anomalyco / anomalyco/opencode
[FEATURE]: Expose global broadcast events for UI Dialogs and OS Attention notifications to allow cross-plugin monitoring
@kitlangton is already working on this.
Since Jul 23, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Description
Currently, when building a custom plugin to monitor or log notifications, developers can successfully intercept toast notifications by listening to the global tui.toast.show event.
However, there are no equivalent global broadcast events for Modal Dialogs or OS Attention alerts. When custom plugins attempt to intercept these by using patchGlobally on the api.ui or api.attention namespaces, the attempt fails because OpenCode intentionally sandboxes plugins, supplying each one with a unique, isolated api object instance. Modifying this instance only patches the local plugin's API, making it completely blind to actions performed by other plugins (like the official Magic Context plugin).
Impact
Due to this architectural limitation, it is currently impossible for developers to build a reliable, universal "Notification History" plugin. Custom plugins inevitably miss critical events, specifically:
• Modal Dialogs (api.ui.dialog.replace): e.g., Magic Context startup announcements and result dialogs
• OS Attention Notifications (api.attention.notify)
• Audio Alerts (api.attention.soundboard.activate)
Proposed Solution
The OpenCode core SDK should natively broadcast global events for dialogs and attention notifications, exactly like it currently does for tui.toast.show.
Please consider introducing native broadcast events such as:
• tui.dialog.show
• tui.attention.notify
• tui.soundboard.play
This would allow plugins to securely and reliably subscribe to these UI events across all plugin boundaries without resorting to fragile prototype patching or intercepting the internal module cache.`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.