dsh-leader-agent 0.5.0 → 0.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/.agents/skills/leader-mode/playbooks/program.md +2 -0
- package/README.md +8 -0
- package/README_ZH.md +8 -0
- package/THIRD_PARTY_LICENSE +84 -0
- package/lib/client.js +833 -71
- package/locale/en.json +1 -1
- package/locale/zh.json +2 -2
- package/package.json +5 -2
- package/src/client/board-foreground.js +40 -0
- package/src/client/board.js +113 -18
- package/src/client/index.js +24 -1
- package/src/client/locales.js +4 -0
- package/src/client/project-board-data.js +36 -1
- package/src/client/session-tabs-logic.js +369 -0
- package/src/client/session-tabs.js +636 -0
- package/src/host/cards/card-list-view.js +65 -10
- package/src/host/dispatch.js +274 -10
- package/src/host/index.js +5 -1
- package/src/host/notification-store.js +19 -0
- package/src/host/tools/cards.js +51 -8
- package/src/host/worker-registry.js +24 -0
- package/src/host/worker-stall.js +207 -0
- package/src/shared/worker-stall.js +66 -0
|
@@ -28,6 +28,8 @@ worker 是常驻根会话,人可以在项目树里打开它直接下钻对话
|
|
|
28
28
|
|
|
29
29
|
worker 的一切交互只有 `spawn_worker`、`message_worker` 与只读的 `read_worker_session` 三个入口。宿主的 `list_agents` / `send_message` / `interrupt_agent` 只认宿主 subagent 体系:我们的 worker 是普通根会话,不在它们的子会话名录里,传话与中止都落不到它身上(这三件已从你的工具面摘掉)。worker 跑偏时用 `message_worker` 把纠偏指令 steer 进当前轮次(正在跑就插进下一步);没有中止手段,真卡死了才请人去那个会话里处理。宿主另有同伴模型的一套同名工具,按成员名寻址,与本流程的 worker 不是同一批,同样不要混用。
|
|
30
30
|
|
|
31
|
+
worker 连续 15 分钟没有任何回报时,机制侧会注入一条带 **`【后台巡查】`** 前缀的例行检查提醒(与完成通知同一条通道,但正文自带前缀与会话 id,不是 worker 的回报;不一定是卡住,也不代表任务失败)。收到后先 `read_worker_session` 回看它最近几轮卡在哪一步,再决定继续等待、用 `message_worker` 纠偏,还是请人在它的会话里处理;不要因为收到提醒就重复追问或重派同一件活。提醒每 15 分钟至多一条,本流程仍没有中止手段。
|
|
32
|
+
|
|
31
33
|
worker 的产物摘要在完成通知里,不需要轮询查询。**要看过程用 `read_worker_session`**:它直读 worker 的会话日志(`sessionId` 必填,`turns` 默认 2、最多 20),给出每轮的任务正文、worker 说过的正文、调过哪些工具与失败原因。只读、不唤醒 worker、不产生模型调用,worker 正在跑也能读(读到的是已落盘部分,最后一轮会标「进行中」)。正文有条目上限与总量上限,读不到全部历史是设计如此。需要 worker 补充解释、或者要它接着动手时,才用 `message_worker`——worker 正在跑时消息在它的下一步注入当前轮次(算纠偏,不是另起一轮),空闲时直接开新回合。
|
|
32
34
|
|
|
33
35
|
## Orchestrate
|
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
4. **Many projects in parallel, one Leader each** — Adding a project binds a leader session to it, and the project tree lists the workers that Leader spawned; rows can be dragged to reorder, and deleting a project only drops the record while keeping the folder and the sessions (dsh workspaces are untouched). Projects stay out of each other's way. Swap in a new Leader and the existing workers plus undelivered reports move over, so it can dispatch immediately.
|
|
34
34
|
5. **The `leader-mode` skill: an orchestration protocol for the Leader** — Not "you are a tech lead". Staged playbooks across discussion → design → implementation and delivery → review → merge, plus guidance on parallel collaboration and handoff.
|
|
35
35
|
6. **Read back what a worker did, without waking it** — `read_worker_session` reads a worker's session log directly and returns each turn's task, body, the tools it called and why anything failed. Read-only: it does not wake the worker and triggers no model call. The completion notice tells you what came out; this tells you how it got there, so debugging does not need another round.
|
|
36
|
+
7. **A worker that goes quiet gets flagged** — When a Leader-dispatched turn produces no report for 15 minutes, a plain-text background patrol notice (prefixed with 【后台巡查】) arrives with the session id, the card it holds, how long it has been silent, its last report and a copy-pasteable read-back call. At most one every 15 minutes: no polling, and no pretending it is still alive.
|
|
36
37
|
|
|
37
38
|
## Install
|
|
38
39
|
|
|
@@ -99,6 +100,7 @@ Three mechanisms make this more than "a smarter prompt":
|
|
|
99
100
|
- **Identity decides the tool surface.** The Leader gets `spawn_worker` / `message_worker`; workers don't. The host trims the tool surface when a session is created — the model is not trusted to hold back.
|
|
100
101
|
- **Completion is settled by the runtime, which wakes the Leader.** When a worker's turn ends, the Leader receives a report (rendered as the worker speaking), with no polling from the Leader and no submit step from the worker.
|
|
101
102
|
- **Workers are persistent root sessions.** Several run at once, you can open any of them and keep the conversation going, and they cold-resume after a restart. The cost: the Leader cannot stop one, see [Current limitations](#current-limitations).
|
|
103
|
+
- **Project sessions get a tab bar.** The project name is the Leader tab; workers you open join it with a live status light. Closing a tab only drops the shortcut — the session stays in the project tree.
|
|
102
104
|
|
|
103
105
|
## Design trade-offs
|
|
104
106
|
|
|
@@ -147,6 +149,7 @@ Running ten features in parallel requires real isolation between tasks: one work
|
|
|
147
149
|
- **The Leader can steer a worker but cannot cancel one.** Workers are ordinary root sessions, so the host's `list_agents` / `send_message` / `interrupt_agent` do not apply to them (`interrupt_agent` even returns a false success). A worker that goes off track is steered with `message_worker`: the message is injected into the next step of its current turn. There is no cancel — the host's `Agent.cancel()` is not exposed as a tool here — so a wedged worker needs a human in its own session. You can read what it is doing (`read_worker_session`, read-only, no wake-up).
|
|
148
150
|
- **Completion reports depend on the turn ending normally.** If the process dies before a worker finishes, that turn is never settled. After a restart, open the worker session and continue there.
|
|
149
151
|
- **The board only shows for project sessions.** The leader and that project's workers see it; an ordinary session in the same directory, or a retired leader, only gets a notice, and sessions outside any project get no board at all.
|
|
152
|
+
- **The session tab bar is a DOM overlay, not a native host feature.** It is inserted above the conversation header; per-project tab state lives in browser localStorage and does not travel with the data root.
|
|
150
153
|
- **Card details only write links and delete the card.** Links can be added, edited and removed; deletion lives in the detail footer, asks for confirmation, and is a hard delete with no undo. Completing, pinning and renaming still belong to the Leader's card tools. Card numbers increase globally and are never reused or reclaimed; models have no card-deletion tool, so a human must click it.
|
|
151
154
|
- **The project registry is only reachable from the left sidebar.** There are no project tools for the model; if the directory picker is unavailable you cannot create a project and need the web profile.
|
|
152
155
|
- **The project tree coexists with the official workspace tree.** Projects neither register nor occupy dsh workspaces: project sessions land in the official tree's "Ungrouped" section and are excluded there at render time (official counts and search still include them); when nothing but excluded rows is left in that section, its header is hidden too.
|
|
@@ -182,6 +185,7 @@ Read [AGENTS.md](AGENTS.md) first: worktree discipline, verification requirement
|
|
|
182
185
|
| [docs/development.md](docs/development.md) | Dev environment, instances, build contract, test policy |
|
|
183
186
|
| [docs/capability-gaps.md](docs/capability-gaps.md) | Measured evidence for host capability boundaries (read before touching host-side code) |
|
|
184
187
|
| [docs/e2e-testing.md](docs/e2e-testing.md) | Browser e2e lane (commands, fixtures, mock conventions, screenshots) and manual evidence rules; assertion discipline and failure diagnosis live in `.agents/skills/e2e-scenarios/` |
|
|
188
|
+
| [growing/](growing/) | Growth archive: case studies, copy, source files; media lives in OSS |
|
|
185
189
|
| [.agents/notes/](.agents/notes/) | Decision memory for non-trivial changes |
|
|
186
190
|
| [.agents/skills/leader-mode/](.agents/skills/leader-mode/) | Protocol layer: dispatch, handoff, event scheduling, card upkeep, acceptance |
|
|
187
191
|
| [.agents/skills/promo-video/](.agents/skills/promo-video/) | Promo pipeline for the repo dev env (needs Playwright + ffmpeg): storyboard, TTS timeline, capture/record, cover production; narration in `doubao-tts/`, covers in `promo-stills/` |
|
|
@@ -190,8 +194,12 @@ Read [AGENTS.md](AGENTS.md) first: worktree discipline, verification requirement
|
|
|
190
194
|
|
|
191
195
|
The design drew on **Cursor's Project implementation** and **PStack's orchestration mechanism**: treating a project as a first-class entity, aggregating sessions and deliverables per project, and the leader-dispatches / executor-reports / delivery-board line.
|
|
192
196
|
|
|
197
|
+
The session tab bar drew on [dsh-session-tabs](https://github.com/QIN-SMART/dsh-session-tabs) (MIT) for main-panel anchoring and per-project tab persistence; see [THIRD_PARTY_LICENSE](THIRD_PARTY_LICENSE) for the full third-party inventory.
|
|
198
|
+
|
|
193
199
|
Thanks also to the **DeepSeek Harness team**: the host plugin contract, and the worktree, Agent Note, progressive-disclosure and documentation practices this repository mirrors directly.
|
|
194
200
|
|
|
195
201
|
## License
|
|
196
202
|
|
|
197
203
|
[MIT](LICENSE)
|
|
204
|
+
|
|
205
|
+
Third-party notices: [THIRD_PARTY_LICENSE](THIRD_PARTY_LICENSE).
|
package/README_ZH.md
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
4. **多项目并行,每个项目一个 Leader** — 左栏加一个项目就绑定一个 leader 会话,项目树列出它派出的 worker;项目行可拖拽排序,删除项目只删记录、保留文件夹与会话(dsh 工作区不受影响)。项目之间各管各的。换 Leader 时原班 worker 与未投递的回报一并改投新会话,新 Leader 直接接着派。
|
|
34
34
|
5. **`leader-mode` skill,给 Leader 的编排 Skill** — 不是一句「你是 tech lead」:按技术讨论 → 设计 → 实现交付 → 审查 → 合入分阶段给 playbook,另有并行协作与交接规范。
|
|
35
35
|
6. **回看 worker 的会话过程,不必唤醒它** — `read_worker_session` 直读 worker 的会话日志,给出每轮的任务、正文、调过哪些工具与失败原因。只读:不唤醒 worker、不产生模型调用。完成通知负责「产物是什么」,它负责「过程是怎样的」,排查不必再开一轮。
|
|
36
|
+
7. **worker 长时间没动静会收到巡查提醒** — Leader 发起的一轮超过 15 分钟没有任何回报时,机制侧注入一条带「【后台巡查】」前缀的普通文本提醒:挂着的卡、已连续多久、最后回报在哪、可照抄的回看调用。每 15 分钟至多一条,不轮询、不假装还活着。
|
|
36
37
|
|
|
37
38
|
## 安装
|
|
38
39
|
|
|
@@ -99,6 +100,7 @@ profile 名必须用 `web`;自定义名不在 `PROFILE_TEMPLATES` 里,装出
|
|
|
99
100
|
- **身份决定工具面**:Leader 拿得到 `spawn_worker` / `message_worker`,worker 拿不到;工具面在会话创建时由宿主裁剪,不是靠提示词约束模型。
|
|
100
101
|
- **完成由机制结算并自动唤醒**:worker 那一轮结束时,Leader 自动收到一条回报(渲染成 worker 的发言气泡),不轮询、不靠 worker 自觉。
|
|
101
102
|
- **worker 是常驻根会话**:能同时跑多个,人可以直接打开它的会话接着聊,进程重启后能冷恢复。代价是 Leader 侧不能强杀它,见[当前限制](#当前限制)。
|
|
103
|
+
- **项目会话有标签栏**:第一个标签是项目名(Leader 入口),点开的 worker 带着状态灯加入;关标签只丢快捷方式,会话仍在项目树里。
|
|
102
104
|
|
|
103
105
|
## 设计取舍
|
|
104
106
|
|
|
@@ -147,6 +149,7 @@ profile 名必须用 `web`;自定义名不在 `PROFILE_TEMPLATES` 里,装出
|
|
|
147
149
|
- **Leader 能纠偏、但不能中止 worker**:worker 是普通根会话,宿主的 `list_agents` / `send_message` / `interrupt_agent` 对它无效(`interrupt_agent` 会返回假成功)。跑偏了用 `message_worker` 把纠偏指令 steer 进它当前轮次(正在跑就插下一步);没有中止手段——宿主的 `Agent.cancel()` 没被接成工具,真卡死只能请人去那个会话处理。能读它的会话过程(`read_worker_session`,只读、不唤醒)。
|
|
148
150
|
- **完成回报依赖轮次正常结束**:进程在 worker 跑完前被杀,那一轮不结算;重启后自己打开 worker 会话看或续聊。
|
|
149
151
|
- **看板只对项目会话展示**:leader 与该项目的 worker 能看到;同目录的普通会话与已换下的 leader 只看到提示,不属于任何项目的会话也没有看板。
|
|
152
|
+
- **会话标签栏是 DOM 注入,不是宿主原生能力**:它插在会话头之上,标签状态按项目存在浏览器 localStorage,不随数据根迁移。
|
|
150
153
|
- **卡片详情的人工写操作只有链接与删除**:链接可在详情里增删改;删除在详情页脚,二次确认后硬删、不可撤销,编号不复用,槽位绑定一并解除;完成、置顶、重命名仍归 leader 的卡片工具。模型没有删除卡片的工具,删除只能由人点出来。
|
|
151
154
|
- **项目注册表只经左栏区块操作**:模型没有项目工具;目录选择器不可用时无法建项目,需换 web profile。
|
|
152
155
|
- **项目树与官方工作区树并存**:项目不注册也不占用 dsh 工作区,项目会话落进官方树的「未分组」,在那里被渲染层排除(官方计数与搜索仍包含它们);组里只剩被排除的行时「未分组」组头一起藏起来。
|
|
@@ -182,6 +185,7 @@ npm run e2e # 浏览器 e2e
|
|
|
182
185
|
| [docs/development.md](docs/development.md) | 开发环境、实例、构建契约与测试口径 |
|
|
183
186
|
| [docs/capability-gaps.md](docs/capability-gaps.md) | 宿主能力边界的实测依据(改宿主侧前先读) |
|
|
184
187
|
| [docs/e2e-testing.md](docs/e2e-testing.md) | 浏览器 e2e 车道(命令、夹具、mock 约定、截图)与人工取证规范;断言纪律与失败诊断见 `.agents/skills/e2e-scenarios/` |
|
|
188
|
+
| [growing/](growing/) | 增长资产索引:案例、文案、源文件;媒体在 OSS |
|
|
185
189
|
| [.agents/notes/](.agents/notes/) | 非平凡改动的决策记忆 |
|
|
186
190
|
| [.agents/skills/leader-mode/](.agents/skills/leader-mode/) | 协议层:派工、接力、事件调度、卡片维护、验收裁决 |
|
|
187
191
|
| [.agents/skills/promo-video/](.agents/skills/promo-video/) | 宣传片流水线(需本仓开发环境:Playwright + ffmpeg):分镜、旁白时间轴、录制与封面制作;旁白见 `doubao-tts/`,封面见 `promo-stills/` |
|
|
@@ -190,8 +194,12 @@ npm run e2e # 浏览器 e2e
|
|
|
190
194
|
|
|
191
195
|
本方案在设计时参考过 **Cursor 的 Project 实现**与 **PStack 的编排机制**:把项目当成一等实体、按项目聚合会话与交付物,以及「leader 派工 / 执行者回报 / 交付看板」这条主线。
|
|
192
196
|
|
|
197
|
+
会话标签栏参考了 [dsh-session-tabs](https://github.com/QIN-SMART/dsh-session-tabs)(MIT)的主面板定位与标签持久化实现;完整第三方清单见 [THIRD_PARTY_LICENSE](THIRD_PARTY_LICENSE)。
|
|
198
|
+
|
|
193
199
|
也感谢 **DeepSeek Harness 团队**:宿主的插件契约,以及 worktree 并发、Agent Note、AGENTS.md 渐进式披露、文档防腐化这套工程实践,是本仓直接对照的来源。
|
|
194
200
|
|
|
195
201
|
## 许可证
|
|
196
202
|
|
|
197
203
|
[MIT](LICENSE)
|
|
204
|
+
|
|
205
|
+
第三方许可:[THIRD_PARTY_LICENSE](THIRD_PARTY_LICENSE)。
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# THIRD_PARTY_LICENSE
|
|
2
|
+
|
|
3
|
+
本文件由 `node scripts/third-party-license.mjs` 生成,请勿手改。
|
|
4
|
+
重新生成:`npm run licenses`;校验:`npm run licenses:check`(已并入 `npm run check`)。
|
|
5
|
+
|
|
6
|
+
本包(dsh-leader-agent)自身以 MIT 许可发布,见 `LICENSE`。下面只列第三方代码与参考实现。
|
|
7
|
+
|
|
8
|
+
## 随客户端产物分发的第三方代码
|
|
9
|
+
|
|
10
|
+
### minidenticons 4.2.1(MIT)
|
|
11
|
+
|
|
12
|
+
- 来源:https://github.com/laurentpayot/minidenticons
|
|
13
|
+
- 版权:Copyright (c) 2021 Laurent Payot
|
|
14
|
+
- 用途:worker / leader 头像的确定性像素图案。实现由 esbuild 内联进 lib/client.js;产物头部另有同份 MIT 声明。
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
MIT License
|
|
18
|
+
|
|
19
|
+
Copyright (c) 2021 Laurent Payot
|
|
20
|
+
|
|
21
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
22
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
23
|
+
in the Software without restriction, including without limitation the rights
|
|
24
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
25
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
26
|
+
furnished to do so, subject to the following conditions:
|
|
27
|
+
|
|
28
|
+
The above copyright notice and this permission notice shall be included in all
|
|
29
|
+
copies or substantial portions of the Software.
|
|
30
|
+
|
|
31
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
33
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
34
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
35
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
36
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
|
+
SOFTWARE.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 随包安装的运行时依赖
|
|
41
|
+
|
|
42
|
+
无。运行时只依赖宿主提供的基线模块(React、React DOM、`@deepseek-ai/dsh-client-ui-primitives`),它们由宿主模块表提供,不随本包分发。
|
|
43
|
+
|
|
44
|
+
## 参考实现(未随包分发)
|
|
45
|
+
|
|
46
|
+
### dsh-session-tabs 0.1.6(MIT)
|
|
47
|
+
|
|
48
|
+
- 来源:https://github.com/QIN-SMART/dsh-session-tabs
|
|
49
|
+
- 版权:Copyright (c) 2026 QIN-SMART
|
|
50
|
+
- 参考位置:`src/client/session-tabs.js`
|
|
51
|
+
- 参考内容:主面板槽位(`data-slot="main"`)定位与父列选择、`retainedBy.mainView` 判定当前会话、主面板与会话体的 flex 收缩标记,以及按项目持久化标签的部分实现。上游产物不随本包分发,许可全文见下。
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
MIT License
|
|
55
|
+
|
|
56
|
+
Copyright (c) 2026 QIN-SMART
|
|
57
|
+
|
|
58
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
59
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
60
|
+
in the Software without restriction, including without limitation the rights
|
|
61
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
62
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
63
|
+
furnished to do so, subject to the following conditions:
|
|
64
|
+
|
|
65
|
+
The above copyright notice and this permission notice shall be included in all
|
|
66
|
+
copies or substantial portions of the Software.
|
|
67
|
+
|
|
68
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
69
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
70
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
71
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
72
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
73
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
74
|
+
SOFTWARE.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 构建与测试工具(不随包分发)
|
|
78
|
+
|
|
79
|
+
| 包 | 版本 | 许可 | 来源 |
|
|
80
|
+
| --- | --- | --- | --- |
|
|
81
|
+
| esbuild | 0.28.2 | MIT | https://github.com/evanw/esbuild |
|
|
82
|
+
| playwright | 1.64.1 | Apache-2.0 | https://github.com/microsoft/playwright |
|
|
83
|
+
|
|
84
|
+
这些工具只在开发、构建或测试时使用,不进入 npm 包或客户端产物;完整许可文本在各自安装目录的 `LICENSE` 文件里。
|