@indigoai-us/hq-cli 5.345.251 → 5.345.253

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 (188) hide show
  1. package/CHANGELOG.md +153 -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 +269 -1
  5. package/dist/command-catalog.generated.js +330 -1
  6. package/dist/command-registration-plan.d.ts +6 -0
  7. package/dist/command-registration-plan.js +1 -0
  8. package/dist/commands/bot.js +7 -2
  9. package/dist/commands/ci-intake.d.ts +15 -0
  10. package/dist/commands/ci-intake.js +252 -0
  11. package/dist/commands/ci-metrics.d.ts +8 -0
  12. package/dist/commands/ci-metrics.js +55 -0
  13. package/dist/commands/ci.d.ts +13 -0
  14. package/dist/commands/ci.js +10 -0
  15. package/dist/commands/core-bucket-c-work-mesh-offer-native.js +1 -1
  16. package/dist/commands/core-hq-session-binding.d.ts +140 -0
  17. package/dist/commands/core-hq-session-binding.js +363 -0
  18. package/dist/commands/core-hq-session-native.d.ts +23 -0
  19. package/dist/commands/core-hq-session-native.js +59 -9
  20. package/dist/commands/core-stop-autosave.js +1 -1
  21. package/dist/commands/core.js +10 -0
  22. package/dist/commands/doctor.d.ts +5 -1
  23. package/dist/commands/doctor.js +42 -5
  24. package/dist/commands/files.d.ts +62 -0
  25. package/dist/commands/files.js +250 -9
  26. package/dist/commands/install-global.js +4 -2
  27. package/dist/commands/logout.js +4 -0
  28. package/dist/commands/ontology-graph.d.ts +2 -0
  29. package/dist/commands/ontology-graph.js +33 -0
  30. package/dist/commands/report.js +35 -2
  31. package/dist/commands/storage-gate.js +1 -1
  32. package/dist/commands/vault-retention-flag.js +2 -1
  33. package/dist/commands/whoami.js +1 -1
  34. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +238 -221
  35. package/dist/hq-cloud-sync-runner/package.json +1 -1
  36. package/dist/index.js +3 -1
  37. package/dist/lib/agent-kit/inbox-poll-backoff-flag.js +1 -1
  38. package/dist/lib/agent-kit/mcp/tools.js +48 -0
  39. package/dist/lib/bot/fleet-bots-update-pass.js +1 -1
  40. package/dist/lib/bot/fleet-cron.d.ts +50 -0
  41. package/dist/lib/bot/fleet-cron.js +173 -32
  42. package/dist/lib/bot/fleet-local.d.ts +18 -0
  43. package/dist/lib/bot/fleet-local.js +51 -5
  44. package/dist/lib/bot/inbox-poll-backoff-flag.js +1 -1
  45. package/dist/lib/bot/signals-engine-flag.d.ts +1 -1
  46. package/dist/lib/bot/signals-engine-flag.js +1 -1
  47. package/dist/lib/cli-invite-nudge.js +1 -1
  48. package/dist/lib/client-version.d.ts +2 -0
  49. package/dist/lib/client-version.js +24 -0
  50. package/dist/lib/company-flag-gate.d.ts +30 -0
  51. package/dist/lib/company-flag-gate.js +104 -0
  52. package/dist/lib/core-utils/hook-timeout-debug-context-flag.js +1 -1
  53. package/dist/lib/daemon/flag.js +2 -1
  54. package/dist/lib/daemon/legacy-journal-gate.js +3 -1
  55. package/dist/lib/daemon/run.js +4 -3
  56. package/dist/lib/daemon/shared-flag-reads.js +1 -1
  57. package/dist/lib/delivery/migrations.d.ts +32 -1
  58. package/dist/lib/delivery/migrations.js +69 -8
  59. package/dist/lib/doctor/checks/host-core.js +22 -4
  60. package/dist/lib/doctor/checks/jq.d.ts +27 -6
  61. package/dist/lib/doctor/checks/jq.js +46 -8
  62. package/dist/lib/doctor/client-health-reason-codes-flag.js +1 -1
  63. package/dist/lib/doctor/fix/refresh-sync-handoff.d.ts +1 -1
  64. package/dist/lib/doctor/fix/refresh-sync-handoff.js +1 -1
  65. package/dist/lib/flag-client-gate-headers.d.ts +38 -0
  66. package/dist/lib/flag-client-gate-headers.js +62 -0
  67. package/dist/lib/flag-client-headers.d.ts +15 -0
  68. package/dist/lib/flag-client-headers.js +25 -0
  69. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  70. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  71. package/dist/lib/flag-registry-worker.js +35 -0
  72. package/dist/lib/flag-registry.d.ts +1 -20
  73. package/dist/lib/flag-registry.js +5 -81
  74. package/dist/lib/hook-engine/adapter-core-pin.d.ts +30 -0
  75. package/dist/lib/hook-engine/adapter-core-pin.js +30 -0
  76. package/dist/lib/hook-engine/coverage.d.ts +65 -1
  77. package/dist/lib/hook-engine/coverage.js +173 -8
  78. package/dist/lib/hook-engine/reconcile.js +3 -2
  79. package/dist/lib/hot-channels/prompts/signals-pass.md +20 -0
  80. package/dist/lib/hot-channels/signal-changes.d.ts +228 -0
  81. package/dist/lib/hot-channels/signal-changes.js +683 -0
  82. package/dist/lib/hot-channels/signals-pass.d.ts +24 -0
  83. package/dist/lib/hot-channels/signals-pass.js +232 -12
  84. package/dist/lib/lanes/outpost-worktree-pruner-flag.d.ts +1 -1
  85. package/dist/lib/lanes/outpost-worktree-pruner-flag.js +1 -1
  86. package/dist/lib/lanes/registry-flag.js +2 -1
  87. package/dist/lib/lanes/spawn.js +11 -1
  88. package/dist/lib/mesh/live/binding-intent.d.ts +61 -0
  89. package/dist/lib/mesh/live/binding-intent.js +201 -0
  90. package/dist/lib/mesh/live/binding-receipt.d.ts +157 -0
  91. package/dist/lib/mesh/live/binding-receipt.js +365 -0
  92. package/dist/lib/mesh/live/company-flag-refresh.js +1 -1
  93. package/dist/lib/mesh/live/daemon/doctor-telemetry.d.ts +39 -0
  94. package/dist/lib/mesh/live/daemon/doctor-telemetry.js +58 -0
  95. package/dist/lib/mesh/live/daemon/install.js +2 -1
  96. package/dist/lib/mesh/live/daemon/presence.js +9 -0
  97. package/dist/lib/mesh/live/daemon/run.d.ts +3 -0
  98. package/dist/lib/mesh/live/daemon/run.js +33 -1
  99. package/dist/lib/ontology-graph/lineage/index.d.ts +401 -0
  100. package/dist/lib/ontology-graph/lineage/index.js +1027 -0
  101. package/dist/lib/ontology-graph/model/index.d.ts +54 -0
  102. package/dist/lib/ontology-graph/model/index.js +112 -0
  103. package/dist/lib/ontology-graph/model/pass-tasks.d.ts +75 -0
  104. package/dist/lib/ontology-graph/model/pass-tasks.js +166 -0
  105. package/dist/lib/ontology-graph/model/pass.d.ts +6 -0
  106. package/dist/lib/ontology-graph/model/pass.js +9 -2
  107. package/dist/lib/ontology-graph/model/pending-items.d.ts +8 -0
  108. package/dist/lib/ontology-graph/model/pending-items.js +24 -1
  109. package/dist/lib/ontology-graph/model/step.d.ts +1 -1
  110. package/dist/lib/ontology-graph/model/tasks.d.ts +11 -3
  111. package/dist/lib/ontology-graph/model/tasks.js +20 -7
  112. package/dist/lib/ontology-graph/read/brief.js +41 -6
  113. package/dist/lib/ontology-graph/read/index.d.ts +4 -0
  114. package/dist/lib/ontology-graph/read/index.js +173 -29
  115. package/dist/lib/ontology-graph/read/lineage.d.ts +101 -0
  116. package/dist/lib/ontology-graph/read/lineage.js +262 -0
  117. package/dist/lib/ontology-graph/replay/buffered-store.js +17 -0
  118. package/dist/lib/ontology-graph/replay/engine.d.ts +32 -1
  119. package/dist/lib/ontology-graph/replay/engine.js +213 -8
  120. package/dist/lib/ontology-graph/replay/extractors.d.ts +26 -0
  121. package/dist/lib/ontology-graph/replay/extractors.js +25 -1
  122. package/dist/lib/ontology-graph/replay/index.d.ts +2 -0
  123. package/dist/lib/ontology-graph/replay/index.js +9 -3
  124. package/dist/lib/ontology-graph/replay/signal-changes.d.ts +118 -0
  125. package/dist/lib/ontology-graph/replay/signal-changes.js +687 -0
  126. package/dist/lib/ontology-graph/schema/decision-status.d.ts +18 -0
  127. package/dist/lib/ontology-graph/schema/decision-status.js +20 -0
  128. package/dist/lib/ontology-graph/schema/index.d.ts +1 -0
  129. package/dist/lib/ontology-graph/schema/index.js +1 -0
  130. package/dist/lib/ontology-graph/setup/index.js +13 -3
  131. package/dist/lib/search-index/index.d.ts +33 -1
  132. package/dist/lib/search-index/index.js +180 -25
  133. package/dist/lib/search-index/qmd-exit-diagnostics.d.ts +7 -0
  134. package/dist/lib/search-index/qmd-exit-diagnostics.js +25 -1
  135. package/dist/lib/signals/adapters-catalog.js +1 -1
  136. package/dist/lib/smart-ci/cost.d.ts +72 -0
  137. package/dist/lib/smart-ci/cost.js +120 -0
  138. package/dist/lib/smart-ci/github.d.ts +112 -0
  139. package/dist/lib/smart-ci/github.js +267 -0
  140. package/dist/lib/smart-ci/intake.d.ts +288 -0
  141. package/dist/lib/smart-ci/intake.js +1078 -0
  142. package/dist/lib/smart-ci/ledger.d.ts +218 -0
  143. package/dist/lib/smart-ci/ledger.js +527 -0
  144. package/dist/lib/smart-ci/metrics.d.ts +137 -0
  145. package/dist/lib/smart-ci/metrics.js +249 -0
  146. package/dist/lib/smart-ci/records.d.ts +265 -0
  147. package/dist/lib/smart-ci/records.js +281 -0
  148. package/dist/lib/smart-ci/reducer.d.ts +67 -0
  149. package/dist/lib/smart-ci/reducer.js +261 -0
  150. package/dist/lib/sync-core/engine-holds.d.ts +15 -0
  151. package/dist/lib/sync-core/engine-holds.js +104 -11
  152. package/dist/lib/sync-core/engine-home.d.ts +3 -0
  153. package/dist/lib/sync-core/engine-home.js +41 -1
  154. package/dist/lib/sync-core/flag.js +2 -1
  155. package/dist/lib/sync-core/hand-back.d.ts +1 -0
  156. package/dist/lib/sync-core/hand-back.js +7 -2
  157. package/dist/lib/sync-core/legacy-journal-export-child.js +5 -3
  158. package/dist/lib/sync-core/legacy-journal-export.d.ts +23 -4
  159. package/dist/lib/sync-core/legacy-journal-export.js +120 -55
  160. package/dist/lib/sync-core/reconcile.d.ts +2 -1
  161. package/dist/lib/sync-core/reconcile.js +40 -7
  162. package/dist/lib/sync-invalid-entity-warning.js +2 -1
  163. package/dist/lib/windows/install-followup.d.ts +41 -0
  164. package/dist/lib/windows/install-followup.js +87 -0
  165. package/dist/lib/windows/jq.d.ts +59 -0
  166. package/dist/lib/windows/jq.js +154 -3
  167. package/dist/lib/windows/user-path.d.ts +5 -0
  168. package/dist/lib/windows/user-path.js +1 -1
  169. package/dist/lib/work-context/auto-bind.d.ts +12 -0
  170. package/dist/lib/work-context/auto-bind.js +49 -3
  171. package/dist/lib/work-context/organize.d.ts +4 -2
  172. package/dist/lib/work-context/organize.js +18 -8
  173. package/dist/lib/work-context/reconcile.js +16 -1
  174. package/dist/main.js +12 -1
  175. package/dist/utils/client-health-contract.d.ts +30 -0
  176. package/dist/utils/client-health-contract.js +111 -0
  177. package/dist/utils/client-health.d.ts +5 -2
  178. package/dist/utils/client-health.js +74 -5
  179. package/dist/utils/exclusive-lock.d.ts +5 -1
  180. package/dist/utils/exclusive-lock.js +9 -2
  181. package/dist/utils/host-registration.d.ts +7 -0
  182. package/dist/utils/host-registration.js +10 -1
  183. package/dist/utils/pid.d.ts +31 -0
  184. package/dist/utils/pid.js +65 -0
  185. package/dist/utils/resident-package-preload.js +12 -4
  186. package/dist/utils/sentry-fingerprint.js +3 -0
  187. package/package.json +10 -8
  188. package/scripts/install-hook-engine.mjs +5 -3
@@ -7,8 +7,8 @@ import { clearEngineStatus, engineFirstCycle, isSyncCoreVaultUid, removeEngineOw
7
7
  import { SYNC_CORE_FULL_RELEASE, SYNC_CORE_RELEASE, compareSyncCoreReleases, fullModeAllowed, installedSyncCoreRelease, syncCoreBinaryPath, windowsFullRelease, } from "./release.js";
8
8
  import { readSyncCoreSkips } from "./skip.js";
9
9
  import { isLiveCompanyEntity, joinedCompanySlug, setUpJoinedCompany } from "./company-adoption.js";
10
- import { heldDeletesHandoverLine, readEngineHeldDeletes, writeHandbackKeep } from "./engine-holds.js";
11
- import { legacyJournalDirs, legacyJournalExportState, removeLegacyJournalExport, writeLegacyJournalExport, } from "./legacy-journal-export.js";
10
+ import { heldDeletesHandoverLine, heldLocalBodiesHandoverLine, readEngineHeldDeletes, readEngineHeldLocalBodies, writeHandbackKeep } from "./engine-holds.js";
11
+ import { dropStaleLegacyJournalExport, legacyJournalDirs, legacyJournalExportState, markLegacyJournalExportStale, removeLegacyJournalExport, writeLegacyJournalExport, } from "./legacy-journal-export.js";
12
12
  import { SYNC_RUST_ENGINE_ROLLOUT_FLAG } from "./flag.js";
13
13
  import { readSyncCoreRolloutState, syncCoreRolloutStatePath, writeSyncCoreRolloutState, } from "./rollout-state.js";
14
14
  function message(error) {
@@ -155,6 +155,19 @@ async function setUpJoinedCompanies(deps, memberships, ctx) {
155
155
  function dropLegacyJournalExport(home, vault, warnings) {
156
156
  try {
157
157
  removeLegacyJournalExport(home, vault);
158
+ return true;
159
+ }
160
+ catch (error) {
161
+ warnings.push(`could not remove the old copy of the current sync's record of ${vault.slug ?? vault.uid}: ${message(error)}`);
162
+ return false;
163
+ }
164
+ }
165
+ function retryStaleLegacyJournalExport(deps, vault, warnings) {
166
+ try {
167
+ const dropped = dropStaleLegacyJournalExport(deps.home, vault, deps.removeStaleLegacyJournalFiles);
168
+ if (dropped.status === "failed") {
169
+ warnings.push(`could not remove the old copy of the current sync's record of ${vault.slug ?? vault.uid}, which is out of date: ${dropped.reason}; trying again on the next reconcile, and no new copy is written until it is gone`);
170
+ }
158
171
  }
159
172
  catch (error) {
160
173
  warnings.push(`could not remove the old copy of the current sync's record of ${vault.slug ?? vault.uid}: ${message(error)}`);
@@ -176,7 +189,8 @@ export async function reconcileSyncCore(deps) {
176
189
  await setUpJoinedCompanies(deps, memberships, { platform, env, previousByUid, flagReads, warnings, log });
177
190
  const desired = [];
178
191
  let anyCompanyOn = false;
179
- for (const company of localCompanies(deps.hqRoot, memberships)) {
192
+ const companiesHere = localCompanies(deps.hqRoot, memberships);
193
+ for (const company of companiesHere) {
180
194
  let on;
181
195
  try {
182
196
  on = flagReads.get(company.uid) ?? await deps.readRolloutFlag(company.uid);
@@ -281,8 +295,7 @@ export async function reconcileSyncCore(deps) {
281
295
  const engineHome = syncCoreEngineHome(deps.home, vault.uid);
282
296
  if (!before)
283
297
  clearEngineStatus(deps.home, vault.uid);
284
- if (!before && !pending)
285
- dropLegacyJournalExport(deps.home, vault, warnings);
298
+ const dropFailed = !before && !pending && !dropLegacyJournalExport(deps.home, vault, warnings);
286
299
  writeEngineHome({ home: deps.home, hqRoot: deps.hqRoot, vault, phase: "full", tokenFile: deps.tokenFile, platform, release: engineRelease });
287
300
  const wasFull = before?.phase === "full";
288
301
  const alreadyOff = vault.kind === "personal"
@@ -324,8 +337,15 @@ export async function reconcileSyncCore(deps) {
324
337
  ...(downloadStreams !== undefined ? { downloadStreams } : {}),
325
338
  });
326
339
  if (vault.kind === "company" && wasFull && !alreadyOff && switchesBefore.unreadable === undefined) {
327
- dropLegacyJournalExport(deps.home, vault, warnings);
340
+ try {
341
+ markLegacyJournalExportStale(deps.home, vault);
342
+ }
343
+ catch (error) {
344
+ warnings.push(`could not mark the old copy of the current sync's record of ${vault.slug ?? vault.uid} as out of date: ${message(error)}`);
345
+ }
328
346
  }
347
+ if (vault.kind === "company" && !dropFailed)
348
+ retryStaleLegacyJournalExport(deps, vault, warnings);
329
349
  const cycledSinceOff = vault.kind === "company" && wasFull && alreadyOff
330
350
  ? engineFirstCycle(engineHome, vault.uid, legacyOffSince)
331
351
  : null;
@@ -380,7 +400,10 @@ export async function reconcileSyncCore(deps) {
380
400
  warnings.push(`could not record the ${heldDeletes.count} deletes the new sync engine held for ${vault.uid}; the current sync may apply them: ${message(error)}`);
381
401
  }
382
402
  }
383
- if (heldDeletes)
403
+ const heldLocalBodies = readEngineHeldLocalBodies(engineHome, vault.uid);
404
+ if (heldLocalBodies)
405
+ handover.push(heldLocalBodiesHandoverLine(vault.uid, heldLocalBodies));
406
+ else if (heldDeletes)
384
407
  handover.push(heldDeletesHandoverLine(vault.uid, heldDeletes, engineHome, deps.home));
385
408
  handedBack.push(vault);
386
409
  }
@@ -390,6 +413,16 @@ export async function reconcileSyncCore(deps) {
390
413
  && !handedBack.some((back) => back.uid === vault.uid)
391
414
  && engineOwnsVault(deps.home, vault.uid)),
392
415
  ];
416
+ for (const vault of handingBack) {
417
+ const heldLocalBodies = readEngineHeldLocalBodies(syncCoreEngineHome(deps.home, vault.uid), vault.uid);
418
+ if (heldLocalBodies)
419
+ warnings.push(heldLocalBodiesHandoverLine(vault.uid, heldLocalBodies));
420
+ }
421
+ for (const company of companiesHere) {
422
+ if (desired.some((vault) => vault.uid === company.uid) || handingBack.some((vault) => vault.uid === company.uid))
423
+ continue;
424
+ retryStaleLegacyJournalExport(deps, company, warnings);
425
+ }
393
426
  const state = {
394
427
  version: 1,
395
428
  rolloutFlagKey: SYNC_RUST_ENGINE_ROLLOUT_FLAG,
@@ -1,4 +1,5 @@
1
- import { createFlagClient, readLocalOverride } from "@indigoai-us/hq-flags-client";
1
+ import { readLocalOverride } from "@indigoai-us/hq-flags-client";
2
+ import { createHqFlagClient as createFlagClient } from "./flag-client-headers.js";
2
3
  import { createHash } from "node:crypto";
3
4
  import * as fs from "node:fs";
4
5
  import * as path from "node:path";
@@ -15,6 +15,16 @@ export interface InstallFollowupMarker {
15
15
  };
16
16
  meshFailedVersion?: string;
17
17
  meshFailedAt?: number;
18
+ /**
19
+ * The CLI version whose jq step finished. `managed` is true when HQ's own
20
+ * jq.exe is the one in use, false when the machine already had jq on PATH.
21
+ */
22
+ jq?: {
23
+ version: string;
24
+ managed: boolean;
25
+ };
26
+ jqFailedVersion?: string;
27
+ jqFailedAt?: number;
18
28
  }
19
29
  /** A failed daemon install blocks for up to 30 s, so it is retried at most hourly. */
20
30
  export declare const MESH_RETRY_MS: number;
@@ -34,4 +44,35 @@ export interface InstallFollowupDeps {
34
44
  now?: () => number;
35
45
  }
36
46
  export declare function runWindowsInstallFollowup(deps: InstallFollowupDeps): void;
47
+ /** A failed jq download waits up to 20 s, so it is retried at most hourly. */
48
+ export declare const JQ_RETRY_MS: number;
49
+ export interface JqFollowupDeps {
50
+ argv: readonly string[];
51
+ env?: NodeJS.ProcessEnv;
52
+ platform?: NodeJS.Platform;
53
+ version?: string;
54
+ readMarker?: () => InstallFollowupMarker;
55
+ writeMarker?: (marker: InstallFollowupMarker) => void;
56
+ now?: () => number;
57
+ /** True when a jq.exe HQ did not install is on this process's PATH. */
58
+ otherJqOnPath?: () => boolean;
59
+ /** True when HQ's managed jq.exe exists. */
60
+ jqInstalled?: () => boolean;
61
+ /** Installs the verified jq and puts its folder on the user PATH. */
62
+ ensureJq?: () => Promise<{
63
+ onUserPath: boolean;
64
+ } | undefined>;
65
+ }
66
+ /** True when `file` is the jq.exe HQ installs: in the home's `.local\bin`, or beside hq.cmd. */
67
+ export declare function isHqManagedJq(file: string, home: string, shimDir: string | null): boolean;
68
+ /**
69
+ * Give a Windows machine the jq its HQ hooks need, with no step by hand
70
+ * (hq-cli #3716). Without jq, master-hook blocks every tool call, and npm 11
71
+ * skips the postinstall that would have installed it, so the first hq command
72
+ * after an install or update does it here. A machine that already has jq on
73
+ * PATH (one HQ did not install) is left alone. Runs once per CLI version; a settled machine pays one
74
+ * file check per command. A failure is retried after JQ_RETRY_MS and never
75
+ * fails the command the user asked for.
76
+ */
77
+ export declare function runWindowsJqFollowup(deps: JqFollowupDeps): Promise<void>;
37
78
  //# sourceMappingURL=install-followup.d.ts.map
@@ -5,12 +5,17 @@
5
5
  *
6
6
  * Both steps record their result in ~/.hq/install-followup.json, so later
7
7
  * commands start no PowerShell or daemon process for the same version.
8
+ *
9
+ * On Windows a third step, runWindowsJqFollowup, installs the verified jq HQ
10
+ * hooks need and puts it on the user PATH (hq-cli #3716).
8
11
  */
9
12
  import { spawnSync } from "node:child_process";
10
13
  import fs from "node:fs";
11
14
  import os from "node:os";
12
15
  import path from "node:path";
13
16
  import { fileURLToPath } from "node:url";
17
+ import { findExecutableOnPath } from "../../utils/resolve-executable.js";
18
+ import { ensureWindowsJq, windowsJqPath } from "./jq.js";
14
19
  import { ensureShimOnUserPath, npmShimDir } from "./user-path.js";
15
20
  import { homeIsLoginSafe } from "../mesh/live/daemon/login-home.js";
16
21
  const MARKER_NAME = "install-followup.json";
@@ -56,6 +61,13 @@ function readMarker(env) {
56
61
  marker.meshFailedVersion = parsed.meshFailedVersion;
57
62
  marker.meshFailedAt = parsed.meshFailedAt;
58
63
  }
64
+ if (typeof parsed.jq?.version === "string" && typeof parsed.jq.managed === "boolean") {
65
+ marker.jq = { version: parsed.jq.version, managed: parsed.jq.managed };
66
+ }
67
+ if (typeof parsed.jqFailedVersion === "string" && typeof parsed.jqFailedAt === "number") {
68
+ marker.jqFailedVersion = parsed.jqFailedVersion;
69
+ marker.jqFailedAt = parsed.jqFailedAt;
70
+ }
59
71
  return marker;
60
72
  }
61
73
  catch {
@@ -142,4 +154,79 @@ export function runWindowsInstallFollowup(deps) {
142
154
  else
143
155
  save({ meshFailedVersion: version, meshFailedAt: now });
144
156
  }
157
+ /** A failed jq download waits up to 20 s, so it is retried at most hourly. */
158
+ export const JQ_RETRY_MS = 60 * 60 * 1000;
159
+ /** True when `file` is the jq.exe HQ installs: in the home's `.local\bin`, or beside hq.cmd. */
160
+ export function isHqManagedJq(file, home, shimDir) {
161
+ const norm = (value) => path.win32.normalize(value).replace(/\\+$/, "").toLowerCase();
162
+ const dir = norm(path.win32.dirname(file));
163
+ if (path.win32.basename(file).toLowerCase() !== "jq.exe")
164
+ return false;
165
+ return dir === norm(path.win32.join(home, ".local", "bin")) || (shimDir !== null && dir === norm(shimDir));
166
+ }
167
+ /**
168
+ * Give a Windows machine the jq its HQ hooks need, with no step by hand
169
+ * (hq-cli #3716). Without jq, master-hook blocks every tool call, and npm 11
170
+ * skips the postinstall that would have installed it, so the first hq command
171
+ * after an install or update does it here. A machine that already has jq on
172
+ * PATH (one HQ did not install) is left alone. Runs once per CLI version; a settled machine pays one
173
+ * file check per command. A failure is retried after JQ_RETRY_MS and never
174
+ * fails the command the user asked for.
175
+ */
176
+ export async function runWindowsJqFollowup(deps) {
177
+ try {
178
+ if ((deps.platform ?? process.platform) !== "win32")
179
+ return;
180
+ const env = deps.env ?? process.env;
181
+ if (isInstallFollowupSkipped(deps.argv, env))
182
+ return;
183
+ const version = deps.version ?? packageVersion();
184
+ if (!version)
185
+ return;
186
+ const read = deps.readMarker ?? (() => readMarker(env));
187
+ const write = deps.writeMarker ?? ((marker) => writeMarker(env, marker));
188
+ const save = (update) => {
189
+ try {
190
+ write({ ...read(), ...update });
191
+ }
192
+ catch {
193
+ // A marker failure only means the next command tries again.
194
+ }
195
+ };
196
+ const home = env.USERPROFILE || env.HOME || os.homedir();
197
+ const installed = deps.jqInstalled ?? (() => fs.existsSync(windowsJqPath(home)));
198
+ const marker = read();
199
+ if (marker.jq?.version === version && (!marker.jq.managed || installed()))
200
+ return;
201
+ const now = (deps.now ?? Date.now)();
202
+ if (marker.jqFailedVersion === version && marker.jqFailedAt !== undefined && now - marker.jqFailedAt < JQ_RETRY_MS)
203
+ return;
204
+ const done = { jqFailedVersion: undefined, jqFailedAt: undefined };
205
+ // HQ's own jq on PATH does not count: it is still HQ's to reinstall
206
+ // when deleted and to replace when the pinned version changes.
207
+ const otherOnPath = deps.otherJqOnPath ?? (() => {
208
+ const found = findExecutableOnPath("jq", env.PATH ?? env.Path ?? "", "win32", ".EXE");
209
+ return found !== undefined && !isHqManagedJq(found, home, npmShimDir(deps.argv[1], fs.existsSync));
210
+ });
211
+ if (otherOnPath()) {
212
+ save({ jq: { version, managed: false }, ...done });
213
+ return;
214
+ }
215
+ let ok = false;
216
+ try {
217
+ const ensured = await (deps.ensureJq ?? (() => ensureWindowsJq({ home, env })))();
218
+ ok = ensured?.onUserPath === true;
219
+ }
220
+ catch {
221
+ // Offline, a refused checksum or an unsafe folder: `hq doctor` reports it.
222
+ }
223
+ if (ok)
224
+ save({ jq: { version, managed: true }, ...done });
225
+ else
226
+ save({ jqFailedVersion: version, jqFailedAt: now });
227
+ }
228
+ catch {
229
+ // jq repair must not turn into a failed command.
230
+ }
231
+ }
145
232
  //# sourceMappingURL=install-followup.js.map
@@ -1,3 +1,5 @@
1
+ import type { CheckResult } from "../doctor/types.js";
2
+ import { type PowerShellRun, type UserPathStore, type UserPathWriteReason } from "./user-path.js";
1
3
  export declare const WINDOWS_JQ_REPAIR = "hq doctor --fix-jq";
2
4
  interface JqAsset {
3
5
  name: string;
@@ -17,5 +19,62 @@ interface InstallOptions {
17
19
  }
18
20
  /** The npm lifecycle, global hook setup and doctor use the same Windows installer. */
19
21
  export declare function installWindowsJq({ platform, arch, home, fetch: download, asset, }?: InstallOptions): Promise<string | undefined>;
22
+ export interface EnsureJqResult {
23
+ /** The verified jq.exe. */
24
+ target: string;
25
+ /** The folder holding it. */
26
+ dir: string;
27
+ /**
28
+ * What the user PATH step did. `not-login-home`: the home is not the
29
+ * signed-in profile (a scratch USERPROFILE), so the account's PATH was left alone.
30
+ */
31
+ path: UserPathWriteReason | "not-login-home";
32
+ /** True when the folder is on the stored user PATH, so new terminals and sessions find jq. */
33
+ onUserPath: boolean;
34
+ /** The copy beside hq.cmd, when one is in place. Sessions that are already open find this one. */
35
+ sessionTarget?: string;
36
+ }
37
+ export interface EnsureJqOptions extends InstallOptions {
38
+ store?: UserPathStore;
39
+ env?: NodeJS.ProcessEnv;
40
+ /** The signed-in user's profile folder. Defaults to the one Windows reports, whatever USERPROFILE says. */
41
+ loginHome?: string;
42
+ /** The folder holding hq.cmd, or null for none. Defaults to the one this CLI runs from. */
43
+ shimDir?: string | null;
44
+ }
45
+ /**
46
+ * Install the verified jq and make hooks able to find it (hq-cli #3716).
47
+ *
48
+ * Installing alone is not enough: before hq-core 16.0.51 the hook gate
49
+ * searches only the inherited PATH, and `%USERPROFILE%\.local\bin` is not on
50
+ * it by default. Two things make hooks find jq:
51
+ *
52
+ * 1. The folder goes on the user PATH (HKCU only, through the same writer as
53
+ * the npm shim folder, which also tells Explorer the environment changed).
54
+ * Terminals and sessions opened afterwards find jq there.
55
+ * 2. A copy goes beside hq.cmd, a folder already on the PATH of sessions that
56
+ * are open now, so they are unblocked without a restart. A jq.exe already
57
+ * there that is not this pinned build is left alone, so when the pinned
58
+ * version changes the old copy stays until it is removed.
59
+ *
60
+ * This process's own PATH is left as it is: a doctor check in the same process
61
+ * must report what the open terminal sees. The npm postinstall, the first hq
62
+ * command after an install, `hq install-global` and `hq doctor --fix-jq` all
63
+ * call it. Undefined off Windows.
64
+ */
65
+ export declare function ensureWindowsJq(options?: EnsureJqOptions): Promise<EnsureJqResult | undefined>;
66
+ /**
67
+ * The jq a terminal or Claude Code session opened from now on will find: the
68
+ * first jq.exe on the stored machine Path followed by the stored user Path,
69
+ * which is the order Windows builds a new process's PATH in. Undefined when
70
+ * there is none, and also when the registry cannot be read: this process's own
71
+ * PATH is not evidence of what a new session gets.
72
+ */
73
+ export declare function findJqOnPersistedPath(run?: PowerShellRun, env?: NodeJS.ProcessEnv): string | undefined;
74
+ /**
75
+ * The one step left when `hq doctor --fix-jq` installed jq but its closing
76
+ * check still fails. `check` is the failing jq.on-path result.
77
+ */
78
+ export declare function jqRemainingStep(ensured: EnsureJqResult, check: Pick<CheckResult, "target" | "message">): string;
20
79
  export {};
21
80
  //# sourceMappingURL=jq.d.ts.map
@@ -1,6 +1,10 @@
1
+ import * as fs from "node:fs";
1
2
  import { homedir } from "node:os";
2
- import { join } from "node:path";
3
- import { installPinnedJq } from "../jq/install.js";
3
+ import { dirname, join } from "node:path";
4
+ import { findExecutableOnPath } from "../../utils/resolve-executable.js";
5
+ import { installPinnedJq, matchesPinnedJq } from "../jq/install.js";
6
+ import { homeIsLoginSafe } from "../mesh/live/daemon/login-home.js";
7
+ import { READ_PATHS_SCRIPT, USER_PATH_TEST_KEY_ENV, defaultPowerShell, expandWindowsEnv, npmShimDir, parseReadPathsOutput, pathFixCommand, powershellUserPathStore, } from "./user-path.js";
4
8
  const version = "1.8.2";
5
9
  const release = `https://github.com/jqlang/jq/releases/download/jq-${version}`;
6
10
  export const WINDOWS_JQ_REPAIR = "hq doctor --fix-jq";
@@ -24,7 +28,9 @@ export function windowsJqAsset(arch) {
24
28
  return asset ? { url: `${release}/${asset.name}`, sha256: asset.sha256 } : null;
25
29
  }
26
30
  export function windowsJqPath(home = homedir()) {
27
- // hq-core-staging #2047 adds this directory to hook PATH when it holds jq.exe.
31
+ // hq-core-staging #2047 (first released in hq-core 16.0.51) adds this
32
+ // directory to hook PATH when it holds jq.exe. Older hooks search only the
33
+ // inherited PATH, so ensureWindowsJq also puts the directory on the user PATH.
28
34
  return join(home, ".local", "bin", "jq.exe");
29
35
  }
30
36
  /** The npm lifecycle, global hook setup and doctor use the same Windows installer. */
@@ -40,4 +46,149 @@ export async function installWindowsJq({ platform = process.platform, arch = pro
40
46
  fetch: download,
41
47
  });
42
48
  }
49
+ /**
50
+ * Put the verified jq.exe beside hq.cmd. A terminal or Claude Code session
51
+ * that is already open keeps the PATH it started with, so the user PATH entry
52
+ * does not reach it; the hq shim folder is already on that PATH. Returns the
53
+ * copy's path, or undefined when the folder is outside the home folder, holds
54
+ * a jq.exe HQ did not put there, or cannot be written.
55
+ */
56
+ function copyJqBesideHq(home, source, shimDir, sha256) {
57
+ try {
58
+ const dest = join(shimDir, "jq.exe");
59
+ const pinned = { url: "", sha256 };
60
+ // Also refuses a folder outside the home folder and any link on the way.
61
+ if (matchesPinnedJq(home, dest, pinned))
62
+ return dest;
63
+ if (fs.existsSync(dest))
64
+ return undefined;
65
+ const staged = fs.mkdtempSync(join(shimDir, ".hq-jq-"));
66
+ try {
67
+ const file = join(staged, "jq.exe");
68
+ fs.copyFileSync(source, file, fs.constants.COPYFILE_EXCL);
69
+ if (!matchesPinnedJq(home, file, pinned))
70
+ return undefined;
71
+ fs.renameSync(file, dest);
72
+ }
73
+ finally {
74
+ // A staging folder that cannot be removed must not undo a finished copy.
75
+ try {
76
+ fs.rmSync(staged, { recursive: true, force: true });
77
+ }
78
+ catch {
79
+ // Left behind: an empty `.hq-jq-*` folder, harmless on PATH.
80
+ }
81
+ }
82
+ return dest;
83
+ }
84
+ catch {
85
+ return undefined;
86
+ }
87
+ }
88
+ /**
89
+ * Install the verified jq and make hooks able to find it (hq-cli #3716).
90
+ *
91
+ * Installing alone is not enough: before hq-core 16.0.51 the hook gate
92
+ * searches only the inherited PATH, and `%USERPROFILE%\.local\bin` is not on
93
+ * it by default. Two things make hooks find jq:
94
+ *
95
+ * 1. The folder goes on the user PATH (HKCU only, through the same writer as
96
+ * the npm shim folder, which also tells Explorer the environment changed).
97
+ * Terminals and sessions opened afterwards find jq there.
98
+ * 2. A copy goes beside hq.cmd, a folder already on the PATH of sessions that
99
+ * are open now, so they are unblocked without a restart. A jq.exe already
100
+ * there that is not this pinned build is left alone, so when the pinned
101
+ * version changes the old copy stays until it is removed.
102
+ *
103
+ * This process's own PATH is left as it is: a doctor check in the same process
104
+ * must report what the open terminal sees. The npm postinstall, the first hq
105
+ * command after an install, `hq install-global` and `hq doctor --fix-jq` all
106
+ * call it. Undefined off Windows.
107
+ */
108
+ export async function ensureWindowsJq(options = {}) {
109
+ const { store, env = process.env, loginHome, shimDir, ...install } = options;
110
+ const target = await installWindowsJq(install);
111
+ if (!target)
112
+ return undefined;
113
+ const dir = dirname(target);
114
+ const home = install.home ?? homedir();
115
+ let path;
116
+ // Tests redirect the registry write to a scratch key; the writer below
117
+ // reads the same variable from the same environment.
118
+ const scratchKey = env[USER_PATH_TEST_KEY_ENV];
119
+ if (!scratchKey && !homeIsLoginSafe(home, loginHome)) {
120
+ // USERPROFILE names a scratch folder (a test, a temporary home). The
121
+ // registry is still the real account's, so its PATH is not touched.
122
+ path = "not-login-home";
123
+ }
124
+ else {
125
+ let applied;
126
+ try {
127
+ const writer = store ?? powershellUserPathStore(undefined, scratchKey ? { [USER_PATH_TEST_KEY_ENV]: scratchKey } : {});
128
+ applied = writer.appendUserPath(dir);
129
+ }
130
+ catch {
131
+ applied = { written: false, reason: "write-failed" };
132
+ }
133
+ path = applied.written ? "written" : applied.reason;
134
+ }
135
+ const result = { target, dir, path, onUserPath: path === "written" || path === "present" };
136
+ const beside = shimDir === undefined ? npmShimDir(process.argv[1], fs.existsSync) : shimDir;
137
+ const sha256 = (install.asset ?? assets[install.arch ?? process.arch])?.sha256;
138
+ if (beside && sha256) {
139
+ const sessionTarget = copyJqBesideHq(home, target, beside, sha256);
140
+ if (sessionTarget)
141
+ result.sessionTarget = sessionTarget;
142
+ }
143
+ return result;
144
+ }
145
+ /**
146
+ * The jq a terminal or Claude Code session opened from now on will find: the
147
+ * first jq.exe on the stored machine Path followed by the stored user Path,
148
+ * which is the order Windows builds a new process's PATH in. Undefined when
149
+ * there is none, and also when the registry cannot be read: this process's own
150
+ * PATH is not evidence of what a new session gets.
151
+ */
152
+ export function findJqOnPersistedPath(run = defaultPowerShell, env = process.env) {
153
+ let read;
154
+ try {
155
+ const result = run(READ_PATHS_SCRIPT, {});
156
+ if (result.status !== 0)
157
+ return undefined;
158
+ read = parseReadPathsOutput(result.stdout);
159
+ }
160
+ catch {
161
+ return undefined;
162
+ }
163
+ const stored = [read.machine, read.user].filter((value) => value !== null);
164
+ if (stored.length === 0)
165
+ return undefined;
166
+ // Git Bash runs the hooks: it can run jq.exe but not a jq.cmd or jq.bat.
167
+ return findExecutableOnPath("jq", stored.map((value) => expandWindowsEnv(value, env)).join(";"), "win32", ".exe");
168
+ }
169
+ /**
170
+ * The one step left when `hq doctor --fix-jq` installed jq but its closing
171
+ * check still fails. `check` is the failing jq.on-path result.
172
+ */
173
+ export function jqRemainingStep(ensured, check) {
174
+ if (!ensured.onUserPath) {
175
+ if (ensured.path === "not-login-home") {
176
+ return `${dirname(dirname(ensured.dir))} is not your Windows profile folder, so HQ left your user PATH alone. Run \`${WINDOWS_JQ_REPAIR}\` from a normal terminal, without USERPROFILE or HOME pointed somewhere else.`;
177
+ }
178
+ if (ensured.path === "too-long") {
179
+ return `Your user PATH is too long for HQ to add ${ensured.dir}. Remove an entry you no longer need (Windows Settings, "Edit environment variables for your account"), then run \`${WINDOWS_JQ_REPAIR}\` again.`;
180
+ }
181
+ return [
182
+ `HQ could not add ${ensured.dir} to your user PATH (${ensured.path}). Run this in PowerShell, then open a new terminal and restart Claude Code:`,
183
+ ` ${pathFixCommand(ensured.dir)}`,
184
+ ].join("\n");
185
+ }
186
+ if (check.target && check.target.toLowerCase() !== ensured.target.toLowerCase()) {
187
+ return `Another jq at ${check.target} comes first on PATH and does not work. Remove or rename it, then run \`${WINDOWS_JQ_REPAIR}\` again.`;
188
+ }
189
+ if (check.target) {
190
+ return `The jq HQ installed at ${check.target} does not run. Delete that file, then run \`${WINDOWS_JQ_REPAIR}\` again to download it afresh.`;
191
+ }
192
+ return `Open a new terminal and run \`hq doctor --only jq\`. If it still fails, report it with \`/hq-bug\` and include that output.`;
193
+ }
43
194
  //# sourceMappingURL=jq.js.map
@@ -50,6 +50,11 @@ export declare function readPersistedPath(run: PowerShellRun, env: NodeJS.Proces
50
50
  source: "registry" | "process";
51
51
  };
52
52
  export declare function isDirOnPath(dir: string, pathValue: string): boolean;
53
+ /** Runs a script through Windows PowerShell. The script travels as -EncodedCommand (UTF-16LE), so quoting cannot change it. */
54
+ export declare function defaultPowerShell(script: string, extraEnv: NodeJS.ProcessEnv): {
55
+ status: number | null;
56
+ stdout: string;
57
+ };
53
58
  /** Null when not on Windows or when hq was not installed as an npm global shim. */
54
59
  export declare function checkShimOnPath(deps?: ShimPathDeps): ShimPathCheck | null;
55
60
  /** Dummy user variable set and cleared so Windows tells running programs that the environment changed. */
@@ -108,7 +108,7 @@ export function isDirOnPath(dir, pathValue) {
108
108
  return pathValue.split(";").some((entry) => normalizeDir(entry) === want);
109
109
  }
110
110
  /** Runs a script through Windows PowerShell. The script travels as -EncodedCommand (UTF-16LE), so quoting cannot change it. */
111
- function defaultPowerShell(script, extraEnv) {
111
+ export function defaultPowerShell(script, extraEnv) {
112
112
  const encoded = Buffer.from(script, "utf16le").toString("base64");
113
113
  const result = spawnSync("powershell.exe", ["-NoProfile", "-NonInteractive", "-EncodedCommand", encoded], {
114
114
  encoding: "utf8",
@@ -47,11 +47,21 @@ export declare function findRepoPrdCandidates(input: {
47
47
  branch: string | null;
48
48
  }): AutoBindCandidate[];
49
49
  export declare function autoBindHistoryPath(workContextRoot: string): string;
50
+ /**
51
+ * Whether the Board for this project is archived or completed, read from the
52
+ * local work-mesh project cache (no network). A duplicate Board archived in
53
+ * favor of the canonical one must not keep receiving sessions.
54
+ */
55
+ export declare function projectRetiredInCache(companyUid: string | undefined, projectId: string, cacheRoot?: string): boolean;
56
+ /** Drop every remembered binding to a retired project. Best-effort; never throws. */
57
+ export declare function forgetRetiredPriorBindings(workContextRoot: string, projectId: string): number;
50
58
  export declare function lookupPriorBinding(input: {
51
59
  workContextRoot: string;
52
60
  companySlug: string;
53
61
  identities: string[];
54
62
  branch: string | null;
63
+ /** A remembered project that is retired is forgotten, and the lookup goes on. */
64
+ isRetired?: (projectId: string) => boolean;
55
65
  }): string | null;
56
66
  /** Remember a binding for this repo+branch. Best-effort; never throws. */
57
67
  export declare function recordPriorBinding(input: {
@@ -68,6 +78,8 @@ export declare function decideAutoBind(input: {
68
78
  hqRoot: string;
69
79
  workContextRoot: string;
70
80
  companySlug?: string;
81
+ /** Defaults to the local work-mesh cache's Board lifecycle. */
82
+ isRetired?: (projectId: string) => boolean;
71
83
  }): AutoBindDecision & {
72
84
  git?: GitLocation;
73
85
  identities?: string[];
@@ -11,6 +11,7 @@
11
11
  import * as fs from "node:fs";
12
12
  import * as path from "node:path";
13
13
  import { foreignSessionOwnsLane } from "./lane-bind.js";
14
+ import { isSafeCacheSegment, meshCacheRoot } from "../mesh/cache.js";
14
15
  function readText(file) {
15
16
  try {
16
17
  return fs.readFileSync(file, "utf8");
@@ -157,14 +158,57 @@ function readHistory(workContextRoot) {
157
158
  return {};
158
159
  }
159
160
  }
161
+ /**
162
+ * Whether the Board for this project is archived or completed, read from the
163
+ * local work-mesh project cache (no network). A duplicate Board archived in
164
+ * favor of the canonical one must not keep receiving sessions.
165
+ */
166
+ export function projectRetiredInCache(companyUid, projectId, cacheRoot = meshCacheRoot()) {
167
+ if (!companyUid || !isSafeCacheSegment(companyUid) || !isSafeCacheSegment(projectId))
168
+ return false;
169
+ const raw = readText(path.join(cacheRoot, "projects", companyUid, `${projectId}.json`));
170
+ if (!raw)
171
+ return false;
172
+ try {
173
+ const lifecycle = asRecord(asRecord(JSON.parse(raw))?.lifecycle);
174
+ return lifecycle?.status === "archived" || lifecycle?.status === "completed";
175
+ }
176
+ catch {
177
+ return false;
178
+ }
179
+ }
180
+ /** Drop every remembered binding to a retired project. Best-effort; never throws. */
181
+ export function forgetRetiredPriorBindings(workContextRoot, projectId) {
182
+ try {
183
+ const history = readHistory(workContextRoot);
184
+ const stale = Object.keys(history).filter((key) => history[key]?.projectId === projectId);
185
+ if (stale.length === 0)
186
+ return 0;
187
+ for (const key of stale)
188
+ delete history[key];
189
+ const file = autoBindHistoryPath(workContextRoot);
190
+ const tmp = `${file}.tmp.${process.pid}`;
191
+ fs.writeFileSync(tmp, `${JSON.stringify(history, null, 2)}\n`, { mode: 0o600 });
192
+ fs.renameSync(tmp, file);
193
+ return stale.length;
194
+ }
195
+ catch {
196
+ return 0;
197
+ }
198
+ }
160
199
  export function lookupPriorBinding(input) {
161
200
  if (!input.branch)
162
201
  return null;
163
202
  const history = readHistory(input.workContextRoot);
164
203
  for (const repo of input.identities) {
165
204
  const hit = history[historyKey(input.companySlug, repo, input.branch)];
166
- if (hit?.projectId)
167
- return hit.projectId;
205
+ if (!hit?.projectId)
206
+ continue;
207
+ if (input.isRetired?.(hit.projectId)) {
208
+ forgetRetiredPriorBindings(input.workContextRoot, hit.projectId);
209
+ continue;
210
+ }
211
+ return hit.projectId;
168
212
  }
169
213
  return null;
170
214
  }
@@ -212,18 +256,20 @@ export function decideAutoBind(input) {
212
256
  return { action: "skip", reason: "no_git", candidates: [] };
213
257
  const identities = repoIdentities(git, input.hqRoot);
214
258
  const extra = { git, identities };
259
+ const isRetired = input.isRetired ?? ((projectId) => projectRetiredInCache(state.companyUid, projectId));
215
260
  const prior = lookupPriorBinding({
216
261
  workContextRoot: input.workContextRoot,
217
262
  companySlug,
218
263
  identities,
219
264
  branch: git.branch,
265
+ isRetired,
220
266
  });
221
267
  const candidates = findRepoPrdCandidates({
222
268
  hqRoot: input.hqRoot,
223
269
  companySlug,
224
270
  identities,
225
271
  branch: git.branch,
226
- });
272
+ }).filter((c) => !isRetired(c.projectId));
227
273
  const ownedByOtherSession = (projectId) => foreignSessionOwnsLane({
228
274
  hqRoot: input.hqRoot,
229
275
  projectId,