dsh-workflow-canvas 0.1.2 → 0.2.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 CHANGED
@@ -1,130 +1,163 @@
1
- # DSH Workflow Canvas
2
- English | [中文](README.zh.md)
3
-
4
- Orchestrate subagent workflows from the DSH sidebar. Draw each step as a node, wire
5
- the data flow with three link types, enable it, and run it from chat — subagent nodes
6
- are spawned for real, Lead nodes pause the run and are performed by the conversation
7
- itself.
8
-
9
- Describe a workflow in one sentence and the agent sketches the whole canvas for you;
10
- tweak it in place afterwards with `canvas_patch`. Links make the flow obvious at a
11
- glance — grey carries text, blue carries JSON, purple continues the upstream session.
12
-
13
- ![workflow canvas](docs/images/canvas-demo.png)
14
-
15
- ## Installation
16
-
17
- Requires DeepSeek Harness **0.2.2** or newer (the package declares
18
- `engines.dsh: ">=0.2.2-rc.1 <0.3.0-0"`).
19
-
20
- - **From the plugin market** — open **Plugins → Discover**, search
21
- *"workflow canvas"*, and install. The dshmarket entry is still awaiting
22
- review; see the
23
- [catalog PR](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/17180).
24
- - **From npm** — install the published package `dsh-workflow-canvas`
25
- (latest `0.1.0`) from the **Plugins** panel, or via the `plugin_manager` tool /
26
- `dsh` CLI with `install_bundle` and `target: dsh-workflow-canvas`.
27
- - **From source** — clone the repository and install it as a local directory
28
- with **Plugins → Add plugin**, pointing at the checkout.
29
-
30
- After installing, enable the plugin and the `workflow` tab appears in the right
31
- sidebar.
32
-
33
- ## How this differs from other canvas plugins
34
-
35
- DSH has more than one "workflow canvas". This one orchestrates **subagents** from
36
- the sidebar, performs Lead steps in the conversation itself, and lets the agent
37
- sketch a whole canvas from one sentence. For tool-call / condition / output
38
- pipelines compiled to `ctx.workflows`, see
39
- [`@piedpiper911/dsh-workflow-canvas`](https://github.com/PiedPiper911/dsh-workflow-canvas).
40
-
41
- ## Nodes
42
-
43
- - **Subagent node** (green top bar) — spawns a child agent. Each node sets its own
44
- model, reasoning effort, capability scope (`standard` / `minimal`), fallback
45
- model, memory and role.
46
- - **Lead node** (blue top bar) — performed by the conversation, never spawned. The
47
- entry Lead carries the overall task; the run stops at every Lead step and resumes
48
- with your answer.
49
-
50
- ## Links
51
-
52
- | Type | Colour | Carries |
53
- |---|---|---|
54
- | `prompt` | grey | plain text |
55
- | `structured` | blue | a JSON object; the upstream node is asked for structured output automatically |
56
- | `session` | purple | the upstream child session, so the downstream runs **inside it** |
57
-
58
- Drag from a right socket to a left socket, or from a left socket to a right one.
59
- Drag a connected left socket away to detach. Hold the **right button** and sweep
60
- across links to cut them (toggle in `⋯`).
61
-
62
- ## Running
63
-
64
- 1. Write the task in the entry Lead, and a role for each node.
65
- 2. Connect the nodes — unlinked nodes are dashed and skipped.
66
- 3. Press the **● ON / ○ OFF** pill at the top-left of the canvas, then ask in chat
67
- to run it.
68
- 4. The run proceeds in parallel waves (up to 4 at a time) and pauses at each Lead
69
- node with the results collected so far.
70
-
71
- ## Lead handover
72
-
73
- When a `session` link points into a Lead node, the run reports that child session
74
- id at the Lead step, so the conversation can keep talking to that agent instead of
75
- only receiving its text.
76
-
77
- ## Generating and editing the canvas from chat
78
-
79
- - `canvas_generate` — build a whole canvas from a node/edge sketch (replaces it).
80
- - `canvas_patch` — edit it in place: update nodes by id, add or remove nodes and
81
- links, leaving positions and everything else untouched.
82
-
83
- Both write the canvas to the workspace, and the panel picks it up within ~1.5s.
84
-
85
- ## Presets
86
-
87
- Name a canvas and press `☆ Save`; load it in another session from `☰ Presets`.
88
- Presets live in browser storage, shared across sessions of the same origin, and are
89
- not synchronised across machines.
90
-
91
- ## Memory
92
-
93
- A node with memory on reuses its child session: within a run, across runs in the
94
- same session, and — through the persisted child id — after a restart, where the
95
- Host cold-resumes it. A resume the Host refuses is forgotten and the node starts
96
- fresh.
97
-
98
- ## Limits
99
-
100
- - Presets do not travel between the Desktop app and `dsh web`, nor across machines.
101
- - Node status is read from the subagent catalog, so Lead steps show **Runs in chat**
102
- instead of a tracked state.
103
- - Up to 4 nodes run at a time.
104
-
105
- ## Making the agent use this plugin
106
-
107
- The bundled guide ships as a skill named `workflow-canvas`. DSH has no "auto-load"
108
- switch: the model sees each skill's **name and description** in its catalogue and
109
- loads the body on demand. Three things make it reliable:
110
-
111
- 1. **A description that names the trigger words** — canvas, workflow, pipeline,
112
- node graph, 画布, 工作流, 编排.
113
- 2. **Pointers from the tools** — every `canvas_*` tool description tells the model
114
- to load the skill first, and tools are always in context.
115
- 3. **A line in your project's `AGENTS.md`** — the strongest option, because it is
116
- always loaded:
117
-
118
- ```markdown
119
- When a task involves the workflow canvas or the canvas_* tools, call the `skill`
120
- tool with name `workflow-canvas` first.
121
- ```
122
-
123
- ## Development
124
-
125
- Edit `client.js` / `index.js` and reload the app; client changes hot-reload, Host
126
- changes need a restart. See [docs/DETAIL.md](docs/DETAIL.md) for the internals.
127
-
128
- ## License
129
-
130
- MIT — see [LICENSE](LICENSE).
1
+ # DSH Workflow Canvas
2
+
3
+ [![npm version](https://img.shields.io/npm/v/dsh-workflow-canvas)](https://www.npmjs.com/package/dsh-workflow-canvas)
4
+ [![DSH](https://img.shields.io/badge/DSH-%3E%3D0.2.2-2f81f7)](https://github.com/Wasabi2575/dsh-workflow-canvas)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-3fb950.svg)](LICENSE)
6
+
7
+ English | [中文](README.zh.md)
8
+
9
+ Orchestrate subagent workflows from the DSH sidebar. Draw each step as a node, wire
10
+ the data flow with three link types, enable it, and run it from chat — subagent nodes
11
+ are spawned for real, Lead nodes pause the run and are performed by the conversation
12
+ itself.
13
+
14
+ Describe a workflow in one sentence and the agent sketches the whole canvas for you;
15
+ tweak it in place afterwards with `canvas_patch`. Links make the flow obvious at a
16
+ glance — grey carries text, blue carries JSON, purple continues the upstream session.
17
+
18
+ ![workflow canvas](docs/images/canvas-demo.png)
19
+
20
+ ## Installation
21
+
22
+ Requires DeepSeek Harness **0.2.2** or newer (the package declares
23
+ `engines.dsh: ">=0.2.2-rc.1 <0.3.0-0"`).
24
+
25
+ - **From the plugin market** — open **Plugins → Discover**, search
26
+ *"workflow canvas"*, and install. The dshmarket entry is still awaiting
27
+ review; see the
28
+ [catalog PR](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/17180).
29
+ - **From npm** — install the published package `dsh-workflow-canvas` from the
30
+ **Plugins** panel, or via the `plugin_manager` tool / `dsh` CLI with
31
+ `install_bundle` and `target: dsh-workflow-canvas`.
32
+ - **From source** — clone the repository and install it as a local directory
33
+ with **Plugins → Add plugin**, pointing at the checkout.
34
+
35
+ After installing, enable the plugin and the `workflow` tab appears in the right
36
+ sidebar.
37
+
38
+ ## Quick start (30 seconds)
39
+
40
+ - **Zero-setup tryout**: open the right-sidebar `Workflow` tab → load a starter
41
+ template from `☰ Presets` → press **● ON** at top-left → ask in chat to run the
42
+ canvas.
43
+ - **Prompts you can copy right into chat**:
44
+ - **Sketch from one sentence**: *"Build a parallel research workflow on the canvas: two subagents investigate competitors and technical feasibility in parallel, pause for me (Lead) to decide, then hand off to a writer subagent."*
45
+ - **Patch in place**: *"Inspect the current canvas, turn Memory on for the feasibility node, and add a read-only cost-estimate node wired in parallel into plan synthesis."*
46
+ - **Reuse a template with a new task**: *"Run the current canvas with the task: evaluate adding a local knowledge base to this project."*
47
+
48
+ ## How this differs from other canvas plugins
49
+
50
+ DSH has more than one "workflow canvas". This one orchestrates **subagents** from
51
+ the sidebar, performs Lead steps in the conversation itself, and lets the agent
52
+ sketch a whole canvas from one sentence. For tool-call / condition / output
53
+ pipelines compiled to `ctx.workflows`, see
54
+ [`@piedpiper911/dsh-workflow-canvas`](https://github.com/PiedPiper911/dsh-workflow-canvas).
55
+
56
+ ## Nodes
57
+
58
+ - **Subagent node** (green top bar) — spawns a child agent. Each node sets its own
59
+ model, reasoning effort, capability scope (`standard` / `minimal`), fallback
60
+ model, memory and role.
61
+ - **Lead node** (blue top bar) — performed by the conversation, never spawned. The
62
+ entry Lead carries the overall task; the run stops at every Lead step and resumes
63
+ with your answer.
64
+
65
+ ## Links
66
+
67
+ | Type | Colour | Carries |
68
+ |---|---|---|
69
+ | `prompt` | grey | plain text |
70
+ | `structured` | blue | a JSON object; the upstream node is asked for structured output automatically |
71
+ | `session` | purple | the upstream child session, so the downstream runs **inside it** |
72
+
73
+ Drag from a right socket to a left socket, or from a left socket to a right one
74
+ (cycles are blocked immediately). Drag a connected left socket away to detach.
75
+
76
+ ## Canvas controls & shortcuts
77
+
78
+ | Control / Shortcut | Action |
79
+ |---|---|
80
+ | `Shift+A` | Open the Add Node menu at the cursor (`1` / `2` to drop immediately) |
81
+ | Middle-drag / `Space` + left-drag | Pan the canvas (works even when starting over a node) |
82
+ | Wheel / `⊡ Fit` / `100%` | Cursor-anchored zoom / fit all nodes in view / reset to 100% on Lead |
83
+ | Marquee drag + `Ctrl+D` / `Delete` | Multi-select move, duplicate (preserving settings), or batch delete |
84
+ | `Ctrl+Z` / `Esc` | Undo structural edits / close open popups and menus |
85
+ | Right-drag across links | Cut swept links (toggle under `⋯`); `⋯` also has `⊞ Auto layout`, `⇧ Copy JSON`, and `Visual effects` (Minimal / Standard / Vivid) |
86
+
87
+ ## Running
88
+
89
+ 1. Write the task in the entry Lead, and a role for each node (or leave the task
90
+ blank and pass `task` from chat when reusing a template).
91
+ 2. Connect the nodes — unlinked nodes are dashed and skipped.
92
+ 3. Press the **● ON / ○ OFF** pill at the top-left of the canvas, then ask in chat
93
+ to run it (pass `reset: true` to restart from scratch).
94
+ 4. The run proceeds in parallel waves (up to 4 at a time) and pauses at each Lead
95
+ node with the results collected so far. Click a subagent's status pill (e.g.
96
+ `Done ↗`) to jump straight to its live chat pane.
97
+
98
+ ## Lead handover
99
+
100
+ When a `session` link points into a Lead node, the run reports that child session
101
+ id at the Lead step, so the conversation can keep talking to that agent instead of
102
+ only receiving its text.
103
+
104
+ ## Inspecting, generating and editing the canvas from chat
105
+
106
+ - `canvas_inspect` — read the current canvas (enabled state, task, node ids/models/roles
107
+ and links), so the agent can safely patch manually edited or preset graphs.
108
+ - `canvas_generate` — build a whole canvas from a node/edge sketch (replaces it).
109
+ - `canvas_patch` — edit it in place: update nodes by id, add or remove nodes and
110
+ links, leaving positions and everything else untouched.
111
+
112
+ Generate and patch both write the canvas to the workspace, and the panel picks it
113
+ up within ~1.5s.
114
+
115
+ ## Presets & sharing
116
+
117
+ `☰ Presets` ships with ready-to-run starter templates; name any canvas and press
118
+ `☆ Save` to keep your own. Presets live in browser storage; to share across
119
+ machines or between Desktop and `dsh web`, use `⋯ → ⇧ Copy JSON` and `⇩ Import`.
120
+
121
+ ## Memory
122
+
123
+ A node with memory on reuses its child session: within a run, across runs in the
124
+ same session, and — through the persisted child id — after a restart, where the
125
+ Host cold-resumes it. A resume the Host refuses is forgotten and the node starts
126
+ fresh.
127
+
128
+ ## Limits
129
+
130
+ - Saved presets live in browser storage and do not auto-sync between the Desktop
131
+ app and `dsh web`, nor across machines (use `⋯ → ⇧ Copy JSON` and `⇩ Import`
132
+ to move or share them).
133
+ - Node status is read from the subagent catalog, so Lead steps show **Runs in chat**
134
+ instead of a tracked state.
135
+ - Up to 4 nodes run at a time.
136
+
137
+ ## Making the agent use this plugin
138
+
139
+ The bundled guide ships as a skill named `workflow-canvas`. DSH has no "auto-load"
140
+ switch: the model sees each skill's **name and description** in its catalogue and
141
+ loads the body on demand. Three things make it reliable:
142
+
143
+ 1. **A description that names the trigger words** — canvas, workflow, pipeline,
144
+ node graph, 画布, 工作流, 编排.
145
+ 2. **Pointers from the tools** — every `canvas_*` tool description tells the model
146
+ to load the skill first, and tools are always in context.
147
+ 3. **A line in your project's `AGENTS.md`** — the strongest option, because it is
148
+ always loaded:
149
+
150
+ ```markdown
151
+ When a task involves the workflow canvas or the canvas_* tools, call the `skill`
152
+ tool with name `workflow-canvas` first.
153
+ ```
154
+
155
+ ## Development
156
+
157
+ Edit `client.js` / `index.js` and reload the app; client changes hot-reload, Host
158
+ changes need a restart. Run `npm test` for the test suite. See
159
+ [docs/DETAIL.md](docs/DETAIL.md) for the internals.
160
+
161
+ ## License
162
+
163
+ MIT — see [LICENSE](LICENSE).
package/README.zh.md CHANGED
@@ -1,101 +1,125 @@
1
- # DSH Workflow Canvas(可视化工作流画布)
2
- 中文 | [English](README.md)
3
-
4
- 在 DSH 侧边栏里编排子代理工作流:把每一步画成一个节点、用三种连线标出数据怎么流转,
5
- 启用后直接在对话里运行。子代理节点会被真实启动,Lead 节点会暂停运行、由对话本体执行。
6
-
7
- 不必手动画——用一句话描述流程,agent 会替你搭好整张图,之后再随时就地微调。
8
- 节点间的连线一眼就能看懂数据流向:灰线传文本、蓝线传 JSON、紫线让下游接着上游的会话跑。
9
-
10
- ![工作流画布](docs/images/canvas-demo-zh.png)
11
-
12
- ## 安装
13
-
14
- 需要 DeepSeek Harness **0.2.2** 或更新版本(包声明
15
- `engines.dsh: ">=0.2.2-rc.1 <0.3.0-0"`)。
16
-
17
- - **从插件市场安装** —— 打开 **插件 → 发现(Discover)**,搜索
18
- *"workflow canvas"* 并安装。dshmarket 条目尚在审核中,见
19
- [目录 PR](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/17180)。
20
- - **从 npm 安装** —— 从 **插件** 面板,或用 `plugin_manager` 工具 / `dsh` CLI
21
- 的 `install_bundle`(`target` 填 `dsh-workflow-canvas`)安装已发布的包
22
- `dsh-workflow-canvas`(最新 `0.1.0`)。
23
- - **从源码安装** —— 克隆仓库后,用 **插件 → 添加插件(Add plugin)** 把它作为
24
- 本地目录安装,指向 checkout 目录。
25
-
26
- 装好并启用插件后,右侧边栏会出现 `workflow` 标签页。
27
-
28
- ## 与其它画布插件的区别
29
-
30
- DSH 生态里不止一个「工作流画布」。本项目在侧边栏里编排**子代理**,Lead 步骤由对话本体执行,
31
- 还支持一句话让 agent 自动搭图。若要的是「工具调用 / 条件分支 / 输出模板」编译成 `ctx.workflows`
32
- 的那类管线,请看 [`@piedpiper911/dsh-workflow-canvas`](https://github.com/PiedPiper911/dsh-workflow-canvas)。
33
-
34
- ## 节点
35
-
36
- - **子代理节点**(顶部绿条)—— 真正 spawn 一个子代理。每个节点可单独设置模型、推理强度、能力范围(`standard` / `minimal`)、备用模型、记忆和分工。
37
- - **Lead 节点**(顶部蓝条)—— 由对话本体执行,从不 spawn。入口 Lead 承载总任务;运行每到一步 Lead 就暂停,等你在对话里完成。
38
-
39
- ## 连线
40
-
41
- | 类型 | 颜色 | 传递内容 |
42
- |---|---|---|
43
- | `prompt` | 灰 | 纯文本 |
44
- | `structured` | 蓝 | 一个 JSON 对象;上游节点会被自动要求输出结构化结果 |
45
- | `session` | 紫 | 上游的子会话,下游在**它里面**继续跑 |
46
-
47
- 从右端口拖到左端口、或从左端口拖到右端口都能连线;拖已连接的左端口可断开。
48
- 按住**右键**划过连线可切断(可在 `⋯` 里关掉这个手势)。
49
-
50
- ## 运行
51
-
52
- 1. 在入口 Lead 写总任务,给每个节点写分工。
53
- 2. 连好节点——未连线的节点会显示虚线并被跳过。
54
- 3. 点画布左上角的 **● 已启用 / ○ 已禁用** 浮窗,然后在对话里让它跑。
55
- 4. 运行按波次并行(每次最多 4 个),每到一个 Lead 节点就暂停,并把已收集的结果交回。
56
-
57
- ## Lead 交接
58
-
59
- 当 `session` 线指向 Lead 节点时,运行会在 Lead 步骤上报那个子会话 id,于是对话可以继续追问那个子代理,而不只是拿到它的文本。
60
-
61
- ## 从对话生成 / 修改画布
62
-
63
- - `canvas_generate` —— 从一个节点/连线草图重建整张画布(替换)。
64
- - `canvas_patch` —— 就地编辑:按 id 更新节点、增删节点和连线,位置和其余内容保持不变。
65
-
66
- 两者都会把画布写到工作区,面板约 1.5 秒内自动读取。
67
-
68
- ## 预设
69
-
70
- 给画布起名后点 `☆ 保存`;在其它会话里从 `☰ 预设` 载入。预设存在浏览器存储里,同源会话共享,不跨机器同步。
71
-
72
- ## 记忆
73
-
74
- 开启记忆的节点会复用它的子会话:同一轮运行内、同一会话的多次运行之间,以及——通过落盘的子会话 id——重启之后(Host 冷恢复)。若 Host 拒绝恢复,该记录会被丢弃、节点重新开始。
75
-
76
- ## 限制
77
-
78
- - 预设不在桌面应用和 `dsh web` 之间互通,也不跨机器同步。
79
- - 节点状态读取自子代理目录,因此 Lead 步骤显示 **由对话执行**,而不是一个可追踪的状态。
80
- - 同一时间最多并行运行 4 个节点。
81
-
82
- ## 让 agent 使用这个插件
83
-
84
- 内置指南以名为 `workflow-canvas` 的技能发布。DSH 没有「自动加载」开关:模型在技能目录里看到每个技能的**名字和描述**,然后按需加载正文。三件事让它更可靠:
85
-
86
- 1. **描述里写进触发词** —— canvas、workflow、pipeline、node graph、画布、工作流、编排。
87
- 2. **从工具指路** —— 每个 `canvas_*` 工具的说明都提示先加载该技能,而工具永远在上下文里。
88
- 3. **在项目的 `AGENTS.md` 里加一行** —— 最稳的办法,因为它每次都会加载:
89
-
90
- ```markdown
91
- 当任务涉及 workflow canvas(画布 / 工作流 / 编排)或 canvas_* 工具时,
92
- 先调用 `skill` 工具加载 `workflow-canvas`。
93
- ```
94
-
95
- ## 开发
96
-
97
- 编辑 `client.js` / `index.js` 后重载应用;客户端改动热更生效,Host 改动需要重启。内部实现见 [docs/DETAIL.md](docs/DETAIL.md)。
98
-
99
- ## 许可
100
-
101
- MIT —— 见 [LICENSE](LICENSE)。
1
+ # DSH Workflow Canvas(可视化工作流画布)
2
+
3
+ [![npm version](https://img.shields.io/npm/v/dsh-workflow-canvas)](https://www.npmjs.com/package/dsh-workflow-canvas)
4
+ [![DSH](https://img.shields.io/badge/DSH-%3E%3D0.2.2-2f81f7)](https://github.com/Wasabi2575/dsh-workflow-canvas)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-3fb950.svg)](LICENSE)
6
+
7
+ 中文 | [English](README.md)
8
+
9
+ 在 DSH 侧边栏里编排子代理工作流:把每一步画成一个节点、用三种连线标出数据怎么流转,
10
+ 启用后直接在对话里运行。子代理节点会被真实启动,Lead 节点会暂停运行、由对话本体执行。
11
+
12
+ 不必手动画——用一句话描述流程,agent 会替你搭好整张图,之后再随时就地微调。
13
+ 节点间的连线一眼就能看懂数据流向:灰线传文本、蓝线传 JSON、紫线让下游接着上游的会话跑。
14
+
15
+ ![工作流画布](docs/images/canvas-demo-zh.png)
16
+
17
+ ## 安装
18
+
19
+ 需要 DeepSeek Harness **0.2.2** 或更新版本(包声明
20
+ `engines.dsh: ">=0.2.2-rc.1 <0.3.0-0"`)。
21
+
22
+ - **从插件市场安装** —— 打开 **插件 → 发现(Discover)**,搜索
23
+ *"workflow canvas"* 并安装。dshmarket 条目尚在审核中,见
24
+ [目录 PR](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/17180)。
25
+ - **从 npm 安装** —— 从 **插件** 面板,或用 `plugin_manager` 工具 / `dsh` CLI
26
+ 的 `install_bundle`(`target` 填 `dsh-workflow-canvas`)安装已发布的包
27
+ `dsh-workflow-canvas`。
28
+ - **从源码安装** —— 克隆仓库后,用 **插件 → 添加插件(Add plugin)** 把它作为
29
+ 本地目录安装,指向 checkout 目录。
30
+
31
+ 装好并启用插件后,右侧边栏会出现 `workflow` 标签页。
32
+
33
+ ## 30 秒快速上手
34
+
35
+ - **最快体验(零手动画图)**:打开右侧 `Workflow` 标签页 → 点击 `☰ 预设` 载入内置示例模板 → 点左上角 **● 已启用** → 在对话里说「按画布跑一次」。
36
+ - **直接用对话驱动画布**(可复制尝试):
37
+ - **一句话搭图**:*「帮我在工作流画布里搭一个并行调研流程:先让两个子代理分别做竞品调研和技术可行性评估,再由我(Lead)拍板,最后交给子代理写方案」*
38
+ - **就地微调**:*「先看一下当前画布,把技术可行性节点开启记忆,再补一个只读的成本估算节点并行连到方案合成」*
39
+ - **复用模板换任务跑**:*「用当前画布跑一下,总任务改为:评估在现有项目里接入本地知识库的方案」*
40
+
41
+ ## 与其它画布插件的区别
42
+
43
+ DSH 生态里不止一个「工作流画布」。本项目在侧边栏里编排**子代理**,Lead 步骤由对话本体执行,
44
+ 还支持一句话让 agent 自动搭图。若要的是「工具调用 / 条件分支 / 输出模板」编译成 `ctx.workflows`
45
+ 的那类管线,请看 [`@piedpiper911/dsh-workflow-canvas`](https://github.com/PiedPiper911/dsh-workflow-canvas)。
46
+
47
+ ## 节点
48
+
49
+ - **子代理节点**(顶部绿条)—— 真正 spawn 一个子代理。每个节点可单独设置模型、推理强度、能力范围(`standard` / `minimal`)、备用模型、记忆和分工。
50
+ - **Lead 节点**(顶部蓝条)—— 由对话本体执行,从不 spawn。入口 Lead 承载总任务;运行每到一步 Lead 就暂停,等你在对话里完成。
51
+
52
+ ## 连线
53
+
54
+ | 类型 | 颜色 | 传递内容 |
55
+ |---|---|---|
56
+ | `prompt` | 灰 | 纯文本 |
57
+ | `structured` | 蓝 | 一个 JSON 对象;上游节点会被自动要求输出结构化结果 |
58
+ | `session` | 紫 | 上游的子会话,下游在**它里面**继续跑 |
59
+
60
+ 从右端口拖到左端口、或从左端口拖到右端口都能连线(成环会被即时阻止);拖已连接的左端口可断开。
61
+
62
+ ## 画布操作与快捷键
63
+
64
+ | 操作 / 快捷键 | 效果 |
65
+ |---|---|
66
+ | `Shift+A` | 在光标位置打开新建节点菜单(按 `1` / `2` 快速落点) |
67
+ | 鼠标中键拖拽 / `Space` + 左键拖拽 | 平移画布(鼠标悬停在节点上也可直接拖) |
68
+ | 滚轮 / `⊡ 全览` / `100%` | 光标处缩放 / 自适应完整显示全图 / 重置 100% 并聚焦入口 Lead |
69
+ | 左键框选 + `Ctrl+D` / `Delete` | 多选拖拽、批量复制(保留模型与参数配置)或批量删除选中节点 |
70
+ | `Ctrl+Z` / `Esc` | 撤销结构改动 / 关闭当前浮层与菜单 |
71
+ | 右键按住划过连线 | 切断连线(可在 `⋯` 菜单开关);`⋯` 里还提供 `⊞ 自动排版`、`⇧ 复制 JSON` 与三档 `视觉效果`(极简 / 标准 / 炫酷) |
72
+
73
+ ## 运行
74
+
75
+ 1. 在入口 Lead 写总任务,给每个节点写分工(也可以留空任务,在对话里直接让 agent 传 `task` 运行)。
76
+ 2. 连好节点——未连线的节点会显示虚线并被跳过。
77
+ 3. 点画布左上角的 **● 已启用 / ○ 已禁用** 浮窗,然后在对话里让它跑(支持 `reset: true` 从头重跑)。
78
+ 4. 运行按波次并行(每次最多 4 个),每到一个 Lead 节点就暂停,并把已收集的结果交回;点击子代理节点右下角状态胶囊(如 `已完成 ↗`)可直达它的对话记录。
79
+
80
+ ## Lead 交接
81
+
82
+ 当 `session` 线指向 Lead 节点时,运行会在 Lead 步骤上报那个子会话 id,于是对话可以继续追问那个子代理,而不只是拿到它的文本。
83
+
84
+ ## 从对话读取 / 生成 / 修改画布
85
+
86
+ - `canvas_inspect` —— 只读查看当前画布的启用状态、总任务、节点 id/模型/分工与连线(手动改图或载入预设后,先读再改)。
87
+ - `canvas_generate` —— 从一个节点/连线草图重建整张画布(替换)。
88
+ - `canvas_patch` —— 就地编辑:按 id 更新节点、增删节点和连线,位置和其余内容保持不变。
89
+
90
+ 生成和修改都会把画布写到工作区,面板约 1.5 秒内自动读取。
91
+
92
+ ## 预设与分享
93
+
94
+ `☰ 预设` 内置了开箱即用的示例模板,点一下即可载入试跑;给画布起名后点 `☆ 保存` 即可存为自定义预设。若要跨机器或在桌面端 / `dsh web` 之间分享,用 `⋯ → ⇧ 复制 JSON` 与 `⇩ 导入` 即可。
95
+
96
+ ## 记忆
97
+
98
+ 开启记忆的节点会复用它的子会话:同一轮运行内、同一会话的多次运行之间,以及——通过落盘的子会话 id——重启之后(Host 冷恢复)。若 Host 拒绝恢复,该记录会被丢弃、节点重新开始。
99
+
100
+ ## 限制
101
+
102
+ - 自定义预设存储在浏览器本地,不在桌面应用和 `dsh web` 之间自动同步,也不跨机器同步(可通过 `⋯ → ⇧ 复制 JSON` 与 `⇩ 导入` 手动迁移或分享)。
103
+ - 节点状态读取自子代理目录,因此 Lead 步骤显示 **由对话执行**,而不是一个可追踪的状态。
104
+ - 同一时间最多并行运行 4 个节点。
105
+
106
+ ## 让 agent 使用这个插件
107
+
108
+ 内置指南以名为 `workflow-canvas` 的技能发布。DSH 没有「自动加载」开关:模型在技能目录里看到每个技能的**名字和描述**,然后按需加载正文。三件事让它更可靠:
109
+
110
+ 1. **描述里写进触发词** —— canvas、workflow、pipeline、node graph、画布、工作流、编排。
111
+ 2. **从工具指路** —— 每个 `canvas_*` 工具的说明都提示先加载该技能,而工具永远在上下文里。
112
+ 3. **在项目的 `AGENTS.md` 里加一行** —— 最稳的办法,因为它每次都会加载:
113
+
114
+ ```markdown
115
+ 当任务涉及 workflow canvas(画布 / 工作流 / 编排)或 canvas_* 工具时,
116
+ 先调用 `skill` 工具加载 `workflow-canvas`。
117
+ ```
118
+
119
+ ## 开发
120
+
121
+ 编辑 `client.js` / `index.js` 后重载应用;客户端改动热更生效,Host 改动需要重启。运行 `npm test` 执行单测;内部实现见 [docs/DETAIL.md](docs/DETAIL.md)。
122
+
123
+ ## 许可
124
+
125
+ MIT —— 见 [LICENSE](LICENSE)。