dsh-leader-agent 0.8.0 → 0.9.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 (48) 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 +3 -2
  5. package/README.md +10 -11
  6. package/README_ZH.md +10 -11
  7. package/lib/client.js +647 -295
  8. package/locale/de.json +22 -12
  9. package/locale/en.json +22 -12
  10. package/locale/es.json +22 -12
  11. package/locale/fr.json +22 -12
  12. package/locale/ja.json +22 -12
  13. package/locale/pt.json +22 -12
  14. package/locale/ru.json +22 -12
  15. package/locale/zh.json +22 -12
  16. package/package.json +1 -1
  17. package/src/client/agent-bubble-styles.js +4 -7
  18. package/src/client/board-mode.js +35 -77
  19. package/src/client/board-settings.js +311 -47
  20. package/src/client/board-styles.js +146 -59
  21. package/src/client/board.js +22 -13
  22. package/src/client/leader-changes.js +3 -7
  23. package/src/client/locales.generated.js +120 -40
  24. package/src/client/modal-shell.js +5 -9
  25. package/src/client/project-remote.js +22 -3
  26. package/src/client/project-section.js +3 -7
  27. package/src/client/session-tabs.js +3 -9
  28. package/src/client/style-sheet.js +32 -0
  29. package/src/client/toast-view.js +3 -7
  30. package/src/client/worker-task-styles.js +4 -7
  31. package/src/client/workspace-exclusion.js +4 -7
  32. package/src/host/dispatch.js +268 -52
  33. package/src/host/index.js +31 -5
  34. package/src/host/leader-context.js +7 -4
  35. package/src/host/projects/remote.js +45 -3
  36. package/src/host/settings-store.js +231 -0
  37. package/src/host/slots/slot-templates.js +71 -16
  38. package/src/host/tools/gate.js +2 -1
  39. package/src/host/tools/list-worker-models.js +204 -0
  40. package/src/host/tools/read-worker.js +15 -3
  41. package/src/host/tools/spawn-worker.js +46 -3
  42. package/src/host/worker-model.js +274 -0
  43. package/src/host/worker-sessions.js +31 -4
  44. package/src/host/worker-transcript.js +49 -52
  45. package/src/shared/projects.js +8 -2
  46. package/src/shared/settings.js +81 -0
  47. package/src/shared/truncate.js +49 -0
  48. package/src/shared/turn-failure.js +25 -0
@@ -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` 查,别编。
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` 查。模型只在建 worker 时定下,改这里只影响新派的工。
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 当前模型。模型只在建 worker 时定下,之后改 `SLOTS.md` 只影响新派的工,角色正文仍每轮更新。槽位绑定记在卡片的 `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`)、`read_worker_session`(回看它的会话回合:任务、正文、调过哪些工具、哪一步失败与原因;`turns`/`offset` 翻页;只读、不唤醒 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-动作与工具)。
88
88
 
89
89
  派工确保原简报、后续指令、实际产物与版本均可沿指针完整恢复,不依赖「done」摘要继承变更。按 [leader 传话纪律](playbooks/program.md#输出与传话纪律)保留边界与验收,已落盘正文不抄入派单。按宿主与任务权限使用 worker;现有 owner 与 worktree 状态能可信恢复时续跑,新上下文更合适时新派,不能丢原约束。停止/恢复遵守用户指令与宿主契约;能力不可用明确 limitation,不声称多模型独立评估。
90
90
 
@@ -9,6 +9,7 @@
9
9
  | 动作 | 工具 |
10
10
  |---|---|
11
11
  | 建 worker 会话(不开工,立即返回) | `spawn_worker` |
12
+ | 查 worker 可用的模型 route 与 effort | `list_worker_models` |
12
13
  | 投递任务 / 续聊 / 改名(第一条消息即开工) | `message_worker` |
13
14
  | 读 worker 回报 | 完成通知(无需轮询) |
14
15
  | 回看 worker 的会话过程(不唤醒它) | `read_worker_session` |
@@ -18,7 +19,7 @@
18
19
 
19
20
  派工分两步:`spawn_worker` 只建常驻 worker 会话并立即返回会话 id,**不产生模型调用**;`message_worker` 投递第一条消息时才开工。分两步是为了让槽位绑定先落盘——第一条任务请求组装时角色槽位与卡片事实就已经在上下文里。worker 那一轮结束时自动唤醒你并附完成通知,同一轮里可连派多个工。
20
21
 
21
- 建 worker 必须给 `name`:它是 worker 的显示名,也直接成为它的会话标题——侧栏与项目树里看到的就是这个名字,所以用角色-任务短名(如 `research-sources`),不要写成长句。要挂卡就在同一次调用里给 `cardId` 与 `slot`(两者成对),卡必须是本项目的、状态为 `active`(跨项目、已关闭或已归档的卡会被拒绝);绑定在返回前完成。worker 换了角色用 `message_worker` 的 `rename` 顺手改名,不必为此另派新工。
22
+ 建 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 也可以,套在最终模型上。模型在建会话时定下,事后改 `SLOTS.md` 只影响新派的工;回执里的「模型」一行写明最终 route 与来源。worker 换了角色用 `message_worker` 的 `rename` 顺手改名,不必为此另派新工。
22
23
 
23
24
  建完立刻投递:`spawn_worker` 之后不投任务的 worker 只是一条空闲会话,占名册也可能被误当成在跑。投递用 `message_worker`(worker 挂着未完成卡时 `cardId` 必填且必须一致),消息只写「做什么、边界、验收与指针」;卡片规格、链接与 revision 由宿主注入,不要抄进消息。
24
25
 
@@ -30,7 +31,7 @@ worker 的一切交互只有 `spawn_worker`、`message_worker` 与只读的 `rea
30
31
 
31
32
  worker 连续 15 分钟没有任何回报时,机制侧会注入一条带 **`【后台巡查】`** 前缀的例行检查提醒(与完成通知同一条通道,但正文自带前缀与会话 id,不是 worker 的回报;不一定是卡住,也不代表任务失败)。收到后先 `read_worker_session` 回看它最近几轮卡在哪一步,再决定继续等待、用 `message_worker` 纠偏,还是请人在它的会话里处理;不要因为收到提醒就重复追问或重派同一件活。提醒每 15 分钟至多一条,本流程仍没有中止手段。
32
33
 
33
- worker 的产物摘要在完成通知里,不需要轮询查询。**要看过程用 `read_worker_session`**:它直读 worker 的会话日志(`sessionId` 必填,`turns` 默认 2、最多 20),给出每轮的任务正文、worker 说过的正文、调过哪些工具与失败原因。只读、不唤醒 worker、不产生模型调用,worker 正在跑也能读(读到的是已落盘部分,最后一轮会标「进行中」)。正文有条目上限与总量上限,读不到全部历史是设计如此。需要 worker 补充解释、或者要它接着动手时,才用 `message_worker`——worker 正在跑时消息在它的下一步注入当前轮次(算纠偏,不是另起一轮),空闲时直接开新回合。
34
+ worker 的产物摘要在完成通知里,不需要轮询查询。**要看过程用 `read_worker_session`**:它直读 worker 的会话日志(`sessionId` 必填,`turns` 默认 2、最多 20,`offset` 跳过最新回合往更早翻页),给出每轮的任务正文、worker 说过的正文、调过哪些工具与失败原因。只读、不唤醒 worker、不产生模型调用,worker 正在跑也能读(读到的是已落盘部分,最后一轮会标「进行中」)。正文有条目上限与单页总量上限,超出时按页末给出的 `offset` 继续翻;完成通知被截断时也照此回看。需要 worker 补充解释、或者要它接着动手时,才用 `message_worker`——worker 正在跑时消息在它的下一步注入当前轮次(算纠偏,不是另起一轮),空闲时直接开新回合。
34
35
 
35
36
  ## Orchestrate
36
37
 
package/README.md CHANGED
@@ -27,13 +27,12 @@
27
27
 
28
28
  ## Highlights
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. **One Leader drives development and review** — state the goal once: it opens cards, dispatches workers, watches each one finish, checks the deliverable and organizes review. Target: ten features in flight at once.
31
+ 2. **A board that shows who is working** — one per project, as a **Work** list or a **Cinematic** workflow map. Cards carry the executor slot and a live status light; click a card for its spec, or a slot to drill into that agent's session and keep talking.
32
+ 3. **Arrangement lives in two files** — `LEADER.md` holds the Leader's prompt and this project's rules, `SLOTS.md` gives each worker role its own. Edits apply on the next request, with no session rebuild.
33
+ 4. **Many projects in parallel, one Leader each** — adding a project binds a leader session and lists its workers; deleting it keeps the folder and sessions, and a new Leader inherits the workers plus undelivered reports.
34
+ 5. **A protocol skill, not a persona line** — `leader-mode` stages the work from discussion through design, delivery, review and merge, with playbooks for parallel collaboration and handoff.
35
+ 6. **A stall surfaces instead of hanging** — a worker with no report for 15 minutes triggers a background patrol notice (【后台巡查】) carrying its card, last report and a copy-pasteable read-back call; `read_worker_session` then replays what it did, read-only and without waking it.
37
36
 
38
37
  ## Install
39
38
 
@@ -84,7 +83,7 @@ For pinning a version, removing it, development installs, or trying it without a
84
83
 
85
84
  **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.
86
85
 
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).
86
+ Switch under **Settings → Leader Agent → Task board**; the choice is stored per instance. Work-mode shot is a real session; cinematic shot is the browser e2e fixture (real host + local mock).
88
87
 
89
88
  ## How it runs
90
89
 
@@ -121,13 +120,13 @@ Three mechanisms make this more than "a smarter prompt":
121
120
 
122
121
  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
122
  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.
123
+ 3. **Dispatch.** `spawn_worker` requires `name` (a short role-task handle); `cardId` + `slot` optionally bind the card's executor slot in the same call. Pass `model` / `effort` to run it on another model; defaults: the bound slot's `SLOTS.md`, then the Leader's. 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. Use `read_worker_session` to see the turn's tools and failures without waking it.
125
124
  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
125
  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.
127
126
 
128
127
  ## Orchestration lives in files
129
128
 
130
- Three things, each covering one layer. All of them contribute prompt text only and grant no tool permissions:
129
+ Three things, one layer each. None grant tool permissions; the two manuals contribute prompt text, and slots may set default models:
131
130
 
132
131
  | File / skill | For whom | What it holds |
133
132
  |---|---|---|
@@ -139,7 +138,7 @@ Three things, each covering one layer. All of them contribute prompt text only a
139
138
 
140
139
  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.
141
140
 
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`.
141
+ 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`. Slots may set default `model` / `effort`; dispatch otherwise uses the Leader's model, fixed at spawn.
143
142
 
144
143
  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.
145
144
 
package/README_ZH.md CHANGED
@@ -27,13 +27,12 @@
27
27
 
28
28
  ## 亮点
29
29
 
30
- 1. **通过一个 Leader,帮你推进开发和 Review** — 你只跟 Leader 说目标,它拆卡、派工、盯住每个 worker 的完成、验证产物、组织审查。注意力回到「要什么」上,不用逐个陪跑——目标规模是一次并行开发 10 个 feature。
31
- 2. **右栏 SidePanel 看板,正在工作的 Agent 一目了然** — 一个项目一块看板,两套呈现:**工作**(默认)保持纯列表,**炫酷**把卡片画成线路图、纯演示与社交媒体传播用,`设置 → Leader Agent → 任务看板` 切换。卡面上是执行者槽位与实时信号灯,卡片说明按 Markdown 渲染,链接可在浮层里直接编辑,详情页脚可删除卡片;点卡面看详情(目标、范围、验收、链接,其余只读),点槽位直接下钻进那个 Agent 的会话接着聊。worker 的回报按 Markdown 渲染成左侧 agent 气泡;leader 派过去的任务渲染成右侧用户气泡,正文与 assistant 内容同套 Markdown;单换行按 Markdown 合并,需要断行用空行或 Markdown 语法。
32
- 3. **Agent 自由编排** — 拆成两份文件:`LEADER.md` 写 Leader 的 prompt 与项目编排规则(职责边界、派工要求、验收口径);`SLOTS.md` 按角色给 worker 写编排规则(开发 / 审核……)。两者在每次模型请求前求值、正文变化才追加,改文件即改行为,不用重建会话。
33
- 4. **多项目并行,每个项目一个 Leader** — 左栏加一个项目就绑定一个 leader 会话,项目树列出它派出的 worker;项目行可拖拽排序,删除项目只删记录、保留文件夹与会话(dsh 工作区不受影响)。项目之间各管各的。换 Leader 时原班 worker 与未投递的回报一并改投新会话,新 Leader 直接接着派。
34
- 5. **`leader-mode` skill,给 Leader 的编排 Skill** — 不是一句「你是 tech lead」:按技术讨论 → 设计 → 实现交付 → 审查 → 合入分阶段给 playbook,另有并行协作与交接规范。
35
- 6. **回看 worker 的会话过程,不必唤醒它** — `read_worker_session` 直读 worker 的会话日志,给出每轮的任务、正文、调过哪些工具与失败原因。只读:不唤醒 worker、不产生模型调用。完成通知负责「产物是什么」,它负责「过程是怎样的」,排查不必再开一轮。
36
- 7. **worker 长时间没动静会收到巡查提醒** — Leader 发起的一轮超过 15 分钟没有任何回报时,机制侧注入一条带「【后台巡查】」前缀的普通文本提醒:挂着的卡、已连续多久、最后回报在哪、可照抄的回看调用。每 15 分钟至多一条,不轮询、不假装还活着。
30
+ 1. **通过一个 Leader,帮你推进开发和 Review** — 你只说一次目标:它拆卡、派工、盯住每个 worker 的完成、验证产物、组织审查。目标规模是一次并行开发 10 个 feature。
31
+ 2. **一块看得见谁在干活的看板** — 一个项目一块,**工作**列表或**炫酷**线路图两种呈现;卡面是执行者槽位与实时信号灯,点卡看详情,点槽位直接钻进那个 Agent 的会话接着聊。
32
+ 3. **编排规则写进两份文件** — `LEADER.md` 写 Leader 的 prompt 与本项目的编排规则,`SLOTS.md` 按角色给 worker 写。改文件即改行为,下一次请求生效,不用重建会话。
33
+ 4. **多项目并行,每个项目一个 Leader** — 加项目即绑定一个 leader 会话并列出它派出的 worker;删项目只删记录、保留文件夹与会话;换 Leader 时原班 worker 与未投递的回报一并改投。
34
+ 5. **给 Leader 的编排 Skill,不是一句人设** — `leader-mode` 按讨论 → 设计 → 实现交付 → 审查 → 合入分阶段给 playbook,另有并行协作与交接规范。
35
+ 6. **卡住的任务会浮出来,不会无限等** — worker 超过 15 分钟没有回报时,会触发一条带「【后台巡查】」前缀的提醒,附挂着的卡、最后回报与可照抄的回看调用;`read_worker_session` 只读回放它做过什么,不唤醒 worker。
37
36
 
38
37
  ## 安装
39
38
 
@@ -84,7 +83,7 @@ profile 名必须用 `web`;自定义名不在 `PROFILE_TEMPLATES` 里,装出
84
83
 
85
84
  **炫酷模式**:同一块看板画成线路图——卡片挂主干,执行者是右侧支线,只有执行中的支线跑光点。纯演示,社交媒体传播用。图为深色主题;浅色宿主下是电蓝正交线条。
86
85
 
87
- 在 **设置 → Leader Agent → 任务看板** 切换,选择只存本浏览器;工作模式截图取自真实会话,炫酷模式取自 e2e 夹具(真实宿主 + 本地 mock)。
86
+ 在 **设置 → Leader Agent → 任务看板** 切换,选择只存本实例;工作模式截图取自真实会话,炫酷模式取自 e2e 夹具(真实宿主 + 本地 mock)。
88
87
 
89
88
  ## 它是怎么跑起来的
90
89
 
@@ -121,13 +120,13 @@ profile 名必须用 `web`;自定义名不在 `PROFILE_TEMPLATES` 里,装出
121
120
 
122
121
  1. **加项目**:左栏「项目」区块点「加项目」,选一个目录。项目当场建好并绑定一个 leader 会话;点项目行就是打开这个 Leader。当前会话属于该项目时左栏按两层回执:打开的是 leader 会话则项目行整行亮,打开的是它派出的 worker 则项目行只点亮行首应用格子、选中态落在那个 worker 自己的会话行上。行首槽位平时是应用格子图标(宿主 `apps-add-outline`:三格 + 一个加号;替掉宿主的目录图标,免得侧边栏里「项目」和「工作区」同形),活动提示看 leader:它在跑就换成加载圈(leader 没有自己的行,项目展开着也照换),项目收起时名下有 worker 在跑也换成加载圈,展开后 worker 由会话行自己带加载圈。
123
122
  2. **加载协议**:leader 会话里让模型加载 `leader-mode`,先读 `playbooks/program.md`,再按阶段读对应 playbook。
124
- 3. **派工**:`spawn_worker` 只要求 `name`(角色-任务短名),可带 `cardId` + `slot` 一次把卡槽位绑好;工具立即返回会话 id,此时 worker **还没开工**。用 `message_worker` 投递任务正文(`sessionId` + `message`,可顺手 `rename`),第一条消息才开工;挂卡 worker 的请求会自动带上卡片事实,消息里不必抄 spec。worker 的沙箱模式与审批策略在派工那一刻从 leader 继承(leader 是 Auto 时连审查门一起继承),回执里写明它实际以什么权限在跑,完全权限会被点名。要看它这一轮怎么做的(调了哪些工具、哪步失败),用 `read_worker_session` 回看,不必唤醒它。
123
+ 3. **派工**:`spawn_worker` 只要求 `name`(角色-任务短名),可带 `cardId` + `slot` 一次绑好卡槽位,也可带 `model` / `effort`;默认取绑定槽位的 `SLOTS.md`,再回落 leader 模型。工具立即返回会话 id,此时 worker **还没开工**。用 `message_worker` 投递任务正文(`sessionId` + `message`,可顺手 `rename`),第一条消息才开工;挂卡 worker 的请求会自动带上卡片事实,消息里不必抄 spec。worker 的沙箱与审批在派工那一刻从 leader 继承(Auto 连审查门一起继承),回执写明实际权限,完全权限会被点名。用 `read_worker_session` 回看它这一轮调了哪些工具、哪步失败,不必唤醒它。
125
124
  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` 续读。
126
125
  5. **看看板**:右栏「看板」Tab,按当前会话所属项目拉卡片。leader 建卡后自动打开;点卡面看详情(链接可编辑、可删卡,其余只读),点槽位 chip 打开执行者会话。工作模式是默认;想切炫酷,在 `设置 → Leader Agent → 任务看板` 选「炫酷模式」。
127
126
 
128
127
  ## 编排:把规则写进文件
129
128
 
130
- 三份东西各管一层,都只贡献提示词,不授予工具权限:
129
+ 三份不授权工具;手册贡献提示词,槽位可声明默认模型:
131
130
 
132
131
  | 文件 / skill | 写给谁 | 管什么 |
133
132
  |---|---|---|
@@ -139,7 +138,7 @@ profile 名必须用 `web`;自定义名不在 `PROFILE_TEMPLATES` 里,装出
139
138
 
140
139
  插件只读 `LEADER.md`。项目里另放一个只指向它的 `COORDINATOR.md` 是给仍按旧文件名找 leader 手册的外部工具用的兼容入口,不参与注入;没有那个工具就不需要建。
141
140
 
142
- 槽位名是 ASCII 标识(小写字母、数字、下划线、连字符,最长 32 字符),界面显示名由 `SLOTS.md` 顶部 frontmatter 的 `slots:` 声明。没写 `SLOTS.md` 的项目回落默认两角色 `dev` / `review`。
141
+ 槽位名是 ASCII 标识(小写字母、数字、下划线、连字符,最长 32 字符),界面显示名由 `SLOTS.md` 顶部 frontmatter 的 `slots:` 声明。没写 `SLOTS.md` 的项目回落默认两角色 `dev` / `review`。槽位可声明默认 `model` / `effort`;没给就回落到 Leader 模型,建会话时定下。
143
142
 
144
143
  `init-leader-agent` skill 管项目初始化:先把仓库工程约定并入目标项目 `AGENTS.md` 的受管区块,再按包内骨架写 `LEADER.md`(leader 怎么指挥这个项目)与 `SLOTS.md`(执行者角色)。重复执行只替换受管区块,两份手册先读后改;空目录写带 TODO 的骨架,并把还没答的三个问题问清楚,不编造项目事实。
145
144