dsh-chief 1.3.0 → 1.4.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 CHANGED
@@ -5,26 +5,56 @@ 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.4.0] - 2026-11-19
9
+
10
+ ### Added
11
+
12
+ #### 🧱 全会话事前物理驻墙与独立安全内核 (`pkg/safety/` + `tools/pre-execute`)
13
+ - **事前物理硬拦截**:主对话、子代理与参谋调用文件或命令落地前统一经过 `tools/pre-execute` 门禁,撞墙直接拒止并写入 `chief-audit.jsonl`。
14
+ - **随身复用的动态物理墙**:边界页新增「🧱 物理驻墙」(持久化于 `~/.dsh/chief/guard-walls.json`),支持 `global`(跨窗口自动跟随)/ `workspace`(仅本工程)/ `paused`(暂挂备用)一键切换。
15
+ - **大白话手搓与同类合并**:对参谋说白话即可生成 `wallProposals` 草案(人工确认后落锁),支持多选或一键合并相同 `ruleType` 的物理墙(跨类型混选自动拦截)。
16
+ - **9 模块独立安全内核**:将硬守卫、命令拆解、路径穿透检测、能力引擎与审计拆为 `pkg/safety/` 9 个零业务依赖模块,与 `chief-executor.js` 全集 MD5 锁定。
17
+
18
+ #### 🤝 参谋懒介入协同、无感问询与自动续跑 (`chief-commands.js` + `chief-state.js`)
19
+ - **主对话优先(懒介入)**:高权限下只要未点名让参谋亲自操刀,工作区改动与命令统一发 `[EXECUTION_REQUEST]` 委派 `@lead` 动手,绝不冒充用户发言。
20
+ - **空白新窗口先探路定计划**:新开空白会话直接找参谋时,默认先引导 `@lead` 只读看代码 → `graph.plan` 排计划 → `chief.request` 汇报结论。
21
+ - **后台优先问询零打断**:参谋缺细节时经 `agent/pre-step` 递出 `[INQUIRY #id]`,主对话顺手调 `inquiry.reply` 秒回后继续原工作,不打断当前步骤。
22
+ - **审批/提权后自动续跑 (`TaskLedger`)**:点完「允许」后按持久化账本自动接上未走完的步骤;异常重启时自动将半途任务安全置为 `interrupted`,不偷偷重跑。
23
+
24
+ #### 🔒 细粒度能力模型与只紧不松策略 (`policy-engine.js` + `policy-plugin.js`)
25
+ - **`role + capabilities` 双层解耦**:界面保持 `advisor / assistant / strategist / chief` 四档,底层放开 `assistant` 低风险看板与档案整理免弹窗,依然严锁文件写入。
26
+ - **单次授权防复用与只紧不松插件**:逐项授权绑定目标路径/命令 `capabilityScope`;可选 `policyPlugins` 仅允许收紧规则,试图关闭硬守卫的配置直接拒绝。
27
+
28
+ ### Changed
29
+ - **前后台流光舞台提示 (`activeWork`)**:参谋在前台或后台自动巡检、收档、维护边界或刷摘要时,面板自动切页并点亮流动渐变 + 双束光线边框与毛玻璃跃动字提示。
30
+ - **强介入双防线核对窗 (`InterventionConfirmModal`)**:开启前并排核对当前生效的「🧱 物理驻墙」与「🚫 禁止红线」,右上角改为「管理边界」并支持一键收起/拉开。
31
+ - **问答分组框、红盾哨兵与顺势刷摘要**:每轮提问与回执包进高对比分组外框并支持一键折展,按钮统一靠右下对齐;「🛡 红线哨兵」开启时变红并点亮双层红盾图标;每次聊完按 60 秒节流后台顺势刷新顶部摘要。
32
+
33
+ ### Fixed
34
+ - **适配 DSH `0.2.2-rc.5` 原生工具与弹窗审批**:对齐 `dsh-tool-fs`(`read` / `read_image` / `write` / `edit` / `apply_patch`),修复仅禁写路径墙误拦 `str_replace_editor` 只读 `view` 模式的问题,接入 `tools/pre-execute` 原生 `{ kind: 'ask' }` 单次审批弹窗,并兼容多代际 `session(.vN).jsonl(.zstd)` 日志检索。
35
+ - **封堵复合管道、内联脚本与多反斜杠凭据变形**:补齐 `&& / || / | / ;`、嵌套 Shell、`node -e / python -c / pwsh / iex`(含 Base64)及引号多反斜杠绕过(如 `copy x ".\\"env`),对 `node .\env\setup.js`、`process.env.NODE_ENV` 与 `$env:TEMP` 保持 0 误杀;`bounds.*` 与驻墙删改强制校验 `HUMAN_BOUNDS_CONFIRM_TOKEN`。
36
+
8
37
  ## [1.3.0] - 2026-11-18
9
38
 
10
39
  ### Added
11
- - **模块化架构拆分(减少单文件依赖)**:将 4 个超长单体文件拆分为 **29 个后端 ESM 模块 + 16 个前端源码模块**,保持 `index.js`、`chief.js`、`archives.js`、`client.js` 公开导出 100% 兼容,强制零 `export let/var` 可变导出、无环依赖,并配套 `ARCHITECTURE.md`、`scripts/build-client.mjs` 与 `.github/workflows/ci.yml` 双版本 Node (22 / 24) CI 门禁。
12
- - **授权/提权后自动续跑 (`resumeTasks`)**:用户点击「允许本次操作」或完成提权审批后,按轻量恢复账本(30 分钟 TTL + 最大深度熔断)自动续接未完成的多步参谋任务,拒绝或过期自动取消不空转。
13
- - **独立只追加审计账本 (`chief-audit.jsonl`)**:所有权限判定、审批放行/拒绝与安全拦截均独立追加落盘至 `chief-audit.jsonl`,不受状态文件截断影响。
14
- - **顶栏常驻版本号与对话流筛选**:参谋长标题栏常驻展示当前版本徽章(`v1.3.0`);参谋页支持 **`全部 / 💬 问答 / 📋 回执`** 视觉筛选,并将待定建议收拢至顶部统一「`▶ 执行建议`」批量执行。
15
40
 
16
- ### Security
17
- - **命令与内容安全卫兵归一化**:`chief-executor.js` 在安全检查前统一执行 NFKC 规范化、PowerShell `-EncodedCommand` 解码、引号拼接还原、引号内反斜杠(如 `".\"env`)与 CMD `^` 插入符折叠、以及 `git` / `npm` 子命令提取;`checkForbiddenBounds` 同步覆盖 `write_file` / `edit_file` / 递话参数正文。
18
- - **凭据路径与 NTFS ADS 拦截**:拦截工作区外越界写入、凭据符号链接及 NTFS Alternate Data Streams(如 `safe.txt:.env`)。
19
- - **审批快照哈希锁与失败默认拒绝**:待批操作绑定 SHA-256 `payloadHash`,拦截篡改与重放审批并全部记入审计;同源 HTTP `guard()` 检测到连接守卫异常时 fail-closed 返回 `403`。
41
+ #### 🧩 模块化低耦合架构与双版本 CI (`ARCHITECTURE.md` + `build-client.mjs`)
42
+ - **前后端模块化拆分**:将 4 个超长单体文件拆为 **29 个后端模块 + 16 个前端源码模块**,`index.js`、`chief.js`、`archives.js`、`client.js` 公开导出保持 100% 兼容。
43
+ - **静态边界与双版本门禁**:强制零 `export let/var` 可变导出、零循环依赖,新增 GitHub Actions Node `22 / 24` 自动门禁。
44
+
45
+ #### 🔄 审批续跑、独立审计与对话流筛选 (`chief-executor.js` + `chief-state.js`)
46
+ - **点完允许自动接着跑 (`resumeTasks`)**:点击「允许本次操作」或完成提权后,按 30 分钟 TTL 与深度熔断自动续接未走完的多步任务,拒绝或超时自动取消不空转。
47
+ - **独立只追加审计账本 (`chief-audit.jsonl`)**:权限判定、放行/拒绝与安全拦截统一追加写入 `~/.dsh/chief/chief-audit.jsonl`,不受状态文件截断影响。
48
+ - **顶栏版本号与对话流筛选**:标题栏常驻显示当前版本徽章(`v1.3.0`);参谋页支持 `全部 / 💬 问答 / 📋 回执` 筛选,待定建议统一收拢至顶部「`▶ 执行建议`」。
20
49
 
21
50
  ### Changed
22
- - **存储层并发锁与原子写鲁棒性加固**:`board-store.js`、`chief-state.js`、`archive-core.js` 统一引入跨进程/跨工作线程 `O_EXCL` 自旋锁与 `threadId` 唯一临时文件路径,把 Windows NTFS 瞬态 `EPERM` / `EACCES` / `EBUSY` 纳入随机抖动等待,并对 `fs.renameSync` 增加瞬态重试,消除高并发多线程场景下的丢写风险。
23
- - **模型上下文窗口异步回写**:`subagent-runtime.js` 兼容同步与异步 `resolveModelInfo` 查询,缓存并及时更新会话 Token 窗口统计。
51
+ - **跨进程与多线程文件锁加固 (`O_EXCL`)**:`board-store.js`、`chief-state.js`、`archive-core.js` 引入 `threadId` 唯一临时文件与 Windows NTFS `EPERM / EACCES / EBUSY` 随机抖动自旋重试,消除高并发丢写。
52
+ - **模型上下文窗口异步回写 (`subagent-runtime.js`)**:兼容同步与异步 `resolveModelInfo` 查询,及时缓存并刷新会话 Token 窗口统计。
24
53
 
25
54
  ### Fixed
26
- - **修复关闭右侧面板后每 3.2 秒自动弹回与假 Toggle**:区分首次启动自动挂载与用户手动收起状态,支持底部入口点击真实折叠/展开。
27
- - **修复档案页「一键收纳入柜」无响应与未刷新**:补齐会话看板、根会话看板与横幅显式指定共享便签三路收纳,自动对疑似密钥串执行 `[REDACTED]` 脱敏入柜,并将最新 `board`、`archives` 与分柜实时计数即时同步至前端状态。
55
+ - **命令与路径安全卫兵反混淆 (`chief-executor.js`)**:检查前统一执行 NFKC 规范化、PowerShell `-EncodedCommand` 解码、引号拼接与 `^` 插入符折叠;拦截越界写入、凭据符号链接与 NTFS ADS 流(如 `safe.txt:.env`);待批操作绑定 SHA-256 `payloadHash`,同源 `guard()` 异常默认返回 `403`。
56
+ - **修复关闭右侧栏后每 3.2 秒自动弹回**:区分首次启动自动展开与用户手动收起状态,底部入口点击恢复真实折叠/展开(Toggle)。
57
+ - **修复档案页「一键收纳入柜」漏收与不刷新**:补齐会话看板、根会话看板与共享便签三路收纳,疑似密钥自动 `[REDACTED]` 脱敏入柜,并即时同步前端分柜计数。
28
58
 
29
59
  ## [1.2.1] - 2026-11-17
30
60
 
package/README.en.md CHANGED
@@ -1,20 +1,20 @@
1
1
  <div align="center">
2
2
 
3
- **AI manages AI, you take the day off — even when you're not there, it's watching.**
4
- <sub>It dispatches the work, keeps the subagents on track, and closes out on its own; if it starts to drift, it stops first.</sub>
3
+ **Right-sidebar supervisor, anti-compaction vault, and approval gate for DeepSeek Harness (DSH)**
4
+ <sub>Saves paths and findings before `/compact` wipes context, tracks subagent DAGs in one view, and asks before editing files or running shell commands.</sub>
5
5
 
6
- <img src="assets/chief-10s-compare.gif" alt="dsh-chief in 10 seconds: left is a plain long session — re-reading the same files, losing parameters to compaction, forgetting when you switch windows; right is Chief — loop breaker, parameters vaulted before compaction, archive carried across windows. Read-only by default." width="800" />
6
+ <img src="assets/chief-10s-compare.gif" alt="Side-by-side comparison: plain long session loses context on compaction vs. dsh-chief saves findings to cold vaults, guards actions, and carries structured handoffs across windows" width="800" />
7
7
 
8
- <sub>Read-only by default · asks before touching your workspace · `dsh plugin --profile web add dsh-chief`</sub>
8
+ <sub>Read-only by default · Per-action workspace approval · `dsh plugin --profile web add dsh-chief`</sub>
9
9
 
10
10
  <br />
11
11
 
12
- <img src="assets/hero-banner.png" alt="DSH Chief (dsh-chief) v1.2.0 — Wish-Driven Multi-Agent Cockpit & 3-Tier Cold Vaults" width="100%" />
12
+ <img src="assets/hero-banner.png" alt="dsh-chief main cockpit view" width="100%" />
13
13
 
14
14
  <br />
15
15
 
16
- # ✦ DSH Chief (`dsh-chief` · DSH 参谋长)
17
- ### DeepSeek Harness Multi-Agent Cockpit · Wishing Box Executor · 3-Tier 0-Token Cold Vaults · `✦ 智选压缩`
16
+ # DSH Chief (`dsh-chief`)
17
+ ### DeepSeek Harness Right-Sidebar Supervisor, Zero-Token Archive Vault & Safety Gate
18
18
 
19
19
  [![DSH Compatibility](https://img.shields.io/badge/DSH-%3E%3D%200.2.2--rc.2-38bdf8?style=flat-square)](https://dsh.deepseek.com)
20
20
  [![npm version](https://img.shields.io/npm/v/dsh-chief?color=cb3837&style=flat-square)](https://www.npmjs.com/package/dsh-chief)
@@ -25,8 +25,8 @@
25
25
  [![Zero Dependencies](https://img.shields.io/badge/Dependencies-0%20External-ffe033?style=flat-square)](#)
26
26
  [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-f87171?style=flat-square)](LICENSE)
27
27
 
28
- > **Nobody watching, nothing breaking: state your intent in the Wishing Box and it runs the whole flow, stopping first if it starts to drift (`v1.3.0`)**
29
- > Follows the same shape as DeepSeek's official **[SuperAgent (`dsh-superagent-prototype`)](https://github.com/deepseek-ai/dsh-superagent-prototype)** *Router + Isolated Workers* architecture to keep focus sharp and context clean.
28
+ > **Current release `v1.4.0`**: Adds a 9-module safety kernel (`pkg/safety/`), `tools/pre-execute` guard walls (`guard-walls.json`), two-tier `role + capabilities` with persistent `TaskLedger` resume, main-chat-first lazy delegation (`[EXECUTION_REQUEST]`), quiet `[INQUIRY]` checks, and DSH `0.2.2-rc.5` support.
29
+ > 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.
30
30
 
31
31
  [简体中文 (`README.md`)](README.md) · **English** · [Changelog (`CHANGELOG.md`)](CHANGELOG.md)
32
32
 
@@ -34,93 +34,75 @@
34
34
 
35
35
  ---
36
36
 
37
- ## 🔗 Core Highlights Wired Into DSH Runtime
37
+ ## Daily Friction This Plugin Fixes
38
38
 
39
- - **Modular Architecture & Concurrency Robustness (`v1.3.0`)**: Split from monolithic files into 29 backend + 16 frontend ES modules with acyclic DAG boundaries, `O_EXCL` spin-locks with Windows NTFS retry (`board-store`, `chief-state`, `archive-core`), fail-closed `guard()`, SHA-256 `payloadHash` approval verification, and append-only `chief-audit.jsonl`.
39
+ If you run multi-step coding tasks inside DeepSeek Harness, these six problems tend to come up quickly.
40
40
 
41
- - **Persistent Router Cockpit**: Unifies the root coordinator, subagents, and linked DSH windows inside one **Full-Spread Pyramid DAG**—zero blind tab switching.
42
- - **Native Split-Pane Streams (`subagentchat`)**: Click `分屏` on any subagent node to open DSH's native `sidebarRight.openResource` live stream.
43
- - **Read-only first, asks before acting (`chief-executor.js`)**: New and handed-off sessions start read-only — it observes and proposes first. Editing files, running commands, or steering subagents needs your per-action approval, with a confirmation popup and an audit log behind it.
44
- - **Ready on Blank New Sessions**: Resolves workspace root via `workspaceRegistry` even before turn 1 in the main chat, and stages `@lead` relays cleanly in `pending-transfer.json`.
45
- - **Objective Lock & Human Sign-Off**: Strong Intervention locks your Core Objective (`0 = ∞` turns supported), verifies `allowed` must-do items, and waits for your explicit **`✅ 批准结项`** click.
46
- - **Cross-Isolation `✦ 智选压缩` & Flexible Thresholds**: Compacts via DSH `/compact` across Cordis service isolation (and wakes dormant agents via `sessionController.resolveAgent`), supporting `10%–95%`, `>= 8,000` tokens, or direct `"压缩吧"` commands.
47
- - **Three-Tier 0-Token Cold Vaults**: Isolates **Session Cabinet**, **System Global Cold Vault** (with live Local ↔ Global diff), and **Double-Blind Precipitated Vault**, spotlighted only via **`📌 摆上桌面`**.
48
- - **Clean Cross-Window Linking & Pinnable Handoffs**: Warns before linking sessions, purges external context immediately on detach, and locks snapshots via **`📌 定住防改`**.
41
+ ### 1. Context compaction (`/compact`) wipes paths, commands, and errors
42
+ - **What goes wrong**: When a long session compacts, the summary drops exact file paths, port numbers, and shell fixes you already verified, so the model re-reads files from scratch.
43
+ - **How `dsh-chief` handles it**: Supports `✦ 智选压缩` at idle phase boundaries, custom `10%–95%` or `>= 8,000` token thresholds, or typing `"压缩吧"`.
44
+ - **Fixed order of operations**: It harvests notes into your local session archive and verifies the write before running `/compact` via DSH. Compaction counters only increment after a real, non-empty compaction succeeds.
49
45
 
50
- ---
51
-
52
- ## 💡 6 Daily Engineering Pain Points — Solved
53
-
54
- Ordinary Todo plugins give you another scratchpad; always-on memory plugins flood every system prompt with stale noise. **`dsh-chief` turns human micromanagement into Wish-Driven One-Stop Execution:**
55
-
56
- ### 1. Agents Stop Halfway ("I edited the file, please test it yourself")
57
- - **Typical Plugins**: Static checklists let agents self-declare victory.
58
- - **`dsh-chief`**: Locks the Core Objective with Strong Intervention (`0 = ∞`), verifies `allowed` must-do checks, and blocks exit until you click **`✅ 批准结项`**.
59
- - **Instant Override**: High-risk checks prompt first, and the red **`⏹ 急停`** button halts background drives immediately.
46
+ ### 2. Agents stop halfway ("I edited the file, please test it")
47
+ - **What goes wrong**: Left unattended or overnight, an agent updates one file and marks the task done without running checks or builds.
48
+ - **How `dsh-chief` handles it**: Locks the Core Objective under Strong Intervention (`0 = ∞` turns with stall breakers) and checks your `allowed` must-do list until you explicitly click `✅ 批准结项`.
49
+ - Hit the red `⏹ 急停` button at any time to stop background drives and take back manual control.
60
50
 
61
- ### 2. "Lobotomy" Amnesia Right After Context Compaction
62
- - **Typical Plugins**: Auto-compaction wipes out freshly discovered file paths, commands, and errors.
63
- - **`dsh-chief`**: Triggers **`✦ 智选压缩`** when idle at phase boundaries, custom **`10%–95%` / `>= 8k`** thresholds, or direct `"压缩吧"` requests.
64
- - **Atomic Guarantee**: Harvests and disk-verifies notes in the Session Cabinet before `/compact`, never inflating counters on failures or empty no-ops.
51
+ ### 3. Always-on memory plugins bloat prompts and burn tokens
52
+ - **What goes wrong**: Injecting kilobytes of old notes on every turn wastes context window and distracts the model from the current file.
53
+ - **How `dsh-chief` handles it**: Stores sealed dossiers in three local vaults (Session, System Global, Precipitated). **While sealed, they add 0 bytes and 0 tokens to the main chat.**
54
+ - Click `📌 摆上桌面` or `📤 取出` only when a specific note is needed, and put it back as soon as you finish that step.
65
55
 
66
- ### 3. Bloated Memory Injections Mudding the Model's Brain
67
- - **Typical Plugins**: Re-injects megabytes of old logs every turn, burning quota and confusing current reasoning.
68
- - **`dsh-chief`**: All three cold vaults remain **0 bytes / 0 tokens while sealed** (Precipitated Vault is double-blind to both Lead and Chief).
69
- - **On-Demand Precision**: Injects only items explicitly spotlighted via **`📌 摆上桌面`** or flipped out via **`📤 取出`**.
56
+ ### 4. Full autonomy feels unsafe, but chat-only mode leaves Chief idle (or bossy)
57
+ - **What goes wrong**: Clicking "allow everything" risks `git push --force`, destructive deletes, or reading `.env`, while high-tier supervisors often try to edit files themselves instead of letting your main agent work.
58
+ - **How `dsh-chief` handles it**: Uses four permission tiers (`advisor` read-only default, `assistant`, `strategist` per-action approval, `chief` high autonomy) plus a pre-execution firewall.
59
+ - **Every new session starts read-only**: Observes code, answers questions, and updates the board without touching your workspace.
60
+ - **Pre-execution guard walls (`tools/pre-execute`)**: Before the main agent, any subagent, or Chief writes a file or runs a command, calls pass through `~/.dsh/chief/guard-walls.json`. Walls can be scoped as `global` (follow every new session like preferences), `workspace` (project-only), or `paused`, merged in-place when they share a rule type, or crafted in plain language by Chief for you to approve. High-risk command rules can prompt DSH's native one-time approval dialog.
61
+ - **Lazy intervention & background check-ins**: Unless you explicitly ask Chief to edit files directly, it sends structured `[EXECUTION_REQUEST]` items to the main conversation instead of taking over or speaking as you. In a blank new chat, it instructs `@lead` to read the repo and build a plan first, asks clarifying questions quietly in the background without pausing `@lead`, and updates the top summary after chats.
62
+ - **Auto-resume after approval & restrict-only policies**: `TaskLedger` picks up unfinished steps once you click Allow, hard rules (compound shells, `node -e`/`python -c`, quote-backslash `.env` tricks, symlinks, NTFS ADS) hold in every tier with logs written to `~/.dsh/chief/chief-audit.jsonl`, and optional JSON `policyPlugins` can tighten permissions without ever weakening built-in hard guards.
70
63
 
71
- ### 4. Chat-Only "Mascot Copilots" — Or All-or-Nothing Yolo Modes
72
- - **Typical Plugins**: Either you can only look, or one switch hands over everything and it quietly edits your files.
73
- - **`dsh-chief`**: Read-only by default, and it asks before each escalation — it won't act up while you're away:
74
- - **Read-only on every new session**: Observes, analyses, and proposes; never touches the workspace or takes over lead/subagent flows.
75
- - **Asks before acting**: File edits, commands, and subagent steering pop an **Operation Approval Modal** (`what / on what / why / impact`) and run only after you allow that one action.
76
- - **Second check for high autonomy**: Granting higher autonomy requires acknowledging the **High-Privilege Risk Notice** checkbox, then a backend check.
77
- - **Take it back anytime**: The red **`⏹ 急停`** button hands control back to you immediately, and everything stays in the audit log.
64
+ ### 5. Dozens of subagents run out of sight and ignore verbal rules
65
+ - **What goes wrong**: Workers live across scattered tabs, and rules mentioned in chat scroll out of context after ten turns.
66
+ - **How `dsh-chief` handles it**: Shows the main coordinator and subagents in one tree view with status controls, step Q&A, and one-click `分屏` live output streams. Pin rules with `📌` in Boundaries so every new task inherits them.
78
67
 
79
- ### 5. Cramped Subagent Views & Verbal Rules Forgotten in 10 Turns
80
- - **Typical Plugins**: Tiny scroll boxes hide blocked workers, and safety instructions scroll out of context.
81
- - **`dsh-chief`**: Full-spread Pyramid DAG + native split-pane stream viewer + **`📌` Global Thumbtack Redlines** persisted across tasks.
82
-
83
- ### 6. Lost Setup Across Windows & Silent Metered-API Quota Drain
84
- - **Typical Plugins**: New tabs wipe your coordinator rules, while background loops hit expensive metered APIs.
85
- - **`dsh-chief`**: Defaults to **`⏸ On-Demand` (0 background LLM calls)**, strictly aligns `Provider / Model` channels, and clones setup via 1-click Chief handoff.
68
+ ### 6. Long threads slow down, but opening a new window resets everything
69
+ - **What goes wrong**: After 100 turns you want a clean window without re-explaining workspace paths and task progress, and you do not want a background plugin quietly calling paid APIs every turn.
70
+ - **How `dsh-chief` handles it**: Defaults to `⏸ On-Demand` (0 background LLM calls) and mirrors your active session's provider/model. Edit or freeze handoff notes with `📌 定住防改`, then deploy a linked window carrying only the vault scope you pick.
86
71
 
87
72
  ---
88
73
 
89
- ## 📸 Visual Tour (`v1.2.0` 7 High-DPI Views)
74
+ ## Inside the Sidebar
90
75
 
91
- ### 01 · Wish-Driven Chief Cockpit (`参谋` Tab)
92
- - **Guardrails & Tactical Bar**: Compact `+` trigger on the left with live pills above (`⚡ 强介入 0/♾️`, `✦ 智选压缩`, `🛡 红线哨兵`, `🔵 完全权限`, and `⏹ 急停`).
93
- - **Clear Execution & Compaction Receipts**: Live status narrative, boundary approval cards, and visible `✦ 智选压缩` chat receipts side-by-side.
94
- - **Handoff Sync Toggle**: `同步交接单` control right in the cockpit header.
76
+ ### 01 · Chief Cockpit (`参谋` Tab)
77
+ - Send tasks in plain language from the bottom input box (with action buttons cleanly aligned at bottom-right). Status pills above show `⚡ 强介入`, `✦ 智选压缩`, `🛡 红线哨兵` (turning red with a colored shield when active), permission tier, and `⏹ 急停`.
78
+ - Enabling Strong Intervention opens a confirmation modal listing both active Physical Guard Walls and Forbidden Redlines side by side (`管理边界` + expand/collapse controls).
79
+ - Filter the feed by `全部 / 💬 问答 / 📋 回执`. User prompts and Chief receipts sit inside high-contrast grouped frames that collapse individually or all at once, multi-step suggestions merge into one top `▶ 执行建议` button, and background Chief work switches to the active tab with a frosted overlay and sweeping light-beam border.
95
80
 
96
- ![01 - Wish-Driven Chief Cockpit Overview](assets/screenshots/01-chief-cockpit-overview.png)
81
+ ![01 - Chief Cockpit Overview](assets/screenshots/01-chief-cockpit-overview.png)
97
82
 
98
83
  ---
99
84
 
100
- ### 02 · Full-Spread Pyramid Subagent DAG (`任务` Tab)
101
- - **Zero Cramped Panning**: Root Coordinator sits cleanly at the apex while subagent lanes spread vertically below.
102
- - **Inline Squad Controls**: Transition statuses, ask for plain-language explanations, dispatch tasks, or launch native `分屏` live streams in one click.
85
+ ### 02 · Coordinator & Subagent Task Tree (`任务` Tab)
86
+ - Displays the root coordinator and active subagent lanes in a single layout instead of tiny nested lists, with inline status toggles, plain-language step explanations, and `分屏` live stream panes.
103
87
 
104
88
  <div align="center">
105
- <img src="assets/screenshots/02-full-spread-pyramid-dag.png" alt="02 - Full-Spread Pyramid Task Topology" width="76%" />
89
+ <img src="assets/screenshots/02-full-spread-pyramid-dag.png" alt="02 - Subagent DAG View" width="76%" />
106
90
  </div>
107
91
 
108
92
  ---
109
93
 
110
- ### 03 · 0-Token Cold Vaults & Bidirectional Diff (`档案` Tab)
111
- - **Strict Vault Switcher**: Toggle **💬 Session Cabinet**, **🌐 System Global Vault**, and **🏛️ Precipitated Cold Vault** cleanly from the top bar.
112
- - **Paperclip Organization, Four Levels**: Cabinets → Drawers → Gold / Silver / Copper paperclipped dossiers → Unfoldable points & sub-points.
113
- - **Spotlight & Diff Tracking**: Tracks `Synced` / `Local Modified` / `Local Only` diffs; inject selectively via **`📌 摆上桌面`** or send multi-archive **combinatorial relays**.
94
+ ### 03 · 3-Tier Local Archive Vaults (`档案` Tab)
95
+ - Separates **💬 Session Cabinet** (strictly isolated per `rootSessionId`, with multi-cabinet support and one-click `一键收纳入柜` for temporary notes), **🌐 System Global Vault** (tracks `Synced` / `Local Modified` / `Local Only` diffs), and **🏛️ Precipitated Vault** (double-blind by default).
96
+ - Dossiers stay out of prompts until you click `📌 摆上桌面`.
114
97
 
115
98
  <div align="center">
116
- <img src="assets/screenshots/03-cold-archive-cabinet.png" alt="03 - Three-Tier Cold Vaults and Bidirectional Diff" width="68%" />
99
+ <img src="assets/screenshots/03-cold-archive-cabinet.png" alt="03 - Three-Tier Cold Vaults and Diff Tracking" width="68%" />
117
100
  </div>
118
101
 
119
102
  ---
120
103
 
121
- ### 04 · Goal Supervision, Step Q&A & Closure Gate (`规划` Top)
122
- - **Core Objective Lock**: Click **`🎯 设为目标`** to supervise long-horizon goals (locked automatically while Strong Intervention is active).
123
- - **Interactive Step Board**: Click any step to ask Chief *"Why does this step exist?"* without interrupting the main session.
104
+ ### 04 · Core Objective Lock & Step Q&A (`规划` Top)
105
+ - Click `🎯 设为目标` to track long tasks, or click any step in the plan list to ask why that step exists without interrupting the main agent.
124
106
 
125
107
  <div align="center">
126
108
  <img src="assets/screenshots/04-dual-tier-goal-and-step-qa.png" alt="04 - Goal Supervision and Step Q&A" width="68%" />
@@ -128,10 +110,9 @@ Ordinary Todo plugins give you another scratchpad; always-on memory plugins floo
128
110
 
129
111
  ---
130
112
 
131
- ### 05 · Cross-Window Peer Linking & Drawer Mailbox (`协同` Tab)
132
- - **Cluster Federation**: Link multiple independent DSH windows to share real-time progress, with instant zero-pollution cleanup on detach.
133
- - **Color-Coded Drawer Mailbox**: Deduplicates `@all` broadcasts and groups messages by channel scope.
134
- - **Lossless Image Staging**: Uploaded screenshots persist directly in `<cwd>/.dsh-chief/uploads/` for multimodal lead fallback.
113
+ ### 05 · Cross-Window Peer Linking & Mailbox (`协同` Tab)
114
+ - Connect multiple open DSH windows to share live progress, with automatic cache and mailbox purge on detach.
115
+ - Screenshots pasted into the cockpit are saved under `<cwd>/.dsh-chief/uploads/` so models can inspect real files instead of guessing.
135
116
 
136
117
  <div align="center">
137
118
  <img src="assets/screenshots/05-cross-session-collab-bus.png" alt="05 - Cross-Window Linking and Mailbox" width="68%" />
@@ -139,87 +120,133 @@ Ordinary Todo plugins give you another scratchpad; always-on memory plugins floo
139
120
 
140
121
  ---
141
122
 
142
- ### 06 · `📌` Global Thumbtack Redlines & Proposals (`边界` Tab)
143
- - **Task vs. Global Scope**: Pin critical rules with **`📌`** to enforce globally across projects; leave unpinned rules scoped to the active session.
144
- - **Must-Do & Boundary Governance**: Manage `allowed`, `forbidden`, and `notes` rules, approve worker proposals, or consolidate scattered entries cleanly.
123
+ ### 06 · Guard Walls, Pinned Redlines & Must-Do Checks (`边界` Tab)
124
+ - The top **🧱 Physical Guard Walls** section blocks dangerous commands or paths before execution: add rules manually (`+ 手动驻墙`) or let Chief draft them from plain text (`✨ 参谋手搓墙`), toggle `🌐 Global`, `📁 Workspace`, or `⏸ Paused`, and merge multiple walls of the same type cleanly (cross-type merges are blocked).
125
+ - Below that, `allowed` (verification gates), `forbidden` (hard blockers), and `notes` separate global `📌` rules from session-only ones and list boundary proposals from blocked workers. Models cannot delete or mute locked walls or redlines on their own.
145
126
 
146
127
  <div align="center">
147
- <img src="assets/screenshots/06-pinned-bounds-and-handoff.png" alt="06 - Global Thumbtack Redlines" width="68%" />
128
+ <img src="assets/screenshots/06-pinned-bounds-and-handoff.png" alt="06 - Pinned Global Redlines and Proposals" width="68%" />
148
129
  </div>
149
130
 
150
131
  ---
151
132
 
152
- ### 07 · Cross-Session Relay, `📌 定住防改` & 1-Click Deployment (`规划` Bottom)
153
- - **Editable & Pinnable Handoff**: Freeze auto-rendered snapshots cleanly via **`📌 定住防改`** (automatically locking auto-sync overwrites).
154
- - **4 Scoped Archive Policies**: Choose `None`, `Spotlight Only`, `Entire Drawer`, or `Full Session Cabinet`—while Precipitated Vault stays isolated.
155
- - **1-Click Chief Deployment & `idle-guard`**: Clones Chief config safely (forcing Strong Intervention off) to a fresh or target session.
133
+ ### 07 · Session Handoff & Deployment (`规划` Bottom)
134
+ - Edit the Markdown handoff packet directly and lock it via `📌 定住防改` so later summaries do not overwrite your edits.
135
+ - 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.
156
136
 
157
137
  <div align="center">
158
- <img src="assets/screenshots/07-session-handoff-and-guard.png" alt="07 - Cross-Session Relay and Pinnable Handoff" width="68%" />
138
+ <img src="assets/screenshots/07-session-handoff-and-guard.png" alt="07 - Cross-Session Handoff and Deployment" width="68%" />
159
139
  </div>
160
140
 
161
141
  ---
162
142
 
163
- ## ⚠️ Usage Notes & Two Critical Disclaimers
143
+ ## Two Things to Know Before Enabling Tools
164
144
 
165
- > [!IMPORTANT]
166
- > Keep these two engineering realities in mind before enabling Wishing Box tools, **`⚡ Strong Intervention`**, or **`✦ 智选压缩`**:
145
+ > [!NOTE]
146
+ > Keep these two constraints in mind when using Wishing Box tools, `⚡ Strong Intervention`, or `✦ 智选压缩`:
167
147
  >
168
- > 1. **Safety Floor From Plugin Guardrails — Intelligence Ceiling From Your Underlying LLM**
169
- > - `dsh-chief` guarantees the engineering floor (0-token vault isolation, 4 permission modes, verified pre-compact harvesting, circuit breakers, and `⏹ 急停`).
170
- > - However, planning rigor, multi-step tool precision, and supervision quality **depend directly on the LLM you assign to DSH Chief**.
171
- > - Use a strong reasoning flagship model for Chief on complex projects rather than expecting frontier orchestration from tiny models.
172
- > 2. **Avoid Flooding the Model's Brain With Heavy External Prompt Injections**
173
- > - Do **not** stack huge System Prompts, hundreds of conflicting project Rules, or always-injected memory plugins alongside `dsh-chief`.
174
- > - **Bloated injections muddy working memory and fracture attention**, frequently clashing with Chief supervision and causing loops or early trips.
175
- > - Keep global prompts lean and store low-frequency context inside `dsh-chief`'s **0-Token Cold Vaults** for on-demand retrieval.
148
+ > 1. **Guardrails set the safety floor; your LLM sets the ceiling**
149
+ > The plugin guarantees 0-token vault isolation, permission gating, verified pre-compact saves, loop breakers, and `⏹ 急停`. Planning accuracy and code judgment still depend on the model assigned to Chief. Use a strong reasoning model for real engineering work.
150
+ > 2. **Avoid stacking heavy external prompt injections**
151
+ > Skip stacking hundreds of conflicting global rule lines or always-on memory plugins alongside `dsh-chief`. Extra prompt noise competes with active work and causes unnecessary loops or early trips. Keep prompts lean and store reference notes in the cold archive instead.
176
152
 
177
153
  ---
178
154
 
179
- ## ⚡ Quick Installation (Zero External Dependencies)
155
+ ## Modular Architecture (`v1.4.0`)
156
+
157
+ `v1.4.0` spans **38 backend modules (including 9 isolated modules under `pkg/safety/`) and 16 frontend modules** with zero `export let` bindings and zero circular imports. See [ARCHITECTURE.md](ARCHITECTURE.md) for boundaries and module contracts.
158
+
159
+ ```mermaid
160
+ flowchart TB
161
+ subgraph UI["DSH Right Sidebar (client.js <- 16 source modules)"]
162
+ T1["Chief Tab (Grouped Q&A + Red Shield + FX Border)"]
163
+ T2["Tasks Tab (Coordinator + Subagent Lanes + Split Stream)"]
164
+ T3["Peers Tab (Cross-Window Link + Mailbox)"]
165
+ T4["Plan Tab (Objective Lock + Pinned Handoff + Deploy)"]
166
+ T5["Archives Tab (3-Tier Vaults + Sweep Notes)"]
167
+ T6["Boundaries Tab (Dynamic Guard Walls + 📌 Redlines)"]
168
+ end
169
+
170
+ subgraph Core["Local Backend & Safety Kernel (Zero External Deps · 38 modules)"]
171
+ Hot["Hot Boards: ~/.dsh/chief/board.json & boards/<sid>.json\nCross-process/worker_threads O_EXCL spin locks"]
172
+ Walls["Guard Walls: ~/.dsh/chief/guard-walls.json\nGlobal / Workspace / Paused"]
173
+ Cold["3-Tier Vaults: cabinets/ + global-vault/ + precipitated/"]
174
+ Bus["Safety & Resume: safety/*.js + chief-executor.js + taskLedger + chief-audit.jsonl"]
175
+ end
176
+
177
+ subgraph Agents["Host Execution Agents (tools/pre-execute gate)"]
178
+ Lead["Main Coordinator (@lead)"]
179
+ Subs["Subagents (@arch / @dev / @bench)"]
180
+ Peers["Linked DSH Windows"]
181
+ end
182
+
183
+ UI <-->|"27 Same-Origin Routes (/api/dsh-chief/*, fail-closed 403)"| Core
184
+ Hot -->|"Compact Hot State"| Lead
185
+ Hot -->|"Compact Hot State"| Subs
186
+ Walls -->|"Pre-Execution Block or Ask Prompt"| Lead
187
+ Walls -->|"Pre-Execution Block or Ask Prompt"| Subs
188
+ Cold -.->|"0 Tokens While Sealed\nInjected Only When Pinned to Desk"| Lead
189
+ Bus <-->|"chief_board / chief_memory\nchief_boundaries / chief_handoff"| Agents
190
+ ```
191
+
192
+ ---
180
193
 
181
- Search **`dsh-chief`** inside [dshmarket](https://github.com/dsh-market/dsh-market) / DSH Plugin Market, or install via CLI (replace `desktop` with `web` for web profile):
194
+ ## Installation & Host Compatibility
195
+
196
+ 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):
182
197
 
183
198
  ```bash
184
- # Option 1: Install the latest v1.3.0 from npm registry (recommended — fastest mirrors + auto-update notices)
199
+ # Option 1: Install latest release (v1.4.0) from npm
185
200
  dsh plugin --profile desktop add dsh-chief
186
201
 
187
- # Option 2: Install archived historical GitHub Release tarball (v1.2.1)
188
- dsh plugin --profile desktop add https://github.com/gluztm/dsh-chief/releases/download/v1.2.1/dsh-chief-1.2.1.tgz
189
-
190
- # Option 3: Install directly from GitHub repository
202
+ # Option 2: Install directly from GitHub main branch
191
203
  dsh plugin --profile desktop add github:gluztm/dsh-chief
204
+
205
+ # Option 3: Install prebuilt GitHub Release tarball (v1.4.0)
206
+ dsh plugin --profile desktop add https://github.com/gluztm/dsh-chief/releases/download/v1.4.0/dsh-chief-1.4.0.tgz
192
207
  ```
193
208
 
194
- ### Host Version Compatibility Matrix
209
+ ### Host Version Compatibility
195
210
 
196
- | DeepSeek Harness (DSH) Version | Panel / Board / 3-Tier Vaults / Wishing Box | Named Subagent Tree (`task.dispatch` / `team.*`) | Notes |
211
+ | DeepSeek Harness (DSH) Version | Panel / Board / Vaults / Pre-Execute Walls | Named Subagent Tree (`task.dispatch` / `team.*`) | Notes |
197
212
  | :--- | :---: | :---: | :--- |
198
- | **`>= 0.2.2-rc.2` (`rc.3+` recommended)** | ✅ Full support | ✅ Full support | Native `subagents.resolveName` / `rootOf` / `namesOf` |
199
- | `0.2.0 ~ 0.2.2-rc.1` | ✅ Panel works normally | ⚠️ Upgrade banner | Safely guards `team.*` calls with upgrade guidance |
213
+ | **`>= 0.2.2-rc.5` (current desktop target)** | Full support | Full support | Matches `dsh-tool-fs` (`read`/`read_image`/`write`/`edit`/`apply_patch`), `str_replace_editor`, and native `{ kind: 'ask' }` approval dialogs |
214
+ | `0.2.2-rc.2 ~ 0.2.2-rc.4` | Full support | Full support | Provides native `subagents.resolveName`, `rootOf`, `namesOf`, and `tools/pre-execute` |
215
+ | `0.2.0 ~ 0.2.2-rc.1` | Panel works | Upgrade notice | Blocks unsafe `team.*` dispatch and prompts host upgrade |
200
216
 
201
217
  ---
202
218
 
203
- ## 🛠️ Model Tool Suite (4 Tools)
219
+ ## Tools Registered With the Model
204
220
 
205
- | Tool Name | Purpose | Key Actions |
221
+ | Tool Name | Purpose | Common Actions |
206
222
  | :--- | :--- | :--- |
207
- | **`chief_board`** | Task DAG orchestration, step lists, archive search, inter-agent mail, elevation request, smart compaction | `graph.plan`, `task.add`, `task.update`, `plan.set`, `cursor.set`, `mail.send`, `archive.save`, `archive.search`, `bounds.propose`, `permission.request`, `context.compact` |
208
- | **`chief_memory`** | Session-scoped hot digest items (`decisions`, `progress`, `verify`, `risks`) | `list`, `get`, `add`, `update`, `remove` |
209
- | **`chief_boundaries`** | Global thumbtack redlines (`📌`), must-do checks (`allowed`), and notes | `get`, `set`, `add`, `pin`, `remove` |
210
- | **`chief_handoff`** | Generate self-contained cross-session Markdown handoff packets | `preview` / session relay |
223
+ | **`chief_board`** | Task DAG updates, cold archive queries, peer & chief requests, inquiry replies, wall listing, elevations, compaction | `graph.plan`, `task.add`, `task.update`, `plan.set`, `cursor.set`, `mail.send`, `chief.request`, `inquiry.reply`, `wall.list`, `archive.save`, `archive.search`, `bounds.propose`, `permission.request`, `context.compact` |
224
+ | **`chief_memory`** | Session-scoped hot items (`decisions`, `progress`, `verify`, `risks`) | `list`, `get`, `add`, `update`, `remove` |
225
+ | **`chief_boundaries`** | Global `📌` redlines, must-do checks (`allowed`), and notes | `get`, `set`, `add`, `pin`, `remove` |
226
+ | **`chief_handoff`** | Preview and render self-contained Markdown handoff packets | `preview` / session handoff |
227
+
228
+ ---
229
+
230
+ ## Local Storage & Security Guarantees
231
+
232
+ - **Process & Worker-Thread Lock Safety**: `board-store.js`, `chief-state.js`, `archive-core.js`, and `safety/guard-walls.js` serialize writes with `O_EXCL` spin locks (handling transient Windows NTFS `EPERM`/`EACCES`/`EBUSY` retries) and `threadId`-scoped temporary files before atomic rename.
233
+ - **Isolated Safety Kernel & De-obfuscation**: `pkg/safety/` (9 modules) and `chief-executor.js` are checksum-locked and catch compound shells, inline scripts (`node -e` / `python -c` / `pwsh` / `iex` + Base64), quote-backslash credential obfuscation (zero false positives on `process.env.NODE_ENV` or `node .\env\setup.js`), `bounds.*` / wall human confirmation tokens, and single-use `capabilityScope` checks.
234
+ - **27 Loopback-Guarded HTTP Routes**: All `/api/dsh-chief/*` endpoints validate local origin/host headers and fail closed (`403`) if connection checks throw.
235
+ - **Secret Protection & Zero Telemetry**: Refuses to persist `sk-*`, `ghp_*`, Bearer tokens, `AIza*`, `AKIA*`, or private keys (auto-redacting to `[REDACTED]` when sweeping temporary notes). All boards, archives, guard walls, and `chief-audit.jsonl` stay locally under `~/.dsh/chief/`.
211
236
 
212
237
  ---
213
238
 
214
- ## 🛡️ Security & Local-Only Privacy
239
+ ## Contributors
215
240
 
216
- - **Atomic Exclusive File Locks**: Prevents corruption on `board.json` and 3-tier archive files even under concurrent writes.
217
- - **Zero-Leak 0-Token Vaults**: Sealed dossiers inject **0 bytes** into lead/chief prompts until explicitly pinned to Desk or flipped out.
218
- - **25 Same-Origin Loopback Routes**: Every `/api/dsh-chief/*` endpoint validates loopback origin and host headers.
219
- - **Regex Secret Blocker**: Blocks accidental persistence of `sk-*`, `ghp_*`, Bearer tokens, and OpenSSH private keys; 100% local under `~/.dsh/chief/` with zero telemetry.
241
+ | Contributor | Role |
242
+ | --- | --- |
243
+ | [gluztm](https://github.com/gluztm) | Creator, product design, and maintainer |
244
+ | [Gemini](https://github.com/gemini-code-assist) | Feature development, `pkg/safety/` kernel, pre-execute guard walls, lazy intervention, and CI gates |
245
+ | [Codex](https://github.com/codex) | Modular architecture design, concurrency stress tests, and red-team boundary audits |
246
+ | [deepseek-ai](https://github.com/deepseek-ai) | DeepSeek Harness host runtime and SuperAgent workflow alignment |
220
247
 
221
248
  ---
222
249
 
223
- ## 📄 License
250
+ ## License
224
251
 
225
252
  Licensed under **[GNU Affero General Public License v3.0 (`AGPL-3.0-only`)](LICENSE)**.