dsh-workflow-canvas 0.2.4 → 1.0.1

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
@@ -6,156 +6,122 @@
6
6
 
7
7
  English | [中文](README.zh.md) | [Mechanism & Architecture](docs/MECHANISM.md)
8
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.
9
+ Turn multi-agent orchestration in DSH into a visual node graph: each card is an AI role, each wire defines who feeds whom, and pressing **● ON** lets you run the whole pipeline straight from chat.
13
10
 
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.
11
+ - **Real parallelism**: Independent nodes run concurrently (up to 4 at once), and newly unblocked downstream nodes start the instant their inputs finish.
12
+ - **Human-in-the-loop**: Drop a **Lead** card anywhere in the flow to pause automatically for your decision before continuing.
13
+ - **Zero black box**: Click any subagent card to open its live chat transcript and inspect its exact output.
14
+ - **Don't want to draw by hand?** Describe the workflow in one sentence in chat — the agent sketches the graph for you and can patch it in place anytime.
17
15
 
18
- ![workflow canvas](docs/images/canvas-demo.png)
16
+ ![Workflow canvas overview](docs/images/canvas-demo.png)
19
17
 
20
18
  ## Installation
21
19
 
22
- Requires DeepSeek Harness **0.2.2** or newer (the package declares
23
- `engines.dsh: ">=0.2.2-rc.1 <0.3.0-0"`).
20
+ Requires DeepSeek Harness **0.2.2** or newer (`engines.dsh: ">=0.2.2-rc.1 <0.3.0-0"`).
24
21
 
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.
22
+ - **From the plugin market** — open **Plugins → Discover**, search *"workflow canvas"*, and install ([catalog PR #17180](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/17180)).
23
+ - **From npm** — install `dsh-workflow-canvas` from the **Plugins** panel or via `plugin_manager` / `dsh` CLI (`install_bundle`).
24
+ - **From source** — clone this repo and install it via **Plugins → Add plugin** pointing at the local folder.
34
25
 
35
- After installing, enable the plugin and the `workflow` tab appears in the right
36
- sidebar.
26
+ Once enabled, open the **`Workflow`** tab in the right sidebar.
37
27
 
38
- ## Quick start (30 seconds)
28
+ ---
39
29
 
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."*
30
+ ## Usage
47
31
 
48
- ## How this differs from other canvas plugins
32
+ ### 1. Node types
49
33
 
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).
34
+ There are three node types on the canvas:
55
35
 
56
- ## Nodes
36
+ | Node | Description |
37
+ |---|---|
38
+ | <img src="docs/images/node-entry-en.png" width="220" alt="Entry Lead node" /> | **Entry Lead (start node, always present)**<br>• The starting point of the graph — **right-side output sockets only**.<br>• Write the overall goal in **Task**, or leave it blank and send your prompt directly in chat once the canvas is **● ON**.<br>• Every node that should run must be reachable from here. |
39
+ | <img src="docs/images/node-subagent-en.png" width="220" alt="Subagent node" /> | **Subagent (green top bar — runs in an isolated child session)**<br>• **Model / Reasoning**: Configure model and reasoning effort per node.<br>• **Scope**: `standard` (all tools) or `minimal` (read-only thinking — disables file edits and web), bounded by the main chat's permission mode.<br>• **Fallback**: Automatically retries once on another model if the primary one fails.<br>• **Memory**: Flip **on** and use the dropdown beside it to resume **Latest** or pin any past run (`#1 / #2`).<br>• **Role**: Click the pencil icon to describe what this node is responsible for. |
40
+ | <img src="docs/images/node-lead-en.png" width="220" alt="Lead node" /> | **Lead (blue top bar — runs directly in the main conversation)**<br>• **Never spawned** — handled by your main chat itself.<br>• **Mid-flow** (e.g. `Lead Pick`): pauses with `⏸ Ready` once upstream finishes so you can decide before downstream starts.<br>• **End-of-flow** (e.g. `Lead Review`): delivers the final summary in one shot without an extra round-trip.<br>• Requires at least one subagent upstream (solo Lead-to-Lead nodes render dashed and are skipped). |
41
+
42
+ Load a built-in template from **`☰ Presets`**, or press **`Shift+A`** anywhere on the canvas to add a node (`⋯` also provides `⊞ Auto layout` and `✕ Clear canvas`):
43
+
44
+ ![Add a node with Shift+A and connect it](docs/images/add-node-shift-a.gif)
57
45
 
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.
46
+ ---
64
47
 
65
- ## Links
48
+ ### 2. Links and data flow
66
49
 
67
- | Type | Colour | Carries |
50
+ **Drag from a right-side output socket on an upstream node to a left-side input socket on a downstream node** to pass results forward.
51
+
52
+ Socket colour indicates the channel type — **only matching colours connect**:
53
+ | Colour | Type | Description |
68
54
  |---|---|---|
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** |
55
+ | Grey | `prompt` | Passes plain-text output downstream |
56
+ | Blue | `structured` | Passes a JSON object; the upstream node is automatically asked for structured output |
57
+ | Purple | `session` | Continues inside the upstream child session without reloading context |
72
58
 
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.
59
+ - **Disconnect**: Hold **right-click and sweep across any wire** to cut it (or drag a connected left socket away).
60
+ - **Dashed nodes (inactive)**: Unreachable nodes, solo chained Lead nodes with no subagent upstream, and dangling dead-end subagents render **dashed** and are skipped at run time.
75
61
 
76
- ## Canvas controls & shortcuts
62
+ ![Right-drag to cut a link and re-wire](docs/images/connect-and-cut.gif)
77
63
 
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) |
64
+ ---
65
+
66
+ ### 3. Per-node settings
67
+
68
+ Every subagent node can be configured independently:
69
+ - **Model & Reasoning**: Assign different models and effort levels per step.
70
+ - **Scope**: `standard` (all tools) or `minimal` (read-only thinking). *Bounded by the main chat's permission mode.*
71
+ - **Fallback**: Retries once on another model when the primary model fails.
72
+ - **Memory**: Reuses a past child session across runs and restarts, with a dropdown to pick **Latest** or a specific run.
86
73
 
87
- ## Running
74
+ ![Configure model, reasoning, scope, fallback and memory per node](docs/images/node-config.gif)
88
75
 
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.
76
+ ---
97
77
 
98
- ## Lead handover
78
+ ### 4. Enable and run
99
79
 
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.
80
+ Press **`● ON`** at the top-left of the canvas, then send your task in chat (while enabled, a per-session runtime context notifies the agent automatically):
103
81
 
104
- ## Inspecting, generating and editing the canvas from chat
82
+ - If the entry Lead's task is blank, your chat message is passed as `task`.
83
+ - At an intermediate **Lead** node, the canvas shows **`⏸ Ready`** and hands control to chat; once you reply, downstream nodes resume automatically through the final Lead review.
84
+ - Re-running in the same chat supports `reset: true`; if any node has saved **Memory**, the agent confirms whether to keep memory or clear it (`clearMemory: true`).
105
85
 
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.
86
+ ![Auto-run enabled canvas, pause at Lead decision, and finish](docs/images/lead-pause-resume.gif)
111
87
 
112
- Generate and patch both write the canvas to the workspace, and the panel picks it
113
- up within ~1.5s.
88
+ ---
114
89
 
115
- ## Presets & sharing
90
+ ### 5. Inspect live subagent runs
116
91
 
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`.
92
+ Active nodes glow blue with animated flow wires and turn green when done. **Click the status badge (`Running ↗` / `Done ↗`) at the bottom-right of any subagent node** to open its conversation pane:
120
93
 
121
- ## Memory
94
+ ![Parallel execution and clicking straight into a subagent chat](docs/images/parallel-and-inspect.gif)
122
95
 
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.
96
+ ---
127
97
 
128
- ## Limits
98
+ ## Let the agent draw or edit the canvas from chat
129
99
 
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.
100
+ - **Sketch from one sentence** (`canvas_generate`): *"Build a parallel research workflow on the canvas: two subagents investigate competitors and feasibility, pause for me to decide, then write the plan."*
101
+ - **Patch in place** (`canvas_inspect` + `canvas_patch`): *"Inspect the current canvas, turn Memory on for feasibility, and add a read-only cost-estimate node wired into plan synthesis."* (Preserves your layout.)
136
102
 
137
- ## Making the agent use this plugin
103
+ ## Shortcuts & controls
138
104
 
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:
105
+ | Control / Shortcut | Action |
106
+ |---|---|
107
+ | `Shift+A` | Add a node at the cursor (`1` = Subagent, `2` = Lead) |
108
+ | Middle-drag / `Space` + left-drag | Pan the canvas |
109
+ | Wheel / `⊡ Fit` / `100%` pill | Zoom around cursor / fit all nodes / click to reset 100%, drag left-right to scrub zoom |
110
+ | Marquee drag + `Ctrl+D` / `Delete` | Multi-select move, duplicate (with settings), or batch delete |
111
+ | Right-drag across wires | Cut links (toggle under `⋯`) |
112
+ | `Ctrl+Z` / `Esc` | Undo structural edit / close popups |
113
+ | `⋯` menu | Import / Copy JSON, Auto layout, Clear canvas, Visual effects (Minimal / Standard / Vivid) |
142
114
 
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:
115
+ ## Presets, sharing & limits
149
116
 
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
- ```
117
+ - **Presets & sharing**: `☰ Presets` includes 3 starter templates plus **New blank canvas**; save your own with `☆ Save`. Custom presets live in browser storage — use `⋯ → ⇧ Copy JSON` and `⇩ Import` to share across devices.
118
+ - **How this differs from other canvas plugins**: Built for **multi-subagent orchestration + conversation Lead gates**; for `ctx.workflows` tool/condition pipelines, see [`@piedpiper911/dsh-workflow-canvas`](https://github.com/PiedPiper911/dsh-workflow-canvas).
119
+ - **Limits**: Up to 4 subagents run concurrently; per-node `Scope` only narrows tools within the main chat's permission/sandbox ceiling.
154
120
 
155
121
  ## Development & internals
156
122
 
157
- - For the full architecture, Client ↔ Host sync bridge, DAG wave execution, runtime link semantics, cold resume, and live status tracking, see [**Mechanism & Architecture**](docs/MECHANISM.md) ([中文](docs/MECHANISM.zh.md)).
158
- - Edit `client.js` / `index.js` and reload the app; client changes hot-reload, Host changes need a restart. Run `npm test` for the test suite. See [docs/DETAIL.md](docs/DETAIL.md) for the compact plugin detail page.
123
+ - See [**Mechanism & Architecture**](docs/MECHANISM.md) ([中文](docs/MECHANISM.zh.md)) for the Client ↔ Host bridge, event-driven concurrency pool, link semantics, and cold resume.
124
+ - Edit `client.js` / `index.js` and reload (Host changes require restart). Run `npm test` for the test suite. Compact plugin page: [docs/DETAIL.md](docs/DETAIL.md).
159
125
 
160
126
  ## License
161
127
 
package/README.zh.md CHANGED
@@ -6,120 +6,123 @@
6
6
 
7
7
  中文 | [English](README.md) | [工作机制与架构原理](docs/MECHANISM.zh.md)
8
8
 
9
- 在 DSH 侧边栏里编排子代理工作流:把每一步画成一个节点、用三种连线标出数据怎么流转,
10
- 启用后直接在对话里运行。子代理节点会被真实启动,Lead 节点会暂停运行、由对话本体执行。
9
+ 把 DSH 的多智能体协作画成一张直观的流程图:每个卡片是一名负责具体工作的 AI,连线决定「谁先做、结果交给谁」,点一下启用就能在聊天里直接开跑。
11
10
 
12
- 不必手动画——用一句话描述流程,agent 会替你搭好整张图,之后再随时就地微调。
13
- 节点间的连线一眼就能看懂数据流向:灰线传文本、蓝线传 JSON、紫线让下游接着上游的会话跑。
11
+ - **真并行**:互相不依赖的卡片会自动同时开工(最多 4 个并行),跑完一个立刻推进下游,不用干等。
12
+ - **人机协同**:在关键节点放一个 **Lead 卡片**,跑到那一步会自动停下来问你拍板,确认后再继续往下跑。
13
+ - **完全白盒**:每个子代理的对话记录都能直接点开看,不用猜黑盒里发生了什么。
14
+ - **懒得手动画?** 直接在聊天里用一句话描述分工,AI 会帮你把整张图搭好,之后还能随时说一句让它原地修改。
14
15
 
15
- ![工作流画布](docs/images/canvas-demo-zh.png)
16
+ ![工作流画布总览](docs/images/canvas-demo-zh.png)
16
17
 
17
18
  ## 安装
18
19
 
19
- 需要 DeepSeek Harness **0.2.2** 或更新版本(包声明
20
- `engines.dsh: ">=0.2.2-rc.1 <0.3.0-0"`)。
20
+ 需要 DeepSeek Harness **0.2.2** 或更新版本(`engines.dsh: ">=0.2.2-rc.1 <0.3.0-0"`)。
21
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 目录。
22
+ - **从插件市场安装** —— 打开 **插件 → 发现(Discover)**,搜索 *"workflow canvas"* 安装(目录 PR:[#17180](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/17180))。
23
+ - **从 npm 安装** —— 在 **插件** 面板,或用 `plugin_manager` / `dsh` CLI 的 `install_bundle` 安装 `dsh-workflow-canvas`。
24
+ - **从源码安装** —— 克隆仓库后,通过 **插件 → 添加插件(Add plugin)** 指向本地目录即可。
30
25
 
31
- 装好并启用插件后,右侧边栏会出现 `workflow` 标签页。
26
+ 启用插件后,右侧边栏会出现 **`Workflow`** 标签页。
32
27
 
33
- ## 30 秒快速上手
28
+ ---
34
29
 
35
- - **最快体验(零手动画图)**:打开右侧 `Workflow` 标签页 → 点击 `☰ 预设` 载入内置示例模板 → 点左上角 **● 已启用** → 在对话里说「按画布跑一次」。
36
- - **直接用对话驱动画布**(可复制尝试):
37
- - **一句话搭图**:*「帮我在工作流画布里搭一个并行调研流程:先让两个子代理分别做竞品调研和技术可行性评估,再由我(Lead)拍板,最后交给子代理写方案」*
38
- - **就地微调**:*「先看一下当前画布,把技术可行性节点开启记忆,再补一个只读的成本估算节点并行连到方案合成」*
39
- - **复用模板换任务跑**:*「用当前画布跑一下,总任务改为:评估在现有项目里接入本地知识库的方案」*
30
+ ## 使用说明
40
31
 
41
- ## 与其它画布插件的区别
32
+ ### 1. 节点类型
42
33
 
43
- DSH 生态里不止一个「工作流画布」。本项目在侧边栏里编排**子代理**,Lead 步骤由对话本体执行,
44
- 还支持一句话让 agent 自动搭图。若要的是「工具调用 / 条件分支 / 输出模板」编译成 `ctx.workflows`
45
- 的那类管线,请看 [`@piedpiper911/dsh-workflow-canvas`](https://github.com/PiedPiper911/dsh-workflow-canvas)。
34
+ 画布上有三种节点:
46
35
 
47
- ## 节点
36
+ | 节点 | 说明 |
37
+ |---|---|
38
+ | <img src="docs/images/node-entry-zh.png" width="220" alt="开始节点(入口 Lead)" /> | **入口 Lead(开始节点,不可删除)**<br>• 整张图的起点,**只有右侧输出口**。<br>• 「任务」框用于填写本次流程的总目标;也可以留空,开启画布后直接在聊天框发任务即可自动传入。<br>• 需要参与执行的节点都必须从它连出去。 |
39
+ | <img src="docs/images/node-subagent-zh.png" width="220" alt="子代理节点" /> | **子代理节点(绿顶,独立子会话执行)**<br>• **模型 / 推理**:可为每个节点单独指定模型和推理强度。<br>• **能力**:`standard`(全部工具)或 `minimal`(只读思考,关闭文件读写与联网),受主对话权限上限约束。<br>• **备用**:主模型报错时自动换备用模型重试一次。<br>• **记忆**:打开 `开` 后可在右侧下拉框选 `最新` 或指定某次历史会话(`#1 / #2`)续接。<br>• **分工**:点铅笔图标展开填写该节点的具体职责。 |
40
+ | <img src="docs/images/node-lead-zh.png" width="220" alt="Lead 节点" /> | **Lead 节点(蓝顶,由主对话直接执行)**<br>• **不创建子会话**,直接交回当前主对话完成这一步。<br>• **放在流程中间**(如 `Lead 拍板`):上游完成后暂停并亮起 `⏸ 待拍板`,在对话里确认或补充后再继续跑下游。<br>• **放在流程末尾**(如 `Lead 终审`):所有子代理完成后直接汇总交付,不产生额外回调轮次。<br>• 至少需连入一个子代理上游,否则会显示为虚线并在运行时跳过。 |
41
+
42
+ 可以直接点右上角 **`☰ 预设`** 载入内置模板,或在画布任意位置按 **`Shift+A`** 新建节点(`⋯` 菜单提供 `⊞ 自动排版` 和 `✕ 清空画布`):
43
+
44
+ ![Shift+A 新建节点并连线](docs/images/add-node-shift-a.gif)
48
45
 
49
- - **子代理节点**(顶部绿条)—— 真正 spawn 一个子代理。每个节点可单独设置模型、推理强度、能力范围(`standard` / `minimal`)、备用模型、记忆和分工。
50
- - **Lead 节点**(顶部蓝条)—— 由对话本体执行,从不 spawn。入口 Lead 承载总任务;运行每到一步 Lead 就暂停,等你在对话里完成。
46
+ ---
51
47
 
52
- ## 连线
48
+ ### 2. 连线与数据流向
53
49
 
54
- | 类型 | 颜色 | 传递内容 |
50
+ **从上游节点的右侧端口拖到下游节点的左侧端口**,表示上游完成后把结果传给下游。
51
+
52
+ 端口颜色代表传递方式,**只能同色相连**:
53
+ | 颜色 | 类型 | 说明 |
55
54
  |---|---|---|
56
- | `prompt` | 灰 | 纯文本 |
57
- | `structured` | 蓝 | 一个 JSON 对象;上游节点会被自动要求输出结构化结果 |
58
- | `session` | 紫 | 上游的子会话,下游在**它里面**继续跑 |
55
+ | 灰 | `prompt` | 传递纯文本结果给下游 |
56
+ | 蓝 | `structured` | 传递 JSON 对象;上游会被自动要求输出结构化结果 |
57
+ | 紫 | `session` | 复用上游的子会话,下游在同一个上下文里继续执行 |
59
58
 
60
- 从右端口拖到左端口、或从左端口拖到右端口都能连线(成环会被即时阻止);拖已连接的左端口可断开。
59
+ - **断开连线**:按住**鼠标右键划过连线**即可切断(也可以把左侧已连接的端口拖开)。
60
+ - **虚线节点(不生效)**:未从入口连通的节点、未连入任何子代理的单独串联 Lead、以及存在终审 Lead 却没有连出下游的子代理,都会显示为**虚线框**并在运行时跳过。
61
61
 
62
- ## 画布操作与快捷键
62
+ ![右键划断连线与重连](docs/images/connect-and-cut.gif)
63
63
 
64
- | 操作 / 快捷键 | 效果 |
65
- |---|---|
66
- | `Shift+A` | 在光标位置打开新建节点菜单(按 `1` / `2` 快速落点) |
67
- | 鼠标中键拖拽 / `Space` + 左键拖拽 | 平移画布(鼠标悬停在节点上也可直接拖) |
68
- | 滚轮 / `⊡ 全览` / `100%` | 光标处缩放 / 自适应完整显示全图 / 重置 100% 并聚焦入口 Lead |
69
- | 左键框选 + `Ctrl+D` / `Delete` | 多选拖拽、批量复制(保留模型与参数配置)或批量删除选中节点 |
70
- | `Ctrl+Z` / `Esc` | 撤销结构改动 / 关闭当前浮层与菜单 |
71
- | 右键按住划过连线 | 切断连线(可在 `⋯` 菜单开关);`⋯` 里还提供 `⊞ 自动排版`、`⇧ 复制 JSON` 与三档 `视觉效果`(极简 / 标准 / 炫酷) |
64
+ ---
65
+
66
+ ### 3. 单节点配置
67
+
68
+ 每个子代理节点都支持独立配置:
69
+ - **模型 & 推理强度**:按步骤复杂度分别搭配不同模型与推理档位。
70
+ - **能力范围**:`standard`(全部工具)或 `minimal`(只读思考,关闭文件读写与联网)。*受主对话权限上限约束,只收窄、不提权。*
71
+ - **备用模型**:主模型失败时自动切换重试一次。
72
+ - **记忆**:开启后可续接历史子会话(跨运行及重启后仍可恢复),并通过右侧下拉框选择 `最新` 或具体某次历史会话。
72
73
 
73
- ## 运行
74
+ ![单节点模型、推理、能力与记忆配置](docs/images/node-config.gif)
74
75
 
75
- 1. 在入口 Lead 写总任务,给每个节点写分工(也可以留空任务,在对话里直接让 agent 传 `task` 运行)。
76
- 2. 连好节点——未连线的节点会显示虚线并被跳过。
77
- 3. 点画布左上角的 **● 已启用 / ○ 已禁用** 浮窗,然后在对话里让它跑(支持 `reset: true` 从头重跑)。
78
- 4. 运行按波次并行(每次最多 4 个),每到一个 Lead 节点就暂停,并把已收集的结果交回;点击子代理节点右下角状态胶囊(如 `已完成 ↗`)可直达它的对话记录。
76
+ ---
79
77
 
80
- ## Lead 交接
78
+ ### 4. 启用与运行
81
79
 
82
- 当 `session` 线指向 Lead 节点时,运行会在 Lead 步骤上报那个子会话 id,于是对话可以继续追问那个子代理,而不只是拿到它的文本。
80
+ 连好图后,点画布左上角的 **`● 已启用`**,然后在聊天框直接发任务即可(启用状态下插件会按会话自动注入上下文,无需额外提示调用工具):
83
81
 
84
- ## 从对话读取 / 生成 / 修改画布
82
+ - 入口 Lead 的任务栏可填可不填;留空时,聊天框发出的任务会自动作为 `task` 传入。
83
+ - 跑到中间 Lead 时,画布亮起 **`⏸ 待拍板`** 并交回主对话;回复后下游自动续跑到终审完成。
84
+ - 同一对话重跑支持 `reset: true`;若画布含已产生历史会话的记忆节点,Agent 会在重跑前确认保留记忆还是清空记忆(`clearMemory: true`)。
85
85
 
86
- - `canvas_inspect` —— 只读查看当前画布的启用状态、总任务、节点 id/模型/分工与连线(手动改图或载入预设后,先读再改)。
87
- - `canvas_generate` —— 从一个节点/连线草图重建整张画布(替换)。
88
- - `canvas_patch` —— 就地编辑:按 id 更新节点、增删节点和连线,位置和其余内容保持不变。
86
+ ![启用即跑、Lead 暂停拍板与自动续跑交付](docs/images/lead-pause-resume.gif)
89
87
 
90
- 生成和修改都会把画布写到工作区,面板约 1.5 秒内自动读取。
88
+ ---
91
89
 
92
- ## 预设与分享
90
+ ### 5. 查看子代理执行过程
93
91
 
94
- `☰ 预设` 内置了开箱即用的示例模板,点一下即可载入试跑;给画布起名后点 `☆ 保存` 即可存为自定义预设。若要跨机器或在桌面端 / `dsh web` 之间分享,用 `⋯ → ⇧ 复制 JSON` 与 `⇩ 导入` 即可。
92
+ 运行中,执行中的节点亮蓝光并显示流动连线,完成后变绿。**点击任意子代理节点右下角的 `进行中 ↗` / `已完成 ↗`**,即可打开它的独立对话窗格查看过程与输出:
95
93
 
96
- ## 记忆
94
+ ![多节点真并行与点击直达子代理对话](docs/images/parallel-and-inspect.gif)
97
95
 
98
- 开启记忆的节点会复用它的子会话:同一轮运行内、同一会话的多次运行之间,以及——通过落盘的子会话 id——重启之后(Host 冷恢复)。若 Host 拒绝恢复,该记录会被丢弃、节点重新开始。
96
+ ---
99
97
 
100
- ## 限制
98
+ ## 用对话让 AI 帮你画图 / 改图
101
99
 
102
- - 自定义预设存储在浏览器本地,不在桌面应用和 `dsh web` 之间自动同步,也不跨机器同步(可通过 `⋯ → ⇧ 复制 JSON` 与 `⇩ 导入` 手动迁移或分享)。
103
- - 节点状态读取自子代理目录,因此 Lead 步骤显示 **由对话执行**,而不是一个可追踪的状态。
104
- - 同一时间最多并行运行 4 个节点。
100
+ 除了手动拖拽,你也可以直接对聊天框说:
101
+ - **一句话搭图**(`canvas_generate`):*「帮我在工作流画布里搭一个并行调研流程:两个子代理分别做竞品和技术可行性,再让我拍板,最后写方案」*
102
+ - **原地微调**(`canvas_inspect` + `canvas_patch`):*「看一下当前画布,把技术可行性开启记忆,再加一个只读成本估算节点并行连到方案合成」*(不会打乱你摆好的位置)
105
103
 
106
- ## 让 agent 使用这个插件
104
+ ## 常用快捷键一览
107
105
 
108
- 内置指南以名为 `workflow-canvas` 的技能发布。DSH 没有「自动加载」开关:模型在技能目录里看到每个技能的**名字和描述**,然后按需加载正文。三件事让它更可靠:
106
+ | 操作 / 快捷键 | 效果 |
107
+ |---|---|
108
+ | `Shift+A` | 在鼠标位置新建节点(按 `1` 加子代理,`2` 加 Lead) |
109
+ | 鼠标中键拖拽 / `Space` + 左键拖拽 | 平移画布 |
110
+ | 滚轮 / `⊡ 全览` / `100%` 按钮 | 光标处缩放 / 一键居中看全图 / 点击回 100%,左右拖可连续缩放 |
111
+ | 左键框选 + `Ctrl+D` / `Delete` | 批量移动、批量复制(连同参数配置)或批量删除 |
112
+ | 右键按住划过连线 | 切断连线(可在 `⋯` 菜单开关) |
113
+ | `Ctrl+Z` / `Esc` | 撤销上一步改动 / 关闭菜单弹窗 |
114
+ | `⋯` 更多菜单 | 导入 / 复制 JSON、自动排版、清空画布、切换三档视觉效果(极简 / 标准 / 炫酷) |
109
115
 
110
- 1. **描述里写进触发词** —— canvas、workflow、pipeline、node graph、画布、工作流、编排。
111
- 2. **从工具指路** —— 每个 `canvas_*` 工具的说明都提示先加载该技能,而工具永远在上下文里。
112
- 3. **在项目的 `AGENTS.md` 里加一行** —— 最稳的办法,因为它每次都会加载:
116
+ ## 预设、分享与限制
113
117
 
114
- ```markdown
115
- 当任务涉及 workflow canvas(画布 / 工作流 / 编排)或 canvas_* 工具时,
116
- 先调用 `skill` 工具加载 `workflow-canvas`。
117
- ```
118
+ - **预设与分享**:`☰ 预设` 内置 3 套开箱即用模板和「新建空白画布」;输入名字点 `☆ 保存` 存为自己的预设。自定义预设保存在本地浏览器存储中,跨设备分享请用 `⋯ → ⇧ 复制 JSON` 与 `⇩ 导入`。
119
+ - **与其它画布插件的区别**:本项目专注**多子代理编排 + 对话本体拍板**;如果你需要的是把工具调用/条件分支编译为 `ctx.workflows` 的管线,可看 [`@piedpiper911/dsh-workflow-canvas`](https://github.com/PiedPiper911/dsh-workflow-canvas)。
120
+ - **运行限制**:同时最多并行运行 4 个子代理;子代理的「能力」受主对话权限/沙箱上限约束。
118
121
 
119
122
  ## 开发与原理
120
123
 
121
- - 底层架构、双向同步通道、波次执行、三种连线运行时行为与冷恢复机制详见 [**工作机制与架构原理**](docs/MECHANISM.zh.md)([English](docs/MECHANISM.md))。
122
- - 编辑 `client.js` / `index.js` 后重载应用;客户端改动热更生效,Host 改动需要重启。运行 `npm test` 执行单测;插件详情页说明见 [docs/DETAIL.md](docs/DETAIL.md)。
124
+ - 底层双向同步、并发池调度、三色连线运行时机制与冷恢复详见 [**工作机制与架构原理**](docs/MECHANISM.zh.md)([English](docs/MECHANISM.md))。
125
+ - 本地开发:改完 `client.js` / `index.js` 重载应用(Host 改动需重启),运行 `npm test` 执行全套单测。插件详情页见 [docs/DETAIL.md](docs/DETAIL.md)。
123
126
 
124
127
  ## 许可
125
128