@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,6 +1,6 @@
1
1
  import { readSessionCompanyLock } from "../lib/session-company-lock.js";
2
2
  /**
3
- * `hq lanes` — worker lane management and decision queue (spec §5–§7, §10–§11).
3
+ * `hq runners` — worker lane management and decision queue (spec §5–§7, §10–§11).
4
4
  *
5
5
  * Existing commands print JSON on stdout by default and take no interactive input, except
6
6
  * `accounts login`, which hands the terminal to the vendor's own sign-in.
@@ -257,7 +257,7 @@ const REMOTE_LANE_NOT_FOUND_GRACE_MS = 15 * 60_000;
257
257
  /** The lane → mesh seam. Defined in lib/lanes/mesh-events.ts; the watcher shares it. */
258
258
  export { emitLaneDecisionEvents };
259
259
  const monitorLaneMessageApis = new WeakMap();
260
- /** Build the same lane message handlers used by `hq lanes _monitor-message`, without a CLI process boundary. */
260
+ /** Build the same lane message handlers used by `hq runners _monitor-message`, without a CLI process boundary. */
261
261
  export function createMonitorLaneMessageApi(hqRoot, cwd, env = process.env) {
262
262
  const program = new Command();
263
263
  registerRunnersCommand(program, {
@@ -292,13 +292,13 @@ function failJson(err) {
292
292
  : err;
293
293
  if (isLanesError(commandError)) {
294
294
  if (commandError.error === "hire_grant_exhausted") {
295
- process.stderr.write(`hq lanes: ${commandError.message}\n`);
295
+ process.stderr.write(`hq runners: ${commandError.message}\n`);
296
296
  }
297
297
  printJson({ ...commandError.toJSON(), message: commandError.message });
298
298
  process.exit(["signal_not_found", "no_conductor_link"].includes(commandError.error) ? 2 : 1);
299
299
  }
300
300
  const message = commandError instanceof Error ? commandError.message : String(commandError);
301
- process.stderr.write(`hq lanes: ${message}${commandError instanceof Error && commandError.stack ? `\n${commandError.stack}` : ""}\n`);
301
+ process.stderr.write(`hq runners: ${message}${commandError instanceof Error && commandError.stack ? `\n${commandError.stack}` : ""}\n`);
302
302
  printJson({ error: "internal", message });
303
303
  process.exit(1);
304
304
  }
@@ -314,7 +314,7 @@ function wrap(action) {
314
314
  }
315
315
  function failText(err) {
316
316
  const message = err instanceof Error ? err.message : String(err);
317
- process.stderr.write(`hq lanes: ${message}\n`);
317
+ process.stderr.write(`hq runners: ${message}\n`);
318
318
  process.exit(MONITOR_ERROR_EXIT_CODE);
319
319
  }
320
320
  function wrapText(action) {
@@ -472,7 +472,7 @@ function derivedLaneWorkRequirements(ctx, hqRoot, lane) {
472
472
  }
473
473
  }
474
474
  /**
475
- * The derived requirements after hq lanes repair-company sets the lane's
475
+ * The derived requirements after hq runners repair-company sets the lane's
476
476
  * company. A declared document is left as it is.
477
477
  */
478
478
  function repairedWorkRequirements(current, company) {
@@ -599,7 +599,7 @@ function livenessDepsFromCtx(ctx) {
599
599
  * Start a lane that admission just let through. A queued loop lane is marked
600
600
  * running and gets its loop controller, which works through the queued phase
601
601
  * envelopes; every other lane spawns its worker directly. Every admission path
602
- * (reconcile, in-process queue drain, hq lanes admit) goes through here so a
602
+ * (reconcile, in-process queue drain, hq runners admit) goes through here so a
603
603
  * loop lane never runs its brief without a controller.
604
604
  *
605
605
  * A queued loop lane whose controller is still alive is a deferred phase: the
@@ -670,12 +670,12 @@ async function admitQueuedFromCtx(ctx) {
670
670
  env: ctx.env,
671
671
  });
672
672
  for (const error of result.errors) {
673
- process.stderr.write(`hq lanes: queue admission: ${error.message}\n`);
673
+ process.stderr.write(`hq runners: queue admission: ${error.message}\n`);
674
674
  }
675
675
  return result.admitted;
676
676
  }
677
677
  catch (err) {
678
- process.stderr.write(`hq lanes: queue admission failed: ${err instanceof Error ? err.message : String(err)}\n`);
678
+ process.stderr.write(`hq runners: queue admission failed: ${err instanceof Error ? err.message : String(err)}\n`);
679
679
  return [];
680
680
  }
681
681
  }
@@ -1049,7 +1049,7 @@ function ownerErrorFromOutput(stdout) {
1049
1049
  parsed = JSON.parse(trimmed);
1050
1050
  }
1051
1051
  catch {
1052
- process.stderr.write("hq lanes: Outpost lanes dispatch returned malformed JSON\n");
1052
+ process.stderr.write("hq runners: Outpost lanes dispatch returned malformed JSON\n");
1053
1053
  return undefined;
1054
1054
  }
1055
1055
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
@@ -1574,7 +1574,7 @@ function subagentLaneHost(ctx) {
1574
1574
  const reason = unusable(err);
1575
1575
  if (reason === null)
1576
1576
  throw err;
1577
- process.stderr.write(`hq lanes: could not use ${file} (${reason}); recording a host id that can be read\n`);
1577
+ process.stderr.write(`hq runners: could not use ${file} (${reason}); recording a host id that can be read\n`);
1578
1578
  if (reason === "host_identity_corrupt")
1579
1579
  return { kind: "local", id: hostname };
1580
1580
  }
@@ -1585,7 +1585,7 @@ function subagentLaneHost(ctx) {
1585
1585
  const reason = unusable(err);
1586
1586
  if (reason === null)
1587
1587
  throw err;
1588
- process.stderr.write(`hq lanes: could not read ${file} (${reason}); recording the hostname\n`);
1588
+ process.stderr.write(`hq runners: could not read ${file} (${reason}); recording the hostname\n`);
1589
1589
  return { kind: "local", id: hostname };
1590
1590
  }
1591
1591
  }
@@ -1768,7 +1768,7 @@ async function loadHostCapacitySnapshots(ctx, hqRoot, config = loadLanesConfig(h
1768
1768
  }
1769
1769
  const outpostLaneListMemo = new WeakMap();
1770
1770
  const MAX_OUTPOST_LANE_LIST_BYTES = 480 * 1024;
1771
- /** Tails `hq lanes logs` retries with when an Outpost's full logs are clipped. */
1771
+ /** Tails `hq runners logs` retries with when an Outpost's full logs are clipped. */
1772
1772
  const REMOTE_LOGS_FALLBACK_TAILS = [200, 20];
1773
1773
  /** Whether an Outpost exec result hit the inline output limit and was clipped. */
1774
1774
  function outpostExecOutputClipped(result) {
@@ -2026,7 +2026,7 @@ async function refreshRemoteLaneMirrors(ctx, hqRoot, records, parentLaneIds, opt
2026
2026
  for (const lane of overflow) {
2027
2027
  result.unverifiedRemote.set(lane.lane_id, "refresh_batch_limit");
2028
2028
  }
2029
- process.stderr.write(`hq lanes: unverified remote mirrors from Outpost ${outpostId} remain counted; refresh batch limit left lanes ${ids.join(", ")} unread\n`);
2029
+ process.stderr.write(`hq runners: unverified remote mirrors from Outpost ${outpostId} remain counted; refresh batch limit left lanes ${ids.join(", ")} unread\n`);
2030
2030
  }
2031
2031
  let ownerRecords;
2032
2032
  try {
@@ -2043,7 +2043,7 @@ async function refreshRemoteLaneMirrors(ctx, hqRoot, records, parentLaneIds, opt
2043
2043
  : dispatchErrorMessage(error);
2044
2044
  for (const lane of batch)
2045
2045
  result.unverifiedRemote.set(lane.lane_id, detail);
2046
- process.stderr.write(`hq lanes: unverified remote mirrors from Outpost ${outpostId} remain counted: ${detail}; lanes ${batch.map((lane) => lane.lane_id).join(", ")}\n`);
2046
+ process.stderr.write(`hq runners: unverified remote mirrors from Outpost ${outpostId} remain counted: ${detail}; lanes ${batch.map((lane) => lane.lane_id).join(", ")}\n`);
2047
2047
  continue;
2048
2048
  }
2049
2049
  for (const mirror of batch) {
@@ -2083,7 +2083,7 @@ async function refreshRemoteLaneMirrors(ctx, hqRoot, records, parentLaneIds, opt
2083
2083
  ? "owner returned duplicate lane rows"
2084
2084
  : "owner lane identity did not match its mirror";
2085
2085
  result.unverifiedRemote.set(mirror.lane_id, detail);
2086
- process.stderr.write(`hq lanes: unverified remote mirror ${mirror.lane_id} from Outpost ${outpostId} remains counted: ${detail}\n`);
2086
+ process.stderr.write(`hq runners: unverified remote mirror ${mirror.lane_id} from Outpost ${outpostId} remains counted: ${detail}\n`);
2087
2087
  continue;
2088
2088
  }
2089
2089
  const endedAt = isTerminalLaneState(owner.state)
@@ -2575,7 +2575,7 @@ function loadSessionMeta(hqRoot, sessionId, ctx) {
2575
2575
  text = ctx.readFileSync(filePath, "utf8");
2576
2576
  }
2577
2577
  catch (err) {
2578
- process.stderr.write(`hq lanes: failed to read session meta ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
2578
+ process.stderr.write(`hq runners: failed to read session meta ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
2579
2579
  return { status: "unreadable" };
2580
2580
  }
2581
2581
  let doc;
@@ -2583,7 +2583,7 @@ function loadSessionMeta(hqRoot, sessionId, ctx) {
2583
2583
  doc = parseUserYaml(text, filePath);
2584
2584
  }
2585
2585
  catch (err) {
2586
- process.stderr.write(`hq lanes: failed to parse session meta ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
2586
+ process.stderr.write(`hq runners: failed to parse session meta ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
2587
2587
  return { status: "malformed" };
2588
2588
  }
2589
2589
  if (!isSessionMetaDocument(doc)) {
@@ -2642,7 +2642,7 @@ function seniorExists(hqRoot, ref, ctx) {
2642
2642
  return index.sessions[ref.id] !== undefined;
2643
2643
  }
2644
2644
  catch (err) {
2645
- process.stderr.write(`hq lanes: liveness index read failed while checking session ${ref.id}: ${err instanceof Error ? err.message : String(err)}\n`);
2645
+ process.stderr.write(`hq runners: liveness index read failed while checking session ${ref.id}: ${err instanceof Error ? err.message : String(err)}\n`);
2646
2646
  throw err;
2647
2647
  }
2648
2648
  }
@@ -3194,7 +3194,7 @@ function assertKnownOutpost(requested, known) {
3194
3194
  }
3195
3195
  }
3196
3196
  /**
3197
- * Spec §5.1: `hq lanes ask` from inside a lane can hit a binary or dist
3197
+ * Spec §5.1: `hq runners ask` from inside a lane can hit a binary or dist
3198
3198
  * being replaced mid-call (ENOENT / ETXTBSY / a module that no longer
3199
3199
  * resolves) or a record written by a newer CLI. Three attempts, waits of
3200
3200
  * 5 s then 15 s, 20 s of backoff in total, inside the 30 s bound.
@@ -3420,7 +3420,7 @@ async function emitLaneTerminalStateSoft(ctx, lane) {
3420
3420
  await emitLaneTerminalStateEvent(ctx.mesh, lane, lane.state, lane.terminal_reason, AbortSignal.timeout(10_000));
3421
3421
  }
3422
3422
  catch (err) {
3423
- process.stderr.write(`hq lanes: terminal mesh update failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
3423
+ process.stderr.write(`hq runners: terminal mesh update failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
3424
3424
  }
3425
3425
  }
3426
3426
  /**
@@ -3450,7 +3450,7 @@ async function emitLaneStartedForStories(ctx, company, lane, threadId, knownAbse
3450
3450
  const prefix = `Lane ${lane.lane_id} is RUNNING (do not re-run create).`;
3451
3451
  const warnings = [];
3452
3452
  const fail = (text) => {
3453
- process.stderr.write(`hq lanes: ${prefix} ${text}\n`);
3453
+ process.stderr.write(`hq runners: ${prefix} ${text}\n`);
3454
3454
  warnings.push(`${prefix} ${text}`);
3455
3455
  };
3456
3456
  const storyFix = (story) => `hq mesh story --company ${company.slug} --project ${story.project_id} --story ${story.story_id} --status in_progress`;
@@ -5361,8 +5361,8 @@ async function dispatchCreatedOutpostLane(ctx, input) {
5361
5361
  // The pickup exec was submitted, but the wait for its result ended (a
5362
5362
  // timeout or a failed poll). The Outpost may already run the lane, so this
5363
5363
  // is an unknown outcome, not a failed dispatch. Writing `failed` here made
5364
- // `hq lanes watch` report a running Outpost lane as terminal while
5365
- // `hq lanes show` read it running from its owner (feedback_b929c4a8).
5364
+ // `hq runners watch` report a running Outpost lane as terminal while
5365
+ // `hq runners show` read it running from its owner (feedback_b929c4a8).
5366
5366
  if (isLanesError(err) &&
5367
5367
  err.error === DISPATCH_TERMINAL_REASON &&
5368
5368
  err.details.outcome_unknown === true &&
@@ -5418,10 +5418,10 @@ function parseRemoteJson(stdout, surface) {
5418
5418
  if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
5419
5419
  return parsed;
5420
5420
  }
5421
- process.stderr.write(`hq lanes: ${surface} stdout is not a JSON object\n`);
5421
+ process.stderr.write(`hq runners: ${surface} stdout is not a JSON object\n`);
5422
5422
  }
5423
5423
  catch (err) {
5424
- process.stderr.write(`hq lanes: failed to parse ${surface} JSON: ${err instanceof Error ? err.message : String(err)}\n`);
5424
+ process.stderr.write(`hq runners: failed to parse ${surface} JSON: ${err instanceof Error ? err.message : String(err)}\n`);
5425
5425
  return null;
5426
5426
  }
5427
5427
  return null;
@@ -6438,7 +6438,7 @@ async function laneStatusFieldsForCommand(ctx, hqRoot, lane, now) {
6438
6438
  });
6439
6439
  }
6440
6440
  catch (err) {
6441
- process.stderr.write(`hq lanes: status row fields flag read failed open: ${err instanceof Error ? err.message : String(err)}\n`);
6441
+ process.stderr.write(`hq runners: status row fields flag read failed open: ${err instanceof Error ? err.message : String(err)}\n`);
6442
6442
  }
6443
6443
  if (!enabled)
6444
6444
  return {};
@@ -7011,7 +7011,7 @@ async function refreshOutpostLaneCopiesForShow(ctx, lane, localLanes) {
7011
7011
  const detail = isLanesError(err)
7012
7012
  ? `${err.error}: ${err.message}`
7013
7013
  : `outpost_lane_sync_unavailable: ${dispatchErrorMessage(err)}`;
7014
- process.stderr.write(`hq lanes: owner snapshot refresh failed for lane ${laneId}: ${detail}\n`);
7014
+ process.stderr.write(`hq runners: owner snapshot refresh failed for lane ${laneId}: ${detail}\n`);
7015
7015
  return null;
7016
7016
  }
7017
7017
  };
@@ -7062,7 +7062,7 @@ async function runShow(ctx, laneId, hasPendingQuestionForLane, resolveLaneTarget
7062
7062
  catch (err) {
7063
7063
  managerStatusGateError = err instanceof LanesError ? err.error : "manager_status_gate_unavailable";
7064
7064
  const message = err instanceof Error ? err.message : String(err);
7065
- process.stderr.write(`hq lanes: manager status gate disabled for ${storedLane.lane_id}: ${managerStatusGateError}: ${message}\n`);
7065
+ process.stderr.write(`hq runners: manager status gate disabled for ${storedLane.lane_id}: ${managerStatusGateError}: ${message}\n`);
7066
7066
  }
7067
7067
  const blockerFreshness = await resolveBlockerFreshnessForLane(hqRoot, storedLane, {
7068
7068
  env: ctx.env,
@@ -7086,7 +7086,7 @@ async function runShow(ctx, laneId, hasPendingQuestionForLane, resolveLaneTarget
7086
7086
  ? listLaneReviews(hqRoot, laneId)
7087
7087
  : { reviews: [], skipped: 0 };
7088
7088
  if (reviewListing.skipped > 0) {
7089
- console.error(`hq lanes show: skipped ${reviewListing.skipped} invalid or unreadable review item(s)`);
7089
+ console.error(`hq runners show: skipped ${reviewListing.skipped} invalid or unreadable review item(s)`);
7090
7090
  }
7091
7091
  const recentReviews = reviewListing.reviews
7092
7092
  .filter((item) => {
@@ -7402,13 +7402,13 @@ async function printGrantResult(ctx, hqRoot, updated, hierarchy) {
7402
7402
  });
7403
7403
  }
7404
7404
  /**
7405
- * `hq lanes set`: change the model or effort a lane uses from its next
7405
+ * `hq runners set`: change the model or effort a lane uses from its next
7406
7406
  * resume. The running turn keeps its values. Both are stored as explicit
7407
- * (`cli`) choices, so keep-alive and `hq lanes resume` keep them until the
7407
+ * (`cli`) choices, so keep-alive and `hq runners resume` keep them until the
7408
7408
  * next `set` or an explicit resume `--effort`/`--worker`.
7409
7409
  *
7410
7410
  * A lane whose state lives on another Outpost is resolved the same way
7411
- * `hq lanes grant` resolves it, and the change is forwarded to the owning
7411
+ * `hq runners grant` resolves it, and the change is forwarded to the owning
7412
7412
  * Outpost after the caller is checked against the owner's senior.
7413
7413
  */
7414
7414
  async function runSet(ctx, laneId, opts) {
@@ -7451,7 +7451,7 @@ async function runSet(ctx, laneId, opts) {
7451
7451
  printLaneSetResult(updated);
7452
7452
  }
7453
7453
  /**
7454
- * Owner side of a forwarded `hq lanes set`. The primary has already checked
7454
+ * Owner side of a forwarded `hq runners set`. The primary has already checked
7455
7455
  * the caller against the lane's senior; this side accepts only an SSM Run
7456
7456
  * Command dispatch for a lane hosted here whose senior is still the one the
7457
7457
  * primary checked.
@@ -9320,7 +9320,7 @@ async function runLogs(ctx, laneId, opts) {
9320
9320
  throw new LanesError("outpost_lane_logs_invalid", `Outpost ${outpostId} returned a malformed logs payload for lane ${laneId}`, { lane_id: laneId, outpost_id: outpostId });
9321
9321
  }
9322
9322
  if (tail === undefined && appliedTail !== undefined) {
9323
- process.stderr.write(`hq lanes: full logs for lane ${laneId} exceed the Outpost exec output limit; showing the last ${appliedTail} lines of each stream\n`);
9323
+ process.stderr.write(`hq runners: full logs for lane ${laneId} exceed the Outpost exec output limit; showing the last ${appliedTail} lines of each stream\n`);
9324
9324
  printJson({ ...body, tail_applied: appliedTail });
9325
9325
  return;
9326
9326
  }
@@ -9754,7 +9754,7 @@ async function dispatchOutpostLaneStop(ctx, lane, reason, quiet = false, behavio
9754
9754
  * same attribution as a process lane (company, project, story, worker, brief,
9755
9755
  * senior, model) so it shows on the lanes board, but admission and capacity
9756
9756
  * are skipped and no provider process or watcher starts. The lane is
9757
- * `running` from creation; `hq lanes progress` reports lines and the result.
9757
+ * `running` from creation; `hq runners progress` reports lines and the result.
9758
9758
  */
9759
9759
  async function runCreateSubagent(ctx, opts) {
9760
9760
  const unsupported = [
@@ -9942,7 +9942,7 @@ async function runCreateSubagent(ctx, opts) {
9942
9942
  });
9943
9943
  return lane;
9944
9944
  }
9945
- /** Longest progress line kept; `hq lanes list` clips its last line further. */
9945
+ /** Longest progress line kept; `hq runners list` clips its last line further. */
9946
9946
  const SUBAGENT_PROGRESS_LINE_MAX = 500;
9947
9947
  /**
9948
9948
  * Report on a subagent lane: append a progress line, record the final
@@ -10141,12 +10141,12 @@ async function runStop(ctx, laneId, reason, quiet = false) {
10141
10141
  }
10142
10142
  /** Stderr notice that `stop` ends a lane for good, naming the resumable path. */
10143
10143
  function stopTerminalWarning(laneId) {
10144
- return `hq lanes: warning: stop kills lane ${laneId} and it cannot be resumed. ` +
10144
+ return `hq runners: warning: stop kills lane ${laneId} and it cannot be resumed. ` +
10145
10145
  `To pause it and keep it resumable, use hq runners interrupt ${laneId}.\n`;
10146
10146
  }
10147
10147
  /**
10148
10148
  * Stop a running lane's worker and leave it `interrupted`, keeping the provider
10149
- * session so `hq lanes resume` continues it. Keep-alive resumes only
10149
+ * session so `hq runners resume` continues it. Keep-alive resumes only
10150
10150
  * `exited_with_partial_output` interruptions, so it leaves this lane alone.
10151
10151
  */
10152
10152
  /** Stop-history text for an operator interrupt given without --reason. */
@@ -10154,7 +10154,7 @@ function defaultOperatorInterruptReason(ctx) {
10154
10154
  const sessionId = sessionIdFromEnv(ctx.env);
10155
10155
  const laneId = ctx.env.HQ_LANE_ID?.trim();
10156
10156
  const caller = laneId ? ` by lane ${laneId}` : sessionId ? ` by session ${sessionId}` : "";
10157
- return `hq lanes interrupt${caller} (no reason given)`;
10157
+ return `hq runners interrupt${caller} (no reason given)`;
10158
10158
  }
10159
10159
  async function runInterrupt(ctx, laneId, reason, options = {}) {
10160
10160
  const operatorReason = reason?.trim();
@@ -10267,7 +10267,7 @@ function persistInterruptedSession(hqRoot, lane) {
10267
10267
  sessionId = readWorkerRunResult(runDir, lane.provider, readSpawnManifest(runDir).worker_out_offset ?? 0)?.session_id ?? null;
10268
10268
  }
10269
10269
  catch (err) {
10270
- process.stderr.write(`hq lanes: could not read the session id of interrupted lane ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
10270
+ process.stderr.write(`hq runners: could not read the session id of interrupted lane ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
10271
10271
  }
10272
10272
  if (sessionId === null || sessionId === lane.provider_session_id)
10273
10273
  return lane;
@@ -10277,7 +10277,7 @@ function persistInterruptedSession(hqRoot, lane) {
10277
10277
  }
10278
10278
  /** Stderr notice when an interrupted lane has no session to resume from. */
10279
10279
  function interruptNotResumableWarning(laneId) {
10280
- return `hq lanes: warning: lane ${laneId} was interrupted before its provider reported a session id, ` +
10280
+ return `hq runners: warning: lane ${laneId} was interrupted before its provider reported a session id, ` +
10281
10281
  `so hq runners resume cannot continue it. Start a new lane for the remaining work.\n`;
10282
10282
  }
10283
10283
  function parseQuestionPriority(value) {
@@ -10351,7 +10351,7 @@ async function runAsk(ctx, opts) {
10351
10351
  });
10352
10352
  }
10353
10353
  if (priority === undefined) {
10354
- process.stderr.write(`hq lanes ask: warning: ${ASK_PRIORITY_WARNING}\n`);
10354
+ process.stderr.write(`hq runners ask: warning: ${ASK_PRIORITY_WARNING}\n`);
10355
10355
  }
10356
10356
  printJson({
10357
10357
  ok: true,
@@ -10367,7 +10367,7 @@ async function runAsk(ctx, opts) {
10367
10367
  if (isLanesError(err) && err.error === "secret_text_refused")
10368
10368
  throw err;
10369
10369
  lastErr = err;
10370
- process.stderr.write(`hq lanes ask: attempt ${i + 1}/${attempts} failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
10370
+ process.stderr.write(`hq runners ask: attempt ${i + 1}/${attempts} failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
10371
10371
  if (i === attempts - 1)
10372
10372
  break;
10373
10373
  await ctx.sleep(ASK_BACKOFF_MS[i] ?? ASK_BACKOFF_MS[ASK_BACKOFF_MS.length - 1]);
@@ -10386,7 +10386,7 @@ async function runAsk(ctx, opts) {
10386
10386
  writeJsonFile(askDeliveryFailedPath(hqRoot, lane.lane_id), failure);
10387
10387
  }
10388
10388
  catch (writeErr) {
10389
- process.stderr.write(`hq lanes: failed to write ask_delivery_failed for ${lane.lane_id}: ${writeErr instanceof Error ? writeErr.message : String(writeErr)}\n`);
10389
+ process.stderr.write(`hq runners: failed to write ask_delivery_failed for ${lane.lane_id}: ${writeErr instanceof Error ? writeErr.message : String(writeErr)}\n`);
10390
10390
  }
10391
10391
  throw new LanesError("ask_delivery_failed", `Failed to deliver ask for lane ${lane.lane_id}`, {
10392
10392
  lane_id: lane.lane_id,
@@ -10519,7 +10519,7 @@ function writeAnswerDeliveryFailed(hqRoot, laneId, questionId, err, at) {
10519
10519
  writeJsonFile(askDeliveryFailedPath(hqRoot, laneId), failure);
10520
10520
  }
10521
10521
  catch (writeErr) {
10522
- process.stderr.write(`hq lanes: failed to write ask_delivery_failed for ${laneId}: ${writeErr instanceof Error ? writeErr.message : String(writeErr)}\n`);
10522
+ process.stderr.write(`hq runners: failed to write ask_delivery_failed for ${laneId}: ${writeErr instanceof Error ? writeErr.message : String(writeErr)}\n`);
10523
10523
  }
10524
10524
  }
10525
10525
  /**
@@ -10776,17 +10776,17 @@ async function runReconcile(ctx, opts, recoverQueuedMessages) {
10776
10776
  if (isNonInteractiveLoginError(error)) {
10777
10777
  // Signed out: there is no Outpost list to read and nothing to sync.
10778
10778
  // The daemon already reports this unit as waiting for sign-in, so the
10779
- // pass records a note and stays healthy instead of failing every 15 s.
10779
+ // pass records a note and stays healthy instead of failing every pass.
10780
10780
  summary.notes ??= [];
10781
10781
  summary.notes.push("Lead autopilot registry sync skipped: not signed in");
10782
- process.stderr.write("hq lanes autopilot registry: note: skipped, not signed in\n");
10782
+ process.stderr.write("hq runners autopilot registry: note: skipped, not signed in\n");
10783
10783
  }
10784
10784
  else {
10785
10785
  const code = error instanceof LanesError ? error.error : "lead_autopilot_registry_sync_failed";
10786
10786
  const message = error instanceof Error ? error.message : String(error);
10787
10787
  summary.ok = false;
10788
10788
  summary.errors.push({ code, message });
10789
- process.stderr.write(`hq lanes autopilot registry: ${message}\n`);
10789
+ process.stderr.write(`hq runners autopilot registry: ${message}\n`);
10790
10790
  }
10791
10791
  }
10792
10792
  }
@@ -10809,7 +10809,7 @@ async function runReconcile(ctx, opts, recoverQueuedMessages) {
10809
10809
  const message = error instanceof Error ? error.message : String(error);
10810
10810
  summary.ok = false;
10811
10811
  summary.errors.push({ code: error instanceof LanesError ? error.error : "lead_autopilot_failed", message });
10812
- process.stderr.write(`hq lanes autopilot: ${message}\n`);
10812
+ process.stderr.write(`hq runners autopilot: ${message}\n`);
10813
10813
  }
10814
10814
  if (!opts.inProcess) {
10815
10815
  printJson({
@@ -76,6 +76,31 @@ export declare function sessionEventGoesToSpool(kind: SessionEventKind, enqueue:
76
76
  export declare function registerMeshCommand(program: Command, deps?: {
77
77
  defaultCompanyPrompt?: DefaultCompanyPromptDeps;
78
78
  }): void;
79
+ /** What the duplicate user unit check before the pid lock tells the start path. */
80
+ export interface DuplicateUnitCheck {
81
+ /** This process belongs to the user unit that was just removed: exit instead of starting. */
82
+ exitAfter?: boolean;
83
+ /** This process belongs to the system unit: remove the user unit only after holding the pid lock. */
84
+ removeAfterLock?: boolean;
85
+ }
86
+ export interface DuplicateUnitStartHooks {
87
+ /** Check before the pid lock (tests inject; default reconcileDuplicateMeshUnit on Linux). */
88
+ reconcile?: () => Promise<DuplicateUnitCheck>;
89
+ /** Removal once the pid lock is held (tests inject; default removeDuplicateUserUnitOnceSettled). */
90
+ onLockHeld?: (lockDir: string) => Promise<unknown>;
91
+ }
92
+ /**
93
+ * Start the Work Mesh daemon with the Linux duplicate user unit check around
94
+ * it (boxes that run Work Mesh from /etc/systemd/system/hq-mesh-daemon.service
95
+ * and also carry a per-user unit). Returns null when this process belongs to
96
+ * the removed user unit and must exit. A process of the system unit removes
97
+ * the user unit only after `start` has taken the pid lock; when another live
98
+ * daemon holds the lock, `start` throws as before and nothing is removed.
99
+ * The check itself never throws and never stops the daemon from starting.
100
+ */
101
+ export declare function startMeshDaemonWithDuplicateCheck<T extends {
102
+ dir: string;
103
+ }>(start: () => Promise<T>, hooks?: DuplicateUnitStartHooks): Promise<T | null>;
79
104
  /**
80
105
  * The resident Work Mesh loop. `hq daemon` runs it as its `mesh` service
81
106
  * (`hq daemon service mesh`); `hq mesh daemon run`, which older standalone
@@ -1,4 +1,4 @@
1
- import { reportingRuntimeAllowed } from "../lib/mesh/live/reporting-privacy.js";
1
+ import { reportingRuntimeState } from "../lib/mesh/live/reporting-privacy.js";
2
2
  /**
3
3
  * `hq mesh` — work-mesh verbs for agents and local sessions.
4
4
  *
@@ -1154,9 +1154,10 @@ async function runPrdSync(opts) {
1154
1154
  // Asked once. With HQ Anywhere off the events of a session with a verified
1155
1155
  // company binding are still sent (emitEvents); the story claim below is a
1156
1156
  // Board write on the person's behalf and stays off.
1157
- const reportingOn = await reportingRuntimeAllowed(isMachineIdentity());
1157
+ const reporting = await reportingRuntimeState(isMachineIdentity());
1158
+ const reportingOn = reporting === "on";
1158
1159
  const emitted = await emitEvents({
1159
- reportingAllowed: async () => reportingOn,
1160
+ reportingState: async () => reporting,
1160
1161
  workMeshRoot: meshRoot,
1161
1162
  poster,
1162
1163
  newEvents: events,
@@ -2665,7 +2666,7 @@ async function runSessionEnqueue(cliKind, opts) {
2665
2666
  baseUrl: resolveVaultApiBase(process.env),
2666
2667
  });
2667
2668
  const summary = await emitEvents({
2668
- reportingAllowed: () => reportingRuntimeAllowed(isMachineIdentity()),
2669
+ reportingState: () => reportingRuntimeState(isMachineIdentity()),
2669
2670
  workMeshRoot: meshRoot,
2670
2671
  poster,
2671
2672
  newEvents: [event],
@@ -2751,7 +2752,7 @@ async function runMeshEmit(opts) {
2751
2752
  skipped = backlog.skipped;
2752
2753
  newEvents = backlog.events;
2753
2754
  }
2754
- const summary = await emitEvents({ reportingAllowed: () => reportingRuntimeAllowed(isMachineIdentity()), workMeshRoot: meshRoot, poster, newEvents });
2755
+ const summary = await emitEvents({ reportingState: () => reportingRuntimeState(isMachineIdentity()), workMeshRoot: meshRoot, poster, newEvents });
2755
2756
  const out = {
2756
2757
  ok: true,
2757
2758
  action: "emit",
@@ -2779,7 +2780,7 @@ async function runSessionFlush(opts) {
2779
2780
  // In direct mode this is one drain cycle: the first run on a machine moves
2780
2781
  // the queued files aside and posts nothing (US-038, owner decision 70).
2781
2782
  const { summary, firstRun, setAside } = await flushForEmitMode(resolveMeshEmitMode(), {
2782
- reportingAllowed: () => reportingRuntimeAllowed(isMachineIdentity()),
2783
+ reportingState: () => reportingRuntimeState(isMachineIdentity()),
2783
2784
  workMeshRoot: workMeshHomeRoot(),
2784
2785
  workContextRoot: workContextHomeRoot(),
2785
2786
  poster,
@@ -3234,6 +3235,43 @@ async function runMeshPushStatus(opts) {
3234
3235
  if (status.status === "stale")
3235
3236
  process.exitCode = 1;
3236
3237
  }
3238
+ /**
3239
+ * Start the Work Mesh daemon with the Linux duplicate user unit check around
3240
+ * it (boxes that run Work Mesh from /etc/systemd/system/hq-mesh-daemon.service
3241
+ * and also carry a per-user unit). Returns null when this process belongs to
3242
+ * the removed user unit and must exit. A process of the system unit removes
3243
+ * the user unit only after `start` has taken the pid lock; when another live
3244
+ * daemon holds the lock, `start` throws as before and nothing is removed.
3245
+ * The check itself never throws and never stops the daemon from starting.
3246
+ */
3247
+ export async function startMeshDaemonWithDuplicateCheck(start, hooks = {}) {
3248
+ let check = {};
3249
+ if (hooks.reconcile || process.platform === "linux") {
3250
+ try {
3251
+ const reconcile = hooks.reconcile ?? (async () => {
3252
+ const { reconcileDuplicateMeshUnit } = await import("../lib/mesh/live/daemon/duplicate-unit.js");
3253
+ return reconcileDuplicateMeshUnit();
3254
+ });
3255
+ check = await reconcile();
3256
+ }
3257
+ catch (err) {
3258
+ console.error(`hq mesh daemon: duplicate unit check failed: ${err instanceof Error ? err.message : String(err)}`);
3259
+ }
3260
+ }
3261
+ if (check.exitAfter === true)
3262
+ return null;
3263
+ const handle = await start();
3264
+ if (check.removeAfterLock === true) {
3265
+ const onLockHeld = hooks.onLockHeld ?? (async (lockDir) => {
3266
+ const { removeDuplicateUserUnitOnceSettled } = await import("../lib/mesh/live/daemon/duplicate-unit.js");
3267
+ return removeDuplicateUserUnitOnceSettled({ lockDir });
3268
+ });
3269
+ void onLockHeld(handle.dir).catch((err) => {
3270
+ console.error(`hq mesh daemon: duplicate unit removal failed: ${err instanceof Error ? err.message : String(err)}`);
3271
+ });
3272
+ }
3273
+ return handle;
3274
+ }
3237
3275
  /**
3238
3276
  * The resident Work Mesh loop. `hq daemon` runs it as its `mesh` service
3239
3277
  * (`hq daemon service mesh`); `hq mesh daemon run`, which older standalone
@@ -3245,10 +3283,12 @@ export async function runMeshDaemonService(opts = {}) {
3245
3283
  async function runDaemonRun(opts = {}) {
3246
3284
  const { runMeshDaemon } = await import("../lib/mesh/live/daemon/run.js");
3247
3285
  const hqRoot = opts.hqRoot?.trim() || undefined;
3248
- const handle = await runMeshDaemon({
3286
+ const handle = await startMeshDaemonWithDuplicateCheck(() => runMeshDaemon({
3249
3287
  ...(hqRoot ? { hqRoot } : {}),
3250
3288
  enableWorkCache: true,
3251
- });
3289
+ }));
3290
+ if (!handle)
3291
+ return;
3252
3292
  // Stay alive until signal handlers call stop + exit.
3253
3293
  await new Promise(() => {
3254
3294
  void handle;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * `hq ontology ...`: the ontology graph (sourced facts, typed edges, replay
3
+ * rebuild). This file only parses flags, resolves the company and graph
4
+ * folder, and prints. Each subcommand calls one entry point of a package under
5
+ * src/lib/ontology-graph/ (see CONTRACT.md there), imported on demand so a
6
+ * read command never loads the replay engine.
7
+ *
8
+ * hq ontology rebuild --company <slug> [--from D --to D] [--resume] [--budget-tokens N] [--no-model] [--dry-run]
9
+ * hq ontology update --company <slug> [--input <path>] [--budget-tokens N] [--no-model]
10
+ * hq ontology lookup <name> [--page] | neighbors <id> [--depth N] | search <text> | traverse <from> [<to>]
11
+ * hq ontology lint [--strict] [--coverage] | proposals list|accept|nope|undo [--set <name>] | brief
12
+ * hq ontology org-chart draft | confirm --from <file> [--yes] | show
13
+ * hq ontology activity [<person>] [--roles] [--compare] [--write] [--view company|member] [--as-of D] [--model]
14
+ * (`hq ontology org observed|compare|person <name>` is the same thing under its first name, kept hidden)
15
+ * hq ontology daily | job install|uninstall|status
16
+ *
17
+ * No identity flag is needed (correction C5). Without `--member` the read
18
+ * commands and the brief take the member signed in to the CLI, and the
19
+ * audience keys are the `facts/@<key>` folders the member's graph holds.
20
+ * `rebuild`, `update`, `daily` and the proposals commands find the signed-in
21
+ * member in their own packages.
22
+ *
23
+ * The graph lives in `companies/<slug>/.hq/ontology-graph/` (a `.hq` folder is
24
+ * ignored by sync and by git), is local to this machine and is never uploaded.
25
+ * `--graph-root` or HQ_ONTOLOGY_GRAPH_ROOT points it elsewhere. `hq core ontology` (the checkpoint steps over
26
+ * the old `ontology/entities/` folder) is a different command and is unchanged.
27
+ */
28
+ import { Command } from "commander";
29
+ import type { GraphContext, MemberIdentity } from "../lib/ontology-graph/types.js";
30
+ export declare class OntologyGraphUsageError extends Error {
31
+ constructor(message: string);
32
+ }
33
+ interface ScopeOptions {
34
+ company?: string;
35
+ hqRoot?: string;
36
+ graphRoot?: string;
37
+ member?: string;
38
+ audienceKey?: string[];
39
+ json?: boolean;
40
+ }
41
+ /** Environment variables for the member identity (correction C2). */
42
+ export declare const MEMBER_ENV = "HQ_ONTOLOGY_MEMBER";
43
+ export declare const MEMBER_AUDIENCE_KEYS_ENV = "HQ_ONTOLOGY_AUDIENCE_KEYS";
44
+ /**
45
+ * The member a run is for: `--member <person uid>` (else HQ_ONTOLOGY_MEMBER)
46
+ * and the audience keys the member holds from repeated `--audience-key` (else
47
+ * the comma-separated HQ_ONTOLOGY_AUDIENCE_KEYS). Undefined when no member is
48
+ * given; readers then read company scope only or refuse.
49
+ */
50
+ export declare function resolveMemberIdentity(options: Pick<ScopeOptions, "member" | "audienceKey">, env?: NodeJS.ProcessEnv): MemberIdentity | undefined;
51
+ export interface OntologyGraphCommandDeps {
52
+ /** Receives stdout text. Default: process.stdout. */
53
+ write?: (text: string) => void;
54
+ /** Receives the exit code when it is not 0. Default: sets process.exitCode. */
55
+ setExitCode?: (code: number) => void;
56
+ /** Fills in the member for read commands. Default: `resolveReadMember` in read/member.ts. */
57
+ resolveReadMember?: (context: GraphContext) => GraphContext;
58
+ }
59
+ /** Resolves the company and the graph folder for one invocation. */
60
+ export declare function resolveGraphContext(options: ScopeOptions): GraphContext;
61
+ export declare function registerOntologyCommand(program: Command, deps?: OntologyGraphCommandDeps): Command;
62
+ export {};
63
+ //# sourceMappingURL=ontology-graph.d.ts.map