@indigoai-us/hq-cloud 6.15.95 → 6.15.97
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 +7 -2
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +104 -34
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +3 -4
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +9 -0
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/share.d.ts.map +1 -1
- package/dist/cli/share.js +30 -7
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/share.test.js +47 -1
- package/dist/cli/share.test.js.map +1 -1
- package/dist/cli/sync.d.ts +4 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.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/outposts/self-deploy.d.ts.map +1 -1
- package/dist/outposts/self-deploy.js +7 -5
- package/dist/outposts/self-deploy.js.map +1 -1
- package/dist/outposts/self-deploy.test.js +3 -2
- package/dist/outposts/self-deploy.test.js.map +1 -1
- package/dist/sync/area-ledger-auto-migration.d.ts +55 -0
- package/dist/sync/area-ledger-auto-migration.d.ts.map +1 -0
- package/dist/sync/area-ledger-auto-migration.js +167 -0
- package/dist/sync/area-ledger-auto-migration.js.map +1 -0
- package/dist/sync/area-ledger-auto-migration.test.d.ts +2 -0
- package/dist/sync/area-ledger-auto-migration.test.d.ts.map +1 -0
- package/dist/sync/area-ledger-auto-migration.test.js +229 -0
- package/dist/sync/area-ledger-auto-migration.test.js.map +1 -0
- package/dist/sync/event-sync.d.ts +11 -3
- package/dist/sync/event-sync.d.ts.map +1 -1
- package/dist/sync/event-sync.js +189 -101
- package/dist/sync/event-sync.js.map +1 -1
- package/dist/sync/event-sync.test.js +140 -0
- package/dist/sync/event-sync.test.js.map +1 -1
- package/dist/sync/feature-flags.d.ts +68 -15
- package/dist/sync/feature-flags.d.ts.map +1 -1
- package/dist/sync/feature-flags.js +98 -21
- package/dist/sync/feature-flags.js.map +1 -1
- package/dist/sync/feature-flags.test.js +145 -4
- package/dist/sync/feature-flags.test.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/push-transport.d.ts +18 -0
- package/dist/sync/push-transport.d.ts.map +1 -1
- package/dist/sync/push-transport.js +40 -0
- package/dist/sync/push-transport.js.map +1 -1
- package/dist/sync/state-store.d.ts +2 -2
- package/dist/sync/state-store.d.ts.map +1 -1
- package/dist/sync/state-store.js +186 -68
- package/dist/sync/state-store.js.map +1 -1
- package/dist/sync/state-store.test.js +72 -1
- package/dist/sync/state-store.test.js.map +1 -1
- package/dist/sync/sync-work.d.ts +1 -1
- package/dist/sync/sync-work.d.ts.map +1 -1
- package/dist/watcher.d.ts +4 -0
- package/dist/watcher.d.ts.map +1 -1
- package/dist/watcher.js +31 -6
- package/dist/watcher.js.map +1 -1
- package/dist/watcher.test.js +53 -0
- package/dist/watcher.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { type TreeChange, type TreeChangeBatch } from "../watcher.js";
|
|
2
2
|
import { readJournal } from "../journal.js";
|
|
3
|
+
import { type FeatureSwitch } from "../sync/feature-flags.js";
|
|
3
4
|
import type { TelemetryClaims } from "../telemetry-events.js";
|
|
4
5
|
import type { Direction, RunnerLoopDeps, RunnerPassOutcome } from "./sync-runner.js";
|
|
5
|
-
/**
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Area storage is AUTO by default and only applies after durable cutover.
|
|
8
|
+
* Pass the env switch (`auto`/`on`/`off`) or a boolean force-on/force-off.
|
|
9
|
+
* `HQ_SYNC_AREA_STORAGE=off` is the kill switch.
|
|
10
|
+
*/
|
|
11
|
+
export declare function shouldUseAreaStorage(areaStorage: boolean | FeatureSwitch, stateDir: string, journalSlug: string): boolean;
|
|
7
12
|
/**
|
|
8
13
|
* Targeted-pass batch limit: an event batch touching more distinct paths than
|
|
9
14
|
* this falls back to one full reconcile pass. The limit catches genuine
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-runner-watch-loop.d.ts","sourceRoot":"","sources":["../../src/bin/sync-runner-watch-loop.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync-runner-watch-loop.d.ts","sourceRoot":"","sources":["../../src/bin/sync-runner-watch-loop.ts"],"names":[],"mappings":"AAmBA,OAAO,EAKL,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAUL,WAAW,EAEZ,MAAM,eAAe,CAAC;AAYvB,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAiBlC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAY9D,OAAO,KAAK,EACV,SAAS,EAET,cAAc,EACd,iBAAiB,EAElB,MAAM,kBAAkB,CAAC;AAK1B;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,OAAO,GAAG,aAAa,EACpC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,OAAO,CAMT;AAmDD;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAChD,eAAO,MAAM,qBAAqB,8BAA8B,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AACrE,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AACrE,eAAO,MAAM,4BAA4B,qCAAqC,CAAC;AAC/E,eAAO,MAAM,2BAA2B,KAAK,CA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YAAY,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;AAE5D;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,QAAQ,GAAG,WAAW,GAC3B,KAAK,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CASvC;AAWD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oCAAoC,CAClD,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAIT;AA6BD,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CA+nFjB"}
|
|
@@ -5,7 +5,7 @@ import { performance } from "node:perf_hooks";
|
|
|
5
5
|
import { inventoryManagedSnapshots } from "../backup-prune.js";
|
|
6
6
|
import { VaultClient } from "../index.js";
|
|
7
7
|
import { pickCanonicalPersonEntity } from "../vault-client.js";
|
|
8
|
-
import { acquireOperationLock, withOperationLock, OperationLockedError, OPERATION_LOCKED_EXIT, } from "../operation-lock.js";
|
|
8
|
+
import { acquireOperationLock, withOperationLock, withOperationLockSync, OperationLockedError, OPERATION_LOCKED_EXIT, } from "../operation-lock.js";
|
|
9
9
|
import { describeError } from "../lib/describe-error.js";
|
|
10
10
|
import { TRANSIENT_NETWORK_EXIT } from "../lib/net-errors.js";
|
|
11
11
|
import { PARTIAL_SYNC_EXIT } from "../lib/exit-codes.js";
|
|
@@ -15,8 +15,10 @@ import { TreeWatcher, resolveEventDebounceConfig, systemClock, } from "../watche
|
|
|
15
15
|
import { clearLocalDeleteIntent, getStateDir, markLocalDeleteIntent, PERSONAL_VAULT_JOURNAL_SLUG, openJournalStoreSession, openJournalStoreSessionAsync, listJournalSlugs, listJournals, maintainAreaJournalSlice, readJournal, writeJournal, } from "../journal.js";
|
|
16
16
|
import { NoopPushReceiver, } from "../sync/push-receiver.js";
|
|
17
17
|
import { resolveEventSync, startEventSync as defaultStartEventSync, } from "../sync/event-sync.js";
|
|
18
|
-
import { resolveParallelSyncRollout } from "../sync/feature-flags.js";
|
|
18
|
+
import { resolveAreaStorageEnabled, resolveEffectiveParallelSyncRollout, resolveParallelSyncRollout, } from "../sync/feature-flags.js";
|
|
19
19
|
import { resolveAreaLayoutAuthority } from "../sync/area-ledger-migration.js";
|
|
20
|
+
import { AREA_AUTO_MIGRATION_SOURCE, createAreaAutoMigrationScheduler, openPersonalVaultAreaMigration, readPersonalVaultLayoutPhase, } from "../sync/area-ledger-auto-migration.js";
|
|
21
|
+
import { emitCloudTelemetry } from "../telemetry-events.js";
|
|
20
22
|
import { DefaultParallelSyncCoordinator } from "../sync/parallel-sync-coordinator.js";
|
|
21
23
|
import { RealtimeTelemetrySpan, writeRealtimeTelemetryToStderr } from "../sync/realtime-telemetry.js";
|
|
22
24
|
import { InlineSyncWorkerAdapter, } from "../sync/sync-work.js";
|
|
@@ -24,9 +26,17 @@ import { buildRoutePullArgv, buildScopedPushArgv, buildScopedDrainPullArgv, buil
|
|
|
24
26
|
import { resolveSkipCompanies } from "./sync-runner-planning.js";
|
|
25
27
|
const FULL_RECONCILE_EVERY_TICKS = 10;
|
|
26
28
|
const MAX_FULL_RECONCILE_REASONS = 7;
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Area storage is AUTO by default and only applies after durable cutover.
|
|
31
|
+
* Pass the env switch (`auto`/`on`/`off`) or a boolean force-on/force-off.
|
|
32
|
+
* `HQ_SYNC_AREA_STORAGE=off` is the kill switch.
|
|
33
|
+
*/
|
|
34
|
+
export function shouldUseAreaStorage(areaStorage, stateDir, journalSlug) {
|
|
35
|
+
const authority = resolveAreaLayoutAuthority(stateDir, journalSlug);
|
|
36
|
+
const enabled = typeof areaStorage === "boolean"
|
|
37
|
+
? areaStorage
|
|
38
|
+
: resolveAreaStorageEnabled(areaStorage, authority);
|
|
39
|
+
return enabled && authority === "areas";
|
|
30
40
|
}
|
|
31
41
|
function emitFullReconcileDecision({ mode, reasons, triggers, pollTick, configuredIntervalMs, elapsedSinceLastCompletedFullReconcileMs, batchPathCount, }) {
|
|
32
42
|
process.stderr.write(JSON.stringify({
|
|
@@ -799,15 +809,14 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
799
809
|
};
|
|
800
810
|
const runGuarded = (passArgvForRun, prepare, lane = "slow") => runGuardedTask(() => runPassWithLock(passArgvForRun, prepare, lane), lane);
|
|
801
811
|
/*
|
|
802
|
-
*
|
|
803
|
-
*
|
|
804
|
-
*
|
|
805
|
-
*
|
|
806
|
-
* runner's real slice executors are being moved into child workers.
|
|
812
|
+
* Area storage and the parallel coordinator default to AUTO. AUTO turns
|
|
813
|
+
* them on after durable personal-vault cutover; explicit off is the kill
|
|
814
|
+
* switch; explicit on keeps the previous force-enable meaning. The env
|
|
815
|
+
* parse stays pure; the phase-dependent decision uses the personal journal.
|
|
807
816
|
*/
|
|
808
817
|
const parallelRollout = resolveParallelSyncRollout();
|
|
809
|
-
const
|
|
810
|
-
|
|
818
|
+
const refreshCoordinatorEnabled = () => resolveEffectiveParallelSyncRollout(resolveAreaLayoutAuthority(getStateDir(), PERSONAL_VAULT_JOURNAL_SLUG)).parallelExecutionEnabled;
|
|
819
|
+
let parallelCoordinatorEnabled = refreshCoordinatorEnabled();
|
|
811
820
|
const coordinatorExecutions = new WeakMap();
|
|
812
821
|
const coordinatorWorker = async (slice) => {
|
|
813
822
|
const execution = coordinatorExecutions.get(slice.work);
|
|
@@ -842,25 +851,24 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
842
851
|
})),
|
|
843
852
|
};
|
|
844
853
|
};
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
: null;
|
|
854
|
+
const createCoordinator = () => new DefaultParallelSyncCoordinator({
|
|
855
|
+
realtimeWorker: new InlineSyncWorkerAdapter(coordinatorWorker),
|
|
856
|
+
choreWorker: new InlineSyncWorkerAdapter(coordinatorWorker),
|
|
857
|
+
identifyPath: (canonicalPath) => {
|
|
858
|
+
const route = routeChangeToTarget(canonicalPath);
|
|
859
|
+
if (!route)
|
|
860
|
+
throw new Error(`coordinator cannot route ${canonicalPath}`);
|
|
861
|
+
return route.kind === "company"
|
|
862
|
+
? { targetUid: `company:${route.slug}`, areaId: `company:${route.slug}` }
|
|
863
|
+
: { targetUid: "personal", areaId: "personal" };
|
|
864
|
+
},
|
|
865
|
+
// Compatibility chores still use whole-vault/whole-route executors,
|
|
866
|
+
// which cannot yet name sound bounded mutation paths. Their execution
|
|
867
|
+
// therefore remains behind the runner's guarded operation queue until
|
|
868
|
+
// those executors can provide concrete scopes.
|
|
869
|
+
planChorePaths: () => [],
|
|
870
|
+
});
|
|
871
|
+
let coordinator = parallelCoordinatorEnabled ? createCoordinator() : null;
|
|
864
872
|
const runCoordinatorWork = async (work, task, options = {}) => {
|
|
865
873
|
const telemetry = work.class === "realtime" && parallelCoordinatorEnabled
|
|
866
874
|
? new RealtimeTelemetrySpan(work.source, work.direction, work.paths.length, writeRealtimeTelemetryToStderr)
|
|
@@ -937,6 +945,67 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
937
945
|
onSettled({ result: 1, accepted: false, coordinatorRefusedPaths: [] });
|
|
938
946
|
});
|
|
939
947
|
};
|
|
948
|
+
const personalJournalInScope = (companiesMode || personalMode) && !watchRouteSelection.skipPersonal;
|
|
949
|
+
const areaAutoMigration = personalJournalInScope
|
|
950
|
+
? createAreaAutoMigrationScheduler({
|
|
951
|
+
now: () => Date.now(),
|
|
952
|
+
hasActiveRealtimeSession: () => eventSync !== null && eventSyncLive,
|
|
953
|
+
areaStorageSwitch: () => parallelRollout.areaStorage,
|
|
954
|
+
readPhase: () => readPersonalVaultLayoutPhase(getStateDir(), PERSONAL_VAULT_JOURNAL_SLUG),
|
|
955
|
+
hasLegacyJournal: () => {
|
|
956
|
+
const slugs = listJournalSlugs();
|
|
957
|
+
return slugs.includes(PERSONAL_VAULT_JOURNAL_SLUG) || slugs.includes("personal");
|
|
958
|
+
},
|
|
959
|
+
createMigration: () => {
|
|
960
|
+
const opened = openPersonalVaultAreaMigration(hqRoot, getStateDir(), PERSONAL_VAULT_JOURNAL_SLUG);
|
|
961
|
+
return {
|
|
962
|
+
copyAndCatchUp: () => opened.migration.copyAndCatchUp(),
|
|
963
|
+
verifyParity: (legacy) => opened.migration.verifyParity(legacy),
|
|
964
|
+
cutOver: () => opened.migration.cutOver(),
|
|
965
|
+
readLegacyJournal: opened.readLegacyJournal,
|
|
966
|
+
};
|
|
967
|
+
},
|
|
968
|
+
withExclusiveLock: (fn) => withOperationLockSync(hqRoot, "area-ledger-migration", fn, {
|
|
969
|
+
mode: "exclusive",
|
|
970
|
+
timeoutSec: 5,
|
|
971
|
+
onWaitStart: () => undefined,
|
|
972
|
+
}),
|
|
973
|
+
enqueueChore: (run) => {
|
|
974
|
+
enqueueChore("migration", async () => {
|
|
975
|
+
run();
|
|
976
|
+
return 0;
|
|
977
|
+
}, (execution) => {
|
|
978
|
+
if (!execution.accepted || passExitCode(execution.result) !== 0) {
|
|
979
|
+
process.stderr.write("hq-sync-runner: area-ledger auto-migration chore failed; will retry\n");
|
|
980
|
+
}
|
|
981
|
+
}, { wholeMutation: false });
|
|
982
|
+
},
|
|
983
|
+
log: (message) => process.stderr.write(`hq-sync-runner: ${message}\n`),
|
|
984
|
+
emitTelemetry: (eventName) => {
|
|
985
|
+
const getAccessToken = deps.getAccessToken ?? runtime.defaultGetAccessToken;
|
|
986
|
+
const getClaims = deps.getIdTokenClaims ?? runtime.defaultGetIdTokenClaims;
|
|
987
|
+
const client = new VaultClient({
|
|
988
|
+
apiUrl: runtime.apiUrl,
|
|
989
|
+
authToken: getAccessToken,
|
|
990
|
+
region: runtime.region,
|
|
991
|
+
});
|
|
992
|
+
void emitCloudTelemetry(client, {
|
|
993
|
+
eventName,
|
|
994
|
+
source: AREA_AUTO_MIGRATION_SOURCE,
|
|
995
|
+
properties: { trigger: "realtime_auto" },
|
|
996
|
+
}, {
|
|
997
|
+
claims: getClaims(),
|
|
998
|
+
log: (message) => process.stderr.write(`hq-sync-runner: ${message}\n`),
|
|
999
|
+
});
|
|
1000
|
+
},
|
|
1001
|
+
onCutOver: () => {
|
|
1002
|
+
parallelCoordinatorEnabled = refreshCoordinatorEnabled();
|
|
1003
|
+
if (parallelCoordinatorEnabled && coordinator === null) {
|
|
1004
|
+
coordinator = createCoordinator();
|
|
1005
|
+
}
|
|
1006
|
+
},
|
|
1007
|
+
})
|
|
1008
|
+
: { onTick() { } };
|
|
940
1009
|
let watcher = null;
|
|
941
1010
|
let eventPushSurfacesActivated = false;
|
|
942
1011
|
let watcherUnavailableWarned = false;
|
|
@@ -2316,6 +2385,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2316
2385
|
if (coordinatorAuthRequired)
|
|
2317
2386
|
return 0;
|
|
2318
2387
|
pollTick++;
|
|
2388
|
+
areaAutoMigration.onTick();
|
|
2319
2389
|
const pending = takePendingWatcherChange();
|
|
2320
2390
|
// The quarantine is scoped to the delete episode it refused, and only
|
|
2321
2391
|
// the roots already refused when this batch was taken belong to it.
|
|
@@ -2550,7 +2620,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2550
2620
|
}, { wholeMutation: true });
|
|
2551
2621
|
const epoch = new Date().toISOString().slice(0, 10);
|
|
2552
2622
|
for (const slug of listJournalSlugs()) {
|
|
2553
|
-
if (!shouldUseAreaStorage(
|
|
2623
|
+
if (!shouldUseAreaStorage(parallelRollout.areaStorage, getStateDir(), slug))
|
|
2554
2624
|
continue;
|
|
2555
2625
|
enqueueChore("rotation", () => runGuardedTask(async () => {
|
|
2556
2626
|
const maintenance = maintainAreaJournalSlice(slug, epoch);
|
|
@@ -2571,10 +2641,10 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2571
2641
|
catch (error) {
|
|
2572
2642
|
process.stderr.write(`hq-sync-runner: backup retention dry-run failed — ${error instanceof Error ? error.message : String(error)}\n`);
|
|
2573
2643
|
}
|
|
2574
|
-
|
|
2644
|
+
{
|
|
2575
2645
|
const epoch = new Date().toISOString().slice(0, 10);
|
|
2576
2646
|
for (const slug of listJournalSlugs()) {
|
|
2577
|
-
if (!shouldUseAreaStorage(
|
|
2647
|
+
if (!shouldUseAreaStorage(parallelRollout.areaStorage, getStateDir(), slug))
|
|
2578
2648
|
continue;
|
|
2579
2649
|
await runGuardedTask(async () => {
|
|
2580
2650
|
const maintenance = maintainAreaJournalSlice(slug, epoch);
|