@seanhogg/builderforce-memory 2026.10.55 → 2026.10.56
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/dist/knowledge/index.d.ts +2 -2
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/index.js.map +1 -1
- package/dist/knowledge/stores/extractLogWriter.d.ts +26 -0
- package/dist/knowledge/stores/extractLogWriter.d.ts.map +1 -0
- package/dist/knowledge/stores/extractLogWriter.js +60 -0
- package/dist/knowledge/stores/extractLogWriter.js.map +1 -0
- package/dist/knowledge/stores/localSnapshotStore.d.ts +48 -39
- package/dist/knowledge/stores/localSnapshotStore.d.ts.map +1 -1
- package/dist/knowledge/stores/localSnapshotStore.js +137 -179
- package/dist/knowledge/stores/localSnapshotStore.js.map +1 -1
- package/dist/knowledge/stores/rowDelta.d.ts +97 -0
- package/dist/knowledge/stores/rowDelta.d.ts.map +1 -0
- package/dist/knowledge/stores/rowDelta.js +141 -0
- package/dist/knowledge/stores/rowDelta.js.map +1 -0
- package/dist/knowledge/stores/rowMemory.d.ts +31 -0
- package/dist/knowledge/stores/rowMemory.d.ts.map +1 -0
- package/dist/knowledge/stores/rowMemory.js +85 -0
- package/dist/knowledge/stores/rowMemory.js.map +1 -0
- package/dist/knowledge/stores/rowSync.d.ts +56 -0
- package/dist/knowledge/stores/rowSync.d.ts.map +1 -0
- package/dist/knowledge/stores/rowSync.js +119 -0
- package/dist/knowledge/stores/rowSync.js.map +1 -0
- package/dist/knowledge/stores/snapshotFormat.d.ts +17 -0
- package/dist/knowledge/stores/snapshotFormat.d.ts.map +1 -1
- package/dist/knowledge/stores/snapshotFormat.js +19 -0
- package/dist/knowledge/stores/snapshotFormat.js.map +1 -1
- package/package.json +3 -3
- package/src/contract/exports.snapshot.json +1 -0
- package/src/contract/regression.rows.test.ts +377 -0
- package/src/contract/types.contract.test.ts +28 -4
- package/src/knowledge/index.ts +4 -2
- package/src/knowledge/stores/extractLogWriter.ts +57 -0
- package/src/knowledge/stores/localSnapshotStore.ts +138 -168
- package/src/knowledge/stores/rowDelta.test.ts +91 -0
- package/src/knowledge/stores/rowDelta.ts +166 -0
- package/src/knowledge/stores/rowMemory.ts +82 -0
- package/src/knowledge/stores/rowSync.ts +118 -0
- package/src/knowledge/stores/snapshotFormat.ts +30 -0
|
@@ -44,7 +44,7 @@ export { composePacks, ignoreMatcher, ignoreSourcesOf, isBinaryPath, isBinaryTex
|
|
|
44
44
|
export { srcRef, pathOfRef, fileRefOf, factRef, factKeyOf, slugOf, canonicalJson, compareStr, nameResolver, aboutTargets, } from './refs.js';
|
|
45
45
|
export { DOCS_PACK, DOCS_PACK_ID, brokenLinkRule, orphanDocumentRule, contradictionRule } from './packs/docs.js';
|
|
46
46
|
export { frontMatterOf, SECTION_INDEX_BADGE } from '../ingest/docsExtract.js';
|
|
47
|
-
export { LocalSnapshotStore, localSnapshotStore } from './stores/localSnapshotStore.js';
|
|
48
|
-
export type { SnapshotPersistence, KnowledgeSnapshot, LocalSnapshotStoreOptions, ExtractedLogPersistence } from './stores/localSnapshotStore.js';
|
|
47
|
+
export { LocalSnapshotStore, localSnapshotStore, canonicalDump } from './stores/localSnapshotStore.js';
|
|
48
|
+
export type { SnapshotPersistence, KnowledgeSnapshot, LocalSnapshotStoreOptions, ExtractedLogPersistence, RowPersistence, RowChange, } from './stores/localSnapshotStore.js';
|
|
49
49
|
export * from '../retrieval/knowledge-index/index.js';
|
|
50
50
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/knowledge/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACR,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EACzG,aAAa,EAAE,i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Y,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EACzG,eAAe,EAAE,mBAAmB,EACpC,sBAAsB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,GAC3H,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,GAClH,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACjH,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACvG,YAAY,EACR,mBAAmB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,cAAc,EAAE,SAAS,GACxH,MAAM,gCAAgC,CAAC;AAGxC,cAAc,uCAAuC,CAAC"}
|
package/dist/knowledge/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export { composePacks, ignoreMatcher, ignoreSourcesOf, isBinaryPath, isBinaryTex
|
|
|
31
31
|
export { srcRef, pathOfRef, fileRefOf, factRef, factKeyOf, slugOf, canonicalJson, compareStr, nameResolver, aboutTargets, } from './refs.js';
|
|
32
32
|
export { DOCS_PACK, DOCS_PACK_ID, brokenLinkRule, orphanDocumentRule, contradictionRule } from './packs/docs.js';
|
|
33
33
|
export { frontMatterOf, SECTION_INDEX_BADGE } from '../ingest/docsExtract.js';
|
|
34
|
-
export { LocalSnapshotStore, localSnapshotStore } from './stores/localSnapshotStore.js';
|
|
34
|
+
export { LocalSnapshotStore, localSnapshotStore, canonicalDump } from './stores/localSnapshotStore.js';
|
|
35
35
|
// The knowledge index (search, expand, near-duplicate pairs) ships on the same subpath.
|
|
36
36
|
export * from '../retrieval/knowledge-index/index.js';
|
|
37
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/knowledge/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,EACH,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,GACtI,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAA0B,MAAM,gBAAgB,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,cAAc,EAAwB,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEpF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAChH,OAAO,EACH,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,GACpG,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,UAAU,EAAE,SAAS,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,GAChH,MAAM,YAAY,CAAC;AAEpB,OAAO,EACH,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,GAC3I,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EA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AAe,EAAE,eAAe,EAAE,oBAAoB,EAChH,0BAA0B,EAAE,gCAAgC,EAAE,kBAAkB,GACnF,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EACzG,eAAe,EAAE,mBAAmB,EACpC,sBAAsB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,GAC3H,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,GAClH,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACjH,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAKvG,wFAAwF;AACxF,cAAc,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge/stores/extractLogWriter.ts — the write side of the extract cache's append-only log (PRD 41 A10 rule 7), moved
|
|
3
|
+
* out of {@link LocalSnapshotStore}. It owns what is not yet appended and whether the log's last line is torn; the store
|
|
4
|
+
* owns WHEN to flush (inside `persistIfDirty`). No behaviour of its own beyond the log port.
|
|
5
|
+
*/
|
|
6
|
+
import type { Extracted } from '../model.js';
|
|
7
|
+
import type { ExtractedLogPersistence } from './localSnapshotStore.js';
|
|
8
|
+
export declare class ExtractLogWriter {
|
|
9
|
+
private readonly port;
|
|
10
|
+
/** Entries not yet appended. */
|
|
11
|
+
private pending;
|
|
12
|
+
/** The log's last line is torn (no newline), so the next append starts on a fresh line. */
|
|
13
|
+
private torn;
|
|
14
|
+
constructor(port: ExtractedLogPersistence);
|
|
15
|
+
read(): Promise<string | undefined>;
|
|
16
|
+
/** Queues an entry for the next {@link flush}. */
|
|
17
|
+
queue(hash: string, entries: Extracted[]): void;
|
|
18
|
+
/** Fills `into` from the log's text (last line per hash wins) and compacts the log when dead bytes exceed live bytes. */
|
|
19
|
+
load(text: string | undefined, into: Map<string, Extracted[]>): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Appends the not-yet-logged entries as ONE `append` of complete lines. A failed append keeps them pending and marks the
|
|
22
|
+
* log torn (it may hold a partial line), so the next append starts on a fresh line.
|
|
23
|
+
*/
|
|
24
|
+
flush(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=extractLogWriter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractLogWriter.d.ts","sourceRoot":"","sources":["../../../src/knowledge/stores/extractLogWriter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAGvE,qBAAa,gBAAgB;IAMb,OAAO,CAAC,QAAQ,CAAC,IAAI;IALjC,gCAAgC;IAChC,OAAO,CAAC,OAAO,CAAkC;IACjD,2FAA2F;IAC3F,OAAO,CAAC,IAAI,CAAS;IAErB,YAA6B,IAAI,EAAE,uBAAuB,EAAI;IAE9D,IAAI,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAA6B;IAEhE,kDAAkD;IAClD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAqC;IAEpF,yHAAyH;IACnH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAWlF;IAED;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAc3B;CACJ"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge/stores/extractLogWriter.ts — the write side of the extract cache's append-only log (PRD 41 A10 rule 7), moved
|
|
3
|
+
* out of {@link LocalSnapshotStore}. It owns what is not yet appended and whether the log's last line is torn; the store
|
|
4
|
+
* owns WHEN to flush (inside `persistIfDirty`). No behaviour of its own beyond the log port.
|
|
5
|
+
*/
|
|
6
|
+
import { parseLog } from './snapshotFormat.js';
|
|
7
|
+
export class ExtractLogWriter {
|
|
8
|
+
port;
|
|
9
|
+
/** Entries not yet appended. */
|
|
10
|
+
pending = new Map();
|
|
11
|
+
/** The log's last line is torn (no newline), so the next append starts on a fresh line. */
|
|
12
|
+
torn = false;
|
|
13
|
+
constructor(port) {
|
|
14
|
+
this.port = port;
|
|
15
|
+
}
|
|
16
|
+
read() { return this.port.read(); }
|
|
17
|
+
/** Queues an entry for the next {@link flush}. */
|
|
18
|
+
queue(hash, entries) { this.pending.set(hash, entries); }
|
|
19
|
+
/** Fills `into` from the log's text (last line per hash wins) and compacts the log when dead bytes exceed live bytes. */
|
|
20
|
+
async load(text, into) {
|
|
21
|
+
const parsed = parseLog(text);
|
|
22
|
+
for (const [h, e] of parsed.entries)
|
|
23
|
+
into.set(h, e);
|
|
24
|
+
this.torn = !!text && !text.endsWith('\n');
|
|
25
|
+
// Needs the port's `replace`; a failure is ignored (the log stays correct, only larger). Another window appending between
|
|
26
|
+
// this read and the replace loses those lines from the cache — a cache miss, re-extracted next review.
|
|
27
|
+
if (!this.port.replace || parsed.deadBytes <= parsed.liveBytes)
|
|
28
|
+
return;
|
|
29
|
+
try {
|
|
30
|
+
await this.port.replace([...parsed.liveLines.values()].join(''));
|
|
31
|
+
this.torn = false;
|
|
32
|
+
}
|
|
33
|
+
catch { /* keep the uncompacted log */ }
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Appends the not-yet-logged entries as ONE `append` of complete lines. A failed append keeps them pending and marks the
|
|
37
|
+
* log torn (it may hold a partial line), so the next append starts on a fresh line.
|
|
38
|
+
*/
|
|
39
|
+
async flush() {
|
|
40
|
+
if (this.pending.size === 0)
|
|
41
|
+
return;
|
|
42
|
+
const batch = this.pending;
|
|
43
|
+
this.pending = new Map();
|
|
44
|
+
let text = this.torn ? '\n' : '';
|
|
45
|
+
for (const [h, e] of batch)
|
|
46
|
+
text += `${JSON.stringify({ h, e })}\n`;
|
|
47
|
+
try {
|
|
48
|
+
await this.port.append(text);
|
|
49
|
+
this.torn = false;
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
this.torn = true;
|
|
53
|
+
for (const [h, e] of batch)
|
|
54
|
+
if (!this.pending.has(h))
|
|
55
|
+
this.pending.set(h, e);
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=extractLogWriter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractLogWriter.js","sourceRoot":"","sources":["../../../src/knowledge/stores/extractLogWriter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,OAAO,gBAAgB;IAMI,IAAI;IALjC,gCAAgC;IACxB,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IACjD,2FAA2F;IACnF,IAAI,GAAG,KAAK,CAAC;IAErB,YAA6B,IAA6B;oBAA7B,IAAI;IAA4B,CAAC;IAE9D,IAAI,KAAkC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAEhE,kDAAkD;IAClD,KAAK,CAAC,IAAY,EAAE,OAAoB,IAAU,IAAI,CAAC,OAAO,CAAC,GAA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EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACpE,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QACtB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK;gBAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;oBAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7E,MAAM,GAAG,CAAC;QACd,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -14,11 +14,17 @@
|
|
|
14
14
|
* inside a run; outside one, each awaited mutation has persisted when it resolves.
|
|
15
15
|
*
|
|
16
16
|
* PRD 41 A10: reads come from memory once loaded (never behind the mutation queue); rows live in
|
|
17
|
-
* per-root maps updated incrementally; with the optional `extractedLog` port the
|
|
18
|
-
* an append-only JSON Lines file instead of part of the snapshot.
|
|
17
|
+
* per-root maps (rowMemory.ts) updated incrementally; with the optional `extractedLog` port the
|
|
18
|
+
* extract cache is an append-only JSON Lines file (extractLogWriter.ts) instead of part of the snapshot.
|
|
19
|
+
*
|
|
20
|
+
* PRD 41 B4 (G03): with `opts.rows` ({@link RowPersistence}) the store persists only the rows that changed
|
|
21
|
+
* (dirty keys in rowDelta.ts) and `persistence` / `extractedLog` are not used. Construct it as
|
|
22
|
+
* `new LocalSnapshotStore(undefined, { rows })`; a `persistence` given beside `rows` is ignored.
|
|
19
23
|
*/
|
|
20
24
|
import type { Extracted, KnowledgeStore, NodeRef, Scope, ScopeRecord, StoredFact, StoredRelation } from '../model.js';
|
|
25
|
+
import type { RowPersistence } from './rowDelta.js';
|
|
21
26
|
export type { KnowledgeSnapshot } from './snapshotFormat.js';
|
|
27
|
+
export type { RowChange, RowPersistence } from './rowDelta.js';
|
|
22
28
|
export interface SnapshotPersistence {
|
|
23
29
|
read(): Promise<string | undefined>;
|
|
24
30
|
write(snapshot: string): Promise<void>;
|
|
@@ -37,8 +43,10 @@ export interface ExtractedLogPersistence {
|
|
|
37
43
|
replace?(text: string): Promise<void>;
|
|
38
44
|
}
|
|
39
45
|
export interface LocalSnapshotStoreOptions {
|
|
40
|
-
/** When given, the extract cache lives in this log and the snapshot omits `extracted`. */
|
|
46
|
+
/** When given, the extract cache lives in this log and the snapshot omits `extracted`. Ignored with `rows`. */
|
|
41
47
|
extractedLog?: ExtractedLogPersistence;
|
|
48
|
+
/** Row-level persistence (a SQLite file): only changed rows are written; `SnapshotPersistence` and `extractedLog` are not used. */
|
|
49
|
+
rows?: RowPersistence;
|
|
42
50
|
/** ISO clock for `staleAt`. Default `new Date().toISOString()`. */
|
|
43
51
|
now?(): string;
|
|
44
52
|
/** Inside `batched`, a mutation persists when this many ms passed since the last write (a crash loses at most this much). Default 30_000. */
|
|
@@ -50,20 +58,14 @@ export declare class LocalSnapshotStore implements KnowledgeStore {
|
|
|
50
58
|
private readonly persistence;
|
|
51
59
|
private loaded;
|
|
52
60
|
private loading;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
private readonly factMaps;
|
|
56
|
-
private readonly relMaps;
|
|
57
|
-
/** Per root: source path → keys of the relations touching it (`from` or `to`). */
|
|
58
|
-
private readonly relByPath;
|
|
59
|
-
private readonly extracted;
|
|
60
|
-
/** Hashes the next review re-checks (persisted with the snapshot). */
|
|
61
|
-
private readonly recheck;
|
|
62
|
-
/** Extract entries not yet appended to the log. */
|
|
63
|
-
private pending;
|
|
64
|
-
/** The log's last line is torn (no newline), so the next append starts on a fresh line. */
|
|
65
|
-
private logTorn;
|
|
61
|
+
/** Per-root rows and the extract cache (PRD 41 A10 rule 7). */
|
|
62
|
+
private mem;
|
|
66
63
|
private readonly log;
|
|
64
|
+
private readonly rows;
|
|
65
|
+
/** Row mode only: writes the changed rows, reloads, reads bodies lazily (rowSync.ts). */
|
|
66
|
+
private readonly sync;
|
|
67
|
+
/** Row mode only: the keys changed since the last `apply`. */
|
|
68
|
+
private readonly delta;
|
|
67
69
|
/** Serializes mutations so two writers never interleave a read-modify-write. */
|
|
68
70
|
private queue;
|
|
69
71
|
private readonly now;
|
|
@@ -76,34 +78,30 @@ export declare class LocalSnapshotStore implements KnowledgeStore {
|
|
|
76
78
|
private persistedAt;
|
|
77
79
|
/** Serializes snapshot writes; never rejects. */
|
|
78
80
|
private persisting;
|
|
81
|
+
/** Steps queued or running on the persist chain. */
|
|
82
|
+
private steps;
|
|
79
83
|
/** A background checkpoint in flight (at most one). */
|
|
80
84
|
private checkpointing;
|
|
85
|
+
/** Row-persisted: no whole-snapshot port; only changed rows are written through `opts.rows`. */
|
|
86
|
+
constructor(persistence: undefined, opts: LocalSnapshotStoreOptions & {
|
|
87
|
+
rows: RowPersistence;
|
|
88
|
+
});
|
|
89
|
+
/** Snapshot-persisted (the default): the whole canonical snapshot is written through `persistence`. */
|
|
81
90
|
constructor(persistence: SnapshotPersistence, opts?: LocalSnapshotStoreOptions);
|
|
82
91
|
/** Loads once; every later call is a no-op, so reads never wait on the mutation queue after the first. */
|
|
83
92
|
private load;
|
|
93
|
+
/** What a read waits for: the first load, then (row mode) a reload when another writer changed the store. */
|
|
94
|
+
private fresh;
|
|
84
95
|
private doLoad;
|
|
85
|
-
/**
|
|
86
|
-
|
|
87
|
-
* port's `replace`; a failure is ignored (the log stays correct, only larger). Another window appending between
|
|
88
|
-
* this read and the replace loses those lines from the cache — a cache miss, re-extracted next review.
|
|
89
|
-
*/
|
|
90
|
-
private compactLog;
|
|
91
|
-
private factsOf;
|
|
92
|
-
private relsOf;
|
|
93
|
-
/** Upserts a relation and indexes it under the source paths of both ends. */
|
|
94
|
-
private putRelation;
|
|
96
|
+
/** Runs a step after the previous persist step (one at a time); the chain itself never rejects. */
|
|
97
|
+
private onChain;
|
|
95
98
|
private enqueue;
|
|
96
99
|
/**
|
|
97
|
-
* Appends
|
|
98
|
-
*
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
* Appends new extract entries, then writes the snapshot if memory is ahead of it, one write at a time. It
|
|
103
|
-
* runs OUTSIDE the mutation queue: a write of a large snapshot (serialize + disk) must never hold up reads or
|
|
104
|
-
* the next mutation's in-memory apply (PRD 41 A10 — it did: every `getExtracted` waited out each checkpoint).
|
|
105
|
-
* The log goes first, so a snapshot that dropped a migrated cache never outlives its entries. A failed
|
|
106
|
-
* write leaves the snapshot dirty, so the next one retries it.
|
|
100
|
+
* Appends new extract entries, then writes the snapshot (or, in row mode, the changed rows) if memory is ahead of it,
|
|
101
|
+
* one write at a time. It runs OUTSIDE the mutation queue: a write of a large snapshot (serialize + disk) must never
|
|
102
|
+
* hold up reads or the next mutation's in-memory apply (PRD 41 A10 — it did: every `getExtracted` waited out each
|
|
103
|
+
* checkpoint). The log goes first, so a snapshot that dropped a migrated cache never outlives its entries. A failed
|
|
104
|
+
* write leaves the store dirty, so the next one retries it.
|
|
107
105
|
*/
|
|
108
106
|
private persistIfDirty;
|
|
109
107
|
/**
|
|
@@ -129,18 +127,29 @@ export declare class LocalSnapshotStore implements KnowledgeStore {
|
|
|
129
127
|
relations: StoredRelation[];
|
|
130
128
|
}): Promise<void>;
|
|
131
129
|
markStale(scope: Scope, sourceRef: NodeRef, currentHash: string): Promise<void>;
|
|
130
|
+
/** The cached entries of a content hash. In row mode a hash not in memory is read through `rows.loadExtracted` and kept. */
|
|
132
131
|
getExtracted(hash: string): Promise<Extracted[] | undefined>;
|
|
132
|
+
/** Row mode: reads the bodies of these hashes through `rows.loadExtracted`, a chunk at a time. Otherwise a no-op (everything is in memory). */
|
|
133
|
+
preloadExtracted(hashes: readonly string[]): Promise<void>;
|
|
133
134
|
/** Asks the next review to re-check the files with these content hashes (persisted until {@link clearRecheck}). */
|
|
134
135
|
markRecheck(hashes: readonly string[]): Promise<void>;
|
|
135
136
|
hasRecheck(hash: string): Promise<boolean>;
|
|
136
137
|
recheckHashes(): Promise<string[]>;
|
|
137
138
|
/** Forgets hashes a review has handled. */
|
|
138
139
|
clearRecheck(hashes: readonly string[]): Promise<void>;
|
|
139
|
-
/** Every cached entry by content hash (the log's, else the snapshot's `extracted`), for a host that packs the cache. */
|
|
140
|
+
/** Every cached entry by content hash (the log's, else the snapshot's `extracted`), for a host that packs the cache. Row mode reads ALL bodies through `loadAllExtracted` (memory wins) and throws without it: never a partial map. */
|
|
140
141
|
extractedEntries(): Promise<Record<string, Extracted[]>>;
|
|
141
142
|
putExtracted(hash: string, extracted: Extracted[]): Promise<void>;
|
|
142
|
-
/**
|
|
143
|
-
|
|
143
|
+
/** See {@link canonicalDump}. Static so it can reach private state without widening the instance's public surface. */
|
|
144
|
+
static dumpOf(store: LocalSnapshotStore): Promise<string>;
|
|
144
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* The canonical text of a store's rows: byte-equal to what a snapshot-persisted store writes (without `extractedLog`, the
|
|
148
|
+
* extract cache included). The projection `packPush` / `portablePack` read. Row mode reads every body through `loadAllExtracted` and throws `knowledge_dump_needs_all_bodies` without it.
|
|
149
|
+
*/
|
|
150
|
+
export declare const canonicalDump: (store: LocalSnapshotStore) => Promise<string>;
|
|
151
|
+
export declare function localSnapshotStore(persistence: undefined, opts: LocalSnapshotStoreOptions & {
|
|
152
|
+
rows: RowPersistence;
|
|
153
|
+
}): LocalSnapshotStore;
|
|
145
154
|
export declare function localSnapshotStore(persistence: SnapshotPersistence, opts?: LocalSnapshotStoreOptions): LocalSnapshotStore;
|
|
146
155
|
//# sourceMappingURL=localSnapshotStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localSnapshotStore.d.ts","sourceRoot":"","sources":["../../../src/knowledge/stores/localSnapshotStore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"localSnapshotStore.d.ts","sourceRoot":"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