Skip to content

feat(workflow): web app + desktop (4/6) — split from #29789#32394

Open
mguttmann wants to merge 4 commits into
anomalyco:devfrom
mguttmann:workflow-split/04-app-desktop
Open

feat(workflow): web app + desktop (4/6) — split from #29789#32394
mguttmann wants to merge 4 commits into
anomalyco:devfrom
mguttmann:workflow-split/04-app-desktop

Conversation

@mguttmann

Copy link
Copy Markdown

Issue for this PR

Relates to #29789 — part 4/6 of splitting that oversized workflow PR. Builds on the TUI PR (#32390 stack).

Type of change

  • New feature

What does this PR do?

Adds the web-app workflow surface (dashboard, run/approval/question dialogs, prompt-input wiring, i18n) at parity with the TUI, plus the desktop change that bundles the opencode server with esbuild instead of the previous virtual-module approach. App side talks to workflows only through the SDK; the desktop change consumes the server as a prebuilt artifact.

How did you verify your code works?

bun turbo typecheck passes (23/23). The app test suites pass locally.

Screenshots / recordings

No visual change beyond the workflow UI already shown in #29789 — this PR moves the web-app side into its own reviewable layer.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Part 4/6 of the #29789 split. Opened together with the rest, so GitHub shows a cumulative diff against dev; the change this layer adds is here: mguttmann/opencode@workflow-split/03-tui...workflow-split/04-app-desktop

mguttmann and others added 4 commits June 15, 2026 07:28
… deps

Bring the workflow ENGINE net-state from the workflow PR head SHA
(d3ebe64) onto dev as a standalone engine-core slice, and modularize the
4810-line workflow.ts into coherent files with a thin barrel that preserves
the full public Workflow surface (no exported symbol dropped).

Modularization (workflow.ts 4810 -> 4147 lines; barrel re-exports all):
- schema.ts: RunID, Info, Source, Definition, Status, LogEntry, AgentRun,
  Run, Event + the row<->schema compile-time assertions.
- errors.ts: the 7 workflow error classes (tags unchanged; HTTP 409 etc).
- types.ts: Start/Wait/Answer/Save inputs, Agent/Tool/Parallel/Pipeline
  types, ContextApi, the service Interface.
- workflow.ts: thin barrel re-exporting the above + the engine internals
  (Service/layer/defaultLayer/node/__testHooks/fmt + all file-scope
  helpers + createContext + persistence). The 5 mutable test-seam `let`s
  and `layer`/`__testHooks` stay co-located (shared closure state cannot be
  split via re-export). Ends with `export * as Workflow from "./workflow"`.

Minimal non-workflow deps brought over (the engine imports these; absent on
dev): core/workflow/sql.ts, session/turn-budget.ts, tool/catalog.ts;
tool/shell.ts reconciled (adds the exported scanCommand the ctx.shell gate
reuses; pure refactor, byte-identical bash behavior).

Surgical reconciles so packages/opencode typechecks (smallest set; no
wholesale file copies, no prompt.ts cascade):
- plugin/src/workflow.ts (new) + plugin/package.json `./workflow` subpath +
  plugin/src/index.ts Hooks.workflow.
- core/v1/config/config.ts: workflows config block.
- session/session.ts: create `directory?` passthrough.
- session/prompt.ts: PromptInput `permissionSessionID`/`turnBudget`/`mcp`.

Migrations/generated files regenerated via `bun script/migration.ts` (node
24) — registers the workflow_run table; schema.gen.ts/migration.gen.ts/
schema.json regenerated, not hand-edited. `--check` clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…andlers + regenerated SDK

Adds the workflow HTTP API group and handlers on the instance httpapi,
registers WorkflowApi + workflowHandlers + Workflow.defaultLayer, and
regenerates the JS SDK (sdk.gen.ts, types.gen.ts) and openapi.json so the
WorkflowLogEntry/WorkflowAgentRun/WorkflowRun types are exposed. Turns the
PR-1 RED SDK-types test green (time fields are plain numbers).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…en dialog size

Brings the TUI workflow surface: dialog-workflow* components, prompt
workflow-autocomplete + ultracode, session route/permission rendering,
keybind/theme/renderer changes, and the plugin TuiDialog "fullscreen" size.

Reconcile (PR-5 -> PR-3): command/index.ts is pulled forward because the TUI
prompt code (prompt/index.tsx, prompt/workflow-autocomplete.ts) has an UNCAST
dependency on the SDK Command.source "workflow" variant, which is derived from
command/index.ts's source schema. test/fixture/tui-plugin.ts is pulled forward
to satisfy the new "fullscreen" TuiDialogStack size. SDK regenerated so
Command.source includes "workflow".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… + desktop sidecar bundling

App: dialog-workflow* components, prompt-input workflow-command/dashboard +
ultracode, notification + i18n (de/en) workflow strings. Consumes the SDK
workflow run events (workflow.run.updated/finished) already exposed since PR-3.

Desktop: esbuild-bundle the opencode server sidecar to a self-contained .mjs
(the engine embeds the TS compiler for static workflow meta extraction, ~30MB),
asarUnpack it + wasm assets, load it via a real file URL in sidecar.ts. Adds the
esbuild devDependency (bun.lock updated with that single edge; version field NOT
downgraded — net-state's 1.17.6 downgrade is base drift and intentionally skipped).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

The search results show that PR #32394 (the current PR) is part of a coordinated 6-part split of #29789. All the related PRs are intentionally separate parts of the same feature split and are not duplicates—they are sequential parts of the workflow feature rollout:

  1. feat(workflow): engine-core (1/6) — modularized workflow engine, split from #29789 #32390 - Engine core (1/6)
  2. feat(workflow): server routes + SDK (2/6) — split from #29789 #32392 - Server routes + SDK (2/6)
  3. feat(workflow): TUI workflow dialogs (3/6) — split from #29789 #32393 - TUI workflow dialogs (3/6)
  4. feat(workflow): web app + desktop (4/6) — split from #29789 #32394 - Web app + desktop (4/6) ← Current PR
  5. feat(workflow): ctx.tool + plugin registration (5/6) — split from #29789 #32395 - ctx.tool + plugin registration (5/6)
  6. docs(workflow): workflows guide (6/6) — split from #29789 #32396 - Workflows guide (6/6)

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