dsh-workflow-canvas 1.4.0 → 1.5.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,6 +1,7 @@
1
1
  # DSH Workflow Canvas
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/dsh-workflow-canvas)](https://www.npmjs.com/package/dsh-workflow-canvas)
4
+ [![CI](https://github.com/Wasabi2575/dsh-workflow-canvas/actions/workflows/test.yml/badge.svg)](https://github.com/Wasabi2575/dsh-workflow-canvas/actions/workflows/test.yml)
4
5
  [![DSH](https://img.shields.io/badge/DSH-%3E%3D0.2.2-2f81f7)](https://github.com/Wasabi2575/dsh-workflow-canvas)
5
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-3fb950.svg)](LICENSE)
6
7
 
@@ -9,7 +10,7 @@ English | [中文](README.zh.md) | [Mechanism & Architecture](docs/MECHANISM.md)
9
10
  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.
10
11
 
11
12
  - **Real parallelism**: Independent nodes run concurrently (default 4, configurable 1–8 under `⋯`), and newly unblocked downstream nodes start the instant their inputs finish.
12
- - **Conditional branching**: Drop a **Condition** node anywhere to route downstream along `✓ Yes` or `✕ No` based on upstream results — the unchosen branch is skipped automatically without spawning.
13
+ - **Conditional branching & controlled retry loops**: Drop a **Condition** node anywhere to route downstream (`✓ Yes` / `✕ No` or multi-way `switch/case`), or wire a branch back upstream (or right-click selected nodes → **`↺ Create loop`**) for bounded feedback-driven retries that circuit-break to Lead when exhausted.
13
14
  - **Human-in-the-loop**: Drop a **Lead** card anywhere in the flow to pause automatically for your decision before continuing.
14
15
  - **Zero black box**: Click any subagent card to open its live chat transcript and inspect its exact output.
15
16
  - **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.
@@ -77,15 +78,21 @@ Every subagent node can be configured independently:
77
78
 
78
79
  ---
79
80
 
80
- ### 4. Conditional branching & dynamic pruning
81
+ ### 4. Conditional branching, dynamic pruning & retry loops
81
82
 
82
- Drop a **Condition** node anywhere in the graph to route downstream automatically based on upstream outputs:
83
+ Drop a **Condition** node anywhere in the graph to route downstream automatically or loop back with feedback on failure:
83
84
 
84
85
  - Supports default binary **`Yes / No`**, multi-way **`switch/case`** via **`+ Case`** (e.g. `Pass / Minor Fix / Rewrite`), and **`Single / Multi`** match modes.
85
86
  - Unchosen branches are pruned automatically without spawning; if zero branches match or the condition node itself fails, it never guesses — it skips intermediate branches and hands off to the nearest downstream Lead.
86
87
  - Once judged, a compact verdict pill appears right under the condition card (click to inspect the full verdict reason), while unchosen branch edges and skipped nodes dim automatically.
88
+ - **Controlled retry loops (`↺`)**:
89
+ - **Two ways to create**: Select one or more connected nodes → right-click **`↺ Create loop`** (auto-inserts a lightweight condition gate if the tail is a regular subagent), or drag a condition branch wire directly back to a strict ancestor node.
90
+ - **Clear visuals & free limit control**: Loop members get a color-coded outer dashed outline & `↺` badge (never clashing with running/done/failed borders), connected by an outer bypass rail; click the midpoint **`↺ ×3`** pill to adjust max retries (`1–10`) or remove the loop.
91
+ - **Feedback & circuit-break**: Retries reset only strict loop members (bypass nodes are never re-run), inject the condition's rejection reason while reusing healthy warm sessions, and circuit-break at max retries by handing all round summaries to the nearest downstream Lead.
87
92
  - **Per-node & global `+ Refs` list**: Click **`+ Refs`** in the top-right title bar of any node (Entry Lead global refs, downstream Leads, Subagents, or Condition nodes) to attach up to 16 reference file paths, URLs, or constraints — deduplicated and injected into prompts automatically at run time.
88
93
 
94
+ ![Controlled retry loop: Implement → Test & Verify → Checks Passed ↺ Auto-fix](docs/images/retry-loop-en.png)
95
+
89
96
  ![3-way switch/case conditional routing and automatic branch pruning](docs/images/condition-switch-run.gif)
90
97
 
91
98
  ---
@@ -125,15 +132,15 @@ Active nodes glow blue with animated flow wires and turn green when done. **Clic
125
132
  | Middle-drag / `Space` + left-drag | Pan the canvas |
126
133
  | Wheel / bottom-right `⊡` & `100%` pill | Zoom around cursor / fit all nodes / click to reset 100%, drag left-right to scrub zoom |
127
134
  | `⇄ Horiz` / `⇅ Vert` | Switch canvas direction and auto-layout (vertical mode uses top-in / bottom-out vertical curves for narrow sidebars; Condition nodes support `Out R / Out L` side toggle) |
128
- | Marquee drag + `Shift+D` / `Delete` | Multi-select move, duplicate (with settings & internal links), or batch delete |
129
- | Right-click node / edge / canvas | Context menu (edit role, manage refs, insert node on wire, add nodes, layout, undo) |
135
+ | Marquee / `Shift`/`Ctrl` click + `Shift+D` / `Delete` | Multi-select move, duplicate (with settings & internal links), or batch delete |
136
+ | Right-click node / edge / canvas | Context menu (edit role, manage refs, insert node on wire, add nodes, layout, undo/redo) |
130
137
  | Right-drag across wires | Cut links (activates at ≥ 6px drag without conflicting with context menu; toggle under `⋯`) |
131
- | `Ctrl+Z` / `Esc` | Undo structural edit / close popups |
138
+ | `Ctrl+Z` / `Ctrl+Shift+Z` (`Ctrl+Y`) / `Esc` | Undo / redo structural edit / close popups |
132
139
  | `⋯` menu | Undo, Fit, Import / Copy JSON, Auto layout, Clear canvas, Visual effects, Max parallel, Language, Shortcuts |
133
140
 
134
141
  ## Presets, sharing & limits
135
142
 
136
- - **Presets & cross-session reuse**: Click `☰ Presets` to save the current canvas at the top of the menu (immediately available in any new chat), or load one of the 4 starter templates and **New blank canvas**. Custom presets live in browser storage — use `⋯ → ⇧ Copy JSON` and `⇩ Import` to share across devices.
143
+ - **Presets & cross-session reuse**: Click `☰ Presets` to save the current canvas at the top of the menu (immediately available in any new chat), or load one of the 5 starter templates (including conditional branching & retry loop) and **New blank canvas**. Custom presets live in browser storage — use `⋯ → ⇧ Copy JSON` and `⇩ Import` to share across devices.
137
144
  - **Partial resume & concurrency**: If a mid-flow node fails, call `retryFailed: true` or `fromNodes` to reuse succeeded outputs and re-run only the failed segment and its downstream; adjust max concurrency (1 / 2 / 4 / 6 / 8, default 4) under `⋯`.
138
145
  - **How this differs from other canvas plugins**: Built for **multi-subagent orchestration + conditional routing + conversation Lead gates**; for `ctx.workflows` low-level tool pipelines, see [`@piedpiper911/dsh-workflow-canvas`](https://github.com/PiedPiper911/dsh-workflow-canvas).
139
146
  - **Limits**: Per-node `Scope` only narrows tools within the main chat's permission/sandbox ceiling.
package/README.zh.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # DSH Workflow Canvas(可视化工作流画布)
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/dsh-workflow-canvas)](https://www.npmjs.com/package/dsh-workflow-canvas)
4
+ [![CI](https://github.com/Wasabi2575/dsh-workflow-canvas/actions/workflows/test.yml/badge.svg)](https://github.com/Wasabi2575/dsh-workflow-canvas/actions/workflows/test.yml)
4
5
  [![DSH](https://img.shields.io/badge/DSH-%3E%3D0.2.2-2f81f7)](https://github.com/Wasabi2575/dsh-workflow-canvas)
5
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-3fb950.svg)](LICENSE)
6
7
 
@@ -9,7 +10,7 @@
9
10
  把 DSH 的多智能体协作画成一张直观的流程图:每个卡片是一名负责具体工作的 AI,连线决定「谁先做、结果交给谁」,点一下启用就能在聊天里直接开跑。
10
11
 
11
12
  - **真并行**:互相不依赖的卡片会自动同时开工(默认 4 路并发,可在 `⋯` 菜单按需调节 1–8 路),跑完一个立刻推进下游,不用干等。
12
- - **条件分支**:放入 **条件节点** 即可根据上游执行结果自动分流(`✓ 是` / `✕ 否`),未命中的分支自动跳过、不消耗额外额度。
13
+ - **条件分支 & 失败回环重试**:放入 **条件节点** 即可根据上游执行结果自动分流(`✓ 是` / `✕ 否` 或多路 `switch/case`),更支持将条件分支连回上游(或多选节点右键「`↺ 设为回环`」)组成**带反馈的受控重试循环**,达上限自动熔断并汇总转交 Lead。
13
14
  - **人机协同**:在关键节点放一个 **Lead 卡片**,跑到那一步会自动停下来问你拍板,确认后再继续往下跑。
14
15
  - **完全白盒**:每个子代理的对话记录都能直接点开看,不用猜黑盒里发生了什么。
15
16
  - **懒得手动画?** 直接在聊天里用一句话描述分工,AI 会帮你把整张图搭好,之后还能随时说一句让它原地修改。
@@ -77,15 +78,21 @@
77
78
 
78
79
  ---
79
80
 
80
- ### 4. 条件分支与动态剪枝
81
+ ### 4. 条件分支、动态剪枝与受控回环
81
82
 
82
- 在流程中放入 **条件节点**,即可根据上游子代理或 Lead 的实际输出自动路由:
83
+ 在流程中放入 **条件节点**,即可根据上游子代理或 Lead 的实际输出自动路由或触发带反馈的自动重试:
83
84
 
84
85
  - 支持默认二分支 **`是 / 否`**、点击 **`+ 分支`** 扩展多路 **`switch/case`**(如 `通过 / 小修 / 重做`),以及 **`单选 / 多选`** 两种匹配模式。
85
86
  - 未命中的分支自动剪枝跳过、不消耗额度;所有分支均未命中或条件节点自身失败时,不擅自乱选,直接转交最近下游 Lead 处理。
86
87
  - 判决完成后,条件节点下方会直接显示命中分支标签(点击可查看完整判断理由),未命中的分支连线与被跳过节点自动淡化标示。
88
+ - **受控回环重试(`↺` 失败带反馈重做)**:
89
+ - **两种创建方式**:框选或 `Shift`/`Ctrl` 点选一组节点 → 右键 **「↺ 设为回环」**(若末尾是普通子代理,自动补一个「是否通过?」条件判断节点并接好回环);或直接从条件节点的分支出口拖线连回上游祖先节点。
90
+ - **视觉高亮与调参**:环内节点自动套上同色外圈虚线轮廓与 `↺` 角标(不遮挡运行蓝/绿/红边框),回环边自动绕开卡片外侧走圆角虚线弧线;点击弧线中点 **`↺ ×3`** 徽章即可用 `− / +` 或直接输入自由调整最大重试次数(`1–10`)或取消回环。
91
+ - **带反馈修正与熔断**:每次打回只重置环内节点(环外旁路绝不重复执行),把条件节点的打回理由注入回环起点,并智能复用健康热会话原地修正;超过上限自动熔断,将 `1..N` 轮失败摘要转交最近下游 Lead 拍板。
87
92
  - **节点 `+ 参考` 清单**:所有节点(包括入口 Lead 全局参考、下游 Lead、子代理、条件节点)标题栏右上角均提供 **`+ 参考`** 按钮,可附带文件路径、URL 或规范约束(最多 16 条),运行时自动去重注入提示词。
88
93
 
94
+ ![受控回环重试:编写实现 → 测试与检查 → 是否通过 ↺ 自动修复](docs/images/retry-loop-zh.png)
95
+
89
96
  ![三路 switch/case 条件分支判断与自动剪枝](docs/images/condition-switch-run.gif)
90
97
 
91
98
  ---
@@ -126,15 +133,15 @@
126
133
  | 鼠标中键拖拽 / `Space` + 左键拖拽 | 平移画布 |
127
134
  | 滚轮 / 右下角 `⊡` & `100%` 浮条 | 光标处缩放 / 一键居中看全图 / 点击回 100%,左右拖可连续缩放 |
128
135
  | `⇄ 横排` / `⇅ 竖排` | 一键切换画布流向并自动重排(竖排为顶入底出 + 垂直曲线,更适合窄侧边栏;条件节点支持 `右出 / 左出` 切换) |
129
- | 左键框选 + `Shift+D` / `Delete` | 批量移动、批量复制(连同参数配置与内部连线)或批量删除 |
130
- | 右键单击节点 / 连线 / 空白处 | 打开右键上下文菜单(编辑分工、管理参考、在连线中间插入节点、新建/排版/撤销等) |
136
+ | 左键框选 / `Shift`/`Ctrl` 点选 + `Shift+D` / `Delete` | 批量移动、批量复制(连同参数配置与内部连线)或批量删除 |
137
+ | 右键单击节点 / 连线 / 空白处 | 打开右键上下文菜单(编辑分工、管理参考、在连线中间插入节点、新建/排版/撤销重做等) |
131
138
  | 右键按住划过连线 | 切断连线(移动 ≥ 6px 触发,与右键菜单不冲突;可在 `⋯` 菜单开关) |
132
- | `Ctrl+Z` / `Esc` | 撤销上一步改动 / 关闭菜单弹窗 |
139
+ | `Ctrl+Z` / `Ctrl+Shift+Z`(`Ctrl+Y`) / `Esc` | 撤销 / 重做上一步改动 / 关闭菜单弹窗 |
133
140
  | `⋯` 更多菜单 | 撤销、全览、导入 / 复制 JSON、自动排版、清空画布、动效档位、最大并发、语言切换、快捷键设置 |
134
141
 
135
142
  ## 预设、分享与限制
136
143
 
137
- - **预设与跨会话复用**:点右上角 `☰ 预设` 即可在顶部将当前画布保存为自定义预设(跨会话通用,新对话一键载入),下方还内置 4 套开箱即用模板(含条件分支)和「新建空白画布」。自定义预设保存在本地浏览器存储中,跨设备分享请用 `⋯ → ⇧ 复制 JSON` 与 `⇩ 导入`。
144
+ - **预设与跨会话复用**:点右上角 `☰ 预设` 即可在顶部将当前画布保存为自定义预设(跨会话通用,新对话一键载入),下方还内置 5 套开箱即用模板(含条件分支与循环重试)和「新建空白画布」。自定义预设保存在本地浏览器存储中,跨设备分享请用 `⋯ → ⇧ 复制 JSON` 与 `⇩ 导入`。
138
145
  - **局部重跑与并发调节**:中间节点失败后支持 `retryFailed: true` 或 `fromNodes` 只重跑失败段及下游、复用已成功节点缓存;`⋯` 菜单可调整最大并发数(1 / 2 / 4 / 6 / 8,默认 4)。
139
146
  - **与其它画布插件的区别**:本项目专注**多子代理编排 + 条件分流 + 对话本体拍板**;如果你需要的是把底层工具调用编译为 `ctx.workflows` 的管线,可看 [`@piedpiper911/dsh-workflow-canvas`](https://github.com/PiedPiper911/dsh-workflow-canvas)。
140
147
  - **运行限制**:子代理的「能力」受主对话权限/沙箱上限约束。