You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@opencode-ai/plugin used for plugins is using @opencode-ai/sdk but with latest changes in v1.1.x opencode now uses @opencode-ai/sdk/v2.
E.g., event.type === "permission.asked" will give type errors when using the @opencode-ai/plugin package.
My simple plugin with hacky cast workaround:
importtype{Plugin}from"@opencode-ai/plugin";importtype{Event,EventSessionStatus}from"@opencode-ai/sdk/v2";constNOTIFY_SCRIPT="~/.claude/hooks/notify.sh";constDELAY_MS=15_000;// 15 secondsexportconstNotificationPlugin: Plugin=async({ $ })=>{lettimeout: ReturnType<typeofsetTimeout>|null=null;constclearPendingTimeout=()=>{if(timeout){clearTimeout(timeout);timeout=null;}};constscheduleNotification=(message: string)=>{clearPendingTimeout();timeout=setTimeout(async()=>{await$`echo '{"message": "${message}"}' | ${NOTIFY_SCRIPT}`.quiet().nothrow();timeout=null;},DELAY_MS);};return{event: async({event: _event})=>{// HACK: cast to v2 Event type (Plugin package not yet updated for permission.asked)constevent=_eventasEvent;// Cancel on any user activityif(// Session became busy(event.type==="session.status"&&(eventasEventSessionStatus).properties.status.type==="busy")||// User replied to permission promptevent.type==="permission.replied"){clearPendingTimeout();return;}// Schedule delayed notification on idle or permission requestif(event.type==="session.idle"){scheduleNotification("OpenCode finished");}elseif(event.type==="permission.asked"){scheduleNotification("OpenCode awaiting permission");}},};};
I made a PR to address this #8380. This is a pretty massive gap for the plugin ecosystem, if I'm being honest. It bit me multiple times when working on my own plugins.
Activity
Y4tacker commentedon Jan 10, 2026
The world really is just one big shitshow.Can we stop changing the event types all the time?
eXamadeus commentedon Jan 18, 2026
I made a PR to address this #8380. This is a pretty massive gap for the plugin ecosystem, if I'm being honest. It bit me multiple times when working on my own plugins.
eXamadeus commentedon Mar 26, 2026
Still relevant, but fix hasn't been reviewed yet.
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.