@indigoai-us/hq-cli 5.345.251 → 5.345.252

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.
Files changed (160) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/assets/scaffold/core/scripts/hq-session.sh +9 -0
  3. package/contracts/host-canary-release.json +9 -3
  4. package/dist/command-catalog.generated.d.ts +121 -1
  5. package/dist/command-catalog.generated.js +148 -1
  6. package/dist/commands/bot.js +7 -2
  7. package/dist/commands/core-bucket-c-work-mesh-offer-native.js +1 -1
  8. package/dist/commands/core-hq-session-binding.d.ts +140 -0
  9. package/dist/commands/core-hq-session-binding.js +363 -0
  10. package/dist/commands/core-hq-session-native.d.ts +23 -0
  11. package/dist/commands/core-hq-session-native.js +59 -9
  12. package/dist/commands/core-stop-autosave.js +1 -1
  13. package/dist/commands/core.js +10 -0
  14. package/dist/commands/doctor.d.ts +5 -1
  15. package/dist/commands/doctor.js +42 -5
  16. package/dist/commands/files.js +1 -1
  17. package/dist/commands/install-global.js +4 -2
  18. package/dist/commands/logout.js +4 -0
  19. package/dist/commands/ontology-graph.d.ts +2 -0
  20. package/dist/commands/ontology-graph.js +33 -0
  21. package/dist/commands/report.js +35 -2
  22. package/dist/commands/storage-gate.js +1 -1
  23. package/dist/commands/vault-retention-flag.js +2 -1
  24. package/dist/commands/whoami.js +1 -1
  25. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +238 -221
  26. package/dist/hq-cloud-sync-runner/package.json +1 -1
  27. package/dist/index.js +3 -1
  28. package/dist/lib/agent-kit/inbox-poll-backoff-flag.js +1 -1
  29. package/dist/lib/agent-kit/mcp/tools.js +48 -0
  30. package/dist/lib/bot/fleet-bots-update-pass.js +1 -1
  31. package/dist/lib/bot/fleet-cron.d.ts +35 -0
  32. package/dist/lib/bot/fleet-cron.js +54 -12
  33. package/dist/lib/bot/fleet-local.d.ts +18 -0
  34. package/dist/lib/bot/fleet-local.js +51 -5
  35. package/dist/lib/bot/inbox-poll-backoff-flag.js +1 -1
  36. package/dist/lib/bot/signals-engine-flag.d.ts +1 -1
  37. package/dist/lib/bot/signals-engine-flag.js +1 -1
  38. package/dist/lib/cli-invite-nudge.js +1 -1
  39. package/dist/lib/client-version.d.ts +2 -0
  40. package/dist/lib/client-version.js +24 -0
  41. package/dist/lib/company-flag-gate.d.ts +30 -0
  42. package/dist/lib/company-flag-gate.js +104 -0
  43. package/dist/lib/core-utils/hook-timeout-debug-context-flag.js +1 -1
  44. package/dist/lib/daemon/flag.js +2 -1
  45. package/dist/lib/daemon/legacy-journal-gate.js +3 -1
  46. package/dist/lib/daemon/shared-flag-reads.js +1 -1
  47. package/dist/lib/doctor/checks/host-core.js +22 -4
  48. package/dist/lib/doctor/checks/jq.d.ts +27 -6
  49. package/dist/lib/doctor/checks/jq.js +46 -8
  50. package/dist/lib/doctor/client-health-reason-codes-flag.js +1 -1
  51. package/dist/lib/doctor/fix/refresh-sync-handoff.d.ts +1 -1
  52. package/dist/lib/doctor/fix/refresh-sync-handoff.js +1 -1
  53. package/dist/lib/flag-client-gate-headers.d.ts +38 -0
  54. package/dist/lib/flag-client-gate-headers.js +62 -0
  55. package/dist/lib/flag-client-headers.d.ts +15 -0
  56. package/dist/lib/flag-client-headers.js +25 -0
  57. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  58. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  59. package/dist/lib/flag-registry-worker.js +35 -0
  60. package/dist/lib/flag-registry.d.ts +1 -20
  61. package/dist/lib/flag-registry.js +5 -81
  62. package/dist/lib/hook-engine/adapter-core-pin.d.ts +29 -0
  63. package/dist/lib/hook-engine/adapter-core-pin.js +29 -0
  64. package/dist/lib/hook-engine/coverage.d.ts +50 -1
  65. package/dist/lib/hook-engine/coverage.js +111 -7
  66. package/dist/lib/hook-engine/reconcile.js +3 -2
  67. package/dist/lib/hot-channels/prompts/signals-pass.md +20 -0
  68. package/dist/lib/hot-channels/signal-changes.d.ts +228 -0
  69. package/dist/lib/hot-channels/signal-changes.js +683 -0
  70. package/dist/lib/hot-channels/signals-pass.d.ts +24 -0
  71. package/dist/lib/hot-channels/signals-pass.js +232 -12
  72. package/dist/lib/lanes/outpost-worktree-pruner-flag.d.ts +1 -1
  73. package/dist/lib/lanes/outpost-worktree-pruner-flag.js +1 -1
  74. package/dist/lib/lanes/registry-flag.js +2 -1
  75. package/dist/lib/lanes/spawn.js +11 -1
  76. package/dist/lib/mesh/live/binding-intent.d.ts +61 -0
  77. package/dist/lib/mesh/live/binding-intent.js +201 -0
  78. package/dist/lib/mesh/live/binding-receipt.d.ts +157 -0
  79. package/dist/lib/mesh/live/binding-receipt.js +365 -0
  80. package/dist/lib/mesh/live/company-flag-refresh.js +1 -1
  81. package/dist/lib/mesh/live/daemon/doctor-telemetry.d.ts +39 -0
  82. package/dist/lib/mesh/live/daemon/doctor-telemetry.js +58 -0
  83. package/dist/lib/mesh/live/daemon/install.js +2 -1
  84. package/dist/lib/mesh/live/daemon/presence.js +9 -0
  85. package/dist/lib/mesh/live/daemon/run.d.ts +3 -0
  86. package/dist/lib/mesh/live/daemon/run.js +33 -1
  87. package/dist/lib/ontology-graph/lineage/index.d.ts +401 -0
  88. package/dist/lib/ontology-graph/lineage/index.js +1027 -0
  89. package/dist/lib/ontology-graph/model/index.d.ts +54 -0
  90. package/dist/lib/ontology-graph/model/index.js +112 -0
  91. package/dist/lib/ontology-graph/model/pass-tasks.d.ts +75 -0
  92. package/dist/lib/ontology-graph/model/pass-tasks.js +166 -0
  93. package/dist/lib/ontology-graph/model/pass.d.ts +6 -0
  94. package/dist/lib/ontology-graph/model/pass.js +9 -2
  95. package/dist/lib/ontology-graph/model/pending-items.d.ts +8 -0
  96. package/dist/lib/ontology-graph/model/pending-items.js +24 -1
  97. package/dist/lib/ontology-graph/model/step.d.ts +1 -1
  98. package/dist/lib/ontology-graph/model/tasks.d.ts +11 -3
  99. package/dist/lib/ontology-graph/model/tasks.js +20 -7
  100. package/dist/lib/ontology-graph/read/brief.js +41 -6
  101. package/dist/lib/ontology-graph/read/index.d.ts +4 -0
  102. package/dist/lib/ontology-graph/read/index.js +173 -29
  103. package/dist/lib/ontology-graph/read/lineage.d.ts +101 -0
  104. package/dist/lib/ontology-graph/read/lineage.js +262 -0
  105. package/dist/lib/ontology-graph/replay/buffered-store.js +17 -0
  106. package/dist/lib/ontology-graph/replay/engine.d.ts +32 -1
  107. package/dist/lib/ontology-graph/replay/engine.js +213 -8
  108. package/dist/lib/ontology-graph/replay/extractors.d.ts +26 -0
  109. package/dist/lib/ontology-graph/replay/extractors.js +25 -1
  110. package/dist/lib/ontology-graph/replay/index.d.ts +2 -0
  111. package/dist/lib/ontology-graph/replay/index.js +9 -3
  112. package/dist/lib/ontology-graph/replay/signal-changes.d.ts +118 -0
  113. package/dist/lib/ontology-graph/replay/signal-changes.js +687 -0
  114. package/dist/lib/ontology-graph/schema/decision-status.d.ts +18 -0
  115. package/dist/lib/ontology-graph/schema/decision-status.js +20 -0
  116. package/dist/lib/ontology-graph/schema/index.d.ts +1 -0
  117. package/dist/lib/ontology-graph/schema/index.js +1 -0
  118. package/dist/lib/ontology-graph/setup/index.js +13 -3
  119. package/dist/lib/search-index/index.d.ts +33 -1
  120. package/dist/lib/search-index/index.js +180 -25
  121. package/dist/lib/search-index/qmd-exit-diagnostics.d.ts +7 -0
  122. package/dist/lib/search-index/qmd-exit-diagnostics.js +25 -1
  123. package/dist/lib/signals/adapters-catalog.js +1 -1
  124. package/dist/lib/sync-core/engine-holds.d.ts +1 -0
  125. package/dist/lib/sync-core/engine-holds.js +26 -0
  126. package/dist/lib/sync-core/engine-home.d.ts +3 -0
  127. package/dist/lib/sync-core/engine-home.js +41 -1
  128. package/dist/lib/sync-core/flag.js +2 -1
  129. package/dist/lib/sync-core/legacy-journal-export-child.js +5 -3
  130. package/dist/lib/sync-core/legacy-journal-export.d.ts +23 -4
  131. package/dist/lib/sync-core/legacy-journal-export.js +120 -55
  132. package/dist/lib/sync-core/reconcile.d.ts +2 -1
  133. package/dist/lib/sync-core/reconcile.js +30 -5
  134. package/dist/lib/sync-invalid-entity-warning.js +2 -1
  135. package/dist/lib/windows/install-followup.d.ts +41 -0
  136. package/dist/lib/windows/install-followup.js +87 -0
  137. package/dist/lib/windows/jq.d.ts +59 -0
  138. package/dist/lib/windows/jq.js +154 -3
  139. package/dist/lib/windows/user-path.d.ts +5 -0
  140. package/dist/lib/windows/user-path.js +1 -1
  141. package/dist/lib/work-context/auto-bind.d.ts +12 -0
  142. package/dist/lib/work-context/auto-bind.js +49 -3
  143. package/dist/lib/work-context/organize.d.ts +4 -2
  144. package/dist/lib/work-context/organize.js +18 -8
  145. package/dist/lib/work-context/reconcile.js +16 -1
  146. package/dist/main.js +12 -1
  147. package/dist/utils/client-health-contract.d.ts +30 -0
  148. package/dist/utils/client-health-contract.js +111 -0
  149. package/dist/utils/client-health.d.ts +5 -2
  150. package/dist/utils/client-health.js +74 -5
  151. package/dist/utils/exclusive-lock.d.ts +5 -1
  152. package/dist/utils/exclusive-lock.js +9 -2
  153. package/dist/utils/host-registration.d.ts +7 -0
  154. package/dist/utils/host-registration.js +10 -1
  155. package/dist/utils/pid.d.ts +31 -0
  156. package/dist/utils/pid.js +65 -0
  157. package/dist/utils/resident-package-preload.js +12 -4
  158. package/dist/utils/sentry-fingerprint.js +3 -0
  159. package/package.json +8 -8
  160. package/scripts/install-hook-engine.mjs +5 -3
@@ -60,6 +60,15 @@ export declare const CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_OUTCOMES: readonly ["u
60
60
  export declare const CLIENT_HEALTH_SYNC_ENGINES: readonly ["hq-syncd"];
61
61
  export type ClientHealthSyncEngine = (typeof CLIENT_HEALTH_SYNC_ENGINES)[number];
62
62
  export declare const CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULTS = 10000;
63
+ export declare const CLIENT_HEALTH_SYNC_ENGINE_OWNERS: readonly ["engine", "legacy"];
64
+ export type ClientHealthSyncEngineOwner = (typeof CLIENT_HEALTH_SYNC_ENGINE_OWNERS)[number];
65
+ export declare const CLIENT_HEALTH_SYNC_ENGINE_HOLD_KINDS: readonly ["delete_local", "delete_remote", "overwrite_local"];
66
+ export type ClientHealthSyncEngineHoldKind = (typeof CLIENT_HEALTH_SYNC_ENGINE_HOLD_KINDS)[number];
67
+ export declare const CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULT_ENTRIES = 16;
68
+ export declare const CLIENT_HEALTH_MAX_SYNC_ENGINE_COUNT = 100000000;
69
+ export declare const CLIENT_HEALTH_SYNC_ENGINE_SAFETY_COUNTERS: readonly ["vaultDeletes", "localDeletes", "downloadTrashed", "conflictBackups", "localReplaced", "uploadsOver", "refusedDeletes", "refusedUploads", "adoptions"];
70
+ export type ClientHealthSyncEngineSafetyCounter = (typeof CLIENT_HEALTH_SYNC_ENGINE_SAFETY_COUNTERS)[number];
71
+ export declare const CLIENT_HEALTH_MAX_EPOCH_MS = 8640000000000000;
63
72
  export type ClientHealthDaemonHqCloudUpdateOutcome = (typeof CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_OUTCOMES)[number];
64
73
  export declare const CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_ERROR_CLASSES: readonly ["registry", "install", "convergence", "filesystem", "unknown"];
65
74
  export type ClientHealthDaemonHqCloudUpdateErrorClass = (typeof CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_ERROR_CLASSES)[number];
@@ -120,6 +129,26 @@ export interface ClientHealthLocalFilesOverview {
120
129
  /** Capped at {@link CLIENT_HEALTH_MAX_ERROR_LINE_COUNT}. */
121
130
  recentErrorLineCount: number;
122
131
  }
132
+ export interface ClientHealthSyncEngineVault {
133
+ vaultUid: string;
134
+ owner: ClientHealthSyncEngineOwner;
135
+ unitRunning?: boolean;
136
+ lastCycleAt?: string;
137
+ lastCycleSuccess?: boolean;
138
+ held?: number;
139
+ holdKinds?: ClientHealthSyncEngineHoldKind[];
140
+ conflicts?: number;
141
+ transferFailures?: number;
142
+ truncated?: boolean;
143
+ requests24h?: number;
144
+ safety?: ClientHealthSyncEngineSafety;
145
+ }
146
+ export interface ClientHealthSyncEngineSafetyCount {
147
+ total: number;
148
+ last24h: number;
149
+ lastAtMs?: number;
150
+ }
151
+ export type ClientHealthSyncEngineSafety = Partial<Record<ClientHealthSyncEngineSafetyCounter, ClientHealthSyncEngineSafetyCount>>;
123
152
  export interface ClientHealthHeartbeat {
124
153
  contractVersion: number;
125
154
  /** Stable random installation identity — NOT a hardware fingerprint. */
@@ -153,6 +182,7 @@ export interface ClientHealthHeartbeat {
153
182
  syncRunnerSource?: ClientHealthSyncRunnerSource;
154
183
  syncEngine?: ClientHealthSyncEngine;
155
184
  syncEngineVaults?: number;
185
+ syncEngineByVault?: ClientHealthSyncEngineVault[];
156
186
  daemonHqCloudUpdateLastCheckAt?: string;
157
187
  daemonHqCloudUpdateOutcome?: ClientHealthDaemonHqCloudUpdateOutcome;
158
188
  daemonHqCloudUpdateTarget?: string;
@@ -81,6 +81,22 @@ export const CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_OUTCOMES = [
81
81
  ];
82
82
  export const CLIENT_HEALTH_SYNC_ENGINES = ["hq-syncd"];
83
83
  export const CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULTS = 10_000;
84
+ export const CLIENT_HEALTH_SYNC_ENGINE_OWNERS = ["engine", "legacy"];
85
+ export const CLIENT_HEALTH_SYNC_ENGINE_HOLD_KINDS = ["delete_local", "delete_remote", "overwrite_local"];
86
+ export const CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULT_ENTRIES = 16;
87
+ export const CLIENT_HEALTH_MAX_SYNC_ENGINE_COUNT = 100_000_000;
88
+ export const CLIENT_HEALTH_SYNC_ENGINE_SAFETY_COUNTERS = [
89
+ "vaultDeletes",
90
+ "localDeletes",
91
+ "downloadTrashed",
92
+ "conflictBackups",
93
+ "localReplaced",
94
+ "uploadsOver",
95
+ "refusedDeletes",
96
+ "refusedUploads",
97
+ "adoptions",
98
+ ];
99
+ export const CLIENT_HEALTH_MAX_EPOCH_MS = 8_640_000_000_000_000;
84
100
  export const CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_ERROR_CLASSES = [
85
101
  "registry",
86
102
  "install",
@@ -165,6 +181,7 @@ export class ClientHealthContractError extends Error {
165
181
  // ─── Value validators (fail closed) ──────────────────────────────────────────
166
182
  const INSTALLATION_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{7,63}$/;
167
183
  const COMMAND_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{7,63}$/;
184
+ const SYNC_ENGINE_VAULT_UID = /^(?:prs|cmp)_[A-Za-z0-9][A-Za-z0-9_-]{0,59}$/;
168
185
  /** Same shape sync-auth-middleware.ts enforces on x-hq-*-version headers. */
169
186
  export const SEMVER = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
170
187
  const ISO_UTC = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/;
@@ -316,6 +333,11 @@ export function parseClientHealthHeartbeat(input) {
316
333
  if (vaults !== undefined)
317
334
  heartbeat.syncEngineVaults = vaults;
318
335
  }
336
+ if (raw.syncEngineByVault !== undefined) {
337
+ const byVault = parseClientHealthSyncEngineByVault(raw.syncEngineByVault);
338
+ if (byVault !== undefined)
339
+ heartbeat.syncEngineByVault = byVault;
340
+ }
319
341
  if (raw.daemonHqCloudUpdateLastCheckAt !== undefined) {
320
342
  const lastCheckAt = copyValidOptionalDiagnostic("daemonHqCloudUpdateLastCheckAt", raw.daemonHqCloudUpdateLastCheckAt, assertIsoUtc);
321
343
  if (lastCheckAt !== undefined)
@@ -338,6 +360,95 @@ export function parseClientHealthHeartbeat(input) {
338
360
  }
339
361
  return heartbeat;
340
362
  }
363
+ function parseClientHealthSyncEngineByVault(input) {
364
+ if (!Array.isArray(input))
365
+ return undefined;
366
+ if (input.length === 0)
367
+ return [];
368
+ const seen = new Set();
369
+ const out = [];
370
+ const limit = Math.min(input.length, CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULT_ENTRIES);
371
+ for (let index = 0; index < limit; index += 1) {
372
+ const entry = parseClientHealthSyncEngineVault(`syncEngineByVault[${index}]`, input[index]);
373
+ if (!entry || seen.has(entry.vaultUid))
374
+ continue;
375
+ seen.add(entry.vaultUid);
376
+ out.push(entry);
377
+ }
378
+ return out.length > 0 ? out : undefined;
379
+ }
380
+ function parseClientHealthSyncEngineVault(field, input) {
381
+ const raw = copyValidOptionalDiagnostic(field, input, asRecord);
382
+ if (!raw)
383
+ return undefined;
384
+ const vaultUid = copyValidOptionalDiagnostic(`${field}.vaultUid`, raw.vaultUid, (name, value) => {
385
+ const safe = assertSafeBoundedString(name, value);
386
+ if (!SYNC_ENGINE_VAULT_UID.test(safe))
387
+ throw new ClientHealthContractError("UNSAFE_VALUE", name);
388
+ return safe;
389
+ });
390
+ const owner = copyValidOptionalDiagnostic(`${field}.owner`, raw.owner, (name, value) => assertEnum(name, value, CLIENT_HEALTH_SYNC_ENGINE_OWNERS));
391
+ if (vaultUid === undefined || owner === undefined)
392
+ return undefined;
393
+ const entry = { vaultUid, owner };
394
+ const optional = (key, validate) => {
395
+ if (raw[key] === undefined)
396
+ return;
397
+ const parsed = copyValidOptionalDiagnostic(`${field}.${key}`, raw[key], validate);
398
+ if (parsed !== undefined)
399
+ entry[key] = parsed;
400
+ };
401
+ const count = (name, value) => assertBoundedInt(name, value, CLIENT_HEALTH_MAX_SYNC_ENGINE_COUNT);
402
+ optional("unitRunning", assertBoolean);
403
+ optional("lastCycleAt", assertIsoUtc);
404
+ optional("lastCycleSuccess", assertBoolean);
405
+ optional("held", count);
406
+ optional("holdKinds", (name, value) => {
407
+ if (!Array.isArray(value))
408
+ throw new ClientHealthContractError("INVALID_TYPE", name, "expected array");
409
+ const kinds = CLIENT_HEALTH_SYNC_ENGINE_HOLD_KINDS.filter((known) => value.includes(known));
410
+ if (kinds.length === 0)
411
+ throw new ClientHealthContractError("UNKNOWN_ENUM_VALUE", name);
412
+ return kinds;
413
+ });
414
+ optional("conflicts", count);
415
+ optional("transferFailures", count);
416
+ optional("truncated", assertBoolean);
417
+ optional("requests24h", count);
418
+ optional("safety", parseClientHealthSyncEngineSafety);
419
+ return entry;
420
+ }
421
+ function parseClientHealthSyncEngineSafety(field, input) {
422
+ const raw = asRecord(field, input);
423
+ const safety = {};
424
+ let malformed = false;
425
+ for (const name of CLIENT_HEALTH_SYNC_ENGINE_SAFETY_COUNTERS) {
426
+ if (raw[name] === undefined)
427
+ continue;
428
+ const parsed = copyValidOptionalDiagnostic(`${field}.${name}`, raw[name], parseClientHealthSyncEngineSafetyCount);
429
+ if (parsed === undefined)
430
+ malformed = true;
431
+ else
432
+ safety[name] = parsed;
433
+ }
434
+ if (malformed && Object.keys(safety).length === 0) {
435
+ throw new ClientHealthContractError("INVALID_TYPE", field, "no valid counter");
436
+ }
437
+ return safety;
438
+ }
439
+ function parseClientHealthSyncEngineSafetyCount(field, input) {
440
+ const raw = asRecord(field, input);
441
+ const count = {
442
+ total: assertBoundedInt(`${field}.total`, raw.total, CLIENT_HEALTH_MAX_SYNC_ENGINE_COUNT),
443
+ last24h: assertBoundedInt(`${field}.last24h`, raw.last24h, CLIENT_HEALTH_MAX_SYNC_ENGINE_COUNT),
444
+ };
445
+ if (raw.lastAtMs !== undefined) {
446
+ const lastAtMs = copyValidOptionalDiagnostic(`${field}.lastAtMs`, raw.lastAtMs, (name, value) => assertBoundedInt(name, value, CLIENT_HEALTH_MAX_EPOCH_MS));
447
+ if (lastAtMs !== undefined && lastAtMs > 0)
448
+ count.lastAtMs = lastAtMs;
449
+ }
450
+ return count;
451
+ }
341
452
  /**
342
453
  * Parse + validate a {@link ClientHealthLocalFilesOverview}. Every field is a
343
454
  * boolean or a bounded integer — there is no string field to be path- or
@@ -32,7 +32,8 @@
32
32
  */
33
33
  import { isExpiring, loadCachedTokens } from "./cognito-session.js";
34
34
  import { type VersionInfo } from "./feedback-versions.js";
35
- import { type ClientHealthArch, type ClientHealthFailureReason, type ClientHealthHeartbeat, type ClientHealthLocalFilesOverview, type ClientHealthPlatform } from "./client-health-contract.js";
35
+ import { type ClientHealthArch, type ClientHealthFailureReason, type ClientHealthHeartbeat, type ClientHealthLocalFilesOverview, type ClientHealthPlatform, type ClientHealthSyncEngineVault } from "./client-health-contract.js";
36
+ import { type DaemonPaths } from "../lib/daemon/paths.js";
36
37
  export declare const CLIENT_HEALTH_STATE_FILE = "cli-client-health.json";
37
38
  /**
38
39
  * Single-flight marker for the journal observation below. Held only for the
@@ -184,8 +185,9 @@ export interface BuildCliHeartbeatInput {
184
185
  export interface CliSyncEngine {
185
186
  release: string;
186
187
  vaults: number;
188
+ byVault?: ClientHealthSyncEngineVault[];
187
189
  }
188
- export declare function readCliSyncEngine(stateDir: string): CliSyncEngine | null;
190
+ export declare function readCliSyncEngine(stateDir: string, now?: Date, paths?: DaemonPaths, alive?: (pid: number) => boolean): CliSyncEngine | null;
189
191
  /** Classify sync failures using typed error identity/code fields only. */
190
192
  export declare function classifySyncFailure(err: unknown): ClientHealthFailureReason;
191
193
  /**
@@ -213,6 +215,7 @@ export interface ClientHealthDeps {
213
215
  /** US-016: overridable for tests; defaults to {@link collectLocalFilesOverview}. */
214
216
  localFilesOverview?: () => ClientHealthLocalFilesOverview;
215
217
  syncEngine?: () => CliSyncEngine | null;
218
+ daemonPaths?: DaemonPaths;
216
219
  daemonCliVersion?: () => Promise<string | null>;
217
220
  /** Override for {@link JOURNAL_OBSERVATION_TTL_MS}. */
218
221
  journalObservationTtlMs?: number;
@@ -42,9 +42,13 @@ import { vaultApiFetch } from "./vault-api.js";
42
42
  import { collectVersions } from "./feedback-versions.js";
43
43
  import { resolveDaemonCliVersion } from "./daemon-cli-version.js";
44
44
  import { isAuthError } from "./auth-error.js";
45
- import { CLIENT_HEALTH_CONTRACT_VERSION, CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULTS, parseClientHealthHeartbeat, SEMVER, } from "./client-health-contract.js";
45
+ import { CLIENT_HEALTH_CONTRACT_VERSION, CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULTS, CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULT_ENTRIES, CLIENT_HEALTH_SYNC_ENGINE_HOLD_KINDS, parseClientHealthHeartbeat, SEMVER, } from "./client-health-contract.js";
46
46
  import { collectLocalFilesOverview } from "./local-files-overview.js";
47
47
  import { readSyncCoreRolloutStateFile } from "../lib/sync-core/rollout-state.js";
48
+ import { readEngineStatus, SYNC_CORE_STATUS_WORK_LIMIT, syncCoreUnitId } from "../lib/sync-core/engine-home.js";
49
+ import { daemonPaths } from "../lib/daemon/paths.js";
50
+ import { isProcessAlive, runningDaemonPid } from "../lib/daemon/lock.js";
51
+ import { readEngineHoldKinds } from "../lib/sync-core/engine-holds.js";
48
52
  /** Same bound as CLI telemetry: a heartbeat may never stall a command. */
49
53
  const CLIENT_HEALTH_TIMEOUT_MS = 1_200;
50
54
  export const CLIENT_HEALTH_STATE_FILE = "cli-client-health.json";
@@ -383,10 +387,72 @@ function acquireJournalObservationLock(stateDir, nowMs, staleMs) {
383
387
  }
384
388
  };
385
389
  }
386
- export function readCliSyncEngine(stateDir) {
390
+ function readDaemonUnitStatuses(paths, alive) {
391
+ try {
392
+ const daemonPid = runningDaemonPid(paths.lockPath, alive);
393
+ if (daemonPid === null)
394
+ return new Map();
395
+ const state = JSON.parse(fs.readFileSync(paths.statePath, "utf8"));
396
+ if (!state || state.pid !== daemonPid || !Array.isArray(state.units))
397
+ return null;
398
+ const out = new Map();
399
+ for (const unit of state.units) {
400
+ const u = unit;
401
+ if (typeof u?.id === "string" && typeof u.status === "string")
402
+ out.set(u.id, u.status);
403
+ }
404
+ return out;
405
+ }
406
+ catch {
407
+ return null;
408
+ }
409
+ }
410
+ function syncEngineVaultFacts(vault, owner, units, now) {
411
+ const entry = { vaultUid: vault.uid, owner };
412
+ if (units)
413
+ entry.unitRunning = units.get(syncCoreUnitId(vault.uid)) === "running";
414
+ const engine = readEngineStatus(vault.engineHome, vault.uid, now);
415
+ const cycle = engine?.lastCycle;
416
+ if (cycle) {
417
+ entry.lastCycleAt = cycle.at;
418
+ entry.lastCycleSuccess = cycle.success;
419
+ entry.held = Math.floor(cycle.held);
420
+ entry.conflicts = cycle.conflicts;
421
+ entry.transferFailures = cycle.transferFailures;
422
+ if (cycle.truncated || cycle.transferFailures >= SYNC_CORE_STATUS_WORK_LIMIT)
423
+ entry.truncated = true;
424
+ }
425
+ if (engine?.requests24h !== undefined)
426
+ entry.requests24h = Math.floor(engine.requests24h);
427
+ if (engine?.safety)
428
+ entry.safety = engine.safety;
429
+ const holdKinds = readEngineHoldKinds(vault.engineHome, vault.uid).filter((kind) => CLIENT_HEALTH_SYNC_ENGINE_HOLD_KINDS.includes(kind));
430
+ if (holdKinds.length > 0)
431
+ entry.holdKinds = holdKinds;
432
+ return entry;
433
+ }
434
+ export function readCliSyncEngine(stateDir, now = new Date(), paths = daemonPaths(), alive = isProcessAlive) {
387
435
  const state = readSyncCoreRolloutStateFile(path.join(stateDir, "sync-core", "rollout.json"));
388
- const vaults = state?.vaults.filter((vault) => vault.phase === "full").length ?? 0;
389
- return state && vaults > 0 ? { release: state.release, vaults } : null;
436
+ if (!state)
437
+ return null;
438
+ const vaults = state.vaults.filter((vault) => vault.phase === "full").length;
439
+ const units = readDaemonUnitStatuses(paths, alive);
440
+ const byVault = [];
441
+ const seen = new Set();
442
+ const add = (uid, entry) => {
443
+ if (seen.has(uid) || byVault.length >= CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULT_ENTRIES)
444
+ return;
445
+ seen.add(uid);
446
+ byVault.push(entry());
447
+ };
448
+ for (const vault of state.vaults) {
449
+ add(vault.uid, () => syncEngineVaultFacts(vault, vault.phase === "full" ? "engine" : "legacy", units, now));
450
+ }
451
+ for (const vault of state.handingBack ?? [])
452
+ add(vault.uid, () => syncEngineVaultFacts(vault, "legacy", units, now));
453
+ for (const { uid } of [...(state.skipped ?? []), ...(state.held ?? [])])
454
+ add(uid, () => ({ vaultUid: uid, owner: "legacy" }));
455
+ return { release: state.release, vaults, byVault };
390
456
  }
391
457
  /** Classify sync failures using typed error identity/code fields only. */
392
458
  export function classifySyncFailure(err) {
@@ -494,6 +560,9 @@ export function buildCliHeartbeat(input) {
494
560
  input.localFilesOverview) {
495
561
  heartbeat.localFilesOverview = input.localFilesOverview;
496
562
  }
563
+ if (input.syncEngine?.byVault) {
564
+ heartbeat.syncEngineByVault = input.syncEngine.byVault;
565
+ }
497
566
  if (input.syncEngine && input.syncEngine.vaults > 0) {
498
567
  heartbeat.syncEngine = "hq-syncd";
499
568
  heartbeat.syncEngineVaults = Math.min(input.syncEngine.vaults, CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULTS);
@@ -665,7 +734,7 @@ async function contributeClientHealthUnbounded(kind, deps, failureReason) {
665
734
  }
666
735
  let syncEngine = null;
667
736
  try {
668
- syncEngine = (deps.syncEngine ?? (() => readCliSyncEngine(stateDir)))();
737
+ syncEngine = (deps.syncEngine ?? (() => readCliSyncEngine(stateDir, now, deps.daemonPaths ?? daemonPaths())))();
669
738
  }
670
739
  catch {
671
740
  syncEngine = null;
@@ -35,7 +35,11 @@ export interface PidLockRecord {
35
35
  pid: number;
36
36
  ts: number;
37
37
  }
38
- /** Parse a `pid=<n>\nts=<n>` body; null unless both fields are plain digits. */
38
+ /**
39
+ * Parse a `pid=<n>\nts=<n>` body; null unless both fields are plain digits and
40
+ * the pid is a positive integer. A `pid=0` record must never reach a kill or
41
+ * taskkill: process.kill(0) signals the caller's whole process group.
42
+ */
39
43
  export declare function parsePidLockRecord(content: string): PidLockRecord | null;
40
44
  export interface LockFileReadDeps {
41
45
  existsSync?: typeof fs.existsSync;
@@ -72,7 +72,11 @@ export function acquireLockFileExclusively(candidate, lockFile, dirKey) {
72
72
  mode: 0o600,
73
73
  });
74
74
  }
75
- /** Parse a `pid=<n>\nts=<n>` body; null unless both fields are plain digits. */
75
+ /**
76
+ * Parse a `pid=<n>\nts=<n>` body; null unless both fields are plain digits and
77
+ * the pid is a positive integer. A `pid=0` record must never reach a kill or
78
+ * taskkill: process.kill(0) signals the caller's whole process group.
79
+ */
76
80
  export function parsePidLockRecord(content) {
77
81
  const fields = {};
78
82
  for (const line of content.split("\n")) {
@@ -84,7 +88,10 @@ export function parsePidLockRecord(content) {
84
88
  if (!/^\d+$/.test(fields.pid ?? "") || !/^\d+$/.test(fields.ts ?? "")) {
85
89
  return null;
86
90
  }
87
- return { pid: Number(fields.pid), ts: Number(fields.ts) };
91
+ const pid = Number(fields.pid);
92
+ if (!Number.isSafeInteger(pid) || pid <= 0)
93
+ return null;
94
+ return { pid, ts: Number(fields.ts) };
88
95
  }
89
96
  /** Read and parse a lock file. A missing file, a read error or a parse error is null. */
90
97
  export function readLockFile(lockPath, parse, deps = {}) {
@@ -117,6 +117,13 @@ export declare function resolveCoreNextEngine(home: string, options: CoreNextEng
117
117
  * stays as it is today.
118
118
  */
119
119
  export declare function coreNextTarget(home: string, env?: NodeJS.ProcessEnv, options?: CoreNextOptions): CoreNextTarget | null;
120
+ /**
121
+ * The new-core target for an engine at `stable` already probed (`caps`): its
122
+ * capable events, its covers and the host canary gate; null when it has no
123
+ * capable event. [`coreNextTarget`] builds its target here, and `hq doctor`
124
+ * uses it to ask the same questions without installing anything.
125
+ */
126
+ export declare function coreNextTargetFor(home: string, env: NodeJS.ProcessEnv, stable: string, caps: EngineCapabilities, platform?: NodeJS.Platform, warn?: (message: string) => void): CoreNextTarget | null;
120
127
  /**
121
128
  * Set by `hq reindex --from-hook` (a reindex the daemon runs for a hook's
122
129
  * request note): the host canary gate then keeps every host on the core it is
@@ -333,10 +333,19 @@ export function coreNextTarget(home, env = process.env, options = {}) {
333
333
  if (coreNextOffReason(home, env, platform))
334
334
  return null;
335
335
  const { stable, caps } = resolveCoreNextEngine(home, { mode: 'install', platform, probe: options.probe });
336
+ return coreNextTargetFor(home, env, stable, caps, platform, options.warn);
337
+ }
338
+ /**
339
+ * The new-core target for an engine at `stable` already probed (`caps`): its
340
+ * capable events, its covers and the host canary gate; null when it has no
341
+ * capable event. [`coreNextTarget`] builds its target here, and `hq doctor`
342
+ * uses it to ask the same questions without installing anything.
343
+ */
344
+ export function coreNextTargetFor(home, env, stable, caps, platform = process.platform, warn) {
336
345
  const events = capableEvents(caps);
337
346
  if (!events.length)
338
347
  return null;
339
- return resolvedUnder({ coreNext: stable, events, covers: caps.covers ?? {}, canary: hostCanaryGate(home, env, caps.version, platform, options.warn) }, env);
348
+ return resolvedUnder({ coreNext: stable, events, covers: caps.covers ?? {}, canary: hostCanaryGate(home, env, caps.version, platform, warn) }, env);
340
349
  }
341
350
  const warned = new Set();
342
351
  function warnOnce(message, warn) {
@@ -0,0 +1,31 @@
1
+ type Kill = (pid: number, signal?: NodeJS.Signals | number) => unknown;
2
+ /** A pid that names one process: a safe integer above 0. */
3
+ export declare function isSignalablePid(pid: unknown): pid is number;
4
+ /**
5
+ * The pid in `text` (a pid file's content, a parsed field), or undefined when
6
+ * it is not exactly one positive decimal integer, surrounding whitespace
7
+ * aside. Empty, partial-looking ("12a"), negative, zero, fractional and
8
+ * out-of-range values are all undefined.
9
+ */
10
+ export declare function parsePid(text: string | null | undefined): number | undefined;
11
+ /**
12
+ * Send `signal` to the single process `pid`. Returns false without calling
13
+ * `kill` when `pid` is not a signalable pid, so 0, negative numbers and NaN
14
+ * never reach process.kill. Errors from `kill` itself (ESRCH, EPERM) propagate.
15
+ */
16
+ export declare function signalPid(pid: unknown, signal: NodeJS.Signals | number, kill?: Kill): boolean;
17
+ /**
18
+ * Send `signal` to the process group led by `leaderPid` (process.kill(-leaderPid)).
19
+ * Returns false without calling `kill` unless `leaderPid` is a signalable pid
20
+ * above 1: group 0 is the caller's own group and -1 means every process the
21
+ * user may signal.
22
+ */
23
+ export declare function signalProcessGroup(leaderPid: unknown, signal: NodeJS.Signals | number, kill?: Kill): boolean;
24
+ /**
25
+ * Write `pid` to `file` so a reader never sees an empty or partial value: the
26
+ * pid goes to a temp file in the same directory, which is then renamed over
27
+ * `file`. A writer killed mid-write leaves only the temp file behind.
28
+ */
29
+ export declare function writePidFileAtomic(file: string, pid?: number): void;
30
+ export {};
31
+ //# sourceMappingURL=pid.d.ts.map
@@ -0,0 +1,65 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { renameSync, rmSync, writeFileSync } from "node:fs";
3
+ import path from "node:path";
4
+ const defaultKill = (pid, signal) => process.kill(pid, signal);
5
+ /** A pid that names one process: a safe integer above 0. */
6
+ export function isSignalablePid(pid) {
7
+ return typeof pid === "number" && Number.isSafeInteger(pid) && pid > 0;
8
+ }
9
+ /**
10
+ * The pid in `text` (a pid file's content, a parsed field), or undefined when
11
+ * it is not exactly one positive decimal integer, surrounding whitespace
12
+ * aside. Empty, partial-looking ("12a"), negative, zero, fractional and
13
+ * out-of-range values are all undefined.
14
+ */
15
+ export function parsePid(text) {
16
+ if (typeof text !== "string")
17
+ return undefined;
18
+ const trimmed = text.trim();
19
+ if (!/^[1-9]\d*$/.test(trimmed))
20
+ return undefined;
21
+ const pid = Number(trimmed);
22
+ return isSignalablePid(pid) ? pid : undefined;
23
+ }
24
+ /**
25
+ * Send `signal` to the single process `pid`. Returns false without calling
26
+ * `kill` when `pid` is not a signalable pid, so 0, negative numbers and NaN
27
+ * never reach process.kill. Errors from `kill` itself (ESRCH, EPERM) propagate.
28
+ */
29
+ export function signalPid(pid, signal, kill = defaultKill) {
30
+ if (!isSignalablePid(pid))
31
+ return false;
32
+ kill(pid, signal);
33
+ return true;
34
+ }
35
+ /**
36
+ * Send `signal` to the process group led by `leaderPid` (process.kill(-leaderPid)).
37
+ * Returns false without calling `kill` unless `leaderPid` is a signalable pid
38
+ * above 1: group 0 is the caller's own group and -1 means every process the
39
+ * user may signal.
40
+ */
41
+ export function signalProcessGroup(leaderPid, signal, kill = defaultKill) {
42
+ if (!isSignalablePid(leaderPid) || leaderPid <= 1)
43
+ return false;
44
+ kill(-leaderPid, signal);
45
+ return true;
46
+ }
47
+ /**
48
+ * Write `pid` to `file` so a reader never sees an empty or partial value: the
49
+ * pid goes to a temp file in the same directory, which is then renamed over
50
+ * `file`. A writer killed mid-write leaves only the temp file behind.
51
+ */
52
+ export function writePidFileAtomic(file, pid = process.pid) {
53
+ if (!isSignalablePid(pid))
54
+ throw new Error(`refusing to write invalid pid ${String(pid)} to ${file}`);
55
+ const temp = path.join(path.dirname(file), `.${path.basename(file)}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`);
56
+ try {
57
+ writeFileSync(temp, String(pid));
58
+ renameSync(temp, file);
59
+ }
60
+ catch (error) {
61
+ rmSync(temp, { force: true });
62
+ throw error;
63
+ }
64
+ }
65
+ //# sourceMappingURL=pid.js.map
@@ -32,6 +32,7 @@ export const RESIDENT_PACKAGE_MODULES = {
32
32
  "../commands/lanes.js",
33
33
  "../lib/lanes/reconcile.js",
34
34
  "../lib/flag-registry.js",
35
+ "../lib/company-flag-gate.js",
35
36
  "../commands/access.js",
36
37
  "../commands/sources.js",
37
38
  "../lib/hot-channels/adapters/index.js",
@@ -62,6 +63,7 @@ export const RESIDENT_PACKAGE_MODULES = {
62
63
  "../lib/doctor/client-health-reason-codes-flag.js",
63
64
  "@indigoai-us/hq-flags-client",
64
65
  "../lib/flag-registry.js",
66
+ "../lib/company-flag-gate.js",
65
67
  "../utils/cognito-session.js",
66
68
  "../lib/plan-limit-nag.js",
67
69
  "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js",
@@ -93,12 +95,12 @@ export const RESIDENT_PACKAGE_MODULES = {
93
95
  ],
94
96
  "daemon-logs-follow": [],
95
97
  "mesh-daemon": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud"],
96
- "lanes-watch": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../lib/hot-channels/signals-pass.js", "../lib/hot-channels/signals-runtime.js", "../lib/hot-channels/signals-claude-login.js", "../commands/lanes.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
97
- "monitor-wait": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../lib/hot-channels/signals-pass.js", "../lib/hot-channels/signals-runtime.js", "../lib/hot-channels/signals-claude-login.js", "../commands/lanes.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
98
- "monitor-run": ["../commands/lanes.js", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../lib/hot-channels/signals-pass.js", "../lib/hot-channels/signals-runtime.js", "../lib/hot-channels/signals-claude-login.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
98
+ "lanes-watch": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../lib/company-flag-gate.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../lib/hot-channels/signals-pass.js", "../lib/hot-channels/signals-runtime.js", "../lib/hot-channels/signals-claude-login.js", "../commands/lanes.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
99
+ "monitor-wait": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../lib/company-flag-gate.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../lib/hot-channels/signals-pass.js", "../lib/hot-channels/signals-runtime.js", "../lib/hot-channels/signals-claude-login.js", "../commands/lanes.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
100
+ "monitor-run": ["../commands/lanes.js", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../lib/company-flag-gate.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../lib/hot-channels/signals-pass.js", "../lib/hot-channels/signals-runtime.js", "../lib/hot-channels/signals-claude-login.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
99
101
  "agents-message-wait": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud"],
100
102
  "integrations-oauth-wait": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud"],
101
- "outpost-wait": ["../commands/lanes.js", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../lib/hot-channels/signals-pass.js", "../lib/hot-channels/signals-runtime.js", "../lib/hot-channels/signals-claude-login.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
103
+ "outpost-wait": ["../commands/lanes.js", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud", "../lib/lanes/reconcile.js", "../utils/local-files-overview.js", "../lib/flag-registry.js", "../lib/company-flag-gate.js", "../utils/vault-api.js", "../commands/files-browse.js", "@aws-sdk/client-s3", "../commands/access.js", "../commands/sources.js", "../lib/hot-channels/adapters/index.js", "../lib/hot-channels/signals-pass.js", "../lib/hot-channels/signals-runtime.js", "../lib/hot-channels/signals-claude-login.js", "../lib/capacity/collect.js", "../lib/capacity/accounts.js"],
102
104
  "secrets-sandbox": [],
103
105
  "pkg-update": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../utils/cognito-session.js", "@indigoai-us/hq-cloud"],
104
106
  "pack-install": [
@@ -210,6 +212,7 @@ const LOADERS = {
210
212
  () => import("../commands/lanes.js"),
211
213
  () => import("../lib/lanes/reconcile.js"),
212
214
  () => import("../lib/flag-registry.js"),
215
+ () => import("../lib/company-flag-gate.js"),
213
216
  () => import("../commands/access.js"),
214
217
  // The signals engine's adapters step (lib/signals/steps/adapters.ts)
215
218
  // lazily imports the hot-channel sync when the bot's signals job fires.
@@ -278,6 +281,7 @@ const LOADERS = {
278
281
  preloadSentrySdk();
279
282
  },
280
283
  () => import("../lib/flag-registry.js"),
284
+ () => import("../lib/company-flag-gate.js"),
281
285
  () => import("../utils/cognito-session.js"),
282
286
  () => import("../lib/plan-limit-nag.js"),
283
287
  () => import("../utils/plan-gate-error.js"),
@@ -349,6 +353,7 @@ const LOADERS = {
349
353
  // Source reports use the signals engine after a resident wait.
350
354
  () => import("../utils/local-files-overview.js"),
351
355
  () => import("../lib/flag-registry.js"),
356
+ () => import("../lib/company-flag-gate.js"),
352
357
  () => import("../utils/vault-api.js"),
353
358
  () => import("../commands/files-browse.js"),
354
359
  () => import("@aws-sdk/client-s3"),
@@ -384,6 +389,7 @@ const LOADERS = {
384
389
  // Source reports use the signals engine after a resident wait.
385
390
  () => import("../utils/local-files-overview.js"),
386
391
  () => import("../lib/flag-registry.js"),
392
+ () => import("../lib/company-flag-gate.js"),
387
393
  () => import("../utils/vault-api.js"),
388
394
  () => import("../commands/files-browse.js"),
389
395
  () => import("@aws-sdk/client-s3"),
@@ -420,6 +426,7 @@ const LOADERS = {
420
426
  // Source reports use the signals engine after a resident wait.
421
427
  () => import("../utils/local-files-overview.js"),
422
428
  () => import("../lib/flag-registry.js"),
429
+ () => import("../lib/company-flag-gate.js"),
423
430
  () => import("../utils/vault-api.js"),
424
431
  () => import("../commands/files-browse.js"),
425
432
  () => import("@aws-sdk/client-s3"),
@@ -485,6 +492,7 @@ const LOADERS = {
485
492
  // Source reports use the signals engine after a resident wait.
486
493
  () => import("../utils/local-files-overview.js"),
487
494
  () => import("../lib/flag-registry.js"),
495
+ () => import("../lib/company-flag-gate.js"),
488
496
  () => import("../utils/vault-api.js"),
489
497
  () => import("../commands/files-browse.js"),
490
498
  () => import("@aws-sdk/client-s3"),
@@ -142,6 +142,9 @@ const KNOWN_ERROR_NAMES = new Set([
142
142
  // which shares the `Qmd` prefix the qmd branch keys on (HQ-CLI-Y, 7690356976).
143
143
  "QmdExitError",
144
144
  "QmdBinaryMissingError",
145
+ // Neither the bundled nor the PATH qmd passed its probe. Printed with a
146
+ // remedy and still captured (HQ-CLI-J4, HQ-CLI-HH).
147
+ "QmdUnusableError",
145
148
  "QmdCollectionMissingError",
146
149
  "QmdCollectionExistsError",
147
150
  "QmdTerminatedError",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.251",
3
+ "version": "5.345.252",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -63,7 +63,7 @@
63
63
  "@aws-sdk/client-iot-data-plane": "^3.1096.0",
64
64
  "@aws-sdk/client-s3": "^3.1049.0",
65
65
  "@aws-sdk/dsql-signer": "^3.1146.0",
66
- "@indigoai-us/hq-cloud": "6.18.122",
66
+ "@indigoai-us/hq-cloud": "6.18.124",
67
67
  "@indigoai-us/hq-flags-client": "^0.2.0",
68
68
  "@modelcontextprotocol/sdk": "1.32.2",
69
69
  "@sentry/node": "^10.49.0",
@@ -126,11 +126,11 @@
126
126
  "*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
127
127
  },
128
128
  "optionalDependencies": {
129
- "@indigoai-us/hq-hook-win32-x64": "5.345.251",
130
- "@indigoai-us/hq-hook-win32-arm64": "5.345.251",
131
- "@indigoai-us/hq-hook-darwin-x64": "5.345.251",
132
- "@indigoai-us/hq-hook-darwin-arm64": "5.345.251",
133
- "@indigoai-us/hq-hook-linux-x64": "5.345.251",
134
- "@indigoai-us/hq-hook-linux-arm64": "5.345.251"
129
+ "@indigoai-us/hq-hook-win32-x64": "5.345.252",
130
+ "@indigoai-us/hq-hook-win32-arm64": "5.345.252",
131
+ "@indigoai-us/hq-hook-darwin-x64": "5.345.252",
132
+ "@indigoai-us/hq-hook-darwin-arm64": "5.345.252",
133
+ "@indigoai-us/hq-hook-linux-x64": "5.345.252",
134
+ "@indigoai-us/hq-hook-linux-arm64": "5.345.252"
135
135
  }
136
136
  }