@yankeguo/dsh-devlead-protocol 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 (4) hide show
  1. package/README.md +32 -7
  2. package/lib/client.js +14786 -6
  3. package/lib/index.js +14786 -6
  4. package/package.json +4 -3
package/README.md CHANGED
@@ -1,10 +1,21 @@
1
1
  # @yankeguo/dsh-devlead-protocol
2
2
 
3
3
  Pure shared protocol for the DevLead plugin suite: durable record payloads, Session projection
4
- types, formatting helpers, and the constants both the Host and the browser bundle use.
4
+ types, the strict project-board and project-notes wire schemas (both v1), formatting helpers, and the
5
+ constants both the Host and the browser bundle use. It is the only package both halves share: the
6
+ board's default path segments (`DEVLEAD_BOARD_DIR_SEGMENTS`, `DEVLEAD_BOARD_FILE_NAME`) and the
7
+ `DEVLEAD_BOARD_READ_MAX_BYTES` tool-read cap live here, so the Host (which derives
8
+ `<lead header.cwd>/.dsh/devlead/board.json`) and the browser (which derives the same default path
9
+ from the Session summary `cwd` when the page-load global is absent) cannot drift. Notes constants
10
+ identify `dirname(boardPath)/notes/index.json`, cap the index at 128 KiB and each Markdown body at
11
+ 256 KiB, and limit each project to 100 notes.
5
12
 
6
13
  This package has **no runtime dependency** on any DSH package. Its single DSH import is a
7
- type-only projection-map augmentation; it is erased at build time. Installing it alone does not
14
+ type-only projection-map augmentation; it is erased at build time. The one third-party runtime
15
+ dependency is `zod`, which builds the board and notes-index schemas shared by the Host validators and
16
+ browser decoders: both published entries bundle it, so an installed profile does not need to resolve `zod`
17
+ for the Host half, while DSH's browser build imports the frozen module table's `zod` platform
18
+ singleton (the same module `client-ui` already relied on). Installing this package alone does not
8
19
  enable DevLead — install the bundle (below) to get the host service, tools, command, and UI.
9
20
 
10
21
  ## Install
@@ -22,7 +33,7 @@ Only install this package directly when you are composing the suite yourself.
22
33
  | Export | Contents |
23
34
  | --- | --- |
24
35
  | `@yankeguo/dsh-devlead-protocol` | Host entry; re-exports the client-safe surface |
25
- | `@yankeguo/dsh-devlead-protocol/client` | Browser-safe constants, types, and pure formatting helpers |
36
+ | `@yankeguo/dsh-devlead-protocol/client` | Browser-safe constants, types, pure formatting helpers, the shared board and notes-index schema factories/parsers, and the default board path segments / read cap |
26
37
  | `@yankeguo/dsh-devlead-protocol/package.json` | Package manifest |
27
38
 
28
39
  The public contract includes the `devLead` / `devLeadMode` / `devLeadWatch` projection keys and
@@ -34,7 +45,23 @@ restarts all three projections from their empty state), the summary-sized `DevLe
34
45
  instant constants, transition/report-kind vocabulary, `devLeadReportId`, `reportLine`,
35
46
  `notificationLine` / `excerptLine` / `formatInstant`, the `DevLeadUseWorkspaceRequest` shape
36
47
  (`{ path, title?, create? }`, `create` defaults to `false`), and the `DevLeadIsolation` outcome
37
- carried by the required `DevLeadCreatedSession.isolation` field.
48
+ carried by the required `DevLeadCreatedSession.isolation` field, plus the project-board contract:
49
+ the schema version, byte/count/length limits, the default path segment constants, the 64 KiB
50
+ `DEVLEAD_BOARD_READ_MAX_BYTES` read cap, durable project/blocker/task types, and
51
+ `createDevLeadBoardSchema(isAbsolutePath)` — one strict decoder both the Host (with its own
52
+ `node:path.isAbsolute`) and the browser (with the Host-published `pathPlatform`) consume, including
53
+ duplicate project/workspace-path/blocker/task rules, UTC-only timestamps, and strict unknown-field
54
+ rejection. The notes contract adds `DevLeadNotesIndex` / `DevLeadNotesProject` /
55
+ `DevLeadNoteMetadata`, `createDevLeadNotesIndexSchema()` and `parseDevLeadNotesIndex()`, plus
56
+ `DEVLEAD_NOTES_*` path and limit constants. Its strict schema-v1 index is
57
+ `{ schemaVersion:1, revision, updatedAt, projects:[{ id, directory, notes[] }] }`; metadata rows are
58
+ `{ id, title, summary, updatedAt, bytes, path }`. Unknown fields, duplicate project ids/directories,
59
+ duplicate note ids/paths, unsafe absolute/traversal paths, and any path other than the exact
60
+ `<project.directory>/<note.id>.md` are rejected. Note bodies never appear in the index. Host tool results may
61
+ derive an additional `absolutePath` for DSH-native body editing, but that field is deliberately not part of this
62
+ wire schema and is never persisted.
63
+ `client-ui` imports these constants and decoders from this package instead of depending on the Host
64
+ core package.
38
65
 
39
66
  ## Related docs
40
67
 
@@ -45,6 +72,4 @@ carried by the required `DevLeadCreatedSession.isolation` field.
45
72
  ## 中文
46
73
 
47
74
  `@yankeguo/dsh-devlead-protocol` 是 DevLead 套件的纯协议包:host 与浏览器共用的类型、常量、
48
- projection 键(`devLead` / `devLeadMode` / `devLeadWatch`)、`plugin:devlead/*` 持久记录类型(mode / watch / notification / report / reset)与格式化
49
- 函数,以及 `DevLeadUseWorkspaceRequest`、必填的 `DevLeadCreatedSession.isolation` 等请求/结果
50
- 形状。它没有运行时 DSH 依赖,通常随 bundle 安装。完整中文文档见[根 README.zh.md](https://github.com/yankeguo/dsh-devlead/blob/main/README.zh.md)与[设计说明](https://github.com/yankeguo/dsh-devlead/blob/main/docs/DESIGN.md)。
75
+ projection 键(`devLead` / `devLeadMode` / `devLeadWatch`)、`plugin:devlead/*` 持久记录类型(mode / watch / notification / report / reset)、项目看板与项目 notes 的严格 wire schema v1,以及格式化函数和请求/结果形状。看板导出 `createDevLeadBoardSchema(isAbsolutePath)`、limits、持久类型、重复 id/path 与 UTC 时间规则、RFC 6901 issue 映射;包内另导出看板默认路径段常量(`DEVLEAD_BOARD_DIR_SEGMENTS` = `.dsh`/`devlead`、`DEVLEAD_BOARD_FILE_NAME` = `board.json`)与 `devlead_board_read` 的 64 KiB 上限 `DEVLEAD_BOARD_READ_MAX_BYTES`,Host 与浏览器各自用自己的路径实现派生同一默认路径,不会各写一份。notes 导出 `DevLeadNotesIndex` / `DevLeadNotesProject` / `DevLeadNoteMetadata`、`createDevLeadNotesIndexSchema()` / `parseDevLeadNotesIndex()` 与 `DEVLEAD_NOTES_*` 常量:index 固定为 `{schemaVersion:1,revision,updatedAt,projects:[{id,directory,notes[]}]}`,metadata 固定为 `{id,title,summary,updatedAt,bytes,path}`;正文不进入 index,路径必须精确等于 `<directory>/<note-id>.md`。未知字段、重复 project id/directory/note id/path、绝对路径和 path traversal 一律拒绝;index ≤128 KiB、单 note ≤256 KiB、每项目 ≤100 条。它没有运行时 DSH 依赖;`zod` 是唯一的第三方运行期依赖,会被打包进两个发布入口,浏览器侧使用 DSH 冻结 module table 的 `zod` platform singleton。`@yankeguo/dsh-client-ui-devlead` 只依赖本包(不依赖 `@yankeguo/dsh-devlead`)。通常随 bundle 安装。完整中文文档见[根 README.zh.md](https://github.com/yankeguo/dsh-devlead/blob/main/README.zh.md)与[设计说明](https://github.com/yankeguo/dsh-devlead/blob/main/docs/DESIGN.md)。