@indigoai-us/hq-cli 5.345.247 → 5.345.250

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 (284) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/assets/lanes-hooks/hq-lanes-drain.sh +1 -1
  3. package/contracts/host-canary-release.json +14 -0
  4. package/dist/command-catalog.generated.d.ts +1198 -0
  5. package/dist/command-catalog.generated.js +1476 -0
  6. package/dist/command-registration-plan.d.ts +6 -0
  7. package/dist/command-registration-plan.js +1 -0
  8. package/dist/commands/core-job-run-native.js +4 -0
  9. package/dist/commands/core-knowledge-prefs.d.ts +1 -1
  10. package/dist/commands/core-knowledge-prefs.js +1 -16
  11. package/dist/commands/core.js +0 -2
  12. package/dist/commands/daemon.js +21 -0
  13. package/dist/commands/lanes-hold.js +7 -7
  14. package/dist/commands/lanes-resume.js +2 -2
  15. package/dist/commands/lanes-review.js +1 -1
  16. package/dist/commands/lanes-session-start.d.ts +1 -1
  17. package/dist/commands/lanes-session-start.js +3 -3
  18. package/dist/commands/lanes-shared.d.ts +1 -1
  19. package/dist/commands/lanes.d.ts +2 -2
  20. package/dist/commands/lanes.js +50 -50
  21. package/dist/commands/mesh.d.ts +25 -0
  22. package/dist/commands/mesh.js +48 -8
  23. package/dist/commands/ontology-graph.d.ts +63 -0
  24. package/dist/commands/ontology-graph.js +470 -0
  25. package/dist/commands/sync-core.js +6 -0
  26. package/dist/fast-scaffold.js +1 -3
  27. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +281 -256
  28. package/dist/hq-cloud-sync-runner/package.json +1 -1
  29. package/dist/index.d.ts +8 -0
  30. package/dist/index.js +48 -1
  31. package/dist/lanes-monitor-check-argv.d.ts +1 -1
  32. package/dist/lanes-monitor-check-argv.js +1 -1
  33. package/dist/lanes-monitor-check-fast.d.ts +1 -1
  34. package/dist/lanes-monitor-check-fast.js +1 -1
  35. package/dist/lanes-session-start-argv.d.ts +1 -1
  36. package/dist/lanes-session-start-argv.js +1 -1
  37. package/dist/lib/capacity/sign-in.d.ts +1 -1
  38. package/dist/lib/capacity/sign-in.js +1 -1
  39. package/dist/lib/daemon/hook-requests-conduct-link.js +2 -2
  40. package/dist/lib/daemon/installed-cli-restart.d.ts +57 -0
  41. package/dist/lib/daemon/installed-cli-restart.js +114 -0
  42. package/dist/lib/daemon/lanes-monitor-state.d.ts +2 -2
  43. package/dist/lib/daemon/lanes-monitor-state.js +2 -2
  44. package/dist/lib/daemon/legacy-journal-gate.d.ts +32 -0
  45. package/dist/lib/daemon/legacy-journal-gate.js +102 -0
  46. package/dist/lib/daemon/machine-checks.d.ts +7 -0
  47. package/dist/lib/daemon/machine-checks.js +10 -0
  48. package/dist/lib/daemon/merge-sections.d.ts +3 -3
  49. package/dist/lib/daemon/merge-sections.js +7 -7
  50. package/dist/lib/daemon/remote-control-pools.js +1 -1
  51. package/dist/lib/daemon/run.d.ts +3 -1
  52. package/dist/lib/daemon/run.js +49 -6
  53. package/dist/lib/daemon/state-file.d.ts +1 -1
  54. package/dist/lib/daemon/state-file.js +1 -1
  55. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  56. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  57. package/dist/lib/flag-snapshot-file.d.ts +2 -0
  58. package/dist/lib/flag-snapshot-file.js +118 -48
  59. package/dist/lib/hook-engine/canary-gate.d.ts +57 -3
  60. package/dist/lib/hook-engine/canary-gate.js +138 -6
  61. package/dist/lib/hook-engine/coverage.d.ts +82 -13
  62. package/dist/lib/hook-engine/coverage.js +214 -18
  63. package/dist/lib/hook-engine/registration-identity.d.ts +5 -0
  64. package/dist/lib/hook-engine/registration-identity.js +1 -1
  65. package/dist/lib/hook-engine/resolve.d.ts +23 -0
  66. package/dist/lib/hook-engine/resolve.js +48 -1
  67. package/dist/lib/hook-engine/stable-heal.d.ts +87 -0
  68. package/dist/lib/hook-engine/stable-heal.js +214 -0
  69. package/dist/lib/hot-channels/graph-context.d.ts +105 -0
  70. package/dist/lib/hot-channels/graph-context.js +380 -0
  71. package/dist/lib/hot-channels/signals-pass.js +27 -1
  72. package/dist/lib/lanes/claude-credential.d.ts +1 -1
  73. package/dist/lib/lanes/claude-credential.js +1 -1
  74. package/dist/lib/lanes/delivery-core.d.ts +1 -1
  75. package/dist/lib/lanes/delivery-core.js +1 -1
  76. package/dist/lib/lanes/delivery.d.ts +10 -10
  77. package/dist/lib/lanes/delivery.js +8 -8
  78. package/dist/lib/lanes/dropbox.d.ts +1 -1
  79. package/dist/lib/lanes/dropbox.js +1 -1
  80. package/dist/lib/lanes/hooks-install.js +2 -2
  81. package/dist/lib/lanes/index.d.ts +1 -1
  82. package/dist/lib/lanes/index.js +1 -1
  83. package/dist/lib/lanes/monitor.js +1 -1
  84. package/dist/lib/lanes/quota-notice.js +1 -1
  85. package/dist/lib/lanes/quota.d.ts +1 -1
  86. package/dist/lib/lanes/quota.js +1 -1
  87. package/dist/lib/lanes/repo-merge-hold.d.ts +2 -2
  88. package/dist/lib/lanes/repo-merge-hold.js +2 -2
  89. package/dist/lib/lanes/spawn.d.ts +4 -4
  90. package/dist/lib/lanes/spawn.js +5 -5
  91. package/dist/lib/mesh/live/company-flag-refresh.d.ts +61 -0
  92. package/dist/lib/mesh/live/company-flag-refresh.js +159 -0
  93. package/dist/lib/mesh/live/company-reporting-gaps.d.ts +61 -0
  94. package/dist/lib/mesh/live/company-reporting-gaps.js +238 -0
  95. package/dist/lib/mesh/live/daemon/duplicate-unit.d.ts +156 -0
  96. package/dist/lib/mesh/live/daemon/duplicate-unit.js +616 -0
  97. package/dist/lib/mesh/live/daemon/run.d.ts +13 -0
  98. package/dist/lib/mesh/live/daemon/run.js +35 -2
  99. package/dist/lib/mesh/live/direct-drain.js +1 -1
  100. package/dist/lib/mesh/live/emit.d.ts +3 -0
  101. package/dist/lib/mesh/live/emit.js +32 -9
  102. package/dist/lib/mesh/live/flush.d.ts +3 -0
  103. package/dist/lib/mesh/live/flush.js +115 -32
  104. package/dist/lib/mesh/live/liveness-carry.d.ts +1 -1
  105. package/dist/lib/mesh/live/liveness-carry.js +1 -1
  106. package/dist/lib/mesh/live/reporting-privacy.d.ts +119 -3
  107. package/dist/lib/mesh/live/reporting-privacy.js +235 -11
  108. package/dist/lib/mesh/live/spool.d.ts +17 -2
  109. package/dist/lib/mesh/live/spool.js +22 -6
  110. package/dist/lib/ontology-graph/legacy/coverage.d.ts +67 -0
  111. package/dist/lib/ontology-graph/legacy/coverage.js +192 -0
  112. package/dist/lib/ontology-graph/legacy/index.d.ts +199 -0
  113. package/dist/lib/ontology-graph/legacy/index.js +1150 -0
  114. package/dist/lib/ontology-graph/legacy/parse.d.ts +49 -0
  115. package/dist/lib/ontology-graph/legacy/parse.js +126 -0
  116. package/dist/lib/ontology-graph/legacy/report.d.ts +14 -0
  117. package/dist/lib/ontology-graph/legacy/report.js +254 -0
  118. package/dist/lib/ontology-graph/legacy/verb-map.d.ts +35 -0
  119. package/dist/lib/ontology-graph/legacy/verb-map.js +84 -0
  120. package/dist/lib/ontology-graph/lint/checks.d.ts +140 -0
  121. package/dist/lib/ontology-graph/lint/checks.js +717 -0
  122. package/dist/lib/ontology-graph/lint/coverage.d.ts +106 -0
  123. package/dist/lib/ontology-graph/lint/coverage.js +241 -0
  124. package/dist/lib/ontology-graph/lint/daily-job.d.ts +259 -0
  125. package/dist/lib/ontology-graph/lint/daily-job.js +595 -0
  126. package/dist/lib/ontology-graph/lint/index.d.ts +65 -0
  127. package/dist/lib/ontology-graph/lint/index.js +176 -0
  128. package/dist/lib/ontology-graph/model/files.d.ts +20 -0
  129. package/dist/lib/ontology-graph/model/files.js +89 -0
  130. package/dist/lib/ontology-graph/model/index.d.ts +65 -0
  131. package/dist/lib/ontology-graph/model/index.js +100 -0
  132. package/dist/lib/ontology-graph/model/pass-tasks.d.ts +156 -0
  133. package/dist/lib/ontology-graph/model/pass-tasks.js +345 -0
  134. package/dist/lib/ontology-graph/model/pass.d.ts +109 -0
  135. package/dist/lib/ontology-graph/model/pass.js +958 -0
  136. package/dist/lib/ontology-graph/model/runner.d.ts +50 -0
  137. package/dist/lib/ontology-graph/model/runner.js +160 -0
  138. package/dist/lib/ontology-graph/model/step.d.ts +197 -0
  139. package/dist/lib/ontology-graph/model/step.js +526 -0
  140. package/dist/lib/ontology-graph/model/tasks.d.ts +183 -0
  141. package/dist/lib/ontology-graph/model/tasks.js +349 -0
  142. package/dist/lib/ontology-graph/not-implemented.d.ts +5 -0
  143. package/dist/lib/ontology-graph/not-implemented.js +8 -0
  144. package/dist/lib/ontology-graph/org/compare.d.ts +28 -0
  145. package/dist/lib/ontology-graph/org/compare.js +239 -0
  146. package/dist/lib/ontology-graph/org/derive.d.ts +67 -0
  147. package/dist/lib/ontology-graph/org/derive.js +359 -0
  148. package/dist/lib/ontology-graph/org/index.d.ts +102 -0
  149. package/dist/lib/ontology-graph/org/index.js +630 -0
  150. package/dist/lib/ontology-graph/org/load.d.ts +31 -0
  151. package/dist/lib/ontology-graph/org/load.js +476 -0
  152. package/dist/lib/ontology-graph/org/role.d.ts +38 -0
  153. package/dist/lib/ontology-graph/org/role.js +268 -0
  154. package/dist/lib/ontology-graph/org/structure.d.ts +63 -0
  155. package/dist/lib/ontology-graph/org/structure.js +437 -0
  156. package/dist/lib/ontology-graph/org/text.d.ts +97 -0
  157. package/dist/lib/ontology-graph/org/text.js +321 -0
  158. package/dist/lib/ontology-graph/org/types.d.ts +457 -0
  159. package/dist/lib/ontology-graph/org/types.js +80 -0
  160. package/dist/lib/ontology-graph/pages/index.d.ts +64 -0
  161. package/dist/lib/ontology-graph/pages/index.js +193 -0
  162. package/dist/lib/ontology-graph/pages/render.d.ts +144 -0
  163. package/dist/lib/ontology-graph/pages/render.js +688 -0
  164. package/dist/lib/ontology-graph/proposals/apply.d.ts +109 -0
  165. package/dist/lib/ontology-graph/proposals/apply.js +468 -0
  166. package/dist/lib/ontology-graph/proposals/group.d.ts +63 -0
  167. package/dist/lib/ontology-graph/proposals/group.js +232 -0
  168. package/dist/lib/ontology-graph/proposals/index.d.ts +173 -0
  169. package/dist/lib/ontology-graph/proposals/index.js +474 -0
  170. package/dist/lib/ontology-graph/proposals/model.d.ts +162 -0
  171. package/dist/lib/ontology-graph/proposals/model.js +196 -0
  172. package/dist/lib/ontology-graph/proposals/org-chart.d.ts +82 -0
  173. package/dist/lib/ontology-graph/proposals/org-chart.js +340 -0
  174. package/dist/lib/ontology-graph/read/brief.d.ts +26 -0
  175. package/dist/lib/ontology-graph/read/brief.js +254 -0
  176. package/dist/lib/ontology-graph/read/graph-index.d.ts +76 -0
  177. package/dist/lib/ontology-graph/read/graph-index.js +198 -0
  178. package/dist/lib/ontology-graph/read/index.d.ts +59 -0
  179. package/dist/lib/ontology-graph/read/index.js +803 -0
  180. package/dist/lib/ontology-graph/read/member.d.ts +7 -0
  181. package/dist/lib/ontology-graph/read/member.js +34 -0
  182. package/dist/lib/ontology-graph/read/names.d.ts +49 -0
  183. package/dist/lib/ontology-graph/read/names.js +297 -0
  184. package/dist/lib/ontology-graph/read/reader-setting.d.ts +19 -0
  185. package/dist/lib/ontology-graph/read/reader-setting.js +62 -0
  186. package/dist/lib/ontology-graph/read/test-graph.d.ts +37 -0
  187. package/dist/lib/ontology-graph/read/test-graph.js +150 -0
  188. package/dist/lib/ontology-graph/replay/buffered-store.d.ts +33 -0
  189. package/dist/lib/ontology-graph/replay/buffered-store.js +50 -0
  190. package/dist/lib/ontology-graph/replay/config.d.ts +41 -0
  191. package/dist/lib/ontology-graph/replay/config.js +105 -0
  192. package/dist/lib/ontology-graph/replay/engine.d.ts +146 -0
  193. package/dist/lib/ontology-graph/replay/engine.js +1240 -0
  194. package/dist/lib/ontology-graph/replay/extractors.d.ts +59 -0
  195. package/dist/lib/ontology-graph/replay/extractors.js +1555 -0
  196. package/dist/lib/ontology-graph/replay/index.d.ts +91 -0
  197. package/dist/lib/ontology-graph/replay/index.js +220 -0
  198. package/dist/lib/ontology-graph/replay/listing-manifest.d.ts +66 -0
  199. package/dist/lib/ontology-graph/replay/listing-manifest.js +242 -0
  200. package/dist/lib/ontology-graph/replay/member.d.ts +19 -0
  201. package/dist/lib/ontology-graph/replay/member.js +65 -0
  202. package/dist/lib/ontology-graph/replay/mentions.d.ts +58 -0
  203. package/dist/lib/ontology-graph/replay/mentions.js +239 -0
  204. package/dist/lib/ontology-graph/replay/readers.d.ts +98 -0
  205. package/dist/lib/ontology-graph/replay/readers.js +1251 -0
  206. package/dist/lib/ontology-graph/replay/rules.d.ts +127 -0
  207. package/dist/lib/ontology-graph/replay/rules.js +374 -0
  208. package/dist/lib/ontology-graph/replay/scope.d.ts +35 -0
  209. package/dist/lib/ontology-graph/replay/scope.js +115 -0
  210. package/dist/lib/ontology-graph/replay/transcripts.d.ts +39 -0
  211. package/dist/lib/ontology-graph/replay/transcripts.js +224 -0
  212. package/dist/lib/ontology-graph/replay/util.d.ts +55 -0
  213. package/dist/lib/ontology-graph/replay/util.js +256 -0
  214. package/dist/lib/ontology-graph/resolve/entity-index.d.ts +159 -0
  215. package/dist/lib/ontology-graph/resolve/entity-index.js +652 -0
  216. package/dist/lib/ontology-graph/resolve/index.d.ts +113 -0
  217. package/dist/lib/ontology-graph/resolve/index.js +214 -0
  218. package/dist/lib/ontology-graph/resolve/machine.d.ts +34 -0
  219. package/dist/lib/ontology-graph/resolve/machine.js +95 -0
  220. package/dist/lib/ontology-graph/resolve/normalize.d.ts +35 -0
  221. package/dist/lib/ontology-graph/resolve/normalize.js +124 -0
  222. package/dist/lib/ontology-graph/resolve/org-chart.d.ts +107 -0
  223. package/dist/lib/ontology-graph/resolve/org-chart.js +578 -0
  224. package/dist/lib/ontology-graph/resolve/org-layer.d.ts +78 -0
  225. package/dist/lib/ontology-graph/resolve/org-layer.js +159 -0
  226. package/dist/lib/ontology-graph/resolve/org-seed.d.ts +141 -0
  227. package/dist/lib/ontology-graph/resolve/org-seed.js +631 -0
  228. package/dist/lib/ontology-graph/resolve/org-sources.d.ts +165 -0
  229. package/dist/lib/ontology-graph/resolve/org-sources.js +634 -0
  230. package/dist/lib/ontology-graph/resolve/roster.d.ts +76 -0
  231. package/dist/lib/ontology-graph/resolve/roster.js +226 -0
  232. package/dist/lib/ontology-graph/resolve/seed.d.ts +267 -0
  233. package/dist/lib/ontology-graph/resolve/seed.js +1198 -0
  234. package/dist/lib/ontology-graph/resolve/upsert.d.ts +58 -0
  235. package/dist/lib/ontology-graph/resolve/upsert.js +139 -0
  236. package/dist/lib/ontology-graph/resolve/writer.d.ts +128 -0
  237. package/dist/lib/ontology-graph/resolve/writer.js +351 -0
  238. package/dist/lib/ontology-graph/schema/authority.d.ts +107 -0
  239. package/dist/lib/ontology-graph/schema/authority.js +186 -0
  240. package/dist/lib/ontology-graph/schema/default-schema.d.ts +10 -0
  241. package/dist/lib/ontology-graph/schema/default-schema.js +242 -0
  242. package/dist/lib/ontology-graph/schema/grammar.d.ts +57 -0
  243. package/dist/lib/ontology-graph/schema/grammar.js +409 -0
  244. package/dist/lib/ontology-graph/schema/index.d.ts +12 -0
  245. package/dist/lib/ontology-graph/schema/index.js +10 -0
  246. package/dist/lib/ontology-graph/schema/validate.d.ts +13 -0
  247. package/dist/lib/ontology-graph/schema/validate.js +132 -0
  248. package/dist/lib/ontology-graph/store/files.d.ts +34 -0
  249. package/dist/lib/ontology-graph/store/files.js +207 -0
  250. package/dist/lib/ontology-graph/store/fs.d.ts +30 -0
  251. package/dist/lib/ontology-graph/store/fs.js +101 -0
  252. package/dist/lib/ontology-graph/store/graph-store.d.ts +14 -0
  253. package/dist/lib/ontology-graph/store/graph-store.js +520 -0
  254. package/dist/lib/ontology-graph/store/index.d.ts +18 -0
  255. package/dist/lib/ontology-graph/store/index.js +15 -0
  256. package/dist/lib/ontology-graph/store/ingest.d.ts +37 -0
  257. package/dist/lib/ontology-graph/store/ingest.js +323 -0
  258. package/dist/lib/ontology-graph/store/paths.d.ts +114 -0
  259. package/dist/lib/ontology-graph/store/paths.js +232 -0
  260. package/dist/lib/ontology-graph/types.d.ts +1190 -0
  261. package/dist/lib/ontology-graph/types.js +131 -0
  262. package/dist/lib/secret-scan/gitleaks-rules.generated.js +1 -1
  263. package/dist/lib/sync-core/engine-holds.d.ts +1 -1
  264. package/dist/lib/sync-core/engine-holds.js +12 -2
  265. package/dist/lib/sync-core/hand-back.d.ts +2 -1
  266. package/dist/lib/sync-core/hand-back.js +16 -2
  267. package/dist/lib/sync-core/legacy-journal-export-child.d.ts +2 -0
  268. package/dist/lib/sync-core/legacy-journal-export-child.js +24 -0
  269. package/dist/lib/sync-core/legacy-journal-export.d.ts +39 -0
  270. package/dist/lib/sync-core/legacy-journal-export.js +241 -0
  271. package/dist/lib/sync-core/legacy-journal-reader.d.ts +15 -0
  272. package/dist/lib/sync-core/legacy-journal-reader.js +56 -0
  273. package/dist/lib/sync-core/reconcile.d.ts +3 -0
  274. package/dist/lib/sync-core/reconcile.js +43 -3
  275. package/dist/utils/cli-telemetry.d.ts +1 -0
  276. package/dist/utils/cli-telemetry.js +6 -3
  277. package/dist/utils/frontmatter.d.ts +14 -0
  278. package/dist/utils/frontmatter.js +18 -0
  279. package/dist/utils/hook-engine-rollup.d.ts +96 -0
  280. package/dist/utils/hook-engine-rollup.js +725 -0
  281. package/dist/utils/interactive-caller.js +1 -1
  282. package/package.json +9 -9
  283. package/scripts/install-hook-engine.mjs +4 -0
  284. package/assets/scaffold/core/scripts/knowledge-prefs.sh +0 -55
@@ -1 +1 @@
1
- {"name":"hq-cli-daemon-sync-runner","type":"module","version":"6.18.121","bundleSha256":"93df1547b4ae2346bf65b1a16eba2410370625efaab1e29fd93ca0a4e627410d","formatVersion":1}
1
+ {"name":"hq-cli-daemon-sync-runner","type":"module","version":"6.18.122","bundleSha256":"b8fdfeffdf3169c9c27d4eaf2dd3ce730b2f1e20f5ada5aacaa0217ddeecc72e","formatVersion":1}
package/dist/index.d.ts CHANGED
@@ -12,6 +12,13 @@ import { isFastCoreRequest } from "./fast-scaffold.js";
12
12
  * install-followup.ts.
13
13
  */
14
14
  export declare function installFollowupWouldDoWork(argv: readonly string[], env: NodeJS.ProcessEnv, platform: NodeJS.Platform): boolean;
15
+ /**
16
+ * Whether this run should check the `stable` hook engine link after an update
17
+ * (lib/hook-engine/stable-heal.ts). Only full commands run from an install,
18
+ * never `hq reindex` itself, the reindex the heal starts, or the daemons; and
19
+ * only where the link exists, so a machine without core.next loads nothing.
20
+ */
21
+ export declare function stableHealWouldRun(argv: readonly string[], env: NodeJS.ProcessEnv, platform: NodeJS.Platform, home?: string): boolean;
15
22
  type PackageUseLeaseLoader = () => Promise<void>;
16
23
  type PackageUseUpdateProbe = () => Promise<boolean>;
17
24
  /** Resolves true once the command was re-run (exit code already set). */
@@ -28,6 +35,7 @@ export declare const __test__: {
28
35
  isVersionRequest: typeof isVersionRequest;
29
36
  isFastCoreRequest: typeof isFastCoreRequest;
30
37
  installFollowupWouldDoWork: typeof installFollowupWouldDoWork;
38
+ stableHealWouldRun: typeof stableHealWouldRun;
31
39
  dispatchWithPackageUseLease: typeof dispatchWithPackageUseLease;
32
40
  waitForUpdateThenReexec: typeof waitForUpdateThenReexec;
33
41
  runCliEntry: typeof runCliEntry;
package/dist/index.js CHANGED
@@ -19,6 +19,9 @@ import { parseMonitorCheckFastRequest } from "./lanes-monitor-check-argv.js";
19
19
  import { isLaneSessionStartFastRequest } from "./lanes-session-start-argv.js";
20
20
  import { writeLanesAliasDeprecationForArgv } from "./runners-alias.js";
21
21
  import { createRequire } from "node:module";
22
+ import { lstatSync } from "node:fs";
23
+ import { homedir } from "node:os";
24
+ import { join } from "node:path";
22
25
  import { hookEnginePathArgs, runHookEnginePath } from "./hook-engine-path.js";
23
26
  // Builtins only: the local command count and the retiring gate run on every
24
27
  // route, including the hook fast routes. The gate ships switched off
@@ -187,7 +190,7 @@ async function runMonitorCheckFastWithRecovery(request) {
187
190
  await runMainWithInstallTreeRecovery();
188
191
  }
189
192
  /**
190
- * The SessionStart hook runs `hq lanes session-start` on every new session
193
+ * The SessionStart hook runs `hq runners session-start` on every new session
191
194
  * under a 2 s cap. Load only that command's module, not the command graph.
192
195
  */
193
196
  async function runLaneSessionStartFastWithRecovery() {
@@ -293,6 +296,49 @@ function dispatchCliRoutes() {
293
296
  // daemon work, so they never start PowerShell or reg.exe. The module stays
294
297
  // unloaded when there is nothing to do, so a Linux fast route does not
295
298
  // import it.
299
+ if (!versionRequest && !helpRequest && !monitorRequest && !parsedFastCore && !secretsRequest && !mcpRequest
300
+ && stableHealWouldRun(process.argv, process.env, process.platform)) {
301
+ void import("./lib/hook-engine/stable-heal.js").then(({ healStableEngine, recordStableHealFailure }) => {
302
+ try {
303
+ healStableEngine();
304
+ }
305
+ catch (error) {
306
+ // The heal must not turn into a failed command; its log says what went wrong.
307
+ recordStableHealFailure(error);
308
+ }
309
+ }).catch(() => undefined).then(() => {
310
+ dispatchInstallFollowupThenCommand(versionRequest, helpRequest, parsedFastCore, monitorRequest, secretsRequest, mcpRequest);
311
+ });
312
+ return;
313
+ }
314
+ dispatchInstallFollowupThenCommand(versionRequest, helpRequest, parsedFastCore, monitorRequest, secretsRequest, mcpRequest);
315
+ }
316
+ /**
317
+ * Whether this run should check the `stable` hook engine link after an update
318
+ * (lib/hook-engine/stable-heal.ts). Only full commands run from an install,
319
+ * never `hq reindex` itself, the reindex the heal starts, or the daemons; and
320
+ * only where the link exists, so a machine without core.next loads nothing.
321
+ */
322
+ export function stableHealWouldRun(argv, env, platform, home = homedir()) {
323
+ if (platform === "win32" || env.HQ_STABLE_HEAL === "1" || env.HQ_STAGED_INSTALL === "1")
324
+ return false;
325
+ const args = argv.slice(2).filter((arg) => arg !== "--verbose");
326
+ if (args[0] === "reindex" || args[0] === "master-sync")
327
+ return false;
328
+ if (args[0] === "mesh" && args[1] === "daemon")
329
+ return false;
330
+ if (args[0] === "daemon")
331
+ return false;
332
+ if (!/node_modules[/\\]@indigoai-us[/\\]hq-cli[/\\]/i.test(argv[1] ?? ""))
333
+ return false;
334
+ try {
335
+ return lstatSync(join(home, ".hq", "bin", "hq-hook", "stable")).isSymbolicLink();
336
+ }
337
+ catch {
338
+ return false;
339
+ }
340
+ }
341
+ function dispatchInstallFollowupThenCommand(versionRequest, helpRequest, parsedFastCore, monitorRequest, secretsRequest, mcpRequest) {
296
342
  if (!versionRequest && !monitorRequest && !parsedFastCore && !secretsRequest && !mcpRequest
297
343
  && installFollowupWouldDoWork(process.argv, process.env, process.platform)) {
298
344
  void import("./lib/windows/install-followup.js").then(({ runWindowsInstallFollowup }) => {
@@ -536,6 +582,7 @@ export const __test__ = {
536
582
  isVersionRequest,
537
583
  isFastCoreRequest,
538
584
  installFollowupWouldDoWork,
585
+ stableHealWouldRun,
539
586
  dispatchWithPackageUseLease,
540
587
  waitForUpdateThenReexec,
541
588
  runCliEntry,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Dependency-free argv matcher for the `hq lanes monitor-check` fast route.
2
+ * Dependency-free argv matcher for the `hq runners monitor-check` fast route.
3
3
  * Imported statically by src/index.ts, so it must not import anything.
4
4
  */
5
5
  export interface MonitorCheckFastRequest {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Dependency-free argv matcher for the `hq lanes monitor-check` fast route.
2
+ * Dependency-free argv matcher for the `hq runners monitor-check` fast route.
3
3
  * Imported statically by src/index.ts, so it must not import anything.
4
4
  */
5
5
  const SAFE_SESSION_ID = /^[A-Za-z0-9._:-]{1,200}$/u;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Startup fast route for `hq lanes monitor-check`.
2
+ * Startup fast route for `hq runners monitor-check`.
3
3
  *
4
4
  * The Claude Stop hook (`lanes-senior-monitor-stop-gate.sh`) runs this command
5
5
  * at the end of every assistant turn in every HQ session, and the
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Startup fast route for `hq lanes monitor-check`.
2
+ * Startup fast route for `hq runners monitor-check`.
3
3
  *
4
4
  * The Claude Stop hook (`lanes-senior-monitor-stop-gate.sh`) runs this command
5
5
  * at the end of every assistant turn in every HQ session, and the
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Dependency-free argv matcher for the `hq lanes session-start` fast route.
2
+ * Dependency-free argv matcher for the `hq runners session-start` fast route.
3
3
  * Imported statically by src/index.ts, so it must not import anything.
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Dependency-free argv matcher for the `hq lanes session-start` fast route.
2
+ * Dependency-free argv matcher for the `hq runners session-start` fast route.
3
3
  * Imported statically by src/index.ts, so it must not import anything.
4
4
  */
5
5
  /**
@@ -2,7 +2,7 @@
2
2
  * hq capacity login / accounts (US-012).
3
3
  *
4
4
  * Account homes, vendor login, and registry writes stay in
5
- * `hq lanes accounts login`. This module decides which accounts to show,
5
+ * `hq runners accounts login`. This module decides which accounts to show,
6
6
  * which ones are expired rather than signed out, and which registry id to
7
7
  * keep after the first usage read. It never refreshes a token.
8
8
  */
@@ -2,7 +2,7 @@
2
2
  * hq capacity login / accounts (US-012).
3
3
  *
4
4
  * Account homes, vendor login, and registry writes stay in
5
- * `hq lanes accounts login`. This module decides which accounts to show,
5
+ * `hq runners accounts login`. This module decides which accounts to show,
6
6
  * which ones are expired rather than signed out, and which registry id to
7
7
  * keep after the first usage read. It never refreshes a token.
8
8
  */
@@ -10,7 +10,7 @@
10
10
  * - `conduct-lanes-link-deliver`: `.claude/hooks/conduct-lanes-link-deliver.sh
11
11
  * PostToolUse`, which for a root session with a
12
12
  * `workspace/lanes-links/by-session/<sid>` pointer runs
13
- * `hq lanes link _deliver --event PostToolUse` with the payload on stdin.
13
+ * `hq runners link _deliver --event PostToolUse` with the payload on stdin.
14
14
  * - `conduct-link-inherit`: `.claude/hooks/conduct-link-inherit.sh PostToolUse`,
15
15
  * which runs `node core/scripts/lib/conduct-link-inherit.mjs PostToolUse
16
16
  * <root>`; its `settle` joins a pending claim of the session to its conduct
@@ -20,7 +20,7 @@
20
20
  * carries (`args.session_id`, also the note's session). A deliver note may
21
21
  * also carry `args.at`, the event's time (UTC, `...Z`): the daemon passes it to
22
22
  * the script as HQ_LINK_DELIVER_QUEUED_AT_OR_BEFORE, which the script's
23
- * `hq lanes link _deliver` inherits, so the run takes only the messages queued
23
+ * `hq runners link _deliver` inherits, so the run takes only the messages queued
24
24
  * at or before the event; later ones stay queued for the root's next
25
25
  * PostToolUse or Stop, where the adapter would have delivered them. The daemon runs the
26
26
  * root's own hook script, `bash <root>/.claude/hooks/<script> PostToolUse`,
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Restart a daemon that is older than the hq CLI installed on disk.
3
+ *
4
+ * The desktop app, `hq update` or `npm install -g` can replace the CLI while
5
+ * the daemon keeps running. Units the daemon starts load the new files, but
6
+ * work the daemon does in its own process (the in-process lanes reconcile,
7
+ * the supervisor itself) keeps running the release it started from. The
8
+ * `updater` unit restarts an older daemon, but a machine can turn that unit
9
+ * off (`hq daemon disable updater`), and then nothing restarted the daemon:
10
+ * on 2026-11-22 a desktop daemon still ran 5.345.236 with 5.345.247
11
+ * installed, so the lanes reconcile kept failing with a bug 5.345.246 fixed.
12
+ *
13
+ * Restarting onto an installed release is not an update, so this runs from
14
+ * the hourly housekeeping unit on every machine type, whether or not the
15
+ * updater is on. Only a strictly older, parseable daemon version asks, and
16
+ * it asks once per (running, installed) pair, recorded on disk, so a dev build
17
+ * or a restart that comes back on the same old release never loops.
18
+ */
19
+ /** The version in the hq-cli package.json under `packageRoot`, read from disk now; null when unknown. */
20
+ export declare function installedCliVersionOnDisk(packageRoot: string | null, read?: (file: string) => string): string | null;
21
+ export interface OlderParentDaemonDeps {
22
+ /** HQ_DAEMON_CLI_VERSION: the release of the daemon that started this unit (set by every daemon since before 5.345.236). */
23
+ parentVersion: string | undefined;
24
+ /** This process's own CLI_VERSION: the CLI installed on disk, since units start from it. */
25
+ cliVersion: string;
26
+ /** Records the last pair asked for, so units started by the same daemon ask once. */
27
+ markerPath: string;
28
+ /** Ask the running daemon to restart once sync is idle. */
29
+ requestRestart: () => void;
30
+ }
31
+ /**
32
+ * Heal a daemon that is already stuck on an older release, which has no
33
+ * housekeeping check of its own: a unit it starts runs the CLI on disk and can
34
+ * see that its parent is older. Asks once per (daemon, installed) pair; returns
35
+ * whether it asked. Never throws: the unit must start either way.
36
+ */
37
+ export declare function requestRestartOfOlderParentDaemon(deps: OlderParentDaemonDeps): boolean;
38
+ export interface InstalledCliRestartDeps {
39
+ /** The release this daemon process was started from (its CLI_VERSION). */
40
+ runningVersion: string;
41
+ /** The release installed on disk now, or null when it cannot be read. */
42
+ readInstalledVersion: () => string | null;
43
+ /** Ask the running daemon to restart once sync is idle. */
44
+ requestRestart: () => void;
45
+ log: (level: "info" | "warn", line: string) => void;
46
+ /**
47
+ * Records the last (running, installed) pair asked for, so a daemon that comes
48
+ * back on the same old release after a restart does not ask again every hour.
49
+ */
50
+ markerPath?: string;
51
+ }
52
+ /**
53
+ * One check per call. Returns the installed version it asked to restart onto,
54
+ * or null when it did not ask. Never throws: housekeeping must keep running.
55
+ */
56
+ export declare function createInstalledCliRestartCheck(deps: InstalledCliRestartDeps): () => string | null;
57
+ //# sourceMappingURL=installed-cli-restart.d.ts.map
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Restart a daemon that is older than the hq CLI installed on disk.
3
+ *
4
+ * The desktop app, `hq update` or `npm install -g` can replace the CLI while
5
+ * the daemon keeps running. Units the daemon starts load the new files, but
6
+ * work the daemon does in its own process (the in-process lanes reconcile,
7
+ * the supervisor itself) keeps running the release it started from. The
8
+ * `updater` unit restarts an older daemon, but a machine can turn that unit
9
+ * off (`hq daemon disable updater`), and then nothing restarted the daemon:
10
+ * on 2026-11-22 a desktop daemon still ran 5.345.236 with 5.345.247
11
+ * installed, so the lanes reconcile kept failing with a bug 5.345.246 fixed.
12
+ *
13
+ * Restarting onto an installed release is not an update, so this runs from
14
+ * the hourly housekeeping unit on every machine type, whether or not the
15
+ * updater is on. Only a strictly older, parseable daemon version asks, and
16
+ * it asks once per (running, installed) pair, recorded on disk, so a dev build
17
+ * or a restart that comes back on the same old release never loops.
18
+ */
19
+ import * as fs from "node:fs";
20
+ import * as path from "node:path";
21
+ import semver from "semver";
22
+ /** The version in the hq-cli package.json under `packageRoot`, read from disk now; null when unknown. */
23
+ export function installedCliVersionOnDisk(packageRoot, read = (file) => fs.readFileSync(file, "utf8")) {
24
+ if (!packageRoot)
25
+ return null;
26
+ try {
27
+ const pkg = JSON.parse(read(path.join(packageRoot, "package.json")));
28
+ if (pkg.name !== "@indigoai-us/hq-cli" || typeof pkg.version !== "string")
29
+ return null;
30
+ return semver.valid(pkg.version);
31
+ }
32
+ catch {
33
+ return null;
34
+ }
35
+ }
36
+ /**
37
+ * Heal a daemon that is already stuck on an older release, which has no
38
+ * housekeeping check of its own: a unit it starts runs the CLI on disk and can
39
+ * see that its parent is older. Asks once per (daemon, installed) pair; returns
40
+ * whether it asked. Never throws: the unit must start either way.
41
+ */
42
+ export function requestRestartOfOlderParentDaemon(deps) {
43
+ try {
44
+ const parent = semver.valid(deps.parentVersion?.trim() ?? "");
45
+ const installed = semver.valid(deps.cliVersion);
46
+ if (!parent || !installed || !semver.lt(parent, installed))
47
+ return false;
48
+ const pair = `${parent}->${installed}`;
49
+ try {
50
+ if (JSON.parse(fs.readFileSync(deps.markerPath, "utf8")).pair === pair)
51
+ return false;
52
+ }
53
+ catch {
54
+ // no marker yet, or unreadable: ask
55
+ }
56
+ fs.mkdirSync(path.dirname(deps.markerPath), { recursive: true, mode: 0o700 });
57
+ fs.writeFileSync(deps.markerPath, `${JSON.stringify({ pair })}\n`, { mode: 0o600 });
58
+ deps.requestRestart();
59
+ return true;
60
+ }
61
+ catch {
62
+ return false;
63
+ }
64
+ }
65
+ function readRequestedPair(markerPath) {
66
+ if (!markerPath)
67
+ return null;
68
+ try {
69
+ return JSON.parse(fs.readFileSync(markerPath, "utf8"));
70
+ }
71
+ catch {
72
+ return null;
73
+ }
74
+ }
75
+ /**
76
+ * One check per call. Returns the installed version it asked to restart onto,
77
+ * or null when it did not ask. Never throws: housekeeping must keep running.
78
+ */
79
+ export function createInstalledCliRestartCheck(deps) {
80
+ let requestedFor = null;
81
+ return () => {
82
+ try {
83
+ const running = semver.valid(deps.runningVersion);
84
+ const installed = deps.readInstalledVersion();
85
+ if (!running || !installed || !semver.lt(running, installed))
86
+ return null;
87
+ if (requestedFor === installed)
88
+ return null;
89
+ const earlier = readRequestedPair(deps.markerPath);
90
+ if (earlier?.running === running && earlier.installed === installed) {
91
+ requestedFor = installed;
92
+ return null;
93
+ }
94
+ requestedFor = installed;
95
+ if (deps.markerPath) {
96
+ try {
97
+ fs.mkdirSync(path.dirname(deps.markerPath), { recursive: true, mode: 0o700 });
98
+ fs.writeFileSync(deps.markerPath, `${JSON.stringify({ running, installed })}\n`, { mode: 0o600 });
99
+ }
100
+ catch {
101
+ // Without the marker this process still asks only once; ask now.
102
+ }
103
+ }
104
+ deps.log("info", `this daemon runs hq-cli ${running}, older than the installed ${installed}; restarting onto it once sync is idle`);
105
+ deps.requestRestart();
106
+ return installed;
107
+ }
108
+ catch (error) {
109
+ deps.log("warn", `could not compare this daemon with the installed hq-cli (${error instanceof Error ? error.message : String(error)})`);
110
+ return null;
111
+ }
112
+ };
113
+ }
114
+ //# sourceMappingURL=installed-cli-restart.js.map
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The lanes_monitor section of the daemon state file (state-file.ts): for each
3
- * Claude senior session of an active lane, what `hq lanes monitor-check
3
+ * Claude senior session of an active lane, what `hq runners monitor-check
4
4
  * --session <id> --engine claude --json` would answer, plus the
5
5
  * `--reminder` text. The UserPromptSubmit hook (crates/hq-hook) reads it
6
6
  * instead of starting `hq`, so a prompt never waits on a program. A missing or
@@ -22,7 +22,7 @@ import type { LaneRecord } from "../lanes/types.js";
22
22
  */
23
23
  export declare const LANES_MONITOR_MAX_WATCHED_LANES = 64;
24
24
  import { type DaemonStateLanesMonitor, type DaemonStateMonitorCall } from "./state-file.js";
25
- /** The states `hq lanes monitor-check` counts as active (MONITOR_ACTIVE_LANE_STATES in lanes-watch.ts). */
25
+ /** The states `hq runners monitor-check` counts as active (MONITOR_ACTIVE_LANE_STATES in lanes-watch.ts). */
26
26
  export declare const LANES_MONITOR_ACTIVE_STATES: ReadonlySet<string>;
27
27
  export interface ComputeLanesMonitorSectionOptions {
28
28
  hqRoot: string;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The lanes_monitor section of the daemon state file (state-file.ts): for each
3
- * Claude senior session of an active lane, what `hq lanes monitor-check
3
+ * Claude senior session of an active lane, what `hq runners monitor-check
4
4
  * --session <id> --engine claude --json` would answer, plus the
5
5
  * `--reminder` text. The UserPromptSubmit hook (crates/hq-hook) reads it
6
6
  * instead of starting `hq`, so a prompt never waits on a program. A missing or
@@ -23,7 +23,7 @@ import { readAllLanes } from "../lanes/store.js";
23
23
  export const LANES_MONITOR_MAX_WATCHED_LANES = 64;
24
24
  const MAX_WATCHED_LANES = LANES_MONITOR_MAX_WATCHED_LANES;
25
25
  import { LANES_MONITOR_MAX_BYTES, LANES_MONITOR_MAX_SESSIONS, LANES_MONITOR_SESSION_ID_RE, } from "./state-file.js";
26
- /** The states `hq lanes monitor-check` counts as active (MONITOR_ACTIVE_LANE_STATES in lanes-watch.ts). */
26
+ /** The states `hq runners monitor-check` counts as active (MONITOR_ACTIVE_LANE_STATES in lanes-watch.ts). */
27
27
  export const LANES_MONITOR_ACTIVE_STATES = new Set([
28
28
  "running",
29
29
  "queued",
@@ -0,0 +1,32 @@
1
+ export declare const LEGACY_JOURNAL_EXPORT_TIMEOUT_MS = 120000;
2
+ export declare const LEGACY_JOURNAL_EXPORT_WAIT_PREFIX = "copying what the current sync last synced for ";
3
+ export interface LegacyJournalGateVault {
4
+ uid: string;
5
+ kind: "personal" | "company";
6
+ slug?: string;
7
+ phase: "warming" | "full";
8
+ legacyOffSince?: string;
9
+ }
10
+ export interface LegacyJournalGate {
11
+ pending(vault: LegacyJournalGateVault): boolean;
12
+ }
13
+ export type LegacyJournalExportRun = (vault: {
14
+ uid: string;
15
+ slug: string;
16
+ legacyOffSince?: string;
17
+ }, done: (failure?: string) => void) => {
18
+ cancel: () => void;
19
+ };
20
+ export interface LegacyJournalGateDeps {
21
+ home: string;
22
+ env: NodeJS.ProcessEnv;
23
+ now: () => number;
24
+ run: LegacyJournalExportRun;
25
+ timeoutMs?: number;
26
+ log: (level: "info" | "warn", message: string) => void;
27
+ }
28
+ export declare function legacyJournalExportWaitReason(what: string): string;
29
+ export declare function createLegacyJournalGate(deps: LegacyJournalGateDeps): LegacyJournalGate;
30
+ export declare function legacyJournalExportChildPath(): string;
31
+ export declare function runLegacyJournalExportChild(home: string, env: NodeJS.ProcessEnv, nodeBinary?: string, childPath?: string): LegacyJournalExportRun;
32
+ //# sourceMappingURL=legacy-journal-gate.d.ts.map
@@ -0,0 +1,102 @@
1
+ import { spawn } from "node:child_process";
2
+ import { fileURLToPath } from "node:url";
3
+ import { legacyJournalDirs, legacyJournalExportState, removeLegacyJournalTemps } from "../sync-core/legacy-journal-export.js";
4
+ export const LEGACY_JOURNAL_EXPORT_TIMEOUT_MS = 120_000;
5
+ export const LEGACY_JOURNAL_EXPORT_WAIT_PREFIX = "copying what the current sync last synced for ";
6
+ export function legacyJournalExportWaitReason(what) {
7
+ return `${LEGACY_JOURNAL_EXPORT_WAIT_PREFIX}${what}, so the new sync engine can tell an old copy from an edit that was never uploaded`;
8
+ }
9
+ export function createLegacyJournalGate(deps) {
10
+ const seen = new Map();
11
+ const timeoutMs = deps.timeoutMs ?? LEGACY_JOURNAL_EXPORT_TIMEOUT_MS;
12
+ const dropTemps = (vault) => {
13
+ try {
14
+ removeLegacyJournalTemps(deps.home, vault);
15
+ }
16
+ catch (error) {
17
+ deps.log("warn", `${vault.uid}: could not remove an unfinished copy of the current sync's record: ${error instanceof Error ? error.message : String(error)}`);
18
+ }
19
+ };
20
+ return {
21
+ pending(vault) {
22
+ if (vault.kind !== "company" || vault.phase !== "full" || !vault.slug)
23
+ return false;
24
+ const slug = vault.slug;
25
+ const key = vault.legacyOffSince ?? "";
26
+ const entry = seen.get(vault.uid);
27
+ if (entry && entry.key === key) {
28
+ if (entry.done)
29
+ return false;
30
+ if (deps.now() - entry.startedAt < timeoutMs)
31
+ return true;
32
+ entry.done = true;
33
+ entry.cancel?.();
34
+ dropTemps(vault);
35
+ deps.log("warn", `${vault.uid}: copying the current sync's record of ${slug} took over ${Math.round(timeoutMs / 1000)} seconds; starting the new sync engine without it`);
36
+ return false;
37
+ }
38
+ const started = { key, startedAt: deps.now(), done: false };
39
+ seen.set(vault.uid, started);
40
+ let needed;
41
+ try {
42
+ const state = legacyJournalExportState(deps.home, vault, deps.now());
43
+ needed = (state === "missing" || state === "unusable") && legacyJournalDirs(deps.home, deps.env, slug).length > 0;
44
+ }
45
+ catch (error) {
46
+ deps.log("warn", `${vault.uid}: could not check for the current sync's record of ${slug}: ${error instanceof Error ? error.message : String(error)}; starting the new sync engine without it`);
47
+ needed = false;
48
+ }
49
+ if (!needed) {
50
+ started.done = true;
51
+ return false;
52
+ }
53
+ try {
54
+ started.cancel = deps.run({ uid: vault.uid, slug, ...(vault.legacyOffSince ? { legacyOffSince: vault.legacyOffSince } : {}) }, (failure) => {
55
+ if (failure)
56
+ dropTemps(vault);
57
+ if (started.done)
58
+ return;
59
+ started.done = true;
60
+ if (failure)
61
+ deps.log("warn", `${vault.uid}: could not copy the current sync's record of ${slug} for the new sync engine: ${failure}; starting the engine without it`);
62
+ else
63
+ deps.log("info", `${vault.uid}: copied the current sync's record of ${slug} for the new sync engine`);
64
+ }).cancel;
65
+ }
66
+ catch (error) {
67
+ started.done = true;
68
+ deps.log("warn", `${vault.uid}: could not copy the current sync's record of ${slug} for the new sync engine: ${error instanceof Error ? error.message : String(error)}; starting the engine without it`);
69
+ }
70
+ return !started.done;
71
+ },
72
+ };
73
+ }
74
+ export function legacyJournalExportChildPath() {
75
+ return fileURLToPath(new URL("../sync-core/legacy-journal-export-child.js", import.meta.url));
76
+ }
77
+ export function runLegacyJournalExportChild(home, env, nodeBinary = process.execPath, childPath = legacyJournalExportChildPath()) {
78
+ return (vault, done) => {
79
+ const child = spawn(nodeBinary, [childPath, home, vault.uid, vault.slug, ...(vault.legacyOffSince ? [vault.legacyOffSince] : [])], {
80
+ env: { ...env, HQ_NO_UPDATE_CHECK: "1" },
81
+ stdio: ["ignore", "ignore", "pipe"],
82
+ windowsHide: true,
83
+ });
84
+ let stderr = "";
85
+ child.stderr?.setEncoding("utf8");
86
+ child.stderr?.on("data", (text) => {
87
+ if (stderr.length < 2000)
88
+ stderr += text;
89
+ });
90
+ child.on("error", (error) => done(error.message));
91
+ child.on("exit", (code, signal) => {
92
+ if (code === 0)
93
+ done();
94
+ else {
95
+ const lines = stderr.split("\n").map((line) => line.trim()).filter(Boolean);
96
+ done(lines.find((line) => /\bError\b/.test(line)) ?? lines.pop() ?? `the copy step ended with ${signal ?? `exit code ${String(code)}`}`);
97
+ }
98
+ });
99
+ return { cancel: () => void child.kill() };
100
+ };
101
+ }
102
+ //# sourceMappingURL=legacy-journal-gate.js.map
@@ -190,6 +190,13 @@ export interface MachineCheckScheduleOptions {
190
190
  collectOnlySupported?: (hqRoot: string) => boolean;
191
191
  /** Test seam: the fingerprints the native notice delivered. Default nativeNoticeShownFingerprints. */
192
192
  shownFingerprints?: (env: NodeJS.ProcessEnv, home: string) => ReadonlySet<string>;
193
+ /**
194
+ * Work that rides every tick while the schedule's gate is on (the daily
195
+ * hook-engine failure upload). It needs no HQ root and does not wait for the
196
+ * batch interval. Its own failure logs the error's name only and never stops
197
+ * the batch.
198
+ */
199
+ rollup?: () => Promise<void>;
193
200
  }
194
201
  /**
195
202
  * The checks to commit in this batch: each whose last result (the results
@@ -490,6 +490,16 @@ export function startMachineCheckSchedule(options) {
490
490
  /** Check id to the fingerprint last committed for it (in memory; a restart may commit once more, which is harmless). */
491
491
  const committed = new Map();
492
492
  const tick = async () => {
493
+ if (closed)
494
+ return;
495
+ if (options.rollup && enabled(options.env, options.home)) {
496
+ try {
497
+ await options.rollup();
498
+ }
499
+ catch (error) {
500
+ options.log("warn", `hook-engine rollup failed (${error instanceof Error ? error.name : "UnknownError"})`);
501
+ }
502
+ }
493
503
  try {
494
504
  if (closed)
495
505
  return;
@@ -15,7 +15,7 @@
15
15
  * min(max_age_seconds, 60) seconds, so whenever a decision cannot be made here
16
16
  * the section (or the session) is written so the check refuses:
17
17
  *
18
- * - a hold file `hq lanes hold` would refuse, an unreadable holds folder, or
18
+ * - a hold file `hq runners hold` would refuse, an unreadable holds folder, or
19
19
  * an unreadable `lanes.repo-merge-hold` flag omits merge_holds;
20
20
  * - an unreadable link folder omits merge_approvals;
21
21
  * - a session the conduct gate covers (a link pointer and a decision queue)
@@ -116,7 +116,7 @@ export interface MergeSectionInput {
116
116
  readFlag: MergeFlagReader;
117
117
  }
118
118
  /**
119
- * Every hold record, or null when any of them is one `hq lanes hold list`
119
+ * Every hold record, or null when any of them is one `hq runners hold list`
120
120
  * would refuse (unreadable, not JSON, invalid fields, or a file name that
121
121
  * does not match its repository), or when the folder cannot be read.
122
122
  */
@@ -156,7 +156,7 @@ export interface RegistryMergeFlagReaderOptions {
156
156
  * The environment the hold flag is read under: the daemon's own, without
157
157
  * the flag's local override (`HQ_FLAG_<KEY>`). The sections are read by the
158
158
  * native merge gates of every session; each session applies its own override
159
- * in process, as its `hq lanes hold check` would. An override set only in the
159
+ * in process, as its `hq runners hold check` would. An override set only in the
160
160
  * daemon's environment must not be written as every company's registry value.
161
161
  */
162
162
  export declare function withoutLocalOverride(flag: string, env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;