@indigoai-us/hq-cli 5.345.221 → 5.345.223
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/CHANGELOG.md +70 -1
- package/dist/command-catalog.generated.d.ts +31 -0
- package/dist/command-catalog.generated.js +38 -0
- package/dist/commands/auth.js +2 -1
- package/dist/commands/bot.d.ts +1 -1
- package/dist/commands/bot.js +34 -33
- package/dist/commands/core-delegate-w1b.js +216 -190
- package/dist/commands/daemon.d.ts +1 -0
- package/dist/commands/daemon.js +15 -1
- package/dist/commands/link.d.ts +2 -0
- package/dist/commands/link.js +14 -2
- package/dist/commands/mesh.js +23 -3
- package/dist/commands/packs.js +13 -2
- package/dist/commands/sync-core.d.ts +6 -0
- package/dist/commands/sync-core.js +75 -1
- package/dist/data/command-states.json +3 -0
- package/dist/lib/bot/fleet-cron.d.ts +26 -3
- package/dist/lib/bot/fleet-cron.js +44 -4
- package/dist/lib/bot/run.d.ts +4 -4
- package/dist/lib/bot/run.js +5 -3
- package/dist/lib/bot/signals-engine-flag.d.ts +53 -13
- package/dist/lib/bot/signals-engine-flag.js +202 -9
- package/dist/lib/daemon/catalog.js +2 -0
- package/dist/lib/daemon/install.d.ts +2 -1
- package/dist/lib/daemon/install.js +9 -0
- package/dist/lib/daemon/legacy.d.ts +1 -0
- package/dist/lib/daemon/legacy.js +5 -2
- package/dist/lib/daemon/machine-check-owner.d.ts +2 -0
- package/dist/lib/daemon/machine-check-owner.js +6 -1
- package/dist/lib/daemon/machine-checks.d.ts +52 -1
- package/dist/lib/daemon/machine-checks.js +104 -11
- package/dist/lib/daemon/mesh-owner.d.ts +45 -0
- package/dist/lib/daemon/mesh-owner.js +166 -0
- package/dist/lib/daemon/native-notice-ledger.d.ts +36 -0
- package/dist/lib/daemon/native-notice-ledger.js +156 -0
- package/dist/lib/daemon/run.d.ts +15 -0
- package/dist/lib/daemon/run.js +72 -3
- package/dist/lib/daemon/selfcheck.d.ts +35 -2
- package/dist/lib/daemon/selfcheck.js +118 -9
- package/dist/lib/daemon/supervisor.d.ts +10 -0
- package/dist/lib/daemon/supervisor.js +86 -0
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/flag-registry-worker.js +33 -3
- package/dist/lib/flag-registry.js +13 -0
- package/dist/lib/hook-engine/coverage.d.ts +9 -0
- package/dist/lib/hook-engine/coverage.js +56 -0
- package/dist/lib/hook-engine/native-stop-compatibility.json +56 -5
- package/dist/lib/mesh/live/daemon/config.d.ts +8 -1
- package/dist/lib/mesh/live/daemon/config.js +16 -0
- package/dist/lib/mesh/live/daemon/install.d.ts +31 -2
- package/dist/lib/mesh/live/daemon/install.js +142 -1
- package/dist/lib/mesh/live/daemon/login-home.d.ts +5 -0
- package/dist/lib/mesh/live/daemon/login-home.js +27 -0
- package/dist/lib/mesh/live/daemon/unit-home.d.ts +49 -0
- package/dist/lib/mesh/live/daemon/unit-home.js +134 -0
- package/dist/lib/registry/registry.d.ts +35 -7
- package/dist/lib/registry/registry.js +88 -13
- package/dist/lib/scan-packages/index.js +23 -2
- package/dist/lib/search-index/max-doc-bytes.js +2 -1
- package/dist/lib/service-manager/startup-migration.d.ts +1 -0
- package/dist/lib/service-manager/startup-migration.js +3 -0
- package/dist/lib/signals/engine.d.ts +8 -0
- package/dist/lib/signals/engine.js +15 -5
- package/dist/lib/sync-core/engine-holds.d.ts +14 -0
- package/dist/lib/sync-core/engine-holds.js +60 -0
- package/dist/lib/sync-core/engine-home.d.ts +2 -0
- package/dist/lib/sync-core/flag.d.ts +18 -0
- package/dist/lib/sync-core/flag.js +66 -0
- package/dist/lib/sync-core/reconcile.d.ts +6 -0
- package/dist/lib/sync-core/reconcile.js +23 -0
- package/dist/lib/sync-core/rollout-state.d.ts +2 -0
- package/dist/lib/sync-core/rollout-state.js +7 -0
- package/dist/lib/sync-core/vault-settings.d.ts +32 -0
- package/dist/lib/sync-core/vault-settings.js +147 -0
- package/dist/lib/windows/install-followup.d.ts +2 -0
- package/dist/lib/windows/install-followup.js +4 -1
- package/dist/utils/host-registration.js +3 -1
- package/dist/utils/pack-contributions.d.ts +16 -1
- package/dist/utils/pack-contributions.js +139 -26
- package/dist/utils/self-update.d.ts +3 -1
- package/dist/utils/self-update.js +56 -11
- package/dist/utils/update-lock.d.ts +151 -14
- package/dist/utils/update-lock.js +782 -46
- package/dist/utils/version-gate.js +12 -2
- package/package.json +7 -7
- package/scripts/bench-core.mjs +34 -3
|
@@ -44,6 +44,32 @@ export const EPISODE_HEALTHY_RESET_MS = 30 * 60_000;
|
|
|
44
44
|
export const STOP_ESCALATION_MS = 10_000;
|
|
45
45
|
export const SYNC_RUNNER_PERSIST_GRACE_MS = 60_000;
|
|
46
46
|
const CLI_UPDATE_SYNC_IDLE_MAX_MS = 10 * 60_000;
|
|
47
|
+
/**
|
|
48
|
+
* Longest wait for a sync-core engine's cycle to end before a parallel-download
|
|
49
|
+
* settings change restarts it anyway. A first-sync cycle can run about 14 minutes.
|
|
50
|
+
*/
|
|
51
|
+
export const SYNC_CORE_SETTINGS_IDLE_MAX_MS = 30 * 60_000;
|
|
52
|
+
/** Engine env keys whose change waits for the engine to be between cycles. */
|
|
53
|
+
const SYNC_CORE_IDLE_RESTART_ENV_KEYS = new Set(["HQ_SYNC_PARALLEL_DOWNLOADS", "HQ_SYNC_DOWNLOAD_STREAMS"]);
|
|
54
|
+
/**
|
|
55
|
+
* True when two sync-core plans differ only in the parallel-download env keys,
|
|
56
|
+
* so the change can wait for the engine to finish its cycle.
|
|
57
|
+
*/
|
|
58
|
+
export function onlySyncCoreSettingsChanged(before, after) {
|
|
59
|
+
if (before.service !== "sync-core" || after.service !== "sync-core")
|
|
60
|
+
return false;
|
|
61
|
+
const strip = (plan) => ({
|
|
62
|
+
...plan,
|
|
63
|
+
env: Object.fromEntries(Object.entries(plan.env ?? {}).filter(([key]) => !SYNC_CORE_IDLE_RESTART_ENV_KEYS.has(key))),
|
|
64
|
+
});
|
|
65
|
+
const b = strip(before);
|
|
66
|
+
const a = strip(after);
|
|
67
|
+
if (planKey(b) !== planKey(a))
|
|
68
|
+
return false;
|
|
69
|
+
if ((b.blocked === undefined) !== (a.blocked === undefined))
|
|
70
|
+
return false;
|
|
71
|
+
return planKey(before) !== planKey(after);
|
|
72
|
+
}
|
|
47
73
|
export const CLI_UPDATE_SYNC_IDLE_KILL_GRACE_MS = 60_000;
|
|
48
74
|
const MESH_OWNER_RECHECK_MS = 15_000;
|
|
49
75
|
const MESH_OWNER_LOG_INTERVAL_MS = 10 * 60_000;
|
|
@@ -398,6 +424,50 @@ export function createSupervisor(deps) {
|
|
|
398
424
|
pending.timer = setT(() => finishPendingSyncCommandRestart(true), CLI_UPDATE_SYNC_IDLE_MAX_MS);
|
|
399
425
|
}
|
|
400
426
|
};
|
|
427
|
+
const clearEngineIdleRestart = (slot) => {
|
|
428
|
+
const pending = slot.engineIdleRestart;
|
|
429
|
+
if (!pending)
|
|
430
|
+
return;
|
|
431
|
+
if (pending.timer !== undefined)
|
|
432
|
+
clearT(pending.timer);
|
|
433
|
+
slot.engineIdleRestart = undefined;
|
|
434
|
+
};
|
|
435
|
+
const runEngineIdleRestart = (slot) => {
|
|
436
|
+
const pending = slot.engineIdleRestart;
|
|
437
|
+
if (!pending)
|
|
438
|
+
return;
|
|
439
|
+
clearEngineIdleRestart(slot);
|
|
440
|
+
pending.run();
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* Restart a sync-core engine whose parallel-download settings changed once it
|
|
444
|
+
* is between cycles (after its all-complete), or after
|
|
445
|
+
* SYNC_CORE_SETTINGS_IDLE_MAX_MS. Each engine unit has its own pending restart.
|
|
446
|
+
*/
|
|
447
|
+
const deferEngineRestartUntilIdle = (slot) => {
|
|
448
|
+
const run = () => {
|
|
449
|
+
deps.log("info", `restarting ${slot.plan.id}: its parallel download settings changed`);
|
|
450
|
+
terminate(slot, () => activate(slot));
|
|
451
|
+
};
|
|
452
|
+
if (slot.engineCycleActive === false) {
|
|
453
|
+
clearEngineIdleRestart(slot);
|
|
454
|
+
run();
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
if (slot.engineIdleRestart) {
|
|
458
|
+
slot.engineIdleRestart.run = run;
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
deps.log("info", `deferring restart of ${slot.plan.id} until its sync cycle ends (maximum ${SYNC_CORE_SETTINGS_IDLE_MAX_MS / 60_000} minutes)`);
|
|
462
|
+
const pending = { run };
|
|
463
|
+
slot.engineIdleRestart = pending;
|
|
464
|
+
pending.timer = setT(() => {
|
|
465
|
+
if (slot.engineIdleRestart !== pending)
|
|
466
|
+
return;
|
|
467
|
+
deps.log("warn", `${slot.plan.id} did not finish its sync cycle within ${SYNC_CORE_SETTINGS_IDLE_MAX_MS / 60_000} minutes; restarting it to apply the changed settings`);
|
|
468
|
+
runEngineIdleRestart(slot);
|
|
469
|
+
}, SYNC_CORE_SETTINGS_IDLE_MAX_MS);
|
|
470
|
+
};
|
|
401
471
|
const setBlocked = (slot) => {
|
|
402
472
|
const block = slot.plan.blocked;
|
|
403
473
|
slot.state.status = block.state;
|
|
@@ -559,6 +629,7 @@ export function createSupervisor(deps) {
|
|
|
559
629
|
*/
|
|
560
630
|
const terminate = (slot, then, drain = false, killGraceMs = slot.plan.stopGraceMs ?? STOP_ESCALATION_MS) => {
|
|
561
631
|
clearPendingSyncCommandRestart(slot);
|
|
632
|
+
clearEngineIdleRestart(slot);
|
|
562
633
|
clearTimer(slot);
|
|
563
634
|
clearHeartbeatTimer(slot);
|
|
564
635
|
const child = slot.child;
|
|
@@ -703,6 +774,12 @@ export function createSupervisor(deps) {
|
|
|
703
774
|
}
|
|
704
775
|
}
|
|
705
776
|
if (slot.plan.service === "sync-core") {
|
|
777
|
+
if (event.type === "fanout-plan")
|
|
778
|
+
slot.engineCycleActive = true;
|
|
779
|
+
else if (event.type === "all-complete") {
|
|
780
|
+
slot.engineCycleActive = false;
|
|
781
|
+
runEngineIdleRestart(slot);
|
|
782
|
+
}
|
|
706
783
|
const bytes = heartbeatProgressBytes(event);
|
|
707
784
|
if (bytes !== null) {
|
|
708
785
|
// The first progress heartbeat of a run is the baseline: counters are
|
|
@@ -758,6 +835,8 @@ export function createSupervisor(deps) {
|
|
|
758
835
|
if (slot.child !== child)
|
|
759
836
|
return;
|
|
760
837
|
slot.child = undefined;
|
|
838
|
+
// The next start uses the current plan, so a waiting settings restart is moot.
|
|
839
|
+
clearEngineIdleRestart(slot);
|
|
761
840
|
if (pendingSyncCommandRestart?.slot === slot) {
|
|
762
841
|
clearPendingSyncCommandRestart(slot);
|
|
763
842
|
if (deferredCliRestart)
|
|
@@ -919,6 +998,7 @@ export function createSupervisor(deps) {
|
|
|
919
998
|
delete slot.lastProtocolLine;
|
|
920
999
|
delete slot.lastProtocolStatus;
|
|
921
1000
|
delete slot.syncPassActive;
|
|
1001
|
+
delete slot.engineCycleActive;
|
|
922
1002
|
delete slot.progressBytes;
|
|
923
1003
|
delete slot.progressedThisRun;
|
|
924
1004
|
let child;
|
|
@@ -1193,6 +1273,7 @@ export function createSupervisor(deps) {
|
|
|
1193
1273
|
existing.adopted = false;
|
|
1194
1274
|
const hadDrainSignal = existing.plan.drainSignal !== undefined;
|
|
1195
1275
|
const key = planKey(plan, deps.cliVersion);
|
|
1276
|
+
const settingsOnly = onlySyncCoreSettingsChanged(existing.plan, plan);
|
|
1196
1277
|
const wasBlocked = existing.plan.blocked !== undefined;
|
|
1197
1278
|
const changed = key !== existing.key;
|
|
1198
1279
|
existing.plan = plan;
|
|
@@ -1259,6 +1340,11 @@ export function createSupervisor(deps) {
|
|
|
1259
1340
|
deps.log("info", `will replace ${plan.id}: it runs an older CLI or command`);
|
|
1260
1341
|
handoffQueue.push(existing);
|
|
1261
1342
|
}
|
|
1343
|
+
else if (changed && settingsOnly && existing.child && !existing.expectingExit) {
|
|
1344
|
+
existing.attempts = 0;
|
|
1345
|
+
existing.state.restarts = 0;
|
|
1346
|
+
deferEngineRestartUntilIdle(existing);
|
|
1347
|
+
}
|
|
1262
1348
|
else if (changed) {
|
|
1263
1349
|
deps.log("info", `restarting ${plan.id}: its command changed`);
|
|
1264
1350
|
existing.attempts = 0;
|