Skip to content

feat(designer): Agentic Workflow Designer#18

Merged
DoyleDev merged 4 commits into
fix/cross-model-compatfrom
feat/workflow-designer
Jun 11, 2026
Merged

feat(designer): Agentic Workflow Designer#18
DoyleDev merged 4 commits into
fix/cross-model-compatfrom
feat/workflow-designer

Conversation

@DoyleDev

Copy link
Copy Markdown
Collaborator

Summary

Adds the Agentic Workflow Designer — a visual, node-based canvas (n8n-style) for composing multi-model agentic pipelines, per the engineering spec in docs/specs/agentic-workflow-designer.md (included in this PR).

Stacked on #17 (fix/cross-model-compat) — merge that first; GitHub will retarget this PR to main.

What's in it

Designer UI (src/designer.ts, hand-rolled DOM + SVG — no new deps)

  • Sidebar button above the Profile section (+ Cmd+D) swaps the chat pane for a pannable/zoomable dot-grid canvas
  • Cells: editable name, model picker (all discovered + custom models), per-cell tool subset (built-in + MCP + UC MCP), prompt, live status pill
  • Edges: drag from a cell's output port onto another cell → solid flow edge (run order + output piping); drop on the top port → dashed red feedback edge. Double-click to label; labels become input headers downstream and route names for gates
  • Transcript drawer shows each cell's run live (streamed markdown, tool calls, verdicts)
  • Built-in Spec → Implement → Test → Review template matching the motivating user story

Engine (src/workflow-engine.ts)

  • Sequential scheduler over the flow DAG; labeled multi-input joins (## Input from "spec" sections); fan-out/fan-in
  • Gates: cells with feedback edges must call a generated route_output tool (enum of outgoing edges + end) — works on every tool-capable Gateway model, no JSON-in-prose parsing
  • Feedback loops: re-entry sends only the gate's notes + the cell's previous output (bounded context growth); downstream cells re-open automatically
  • Budgets: 40 inner agent-loop steps / 5 feedback iterations per cell (gatekeeper forces a different route when exhausted) / 25 cell runs global
  • Validation: flow-only cycles rejected, model availability per profile, terminal reachability

Phase 0 refactor (src/agent-runner.ts)

  • resolveModelRouting + executeToolCore + capToolResult extracted from chat.ts so chat and the engine share one implementation; getAllToolDefs(allowlist?) for per-cell narrowing. Chat behavior unchanged.

Persistence: ~/.mason/workflows/<id>.json via 4 new IPC handlers (mirrors chat history; atomic temp+rename writes, id sanitization). Autosave every 10s.

Verified

  • tsc strict typecheck clean
  • ✅ Live end-to-end run: 2-cell feedback loop (Haiku writer → Sonnet critic gate) — critic routed feedback, writer re-ran with it, critic approved and routed end; 4 cell runs, correct statuses/verdicts/transcripts
  • ✅ Template inserts and validates; save → load roundtrip
  • ✅ Chat regression after the Phase 0 refactor: streamed turn returns correctly
  • ✅ Cross-model sweep (81/81) green on the base branch; chat request building untouched here

Test plan

  • npm start → Workflow Designer button above Profile opens the canvas
  • Insert Template → Run with a real project goal in the Spec cell
  • Draw flow + feedback edges by hand; label via double-click; delete via select + Delete
  • Switch profiles with the designer open → unavailable models flagged
  • Confirm chat view: streaming, tools, ask_user, stop button all unchanged

DoyleDev added 4 commits June 11, 2026 11:34
…r.ts

resolveModelRouting (gateway/format resolution incl. tools->Responses
promotion), executeToolCore (headless load_skill/builtin/MCP dispatch),
and capToolResult move to src/agent-runner.ts so the upcoming workflow
engine can reuse them. getAllToolDefs gains an optional allowlist param
(narrowing only) for per-cell tool selection; renderQuestionCard gains
an optional container. Chat behavior unchanged.

Co-authored-by: Isaac
Visual node-based workflow designer (sidebar button above Profile,
Cmd+D). Cells select a model + per-cell tool subset + prompt; flow
edges pipe outputs downstream with labeled multi-input joins; dashed
feedback edges create bounded revision loops driven by a forced
route_output verdict tool on gate cells. Sequential execution through
the existing chat IPC; budgets (40 inner / 5 feedback / 25 global)
guard against runaway loops. Workflows persist to ~/.mason/workflows.
Includes the Spec → Implement → Test → Review template.

Co-authored-by: Isaac
…e pressure

Loops were already bounded (5 revisions per cell, 25 cell runs global,
gatekeeper forces a terminal route on exhaustion) but invisibly so.
Now: feedback-target cells show an editable revision cap (1-20) on the
card; status pills show loop progress (running 3/5); gates see
'revision N of M' annotations on revised inputs plus per-route budget
state and an explicit don't-chase-perfection instruction. Verified
against a critic prompted to never be satisfied: forced to route end
after the cap, 4 cell runs.

Co-authored-by: Isaac
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