feat(orchestration): renderer→main run/taskCreate preload binding (#15) - #19
Merged
Merged
Conversation
Add a `window.api.orchestration` preload binding exposing the already-registered `orchestration.run` and `orchestration.taskCreate` RPC methods to the renderer, so a recipe director (and any renderer-side trigger) can start a coordinator run or create a task from the app — today these are CLI-only. The binding routes through the existing `runtime.call` channel (desktop unwraps the `runtime:call` IPC envelope; web reuses `callRuntimeResult`), so it works for local and remote/SSH runtimes alike with no new main-process handler. A shared `orchestration-binding.ts` holds the renderer-facing param/return contract, mirroring the RPC shapes (incl. F1 worktree/target-key handling and slice-1 worktreeBacked/workerAgent pass-throughs) without importing main internals. Additive only: no existing behavior changes and nothing in the UI calls it yet (that's the recipe backend, #9). Pure plumbing, so no experimentalOrchestrators gate is needed. Does not touch coordinator.ts or the orchestration DB. Test: web preload parity tests assert the binding forwards run/taskCreate params (including worktree-backed and callerTerminalHandle pass-throughs) verbatim to the runtime method and unwraps the result, and surfaces runtime failures. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
Review panel verdict — nits-only (ship it)Three independent adversarial lenses (type-faithfulness · lane/IPC/SSH · test-honesty) + synthesis. 0 blockers, 0 should-fixes, 9 nits. Core contract verified correct on both preload surfaces: verbatim param pass-through, Nits (optional, cheap)
Over-flagged + dropped on review: the Recommendation: approve. Optionally fold in the desktop-preload test (#1) + the two trivial test hardenings (#3, #4) first. |
This was referenced Jun 24, 2026
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.
What
Exposes the already-registered
orchestration.runandorchestration.taskCreateRPC methods to the renderer through a newwindow.api.orchestrationpreload binding. Today these are CLI-only (the sole caller issrc/cli/handlers/orchestration.ts) and there is nowindow.api.orchestrationbinding — this is F4 (#15), the plumbing that lets a recipe director (and any renderer-side trigger) start a coordinator run or create a task from the app.How
src/shared/orchestration-binding.tsdefines the renderer-facing param/return types (OrchestrationRunParams/Result,OrchestrationTaskCreateParams/Result,OrchestrationTask) plus the RPC method-name constants. It mirrors the RPC shapes — including F1'sworktree/target-key handling and slice-1'sworktreeBacked/workerAgentoptions — and passes them through verbatim (the semantics live in the main handler). Lives insharedso preload, renderer, and any future client share one contract without importing main internals across the layer boundary.orchestration: OrchestrationPreloadApiadded toPreloadApiinsrc/preload/api-types.ts.src/preload/index.ts) — orchestration methods are runtime RPC methods (not dedicated IPC channels), so the binding forwards through the existingruntime:callenvelope and unwraps it. No new main-process handler.src/renderer/src/web/web-preload-api.ts) — reusescallRuntimeResult, the same unwrap path every other runtime-backed namespace uses.Routing through
runtime.callmeans the binding is SSH/remote-safe (the renderer talks to main/host over the same channel for local and paired runtimes alike).Scope / safety
experimentalOrchestratorsgate is needed.coordinator.tsor the orchestration DB (F2 slice 2 owns those)..ts, not.d.ts.Test evidence
New
web orchestration preload APIblock inweb-preload-api.test.ts(mocks the IPC/runtime boundary):orchestration.runforwards all params (incl.worktree/worktreeBacked/workerAgent) verbatim and unwraps{ runId, status }.orchestration.taskCreateforwards all params (incl.callerTerminalHandle) verbatim and unwraps{ task }.ok: falsesurfaces as a rejected promise.Gates run locally, all green:
pnpm run typecheck(node + cli + web) ✓vitest run web-preload-api.test.ts→ 54 passed (3 new) ✓vitest runorchestration RPC registry → 99 passed ✓ (asserts no behavior change)oxlinton changed files ✓pnpm run build:electron-vite✓(One pre-existing
switch-exhaustivenesserror intask-page-github-work-item-status.ts— unrelated, not in this diff.)🤖 Generated with Claude Code