dsh-leader-agent 0.8.0 → 0.10.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 (59) hide show
  1. package/.agents/skills/init-leader-agent/SKILL.md +2 -1
  2. package/.agents/skills/init-leader-agent/references/SLOTS.md +6 -1
  3. package/.agents/skills/leader-mode/SKILL.md +2 -2
  4. package/.agents/skills/leader-mode/playbooks/program.md +7 -5
  5. package/.agents/skills/leader-mode/references/parallel.md +1 -1
  6. package/README.md +125 -125
  7. package/README_EN.md +210 -0
  8. package/lib/client.js +1557 -515
  9. package/locale/de.json +35 -12
  10. package/locale/en.json +35 -12
  11. package/locale/es.json +35 -12
  12. package/locale/fr.json +35 -12
  13. package/locale/ja.json +35 -12
  14. package/locale/pt.json +35 -12
  15. package/locale/ru.json +35 -12
  16. package/locale/zh.json +35 -12
  17. package/package.json +2 -2
  18. package/src/client/agent-bubble-styles.js +4 -7
  19. package/src/client/board-mode.js +35 -77
  20. package/src/client/board-settings.js +311 -47
  21. package/src/client/board-styles.js +146 -59
  22. package/src/client/board.js +29 -22
  23. package/src/client/directory-browse-logic.js +177 -0
  24. package/src/client/directory-browse.js +544 -0
  25. package/src/client/leader-changes.js +3 -7
  26. package/src/client/locales.generated.js +224 -40
  27. package/src/client/modal-shell.js +5 -9
  28. package/src/client/project-panel.js +76 -13
  29. package/src/client/project-remote.js +22 -3
  30. package/src/client/project-section.js +3 -7
  31. package/src/client/session-tabs.js +3 -9
  32. package/src/client/session-watermark.js +19 -24
  33. package/src/client/slot-retain.js +20 -2
  34. package/src/client/style-sheet.js +32 -0
  35. package/src/client/toast-view.js +3 -7
  36. package/src/client/worker-task-styles.js +4 -7
  37. package/src/client/workspace-exclusion.js +4 -7
  38. package/src/host/dispatch.js +508 -75
  39. package/src/host/index.js +40 -10
  40. package/src/host/leader-context.js +7 -4
  41. package/src/host/projects/remote.js +45 -3
  42. package/src/host/settings-store.js +231 -0
  43. package/src/host/slots/slot-templates.js +71 -16
  44. package/src/host/tools/gate.js +3 -1
  45. package/src/host/tools/list-worker-models.js +204 -0
  46. package/src/host/tools/list-workers.js +146 -0
  47. package/src/host/tools/message-worker.js +42 -6
  48. package/src/host/tools/read-worker.js +15 -3
  49. package/src/host/tools/spawn-worker.js +46 -3
  50. package/src/host/worker-model.js +357 -0
  51. package/src/host/worker-registry.js +43 -0
  52. package/src/host/worker-sessions.js +157 -16
  53. package/src/host/worker-stall.js +25 -3
  54. package/src/host/worker-transcript.js +49 -52
  55. package/src/shared/projects.js +8 -2
  56. package/src/shared/settings.js +81 -0
  57. package/src/shared/truncate.js +63 -0
  58. package/src/shared/turn-failure.js +25 -0
  59. package/README_ZH.md +0 -211
@@ -49,7 +49,8 @@ dsh 读取 `AGENTS.md` 作为系统提示段落,写入后立即对模型生效
49
49
  1. 读 `references/SLOTS.md`,得到骨架:frontmatter 声明 `dev` / `review` 两个槽位,正文按 `## <槽位名>` 分节。
50
50
  2. 按项目需要调整槽位(可以增删,frontmatter 与正文章节要同步)。需要单独的需求讨论角色,再加一节 `## discuss`。
51
51
  3. 每节写这个项目对这类角色的具体要求:开工前读什么、改动范围、验证方式、审查判据。不写通用道理。
52
- 4. 写到项目根目录的 `SLOTS.md`。已存在就先读再改。
52
+ 4. 可选:在 frontmatter 给角色写默认 `model` / `effort`(`model` 写 `provider/model`,或只写模型 id 沿用 leader 的 provider);不写就回落 leader 当前模型。拿不准模型 id 时先用 `list_worker_models` 查,别编。这里只是槽位默认;派工和复用承接该槽位时,缺 `model` / `effort` 分别用它,显式值优先。
53
+ 5. 写到项目根目录的 `SLOTS.md`。已存在就先读再改。
53
54
 
54
55
  槽位只描述工作方法与人设,不授予工具权限。
55
56
 
@@ -2,13 +2,18 @@
2
2
  slots:
3
3
  dev:
4
4
  label: 开发
5
+ # 可选:该角色的默认模型。model 写 provider/model,或只写模型 id(沿用 leader 的 provider)。
6
+ # model: deepseek/deepseek-reasoner
7
+ # effort: high
5
8
  review:
6
9
  label: 审核
7
10
  ---
8
11
 
9
12
  # 角色槽位
10
13
 
11
- 本文件由 dsh-leader-agent 解析:顶部 YAML frontmatter 的 `slots:` 声明每个槽位的显示名,正文按 `## <槽位名>` 分节;leader 用卡片的 `slots` 字段把槽位绑到执行会话,被绑会话每轮 turn 注入对应正文。槽位名是 ASCII 机器标识(小写字母、数字、下划线、连字符,最长 32 字符),`label` 可用中文。槽位只描述工作方法与人设,不授予工具权限。
14
+ 本文件由 dsh-leader-agent 解析:顶部 YAML frontmatter 的 `slots:` 声明每个槽位的显示名与可选默认模型,正文按 `## <槽位名>` 分节;leader 用卡片的 `slots` 字段把槽位绑到执行会话,被绑会话每轮 turn 注入对应正文。槽位名是 ASCII 机器标识(小写字母、数字、下划线、连字符,最长 32 字符),`label` 可用中文。槽位只描述工作方法与人设,不授予工具权限。
15
+
16
+ `model` / `effort` 是绑到这个槽位时的默认模型;没写就回落 leader 当前模型;模型 id 与 effort 可用 `list_worker_models` 查。派工和复用承接该槽位时,缺 model 用槽位默认、缺 effort 用槽位 effort;同卡续聊不重置,显式同名值优先。
12
17
 
13
18
  > 这是骨架:把每节正文换成这个项目对这类角色的要求。需要单独的讨论角色就自己加一节 `## discuss` 并在 frontmatter 补上声明;不需要的槽位整节删掉,frontmatter 里对应声明一起删。
14
19
 
@@ -30,7 +30,7 @@ whenToUse: 一个会话需要同时管理多个执行者、跨阶段推进并对
30
30
 
31
31
  项目自带 leader 会话:注册项目时宿主就在项目目录里建好 leader 会话并与项目绑定,因此「加完项目」立刻有可用的 leader。切项目就是打开该项目的 leader 会话;leader 会话没了就在左栏项目区块里换新 Leader:新会话立刻接手项目,旧会话降级为项目里的普通会话,和 worker 一起列在项目行下(不再出现在官方工作区树里),历史照旧可读;换人之后它不再指挥这个项目——它手里那套工具面不会被重裁,所以派工、投递消息、跨项目查卡与建卡改卡都按当前身份在调用时再判一次,退役会话的 `spawn_worker` / `message_worker` / `list_cards(scope:'all')` / `create_card` / `update_card` 会被拒绝。换人时原班 worker 的派工归属与未投递的完成回报一并改投新会话,所以「新会话立刻接手项目」包含原班 worker——直接用 `message_worker` 接着派就行,不必重新派工。
32
32
 
33
- 角色槽位定义在项目目录的 `SLOTS.md` 里,按 `## <槽位名>` 分节,正文是该角色的工作方法与人设。槽位名是 ASCII 机器标识(小写字母、数字、下划线、连字符,最长 32 字符),写卡时与 `SLOTS.md` 的节名保持一致;文件顶部 YAML frontmatter 的 `slots:` 声明卡面上的显示名:`slots:` 下按槽位名缩进一层写 `label:`(块状 YAML,不能写成 `slots.dev.label: 开发` 这种点路径),中文可用;没声明时内置 `dev` / `review` 按界面语言显示,其余显示槽位名(`discuss` 保留内置翻译)。槽位只贡献一段提示词文本,**不授予任何工具权限**——可用工具由宿主决定。槽位绑定记在卡片的 `slots` 字段(`{ 槽位名: { sessionId } }`)里:宿主在每轮请求组装时求值,正文**变化才追加**一份新快照,所以改动 `SLOTS.md` 在下一个模型请求生效,正文没变的轮次不会重复注入。
33
+ 角色槽位定义在项目目录的 `SLOTS.md` 里,按 `## <槽位名>` 分节,正文是该角色的工作方法与人设。槽位名是 ASCII 机器标识(小写字母、数字、下划线、连字符,最长 32 字符),写卡时与 `SLOTS.md` 的节名保持一致;文件顶部 YAML frontmatter 的 `slots:` 声明卡面上的显示名:`slots:` 下按槽位名缩进一层写 `label:`(块状 YAML,不能写成 `slots.dev.label: 开发` 这种点路径),中文可用;没声明时内置 `dev` / `review` 按界面语言显示,其余显示槽位名(`discuss` 保留内置翻译)。槽位只贡献一段提示词文本,**不授予任何工具权限**——可用工具由宿主决定。frontmatter 里同一槽位还可以写 `model` / `effort` 作为该角色的默认模型;派工没显式给模型时用它,没写就回落 leader 当前模型。槽位模型在派工和复用承接该槽位时生效(换卡/换槽位投递时,显式 `model` 优先,缺 model 就用槽位默认),同卡续聊不重置;之后改 `SLOTS.md` 只影响新派或新承接的工,显式 `model` / `effort` 分别优先。槽位绑定记在卡片的 `slots` 字段(`{ 槽位名: { sessionId } }`)里:宿主在每轮请求组装时求值,正文**变化才追加**一份新快照,所以改动 `SLOTS.md` 在下一个模型请求生效,正文没变的轮次不会重复注入。
34
34
 
35
35
  挂卡会话还会同时获得**卡片事实**:编号、标题、状态、槽位、revision,以及 spec 全文与链接列表。它与槽位同一套通道(每轮求值、变化才追加),首轮请求就带着——因为绑定在 `spawn_worker` 返回前完成,而开工要等 leader 随后的第一条消息。worker 自己用 `update_card` 的 `addLinks` 挂上 PR 后,下一次请求就会看到递增的 revision 与新链接。
36
36
 
@@ -84,7 +84,7 @@ worker 的工作目录强制是项目目录:leader 不能指定 worker 的 cwd
84
84
 
85
85
  ## 派工与接收
86
86
 
87
- 派工用 `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
+ 派工用 `spawn_worker`:它建一个常驻 worker 会话并立即返回会话 id,worker 那一轮结束时自动唤醒你并附完成通知与产物摘要(它不需要、也没有「报告完成」这类工具),同一轮可连派多个工。不确定可用 route 时先用 `list_worker_models` 查(不传参列 provider,给 provider 列模型,再给 model 看 effort)。需要不同模型时同一次调用带 `model`(`provider/model`,只写模型 id 时用 leader 的 provider)与可选的 `effort`;省略时按绑定槽位在 `SLOTS.md` 的默认模型回落,再回落 leader 当前模型。回执会写明最终模型与来源,不要凭猜测在消息里向 worker 转述模型。worker 失败通知会带模型与原因;任务消息落成前的失败会标明归属不确定,先 `read_worker_session` 再决定重投或换模型。worker 是普通会话——人能在项目树里打开它直接聊,那种轮次不经过你,也不会唤醒你。**worker 的入口只有三个**:`spawn_worker`(派工)、`message_worker`(续聊、改名与换模型:`sessionId` + `message` 必填,可选 `rename`、`model`、`effort`;换卡/换槽位复用且没显式给模型时会按新槽位默认切换)、`read_worker_session`(回看它的会话回合:任务、正文、调过哪些工具、哪一步失败与原因;`turns`/`offset` 翻页;只读、不唤醒 worker——排查「为什么慢/为什么错」先用它,不要为此让 worker 再跑一轮)。另有只读的 `list_workers`:列本项目未归档 worker 的会话 id、模型 / effort、运行状态与挂卡,用于盘点和核对,不是交互入口。宿主的 `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-动作与工具)。
88
88
 
89
89
  派工确保原简报、后续指令、实际产物与版本均可沿指针完整恢复,不依赖「done」摘要继承变更。按 [leader 传话纪律](playbooks/program.md#输出与传话纪律)保留边界与验收,已落盘正文不抄入派单。按宿主与任务权限使用 worker;现有 owner 与 worktree 状态能可信恢复时续跑,新上下文更合适时新派,不能丢原约束。停止/恢复遵守用户指令与宿主契约;能力不可用明确 limitation,不声称多模型独立评估。
90
90
 
@@ -9,7 +9,9 @@
9
9
  | 动作 | 工具 |
10
10
  |---|---|
11
11
  | 建 worker 会话(不开工,立即返回) | `spawn_worker` |
12
- | 投递任务 / 续聊 / 改名(第一条消息即开工) | `message_worker` |
12
+ | 查 worker 可用的模型 route 与 effort | `list_worker_models` |
13
+ | 盘点本项目 worker 及其模型、effort 与状态 | `list_workers` |
14
+ | 投递任务 / 续聊 / 改名 / 换模型(第一条消息即开工) | `message_worker` |
13
15
  | 读 worker 回报 | 完成通知(无需轮询) |
14
16
  | 回看 worker 的会话过程(不唤醒它) | `read_worker_session` |
15
17
  | 建卡 | `create_card` |
@@ -18,19 +20,19 @@
18
20
 
19
21
  派工分两步:`spawn_worker` 只建常驻 worker 会话并立即返回会话 id,**不产生模型调用**;`message_worker` 投递第一条消息时才开工。分两步是为了让槽位绑定先落盘——第一条任务请求组装时角色槽位与卡片事实就已经在上下文里。worker 那一轮结束时自动唤醒你并附完成通知,同一轮里可连派多个工。
20
22
 
21
- 建 worker 必须给 `name`:它是 worker 的显示名,也直接成为它的会话标题——侧栏与项目树里看到的就是这个名字,所以用角色-任务短名(如 `research-sources`),不要写成长句。要挂卡就在同一次调用里给 `cardId` 与 `slot`(两者成对),卡必须是本项目的、状态为 `active`(跨项目、已关闭或已归档的卡会被拒绝);绑定在返回前完成。worker 换了角色用 `message_worker` 的 `rename` 顺手改名,不必为此另派新工。
23
+ 建 worker 必须给 `name`:它是 worker 的显示名,也直接成为它的会话标题——侧栏与项目树里看到的就是这个名字,所以用角色-任务短名(如 `research-sources`),不要写成长句。要挂卡就在同一次调用里给 `cardId` 与 `slot`(两者成对),卡必须是本项目的、状态为 `active`(跨项目、已关闭或已归档的卡会被拒绝);绑定在返回前完成。不确定有哪些模型 route 时先用 `list_worker_models` 查(不传参列 provider,给 provider 列模型,再给 model 看 effort)。需要该 worker 跑在别的模型上时,同一次调用带 `model`(`provider/model`,只写模型 id 时沿用你的 provider)与可选的 `effort`;省略时按槽位在 `SLOTS.md` 的默认模型回落,再回落你当前用的模型。只是给 effort 也可以,套在最终模型上。模型在派工时可指定,之后也能用 `message_worker` 的 `model` / `effort` 换(写进登记表,冷恢复沿用);事后改 `SLOTS.md` 只影响新派的工。回执里的「模型」一行写明最终 route 与来源。worker 换了角色用 `message_worker` 的 `rename` 顺手改名,不必为此另派新工。
22
24
 
23
25
  建完立刻投递:`spawn_worker` 之后不投任务的 worker 只是一条空闲会话,占名册也可能被误当成在跑。投递用 `message_worker`(worker 挂着未完成卡时 `cardId` 必填且必须一致),消息只写「做什么、边界、验收与指针」;卡片规格、链接与 revision 由宿主注入,不要抄进消息。
24
26
 
25
- 复用 worker 派新活前先看它挂没挂卡:挂着 `active` 卡的 worker 不能接别的工作(投递会被拒绝),只能同卡续跑。要让它转去下一张卡,先把旧卡标 `done` 或归档——关闭卡片会自动释放槽位上的执行者,worker 立刻变成未挂卡、可以接新任务。名册到顶时的候选清单已经排除挂着卡的 worker,并在下面单独列出怎么释放。
27
+ 复用 worker 派新活前先用 `list_workers` 盘点:它按最近使用排序,列出本项目未归档 worker 的会话 id、模型 / effort、是否在跑与挂着的卡;再确认它挂没挂卡——挂着 `active` 卡的 worker 不能接别的工作(投递会被拒绝),只能同卡续跑。要让它转去下一张卡,先把旧卡标 `done` 或归档——关闭卡片会自动释放槽位上的执行者,worker 立刻变成未挂卡、可以接新任务。把新卡的槽位指向它后再投递:没显式给 `model` 时,这次换卡/换槽位会按新槽位的 `SLOTS.md` 默认模型切换;同卡续聊保持当前 route。名册到顶时的候选清单已经排除挂着卡的 worker,并在下面单独列出怎么释放。
26
28
 
27
29
  worker 是常驻根会话,人可以在项目树里打开它直接下钻对话。**人自己聊的那几轮你要当没发生**:它不会唤醒你,也不会给你完成通知;除非用户回来让你接着推进,否则不要凭猜测去追问它在聊什么。
28
30
 
29
- worker 的一切交互只有 `spawn_worker`、`message_worker` 与只读的 `read_worker_session` 三个入口。宿主的 `list_agents` / `send_message` / `interrupt_agent` / `wait_agent` 只认宿主 subagent 体系:我们的 worker 是普通根会话,不在它们的子会话名录里,传话、中止与等待都落不到它身上(这四件已从你的工具面摘掉)。worker 跑偏时用 `message_worker` 把纠偏指令 steer 进当前轮次(正在跑就插进下一步);没有中止手段,真卡死了才请人去那个会话里处理。宿主另有同伴模型的一套同名工具,按成员名寻址,与本流程的 worker 不是同一批,同样不要混用。
31
+ worker 的一切交互只有 `spawn_worker`、`message_worker` 与只读的 `read_worker_session` 三个入口;要看有哪些 worker、各自跑在什么模型上,用同样只读的 `list_workers`(不唤醒、不产生模型调用)。宿主的 `list_agents` / `send_message` / `interrupt_agent` / `wait_agent` 只认宿主 subagent 体系:我们的 worker 是普通根会话,不在它们的子会话名录里,传话、中止与等待都落不到它身上(这四件已从你的工具面摘掉)。worker 跑偏时用 `message_worker` 把纠偏指令 steer 进当前轮次(正在跑就插进下一步);没有中止手段,真卡死了才请人去那个会话里处理。宿主另有同伴模型的一套同名工具,按成员名寻址,与本流程的 worker 不是同一批,同样不要混用。
30
32
 
31
33
  worker 连续 15 分钟没有任何回报时,机制侧会注入一条带 **`【后台巡查】`** 前缀的例行检查提醒(与完成通知同一条通道,但正文自带前缀与会话 id,不是 worker 的回报;不一定是卡住,也不代表任务失败)。收到后先 `read_worker_session` 回看它最近几轮卡在哪一步,再决定继续等待、用 `message_worker` 纠偏,还是请人在它的会话里处理;不要因为收到提醒就重复追问或重派同一件活。提醒每 15 分钟至多一条,本流程仍没有中止手段。
32
34
 
33
- worker 的产物摘要在完成通知里,不需要轮询查询。**要看过程用 `read_worker_session`**:它直读 worker 的会话日志(`sessionId` 必填,`turns` 默认 2、最多 20),给出每轮的任务正文、worker 说过的正文、调过哪些工具与失败原因。只读、不唤醒 worker、不产生模型调用,worker 正在跑也能读(读到的是已落盘部分,最后一轮会标「进行中」)。正文有条目上限与总量上限,读不到全部历史是设计如此。需要 worker 补充解释、或者要它接着动手时,才用 `message_worker`——worker 正在跑时消息在它的下一步注入当前轮次(算纠偏,不是另起一轮),空闲时直接开新回合。
35
+ worker 的产物摘要在完成通知里,不需要轮询查询。**要看过程用 `read_worker_session`**:它直读 worker 的会话日志(`sessionId` 必填,`turns` 默认 2、最多 20,`offset` 跳过最新回合往更早翻页),给出每轮的任务正文、worker 说过的正文、调过哪些工具与失败原因。只读、不唤醒 worker、不产生模型调用,worker 正在跑也能读(读到的是已落盘部分,最后一轮会标「进行中」)。正文有条目上限与单页总量上限,超出时按页末给出的 `offset` 继续翻;完成通知被截断时也照此回看。需要 worker 补充解释、或者要它接着动手时,才用 `message_worker`——worker 正在跑时消息在它的下一步注入当前轮次(算纠偏,不是另起一轮),空闲时直接开新回合。
34
36
 
35
37
  ## Orchestrate
36
38
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  派活绑定卡槽位,不按「谁空闲」:投递前用查卡工具确认任务挂在哪张卡、槽位上是谁,只派给那张卡的槽位执行者——空闲不等于可派,一会话一时只服务一张卡的一个槽位。**挂着未完成卡的 worker 不能接别的工作**(投递门禁只放行同卡续跑):先把它手上的卡标 `done` 或归档,槽位会自动释放,worker 才能接新任务。**同时挂多张 `active` 卡**(整卡替换 `slots` 时会造出来)一律拒绝投递,与声明哪张卡无关——先关掉多余的卡收敛到一张。`idle` 不等于有人可派:卡槽位与看板信号都看不出「被用户停止」,停用会话状态即 idle。不做事前判断,**投递即探测**:`message_worker` 失败后按错误信息判——报「没有派工记录」说明该会话已撤销(归档会摘掉登记),视作死槽,用 `update_card` 把该槽位改派给新会话;其余错误是普通失败,照常上报,不动槽位。
12
12
 
13
- 复用会话承接新任务前先确认它没挂未完成的卡;挂着就先关闭旧卡(自动释放)或走同卡续跑。承接时同次改名成卡上任务名(`message_worker` 的 `rename`),名册与卡上任务不符就是串线信号。换卡改派是三步、顺序不能换:① `update_card` 关旧卡(槽位自动释放);② `update_card` 在新卡上把槽位指向该会话——`slots` 整体替换,这张卡上别的槽位要一起写全,只写一个会把其余清掉;③ `message_worker` 带 `cardId` 与 `rename` 投递。卡片上只有 `slots` 一个绑定面、没有独立的「指派」字段:给新卡写绑定不会自动清掉旧卡,旧卡必须自己关。绑定也要早于投递——投递之后才绑,首轮请求里没有角色槽位与卡片事实。原卡仍 `active` 时要检查是否缺槽位,缺了就补,`done` 卡不补;「摘掉」不算处理,那只是把缺槽位留给活跃卡。
13
+ 复用会话承接新任务前先确认它没挂未完成的卡;挂着就先关闭旧卡(自动释放)或走同卡续跑。承接时同次改名成卡上任务名(`message_worker` 的 `rename`),名册与卡上任务不符就是串线信号。换卡改派是三步、顺序不能换:① `update_card` 关旧卡(槽位自动释放);② `update_card` 在新卡上把槽位指向该会话——`slots` 整体替换,这张卡上别的槽位要一起写全,只写一个会把其余清掉;③ `message_worker` 带 `cardId` 与 `rename` 投递;没显式给 `model` 时,换卡或换槽位会按新槽位的 `SLOTS.md` 默认模型切换(显式 effort 单独生效),同卡续聊不重置。卡片上只有 `slots` 一个绑定面、没有独立的「指派」字段:给新卡写绑定不会自动清掉旧卡,旧卡必须自己关。绑定也要早于投递——投递之后才绑,首轮请求里没有角色槽位与卡片事实。原卡仍 `active` 时要检查是否缺槽位,缺了就补,`done` 卡不补;「摘掉」不算处理,那只是把缺槽位留给活跃卡。
14
14
 
15
15
  活跃卡(状态为 `active` 且有活要干)必须同时有 dev 与 review 槽位,缺 review 槽位会逼出「借别的卡的审查员」。补槽直接在新派工里带 `cardId` + `slot`,绑定在建会话返回前完成;要换执行者时先 `update_card` 显式改派到新会话,再投递——槽位已被别的会话占用时派工会被拒绝,不静默顶替。卡片关闭(`done` / `archived`)会自动释放槽位与执行者,重新打开要重新指派;不要手工清 `slots`。
16
16
 
package/README.md CHANGED
@@ -1,211 +1,211 @@
1
1
  <p align="center">
2
2
  <picture>
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 keystone fanning out into parallel worker tracks" width="460">
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 节点扇出三条并行执行轨" 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> | <a href="https://fengshenx.github.io/dsh-leader-agent/">Website</a>
9
+ <a href="README_EN.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">
13
- <a href="https://www.npmjs.com/package/dsh-leader-agent"><img alt="npm version" src="https://img.shields.io/npm/v/dsh-leader-agent?style=flat-square&color=4b6fff"></a>
13
+ <a href="https://www.npmjs.com/package/dsh-leader-agent"><img alt="npm 版本" src="https://img.shields.io/npm/v/dsh-leader-agent?style=flat-square&color=4b6fff"></a>
14
14
  <a href="https://github.com/fengshenx/dsh-leader-agent/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/fengshenx/dsh-leader-agent/actions/workflows/ci.yml/badge.svg"></a>
15
15
  <a href="LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-263146?style=flat-square"></a>
16
- <img alt="dsh version" src="https://img.shields.io/badge/dsh-%3E%3D0.2.1--rc.2-4b6fff?style=flat-square">
17
- <img alt="status" src="https://img.shields.io/badge/status-developer%20preview-7da1de?style=flat-square">
18
- <a href="https://www.npmjs.com/package/dsh-leader-agent"><img alt="npm downloads" src="https://img.shields.io/npm/dm/dsh-leader-agent?style=flat-square&color=4b6fff"></a>
19
- <a href="https://github.com/fengshenx/dsh-leader-agent/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/fengshenx/dsh-leader-agent?style=flat-square&color=4b6fff"></a>
16
+ <img alt="dsh 版本要求" src="https://img.shields.io/badge/dsh-%3E%3D0.2.1--rc.2-4b6fff?style=flat-square">
17
+ <img alt="状态" src="https://img.shields.io/badge/status-developer%20preview-7da1de?style=flat-square">
18
+ <a href="https://www.npmjs.com/package/dsh-leader-agent"><img alt="npm 月下载量" src="https://img.shields.io/npm/dm/dsh-leader-agent?style=flat-square&color=4b6fff"></a>
19
+ <a href="https://github.com/fengshenx/dsh-leader-agent/stargazers"><img alt="GitHub Stars" src="https://img.shields.io/github/stars/fengshenx/dsh-leader-agent?style=flat-square&color=4b6fff"></a>
20
20
  </p>
21
21
 
22
22
  # dsh-leader-agent
23
23
 
24
- > One Leader drives the work and the review, so you can run ten features in parallel instead of babysitting each one.
24
+ > 一个 Leader 帮你推进开发和 Review,解放你的注意力:同时并行开发 10 个 feature,而不是逐个陪跑。
25
25
  >
26
- > A leader / worker orchestration bundle for DeepSeek Harness (dsh). The Leader splits work, dispatches it, tracks every worker to completion, checks what comes back and runs review; workers do the work in the background, report back automatically, and every task fact lands on a board organized by project. Running one worktree per task is this repository's convention, not a requirement of the bundle.
26
+ > DeepSeek Harness(dsh)的 leader / 执行者编排 bundle。Leader 拆解、派工、盯完成、收产物、组织审查;worker 在后台各自干活、完成自动回报,任务事实落进按项目组织的看板。一人一个 worktree 是本仓的约定,不是 bundle 的硬性要求。
27
27
 
28
- ## Highlights
28
+ ## 亮点
29
29
 
30
- 1. **One Leader drives development and review** — You state the goal once. The Leader opens cards, dispatches workers, watches each one finish, verifies the deliverable and organizes review. Your attention goes back to "what do I want" instead of "which agent is stuck"; the target is ten features in flight at once.
31
- 2. **A right SidePanel board: see who is working at a glance** — One board per project, in two presentations: **Work** (default) keeps the plain list, **Cinematic** draws it as a workflow map for demos and social sharing; switch under Settings → Leader Agent → Task board. Each card carries its executor slot and a live status light, its note renders as Markdown, its links are editable in place, and the detail footer can delete the card. Click a card for the spec (goal, scope, acceptance, links), click a slot to drill into that agent's session and keep talking; worker reports arrive as Markdown-rendered agent bubbles; dispatched task briefs arrive as user-style bubbles whose body uses the same Markdown pipeline as assistant content; single newlines merge per Markdown, so use blank lines or Markdown syntax for a line break.
32
- 3. **Arrange your agents however you want** — Two files do the arranging. `LEADER.md` holds the Leader's prompt and this project's orchestration rules: boundaries, dispatch requirements, acceptance criteria. `SLOTS.md` gives each worker role its own rules (dev / review / …). Both are evaluated before every model request and appended only when their text changes, so editing a file changes behavior without recreating sessions.
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
- 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
- 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.
30
+ 1. **通过一个 Leader,帮你推进开发和 Review** — 你只说一次目标:它拆卡、派工、盯住每个 worker 的完成、验证产物、组织审查。目标规模是一次并行开发 10 个 feature。
31
+ 2. **一块看得见谁在干活的看板** — 一个项目一块,**工作**列表或**炫酷**线路图两种呈现;卡面是执行者槽位与实时信号灯,点卡看详情,点槽位直接钻进那个 Agent 的会话接着聊。
32
+ 3. **编排规则写进两份文件** — `LEADER.md` 写 Leader 的 prompt 与本项目的编排规则,`SLOTS.md` 按角色给 worker 写。改文件即改行为,下一次请求生效,不用重建会话。
33
+ 4. **每个 worker 用合适的模型** — 派工时按任务挑模型与 effort:重活用强模型、查证用快模型;`SLOTS.md` 可按角色写默认,`message_worker` 续聊时也能换,派工前用 `list_worker_models` 查可选 route。
34
+ 5. **多项目并行,每个项目一个 Leader** — 加项目即绑定一个 leader 会话并列出它派出的 worker;删项目只删记录、保留文件夹与会话;换 Leader 时原班 worker 与未投递的回报一并改投。
35
+ 6. **给 Leader 的编排 Skill,不是一句人设** — `leader-mode` 按讨论 → 设计 → 实现交付 → 审查 → 合入分阶段给 playbook,另有并行协作与交接规范。
36
+ 7. **卡住的任务会浮出来,不会无限等** — worker 超过 15 分钟没有回报时,会触发一条带「【后台巡查】」前缀的提醒,附挂着的卡、最后回报与可照抄的回看调用;`read_worker_session` 只读回放它做过什么,不唤醒 worker。
37
37
 
38
- ## Install
38
+ ## 安装
39
39
 
40
- ### Desktop install (DeepSeek Harness Desktop)
40
+ ### 桌面版安装(DeepSeek Harness Desktop)
41
41
 
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
+ 桌面版用独立 profile(`$DSH_HOME/profiles/desktop`),与上面的 `web` 互不相通:插件要在对应 profile 里分别安装,装好后两侧功能一致(含看板与项目树);会话、项目与卡片数据共享。
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
+ **图形界面安装**:左侧 SidePanel 打开「插件」,点右上角「添加插件」,在包名框填 `dsh-leader-agent` 后点「安装」:
45
45
 
46
- <img src="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/main/docs/assets/readme/desktop-add-plugin.png" alt="Add plugin wizard: enter dsh-leader-agent" width="880">
46
+ <img src="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/main/docs/assets/readme/desktop-add-plugin.png" alt="Add plugin 向导:输入 dsh-leader-agent" width="880">
47
47
 
48
- **CLI install:** the system `dsh` refuses to manage the desktop profile; use the CLI bundled with the desktop install:
48
+ **命令行安装**:系统 `dsh` 拒绝管理 desktop profile,要用桌面安装自带的 CLI:
49
49
 
50
50
  ```sh
51
- # quit the app completely first (closing the window only hides it)
51
+ # 先完全退出应用(关窗口只是隐藏)
52
52
  "/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh" \
53
53
  plugin --profile desktop add dsh-leader-agent
54
54
  ```
55
55
 
56
- On Windows / Linux, use `runtime/cli/bin/dsh` inside the installation directory. The app reads the profile only at startup, and only one version can be mounted at a time. `DSH_HOME` must be absolute or start with `~/`. Sessions, projects, and cards are shared with `web`; plugin packages and activation are separate.
56
+ Windows / Linux 换成安装目录里对应的 `runtime/cli/bin/dsh`。应用只在启动时读 profile,同一时刻只能挂一个版本;`DSH_HOME` 要用绝对路径或 `~/` 写法。
57
57
 
58
- Development: `npm run desktop` uses an isolated root (`.dev/desktop-home`); `npm run desktop:prod` uses a shadow root (`.dev/desktop-prod-home`) linking sessions/cards to `~/.dsh`; online profile untouched. Both run local code; direct launches use the installed version. `-- --remove` cleans its root; `-- --remove --remove-mount` removes a legacy mount.
58
+ `npm run desktop` 用 dev 根 `.dev/desktop-home`;`npm run desktop:prod` 用正式数据(影子根 `.dev/desktop-prod-home`,共用日常,线上 profile 不动)。都用本仓代码,直接启动仍用线上;`-- --remove` 清根,旧版用 `-- --remove --remove-mount` 摘。
59
59
 
60
- ### Web install
60
+ ### Web 版安装
61
61
 
62
- Install from npm (package name `dsh-leader-agent`):
62
+ 从 npm 安装(包名 `dsh-leader-agent`):
63
63
 
64
64
  ```sh
65
65
  dsh plugin --profile web add dsh-leader-agent
66
66
  dsh web
67
67
  ```
68
68
 
69
- The profile must be named `web`; custom names are absent from `PROFILE_TEMPLATES`, so the install lacks the web-app bundle and the client half never loads. Requires dsh `>=0.2.1-rc.2 <0.3.0`.
69
+ profile 名必须用 `web`;自定义名不在 `PROFILE_TEMPLATES` 里,装出来缺 web-app bundle,客户端半边不加载。需要 dsh `>=0.2.1-rc.2 <0.3.0`。
70
70
 
71
- For pinning a version, removing it, development installs, or trying it without a profile, see [Development](docs/development.md).
71
+ 指定版本、卸载、开发期安装与不装 profile 直接试跑见[开发](docs/development.md)。
72
72
 
73
- ## Preview
73
+ ## 如何使用
74
+
75
+ 1. **在左栏加目录**:左栏「项目」区块点「加项目」,选一个目录。项目当场建好并绑定一个 Leader,项目行就是入口。
76
+ 2. **点引导卡,让 Leader 讲方法**:新 Leader 会话还没有消息时,输入框上方有一张引导卡;点「了解怎么用」,Leader 会解释卡、worker 与看板怎么配合。也可以直接在会话里问「这个项目该怎么设置 / 怎么开始?」。
77
+ 3. **按它的引导走**:做项目设置时,它会读当前目录与 `AGENTS.md`,需要时用 `init-leader-agent` 写 `LEADER.md` / `SLOTS.md`,再带你建卡、派工与看看板。
78
+ 4. **定制流程**:`LEADER.md` / `SLOTS.md` 可按需改写,也能在文件里要求 Leader / worker 加载指定 skill。
79
+ 5. **要细节时查手册**:[上手](docs/getting-started.md) 完整走一遍,[使用手册](docs/usage.md) 查每个动作。
80
+
81
+ 两份文件是项目手册,`leader-mode` 是协议,目标项目的 `AGENTS.md` 仍由宿主读取;三者都不授予工具权限。见[项目提示词](docs/usage.md#项目提示词)、[上手](docs/getting-started.md#三两份文件leader-的人设worker-的工作方法)与 `init-leader-agent` skill。
82
+
83
+ ## 常规用法
84
+
85
+ 按你手上的东西选入口:
86
+
87
+ 1. **给文档**:先把需求聊清、写成文档,直接交给 Leader。它按 `LEADER.md` 约定的编排拆卡、派工,推进开发 / Review / 修 Bug,需要决策时由你拍板。
88
+ 2. **给 PR**:也可以自己在普通工作区的会话里边聊边开发,完成后提 PR;把 PR 交给 Leader,由它接手后续的 Review / 修 Bug。
89
+ 3. **问状态**:随时问 Leader「汇报当前状态。哪个 PR 可以合并,哪些事情需要我决策」,它会按卡片、交付物与 CI 给出可行动的结论。
90
+
91
+ ## 预览
74
92
 
75
93
  <div align="center">
76
- <img src="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/main/docs/assets/readme/board.png" alt="Work mode: the project tree on the left, the Leader's conversation in the middle, the delivery board as a list on the right" width="1200">
94
+ <img src="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/main/docs/assets/readme/board.png" alt="工作模式:左栏项目树、中栏 Leader 的会话、右栏列表形态的交付看板" width="1200">
77
95
  </div>
78
96
 
79
- **Work mode (default).** The plain list: one card per task with a slot chip per executor. Left: projects and their workers. Center: the Leader's session — task, dispatch, report, verdict. Right: the board; click an executor to open its session.
97
+ **工作模式(默认)**:纯列表,一卡一件事,槽位 chip 标出执行者。左栏项目树、中栏 Leader 会话、右栏看板;点执行者即可下钻到它的会话。
80
98
 
81
99
  <div align="center">
82
- <img src="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/ab19c6307736fc21675bbac2847dd9bce3bf7a81/docs/assets/readme/board-cinema.png" alt="Cinematic mode in the dark theme: the delivery board as a workflow map, with cards on a trunk and executors on animated branches" width="1200">
100
+ <img src="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/ab19c6307736fc21675bbac2847dd9bce3bf7a81/docs/assets/readme/board-cinema.png" alt="炫酷模式(深色主题):交付看板画成线路图,卡片挂在主干上,执行者支线按运行状态点亮" width="1200">
83
101
  </div>
84
102
 
85
- **Cinematic mode.** The same board as a workflow map: cards on a trunk, one branch per executor; only a running branch animates. Built for demos and social sharing. Shown in the dark theme; the light theme uses electric-blue lines.
103
+ **炫酷模式**:同一块看板画成线路图——卡片挂主干,执行者是右侧支线,只有执行中的支线跑光点。纯演示,社交媒体传播用。图为深色主题;浅色宿主下是电蓝正交线条。
86
104
 
87
- Switch under **Settings → Leader Agent → Task board**; the choice is stored per browser. Work-mode shot is a real session; cinematic shot is the browser e2e fixture (real host + local mock).
105
+ 在 **设置 → Leader Agent → 任务看板** 切换,选择只存本实例;工作模式截图取自真实会话,炫酷模式取自 e2e 夹具(真实宿主 + 本地 mock)。
88
106
 
89
- ## How it runs
107
+ ## 它是怎么跑起来的
90
108
 
91
109
  ```text
92
- you ──────▶ Leader (the leader session, sole commander of the project)
93
- │ create_card record what to build and how it is accepted
94
- │ spawn_worker create the worker session, return immediately
95
- │ message_worker deliver the first message — that is what starts work
110
+ 你 ──────▶ Leader(leader 会话,项目的唯一指挥)
111
+ │ create_card 记下要做什么、验收是什么
112
+ │ spawn_worker 建 worker 会话,立即返回
113
+ │ message_worker 投第一条消息——开工的是它
96
114
  ▼
97
- worker ─ worker ─ worker each runs in its own project directory
98
- │ (one worktree each is the project convention, see Prerequisites)
99
- │ the turn end is settled by the runtime, workers submit nothing
115
+ worker ─ worker ─ worker 各自在自己的项目目录里后台并行
116
+ │ (一人一个 worktree 是项目约定,见「前提」)
117
+ │ turn 结束由机制侧结算(worker 不用调工具交作业)
100
118
  ▼
101
- Leader wakes up ──▶ board status lights update ──▶ open any worker and keep talking
119
+ Leader 被唤醒 ──▶ 看板信号灯更新 ──▶ 你打开任一 worker 接着聊
102
120
  ```
103
121
 
104
- Three mechanisms make this more than "a smarter prompt":
105
-
106
- - **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.
107
- - **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.
108
- - **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).
109
- - **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.
110
-
111
- ## Design trade-offs
112
-
113
- - This project does not aim to rebuild [the Super-agent research prototype from the DeepSeek Harness team](https://github.com/deepseek-ai/dsh-superagent-prototype) (a research prototype, not an official DeepSeek product), which watches one repository and runs event-driven sessions. It solves a different problem: letting one person manage 20+ sessions, with a Leader, a board and parallel tasks ([FAQ](https://fengshenx.github.io/dsh-leader-agent/#faq)).
114
- - Today's agents are not reliable enough to run unattended, so the design assumes you can interrupt or push any worker at any point.
115
- - The routing layer runs a full-size model. In practice, holding the global picture, it often connects several PRs in one thought and resolves what a single worker cannot see.
116
- - Agent orchestration generalizes. A card describes the task itself, so it works outside coding and composes with any skill.
117
- - Initialization is still manual: in your own project you write `LEADER.md` (the Leader's persona prompt and orchestration flow) and `SLOTS.md` (the role split and each role's persona prompt).
118
- - The Leader leads and workers never talk to each other; the tool surface rules it out. Today's agents are trained for strict instruction-following, and one noisy message between two agents can derail the entire conversation.
122
+ 这些行为由机制保证,不靠提示词:
119
123
 
120
- ## Five steps
124
+ - **身份决定工具面**:Leader 拿得到 `spawn_worker` / `message_worker`,worker 拿不到;工具面在会话创建时由宿主裁剪,不是靠提示词约束模型。
125
+ - **完成由机制结算并自动唤醒**:worker 那一轮结束时,Leader 自动收到一条回报(渲染成 worker 的发言气泡),不轮询、不靠 worker 自觉。
126
+ - **worker 是常驻根会话**:能同时跑多个,人可以直接打开它的会话接着聊,进程重启后能冷恢复。代价是 Leader 侧不能强杀它,见[当前限制](#当前限制)。
127
+ - **项目会话有标签栏**:第一个标签是项目名(Leader 入口),点开的 worker 带着状态灯加入;栏右端是会话「更多」与右栏开关。关标签只丢快捷方式,会话仍在项目树里。
121
128
 
122
- 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.
123
- 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.
124
- 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.
125
- 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`.
126
- 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. Work mode is the default; choose Cinematic under Settings → Leader Agent → Task board.
129
+ ## 设计取舍
127
130
 
128
- ## Orchestration lives in files
131
+ - 这个项目不复刻 [DeepSeek Harness 团队的 Super-agent 研究原型](https://github.com/deepseek-ai/dsh-superagent-prototype)(研究原型,不是 DeepSeek 官方产品;它盯一个仓库、按事件起会话),要解决的是另一件事:让 1 个人管理 20 个以上的 Session,有 Leader、看板和并行任务([项目落地页 FAQ](https://fengshenx.github.io/dsh-leader-agent/#faq))。
132
+ - 你可以随时打开 worker 的会话,直接看它的消息流:做到哪、卡在哪,再决定打断或推进。
133
+ - routing 层用的是完整大模型,实际使用中,routing 层由于知道全局信息,经常能够把多个 PR 串起来思考,解决单 Worker 看不到的问题。
134
+ - Agent 编排的泛化。Card 是任务本身的描述,可以用在非编码场景,也可以和各种 Skill 集成。
135
+ - 项目还缺少一些初始化机制,实际使用时你需要在你的项目内初始化 `LEADER.md`(Leader 的人设 Prompt 以及编排流)和 `SLOTS.md`(任务的角色分工以及对应的人设 Prompt)。
136
+ - 项目设计成了 Leader 领导 Worker,Worker 之间绝不通信(Tool Use 层就杜绝了),因为当前的 Agent 被训练成了强指令遵循,两个 Agent 对话一旦出现一个错误的噪音,会把整个对话带偏。
129
137
 
130
- Three things, each covering one layer. All of them contribute prompt text only and grant no tool permissions:
138
+ ## 前提:多 worktree 隔离
131
139
 
132
- | File / skill | For whom | What it holds |
133
- |---|---|---|
134
- | `LEADER.md` | The Leader of this project | How to command this project: boundaries, card and dispatch granularity, hard constraints every brief must carry, acceptance criteria. Injected into the leader session, with no binding step |
135
- | `SLOTS.md` | Workers, by role | Per-role method and persona under `## <slot-name>` (`dev` / `review` / …). The card's `slots` field binds a slot to a session, and that session gets the section injected |
136
- | `leader-mode` skill | The Leader's protocol | Staged playbooks for discussion → design → implementation and delivery → review → merge, plus parallel-collaboration and handoff guidance |
140
+ 每个任务一个 worktree、一个独立 dsh 实例与数据根;否则并行任务会互相覆盖插件版本、争抢会话与数据。
137
141
 
138
- `LEADER.md` and `SLOTS.md` are evaluated before every model request and appended only when their text changes, so a change takes effect on the next request and nothing gets injected twice. The `leader-mode` skill takes a different path — the model loads it through the `skill` tool on demand, which is why the step above says load rather than configure. The target project's own `AGENTS.md` is read by the host's agent-instructions as a system-prompt section. Closing a card (`done` / `archived`) releases its executor: the slot binding and the card facts stop being injected together.
142
+ 建议把「建 worktree → 起实例」做成项目脚本:worktree 建好后还有依赖、独立实例与数据根要准备,手工做容易漏。本仓用 `npm run worktree:spawn <任务名>` 建 `.worktrees/<任务名>` 与 `feature/<任务名>` 并链接依赖,再用 `npm run dev` 起独立实例与数据根;这两个脚本就是本仓日常开发实际使用的,可以照抄或按项目改造。详见[开发](docs/development.md)与[架构](docs/architecture.md#项目与会话归属)。
139
143
 
140
- The plugin only reads `LEADER.md`. A `COORDINATOR.md` that merely points at it is a compatibility shim for external tools that still look for the old file name; it is never injected, and you do not need it otherwise.
144
+ ## 当前限制
141
145
 
142
- Slot names are ASCII identifiers (lowercase letters, digits, underscore, hyphen, up to 32 characters); display names come from the `slots:` frontmatter at the top of `SLOTS.md`. A project without `SLOTS.md` falls back to the default two roles `dev` / `review`.
146
+ - **后台编排需要长驻宿主**(web / desktop / sdk):headless 是一次性 CLI,没有载体接收回报。
147
+ - **Leader 能纠偏、不能中止 worker**:宿主的 subagent 工具对 worker 无效;真卡死只能请人进它的会话处理。
148
+ - **回报依赖轮次正常结束**:进程在 worker 跑完前被杀,那一轮不结算。
149
+ - **看板与项目树只对项目会话展示**;标签栏是 DOM 注入,状态按项目存在浏览器 localStorage。
150
+ - **卡片详情只能改链接或删卡**;其它卡片修改仍归 Leader 的工具。
151
+ - **项目注册表只经左栏操作**,项目会话与官方工作区树并存。
152
+ - **客户端与宿主版本耦合。**
143
153
 
144
- The `init-leader-agent` skill handles project setup: it merges the repository's engineering conventions into a managed block of the target project's `AGENTS.md`, then writes `LEADER.md` (how the Leader drives this project) and `SLOTS.md` (executor roles) from the bundled skeletons. Re-running only replaces the managed block, and both manuals are read before editing. An empty directory gets the TODO skeleton plus the three questions still unanswered — project facts are never invented.
154
+ 完整限制清单见[已知限制](docs/limitations.md)。
145
155
 
146
- For the full interaction — slot frontmatter details, archiving, swapping the Leader, how board status lights are derived — see the [usage manual](docs/usage.md) (Chinese).
156
+ ## 开发
147
157
 
148
- ## Prerequisites: get multi-worktree parallelism working first
149
-
150
- Running ten features in parallel requires real isolation between tasks: one worktree per task, one dsh instance per task, one data root per task, so tasks never overwrite each other's plugin version or compete for sessions and data. This repository's `scripts/worktree-*.mjs` and `scripts/dev.mjs` exist for exactly this ([Development](docs/development.md)); mechanisms and where each one lands are in [collaboration and documentation](docs/architecture.md#协作与文档机制) (Chinese).
151
-
152
- ## Current limitations
158
+ ```sh
159
+ npm run worktree:spawn <任务名> # 建 worktree + feature 分支
160
+ cd .worktrees/<任务名>
161
+ npm run dev # 起挂当前工作树的 dsh 实例
162
+ npm run check # 全量门禁
163
+ npm run e2e # 浏览器 e2e
164
+ ```
153
165
 
154
- - **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.
155
- - **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).
156
- - **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.
157
- - **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.
158
- - **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.
159
- - **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.
160
- - **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.
161
- - **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.
162
- - **The client is coupled to the host version.** Dialogs, menus and icons are copied from host sources, the Typert remote channel is a hand-written protocol shape, and the leader session layout depends on the host's session view service, so host upgrades require syncing this repository.
166
+ 数据根、实例覆盖项、构建契约与测试口径见[开发](docs/development.md);常用命令见 [AGENTS.md](AGENTS.md#常用命令)。`npm start` 起日常实例。
163
167
 
164
- The full list and trade-offs (status-light sources, watermark collapsing, avatars, the archive entry point, DOM injection positioning and more) live in [known limitations and trade-offs](docs/limitations.md) (Chinese).
168
+ ## 贡献
165
169
 
166
- ## Development
170
+ 改代码前先读 [AGENTS.md](AGENTS.md):worktree 纪律、验证要求与文档机制都在那里。最短路径是 `npm install` → `npm run check` → 开 PR;提交信息用中文,非平凡改动同 PR 带 `.agents/notes/` 决策笔记。
167
171
 
168
- ```sh
169
- npm run worktree:spawn <task> # create the worktree and feature branch
170
- cd .worktrees/<task>
171
- npm run dev # dsh instance mounting this worktree's plugin
172
- npm run check # full gate
173
- npm run e2e # browser e2e
174
- ```
172
+ ## 加入微信群
175
173
 
176
- Data roots, instance overrides, build constraints and the test policy are in [development](docs/development.md) (Chinese); the command index is in [AGENTS.md](AGENTS.md#常用命令) (Chinese). `npm start` runs the daily instance.
174
+ 欢迎本插件用户,以及对前沿 Agent 开发、多 Agent 编排感兴趣的朋友入群讨论:
177
175
 
178
- ## Contributing
176
+ <p align="center">
177
+ <img src="https://raw.githubusercontent.com/fengshenx/dsh-leader-agent/7daa10e0d4fed1240cdec8004b0c6021e47c0e2f/docs/assets/readme/wechat-group.jpg" alt="dsh-leader-agent 微信群二维码" width="320">
178
+ </p>
179
179
 
180
- Read [AGENTS.md](AGENTS.md) first: worktree discipline, verification requirements, and documentation rules live there. The short path is `npm install` → `npm run check` → open a PR. Commit messages are in Chinese, and non-trivial changes ship an `.agents/notes/` decision note in the same PR.
180
+ 二维码 7 天内有效,过期后会更新。
181
181
 
182
- ## Docs
182
+ ## 文档
183
183
 
184
- | Document | Contents |
184
+ | 文档 | 内容 |
185
185
  |---|---|
186
- | [AGENTS.md](AGENTS.md) | Repository rules and the task-routed reading index |
187
- | [docs/getting-started.md](docs/getting-started.md) | Walkthrough (Chinese): prerequisites, adding a project and its Leader, the two project files, one card from creation to drill-down |
188
- | [docs/usage.md](docs/usage.md) | Full interaction for dispatch, follow-ups, cards, board, project management, slots and manuals |
189
- | [docs/architecture.md](docs/architecture.md) | Layers, runtime model, data flow, persistence layout, host-contract landing spots |
190
- | [docs/limitations.md](docs/limitations.md) | Full known limitations and trade-offs |
191
- | [docs/development.md](docs/development.md) | Dev environment, instances, build contract, test policy |
192
- | [docs/capability-gaps.md](docs/capability-gaps.md) | Measured evidence for host capability boundaries (read before touching host-side code) |
193
- | [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/` |
194
- | [growing/](growing/) | Growth archive: case studies, copy, source files; media lives in OSS |
195
- | [.agents/notes/](.agents/notes/) | Decision memory for non-trivial changes |
196
- | [.agents/skills/leader-mode/](.agents/skills/leader-mode/) | Protocol layer: dispatch, handoff, event scheduling, card upkeep, acceptance |
197
- | [.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/` |
186
+ | [AGENTS.md](AGENTS.md) | 仓库铁律与按任务查阅入口 |
187
+ | [docs/getting-started.md](docs/getting-started.md) | 上手路线:使用前提、加项目与 Leader、两份项目文件、一张卡从创建到下钻 |
188
+ | [docs/usage.md](docs/usage.md) | 使用手册:项目、派工、卡片、看板、槽位与手册 |
189
+ | [docs/architecture.md](docs/architecture.md) | 分层、运行时模型、数据流、持久化布局、宿主契约落点 |
190
+ | [docs/limitations.md](docs/limitations.md) | 已知限制清单 |
191
+ | [docs/development.md](docs/development.md) | 开发环境、实例、构建契约与测试口径 |
192
+ | [docs/capability-gaps.md](docs/capability-gaps.md) | 宿主能力边界的实测依据(改宿主侧前先读) |
193
+ | [docs/e2e-testing.md](docs/e2e-testing.md) | 浏览器 e2e 车道(命令、夹具、mock 约定、截图)与人工取证规范;断言纪律与失败诊断见 `.agents/skills/e2e-scenarios/` |
194
+ | [growing/](growing/) | 增长资产索引:案例、文案、源文件;媒体在 OSS |
195
+ | [.agents/notes/](.agents/notes/) | 非平凡改动的决策记忆 |
196
+ | [.agents/skills/leader-mode/](.agents/skills/leader-mode/) | 协议层:派工、接力、事件调度、卡片维护、验收裁决 |
197
+ | [.agents/skills/promo-video/](.agents/skills/promo-video/) | 宣传片流水线(需本仓开发环境:Playwright + ffmpeg):分镜、旁白时间轴、录制与封面制作;旁白见 `doubao-tts/`,封面见 `promo-stills/` |
198
198
 
199
- ## Credits
199
+ ## 致谢
200
200
 
201
- 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.
201
+ 本方案在设计时参考过 **Cursor 的 Project 实现**与 **PStack 的编排机制**:把项目当成一等实体、按项目聚合会话与交付物,以及「leader 派工 / 执行者回报 / 交付看板」这条主线。
202
202
 
203
- 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.
203
+ 会话标签栏参考了 [dsh-session-tabs](https://github.com/QIN-SMART/dsh-session-tabs)(MIT)的主面板定位与标签持久化实现;完整第三方清单见 [THIRD_PARTY_LICENSE](THIRD_PARTY_LICENSE)。
204
204
 
205
- 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.
205
+ 也感谢 **DeepSeek Harness 团队**:宿主的插件契约,以及 worktree 并发、Agent Note、AGENTS.md 渐进式披露、文档防腐化这套工程实践,是本仓直接对照的来源。
206
206
 
207
- ## License
207
+ ## 许可证
208
208
 
209
209
  [MIT](LICENSE)
210
210
 
211
- Third-party notices: [THIRD_PARTY_LICENSE](THIRD_PARTY_LICENSE).
211
+ 第三方许可:[THIRD_PARTY_LICENSE](THIRD_PARTY_LICENSE)。