跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    Guan612

    Ai Light

    v0.1.0其他
    @guan612/opencode-ai-light

    OpenCode plugin that forwards session events to AI Light (desktop traffic light widget)

    GitHub 星标

    0

    月装机量

    11

    近 7 天 2

    综合评分SCORE

    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"]
    }

    opencode 启动时会通过内嵌运行时自动加载 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 port
    • AI_LIGHT_URL environment 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:

    1. Add OpenCode to the Tool enum in src-tauri/src/types.rs
    2. Use a dedicated route like /events/opencode to tag sessions correctly

    License

    AGPL-3.0-only