dsh-workflow-canvas 1.5.5 → 1.6.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/docs/DETAIL.md CHANGED
@@ -81,12 +81,16 @@ run), `cancel: true` (cleanly stop an active or paused `need-lead` run),
81
81
  failed/target segments plus downstream), and `clearMemory: true` (forget saved
82
82
  `keepSession` memories). While enabled, a per-session runtime context notifies
83
83
  the agent automatically. While running or paused at an intermediate Lead node,
84
- a unified red **`⏹ Stop`** button appears beside `● ON` and on the Entry Lead
85
- card to interrupt all running subagents, cancel the root turn, and clear any
84
+ a unified **`⏹ Stop`** button stays visible beside `● ON` (muted when idle, lighting up red alongside a compact `⏹` on the Entry Lead card while running or paused at an intermediate Lead) to interrupt all running subagents, cancel the root turn, and clear any
86
85
  Lead pause via `/canvas-stop`. Intermediate Lead nodes pause with
87
86
  `status: "need-lead"` and report `decisions` / `branchSkipped` / `failed` /
88
87
  `emptyOutputs` plus `session` handovers and merged `refs`; a terminal Lead
89
- completes directly with `status: "done"` and `finalLead`.
88
+ completes directly with `status: "done"` and `finalLead`. Once a run begins, a
89
+ compact bottom-left **Summary** pill (and `⋯ → 📊 Run summary`) displays live
90
+ elapsed time, per-node duration bars, fallback/session-continuation badges,
91
+ condition verdicts, and loop retry history with node focus, child-chat jump,
92
+ and Markdown copy — computed strictly from `.run.json` telemetry with zero
93
+ extra tokens.
90
94
 
91
95
  ## Memory
92
96
 
package/docs/MECHANISM.md CHANGED
@@ -12,8 +12,8 @@ at run time, and how memory cold-resume, fallbacks, and live status tracking wor
12
12
  ## 1. Architecture: Bidirectional Client ↔ Host Bridge
13
13
 
14
14
  The plugin splits cleanly into two halves:
15
- - **Client (`client.js`)**: Mounted as a right-sidebar `Workflow` tab (`keepMounted: true`, keyed by `sessionId` for isolation, preserving state while collapsed). Owns visual editing, live cross-tab preset sync, global layout preferences, shortcuts, visual effects, and live status rendering.
16
- - **Host (`index.js`)**: Registers the bundled `workflow-canvas` skill, per-session `systemPrompt.context`, two commands (`/canvas-sync` and `/canvas-stop`), and four tools (`canvas_inspect`, `canvas_generate`, `canvas_patch`, `canvas_workflow`). Owns real subagent execution, unified cancellation, and durable state persistence.
15
+ - **Client (`client.js`)**: Mounted as a right-sidebar `Workflow` tab (`keepMounted: true`, keyed by `sessionId` for isolation, preserving state while collapsed). Owns visual editing, live cross-tab preset sync, global layout preferences, `rAF`-coalesced rendering, visibility-aware adaptive polling, shortcuts, visual effects, and live status rendering.
16
+ - **Host (`index.js` + `lib/graph.js` + `lib/telemetry.js`)**: Registers the bundled `workflow-canvas` skill, compact per-session `systemPrompt.context`, two commands (`/canvas-sync` and `/canvas-stop`), and four tools (`canvas_inspect`, `canvas_generate`, `canvas_patch`, `canvas_workflow`). Owns real subagent execution, head+tail upstream output clipping, safe read-only transient backoff retry, unified cancellation, LRU memory/disk hygiene, and atomic state persistence.
17
17
 
18
18
  ```mermaid
19
19
  flowchart LR
@@ -122,8 +122,8 @@ The three link types are distinct runtime channels, not just visual colour codin
122
122
  ## 5. Live Status Pills & Click-to-Open Subagent Chats
123
123
 
124
124
  1. **Node tagging**: `spawnOnce` tags every spawned child with `label: "<node.label>#<node.id>"`.
125
- 2. **Catalog & run-state telemetry tracking**: While a turn runs (every 700ms, plus on mount and turn completion), the client reads `subagentCatalog` and `subagentTiming` from `sessions.list`, matching `/#([^\s#]+)$/` to map each child back to its canvas node (`running` takes strict priority over historical rounds) and latest `childId`, while also polling `<workspace>/.dsh/canvas/<sid>.run.json` for condition `decisions`, `pruned` nodes, `blockedEdges`, live retry counts (`loopCounts` / `nodeAttempts`), and `waitingLead`.
126
- 3. **Authoritative Lead `⏸ Ready` state & unified Stop**: Authoritative `.run.json` status takes precedence (`need-lead` highlights **`⏸ Ready`**; `halted` / `done` / `idle` never re-lock from historical subagent statuses), falling back to forward-edge heuristics only when `.run.json` is absent. Both running and awaiting-Lead states expose the unified **`⏹ Stop`** button.
125
+ 2. **Catalog & run-state telemetry tracking**: While a turn runs (every 700ms, plus on mount and turn completion), the client reads `subagentCatalog` and `subagentTiming` from `sessions.list`, matching `/#([^\s#]+)$/` to map each child back to its canvas node (`running` takes strict priority over historical rounds) and latest `childId`, while also polling `<workspace>/.dsh/canvas/<sid>.run.json` for condition `decisions`, `pruned` nodes, `blockedEdges`, live retry counts (`loopCounts` / `nodeAttempts`), `waitingLead`, and the zero-token `summary` payload (per-node timestamps/durations, fallback/session badges, loop history — never injected into model prompts).
126
+ 3. **Authoritative Lead `⏸ Ready` state, unified Stop & Run Summary**: Authoritative `.run.json` status takes precedence (`need-lead` highlights **`⏸ Ready`**; `halted` / `done` / `idle` never re-lock from historical subagent statuses), falling back to forward-edge heuristics only when `.run.json` is absent. The top-left **`⏹ Stop`** pill stays visible (muted when idle, red when active); once run telemetry exists, a bottom-left **Summary** pill (and `⋯ → 📊 Run summary`) renders the local timing/branch/loop breakdown with Markdown export.
127
127
  4. **Jump to live chat**: Clicking any subagent's bottom-left status pill (e.g. `Running ↗`, `Done ↗`) opens `dsh-resource://subagentchat/session/<childId>?parent=<sessionId>&mode=<mode>` via `sidebarRight.openResource(..., { kind: 'subagentchat', preferNewPane: true })`.
128
128
 
129
129
  ---
@@ -9,8 +9,8 @@
9
9
  ## 1. 整体架构:Client 与 Host 的双向通道
10
10
 
11
11
  插件由两部分组成:
12
- - **客户端(`client.js`)**:挂载在 DSH 右侧边栏的 `Workflow` 标签页(`keepMounted: true` 且按 `sessionId` 设 `key` 隔离,收起侧边栏时保留画布状态),负责图形编辑、跨会话实时预设同步、全局布局偏好与实时状态渲染。
13
- - **Host 侧(`index.js`)**:注册技能 `workflow-canvas`、会话级强上下文注入 `systemPrompt.context`、两条命令(`/canvas-sync` 与 `/canvas-stop`),以及 4 个工具(`canvas_inspect`、`canvas_generate`、`canvas_patch`、`canvas_workflow`),负责真实调度子代理、统一中止与持久化执行状态。
12
+ - **客户端(`client.js`)**:挂载在 DSH 右侧边栏的 `Workflow` 标签页(`keepMounted: true` 且按 `sessionId` 设 `key` 隔离,收起侧边栏时保留画布状态),负责图形编辑、跨会话实时预设同步、全局布局偏好、`rAF` 流畅渲染、可见性自适应轮询与实时状态渲染。
13
+ - **Host 侧(`index.js` + `lib/graph.js` + `lib/telemetry.js`)**:注册技能 `workflow-canvas`、精简会话级强上下文注入 `systemPrompt.context`、两条命令(`/canvas-sync` 与 `/canvas-stop`),以及 4 个工具(`canvas_inspect`、`canvas_generate`、`canvas_patch`、`canvas_workflow`),负责真实调度子代理、上游超长输出头尾智能裁剪、只读节点瞬态错误自动退避重试、统一中止、LRU 内存/磁盘清理与原子持久化。
14
14
 
15
15
  ```mermaid
16
16
  flowchart LR
@@ -119,8 +119,8 @@ sequenceDiagram
119
119
  ## 5. 实时状态胶囊与点击直达子会话
120
120
 
121
121
  1. **节点反查标记**:`spawnOnce` 启动子代理时,固定把 `spec.label` 设为 `<节点名>#<nodeId>`。
122
- 2. **状态与遥测实时追踪**:客户端在对话运行期间每 700ms(以及挂载与每轮结束时)读取 `sessions.list` 投影中的 `subagentCatalog` 与 `subagentTiming`,用末尾正则 `/#([^\s#]+)$/` 精准反查子代理状态(`running` 具最高优先级,避免多轮重试被历史记录覆盖)与 `childId`;同时轮询 Host 写入的 `<workspace>/.dsh/canvas/<sid>.run.json` 获取条件判决(`decisions`)、剪枝集(`pruned`)、阻断边(`blockedEdges`)、回环实时轮次(`loopCounts` / `nodeAttempts`)与待拍板状态(`waitingLead`)。
123
- 3. **Lead「待拍板」权威状态与统一终止**:优先以 `.run.json` 报告的权威状态为准(`need-lead` 高亮 **`⏸ 待拍板`**,`halted` / `done` / `idle` 绝不误回弹锁死),仅在缺失 `.run.json` 时回退到前向边启发式推导;运行中或待拍板时均显示 **`⏹ 终止`** 按钮。
122
+ 2. **状态与遥测实时追踪**:客户端在对话运行期间每 700ms(以及挂载与每轮结束时)读取 `sessions.list` 投影中的 `subagentCatalog` 与 `subagentTiming`,用末尾正则 `/#([^\s#]+)$/` 精准反查子代理状态(`running` 具最高优先级,避免多轮重试被历史记录覆盖)与 `childId`;同时轮询 Host 写入的 `<workspace>/.dsh/canvas/<sid>.run.json` 获取条件判决(`decisions`)、剪枝集(`pruned`)、阻断边(`blockedEdges`)、回环实时轮次(`loopCounts` / `nodeAttempts`)、待拍板状态(`waitingLead`)以及零 Token 复盘快照(`summary`:各节点耗时、回退/续接标记与回环历史,绝不注入模型上下文)。
123
+ 3. **Lead「待拍板」权威状态、统一终止与执行复盘**:优先以 `.run.json` 报告的权威状态为准(`need-lead` 高亮 **`⏸ 待拍板`**,`halted` / `done` / `idle` 绝不误回弹锁死),仅在缺失 `.run.json` 时回退到前向边启发式推导;左上角 **`⏹ 终止`** 按钮常态可见(空闲灰标、运行或待拍板亮红);存在运行遥测时,左下角同步出现 **复盘** 胶囊(及 `⋯ → 📊 执行复盘`)展示本地统计与一键导出 Markdown。
124
124
  4. **一键直达真实子对话**:点击任意子代理节点左下角状态胶囊(如 `进行中 ↗` / `已完成 ↗`),客户端调用 `sidebarRight.openResource('dsh-resource://subagentchat/session/<childId>?parent=<sessionId>&mode=<mode>', { kind: 'subagentchat', preferNewPane: true })`,直接在新侧边窗格打开该子代理的真实对话记录。
125
125
 
126
126
  ---