dsh-leader-agent 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/e2e-scenarios/SKILL.md +63 -0
- package/.agents/skills/leader-mode/playbooks/program.md +1 -1
- package/README.md +4 -4
- package/README_ZH.md +4 -4
- package/lib/client.js +497 -146
- package/package.json +2 -2
- package/src/client/{worker-report-styles.js → agent-bubble-styles.js} +28 -28
- package/src/client/agent-bubble-view.js +142 -0
- package/src/client/board-projection.js +39 -0
- package/src/client/board-styles.js +25 -1
- package/src/client/board.js +27 -1
- package/src/client/bubble-clock.js +30 -0
- package/src/client/card-links-editor.js +1 -1
- package/src/client/icons.js +16 -15
- package/src/client/index.js +30 -20
- package/src/client/markdown.js +1 -1
- package/src/client/project-panel.js +46 -7
- package/src/client/project-section.js +26 -16
- package/src/client/session-completion.js +89 -0
- package/src/client/session-watermark.js +70 -23
- package/src/client/worker-report-avatar.js +1 -1
- package/src/client/worker-report-definition.js +3 -2
- package/src/client/worker-report-view.js +22 -156
- package/src/client/worker-task-definition.js +72 -0
- package/src/client/worker-task-styles.js +97 -0
- package/src/client/worker-task-view.js +84 -0
- package/src/host/dispatch.js +26 -21
- package/src/host/message.js +0 -25
- package/src/host/projects/service.js +49 -37
- package/src/host/tools/message-worker.js +7 -7
- package/src/host/worker-sessions.js +71 -11
- package/src/host/worker-transcript.js +5 -4
- package/src/shared/message-text.js +64 -0
- package/src/shared/worker-report.js +6 -41
- package/src/shared/worker-task.js +33 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: e2e-scenarios
|
|
3
|
+
description: 写浏览器 e2e 场景与排查失败:断言锚、等待预算、失败读数、双向验证、把目标会话放进项目树。要新增/修改 tests/e2e 场景、或 e2e 红了要定位时使用。
|
|
4
|
+
whenToUse: 新增或修改 tests/e2e/*.e2e.js、给 UI 行为留可复现证据、或排查一条 e2e 失败时。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 浏览器 e2e 场景
|
|
8
|
+
|
|
9
|
+
e2e 的判据是「真实宿主 + 真实 chromium 里,可观察行为是否成立」。车道命令、文件职责、场景模板、mock 约定与截图落点见 [docs/e2e-testing.md](https://github.com/fengshenx/dsh-leader-agent/blob/main/docs/e2e-testing.md);宿主方案的由来与从宿主搬来的确定性规则见[笔记](https://github.com/fengshenx/dsh-leader-agent/blob/main/.agents/notes/implemented/testing/2026-11-04-e2e-host-approach-and-determinism.md)。本技能只讲写场景与排查时的方法。
|
|
10
|
+
|
|
11
|
+
## 适用场景
|
|
12
|
+
|
|
13
|
+
- 新增一条场景,要证明某个界面行为在真实宿主里成立。
|
|
14
|
+
- 给一个 bug 修完补回归,先让场景在修复前变红。
|
|
15
|
+
- 一条 e2e 红了,要区分「数据没到」「渲染错了」「清理挂了」。
|
|
16
|
+
|
|
17
|
+
## 断言纪律
|
|
18
|
+
|
|
19
|
+
- **断言外部世界**:DOM 的 class、`getComputedStyle` 的具体属性、磁盘上的 JSON。不读 agent 的自述文本,不拿页面里的推理文字当证据。
|
|
20
|
+
- **等状态,不睡时间**。`waitFor()` 轮询到条件成立;locator 用 `contenteditable="true"`、`data-*`、可见文本这类状态条件,让 playwright 自己等。
|
|
21
|
+
- **等待预算按正常耗时给**。实测单场景 3–8 秒、元素 1–2 秒到位:首次启动 20 秒、元素状态 15 秒。写 60 秒/90 秒只会让失败多等一整分钟,还把「机器慢」与「等错了元素」混成同一个症状。慢机与 2 核 CI 用 `E2E_BUDGET_SCALE=1.5` 整体放大(测试级上限走 `scenarioTimeout()`,取同一个倍率)。
|
|
22
|
+
- **失败要带读数**。元素等待走 `waitForLocator()`:失败时报 locator、目标元素读数(计数、`visible`、边界盒、`display` / `visibility` / `checkVisibility`、宽高)与页面读数(会话行、工作区行、插件元素计数)。目标读数用来分开「不在 DOM」「在 DOM 但 `display:none`」「在 DOM 但零尺寸」——只数 count 时这三种是同一句超时。读数自身限 2 秒,页面主线程卡死时退化成 `{ unavailable }`;自定义读数用 `describePage()`。细节见[e2e 失败预算](https://github.com/fengshenx/dsh-leader-agent/blob/main/.agents/notes/implemented/testing/2026-11-04-e2e-failure-budget.md)。
|
|
23
|
+
- **造状态用 seed**:目标状态直接写进数据文件(`<home>/dsh-leader-agent/cards.json`、`projects.json`),让界面去读。靠反复重启、反复点 UI 去凑瞬时态,永远对不齐。
|
|
24
|
+
- **标识符必须来自本次运行**:端口、token、会话 id、数据根都从本次实例取,不硬编码上一轮残留的值。
|
|
25
|
+
|
|
26
|
+
## 双向验证
|
|
27
|
+
|
|
28
|
+
撤掉修复 → 断言必须变红 → 还原 → 变绿。绿了但撤掉修复也绿,说明断言没守住任何东西。
|
|
29
|
+
|
|
30
|
+
- 验证的是断言,不是实现:先怀疑断言有没有落在真实可观测量上,再怀疑修复。
|
|
31
|
+
- 一次只改一个变量:两个变量同时变,失败原因就分不开。
|
|
32
|
+
- 把「撤掉什么、红了哪条、报什么读数」写进 PR;没有读数的「已双向验证」不算证据。
|
|
33
|
+
|
|
34
|
+
## 失败诊断
|
|
35
|
+
|
|
36
|
+
1. **先看耗时**:单场景正常 3–8 秒(全量约 10 秒)。跑了一分钟还没结束,先怀疑某个等待在等不会出现的元素(典型:`lib/client.js` 没构建、会话行没渲染),不是机器慢。别用 `grep` / `head` 过滤输出,`TimeoutError` 里的 locator 就是线索。报错头是「等待失败:…」而不是「等待超时」时,先看页面或浏览器是不是已经关掉、崩了——那不是选择器的问题。测试级上限 90 秒(`scenarioTimeout()`,随 `E2E_BUDGET_SCALE` 放大);清理链上实例与 mock 卡住会变成带名字的失败,浏览器关闭超时只告警并继续。
|
|
37
|
+
2. 先看 `problems`(pageerror / console.error)。本仓出过「圆点不亮」查不出原因的情况,根因是三处空 `catch`:保留会话失败、订阅就绪失败,全都吞掉,界面上只剩一个空心圈。失败必须报告,且同一目标只报一次。
|
|
38
|
+
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
|
+
4. 看 `instance.logs`(子进程 stdout/stderr 全量)与 `mock.requests`:模型请求到底有没有发出来、打到哪个端点、带没带标记。
|
|
40
|
+
5. **区分「数据没到」与「渲染错了」**:落盘文件里有没有、DOM 里有没有,分开查;字段不在就是数据层的问题,不在渲染层。
|
|
41
|
+
6. **一次性日志优于每帧日志**:首次读数打一条就够,高频刷新会把控制台淹掉。
|
|
42
|
+
7. 起不来先看源 profile:`dsh` 不在 PATH、profile 缺 web app bundle、node_modules 没装,报错都会直接说明。
|
|
43
|
+
|
|
44
|
+
## 搭场景:让目标会话出现在射击位
|
|
45
|
+
|
|
46
|
+
要点的按钮长在某个会话行上(归档、打开、续聊),而这行出现在左栏需要同时满足三个条件。少一条,界面上什么都不会出现,症状还都一样「等不到」。
|
|
47
|
+
|
|
48
|
+
1. **只有登记过的 worker 会话进项目树**。`groupSessionsByProject()` 按调用方传入的 `isWorkerSession` 判身份,其余会话一律跳过(`src/host/projects/session-index.js`)——手工 New Session 造的普通会话永远不在项目树下,别指望在它上面点项目内的动作。要在项目树下取证,先让 worker 派工出来(worker 是普通根会话,会话头不带 `origin` 标记,只能按登记判定)。
|
|
49
|
+
2. **派工只认项目 leader**。身份来自 `projects.json` 的 `leaderSessionId`,判定读的是进程内镜像(`src/host/projects/service.js` 的 `isLeaderSession()`,镜像由 `loadIndex()` 从注册表填充)。要换 leader:停机 → 改 `projects.json` → 重启,热改文件不会被读到。
|
|
50
|
+
3. **mock 用首条用户消息判角色**。`firstUserText()` 含 `MOCK-WORKER-TASK` 就把该会话当 worker 首轮,直接吐文本、永不派工。所以 leader 会话的第一条消息只能带场景标记(如 `MOCK-LONG-REPORT`),worker 标记由 mock 拼进派工 task 里。
|
|
51
|
+
|
|
52
|
+
路径形式不是坑:项目目录与会话 cwd 都过 `realpath`(`src/host/projects/service.js:23`),`/tmp/...` 与 `/private/tmp/...` 判成同一个目录,不要在这上面找原因。
|
|
53
|
+
|
|
54
|
+
会话 id 从 `$DSH_HOME/sessions/--<编码后的 cwd>--/<id>` 里按 mtime 取最新,不要硬编码。左栏刷新靠窗口 focus 或整页 reload;`sessionsByProject` 每次调用都现查宿主会话注册表,不缓存,所以 reload 后仍看不到,问题在上面三条里,不在刷新时机。
|
|
55
|
+
|
|
56
|
+
**一次只改一个变量**。上面三条里任意两条同时变动,失败原因就分不开——本轮踩过:换会话与改项目目录一起做,成功之后把功劳记在了目录上,而真实原因是新会话的首条消息不再带 worker 标记。改一样、验一次、再改下一样。
|
|
57
|
+
|
|
58
|
+
## 边界
|
|
59
|
+
|
|
60
|
+
- 不为了 e2e 改生产代码:场景用现有 class 与 role;需要新选择器时那是一次产品决定,不夹带。
|
|
61
|
+
- 不把截图当断言:截图只解释「当时界面上是什么样」,回归靠断言。
|
|
62
|
+
- 不覆盖原生控件、浮层像素位置、WebKit / Firefox:这些走人工取证,PR 里如实标注。
|
|
63
|
+
- 不加 `--test-force-exit`:它会把漏清理从「挂住/超时变红」变成「绿着通过 + 孤儿进程」;有界清理见[e2e 清理笔记](https://github.com/fengshenx/dsh-leader-agent/blob/main/.agents/notes/implemented/testing/2026-11-04-e2e-shutdown-bounded.md)。
|
|
@@ -28,7 +28,7 @@ worker 是常驻根会话,人可以在项目树里打开它直接下钻对话
|
|
|
28
28
|
|
|
29
29
|
worker 的一切交互只有 `spawn_worker`、`message_worker` 与只读的 `read_worker_session` 三个入口。宿主的 `list_agents` / `send_message` / `interrupt_agent` 只认宿主 subagent 体系:我们的 worker 是普通根会话,不在它们的子会话名录里,传话与中止都落不到它身上(这三件已从你的工具面摘掉)。worker 卡住时只能请人去那个会话里处理。宿主另有同伴模型的一套同名工具,按成员名寻址,与本流程的 worker 不是同一批,同样不要混用。
|
|
30
30
|
|
|
31
|
-
worker 的产物摘要在完成通知里,不需要轮询查询。**要看过程用 `read_worker_session`**:它直读 worker 的会话日志(`sessionId` 必填,`turns` 默认 2、最多 20),给出每轮的任务正文、worker 说过的正文、调过哪些工具与失败原因。只读、不唤醒 worker、不产生模型调用,worker 正在跑也能读(读到的是已落盘部分,最后一轮会标「进行中」)。正文有条目上限与总量上限,读不到全部历史是设计如此。需要 worker 补充解释、或者要它接着动手时,才用 `message_worker
|
|
31
|
+
worker 的产物摘要在完成通知里,不需要轮询查询。**要看过程用 `read_worker_session`**:它直读 worker 的会话日志(`sessionId` 必填,`turns` 默认 2、最多 20),给出每轮的任务正文、worker 说过的正文、调过哪些工具与失败原因。只读、不唤醒 worker、不产生模型调用,worker 正在跑也能读(读到的是已落盘部分,最后一轮会标「进行中」)。正文有条目上限与总量上限,读不到全部历史是设计如此。需要 worker 补充解释、或者要它接着动手时,才用 `message_worker`——worker 正在跑时消息在它的下一步注入当前轮次(算纠偏,不是另起一轮),空闲时直接开新回合。
|
|
32
32
|
|
|
33
33
|
## Orchestrate
|
|
34
34
|
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
## Highlights
|
|
29
29
|
|
|
30
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. Each card carries its executor slot and a live status light, its note renders as Markdown, and its links are editable in place. 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 the
|
|
31
|
+
2. **A right SidePanel board: see who is working at a glance** — One board per project. Each card carries its executor slot and a live status light, its note renders as Markdown, and its links are editable in place. 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
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
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.
|
|
@@ -122,7 +122,7 @@ Three mechanisms make this more than "a smarter prompt":
|
|
|
122
122
|
|
|
123
123
|
## Five steps
|
|
124
124
|
|
|
125
|
-
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
|
|
125
|
+
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.
|
|
126
126
|
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.
|
|
127
127
|
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.
|
|
128
128
|
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` / `slots` belong to the Leader (the first two are the acceptance anchor and injected content, the last two decide who executes and whether the card counts as done).
|
|
@@ -140,7 +140,7 @@ Three things, each covering one layer. All of them contribute prompt text only a
|
|
|
140
140
|
|
|
141
141
|
`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
142
|
|
|
143
|
-
The plugin only reads `LEADER.md`. A `COORDINATOR.md` that merely points at it is a compatibility shim for external tools
|
|
143
|
+
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
144
|
|
|
145
145
|
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
146
|
|
|
@@ -192,7 +192,7 @@ Read [AGENTS.md](AGENTS.md) first: worktree discipline, verification requirement
|
|
|
192
192
|
| [docs/limitations.md](docs/limitations.md) | Full known limitations and trade-offs |
|
|
193
193
|
| [docs/development.md](docs/development.md) | Dev environment, instances, build contract, test policy |
|
|
194
194
|
| [docs/capability-gaps.md](docs/capability-gaps.md) | Measured evidence for host capability boundaries (read before touching host-side code) |
|
|
195
|
-
| [docs/e2e-testing.md](docs/e2e-testing.md) | Browser e2e lane (commands, fixtures, mock conventions,
|
|
195
|
+
| [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/` |
|
|
196
196
|
| [.agents/notes/](.agents/notes/) | Decision memory for non-trivial changes |
|
|
197
197
|
| [.agents/skills/leader-mode/](.agents/skills/leader-mode/) | Protocol layer: dispatch, handoff, event scheduling, card upkeep, acceptance |
|
|
198
198
|
|
package/README_ZH.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
## 亮点
|
|
29
29
|
|
|
30
30
|
1. **通过一个 Leader,帮你推进开发和 Review** — 你只跟 Leader 说目标,它拆卡、派工、盯住每个 worker 的完成、验证产物、组织审查。注意力回到「要什么」上,不用逐个陪跑——目标规模是一次并行开发 10 个 feature。
|
|
31
|
-
2. **右栏 SidePanel 看板,正在工作的 Agent 一目了然** — 一个项目一块看板。卡面上是执行者槽位与实时信号灯,卡片说明按 Markdown 渲染,链接可在浮层里直接编辑;点卡面看详情(目标、范围、验收、链接,其余只读),点槽位直接下钻进那个 Agent 的会话接着聊。worker
|
|
31
|
+
2. **右栏 SidePanel 看板,正在工作的 Agent 一目了然** — 一个项目一块看板。卡面上是执行者槽位与实时信号灯,卡片说明按 Markdown 渲染,链接可在浮层里直接编辑;点卡面看详情(目标、范围、验收、链接,其余只读),点槽位直接下钻进那个 Agent 的会话接着聊。worker 的回报按 Markdown 渲染成左侧 agent 气泡;leader 派过去的任务渲染成右侧用户气泡,正文与 assistant 内容同套 Markdown;单换行按 Markdown 合并,需要断行用空行或 Markdown 语法。
|
|
32
32
|
3. **Agent 自由编排** — 拆成两份文件:`LEADER.md` 写 Leader 的 prompt 与项目编排规则(职责边界、派工要求、验收口径);`SLOTS.md` 按角色给 worker 写编排规则(开发 / 审核……)。两者在每次模型请求前求值、正文变化才追加,改文件即改行为,不用重建会话。
|
|
33
33
|
4. **多项目并行,每个项目一个 Leader** — 左栏加一个项目就绑定一个 leader 会话,项目树列出它派出的 worker;项目行可拖拽排序,删除项目只删记录、保留文件夹与会话(dsh 工作区不受影响)。项目之间各管各的。换 Leader 时原班 worker 与未投递的回报一并改投新会话,新 Leader 直接接着派。
|
|
34
34
|
5. **`leader-mode` skill,给 Leader 的编排 Skill** — 不是一句「你是 tech lead」:按技术讨论 → 设计 → 实现交付 → 审查 → 合入分阶段给 playbook,另有并行协作与交接规范。
|
|
@@ -124,7 +124,7 @@ dsh plugin --profile web add dsh-leader-agent
|
|
|
124
124
|
|
|
125
125
|
## 五步上手
|
|
126
126
|
|
|
127
|
-
1. **加项目**:左栏「项目」区块点「加项目」,选一个目录。项目当场建好并绑定一个 leader 会话;点项目行就是打开这个 Leader。当前会话属于该项目时左栏按两层回执:打开的是 leader 会话则项目行整行亮,打开的是它派出的 worker
|
|
127
|
+
1. **加项目**:左栏「项目」区块点「加项目」,选一个目录。项目当场建好并绑定一个 leader 会话;点项目行就是打开这个 Leader。当前会话属于该项目时左栏按两层回执:打开的是 leader 会话则项目行整行亮,打开的是它派出的 worker 则项目行只点亮行首应用格子、选中态落在那个 worker 自己的会话行上。行首槽位平时是应用格子图标(宿主 `apps-add-outline`:三格 + 一个加号;替掉宿主的目录图标,免得侧边栏里「项目」和「工作区」同形),活动提示看 leader:它在跑就换成加载圈(leader 没有自己的行,项目展开着也照换),项目收起时名下有 worker 在跑也换成加载圈,展开后 worker 由会话行自己带加载圈。
|
|
128
128
|
2. **加载协议**:leader 会话里让模型加载 `leader-mode`,先读 `playbooks/program.md`,再按阶段读对应 playbook。
|
|
129
129
|
3. **派工**:`spawn_worker` 只要求 `name`(角色-任务短名),可带 `cardId` + `slot` 一次把卡槽位绑好;工具立即返回会话 id,此时 worker **还没开工**。用 `message_worker` 投递任务正文(`sessionId` + `message`,可顺手 `rename`),第一条消息才开工;挂卡 worker 的请求会自动带上卡片事实,消息里不必抄 spec。worker 的沙箱模式与审批策略在派工那一刻从 leader 继承(leader 是 Auto 时连审查门一起继承),回执里写明它实际以什么权限在跑,完全权限会被点名。要看它这一轮怎么做的(调了哪些工具、哪步失败),用 `read_worker_session` 回看,不必唤醒它。
|
|
130
130
|
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` / `slots` 都归 leader(前两者是验收锚点与注入内容,后两者决定谁在执行、卡是否算完成)。
|
|
@@ -142,7 +142,7 @@ dsh plugin --profile web add dsh-leader-agent
|
|
|
142
142
|
|
|
143
143
|
`LEADER.md` 与 `SLOTS.md` 在每次模型请求前求值、正文变化才追加:改动在下一个请求生效,没变的轮次不重复注入。`leader-mode` skill 走的是另一条路——模型按需调 `skill` 工具加载,所以上面第 2 步写的是「加载」而不是「配置」。目标项目自己的 `AGENTS.md` 由宿主的 agent-instructions 读成系统提示段落。卡片转为 `done` / `archived` 即释放执行者——槽位绑定与卡片事实一起停止注入。
|
|
144
144
|
|
|
145
|
-
插件只读 `LEADER.md`。项目里另放一个只指向它的 `COORDINATOR.md`
|
|
145
|
+
插件只读 `LEADER.md`。项目里另放一个只指向它的 `COORDINATOR.md` 是给仍按旧文件名找 leader 手册的外部工具用的兼容入口,不参与注入;没有那个工具就不需要建。
|
|
146
146
|
|
|
147
147
|
槽位名是 ASCII 标识(小写字母、数字、下划线、连字符,最长 32 字符),界面显示名由 `SLOTS.md` 顶部 frontmatter 的 `slots:` 声明。没写 `SLOTS.md` 的项目回落默认两角色 `dev` / `review`。
|
|
148
148
|
|
|
@@ -194,7 +194,7 @@ npm run e2e # 浏览器 e2e
|
|
|
194
194
|
| [docs/limitations.md](docs/limitations.md) | 完整已知限制与取舍 |
|
|
195
195
|
| [docs/development.md](docs/development.md) | 开发环境、实例、构建契约与测试口径 |
|
|
196
196
|
| [docs/capability-gaps.md](docs/capability-gaps.md) | 宿主能力边界的实测依据(改宿主侧前先读) |
|
|
197
|
-
| [docs/e2e-testing.md](docs/e2e-testing.md) | 浏览器 e2e 车道(命令、夹具、mock
|
|
197
|
+
| [docs/e2e-testing.md](docs/e2e-testing.md) | 浏览器 e2e 车道(命令、夹具、mock 约定、截图)与人工取证规范;断言纪律与失败诊断见 `.agents/skills/e2e-scenarios/` |
|
|
198
198
|
| [.agents/notes/](.agents/notes/) | 非平凡改动的决策记忆 |
|
|
199
199
|
| [.agents/skills/leader-mode/](.agents/skills/leader-mode/) | 协议层:派工、接力、事件调度、卡片维护、验收裁决 |
|
|
200
200
|
|