@indigoai-us/hq-cloud 6.16.34 → 6.16.36
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/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +20 -8
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.test.js +1 -2
- package/dist/bin/sync-runner-watch-loop.test.js.map +1 -1
- package/dist/bin/sync-runner.test.js +21 -24
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/share.d.ts.map +1 -1
- package/dist/cli/share.js +18 -7
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/share.test.js +30 -3
- package/dist/cli/share.test.js.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +3 -2
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +6 -6
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/company-vault-transport.d.ts +0 -2
- package/dist/company-vault-transport.d.ts.map +1 -1
- package/dist/company-vault-transport.js +0 -2
- package/dist/company-vault-transport.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/journal-baseline.test.js +18 -15
- package/dist/journal-baseline.test.js.map +1 -1
- package/dist/journal-delta-writes.test.js +2 -2
- package/dist/journal-delta-writes.test.js.map +1 -1
- package/dist/journal-public-boundary.test.d.ts +2 -0
- package/dist/journal-public-boundary.test.d.ts.map +1 -0
- package/dist/journal-public-boundary.test.js +216 -0
- package/dist/journal-public-boundary.test.js.map +1 -0
- package/dist/journal-record-proxy.d.ts +11 -0
- package/dist/journal-record-proxy.d.ts.map +1 -0
- package/dist/journal-record-proxy.js +71 -0
- package/dist/journal-record-proxy.js.map +1 -0
- package/dist/journal-row-store.d.ts +76 -3
- package/dist/journal-row-store.d.ts.map +1 -1
- package/dist/journal-row-store.js +450 -43
- package/dist/journal-row-store.js.map +1 -1
- package/dist/journal-row-store.test.js +139 -6
- package/dist/journal-row-store.test.js.map +1 -1
- package/dist/journal-snapshot-decoder.d.ts +18 -0
- package/dist/journal-snapshot-decoder.d.ts.map +1 -0
- package/dist/journal-snapshot-decoder.js +373 -0
- package/dist/journal-snapshot-decoder.js.map +1 -0
- package/dist/journal-snapshot-memory-helpers.d.ts +30 -0
- package/dist/journal-snapshot-memory-helpers.d.ts.map +1 -0
- package/dist/journal-snapshot-memory-helpers.js +203 -0
- package/dist/journal-snapshot-memory-helpers.js.map +1 -0
- package/dist/journal-snapshot-memory.test.d.ts +2 -0
- package/dist/journal-snapshot-memory.test.d.ts.map +1 -0
- package/dist/journal-snapshot-memory.test.js +32 -0
- package/dist/journal-snapshot-memory.test.js.map +1 -0
- package/dist/journal-snapshot-v4-memory.test.d.ts +2 -0
- package/dist/journal-snapshot-v4-memory.test.d.ts.map +1 -0
- package/dist/journal-snapshot-v4-memory.test.js +24 -0
- package/dist/journal-snapshot-v4-memory.test.js.map +1 -0
- package/dist/journal-snapshot-v4.d.ts +52 -0
- package/dist/journal-snapshot-v4.d.ts.map +1 -0
- package/dist/journal-snapshot-v4.js +352 -0
- package/dist/journal-snapshot-v4.js.map +1 -0
- package/dist/journal-snapshot-v4.test.d.ts +2 -0
- package/dist/journal-snapshot-v4.test.d.ts.map +1 -0
- package/dist/journal-snapshot-v4.test.js +280 -0
- package/dist/journal-snapshot-v4.test.js.map +1 -0
- package/dist/journal-store.test.js +335 -17
- package/dist/journal-store.test.js.map +1 -1
- package/dist/journal.d.ts +10 -8
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +165 -50
- package/dist/journal.js.map +1 -1
- package/dist/journal.test.js +1 -1
- package/dist/journal.test.js.map +1 -1
- package/dist/manifest/build-manifest.bench.test.js +165 -58
- package/dist/manifest/build-manifest.bench.test.js.map +1 -1
- package/dist/remote-pull.js +6 -4
- package/dist/remote-pull.js.map +1 -1
- package/dist/remote-pull.test.js +72 -0
- package/dist/remote-pull.test.js.map +1 -1
- package/dist/session-log-retention.test.js +3 -3
- package/dist/session-log-retention.test.js.map +1 -1
- package/dist/skill-telemetry.d.ts +1 -2
- package/dist/skill-telemetry.d.ts.map +1 -1
- package/dist/skill-telemetry.js +1 -10
- package/dist/skill-telemetry.js.map +1 -1
- package/dist/sync/child-process-sync-worker-env.test.d.ts +2 -0
- package/dist/sync/child-process-sync-worker-env.test.d.ts.map +1 -0
- package/dist/sync/child-process-sync-worker-env.test.js +38 -0
- package/dist/sync/child-process-sync-worker-env.test.js.map +1 -0
- package/dist/sync/feature-flags.d.ts +0 -16
- package/dist/sync/feature-flags.d.ts.map +1 -1
- package/dist/sync/feature-flags.js +0 -11
- package/dist/sync/feature-flags.js.map +1 -1
- package/dist/sync/index.d.ts +2 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +1 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/logger.test.js +1 -3
- package/dist/sync/logger.test.js.map +1 -1
- package/dist/sync/metrics.test.js +0 -3
- package/dist/sync/metrics.test.js.map +1 -1
- package/dist/sync/push-receiver.d.ts +0 -7
- package/dist/sync/push-receiver.d.ts.map +1 -1
- package/dist/sync/push-receiver.js.map +1 -1
- package/dist/sync/state-store.d.ts +23 -0
- package/dist/sync/state-store.d.ts.map +1 -1
- package/dist/sync/state-store.js +114 -39
- package/dist/sync/state-store.js.map +1 -1
- package/dist/sync/state-store.test.js +82 -0
- package/dist/sync/state-store.test.js.map +1 -1
- package/dist/watcher.test.js +7 -8
- package/dist/watcher.test.js.map +1 -1
- package/package.json +1 -1
- package/dist/daemon-worker.d.ts +0 -11
- package/dist/daemon-worker.d.ts.map +0 -1
- package/dist/daemon-worker.js +0 -22
- package/dist/daemon-worker.js.map +0 -1
package/dist/journal.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import * as fs from "fs";
|
|
16
16
|
import type { SyncJournal, JournalEntry, PullRecord, V3JournalDeltaPayload, V3JournalState } from "./types.js";
|
|
17
|
-
import { StateStore, type StateStoreRecoveryProgress } from "./sync/state-store.js";
|
|
17
|
+
import { StateStore, type StateStoreRecoveryProgress, type StateStoreSnapshotDecoder } from "./sync/state-store.js";
|
|
18
18
|
import { AreaLedgerMigration } from "./sync/area-ledger-migration.js";
|
|
19
19
|
import { type AreaMaintenanceOutcome } from "./sync/per-area-maintenance.js";
|
|
20
20
|
export { AreaLedger, setAreaLedgerTestHooksForTest, type AreaLedgerDelta, type AreaLedgerOptions, } from "./sync/area-ledger.js";
|
|
@@ -42,6 +42,8 @@ export declare function closeCachedAreaJournalMigration(slug: string): void;
|
|
|
42
42
|
export declare function releaseCachedAreaJournalMigrations(): void;
|
|
43
43
|
/** Path-free count exported solely for the runner heap census. */
|
|
44
44
|
export declare function journalCacheCensusSizes(): Record<string, number>;
|
|
45
|
+
/** Exposed only to pin write-path selection at the public boundary. */
|
|
46
|
+
export declare function journalDeltaPathForTest(journal: SyncJournal): "dirty-log" | "fingerprint";
|
|
45
47
|
/**
|
|
46
48
|
* The delta `writeJournal` would publish for a journal read in this process.
|
|
47
49
|
* Exported for the baseline parity tests only; throws for a journal that no
|
|
@@ -129,6 +131,8 @@ export declare function readJournalScoped(slug: string, keys: readonly string[],
|
|
|
129
131
|
* walking the key's ancestors (O(depth)) instead of the root list (O(roots)).
|
|
130
132
|
*/
|
|
131
133
|
export declare function isUnderAnyRoot(key: string, roots: ReadonlySet<string>): boolean;
|
|
134
|
+
/** Test-only seam for comparing packed streaming recovery with legacy JSON.parse. */
|
|
135
|
+
export declare function setJournalSnapshotDecoderForTest(decoder: StateStoreSnapshotDecoder | null | undefined): void;
|
|
132
136
|
/**
|
|
133
137
|
* Bridge-only access to the v3 container. Normal journal callers must use
|
|
134
138
|
* JournalStore; the live area migration needs source identities, durable pins,
|
|
@@ -151,7 +155,7 @@ export declare class JournalStore {
|
|
|
151
155
|
readonly slug: string;
|
|
152
156
|
private store;
|
|
153
157
|
private areaMigration?;
|
|
154
|
-
private
|
|
158
|
+
private files;
|
|
155
159
|
private version;
|
|
156
160
|
private lastSync;
|
|
157
161
|
private pulls;
|
|
@@ -174,12 +178,10 @@ export declare class JournalStore {
|
|
|
174
178
|
private applyAppended;
|
|
175
179
|
private applyCommitted;
|
|
176
180
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* ceiling. `copied`: the source is a live legacy v3 state that in-process
|
|
182
|
-
* writers still mutate in place, so this projection keeps its own rows.
|
|
181
|
+
* Packing copies every source row into typed arrays, so this projection never
|
|
182
|
+
* aliases a source object and needs no structuredClone. A 690k-row vault used
|
|
183
|
+
* to be deep-copied here on EVERY session open (cached targeted pull, watcher,
|
|
184
|
+
* pass-local), which is what put the outposts over Node's heap ceiling.
|
|
183
185
|
*/
|
|
184
186
|
private replaceFromJournal;
|
|
185
187
|
private applyRecord;
|
package/dist/journal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../src/journal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAIzB,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,cAAc,EAEf,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../src/journal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAIzB,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,cAAc,EAEf,MAAM,YAAY,CAAC;AAKpB,OAAO,EACL,UAAU,EAKV,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC/B,MAAM,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kEAAkE;AAClE,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,OAAO,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,WAAW,EACpB,GAAG,GAAE,MAAmB,GACvB,MAAM,CAYR"}
|
package/dist/journal.js
CHANGED
|
@@ -16,8 +16,11 @@ import * as fs from "fs";
|
|
|
16
16
|
import * as os from "os";
|
|
17
17
|
import * as path from "path";
|
|
18
18
|
import * as crypto from "crypto";
|
|
19
|
+
import { JournalRowStore, journalEntryFingerprint } from "./journal-row-store.js";
|
|
20
|
+
import { createJournalRecordProxy } from "./journal-record-proxy.js";
|
|
21
|
+
import { decodeJournalSnapshot, decodedJournalRows } from "./journal-snapshot-decoder.js";
|
|
19
22
|
import { toPosixKey } from "./posix-key.js";
|
|
20
|
-
import { StateStore, StateStoreCorruptionError, } from "./sync/state-store.js";
|
|
23
|
+
import { StateStore, StateStoreCorruptionError, SNAPSHOT_V4_MAGIC, } from "./sync/state-store.js";
|
|
21
24
|
import { streamJournalLedgerRows } from "./sync/journal-ledger-stream.js";
|
|
22
25
|
import { AreaResolver } from "./sync/area-resolver.js";
|
|
23
26
|
import { AreaLedgerMigration, areaLayoutDirectory, readAreaLayoutState, } from "./sync/area-ledger-migration.js";
|
|
@@ -43,6 +46,10 @@ const JOURNAL_LAST_GOOD_SUFFIX = ".last-good";
|
|
|
43
46
|
const JOURNAL_WAL_RECORD_TYPE = 1;
|
|
44
47
|
const JOURNAL_DELTA_RECORD_TYPE = 2;
|
|
45
48
|
const journalBaselines = new WeakMap();
|
|
49
|
+
// The weak map is an explicit boundary brand. It keeps the packed store out of
|
|
50
|
+
// the public journal object while letting writeJournal select its O(changes)
|
|
51
|
+
// dirty-log path only for journals returned by readJournal.
|
|
52
|
+
const storeBackedJournals = new WeakMap();
|
|
46
53
|
// Area-authoritative reads still refresh every participating area so a cached
|
|
47
54
|
// bridge observes committed writers in this and other processes. The expensive
|
|
48
55
|
// part we can share is the bridge construction: it owns the lazy AreaLedger
|
|
@@ -96,6 +103,97 @@ function rememberJournalBaseline(journal) {
|
|
|
96
103
|
});
|
|
97
104
|
return journal;
|
|
98
105
|
}
|
|
106
|
+
function readStoreBackedJournal(journal) {
|
|
107
|
+
const existing = storeBackedJournals.get(journal);
|
|
108
|
+
if (existing) {
|
|
109
|
+
// Snapshot decode starts the store's change log before WAL replay. The
|
|
110
|
+
// returned journal's baseline starts only after every recovered record.
|
|
111
|
+
existing.store.drainDirtyLog();
|
|
112
|
+
existing.version = journal.version;
|
|
113
|
+
existing.lastSync = journal.lastSync;
|
|
114
|
+
existing.pullsJson = JSON.stringify(journal.pulls ?? []);
|
|
115
|
+
return journal;
|
|
116
|
+
}
|
|
117
|
+
const decoded = decodedJournalRows(journal);
|
|
118
|
+
if (decoded) {
|
|
119
|
+
decoded.enableChangeTracking();
|
|
120
|
+
storeBackedJournals.set(journal, {
|
|
121
|
+
store: decoded,
|
|
122
|
+
version: journal.version,
|
|
123
|
+
lastSync: journal.lastSync,
|
|
124
|
+
pullsJson: JSON.stringify(journal.pulls ?? []),
|
|
125
|
+
});
|
|
126
|
+
return journal;
|
|
127
|
+
}
|
|
128
|
+
const store = new JournalRowStore();
|
|
129
|
+
for (const [key, entry] of Object.entries(journal.files))
|
|
130
|
+
store.set(key, entry);
|
|
131
|
+
// Loading establishes the read baseline; only caller mutations belong in the
|
|
132
|
+
// write delta. The store remains change-tracked after this checkpoint.
|
|
133
|
+
store.drainDirtyLog();
|
|
134
|
+
// StateStore writes canonical JSON, so spreading preserves the same top-level
|
|
135
|
+
// property order that JSON.stringify exposed before this proxy existed.
|
|
136
|
+
const result = { ...journal, files: createJournalRecordProxy(store) };
|
|
137
|
+
if (Object.hasOwn(journal, "pulls"))
|
|
138
|
+
result.pulls = structuredClone(journal.pulls);
|
|
139
|
+
storeBackedJournals.set(result, {
|
|
140
|
+
store,
|
|
141
|
+
version: result.version,
|
|
142
|
+
lastSync: result.lastSync,
|
|
143
|
+
pullsJson: JSON.stringify(result.pulls ?? []),
|
|
144
|
+
});
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
function journalDeltaFromDirtyLog(backing, next) {
|
|
148
|
+
const previousByPath = new Map();
|
|
149
|
+
for (const change of backing.store.dirtyLogSnapshot()) {
|
|
150
|
+
if (!previousByPath.has(change.path)) {
|
|
151
|
+
previousByPath.set(change.path, {
|
|
152
|
+
hadPrevious: change.hadPrevious,
|
|
153
|
+
previousFingerprint: change.previousFingerprint,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const upserts = {};
|
|
158
|
+
const deletes = [];
|
|
159
|
+
for (const [key, previous] of previousByPath) {
|
|
160
|
+
const current = backing.store.get(key);
|
|
161
|
+
if (!previous.hadPrevious) {
|
|
162
|
+
if (current !== undefined)
|
|
163
|
+
upserts[key] = current;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (current === undefined) {
|
|
167
|
+
deletes.push(key);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (previous.previousFingerprint !== journalEntryFingerprint(current))
|
|
171
|
+
upserts[key] = current;
|
|
172
|
+
}
|
|
173
|
+
const delta = {
|
|
174
|
+
version: next.version === "1" ? JOURNAL_VERSION_CURRENT : next.version,
|
|
175
|
+
upserts,
|
|
176
|
+
deletes,
|
|
177
|
+
};
|
|
178
|
+
if (backing.lastSync !== next.lastSync)
|
|
179
|
+
delta.lastSync = next.lastSync;
|
|
180
|
+
if (JSON.stringify(next.pulls ?? []) !== backing.pullsJson)
|
|
181
|
+
delta.pulls = next.pulls ?? [];
|
|
182
|
+
return delta;
|
|
183
|
+
}
|
|
184
|
+
function checkpointStoreBackedJournal(backing, journal) {
|
|
185
|
+
backing.store.drainDirtyLog();
|
|
186
|
+
backing.version = journal.version;
|
|
187
|
+
backing.lastSync = journal.lastSync;
|
|
188
|
+
backing.pullsJson = JSON.stringify(journal.pulls ?? []);
|
|
189
|
+
}
|
|
190
|
+
function journalDeltaPath(journal) {
|
|
191
|
+
return storeBackedJournals.has(journal) ? "dirty-log" : "fingerprint";
|
|
192
|
+
}
|
|
193
|
+
/** Exposed only to pin write-path selection at the public boundary. */
|
|
194
|
+
export function journalDeltaPathForTest(journal) {
|
|
195
|
+
return journalDeltaPath(journal);
|
|
196
|
+
}
|
|
99
197
|
/**
|
|
100
198
|
* Canonical form of a journal entry, with the same equivalence as `sameEntry`:
|
|
101
199
|
* own keys compared as a set (so key order is irrelevant), primitives by type
|
|
@@ -186,6 +284,9 @@ function journalDeltaFromBaseline(baseline, next) {
|
|
|
186
284
|
* `readJournal` produced.
|
|
187
285
|
*/
|
|
188
286
|
export function journalDeltaForTest(journal) {
|
|
287
|
+
const backing = storeBackedJournals.get(journal);
|
|
288
|
+
if (backing)
|
|
289
|
+
return journalDeltaFromDirtyLog(backing, journal);
|
|
189
290
|
const baseline = journalBaselines.get(journal);
|
|
190
291
|
if (!baseline)
|
|
191
292
|
throw new Error("journalDeltaForTest: journal has no remembered baseline");
|
|
@@ -300,7 +401,7 @@ export function migratePersonalVaultJournal() {
|
|
|
300
401
|
* installs never pass through v1 on disk.
|
|
301
402
|
*/
|
|
302
403
|
export function readJournal(slug) {
|
|
303
|
-
return
|
|
404
|
+
return readStoreBackedJournal(readJournalAggregate(slug));
|
|
304
405
|
}
|
|
305
406
|
/**
|
|
306
407
|
* The live aggregate for `slug` without recording a delta baseline.
|
|
@@ -421,11 +522,21 @@ function emptyJournal() {
|
|
|
421
522
|
function journalScopeId(slug) {
|
|
422
523
|
return `journal:${sanitizeSlug(slug)}`;
|
|
423
524
|
}
|
|
525
|
+
// Undefined is production behavior; null is the test-only whole-payload control.
|
|
526
|
+
let journalSnapshotDecoderForTest;
|
|
527
|
+
/** Test-only seam for comparing packed streaming recovery with legacy JSON.parse. */
|
|
528
|
+
export function setJournalSnapshotDecoderForTest(decoder) {
|
|
529
|
+
journalSnapshotDecoderForTest = decoder;
|
|
530
|
+
}
|
|
424
531
|
function journalStoreOptions(slug, initialJournal) {
|
|
425
532
|
return {
|
|
426
533
|
rootDir: getStateDir(),
|
|
427
534
|
scopeId: journalScopeId(slug),
|
|
428
535
|
initialState: { journal: initialJournal },
|
|
536
|
+
snapshotDecoder: journalSnapshotDecoderForTest === undefined
|
|
537
|
+
? decodeJournalSnapshot
|
|
538
|
+
: journalSnapshotDecoderForTest ?? undefined,
|
|
539
|
+
snapshotMagics: [SNAPSHOT_V4_MAGIC],
|
|
429
540
|
validateRecord: validateJournalRecord,
|
|
430
541
|
reduce: (state, record) => {
|
|
431
542
|
if (record.type === JOURNAL_WAL_RECORD_TYPE) {
|
|
@@ -553,7 +664,7 @@ export class JournalStore {
|
|
|
553
664
|
slug;
|
|
554
665
|
store;
|
|
555
666
|
areaMigration;
|
|
556
|
-
files = new
|
|
667
|
+
files = new JournalRowStore({ trackChanges: false });
|
|
557
668
|
version = JOURNAL_VERSION_CURRENT;
|
|
558
669
|
lastSync = "";
|
|
559
670
|
pulls = [];
|
|
@@ -565,7 +676,7 @@ export class JournalStore {
|
|
|
565
676
|
this.areaMigration = areaMigration;
|
|
566
677
|
if (areaMigration) {
|
|
567
678
|
const cached = areaMigration.readAreaJournalCached();
|
|
568
|
-
this.replaceFromJournal(cached.journal
|
|
679
|
+
this.replaceFromJournal(cached.journal);
|
|
569
680
|
this.areaJournalRevision = cached.revision;
|
|
570
681
|
}
|
|
571
682
|
else {
|
|
@@ -574,21 +685,11 @@ export class JournalStore {
|
|
|
574
685
|
}
|
|
575
686
|
get(key) {
|
|
576
687
|
this.assertOpen();
|
|
577
|
-
|
|
578
|
-
return entry === undefined ? undefined : immutableCopy(entry);
|
|
688
|
+
return this.files.get(key);
|
|
579
689
|
}
|
|
580
690
|
scanPrefix(prefix) {
|
|
581
691
|
this.assertOpen();
|
|
582
|
-
|
|
583
|
-
const normalizedPrefix = prefix.replace(/\/+$/, "");
|
|
584
|
-
for (const [key, entry] of this.files) {
|
|
585
|
-
if (normalizedPrefix === "" ||
|
|
586
|
-
key === normalizedPrefix ||
|
|
587
|
-
key.startsWith(`${normalizedPrefix}/`)) {
|
|
588
|
-
matches.push([key, immutableCopy(entry)]);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
return matches;
|
|
692
|
+
return Array.from(this.files.entriesForPrefix(prefix));
|
|
592
693
|
}
|
|
593
694
|
rowCount() {
|
|
594
695
|
return this.files.size;
|
|
@@ -613,7 +714,7 @@ export class JournalStore {
|
|
|
613
714
|
return;
|
|
614
715
|
const cached = this.areaMigration.readAreaJournalCached();
|
|
615
716
|
if (cached.revision !== this.areaJournalRevision) {
|
|
616
|
-
this.replaceFromJournal(cached.journal
|
|
717
|
+
this.replaceFromJournal(cached.journal);
|
|
617
718
|
this.areaJournalRevision = cached.revision;
|
|
618
719
|
}
|
|
619
720
|
return;
|
|
@@ -706,23 +807,23 @@ export class JournalStore {
|
|
|
706
807
|
this.applyRecord(appended.type, appended.payload);
|
|
707
808
|
}
|
|
708
809
|
/**
|
|
709
|
-
*
|
|
710
|
-
*
|
|
711
|
-
*
|
|
712
|
-
*
|
|
713
|
-
* ceiling. `copied`: the source is a live legacy v3 state that in-process
|
|
714
|
-
* writers still mutate in place, so this projection keeps its own rows.
|
|
810
|
+
* Packing copies every source row into typed arrays, so this projection never
|
|
811
|
+
* aliases a source object and needs no structuredClone. A 690k-row vault used
|
|
812
|
+
* to be deep-copied here on EVERY session open (cached targeted pull, watcher,
|
|
813
|
+
* pass-local), which is what put the outposts over Node's heap ceiling.
|
|
715
814
|
*/
|
|
716
|
-
replaceFromJournal(journal
|
|
717
|
-
|
|
718
|
-
if (
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
this.files.set(key, structuredClone(entry));
|
|
815
|
+
replaceFromJournal(journal) {
|
|
816
|
+
const decoded = decodedJournalRows(journal);
|
|
817
|
+
if (decoded) {
|
|
818
|
+
this.files = decoded;
|
|
819
|
+
this.version = journal.version;
|
|
820
|
+
this.lastSync = journal.lastSync;
|
|
821
|
+
this.pulls = structuredClone(journal.pulls ?? []);
|
|
822
|
+
return;
|
|
725
823
|
}
|
|
824
|
+
this.files.clear();
|
|
825
|
+
for (const [key, entry] of Object.entries(journal.files))
|
|
826
|
+
this.files.set(key, entry);
|
|
726
827
|
this.version = journal.version;
|
|
727
828
|
this.lastSync = journal.lastSync;
|
|
728
829
|
this.pulls = structuredClone(journal.pulls ?? []);
|
|
@@ -738,7 +839,7 @@ export class JournalStore {
|
|
|
738
839
|
for (const key of payload.deletes)
|
|
739
840
|
this.files.delete(key);
|
|
740
841
|
for (const [key, entry] of Object.entries(payload.upserts))
|
|
741
|
-
this.files.set(key,
|
|
842
|
+
this.files.set(key, entry);
|
|
742
843
|
this.version = payload.version;
|
|
743
844
|
this.lastSync = payload.lastSync ?? this.lastSync;
|
|
744
845
|
this.pulls = structuredClone(payload.pulls ?? this.pulls);
|
|
@@ -758,7 +859,7 @@ export class JournalStore {
|
|
|
758
859
|
throw new Error(`journal: session for ${this.slug} is disposed`);
|
|
759
860
|
}
|
|
760
861
|
}
|
|
761
|
-
/** Return a detached, deeply frozen JSON-shaped value
|
|
862
|
+
/** Return a detached, deeply frozen JSON-shaped metadata value. */
|
|
762
863
|
function immutableCopy(value) {
|
|
763
864
|
const copy = structuredClone(value);
|
|
764
865
|
const freeze = (current) => {
|
|
@@ -1209,15 +1310,21 @@ export function migrateToV2(journal) {
|
|
|
1209
1310
|
*/
|
|
1210
1311
|
export function writeJournal(slug, journal) {
|
|
1211
1312
|
migrateToV2(journal);
|
|
1313
|
+
const storeBacking = storeBackedJournals.get(journal);
|
|
1212
1314
|
const areaMigration = openAreaMigrationIfAuthoritative(slug);
|
|
1213
1315
|
if (areaMigration) {
|
|
1214
1316
|
const baseline = journalBaselines.get(journal);
|
|
1215
|
-
const delta =
|
|
1216
|
-
?
|
|
1217
|
-
:
|
|
1317
|
+
const delta = storeBacking
|
|
1318
|
+
? journalDeltaFromDirtyLog(storeBacking, journal)
|
|
1319
|
+
: baseline
|
|
1320
|
+
? journalDeltaFromBaseline(baseline, journal)
|
|
1321
|
+
: journalDelta(areaMigration.readAreaJournal(), journal);
|
|
1218
1322
|
if (hasJournalDelta(delta))
|
|
1219
1323
|
areaMigration.reverseShadow(toAreaLedgerDelta(delta));
|
|
1220
|
-
|
|
1324
|
+
if (storeBacking)
|
|
1325
|
+
checkpointStoreBackedJournal(storeBacking, journal);
|
|
1326
|
+
else
|
|
1327
|
+
rememberJournalBaseline(journal);
|
|
1221
1328
|
ensureJournalLocator(slug);
|
|
1222
1329
|
return;
|
|
1223
1330
|
}
|
|
@@ -1243,13 +1350,18 @@ export function writeJournal(slug, journal) {
|
|
|
1243
1350
|
// so a full snapshot is written periodically rather than never — recovery
|
|
1244
1351
|
// stays bounded, it just no longer happens on every single update.
|
|
1245
1352
|
const baseline = journalBaselines.get(journal);
|
|
1246
|
-
const delta =
|
|
1247
|
-
?
|
|
1248
|
-
:
|
|
1353
|
+
const delta = storeBacking
|
|
1354
|
+
? journalDeltaFromDirtyLog(storeBacking, journal)
|
|
1355
|
+
: baseline
|
|
1356
|
+
? journalDeltaFromBaseline(baseline, journal)
|
|
1357
|
+
: journalDelta(store.getState().journal, journal);
|
|
1249
1358
|
store.append(JOURNAL_DELTA_RECORD_TYPE, delta);
|
|
1250
1359
|
// A caller can checkpoint more than once during one pass. Advancing only its
|
|
1251
1360
|
// own baseline means the next checkpoint again publishes only new mutations.
|
|
1252
|
-
|
|
1361
|
+
if (storeBacking)
|
|
1362
|
+
checkpointStoreBackedJournal(storeBacking, journal);
|
|
1363
|
+
else
|
|
1364
|
+
rememberJournalBaseline(journal);
|
|
1253
1365
|
// The locator is immutable content, so it only needs writing if it is absent
|
|
1254
1366
|
// or still holds a pre-v3 full copy.
|
|
1255
1367
|
ensureJournalLocator(slug);
|
|
@@ -1744,8 +1856,7 @@ export function tombstoneEntry(journal, relativePath, reason, now = new Date().t
|
|
|
1744
1856
|
const entry = journal.files[relativePath];
|
|
1745
1857
|
if (!entry)
|
|
1746
1858
|
return;
|
|
1747
|
-
|
|
1748
|
-
entry.removedReason = reason;
|
|
1859
|
+
journal.files[relativePath] = { ...entry, removedAt: now, removedReason: reason };
|
|
1749
1860
|
}
|
|
1750
1861
|
/**
|
|
1751
1862
|
* Mark a journal entry for a user-authorized local delete. Callers must
|
|
@@ -1760,11 +1871,14 @@ export function markLocalDeleteIntent(journal, relativePath, localHash, localKin
|
|
|
1760
1871
|
entry.kind !== localKind) {
|
|
1761
1872
|
return false;
|
|
1762
1873
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1874
|
+
journal.files[relativePath] = {
|
|
1875
|
+
...entry,
|
|
1876
|
+
localDeleteIntent: {
|
|
1877
|
+
version: 1,
|
|
1878
|
+
remoteEtag: entry.remoteEtag,
|
|
1879
|
+
localHash,
|
|
1880
|
+
localKind,
|
|
1881
|
+
},
|
|
1768
1882
|
};
|
|
1769
1883
|
return true;
|
|
1770
1884
|
}
|
|
@@ -1773,7 +1887,8 @@ export function clearLocalDeleteIntent(journal, relativePath) {
|
|
|
1773
1887
|
const entry = journal.files[relativePath];
|
|
1774
1888
|
if (!entry?.localDeleteIntent)
|
|
1775
1889
|
return false;
|
|
1776
|
-
|
|
1890
|
+
const { localDeleteIntent: _localDeleteIntent, ...cleared } = entry;
|
|
1891
|
+
journal.files[relativePath] = cleared;
|
|
1777
1892
|
return true;
|
|
1778
1893
|
}
|
|
1779
1894
|
/** True if the entry is a tombstone (set by `tombstoneEntry`). */
|