@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
@@ -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)
@@ -97,7 +97,7 @@ function isRecord(value) {
97
97
  return typeof value === "object" && value !== null && !Array.isArray(value);
98
98
  }
99
99
  /**
100
- * Every hold record, or null when any of them is one `hq lanes hold list`
100
+ * Every hold record, or null when any of them is one `hq runners hold list`
101
101
  * would refuse (unreadable, not JSON, invalid fields, or a file name that
102
102
  * does not match its repository), or when the folder cannot be read.
103
103
  */
@@ -116,7 +116,7 @@ export function readMergeHoldRecords(hqRoot) {
116
116
  for (const name of listed.value.filter((entry) => entry.endsWith(".json")).sort()) {
117
117
  const file = path.join(directory, name);
118
118
  const read = readIn(folder, name, MAX_HOLD_BYTES);
119
- // A file removed between the listing and the read was released by `hq lanes hold`.
119
+ // A file removed between the listing and the read was released by `hq runners hold`.
120
120
  if (read.kind === "missing")
121
121
  continue;
122
122
  if (read.kind === "refused")
@@ -263,7 +263,7 @@ function companyUidForSlug(hqRoot, slug) {
263
263
  uid = readCompaniesManifestMap(hqRoot)?.[slug]?.cloud_uid;
264
264
  return typeof uid === "string" && COMPANY_UID_RE.test(uid) ? uid : null;
265
265
  }
266
- /** The company a session's meta.yaml names (`company_slug`), the way `hq lanes link join` reads it. */
266
+ /** The company a session's meta.yaml names (`company_slug`), the way `hq runners link join` reads it. */
267
267
  function sessionMetaCompany(hqRoot, sid) {
268
268
  const meta = readOne(path.join(hqRoot, "workspace", "sessions", sid, "meta.yaml"), MAX_SESSION_META_BYTES);
269
269
  if (meta.kind !== "text")
@@ -277,7 +277,7 @@ function laneSessionIds(lane) {
277
277
  return ids.filter((id) => typeof id === "string" && LINK_ID_RE.test(id));
278
278
  }
279
279
  /**
280
- * The review context `hq lanes hold check` builds for a caller lane, for every
280
+ * The review context `hq runners hold check` builds for a caller lane, for every
281
281
  * live lane whose provider session id is known: the lane's company, and
282
282
  * whether the review-before-merge flag is on for it and the lane is a senior
283
283
  * of another lane.
@@ -298,7 +298,7 @@ async function laneSessions(hqRoot, readFlag) {
298
298
  }
299
299
  catch {
300
300
  // This may be the caller or a junior that makes the caller a senior.
301
- // `hq lanes hold check` refuses here too; an empty session map allows.
301
+ // `hq runners hold check` refuses here too; an empty session map allows.
302
302
  return null;
303
303
  }
304
304
  }
@@ -478,7 +478,7 @@ async function registryRead(flag, company, env) {
478
478
  * The environment the hold flag is read under: the daemon's own, without
479
479
  * the flag's local override (`HQ_FLAG_<KEY>`). The sections are read by the
480
480
  * native merge gates of every session; each session applies its own override
481
- * in process, as its `hq lanes hold check` would. An override set only in the
481
+ * in process, as its `hq runners hold check` would. An override set only in the
482
482
  * daemon's environment must not be written as every company's registry value.
483
483
  */
484
484
  export function withoutLocalOverride(flag, env) {
@@ -73,7 +73,7 @@ export function parseRemoteControlPoolsConfig(value, knownAccountIds, home = os.
73
73
  throw new Error(`${prefix}.accountId is invalid`);
74
74
  }
75
75
  if (known && !known.has(raw.accountId))
76
- throw new Error(`${prefix}.accountId "${raw.accountId}" is not configured in hq lanes accounts`);
76
+ throw new Error(`${prefix}.accountId "${raw.accountId}" is not configured in hq runners accounts`);
77
77
  if (seenAccounts.has(raw.accountId))
78
78
  throw new Error(`duplicate accountId "${raw.accountId}"`);
79
79
  seenAccounts.add(raw.accountId);
@@ -9,6 +9,7 @@ import { acquirePackageUseLease } from "../../utils/package-use-lease.js";
9
9
  import { type PlanFleetBotsDeps } from "../bot/fleet-daemon.js";
10
10
  import { type FleetBotPlan, type LegacySyncHolder, type PlanContext, type ServiceName, type UnitPlan } from "./catalog.js";
11
11
  import { type LegacyHandover } from "./legacy-handover.js";
12
+ import { type LegacyJournalGate } from "./legacy-journal-gate.js";
12
13
  import { type SyncCoreVaultPlan } from "../sync-core/engine-home.js";
13
14
  import { type DaemonFlagRegistryRead, type DaemonFlagSnapshotSource } from "./flag.js";
14
15
  import { type LegacyUnit, type WindowsTaskOwner } from "./legacy.js";
@@ -24,7 +25,7 @@ export declare const LOG_ROTATE_BYTES: number;
24
25
  /** Exit code for "restart me": non-zero so every service manager relaunches (Windows tasks only restart on failure). */
25
26
  export declare const RESTART_EXIT_CODE = 75;
26
27
  export declare function syncCoreVaultPlans(home: string, hqRoot: string | undefined, platform: NodeJS.Platform): SyncCoreVaultPlan[];
27
- export declare function planUnitsWithSyncCoreInterlock(services: readonly ServiceName[], context: PlanContext, supervisor: Pick<Supervisor, "runningPlanKey" | "state"> | null | undefined, readOwnerStatus: () => WatchRunnerOwnerStatus | null, handover?: LegacyHandover, readSwitchOnTimes?: () => VaultSwitchOnTimes): UnitPlan[];
28
+ export declare function planUnitsWithSyncCoreInterlock(services: readonly ServiceName[], context: PlanContext, supervisor: Pick<Supervisor, "runningPlanKey" | "state"> | null | undefined, readOwnerStatus: () => WatchRunnerOwnerStatus | null, handover?: LegacyHandover, readSwitchOnTimes?: () => VaultSwitchOnTimes, journalGate?: LegacyJournalGate): UnitPlan[];
28
29
  export interface LegacyRestoreWait {
29
30
  what: string;
30
31
  /** When HQ turned the vault's old-sync switch back on. */
@@ -81,6 +82,7 @@ export declare function hqdListenerRuntimeAllowed(env: NodeJS.ProcessEnv, readSe
81
82
  export declare function handoffForPackageUpdateRequest(requested: boolean, restartDaemon: () => void): void;
82
83
  export interface RunDaemonOptions {
83
84
  legacyHandover?: LegacyHandover;
85
+ legacyJournalGate?: LegacyJournalGate;
84
86
  removeMeshUnitFromOtherHome?: typeof removeMeshUnitFromOtherHome;
85
87
  isLoginHome?: (home: string) => boolean;
86
88
  foreground?: boolean;
@@ -27,6 +27,7 @@ import { createHeldBotReconciler, heldBotThrottleDir } from "../bot/promotion-ho
27
27
  import { botsRoot } from "../bot/paths.js";
28
28
  import { CLAUDE_RUNNER_SCRIPT, CODEX_RUNNER_SCRIPT, enabledServices, planUnits, SEARCH_INDEX_WORKER_UNAVAILABLE, isLegacyRestartWait } from "./catalog.js";
29
29
  import { createLegacyHandover, LEGACY_HANDOVER_STUCK_FILE, writeLegacyHandoverStuck } from "./legacy-handover.js";
30
+ import { createLegacyJournalGate, legacyJournalExportWaitReason, runLegacyJournalExportChild } from "./legacy-journal-gate.js";
30
31
  import { effectiveSyncOwner, readDaemonConfig } from "./config.js";
31
32
  import { backgroundQosCommand } from "./background-qos.js";
32
33
  import { serveQmdWorker } from "../search-index/worker-process.js";
@@ -45,7 +46,8 @@ import { hqMembersList, startFleetMembersWarmer } from "./fleet-members-cache.js
45
46
  import { SUPERVISOR_HANDOFF_FLAG, readDaemonFlag } from "./flag.js";
46
47
  import { createDaemonSharedFlagReads, hqdListenerFlagGate } from "./shared-flag-reads.js";
47
48
  import { createDaemonKillSwitchMonitors } from "./timed-flag-monitors.js";
48
- import { MACHINE_CHECKS_RESULT_FILE, readMachineCheckResults, startMachineCheckSchedule } from "./machine-checks.js";
49
+ import { MACHINE_CHECKS_INTERVAL_MS, MACHINE_CHECKS_MIN_INTERVAL_MS, MACHINE_CHECKS_RESULT_FILE, readMachineCheckResults, startMachineCheckSchedule, } from "./machine-checks.js";
50
+ import { HOOK_ENGINE_ROLLUP_STATE_FILE, hookEngineRollupLogLine, runHookEngineRollup, } from "../../utils/hook-engine-rollup.js";
49
51
  import { createLanesReconcileWatcher } from "./lanes-reconcile-watcher.js";
50
52
  import { createLanesReconcileStatus, withLanesReconcileUnit } from "./lanes-reconcile-status.js";
51
53
  import { findLegacyUnits, legacyMeshUnitsToRetire, legacyOwnerLookup, } from "./legacy.js";
@@ -74,6 +76,7 @@ import { heartbeatFile, startHeartbeat } from "./heartbeat.js";
74
76
  import { daemonStartEnv } from "./hook-env.js";
75
77
  import { createProtocolTail, ensureProtocolFifo, openProtocolWriter } from "./protocol-tail.js";
76
78
  import { takeControlRequests, writeControlRequest } from "./requests.js";
79
+ import { createInstalledCliRestartCheck, installedCliVersionOnDisk } from "./installed-cli-restart.js";
77
80
  import { currentHqCloud, currentHqCloudAfterLeaseRelease, hqCloudRunners, hqCloudVersionOlder } from "./hq-cloud.js";
78
81
  import { stageSyncRunnerBundle } from "./sync-runner-bundle.js";
79
82
  import { stageHqChildBootstrap } from "./hq-child-bootstrap-stage.js";
@@ -118,7 +121,7 @@ export function syncCoreVaultPlans(home, hqRoot, platform) {
118
121
  });
119
122
  }
120
123
  const rememberedSyncCoreVaults = new Map();
121
- export function planUnitsWithSyncCoreInterlock(services, context, supervisor, readOwnerStatus, handover, readSwitchOnTimes = () => ({ companies: {} })) {
124
+ export function planUnitsWithSyncCoreInterlock(services, context, supervisor, readOwnerStatus, handover, readSwitchOnTimes = () => ({ companies: {} }), journalGate) {
122
125
  const companies = new Set();
123
126
  const runningVaults = new Set();
124
127
  let personal = false;
@@ -196,9 +199,20 @@ export function planUnitsWithSyncCoreInterlock(services, context, supervisor, re
196
199
  legacySyncReadyForCore,
197
200
  ...(holder !== undefined ? { legacySyncHolder: holder } : {}),
198
201
  };
202
+ const holdForJournal = (units) => journalGate
203
+ ? units.map((unit) => {
204
+ if (!unit.id.startsWith("sync-core:") || unit.blocked !== undefined)
205
+ return unit;
206
+ const uid = unit.id.slice("sync-core:".length);
207
+ const vault = context.syncCoreVaults?.find((v) => v.uid === uid);
208
+ if (!vault || runningVaults.has(uid) || !journalGate.pending(vault))
209
+ return unit;
210
+ return { ...unit, blocked: { state: "waiting", reason: legacyJournalExportWaitReason(`the ${vault.slug ?? uid} vault`) } };
211
+ })
212
+ : units;
199
213
  let plans = planUnits(services, planned);
200
214
  if (!handover)
201
- return plans;
215
+ return holdForJournal(plans);
202
216
  const vaultName = (uid) => {
203
217
  const vault = context.syncCoreVaults?.find((v) => v.uid === uid);
204
218
  return vault?.kind === "personal" ? "the personal vault" : `the ${vault?.slug ?? uid} vault`;
@@ -223,7 +237,7 @@ export function planUnitsWithSyncCoreInterlock(services, context, supervisor, re
223
237
  if (stopRequestedAt !== undefined && toEngine.length > 0) {
224
238
  plans = planUnits(services, { ...planned, legacyHandoverStopRequestedAt: stopRequestedAt });
225
239
  }
226
- return plans;
240
+ return holdForJournal(plans);
227
241
  }
228
242
  /**
229
243
  * Vaults whose old-sync switch HQ turned back on (a rollback, or a held engine)
@@ -878,6 +892,14 @@ export async function runDaemon(opts) {
878
892
  const cliPackagePrefix = opts.cliPackagePrefix === undefined
879
893
  ? currentPackageUseLeaseInstall()?.prefix ?? null
880
894
  : opts.cliPackagePrefix;
895
+ // A daemon older than the CLI on disk restarts onto it, even with the updater unit off.
896
+ const checkInstalledCli = createInstalledCliRestartCheck({
897
+ runningVersion: CLI_VERSION,
898
+ readInstalledVersion: () => installedCliVersionOnDisk(cliPackageRoot),
899
+ requestRestart: () => { writeControlRequest(paths.requestsDir, { action: "restart-daemon", deferUntilSyncIdle: true }); },
900
+ log,
901
+ markerPath: path.join(paths.root, "installed-cli-restart.json"),
902
+ });
881
903
  let stagedSyncBundle = null;
882
904
  let bundleStageChecked = false;
883
905
  let bundleStageFailed = false;
@@ -1101,6 +1123,13 @@ export async function runDaemon(opts) {
1101
1123
  writeRestoreStuck: (stuck) => writeLegacyHandoverStuck(path.join(paths.root, LEGACY_HANDOVER_STUCK_FILE), stuck),
1102
1124
  log: (level, message) => log(level, message),
1103
1125
  });
1126
+ const legacyJournalGate = opts.legacyJournalGate ?? createLegacyJournalGate({
1127
+ home,
1128
+ env,
1129
+ now: Date.now,
1130
+ run: runLegacyJournalExportChild(home, env, opts.nodeBinary),
1131
+ log: (level, message) => log(level, message),
1132
+ });
1104
1133
  const meshOwnerReason = () => {
1105
1134
  const lockPath = meshDaemonPidPath(meshDaemonDir(undefined, home, env));
1106
1135
  const owner = readPidLock(lockPath);
@@ -1176,7 +1205,7 @@ export async function runDaemon(opts) {
1176
1205
  ...selfCheckMachineChecks(readSelfCheckResult(path.join(paths.root, SELF_CHECK_RESULT_FILE))),
1177
1206
  ...readMachineCheckResults(path.join(paths.root, MACHINE_CHECKS_RESULT_FILE)),
1178
1207
  ],
1179
- // What `hq lanes monitor-check` would answer, so the UserPromptSubmit hook
1208
+ // What `hq runners monitor-check` would answer, so the UserPromptSubmit hook
1180
1209
  // starts no program. No configured, existing HQ root: no section.
1181
1210
  readLanesMonitor: () => {
1182
1211
  const configured = readDaemonConfig(paths.configPath).hqRoot ?? (env.HQ_ROOT?.trim() || undefined);
@@ -1251,6 +1280,7 @@ export async function runDaemon(opts) {
1251
1280
  const lanesReconcileFileWatchFlag = killSwitches.lanesReconcileFileWatch;
1252
1281
  const searchIndexRunnerOwnsIndexFlag = killSwitches.searchIndexRunnerOwnsIndex;
1253
1282
  const syncProcessScanOnMissingFlag = killSwitches.syncProcessScanOnMissing;
1283
+ let lastRollupStatus;
1254
1284
  const machineChecks = startMachineCheckSchedule({
1255
1285
  env,
1256
1286
  home,
@@ -1260,6 +1290,18 @@ export async function runDaemon(opts) {
1260
1290
  return configured && fs.existsSync(configured) ? configured : undefined;
1261
1291
  },
1262
1292
  resultsFile: path.join(paths.root, MACHINE_CHECKS_RESULT_FILE),
1293
+ rollup: async () => {
1294
+ const result = await runHookEngineRollup({
1295
+ home,
1296
+ env,
1297
+ stateFile: path.join(paths.root, HOOK_ENGINE_ROLLUP_STATE_FILE),
1298
+ maxConfirmGapMs: 2 * MACHINE_CHECKS_INTERVAL_MS + MACHINE_CHECKS_MIN_INTERVAL_MS,
1299
+ });
1300
+ const line = hookEngineRollupLogLine(result, lastRollupStatus);
1301
+ lastRollupStatus = result.status;
1302
+ if (line)
1303
+ log(line.level, line.message);
1304
+ },
1263
1305
  });
1264
1306
  let laneReconcileWatcher = null;
1265
1307
  let laneReconcileWatcherRoot = null;
@@ -1663,7 +1705,7 @@ export async function runDaemon(opts) {
1663
1705
  };
1664
1706
  const plans = planUnitsWithSyncCoreInterlock(services, context, supervisor, () => hqRoot
1665
1707
  ? readWatchRunnerOwnerStatus(watchRunnerOwnerStatusPath(hqRoot, home, env))
1666
- : null, legacyHandover, () => readVaultSwitchOnTimes(home));
1708
+ : null, legacyHandover, () => readVaultSwitchOnTimes(home), legacyJournalGate);
1667
1709
  if (startupPlanOpen) {
1668
1710
  const replaceablePackageRoots = cliPackageRoot ? [cliPackageRoot] : [];
1669
1711
  if (hqCloud?.source === "bundled")
@@ -1873,6 +1915,7 @@ export async function runDaemon(opts) {
1873
1915
  const n = rotateLogs(paths.logsDir);
1874
1916
  if (n > 0)
1875
1917
  log("info", `rotated ${n} log file(s)`);
1918
+ checkInstalledCli();
1876
1919
  return true;
1877
1920
  },
1878
1921
  takeRequests: () => {
@@ -18,7 +18,7 @@
18
18
  * - lanes_monitor (optional, written only when the daemon computed it): per
19
19
  * Claude senior session of an active lane, the active and uncovered lane
20
20
  * ids, the Monitor calls that would cover the uncovered ones, and the
21
- * reminder text (lanes-monitor-state.ts). It is what `hq lanes
21
+ * reminder text (lanes-monitor-state.ts). It is what `hq runners
22
22
  * monitor-check` would answer, precomputed so the UserPromptSubmit hook
23
23
  * starts no program. A missing or stale section means no reminder.
24
24
  * - merge_holds and merge_approvals (merge-sections.ts): the repository
@@ -18,7 +18,7 @@
18
18
  * - lanes_monitor (optional, written only when the daemon computed it): per
19
19
  * Claude senior session of an active lane, the active and uncovered lane
20
20
  * ids, the Monitor calls that would cover the uncovered ones, and the
21
- * reminder text (lanes-monitor-state.ts). It is what `hq lanes
21
+ * reminder text (lanes-monitor-state.ts). It is what `hq runners
22
22
  * monitor-check` would answer, precomputed so the UserPromptSubmit hook
23
23
  * starts no program. A missing or stale section means no reminder.
24
24
  * - merge_holds and merge_approvals (merge-sections.ts): the repository