@yankeguo/dsh-tool-devlead 0.4.2-rc.3 → 0.4.2-rc.6

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 +30 -6
  2. package/lib/index.js +194 -4
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @yankeguo/dsh-tool-devlead
2
2
 
3
- The sixteen model-facing lead tools, one watched-Session report tool, and the conditional DevLead system-prompt sections/context.
3
+ The eighteen model-facing lead tools, one watched-Session report tool, and the conditional DevLead system-prompt sections/context.
4
4
 
5
- The sixteen lead tools are registered with `when: ({ agent }) => ctx.devLead.isEnabled(agent)`,
5
+ The eighteen lead tools are registered with `when: ({ agent }) => ctx.devLead.isEnabled(agent)`,
6
6
  so an ordinary Session never sees them. They become visible only after a human enables DevLead mode
7
7
  with `/devlead on` or the composer-toolbar toggle (shown in both states). `devlead_report` is the
8
8
  inverse condition: `ctx.devLead.isSupervised(agent)` — a non-DevLead Session watched by the unique
@@ -15,6 +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
20
  - `devlead_use_workspace`
19
21
  - `devlead_list_sessions`
20
22
  - `devlead_create_session` (optional `isolation: "none" | "worktree"`; creation-time
@@ -56,7 +58,20 @@ references still report `BOARD_PROJECT_NOT_FOUND`/`BOARD_PROJECT_AMBIGUOUS`. A b
56
58
  degrades the board only: the tools report `BOARD_IO_ERROR` while DevLead keeps working. The human is
57
59
  read-only; only the enabled lead AI writes.
58
60
  `devlead:board-summary` is a cache-safe `systemPrompt.context()` snapshot capped at 1536 UTF-8
59
- bytes. See [docs/BOARD.md](https://github.com/yankeguo/dsh-devlead/blob/main/docs/BOARD.md).
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 batch updates at dispatch/close and material project changes, read
63
+ notes before resuming or briefing, preserve concise plans/decisions/handoffs, reconcile stale state before reporting,
64
+ and report board degradation once instead of repeatedly retrying. Ordinary Sessions see neither text nor board tools.
65
+
66
+ The two notes tools use the same active-lead gate and board-project id/title/absolute-path resolver,
67
+ but never accept a notes file path. They read and mutate only `dirname(boardPath)/notes/`: the strict
68
+ schema-v1 `index.json` contains `{ revision, updatedAt, projects:[{ id, directory, notes[] }] }` and
69
+ metadata only, while each body is `<directory>/<note-id>.md`. Writes use a cross-process file lock,
70
+ atomic replacement, index `expected_revision` CAS and note-body `expected_bytes` CAS. The index is
71
+ limited to 128 KiB, each note to 256 KiB, and each project to 100 notes. The committed index is the
72
+ source of truth; unindexed/orphan Markdown files are ignored. See
73
+ [docs/BOARD.md](https://github.com/yankeguo/dsh-devlead/blob/main/docs/BOARD.md) for operation-specific
74
+ arguments, stable `BOARD_*` errors, and corruption semantics.
60
75
 
61
76
  `devlead_list_models` reports the compact Host model catalog (default selection, providers,
62
77
  models, reasoning efforts, and provider failures). `devlead_list_agent_presets` reports the
@@ -161,7 +176,7 @@ supported platform.
161
176
 
162
177
  ## 中文
163
178
 
164
- `@yankeguo/dsh-tool-devlead` 提供 16 个主工具 + 1 个 `devlead_report` 与条件 system prompt/context。主工具只在 DevLead 模式开启时可见;`devlead_report` 只在非 DevLead、被唯一 active lead 关注的会话可见。写操作与需要调用者身份的读取要求 live Agent(`exec.agent`);`devlead_list_workspaces` 不读取其身份。两个看板工具是 **lead-only**:调用者必须是持有看板文件的当前 active lead,否则返回 `BOARD_DISABLED`(没有 active lead、没有绝对 workspace 根、记录的 workspace 根已不存在,或调用者不是 active lead)。0.2.0 起
179
+ `@yankeguo/dsh-tool-devlead` 提供 18 个主工具 + 1 个 `devlead_report` 与条件 system prompt/context。主工具只在 DevLead 模式开启时可见;`devlead_report` 只在非 DevLead、被唯一 active lead 关注的会话可见。写操作与需要调用者身份的读取要求 live Agent(`exec.agent`);`devlead_list_workspaces` 不读取其身份。两个看板工具是 **lead-only**:调用者必须是持有看板文件的当前 active lead,否则返回 `BOARD_DISABLED`(没有 active lead、没有绝对 workspace 根、记录的 workspace 根已不存在,或调用者不是 active lead)。0.2.0 起
165
180
  `devlead_use_workspace` 把 live Agent 转发给 core 的 `useWorkspace(agent, request, signal)`,
166
181
  `create` 默认 `false`(缺目录报 `DEVLEAD_DIRECTORY_MISSING`,只有人类明确要求建目录时才传
167
182
  `true`)。`devlead_create_session` 还支持创建时指定 `provider`+`model`(可选
@@ -179,8 +194,17 @@ project 行从尾部裁剪,`truncated:true`);update 的 project 引用在
179
194
  workspace path/title 不再误报 `BOARD_LIMIT_EXCEEDED`,未知引用仍是
180
195
  `BOARD_PROJECT_NOT_FOUND`/`BOARD_PROJECT_AMBIGUOUS`。start 失败只降级看板(`BOARD_IO_ERROR`),
181
196
  不阻塞 DevLead。用户只读,只有 enabled lead AI 可通过工具写入。
182
- 动态 `devlead:board-summary` 使用 cache-safe `systemPrompt.context()`,上限 1536 UTF-8 bytes。
183
- 详见 [docs/BOARD.md](https://github.com/yankeguo/dsh-devlead/blob/main/docs/BOARD.md)。`devlead_report` 返回 `{ report, durable, queued, warning? }`:报告先写入
197
+ 动态 `devlead:board-summary` 使用 cache-safe `systemPrompt.context()`,上限 1536 UTF-8 bytes;active
198
+ 项目行在有数据时附带 note 数与最近标题。独立 lead-only `devlead:board-policy` 引导模型在派发/收口和实质变化时
199
+ 批量更新,恢复/派发前读 notes,保存简短计划/决策/交接,汇报前对齐过期状态,看板降级只报告一次而不反复重试;
200
+ 普通 Session 看不到该文案或看板工具。`devlead_board_note_read(project,note?)` 读取项目 notes
201
+ metadata 或单条 Markdown 正文;`devlead_board_note_write` 接收 `project`、`operation`
202
+ (create/update/append/delete)、可选 `note/title/summary/content` 与 `expected_revision/expected_bytes`
203
+ CAS。project 仍按看板 id/title/绝对 path 解析,两个工具都不接受文件路径。notes 根目录固定为
204
+ `dirname(boardPath)/notes/`,index 只含 metadata,正文路径固定为 `<directory>/<note-id>.md`;写入
205
+ 使用跨进程文件锁与原子替换,index 是提交事实、orphan Markdown 忽略。index ≤128 KiB、单 note
206
+ ≤256 KiB、每项目 ≤100 条。详见
207
+ [docs/BOARD.md](https://github.com/yankeguo/dsh-devlead/blob/main/docs/BOARD.md)。`devlead_report` 返回 `{ report, durable, queued, warning? }`:报告先写入
184
208
  durable outbox,lead 日志 flush 成功后才清理;Host 无 storage 时 `durable:false` 并带 warning。
185
209
  报告参数:`message`(≤4000 码点)、
186
210
  可选 `kind`(progress/blocked/decision/question/fyi,默认 progress)与 `summary`(≤200),无 target
package/lib/index.js CHANGED
@@ -115,6 +115,54 @@ var TOOL_PARAMETERS = {
115
115
  }
116
116
  }
117
117
  },
118
+ devlead_board_note_read: {
119
+ project: {
120
+ type: "string",
121
+ required: true,
122
+ description: "Board project reference: exact id, exact workspace title, or exact absolute workspace path. Title ambiguity uses the same BOARD_PROJECT_AMBIGUOUS error as the board tools."
123
+ },
124
+ note: {
125
+ type: "string",
126
+ description: "Optional note id from a prior create/read result. Omit to list this project's note metadata; provide it to return the complete Markdown content. This is an id, never a file path."
127
+ }
128
+ },
129
+ devlead_board_note_write: {
130
+ project: {
131
+ type: "string",
132
+ required: true,
133
+ description: "Existing board project id/title/workspace path. Notes cannot be created for a project absent from the board. This never addresses the notes index or a Markdown file."
134
+ },
135
+ operation: {
136
+ type: "string",
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."
140
+ },
141
+ note: {
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."
144
+ },
145
+ title: {
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."
148
+ },
149
+ summary: {
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."
152
+ },
153
+ content: {
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."
156
+ },
157
+ expected_revision: {
158
+ type: "integer",
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
+ }
165
+ },
118
166
  devlead_use_workspace: {
119
167
  path: {
120
168
  type: "string",
@@ -373,6 +421,12 @@ function optionalProjectRef(value) {
373
421
  if (value === void 0) return void 0;
374
422
  return requireProjectRef(value);
375
423
  }
424
+ function optionalNoteRef(value) {
425
+ if (value === void 0) return void 0;
426
+ const trimmed = value.trim();
427
+ if (trimmed.length === 0) throw new DevLeadToolInputError("note must not be empty when provided");
428
+ return trimmed;
429
+ }
376
430
  function requireWorkspaceRef(value) {
377
431
  const trimmed = value.trim();
378
432
  if (trimmed.length === 0) throw new DevLeadToolInputError("workspace must not be empty");
@@ -1319,8 +1373,10 @@ function unarchivedSessionValue(unarchived) {
1319
1373
  }
1320
1374
 
1321
1375
  // packages/tool/src/board-tools.ts
1322
- 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.";
1323
- 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.";
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. Use when reconciling current cross-project state before dispatching, resuming, closing, or reporting.";
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. Use when dispatching or closing work, or when project focus/next/blockers/tasks materially change; batch related changes.";
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. Use when resuming a project or preparing a dispatch brief so prior plans, decisions, and handoffs inform the work.";
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. Use when a plan, design, decision, or handoff should survive across turns; keep it concise instead of copying transcripts or logs.";
1324
1380
  var BLOCKER_SCHEMA = {
1325
1381
  type: "object",
1326
1382
  additionalProperties: false,
@@ -1392,6 +1448,59 @@ var BOARD_UPDATE_OUTPUT = jsonOutput({
1392
1448
  changed: { type: "array", required: true, items: { type: "string" } }
1393
1449
  }
1394
1450
  });
1451
+ var NOTE_PROJECT_SCHEMA = {
1452
+ type: "object",
1453
+ additionalProperties: false,
1454
+ properties: {
1455
+ id: { type: "string", required: true },
1456
+ directory: { type: "string", required: true }
1457
+ }
1458
+ };
1459
+ var NOTE_METADATA_SCHEMA = {
1460
+ type: "object",
1461
+ additionalProperties: false,
1462
+ properties: {
1463
+ id: { type: "string", required: true },
1464
+ title: { type: "string", required: true },
1465
+ summary: { type: "string", required: true },
1466
+ updatedAt: { type: "string", required: true },
1467
+ bytes: { type: "integer", required: true },
1468
+ path: { type: "string", required: true }
1469
+ }
1470
+ };
1471
+ var NOTE_DOCUMENT_SCHEMA = {
1472
+ type: "object",
1473
+ additionalProperties: false,
1474
+ properties: {
1475
+ ...NOTE_METADATA_SCHEMA.properties,
1476
+ content: { type: "string", required: true }
1477
+ }
1478
+ };
1479
+ var BOARD_NOTE_READ_OUTPUT = jsonOutput({
1480
+ type: "object",
1481
+ additionalProperties: false,
1482
+ properties: {
1483
+ revision: { type: "integer", required: true },
1484
+ updatedAt: { type: "string", required: true },
1485
+ project: { ...NOTE_PROJECT_SCHEMA, required: true },
1486
+ notes: { type: "array", items: NOTE_METADATA_SCHEMA },
1487
+ note: NOTE_DOCUMENT_SCHEMA,
1488
+ truncated: { type: "boolean" }
1489
+ }
1490
+ });
1491
+ var BOARD_NOTE_WRITE_OUTPUT = jsonOutput({
1492
+ type: "object",
1493
+ additionalProperties: false,
1494
+ properties: {
1495
+ revision: { type: "integer", required: true },
1496
+ updatedAt: { type: "string", required: true },
1497
+ project: { ...NOTE_PROJECT_SCHEMA, required: true },
1498
+ note: { ...NOTE_METADATA_SCHEMA, required: true },
1499
+ operation: { type: "string", required: true, enum: ["create", "update", "append", "delete"] },
1500
+ changed: { type: "boolean", required: true },
1501
+ deleted: { type: "boolean" }
1502
+ }
1503
+ });
1395
1504
  function setPatch(input) {
1396
1505
  if (input === void 0) return void 0;
1397
1506
  return {
@@ -1442,6 +1551,21 @@ function boardUpdateRequest(args) {
1442
1551
  }
1443
1552
  };
1444
1553
  }
1554
+ function boardNoteWriteRequest(args) {
1555
+ const note = optionalNoteRef(args.note);
1556
+ const expectedRevision = optionalNonNegativeInteger(args.expected_revision, "expected_revision");
1557
+ const expectedBytes = optionalNonNegativeInteger(args.expected_bytes, "expected_bytes");
1558
+ return {
1559
+ project: requireProjectRef(args.project),
1560
+ operation: args.operation,
1561
+ ...note === void 0 ? {} : { note },
1562
+ ...args.title === void 0 ? {} : { title: args.title },
1563
+ ...args.summary === void 0 ? {} : { summary: args.summary },
1564
+ ...args.content === void 0 ? {} : { content: args.content },
1565
+ ...expectedRevision === void 0 ? {} : { expectedRevision },
1566
+ ...expectedBytes === void 0 ? {} : { expectedBytes }
1567
+ };
1568
+ }
1445
1569
  function resultRecord(result) {
1446
1570
  if (result.isError) return void 0;
1447
1571
  const text = result.content.find((block) => block.type === "text")?.text;
@@ -1468,6 +1592,27 @@ function presentBoardResult(_args, result) {
1468
1592
  }
1469
1593
  return { card: "generic", content: [{ type: "text", text: text.slice(0, 500) }] };
1470
1594
  }
1595
+ function presentBoardNoteResult(_args, result) {
1596
+ const value = resultRecord(result);
1597
+ if (value === void 0) return { card: "generic" };
1598
+ const revision = typeof value.revision === "number" ? `r${value.revision}` : "revision unknown";
1599
+ const project = typeof value.project === "object" && value.project !== null ? value.project : void 0;
1600
+ const projectId = typeof project?.id === "string" ? project.id : "project";
1601
+ let detail;
1602
+ if (Array.isArray(value.notes)) detail = `${value.notes.length} note(s)`;
1603
+ else if (typeof value.operation === "string") {
1604
+ const note = typeof value.note === "object" && value.note !== null ? value.note : void 0;
1605
+ const noteId = typeof note?.id === "string" ? note.id : "note";
1606
+ detail = `${value.operation} ${noteId}${value.changed === false ? "; no changes" : ""}`;
1607
+ } else {
1608
+ const note = typeof value.note === "object" && value.note !== null ? value.note : void 0;
1609
+ detail = `${typeof note?.title === "string" ? note.title : "note content"}${value.truncated === true ? " (truncated)" : ""}`;
1610
+ }
1611
+ return {
1612
+ card: "generic",
1613
+ content: [{ type: "text", text: `DevLead notes ${revision}: ${projectId}; ${detail}`.slice(0, 500) }]
1614
+ };
1615
+ }
1471
1616
  function registerDevLeadBoardTools(ctx) {
1472
1617
  ctx.tools.register(defineTool({
1473
1618
  name: "devlead_board_read",
@@ -1513,10 +1658,49 @@ function registerDevLeadBoardTools(ctx) {
1513
1658
  });
1514
1659
  }
1515
1660
  }), { when: ({ agent }) => ctx.devLead.isEnabled(agent) });
1661
+ ctx.tools.register(defineTool({
1662
+ name: "devlead_board_note_read",
1663
+ description: BOARD_NOTE_READ_DESCRIPTION,
1664
+ parameters: TOOL_PARAMETERS.devlead_board_note_read,
1665
+ output: BOARD_NOTE_READ_OUTPUT,
1666
+ presentCall: (args) => present("Read DevLead project notes", "read", args.project.trim()),
1667
+ presentResult: presentBoardNoteResult,
1668
+ isConcurrencySafe: () => true,
1669
+ execute(args, exec) {
1670
+ return runTool(async () => {
1671
+ assertKnownArguments(args, TOOL_ARGUMENT_KEYS.devlead_board_note_read);
1672
+ const agent = requireAgent(exec.agent, "devlead_board_note_read");
1673
+ const note = optionalNoteRef(args.note);
1674
+ return ctx.devLead.readBoardNote(agent, {
1675
+ project: requireProjectRef(args.project),
1676
+ ...note === void 0 ? {} : { note }
1677
+ });
1678
+ });
1679
+ }
1680
+ }), { when: ({ agent }) => ctx.devLead.isEnabled(agent) });
1681
+ ctx.tools.register(defineTool({
1682
+ name: "devlead_board_note_write",
1683
+ description: BOARD_NOTE_WRITE_DESCRIPTION,
1684
+ parameters: TOOL_PARAMETERS.devlead_board_note_write,
1685
+ output: BOARD_NOTE_WRITE_OUTPUT,
1686
+ presentCall: (args) => present(
1687
+ `${args.operation[0]?.toUpperCase() ?? ""}${args.operation.slice(1)} DevLead project note`,
1688
+ "other",
1689
+ args.project.trim()
1690
+ ),
1691
+ presentResult: presentBoardNoteResult,
1692
+ execute(args, exec) {
1693
+ return runTool(async () => {
1694
+ assertKnownArguments(args, TOOL_ARGUMENT_KEYS.devlead_board_note_write);
1695
+ const agent = requireAgent(exec.agent, "devlead_board_note_write");
1696
+ return ctx.devLead.writeBoardNote(agent, boardNoteWriteRequest(args), exec.signal);
1697
+ });
1698
+ }
1699
+ }), { when: ({ agent }) => ctx.devLead.isEnabled(agent) });
1516
1700
  }
1517
1701
 
1518
1702
  // packages/tool/src/policy.ts
1519
- 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. The Sessions you create are real Sessions that the human can also open and take over, so keep them understandable to a person opening them later. 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.
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.
1520
1704
 
1521
1705
  Role boundary:
1522
1706
  - 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.
@@ -1532,7 +1716,7 @@ Workflow:
1532
1716
  - 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.
1533
1717
  - 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.
1534
1718
  - 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.
1535
- - Board: devlead_board_read/devlead_board_update.
1719
+ - Board: devlead_board_read/devlead_board_update. Notes: devlead_board_note_read/devlead_board_note_write (Markdown CRUD/CAS).
1536
1720
 
1537
1721
  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.
1538
1722
 
@@ -1550,6 +1734,7 @@ function devLeadPolicy(options) {
1550
1734
 
1551
1735
  ${options.worktreeIsolation ? WORKTREE_ISOLATION_POLICY : SERIAL_WRITES_POLICY}`;
1552
1736
  }
1737
+ var DEVLEAD_BOARD_POLICY = `Board workflow: the per-turn board summary is the source of truth for cross-project state. Use devlead_board_update when dispatching or closing work, or when a project's focus, next step, blockers, or tasks materially change; batch related edits instead of writing or announcing every step. Preserve plans, designs, decisions, and handoffs in project notes with devlead_board_note_write; read notes with devlead_board_note_read before resuming a project or writing a dispatch brief. Before reporting to the human, reconcile stale board state with reality. Keep entries short and readable; never paste chats, logs, or tool output wholesale. On BOARD_DISABLED or BOARD_IO_ERROR, continue the task, report degradation once, and do not retry repeatedly. No material change means no update.`;
1553
1738
  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.`;
1554
1739
 
1555
1740
  // packages/tool/src/question-routing.ts
@@ -1699,6 +1884,11 @@ function apply(ctx) {
1699
1884
  order: ctx.systemPrompt.getSectionOrder("TOOL_SUBAGENT"),
1700
1885
  text: ({ agent }) => agent !== void 0 && ctx.devLead.isEnabled(agent) ? devLeadPolicy({ worktreeIsolation: ctx.devLead.worktreeIsolationAvailable }) : ""
1701
1886
  });
1887
+ ctx.systemPrompt.section({
1888
+ name: "devlead:board-policy",
1889
+ order: ctx.systemPrompt.getSectionOrder("TOOL_SUBAGENT"),
1890
+ text: ({ agent }) => agent !== void 0 && ctx.devLead.isEnabled(agent) ? DEVLEAD_BOARD_POLICY : ""
1891
+ });
1702
1892
  ctx.systemPrompt.section({
1703
1893
  name: "devlead:report-policy",
1704
1894
  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.3",
3
+ "version": "0.4.2-rc.6",
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.3",
30
- "@yankeguo/dsh-devlead-protocol": "0.4.2-rc.3"
29
+ "@yankeguo/dsh-devlead": "0.4.2-rc.6",
30
+ "@yankeguo/dsh-devlead-protocol": "0.4.2-rc.6"
31
31
  },
32
32
  "engines": {
33
33
  "dsh": ">=0.2.2-rc.1 <0.3.0"