@indigoai-us/hq-cloud 6.16.0 → 6.16.2
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/area-ledger-migration.test.js +3 -1
- package/dist/bin/area-ledger-migration.test.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.d.ts +11 -0
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +60 -24
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.test.js +84 -2
- package/dist/bin/sync-runner-watch-loop.test.js.map +1 -1
- package/dist/cli/sync.d.ts +2 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +125 -75
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +40 -1
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/ignore.d.ts +26 -8
- package/dist/ignore.d.ts.map +1 -1
- package/dist/ignore.js +66 -18
- package/dist/ignore.js.map +1 -1
- package/dist/ignore.test.js +77 -5
- package/dist/ignore.test.js.map +1 -1
- package/dist/journal-store.test.js +17 -0
- package/dist/journal-store.test.js.map +1 -1
- package/dist/journal.d.ts +14 -2
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +42 -1
- package/dist/journal.js.map +1 -1
- package/dist/sync/area-ledger-migration.d.ts +8 -1
- package/dist/sync/area-ledger-migration.d.ts.map +1 -1
- package/dist/sync/area-ledger-migration.js +81 -50
- package/dist/sync/area-ledger-migration.js.map +1 -1
- package/dist/sync/area-ledger-migration.test.js +1 -0
- package/dist/sync/area-ledger-migration.test.js.map +1 -1
- package/dist/sync/event-sync.d.ts +3 -1
- package/dist/sync/event-sync.d.ts.map +1 -1
- package/dist/sync/event-sync.js +1 -0
- package/dist/sync/event-sync.js.map +1 -1
- package/dist/telemetry.d.ts +2 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +44 -6
- package/dist/telemetry.js.map +1 -1
- package/dist/telemetry.test.js +99 -0
- package/dist/telemetry.test.js.map +1 -1
- package/dist/watcher.d.ts +13 -4
- package/dist/watcher.d.ts.map +1 -1
- package/dist/watcher.js +18 -3
- package/dist/watcher.js.map +1 -1
- package/dist/watcher.test.js +28 -0
- package/dist/watcher.test.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/sync.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/cli/sync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAEV,kBAAkB,EAEnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAA+B,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAOhF,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/cli/sync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAEV,kBAAkB,EAEnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAA+B,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAOhF,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AA0DhC,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAML,KAAK,iBAAiB,EAEvB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAU1E,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EACd,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,kBAAkB,EAClB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,E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Ae,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxD;AAiFD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAM5C;AAwDD,2EAA2E;AAC3E,wBAAgB,iCAAiC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAK1E;AAkBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,kBAAkB,EAC/B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,EACrE,eAAe,CAAC,EAAE,eAAe,GAAG,IAAI,GACvC,OAAO,CAAC,IAAI,CAAC,CA6Ef;AAoCD;;GAEG;AACH,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAOpE;AAi+DD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,OAAsC,GAC5C,OAAO,CAoBT"}
|
package/dist/cli/sync.js
CHANGED
|
@@ -16,7 +16,7 @@ import { createSyncProgressRecorder } from "../sync-progress.js";
|
|
|
16
16
|
import { canonicalVaultKeySpelling, localPathForVaultKey, vaultKeyForLocalPath, } from "../local-path-codec.js";
|
|
17
17
|
import { SKILLS_KEY_PREFIX } from "./doctor.js";
|
|
18
18
|
import { downloadFile, listRemoteFiles, headRemoteFile, primeObjectTransport, toPosixKey, classifyVaultKey, DanglingSymlinkParentError, WindowsSymlinkPrivilegeError, WINDOWS_SYMLINK_PRIVILEGE_REMEDY, WindowsRenameBlockedError, WINDOWS_RENAME_BLOCKED_REMEDY, renameOrRaiseWindowsBlocked, } from "../s3.js";
|
|
19
|
-
import { readJournal, writeJournal, openJournalStoreSession, hashFile, hashSymlinkTarget, updateEntry, removeEntry, getEntry, normalizeEtag, migrateToV2, gcTombstones, isTombstone, tombstoneEntry, lastPullRecord, appendPullRecord, generatePullId, PERSONAL_VAULT_JOURNAL_SLUG, migratePersonalVaultJournal, } from "../journal.js";
|
|
19
|
+
import { readJournal, writeJournal, getStateDir, openJournalStoreSession, hashFile, hashSymlinkTarget, updateEntry, removeEntry, getEntry, normalizeEtag, migrateToV2, gcTombstones, isTombstone, tombstoneEntry, lastPullRecord, appendPullRecord, generatePullId, PERSONAL_VAULT_JOURNAL_SLUG, migratePersonalVaultJournal, } from "../journal.js";
|
|
20
20
|
import { isGeneratedCoreMirrorKey, PERSONAL_VAULT_MANIFEST_KEY, } from "../personal-vault.js";
|
|
21
21
|
import { isPersonalVaultExcluded } from "../personal-vault-exclusions.js";
|
|
22
22
|
import { buildScopeShrinkPlan, applyScopeShrink, ScopeShrinkBlockedError, ScopeShrinkLargePruneError, } from "../scope-shrink.js";
|
|
@@ -134,18 +134,48 @@ export function resolveAutoPruneCap() {
|
|
|
134
134
|
}
|
|
135
135
|
/** Max time to wait on the best-effort new-files notification POST. */
|
|
136
136
|
const NOTIFY_FILE_ADDED_TIMEOUT_MS = 5000;
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
140
|
-
const
|
|
137
|
+
// Keep the existing hot targeted-pull performance contract without retaining
|
|
138
|
+
// one full journal per vault/shard. One current runner can have exactly one
|
|
139
|
+
// idle projection; a different or concurrent target opens a pass-local store.
|
|
140
|
+
const TARGETED_JOURNAL_SESSION_LIMIT = 1;
|
|
141
|
+
let cachedTargetedJournalSession;
|
|
141
142
|
function targetedJournalSession(slug) {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
const cacheKey = `${getStateDir()}\u0000${slug}`;
|
|
144
|
+
const cached = cachedTargetedJournalSession;
|
|
145
|
+
if (cached?.cacheKey === cacheKey && cached.leases === 0) {
|
|
146
|
+
cached.leases = 1;
|
|
147
|
+
return {
|
|
148
|
+
store: cached.store,
|
|
149
|
+
release: () => { cached.leases -= 1; },
|
|
150
|
+
};
|
|
147
151
|
}
|
|
148
|
-
|
|
152
|
+
if ((!cached || cached.leases === 0) && TARGETED_JOURNAL_SESSION_LIMIT === 1) {
|
|
153
|
+
// Keep the current idle lease intact until the replacement opens. If the
|
|
154
|
+
// open fails, the same-key caller can still reuse this healthy session.
|
|
155
|
+
const store = openJournalStoreSession(slug);
|
|
156
|
+
const replacement = {
|
|
157
|
+
cacheKey,
|
|
158
|
+
store,
|
|
159
|
+
leases: 1,
|
|
160
|
+
};
|
|
161
|
+
cached?.store.dispose();
|
|
162
|
+
cachedTargetedJournalSession = replacement;
|
|
163
|
+
return {
|
|
164
|
+
store: replacement.store,
|
|
165
|
+
release: () => { replacement.leases -= 1; },
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
// A concurrent or alternate-vault pass must not mutate the hot projection.
|
|
169
|
+
// Its store is pass-local and released on every completion/error path.
|
|
170
|
+
const transient = openJournalStoreSession(slug);
|
|
171
|
+
return { store: transient, release: () => transient.dispose() };
|
|
172
|
+
}
|
|
173
|
+
/** Fixed-token census for the single retained targeted-pull projection. */
|
|
174
|
+
export function targetedJournalSessionCensusSizes() {
|
|
175
|
+
return {
|
|
176
|
+
targetedJournalSessions: cachedTargetedJournalSession ? 1 : 0,
|
|
177
|
+
targetedJournalRows: cachedTargetedJournalSession?.store.rowCount() ?? 0,
|
|
178
|
+
};
|
|
149
179
|
}
|
|
150
180
|
/**
|
|
151
181
|
* Bound crash recovery while avoiding full-journal checkpoint amplification on
|
|
@@ -287,29 +317,36 @@ export async function sync(options) {
|
|
|
287
317
|
}
|
|
288
318
|
async function syncWithOperationLockHeld(options) {
|
|
289
319
|
const run = await buildPullContext(options);
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
320
|
+
try {
|
|
321
|
+
const plan = planPull(run);
|
|
322
|
+
emitPullPlan(run.emit, plan);
|
|
323
|
+
reportInvalidRemoteKeys(run, plan);
|
|
324
|
+
const scopeRun = run.keyedJournal
|
|
325
|
+
? emptyTargetedScopeRun(run)
|
|
326
|
+
: executeScopeShrink(run, planScopeShrink(run));
|
|
327
|
+
const counters = createPullCounters();
|
|
328
|
+
const transferConcurrency = resolveTransferConcurrency(run.hostLoadAtStart);
|
|
329
|
+
const conflictRun = await executeConflictExecutor(run, plan, scopeRun, counters);
|
|
330
|
+
if (conflictRun.abortResult) {
|
|
331
|
+
return conflictRun.abortResult;
|
|
332
|
+
}
|
|
333
|
+
await executeDownloadExecutor(run, conflictRun.downloadItems, transferConcurrency, counters);
|
|
334
|
+
// The following added-by and tombstone phases may still make authenticated
|
|
335
|
+
// vault calls. Make a completed sub-threshold download tail durable before
|
|
336
|
+
// they begin, so their failure cannot turn a successful bulk transfer into
|
|
337
|
+
// a full replay on the next pass.
|
|
338
|
+
flushDownloadedJournalTail(run);
|
|
339
|
+
await emitAndReportNewFiles(run, plan);
|
|
340
|
+
await verifyPlannedJournalTombstones(run, plan);
|
|
341
|
+
executeJournalTombstoneDeletes(run, plan, counters);
|
|
342
|
+
emitScopeMaterializationGap(run, plan);
|
|
343
|
+
return finalizePullRun(run, plan, scopeRun, counters);
|
|
344
|
+
}
|
|
345
|
+
finally {
|
|
346
|
+
// Release a pass-local lease even on conflict, transfer, or auth failure.
|
|
347
|
+
// The one bounded hot lease remains available only for its same vault.
|
|
348
|
+
run.releaseKeyedJournal?.();
|
|
349
|
+
}
|
|
313
350
|
}
|
|
314
351
|
async function buildPullContext(options) {
|
|
315
352
|
const { company, vaultConfig, hqRoot } = options;
|
|
@@ -381,49 +418,62 @@ async function buildPullContext(options) {
|
|
|
381
418
|
// A targeted receive already knows the only remote prefixes it will inspect.
|
|
382
419
|
// Keep one keyed projection alive across the LIST/planning/write seams rather
|
|
383
420
|
// than reopening and materialising the full v3 journal for this pass.
|
|
384
|
-
const
|
|
421
|
+
const keyedJournalLease = requestedPullPrefixes.length > 0
|
|
385
422
|
? targetedJournalSession(journalSlug)
|
|
386
423
|
: undefined;
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
await
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
424
|
+
const keyedJournal = keyedJournalLease?.store;
|
|
425
|
+
try {
|
|
426
|
+
const remoteFiles = await listRemoteFilesForScope(ctx, syncMode, listedPrefixSet, requestedPullPrefixes.length > 0);
|
|
427
|
+
const fileTombstones = options.fileTombstones ??
|
|
428
|
+
await fetchFileTombstones(vaultConfig, options.personalMode === true
|
|
429
|
+
? { personal: true }
|
|
430
|
+
: { companyUid: ctx.uid });
|
|
431
|
+
// LIST can take minutes on a large personal vault. Reload after that window
|
|
432
|
+
// so a watcher intent committed while it ran participates in classification
|
|
433
|
+
// instead of allowing this pass to re-download the user's deleted object.
|
|
434
|
+
// PR #385 freshness boundary: LIST may take minutes. A pass-start projection
|
|
435
|
+
// is deliberately never used for classification after that window.
|
|
436
|
+
keyedJournal?.refresh();
|
|
437
|
+
const journal = keyedJournal
|
|
438
|
+
? journalForTargetedPull(keyedJournal, listedPrefixSet)
|
|
439
|
+
: migrateToV2(readJournal(journalSlug));
|
|
440
|
+
gcTombstones(journal, Date.now());
|
|
441
|
+
return {
|
|
442
|
+
options,
|
|
443
|
+
hostLoadAtStart,
|
|
444
|
+
companyRef,
|
|
445
|
+
vaultConfig,
|
|
446
|
+
hqRoot,
|
|
447
|
+
emit,
|
|
448
|
+
ctx,
|
|
449
|
+
companyRoot,
|
|
450
|
+
shouldSync,
|
|
451
|
+
journalSlug,
|
|
452
|
+
startedAt,
|
|
453
|
+
journal,
|
|
454
|
+
...(keyedJournal
|
|
455
|
+
? {
|
|
456
|
+
keyedJournal,
|
|
457
|
+
keyedBaseline: structuredClone(journal),
|
|
458
|
+
releaseKeyedJournal: keyedJournalLease.release,
|
|
459
|
+
}
|
|
460
|
+
: {}),
|
|
461
|
+
journalRowCount: keyedJournal?.rowCount() ?? Object.keys(journal.files).length,
|
|
462
|
+
remoteFiles,
|
|
463
|
+
syncMode,
|
|
464
|
+
currentPrefixSet,
|
|
465
|
+
listedPrefixSet,
|
|
466
|
+
currentExcludeSet,
|
|
467
|
+
fileTombstones,
|
|
468
|
+
downloadsSinceJournalCheckpoint: 0,
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
catch (error) {
|
|
472
|
+
// `buildPullContext` can fail during LIST/freshness. Do not leave the
|
|
473
|
+
// leased projection marked in use when no PullRunContext is returned.
|
|
474
|
+
keyedJournalLease?.release();
|
|
475
|
+
throw error;
|
|
476
|
+
}
|
|
427
477
|
}
|
|
428
478
|
/**
|
|
429
479
|
* List the remote objects the current pull can actually materialize.
|