dsh-workflow-canvas 0.0.0-stage → 0.1.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.
@@ -0,0 +1,4 @@
1
+ - insert:
2
+ - id: dsh-workflow-canvas
3
+ name: '@local/dsh-workflow-canvas'
4
+ config: {}
package/docs/DETAIL.md ADDED
@@ -0,0 +1,53 @@
1
+ # Workflow canvas
2
+
3
+ A Blender-style node canvas for orchestrating DSH agents, docked in the right
4
+ Sidebar. Draw a DAG, enable it, and ask the agent to run it — subagent nodes are
5
+ spawned for real, Lead nodes pause the run and are performed by the conversation
6
+ itself.
7
+
8
+ ## Canvas
9
+
10
+ - **Subagent node** (green top bar): spawns a child agent with its own
11
+ `provider` / `model` / `reasoning effort` / capability scope. Optional **记忆**
12
+ reuses the node's session; optional **备用** retries once on a fallback model.
13
+ - **Lead node** (blue top bar): performed by the conversation, never spawned. The
14
+ entry node carries the task; added Lead nodes carry a role.
15
+ - **Sockets are typed** (`prompt` / `structured` / `session`); a link can only
16
+ join the same type, in either direction. Drag a connected input away to detach.
17
+ - Nodes the entry cannot reach are drawn dashed and skipped at run time.
18
+ - Wheel zooms around the cursor; the percentage button resets and recentres on the
19
+ Lead; `◎ 定位` recentres without changing zoom.
20
+ - Marquee selection: press on empty canvas and drag; dragging any selected node
21
+ moves the whole selection.
22
+ - Right-drag across links cuts them on release; the swept path and the links about
23
+ to be cut are drawn in red. Toggle it under `⋯`.
24
+
25
+ ## Editing from chat
26
+
27
+ | Tool | Effect |
28
+ |---|---|
29
+ | `canvas_generate` | replaces the canvas with a node/edge sketch |
30
+ | `canvas_patch` | edits in place: update nodes by id, add/remove nodes and links |
31
+
32
+ Both publish `<workspace>/.dsh/canvas/<session>.json`, which the panel polls every
33
+ 1.5s. A patch document is applied in merge mode, so node positions survive.
34
+
35
+ ## Running
36
+
37
+ Subagent nodes run in parallel waves (up to 4). The run stops at every Lead node
38
+ with `status: "need-lead"` and returns the collected results plus, for `session`
39
+ links into that Lead, the upstream child session ids so the conversation can keep
40
+ talking to those agents.
41
+
42
+ ## Memory
43
+
44
+ `节点 id → child session id` is remembered on disk, keyed per session. A node with
45
+ memory on resumes that child (cold resume after a restart); if the Host refuses,
46
+ the record is dropped and the node starts fresh.
47
+
48
+ ## Limits
49
+
50
+ - Presets live in browser storage: not shared between the Desktop app and
51
+ `dsh web`, not synchronised across machines.
52
+ - Lead steps have no tracked state; they show **由对话执行**.
53
+ - Up to 4 nodes run at a time.
Binary file
Binary file
@@ -0,0 +1,86 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="920" height="300" viewBox="0 0 920 300" font-family="ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif">
2
+ <defs>
3
+ <linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">
4
+ <stop offset="0" stop-color="#14161a"/>
5
+ <stop offset="1" stop-color="#0e1013"/>
6
+ </linearGradient>
7
+ <style>
8
+ .card { fill:#22252b; stroke:#3a3f47; stroke-width:1; rx:10; }
9
+ .title { fill:#e6e8eb; font-size:13px; font-weight:600; }
10
+ .label { fill:#8b9099; font-size:9px; }
11
+ .field { fill:#171a1f; stroke:#3a3f47; stroke-width:1; rx:4; }
12
+ .value { fill:#c9ced6; font-size:10px; }
13
+ .portlabel { fill:#8b9099; font-size:9px; }
14
+ .link { fill:none; stroke-width:2; }
15
+ </style>
16
+ </defs>
17
+
18
+ <rect width="920" height="300" fill="url(#bg)"/>
19
+
20
+ <!-- Lead node -->
21
+ <g transform="translate(40, 60)">
22
+ <rect class="card" width="216" height="176"/>
23
+ <path d="M0 10a10 10 0 0 1 10-10h196a10 10 0 0 1 10 10v2H0z" fill="#2f81f7"/>
24
+ <text class="title" x="12" y="32">Lead · 本对话</text>
25
+ <text class="label" x="12" y="54">任务</text>
26
+ <rect class="field" x="12" y="60" width="192" height="70"/>
27
+ <text class="value" x="18" y="76">把反馈分类,给出建议,</text>
28
+ <text class="value" x="18" y="92">最后我复核</text>
29
+
30
+ <text class="portlabel" x="96" y="150">prompt</text>
31
+ <text class="portlabel" x="96" y="166">structured</text>
32
+ <circle cx="206" cy="146" r="6" fill="#22252b" stroke="#8a8f98" stroke-width="2"/>
33
+ <circle cx="206" cy="162" r="6" fill="#22252b" stroke="#2f81f7" stroke-width="2"/>
34
+ </g>
35
+
36
+ <!-- link -->
37
+ <path class="link" stroke="#8a8f98" d="M246 206 C 296 206, 306 206, 356 206"/>
38
+ <path class="link" stroke="#2f81f7" d="M246 222 C 296 222, 306 222, 356 222"/>
39
+
40
+ <!-- Subagent node -->
41
+ <g transform="translate(356, 60)">
42
+ <rect class="card" width="216" height="176"/>
43
+ <path d="M0 10a10 10 0 0 1 10-10h196a10 10 0 0 1 10 10v2H0z" fill="#3fb950"/>
44
+ <text class="title" x="12" y="32">分类</text>
45
+
46
+ <text class="label" x="12" y="52">模型</text>
47
+ <rect class="field" x="42" y="42" width="162" height="18"/>
48
+ <text class="value" x="48" y="55">DeepSeek-V4-Flash ▾</text>
49
+
50
+ <text class="label" x="12" y="74">推理</text>
51
+ <rect class="field" x="42" y="64" width="162" height="18"/>
52
+ <text class="value" x="48" y="77">默认 ▾</text>
53
+
54
+ <text class="label" x="12" y="96">能力</text>
55
+ <rect class="field" x="42" y="86" width="162" height="18"/>
56
+ <text class="value" x="48" y="99">standard ▾</text>
57
+
58
+ <text class="label" x="12" y="118">备用</text>
59
+ <rect class="field" x="42" y="108" width="162" height="18"/>
60
+ <text class="value" x="48" y="121">无 ▾</text>
61
+
62
+ <text class="label" x="12" y="140">记忆</text>
63
+ <rect class="field" x="42" y="130" width="162" height="18"/>
64
+ <text class="value" x="48" y="143">关</text>
65
+
66
+ <text class="portlabel" x="96" y="150">prompt</text>
67
+ <text class="portlabel" x="96" y="166">structured</text>
68
+ <circle cx="0" cy="146" r="6" fill="#22252b" stroke="#8a8f98" stroke-width="2"/>
69
+ <circle cx="0" cy="162" r="6" fill="#22252b" stroke="#2f81f7" stroke-width="2"/>
70
+ <circle cx="206" cy="146" r="6" fill="#22252b" stroke="#8a8f98" stroke-width="2"/>
71
+ <circle cx="206" cy="162" r="6" fill="#22252b" stroke="#a371f7" stroke-width="2"/>
72
+ </g>
73
+
74
+ <!-- legend -->
75
+ <g transform="translate(620, 96)">
76
+ <rect class="card" width="260" height="120"/>
77
+ <text class="title" x="14" y="24" font-size="12">节点与连线</text>
78
+ <rect x="14" y="38" width="10" height="4" fill="#2f81f7"/>
79
+ <text class="value" x="32" y="45">Lead:对话本体执行,不新开子代理</text>
80
+ <rect x="14" y="60" width="10" height="4" fill="#3fb950"/>
81
+ <text class="value" x="32" y="67">Subagent:真正 spawn 子代理</text>
82
+ <circle cx="19" cy="88" r="5" fill="#22252b" stroke="#8a8f98" stroke-width="2"/>
83
+ <text class="value" x="32" y="92">prompt 灰 / structured 蓝 / session 紫</text>
84
+ <text class="label" x="14" y="110">端口同色才能相连</text>
85
+ </g>
86
+ </svg>
package/icon.svg ADDED
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
2
+ <rect x="4" y="4" width="56" height="56" rx="12" fill="#1a7f5c"/>
3
+ <circle cx="18" cy="20" r="7" fill="#ffffff"/>
4
+ <circle cx="46" cy="20" r="7" fill="#ffffff"/>
5
+ <circle cx="32" cy="46" r="7" fill="#ffffff"/>
6
+ <path d="M25 20 L39 20" stroke="#ffffff" stroke-width="3" fill="none"/>
7
+ <path d="M18 27 L27 40" stroke="#ffffff" stroke-width="3" fill="none"/>
8
+ <path d="M46 27 L37 40" stroke="#ffffff" stroke-width="3" fill="none"/>
9
+ </svg>