feat(workflow): ctx.tool + plugin registration (5/6) — split from #29789#32395
Open
mguttmann wants to merge 5 commits into
Open
feat(workflow): ctx.tool + plugin registration (5/6) — split from #29789#32395mguttmann wants to merge 5 commits into
mguttmann wants to merge 5 commits into
Conversation
… 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>
6 tasks
3 tasks
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on my search results, the PRs found are all part of the same feature split and not duplicates of PR #32395:
No duplicate PRs found |
This was referenced Jun 15, 2026
…, session/agent/skill integration
Brings the remaining net-state delta: the workflow TOOL (tool/workflow.ts +
workflow.txt) and its registry/task wiring; session integration (system,
prompt, tools, processor, mcp-lazy); agent/agent.ts, skill/index.ts; the core
plugin skill (plugin/skill.ts + workflows-instructions.md) and core v1/session;
acp/service, cli/cmd/run + run/workflow.shared; util/process; opencode/config.json;
and the workflow Layer wiring in effect/app-runtime.ts + storage/schema.ts. The
workflow engine itself (workflow/{workflow,errors,schema,types}.ts) stays at
PR-1's modularized form — its Workflow.* namespace already provides every symbol
the tool/session code imports, so nothing in workflow/ is re-touched here.
Excluded as base drift (0 workflow content, would revert current dev): all
unrelated package.json version bumps, mcp/{catalog,oauth-callback}, plugin/{index,
openai/codex,xai}, server/server.ts, stats/*. The 4 net-state workflow migrations
remain superseded by PR-1's single consolidated migration.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: VasyaYovbak <87126061+VasyaYovbak@users.noreply.github.com>
55e9417 to
d842c21
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Relates to #29789 — part 5/6 of splitting that oversized workflow PR. Builds on the app/desktop PR (#32390 stack).
Type of change
What does this PR do?
Wires workflows into the running session: registers the workflow tool in the tool registry, integrates it with session/agent/skill/command/acp/cli, and adds
ctx.tool(...)(so workflows can call registered tools, including MCP and plugin tools) plus plugin-based workflow registration (workflows can be provided through the plugin system, not only the project workflow directory).How did you verify your code works?
bun turbo typecheckpasses (23/23). The tool + session test suites pass locally (tool/workflow.test.ts92/0).Screenshots / recordings
N/A — server/tool/session code, no UI.
Checklist
Part 5/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/04-app-desktop...workflow-split/05-ctx-tool-plugin