Skip to content

Add OpenCode agent support - #18

Open
scross01 wants to merge 6 commits into
no1msd:mainfrom
scross01:opencode
Open

Add OpenCode agent support#18
scross01 wants to merge 6 commits into
no1msd:mainfrom
scross01:opencode

Conversation

@scross01

Copy link
Copy Markdown

Add OpenCode agent support. #9

Extends Séance's agent tracking to OpenCode sessions, matching the existing Claude
Code/Codex/Pi integration pattern.

How it works

OpenCode uses a plugin system rather than CLI hooks. Séance ships a small
TypeScript plugin (plugins/seance-opencode/index.ts) that bridges OpenCode's event
bus to Séance's socket API:

  • session.created → opencode-hook session-start
  • session.status (busy) → opencode-hook prompt-submit
  • tool.execute.before/after → opencode-hook pre-tool-use/post-tool-use
  • session.idle → opencode-hook stop
  • permission.asked → opencode-hook notification

On first launch, Séance auto-installs the plugin to ~/.config/opencode/plugins/ if
the OpenCode config directory exists. Subsequent launches check a version marker
(// @seance-version N) and update if bundled is newer.

Changes

Core (Zig)

  • src/ctl.zig — Added opencode_agent config, cmdOpencodeHook() handler, command
    dispatch, help text
  • src/config.zig — Added opencode_hooks toggle (default: true)
  • src/pane.zig — Added SEANCE_OPENCODE_HOOKS_DISABLED env var injection
  • src/settings.zig — Added settings toggle for OpenCode integration
  • src/app.zig — Auto-install logic: detects ~/.config/opencode/, copies plugin,
    checks/updates version

Plugin (TypeScript)

  • plugins/seance-opencode/index.ts — OpenCode plugin that calls seance ctl
    opencode-hook via Bun shell

Build

  • build.zig — Installs plugin to share/seance/opencode-plugin.ts in AppImage

Docs

  • README.md — Updated agent list, added Agent Integrations section

Testing

Manually tested local AppImage build. Confirmed OpenCode agent status is shown in side bar.

scross01 added 6 commits June 24, 2026 11:49
OPENCODE_SESSION_ID env var was proposed but never shipped.
Session ID is available in event.properties.sessionID for
session.created events.
- Compare bundled version + byte-for-byte content before writing
- Skip write only when version AND content are already identical
- Write to .tmp then rename for atomic swap on failure
- Plugin version is now strictly kept in sync with app
Add opencode wrapper script that survives the agent process (no exec),
providing real PID tracking via SEANCE_OPENCODE_PID and guaranteed
session-end cleanup on agent exit.

Add clear_status_on_end field to AgentConfig (true for all agents,
preserving existing behavior) so the wrapper's session-end hook clears
the sidebar status when opencode exits.
@scross01

scross01 commented Jul 3, 2026

Copy link
Copy Markdown
Author

@no1msd I have additional working updates that add support for KiloCode, and MimoCode which are based on OpenCode, and well as agent support for Mistral Vibe Code if your looking to adding more agents to Seance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant