@yankeguo/dsh-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.
- package/README.md +32 -4
- package/lib/index.js +716 -38
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,8 +13,25 @@ start/pre-create failure is logged and surfaced as `boardStartError` but never r
|
|
|
13
13
|
activation: the board reports `BOARD_IO_ERROR` while the rest of DevLead keeps working. `updateBoard`
|
|
14
14
|
stamps the calling lead identity and requires the caller to be the current active lead. The file is
|
|
15
15
|
lead-AI-writable and human/browser-read-only.
|
|
16
|
-
|
|
17
|
-
|
|
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?,
|
|
20
|
+
expectedBytes? }, signal?)`; both recheck the active lead and accept no filesystem path. The store exposes
|
|
21
|
+
`path` / `indexPath` / `enabled`, `start()` / `close()`, cache-only `summaryIndex()`, and logical `read()` /
|
|
22
|
+
`write()`. Its strict schema-v1 `index.json` is the committed source of truth and
|
|
23
|
+
contains only project/note metadata; Markdown bodies live at the index-declared
|
|
24
|
+
`<sanitized project>/<note-id>.md`, and orphan files are ignored. Every mutation resolves the board
|
|
25
|
+
project by id/title/absolute workspace path, fresh-reads under the cross-process file lock, checks
|
|
26
|
+
index `expected_revision` plus note-body `expected_bytes` CAS where applicable, validates the complete
|
|
27
|
+
next index, and atomically replaces files. The index is capped at 128 KiB, each note at 256 KiB, and
|
|
28
|
+
each project at 100 notes. A bad index is never overwritten from a stale cache and does not block the
|
|
29
|
+
board or DevLead; notes operations still require a valid board project. The synchronous board summary
|
|
30
|
+
reads the valid board + notes caches and adds
|
|
31
|
+
active-project note counts/latest titles within its existing 1536-byte cap. Humans and browsers stay
|
|
32
|
+
read-only.
|
|
33
|
+
See [docs/BOARD.md](https://github.com/yankeguo/dsh-devlead/blob/main/docs/BOARD.md) for both schema
|
|
34
|
+
v1 contracts, store/service APIs, CAS, corruption handling, read caps, and the dynamic summary contract.
|
|
18
35
|
|
|
19
36
|
DevLead mode is **globally single-active**: at most one Session (across every Workspace) may be
|
|
20
37
|
enabled. `setEnabled(agent, true)` throws `DEVLEAD_ALREADY_ACTIVE` naming the occupant when another
|
|
@@ -105,8 +122,19 @@ validated at both the Loader and direct-construction boundaries.
|
|
|
105
122
|
`<cwd>/.dsh/devlead/board.json`,`boardPath` 只作可选绝对路径 override(override 也允许 lead
|
|
106
123
|
没有 workspace 根时仍有看板);没有 lead 时禁用,
|
|
107
124
|
lead off/切换会释放旧 store/watcher,start/预创建失败只记 warning + degraded、不阻塞服务加载
|
|
108
|
-
(board 工具报 `BOARD_IO_ERROR
|
|
109
|
-
|
|
125
|
+
(board 工具报 `BOARD_IO_ERROR`,其余功能照常)。看板与 notes 写入都使用
|
|
126
|
+
`@deepseek-ai/dsh-atomic-write`(安装运行时提供)。同一 Host board service 拥有随 board
|
|
127
|
+
切换/关闭的 `ctx.devLead.notes`(`DevLeadBoardNotesStore`,root 固定
|
|
128
|
+
`dirname(boardPath)/notes/`)。工具侧 service 方法是 `readBoardNote(agent,{project,note?})` 与
|
|
129
|
+
`writeBoardNote(agent,patch,signal?)`,patch 含 operation、可选 note/title/summary/content 与
|
|
130
|
+
expectedRevision/expectedBytes,均不接受文件路径;store 暴露 path/indexPath/enabled、start/close、
|
|
131
|
+
summaryIndex 与逻辑 read/write。严格 schema-v1 `index.json` 是提交事实、只存 metadata,正文位于
|
|
132
|
+
`<sanitized project>/<note-id>.md`,orphan 忽略。每次修改在跨进程文件锁内 fresh read,校验 index
|
|
133
|
+
`expected_revision` 与适用的 note `expected_bytes` CAS,验证完整 next index 后原子替换;index
|
|
134
|
+
≤128 KiB、单 note ≤256 KiB、每项目 ≤100 条。坏 index 不会用旧缓存覆盖,也不阻塞 board/DevLead;
|
|
135
|
+
notes 操作仍要求能解析合法 board project。同步 board summary 从合法缓存为 active 项目附加 note 数/
|
|
136
|
+
最近标题,整体仍 ≤1536 bytes。人类与浏览器
|
|
137
|
+
只读。
|
|
110
138
|
`agents`、`sessions`、`sessionProjections` 为必需 peer;Workspace registry、Session controller、
|
|
111
139
|
标题/查询服务、projection cache、`sessionPersistence`(冷重建就绪屏障)与实验性 worktree 能力
|
|
112
140
|
均为可选探测。完整中文文档见[根 README.zh.md](https://github.com/yankeguo/dsh-devlead/blob/main/README.zh.md)与
|
package/lib/index.js
CHANGED
|
@@ -6,8 +6,8 @@ var __export = (target, all) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// packages/devlead/src/index.ts
|
|
9
|
-
import { mkdir as
|
|
10
|
-
import { isAbsolute as
|
|
9
|
+
import { mkdir as mkdir3, stat as stat4 } from "node:fs/promises";
|
|
10
|
+
import { isAbsolute as isAbsolute4 } from "node:path";
|
|
11
11
|
import { Service } from "@deepseek-ai/cordis";
|
|
12
12
|
import z2 from "@deepseek-ai/schemastery";
|
|
13
13
|
import { MessageId, ReasoningEffortId } from "@deepseek-ai/dsh-llm";
|
|
@@ -151,12 +151,12 @@ function isUnknownNonIgnorableEventError(error51) {
|
|
|
151
151
|
}
|
|
152
152
|
async function recoverUnknownEventSessionLog(ctx, header, signal) {
|
|
153
153
|
const persistence = ctx.get("sessionPersistence");
|
|
154
|
-
const
|
|
155
|
-
if (typeof
|
|
154
|
+
const stat5 = persistence?.stat;
|
|
155
|
+
if (typeof stat5 !== "function") {
|
|
156
156
|
throw new Error(`Session "${String(header.id)}" needs read-only log recovery, but the persistence backend exposes no stat()`);
|
|
157
157
|
}
|
|
158
158
|
signal?.throwIfAborted();
|
|
159
|
-
const snapshot = await
|
|
159
|
+
const snapshot = await stat5.call(
|
|
160
160
|
persistence,
|
|
161
161
|
header.id,
|
|
162
162
|
signal === void 0 ? void 0 : { signal }
|
|
@@ -18112,17 +18112,17 @@ function resolveDevLeadBoardPath(input = {}) {
|
|
|
18112
18112
|
};
|
|
18113
18113
|
}
|
|
18114
18114
|
function boundReadResult(result) {
|
|
18115
|
-
const
|
|
18115
|
+
const serializedBytes2 = (projects2, truncated2) => Buffer.byteLength(JSON.stringify({
|
|
18116
18116
|
revision: result.revision,
|
|
18117
18117
|
updatedAt: result.updatedAt,
|
|
18118
18118
|
projects: projects2,
|
|
18119
18119
|
...truncated2 ? { truncated: true } : {}
|
|
18120
18120
|
}), "utf8");
|
|
18121
|
-
if (
|
|
18121
|
+
if (serializedBytes2(result.projects, result.truncated === true) <= DEVLEAD_BOARD_READ_MAX_BYTES) return result;
|
|
18122
18122
|
const projects = result.projects.map((project) => structuredClone(project));
|
|
18123
18123
|
let truncated = true;
|
|
18124
18124
|
for (; ; ) {
|
|
18125
|
-
if (
|
|
18125
|
+
if (serializedBytes2(projects, truncated) <= DEVLEAD_BOARD_READ_MAX_BYTES) break;
|
|
18126
18126
|
let trimmed = false;
|
|
18127
18127
|
for (let index = projects.length - 1; index >= 0 && !trimmed; index -= 1) {
|
|
18128
18128
|
const tasks = projects[index]?.tasks;
|
|
@@ -18157,7 +18157,7 @@ var DEVLEAD_BOARD_PREFLIGHT_PROJECT_ID = "devlead-validation";
|
|
|
18157
18157
|
function singleLine(value) {
|
|
18158
18158
|
return value.replaceAll(/[\p{Cc}\p{Cf}]+/gu, " ").replaceAll(/\s+/gu, " ").trim();
|
|
18159
18159
|
}
|
|
18160
|
-
function
|
|
18160
|
+
function resolveDevLeadBoardProject(board, reference) {
|
|
18161
18161
|
const trimmed = reference.trim();
|
|
18162
18162
|
if (trimmed.length === 0) {
|
|
18163
18163
|
throw new DevLeadBoardError("project must not be empty", "BOARD_INVALID", [
|
|
@@ -18193,7 +18193,7 @@ function validateUpdateInput(patch) {
|
|
|
18193
18193
|
const candidate = emptyBoard(normalized.updatedBy, timestamp);
|
|
18194
18194
|
if (patch.create !== true) {
|
|
18195
18195
|
const reference = patch.project.trim();
|
|
18196
|
-
if (reference.length === 0)
|
|
18196
|
+
if (reference.length === 0) resolveDevLeadBoardProject(candidate, reference);
|
|
18197
18197
|
const validationTasks = /* @__PURE__ */ new Map();
|
|
18198
18198
|
for (const upsert2 of patch.tasks?.upsert ?? []) {
|
|
18199
18199
|
if (!validationTasks.has(upsert2.id)) {
|
|
@@ -18256,7 +18256,7 @@ function appendUtf8(target, addition, maximum) {
|
|
|
18256
18256
|
target.bytes += bytes;
|
|
18257
18257
|
return true;
|
|
18258
18258
|
}
|
|
18259
|
-
function renderDevLeadBoardSummary(board) {
|
|
18259
|
+
function renderDevLeadBoardSummary(board, notes) {
|
|
18260
18260
|
if (board === void 0 || board.projects.length === 0) return "";
|
|
18261
18261
|
const counts = { active: 0, blocked: 0, paused: 0, done: 0 };
|
|
18262
18262
|
for (const project of board.projects) counts[project.status] += 1;
|
|
@@ -18265,8 +18265,14 @@ function renderDevLeadBoardSummary(board) {
|
|
|
18265
18265
|
];
|
|
18266
18266
|
for (const project of board.projects) {
|
|
18267
18267
|
const focus = Array.from(singleLine(project.focus)).slice(0, 120).join("");
|
|
18268
|
+
const projectNotes = project.status === "active" ? notes?.projects.find((candidate) => candidate.id === project.id)?.notes : void 0;
|
|
18269
|
+
const latest = projectNotes?.reduce(
|
|
18270
|
+
(current, note) => current === void 0 || note.updatedAt > current.updatedAt ? note : current,
|
|
18271
|
+
void 0
|
|
18272
|
+
);
|
|
18273
|
+
const latestTitle = latest === void 0 ? "" : Array.from(singleLine(latest.title)).slice(0, 80).join("");
|
|
18268
18274
|
lines.push(
|
|
18269
|
-
`- ${singleLine(project.id)}/${singleLine(project.workspace.title)} [${project.status}/${project.priority}]${focus.length === 0 ? "" : ` focus: ${focus}`}${project.blockers.length === 0 ? "" : ` !blockers:${project.blockers.length}`}`
|
|
18275
|
+
`- ${singleLine(project.id)}/${singleLine(project.workspace.title)} [${project.status}/${project.priority}]${focus.length === 0 ? "" : ` focus: ${focus}`}${project.blockers.length === 0 ? "" : ` !blockers:${project.blockers.length}`}${projectNotes === void 0 || projectNotes.length === 0 ? "" : ` notes:${projectNotes.length}`}${latestTitle.length === 0 ? "" : ` latest:"${latestTitle}"`}`
|
|
18270
18276
|
);
|
|
18271
18277
|
}
|
|
18272
18278
|
const output = { text: "", bytes: 0 };
|
|
@@ -18476,10 +18482,10 @@ var DevLeadBoardStore = class {
|
|
|
18476
18482
|
let projects;
|
|
18477
18483
|
let truncated = false;
|
|
18478
18484
|
if (filter.project !== void 0) {
|
|
18479
|
-
projects = [
|
|
18485
|
+
projects = [resolveDevLeadBoardProject(board, filter.project)];
|
|
18480
18486
|
} else {
|
|
18481
|
-
const
|
|
18482
|
-
projects = board.projects.slice(0,
|
|
18487
|
+
const limit2 = Math.min(filter.limit ?? DEVLEAD_BOARD_MAX_PROJECTS, DEVLEAD_BOARD_MAX_PROJECTS);
|
|
18488
|
+
projects = board.projects.slice(0, limit2);
|
|
18483
18489
|
truncated = board.projects.length > projects.length;
|
|
18484
18490
|
}
|
|
18485
18491
|
return boundReadResult({
|
|
@@ -18492,6 +18498,10 @@ var DevLeadBoardStore = class {
|
|
|
18492
18498
|
...truncated ? { truncated: true } : {}
|
|
18493
18499
|
});
|
|
18494
18500
|
}
|
|
18501
|
+
/** Resolve one id/title/path against the latest valid board snapshot. */
|
|
18502
|
+
async resolveProject(reference) {
|
|
18503
|
+
return structuredClone(resolveDevLeadBoardProject(await this.current(), reference));
|
|
18504
|
+
}
|
|
18495
18505
|
/**
|
|
18496
18506
|
* Apply one project mutation. Host calls share one promise chain; every call
|
|
18497
18507
|
* then performs its own locked disk read-modify-write cycle.
|
|
@@ -18535,7 +18545,7 @@ var DevLeadBoardStore = class {
|
|
|
18535
18545
|
}
|
|
18536
18546
|
const next = structuredClone(current);
|
|
18537
18547
|
const changed = applyProjectPatch(next, patch, timestamp);
|
|
18538
|
-
const project =
|
|
18548
|
+
const project = resolveDevLeadBoardProject(next, patch.project);
|
|
18539
18549
|
if (changed.length === 0) {
|
|
18540
18550
|
return {
|
|
18541
18551
|
revision: current.revision,
|
|
@@ -18568,7 +18578,7 @@ var DevLeadBoardStore = class {
|
|
|
18568
18578
|
return {
|
|
18569
18579
|
revision: validated.revision,
|
|
18570
18580
|
updatedAt: validated.updatedAt,
|
|
18571
|
-
project: projectView(
|
|
18581
|
+
project: projectView(resolveDevLeadBoardProject(validated, project.id), false),
|
|
18572
18582
|
changed
|
|
18573
18583
|
};
|
|
18574
18584
|
}, signal === void 0 ? {} : { signal });
|
|
@@ -18579,16 +18589,16 @@ var DevLeadBoardStore = class {
|
|
|
18579
18589
|
}
|
|
18580
18590
|
}
|
|
18581
18591
|
/** Synchronous cache-only text for `systemPrompt.context()`. */
|
|
18582
|
-
summary() {
|
|
18592
|
+
summary(notes) {
|
|
18583
18593
|
if (this.filePath === void 0) return "";
|
|
18584
|
-
return renderDevLeadBoardSummary(this.cache);
|
|
18594
|
+
return renderDevLeadBoardSummary(this.cache, notes);
|
|
18585
18595
|
}
|
|
18586
18596
|
};
|
|
18587
18597
|
function applyProjectPatch(board, patch, timestamp) {
|
|
18588
18598
|
const changed = [];
|
|
18589
18599
|
let project;
|
|
18590
18600
|
try {
|
|
18591
|
-
project =
|
|
18601
|
+
project = resolveDevLeadBoardProject(board, patch.project);
|
|
18592
18602
|
} catch (error51) {
|
|
18593
18603
|
if (!(error51 instanceof DevLeadBoardError) || error51.code !== "BOARD_PROJECT_NOT_FOUND" || patch.create !== true) throw error51;
|
|
18594
18604
|
const workspacePatch = patch.set?.workspace;
|
|
@@ -18724,6 +18734,606 @@ function applyProjectPatch(board, patch, timestamp) {
|
|
|
18724
18734
|
return changed;
|
|
18725
18735
|
}
|
|
18726
18736
|
|
|
18737
|
+
// packages/devlead/src/notes.ts
|
|
18738
|
+
import { createHash as createHash2, randomUUID as cryptoRandomUUID } from "node:crypto";
|
|
18739
|
+
import { mkdir as mkdir2, readFile as readFile2, rm, stat as stat3 } from "node:fs/promises";
|
|
18740
|
+
import { dirname as dirname2, isAbsolute as isAbsolute3, join as join2 } from "node:path";
|
|
18741
|
+
import { withFileLock as withFileLock2, writeFileAtomic as writeFileAtomic2 } from "@deepseek-ai/dsh-atomic-write";
|
|
18742
|
+
import {
|
|
18743
|
+
createDevLeadNotesIndexSchema,
|
|
18744
|
+
devLeadBoardIssueViews as devLeadBoardIssueViews2,
|
|
18745
|
+
DEVLEAD_NOTES_DIR_NAME,
|
|
18746
|
+
DEVLEAD_NOTES_DIRECTORY_MAX,
|
|
18747
|
+
DEVLEAD_NOTES_ID_MAX,
|
|
18748
|
+
DEVLEAD_NOTES_INDEX_FILE_NAME,
|
|
18749
|
+
DEVLEAD_NOTES_INDEX_MAX_BYTES,
|
|
18750
|
+
DEVLEAD_NOTES_MAX_PER_PROJECT,
|
|
18751
|
+
DEVLEAD_NOTES_MAX_PROJECTS,
|
|
18752
|
+
DEVLEAD_NOTES_NOTE_MAX_BYTES,
|
|
18753
|
+
DEVLEAD_NOTES_PATH_MAX,
|
|
18754
|
+
DEVLEAD_NOTES_READ_MAX_BYTES,
|
|
18755
|
+
DEVLEAD_NOTES_SCHEMA_VERSION,
|
|
18756
|
+
DEVLEAD_NOTES_SUMMARY_MAX,
|
|
18757
|
+
DEVLEAD_NOTES_TIMESTAMP_MAX,
|
|
18758
|
+
DEVLEAD_NOTES_TITLE_MAX
|
|
18759
|
+
} from "@yankeguo/dsh-devlead-protocol";
|
|
18760
|
+
var notesIndexSchema = createDevLeadNotesIndexSchema();
|
|
18761
|
+
var EMPTY_TIMESTAMP = (/* @__PURE__ */ new Date(0)).toISOString();
|
|
18762
|
+
var READ_ATTEMPTS = 4;
|
|
18763
|
+
function emptyIndex() {
|
|
18764
|
+
return {
|
|
18765
|
+
schemaVersion: DEVLEAD_NOTES_SCHEMA_VERSION,
|
|
18766
|
+
revision: 0,
|
|
18767
|
+
updatedAt: EMPTY_TIMESTAMP,
|
|
18768
|
+
projects: []
|
|
18769
|
+
};
|
|
18770
|
+
}
|
|
18771
|
+
function sameFingerprint2(left, right) {
|
|
18772
|
+
return left !== void 0 && left.mtimeMs === right.mtimeMs && left.size === right.size && left.ino === right.ino;
|
|
18773
|
+
}
|
|
18774
|
+
function errorMessage3(error51) {
|
|
18775
|
+
return error51 instanceof Error ? error51.message : String(error51);
|
|
18776
|
+
}
|
|
18777
|
+
function errorCode2(error51) {
|
|
18778
|
+
if (typeof error51 !== "object" || error51 === null) return void 0;
|
|
18779
|
+
const code = error51.code;
|
|
18780
|
+
return typeof code === "string" ? code : void 0;
|
|
18781
|
+
}
|
|
18782
|
+
var FILESYSTEM_ERROR_CODES2 = /* @__PURE__ */ new Set([
|
|
18783
|
+
"EACCES",
|
|
18784
|
+
"EAGAIN",
|
|
18785
|
+
"EBUSY",
|
|
18786
|
+
"EDQUOT",
|
|
18787
|
+
"EEXIST",
|
|
18788
|
+
"EFBIG",
|
|
18789
|
+
"EIO",
|
|
18790
|
+
"EISDIR",
|
|
18791
|
+
"ELOOP",
|
|
18792
|
+
"EMFILE",
|
|
18793
|
+
"ENAMETOOLONG",
|
|
18794
|
+
"ENFILE",
|
|
18795
|
+
"ENOMEM",
|
|
18796
|
+
"ENOENT",
|
|
18797
|
+
"ENOSPC",
|
|
18798
|
+
"ENOTDIR",
|
|
18799
|
+
"ENOTEMPTY",
|
|
18800
|
+
"EPERM",
|
|
18801
|
+
"EROFS",
|
|
18802
|
+
"ETXTBSY"
|
|
18803
|
+
]);
|
|
18804
|
+
function isWriterLockTimeout2(error51) {
|
|
18805
|
+
const message = errorMessage3(error51);
|
|
18806
|
+
const code = errorCode2(error51);
|
|
18807
|
+
return code === "FILE_LOCK_TIMEOUT" || code === "ATOMIC_WRITE_LOCK_TIMEOUT" || /timed out waiting for the writer lock|writer lock timed out/iu.test(message);
|
|
18808
|
+
}
|
|
18809
|
+
function isWriteIoError2(error51) {
|
|
18810
|
+
const code = errorCode2(error51);
|
|
18811
|
+
return code !== void 0 && FILESYSTEM_ERROR_CODES2.has(code) || error51 instanceof Error && error51.name === "FileLockError" || isWriterLockTimeout2(error51);
|
|
18812
|
+
}
|
|
18813
|
+
function ioError(action, path, error51) {
|
|
18814
|
+
const retry = isWriterLockTimeout2(error51);
|
|
18815
|
+
return new DevLeadBoardError(
|
|
18816
|
+
`could not ${action} ${path}: ${errorMessage3(error51)}${retry ? "; retry after the current writer finishes" : ""}`,
|
|
18817
|
+
"BOARD_IO_ERROR"
|
|
18818
|
+
);
|
|
18819
|
+
}
|
|
18820
|
+
function invalid(message, pointer) {
|
|
18821
|
+
return new DevLeadBoardError(message, "BOARD_INVALID", [{ pointer, message }]);
|
|
18822
|
+
}
|
|
18823
|
+
function limit(message, pointer) {
|
|
18824
|
+
return new DevLeadBoardError(message, "BOARD_LIMIT_EXCEEDED", [{ pointer, message }]);
|
|
18825
|
+
}
|
|
18826
|
+
function validationError2(error51) {
|
|
18827
|
+
const issues = devLeadBoardIssueViews2(error51.issues);
|
|
18828
|
+
const limited = error51.issues.some((issue2) => issue2.code === "too_big");
|
|
18829
|
+
const first = issues[0];
|
|
18830
|
+
return new DevLeadBoardError(
|
|
18831
|
+
`notes index validation failed${first === void 0 ? "" : ` at ${first.pointer || "/"}: ${first.message}`}`,
|
|
18832
|
+
limited ? "BOARD_LIMIT_EXCEEDED" : "BOARD_INVALID",
|
|
18833
|
+
issues
|
|
18834
|
+
);
|
|
18835
|
+
}
|
|
18836
|
+
function parseIndex(value) {
|
|
18837
|
+
const parsed = notesIndexSchema.safeParse(value);
|
|
18838
|
+
if (!parsed.success) throw validationError2(parsed.error);
|
|
18839
|
+
return parsed.data;
|
|
18840
|
+
}
|
|
18841
|
+
function validateNonNegativeInteger(value, field) {
|
|
18842
|
+
if (value !== void 0 && (!Number.isSafeInteger(value) || value < 0)) {
|
|
18843
|
+
throw invalid(`${field} must be a non-negative safe integer`, `/${field}`);
|
|
18844
|
+
}
|
|
18845
|
+
}
|
|
18846
|
+
function validateContentSize(content, pointer = "/content") {
|
|
18847
|
+
const bytes = Buffer.byteLength(content, "utf8");
|
|
18848
|
+
if (bytes > DEVLEAD_NOTES_NOTE_MAX_BYTES) {
|
|
18849
|
+
throw limit(`note content exceeds ${DEVLEAD_NOTES_NOTE_MAX_BYTES} UTF-8 bytes (${bytes})`, pointer);
|
|
18850
|
+
}
|
|
18851
|
+
}
|
|
18852
|
+
function decodeUtf8(bytes, label) {
|
|
18853
|
+
try {
|
|
18854
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
18855
|
+
} catch (error51) {
|
|
18856
|
+
throw invalid(`${label} is not valid UTF-8: ${errorMessage3(error51)}`, "");
|
|
18857
|
+
}
|
|
18858
|
+
}
|
|
18859
|
+
function serializedBytes(value) {
|
|
18860
|
+
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
18861
|
+
}
|
|
18862
|
+
function boundNoteRead(result) {
|
|
18863
|
+
if (result.note === void 0 || serializedBytes(result) <= DEVLEAD_NOTES_READ_MAX_BYTES) return result;
|
|
18864
|
+
const characters = Array.from(result.note.content);
|
|
18865
|
+
let low = 0;
|
|
18866
|
+
let high = characters.length;
|
|
18867
|
+
let content = "";
|
|
18868
|
+
while (low <= high) {
|
|
18869
|
+
const middle = Math.floor((low + high) / 2);
|
|
18870
|
+
const candidate = characters.slice(0, middle).join("");
|
|
18871
|
+
const bounded = {
|
|
18872
|
+
...result,
|
|
18873
|
+
note: { ...result.note, content: candidate },
|
|
18874
|
+
truncated: true
|
|
18875
|
+
};
|
|
18876
|
+
if (serializedBytes(bounded) <= DEVLEAD_NOTES_READ_MAX_BYTES) {
|
|
18877
|
+
content = candidate;
|
|
18878
|
+
low = middle + 1;
|
|
18879
|
+
} else {
|
|
18880
|
+
high = middle - 1;
|
|
18881
|
+
}
|
|
18882
|
+
}
|
|
18883
|
+
return { ...result, note: { ...result.note, content }, truncated: true };
|
|
18884
|
+
}
|
|
18885
|
+
function validateWriteShape(patch) {
|
|
18886
|
+
validateNonNegativeInteger(patch.expectedRevision, "expectedRevision");
|
|
18887
|
+
validateNonNegativeInteger(patch.expectedBytes, "expectedBytes");
|
|
18888
|
+
if (!["create", "update", "append", "delete"].includes(patch.operation)) {
|
|
18889
|
+
throw invalid("operation must be create, update, append, or delete", "/operation");
|
|
18890
|
+
}
|
|
18891
|
+
if (patch.operation !== "create" && patch.note === void 0) {
|
|
18892
|
+
throw invalid(`note is required for ${patch.operation}`, "/note");
|
|
18893
|
+
}
|
|
18894
|
+
if (patch.operation === "create") {
|
|
18895
|
+
if (patch.title === void 0 || patch.title.trim().length === 0) {
|
|
18896
|
+
throw invalid("create requires a non-empty title", "/title");
|
|
18897
|
+
}
|
|
18898
|
+
if (patch.expectedBytes !== void 0) {
|
|
18899
|
+
throw invalid("expectedBytes is not valid for create", "/expectedBytes");
|
|
18900
|
+
}
|
|
18901
|
+
}
|
|
18902
|
+
if (patch.operation === "append") {
|
|
18903
|
+
if (patch.content === void 0) throw invalid("append requires content", "/content");
|
|
18904
|
+
if (patch.title !== void 0 || patch.summary !== void 0) {
|
|
18905
|
+
throw invalid("append accepts content but not title or summary", "/content");
|
|
18906
|
+
}
|
|
18907
|
+
}
|
|
18908
|
+
if (patch.operation === "delete" && (patch.title !== void 0 || patch.summary !== void 0 || patch.content !== void 0)) {
|
|
18909
|
+
throw invalid("delete does not accept title, summary, or content", "/operation");
|
|
18910
|
+
}
|
|
18911
|
+
if (patch.content !== void 0) validateContentSize(patch.content);
|
|
18912
|
+
const id = patch.note ?? "00000000-0000-4000-8000-000000000000";
|
|
18913
|
+
const directory = "project-0123456789ab";
|
|
18914
|
+
parseIndex({
|
|
18915
|
+
...emptyIndex(),
|
|
18916
|
+
projects: [{
|
|
18917
|
+
id: "validation",
|
|
18918
|
+
directory,
|
|
18919
|
+
notes: [{
|
|
18920
|
+
id,
|
|
18921
|
+
title: patch.title?.trim() ?? "DevLead validation",
|
|
18922
|
+
summary: patch.summary ?? "",
|
|
18923
|
+
updatedAt: EMPTY_TIMESTAMP,
|
|
18924
|
+
bytes: 0,
|
|
18925
|
+
path: `${directory}/${id}.md`
|
|
18926
|
+
}]
|
|
18927
|
+
}]
|
|
18928
|
+
});
|
|
18929
|
+
}
|
|
18930
|
+
function projectDirectory(projectId, index) {
|
|
18931
|
+
const existing = index.projects.find((project) => project.id === projectId);
|
|
18932
|
+
if (existing !== void 0) return existing.directory;
|
|
18933
|
+
const hash2 = createHash2("sha256").update(projectId, "utf8").digest("hex");
|
|
18934
|
+
const normalized = projectId.normalize("NFKD").toLowerCase();
|
|
18935
|
+
let base = normalized.replaceAll(/[^a-z0-9._-]+/gu, "-").replaceAll(/^[._-]+|[._-]+$/gu, "");
|
|
18936
|
+
base = base.slice(0, 48).replaceAll(/[._-]+$/gu, "");
|
|
18937
|
+
if (base.length === 0) base = "project";
|
|
18938
|
+
const short = `${base}-${hash2.slice(0, 12)}`;
|
|
18939
|
+
const collision = index.projects.some((project) => project.directory === short && project.id !== projectId);
|
|
18940
|
+
return collision ? `${base}-${hash2}` : short;
|
|
18941
|
+
}
|
|
18942
|
+
function noteFilePath(root, project, note) {
|
|
18943
|
+
return join2(root, project.directory, `${note.id}.md`);
|
|
18944
|
+
}
|
|
18945
|
+
var DevLeadBoardNotesStore = class {
|
|
18946
|
+
constructor(boardPath, board, logger2 = { warn: () => void 0 }, now = Date.now, randomUUID = cryptoRandomUUID) {
|
|
18947
|
+
this.board = board;
|
|
18948
|
+
this.logger = logger2;
|
|
18949
|
+
this.now = now;
|
|
18950
|
+
this.randomUUID = randomUUID;
|
|
18951
|
+
const trimmed = boardPath?.trim() ?? "";
|
|
18952
|
+
if (trimmed.length > 0 && !isAbsolute3(trimmed)) {
|
|
18953
|
+
throw invalid("boardPath must be an absolute path", "/boardPath");
|
|
18954
|
+
}
|
|
18955
|
+
this.rootPath = trimmed.length === 0 ? void 0 : join2(dirname2(trimmed), DEVLEAD_NOTES_DIR_NAME);
|
|
18956
|
+
this.filePath = this.rootPath === void 0 ? void 0 : join2(this.rootPath, DEVLEAD_NOTES_INDEX_FILE_NAME);
|
|
18957
|
+
}
|
|
18958
|
+
board;
|
|
18959
|
+
logger;
|
|
18960
|
+
now;
|
|
18961
|
+
randomUUID;
|
|
18962
|
+
rootPath;
|
|
18963
|
+
filePath;
|
|
18964
|
+
cache;
|
|
18965
|
+
lastError;
|
|
18966
|
+
writeTail = Promise.resolve();
|
|
18967
|
+
/** Absolute notes root, or undefined while the owning board is disabled. */
|
|
18968
|
+
get path() {
|
|
18969
|
+
return this.rootPath;
|
|
18970
|
+
}
|
|
18971
|
+
/** Absolute notes-index path, exposed for diagnostics/tests, never accepted as input. */
|
|
18972
|
+
get indexPath() {
|
|
18973
|
+
return this.filePath;
|
|
18974
|
+
}
|
|
18975
|
+
get enabled() {
|
|
18976
|
+
return this.rootPath !== void 0;
|
|
18977
|
+
}
|
|
18978
|
+
/** Prepare the root and populate the cache; a malformed index degrades reads, not service activation. */
|
|
18979
|
+
async start() {
|
|
18980
|
+
if (this.rootPath === void 0) return;
|
|
18981
|
+
const root = this.rootPath;
|
|
18982
|
+
try {
|
|
18983
|
+
await mkdir2(root, { recursive: true, mode: 448 });
|
|
18984
|
+
} catch (error51) {
|
|
18985
|
+
throw ioError("prepare notes root", root, error51);
|
|
18986
|
+
}
|
|
18987
|
+
await this.refresh();
|
|
18988
|
+
}
|
|
18989
|
+
/** Settle queued writes. No watcher or timer remains owned by this store. */
|
|
18990
|
+
async close() {
|
|
18991
|
+
await this.writeTail;
|
|
18992
|
+
}
|
|
18993
|
+
/** Last valid cached index for the synchronous board-summary renderer. */
|
|
18994
|
+
summaryIndex() {
|
|
18995
|
+
return this.cache;
|
|
18996
|
+
}
|
|
18997
|
+
requireRoot() {
|
|
18998
|
+
if (this.rootPath === void 0) {
|
|
18999
|
+
throw new DevLeadBoardError("DevLead board notes are disabled; activate a lead board first", "BOARD_DISABLED");
|
|
19000
|
+
}
|
|
19001
|
+
return this.rootPath;
|
|
19002
|
+
}
|
|
19003
|
+
requireIndexPath() {
|
|
19004
|
+
this.requireRoot();
|
|
19005
|
+
if (this.filePath === void 0) throw new DevLeadBoardError("DevLead board notes are disabled", "BOARD_DISABLED");
|
|
19006
|
+
return this.filePath;
|
|
19007
|
+
}
|
|
19008
|
+
async refresh() {
|
|
19009
|
+
const filePath = this.requireIndexPath();
|
|
19010
|
+
try {
|
|
19011
|
+
for (let attempt = 0; attempt < READ_ATTEMPTS; attempt += 1) {
|
|
19012
|
+
const before = await stat3(filePath);
|
|
19013
|
+
if (before.size > DEVLEAD_NOTES_INDEX_MAX_BYTES) {
|
|
19014
|
+
this.lastError = limit(
|
|
19015
|
+
`notes index exceeds ${DEVLEAD_NOTES_INDEX_MAX_BYTES} bytes (${before.size})`,
|
|
19016
|
+
""
|
|
19017
|
+
);
|
|
19018
|
+
return;
|
|
19019
|
+
}
|
|
19020
|
+
const bytes = await readFile2(filePath);
|
|
19021
|
+
const after = await stat3(filePath);
|
|
19022
|
+
if (!sameFingerprint2({ mtimeMs: before.mtimeMs, size: before.size, ino: before.ino }, {
|
|
19023
|
+
mtimeMs: after.mtimeMs,
|
|
19024
|
+
size: after.size,
|
|
19025
|
+
ino: after.ino
|
|
19026
|
+
}) || bytes.length !== after.size) continue;
|
|
19027
|
+
let value;
|
|
19028
|
+
try {
|
|
19029
|
+
value = JSON.parse(decodeUtf8(bytes, "notes index"));
|
|
19030
|
+
} catch (error51) {
|
|
19031
|
+
this.lastError = isDevLeadBoardError(error51) ? error51 : new DevLeadBoardError(
|
|
19032
|
+
`notes index is not valid JSON: ${errorMessage3(error51)}`,
|
|
19033
|
+
"BOARD_INVALID",
|
|
19034
|
+
[{ pointer: "", message: errorMessage3(error51) }]
|
|
19035
|
+
);
|
|
19036
|
+
return;
|
|
19037
|
+
}
|
|
19038
|
+
try {
|
|
19039
|
+
this.cache = parseIndex(value);
|
|
19040
|
+
} catch (error51) {
|
|
19041
|
+
this.lastError = isDevLeadBoardError(error51) ? error51 : new DevLeadBoardError(errorMessage3(error51), "BOARD_INVALID");
|
|
19042
|
+
return;
|
|
19043
|
+
}
|
|
19044
|
+
this.lastError = void 0;
|
|
19045
|
+
return;
|
|
19046
|
+
}
|
|
19047
|
+
this.lastError = ioError("read stable notes index", filePath, new Error("file changed repeatedly; retry"));
|
|
19048
|
+
} catch (error51) {
|
|
19049
|
+
if (errorCode2(error51) === "ENOENT") {
|
|
19050
|
+
this.cache = emptyIndex();
|
|
19051
|
+
this.lastError = void 0;
|
|
19052
|
+
return;
|
|
19053
|
+
}
|
|
19054
|
+
if (isDevLeadBoardError(error51)) {
|
|
19055
|
+
this.lastError = error51;
|
|
19056
|
+
return;
|
|
19057
|
+
}
|
|
19058
|
+
this.lastError = ioError("read notes index", filePath, error51);
|
|
19059
|
+
}
|
|
19060
|
+
}
|
|
19061
|
+
async current() {
|
|
19062
|
+
await this.refresh();
|
|
19063
|
+
if (this.lastError !== void 0) throw this.lastError;
|
|
19064
|
+
return this.cache ?? emptyIndex();
|
|
19065
|
+
}
|
|
19066
|
+
/** Read one project's metadata list, or one note body bounded for the model result. */
|
|
19067
|
+
async read(filter) {
|
|
19068
|
+
this.requireRoot();
|
|
19069
|
+
const boardProject = await this.board.resolveProject(filter.project);
|
|
19070
|
+
const index = await this.current();
|
|
19071
|
+
const project = index.projects.find((candidate) => candidate.id === boardProject.id);
|
|
19072
|
+
const view = { id: boardProject.id, directory: projectDirectory(boardProject.id, index) };
|
|
19073
|
+
if (filter.note === void 0) {
|
|
19074
|
+
return {
|
|
19075
|
+
revision: index.revision,
|
|
19076
|
+
updatedAt: index.updatedAt,
|
|
19077
|
+
project: view,
|
|
19078
|
+
notes: structuredClone(project?.notes ?? [])
|
|
19079
|
+
};
|
|
19080
|
+
}
|
|
19081
|
+
if (project === void 0) throw new DevLeadBoardError(`note "${filter.note}" was not found`, "BOARD_NOTE_NOT_FOUND");
|
|
19082
|
+
const metadata = project.notes.find((note) => note.id === filter.note);
|
|
19083
|
+
if (metadata === void 0) {
|
|
19084
|
+
throw new DevLeadBoardError(`note "${filter.note}" was not found`, "BOARD_NOTE_NOT_FOUND");
|
|
19085
|
+
}
|
|
19086
|
+
const body = await this.readBody(project, metadata);
|
|
19087
|
+
return boundNoteRead({
|
|
19088
|
+
revision: index.revision,
|
|
19089
|
+
updatedAt: index.updatedAt,
|
|
19090
|
+
project: view,
|
|
19091
|
+
note: { ...structuredClone(metadata), content: body.content }
|
|
19092
|
+
});
|
|
19093
|
+
}
|
|
19094
|
+
/** Serialize Host calls, then use the index file's cross-process writer lock for each mutation. */
|
|
19095
|
+
async write(patch, signal) {
|
|
19096
|
+
this.requireRoot();
|
|
19097
|
+
validateWriteShape(patch);
|
|
19098
|
+
signal?.throwIfAborted();
|
|
19099
|
+
const operation = this.writeTail.then(() => this.writeLocked(patch, signal));
|
|
19100
|
+
this.writeTail = operation.catch(() => void 0);
|
|
19101
|
+
return operation;
|
|
19102
|
+
}
|
|
19103
|
+
async writeLocked(patch, signal) {
|
|
19104
|
+
const root = this.requireRoot();
|
|
19105
|
+
const filePath = this.requireIndexPath();
|
|
19106
|
+
try {
|
|
19107
|
+
const boardProject = await this.board.resolveProject(patch.project);
|
|
19108
|
+
await mkdir2(root, { recursive: true, mode: 448 });
|
|
19109
|
+
return await withFileLock2(filePath, async () => {
|
|
19110
|
+
signal?.throwIfAborted();
|
|
19111
|
+
const current = await this.current();
|
|
19112
|
+
if (patch.expectedRevision !== void 0 && current.revision !== patch.expectedRevision) {
|
|
19113
|
+
throw new DevLeadBoardError(
|
|
19114
|
+
`notes index revision conflict: expected r${patch.expectedRevision}, current r${current.revision}`,
|
|
19115
|
+
"BOARD_REVISION_CONFLICT",
|
|
19116
|
+
[{ pointer: "/revision", message: `expected ${patch.expectedRevision}, current ${current.revision}` }]
|
|
19117
|
+
);
|
|
19118
|
+
}
|
|
19119
|
+
const timestamp = new Date(this.now()).toISOString();
|
|
19120
|
+
const next = structuredClone(current);
|
|
19121
|
+
let project = next.projects.find((candidate) => candidate.id === boardProject.id);
|
|
19122
|
+
if (patch.operation === "create") {
|
|
19123
|
+
if (project === void 0) {
|
|
19124
|
+
project = { id: boardProject.id, directory: projectDirectory(boardProject.id, next), notes: [] };
|
|
19125
|
+
next.projects.push(project);
|
|
19126
|
+
}
|
|
19127
|
+
return await this.createNote(root, filePath, current, next, project, patch, timestamp);
|
|
19128
|
+
}
|
|
19129
|
+
if (project === void 0) throw new DevLeadBoardError(`note "${patch.note ?? ""}" was not found`, "BOARD_NOTE_NOT_FOUND");
|
|
19130
|
+
const metadata = project.notes.find((note) => note.id === patch.note);
|
|
19131
|
+
if (metadata === void 0) {
|
|
19132
|
+
throw new DevLeadBoardError(`note "${patch.note ?? ""}" was not found`, "BOARD_NOTE_NOT_FOUND");
|
|
19133
|
+
}
|
|
19134
|
+
const body = patch.operation === "delete" && patch.expectedBytes === void 0 ? void 0 : await this.readBody(project, metadata);
|
|
19135
|
+
if (body !== void 0 && patch.expectedBytes !== void 0 && body.buffer.length !== patch.expectedBytes) {
|
|
19136
|
+
throw new DevLeadBoardError(
|
|
19137
|
+
`note byte conflict: expected ${patch.expectedBytes}, current ${body.buffer.length}`,
|
|
19138
|
+
"BOARD_BYTES_CONFLICT",
|
|
19139
|
+
[{ pointer: "/expectedBytes", message: `expected ${patch.expectedBytes}, current ${body.buffer.length}` }]
|
|
19140
|
+
);
|
|
19141
|
+
}
|
|
19142
|
+
if (patch.operation === "delete") {
|
|
19143
|
+
return await this.deleteNote(root, filePath, current, next, project, metadata, timestamp);
|
|
19144
|
+
}
|
|
19145
|
+
return await this.changeNote(root, filePath, current, next, project, metadata, body, patch, timestamp);
|
|
19146
|
+
}, signal === void 0 ? {} : { signal });
|
|
19147
|
+
} catch (error51) {
|
|
19148
|
+
if (isDevLeadBoardError(error51)) throw error51;
|
|
19149
|
+
if (isWriteIoError2(error51)) throw ioError("write notes", filePath, error51);
|
|
19150
|
+
throw error51;
|
|
19151
|
+
}
|
|
19152
|
+
}
|
|
19153
|
+
async createNote(root, filePath, current, next, project, patch, timestamp) {
|
|
19154
|
+
let id = patch.note;
|
|
19155
|
+
if (id === void 0) {
|
|
19156
|
+
for (let attempt = 0; attempt < 4; attempt += 1) {
|
|
19157
|
+
const candidate = this.randomUUID();
|
|
19158
|
+
if (!project.notes.some((note) => note.id === candidate)) {
|
|
19159
|
+
id = candidate;
|
|
19160
|
+
break;
|
|
19161
|
+
}
|
|
19162
|
+
}
|
|
19163
|
+
if (id === void 0) throw invalid("could not allocate a unique note id", "/note");
|
|
19164
|
+
parseIndex({
|
|
19165
|
+
...emptyIndex(),
|
|
19166
|
+
projects: [{ id: "validation", directory: project.directory, notes: [{
|
|
19167
|
+
id,
|
|
19168
|
+
title: "validation",
|
|
19169
|
+
summary: "",
|
|
19170
|
+
updatedAt: EMPTY_TIMESTAMP,
|
|
19171
|
+
bytes: 0,
|
|
19172
|
+
path: `${project.directory}/${id}.md`
|
|
19173
|
+
}] }]
|
|
19174
|
+
});
|
|
19175
|
+
}
|
|
19176
|
+
if (project.notes.some((note) => note.id === id)) {
|
|
19177
|
+
throw invalid(`note "${id}" already exists in project "${project.id}"`, "/note");
|
|
19178
|
+
}
|
|
19179
|
+
if (project.notes.length >= DEVLEAD_NOTES_MAX_PER_PROJECT) {
|
|
19180
|
+
throw limit(`project "${project.id}" already has ${DEVLEAD_NOTES_MAX_PER_PROJECT} notes`, "/notes");
|
|
19181
|
+
}
|
|
19182
|
+
const content = patch.content ?? "";
|
|
19183
|
+
const metadata = {
|
|
19184
|
+
id,
|
|
19185
|
+
title: patch.title.trim(),
|
|
19186
|
+
summary: patch.summary ?? "",
|
|
19187
|
+
updatedAt: timestamp,
|
|
19188
|
+
bytes: Buffer.byteLength(content, "utf8"),
|
|
19189
|
+
path: `${project.directory}/${id}.md`
|
|
19190
|
+
};
|
|
19191
|
+
project.notes.push(metadata);
|
|
19192
|
+
next.revision = current.revision + 1;
|
|
19193
|
+
next.updatedAt = timestamp;
|
|
19194
|
+
const validated = this.validateNext(next);
|
|
19195
|
+
const validatedProject = validated.projects.find((candidate) => candidate.id === project.id);
|
|
19196
|
+
const validatedNote = validatedProject.notes.find((note) => note.id === id);
|
|
19197
|
+
await this.writeBodyAndCommit(root, filePath, validatedProject, validatedNote, content, void 0, validated);
|
|
19198
|
+
return {
|
|
19199
|
+
revision: validated.revision,
|
|
19200
|
+
updatedAt: validated.updatedAt,
|
|
19201
|
+
project: { id: project.id, directory: project.directory },
|
|
19202
|
+
note: structuredClone(validatedNote),
|
|
19203
|
+
operation: "create",
|
|
19204
|
+
changed: true
|
|
19205
|
+
};
|
|
19206
|
+
}
|
|
19207
|
+
async changeNote(root, filePath, current, next, project, metadata, body, patch, timestamp) {
|
|
19208
|
+
const title = patch.title === void 0 ? metadata.title : patch.title.trim();
|
|
19209
|
+
if (title.length === 0) throw invalid("title must not be empty", "/title");
|
|
19210
|
+
const summary = patch.summary ?? metadata.summary;
|
|
19211
|
+
const content = patch.operation === "append" ? body.content + patch.content : patch.content ?? body.content;
|
|
19212
|
+
validateContentSize(content);
|
|
19213
|
+
const changed = title !== metadata.title || summary !== metadata.summary || content !== body.content;
|
|
19214
|
+
if (!changed) {
|
|
19215
|
+
return {
|
|
19216
|
+
revision: current.revision,
|
|
19217
|
+
updatedAt: current.updatedAt,
|
|
19218
|
+
project: { id: project.id, directory: project.directory },
|
|
19219
|
+
note: structuredClone(metadata),
|
|
19220
|
+
operation: patch.operation,
|
|
19221
|
+
changed: false
|
|
19222
|
+
};
|
|
19223
|
+
}
|
|
19224
|
+
Object.assign(metadata, {
|
|
19225
|
+
title,
|
|
19226
|
+
summary,
|
|
19227
|
+
updatedAt: timestamp,
|
|
19228
|
+
bytes: Buffer.byteLength(content, "utf8")
|
|
19229
|
+
});
|
|
19230
|
+
next.revision = current.revision + 1;
|
|
19231
|
+
next.updatedAt = timestamp;
|
|
19232
|
+
const validated = this.validateNext(next);
|
|
19233
|
+
const validatedProject = validated.projects.find((candidate) => candidate.id === project.id);
|
|
19234
|
+
const validatedNote = validatedProject.notes.find((note) => note.id === metadata.id);
|
|
19235
|
+
await this.writeBodyAndCommit(root, filePath, validatedProject, validatedNote, content, body.buffer, validated);
|
|
19236
|
+
return {
|
|
19237
|
+
revision: validated.revision,
|
|
19238
|
+
updatedAt: validated.updatedAt,
|
|
19239
|
+
project: { id: project.id, directory: project.directory },
|
|
19240
|
+
note: structuredClone(validatedNote),
|
|
19241
|
+
operation: patch.operation,
|
|
19242
|
+
changed: true
|
|
19243
|
+
};
|
|
19244
|
+
}
|
|
19245
|
+
async deleteNote(root, filePath, current, next, project, metadata, timestamp) {
|
|
19246
|
+
project.notes = project.notes.filter((note) => note.id !== metadata.id);
|
|
19247
|
+
if (project.notes.length === 0) next.projects = next.projects.filter((candidate) => candidate.id !== project.id);
|
|
19248
|
+
next.revision = current.revision + 1;
|
|
19249
|
+
next.updatedAt = timestamp;
|
|
19250
|
+
const validated = this.validateNext(next);
|
|
19251
|
+
await this.commitIndex(filePath, validated);
|
|
19252
|
+
try {
|
|
19253
|
+
await rm(noteFilePath(root, project, metadata), { force: true });
|
|
19254
|
+
} catch (error51) {
|
|
19255
|
+
this.logger.warn(`devlead: deleted note ${metadata.id} from the index but could not remove its orphan body: ${errorMessage3(error51)}`);
|
|
19256
|
+
}
|
|
19257
|
+
return {
|
|
19258
|
+
revision: validated.revision,
|
|
19259
|
+
updatedAt: validated.updatedAt,
|
|
19260
|
+
project: { id: project.id, directory: project.directory },
|
|
19261
|
+
note: structuredClone(metadata),
|
|
19262
|
+
operation: "delete",
|
|
19263
|
+
changed: true,
|
|
19264
|
+
deleted: true
|
|
19265
|
+
};
|
|
19266
|
+
}
|
|
19267
|
+
validateNext(next) {
|
|
19268
|
+
const validated = parseIndex(next);
|
|
19269
|
+
const content = `${JSON.stringify(validated, null, 2)}
|
|
19270
|
+
`;
|
|
19271
|
+
const bytes = Buffer.byteLength(content, "utf8");
|
|
19272
|
+
if (bytes > DEVLEAD_NOTES_INDEX_MAX_BYTES) {
|
|
19273
|
+
throw limit(`notes index update would exceed ${DEVLEAD_NOTES_INDEX_MAX_BYTES} bytes (${bytes})`, "");
|
|
19274
|
+
}
|
|
19275
|
+
return validated;
|
|
19276
|
+
}
|
|
19277
|
+
async writeBodyAndCommit(root, filePath, project, metadata, content, previous, validated) {
|
|
19278
|
+
const bodyPath = noteFilePath(root, project, metadata);
|
|
19279
|
+
await mkdir2(dirname2(bodyPath), { recursive: true, mode: 448 });
|
|
19280
|
+
await writeFileAtomic2(bodyPath, content, { mode: 384, dirMode: 448 });
|
|
19281
|
+
try {
|
|
19282
|
+
await this.commitIndex(filePath, validated);
|
|
19283
|
+
} catch (error51) {
|
|
19284
|
+
try {
|
|
19285
|
+
if (previous === void 0) await rm(bodyPath, { force: true });
|
|
19286
|
+
else await writeFileAtomic2(bodyPath, previous, { mode: 384, dirMode: 448 });
|
|
19287
|
+
} catch (rollbackError) {
|
|
19288
|
+
this.logger.warn(
|
|
19289
|
+
`devlead: notes index commit failed and body rollback also failed for ${metadata.id}: ${errorMessage3(rollbackError)}`
|
|
19290
|
+
);
|
|
19291
|
+
}
|
|
19292
|
+
throw error51;
|
|
19293
|
+
}
|
|
19294
|
+
}
|
|
19295
|
+
async commitIndex(filePath, validated) {
|
|
19296
|
+
await writeFileAtomic2(filePath, `${JSON.stringify(validated, null, 2)}
|
|
19297
|
+
`, { mode: 384, dirMode: 448 });
|
|
19298
|
+
this.cache = validated;
|
|
19299
|
+
this.lastError = void 0;
|
|
19300
|
+
}
|
|
19301
|
+
/** Read a stable body and reject a stale index/body byte mismatch instead of overwriting it. */
|
|
19302
|
+
async readBody(project, metadata) {
|
|
19303
|
+
const root = this.requireRoot();
|
|
19304
|
+
const path = noteFilePath(root, project, metadata);
|
|
19305
|
+
try {
|
|
19306
|
+
for (let attempt = 0; attempt < READ_ATTEMPTS; attempt += 1) {
|
|
19307
|
+
const before = await stat3(path);
|
|
19308
|
+
if (before.size > DEVLEAD_NOTES_NOTE_MAX_BYTES) {
|
|
19309
|
+
throw limit(`note "${metadata.id}" exceeds ${DEVLEAD_NOTES_NOTE_MAX_BYTES} bytes (${before.size})`, "/note");
|
|
19310
|
+
}
|
|
19311
|
+
const buffer = await readFile2(path);
|
|
19312
|
+
const after = await stat3(path);
|
|
19313
|
+
if (before.mtimeMs !== after.mtimeMs || before.size !== after.size || before.ino !== after.ino || buffer.length !== after.size) continue;
|
|
19314
|
+
if (buffer.length !== metadata.bytes) {
|
|
19315
|
+
throw invalid(
|
|
19316
|
+
`note "${metadata.id}" body has ${buffer.length} bytes but its index metadata records ${metadata.bytes}`,
|
|
19317
|
+
"/bytes"
|
|
19318
|
+
);
|
|
19319
|
+
}
|
|
19320
|
+
return { buffer, content: decodeUtf8(buffer, `note "${metadata.id}"`) };
|
|
19321
|
+
}
|
|
19322
|
+
throw ioError("read stable note", path, new Error("file changed repeatedly; retry"));
|
|
19323
|
+
} catch (error51) {
|
|
19324
|
+
if (isDevLeadBoardError(error51)) throw error51;
|
|
19325
|
+
if (errorCode2(error51) === "ENOENT") {
|
|
19326
|
+
throw new DevLeadBoardError(
|
|
19327
|
+
`note "${metadata.id}" is indexed but its Markdown body is missing`,
|
|
19328
|
+
"BOARD_NOTE_NOT_FOUND"
|
|
19329
|
+
);
|
|
19330
|
+
}
|
|
19331
|
+
if (isWriteIoError2(error51)) throw ioError("read note", path, error51);
|
|
19332
|
+
throw error51;
|
|
19333
|
+
}
|
|
19334
|
+
}
|
|
19335
|
+
};
|
|
19336
|
+
|
|
18727
19337
|
// packages/devlead/src/notification.ts
|
|
18728
19338
|
import { SessionId as toSessionId } from "@deepseek-ai/dsh-session";
|
|
18729
19339
|
import {
|
|
@@ -20689,7 +21299,7 @@ async function readSessionFacts(deps, ids) {
|
|
|
20689
21299
|
}
|
|
20690
21300
|
return { known, workspaces, archived };
|
|
20691
21301
|
}
|
|
20692
|
-
function rankSessionIds(deps, ids, known,
|
|
21302
|
+
function rankSessionIds(deps, ids, known, limit2) {
|
|
20693
21303
|
const ranked = ids.map((id) => ({
|
|
20694
21304
|
id,
|
|
20695
21305
|
watched: deps.isWatched(id),
|
|
@@ -20701,7 +21311,7 @@ function rankSessionIds(deps, ids, known, limit) {
|
|
|
20701
21311
|
if (left.running !== right.running) return left.running ? -1 : 1;
|
|
20702
21312
|
return right.createdAt - left.createdAt || left.id.localeCompare(right.id);
|
|
20703
21313
|
});
|
|
20704
|
-
return ranked.slice(0, Math.max(1,
|
|
21314
|
+
return ranked.slice(0, Math.max(1, limit2)).map((entry) => entry.id);
|
|
20705
21315
|
}
|
|
20706
21316
|
function lastAssistantExcerpt(events) {
|
|
20707
21317
|
for (let index = events.length - 1; index >= 0; index -= 1) {
|
|
@@ -20976,7 +21586,7 @@ function resolveConfig(config2) {
|
|
|
20976
21586
|
const boardPath = config2.boardPath ?? "";
|
|
20977
21587
|
if (typeof boardPath !== "string") throw new TypeError("boardPath must be a string");
|
|
20978
21588
|
const trimmedBoardPath = boardPath.trim();
|
|
20979
|
-
if (trimmedBoardPath.length > 0 && !
|
|
21589
|
+
if (trimmedBoardPath.length > 0 && !isAbsolute4(trimmedBoardPath)) {
|
|
20980
21590
|
throw new TypeError("boardPath must be an absolute path");
|
|
20981
21591
|
}
|
|
20982
21592
|
return {
|
|
@@ -21001,12 +21611,12 @@ function isSessionNotFoundError(error51) {
|
|
|
21001
21611
|
const message = error51 instanceof Error ? error51.message : String(error51);
|
|
21002
21612
|
return /not found|does not exist|unknown session|SESSION_NOT_FOUND/iu.test(message);
|
|
21003
21613
|
}
|
|
21004
|
-
function listLimit(
|
|
21005
|
-
if (
|
|
21006
|
-
if (!Number.isSafeInteger(
|
|
21614
|
+
function listLimit(limit2, maximum) {
|
|
21615
|
+
if (limit2 === void 0) return maximum;
|
|
21616
|
+
if (!Number.isSafeInteger(limit2) || limit2 < 1) {
|
|
21007
21617
|
throw new DevLeadError("limit must be a positive safe integer", "DEVLEAD_INVALID_INPUT");
|
|
21008
21618
|
}
|
|
21009
|
-
return Math.min(
|
|
21619
|
+
return Math.min(limit2, maximum);
|
|
21010
21620
|
}
|
|
21011
21621
|
function workspacePathFailure(error51, path) {
|
|
21012
21622
|
const errno = error51?.code;
|
|
@@ -21134,6 +21744,8 @@ var DevLeadService = class extends Service {
|
|
|
21134
21744
|
* whose reads/writes report BOARD_DISABLED and whose summary is empty.
|
|
21135
21745
|
*/
|
|
21136
21746
|
boardStore;
|
|
21747
|
+
/** Markdown notes store paired with {@link boardStore}'s exact path and lifecycle. */
|
|
21748
|
+
notesStore;
|
|
21137
21749
|
/** Active lead Session whose workspace owns {@link boardStore}, when enabled. */
|
|
21138
21750
|
boardLeadSessionIdValue;
|
|
21139
21751
|
/** Whether the current board path comes from the deployment Config override. */
|
|
@@ -21456,6 +22068,7 @@ var DevLeadService = class extends Service {
|
|
|
21456
22068
|
super(ctx, "devLead");
|
|
21457
22069
|
this.resolved = resolveConfig(config2);
|
|
21458
22070
|
this.boardStore = new DevLeadBoardStore(void 0, this.ctx.logger);
|
|
22071
|
+
this.notesStore = new DevLeadBoardNotesStore(void 0, this.boardStore, this.ctx.logger);
|
|
21459
22072
|
}
|
|
21460
22073
|
async [Service.init]() {
|
|
21461
22074
|
initializeRecordApi(this.ctx.logger);
|
|
@@ -21507,6 +22120,7 @@ var DevLeadService = class extends Service {
|
|
|
21507
22120
|
await this.boardSyncTail.catch(() => void 0);
|
|
21508
22121
|
await Promise.all([
|
|
21509
22122
|
this.boardStore.close(),
|
|
22123
|
+
this.notesStore.close(),
|
|
21510
22124
|
this.outbox?.close(),
|
|
21511
22125
|
this.idempotencyStore?.close()
|
|
21512
22126
|
]);
|
|
@@ -22600,6 +23214,10 @@ var DevLeadService = class extends Service {
|
|
|
22600
23214
|
get board() {
|
|
22601
23215
|
return this.boardStore;
|
|
22602
23216
|
}
|
|
23217
|
+
/** Current notes store, rooted at `dirname(board.path)/notes` when enabled. */
|
|
23218
|
+
get notes() {
|
|
23219
|
+
return this.notesStore;
|
|
23220
|
+
}
|
|
22603
23221
|
/** Active lead Session id whose workspace owns the current board, when enabled. */
|
|
22604
23222
|
get boardLeadSessionId() {
|
|
22605
23223
|
return this.boardLeadSessionIdValue;
|
|
@@ -22660,7 +23278,23 @@ var DevLeadService = class extends Service {
|
|
|
22660
23278
|
boardSummaryFor(agent) {
|
|
22661
23279
|
if (!this.isEnabled(agent)) return "";
|
|
22662
23280
|
if (this.boardLeadSessionIdValue !== String(agent.id)) return "";
|
|
22663
|
-
return this.boardStore.summary();
|
|
23281
|
+
return this.boardStore.summary(this.notesStore.summaryIndex());
|
|
23282
|
+
}
|
|
23283
|
+
/** Read one active-lead project's note metadata or one complete Markdown note. */
|
|
23284
|
+
async readBoardNote(agent, filter) {
|
|
23285
|
+
if (!this.isEnabled(agent)) {
|
|
23286
|
+
throw new DevLeadError("DevLead mode is not enabled for the calling Agent", "DEVLEAD_NOT_ENABLED");
|
|
23287
|
+
}
|
|
23288
|
+
this.requireActiveBoardLead(agent);
|
|
23289
|
+
return this.notesStore.read(filter);
|
|
23290
|
+
}
|
|
23291
|
+
/** Apply one logical note mutation for the active lead; no caller path is accepted. */
|
|
23292
|
+
async writeBoardNote(agent, patch, signal) {
|
|
23293
|
+
if (!this.isEnabled(agent)) {
|
|
23294
|
+
throw new DevLeadError("DevLead mode is not enabled for the calling Agent", "DEVLEAD_NOT_ENABLED");
|
|
23295
|
+
}
|
|
23296
|
+
this.requireActiveBoardLead(agent);
|
|
23297
|
+
return this.notesStore.write(patch, signal);
|
|
22664
23298
|
}
|
|
22665
23299
|
/** Reject a board operation whose caller does not own the current store. */
|
|
22666
23300
|
requireActiveBoardLead(agent) {
|
|
@@ -22743,6 +23377,7 @@ var DevLeadService = class extends Service {
|
|
|
22743
23377
|
return;
|
|
22744
23378
|
}
|
|
22745
23379
|
const previous = this.boardStore;
|
|
23380
|
+
const previousNotes = this.notesStore;
|
|
22746
23381
|
if (previous.path === nextPath) {
|
|
22747
23382
|
this.boardLeadSessionIdValue = sessionId;
|
|
22748
23383
|
this.boardPathOverrideValue = nextOverride;
|
|
@@ -22753,6 +23388,7 @@ var DevLeadService = class extends Service {
|
|
|
22753
23388
|
return;
|
|
22754
23389
|
}
|
|
22755
23390
|
const next = new DevLeadBoardStore(nextPath, this.ctx.logger);
|
|
23391
|
+
const nextNotes = new DevLeadBoardNotesStore(nextPath, next, this.ctx.logger);
|
|
22756
23392
|
let startError;
|
|
22757
23393
|
try {
|
|
22758
23394
|
await next.start();
|
|
@@ -22760,12 +23396,20 @@ var DevLeadService = class extends Service {
|
|
|
22760
23396
|
startError = devLeadBoardStartErrorOf(error51);
|
|
22761
23397
|
this.logBoardStartFailure(nextPath, startError);
|
|
22762
23398
|
}
|
|
23399
|
+
try {
|
|
23400
|
+
await nextNotes.start();
|
|
23401
|
+
} catch (error51) {
|
|
23402
|
+
const notesError = devLeadBoardStartErrorOf(error51);
|
|
23403
|
+
startError ??= notesError;
|
|
23404
|
+
this.logBoardStartFailure(nextNotes.indexPath ?? nextPath, notesError);
|
|
23405
|
+
}
|
|
22763
23406
|
this.boardStore = next;
|
|
23407
|
+
this.notesStore = nextNotes;
|
|
22764
23408
|
this.boardLeadSessionIdValue = sessionId;
|
|
22765
23409
|
this.boardPathOverrideValue = nextOverride;
|
|
22766
23410
|
this.boardDisabledReasonValue = void 0;
|
|
22767
23411
|
this.boardStartErrorValue = startError;
|
|
22768
|
-
await this.closeBoardStore(previous);
|
|
23412
|
+
await Promise.all([this.closeBoardStore(previous), this.closeNotesStore(previousNotes)]);
|
|
22769
23413
|
}
|
|
22770
23414
|
/**
|
|
22771
23415
|
* Whether one derived board's workspace root still exists as a directory.
|
|
@@ -22779,7 +23423,7 @@ var DevLeadService = class extends Service {
|
|
|
22779
23423
|
async workspaceRootExists(workspaceRoot) {
|
|
22780
23424
|
if (workspaceRoot === void 0 || workspaceRoot.trim().length === 0) return false;
|
|
22781
23425
|
try {
|
|
22782
|
-
return (await
|
|
23426
|
+
return (await stat4(workspaceRoot)).isDirectory();
|
|
22783
23427
|
} catch {
|
|
22784
23428
|
return false;
|
|
22785
23429
|
}
|
|
@@ -22793,6 +23437,13 @@ var DevLeadService = class extends Service {
|
|
|
22793
23437
|
startError = devLeadBoardStartErrorOf(error51);
|
|
22794
23438
|
this.logBoardStartFailure(path, startError);
|
|
22795
23439
|
}
|
|
23440
|
+
try {
|
|
23441
|
+
await this.notesStore.start();
|
|
23442
|
+
} catch (error51) {
|
|
23443
|
+
const notesError = devLeadBoardStartErrorOf(error51);
|
|
23444
|
+
startError ??= notesError;
|
|
23445
|
+
this.logBoardStartFailure(this.notesStore.indexPath ?? path, notesError);
|
|
23446
|
+
}
|
|
22796
23447
|
this.boardStartErrorValue = startError;
|
|
22797
23448
|
}
|
|
22798
23449
|
/** Log one board degradation without failing the surrounding service. */
|
|
@@ -22804,13 +23455,15 @@ var DevLeadService = class extends Service {
|
|
|
22804
23455
|
/** Release any current board store and expose why the board is disabled. */
|
|
22805
23456
|
async disableBoardStore(reason) {
|
|
22806
23457
|
const previous = this.boardStore;
|
|
23458
|
+
const previousNotes = this.notesStore;
|
|
22807
23459
|
this.boardLeadSessionIdValue = void 0;
|
|
22808
23460
|
this.boardPathOverrideValue = false;
|
|
22809
23461
|
this.boardStartErrorValue = void 0;
|
|
22810
23462
|
this.boardDisabledReasonValue = reason;
|
|
22811
23463
|
if (previous.path !== void 0) {
|
|
22812
23464
|
this.boardStore = new DevLeadBoardStore(void 0, this.ctx.logger);
|
|
22813
|
-
|
|
23465
|
+
this.notesStore = new DevLeadBoardNotesStore(void 0, this.boardStore, this.ctx.logger);
|
|
23466
|
+
await Promise.all([this.closeBoardStore(previous), this.closeNotesStore(previousNotes)]);
|
|
22814
23467
|
}
|
|
22815
23468
|
}
|
|
22816
23469
|
/** Close one replaced store without letting cleanup failure break the swap. */
|
|
@@ -22822,6 +23475,15 @@ var DevLeadService = class extends Service {
|
|
|
22822
23475
|
this.ctx.logger.warn(`devlead: could not close the previous project board store: ${thrownMessage(error51)}`);
|
|
22823
23476
|
}
|
|
22824
23477
|
}
|
|
23478
|
+
/** Close one replaced notes store without failing the surrounding board swap. */
|
|
23479
|
+
async closeNotesStore(store) {
|
|
23480
|
+
if (store.path === void 0) return;
|
|
23481
|
+
try {
|
|
23482
|
+
await store.close();
|
|
23483
|
+
} catch (error51) {
|
|
23484
|
+
this.ctx.logger.warn(`devlead: could not close the previous board notes store: ${thrownMessage(error51)}`);
|
|
23485
|
+
}
|
|
23486
|
+
}
|
|
22825
23487
|
/**
|
|
22826
23488
|
* Stamp the calling lead's identity onto one board mutation. The board file
|
|
22827
23489
|
* path is derived from the active lead's workspace (or the Config override);
|
|
@@ -23090,7 +23752,7 @@ var DevLeadService = class extends Service {
|
|
|
23090
23752
|
}
|
|
23091
23753
|
signal?.throwIfAborted();
|
|
23092
23754
|
try {
|
|
23093
|
-
await
|
|
23755
|
+
await mkdir3(trimmed, { recursive: true });
|
|
23094
23756
|
} catch (mkdirError) {
|
|
23095
23757
|
throw workspacePathFailure(mkdirError, trimmed);
|
|
23096
23758
|
}
|
|
@@ -23170,10 +23832,10 @@ var DevLeadService = class extends Service {
|
|
|
23170
23832
|
if (options.watchedOnly === true) ids = ids.filter((id) => deps.isWatched(id));
|
|
23171
23833
|
const listingCap = options.watchedOnly === true ? Math.max(this.resolved.maxListedSessions, deps.watchedSessions.length) : this.resolved.maxListedSessions;
|
|
23172
23834
|
const requestedLimit = listLimit(options.limit, listingCap);
|
|
23173
|
-
const
|
|
23835
|
+
const limit2 = options.watchedOnly === true ? Math.max(requestedLimit, deps.watchedSessions.length) : requestedLimit;
|
|
23174
23836
|
const ranking = await sessionRankFacts(deps, ids);
|
|
23175
23837
|
signal?.throwIfAborted();
|
|
23176
|
-
const retained = rankSessionIds(deps, ids, ranking,
|
|
23838
|
+
const retained = rankSessionIds(deps, ids, ranking, limit2);
|
|
23177
23839
|
const facts = await readSessionFacts(deps, retained);
|
|
23178
23840
|
return await devLeadSessionViews(deps, retained, false, facts);
|
|
23179
23841
|
}
|
|
@@ -23864,8 +24526,8 @@ var DevLeadService = class extends Service {
|
|
|
23864
24526
|
notifications(agent, options = {}) {
|
|
23865
24527
|
this.assertLive(agent);
|
|
23866
24528
|
const state = this.strictStateOf(agent.session);
|
|
23867
|
-
const
|
|
23868
|
-
const effective = Number.isSafeInteger(
|
|
24529
|
+
const limit2 = options.limit ?? 20;
|
|
24530
|
+
const effective = Number.isSafeInteger(limit2) && limit2 > 0 ? limit2 : 20;
|
|
23869
24531
|
return state.notifications.slice(-effective);
|
|
23870
24532
|
}
|
|
23871
24533
|
/** Open the durable non-answer idempotency table once, with safe fallback. */
|
|
@@ -24315,8 +24977,8 @@ var DevLeadService = class extends Service {
|
|
|
24315
24977
|
reports(agent, options = {}) {
|
|
24316
24978
|
this.assertLive(agent);
|
|
24317
24979
|
const state = this.strictStateOf(agent.session);
|
|
24318
|
-
const
|
|
24319
|
-
const effective = Number.isSafeInteger(
|
|
24980
|
+
const limit2 = options.limit ?? 20;
|
|
24981
|
+
const effective = Number.isSafeInteger(limit2) && limit2 > 0 ? limit2 : 20;
|
|
24320
24982
|
return state.reports.slice(-effective);
|
|
24321
24983
|
}
|
|
24322
24984
|
/**
|
|
@@ -27212,6 +27874,20 @@ export {
|
|
|
27212
27874
|
DEVLEAD_MAX_INSTANT,
|
|
27213
27875
|
DEVLEAD_MESSAGE_KIND,
|
|
27214
27876
|
DEVLEAD_MODE_RECORD_TYPE,
|
|
27877
|
+
DEVLEAD_NOTES_DIRECTORY_MAX,
|
|
27878
|
+
DEVLEAD_NOTES_DIR_NAME,
|
|
27879
|
+
DEVLEAD_NOTES_ID_MAX,
|
|
27880
|
+
DEVLEAD_NOTES_INDEX_FILE_NAME,
|
|
27881
|
+
DEVLEAD_NOTES_INDEX_MAX_BYTES,
|
|
27882
|
+
DEVLEAD_NOTES_MAX_PER_PROJECT,
|
|
27883
|
+
DEVLEAD_NOTES_MAX_PROJECTS,
|
|
27884
|
+
DEVLEAD_NOTES_NOTE_MAX_BYTES,
|
|
27885
|
+
DEVLEAD_NOTES_PATH_MAX,
|
|
27886
|
+
DEVLEAD_NOTES_READ_MAX_BYTES,
|
|
27887
|
+
DEVLEAD_NOTES_SCHEMA_VERSION,
|
|
27888
|
+
DEVLEAD_NOTES_SUMMARY_MAX,
|
|
27889
|
+
DEVLEAD_NOTES_TIMESTAMP_MAX,
|
|
27890
|
+
DEVLEAD_NOTES_TITLE_MAX,
|
|
27215
27891
|
DEVLEAD_NOTIFICATION_RECORD_TYPE,
|
|
27216
27892
|
DEVLEAD_QUESTIONS_MAX,
|
|
27217
27893
|
DEVLEAD_QUESTION_FIELD_MAX,
|
|
@@ -27225,6 +27901,7 @@ export {
|
|
|
27225
27901
|
DEVLEAD_RESET_RECORD_TYPE,
|
|
27226
27902
|
DEVLEAD_WATCH_RECORD_TYPE,
|
|
27227
27903
|
DevLeadBoardError,
|
|
27904
|
+
DevLeadBoardNotesStore,
|
|
27228
27905
|
DevLeadBoardStore,
|
|
27229
27906
|
DevLeadError,
|
|
27230
27907
|
DevLeadMetrics,
|
|
@@ -27284,5 +27961,6 @@ export {
|
|
|
27284
27961
|
representableInstant,
|
|
27285
27962
|
resetRecord,
|
|
27286
27963
|
resolveDevLeadBoardPath,
|
|
27964
|
+
resolveDevLeadBoardProject,
|
|
27287
27965
|
watchRecord
|
|
27288
27966
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yankeguo/dsh-devlead",
|
|
3
|
-
"version": "0.4.2-rc.
|
|
3
|
+
"version": "0.4.2-rc.6",
|
|
4
4
|
"description": "DevLead mode core service for the DeepSeek Harness: durable per-session mode, Workspace and Session orchestration, watched-session notifications, and the `devLead` Session projection.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@yankeguo/dsh-devlead-protocol": "0.4.2-rc.
|
|
48
|
+
"@yankeguo/dsh-devlead-protocol": "0.4.2-rc.6"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"dsh": ">=0.2.2-rc.1 <0.3.0"
|