@guan612/opencode-ai-lightOpenCode plugin that forwards session events to AI Light (desktop traffic light widget)
0
11
近 7 天 2
23.5
生态多维模型
2 个月前
2026-06-18
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@guan612/opencode-ai-light@0.1.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@guan612/opencode-ai-light@0.1.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @guan612/opencode-ai-lightopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
OpenCode plugin that forwards session events to AI Light — the desktop traffic light widget for monitoring AI coding assistants.
When OpenCode starts a session, submits a prompt, requests permission, or completes a task, this plugin sends real-time status updates to AI Light so you can see your OpenCode sessions alongside Claude Code and Codex at a glance.
Installation
Add the plugin to your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@guan612/opencode-ai-light"]
}
OpenCode installs the package automatically at startup using Bun. Restart OpenCode and the plugin will connect to AI Light automatically.
OpenCode loads plugins at startup. Quit and reopen OpenCode after changing this package or your opencode.json plugin list.
Configuration
No manual configuration needed. The plugin auto-discovers AI Light by reading:
~/.ai_light/runtime.json— for the local AI Light HTTP portAI_LIGHT_URLenvironment variable — overrides auto-discovery if set
Logs are written to ~/.ai_light/opencode-plugin.log.
Event Mapping
| OpenCode Event | AI Light Event | Status |
|---|---|---|
session.created |
session-start |
Idle (green) |
session.status (busy/retry) |
prompt-submit |
Working (yellow) |
session.status (idle) |
stop |
Done (green) |
session.idle |
stop |
Done (green) |
session.error |
notification |
Error (red) |
permission.asked |
permission-request |
Error (red) |
session.deleted |
session-end |
Removed |
session.updated is intentionally ignored because OpenCode also emits it for background session saves after completion. Treating it as work would turn the light yellow again after a task is done.
Completed assistant message.updated events are also ignored because they can occur while OpenCode is still busy, such as before a tool call or follow-up assistant output.
AI Light Integration Note
OpenCode sessions appear as Claude Code tool type in AI Light's UI (the upstream AI Light project uses a hardcoded tool label). To show them as OpenCode, fork ai-light and:
- Add
OpenCodeto theToolenum insrc-tauri/src/types.rs - Use a dedicated route like
/events/opencodeto tag sessions correctly
License
AGPL-3.0-only