@lmzhen/dsh-evolution-state-json 0.3.63 → 0.3.64
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/lib/index.js +5 -3
- package/lib/types/index.d.ts +1 -1
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -91,7 +91,7 @@ const PENDING_STATUSES = new Set([
|
|
|
91
91
|
]);
|
|
92
92
|
const gateReviewRecord = (record) => isNonNegInt(record.turnsSinceMemory) && isNonNegInt(record.turnsSinceSkill) && isNonNegInt(record.lastTurn);
|
|
93
93
|
const gateCuratorRecord = (record) => typeof record.lastRunAt === "number" && Number.isFinite(record.lastRunAt) && record.lastRunAt >= 0 && isNonNegInt(record.runCount) && typeof record.lastSummary === "string" && typeof record.paused === "boolean";
|
|
94
|
-
const gatePendingRecord = (record) => typeof record.id === "string" && typeof record.kind === "string" && PENDING_KINDS.has(record.kind) && typeof record.summary === "string" && typeof record.createdAt === "string" && typeof record.status === "string" && PENDING_STATUSES.has(record.status) && optionalString(record.resolvedAt) && optionalString(record.claimedBy) && optionalString(record.claimedAt) && optionalString(record.origin) && optionalString(record.sessionId);
|
|
94
|
+
const gatePendingRecord = (record) => typeof record.id === "string" && typeof record.kind === "string" && PENDING_KINDS.has(record.kind) && typeof record.summary === "string" && "args" in record && typeof record.createdAt === "string" && typeof record.status === "string" && PENDING_STATUSES.has(record.status) && optionalString(record.resolvedAt) && optionalString(record.claimedBy) && optionalString(record.claimedAt) && optionalString(record.origin) && optionalString(record.sessionId);
|
|
95
95
|
const RECORD_FIELD_GATES = {
|
|
96
96
|
[REVIEW_STATE_FILE]: gateReviewRecord,
|
|
97
97
|
[CURATOR_STATE_FILE]: gateCuratorRecord,
|
|
@@ -185,7 +185,7 @@ async function jsonTransact(ctx, io, root, file, task) {
|
|
|
185
185
|
return next === null ? null : JSON.stringify(next, null, 2);
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
-
function apply(ctx, rawConfig) {
|
|
188
|
+
function apply(ctx, rawConfig = {}) {
|
|
189
189
|
const root = (rawConfig.root ?? "").trim() || evolutionHome();
|
|
190
190
|
if (rawConfig.root !== void 0 && rawConfig.root.trim() !== "" && !isAbsolute(rawConfig.root)) ctx.logger.warn(`evolution-state-json: config.root "${rawConfig.root}" is a relative path and resolves against the process CWD ("${root}") — pass an absolute path to make the store location launch-independent`);
|
|
191
191
|
const io = () => ctx.evolutionIo.provider();
|
|
@@ -322,7 +322,9 @@ function apply(ctx, rawConfig) {
|
|
|
322
322
|
if (current !== null) try {
|
|
323
323
|
const parsed = JSON.parse(current);
|
|
324
324
|
if (Array.isArray(parsed)) archive = parsed;
|
|
325
|
-
} catch {
|
|
325
|
+
} catch {
|
|
326
|
+
await io().writeText(`${pathOf(PENDING_ARCHIVE_FILE)}.corrupt`, current).catch(() => {});
|
|
327
|
+
}
|
|
326
328
|
const shaped = archive.filter((entry) => entry !== null && typeof entry === "object");
|
|
327
329
|
const archiveKeys = /* @__PURE__ */ new Set();
|
|
328
330
|
const collapsed = shaped.filter((entry) => {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -15,5 +15,5 @@ export interface Config {
|
|
|
15
15
|
}
|
|
16
16
|
export declare const Config: z<Config>;
|
|
17
17
|
export declare function jsonTransact<T>(ctx: Context, io: () => EvolutionIoLike, root: string, file: string, task: (current: T | null) => T | null | Promise<T | null>): Promise<void>;
|
|
18
|
-
export declare function apply(ctx: Context, rawConfig
|
|
18
|
+
export declare function apply(ctx: Context, rawConfig?: Config): void;
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-state-json",
|
|
3
3
|
"description": "JSON-file evolution state provider over the IO seam (community build)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.64",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
34
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
34
|
+
"@lmzhen/dsh-evolution-core": "^0.3.64"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
38
38
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
39
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
40
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.3.
|
|
39
|
+
"@lmzhen/dsh-evolution-io": "^0.3.64",
|
|
40
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.3.64"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
44
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
45
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.3.
|
|
46
|
-
"@lmzhen/dsh-evolution-io-node": "^0.3.
|
|
44
|
+
"@lmzhen/dsh-evolution-io": "^0.3.64",
|
|
45
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.3.64",
|
|
46
|
+
"@lmzhen/dsh-evolution-io-node": "^0.3.64"
|
|
47
47
|
}
|
|
48
48
|
}
|