GeezerVison is showing github.com — Merge the desktop app companion (X28-X30); README and changelog for X… · rphang/opencode-workflows@aa610c3
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: AGENTS.md +13-3Lines changed: 13 additions & 3 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -19,12 +19,22 @@ the repo). | 19 | 19 | `acorn`, `ajv`, `effect`, all pinned to opencode 2.3.0 (`effect` must stay the exact version | 20 | 20 | `@opencode/codemode` depends on, so both share one copy: 4.1.0). The TUI build adds devDependencies | 21 | 21 | only (`@opentui/core`, `@opentui/solid` 0.8.4 and `solid-js` 1.9.17, opencode 2.3.0's catalog, with | 22 | | - an npm `overrides` for `solid-js` like opencode's own); the TUI provides them at runtime. | | 22 | + an npm `overrides` for `solid-js` like opencode's own); the TUI provides them at runtime. The GUI | | 23 | + build adds devDependencies only (`vite` 7.3.7 and `vite-plugin-solid` 2.11.10, opencode 2.3.0's | | 24 | + catalog, for the `@opencode/plugin/gui/vite` preset); the desktop app provides `solid-js` and the SDK. | 23 | 25 | - The engine (`src/engine.ts` and friends) is host-agnostic. Everything opencode-specific lives in | 24 | 26 | `src/opencode/`. Engine tests use the fake runner in `tests/helpers/`. | 25 | 27 | - The TUI companion (live progress tree) lives in `src/tui/`: `store.ts` is pure and unit-tested; the | 26 | | - `.tsx` files only render. The server entry (`src/index.ts`) must never import it. `dist/tui.js` is | 27 | | - built by `scripts/build-tui.ts` with the host modules external. | | 28 | + `.tsx` files only render. `dist/tui.js` is built by `scripts/build-tui.ts` with the host modules | | 29 | + external. | | 30 | +- The desktop app companion (composer pill, side panel tree, finish notice; experimental GUI API) | | 31 | + lives in `src/gui/`: `model.ts` is pure and unit-tested; `window.tsx` wires the host (all state | | 32 | + inside `setup`, side work in `createKeyed`, no module state) and `panel.tsx` only renders. Each | | 33 | + `.tsx` starts with `/** @jsxImportSource solid-js */` (the root tsconfig's JSX is opentui's). | | 34 | + `dist/gui-experimental.cjs` is built by `scripts/build-gui.ts` (Vite preset, app modules external). | | 35 | +- Both companions share the host-agnostic client logic in `src/client/` (tree store, rows, actions, | | 36 | + resync driver: no Solid, opentui, SDK or node builtins). The server entry (`src/index.ts`) never | | 37 | + imports `src/tui`, `src/gui` or `src/client`; `tests/unit/install-docs.test.ts` checks it. | 28 | 38 | - Every PARITY ID needs a test in `tests/parity/` whose name starts with the ID. | 29 | 39 | - Plain TypeScript, ESM. Bun loads `.ts` directly in development; `npm run build` produces the | 30 | 40 | published `dist/` bundle. | |
Collapse file Copy file name to clipboardExpand all lines: CHANGELOG.md +8-1Lines changed: 8 additions & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -27,12 +27,19 @@ may contain breaking changes. | 27 | 27 | steers, `ctrl+u` sends an urgent message, `ctrl+d` stops, `ctrl+o` opens the child session. | 28 | 28 | - **TUI sidebar section** (X26): a Workflows summary in the session sidebar (foldable when there | 29 | 29 | are more than two runs); a child session shows its parent's runs. | | 30 | +- **Desktop app companion** (experimental, opencode 2.3 GUI plugin API; X28–X30), shipped as | | 31 | + `./gui-experimental` → `dist/gui-experimental.cjs`: a composer pill with the session's active | | 32 | + runs (warning when paused, danger when an agent failed), the live progress tree as a side panel | | 33 | + (open, pause/resume, stop, message, urgent message; this session or the whole project), and one | | 34 | + system notification per finished run across windows. The plugin must be listed in | | 35 | + `opencode.json(c)`; build-only devDependencies `vite` and `vite-plugin-solid` were added. | 30 | 36 |
| 31 | 37 | ### Fixed | 32 | 38 |
| 33 | 39 | - Failed agents report opencode 2.3's actual error instead of "agent session failed (terminal error)". | 34 | 40 | - After an urgent message whose follow-up turn produced no text, the result no longer falls back to | 35 | 41 | the cut-off text of the interrupted step. | | 42 | +- The tree's resync driver no longer updates a disposed view when a pending `list` answers. | 36 | 43 | - TUI cold start on opencode 2.3 (X27): the tree retries its first list while plugins load and | 37 | 44 | starts over on `plugin.updated`, instead of staying empty until a run starts. | 38 | 45 |
| @@ -44,7 +51,7 @@ may contain breaking changes. | 44 | 51 | never prompts: only allow rules and saved approvals admit it. | 45 | 52 | - TUI internals: global commands are registered at setup, `setup` is typed, the 500 ms target | 46 | 53 | poll is a reactive effect, and the host-agnostic tree logic lives in `src/client/` (shared with | 47 | | - the upcoming GUI part; no `process` reference, so it runs in a browser). | | 54 | + the desktop companion; no `process` reference, so it runs in a browser). | 48 | 55 |
| 49 | 56 | - **Requires opencode 2.3.0** (was 2.0.15). `@opencode/*` 2.3.0, `effect` 4.1.0 (the version | 50 | 57 | codemode 2.3.0 needs; older pins crash every run), and the TUI is built with OpenTUI 0.8.4 and | |
Collapse file Copy file name to clipboardExpand all lines: README.md +38-5Lines changed: 38 additions & 5 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -103,6 +103,8 @@ run (6 agents, under a minute) is in [`demo/DEMO-OUTPUT.md`](demo/DEMO-OUTPUT.md | 103 | 103 | - **Live progress tree (extension, TUI).** `ctrl+x o` opens a live tree of the session's runs: | 104 | 104 | phases with their model labels, every agent with its status, the model it runs on, tokens, | 105 | 105 | elapsed time and what it is doing right now. Enter opens an agent's session, `x` stops, `p` pauses, `m` messages it. | | 106 | + In the desktop app (experimental), a composer pill and a side panel show the same tree | | 107 | + ([Desktop app](#desktop-app-experimental)). | 106 | 108 | - **The model each agent really ran on (extension).** Every agent records its actual model as | 107 | 109 | `provider/model#variant` (from the script's `model`, else the parent session's model, plus the | 108 | 110 | `effort` variant). It is shown in the tree, in `/workflows <runId>` and `workflow_control` status, | @@ -111,9 +113,10 @@ run (6 agents, under a minute) is in [`demo/DEMO-OUTPUT.md`](demo/DEMO-OUTPUT.md | 111 | 113 | - **Safe by default.** Workflows start only when you opt in. Scripts run in a sandbox with no | 112 | 114 | filesystem, network or shell. Agents inherit your permission rules and never get more. | 113 | 115 | - **Tested for parity.** 60 behaviors are each tracked against Claude Code in | 114 | | - [`docs/PARITY.md`](docs/PARITY.md), and each has at least one test. The 21 extensions beyond | 115 | | - Claude Code (`X01`–`X21`: steering, the live progress tree, per-agent models, the per-agent | 116 | | - failure summary and outputs) are specified and tested there the same way. | | 116 | + [`docs/PARITY.md`](docs/PARITY.md), and each has at least one test. The 30 extensions beyond | | 117 | + Claude Code (`X01`–`X30`: steering, the live progress tree, per-agent models, the per-agent | | 118 | + failure summary and outputs, idle-boundary steering and schema nudges, the freeform | | 119 | + `workflow_script` tool, the TUI agent dialog and sidebar, and the desktop app companion) are specified and tested there the same way. | 117 | 120 |
| 118 | 121 | ## Requirements | 119 | 122 |
| @@ -444,6 +447,34 @@ curl -u opencode:$OPENCODE_PASSWORD -H "content-type: application/json" \ | 444 | 447 | -d '{"input":{"all":true}}' http://127.0.0.1:<port>/api/rpc/dynamic-workflows/list | 445 | 448 | ``` | 446 | 449 |
| | 450 | +### Desktop app (experimental) | | 451 | + | | 452 | +opencode's desktop app (2.3) can load a plugin's GUI part, and this plugin ships one | | 453 | +(`dist/gui-experimental.cjs`, the `./gui-experimental` export). opencode marks this plugin API as | | 454 | +experimental, and this part has not been checked in a real desktop app yet. | | 455 | + | | 456 | +- **Composer pill.** While a run of the session is active, a pill above the composer shows | | 457 | + `wf <done>/<total> · <tokens> · $<cost>` (`+n` when more runs are active). It turns orange when a | | 458 | + run is paused or has warnings, and red when a run has an error or a failed agent. Click it for one | | 459 | + row per active run; a row opens the tree on that run. | | 460 | +- **Tree panel.** "Workflows: toggle the live progress tree" in the command palette (or `/wf`, or the | | 461 | + side panel's `+` menu) opens the tree in the side panel. It shows the same runs, phases and agents as | | 462 | + the TUI tree, with buttons on each row: fold, open the agent's (or the run's) session in a tab, | | 463 | + pause/resume the run, stop (after a confirmation), message and urgent message (see | | 464 | + [Steering](#steering-a-running-agent)). A switch at the top shows every run of the project instead | | 465 | + of this session's. | | 466 | +- **Notifications.** When a run of a session open in a tab finishes, the app sends a system | | 467 | + notification under your Agent (or, for a failed run, Errors) notification settings. Clicking it | | 468 | + opens the session. If none was shown (for example because the app has focus), you get a toast. | | 469 | +- From a workflow agent's own tab, the pill and the tree show the parent's run. | | 470 | + | | 471 | +The app loads the GUI part for the plugins of its own server: list the plugin in `plugins` in | | 472 | +`opencode.json(c)` and install it from npm or a built directory (see | | 473 | +[Install](docs/INSTALL.md#the-desktop-app-part-experimental)); a single-file loader has no GUI part. | | 474 | +The GUI then talks to the server plugin through its `dynamic-workflows` RPC on each session's own | | 475 | +server. If a server runs no copy of the plugin (or an older one), the pill stays hidden there and the | | 476 | +panel says the workflows are not available. | | 477 | + | 447 | 478 | ### Saved workflows | 448 | 479 |
| 449 | 480 | `save` writes the run's script to one of two places: | @@ -524,8 +555,10 @@ that check it: | 524 | 555 | | ADAPTED | 1 | Same purpose, reached another way | | 525 | 556 | | N/A | 1 | Cannot be done as an opencode plugin | | 526 | 557 |
| 527 | | -The same file specifies the 21 extensions (status `EXT`, `X01`–`X21`): steering, the live progress | 528 | | -tree and its RPC, the per-agent model display, and the per-agent failure summary and outputs. | | 558 | +The same file specifies the 30 extensions (status `EXT`, `X01`–`X30`): steering (including the | | 559 | +opencode 2.3 idle-boundary flush and schema nudges), the live progress tree and its RPC, the | | 560 | +per-agent model display, the per-agent failure summary and outputs, the freeform `workflow_script` | | 561 | +tool, the TUI agent dialog and sidebar, and the desktop app companion. | 529 | 562 |
| 530 | 563 | Most of the gaps come from one limit of opencode's plugin API: **a plugin cannot create a child | 531 | 564 | session with a `parentID`**. So workflow agents aren't nested under your session in the UI, and | |
Collapse file Copy file name to clipboardExpand all lines: docs/INSTALL.md +16Lines changed: 16 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -200,3 +200,19 @@ or `<directory>/tui`), and the TUI loads it for every active server plugin that | 200 | 200 |
| 201 | 201 | `dist/tui.js` imports `solid-js`, `@opentui/*` and `@opencode/plugin/tui` without bundling them: the | 202 | 202 | TUI provides its own copies at runtime, so the package has no new dependencies. | | 203 | + | | 204 | +### The desktop app part (experimental) | | 205 | + | | 206 | +The desktop app resolves a plugin's GUI entry the same way (`Host.resolve` → `gui`: the | | 207 | +`./gui-experimental` export, or `gui-experimental.cjs` at the root of a directory without `exports`), | | 208 | +and loads it for every plugin listed in `plugins`. opencode marks this plugin API as experimental: | | 209 | + | | 210 | +| Install | GUI entry | Pill, tree panel, finish notice | | | 211 | +|---|---|---| | | 212 | +| npm package (`plugins` entry or `opencode plugin add`) | `exports["./gui-experimental"]` → `dist/gui-experimental.cjs`, one CommonJS file | yes (not live-verified) | | | 213 | +| Directory entry (`file:///…/opencode-workflows`) | the same export (build first) | yes (not live-verified) | | | 214 | +| Loader file (`plugins/workflows.js`) | none | no | | | 215 | + | | 216 | +`dist/gui-experimental.cjs` is built with opencode's Vite preset (`@opencode/plugin/gui/vite`) and | | 217 | +requires only modules the app provides (`solid-js`, `solid-js/web`, `@opencode/plugin/gui`); the | | 218 | +shared client logic is bundled in. |
Collapse file Copy file name to clipboardExpand all lines: docs/OPENCODE-API-NOTES.md +9Lines changed: 9 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -70,6 +70,15 @@ the 2.3.0 packages and `tsc` is clean against their types. | 70 | 70 | footer `actions` (#53009); a `sidebar.content` slot `{sessionID}`; a slot rendering a bare string | 71 | 71 | throws. OpenTUI 0.8 still JSX-compiles only files outside `node_modules`, so `dist/tui.js` stays | 72 | 72 | precompiled. GUI (desktop/web app) plugins are new and experimental (`./gui-experimental` export). | | 73 | +- **GUI entry resolution:** `Host.resolve(...).gui` is the package's `./gui-experimental` export (or | | 74 | + `gui-experimental.cjs`/`.js` at the root of a directory without `exports`), and only a `.cjs`/`.js` | | 75 | + file counts: the app evaluates it as CommonJS text (`new Function("require", "module", "exports", | | 76 | + code)`) in each window and in its main process (window-only modules such as `solid-js` are inert | | 77 | + placeholders there). Its default export must be `Plugin.define({ os?, i18n?, stores?, setup?, main? })` | | 78 | + with a setup; it may require only the modules the preset lists (`@opencode/plugin/gui/vite`). The | | 79 | + app's main process lists the plugins of its own server only; a window `setup` is synchronous, and | | 80 | + `ctx.client` is that server's client, so calls for a session go through `ctx.servers.get(id).client`. | | 81 | + RPC `events.on` does not reconnect after its stream ends. | 73 | 82 |
| 74 | 83 | ## Session API (`ctx.session`) | 75 | 84 |
| |
Collapse file Copy file name to clipboardExpand all lines: docs/PARITY.md +8-1Lines changed: 8 additions & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -147,10 +147,13 @@ Design: [`docs/design/steering-and-live-tree.md`](design/steering-and-live-tree. | 147 | 147 | | X25 | TUI agent dialog (`<leader>j`, palette "Workflows: agents (steer, stop, open)"): one searchable `ui.dialog.select` of the running and queued agents of the runs the tree shows (newest active run first, then by index), titled `#i label`, described `status · phase · model`, grouped by workflow name, starting on the agent selected in the panel. Search: `#3` or `3` lists that index first, then labels starting with the query, then labels, phases, workflow names and run ids containing it. Enter steers the agent (the `m` prompt); footer actions `ctrl+u` urgent steer (`M`), `ctrl+d` stop after a confirm (`x`) and `ctrl+o` open its session (a tab when tabs are on); `ctrl+n`/`ctrl+p` stay the list's own keys. Every action re-reads the agent's current row, so an agent that finished meanwhile gets the panel's toast instead, and one no longer listed a toast. The prompt or confirm an action opens replaces the dialog | EXT (not live-verified on 2.3.0) | `tui-client.test.ts` "X25 …" ×5 | | 148 | 148 | | X26 | TUI sidebar (`sidebar.content` slot, after opencode's own sections): hidden when the session has no runs; a `Workflows` header with a collapse toggle only when there are more than two runs (the state is kept in the plugin's durable `storage.store`; collapsed, the header says `(1 running · $0.42)`: running and paused counts, or `n runs`, and the session's total cost); then up to 3 runs, active newest first, then the newest finished, then `+n more`. Each run: a dot colored by status, the name (≤ 24 cells), `<done>/<total>`, and a muted line: `[paused · ]<phase> · <n> running · <tokens> · $<cost>` while active (the last phase with running agents, else the first unfinished one), `<status> · <tokens> · $<cost>` once finished. Clicking a run opens the panel with that run selected and unfolded. A workflow child session's sidebar shows its parent's runs (the same mapping as the footer) | EXT (not live-verified on 2.3.0) | `tui-client.test.ts` "X26 …" ×3 | | 149 | 149 | | X27 | TUI cold start: on opencode 2.3 `rpc.call` no longer waits for plugins to load, so the tree's first `list` can fail with `rpc.unavailable`. A `list` that throws is retried after 250, 500, 1000, 2000 and 4000 ms, then the tree gives up and says `workflows RPC unavailable (…); use /workflows` (`workflows list failed (…)` for another error). While it retries an unavailable RPC the panel only says `loading…`; another error is shown with `(retrying)`. The attempts reset on a successful list, on a target change (viewed session, scope) and when the host reports `plugin.updated`; a `delta` from the target Location while the tree is not ready lists again at once. A `list` answered `{ok:false}` is shown, not retried. The driver is host-agnostic (`src/client/sync.ts`) | EXT (not live-verified on 2.3.0) | `tui-client.test.ts` "X27 …" ×7<br>unit `client.test.ts` | | | 150 | +| X28 | Desktop app composer pill (`./gui-experimental` entry, `ComposerPill`): shown above a session's composer only while that session has an active run and the `dynamic-workflows` RPC of the session's server answered; label `wf <done>/<total> · <tokens> · $<cost>` of the newest active run (` +n` for more, the TUI footer's parts), its title (accessible name and menu heading) `Workflow <name>` (`Workflow <name> ‖ paused`); tone `danger` when an active run has an error or a failed agent, else `warning` when paused or with warnings; one menu row per active run (newest first, detail `<done>/<total> · <tokens> · $<cost>`) that opens the side panel with that run selected and unfolded. A workflow child's tab targets its parent session and the parent's Location (X15's rule). One sync (`TreeSync`, X27) per server and Location that an open tab needs, pruned when tabs close; calls go to the session's own server (`ctx.servers.get(id).client`), one event subscription per server, subscribed again on reconnect or a new client, with a resync every 15 s while a run is active. On a server whose plugin is absent, disabled or older, `list` fails: the pill stays hidden and the panel says why in one line; it retries on a routed-session change, a reconnect, `plugin.updated` or any delta. Missing fields read as defaults | EXT (not live-verified: experimental GUI API, opencode 2.3) | `gui.test.ts` "X28 …" ×7<br>unit `install-docs.test.ts` (bundle) | | | 151 | +| X29 | Desktop app side panel `tree` (`Panel`, side region, `narrow` width, a mobile view; key `<plugin id>:tree`): opened by the command "Workflows: toggle the live progress tree" (also `/wf`), the side panel `+` menu, or a pill row. Rows from the TUI's `rowsFor` (run → phases → agents) with a status glyph, title and a muted detail line (status, counts, tokens, cost, elapsed, model, activity, messages, run id); icon buttons dispatch exactly `actionFor(row, key)`, each shown only when its action applies: fold (run, phase), open (an agent's or the run's session in a tab, not the one the panel is next to), pause/resume (run rows), stop (after a `danger` confirm), message and urgent message (`dialogs.prompt`); info and `control` answers as toasts. A switch shows this session's runs or every run of the project. Fold, scope and selection are kept per tab (session key), pruned when the tab closes | EXT (not live-verified: experimental GUI API, opencode 2.3) | `gui.test.ts` "X29 …" ×6 | | | 152 | +| X30 | Desktop app finish notice: when a run whose parent session is open in a tab (a workflow child's tab counts for its parent) finishes, `attention.notify({title: "Workflow <name> <status>", message: "<n> agents · <tokens> tokens · $<cost> · <time>", variant: "error" for failed else "default", session: {server, id: parent}, id: "dynamic-workflows:<server>:<runId>"})`: the user's Agent or Errors notification settings apply, a click opens the parent session, and the id sends it once across the app's windows. When no system notification was shown, a toast instead, only in the focused window or one showing that session | EXT (not live-verified: experimental GUI API, opencode 2.3) | `gui.test.ts` "X30 …" ×4 | | 150 | 153 |
| 151 | 154 | ## Test evidence | 152 | 155 |
| 153 | | -`npm run test:parity` (`bun test tests/parity`) runs 359 tests in 15 files, and all pass. They | | 156 | +`npm run test:parity` (`bun test tests/parity`) runs 376 tests in 16 files, and all pass. They | 154 | 157 | enter at the highest level possible: the plugin's `setup()` over a fake opencode v2 Context | 155 | 158 | (`tests/helpers/plugin-harness.ts`), then the `workflow` and `workflow_control` tools | 156 | 159 | (`execute`), the slash commands, and the `<task-notification>` delivered through | @@ -173,6 +176,10 @@ enter at the highest level possible: the plugin's `setup()` over a fake opencode | 173 | 176 | `src/client/tree.ts`) in `tui.test.ts`, and X25–X27 the agent dialog, sidebar and resync helpers | 174 | 177 | (`src/client/tree.ts`, `src/client/sync.ts` over a fake RPC, `tests/helpers/fake-tree-rpc.ts`) in | 175 | 178 | `tui-client.test.ts`; the Solid view itself is checked live (docs/E2E.md "TUI live check"). | | 179 | +- The desktop app rows X28–X30 test the GUI companion's pure model (`src/gui/model.ts`: pill view, | | 180 | + per-Location sync map, row buttons against `actionFor`, the finish notice plan) in `gui.test.ts`; | | 181 | + `tests/unit/install-docs.test.ts` builds `dist/gui-experimental.cjs` and evaluates it the way the | | 182 | + app does. The window code itself has not been run in a real desktop app yet. | 176 | 183 | - The doc examples run verbatim in `doc-examples.test.ts`: the `audit-routes` script, the | 177 | 184 | bundled `/deep-research`, and the resume case where A, B (fails), C and D start in that order, | 178 | 185 | in `runs-resume.test.ts`. | |
|