dsh-leader-agent 0.5.0 → 0.7.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.
Files changed (68) hide show
  1. package/.agents/skills/e2e-scenarios/SKILL.md +3 -1
  2. package/.agents/skills/leader-mode/SKILL.md +1 -1
  3. package/.agents/skills/leader-mode/playbooks/program.md +3 -1
  4. package/.agents/skills/leader-mode/references/parallel.md +1 -1
  5. package/README.md +13 -5
  6. package/README_ZH.md +13 -5
  7. package/THIRD_PARTY_LICENSE +84 -0
  8. package/lib/client.js +2974 -601
  9. package/locale/de.json +134 -0
  10. package/locale/en.json +129 -1
  11. package/locale/es.json +134 -0
  12. package/locale/fr.json +134 -0
  13. package/locale/ja.json +134 -0
  14. package/locale/pt.json +134 -0
  15. package/locale/ru.json +134 -0
  16. package/locale/zh.json +130 -2
  17. package/package.json +20 -4
  18. package/src/client/agent-bubble-styles.js +31 -1
  19. package/src/client/agent-bubble-view.js +42 -17
  20. package/src/client/board-card.js +18 -16
  21. package/src/client/board-foreground.js +40 -0
  22. package/src/client/board-projection.js +6 -2
  23. package/src/client/board-styles.js +11 -41
  24. package/src/client/board.js +142 -39
  25. package/src/client/bubble-clock.js +10 -6
  26. package/src/client/card-detail-view.js +8 -11
  27. package/src/client/card-detail.js +12 -11
  28. package/src/client/card-links-editor.js +27 -15
  29. package/src/client/index.js +83 -9
  30. package/src/client/leader-changes-anchor.js +51 -0
  31. package/src/client/leader-changes.js +150 -0
  32. package/src/client/leader-view-logic.js +2 -1
  33. package/src/client/leader-view.js +1 -1
  34. package/src/client/locales.generated.js +1028 -0
  35. package/src/client/locales.js +27 -31
  36. package/src/client/main-panel.js +73 -0
  37. package/src/client/markdown.js +34 -11
  38. package/src/client/project-board-data.js +36 -1
  39. package/src/client/project-changes.js +2 -1
  40. package/src/client/project-panel-logic.js +24 -17
  41. package/src/client/project-panel.js +47 -45
  42. package/src/client/project-remote.js +56 -29
  43. package/src/client/project-section.js +25 -18
  44. package/src/client/ready-signal.js +1 -1
  45. package/src/client/session-tabs-logic.js +383 -0
  46. package/src/client/session-tabs.js +722 -0
  47. package/src/client/session-watermark.js +10 -6
  48. package/src/client/signal-styles.js +56 -0
  49. package/src/client/toast-view.js +1 -0
  50. package/src/client/worker-report-avatar.js +243 -51
  51. package/src/client/worker-report-view.js +4 -2
  52. package/src/client/worker-task-view.js +8 -7
  53. package/src/host/cards/card-context.js +1 -1
  54. package/src/host/cards/card-list-view.js +65 -10
  55. package/src/host/cards/store.js +24 -5
  56. package/src/host/dispatch.js +386 -27
  57. package/src/host/index.js +22 -5
  58. package/src/host/notification-store.js +19 -0
  59. package/src/host/projects/remote.js +4 -1
  60. package/src/host/projects/store.js +1 -2
  61. package/src/host/skills.js +1 -1
  62. package/src/host/tools/cards.js +105 -17
  63. package/src/host/tools/gate.js +17 -12
  64. package/src/host/tools/spawn-worker.js +1 -1
  65. package/src/host/worker-registry.js +73 -2
  66. package/src/host/worker-stall.js +207 -0
  67. package/src/shared/card-links.js +6 -6
  68. package/src/shared/worker-stall.js +66 -0
@@ -33,7 +33,9 @@ e2e 的判据是「真实宿主 + 真实 chromium 里,可观察行为是否成
33
33
 
34
34
  ## 失败诊断
35
35
 
36
- 1. **先看耗时**:单场景正常 3–8 秒(全量约 10 秒)。跑了一分钟还没结束,先怀疑某个等待在等不会出现的元素(典型:`lib/client.js` 没构建、会话行没渲染),不是机器慢。别用 `grep` / `head` 过滤输出,`TimeoutError` 里的 locator 就是线索。报错头是「等待失败:…」而不是「等待超时」时,先看页面或浏览器是不是已经关掉、崩了——那不是选择器的问题。测试级上限 90 秒(`scenarioTimeout()`,随 `E2E_BUDGET_SCALE` 放大);清理链上实例与 mock 卡住会变成带名字的失败,浏览器关闭超时只告警并继续。
36
+ 操作面(单场景入口、`e2e:report`、负载卫生、已知 flake、超时口径与取证路径)见 [docs/e2e-testing.md 的跑法与失败处理](https://github.com/fengshenx/dsh-leader-agent/blob/main/docs/e2e-testing.md#跑法与失败处理);本节只讲判据,不重复命令。
37
+
38
+ 1. **先看耗时**:单场景约 10–15 秒,全量按场景数累加。跑了一分钟还没结束,先怀疑某个等待在等不会出现的元素(典型:`lib/client.js` 没构建、会话行没渲染),不是机器慢。别用 `grep` / `head` 过滤输出,`TimeoutError` 里的 locator 就是线索。报错头是「等待失败:…」而不是「等待超时」时,先看页面或浏览器是不是已经关掉、崩了——那不是选择器的问题。测试级上限 90 秒(`scenarioTimeout()`,随 `E2E_BUDGET_SCALE` 放大);清理链上实例与 mock 卡住会变成带名字的失败,浏览器关闭超时只告警并继续。
37
39
  2. 先看 `problems`(pageerror / console.error)。本仓出过「圆点不亮」查不出原因的情况,根因是三处空 `catch`:保留会话失败、订阅就绪失败,全都吞掉,界面上只剩一个空心圈。失败必须报告,且同一目标只报一次。
38
40
  3. **构建过了也可能坏**:改过 `src/client/` 里的 CSS 就先跑 `plugin.e2e.js` 冒烟。`STYLE_TEXT` 这类模板字符串里混进反引号会当场截断模板,剩余正文被当成 JS 表达式,产物里留下未定义标识符——插件在 import 期抛错、整页白屏,症状与「没构建」一模一样(每个等待都超时),而 `node --check`、单测与覆盖率门禁全绿,它们都不做模块求值。冒烟只验「插件能不能挂载」,3–6 秒,红了不必等全套跑完;`problems` 里的原文形如 `dsh-leader-agent: import failed: <标识符> is not defined`。
39
41
  4. 看 `instance.logs`(子进程 stdout/stderr 全量)与 `mock.requests`:模型请求到底有没有发出来、打到哪个端点、带没带标记。
@@ -83,7 +83,7 @@ worker 的工作目录强制是项目目录:leader 不能指定 worker 的 cwd
83
83
 
84
84
  ## 派工与接收
85
85
 
86
- 派工用 `spawn_worker`:它建一个常驻 worker 会话并立即返回会话 id,worker 那一轮结束时自动唤醒你并附完成通知与产物摘要(它不需要、也没有「报告完成」这类工具),同一轮可连派多个工。worker 是普通会话——人能在项目树里打开它直接聊,那种轮次不经过你,也不会唤醒你。**worker 的入口只有三个**:`spawn_worker`(派工)、`message_worker`(续聊与改名:`sessionId` + `message` 必填,可选 `rename`)、`read_worker_session`(回看它的会话回合:任务、正文、调过哪些工具、哪一步失败与原因;只读、不唤醒 worker——排查「为什么慢/为什么错」先用它,不要为此让 worker 再跑一轮)。宿主的 `list_agents` / `send_message` / `interrupt_agent` 认的是宿主 subagent 体系,看不到也投不到我们的 worker(这三件已从你的工具面摘掉)。worker 跑偏时用 `message_worker` 把纠偏指令 steer 进它当前轮次(正在跑就插进下一步,不是另起一轮);没有中止手段,真卡死才请人去那个会话里处理。卡片用 `create_card`、`update_card`、`list_cards`,建卡与改卡可带 `kind` 给卡面分类(同一项目用同一套短标签,空串清除),改卡带 `expectedRevision` 做乐观并发——这个版本号从 `list_cards` 的列表里读(每行都带 `revision`),要读某张卡的规格与链接全文就传 `cardId` 单卡查询。完整对应见 [leader 动作与工具](playbooks/program.md#leader-动作与工具)。
86
+ 派工用 `spawn_worker`:它建一个常驻 worker 会话并立即返回会话 id,worker 那一轮结束时自动唤醒你并附完成通知与产物摘要(它不需要、也没有「报告完成」这类工具),同一轮可连派多个工。worker 是普通会话——人能在项目树里打开它直接聊,那种轮次不经过你,也不会唤醒你。**worker 的入口只有三个**:`spawn_worker`(派工)、`message_worker`(续聊与改名:`sessionId` + `message` 必填,可选 `rename`)、`read_worker_session`(回看它的会话回合:任务、正文、调过哪些工具、哪一步失败与原因;只读、不唤醒 worker——排查「为什么慢/为什么错」先用它,不要为此让 worker 再跑一轮)。宿主的 `list_agents` / `send_message` / `interrupt_agent` / `wait_agent` 认的是宿主 subagent 体系,看不到也投不到我们的 worker(这四件已从你的工具面摘掉;`wait_agent` 只会阻塞空等,worker 跑完会自己唤醒你)。worker 跑偏时用 `message_worker` 把纠偏指令 steer 进它当前轮次(正在跑就插进下一步,不是另起一轮);没有中止手段,真卡死才请人去那个会话里处理。卡片用 `create_card`、`update_card`、`list_cards`,建卡与改卡可带 `kind` 给卡面分类(同一项目用同一套短标签,空串清除),改卡带 `expectedRevision` 做乐观并发——这个版本号从 `list_cards` 的列表里读(每行都带 `revision`),要读某张卡的规格与链接全文就传 `cardId` 单卡查询。完整对应见 [leader 动作与工具](playbooks/program.md#leader-动作与工具)。
87
87
 
88
88
  派工确保原简报、后续指令、实际产物与版本均可沿指针完整恢复,不依赖「done」摘要继承变更。按 [leader 传话纪律](playbooks/program.md#输出与传话纪律)保留边界与验收,已落盘正文不抄入派单。按宿主与任务权限使用 worker;现有 owner 与 worktree 状态能可信恢复时续跑,新上下文更合适时新派,不能丢原约束。停止/恢复遵守用户指令与宿主契约;能力不可用明确 limitation,不声称多模型独立评估。
89
89
 
@@ -26,7 +26,9 @@
26
26
 
27
27
  worker 是常驻根会话,人可以在项目树里打开它直接下钻对话。**人自己聊的那几轮你要当没发生**:它不会唤醒你,也不会给你完成通知;除非用户回来让你接着推进,否则不要凭猜测去追问它在聊什么。
28
28
 
29
- worker 的一切交互只有 `spawn_worker`、`message_worker` 与只读的 `read_worker_session` 三个入口。宿主的 `list_agents` / `send_message` / `interrupt_agent` 只认宿主 subagent 体系:我们的 worker 是普通根会话,不在它们的子会话名录里,传话与中止都落不到它身上(这三件已从你的工具面摘掉)。worker 跑偏时用 `message_worker` 把纠偏指令 steer 进当前轮次(正在跑就插进下一步);没有中止手段,真卡死了才请人去那个会话里处理。宿主另有同伴模型的一套同名工具,按成员名寻址,与本流程的 worker 不是同一批,同样不要混用。
29
+ worker 的一切交互只有 `spawn_worker`、`message_worker` 与只读的 `read_worker_session` 三个入口。宿主的 `list_agents` / `send_message` / `interrupt_agent` / `wait_agent` 只认宿主 subagent 体系:我们的 worker 是普通根会话,不在它们的子会话名录里,传话、中止与等待都落不到它身上(这四件已从你的工具面摘掉)。worker 跑偏时用 `message_worker` 把纠偏指令 steer 进当前轮次(正在跑就插进下一步);没有中止手段,真卡死了才请人去那个会话里处理。宿主另有同伴模型的一套同名工具,按成员名寻址,与本流程的 worker 不是同一批,同样不要混用。
30
+
31
+ worker 连续 15 分钟没有任何回报时,机制侧会注入一条带 **`【后台巡查】`** 前缀的例行检查提醒(与完成通知同一条通道,但正文自带前缀与会话 id,不是 worker 的回报;不一定是卡住,也不代表任务失败)。收到后先 `read_worker_session` 回看它最近几轮卡在哪一步,再决定继续等待、用 `message_worker` 纠偏,还是请人在它的会话里处理;不要因为收到提醒就重复追问或重派同一件活。提醒每 15 分钟至多一条,本流程仍没有中止手段。
30
32
 
31
33
  worker 的产物摘要在完成通知里,不需要轮询查询。**要看过程用 `read_worker_session`**:它直读 worker 的会话日志(`sessionId` 必填,`turns` 默认 2、最多 20),给出每轮的任务正文、worker 说过的正文、调过哪些工具与失败原因。只读、不唤醒 worker、不产生模型调用,worker 正在跑也能读(读到的是已落盘部分,最后一轮会标「进行中」)。正文有条目上限与总量上限,读不到全部历史是设计如此。需要 worker 补充解释、或者要它接着动手时,才用 `message_worker`——worker 正在跑时消息在它的下一步注入当前轮次(算纠偏,不是另起一轮),空闲时直接开新回合。
32
34
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  用当前宿主提供的卡片工具和 `git worktree list` 核对任务指针;开发 worktree 以 git 名录与项目约定的 worktree 目录为准,不维护盘上注册表。执行者活性以宿主为准,PR/CI 以代码托管平台为准。名录不是任务内容或完成证明。
8
8
 
9
- 用户授权协调既有执行者后才投递消息。派工、回派与暂停都走本 bundle 的 `message_worker`(`sessionId` + `message`),不用别的消息工具猜会话 id——宿主的 `list_agents` / `send_message` / `interrupt_agent` 只认宿主 subagent 体系,本 bundle 的 worker 是普通会话,它们看不到、也投不到。
9
+ 用户授权协调既有执行者后才投递消息。派工、回派与暂停都走本 bundle 的 `message_worker`(`sessionId` + `message`),不用别的消息工具猜会话 id——宿主的 `list_agents` / `send_message` / `interrupt_agent` / `wait_agent` 只认宿主 subagent 体系,本 bundle 的 worker 是普通会话,它们看不到、也投不到。
10
10
 
11
11
  派活绑定卡槽位,不按「谁空闲」:投递前用查卡工具确认任务挂在哪张卡、槽位上是谁,只派给那张卡的槽位执行者——空闲不等于可派,一会话一时只服务一张卡的一个槽位。**挂着未完成卡的 worker 不能接别的工作**(投递门禁只放行同卡续跑):先把它手上的卡标 `done` 或归档,槽位会自动释放,worker 才能接新任务。**同时挂多张 `active` 卡**(整卡替换 `slots` 时会造出来)一律拒绝投递,与声明哪张卡无关——先关掉多余的卡收敛到一张。`idle` 不等于有人可派:卡槽位与看板信号都看不出「被用户停止」,停用会话状态即 idle。不做事前判断,**投递即探测**:`message_worker` 失败后按错误信息判——报「没有派工记录」说明该会话已撤销(归档会摘掉登记),视作死槽,用 `update_card` 把该槽位改派给新会话;其余错误是普通失败,照常上报,不动槽位。
12
12
 
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  <p align="center">
2
2
  <picture>
3
3
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/main/docs/assets/readme/logo-en-dark.svg">
4
- <img src="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/main/docs/assets/readme/logo-en.svg" alt="dsh-leader-agent: a Leader fanning out to several workers, with a project board on the right" width="560">
4
+ <img src="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/main/docs/assets/readme/logo-en.svg" alt="dsh-leader-agent: a Leader keystone fanning out into parallel worker tracks" width="460">
5
5
  </picture>
6
6
  </p>
7
7
 
8
8
  <p align="center">
9
- <strong>English</strong> | <a href="README_ZH.md">简体中文</a>
9
+ <strong>English</strong> | <a href="README_ZH.md">简体中文</a> | <a href="https://fengshenx.github.io/dsh-leader-agent/">Website</a>
10
10
  </p>
11
11
 
12
12
  <p align="center">
@@ -33,12 +33,13 @@
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
 
39
40
  ### Desktop install (DeepSeek Harness Desktop)
40
41
 
41
- Desktop uses its own profile (`$DSH_HOME/profiles/desktop`), separate from `web`.
42
+ Desktop uses its own profile (`$DSH_HOME/profiles/desktop`), separate from `web`. The **delivery board is a web-profile feature**; the desktop profile loads the plugin without it.
42
43
 
43
44
  **GUI install:** open **Plugins** in the left sidebar, click **Add plugin** in the top right, type `dsh-leader-agent` and click **Install**:
44
45
 
@@ -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. The bar's right end carries the session **More** menu and the right-panel toggle, so the close control stays put. Closing a tab only drops the shortcut — the session stays in the project tree.
102
104
 
103
105
  ## Design trade-offs
104
106
 
@@ -114,7 +116,7 @@ Three mechanisms make this more than "a smarter prompt":
114
116
  1. **Add a project.** In the left sidebar's Projects section, click Add project and pick a directory. The project is created immediately and bound to a leader session; clicking the project row opens that Leader. Selection comes in two layers: the whole row only lights up for the current Leader session, while opening a worker lights the row-start glyph and puts the row highlight on that worker's own session row. The slot at the row start shows the host's `apps-add-outline` glyph by default (three cells plus a plus sign; it replaces the host's folder icon so projects and workspaces are not the same shape in the sidebar): while the Leader is running it becomes a spinner (the Leader has no row of its own, so this holds whether the project is expanded or collapsed), and when the project is collapsed with a worker running under it, it becomes a spinner too — once expanded, each worker carries its own spinner.
115
117
  2. **Load the protocol.** In the leader session, have the model load `leader-mode`. It reads `playbooks/program.md` first, then the playbook for the current stage.
116
118
  3. **Dispatch.** `spawn_worker` requires `name` (a short role-task handle); `cardId` + `slot` optionally bind the card's executor slot in the same call. It returns a session id immediately and the worker has **not started yet**. Deliver the task body with `message_worker` (`sessionId` + `message`, optionally `rename`): the first message is what starts the turn, and a card-bound worker gets the card facts added to its request automatically, so you do not need to paste the spec. The worker's sandbox mode and approval policy are inherited from the Leader at dispatch time (an Auto Leader also passes on its review gate); the receipt states the permissions the worker actually runs with, and calls out full access by name. To see how it went about this turn — which tools it called, where it failed — use `read_worker_session` on it; that does not wake the worker.
117
- 4. **Record task facts.** `create_card` opens a card (`title` required), `update_card` edits one (content changes carry `expectedRevision` for optimistic concurrency; links can be replaced wholesale with `links` or merged by id with `addLinks`), `list_cards` reads them. Cards belong to a project and are numbered globally; edits across projects are refused. `list_cards` and `create_card` are the Leader's alone, and plain sessions get neither; `update_card` is shared with workers. A worker may only edit a card it is bound to, and only derived fields such as `links` — `title` / `spec` / `status` / `kind` / `sortOrder` / `slots` belong to the Leader (the first two are the acceptance anchor and injected content, the rest organize the board and decide who executes). `read_card` is the worker's alone: it reads any card in the project, and with no `cardId` / `number` it reads the worker's single bound card — the way back to its task after compaction or a stale injection. Long specs come in 2000-character pages via `specOffset`.
119
+ 4. **Record task facts.** `create_card` opens a card (`title` required), `update_card` edits one (content changes carry `expectedRevision` for optimistic concurrency; links can be replaced wholesale with `links` or merged by id with `addLinks`), `list_cards` reads them. Links are deliverable entry points — PRs, issues, docs, assets — not comment or inline-comment anchors (`#issuecomment-` / `#discussion_r` / `#pullrequestreview-`). Comments are process evidence; write them in the report body. Cards belong to a project and are numbered globally; edits across projects are refused. `list_cards` and `create_card` are the Leader's alone, and plain sessions get neither; `update_card` is shared with workers. A worker may only edit a card it is bound to, and only derived fields such as `links` — `title` / `spec` / `status` / `kind` / `sortOrder` / `slots` belong to the Leader (the first two are the acceptance anchor and injected content, the rest organize the board and decide who executes). `read_card` is the worker's alone: it reads any card in the project, and with no `cardId` / `number` it reads the worker's single bound card — the way back to its task after compaction or a stale injection. Long specs come in 2000-character pages via `specOffset`.
118
120
  5. **Watch the board.** The Board tab in the right panel pulls cards for the project of the current session. It opens by itself when the leader creates a card; click a card for details (links editable, the card deletable, the rest read-only), click a slot chip to open the executor's session.
119
121
 
120
122
  ## Orchestration lives in files
@@ -144,9 +146,10 @@ Running ten features in parallel requires real isolation between tasks: one work
144
146
  ## Current limitations
145
147
 
146
148
  - **Background orchestration needs a long-lived host** (web / desktop / sdk). headless is a one-shot CLI: the session is destroyed when the turn ends, and nothing is left to receive completion reports.
147
- - **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).
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` / `wait_agent` do not apply to them (`interrupt_agent` even returns a false success; `wait_agent` only blocks). 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
@@ -1,12 +1,12 @@
1
1
  <p align="center">
2
2
  <picture>
3
3
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/main/docs/assets/readme/logo-zh-dark.svg">
4
- <img src="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/main/docs/assets/readme/logo-zh.svg" alt="dsh-leader-agent:Leader 扇出到多个 worker,右侧是项目看板" width="560">
4
+ <img src="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/main/docs/assets/readme/logo-zh.svg" alt="dsh-leader-agent:Leader 节点扇出三条并行执行轨" width="460">
5
5
  </picture>
6
6
  </p>
7
7
 
8
8
  <p align="center">
9
- <a href="README.md">English</a> | <strong>简体中文</strong>
9
+ <a href="README.md">English</a> | <strong>简体中文</strong> | <a href="https://fengshenx.github.io/dsh-leader-agent/">官网</a>
10
10
  </p>
11
11
 
12
12
  <p align="center">
@@ -33,12 +33,13 @@
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
 
39
40
  ### 桌面版安装(DeepSeek Harness Desktop)
40
41
 
41
- 桌面版用独立 profile(`$DSH_HOME/profiles/desktop`),与上面的 `web` 互不相通。
42
+ 桌面版用独立 profile(`$DSH_HOME/profiles/desktop`),与上面的 `web` 互不相通。**交付看板是 `web` profile 的功能**,桌面版装的是插件本体,没有看板。
42
43
 
43
44
  **图形界面安装**:左侧 SidePanel 打开「插件」,点右上角「添加插件」,在包名框填 `dsh-leader-agent` 后点「安装」:
44
45
 
@@ -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
 
@@ -114,7 +116,7 @@ profile 名必须用 `web`;自定义名不在 `PROFILE_TEMPLATES` 里,装出
114
116
  1. **加项目**:左栏「项目」区块点「加项目」,选一个目录。项目当场建好并绑定一个 leader 会话;点项目行就是打开这个 Leader。当前会话属于该项目时左栏按两层回执:打开的是 leader 会话则项目行整行亮,打开的是它派出的 worker 则项目行只点亮行首应用格子、选中态落在那个 worker 自己的会话行上。行首槽位平时是应用格子图标(宿主 `apps-add-outline`:三格 + 一个加号;替掉宿主的目录图标,免得侧边栏里「项目」和「工作区」同形),活动提示看 leader:它在跑就换成加载圈(leader 没有自己的行,项目展开着也照换),项目收起时名下有 worker 在跑也换成加载圈,展开后 worker 由会话行自己带加载圈。
115
117
  2. **加载协议**:leader 会话里让模型加载 `leader-mode`,先读 `playbooks/program.md`,再按阶段读对应 playbook。
116
118
  3. **派工**:`spawn_worker` 只要求 `name`(角色-任务短名),可带 `cardId` + `slot` 一次把卡槽位绑好;工具立即返回会话 id,此时 worker **还没开工**。用 `message_worker` 投递任务正文(`sessionId` + `message`,可顺手 `rename`),第一条消息才开工;挂卡 worker 的请求会自动带上卡片事实,消息里不必抄 spec。worker 的沙箱模式与审批策略在派工那一刻从 leader 继承(leader 是 Auto 时连审查门一起继承),回执里写明它实际以什么权限在跑,完全权限会被点名。要看它这一轮怎么做的(调了哪些工具、哪步失败),用 `read_worker_session` 回看,不必唤醒它。
117
- 4. **记任务事实**:`create_card` 建卡(`title` 必填),`update_card` 改卡(改内容带 `expectedRevision` 做乐观并发;链接可用 `links` 整体替换,或用 `addLinks` 按 id 增量追加),`list_cards` 查卡。卡片按项目归属、编号全局递增,跨项目改卡会被拒绝。`list_cards` 与 `create_card` 只给 leader,普通会话一件也没有;`update_card` leader 与 worker 都有。worker 只能改自己挂着的卡,且只能挂 `links` 这类派生字段:`title` / `spec` / `status` / `kind` / `sortOrder` / `slots` 都归 leader(前两者是验收锚点与注入内容,其余组织看板并决定谁在执行)。`read_card` 只给 worker:读本项目的任意卡,不传 `cardId` / `number` 时读自己唯一绑定的卡——压缩或注入失效后找回任务的入口;长规格按 2000 字符分页,用 `specOffset` 续读。
119
+ 4. **记任务事实**:`create_card` 建卡(`title` 必填),`update_card` 改卡(改内容带 `expectedRevision` 做乐观并发;链接可用 `links` 整体替换,或用 `addLinks` 按 id 增量追加),`list_cards` 查卡。链接只挂 PR / Issue / 文档 / 成片这类交付物入口,不挂评论或行内评论的锚点(`#issuecomment-` / `#discussion_r` / `#pullrequestreview-`);评论是过程证据,写进回报正文。卡片按项目归属、编号全局递增,跨项目改卡会被拒绝。`list_cards` 与 `create_card` 只给 leader,普通会话一件也没有;`update_card` leader 与 worker 都有。worker 只能改自己挂着的卡,且只能挂 `links` 这类派生字段:`title` / `spec` / `status` / `kind` / `sortOrder` / `slots` 都归 leader(前两者是验收锚点与注入内容,其余组织看板并决定谁在执行)。`read_card` 只给 worker:读本项目的任意卡,不传 `cardId` / `number` 时读自己唯一绑定的卡——压缩或注入失效后找回任务的入口;长规格按 2000 字符分页,用 `specOffset` 续读。
118
120
  5. **看看板**:右栏「看板」Tab,按当前会话所属项目拉卡片。leader 建卡后自动打开;点卡面看详情(链接可编辑、可删卡,其余只读),点槽位 chip 打开执行者会话。
119
121
 
120
122
  ## 编排:把规则写进文件
@@ -144,9 +146,10 @@ profile 名必须用 `web`;自定义名不在 `PROFILE_TEMPLATES` 里,装出
144
146
  ## 当前限制
145
147
 
146
148
  - **后台编排只适用于长驻组合**(web / desktop / sdk)。headless 是一次性 CLI,会话在 turn 结束后即销毁,没有载体接收完成通知。
147
- - **Leader 能纠偏、但不能中止 worker**:worker 是普通根会话,宿主的 `list_agents` / `send_message` / `interrupt_agent` 对它无效(`interrupt_agent` 会返回假成功)。跑偏了用 `message_worker` 把纠偏指令 steer 进它当前轮次(正在跑就插下一步);没有中止手段——宿主的 `Agent.cancel()` 没被接成工具,真卡死只能请人去那个会话处理。能读它的会话过程(`read_worker_session`,只读、不唤醒)。
149
+ - **Leader 能纠偏、但不能中止 worker**:worker 是普通根会话,宿主的 `list_agents` / `send_message` / `interrupt_agent` / `wait_agent` 对它无效(`interrupt_agent` 会返回假成功,`wait_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
+ ### blobatar 2.7.0(MIT)
11
+
12
+ - 来源:https://github.com/Alain00/blobatar
13
+ - 版权:Copyright (c) 2026 Alain
14
+ - 用途:worker / leader 头像的确定性「身体 + 胶囊眼」几何。实现由 esbuild 内联进 lib/client.js;产物头部另有同份 MIT 声明。
15
+
16
+ ```text
17
+ MIT License
18
+
19
+ Copyright (c) 2026 Alain
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 OTHER DEALINGS IN THE SOFTWARE.
37
+ ```
38
+
39
+ ## 随包安装的运行时依赖
40
+
41
+ 无。运行时只依赖宿主提供的基线模块(React、React DOM、`@deepseek-ai/dsh-client-ui-primitives`),它们由宿主模块表提供,不随本包分发。
42
+
43
+ ## 参考实现(未随包分发)
44
+
45
+ ### dsh-session-tabs 0.1.6(MIT)
46
+
47
+ - 来源:https://github.com/QIN-SMART/dsh-session-tabs
48
+ - 版权:Copyright (c) 2026 QIN-SMART
49
+ - 参考位置:`src/client/session-tabs.js`
50
+ - 参考内容:主面板槽位(`data-slot="main"`)定位与父列选择、`retainedBy.mainView` 判定当前会话、主面板与会话体的 flex 收缩标记,以及按项目持久化标签的部分实现。上游产物不随本包分发,许可全文见下。
51
+
52
+ ```text
53
+ MIT License
54
+
55
+ Copyright (c) 2026 QIN-SMART
56
+
57
+ Permission is hereby granted, free of charge, to any person obtaining a copy
58
+ of this software and associated documentation files (the "Software"), to deal
59
+ in the Software without restriction, including without limitation the rights
60
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
61
+ copies of the Software, and to permit persons to whom the Software is
62
+ furnished to do so, subject to the following conditions:
63
+
64
+ The above copyright notice and this permission notice shall be included in all
65
+ copies or substantial portions of the Software.
66
+
67
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
68
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
69
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
70
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
71
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
72
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
73
+ SOFTWARE.
74
+ ```
75
+
76
+ ## 构建与测试工具(不随包分发)
77
+
78
+ | 包 | 版本 | 许可 | 来源 |
79
+ | --- | --- | --- | --- |
80
+ | esbuild | 0.28.2 | MIT | https://github.com/evanw/esbuild |
81
+ | oxlint | 1.94.0 | MIT | https://github.com/oxc-project/oxc |
82
+ | playwright | 1.64.1 | Apache-2.0 | https://github.com/microsoft/playwright |
83
+
84
+ 这些工具只在开发、构建或测试时使用,不进入 npm 包或客户端产物;完整许可文本在各自安装目录的 `LICENSE` 文件里。