dsh-workflow-canvas 1.4.1 → 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
@@ -10,7 +10,7 @@ English | [中文](README.zh.md) | [Mechanism & Architecture](docs/MECHANISM.md)
10
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.
11
11
 
12
12
  - **Real parallelism**: Independent nodes run concurrently (default 4, configurable 1–8 under `⋯`), and newly unblocked downstream nodes start the instant their inputs finish.
13
- - **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.
14
14
  - **Human-in-the-loop**: Drop a **Lead** card anywhere in the flow to pause automatically for your decision before continuing.
15
15
  - **Zero black box**: Click any subagent card to open its live chat transcript and inspect its exact output.
16
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.
@@ -78,15 +78,21 @@ Every subagent node can be configured independently:
78
78
 
79
79
  ---
80
80
 
81
- ### 4. Conditional branching & dynamic pruning
81
+ ### 4. Conditional branching, dynamic pruning & retry loops
82
82
 
83
- 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:
84
84
 
85
85
  - Supports default binary **`Yes / No`**, multi-way **`switch/case`** via **`+ Case`** (e.g. `Pass / Minor Fix / Rewrite`), and **`Single / Multi`** match modes.
86
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.
87
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.
88
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.
89
93
 
94
+ ![Controlled retry loop: Implement → Test & Verify → Checks Passed ↺ Auto-fix](docs/images/retry-loop-en.png)
95
+
90
96
  ![3-way switch/case conditional routing and automatic branch pruning](docs/images/condition-switch-run.gif)
91
97
 
92
98
  ---
@@ -134,7 +140,7 @@ Active nodes glow blue with animated flow wires and turn green when done. **Clic
134
140
 
135
141
  ## Presets, sharing & limits
136
142
 
137
- - **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.
138
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 `⋯`.
139
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).
140
146
  - **Limits**: Per-node `Scope` only narrows tools within the main chat's permission/sandbox ceiling.
package/README.zh.md CHANGED
@@ -10,7 +10,7 @@
10
10
  把 DSH 的多智能体协作画成一张直观的流程图:每个卡片是一名负责具体工作的 AI,连线决定「谁先做、结果交给谁」,点一下启用就能在聊天里直接开跑。
11
11
 
12
12
  - **真并行**:互相不依赖的卡片会自动同时开工(默认 4 路并发,可在 `⋯` 菜单按需调节 1–8 路),跑完一个立刻推进下游,不用干等。
13
- - **条件分支**:放入 **条件节点** 即可根据上游执行结果自动分流(`✓ 是` / `✕ 否`),未命中的分支自动跳过、不消耗额外额度。
13
+ - **条件分支 & 失败回环重试**:放入 **条件节点** 即可根据上游执行结果自动分流(`✓ 是` / `✕ 否` 或多路 `switch/case`),更支持将条件分支连回上游(或多选节点右键「`↺ 设为回环`」)组成**带反馈的受控重试循环**,达上限自动熔断并汇总转交 Lead。
14
14
  - **人机协同**:在关键节点放一个 **Lead 卡片**,跑到那一步会自动停下来问你拍板,确认后再继续往下跑。
15
15
  - **完全白盒**:每个子代理的对话记录都能直接点开看,不用猜黑盒里发生了什么。
16
16
  - **懒得手动画?** 直接在聊天里用一句话描述分工,AI 会帮你把整张图搭好,之后还能随时说一句让它原地修改。
@@ -78,15 +78,21 @@
78
78
 
79
79
  ---
80
80
 
81
- ### 4. 条件分支与动态剪枝
81
+ ### 4. 条件分支、动态剪枝与受控回环
82
82
 
83
- 在流程中放入 **条件节点**,即可根据上游子代理或 Lead 的实际输出自动路由:
83
+ 在流程中放入 **条件节点**,即可根据上游子代理或 Lead 的实际输出自动路由或触发带反馈的自动重试:
84
84
 
85
85
  - 支持默认二分支 **`是 / 否`**、点击 **`+ 分支`** 扩展多路 **`switch/case`**(如 `通过 / 小修 / 重做`),以及 **`单选 / 多选`** 两种匹配模式。
86
86
  - 未命中的分支自动剪枝跳过、不消耗额度;所有分支均未命中或条件节点自身失败时,不擅自乱选,直接转交最近下游 Lead 处理。
87
87
  - 判决完成后,条件节点下方会直接显示命中分支标签(点击可查看完整判断理由),未命中的分支连线与被跳过节点自动淡化标示。
88
+ - **受控回环重试(`↺` 失败带反馈重做)**:
89
+ - **两种创建方式**:框选或 `Shift`/`Ctrl` 点选一组节点 → 右键 **「↺ 设为回环」**(若末尾是普通子代理,自动补一个「是否通过?」条件判断节点并接好回环);或直接从条件节点的分支出口拖线连回上游祖先节点。
90
+ - **视觉高亮与调参**:环内节点自动套上同色外圈虚线轮廓与 `↺` 角标(不遮挡运行蓝/绿/红边框),回环边自动绕开卡片外侧走圆角虚线弧线;点击弧线中点 **`↺ ×3`** 徽章即可用 `− / +` 或直接输入自由调整最大重试次数(`1–10`)或取消回环。
91
+ - **带反馈修正与熔断**:每次打回只重置环内节点(环外旁路绝不重复执行),把条件节点的打回理由注入回环起点,并智能复用健康热会话原地修正;超过上限自动熔断,将 `1..N` 轮失败摘要转交最近下游 Lead 拍板。
88
92
  - **节点 `+ 参考` 清单**:所有节点(包括入口 Lead 全局参考、下游 Lead、子代理、条件节点)标题栏右上角均提供 **`+ 参考`** 按钮,可附带文件路径、URL 或规范约束(最多 16 条),运行时自动去重注入提示词。
89
93
 
94
+ ![受控回环重试:编写实现 → 测试与检查 → 是否通过 ↺ 自动修复](docs/images/retry-loop-zh.png)
95
+
90
96
  ![三路 switch/case 条件分支判断与自动剪枝](docs/images/condition-switch-run.gif)
91
97
 
92
98
  ---
@@ -135,7 +141,7 @@
135
141
 
136
142
  ## 预设、分享与限制
137
143
 
138
- - **预设与跨会话复用**:点右上角 `☰ 预设` 即可在顶部将当前画布保存为自定义预设(跨会话通用,新对话一键载入),下方还内置 4 套开箱即用模板(含条件分支)和「新建空白画布」。自定义预设保存在本地浏览器存储中,跨设备分享请用 `⋯ → ⇧ 复制 JSON` 与 `⇩ 导入`。
144
+ - **预设与跨会话复用**:点右上角 `☰ 预设` 即可在顶部将当前画布保存为自定义预设(跨会话通用,新对话一键载入),下方还内置 5 套开箱即用模板(含条件分支与循环重试)和「新建空白画布」。自定义预设保存在本地浏览器存储中,跨设备分享请用 `⋯ → ⇧ 复制 JSON` 与 `⇩ 导入`。
139
145
  - **局部重跑与并发调节**:中间节点失败后支持 `retryFailed: true` 或 `fromNodes` 只重跑失败段及下游、复用已成功节点缓存;`⋯` 菜单可调整最大并发数(1 / 2 / 4 / 6 / 8,默认 4)。
140
146
  - **与其它画布插件的区别**:本项目专注**多子代理编排 + 条件分流 + 对话本体拍板**;如果你需要的是把底层工具调用编译为 `ctx.workflows` 的管线,可看 [`@piedpiper911/dsh-workflow-canvas`](https://github.com/PiedPiper911/dsh-workflow-canvas)。
141
147
  - **运行限制**:子代理的「能力」受主对话权限/沙箱上限约束。