dsh-chief 1.5.0 → 1.6.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/CHANGELOG.md +32 -0
- package/README.en.md +26 -28
- package/README.md +26 -28
- package/api-routes.js +39 -0
- package/board-actions.js +61 -6
- package/board-schema.js +331 -6
- package/chief-archives.js +1 -0
- package/chief-commands.js +2 -0
- package/chief-compaction.js +1 -0
- package/chief-models.js +112 -5
- package/chief-review.js +255 -48
- package/chief-state.js +556 -1
- package/chief-view.js +3 -0
- package/client.js +9906 -5395
- package/digest.js +4 -1
- package/idle-guard.js +233 -8
- package/locale/en.json +71 -0
- package/locale/zh.json +71 -0
- package/model-tools.js +6 -1
- package/package.json +6 -4
- package/runtime-hooks.js +247 -12
- package/safety/invariant-guards.js +2 -1
- package/subagent-runtime.js +28 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,38 @@ All notable changes to **`dsh-chief`** (**DSH 参谋长**) will be documented in
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.6.0] - 2026-11-21
|
|
9
|
+
|
|
10
|
+
> **Release Theme**: **简明可视 · 节约注意力资源(Visual Clarity & Attention Conservation)** — consolidated 5-tab navigation, SVG Flow Canvas & click-to-expand Org Tree, top-bar rotating `⚙️` Settings page, Away Managed reliability loop, and live `zh / en` bilingual UI.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
#### 🧭 可视化工作拓扑、5 页签整合与全站统一拉起交互 (`board-schema.js` / `board-actions.js` / `digest.js` / `subagent-runtime.js` / `tabs/tasks-flow.js` / `tabs/tasks.js` / `components/common.js`)
|
|
15
|
+
- **工程实现**:
|
|
16
|
+
- **5 页签一体化任务工作台**:将原「规划」页签正式合并入「任务」页签(顶栏保持 `参谋 / 任务 / 协同 / 档案 / 边界` 5 大页签),按「**核心目标 → 可视化工作拓扑(流程画布 / 组织树)→ 推进任务板(步骤与任务列表合一)→ 跨会话接力与部署**」清晰排布。
|
|
17
|
+
- **工作流推进流与跨步回指拓扑 (`planStepId` / `targetPlanStepId` / `derivePlanFlowProgress`)**:任务卡片支持关联规划步骤及目标回指步骤(并对历史看板基于 `graph.plan` 自动回填);「流程画布」使用 SVG 绘制主线顺序阶段节点、可嵌套子代理分支卡片与跨步回指连线(支持横竖向切换与缩放适配器)。
|
|
18
|
+
- **全站统一拉起折叠体验**:抽象通用可折叠组件 `AccCard`,推进任务板默认折叠已完成任务分组;「组织树」默认收起,移除冗余的全局 `全部收起 / 全展开` 按钮,改为点击 `👑 主代理` 卡片整卡即可直接拉起/收起下级子代理与任务树,并补齐 DSH 浅色主题全部覆盖样式。
|
|
19
|
+
- **用户感知**:打开「任务」页即可在一屏内看懂主代理和子代理现在推到第几步、卡在哪步、谁做完会向哪步交卷;平时层级保持收起干净,需要排查哪一条再点开即可。
|
|
20
|
+
|
|
21
|
+
#### 🌙 离桌托管闭环:关键节点告警、LLM 调用账本与硬预算熔断、复盘战报导出 (`chief-state.js` / `chief-models.js` / `chief-review.js` / `runtime-hooks.js` / `src/client/notify.js` / `src/client/report.js`)
|
|
22
|
+
- **工程实现**:
|
|
23
|
+
- **7 类关键里程碑告警与静默基线引擎**:后端在 `pending_approval`、`pending_elevation`、`guard_wall_blocked`、`auto_continue_rescue`、`managed_auto_sleep`、`budget_circuit_break`、`hazard_halt` 事件写入 `alertEvents`(5s 同键去重、20 条滚动上限);前端 `notify.js` 为每个会话建立首次静默基线(绝不重放历史旧告警),后续增量推送按开关触发系统桌面 `Notification` 与双音阶 WebAudio 轻柔提示音。
|
|
24
|
+
- **参谋长 LLM 分类账本与硬预算熔断 (`llmLedger` / `checkManagedBudgetBeforeCall` / `recordChiefLlmUsage`)**:按 `问答(chat) / 巡检(review) / 梦境漫游(dream) / other` 统计调用次与输入/输出 Token(对累计统计字段施加 `1M calls / 1B tokens` 安全上限夹紧);在 `托管` 模式下触及单轮次数上限(默认 30 次,可设 `3–500` 或 `0=不限`)或 Token 上限(默认 `300K`,可选 `100K/300K/500K/1M/不限`)立即触发硬熔断并退回 `⏸ 关停`,同时确保人类主动 `ask_chief` 问答永远豁免阻断。
|
|
25
|
+
- **Markdown 复盘战报导出 (`report.js`)**:汇集核心目标、规划进度、任务验收证据、子代理名册、参谋摘要、红线/物理驻墙及账本消耗生成结构化中/英文 `.md` 战报(自动脱敏 `sk-` / `ghp_` / `AKIA` / `AIza` / `Bearer` 及私钥块),支持一键下载 `.md` 文件或复制剪贴板。
|
|
26
|
+
- **用户感知**:离开电脑挂机时,遇到必须拍板或触发熔断会第一时间在桌面收到提醒,再也不用担心后台循环烧光额度;回来点一下就能导出或复制脱敏干净的整局战报交差归档。
|
|
27
|
+
|
|
28
|
+
#### ⚙️ 顶栏旋转齿轮「设置」页、3 档开箱情景预设与中英双语 (`components/Panel.js` / `tabs/plan.js` / `tabs/boundaries.js` / `src/client/i18n.js` / `locale/zh.json` / `locale/en.json`)
|
|
29
|
+
- **工程实现**:
|
|
30
|
+
- **顶栏齿轮入口与边界页减负**:将设置页从「边界」二级页签移至顶栏 `DSH 参谋长` 与版本号 `v1.6.0` 之间的旋转齿轮按钮(点击顺滑旋转 `180°` 切换设置页),让「边界」页专注物理驻墙、红线列表与运行环境信息。
|
|
31
|
+
- **3 档情景预设 (`CHIEF_SCENARIO_PRESETS`)**:支持一键切换「👁 只读旁观 (`L0 · 关停`) / 🤝 日常协作 (`L2 · 巡检 + 红线哨兵`) / 🚀 离桌托管 (`L3 · 托管 + 80% 压缩 + 30次/300K 熔断 + 桌面告警`)」;切换离桌托管必须经过弹窗双重风险确认(后端硬拦截无确认直传)。
|
|
32
|
+
- **全界面中英双语 (`i18n.js`)**:补全 `locale/zh.json` 与 `locale/en.json`,支持 `跟随宿主 (auto) / 简体中文 (zh) / English (en)` 运行时无刷新切换并覆盖全部 5 个页签、弹窗及导出战报。
|
|
33
|
+
- **用户感知**:新装用户点顶栏齿轮就能 1 秒选好合身的协作挡位,也可以随时一键切换中英文界面。
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
- **修复 `--format` 选项误触发破坏性磁盘格式化拦截 (`safety/invariant-guards.js`)**:将命令行参数里的 `--format` 与真实磁盘格式化命令(如 `format C:`、`format.com D:`、`cmd /c format ...`)精确区分,`git log --format=...` 等高频开发命令零误杀,真实格式化命令仍 100% 硬拦截。
|
|
37
|
+
- **加固强介入防空转与冷却期接续 (`idle-guard.js` / `chief-review.js`)**:新增回合中途卡死/重复打转与连续工具报错空转识别 `detectMidTurnSpin`(写入规划操作豁免计数);修复 `off` / `patrol` 模式下开启强介入被忽略、4 秒冷却期内跳过不重排、以及 LLM 未给出 `interventionText` 但存在 `goalMissing` 时漏发督导续推的问题。
|
|
38
|
+
- **修复硬预算熔断后的滞后调用拦截 (`chief-state.js`)**:`checkManagedBudgetBeforeCall` 在 `mr.tripped` 为真且未切入 `patrol` 时直接拦截滞后后台 `review` / `dream` 调用,防止熔断瞬间仍有在途定时器漏跑;显式切回 `patrol` / `managed` 或点击重置计数时同步清除熔断标记。
|
|
39
|
+
|
|
8
40
|
## [1.5.0] - 2026-11-20
|
|
9
41
|
|
|
10
42
|
### Added
|
package/README.en.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
<br />
|
|
11
11
|
|
|
12
|
-
<img src="assets/
|
|
12
|
+
<img src="assets/v160-highlights.png" alt="dsh-chief v1.6.0 feature highlights: SVG Flow Canvas with cross-step return arcs, attention-first click-to-expand Org Tree, top-bar rotating Settings gear with Presets/Alerts/Hard Budget Breaker, and live zh/en bilingual UI plus redacted .md report" width="100%" />
|
|
13
13
|
|
|
14
14
|
<br />
|
|
15
15
|
|
|
@@ -25,29 +25,29 @@
|
|
|
25
25
|
[](https://www.npmjs.com/package/dsh-chief)
|
|
26
26
|
[](https://github.com/gluztm/dsh-chief/actions/workflows/ci.yml)
|
|
27
27
|
[](https://awesome-dsh-plugin.com/p/gluztm/dsh-chief/)
|
|
28
|
-
[](https://www.bilibili.com/video/
|
|
28
|
+
[](https://www.bilibili.com/video/BV1Fksq6iEw8)
|
|
29
29
|
[](https://github.com/deepseek-ai/dsh-superagent-prototype)
|
|
30
30
|
[](https://nodejs.org)
|
|
31
31
|
[](#)
|
|
32
32
|
[](LICENSE)
|
|
33
33
|
|
|
34
|
-
> **Current release `v1.
|
|
34
|
+
> **Current release `v1.6.0`**: Ships **Visual Work Topology (SVG sequential Flow Canvas with cross-step return arrows + click-to-expand Org Tree) inside the consolidated 5-tab layout**, **Away Managed last-mile loop (7 milestone desktop alerts & optional gentle chime, categorized LLM usage ledger + hard budget circuit breaker, and redacted `.md` retrospective report export)**, plus **top-bar rotating Settings gear, 3 one-click Scenario Presets, and live `zh / en` bilingual switching** — alongside the `2,400T / 6` Cognitive Desktop, `180°` fan effort gauge, click-through Dream Roam, `--format` zero-false-positive guard, and DSH `0.2.2-rc.5` support.
|
|
35
35
|
> Shares the Router + Workers split from DeepSeek's **[SuperAgent (`dsh-superagent-prototype`)](https://github.com/deepseek-ai/dsh-superagent-prototype)** while keeping Chief state and prompts isolated from the main session.
|
|
36
36
|
|
|
37
37
|
[简体中文 (`README.md`)](README.md) · **English** · [Changelog (`CHANGELOG.md`)](CHANGELOG.md) · [Architecture (`ARCHITECTURE.md`)](ARCHITECTURE.md)
|
|
38
38
|
|
|
39
|
-
[v1.
|
|
39
|
+
[v1.6.0 Highlights](#what-changed-in-v160) · [Problems Fixed](#daily-friction-this-plugin-fixes) · [Inside the Sidebar](#inside-the-sidebar) · [Architecture](#modular-architecture-v160) · [Installation](#installation--host-compatibility) · [Security](#local-storage--security-guarantees) · [Contributors](#contributors)
|
|
40
40
|
|
|
41
41
|
</div>
|
|
42
42
|
|
|
43
43
|
---
|
|
44
44
|
|
|
45
|
-
## What Changed in `v1.
|
|
45
|
+
## What Changed in `v1.6.0`
|
|
46
46
|
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
- **🛡️
|
|
47
|
+
- **🧭 Visual Work Topology, 5-Tab Consolidation & Unified Pull-Cards**: Merges Plan into the **Tasks** tab cleanly (`Chief / Tasks / Peers / Archives / Guards`): **Flow Canvas** plots sequential stages, nested subagent branches, and explicit cross-step return arrows via SVG, while **Org Tree** stays folded by default until you click the Lead card, matching uniform `AccCard` pull-to-expand interactions and full light-theme support.
|
|
48
|
+
- **🌙 Away Managed Last-Mile Loop**: Emits session-baseline-suppressed desktop `Notification` alerts and optional 2-note WebAudio chimes across 7 milestone events (approvals, elevations, wall blocks, rescue continues, auto-sleep, budget break, hazard halt); tracks calls/tokens by `chat / review / dream` with a default `30 calls / 300K tokens` Managed circuit breaker (never blocking human `ask_chief`); and exports/copies secret-redacted Markdown session reports.
|
|
49
|
+
- **⚙️ Top-Bar Settings Gear, 3 Scenario Presets & Bilingual UI**: Moves configuration into a smooth rotating gear button between the title and `v1.6.0` badge, offering **Observer / Co-Pilot / Away Mode** one-click presets (with mandatory dual-risk modal for L3/Managed) plus instant `Auto / 简体中文 / English` switching backed by `locale/zh.json` & `locale/en.json`.
|
|
50
|
+
- **🛡️ Safety & Mid-Turn Spin Hardening**: Disambiguates `--format` CLI flags from destructive disk-format commands (`format C:` still hard-denied); adds mid-turn duplicate/error-thrash spin detection (`detectMidTurnSpin`) with `planWrite` exemption; and blocks delayed background calls immediately after a budget breaker trip.
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
@@ -97,8 +97,8 @@ If you run multi-step coding tasks inside DeepSeek Harness, these six problems t
|
|
|
97
97
|
|
|
98
98
|
---
|
|
99
99
|
|
|
100
|
-
### 02 ·
|
|
101
|
-
-
|
|
100
|
+
### 02 · Visual Flow Canvas & Click-to-Expand Org Tree (`任务 / Tasks` Tab)
|
|
101
|
+
- **Dual Topology Views**: Switch between **Flow Canvas** (SVG sequential plan backbone, sprouted subagent branches, and dashed cross-step return arcs) and **Org Tree** (collapsed to a crisp one-line summary by default to conserve attention; click anywhere on the lead card to expand/collapse subordinate lanes—zero redundant toggle buttons), above the consolidated progress board and `分屏` live stream panes.
|
|
102
102
|
|
|
103
103
|
<div align="center">
|
|
104
104
|
<img src="assets/screenshots/02-full-spread-pyramid-dag.png" alt="02 - Subagent DAG View" width="80%" />
|
|
@@ -115,8 +115,8 @@ If you run multi-step coding tasks inside DeepSeek Harness, these six problems t
|
|
|
115
115
|
|
|
116
116
|
---
|
|
117
117
|
|
|
118
|
-
### 04 · Objective Lock & Step Q&A (
|
|
119
|
-
- Click `🎯
|
|
118
|
+
### 04 · Objective Lock, Flow Topology & Step Q&A (`Tasks` Tab)
|
|
119
|
+
- Click `🎯 Set Objective` to lock your Core Objective before Strong Intervention, inspect the collapsible **Work Topology** (Flow Canvas / Org Tree) and unified Progress Task Board below, or click `Explain` on any step without interrupting `@lead`.
|
|
120
120
|
|
|
121
121
|
<div align="center">
|
|
122
122
|
<img src="assets/screenshots/04-dual-tier-goal-and-step-qa.png" alt="04 - Goal Supervision and Step Q&A" width="68%" />
|
|
@@ -144,8 +144,8 @@ If you run multi-step coding tasks inside DeepSeek Harness, these six problems t
|
|
|
144
144
|
|
|
145
145
|
---
|
|
146
146
|
|
|
147
|
-
### 07 ·
|
|
148
|
-
-
|
|
147
|
+
### 07 · Top-Bar Rotating Gear Settings: Presets, Budget Breaker & Bilingual UI
|
|
148
|
+
- Click the rotating `⚙️` gear between `DSH 参谋长` and the version chip to open the dedicated **Settings** page: **3 One-Click Scenario Presets** (Observer / Co-Pilot / Away Mode), **7 Milestone Desktop Alerts & Gentle Chime**, **categorized LLM Ledger (`chat / review / dream`) & hard budget circuit breaker**, and live `zh / en` switching — while `📌 Pin Lock` Session Handoff and secret-redacted `.md` report export live in `Tasks`.
|
|
149
149
|
- Choose which archive scope follows into a new session (`None`, `Spotlight Only`, `Entire Drawer`, or `Full Session Cabinet`), while Strong Intervention safely resets to off.
|
|
150
150
|
|
|
151
151
|
<div align="center">
|
|
@@ -166,19 +166,19 @@ If you run multi-step coding tasks inside DeepSeek Harness, these six problems t
|
|
|
166
166
|
|
|
167
167
|
---
|
|
168
168
|
|
|
169
|
-
## Modular Architecture (`v1.
|
|
169
|
+
## Modular Architecture (`v1.6.0`)
|
|
170
170
|
|
|
171
|
-
`v1.
|
|
171
|
+
`v1.6.0` spans **38 backend modules (including 9 isolated modules under `pkg/safety/`) and 20 frontend modules** with zero `export let` bindings and zero circular imports. See [ARCHITECTURE.md](ARCHITECTURE.md) for boundaries and module contracts.
|
|
172
172
|
|
|
173
173
|
```mermaid
|
|
174
174
|
flowchart TB
|
|
175
|
-
subgraph UI["DSH Right Sidebar (client.js <-
|
|
176
|
-
T1["Chief Tab (180° Effort Gauge · Click-Through FX ·
|
|
177
|
-
T2["Tasks Tab (
|
|
178
|
-
T3["Peers Tab (Cross-Window Link + Mailbox)"]
|
|
179
|
-
T4["Plan Tab (Core Objective Lock · Step Explain · Pinned Handoff)"]
|
|
175
|
+
subgraph UI["DSH Right Sidebar (client.js <- 20 modules · 5 Tabs + Top-Bar Settings)"]
|
|
176
|
+
T1["Chief Tab (180° Effort Gauge · Click-Through FX · Report Export)"]
|
|
177
|
+
T2["Tasks Tab (Core Objective · Flow Canvas / Org Tree · Unified Board · Handoff)"]
|
|
178
|
+
T3["Peers Tab (Cross-Window Link + Mailbox · Split Stream)"]
|
|
180
179
|
T5["Archives Tab (2400T Cognitive Desktop · Hooked Stack-of-Papers)"]
|
|
181
|
-
T6["
|
|
180
|
+
T6["Guards Tab (Guard Walls · Blocker Removal · 📌 Redlines)"]
|
|
181
|
+
T7["Top-Bar ⚙️ Settings (Presets · Desktop Alerts · Budget Ledger · zh/en)"]
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
subgraph Core["Local Backend & Safety Kernel (Zero External Deps · 38 modules)"]
|
|
@@ -210,14 +210,14 @@ flowchart TB
|
|
|
210
210
|
Search **`dsh-chief`** inside [dshmarket](https://github.com/dsh-market/dsh-market) / DSH Plugin Market, or install via CLI (replace `desktop` with `web` for the web profile):
|
|
211
211
|
|
|
212
212
|
```bash
|
|
213
|
-
# Option 1: Install latest release (v1.
|
|
213
|
+
# Option 1: Install latest release (v1.6.0) from npm
|
|
214
214
|
dsh plugin --profile desktop add dsh-chief
|
|
215
215
|
|
|
216
216
|
# Option 2: Install directly from GitHub main branch
|
|
217
217
|
dsh plugin --profile desktop add github:gluztm/dsh-chief
|
|
218
218
|
|
|
219
|
-
# Option 3: Install prebuilt GitHub Release tarball (v1.
|
|
220
|
-
dsh plugin --profile desktop add https://github.com/gluztm/dsh-chief/releases/download/v1.
|
|
219
|
+
# Option 3: Install prebuilt GitHub Release tarball (v1.6.0)
|
|
220
|
+
dsh plugin --profile desktop add https://github.com/gluztm/dsh-chief/releases/download/v1.6.0/dsh-chief-1.6.0.tgz
|
|
221
221
|
```
|
|
222
222
|
|
|
223
223
|
### Host Version Compatibility
|
|
@@ -255,8 +255,6 @@ dsh plugin --profile desktop add https://github.com/gluztm/dsh-chief/releases/do
|
|
|
255
255
|
| Contributor | Role |
|
|
256
256
|
| --- | --- |
|
|
257
257
|
| [gluztm](https://github.com/gluztm) | Creator, product design, and maintainer |
|
|
258
|
-
| [@iridiumgit](https://github.com/iridiumgit) | Root-caused and contributed the DSH light-theme popover fix ([#3](https://github.com/gluztm/dsh-chief/issues/3)), subagent entry visibility diagnosis ([#4](https://github.com/gluztm/dsh-chief/issues/4)), and UX feedback ([#5](https://github.com/gluztm/dsh-chief/issues/5)) |
|
|
259
|
-
| [@edz017](https://github.com/edz017) | Day-one DSH `0.2.2-rc.1~rc.3` host compatibility audit, `engines.dsh` constraint diagnosis, and `preferNewPane` fix ([#1](https://github.com/gluztm/dsh-chief/issues/1)) |
|
|
260
258
|
| [Gemini](https://github.com/gemini-code-assist) | Feature development, `pkg/safety/` kernel, Cognitive Desktop, orthogonal runtime modes, fan gauge & CI gates |
|
|
261
259
|
| [Codex](https://github.com/codex) | Modular architecture design, concurrency stress tests, and red-team boundary audits |
|
|
262
260
|
| [deepseek-ai](https://github.com/deepseek-ai) | DeepSeek Harness host runtime and SuperAgent workflow alignment |
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
<br />
|
|
11
11
|
|
|
12
|
-
<img src="assets/
|
|
12
|
+
<img src="assets/v160-highlights.png" alt="dsh-chief v1.6.0 核心新特性实机一览:SVG 流程画布与跨步回指、默认单行收敛与点整卡秒展组织树、顶栏旋转齿轮「设置」情景预设与分类预算熔断、zh / en 实时双语与脱敏 .md 复盘战报" width="100%" />
|
|
13
13
|
|
|
14
14
|
<br />
|
|
15
15
|
|
|
@@ -25,29 +25,29 @@
|
|
|
25
25
|
[](https://www.npmjs.com/package/dsh-chief)
|
|
26
26
|
[](https://github.com/gluztm/dsh-chief/actions/workflows/ci.yml)
|
|
27
27
|
[](https://awesome-dsh-plugin.com/p/gluztm/dsh-chief/)
|
|
28
|
-
[](https://www.bilibili.com/video/
|
|
28
|
+
[](https://www.bilibili.com/video/BV1Fksq6iEw8)
|
|
29
29
|
[](https://github.com/deepseek-ai/dsh-superagent-prototype)
|
|
30
30
|
[](https://nodejs.org)
|
|
31
31
|
[](#)
|
|
32
32
|
[](LICENSE)
|
|
33
33
|
|
|
34
|
-
> **当前版本 `v1.
|
|
34
|
+
> **当前版本 `v1.6.0`**:推出**可视化工作拓扑(「流程画布」SVG 推进流与跨步回指 + 点整卡拉起「组织树」)与 5 页签统一任务台**、**离桌托管闭环(7 类关键节点桌面告警与可选提示音 + 按 `chat / review / dream` 分类账本及硬预算熔断 + 一键导出脱敏 `.md` 复盘战报)**,以及**顶栏旋转齿轮「设置」页、3 档开箱情景预设与 `zh / en` 全界面实时双语**;同时延续 `v1.5.0` 认知桌面(`2,400 Tokens / 6 份`)、`180°` 扇形思考表盘、可点穿透流光毛玻璃与 `--format` 零误杀安全守卫,完整适配 DSH `0.2.2-rc.5`。
|
|
35
35
|
> 协同结构参考官方 **[SuperAgent (`dsh-superagent-prototype`)](https://github.com/deepseek-ai/dsh-superagent-prototype)** 的 Router + Workers 分工模型,保持侧边栏状态与主对话上下文相互隔离。
|
|
36
36
|
|
|
37
37
|
**简体中文** · [English (`README.en.md`)](README.en.md) · [更新日志 (`CHANGELOG.md`)](CHANGELOG.md) · [架构设计 (`ARCHITECTURE.md`)](ARCHITECTURE.md)
|
|
38
38
|
|
|
39
|
-
[v1.
|
|
39
|
+
[v1.6.0 亮点](#v160-重点升级一览) · [核心痛点](#主要解决哪些日常麻烦) · [界面实机](#界面与功能说明) · [模块架构](#模块结构与数据流-v160) · [安装与兼容](#安装与宿主版本兼容) · [安全边界](#本地存储与安全边界) · [贡献者](#贡献者)
|
|
40
40
|
|
|
41
41
|
</div>
|
|
42
42
|
|
|
43
43
|
---
|
|
44
44
|
|
|
45
|
-
## `v1.
|
|
45
|
+
## `v1.6.0` 重点升级一览
|
|
46
46
|
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
- **🛡️
|
|
47
|
+
- **🧭 可视化工作拓扑、5 页签合一与全站统一拉起**:原「规划」正式并入「任务」页签,顶部收口为 **参谋 / 任务 / 协同 / 档案 / 边界** 5 大页签;「流程画布」用 SVG 画出顺序步骤、嵌套子代理分支与跨步回指交卷连线;「组织树」默认收起,点 `👑 主代理` 整卡一键拉起/收起,全站统一 `AccCard` 拉起折叠体验与浅色主题适配。
|
|
48
|
+
- **🌙 离桌托管闭环(桌面提醒 + 分类账本 + 硬预算熔断 + 复盘战报)**:待批/提权/撞墙/断流救活/自动休眠/预算熔断/紧急煞停等 7 类里程碑支持系统桌面告警与可选轻柔提示音(首次会话静默建基线,绝不重放旧告警);`llmLedger` 按问答/巡检/梦境漫游分账并设 `30 次 / 300K tokens` 默认硬熔断保护(人类 `ask_chief` 问答永不拦截);一键导出或复制 `.md` 复盘战报并自动脱敏密钥凭据。
|
|
49
|
+
- **⚙️ 顶栏旋转齿轮「设置」、3 档情景预设与中英双语**:顶栏品牌标题与 `v1.6.0` 之间新增旋转齿轮按钮一键打开「设置」,内建 **👁 只读旁观 / 🤝 日常协作 / 🚀 离桌托管** 三档情景预设(进离桌托管必过 L3 + 托管双重确认门)与 `自动 / 简体中文 / English` 实时语言切换。
|
|
50
|
+
- **🛡️ 安全内核与强介入防空转加固**:精确区分 `--format` 参数与真实磁盘格式化命令(零误杀且硬拦 `format C:`);强化强介入在 `off/patrol` 模式、冷却期重排、空督导兜底及回合中途打转/连错空转检测;延承 `2,400T/6` 认知桌面、`180°` 扇形思考强度表盘、`🔒 锁挡` 与点击穿透流光毛玻璃。
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
|
|
84
84
|
### 6. 对话聊太长变慢变贵,换新窗口又得从头交代背景
|
|
85
85
|
- 常见状况:开了 100 轮想重开新窗口,却怕丢失背景、模型配置和刚梳理完的任务分工,或者后台总结插件偷偷走高价按量渠道。
|
|
86
|
-
- `dsh-chief` 的做法:顶栏模型选择器支持「跟随主对话」与 `180°` 扇形思考强度表盘(日常 `关停` / `巡检` 平常均 0
|
|
86
|
+
- `dsh-chief` 的做法:顶栏模型选择器支持「跟随主对话」与 `180°` 扇形思考强度表盘(日常 `关停` / `巡检` 平常均 0 后台消耗);在「任务」页对看不懂的步骤点「解释」即可大白话解读,在底部交接卡点 `📌 定住防改` 锁定人工核对过的交接单,一键新建窗口接力并可选随带工作档案层级,还可导出脱敏 `.md` 复盘战报。
|
|
87
87
|
|
|
88
88
|
---
|
|
89
89
|
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
|
|
98
98
|
---
|
|
99
99
|
|
|
100
|
-
### 02 ·
|
|
101
|
-
-
|
|
100
|
+
### 02 · 可视化工作流「流程画布」与点卡秒展「组织树」(`任务` 页签)
|
|
101
|
+
- **双视角 SVG 工作拓扑**:支持「**流程画布**」(主干步骤推演 + 子代理分支 + 跨步异常虚线回指弧)与「**组织树**」(默认单行收敛省空间,**点击整张主代理卡片**瞬间展开/收起下属 `@subagent` 详情,去掉冗余开关按钮),下方统一整合推进任务板、`分屏` 实时流与跨会话交接。
|
|
102
102
|
|
|
103
103
|
<div align="center">
|
|
104
104
|
<img src="assets/screenshots/02-full-spread-pyramid-dag.png" alt="02 - 任务树与子代理卡片" width="80%" />
|
|
@@ -116,8 +116,8 @@
|
|
|
116
116
|
|
|
117
117
|
---
|
|
118
118
|
|
|
119
|
-
### 04 ·
|
|
120
|
-
-
|
|
119
|
+
### 04 · 目标锁定、流程拓扑与步骤大白话「解释 / 咨询」(`任务` 页签)
|
|
120
|
+
- 顶部点击 `🎯 设为目标` 开启目标督导(开强介入前必锁),其下紧接可折叠「可视化工作拓扑」(支持「流程画布」SVG 回指视图与点整卡拉起「组织树」)及合并推进任务板;任意步骤都可点击「解释」让参谋长用通俗大白话解释这条在干嘛、跳过有何影响,全程零打断主对话流程。
|
|
121
121
|
|
|
122
122
|
<div align="center">
|
|
123
123
|
<img src="assets/screenshots/04-dual-tier-goal-and-step-qa.png" alt="04 - 目标督导与步骤追问" width="68%" />
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
|
|
146
146
|
---
|
|
147
147
|
|
|
148
|
-
### 07 ·
|
|
149
|
-
-
|
|
148
|
+
### 07 · 顶栏旋转齿轮「设置」页:情景预设、托管预算与双语切换
|
|
149
|
+
- 点击顶栏 `DSH 参谋长` 与版本号之间的旋转 `⚙️` 图标直达**独立设置页**:提供 **3 档开箱情景预设**(只读旁观 / 日常协作 / 离桌托管)、**7 类关键节点桌面告警与轻柔提示音**、**按 `chat / review / dream` 分类的 LLM 账本与硬预算熔断**,以及 `zh / en` 实时双语切换;跨会话交接单(`📌 定住防改`)与一键导出脱敏 `.md` 复盘战报统一收口在 `任务` 页签底部。
|
|
150
150
|
- 支持一键新开窗口并继承当前工作区 `workspaceId`、参谋配置与指定档案范围(高自主强介入默认安全置关),搭配 `idle-guard` 避免长任务空转停机。
|
|
151
151
|
|
|
152
152
|
<div align="center">
|
|
@@ -167,19 +167,19 @@
|
|
|
167
167
|
|
|
168
168
|
---
|
|
169
169
|
|
|
170
|
-
## 模块结构与数据流 (`v1.
|
|
170
|
+
## 模块结构与数据流 (`v1.6.0`)
|
|
171
171
|
|
|
172
|
-
`v1.
|
|
172
|
+
`v1.6.0` 包含 **38 个后端模块(含 `pkg/safety/` 下 9 个零业务依赖的安全内核模块)+ 20 个前端模块**(无环依赖、无 `export let` 可变导出),方便审查与长期维护。详情见 [ARCHITECTURE.md](ARCHITECTURE.md)。
|
|
173
173
|
|
|
174
174
|
```mermaid
|
|
175
175
|
flowchart TB
|
|
176
|
-
subgraph UI["DSH 右侧常驻面板 (client.js <-
|
|
177
|
-
T1["参谋页 (问答框 · 180°扇形思考表盘 · 可点穿透流光毛玻璃)"]
|
|
178
|
-
T2["任务页 (
|
|
179
|
-
T3["协同页 (跨窗联动 · 彩色信箱)"]
|
|
180
|
-
T4["规划页 (必锁目标 · 步骤大白话解释 · 交接单)"]
|
|
176
|
+
subgraph UI["DSH 右侧常驻面板 (client.js <- 20 个前端模块 · 5 页签 + 顶栏齿轮设置)"]
|
|
177
|
+
T1["参谋页 (问答框 · 180°扇形思考表盘 · 可点穿透流光毛玻璃 · 战报导出)"]
|
|
178
|
+
T2["任务页 (核心目标 · SVG流程画布/点卡拉起组织树 · 合一推进任务板 · 交接部署)"]
|
|
179
|
+
T3["协同页 (跨窗联动 · 彩色信箱 · 实时分屏)"]
|
|
181
180
|
T5["档案页 (2400T认知桌面 · 一沓纸三层抽屉与织钩)"]
|
|
182
181
|
T6["边界页 (动态物理驻墙 · 请示拆墙 · 📌全局红线)"]
|
|
182
|
+
T7["顶栏 ⚙️ 设置 (3 档预设 · 桌面告警/提示音 · 账本预算熔断 · zh/en 切换)"]
|
|
183
183
|
end
|
|
184
184
|
|
|
185
185
|
subgraph Core["本地后端存储与安全内核 (零外部依赖 · 38 个后端模块)"]
|
|
@@ -211,14 +211,14 @@ flowchart TB
|
|
|
211
211
|
在已装好 [dshmarket](https://github.com/dsh-market/dsh-market) 的 DSH 里直接搜 **`dsh-chief`** 或 **`DSH 参谋长`** 就能点安装,也可以用命令行(网页版把 `desktop` 换成 `web`):
|
|
212
212
|
|
|
213
213
|
```bash
|
|
214
|
-
# 方式 1:通过 npm 安装最新版(v1.
|
|
214
|
+
# 方式 1:通过 npm 安装最新版(v1.6.0)
|
|
215
215
|
dsh plugin --profile desktop add dsh-chief
|
|
216
216
|
|
|
217
217
|
# 方式 2:从 GitHub 仓库直接安装(与 main 最新代码同步)
|
|
218
218
|
dsh plugin --profile desktop add github:gluztm/dsh-chief
|
|
219
219
|
|
|
220
|
-
# 方式 3:安装 GitHub Release 预构建包(v1.
|
|
221
|
-
dsh plugin --profile desktop add https://github.com/gluztm/dsh-chief/releases/download/v1.
|
|
220
|
+
# 方式 3:安装 GitHub Release 预构建包(v1.6.0)
|
|
221
|
+
dsh plugin --profile desktop add https://github.com/gluztm/dsh-chief/releases/download/v1.6.0/dsh-chief-1.6.0.tgz
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
装好后重启或刷新 DSH 客户端,点工作区右上角 **✦ `DSH 参谋长`** 图标打开面板。
|
|
@@ -260,8 +260,6 @@ dsh plugin --profile desktop add https://github.com/gluztm/dsh-chief/releases/do
|
|
|
260
260
|
| 贡献者 | 主要工作 |
|
|
261
261
|
| --- | --- |
|
|
262
262
|
| [gluztm](https://github.com/gluztm) | 项目发起人、产品定义与长期维护 |
|
|
263
|
-
| [@iridiumgit](https://github.com/iridiumgit) | 深度定位并贡献 DSH 浅色主题弹层修复方案([#3](https://github.com/gluztm/dsh-chief/issues/3))、子代理会话隐藏参谋入口定位([#4](https://github.com/gluztm/dsh-chief/issues/4))及交互建议([#5](https://github.com/gluztm/dsh-chief/issues/5)) |
|
|
264
|
-
| [@edz017](https://github.com/edz017) | 首日实测 DSH `0.2.2-rc.1~rc.3` 宿主兼容性、源码级定位命名子代理接口约束与 `preferNewPane` 参数修正([#1](https://github.com/gluztm/dsh-chief/issues/1)) |
|
|
265
263
|
| [Gemini](https://github.com/gemini-code-assist) | 功能研发、`pkg/safety/` 独立安全内核、认知桌面与三态总控、180° 扇形思考表盘及自动化门禁 |
|
|
266
264
|
| [Codex](https://github.com/codex) | 模块化架构设计、高并发压测、红队穿透测试与边界审查 |
|
|
267
265
|
| [deepseek-ai](https://github.com/deepseek-ai) | DeepSeek Harness 宿主运行时与 SuperAgent 协同机制支持 |
|
package/api-routes.js
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
mutateChiefFact,
|
|
34
34
|
handleApprovalDecision,
|
|
35
35
|
handleElevationDecision,
|
|
36
|
+
scheduleChiefTurnReview,
|
|
36
37
|
} from './chief.js'
|
|
37
38
|
import {
|
|
38
39
|
getChiefActiveWork,
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
queueChiefApproval,
|
|
42
43
|
normalizeSuggestion,
|
|
43
44
|
hasValidChiefRiskAck,
|
|
45
|
+
summarizeLlmLedger,
|
|
44
46
|
SUGGESTIONS_CAP,
|
|
45
47
|
CHAT_CAP,
|
|
46
48
|
nextId,
|
|
@@ -282,6 +284,13 @@ export function createApiRoutes(deps) {
|
|
|
282
284
|
paceMode: effCfg.paceMode || 'manual',
|
|
283
285
|
runMode: effCfg.runMode || 'off',
|
|
284
286
|
managedIdleTimeoutMs: effCfg.managedIdleTimeoutMs || 15 * 60 * 1000,
|
|
287
|
+
notifyEnabled: effCfg.notifyEnabled !== false,
|
|
288
|
+
notifySound: Boolean(effCfg.notifySound),
|
|
289
|
+
uiLang: effCfg.uiLang || 'auto',
|
|
290
|
+
managedBudgetMaxCalls: effCfg.managedBudgetMaxCalls ?? 30,
|
|
291
|
+
managedBudgetMaxTokens: effCfg.managedBudgetMaxTokens ?? 300000,
|
|
292
|
+
llmLedgerSummary: summarizeLlmLedger(rootWs && rootWs.llmLedger, effCfg),
|
|
293
|
+
alertEvents: ((rootWs && Array.isArray(rootWs.alertEvents)) ? rootWs.alertEvents : []).slice(-10),
|
|
285
294
|
thinkingEffort: effCfg.thinkingEffort || 'auto',
|
|
286
295
|
teamEffortMode: effCfg.teamEffortMode || 'auto',
|
|
287
296
|
lockedModelEfforts: effCfg.lockedModelEfforts || {},
|
|
@@ -798,6 +807,36 @@ export function createApiRoutes(deps) {
|
|
|
798
807
|
}
|
|
799
808
|
}
|
|
800
809
|
}
|
|
810
|
+
const cfgActive = updated && updated.config ? updated.config : null
|
|
811
|
+
const switchedToActiveRunOrIntv = Boolean(
|
|
812
|
+
wantsInterventionOn
|
|
813
|
+
|| body?.runMode === 'managed'
|
|
814
|
+
|| body?.runMode === 'patrol'
|
|
815
|
+
|| body?.paceMode === 'auto'
|
|
816
|
+
|| body?.paceMode === 'smart'
|
|
817
|
+
|| body?.autoPilot === true,
|
|
818
|
+
)
|
|
819
|
+
if (
|
|
820
|
+
updated
|
|
821
|
+
&& updated.ok !== false
|
|
822
|
+
&& targetSessionForBoard
|
|
823
|
+
&& !(immediateKickoff && immediateKickoff.triggered)
|
|
824
|
+
&& cfgActive
|
|
825
|
+
&& !cfgActive.stopped
|
|
826
|
+
&& cfgActive.tacticalModes
|
|
827
|
+
&& cfgActive.tacticalModes.intervention === true
|
|
828
|
+
&& switchedToActiveRunOrIntv
|
|
829
|
+
) {
|
|
830
|
+
const agentsSvcNow = runtime && typeof runtime.get === 'function' ? runtime.get('agents') : null
|
|
831
|
+
const leadAgNow = agentsSvcNow && typeof agentsSvcNow.get === 'function' ? agentsSvcNow.get(targetSessionForBoard) : null
|
|
832
|
+
if (leadAgNow && leadAgNow.status !== 'running') {
|
|
833
|
+
scheduleChiefTurnReview(makeChiefDeps(runtime), {
|
|
834
|
+
agent: leadAgNow,
|
|
835
|
+
sessionId: targetSessionForBoard,
|
|
836
|
+
abnormalTrigger: 'config_activated',
|
|
837
|
+
})
|
|
838
|
+
}
|
|
839
|
+
}
|
|
801
840
|
const view = await getChiefView(makeChiefDeps(runtime), sessionId, { autoSummarize: false })
|
|
802
841
|
const latestBoard = targetSessionForBoard ? boardForSession(boardFileFor(targetSessionForBoard)) : null
|
|
803
842
|
sendJson(res, updated && updated.ok === false ? 400 : 200, {
|
package/board-actions.js
CHANGED
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
normalizeTags,
|
|
63
63
|
normalizeTask,
|
|
64
64
|
reconcileTaskDependencies,
|
|
65
|
+
resolveActivePlanStepId,
|
|
65
66
|
normalizeNote,
|
|
66
67
|
BOUND_FIELDS,
|
|
67
68
|
normalizeBoundFieldName,
|
|
@@ -280,6 +281,19 @@ export function createBoardActions(deps) {
|
|
|
280
281
|
|
|
281
282
|
const board = loadBoard(file)
|
|
282
283
|
|
|
284
|
+
const resolveStepRef = (rawRef, fallbackId = '') => {
|
|
285
|
+
const ref = str(rawRef, '').trim()
|
|
286
|
+
if (!ref) return fallbackId
|
|
287
|
+
const plan = Array.isArray(board && board.plan) ? board.plan : []
|
|
288
|
+
if (plan.some(s => s && s.id === ref)) return ref
|
|
289
|
+
const m = ref.match(/^(?:step[-_]?|#)?(\d{1,3})$/i)
|
|
290
|
+
if (m) {
|
|
291
|
+
const idx = Number(m[1]) - 1
|
|
292
|
+
if (idx >= 0 && idx < plan.length && plan[idx] && plan[idx].id) return plan[idx].id
|
|
293
|
+
}
|
|
294
|
+
return ref.slice(0, 120)
|
|
295
|
+
}
|
|
296
|
+
|
|
283
297
|
if (action === 'task.reset') {
|
|
284
298
|
const mode = str(args.mode, 'clear').trim().toLowerCase()
|
|
285
299
|
const hadCount = Array.isArray(board.tasks) ? board.tasks.length : 0
|
|
@@ -308,6 +322,15 @@ export function createBoardActions(deps) {
|
|
|
308
322
|
if (!title) return { ok: false, error: 'title required' }
|
|
309
323
|
const clips = []
|
|
310
324
|
const ownerVal = str(args.subagent || args.target || args.owner, by)
|
|
325
|
+
const parentIdVal = str(args.parentId, '').slice(0, 200)
|
|
326
|
+
const parentTask = parentIdVal ? board.tasks.find(t => t && t.id === parentIdVal) : null
|
|
327
|
+
const autoStepId = (parentTask && parentTask.planStepId) || resolveActivePlanStepId(board)
|
|
328
|
+
const planStepIdVal = args.planStepId !== undefined
|
|
329
|
+
? resolveStepRef(args.planStepId, '')
|
|
330
|
+
: autoStepId
|
|
331
|
+
const targetPlanStepIdVal = args.targetPlanStepId !== undefined
|
|
332
|
+
? resolveStepRef(args.targetPlanStepId, '')
|
|
333
|
+
: ''
|
|
311
334
|
const task = normalizeTask({
|
|
312
335
|
id: str(args.id, '') ? str(args.id, '').slice(0, 64) : newId('t'),
|
|
313
336
|
title: clipInto(clips, 'task.title', title, CAP_TASK_TITLE),
|
|
@@ -321,7 +344,9 @@ export function createBoardActions(deps) {
|
|
|
321
344
|
intent: clipInto(clips, 'task.intent', str(args.intent, ''), CAP_TASK_INTENT),
|
|
322
345
|
evidence: clipInto(clips, 'task.evidence', str(args.evidence, ''), CAP_TASK_EVIDENCE),
|
|
323
346
|
blockedBy: Array.isArray(args.blockedBy) ? args.blockedBy : (typeof args.blockedBy === 'string' && args.blockedBy ? args.blockedBy.split(',').map(s => s.trim()) : []),
|
|
324
|
-
parentId:
|
|
347
|
+
parentId: parentIdVal,
|
|
348
|
+
planStepId: planStepIdVal,
|
|
349
|
+
targetPlanStepId: targetPlanStepIdVal,
|
|
325
350
|
assumptions: str(args.assumption, '') ? [{ text: str(args.assumption, '').slice(0, CAP_ASSUMPTION), verified: false, verifiedAt: 0, note: '' }] : [],
|
|
326
351
|
createdAt: nowMs(),
|
|
327
352
|
updatedAt: nowMs(),
|
|
@@ -385,6 +410,10 @@ export function createBoardActions(deps) {
|
|
|
385
410
|
|
|
386
411
|
const ownerVal = str(item.subagent || item.target || item.owner, existing ? existing.owner : '')
|
|
387
412
|
const subagentVal = str(item.subagent || item.target || (ownerVal && ownerVal !== 'agent' && ownerVal !== 'operator' ? ownerVal : ''), existing ? existing.subagent : '')
|
|
413
|
+
const parentForStep = resolvedParent ? board.tasks.find(t => t && t.id === resolvedParent) : null
|
|
414
|
+
const defaultStepForNew = (parentForStep && parentForStep.planStepId) || resolveActivePlanStepId(board)
|
|
415
|
+
const itemStepId = item.planStepId !== undefined ? resolveStepRef(item.planStepId, '') : undefined
|
|
416
|
+
const itemTargetStepId = item.targetPlanStepId !== undefined ? resolveStepRef(item.targetPlanStepId, '') : undefined
|
|
388
417
|
|
|
389
418
|
if (existing) {
|
|
390
419
|
existing.title = clipInto(clips, 'task.title', title, CAP_TASK_TITLE)
|
|
@@ -395,6 +424,8 @@ export function createBoardActions(deps) {
|
|
|
395
424
|
if (subagentVal) existing.subagent = subagentVal.slice(0, 120)
|
|
396
425
|
if (typeof item.preset === 'string') existing.preset = item.preset.slice(0, 80)
|
|
397
426
|
if (rawParent || item.parentId === '') existing.parentId = resolvedParent.slice(0, 200)
|
|
427
|
+
if (itemStepId !== undefined) existing.planStepId = itemStepId
|
|
428
|
+
if (itemTargetStepId !== undefined) existing.targetPlanStepId = itemTargetStepId
|
|
398
429
|
if (item.blockedBy !== undefined) existing.blockedBy = resolvedDeps
|
|
399
430
|
if (STATUSES.includes(item.status)) existing.status = item.status
|
|
400
431
|
if (PRIORITIES.includes(item.priority)) existing.priority = item.priority
|
|
@@ -415,6 +446,8 @@ export function createBoardActions(deps) {
|
|
|
415
446
|
evidence: clipInto(clips, 'task.evidence', str(item.evidence, ''), CAP_TASK_EVIDENCE),
|
|
416
447
|
blockedBy: resolvedDeps,
|
|
417
448
|
parentId: resolvedParent,
|
|
449
|
+
planStepId: itemStepId !== undefined ? itemStepId : defaultStepForNew,
|
|
450
|
+
targetPlanStepId: itemTargetStepId !== undefined ? itemTargetStepId : '',
|
|
418
451
|
assumptions: str(item.assumption, '') ? [{ text: str(item.assumption, '').slice(0, CAP_ASSUMPTION), verified: false, verifiedAt: 0, note: '' }] : [],
|
|
419
452
|
createdAt: nowMs(),
|
|
420
453
|
updatedAt: nowMs(),
|
|
@@ -427,11 +460,29 @@ export function createBoardActions(deps) {
|
|
|
427
460
|
reconcileTaskDependencies(board, by, session)
|
|
428
461
|
if (!board.plan.length && board.tasks.length) {
|
|
429
462
|
const roots = board.tasks.filter(t => !t.parentId)
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
463
|
+
const stageSeeds = (roots.length ? roots : board.tasks).slice(0, 12)
|
|
464
|
+
board.plan = stageSeeds.map(t => {
|
|
465
|
+
const sid = 's-' + t.id
|
|
466
|
+
if (!t.planStepId) t.planStepId = sid
|
|
467
|
+
return {
|
|
468
|
+
id: sid,
|
|
469
|
+
text: t.title + (t.owner ? ' (@' + t.owner + ')' : ''),
|
|
470
|
+
done: t.status === 'done',
|
|
471
|
+
}
|
|
472
|
+
})
|
|
473
|
+
const byTaskId = new Map(board.tasks.map(t => [t.id, t]))
|
|
474
|
+
const resolveRootStep = (task, seen = new Set()) => {
|
|
475
|
+
if (!task) return ''
|
|
476
|
+
if (task.planStepId) return task.planStepId
|
|
477
|
+
if (task.parentId && byTaskId.has(task.parentId) && !seen.has(task.id)) {
|
|
478
|
+
seen.add(task.id)
|
|
479
|
+
const inherited = resolveRootStep(byTaskId.get(task.parentId), seen)
|
|
480
|
+
if (inherited) task.planStepId = inherited
|
|
481
|
+
return inherited
|
|
482
|
+
}
|
|
483
|
+
return ''
|
|
484
|
+
}
|
|
485
|
+
for (const t of board.tasks) resolveRootStep(t)
|
|
435
486
|
}
|
|
436
487
|
pushLog(board, '规划任务图:共更新/新增 ' + touchedTasks.length + ' 个任务节点', by, session)
|
|
437
488
|
return clipped({ ok: true, tasks: touchedTasks, board: saveBoard(board, file) }, clips)
|
|
@@ -491,6 +542,8 @@ export function createBoardActions(deps) {
|
|
|
491
542
|
task.assumptions.push({ text: clipInto(clips, 'task.assumption', args.assumption.trim(), CAP_ASSUMPTION), verified: false, verifiedAt: 0, note: '' })
|
|
492
543
|
}
|
|
493
544
|
if (typeof args.parentId === 'string') task.parentId = args.parentId.trim().slice(0, 200)
|
|
545
|
+
if (typeof args.planStepId === 'string') task.planStepId = resolveStepRef(args.planStepId, '')
|
|
546
|
+
if (typeof args.targetPlanStepId === 'string') task.targetPlanStepId = resolveStepRef(args.targetPlanStepId, '')
|
|
494
547
|
if (typeof args.owner === 'string') task.owner = str(args.owner, '').slice(0, 200)
|
|
495
548
|
if (typeof args.target === 'string') {
|
|
496
549
|
task.owner = str(args.target, '').slice(0, 200)
|
|
@@ -558,10 +611,12 @@ export function createBoardActions(deps) {
|
|
|
558
611
|
// A bare string in a flattened list is one step, not a step with no
|
|
559
612
|
// text: the old shape filtered it out and wiped the plan.
|
|
560
613
|
const step = typeof raw === 'string' ? { text: raw } : (raw && typeof raw === 'object' ? raw : {})
|
|
614
|
+
const cleanSummary = typeof step.summary === 'string' ? step.summary.trim().slice(0, 240) : ''
|
|
561
615
|
return {
|
|
562
616
|
id: str(step.id, newId('s')),
|
|
563
617
|
text: clipInto(clips, 'plan.step', str(step.text, ''), CAP_PLAN_STEP),
|
|
564
618
|
done: asBool(step.done) === true,
|
|
619
|
+
...(cleanSummary ? { summary: cleanSummary } : {}),
|
|
565
620
|
}
|
|
566
621
|
})
|
|
567
622
|
.filter(step => step.text !== '')
|