@yankeguo/dsh-tool-devlead 0.4.2-rc.5 → 0.4.2-rc.7

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 (3) hide show
  1. package/README.md +28 -15
  2. package/lib/index.js +23 -22
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -15,8 +15,8 @@ active lead.
15
15
  - `devlead_list_agent_presets` (Host Agent preset roster: id, name/description, default marker, broken reason)
16
16
  - `devlead_board_read` (user-visible project board, on by default for the active lead; id/title/workspace-path selection and bounded listings)
17
17
  - `devlead_board_update` (lead-only project create/set, blockers, tasks, and expected-revision CAS)
18
- - `devlead_board_note_read` (`project`, optional `note`; project note metadata or one Markdown body)
19
- - `devlead_board_note_write` (`project`, `operation: create|update|append|delete`, optional `note`, `title`, `summary`, `content`, `expected_revision`, and `expected_bytes` CAS)
18
+ - `devlead_board_note_read` (`project`, optional `note`; project note metadata or one Markdown body, with Host-derived `absolutePath` in every metadata result)
19
+ - `devlead_board_note_write` (`project`, `operation: create|update-metadata|delete`, optional `note`, `title`, `summary`, create-only `content`, and `expected_revision` CAS; existing bodies use DSH-native file tools)
20
20
  - `devlead_use_workspace`
21
21
  - `devlead_list_sessions`
22
22
  - `devlead_create_session` (optional `isolation: "none" | "worktree"`; creation-time
@@ -58,15 +58,22 @@ references still report `BOARD_PROJECT_NOT_FOUND`/`BOARD_PROJECT_AMBIGUOUS`. A b
58
58
  degrades the board only: the tools report `BOARD_IO_ERROR` while DevLead keeps working. The human is
59
59
  read-only; only the enabled lead AI writes.
60
60
  `devlead:board-summary` is a cache-safe `systemPrompt.context()` snapshot capped at 1536 UTF-8
61
- bytes; active-project rows include note counts and the latest note title when available.
61
+ bytes; active-project rows include note counts and the latest note title when available. The independent lead-only
62
+ `devlead:board-policy` section tells the model to maintain the board proactively, batch updates at dispatch/close and
63
+ material project changes, prefer note list/read before resuming or briefing, create/update metadata/delete through the
64
+ tool and then edit bodies with native file tools, reconcile stale state before reporting, and report board degradation
65
+ once instead of repeatedly retrying. Ordinary Sessions see neither text nor board tools.
62
66
 
63
67
  The two notes tools use the same active-lead gate and board-project id/title/absolute-path resolver,
64
- but never accept a notes file path. They read and mutate only `dirname(boardPath)/notes/`: the strict
68
+ but never accept a notes file path argument. They read and manage only `dirname(boardPath)/notes/`: the strict
65
69
  schema-v1 `index.json` contains `{ revision, updatedAt, projects:[{ id, directory, notes[] }] }` and
66
- metadata only, while each body is `<directory>/<note-id>.md`. Writes use a cross-process file lock,
67
- atomic replacement, index `expected_revision` CAS and note-body `expected_bytes` CAS. The index is
68
- limited to 128 KiB, each note to 256 KiB, and each project to 100 notes. The committed index is the
69
- source of truth; unindexed/orphan Markdown files are ignored. See
70
+ metadata only, while each body is `<directory>/<note-id>.md`. Every read/create/update-metadata/delete result adds a
71
+ Host-derived `absolutePath` to returned note metadata; it is not persisted in the disk index. `create` accepts an
72
+ optional initial body (default empty), `update-metadata` changes only title/summary, and `delete` removes the note.
73
+ Later body edits use DSH-native `read`/`write`/`edit` on `absolutePath`, never direct edits to `notes/index.json`.
74
+ Tool-managed index/metadata/deletion writes use a cross-process file lock, atomic replacement, and index
75
+ `expected_revision` CAS. The index is limited to 128 KiB, each note to 256 KiB of valid UTF-8, and each project to
76
+ 100 notes. The committed index is the source of truth; unindexed/orphan Markdown files are ignored. See
70
77
  [docs/BOARD.md](https://github.com/yankeguo/dsh-devlead/blob/main/docs/BOARD.md) for operation-specific
71
78
  arguments, stable `BOARD_*` errors, and corruption semantics.
72
79
 
@@ -192,13 +199,19 @@ workspace path/title 不再误报 `BOARD_LIMIT_EXCEEDED`,未知引用仍是
192
199
  `BOARD_PROJECT_NOT_FOUND`/`BOARD_PROJECT_AMBIGUOUS`。start 失败只降级看板(`BOARD_IO_ERROR`),
193
200
  不阻塞 DevLead。用户只读,只有 enabled lead AI 可通过工具写入。
194
201
  动态 `devlead:board-summary` 使用 cache-safe `systemPrompt.context()`,上限 1536 UTF-8 bytes;active
195
- 项目行在有数据时附带 note 数与最近标题。`devlead_board_note_read(project,note?)` 读取项目 notes
196
- metadata 或单条 Markdown 正文;`devlead_board_note_write` 接收 `project`、`operation`
197
- (create/update/append/delete)、可选 `note/title/summary/content` 与 `expected_revision/expected_bytes`
198
- CAS。project 仍按看板 id/title/绝对 path 解析,两个工具都不接受文件路径。notes 根目录固定为
199
- `dirname(boardPath)/notes/`,index 只含 metadata,正文路径固定为 `<directory>/<note-id>.md`;写入
200
- 使用跨进程文件锁与原子替换,index 是提交事实、orphan Markdown 忽略。index ≤128 KiB、单 note
201
- ≤256 KiB、每项目 ≤100 条。详见
202
+ 项目行在有数据时附带 note 数与最近标题。独立 lead-only `devlead:board-policy` 引导模型主动维护看板,在派发/收口和
203
+ 实质变化时批量更新,恢复/派发前优先用工具 list/read notes,用工具 create/更新 metadata/delete 后以原生文件工具
204
+ 编辑正文,汇报前对齐过期状态,看板降级只报告一次而不反复重试;普通 Session 看不到该文案或看板工具。
205
+ `devlead_board_note_read(project,note?)` 读取项目 notes metadata 或单条 Markdown 正文;
206
+ `devlead_board_note_write` 接收 `project`、`operation`(create/update-metadata/delete)、可选
207
+ `note/title/summary/content` 与 `expected_revision` CAS。create 的 content 是可选初始正文(默认空),
208
+ update-metadata 只改 title/summary;既有正文只能由原生文件工具修改。read/create/update-metadata/delete
209
+ 返回的每个 note metadata 都增加 Host 派生的 `absolutePath`(不写入磁盘 index),后续用 DSH 原生
210
+ `read`/`write`/`edit` 编辑该绝对路径,不要手改 `notes/index.json`。project 仍按看板 id/title/绝对 path 解析,
211
+ 两个工具都不接受文件路径参数。notes 根目录固定为 `dirname(boardPath)/notes/`,index 只含 metadata,正文路径固定为
212
+ `<directory>/<note-id>.md`;工具管理的 index/metadata/删除写入使用跨进程文件锁、原子替换与
213
+ `expected_revision` CAS,index 是提交事实、orphan Markdown 忽略。index ≤128 KiB、单 note ≤256 KiB 合法 UTF-8、
214
+ 每项目 ≤100 条。详见
202
215
  [docs/BOARD.md](https://github.com/yankeguo/dsh-devlead/blob/main/docs/BOARD.md)。`devlead_report` 返回 `{ report, durable, queued, warning? }`:报告先写入
203
216
  durable outbox,lead 日志 flush 成功后才清理;Host 无 storage 时 `durable:false` 并带 warning。
204
217
  报告参数:`message`(≤4000 码点)、
package/lib/index.js CHANGED
@@ -135,32 +135,28 @@ var TOOL_PARAMETERS = {
135
135
  operation: {
136
136
  type: "string",
137
137
  required: true,
138
- enum: ["create", "update", "append", "delete"],
139
- description: "create makes a new note; update replaces supplied title/summary/content fields; append adds content exactly to the existing body; delete removes the note from the index and its body when possible."
138
+ enum: ["create", "update-metadata", "delete"],
139
+ description: "create makes a new index entry and an optionally non-empty initial body; update-metadata changes only title/summary; delete removes the note from the index and its body when possible. Existing bodies are edited with DSH-native file tools, never through this tool."
140
140
  },
141
141
  note: {
142
142
  type: "string",
143
- description: "Note id. Required for update/append/delete. Optional for create: omit it to have the Host generate a UUID. Supplied ids must be filename-safe; do not pass paths or traversal segments."
143
+ description: "Note id. Required for update-metadata/delete. Optional for create: omit it to have the Host generate a UUID. Supplied ids must be filename-safe; do not pass paths or traversal segments."
144
144
  },
145
145
  title: {
146
146
  type: "string",
147
- description: "Non-empty display title, required for create and optionally replaced by update. Not accepted for append/delete. Maximum 200 UTF-16 code units."
147
+ description: "Non-empty display title, required for create and optionally replaced by update-metadata. Not accepted for delete. Maximum 200 UTF-16 code units."
148
148
  },
149
149
  summary: {
150
150
  type: "string",
151
- description: "Optional short metadata summary for create/update; defaults to empty on create and remains unchanged when omitted on update. Maximum 500 UTF-16 code units. Not accepted for append/delete."
151
+ description: "Optional short metadata summary for create/update-metadata; defaults to empty on create and remains unchanged when omitted on update-metadata. Maximum 500 UTF-16 code units. Not accepted for delete."
152
152
  },
153
153
  content: {
154
154
  type: "string",
155
- description: "Markdown body. Create defaults to empty; update replaces the body only when supplied; append requires this and adds it exactly as supplied; delete does not accept it. The resulting note is limited to 256 KiB UTF-8 and content is never duplicated into the index."
155
+ description: "Optional initial Markdown body for create only; defaults to empty. Not accepted for update-metadata/delete. The resulting note is limited to 256 KiB of valid UTF-8 and content is never duplicated into the index. Use the returned absolutePath with DSH-native file tools for later body edits."
156
156
  },
157
157
  expected_revision: {
158
158
  type: "integer",
159
159
  description: "Optional non-negative notes-index compare-and-swap revision from devlead_board_note_read. A stale value fails with BOARD_REVISION_CONFLICT before any mutation."
160
- },
161
- expected_bytes: {
162
- type: "integer",
163
- description: "Optional non-negative current-note UTF-8 byte count for update/append/delete. Use note.bytes from a prior result; a mismatch fails with BOARD_BYTES_CONFLICT. Not valid for create."
164
160
  }
165
161
  },
166
162
  devlead_use_workspace: {
@@ -1373,10 +1369,10 @@ function unarchivedSessionValue(unarchived) {
1373
1369
  }
1374
1370
 
1375
1371
  // packages/tool/src/board-tools.ts
1376
- var BOARD_READ_DESCRIPTION = "Read the user-visible DevLead project board: durable project status, priority, goal/focus/next, blockers, and optionally tasks. Omit project for a bounded all-project summary; select one by exact id, workspace title, or absolute workspace path for full detail. This board is read-only for the human and writable only by the lead AI through devlead_board_update. The board belongs to the active lead Session; its file location is derived from that Session workspace (or a deployment override) and is never a tool argument. Results are bounded and may be truncated:true; no active lead workspace (including a recorded workspace root that no longer exists) means BOARD_DISABLED.";
1377
- var BOARD_UPDATE_DESCRIPTION = "Update one project on the user-visible DevLead board; the human is read-only and only the enabled lead AI may write through this tool. Create requires create:true and set.workspace.path. Supports scalar status/priority/goal/focus/next updates, blocker clear/remove/add, and task remove/upsert. Use expected_revision from devlead_board_read for compare-and-swap when a lost update would matter. Returns only the changed project without task rows and the changed lanes, never the whole board. The file belongs to the active lead Session workspace and no argument can redirect it.";
1378
- var BOARD_NOTE_READ_DESCRIPTION = "Read Markdown notes attached to one existing DevLead board project. project is required and resolves exactly as in the other board tools. Omit note for the project's bounded metadata listing (id, title, summary, updatedAt, bytes, and root-relative path); provide its id for Markdown content plus metadata. A single-note JSON result is capped at 64 KiB and longer content is cut at a Unicode boundary with truncated:true. A missing notes index reads as an empty revision-0 project listing. Only the active lead can use this tool, and no argument accepts or redirects a Host filesystem path.";
1379
- var BOARD_NOTE_WRITE_DESCRIPTION = "Create, update, append to, or delete one Markdown note on an existing project of the active lead's DevLead board. create requires title and may omit note to generate a UUID; update changes only supplied title/summary/content; append requires note and content and appends it exactly; delete requires note. Use expected_revision for notes-index CAS and expected_bytes for existing-note CAS when a lost update would matter. Returns the resulting metadata (or deleted metadata), revision, and changed state without returning the body. Note content stays out of the index. The Host owns all locations; write arguments contain no file path.";
1372
+ var BOARD_READ_DESCRIPTION = "Read the user-visible DevLead project board: durable project status, priority, goal/focus/next, blockers, and optionally tasks. Omit project for a bounded all-project summary; select one by exact id, workspace title, or absolute workspace path for full detail. This board is read-only for the human and writable only by the lead AI through devlead_board_update. The board belongs to the active lead Session; its file location is derived from that Session workspace (or a deployment override) and is never a tool argument. Results are bounded and may be truncated:true; no active lead workspace (including a recorded workspace root that no longer exists) means BOARD_DISABLED. Use when reconciling current cross-project state before dispatching, resuming, closing, or reporting.";
1373
+ var BOARD_UPDATE_DESCRIPTION = "Update one project on the user-visible DevLead board; the human is read-only and only the enabled lead AI may write through this tool. Create requires create:true and set.workspace.path. Supports scalar status/priority/goal/focus/next updates, blocker clear/remove/add, and task remove/upsert. Use expected_revision from devlead_board_read for compare-and-swap when a lost update would matter. Returns only the changed project without task rows and the changed lanes, never the whole board. The file belongs to the active lead Session workspace and no argument can redirect it. Use when dispatching or closing work, or when project focus/next/blockers/tasks materially change; batch related changes.";
1374
+ var BOARD_NOTE_READ_DESCRIPTION = "Read Markdown notes attached to one existing DevLead board project. project is required and resolves exactly as in the other board tools. Omit note for the project's bounded metadata listing (id, title, summary, updatedAt, bytes, root-relative path, and Host-derived absolutePath); provide its id for Markdown content plus metadata. Prefer this list/read interface over direct filesystem reads for board notes. A single-note JSON result is capped at 64 KiB and longer content is cut at a Unicode boundary with truncated:true. To edit a body, use DSH-native read/write/edit on the returned absolutePath; never edit notes/index.json directly. A missing notes index reads as an empty revision-0 project listing. Only the active lead can use this tool, and no argument accepts or redirects a Host filesystem path. Use when resuming a project or preparing a dispatch brief so prior plans, decisions, and handoffs inform the work.";
1375
+ var BOARD_NOTE_WRITE_DESCRIPTION = "Maintain only the notes index, note metadata, or deletion for one existing project of the active lead's DevLead board. create requires title, accepts optional summary/content (the initial body defaults to empty), and may omit note to generate a UUID; update-metadata requires note and changes only supplied title/summary; delete requires note. This tool never updates or appends to an existing Markdown body. Use expected_revision for notes-index CAS when a lost update would matter. Returns resulting or deleted metadata including absolutePath, revision, and changed state without returning the body. After create, use DSH-native read/write/edit on absolutePath for body edits; never edit notes/index.json directly. Note content stays out of the index. The Host owns all locations; write arguments contain no file path. Use when a plan, design, decision, or handoff should survive across turns; keep it concise instead of copying transcripts or logs.";
1380
1376
  var BLOCKER_SCHEMA = {
1381
1377
  type: "object",
1382
1378
  additionalProperties: false,
@@ -1465,7 +1461,8 @@ var NOTE_METADATA_SCHEMA = {
1465
1461
  summary: { type: "string", required: true },
1466
1462
  updatedAt: { type: "string", required: true },
1467
1463
  bytes: { type: "integer", required: true },
1468
- path: { type: "string", required: true }
1464
+ path: { type: "string", required: true },
1465
+ absolutePath: { type: "string", required: true }
1469
1466
  }
1470
1467
  };
1471
1468
  var NOTE_DOCUMENT_SCHEMA = {
@@ -1496,7 +1493,7 @@ var BOARD_NOTE_WRITE_OUTPUT = jsonOutput({
1496
1493
  updatedAt: { type: "string", required: true },
1497
1494
  project: { ...NOTE_PROJECT_SCHEMA, required: true },
1498
1495
  note: { ...NOTE_METADATA_SCHEMA, required: true },
1499
- operation: { type: "string", required: true, enum: ["create", "update", "append", "delete"] },
1496
+ operation: { type: "string", required: true, enum: ["create", "update-metadata", "delete"] },
1500
1497
  changed: { type: "boolean", required: true },
1501
1498
  deleted: { type: "boolean" }
1502
1499
  }
@@ -1554,7 +1551,6 @@ function boardUpdateRequest(args) {
1554
1551
  function boardNoteWriteRequest(args) {
1555
1552
  const note = optionalNoteRef(args.note);
1556
1553
  const expectedRevision = optionalNonNegativeInteger(args.expected_revision, "expected_revision");
1557
- const expectedBytes = optionalNonNegativeInteger(args.expected_bytes, "expected_bytes");
1558
1554
  return {
1559
1555
  project: requireProjectRef(args.project),
1560
1556
  operation: args.operation,
@@ -1562,8 +1558,7 @@ function boardNoteWriteRequest(args) {
1562
1558
  ...args.title === void 0 ? {} : { title: args.title },
1563
1559
  ...args.summary === void 0 ? {} : { summary: args.summary },
1564
1560
  ...args.content === void 0 ? {} : { content: args.content },
1565
- ...expectedRevision === void 0 ? {} : { expectedRevision },
1566
- ...expectedBytes === void 0 ? {} : { expectedBytes }
1561
+ ...expectedRevision === void 0 ? {} : { expectedRevision }
1567
1562
  };
1568
1563
  }
1569
1564
  function resultRecord(result) {
@@ -1700,13 +1695,13 @@ function registerDevLeadBoardTools(ctx) {
1700
1695
  }
1701
1696
 
1702
1697
  // packages/tool/src/policy.ts
1703
- var DEVLEAD_POLICY_BASE = `DevLead mode is enabled in this session. You are the Dev Lead: your job is to orchestrate, not to implement. For every request that needs a change, first decide which Workspace owns it, dispatch the work to a Session there, watch it, then steer, review, and report. Created Sessions are real and human-openable, so keep them understandable. If you are about to edit files, run a build, commit, push, deploy, or open a long-running goal or autonomous plan to carry out the request, stop and dispatch; that work belongs to the owning Session, not to this one.
1698
+ var DEVLEAD_POLICY_BASE = `DevLead mode is enabled in this session. You are the Dev Lead: your job is to orchestrate, not to implement. For every request that needs a change, first decide which Workspace owns it, dispatch the work to a Session there, watch it, then steer, review, and report. Keep created Sessions human-openable and understandable. If you are about to edit files, run a build, commit, push, deploy, or open a long-running goal or autonomous plan to carry out the request, stop and dispatch; that work belongs to the owning Session, not to this one.
1704
1699
 
1705
1700
  Role boundary:
1706
1701
  - Ownership: decide the owning Workspace from devlead_list_workspaces metadata and the directories the human names, not by reading another repository's code. If none matches, or more than one could own it, ask and stop rather than guessing. Never use this session's directory as a fallback; register the directory the human names with devlead_use_workspace.
1707
1702
  - Feasibility triage, not research: read only enough to decide the owning Workspace, state the current behavior and the target result at a high level, and define how to verify it; then stop and dispatch. Do not read whole modules, reproduce the issue, find the root cause, or design the implementation yourself. Put what you could not confirm into the brief as open questions. Read further only when ownership, safety, a human request, or a review of a specific claim requires it.
1708
1703
  - Writes belong to a Session in the owning Workspace: dispatch file edits, builds, commits, pushes, and deploys to that Session; do not do them yourself from this session unless the human explicitly authorizes direct work in this conversation (then say so when you report). This default includes implementation work in this session's own workspace. Direct upkeep of this repository's own record files (README, AGENTS.md, notes) may be done directly when this repository's instructions say so; that is not implementation work, and it never authorizes implementation.
1709
- - Subagents, Agent Teams, and background helpers are not a substitute for dispatching: a read-only helper may gather facts for a brief, but it must not carry out the owning Workspace's writes, and it is not an openable ordinary Session the human can take over.
1704
+ - Subagents, Agent Teams, and background helpers are not a substitute for dispatching: a read-only helper may gather facts, but cannot do the owning Workspace's writes or replace an openable ordinary Session.
1710
1705
  - A Session is for work, not ceremony: route changes through a Session in the owning Workspace and batch small related changes into one; a quick read-only answer needs no Session, but sustained investigation is dispatched too. Never create a blank Session without a concrete, self-contained brief.
1711
1706
 
1712
1707
  Workflow:
@@ -1716,7 +1711,7 @@ Workflow:
1716
1711
  - Inspect progress with devlead_list_sessions and devlead_get_session. The listing carries live, running, watched, archived, and lastTurn; the single-Session detail adds lastTransition, lastError, and lastAssistant when the Host can read the log. Read those fields rather than guessing. If a settled turn's lastAssistant is a question or a request for a decision, treat it as an unanswered question: answer it yourself or ask the human, then continue the Session with devlead_prompt_session.
1717
1712
  - Continue a Session with devlead_prompt_session: the prompt is admitted as a user message attributed to you, and a cold Session is resumed first. Archived Sessions are rejected. By default a running Session queues the prompt behind its current turn; set interrupt true only to replace that work: the Host stops the running turn and the work its stop providers report (subagents, owned jobs, active schedules), discards queued input by default (interrupt_inbox keep/clear-own retains it), then admits the prompt as a new turn; an idle Session is a no-op, and the interrupted turn still notifies you as cancelled. A stale queued prompt you sent can be withdrawn with devlead_retract_input before it runs; only your own relay inputs are yours to retract.
1718
1713
  - Manage the watch set with devlead_watch_session. Only watched Sessions produce notifications, so unwatch work you no longer need and do not let the set grow without purpose. A watch is a follow relationship, not a permission grant: it routes notifications/reports and allows steering, not file access or ownership. For a long-running watched Session whose mid-turn milestones matter, you may invite devlead_report in the brief for blockers, decision forks, or questions; omit it with watch=false and for short linear work. Reports are one-way and never replace the final turn notice.
1719
- - Board: devlead_board_read/devlead_board_update. Notes: devlead_board_note_read/devlead_board_note_write (Markdown CRUD/CAS).
1714
+ - Board: devlead_board_read/devlead_board_update. Notes: devlead_board_note_read/devlead_board_note_write=read/index/metadata/delete; native read/write/edit=body@absolutePath, not notes/index.json.
1720
1715
 
1721
1716
  Closing Workspaces and Sessions is judgment-based: close when it genuinely serves the task and is a reasonable wrap-up, not only when told item by item. Typical cases: archive temporary or wrap-up Sessions you created or dispatched for this task once they are done; remove Workspace registrations that are clearly stale, duplicate, or empty, or that you created; when the human says tidy up, wrap up, or clean up, decide the scope yourself. Closing never deletes work. devlead_remove_workspace performs the DSH remove action: it unregisters a Workspace while its directory, files, and every Session log stay untouched, and its Sessions become ungrouped (still openable) \u2014 re-registering the directory creates a new Workspace that does not adopt them. devlead_archive_session performs the DSH archive action: it hides a Session from grouping while keeping its log, and devlead_unarchive_session restores it to its recorded Workspace position. Boundaries: never close a Session or Workspace the human is using or talking to now, never use closing to hide a failure or skip reporting, and never start an unrelated large cleanup. When tidying up, archive finished Sessions and keep the Workspace registration; remove a registration only when it is stale, duplicate, empty, or yours, since removal has the wider blast radius. Pass stop_running true only when you mean to cancel that Session's running work; otherwise a Session with running work is refused as DEVLEAD_SESSION_ACTIVE, and stop_running archives first and asks the Host to stop that work without waiting for it to settle. You can never archive the Session you are running in: ask the human to close it from the sidebar. Report every autonomous close: what you closed, why, what it affects (which Sessions became ungrouped, whether running work was stopped), and that an archived Session can be unarchived.
1722
1717
 
@@ -1734,6 +1729,7 @@ function devLeadPolicy(options) {
1734
1729
 
1735
1730
  ${options.worktreeIsolation ? WORKTREE_ISOLATION_POLICY : SERIAL_WRITES_POLICY}`;
1736
1731
  }
1732
+ var DEVLEAD_BOARD_POLICY = `Board workflow: proactively maintain the per-turn board summary as cross-project source of truth. Use devlead_board_update when dispatching/closing work or when focus, next, blockers, or tasks materially change; batch related edits. Prefer devlead_board_note_read list/read before resuming or briefing. Preserve plans/decisions/handoffs: devlead_board_note_write creates (optional initial content), updates metadata, or deletes; edit bodies with native read/write/edit at returned absolutePath, then update title/summary as needed; never edit notes/index.json. Reconcile stale state before reporting. Keep bodies valid UTF-8, \u2264256 KiB, and concise; no log dumps. On BOARD_DISABLED or BOARD_IO_ERROR, continue, report degradation once, and do not retry repeatedly. No material change means no update.`;
1737
1733
  var DEVLEAD_REPORT_POLICY = `This Session is watched by the active DevLead Session. Your settled turn already notifies the lead, so do not use devlead_report to re-broadcast routine progress or your final summary. Reserve it for a long-running task's mid-turn milestones the lead must know before the turn ends: a real blocker, a fork that needs the lead's decision, progress that would change scheduling correctness if it waited, or a question that needs the lead's answer; a short or linear task should not call it. The kind selects the delivery lane: progress/fyi are non-urgent background context injected into the lead without waking it (a cold lead or a full background budget keeps them digest-only), so never use them for anything that needs action before the turn ends; blocked/decision steer the lead's next step under a [DEV LEAD ACTION REQUIRED] wake and share a bounded pending queue per lead/child pair \u2014 an overflow returns DEVLEAD_DELIVERY_RATE_LIMITED, so merge reports instead of sending another; question seeks an answer. Reports are one-way: the lead cannot reply through the report, but a kind question report is the supported question path\u2014send it, then end your turn and wait for the lead to answer in a new turn (directly or after asking the human). When the question is durably forwarded the result sets turnEndRequested:true: the tool requests the end of your turn, but the current tool batch still completes and already-queued next-step work still runs before the turn closes; the answer may also steer your next step while you are still running, so do not poll or resend. When the question receipt is not durable, no turn end is requested: restate the question in your final assistant message and end the turn naturally. Direct user questions are disabled while watched, unless the current turn was opened by a direct human message in this Session: in a lead-directed turn an ask_user_question call is intercepted and forwarded to the lead as a question report, and the tool call returns guidance instead of opening the child's own question UI. If you end a turn with a natural-language question instead, the lead sees the assistant excerpt in the turn notification, but the explicit question report is faster and more reliable. Do not poll for an answer and do not use devlead_report as a general reply channel. Keep reports short and actionable: say what happened, what it affects, and what decision or next step you need. The result's durable flag says whether the Host persisted the receipt in its durable outbox; when it is false, the report is memory-only, so warn in your own work and retry when the lead is reachable. At most four distinct non-question reports are accepted per turn; question reports are exempt from that budget, the same kind and message in one turn is deduplicated (the same text under a different kind is a new report), and exhausted progress budgets return DEVLEAD_REPORT_RATE_LIMITED. Reports must be sent to the lead that watches you; no target Session parameter exists.`;
1738
1734
 
1739
1735
  // packages/tool/src/question-routing.ts
@@ -1883,6 +1879,11 @@ function apply(ctx) {
1883
1879
  order: ctx.systemPrompt.getSectionOrder("TOOL_SUBAGENT"),
1884
1880
  text: ({ agent }) => agent !== void 0 && ctx.devLead.isEnabled(agent) ? devLeadPolicy({ worktreeIsolation: ctx.devLead.worktreeIsolationAvailable }) : ""
1885
1881
  });
1882
+ ctx.systemPrompt.section({
1883
+ name: "devlead:board-policy",
1884
+ order: ctx.systemPrompt.getSectionOrder("TOOL_SUBAGENT"),
1885
+ text: ({ agent }) => agent !== void 0 && ctx.devLead.isEnabled(agent) ? DEVLEAD_BOARD_POLICY : ""
1886
+ });
1886
1887
  ctx.systemPrompt.section({
1887
1888
  name: "devlead:report-policy",
1888
1889
  order: ctx.systemPrompt.getSectionOrder("TOOL_SUBAGENT"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yankeguo/dsh-tool-devlead",
3
- "version": "0.4.2-rc.5",
3
+ "version": "0.4.2-rc.7",
4
4
  "description": "Model-facing DevLead tools: register and list DSH Workspaces, create and steer ordinary Sessions, read session status, watch state changes, and read the lead's notification feed.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,8 +26,8 @@
26
26
  "@deepseek-ai/schemastery": "~3.19.0"
27
27
  },
28
28
  "dependencies": {
29
- "@yankeguo/dsh-devlead": "0.4.2-rc.5",
30
- "@yankeguo/dsh-devlead-protocol": "0.4.2-rc.5"
29
+ "@yankeguo/dsh-devlead": "0.4.2-rc.7",
30
+ "@yankeguo/dsh-devlead-protocol": "0.4.2-rc.7"
31
31
  },
32
32
  "engines": {
33
33
  "dsh": ">=0.2.2-rc.1 <0.3.0"