opencode-delegations-sidebar
v0.1.0
Published
opencode TUI plugin that shows sub-agent delegations (subtasks) in the session sidebar.
Maintainers
Readme
opencode-delegations-sidebar
TUI plugin for opencode that adds a Delegations section to the session sidebar, showing every sub-agent (explore, general, etc.) the current session has spawned — active and completed — with a live status indicator and one-click navigation into the child session.
What it looks like
In the right-hand sidebar of a session that has used the task tool:
┌─────────────────────────────┐
│ Delegations │
│ ● explore find TODOs │
│ scan repo for unfinished │
│ ◐ general refactor auth │
│ restructure the auth flow │
│ ✓ general summarize changes│
└─────────────────────────────┘●idle / completed (green)◐busy (yellow)✗retrying (red)○unknown
Clicking (or pressing Enter on) a row navigates into that child session, so you can read its full conversation. Use the normal session switcher to come back to the parent.
The section is hidden automatically when the current session has no delegations, so sessions that never used the task tool look exactly like before.
Install
From a local checkout (development)
Build the plugin first, then point your opencode config at the package directory:
cd opencode-delegations-sidebar
npm install # pulls in solid-js, @opentui/solid, @opencode-ai/plugin
npx bun run build # compiles src/tui.tsx + src/server.ts into dist/// ~/.config/opencode/opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"/absolute/path/to/opencode-delegations-sidebar"
]
}Pointing at the package directory (not a file) is important: the loader reads package.json from that directory to decide which entry to use for the server vs. the TUI. We ship two compiled files:
dist/server.js— a no-opserver()stub. The opencode server loader requires every plugin to default-export aserver()function; this stub satisfies that without doing anything.dist/tui.js— the real TUI plugin. Reached viaexports["./tui"]inpackage.json.
The runtime JSX transform from the opencode binary's bunfig.toml doesn't apply to dynamically-imported plugin files, so we pre-compile with Bun.build using the @opentui/solid/bun-plugin plugin (transforms JSX → createElement calls at build time).
From npm (once published)
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"opencode-delegations-sidebar"
]
}opencode will install the package and its peer dependencies automatically.
How it works
- On every session change, the plugin calls
client.session.childrento list the child sessions (parentID === current) andclient.session.messagesto walk the parent's assistant messages and collect everysubtaskPart (the in-message record thetasktool emits). - Each child session is matched with its
subtaskPart in spawn order. The row shows the agent name, the child session's title, and the task's description (or the first line of its prompt). - Live updates: subscribes to
session.created,session.updated,session.deleted,message.part.updated, andsession.statusand re-fetches as needed. The status dot re-renders on everysession.statusevent for any of the listed children. - Clicking a row calls
api.route.navigate("session", { sessionID: child.id }), which drops you into the child session's normal chat view. Use the session switcher (or your normalgo backkeybind) to return.
The sidebar slot used is sidebar_content with order: 150, so the section appears just below the built-in Context panel and above the MCP/LSP/Todo/Files sections.
Development
cd opencode-delegations-sidebar
npm install
npm run typecheck
npx bun run buildnpm run typecheck—tsc --noEmitagainst the locally installed@opencode-ai/[email protected]and@opencode-ai/[email protected](usesjsxImportSource: "@opentui/solid").npx bun run build— invokesscripts/build.mjswhich callsBun.buildwith the@opentui/solid/bun-pluginplugin, producingdist/tui.js(the actual TUI plugin) anddist/server.js(a no-opserver()stub) with the JSX already transformed tocreateElementcalls.
Peer dependencies
@opencode-ai/plugin >= 1.4.0@opentui/solid >= 0.1.0solid-js >= 1.8.0
These are resolved from opencode's runtime in production. When developing from a local checkout, the plugin's own node_modules provides them so tsc and bun both work standalone.
License
MIT
