@yankeguo/dsh-devlead 0.4.1 → 0.4.2-rc.10

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 +59 -4
  2. package/lib/index.js +1814 -35
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -3,7 +3,37 @@
3
3
  Core Host service of the DevLead suite (`ctx.devLead`): the durable mode switch, damage-recovery
4
4
  `reset()`, Workspace and Session orchestration (including `useWorkspace(agent, request, signal?)`
5
5
  with directory creation opt-in), the watched-session notification hub with cold-lead rehydration, the mid-turn report channel for watched Sessions,
6
- and the `devLead` / `devLeadMode` / `devLeadWatch` Session projections.
6
+ and the `devLead` / `devLeadMode` / `devLeadWatch` Session projections. `ctx.devLead.board` also
7
+ owns the strict, atomically written project-board JSON file. The board is **on by default**: the
8
+ unique active lead Session's original workspace root owns `<header.cwd>/.dsh/devlead/board.json`;
9
+ `boardPath` is only an optional absolute override. With no active lead (or no absolute workspace
10
+ root) the board is disabled (`BOARD_DISABLED`, empty summary, no browser global), and turning the
11
+ lead off or switching leads releases the old store/watcher before the new file is read. A board
12
+ start/pre-create failure is logged and surfaced as `boardStartError` but never rejects service
13
+ activation: the board reports `BOARD_IO_ERROR` while the rest of DevLead keeps working. `updateBoard`
14
+ stamps the calling lead identity and requires the caller to be the current active lead. The file is
15
+ lead-AI-writable and human/browser-read-only.
16
+ The same Host-owned board service also owns `ctx.devLead.notes`, a `DevLeadBoardNotesStore` rooted at
17
+ `dirname(boardPath)/notes/` and swapped/closed with the board lifecycle. Tool-facing service methods are
18
+ `readBoardNote(agent, { project, note? })` and
19
+ `writeBoardNote(agent, { project, operation, note?, title?, summary?, content?, expectedRevision? }, signal?)`;
20
+ both recheck the active lead and accept no filesystem path input. Results derive an `absolutePath` for native
21
+ DSH `read`/`write`/`edit` body editing; it is never persisted in the index. Operations are `create` (optional
22
+ initial content), `update-metadata`, and `delete`; there is no tool body-update/append or body-byte CAS. The store
23
+ exposes `path` / `indexPath` / `enabled`, `start()` / `close()`, cache-only `summaryIndex()`, and logical `read()` /
24
+ `write()`. Its strict schema-v1 `index.json` is the committed source of truth and contains only project/note
25
+ metadata; Markdown bodies live at `<sanitized project>/<note-id>.md`, and orphan files are ignored. Every index
26
+ mutation resolves the board project by id/title/absolute workspace path, fresh-reads under the cross-process file
27
+ lock, checks `expected_revision`, validates the complete next index, and atomically replaces it. Reads/lists also
28
+ serialize through that lock, validate stable UTF-8 body snapshots within 256 KiB, and lazily repair `bytes` and
29
+ file-mtime `updatedAt` without writing bodies; any invalid/missing body aborts the repair and preserves the old
30
+ index. The index is capped at 128 KiB and each project at 100 notes. A bad index is never overwritten from a stale
31
+ cache and does not block the board or DevLead; notes operations still require a valid board project. The synchronous board summary
32
+ reads the valid board + notes caches and adds
33
+ active-project note counts/latest titles within its existing 1536-byte cap. Humans and browsers stay
34
+ read-only.
35
+ See [docs/BOARD.md](https://github.com/yankeguo/dsh-devlead/blob/main/docs/BOARD.md) for both schema
36
+ v1 contracts, store/service APIs, CAS, corruption handling, read caps, and the dynamic summary contract.
7
37
 
8
38
  DevLead mode is **globally single-active**: at most one Session (across every Workspace) may be
9
39
  enabled. `setEnabled(agent, true)` throws `DEVLEAD_ALREADY_ACTIVE` naming the occupant when another
@@ -50,7 +80,8 @@ dsh plugin --profile desktop add @yankeguo/dsh-devlead-bundle
50
80
 
51
81
  - DSH `0.2.2-rc.1`–`0.2.2-rc.5` (the package declares `engines.dsh: >=0.2.2-rc.1 <0.3.0`; this checkout's devDependencies pin rc.1 for the oldest-API typecheck).
52
82
  - Peer services `agents`, `sessions`, `sessionProjections` (provided by the default `dsh-base`
53
- composition).
83
+ composition). The board file uses the peer library `@deepseek-ai/dsh-atomic-write`
84
+ (`writeFileAtomic` / `withFileLock`), which the installed DSH runtime provides.
54
85
  - Optional, probed at call time: `workspaceRegistry`, `sessionController`, `sessionTitle`,
55
86
  `agentPresets` (read-only preset roster discovery), `sessionQuery`, `sessionProjectionCache`
56
87
  (cold-lead rehydration pre-filter), `sessionPersistence` (durable-corpus readiness barrier),
@@ -68,8 +99,13 @@ dsh plugin --profile desktop add @yankeguo/dsh-devlead-bundle
68
99
  ## Configuration
69
100
 
70
101
  The Loader row id `devlead` accepts `notificationBatchMs`, `maxWatchedSessions`,
71
- `maxListedSessions`, `wakeColdSession` (default `true` since 0.2.0), and `defaultAgentPreset`
72
- (used when a created Session names no preset; an invalid id fails creation). See the
102
+ `maxListedSessions`, `wakeColdSession` (default `true` since 0.2.0), `defaultAgentPreset`
103
+ (used when a created Session names no preset; an invalid id fails creation), and the optional
104
+ `boardPath` override. The board is enabled by default: a trimmed-blank / omitted `boardPath` derives
105
+ `<active lead Session header cwd>/.dsh/devlead/board.json`; a non-blank value must be absolute and
106
+ wins over the derived path (relative paths are rejected). Existing explicit `boardPath` deployments
107
+ keep their path and behaviour unchanged, and no tool argument can redirect the board file.
108
+ See the
73
109
  [configuration section](https://github.com/yankeguo/dsh-devlead/blob/main/README.md#configuration) for defaults and ranges; all limits are
74
110
  validated at both the Loader and direct-construction boundaries.
75
111
 
@@ -84,6 +120,25 @@ validated at both the Loader and direct-construction boundaries.
84
120
  `@yankeguo/dsh-devlead` 是套件的 Host 核心服务 `ctx.devLead`:模式开关、损坏状态恢复
85
121
  `reset()`、Workspace/Session 编排(`useWorkspace(agent, request, signal?)`,目录创建 opt-in)、
86
122
  带冷 lead 索引重建的关注关系索引与通知投递,以及 `devLead` / `devLeadMode` / `devLeadWatch` projection。
123
+ 项目看板默认启用:由唯一 active lead 的 `SessionHeader.cwd` 派生
124
+ `<cwd>/.dsh/devlead/board.json`,`boardPath` 只作可选绝对路径 override(override 也允许 lead
125
+ 没有 workspace 根时仍有看板);没有 lead 时禁用,
126
+ lead off/切换会释放旧 store/watcher,start/预创建失败只记 warning + degraded、不阻塞服务加载
127
+ (board 工具报 `BOARD_IO_ERROR`,其余功能照常)。看板与 notes 写入都使用
128
+ `@deepseek-ai/dsh-atomic-write`(安装运行时提供)。同一 Host board service 拥有随 board
129
+ 切换/关闭的 `ctx.devLead.notes`(`DevLeadBoardNotesStore`,root 固定
130
+ `dirname(boardPath)/notes/`)。工具侧 service 方法是 `readBoardNote(agent,{project,note?})` 与
131
+ `writeBoardNote(agent,patch,signal?)`,patch 含 create/update-metadata/delete operation、可选
132
+ note/title/summary/create-only content 与 expectedRevision,均不接受文件路径输入;返回的 absolutePath 供
133
+ DSH 原生 read/write/edit 编辑正文,不写入 index,也不再提供工具 update/append 或正文 bytes CAS。store
134
+ 暴露 path/indexPath/enabled、start/close、summaryIndex 与逻辑 read/write。严格 schema-v1 `index.json`
135
+ 是提交事实、只存 metadata,正文位于 `<sanitized project>/<note-id>.md`,orphan 忽略。每次 index 修改在
136
+ 跨进程文件锁内 fresh read,校验 `expected_revision`,验证完整 next index 后原子替换;read/list 也串行
137
+ 进入该锁,验证稳定、≤256 KiB 的合法 UTF-8 正文快照并惰性修复 bytes/文件 mtime updatedAt,绝不重写正文;
138
+ 缺失/非法正文会中止修复并保留旧 index。index ≤128 KiB、每项目 ≤100 条。坏 index 不会用旧缓存覆盖,也不阻塞 board/DevLead;
139
+ notes 操作仍要求能解析合法 board project。同步 board summary 从合法缓存为 active 项目附加 note 数/
140
+ 最近标题,整体仍 ≤1536 bytes。人类与浏览器
141
+ 只读。
87
142
  `agents`、`sessions`、`sessionProjections` 为必需 peer;Workspace registry、Session controller、
88
143
  标题/查询服务、projection cache、`sessionPersistence`(冷重建就绪屏障)与实验性 worktree 能力
89
144
  均为可选探测。完整中文文档见[根 README.zh.md](https://github.com/yankeguo/dsh-devlead/blob/main/README.zh.md)与