dsh-workflow-canvas 1.5.0 → 1.6.0
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/README.md +7 -5
- package/README.zh.md +7 -5
- package/client.js +1371 -288
- package/docs/DETAIL.md +24 -12
- package/docs/MECHANISM.md +15 -14
- package/docs/MECHANISM.zh.md +15 -14
- package/index.js +795 -81
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +4 -3
- package/skills/workflow-canvas/SKILL.md +8 -7
- package/docs/images/add-node-shift-a.gif +0 -0
- package/docs/images/canvas-demo-zh.png +0 -0
- package/docs/images/canvas-demo.png +0 -0
- package/docs/images/chat-patch-canvas.gif +0 -0
- package/docs/images/condition-switch-run.gif +0 -0
- package/docs/images/connect-and-cut.gif +0 -0
- package/docs/images/lead-pause-resume.gif +0 -0
- package/docs/images/node-condition-en.png +0 -0
- package/docs/images/node-condition-zh.png +0 -0
- package/docs/images/node-config.gif +0 -0
- package/docs/images/node-entry-en.png +0 -0
- package/docs/images/node-entry-zh.png +0 -0
- package/docs/images/node-lead-en.png +0 -0
- package/docs/images/node-lead-zh.png +0 -0
- package/docs/images/node-subagent-en.png +0 -0
- package/docs/images/node-subagent-zh.png +0 -0
- package/docs/images/parallel-and-inspect.gif +0 -0
- package/docs/images/retry-loop-en.png +0 -0
- package/docs/images/retry-loop-zh.png +0 -0
package/docs/DETAIL.md
CHANGED
|
@@ -42,16 +42,20 @@ are performed by the conversation itself.
|
|
|
42
42
|
subagent upstream, or dangling dead-end subagents) are drawn dashed and skipped
|
|
43
43
|
at run time.
|
|
44
44
|
- **Horizontal / vertical layout & slim narrow-sidebar UI**: toggle `⇄ Horiz` /
|
|
45
|
-
`⇅ Vert` (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
`⇅ Vert` (remembered globally for new sessions, saved with custom presets and
|
|
46
|
+
exported JSON, and undoable; top-in / bottom-out curves + condition `Out R / Out L`);
|
|
47
|
+
toolbar provides compact `↶` / `↷` Undo/Redo buttons; right-click any node,
|
|
48
|
+
edge, or blank canvas for context actions (insert on wire, create loop,
|
|
49
|
+
duplicate/delete, layout, undo/redo) without conflicting with right-drag wire
|
|
50
|
+
cutting (`>= 6px`). Bottom-right floating `⊡ | 100%` pill handles fit and
|
|
51
|
+
scrub zoom, and simultaneous pan + wheel zoom stays anchored without drift.
|
|
50
52
|
- **Multi-select & customizable shortcuts**: marquee drag or `Shift`/`Ctrl`+click
|
|
51
53
|
to multi-select; `Shift+A` adds at cursor, `Shift+D` duplicates selected nodes
|
|
52
54
|
together with internal wires, `Delete` removes selected, `Ctrl+Z` /
|
|
53
|
-
`Ctrl+Shift+Z` (`Ctrl+Y`) undo/redo
|
|
54
|
-
under `⋯ → ⌨ Shortcuts`.
|
|
55
|
+
`Ctrl+Shift+Z` (`Ctrl+Y`) undo/redo (including node drags and layout flips),
|
|
56
|
+
and `Esc` closes popups. Customize bindings under `⋯ → ⌨ Shortcuts`.
|
|
57
|
+
- **Live preset sync**: custom presets sync automatically across already-open
|
|
58
|
+
sessions (with a manual `↻` refresh button and `H`/`V` direction tags).
|
|
55
59
|
- Click any subagent node's status pill (e.g. `Done ↗`) to jump straight to its
|
|
56
60
|
live subagent chat pane.
|
|
57
61
|
|
|
@@ -72,13 +76,21 @@ node positions survive.
|
|
|
72
76
|
Subagent nodes run in an event-driven concurrency pool (default 4, configurable
|
|
73
77
|
1–8 via `⋯` or `maxParallel`) via `canvas_workflow`, which supports `task`
|
|
74
78
|
(override the entry task for template reuse), `reset: true` (discard a paused
|
|
75
|
-
run), `
|
|
79
|
+
run), `cancel: true` (cleanly stop an active or paused `need-lead` run),
|
|
80
|
+
`retryFailed: true` / `fromNodes` (reuse succeeded nodes and re-run only
|
|
76
81
|
failed/target segments plus downstream), and `clearMemory: true` (forget saved
|
|
77
82
|
`keepSession` memories). While enabled, a per-session runtime context notifies
|
|
78
|
-
the agent automatically.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
and `
|
|
83
|
+
the agent automatically. While running or paused at an intermediate Lead node,
|
|
84
|
+
a unified **`⏹ Stop`** button stays visible beside `● ON` (muted when idle, lighting up red alongside a compact `⏹` on the Entry Lead card while running or paused at an intermediate Lead) to interrupt all running subagents, cancel the root turn, and clear any
|
|
85
|
+
Lead pause via `/canvas-stop`. Intermediate Lead nodes pause with
|
|
86
|
+
`status: "need-lead"` and report `decisions` / `branchSkipped` / `failed` /
|
|
87
|
+
`emptyOutputs` plus `session` handovers and merged `refs`; a terminal Lead
|
|
88
|
+
completes directly with `status: "done"` and `finalLead`. Once a run begins, a
|
|
89
|
+
compact bottom-left **Summary** pill (and `⋯ → 📊 Run summary`) displays live
|
|
90
|
+
elapsed time, per-node duration bars, fallback/session-continuation badges,
|
|
91
|
+
condition verdicts, and loop retry history with node focus, child-chat jump,
|
|
92
|
+
and Markdown copy — computed strictly from `.run.json` telemetry with zero
|
|
93
|
+
extra tokens.
|
|
82
94
|
|
|
83
95
|
## Memory
|
|
84
96
|
|
package/docs/MECHANISM.md
CHANGED
|
@@ -12,20 +12,20 @@ at run time, and how memory cold-resume, fallbacks, and live status tracking wor
|
|
|
12
12
|
## 1. Architecture: Bidirectional Client ↔ Host Bridge
|
|
13
13
|
|
|
14
14
|
The plugin splits cleanly into two halves:
|
|
15
|
-
- **Client (`client.js`)**: Mounted as a right-sidebar `Workflow` tab (`keepMounted: true`, preserving state while collapsed). Owns visual editing,
|
|
16
|
-
- **Host (`index.js`)**: Registers the bundled `workflow-canvas` skill,
|
|
15
|
+
- **Client (`client.js`)**: Mounted as a right-sidebar `Workflow` tab (`keepMounted: true`, keyed by `sessionId` for isolation, preserving state while collapsed). Owns visual editing, live cross-tab preset sync, global layout preferences, shortcuts, visual effects, and live status rendering.
|
|
16
|
+
- **Host (`index.js`)**: Registers the bundled `workflow-canvas` skill, per-session `systemPrompt.context`, two commands (`/canvas-sync` and `/canvas-stop`), and four tools (`canvas_inspect`, `canvas_generate`, `canvas_patch`, `canvas_workflow`). Owns real subagent execution, unified cancellation, and durable state persistence.
|
|
17
17
|
|
|
18
18
|
```mermaid
|
|
19
19
|
flowchart LR
|
|
20
20
|
subgraph Client["Sidebar Canvas (client.js)"]
|
|
21
|
-
UI["Graph Editor / Presets /
|
|
21
|
+
UI["Graph Editor / Presets / Pills / Stop"]
|
|
22
22
|
LS["localStorage\n(drafts / presets / prefs)"]
|
|
23
23
|
Poll["workspaceFiles Poll\n(every 1.5s)"]
|
|
24
24
|
Cat["subagentCatalog Observer\n(every 700ms while running)"]
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
subgraph Host["Host Plugin (index.js)"]
|
|
28
|
-
Sync["/canvas-sync
|
|
28
|
+
Sync["/canvas-sync & /canvas-stop"]
|
|
29
29
|
Store["Atomic Disk Store\n.workflow-canvas-state.json"]
|
|
30
30
|
Tools["canvas_inspect / generate / patch"]
|
|
31
31
|
Exec["canvas_workflow\nDAG Wave Executor"]
|
|
@@ -33,12 +33,12 @@ flowchart LR
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
UI <--> LS
|
|
36
|
-
UI -- "enable / sync /
|
|
36
|
+
UI -- "enable / sync / stop\n/canvas-sync & /canvas-stop" --> Sync
|
|
37
37
|
Sync --> Store
|
|
38
38
|
Tools -- "writes .dsh/canvas/<sid>.json" --> Poll
|
|
39
39
|
Poll -- "timestamp guard + merge layout" --> UI
|
|
40
40
|
Exec <--> Store
|
|
41
|
-
Exec -- "startActivation
|
|
41
|
+
Exec -- "startActivation / interrupt" --> Sub
|
|
42
42
|
Sub -- "live status & childId" --> Cat
|
|
43
43
|
Cat --> UI
|
|
44
44
|
```
|
|
@@ -69,7 +69,7 @@ When `canvas_workflow` runs, `executePlan` executes the following pipeline:
|
|
|
69
69
|
- **Condition nodes (`kind: "condition"`)** run as lightweight read-only (`minimal`) judges with a strict structured `outputSchema` (supporting binary `if/else`, multi-way `switch/case`, and `multiMatch` parallel fan-out). Unmatched outgoing edges are blocked and unchosen branches are pruned via ancestor-aware BFS (so an upstream `session-ref` side wire cannot bypass a vetoed branch). If zero branches match or the condition node itself fails, it never guesses a branch — it skips intermediate branches and hands off to the nearest downstream Lead (or halts cleanly if none exists).
|
|
70
70
|
- **Controlled retry loops (`loop: true, maxIterations: 1–10`)**: when a condition matches a loop back-edge (taking priority over forward branches under `multiMatch`), if within per-loop and global safety limits (`20`), the executor resets strictly `descendants(target) ∩ ancestors(source)` (bypass nodes outside the loop never re-run), injects the rejection reason into the entry node (supporting both subagents and Lead nodes), and reuses its healthy warm session with an incremental correction prompt (or starts fresh if the prior round crashed/returned empty). At the limit, it circuit-breaks and hands off `1..N` round summaries to the nearest downstream Lead.
|
|
71
71
|
- Intermediate **non-entry Lead nodes** (including `Lead → Lead` stage chains) pause with `status: "need-lead"`; a **terminal Lead** (zero remaining downstream work) finishes in one shot with `status: "done"` and `finalLead`.
|
|
72
|
-
- **`retryFailed: true`** and **`fromNodes: [...]`** reuse succeeded outputs from `lastRunBySession` and re-run only failed/target nodes plus their downstream; `reset: true` discards progress and starts from scratch.
|
|
72
|
+
- **`retryFailed: true`** and **`fromNodes: [...]`** reuse succeeded outputs from `lastRunBySession` and re-run only failed/target nodes plus their downstream; `reset: true` discards progress and starts from scratch; **`cancel: true`** or clicking **`⏹ Stop`** via concurrent `/canvas-stop` (as well as DSH's native chat Stop button) immediately calls `subagents.interrupt(cid, { kind: 'user' })`, `drainDescendants([rootAgent])`, and `rootAgent.cancel({ kind: 'user' }, { keepInbox: true })`, races `abortPromise` out of the pool without spawning fallback retries, preserves completed-node cache, and clears `waitingLead` / `.run.json`.
|
|
73
73
|
|
|
74
74
|
```mermaid
|
|
75
75
|
sequenceDiagram
|
|
@@ -122,15 +122,16 @@ The three link types are distinct runtime channels, not just visual colour codin
|
|
|
122
122
|
## 5. Live Status Pills & Click-to-Open Subagent Chats
|
|
123
123
|
|
|
124
124
|
1. **Node tagging**: `spawnOnce` tags every spawned child with `label: "<node.label>#<node.id>"`.
|
|
125
|
-
2. **Catalog & run-state telemetry tracking**: While a turn runs (every 700ms, plus on mount and turn completion), the client reads `subagentCatalog` and `subagentTiming` from `sessions.list`, matching `/#([^\s#]+)$/` to map each child back to its canvas node (`running`
|
|
126
|
-
3. **Lead `⏸ Ready`
|
|
125
|
+
2. **Catalog & run-state telemetry tracking**: While a turn runs (every 700ms, plus on mount and turn completion), the client reads `subagentCatalog` and `subagentTiming` from `sessions.list`, matching `/#([^\s#]+)$/` to map each child back to its canvas node (`running` takes strict priority over historical rounds) and latest `childId`, while also polling `<workspace>/.dsh/canvas/<sid>.run.json` for condition `decisions`, `pruned` nodes, `blockedEdges`, live retry counts (`loopCounts` / `nodeAttempts`), `waitingLead`, and the zero-token `summary` payload (per-node timestamps/durations, fallback/session badges, loop history — never injected into model prompts).
|
|
126
|
+
3. **Authoritative Lead `⏸ Ready` state, unified Stop & Run Summary**: Authoritative `.run.json` status takes precedence (`need-lead` highlights **`⏸ Ready`**; `halted` / `done` / `idle` never re-lock from historical subagent statuses), falling back to forward-edge heuristics only when `.run.json` is absent. The top-left **`⏹ Stop`** pill stays visible (muted when idle, red when active); once run telemetry exists, a bottom-left **Summary** pill (and `⋯ → 📊 Run summary`) renders the local timing/branch/loop breakdown with Markdown export.
|
|
127
127
|
4. **Jump to live chat**: Clicking any subagent's bottom-left status pill (e.g. `Running ↗`, `Done ↗`) opens `dsh-resource://subagentchat/session/<childId>?parent=<sessionId>&mode=<mode>` via `sidebarRight.openResource(..., { kind: 'subagentchat', preferNewPane: true })`.
|
|
128
128
|
|
|
129
129
|
---
|
|
130
130
|
|
|
131
|
-
## 6. Skill & Tool Discovery
|
|
131
|
+
## 6. Per-Session Context, Skill & Tool Discovery
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
1. **
|
|
135
|
-
2. **
|
|
136
|
-
3. **
|
|
133
|
+
To keep the agent aligned with an enabled canvas without leaking instructions into disabled chats or subagents, the plugin combines four layers:
|
|
134
|
+
1. **Per-session `systemPrompt.context` injection**: Strictly scoped by `sessionId` (never injected into subagents), injecting a live canvas summary on each turn (node overview, controlled retry loop count, global refs count, memory/permission/partial-resume hints; or when paused at a Lead step, the pending Lead role, `leadResult` / `cancel: true` / `reset: true`, and any loop rejection feedback).
|
|
135
|
+
2. **Bundled skill provider**: `index.js` registers `workflow-canvas` via `ctx.skills.registerProvider` with bilingual trigger keywords (`canvas / workflow / condition / retry loop / 画布 / 工作流 / 编排`) and all four `canvas_*` tool names, serving [skills/workflow-canvas/SKILL.md](../skills/workflow-canvas/SKILL.md).
|
|
136
|
+
3. **Tool-level pointers**: Every `canvas_*` tool description reminds the model to load the `workflow-canvas` skill first, and tool schemas are always in context.
|
|
137
|
+
4. **Optional `AGENTS.md` rule**: Adding a single line in a project's `AGENTS.md` guarantees deterministic skill loading in every session.
|
package/docs/MECHANISM.zh.md
CHANGED
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
## 1. 整体架构:Client 与 Host 的双向通道
|
|
10
10
|
|
|
11
11
|
插件由两部分组成:
|
|
12
|
-
- **客户端(`client.js`)**:挂载在 DSH 右侧边栏的 `Workflow` 标签页(`keepMounted: true
|
|
13
|
-
- **Host 侧(`index.js`)**:注册技能 `workflow-canvas
|
|
12
|
+
- **客户端(`client.js`)**:挂载在 DSH 右侧边栏的 `Workflow` 标签页(`keepMounted: true` 且按 `sessionId` 设 `key` 隔离,收起侧边栏时保留画布状态),负责图形编辑、跨会话实时预设同步、全局布局偏好与实时状态渲染。
|
|
13
|
+
- **Host 侧(`index.js`)**:注册技能 `workflow-canvas`、会话级强上下文注入 `systemPrompt.context`、两条命令(`/canvas-sync` 与 `/canvas-stop`),以及 4 个工具(`canvas_inspect`、`canvas_generate`、`canvas_patch`、`canvas_workflow`),负责真实调度子代理、统一中止与持久化执行状态。
|
|
14
14
|
|
|
15
15
|
```mermaid
|
|
16
16
|
flowchart LR
|
|
17
17
|
subgraph Client["客户端画布 (client.js)"]
|
|
18
|
-
UI["画布编辑 / 预设 / 状态胶囊"]
|
|
18
|
+
UI["画布编辑 / 预设 / 状态胶囊 / 终止"]
|
|
19
19
|
LS["localStorage\n(画布草稿 / 预设 / 偏好)"]
|
|
20
20
|
Poll["workspaceFiles 轮询\n(每 1.5s)"]
|
|
21
21
|
Cat["subagentCatalog 投影监听\n(运行中每 700ms)"]
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
subgraph Host["Host 插件 (index.js)"]
|
|
25
|
-
Sync["/canvas-sync
|
|
25
|
+
Sync["/canvas-sync & /canvas-stop"]
|
|
26
26
|
Store["原子持久化\n.workflow-canvas-state.json"]
|
|
27
27
|
Tools["canvas_inspect / generate / patch"]
|
|
28
28
|
Exec["canvas_workflow\nDAG 波次执行器"]
|
|
@@ -30,12 +30,12 @@ flowchart LR
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
UI <--> LS
|
|
33
|
-
UI -- "启用 / 同步 /
|
|
33
|
+
UI -- "启用 / 同步 / 终止\n/canvas-sync & /canvas-stop" --> Sync
|
|
34
34
|
Sync --> Store
|
|
35
35
|
Tools -- "写入 .dsh/canvas/<sid>.json" --> Poll
|
|
36
36
|
Poll -- "时间戳比对 + merge 保留排版" --> UI
|
|
37
37
|
Exec <--> Store
|
|
38
|
-
Exec -- "startActivation
|
|
38
|
+
Exec -- "startActivation / interrupt" --> Sub
|
|
39
39
|
Sub -- "状态与 childId" --> Cat
|
|
40
40
|
Cat --> UI
|
|
41
41
|
```
|
|
@@ -66,7 +66,7 @@ flowchart LR
|
|
|
66
66
|
- 遇到**条件节点(`kind: "condition"`)**时,以轻量只读模式(`minimal`)+ 严格结构化 `outputSchema` 判断命中分支(支持默认 `if/else`、任意多路 `switch/case` 单选与 `multiMatch` 多选并行),随即阻断未命中出边并用祖先感知 BFS 剪枝未命中分支(包括防止上游 `session-ref` 侧线绕过条件);若所有分支均未命中或条件节点自身失败,则绝不瞎猜分支,直接跳过中间分支转交最近下游 Lead(无下游 Lead 时熔断暂停);
|
|
67
67
|
- 遇到命中的**受控回环边(`loop: true, maxIterations: 1–10`)**时(`multiMatch` 下回环优先):若未超单环上限与全局安全上限(`20` 次),精准重置 `descendants(入口) ∩ ancestors(条件)` 环内节点的运行状态(环外旁路不受影响),把打回理由注入回环入口(同时支持子代理与 `Lead` 节点),并在入口上一轮执行健康时自动复用其热子会话发送增量修正提示词(崩溃/空输出则丢弃旧会话重开);若达到上限则熔断停止回跳,汇总 `1..N` 轮失败理由转交最近下游 Lead 拍板;
|
|
68
68
|
- 遇到**中间 Lead 节点**(支持 `Lead → Lead` 阶段串联)时暂停并返回 `status: "need-lead"`;遇到**末尾终审 Lead**(无剩余下游)时直接一步返回 `status: "done"` 与 `finalLead`,无需多余回调轮次;
|
|
69
|
-
- 支持 **`retryFailed: true`** 或 **`fromNodes: [...]`** 局部重跑:自动复用上次已成功节点的缓存结果,仅重跑失败/目标节点及其下游;传 `reset: true`
|
|
69
|
+
- 支持 **`retryFailed: true`** 或 **`fromNodes: [...]`** 局部重跑:自动复用上次已成功节点的缓存结果,仅重跑失败/目标节点及其下游;传 `reset: true` 则从头重跑;传 **`cancel: true`** 或通过画布 **`⏹ 终止`** 触发并发命令 **`/canvas-stop`**(亦对齐 DSH 原生聊天停止按钮)时,立即调用 `subagents.interrupt(cid, { kind: 'user' })`、`drainDescendants([rootAgent])` 与 `rootAgent.cancel({ kind: 'user' }, { keepInbox: true })`,以 `abortPromise` 秒级跳出并发池、阻止拉起备用模型重试,同时保留已完成节点缓存并清空 `waitingLead` / `.run.json`。
|
|
70
70
|
|
|
71
71
|
```mermaid
|
|
72
72
|
sequenceDiagram
|
|
@@ -119,15 +119,16 @@ sequenceDiagram
|
|
|
119
119
|
## 5. 实时状态胶囊与点击直达子会话
|
|
120
120
|
|
|
121
121
|
1. **节点反查标记**:`spawnOnce` 启动子代理时,固定把 `spec.label` 设为 `<节点名>#<nodeId>`。
|
|
122
|
-
2. **状态与遥测实时追踪**:客户端在对话运行期间每 700ms(以及挂载与每轮结束时)读取 `sessions.list` 投影中的 `subagentCatalog` 与 `subagentTiming`,用末尾正则 `/#([^\s#]+)$/` 精准反查子代理状态(`running`
|
|
123
|
-
3. **Lead
|
|
122
|
+
2. **状态与遥测实时追踪**:客户端在对话运行期间每 700ms(以及挂载与每轮结束时)读取 `sessions.list` 投影中的 `subagentCatalog` 与 `subagentTiming`,用末尾正则 `/#([^\s#]+)$/` 精准反查子代理状态(`running` 具最高优先级,避免多轮重试被历史记录覆盖)与 `childId`;同时轮询 Host 写入的 `<workspace>/.dsh/canvas/<sid>.run.json` 获取条件判决(`decisions`)、剪枝集(`pruned`)、阻断边(`blockedEdges`)、回环实时轮次(`loopCounts` / `nodeAttempts`)、待拍板状态(`waitingLead`)以及零 Token 复盘快照(`summary`:各节点耗时、回退/续接标记与回环历史,绝不注入模型上下文)。
|
|
123
|
+
3. **Lead「待拍板」权威状态、统一终止与执行复盘**:优先以 `.run.json` 报告的权威状态为准(`need-lead` 高亮 **`⏸ 待拍板`**,`halted` / `done` / `idle` 绝不误回弹锁死),仅在缺失 `.run.json` 时回退到前向边启发式推导;左上角 **`⏹ 终止`** 按钮常态可见(空闲灰标、运行或待拍板亮红);存在运行遥测时,左下角同步出现 **复盘** 胶囊(及 `⋯ → 📊 执行复盘`)展示本地统计与一键导出 Markdown。
|
|
124
124
|
4. **一键直达真实子对话**:点击任意子代理节点左下角状态胶囊(如 `进行中 ↗` / `已完成 ↗`),客户端调用 `sidebarRight.openResource('dsh-resource://subagentchat/session/<childId>?parent=<sessionId>&mode=<mode>', { kind: 'subagentchat', preferNewPane: true })`,直接在新侧边窗格打开该子代理的真实对话记录。
|
|
125
125
|
|
|
126
126
|
---
|
|
127
127
|
|
|
128
|
-
## 6. Skill 与工具引导机制
|
|
128
|
+
## 6. 会话级强上下文、Skill 与工具引导机制
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
1.
|
|
132
|
-
2.
|
|
133
|
-
3.
|
|
130
|
+
为了让模型在开启画布后稳定、准确地遵循编排而又不污染其它会话或子代理,插件采用四层协同引导:
|
|
131
|
+
1. **会话级 `systemPrompt.context` 强注入**:仅对画布处于「`● 已启用`」的当前主会话(按 `sessionId` 严格匹配,绝不泄漏到子代理)每轮自动注入画布摘要(节点概览、受控回环条数、全局参考数、记忆/权限/断点续跑提示;若暂停在中间 Lead 则注入待拍板说明、`leadResult` / `cancel: true` / `reset: true` 与回环打回理由)。
|
|
132
|
+
2. **Skill 目录注册**:`index.js` 通过 `ctx.skills.registerProvider` 注册内置技能 `workflow-canvas`,摘要中包含中英触发词(`canvas / workflow / 条件分支 / 回环重试 / 画布 / 工作流 / 编排`)与 4 个 `canvas_*` 工具名;正文读取自 [skills/workflow-canvas/SKILL.md](../skills/workflow-canvas/SKILL.md)。
|
|
133
|
+
3. **工具说明互指**:`canvas_inspect`、`canvas_generate`、`canvas_patch`、`canvas_workflow` 的工具描述均提示模型按需先加载 `workflow-canvas` 技能,而工具定义始终在上下文中。
|
|
134
|
+
4. **项目级锁定(可选)**:在项目 `AGENTS.md` 中加一行显式指令,可在任意对话中实现最高触发稳定性。
|