dsh-workflow-canvas 0.2.1 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-workflow-canvas",
3
- "version": "0.2.1",
3
+ "version": "0.2.4",
4
4
  "description": "A visual subagent-workflow canvas for DeepSeek Harness, docked in the sidebar.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -9,8 +9,9 @@ A canvas is a DAG of agents the user can see and edit.
9
9
 
10
10
  ## Node kinds
11
11
 
12
- - **Lead** (blue top bar) — performed by the conversation itself, never spawned. The entry Lead holds the overall task; any other Lead node holds a role and pauses the run so you can do that step.
13
- - **Subagent** (green top bar) — spawned as a child agent with its own model, reasoning effort, capability scope, fallback model and memory switch.
12
+ - **Entry Lead** (`id: "lead"`, blue top bar) — created automatically by `canvas_generate` to hold the overall `task`. **Do not author a separate entry Lead node** — wire first-wave nodes directly from `from: "lead"`. The entry Lead **never** triggers `need-lead` (it does not pause before Wave 1).
13
+ - **Downstream Lead** (`kind: "lead"`, blue top bar) — performed by the conversation itself, never spawned. Any added non-entry Lead node holds a `role` and pauses the run (`status: "need-lead"`) so you can decide, review, or integrate before continuing.
14
+ - **Subagent** (`kind: "agent"`, green top bar) — spawned as a child agent with its own model, reasoning effort, capability scope, fallback model and memory switch. Wire every subagent's output into a downstream node or final Lead so nothing becomes a dead end.
14
15
 
15
16
  ## Which tool to call
16
17
 
@@ -48,20 +49,37 @@ Links only join matching types. Nodes the entry Lead cannot reach are skipped at
48
49
 
49
50
  ## Running
50
51
 
51
- 1. The canvas must be enabled (the pill over the canvas); `canvas_workflow` refuses while it is disabled.
52
+ 1. The canvas must be enabled (the pill over the canvas); `canvas_workflow` refuses while it is disabled. While enabled, the host automatically injects a per-session runtime context reminder on each turn.
52
53
  2. You may pass `task` to override the entry Lead's task (handy when reusing a preset), or `reset: true` to discard a paused run and start from scratch.
53
- 3. Subagent nodes run in parallel waves of up to four; the run stops at every Lead node and returns `status: "need-lead"`.
54
- 4. Do that Lead step yourself, then call `canvas_workflow` again with `leadResult` — do not spawn an agent for it.
55
- 5. When a `session-ref` link points into that Lead node the result lists `sessions: [{ label, childId }]`; you may message those agents directly to follow up.
54
+ 3. Subagent nodes run in a dynamic concurrency pool of up to four: as soon as any node finishes, newly unblocked downstream subagents start immediately without waiting for slower siblings.
55
+ 4. Intermediate downstream Lead nodes pause the run (`status: "need-lead"`). Complete that Lead step yourself, then call `canvas_workflow` again with `leadResult` to resume downstream nodes — do not spawn an agent for it.
56
+ 5. A **terminal** Lead node (zero remaining downstream nodes) finishes directly with `status: "done"` and `finalLead`: complete the review/summary and reply directly to the user — no extra `canvas_workflow` callback is needed.
57
+ 6. When a `session-ref` link points into that Lead node the result lists `sessions: [{ label, childId }]`; you may message those agents directly to follow up.
58
+ 7. Only assign image/visual inspection roles to models that declare image input support.
56
59
 
57
- ## Failures
60
+ ## Failures & verification iron rule
58
61
 
59
62
  A failing node (unknown model, provider error, a stop reason other than completed) does not abort the run. Its result carries the reason, a node with `fallbackModel` is retried once on that model, and unrecovered failures are listed in `failed: [{ id, label, reason }]` while downstream nodes are warned not to treat the error as valid output. Failed nodes show red in the canvas.
60
63
 
64
+ If a subagent finishes with no prose and no structured JSON (`[completed]` / `[no-output]`), it is flagged in `emptyOutputs: [{ id, label }]`. **Never claim a workflow or step succeeded while `failed`, `emptyOutputs`, or `【未完全交付】` is present** — always verify the declared files on disk or follow up with that subagent first.
65
+
66
+ ## Designing a good workflow (checklist)
67
+
68
+ 1. **Pre-flight before `canvas_workflow`**:
69
+ - Never author a duplicate entry Lead — wire first-wave nodes from `from: "lead"`.
70
+ - Always check `warnings` returned by `canvas_generate` / `canvas_patch` / `canvas_inspect` and fix dead-end subagents (missing out-links) or unreachable nodes before running.
71
+ - Give parallel subagents **strictly disjoint file/directory ownership** in their `role` so two agents never overwrite the same file.
72
+ 2. **When to add an intermediate Lead gate**:
73
+ - **Add an intermediate Lead** when scope/architecture is not yet locked down (need human/Lead sign-off before coding), or when downstream steps heavily depend on foundation artifacts (e.g. verify scaffold/assets actually exist and pass checks before building levels on top).
74
+ - **End-only Lead is fine** when all shared contracts (file paths, signals, APIs, groups) are already frozen upfront in the entry `task` and you want uninterrupted parallel execution into a final integration/review Lead.
75
+ 3. **When to use `session-ref` (purple links)**:
76
+ - **Subagent → Subagent**: when an implementer should continue a codebase scanner's warm session instead of re-reading the repo from scratch.
77
+ - **Subagent → final Lead**: wire key implementation nodes into the final review/integration Lead with `session-ref` so if review finds bugs, you can message the original author's warm session to fix them in place.
78
+
61
79
  ## Memory
62
80
 
63
81
  `keepSession: true` reuses that node's child session — across runs, and after a restart through a persisted id (cold resume). If the Host refuses the resume the record is dropped and the node starts fresh.
64
82
 
65
83
  ## Style
66
84
 
67
- Keep labels short and distinct; ids must be unique even when labels repeat. Describe each step by its outcome, not by the tool it uses.
85
+ Keep labels short and distinct; ids must be unique even when labels repeat. Describe each step by its outcome and exact file ownership, not by internal tool names.