@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
@@ -187,7 +187,7 @@ export function parseMonitorTranscript(text) {
187
187
  outputPath: item.outputPath,
188
188
  }));
189
189
  }
190
- // One optional leading `HQ_ROOT=<path>` assignment. `hq lanes watch` reads
190
+ // One optional leading `HQ_ROOT=<path>` assignment. `hq runners watch` reads
191
191
  // $HQ_ROOT first, and a senior whose cwd is a repo outside the HQ tree has no
192
192
  // other way to point the watch at the HQ root (feedback_b6b59676). The value
193
193
  // is a bare word or a single- or double-quoted string; nothing else is
@@ -33,7 +33,7 @@ export function quotaLaneNotice(lane, quota) {
33
33
  * in the watcher log. Returns where it was delivered.
34
34
  */
35
35
  export function deliverQuotaNotice(hqRoot, lane, notice, at) {
36
- process.stderr.write(`hq lanes: ${notice.text}\n`);
36
+ process.stderr.write(`hq runners: ${notice.text}\n`);
37
37
  const message = { at, message_id: notice.message_id, kind: "quota_limit", text: notice.text };
38
38
  if (lane.senior.kind === "lane" && lane.senior.id) {
39
39
  appendDropboxMessageOnce(hqRoot, lane.senior.id, message);
@@ -20,7 +20,7 @@
20
20
  * A recorded 429 never holds the account (owner decision 2026-10-14, after
21
21
  * the 2026-10-13 incident where one 429 on account a blocked every Claude
22
22
  * lane until Friday). The reset times and provider text stay here as
23
- * information for `hq lanes capacity`, `hq lanes accounts list` and the
23
+ * information for `hq runners capacity`, `hq runners accounts list` and the
24
24
  * senior notice; only a needs-credits marker skips an account, for that model.
25
25
  */
26
26
  import type { LaneProvider } from "./types.js";
@@ -20,7 +20,7 @@
20
20
  * A recorded 429 never holds the account (owner decision 2026-10-14, after
21
21
  * the 2026-10-13 incident where one 429 on account a blocked every Claude
22
22
  * lane until Friday). The reset times and provider text stay here as
23
- * information for `hq lanes capacity`, `hq lanes accounts list` and the
23
+ * information for `hq runners capacity`, `hq runners accounts list` and the
24
24
  * senior notice; only a needs-credits marker skips an account, for that model.
25
25
  */
26
26
  import * as fs from "node:fs";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Repository merge hold records (`hq lanes hold`, src/commands/lanes-hold.ts):
2
+ * Repository merge hold records (`hq runners hold`, src/commands/lanes-hold.ts):
3
3
  * their location, their format and the parser that accepts or refuses one.
4
4
  * Kept apart from the command so the daemon (merge-sections.ts) can read hold
5
5
  * records without loading the lanes runtime.
@@ -34,6 +34,6 @@ export interface RepoMergeHold {
34
34
  }
35
35
  /** `<hqRoot>/workspace/lanes/holds/<owner>__<repo>.json`. */
36
36
  export declare function holdFilePath(hqRoot: string, repo: string): string;
37
- /** A hold record as `hq lanes hold` accepts it; throws LanesError for any other value. */
37
+ /** A hold record as `hq runners hold` accepts it; throws LanesError for any other value. */
38
38
  export declare function parseHold(raw: unknown, file: string): RepoMergeHold;
39
39
  //# sourceMappingURL=repo-merge-hold.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Repository merge hold records (`hq lanes hold`, src/commands/lanes-hold.ts):
2
+ * Repository merge hold records (`hq runners hold`, src/commands/lanes-hold.ts):
3
3
  * their location, their format and the parser that accepts or refuses one.
4
4
  * Kept apart from the command so the daemon (merge-sections.ts) can read hold
5
5
  * records without loading the lanes runtime.
@@ -30,7 +30,7 @@ function isCanonicalTimestamp(value) {
30
30
  const timestamp = Date.parse(value);
31
31
  return Number.isFinite(timestamp) && new Date(timestamp).toISOString() === value;
32
32
  }
33
- /** A hold record as `hq lanes hold` accepts it; throws LanesError for any other value. */
33
+ /** A hold record as `hq runners hold` accepts it; throws LanesError for any other value. */
34
34
  export function parseHold(raw, file) {
35
35
  if (!isObject(raw))
36
36
  return fail("repo_hold_invalid", "Merge hold record must be an object", { path: file });
@@ -231,7 +231,7 @@ export declare function resumePrompt(input: {
231
231
  answersPath?: string;
232
232
  /** Inline copy of the answers so the turn carries them, not only a path. */
233
233
  answers?: AnsweredQuestionLine[];
234
- /** `hq lanes resume`: the state the operator resumed the lane from. */
234
+ /** `hq runners resume`: the state the operator resumed the lane from. */
235
235
  resumedFrom?: string;
236
236
  /** Automatic continuation initiated by the lane watcher. */
237
237
  resumeSource?: "watcher";
@@ -323,7 +323,7 @@ export declare function markSpawnFailure(hqRoot: string, laneId: string, reasonR
323
323
  */
324
324
  export declare function refuseOutpostSelfTarget(hqRoot: string, lane: LaneRecord, deps: SpawnLaneDeps): void;
325
325
  /**
326
- * The hq CLI entry a watcher runs internal `hq lanes` commands through. A
326
+ * The hq CLI entry a watcher runs internal `hq runners` commands through. A
327
327
  * watcher admits queued lanes and retries accounts from its own process,
328
328
  * where process.argv[1] is watcher-main.js rather than the CLI. Recording that
329
329
  * path made envelope repair run `watcher-main.js lanes _spawn-envelope-repair`,
@@ -365,7 +365,7 @@ export interface SpawnLaunchOptions {
365
365
  trigger?: LaunchTrigger;
366
366
  /**
367
367
  * False skips the resume-time compaction check for this launch only
368
- * (`hq lanes message --no-compact`). Default true.
368
+ * (`hq runners message --no-compact`). Default true.
369
369
  */
370
370
  compact?: boolean;
371
371
  /** Effort resolved by an explicit resume/message request, or pinned from its record. */
@@ -408,7 +408,7 @@ export type EnvelopeRepairMode = "resume" | "fresh_turn";
408
408
  * prompt. `fresh_turn`: grok gets a new single-turn invocation on the same
409
409
  * account, whose prompt carries the schema, the parser error and the raw
410
410
  * failed output. Grok can resume a session (operator messages and
411
- * `hq lanes resume` use it), but its repair turn stays a fresh turn: that
411
+ * `hq runners resume` use it), but its repair turn stays a fresh turn: that
412
412
  * path was built and proven that way, and a repair by resume has not been.
413
413
  */
414
414
  export declare function envelopeRepairMode(provider: LaneProvider): EnvelopeRepairMode;
@@ -1527,7 +1527,7 @@ export function resumePrompt(input) {
1527
1527
  ].join("\n"));
1528
1528
  }
1529
1529
  // Every resume turn carries the authorization, including a textless
1530
- // `hq lanes resume`: a pre-upgrade session's brief never had the paragraph.
1530
+ // `hq runners resume`: a pre-upgrade session's brief never had the paragraph.
1531
1531
  if (input.operatorMessage !== undefined ||
1532
1532
  input.monitorEvent !== undefined ||
1533
1533
  input.answersPath !== undefined ||
@@ -1912,7 +1912,7 @@ export const WORKER_SESSION_ENV_VARS = SESSION_ID_ENV_VARS;
1912
1912
  * the lane still starts.
1913
1913
  */
1914
1914
  export function laneStartFingerprint(hqRoot, env) {
1915
- return offlineFingerprint(hqRoot, env, "hq lanes");
1915
+ return offlineFingerprint(hqRoot, env, "hq runners");
1916
1916
  }
1917
1917
  /** The session identity a lane turn exports to its worker (see `workerEnv`). */
1918
1918
  export function laneWorkerSessionEnv(lane, workerSessionId) {
@@ -2213,7 +2213,7 @@ function writeSpawnManifest(runDir, input) {
2213
2213
  }, null, 2)}\n`);
2214
2214
  }
2215
2215
  /**
2216
- * The hq CLI entry a watcher runs internal `hq lanes` commands through. A
2216
+ * The hq CLI entry a watcher runs internal `hq runners` commands through. A
2217
2217
  * watcher admits queued lanes and retries accounts from its own process,
2218
2218
  * where process.argv[1] is watcher-main.js rather than the CLI. Recording that
2219
2219
  * path made envelope repair run `watcher-main.js lanes _spawn-envelope-repair`,
@@ -2477,7 +2477,7 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
2477
2477
  const recordedModel = repairRecordedAccount && existing.model_source === "account"
2478
2478
  ? existing.model
2479
2479
  : undefined;
2480
- // `hq lanes set` on a running lane leaves the change pending until this spawn.
2480
+ // `hq runners set` on a running lane leaves the change pending until this spawn.
2481
2481
  const pendingSettings = existing.pending_settings;
2482
2482
  let pinnedModel = pendingSettings?.model ?? (existing.profile_settings_pinned === true || existing.model_source === undefined || existing.model_source === "cli" || existing.model_source === "preserved"
2483
2483
  ? existing.model
@@ -3318,7 +3318,7 @@ export function spawnEnvelopeRepairRequest(hqRoot, rawRequest, deps = {}) {
3318
3318
  * prompt. `fresh_turn`: grok gets a new single-turn invocation on the same
3319
3319
  * account, whose prompt carries the schema, the parser error and the raw
3320
3320
  * failed output. Grok can resume a session (operator messages and
3321
- * `hq lanes resume` use it), but its repair turn stays a fresh turn: that
3321
+ * `hq runners resume` use it), but its repair turn stays a fresh turn: that
3322
3322
  * path was built and proven that way, and a repair by resume has not been.
3323
3323
  */
3324
3324
  export function envelopeRepairMode(provider) {
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Company flag snapshots for every company with bound session work on this
3
+ * machine (rq_20261121230415_a549af8f50, informational 2).
4
+ *
5
+ * `work-mesh-company-reporting-required` is read from the company's local flag
6
+ * snapshot, which is trusted for 24 hours. A CLI process refreshes only the
7
+ * snapshot of its own company scope, and the desktop app and the mesh daemon
8
+ * usually run with none. A company whose sessions run under such a process,
9
+ * or whose member ran no company-scoped command for a day, then had no fresh
10
+ * snapshot, and its sessions fell back to the member's HQ Anywhere switch
11
+ * while the flag was meant to be on.
12
+ *
13
+ * The mesh daemon now keeps those snapshots fresh. On an interval it lists the
14
+ * companies of recent session records with a verified company binding, and
15
+ * for each one whose snapshot is missing or older than
16
+ * COMPANY_FLAG_REFRESH_AGE_MS it asks the flag registry in that company's
17
+ * context and writes the answer. The registry authenticates the member and
18
+ * decides the values: nothing here can turn a flag on that the registry did
19
+ * not return. A signed-out or failed read writes nothing, so the snapshot
20
+ * keeps the registry's last answer until it expires, as before.
21
+ */
22
+ import { type FlagClientOptions, type FlagSnapshot } from "@indigoai-us/hq-flags-client";
23
+ /** How often the daemon looks for snapshots to refresh. */
24
+ export declare const COMPANY_FLAG_REFRESH_INTERVAL_MS: number;
25
+ /** A snapshot older than this is fetched again: well inside the 24-hour trust window. */
26
+ export declare const COMPANY_FLAG_REFRESH_AGE_MS: number;
27
+ /** Session records updated within this window name the companies to keep fresh. */
28
+ export declare const COMPANY_FLAG_REFRESH_SESSION_WINDOW_MS: number;
29
+ /** At most this many companies per refresh, and this many session records read. */
30
+ export declare const COMPANY_FLAG_REFRESH_MAX_COMPANIES = 20;
31
+ /** The flag client surface used here, so tests can supply one. */
32
+ export interface CompanyFlagClient {
33
+ ready(): Promise<unknown>;
34
+ snapshot(): FlagSnapshot | null;
35
+ close(): void;
36
+ }
37
+ /**
38
+ * The companies of recent verified session records whose flag snapshot is
39
+ * missing, unreadable or older than `refreshAgeMs`, newest session first.
40
+ */
41
+ export declare function companiesNeedingFlagRefresh(workContextRoot: string, env: NodeJS.ProcessEnv, now?: () => Date, refreshAgeMs?: number): Array<{
42
+ uid: string;
43
+ slug?: string;
44
+ }>;
45
+ export interface RefreshCompanyFlagSnapshotsOptions {
46
+ workContextRoot: string;
47
+ env: NodeJS.ProcessEnv;
48
+ getToken: () => Promise<string>;
49
+ now?: () => Date;
50
+ createClient?: (options: FlagClientOptions) => CompanyFlagClient;
51
+ write?: (companyUid: string, flags: FlagSnapshot["flags"], options: {
52
+ env: NodeJS.ProcessEnv;
53
+ }) => unknown;
54
+ log?: (message: string) => void;
55
+ }
56
+ /**
57
+ * Refresh the flag snapshot of every company that needs it. Never rejects.
58
+ * Returns the uids whose snapshot was written.
59
+ */
60
+ export declare function refreshCompanyFlagSnapshots(options: RefreshCompanyFlagSnapshotsOptions): Promise<string[]>;
61
+ //# sourceMappingURL=company-flag-refresh.d.ts.map
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Company flag snapshots for every company with bound session work on this
3
+ * machine (rq_20261121230415_a549af8f50, informational 2).
4
+ *
5
+ * `work-mesh-company-reporting-required` is read from the company's local flag
6
+ * snapshot, which is trusted for 24 hours. A CLI process refreshes only the
7
+ * snapshot of its own company scope, and the desktop app and the mesh daemon
8
+ * usually run with none. A company whose sessions run under such a process,
9
+ * or whose member ran no company-scoped command for a day, then had no fresh
10
+ * snapshot, and its sessions fell back to the member's HQ Anywhere switch
11
+ * while the flag was meant to be on.
12
+ *
13
+ * The mesh daemon now keeps those snapshots fresh. On an interval it lists the
14
+ * companies of recent session records with a verified company binding, and
15
+ * for each one whose snapshot is missing or older than
16
+ * COMPANY_FLAG_REFRESH_AGE_MS it asks the flag registry in that company's
17
+ * context and writes the answer. The registry authenticates the member and
18
+ * decides the values: nothing here can turn a flag on that the registry did
19
+ * not return. A signed-out or failed read writes nothing, so the snapshot
20
+ * keeps the registry's last answer until it expires, as before.
21
+ */
22
+ import * as fs from "node:fs";
23
+ import * as path from "node:path";
24
+ import { createFlagClient } from "@indigoai-us/hq-flags-client";
25
+ import { resolveFlagRegistryEndpoint } from "../../flag-registry-endpoint.js";
26
+ import { readFlagSnapshotFile, writeFlagSnapshotFile } from "../../flag-snapshot-file.js";
27
+ import { isNonCloudCompanySlug } from "../../work-context/company-rebind.js";
28
+ import { isWorkContextSessionStateFileName, workContextSessionsDir } from "../../work-context/paths.js";
29
+ import { readSessionState } from "../../work-context/state.js";
30
+ /** How often the daemon looks for snapshots to refresh. */
31
+ export const COMPANY_FLAG_REFRESH_INTERVAL_MS = 15 * 60 * 1_000;
32
+ /** A snapshot older than this is fetched again: well inside the 24-hour trust window. */
33
+ export const COMPANY_FLAG_REFRESH_AGE_MS = 6 * 60 * 60 * 1_000;
34
+ /** Session records updated within this window name the companies to keep fresh. */
35
+ export const COMPANY_FLAG_REFRESH_SESSION_WINDOW_MS = 14 * 24 * 60 * 60 * 1_000;
36
+ /** At most this many companies per refresh, and this many session records read. */
37
+ export const COMPANY_FLAG_REFRESH_MAX_COMPANIES = 20;
38
+ const SESSION_SCAN_MAX = 2_000;
39
+ const REQUEST_TIMEOUT_MS = 5_000;
40
+ const COMPANY_UID_RE = /^cmp_[A-Za-z0-9]{3,128}$/;
41
+ /**
42
+ * A session record whose company the member verified: the binding the
43
+ * reporting predicate requires before it reads the flag at all.
44
+ */
45
+ function verifiedCompanyOf(state) {
46
+ if (state?.contractVersion !== 1 ||
47
+ typeof state.companyUid !== "string" || !COMPANY_UID_RE.test(state.companyUid) ||
48
+ !(state.contextStatus === "bound" || state.contextStatus === "needs_project" || state.contextStatus === "needs_task") ||
49
+ state.companyConfidence === "device_default" ||
50
+ state.ownerMismatch?.companyUid === state.companyUid ||
51
+ (state.companySlug !== undefined && typeof state.companySlug !== "string") ||
52
+ isNonCloudCompanySlug(state.companySlug))
53
+ return null;
54
+ return { uid: state.companyUid, ...(state.companySlug?.trim() ? { slug: state.companySlug.trim() } : {}) };
55
+ }
56
+ /**
57
+ * The companies of recent verified session records whose flag snapshot is
58
+ * missing, unreadable or older than `refreshAgeMs`, newest session first.
59
+ */
60
+ export function companiesNeedingFlagRefresh(workContextRoot, env, now = () => new Date(), refreshAgeMs = COMPANY_FLAG_REFRESH_AGE_MS) {
61
+ const nowMs = now().getTime();
62
+ const dir = workContextSessionsDir(workContextRoot);
63
+ let names;
64
+ try {
65
+ names = fs.readdirSync(dir).filter(isWorkContextSessionStateFileName).slice(0, SESSION_SCAN_MAX);
66
+ }
67
+ catch {
68
+ return [];
69
+ }
70
+ const latest = new Map();
71
+ for (const name of names) {
72
+ const sessionId = path.basename(name, ".json");
73
+ let state;
74
+ try {
75
+ state = readSessionState(sessionId, workContextRoot);
76
+ }
77
+ catch {
78
+ continue;
79
+ }
80
+ if (state?.sessionId !== sessionId)
81
+ continue;
82
+ const company = verifiedCompanyOf(state);
83
+ if (!company)
84
+ continue;
85
+ const at = Date.parse(state.updatedAt);
86
+ if (!Number.isFinite(at) || at > nowMs || nowMs - at > COMPANY_FLAG_REFRESH_SESSION_WINDOW_MS)
87
+ continue;
88
+ const seen = latest.get(company.uid);
89
+ if (!seen || at > seen.at)
90
+ latest.set(company.uid, { ...company, slug: company.slug ?? seen?.slug, at });
91
+ }
92
+ return [...latest.values()]
93
+ .sort((a, b) => b.at - a.at)
94
+ .filter(({ uid }) => readFlagSnapshotFile(uid, { env, now: nowMs, maxAgeMs: refreshAgeMs }) === null)
95
+ .slice(0, COMPANY_FLAG_REFRESH_MAX_COMPANIES)
96
+ .map(({ uid, slug }) => (slug ? { uid, slug } : { uid }));
97
+ }
98
+ /**
99
+ * Refresh the flag snapshot of every company that needs it. Never rejects.
100
+ * Returns the uids whose snapshot was written.
101
+ */
102
+ export async function refreshCompanyFlagSnapshots(options) {
103
+ const written = [];
104
+ let companies;
105
+ try {
106
+ companies = companiesNeedingFlagRefresh(options.workContextRoot, options.env, options.now);
107
+ }
108
+ catch {
109
+ return written;
110
+ }
111
+ if (companies.length === 0)
112
+ return written;
113
+ let token;
114
+ try {
115
+ token = await options.getToken();
116
+ }
117
+ catch {
118
+ return written; // signed out: the snapshots keep the registry's last answer
119
+ }
120
+ if (typeof token !== "string" || !token.trim())
121
+ return written;
122
+ const endpoint = resolveFlagRegistryEndpoint(undefined, options.env);
123
+ for (const company of companies) {
124
+ let client;
125
+ try {
126
+ client = (options.createClient ?? createFlagClient)({
127
+ endpoint,
128
+ companyUid: company.uid,
129
+ ...(company.slug ? { companyIdentifiers: [company.slug] } : {}),
130
+ getToken: () => token,
131
+ env: {},
132
+ refreshIntervalMs: 0,
133
+ requestTimeoutMs: REQUEST_TIMEOUT_MS,
134
+ onError: () => { },
135
+ });
136
+ await client.ready();
137
+ const snapshot = client.snapshot();
138
+ if (!snapshot)
139
+ continue;
140
+ (options.write ?? writeFlagSnapshotFile)(company.uid, snapshot.flags, { env: options.env });
141
+ written.push(company.uid);
142
+ }
143
+ catch (error) {
144
+ options.log?.(`company flag refresh failed company=${company.uid}: ${String(error).slice(0, 120)}`);
145
+ }
146
+ finally {
147
+ try {
148
+ client?.close();
149
+ }
150
+ catch {
151
+ // one client cannot stop the rest
152
+ }
153
+ }
154
+ }
155
+ if (written.length > 0)
156
+ options.log?.(`company flag refresh: wrote ${written.length} snapshot(s)`);
157
+ return written;
158
+ }
159
+ //# sourceMappingURL=company-flag-refresh.js.map
@@ -0,0 +1,61 @@
1
+ /** The company flag that makes Work Mesh reporting required. */
2
+ export declare const WORK_MESH_COMPANY_REPORTING_REQUIRED = "work-mesh-company-reporting-required";
3
+ /**
4
+ * One file per company whose snapshot this machine saw go stale while it
5
+ * said on: when it went stale. The stretch from then is held; the episode
6
+ * itself carries on (review of #3469, INFO-2).
7
+ */
8
+ export declare const COMPANY_REPORTING_STALE_DIRNAME = "company-reporting-stale-since";
9
+ /**
10
+ * One file per company: the stale stretches seen during the current episode,
11
+ * one `<from> <to>` line each (ISO times; `-` for a start that could not be
12
+ * read).
13
+ */
14
+ export declare const COMPANY_REPORTING_GAPS_DIRNAME = "company-reporting-stale-gaps";
15
+ /** The most stale stretches kept per company. Past it the two oldest merge into one, which holds more, not less. */
16
+ export declare const COMPANY_REPORTING_GAPS_MAX = 32;
17
+ /** A stale stretch, [from, to) in epoch ms. */
18
+ export type EnforcementGap = readonly [number, number];
19
+ export declare function readTimeFile(file: string): number | null;
20
+ /**
21
+ * The stretches recorded in `file`. A file that exists but cannot be read,
22
+ * or a line that cannot be read, holds everything up to when the file was
23
+ * last written, as the episode did before stretches were kept.
24
+ */
25
+ export declare function readGaps(file: string, now: () => Date): EnforcementGap[];
26
+ /** A lock older than this was left by a process that stopped; it is taken over. */
27
+ export declare const COMPANY_REPORTING_GAPS_LOCK_STALE_MS = 10000;
28
+ /** How long {@link addCompanyReportingGap} waits for another process's lock by default. */
29
+ export declare const COMPANY_REPORTING_GAPS_LOCK_WAIT_MS = 2000;
30
+ /**
31
+ * Adds a stale stretch for the company. The append, and the rewrite with the
32
+ * oldest merged once there are more than {@link COMPANY_REPORTING_GAPS_MAX}
33
+ * lines, happen under the company's gaps lock, so a daemon flush and an hq
34
+ * command adding one at the same time both keep theirs: no line can be
35
+ * appended between the rewrite's read and its rename (review of #3469,
36
+ * INFO-1 of round 3). False when it could not be stored, including when
37
+ * another process held the lock for `lockWaitMs`.
38
+ */
39
+ export declare function addCompanyReportingGap(workMeshRootDir: string, companyUid: string, gap: EnforcementGap, now?: () => Date, lockWaitMs?: number): boolean;
40
+ /**
41
+ * The stale stretches of the company's current episode on this machine. A
42
+ * stretch still open (a flush saw the snapshot stale and no fresh one has been
43
+ * read since, or closing it could not be stored) runs to now.
44
+ */
45
+ export declare function companyReportingGaps(workMeshRootDir: string, companyUid: string, now?: () => Date): EnforcementGap[];
46
+ /**
47
+ * Called by the company snapshot writer before it replaces `previous`, the
48
+ * snapshot on disk (whatever its age). When that snapshot said reporting is
49
+ * required and is older than `snapshotMaxAgeMs` (the snapshot reader's limit,
50
+ * a day) at `nowMs`, the stretch from when it
51
+ * went stale to now is recorded: no daemon flush may have seen it stale (the
52
+ * daemon was down or asleep), and once the fresh snapshot is on disk the
53
+ * stretch could no longer be told apart (review of #3469, INFO-A). Only on a
54
+ * machine whose Work Mesh root exists. Never throws: the snapshot is written
55
+ * whatever happens here.
56
+ */
57
+ export declare function noteReplacedCompanySnapshot(companyUid: string, previous: {
58
+ fetchedAtMs: number;
59
+ flags: Readonly<Record<string, unknown>>;
60
+ } | null, env: NodeJS.ProcessEnv, snapshotMaxAgeMs: number, nowMs?: number): void;
61
+ //# sourceMappingURL=company-reporting-gaps.d.ts.map