-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Description
Description
I want to configure notifications on my machine using the example snippet from the docs: https://opencode.ai/docs/plugins/#send-notifications. This seems to work for other people, but I don't get any notifications after the session completes as expected. I've confirmed the syntax is correct and I see the plugin being loaded in the logs: INFO 2025-11-27T22:42:08 +5ms service=plugin path=file:///home/oabdellatif/.config/opencode/plugin/notification.js loading plugin.
After some debugging, what seems to be happening is that the event subscription isn't being created. I added console.log() lines as follows:
export const NotificationPlugin = async ({ project, client, $, directory, worktree }) => {
console.log("Plugin loaded")
return {
event: async ({ event }) => {
console.log("Event received: " + event.type)
// Send notification on session completion
if (event.type === "session.idle") {
await $`wsl-notify-send.exe "Session completed!"`
}
},
}
}
I never see the second log line, which leads me to the above conclusion. After some more back and forth with Big Pickle and adding debug logs, it seems like Plugin.init() is either not being called or there's some caching issue.
OpenCode version
1.0.119
Steps to reproduce
- Copy the plugin to ~/.config/opencode/plugin/notification.js
- Run opencode and start a new session
- Wait for the session to complete
Screenshot and/or share link
No response
Operating System
Ubuntu 24.04 LTS on WSL2
Terminal
VS Code Terminal