@indigoai-us/hq-cli 5.313.0 → 5.314.0

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 (1174) hide show
  1. package/CHANGELOG.md +1 -4300
  2. package/assets/scaffold/core/scripts/checkpoint-stop-gate.sh +43 -281
  3. package/assets/scaffold/core/scripts/hook-lib.sh +50 -345
  4. package/assets/scaffold/core/scripts/hq-session.sh +23 -184
  5. package/assets/scaffold/core/scripts/lib/session-id.sh +2 -3
  6. package/assets/scaffold/core/scripts/lib/session-scope-capability.sh +1 -1
  7. package/assets/scaffold/core/scripts/lib/work-mesh-enqueue.sh +1 -2
  8. package/assets/scaffold/core/scripts/qmd-reindex-after-sync.sh +87 -10
  9. package/assets/scaffold/core/scripts/rebuild-company-knowledge-index.sh +3 -36
  10. package/assets/scaffold/core/scripts/rebuild-projects-index.sh +12 -99
  11. package/assets/scaffold/core/scripts/token-usage-report.sh +20 -81
  12. package/dist/bin/hq-auth-refresh.d.ts +0 -2
  13. package/dist/bin/hq-auth-refresh.js +6 -12
  14. package/dist/commands/__fixtures__/access-vault.d.ts +0 -2
  15. package/dist/commands/__fixtures__/access-vault.js +1 -1
  16. package/dist/commands/_patterns.d.ts +0 -16
  17. package/dist/commands/_patterns.js +3 -20
  18. package/dist/commands/access.d.ts +1 -2
  19. package/dist/commands/access.js +49 -58
  20. package/dist/commands/agents.d.ts +4 -106
  21. package/dist/commands/agents.js +45 -924
  22. package/dist/commands/auth.d.ts +0 -1
  23. package/dist/commands/auth.js +19 -189
  24. package/dist/commands/billing.d.ts +0 -3
  25. package/dist/commands/billing.js +1 -6
  26. package/dist/commands/channels.js +1 -56
  27. package/dist/commands/cloud-demote.js +2 -3
  28. package/dist/commands/cloud-provision.d.ts +0 -14
  29. package/dist/commands/cloud-provision.js +58 -232
  30. package/dist/commands/cloud.d.ts +15 -49
  31. package/dist/commands/cloud.js +122 -357
  32. package/dist/commands/company-transfer.d.ts +28 -4
  33. package/dist/commands/company-transfer.js +49 -5
  34. package/dist/commands/company.js +3 -68
  35. package/dist/commands/core-checkpoint.d.ts +9 -19
  36. package/dist/commands/core-checkpoint.js +37 -301
  37. package/dist/commands/core.d.ts +0 -4
  38. package/dist/commands/core.js +80 -277
  39. package/dist/commands/crm.js +3 -52
  40. package/dist/commands/db-provision.js +4 -4
  41. package/dist/commands/db-sql.js +21 -7
  42. package/dist/commands/dm.d.ts +12 -119
  43. package/dist/commands/dm.js +38 -388
  44. package/dist/commands/doctor.d.ts +0 -12
  45. package/dist/commands/doctor.js +12 -158
  46. package/dist/commands/feedback.d.ts +0 -6
  47. package/dist/commands/feedback.js +37 -86
  48. package/dist/commands/files-browse.d.ts +12 -32
  49. package/dist/commands/files-browse.js +60 -176
  50. package/dist/commands/files.d.ts +0 -17
  51. package/dist/commands/files.js +47 -300
  52. package/dist/commands/group-grants.js +2 -3
  53. package/dist/commands/groups.js +5 -6
  54. package/dist/commands/index-cmd.d.ts +1 -19
  55. package/dist/commands/index-cmd.js +7 -74
  56. package/dist/commands/integrations-api.d.ts +10 -15
  57. package/dist/commands/integrations-api.js +22 -27
  58. package/dist/commands/integrations-connect.d.ts +13 -51
  59. package/dist/commands/integrations-connect.js +71 -86
  60. package/dist/commands/integrations-core.d.ts +6 -6
  61. package/dist/commands/integrations-core.js +11 -25
  62. package/dist/commands/integrations-import.d.ts +1 -1
  63. package/dist/commands/integrations-import.js +24 -43
  64. package/dist/commands/integrations-manage.js +13 -20
  65. package/dist/commands/integrations.d.ts +0 -8
  66. package/dist/commands/integrations.js +7 -94
  67. package/dist/commands/login.js +6 -49
  68. package/dist/commands/mcp-registration.d.ts +25 -32
  69. package/dist/commands/mcp-registration.js +23 -256
  70. package/dist/commands/mcp-status.js +0 -1
  71. package/dist/commands/meetings.js +34 -55
  72. package/dist/commands/members.js +1 -5
  73. package/dist/commands/mesh.d.ts +0 -11
  74. package/dist/commands/mesh.js +76 -1086
  75. package/dist/commands/onboard-identity-guard.d.ts +1 -1
  76. package/dist/commands/onboard.js +5 -24
  77. package/dist/commands/pack-install.js +1 -3
  78. package/dist/commands/packs.js +1 -11
  79. package/dist/commands/people.d.ts +0 -4
  80. package/dist/commands/people.js +3 -37
  81. package/dist/commands/publish.d.ts +1 -8
  82. package/dist/commands/publish.js +4 -17
  83. package/dist/commands/reindex.js +6 -56
  84. package/dist/commands/rescue.d.ts +0 -4
  85. package/dist/commands/rescue.js +17 -27
  86. package/dist/commands/run.js +4 -18
  87. package/dist/commands/safe-extract.d.ts +2 -11
  88. package/dist/commands/safe-extract.js +8 -36
  89. package/dist/commands/scaffold-fast.d.ts +41 -0
  90. package/dist/commands/scaffold-fast.js +57 -0
  91. package/dist/commands/secrets.d.ts +2 -20
  92. package/dist/commands/secrets.js +71 -175
  93. package/dist/commands/skill.d.ts +4 -35
  94. package/dist/commands/skill.js +18 -357
  95. package/dist/commands/sync-mode.d.ts +0 -11
  96. package/dist/commands/sync-mode.js +0 -30
  97. package/dist/commands/sync-narrow.js +5 -36
  98. package/dist/commands/team-sync.js +10 -71
  99. package/dist/commands/update.js +0 -6
  100. package/dist/commands/whoami.d.ts +0 -22
  101. package/dist/commands/whoami.js +4 -137
  102. package/dist/commands/workers.d.ts +14 -2
  103. package/dist/commands/workers.js +10 -7
  104. package/dist/fast-core.d.ts +7 -6
  105. package/dist/fast-core.js +24 -87
  106. package/dist/index.d.ts +4 -3
  107. package/dist/index.js +9 -59
  108. package/dist/lazy-commands.d.ts +44 -20
  109. package/dist/lazy-commands.js +58 -60
  110. package/dist/lib/company-skill-wrapper.d.ts +0 -1
  111. package/dist/lib/company-skill-wrapper.js +29 -121
  112. package/dist/lib/core-utils/codex-skill-bridge.d.ts +1 -2
  113. package/dist/lib/core-utils/qmd-reindex-after-sync.d.ts +1 -14
  114. package/dist/lib/core-utils/qmd-reindex-after-sync.js +17 -101
  115. package/dist/lib/core-utils/soft-timeout.js +1 -1
  116. package/dist/lib/core-utils/timeout-guard.d.ts +3 -3
  117. package/dist/lib/core-utils/timeout-guard.js +13 -28
  118. package/dist/lib/core-utils/token-usage-report.js +3 -17
  119. package/dist/lib/db/control-plane.js +0 -6
  120. package/dist/lib/db/local.d.ts +5 -0
  121. package/dist/lib/db/local.js +1 -1
  122. package/dist/lib/db/migrate.d.ts +12 -0
  123. package/dist/lib/db/migrate.js +5 -5
  124. package/dist/lib/db/remote-sql.d.ts +2 -2
  125. package/dist/lib/db/remote-sql.js +3 -3
  126. package/dist/lib/db/sql.d.ts +10 -0
  127. package/dist/lib/db/sql.js +8 -4
  128. package/dist/lib/doctor/__testing__/fake-hq-tree.d.ts +1 -1
  129. package/dist/lib/doctor/__testing__/fake-hq-tree.js +1 -1
  130. package/dist/lib/doctor/checks/claude-wiring.js +1 -70
  131. package/dist/lib/doctor/checks/codex-wiring.d.ts +4 -0
  132. package/dist/lib/doctor/checks/codex-wiring.js +35 -3
  133. package/dist/lib/doctor/checks/grok-wiring.js +34 -1
  134. package/dist/lib/doctor/checks/integrations.js +0 -11
  135. package/dist/lib/doctor/checks/runtime-health.d.ts +17 -4
  136. package/dist/lib/doctor/checks/runtime-health.js +7 -20
  137. package/dist/lib/doctor/checks/sync-health.d.ts +0 -21
  138. package/dist/lib/doctor/checks/sync-health.js +2 -72
  139. package/dist/lib/doctor/checks/work-context.js +6 -20
  140. package/dist/lib/doctor/compat.d.ts +16 -0
  141. package/dist/lib/doctor/compat.js +3 -4
  142. package/dist/lib/doctor/deep/effects.js +3 -1
  143. package/dist/lib/doctor/deep/executor.d.ts +10 -4
  144. package/dist/lib/doctor/deep/executor.js +1 -1
  145. package/dist/lib/doctor/deep/parity.d.ts +29 -2
  146. package/dist/lib/doctor/deep/parity.js +7 -7
  147. package/dist/lib/doctor/deep/sandbox.d.ts +25 -7
  148. package/dist/lib/doctor/deep/sandbox.js +7 -5
  149. package/dist/lib/doctor/fix/apply.d.ts +8 -79
  150. package/dist/lib/doctor/fix/apply.js +80 -292
  151. package/dist/lib/doctor/fix/remediation.d.ts +6 -14
  152. package/dist/lib/doctor/fix/remediation.js +9 -49
  153. package/dist/lib/doctor/fixtures/schema.js +3 -1
  154. package/dist/lib/doctor/json-output.d.ts +1 -17
  155. package/dist/lib/doctor/json-output.js +2 -7
  156. package/dist/lib/doctor/platform.d.ts +26 -0
  157. package/dist/lib/doctor/platform.js +5 -5
  158. package/dist/lib/doctor/registry.d.ts +0 -14
  159. package/dist/lib/doctor/registry.js +0 -71
  160. package/dist/lib/doctor/report.js +1 -1
  161. package/dist/lib/doctor/types.d.ts +0 -5
  162. package/dist/lib/doctor/types.js +0 -20
  163. package/dist/lib/flag-registry-worker.js +1 -12
  164. package/dist/lib/flag-registry.d.ts +6 -26
  165. package/dist/lib/flag-registry.js +16 -133
  166. package/dist/lib/index-render/companies.d.ts +1 -4
  167. package/dist/lib/index-render/companies.js +3 -66
  168. package/dist/lib/index-render/company-knowledge.js +17 -80
  169. package/dist/lib/index-render/index.d.ts +0 -1
  170. package/dist/lib/index-render/index.js +1 -2
  171. package/dist/lib/index-render/projects.js +5 -82
  172. package/dist/lib/index-render/shared.d.ts +1 -13
  173. package/dist/lib/index-render/shared.js +2 -41
  174. package/dist/lib/mesh/api.d.ts +10 -103
  175. package/dist/lib/mesh/api.js +64 -334
  176. package/dist/lib/mesh/client.d.ts +2 -3
  177. package/dist/lib/mesh/client.js +7 -26
  178. package/dist/lib/mesh/live/backfill-held.d.ts +16 -67
  179. package/dist/lib/mesh/live/backfill-held.js +61 -415
  180. package/dist/lib/mesh/live/backoff.d.ts +2 -2
  181. package/dist/lib/mesh/live/backoff.js +3 -16
  182. package/dist/lib/mesh/live/daemon/board-refresh.d.ts +1 -7
  183. package/dist/lib/mesh/live/daemon/board-refresh.js +30 -78
  184. package/dist/lib/mesh/live/daemon/credentials.d.ts +10 -64
  185. package/dist/lib/mesh/live/daemon/credentials.js +20 -270
  186. package/dist/lib/mesh/live/daemon/doctor.d.ts +0 -53
  187. package/dist/lib/mesh/live/daemon/doctor.js +6 -190
  188. package/dist/lib/mesh/live/daemon/index.d.ts +10 -13
  189. package/dist/lib/mesh/live/daemon/index.js +6 -7
  190. package/dist/lib/mesh/live/daemon/install.d.ts +1 -255
  191. package/dist/lib/mesh/live/daemon/install.js +13 -811
  192. package/dist/lib/mesh/live/daemon/paths.d.ts +0 -2
  193. package/dist/lib/mesh/live/daemon/paths.js +0 -2
  194. package/dist/lib/mesh/live/daemon/presence.d.ts +5 -24
  195. package/dist/lib/mesh/live/daemon/presence.js +10 -79
  196. package/dist/lib/mesh/live/daemon/run.d.ts +2 -48
  197. package/dist/lib/mesh/live/daemon/run.js +33 -485
  198. package/dist/lib/mesh/live/daemon/state.d.ts +2 -19
  199. package/dist/lib/mesh/live/daemon/state.js +2 -34
  200. package/dist/lib/mesh/live/daemon/transcript-watch.d.ts +9 -45
  201. package/dist/lib/mesh/live/daemon/transcript-watch.js +31 -227
  202. package/dist/lib/mesh/live/emit-client.d.ts +0 -8
  203. package/dist/lib/mesh/live/emit-client.js +8 -23
  204. package/dist/lib/mesh/live/emit-evidence.d.ts +0 -19
  205. package/dist/lib/mesh/live/emit-evidence.js +2 -20
  206. package/dist/lib/mesh/live/emit.d.ts +0 -9
  207. package/dist/lib/mesh/live/emit.js +2 -28
  208. package/dist/lib/mesh/live/enqueue.d.ts +0 -5
  209. package/dist/lib/mesh/live/enqueue.js +0 -19
  210. package/dist/lib/mesh/live/flush.d.ts +5 -17
  211. package/dist/lib/mesh/live/flush.js +38 -391
  212. package/dist/lib/mesh/live/format-spool-line.d.ts +2 -5
  213. package/dist/lib/mesh/live/format-spool-line.js +0 -10
  214. package/dist/lib/mesh/live/paths.d.ts +0 -2
  215. package/dist/lib/mesh/live/paths.js +0 -4
  216. package/dist/lib/mesh/live/session-event.schema.json +1 -24
  217. package/dist/lib/mesh/live/session-events-client.d.ts +0 -2
  218. package/dist/lib/mesh/live/session-events-client.js +0 -26
  219. package/dist/lib/mesh/live/spool.d.ts +0 -19
  220. package/dist/lib/mesh/live/spool.js +3 -269
  221. package/dist/lib/mesh/live/validate-session-event.d.ts +1 -1
  222. package/dist/lib/mesh/live/validate-session-event.js +1 -1
  223. package/dist/lib/plan-limit-nag.d.ts +6 -102
  224. package/dist/lib/plan-limit-nag.js +43 -348
  225. package/dist/lib/scan-packages/index.d.ts +0 -2
  226. package/dist/lib/scan-packages/index.js +6 -168
  227. package/dist/lib/search-index/background.d.ts +1 -8
  228. package/dist/lib/search-index/background.js +200 -55
  229. package/dist/lib/search-index/index.d.ts +0 -12
  230. package/dist/lib/search-index/index.js +7 -153
  231. package/dist/lib/work-context/company.d.ts +20 -22
  232. package/dist/lib/work-context/company.js +40 -124
  233. package/dist/lib/work-context/config.d.ts +11 -58
  234. package/dist/lib/work-context/config.js +83 -334
  235. package/dist/lib/work-context/contract.d.ts +0 -13
  236. package/dist/lib/work-context/contract.schema.json +1 -3
  237. package/dist/lib/work-context/index.d.ts +25 -0
  238. package/dist/lib/work-context/index.js +21 -0
  239. package/dist/lib/work-context/outbox.d.ts +5 -27
  240. package/dist/lib/work-context/outbox.js +6 -135
  241. package/dist/lib/work-context/reconcile.d.ts +0 -15
  242. package/dist/lib/work-context/reconcile.js +29 -405
  243. package/dist/lib/work-context/state.d.ts +10 -93
  244. package/dist/lib/work-context/state.js +29 -342
  245. package/dist/lib/workers-registry/index.js +8 -62
  246. package/dist/main.d.ts +0 -32
  247. package/dist/main.js +73 -273
  248. package/dist/node-network-compat.d.ts +30 -2
  249. package/dist/node-network-compat.js +51 -4
  250. package/dist/node-preflight.d.ts +1 -7
  251. package/dist/node-preflight.js +5 -5
  252. package/dist/register-all.d.ts +29 -4
  253. package/dist/register-all.js +233 -4
  254. package/dist/run/discover-schemas.d.ts +1 -2
  255. package/dist/run/env-graph-guard.d.ts +2 -2
  256. package/dist/run/env-graph-guard.js +2 -5
  257. package/dist/run/hq-plugin.d.ts +0 -4
  258. package/dist/run/hq-plugin.js +8 -36
  259. package/dist/sentry-before-send.js +0 -80
  260. package/dist/sentry.d.ts +2 -8
  261. package/dist/sentry.js +13 -117
  262. package/dist/startup-registration.d.ts +2 -26
  263. package/dist/startup-registration.js +15 -116
  264. package/dist/utils/cli-telemetry.d.ts +1 -74
  265. package/dist/utils/cli-telemetry.js +7 -434
  266. package/dist/utils/client-health.d.ts +4 -0
  267. package/dist/utils/client-health.js +2 -2
  268. package/dist/utils/cognito-session.d.ts +0 -71
  269. package/dist/utils/cognito-session.js +27 -481
  270. package/dist/utils/contribution-table.d.ts +1 -1
  271. package/dist/utils/environmental-error.d.ts +0 -18
  272. package/dist/utils/environmental-error.js +7 -240
  273. package/dist/utils/expected-cli-error.d.ts +0 -2
  274. package/dist/utils/expected-cli-error.js +0 -4
  275. package/dist/utils/feedback-diagnostics.d.ts +1 -2
  276. package/dist/utils/feedback-log-bundle.d.ts +26 -51
  277. package/dist/utils/feedback-log-bundle.js +31 -211
  278. package/dist/utils/feedback-logs.d.ts +47 -18
  279. package/dist/utils/feedback-logs.js +21 -50
  280. package/dist/utils/feedback-screenshots.d.ts +1 -0
  281. package/dist/utils/feedback-screenshots.js +1 -1
  282. package/dist/utils/hq-roots.d.ts +2 -25
  283. package/dist/utils/hq-roots.js +7 -67
  284. package/dist/utils/incomplete-install-error.d.ts +19 -87
  285. package/dist/utils/incomplete-install-error.js +68 -319
  286. package/dist/utils/install-tree-torn.d.ts +24 -260
  287. package/dist/utils/install-tree-torn.js +51 -998
  288. package/dist/utils/large-file-guard.d.ts +10 -0
  289. package/dist/utils/large-file-guard.js +1 -1
  290. package/dist/utils/local-files-overview.d.ts +8 -4
  291. package/dist/utils/local-files-overview.js +7 -48
  292. package/dist/utils/login-provider.d.ts +0 -7
  293. package/dist/utils/login-provider.js +0 -34
  294. package/dist/utils/pack-contributions.d.ts +14 -2
  295. package/dist/utils/pack-contributions.js +44 -7
  296. package/dist/utils/package-root-diagnostics.d.ts +1 -1
  297. package/dist/utils/people.d.ts +11 -7
  298. package/dist/utils/people.js +20 -5
  299. package/dist/utils/plan-gate-error.d.ts +10 -52
  300. package/dist/utils/plan-gate-error.js +41 -364
  301. package/dist/utils/qmd-model-download-error.d.ts +8 -0
  302. package/dist/utils/qmd-model-download-error.js +1 -1
  303. package/dist/utils/qmd-query-document-error.d.ts +6 -0
  304. package/dist/utils/qmd-query-document-error.js +1 -1
  305. package/dist/utils/redact-error-text.d.ts +2 -0
  306. package/dist/utils/redact-error-text.js +2 -3
  307. package/dist/utils/run-bundled-script.d.ts +0 -6
  308. package/dist/utils/run-bundled-script.js +4 -117
  309. package/dist/utils/sandbox-runner-client.d.ts +1 -2
  310. package/dist/utils/secrets-cache.d.ts +3 -7
  311. package/dist/utils/secrets-cache.js +14 -162
  312. package/dist/utils/self-update.d.ts +1 -34
  313. package/dist/utils/self-update.js +42 -660
  314. package/dist/utils/sentry-fingerprint.d.ts +1 -23
  315. package/dist/utils/sentry-fingerprint.js +31 -223
  316. package/dist/utils/team-upgrade.d.ts +1 -1
  317. package/dist/utils/team-upgrade.js +3 -4
  318. package/dist/utils/vault-api.d.ts +1 -21
  319. package/dist/utils/vault-api.js +84 -251
  320. package/dist/utils/version-check.d.ts +1 -11
  321. package/dist/utils/version-check.js +3 -32
  322. package/dist/utils/version-gate.d.ts +17 -101
  323. package/dist/utils/version-gate.js +70 -645
  324. package/dist/utils/windows-spawn.d.ts +0 -6
  325. package/dist/utils/windows-spawn.js +0 -37
  326. package/package.json +8 -20
  327. package/README.md +0 -113
  328. package/assets/bot-workers/setup/context/USER-GUIDE.md +0 -404
  329. package/assets/bot-workers/setup/context/quick-reference.md +0 -199
  330. package/assets/bot-workers/setup/skills/agents-and-team.md +0 -167
  331. package/assets/bot-workers/setup/skills/explain-hq.md +0 -35
  332. package/assets/bot-workers/setup/skills/first-company.md +0 -74
  333. package/assets/bot-workers/setup/skills/joining-a-team.md +0 -125
  334. package/assets/bot-workers/setup/skills/pricing.md +0 -92
  335. package/assets/bot-workers/setup/skills/standing-help.md +0 -81
  336. package/assets/bot-workers/setup/skills/your-business.md +0 -281
  337. package/assets/bot-workers/setup/worker.yaml +0 -791
  338. package/assets/lanes-hooks/hq-lanes-drain.json +0 -15
  339. package/assets/lanes-hooks/hq-lanes-drain.mjs +0 -275
  340. package/assets/lanes-hooks/hq-lanes-drain.sh +0 -21
  341. package/assets/lanes-reconcile/hq-lanes-reconcile.service +0 -11
  342. package/assets/lanes-reconcile/hq-lanes-reconcile.timer +0 -12
  343. package/assets/scaffold/.claude/hooks/validate-policy-frontmatter.sh +0 -485
  344. package/assets/scaffold/core/scripts/audit-log.sh +0 -384
  345. package/assets/scaffold/core/scripts/clean-worktree-reconcile-handoff.sh +0 -171
  346. package/assets/scaffold/core/scripts/eval-trigger.sh +0 -193
  347. package/assets/scaffold/core/scripts/git-pack-extension-check.sh +0 -164
  348. package/assets/scaffold/core/scripts/handoff-finalize.sh +0 -688
  349. package/assets/scaffold/core/scripts/handoff-open-steps.sh +0 -81
  350. package/assets/scaffold/core/scripts/handoff-post.sh +0 -252
  351. package/assets/scaffold/core/scripts/hq-delegate-bundle.sh +0 -307
  352. package/assets/scaffold/core/scripts/hq-delegate-grant.sh +0 -252
  353. package/assets/scaffold/core/scripts/hq-delegate-pickup.sh +0 -99
  354. package/assets/scaffold/core/scripts/hq-delegate-publish.sh +0 -91
  355. package/assets/scaffold/core/scripts/hq-delegate-repo.sh +0 -158
  356. package/assets/scaffold/core/scripts/hq-delegate-resolve.sh +0 -145
  357. package/assets/scaffold/core/scripts/hq-delegate-secrets.sh +0 -129
  358. package/assets/scaffold/core/scripts/hq-delegate-send.sh +0 -259
  359. package/assets/scaffold/core/scripts/hq-delegate-transfer.sh +0 -175
  360. package/assets/scaffold/core/scripts/hq-delegate-verify.sh +0 -238
  361. package/assets/scaffold/core/scripts/hq-dm-bind.sh +0 -585
  362. package/assets/scaffold/core/scripts/hq-job-notify.sh +0 -389
  363. package/assets/scaffold/core/scripts/hq-job-probe.sh +0 -835
  364. package/assets/scaffold/core/scripts/hq-job-remediate.sh +0 -359
  365. package/assets/scaffold/core/scripts/hq-job-run.sh +0 -1025
  366. package/assets/scaffold/core/scripts/hq-pin.sh +0 -118
  367. package/assets/scaffold/core/scripts/jobs-schedule-parse.sh +0 -310
  368. package/assets/scaffold/core/scripts/jobs-validate.sh +0 -451
  369. package/assets/scaffold/core/scripts/knowledge-prefs.sh +0 -55
  370. package/assets/scaffold/core/scripts/lib/portable.sh +0 -211
  371. package/assets/scaffold/core/scripts/lib/secret-patterns.sh +0 -58
  372. package/assets/scaffold/core/scripts/lib/work-mesh-live-hook.sh +0 -378
  373. package/assets/scaffold/core/scripts/lib/work-mesh-live-rebind.sh +0 -141
  374. package/assets/scaffold/core/scripts/migrate-policy-triggers.sh +0 -373
  375. package/assets/scaffold/core/scripts/ontology-audience-grant.sh +0 -81
  376. package/assets/scaffold/core/scripts/ontology-brief.mjs +0 -93
  377. package/assets/scaffold/core/scripts/ontology-candidate.sh +0 -100
  378. package/assets/scaffold/core/scripts/ontology-garden.mjs +0 -238
  379. package/assets/scaffold/core/scripts/ontology-source-worklist.sh +0 -79
  380. package/assets/scaffold/core/scripts/outpost-jobs-reconcile.sh +0 -834
  381. package/assets/scaffold/core/scripts/policy-age-report.sh +0 -156
  382. package/assets/scaffold/core/scripts/policy-retire.sh +0 -199
  383. package/assets/scaffold/core/scripts/qmd-reindex-bg.sh +0 -40
  384. package/assets/scaffold/core/scripts/read-policy-frontmatter.sh +0 -32
  385. package/assets/scaffold/core/scripts/refresh-vault-access.sh +0 -188
  386. package/assets/scaffold/core/scripts/register-project.sh +0 -262
  387. package/assets/scaffold/core/scripts/resolve-company.sh +0 -199
  388. package/assets/scaffold/core/scripts/resume-thread-lock.sh +0 -285
  389. package/assets/scaffold/core/scripts/source-yaml-validate.sh +0 -36
  390. package/assets/scaffold/core/scripts/verify-story-deliverables.sh +0 -148
  391. package/assets/scaffold/core/scripts/work-mesh-live-bind-trusted.sh +0 -152
  392. package/assets/scaffold/core/scripts/work-mesh-live-rebind.sh +0 -59
  393. package/assets/scaffold/core/scripts/worktree-gc.sh +0 -362
  394. package/contracts/preflight/v1/fixtures.json +0 -87
  395. package/contracts/preflight/v1/schema.json +0 -58
  396. package/dist/command-catalog.generated.d.ts +0 -10735
  397. package/dist/command-catalog.generated.js +0 -13836
  398. package/dist/command-registration-plan.d.ts +0 -474
  399. package/dist/command-registration-plan.js +0 -136
  400. package/dist/commands/agent-enroll.d.ts +0 -146
  401. package/dist/commands/agent-enroll.js +0 -401
  402. package/dist/commands/agent-inbox.d.ts +0 -9
  403. package/dist/commands/agent-inbox.js +0 -102
  404. package/dist/commands/agent-kit.d.ts +0 -87
  405. package/dist/commands/agent-kit.js +0 -480
  406. package/dist/commands/agent-mcp.d.ts +0 -24
  407. package/dist/commands/agent-mcp.js +0 -127
  408. package/dist/commands/agent-probe.d.ts +0 -77
  409. package/dist/commands/agent-probe.js +0 -335
  410. package/dist/commands/agent.d.ts +0 -13
  411. package/dist/commands/agent.js +0 -40
  412. package/dist/commands/billing-sponsor.d.ts +0 -83
  413. package/dist/commands/billing-sponsor.js +0 -344
  414. package/dist/commands/bot-companies.d.ts +0 -40
  415. package/dist/commands/bot-companies.js +0 -64
  416. package/dist/commands/bot-continuity.d.ts +0 -28
  417. package/dist/commands/bot-continuity.js +0 -68
  418. package/dist/commands/bot-jobs.d.ts +0 -127
  419. package/dist/commands/bot-jobs.js +0 -454
  420. package/dist/commands/bot.d.ts +0 -278
  421. package/dist/commands/bot.js +0 -1982
  422. package/dist/commands/cloud-retire.d.ts +0 -51
  423. package/dist/commands/cloud-retire.js +0 -154
  424. package/dist/commands/company-rename-flag.d.ts +0 -4
  425. package/dist/commands/company-rename-flag.js +0 -7
  426. package/dist/commands/company-rename.d.ts +0 -4
  427. package/dist/commands/company-rename.js +0 -90
  428. package/dist/commands/core-audit-log-native.d.ts +0 -9
  429. package/dist/commands/core-audit-log-native.js +0 -257
  430. package/dist/commands/core-checkpoint-gate-setting.d.ts +0 -59
  431. package/dist/commands/core-checkpoint-gate-setting.js +0 -163
  432. package/dist/commands/core-checkpoint-stop-gate-native.d.ts +0 -34
  433. package/dist/commands/core-checkpoint-stop-gate-native.js +0 -725
  434. package/dist/commands/core-command-catalog.d.ts +0 -34
  435. package/dist/commands/core-command-catalog.js +0 -62
  436. package/dist/commands/core-company-index-scope-flag.d.ts +0 -3
  437. package/dist/commands/core-company-index-scope-flag.js +0 -6
  438. package/dist/commands/core-delegate-w1b.d.ts +0 -10
  439. package/dist/commands/core-delegate-w1b.js +0 -1219
  440. package/dist/commands/core-delegate.d.ts +0 -46
  441. package/dist/commands/core-delegate.js +0 -1040
  442. package/dist/commands/core-dm-bind-native.d.ts +0 -32
  443. package/dist/commands/core-dm-bind-native.js +0 -668
  444. package/dist/commands/core-eval-trigger-native.d.ts +0 -4
  445. package/dist/commands/core-eval-trigger-native.js +0 -12
  446. package/dist/commands/core-git-pack-extension-check-native.d.ts +0 -22
  447. package/dist/commands/core-git-pack-extension-check-native.js +0 -190
  448. package/dist/commands/core-handoff-fast.d.ts +0 -18
  449. package/dist/commands/core-handoff-fast.js +0 -104
  450. package/dist/commands/core-handoff-open-steps.d.ts +0 -21
  451. package/dist/commands/core-handoff-open-steps.js +0 -264
  452. package/dist/commands/core-handoff.d.ts +0 -24
  453. package/dist/commands/core-handoff.js +0 -1144
  454. package/dist/commands/core-hq-session-native.d.ts +0 -39
  455. package/dist/commands/core-hq-session-native.js +0 -579
  456. package/dist/commands/core-job-native-utils.d.ts +0 -6
  457. package/dist/commands/core-job-native-utils.js +0 -80
  458. package/dist/commands/core-job-native.d.ts +0 -5
  459. package/dist/commands/core-job-native.js +0 -16
  460. package/dist/commands/core-job-notify-native.d.ts +0 -36
  461. package/dist/commands/core-job-notify-native.js +0 -359
  462. package/dist/commands/core-job-probe-native.d.ts +0 -45
  463. package/dist/commands/core-job-probe-native.js +0 -564
  464. package/dist/commands/core-job-remediate-native.d.ts +0 -26
  465. package/dist/commands/core-job-remediate-native.js +0 -374
  466. package/dist/commands/core-job-remote-launcher.d.ts +0 -7
  467. package/dist/commands/core-job-remote-launcher.js +0 -51
  468. package/dist/commands/core-job-run-native.d.ts +0 -47
  469. package/dist/commands/core-job-run-native.js +0 -1215
  470. package/dist/commands/core-jobs-native.d.ts +0 -25
  471. package/dist/commands/core-jobs-native.js +0 -1339
  472. package/dist/commands/core-knowledge-prefs.d.ts +0 -11
  473. package/dist/commands/core-knowledge-prefs.js +0 -137
  474. package/dist/commands/core-migrate-policy-triggers-native.d.ts +0 -21
  475. package/dist/commands/core-migrate-policy-triggers-native.js +0 -378
  476. package/dist/commands/core-native-handoff-flag.d.ts +0 -4
  477. package/dist/commands/core-native-handoff-flag.js +0 -7
  478. package/dist/commands/core-native-hook-helper-commands.d.ts +0 -4
  479. package/dist/commands/core-native-hook-helper-commands.js +0 -56
  480. package/dist/commands/core-native-hook-helpers-flag.d.ts +0 -4
  481. package/dist/commands/core-native-hook-helpers-flag.js +0 -7
  482. package/dist/commands/core-native-jobs-flag.d.ts +0 -4
  483. package/dist/commands/core-native-jobs-flag.js +0 -7
  484. package/dist/commands/core-native-policy-flag.d.ts +0 -9
  485. package/dist/commands/core-native-policy-flag.js +0 -12
  486. package/dist/commands/core-native-session-flag.d.ts +0 -4
  487. package/dist/commands/core-native-session-flag.js +0 -7
  488. package/dist/commands/core-native-utilities-flag.d.ts +0 -4
  489. package/dist/commands/core-native-utilities-flag.js +0 -7
  490. package/dist/commands/core-native-utilities.d.ts +0 -29
  491. package/dist/commands/core-native-utilities.js +0 -54
  492. package/dist/commands/core-native-worker-skills-flag.d.ts +0 -4
  493. package/dist/commands/core-native-worker-skills-flag.js +0 -7
  494. package/dist/commands/core-ontology-native.d.ts +0 -17
  495. package/dist/commands/core-ontology-native.js +0 -916
  496. package/dist/commands/core-ontology.d.ts +0 -66
  497. package/dist/commands/core-ontology.js +0 -430
  498. package/dist/commands/core-pin-native.d.ts +0 -14
  499. package/dist/commands/core-pin-native.js +0 -236
  500. package/dist/commands/core-policy-frontmatter.d.ts +0 -8
  501. package/dist/commands/core-policy-frontmatter.js +0 -52
  502. package/dist/commands/core-policy.d.ts +0 -14
  503. package/dist/commands/core-policy.js +0 -1018
  504. package/dist/commands/core-refresh-vault-access-native.d.ts +0 -20
  505. package/dist/commands/core-refresh-vault-access-native.js +0 -229
  506. package/dist/commands/core-register-project-native.d.ts +0 -30
  507. package/dist/commands/core-register-project-native.js +0 -347
  508. package/dist/commands/core-resolve-company-command.d.ts +0 -4
  509. package/dist/commands/core-resolve-company-command.js +0 -42
  510. package/dist/commands/core-resolve-company-native.d.ts +0 -28
  511. package/dist/commands/core-resolve-company-native.js +0 -408
  512. package/dist/commands/core-work-mesh-bind-trusted-native.d.ts +0 -32
  513. package/dist/commands/core-work-mesh-bind-trusted-native.js +0 -190
  514. package/dist/commands/core-work-mesh-live-rebind-native.d.ts +0 -18
  515. package/dist/commands/core-work-mesh-live-rebind-native.js +0 -262
  516. package/dist/commands/core-worker-lint-native.d.ts +0 -4
  517. package/dist/commands/core-worker-lint-native.js +0 -160
  518. package/dist/commands/core-worker-share-native.d.ts +0 -4
  519. package/dist/commands/core-worker-share-native.js +0 -260
  520. package/dist/commands/core-worker-skills-command.d.ts +0 -8
  521. package/dist/commands/core-worker-skills-command.js +0 -33
  522. package/dist/commands/core-worker-skills-runtime.d.ts +0 -33
  523. package/dist/commands/core-worker-skills-runtime.js +0 -86
  524. package/dist/commands/daemon.d.ts +0 -63
  525. package/dist/commands/daemon.js +0 -877
  526. package/dist/commands/deploy-comments.d.ts +0 -3
  527. package/dist/commands/deploy-comments.js +0 -162
  528. package/dist/commands/lanes-accounts.d.ts +0 -28
  529. package/dist/commands/lanes-accounts.js +0 -595
  530. package/dist/commands/lanes-autopilot.d.ts +0 -11
  531. package/dist/commands/lanes-autopilot.js +0 -336
  532. package/dist/commands/lanes-checks.d.ts +0 -51
  533. package/dist/commands/lanes-checks.js +0 -941
  534. package/dist/commands/lanes-hold.d.ts +0 -43
  535. package/dist/commands/lanes-hold.js +0 -655
  536. package/dist/commands/lanes-kpis.d.ts +0 -11
  537. package/dist/commands/lanes-kpis.js +0 -34
  538. package/dist/commands/lanes-message.d.ts +0 -9
  539. package/dist/commands/lanes-message.js +0 -937
  540. package/dist/commands/lanes-move.d.ts +0 -12
  541. package/dist/commands/lanes-move.js +0 -397
  542. package/dist/commands/lanes-questions.d.ts +0 -36
  543. package/dist/commands/lanes-questions.js +0 -1005
  544. package/dist/commands/lanes-report.d.ts +0 -11
  545. package/dist/commands/lanes-report.js +0 -333
  546. package/dist/commands/lanes-resume.d.ts +0 -6
  547. package/dist/commands/lanes-resume.js +0 -564
  548. package/dist/commands/lanes-review.d.ts +0 -10
  549. package/dist/commands/lanes-review.js +0 -56
  550. package/dist/commands/lanes-shared.d.ts +0 -448
  551. package/dist/commands/lanes-shared.js +0 -170
  552. package/dist/commands/lanes-stories.d.ts +0 -15
  553. package/dist/commands/lanes-stories.js +0 -347
  554. package/dist/commands/lanes-watch.d.ts +0 -7
  555. package/dist/commands/lanes-watch.js +0 -216
  556. package/dist/commands/lanes.d.ts +0 -149
  557. package/dist/commands/lanes.js +0 -8973
  558. package/dist/commands/monitor.d.ts +0 -58
  559. package/dist/commands/monitor.js +0 -980
  560. package/dist/commands/onboard-bot-membership.d.ts +0 -32
  561. package/dist/commands/onboard-bot-membership.js +0 -40
  562. package/dist/commands/onboard-create-identity.d.ts +0 -26
  563. package/dist/commands/onboard-create-identity.js +0 -23
  564. package/dist/commands/outpost-pruner.d.ts +0 -3
  565. package/dist/commands/outpost-pruner.js +0 -125
  566. package/dist/commands/personal-connector-settings-flag.d.ts +0 -4
  567. package/dist/commands/personal-connector-settings-flag.js +0 -7
  568. package/dist/commands/personal-targeted-push-flag.d.ts +0 -4
  569. package/dist/commands/personal-targeted-push-flag.js +0 -7
  570. package/dist/commands/personal-targeted-push-paths.d.ts +0 -3
  571. package/dist/commands/personal-targeted-push-paths.js +0 -67
  572. package/dist/commands/report.d.ts +0 -19
  573. package/dist/commands/report.js +0 -537
  574. package/dist/commands/run-feature-telemetry.d.ts +0 -3
  575. package/dist/commands/run-feature-telemetry.js +0 -6
  576. package/dist/commands/staff/reset-test-account.d.ts +0 -110
  577. package/dist/commands/staff/reset-test-account.js +0 -268
  578. package/dist/commands/staff/test-account.d.ts +0 -51
  579. package/dist/commands/staff/test-account.js +0 -196
  580. package/dist/commands/vault-retention-flag.d.ts +0 -3
  581. package/dist/commands/vault-retention-flag.js +0 -9
  582. package/dist/commands/vault-retention.d.ts +0 -11
  583. package/dist/commands/vault-retention.js +0 -69
  584. package/dist/commands/version.d.ts +0 -10
  585. package/dist/commands/version.js +0 -11
  586. package/dist/fast-scaffold.d.ts +0 -86
  587. package/dist/fast-scaffold.js +0 -364
  588. package/dist/lanes-drain-hook.d.ts +0 -14
  589. package/dist/lanes-drain-hook.js +0 -203
  590. package/dist/lib/agent-kit/adopt-identity.d.ts +0 -27
  591. package/dist/lib/agent-kit/adopt-identity.js +0 -60
  592. package/dist/lib/agent-kit/attachment-download.d.ts +0 -24
  593. package/dist/lib/agent-kit/attachment-download.js +0 -47
  594. package/dist/lib/agent-kit/creds.d.ts +0 -106
  595. package/dist/lib/agent-kit/creds.js +0 -163
  596. package/dist/lib/agent-kit/fallback.d.ts +0 -78
  597. package/dist/lib/agent-kit/fallback.js +0 -210
  598. package/dist/lib/agent-kit/inbox-state.d.ts +0 -83
  599. package/dist/lib/agent-kit/inbox-state.js +0 -159
  600. package/dist/lib/agent-kit/kit-config.d.ts +0 -56
  601. package/dist/lib/agent-kit/kit-config.js +0 -65
  602. package/dist/lib/agent-kit/log.d.ts +0 -16
  603. package/dist/lib/agent-kit/log.js +0 -46
  604. package/dist/lib/agent-kit/mcp/attachments.d.ts +0 -126
  605. package/dist/lib/agent-kit/mcp/attachments.js +0 -222
  606. package/dist/lib/agent-kit/mcp/jsonrpc.d.ts +0 -75
  607. package/dist/lib/agent-kit/mcp/jsonrpc.js +0 -164
  608. package/dist/lib/agent-kit/mcp/tools.d.ts +0 -64
  609. package/dist/lib/agent-kit/mcp/tools.js +0 -397
  610. package/dist/lib/agent-kit/paths.d.ts +0 -65
  611. package/dist/lib/agent-kit/paths.js +0 -118
  612. package/dist/lib/agent-kit/private-file.d.ts +0 -29
  613. package/dist/lib/agent-kit/private-file.js +0 -91
  614. package/dist/lib/agent-kit/run/heartbeat.d.ts +0 -72
  615. package/dist/lib/agent-kit/run/heartbeat.js +0 -128
  616. package/dist/lib/agent-kit/run/inbox.d.ts +0 -76
  617. package/dist/lib/agent-kit/run/inbox.js +0 -205
  618. package/dist/lib/agent-kit/run/supervisor.d.ts +0 -35
  619. package/dist/lib/agent-kit/run/supervisor.js +0 -85
  620. package/dist/lib/agent-kit/run/sync.d.ts +0 -33
  621. package/dist/lib/agent-kit/run/sync.js +0 -58
  622. package/dist/lib/agent-kit/services.d.ts +0 -31
  623. package/dist/lib/agent-kit/services.js +0 -55
  624. package/dist/lib/agent-kit/skills.d.ts +0 -18
  625. package/dist/lib/agent-kit/skills.js +0 -151
  626. package/dist/lib/agent-kit/wake.d.ts +0 -83
  627. package/dist/lib/agent-kit/wake.js +0 -243
  628. package/dist/lib/agents/model-catalog.d.ts +0 -62
  629. package/dist/lib/agents/model-catalog.js +0 -275
  630. package/dist/lib/auth-login-provider-state.d.ts +0 -8
  631. package/dist/lib/auth-login-provider-state.js +0 -63
  632. package/dist/lib/aws-sdk-node-warning-output.d.ts +0 -12
  633. package/dist/lib/aws-sdk-node-warning-output.js +0 -22
  634. package/dist/lib/billing/free-month.d.ts +0 -18
  635. package/dist/lib/billing/free-month.js +0 -31
  636. package/dist/lib/billing/plan-limit-refusals.d.ts +0 -69
  637. package/dist/lib/billing/plan-limit-refusals.js +0 -187
  638. package/dist/lib/billing/plan-limit-upgrade-url.d.ts +0 -11
  639. package/dist/lib/billing/plan-limit-upgrade-url.js +0 -66
  640. package/dist/lib/billing/plan-lock.d.ts +0 -143
  641. package/dist/lib/billing/plan-lock.js +0 -439
  642. package/dist/lib/bot/api.d.ts +0 -349
  643. package/dist/lib/bot/api.js +0 -316
  644. package/dist/lib/bot/attachments.d.ts +0 -45
  645. package/dist/lib/bot/attachments.js +0 -89
  646. package/dist/lib/bot/cli-update.d.ts +0 -138
  647. package/dist/lib/bot/cli-update.js +0 -278
  648. package/dist/lib/bot/company-bind.d.ts +0 -27
  649. package/dist/lib/bot/company-bind.js +0 -62
  650. package/dist/lib/bot/config.d.ts +0 -153
  651. package/dist/lib/bot/config.js +0 -233
  652. package/dist/lib/bot/continuity-download.d.ts +0 -28
  653. package/dist/lib/bot/continuity-download.js +0 -75
  654. package/dist/lib/bot/continuity-install.d.ts +0 -14
  655. package/dist/lib/bot/continuity-install.js +0 -101
  656. package/dist/lib/bot/continuity.d.ts +0 -67
  657. package/dist/lib/bot/continuity.js +0 -301
  658. package/dist/lib/bot/creds.d.ts +0 -24
  659. package/dist/lib/bot/creds.js +0 -51
  660. package/dist/lib/bot/daemon.d.ts +0 -173
  661. package/dist/lib/bot/daemon.js +0 -552
  662. package/dist/lib/bot/inbox-poll-backoff-flag.d.ts +0 -24
  663. package/dist/lib/bot/inbox-poll-backoff-flag.js +0 -135
  664. package/dist/lib/bot/inbox-state.d.ts +0 -18
  665. package/dist/lib/bot/inbox-state.js +0 -51
  666. package/dist/lib/bot/index.d.ts +0 -23
  667. package/dist/lib/bot/index.js +0 -23
  668. package/dist/lib/bot/inflight.d.ts +0 -119
  669. package/dist/lib/bot/inflight.js +0 -83
  670. package/dist/lib/bot/job-completions.d.ts +0 -89
  671. package/dist/lib/bot/job-completions.js +0 -132
  672. package/dist/lib/bot/job-run.d.ts +0 -109
  673. package/dist/lib/bot/job-run.js +0 -246
  674. package/dist/lib/bot/local-config.d.ts +0 -61
  675. package/dist/lib/bot/local-config.js +0 -145
  676. package/dist/lib/bot/local-jobs.d.ts +0 -89
  677. package/dist/lib/bot/local-jobs.js +0 -459
  678. package/dist/lib/bot/local-name.d.ts +0 -54
  679. package/dist/lib/bot/local-name.js +0 -114
  680. package/dist/lib/bot/log.d.ts +0 -13
  681. package/dist/lib/bot/log.js +0 -59
  682. package/dist/lib/bot/owner-context.d.ts +0 -79
  683. package/dist/lib/bot/owner-context.js +0 -175
  684. package/dist/lib/bot/paths.d.ts +0 -76
  685. package/dist/lib/bot/paths.js +0 -131
  686. package/dist/lib/bot/progress.d.ts +0 -132
  687. package/dist/lib/bot/progress.js +0 -289
  688. package/dist/lib/bot/promote.d.ts +0 -16
  689. package/dist/lib/bot/promote.js +0 -106
  690. package/dist/lib/bot/promotion-hold.d.ts +0 -24
  691. package/dist/lib/bot/promotion-hold.js +0 -103
  692. package/dist/lib/bot/promotion-receipt.d.ts +0 -9
  693. package/dist/lib/bot/promotion-receipt.js +0 -56
  694. package/dist/lib/bot/promotion-upload.d.ts +0 -16
  695. package/dist/lib/bot/promotion-upload.js +0 -80
  696. package/dist/lib/bot/prompt.d.ts +0 -136
  697. package/dist/lib/bot/prompt.js +0 -433
  698. package/dist/lib/bot/room-policy.d.ts +0 -63
  699. package/dist/lib/bot/room-policy.js +0 -91
  700. package/dist/lib/bot/run.d.ts +0 -217
  701. package/dist/lib/bot/run.js +0 -1869
  702. package/dist/lib/bot/runnable.d.ts +0 -51
  703. package/dist/lib/bot/runnable.js +0 -65
  704. package/dist/lib/bot/runtime/claude.d.ts +0 -50
  705. package/dist/lib/bot/runtime/claude.js +0 -170
  706. package/dist/lib/bot/runtime/codex.d.ts +0 -28
  707. package/dist/lib/bot/runtime/codex.js +0 -153
  708. package/dist/lib/bot/runtime/grok-acp.d.ts +0 -40
  709. package/dist/lib/bot/runtime/grok-acp.js +0 -265
  710. package/dist/lib/bot/runtime/grok.d.ts +0 -41
  711. package/dist/lib/bot/runtime/grok.js +0 -169
  712. package/dist/lib/bot/runtime/index.d.ts +0 -36
  713. package/dist/lib/bot/runtime/index.js +0 -417
  714. package/dist/lib/bot/runtime/messages-stream.d.ts +0 -56
  715. package/dist/lib/bot/runtime/messages-stream.js +0 -194
  716. package/dist/lib/bot/runtime/sanitize.d.ts +0 -18
  717. package/dist/lib/bot/runtime/sanitize.js +0 -28
  718. package/dist/lib/bot/runtime/types.d.ts +0 -159
  719. package/dist/lib/bot/runtime/types.js +0 -51
  720. package/dist/lib/bot/runtime/windows.d.ts +0 -10
  721. package/dist/lib/bot/runtime/windows.js +0 -53
  722. package/dist/lib/bot/runtime-sign-in.d.ts +0 -24
  723. package/dist/lib/bot/runtime-sign-in.js +0 -31
  724. package/dist/lib/bot/scaffold.d.ts +0 -38
  725. package/dist/lib/bot/scaffold.js +0 -94
  726. package/dist/lib/bot/self-heal.d.ts +0 -52
  727. package/dist/lib/bot/self-heal.js +0 -79
  728. package/dist/lib/bot/self-process.d.ts +0 -19
  729. package/dist/lib/bot/self-process.js +0 -35
  730. package/dist/lib/bot/session.d.ts +0 -19
  731. package/dist/lib/bot/session.js +0 -39
  732. package/dist/lib/bot/setup-explain.d.ts +0 -64
  733. package/dist/lib/bot/setup-explain.js +0 -141
  734. package/dist/lib/bot/split.d.ts +0 -32
  735. package/dist/lib/bot/split.js +0 -241
  736. package/dist/lib/bot/status.d.ts +0 -57
  737. package/dist/lib/bot/status.js +0 -66
  738. package/dist/lib/bot/worker-source.d.ts +0 -66
  739. package/dist/lib/bot/worker-source.js +0 -283
  740. package/dist/lib/checkpoint-ontology/aliases.d.ts +0 -17
  741. package/dist/lib/checkpoint-ontology/aliases.js +0 -44
  742. package/dist/lib/checkpoint-ontology/apply.d.ts +0 -110
  743. package/dist/lib/checkpoint-ontology/apply.js +0 -777
  744. package/dist/lib/checkpoint-ontology/company-brief.d.ts +0 -18
  745. package/dist/lib/checkpoint-ontology/company-brief.js +0 -337
  746. package/dist/lib/checkpoint-ontology/company.d.ts +0 -44
  747. package/dist/lib/checkpoint-ontology/company.js +0 -118
  748. package/dist/lib/checkpoint-ontology/drop-aliases.d.ts +0 -41
  749. package/dist/lib/checkpoint-ontology/drop-aliases.js +0 -76
  750. package/dist/lib/checkpoint-ontology/entity-file.d.ts +0 -109
  751. package/dist/lib/checkpoint-ontology/entity-file.js +0 -371
  752. package/dist/lib/checkpoint-ontology/identity.d.ts +0 -38
  753. package/dist/lib/checkpoint-ontology/identity.js +0 -95
  754. package/dist/lib/checkpoint-ontology/merge-copies.d.ts +0 -199
  755. package/dist/lib/checkpoint-ontology/merge-copies.js +0 -1086
  756. package/dist/lib/checkpoint-ontology/multi-writer.d.ts +0 -101
  757. package/dist/lib/checkpoint-ontology/multi-writer.js +0 -394
  758. package/dist/lib/checkpoint-ontology/plan.d.ts +0 -193
  759. package/dist/lib/checkpoint-ontology/plan.js +0 -504
  760. package/dist/lib/checkpoint-ontology/queued-touches.d.ts +0 -29
  761. package/dist/lib/checkpoint-ontology/queued-touches.js +0 -193
  762. package/dist/lib/checkpoint-ontology/sync-client.d.ts +0 -38
  763. package/dist/lib/checkpoint-ontology/sync-client.js +0 -84
  764. package/dist/lib/checkpoint-ontology/tree.d.ts +0 -55
  765. package/dist/lib/checkpoint-ontology/tree.js +0 -198
  766. package/dist/lib/company-errors-sdk-warning-flag.d.ts +0 -5
  767. package/dist/lib/company-errors-sdk-warning-flag.js +0 -8
  768. package/dist/lib/core-utils/hook-timeout-debug-context-flag.d.ts +0 -20
  769. package/dist/lib/core-utils/hook-timeout-debug-context-flag.js +0 -81
  770. package/dist/lib/core-utils/jq-json-serializer.d.ts +0 -5
  771. package/dist/lib/core-utils/jq-json-serializer.js +0 -10
  772. package/dist/lib/core-utils/secret-patterns.d.ts +0 -43
  773. package/dist/lib/core-utils/secret-patterns.js +0 -34
  774. package/dist/lib/core-utils/sentry-report.d.ts +0 -114
  775. package/dist/lib/core-utils/sentry-report.js +0 -1034
  776. package/dist/lib/core-utils/timeout-guard-native.d.ts +0 -7
  777. package/dist/lib/core-utils/timeout-guard-native.js +0 -40
  778. package/dist/lib/core-utils/worktree-resume.d.ts +0 -20
  779. package/dist/lib/core-utils/worktree-resume.js +0 -1198
  780. package/dist/lib/daemon/catalog.d.ts +0 -134
  781. package/dist/lib/daemon/catalog.js +0 -358
  782. package/dist/lib/daemon/config.d.ts +0 -35
  783. package/dist/lib/daemon/config.js +0 -108
  784. package/dist/lib/daemon/flag.d.ts +0 -25
  785. package/dist/lib/daemon/flag.js +0 -59
  786. package/dist/lib/daemon/handoff.d.ts +0 -56
  787. package/dist/lib/daemon/handoff.js +0 -161
  788. package/dist/lib/daemon/hq-cloud.d.ts +0 -79
  789. package/dist/lib/daemon/hq-cloud.js +0 -183
  790. package/dist/lib/daemon/install.d.ts +0 -85
  791. package/dist/lib/daemon/install.js +0 -320
  792. package/dist/lib/daemon/legacy-sync-env.d.ts +0 -10
  793. package/dist/lib/daemon/legacy-sync-env.js +0 -58
  794. package/dist/lib/daemon/legacy.d.ts +0 -45
  795. package/dist/lib/daemon/legacy.js +0 -133
  796. package/dist/lib/daemon/lock.d.ts +0 -47
  797. package/dist/lib/daemon/lock.js +0 -138
  798. package/dist/lib/daemon/machine-type.d.ts +0 -50
  799. package/dist/lib/daemon/machine-type.js +0 -159
  800. package/dist/lib/daemon/migrate.d.ts +0 -77
  801. package/dist/lib/daemon/migrate.js +0 -265
  802. package/dist/lib/daemon/paths.d.ts +0 -24
  803. package/dist/lib/daemon/paths.js +0 -43
  804. package/dist/lib/daemon/protocol-tail.d.ts +0 -33
  805. package/dist/lib/daemon/protocol-tail.js +0 -131
  806. package/dist/lib/daemon/remote-control.d.ts +0 -74
  807. package/dist/lib/daemon/remote-control.js +0 -153
  808. package/dist/lib/daemon/requests.d.ts +0 -28
  809. package/dist/lib/daemon/requests.js +0 -65
  810. package/dist/lib/daemon/run.d.ts +0 -79
  811. package/dist/lib/daemon/run.js +0 -755
  812. package/dist/lib/daemon/succession.d.ts +0 -118
  813. package/dist/lib/daemon/succession.js +0 -263
  814. package/dist/lib/daemon/supervisor.d.ts +0 -132
  815. package/dist/lib/daemon/supervisor.js +0 -836
  816. package/dist/lib/daemon/sync-runner.d.ts +0 -58
  817. package/dist/lib/daemon/sync-runner.js +0 -277
  818. package/dist/lib/daemon/tools.d.ts +0 -52
  819. package/dist/lib/daemon/tools.js +0 -95
  820. package/dist/lib/daemon/updater.d.ts +0 -57
  821. package/dist/lib/daemon/updater.js +0 -163
  822. package/dist/lib/deploy-api.d.ts +0 -5
  823. package/dist/lib/deploy-api.js +0 -21
  824. package/dist/lib/deploy-apps.d.ts +0 -13
  825. package/dist/lib/deploy-apps.js +0 -29
  826. package/dist/lib/doctor/__testing__/run-doctor.d.ts +0 -8
  827. package/dist/lib/doctor/__testing__/run-doctor.js +0 -52
  828. package/dist/lib/doctor/checks/bots.d.ts +0 -13
  829. package/dist/lib/doctor/checks/bots.js +0 -189
  830. package/dist/lib/doctor/checks/scaffold-cli-floor.d.ts +0 -6
  831. package/dist/lib/doctor/checks/scaffold-cli-floor.js +0 -73
  832. package/dist/lib/doctor/checks/sync-runtime.d.ts +0 -11
  833. package/dist/lib/doctor/checks/sync-runtime.js +0 -216
  834. package/dist/lib/doctor/client-health-flag-token.d.ts +0 -15
  835. package/dist/lib/doctor/client-health-flag-token.js +0 -66
  836. package/dist/lib/doctor/client-health-reason-codes-flag.d.ts +0 -27
  837. package/dist/lib/doctor/client-health-reason-codes-flag.js +0 -106
  838. package/dist/lib/doctor/fix/json-output.d.ts +0 -28
  839. package/dist/lib/doctor/fix/json-output.js +0 -33
  840. package/dist/lib/doctor/fix/refresh-sync-outcome.d.ts +0 -12
  841. package/dist/lib/doctor/fix/refresh-sync-outcome.js +0 -25
  842. package/dist/lib/doctor/shared.d.ts +0 -8
  843. package/dist/lib/doctor/shared.js +0 -38
  844. package/dist/lib/doctor/stray-gate-entries.d.ts +0 -35
  845. package/dist/lib/doctor/stray-gate-entries.js +0 -83
  846. package/dist/lib/first-sync-next-step.d.ts +0 -37
  847. package/dist/lib/first-sync-next-step.js +0 -189
  848. package/dist/lib/flag-registry-endpoint.d.ts +0 -5
  849. package/dist/lib/flag-registry-endpoint.js +0 -9
  850. package/dist/lib/flag-registry-worker-source.generated.d.ts +0 -2
  851. package/dist/lib/flag-registry-worker-source.generated.js +0 -3
  852. package/dist/lib/flag-snapshot-file.d.ts +0 -20
  853. package/dist/lib/flag-snapshot-file.js +0 -91
  854. package/dist/lib/heartbeat-identity.d.ts +0 -30
  855. package/dist/lib/heartbeat-identity.js +0 -76
  856. package/dist/lib/lanes/account-home.d.ts +0 -8
  857. package/dist/lib/lanes/account-home.js +0 -10
  858. package/dist/lib/lanes/accounts.d.ts +0 -117
  859. package/dist/lib/lanes/accounts.js +0 -366
  860. package/dist/lib/lanes/admission-host.d.ts +0 -22
  861. package/dist/lib/lanes/admission-host.js +0 -37
  862. package/dist/lib/lanes/admission.d.ts +0 -26
  863. package/dist/lib/lanes/admission.js +0 -210
  864. package/dist/lib/lanes/approval-gate.d.ts +0 -8
  865. package/dist/lib/lanes/approval-gate.js +0 -90
  866. package/dist/lib/lanes/autopilot-metrics.d.ts +0 -99
  867. package/dist/lib/lanes/autopilot-metrics.js +0 -301
  868. package/dist/lib/lanes/autopilot-registry.d.ts +0 -62
  869. package/dist/lib/lanes/autopilot-registry.js +0 -192
  870. package/dist/lib/lanes/autopilot.d.ts +0 -120
  871. package/dist/lib/lanes/autopilot.js +0 -1061
  872. package/dist/lib/lanes/blocker-freshness.d.ts +0 -31
  873. package/dist/lib/lanes/blocker-freshness.js +0 -168
  874. package/dist/lib/lanes/checked-company-path.d.ts +0 -3
  875. package/dist/lib/lanes/checked-company-path.js +0 -39
  876. package/dist/lib/lanes/claude-balance.d.ts +0 -97
  877. package/dist/lib/lanes/claude-balance.js +0 -319
  878. package/dist/lib/lanes/compaction.d.ts +0 -110
  879. package/dist/lib/lanes/compaction.js +0 -293
  880. package/dist/lib/lanes/config.d.ts +0 -94
  881. package/dist/lib/lanes/config.js +0 -606
  882. package/dist/lib/lanes/constants.d.ts +0 -3
  883. package/dist/lib/lanes/constants.js +0 -3
  884. package/dist/lib/lanes/delivery-core.d.ts +0 -15
  885. package/dist/lib/lanes/delivery-core.js +0 -21
  886. package/dist/lib/lanes/delivery.d.ts +0 -180
  887. package/dist/lib/lanes/delivery.js +0 -443
  888. package/dist/lib/lanes/disk-guard.d.ts +0 -66
  889. package/dist/lib/lanes/disk-guard.js +0 -172
  890. package/dist/lib/lanes/dropbox.d.ts +0 -129
  891. package/dist/lib/lanes/dropbox.js +0 -601
  892. package/dist/lib/lanes/effort.d.ts +0 -51
  893. package/dist/lib/lanes/effort.js +0 -113
  894. package/dist/lib/lanes/envelope-repair-dispatch.d.ts +0 -26
  895. package/dist/lib/lanes/envelope-repair-dispatch.js +0 -74
  896. package/dist/lib/lanes/errors.d.ts +0 -39
  897. package/dist/lib/lanes/errors.js +0 -72
  898. package/dist/lib/lanes/flag-keys.d.ts +0 -15
  899. package/dist/lib/lanes/flag-keys.js +0 -15
  900. package/dist/lib/lanes/grants.d.ts +0 -30
  901. package/dist/lib/lanes/grants.js +0 -171
  902. package/dist/lib/lanes/hire-grant-dispatch.d.ts +0 -29
  903. package/dist/lib/lanes/hire-grant-dispatch.js +0 -315
  904. package/dist/lib/lanes/hooks-install.d.ts +0 -82
  905. package/dist/lib/lanes/hooks-install.js +0 -479
  906. package/dist/lib/lanes/host-capacity.d.ts +0 -69
  907. package/dist/lib/lanes/host-capacity.js +0 -254
  908. package/dist/lib/lanes/hq-root.d.ts +0 -19
  909. package/dist/lib/lanes/hq-root.js +0 -28
  910. package/dist/lib/lanes/index.d.ts +0 -76
  911. package/dist/lib/lanes/index.js +0 -42
  912. package/dist/lib/lanes/keep-alive.d.ts +0 -68
  913. package/dist/lib/lanes/keep-alive.js +0 -343
  914. package/dist/lib/lanes/kr-freshness.d.ts +0 -76
  915. package/dist/lib/lanes/kr-freshness.js +0 -413
  916. package/dist/lib/lanes/lane-company.d.ts +0 -10
  917. package/dist/lib/lanes/lane-company.js +0 -41
  918. package/dist/lib/lanes/liveness.d.ts +0 -108
  919. package/dist/lib/lanes/liveness.js +0 -396
  920. package/dist/lib/lanes/machine-identity.d.ts +0 -34
  921. package/dist/lib/lanes/machine-identity.js +0 -92
  922. package/dist/lib/lanes/manager-status-gate.d.ts +0 -17
  923. package/dist/lib/lanes/manager-status-gate.js +0 -133
  924. package/dist/lib/lanes/merge-command.d.ts +0 -15
  925. package/dist/lib/lanes/merge-command.js +0 -629
  926. package/dist/lib/lanes/mesh-events.d.ts +0 -127
  927. package/dist/lib/lanes/mesh-events.js +0 -564
  928. package/dist/lib/lanes/message-replay.d.ts +0 -21
  929. package/dist/lib/lanes/message-replay.js +0 -122
  930. package/dist/lib/lanes/models.d.ts +0 -86
  931. package/dist/lib/lanes/models.js +0 -234
  932. package/dist/lib/lanes/monitor.d.ts +0 -48
  933. package/dist/lib/lanes/monitor.js +0 -428
  934. package/dist/lib/lanes/move-account.d.ts +0 -56
  935. package/dist/lib/lanes/move-account.js +0 -193
  936. package/dist/lib/lanes/orphans.d.ts +0 -25
  937. package/dist/lib/lanes/orphans.js +0 -102
  938. package/dist/lib/lanes/outpost-dispatch.d.ts +0 -147
  939. package/dist/lib/lanes/outpost-dispatch.js +0 -271
  940. package/dist/lib/lanes/outpost-hire-cache.d.ts +0 -22
  941. package/dist/lib/lanes/outpost-hire-cache.js +0 -153
  942. package/dist/lib/lanes/outpost-identity.d.ts +0 -33
  943. package/dist/lib/lanes/outpost-identity.js +0 -59
  944. package/dist/lib/lanes/outpost-profile-repin.d.ts +0 -17
  945. package/dist/lib/lanes/outpost-profile-repin.js +0 -84
  946. package/dist/lib/lanes/outpost-pruner-install.d.ts +0 -37
  947. package/dist/lib/lanes/outpost-pruner-install.js +0 -238
  948. package/dist/lib/lanes/outpost-registry-worker-approval.d.ts +0 -18
  949. package/dist/lib/lanes/outpost-registry-worker-approval.js +0 -109
  950. package/dist/lib/lanes/outpost-snapshot-memo.d.ts +0 -6
  951. package/dist/lib/lanes/outpost-snapshot-memo.js +0 -14
  952. package/dist/lib/lanes/outpost-worktree-pruner-flag.d.ts +0 -19
  953. package/dist/lib/lanes/outpost-worktree-pruner-flag.js +0 -86
  954. package/dist/lib/lanes/outpost-worktree-pruner.d.ts +0 -62
  955. package/dist/lib/lanes/outpost-worktree-pruner.js +0 -1201
  956. package/dist/lib/lanes/profile.d.ts +0 -69
  957. package/dist/lib/lanes/profile.js +0 -552
  958. package/dist/lib/lanes/provider-rejection.d.ts +0 -86
  959. package/dist/lib/lanes/provider-rejection.js +0 -286
  960. package/dist/lib/lanes/questions.d.ts +0 -90
  961. package/dist/lib/lanes/questions.js +0 -384
  962. package/dist/lib/lanes/quota.d.ts +0 -134
  963. package/dist/lib/lanes/quota.js +0 -471
  964. package/dist/lib/lanes/reconcile-install.d.ts +0 -90
  965. package/dist/lib/lanes/reconcile-install.js +0 -257
  966. package/dist/lib/lanes/reconcile.d.ts +0 -161
  967. package/dist/lib/lanes/reconcile.js +0 -3324
  968. package/dist/lib/lanes/registry-flag.d.ts +0 -35
  969. package/dist/lib/lanes/registry-flag.js +0 -164
  970. package/dist/lib/lanes/registry-persona.d.ts +0 -20
  971. package/dist/lib/lanes/registry-persona.js +0 -329
  972. package/dist/lib/lanes/registry.d.ts +0 -122
  973. package/dist/lib/lanes/registry.js +0 -570
  974. package/dist/lib/lanes/reviews.d.ts +0 -38
  975. package/dist/lib/lanes/reviews.js +0 -395
  976. package/dist/lib/lanes/runaway-tool-guard.d.ts +0 -38
  977. package/dist/lib/lanes/runaway-tool-guard.js +0 -284
  978. package/dist/lib/lanes/session-relink.d.ts +0 -25
  979. package/dist/lib/lanes/session-relink.js +0 -216
  980. package/dist/lib/lanes/spawn.d.ts +0 -355
  981. package/dist/lib/lanes/spawn.js +0 -2668
  982. package/dist/lib/lanes/ssm-command-context.d.ts +0 -12
  983. package/dist/lib/lanes/ssm-command-context.js +0 -52
  984. package/dist/lib/lanes/store.d.ts +0 -91
  985. package/dist/lib/lanes/store.js +0 -1822
  986. package/dist/lib/lanes/stories.d.ts +0 -23
  987. package/dist/lib/lanes/stories.js +0 -92
  988. package/dist/lib/lanes/story-ledger.d.ts +0 -80
  989. package/dist/lib/lanes/story-ledger.js +0 -815
  990. package/dist/lib/lanes/story-switch.d.ts +0 -21
  991. package/dist/lib/lanes/story-switch.js +0 -75
  992. package/dist/lib/lanes/text-scan.d.ts +0 -11
  993. package/dist/lib/lanes/text-scan.js +0 -103
  994. package/dist/lib/lanes/throttle.d.ts +0 -116
  995. package/dist/lib/lanes/throttle.js +0 -437
  996. package/dist/lib/lanes/timestamp.d.ts +0 -3
  997. package/dist/lib/lanes/timestamp.js +0 -26
  998. package/dist/lib/lanes/tracker-checks.d.ts +0 -77
  999. package/dist/lib/lanes/tracker-checks.js +0 -134
  1000. package/dist/lib/lanes/tracker-report-state.d.ts +0 -10
  1001. package/dist/lib/lanes/tracker-report-state.js +0 -124
  1002. package/dist/lib/lanes/tracker-report.d.ts +0 -203
  1003. package/dist/lib/lanes/tracker-report.js +0 -522
  1004. package/dist/lib/lanes/tracker-store.d.ts +0 -18
  1005. package/dist/lib/lanes/tracker-store.js +0 -106
  1006. package/dist/lib/lanes/types.d.ts +0 -1030
  1007. package/dist/lib/lanes/types.js +0 -418
  1008. package/dist/lib/lanes/wait.d.ts +0 -39
  1009. package/dist/lib/lanes/wait.js +0 -159
  1010. package/dist/lib/lanes/watch.d.ts +0 -39
  1011. package/dist/lib/lanes/watch.js +0 -249
  1012. package/dist/lib/lanes/watcher-main.d.ts +0 -11
  1013. package/dist/lib/lanes/watcher-main.js +0 -108
  1014. package/dist/lib/lanes/watcher.d.ts +0 -287
  1015. package/dist/lib/lanes/watcher.js +0 -1972
  1016. package/dist/lib/mesh/denial-codes.d.ts +0 -5
  1017. package/dist/lib/mesh/denial-codes.js +0 -14
  1018. package/dist/lib/mesh/live/daemon/config.d.ts +0 -36
  1019. package/dist/lib/mesh/live/daemon/config.js +0 -120
  1020. package/dist/lib/mesh/live/daemon/legacy-listen.d.ts +0 -43
  1021. package/dist/lib/mesh/live/daemon/legacy-listen.js +0 -89
  1022. package/dist/lib/mesh/live/daemon/live-cache.d.ts +0 -26
  1023. package/dist/lib/mesh/live/daemon/live-cache.js +0 -116
  1024. package/dist/lib/mesh/live/daemon/mqtt-events.d.ts +0 -7
  1025. package/dist/lib/mesh/live/daemon/mqtt-events.js +0 -2
  1026. package/dist/lib/mesh/live/daemon/mqtt-events.test-d.d.ts +0 -2
  1027. package/dist/lib/mesh/live/daemon/mqtt-events.test-d.js +0 -10
  1028. package/dist/lib/mesh/live/daemon/version-drift.d.ts +0 -5
  1029. package/dist/lib/mesh/live/daemon/version-drift.js +0 -47
  1030. package/dist/lib/mesh/live/daemon/work-subscribe.d.ts +0 -32
  1031. package/dist/lib/mesh/live/daemon/work-subscribe.js +0 -262
  1032. package/dist/lib/mesh/live/report-summary.d.ts +0 -45
  1033. package/dist/lib/mesh/live/report-summary.js +0 -234
  1034. package/dist/lib/mesh/live/session-seq.d.ts +0 -4
  1035. package/dist/lib/mesh/live/session-seq.js +0 -33
  1036. package/dist/lib/mesh/project-board.d.ts +0 -65
  1037. package/dist/lib/mesh/project-board.js +0 -181
  1038. package/dist/lib/mesh/story-status.d.ts +0 -22
  1039. package/dist/lib/mesh/story-status.js +0 -49
  1040. package/dist/lib/monitor.d.ts +0 -149
  1041. package/dist/lib/monitor.js +0 -519
  1042. package/dist/lib/node-binary.d.ts +0 -50
  1043. package/dist/lib/node-binary.js +0 -133
  1044. package/dist/lib/notify-recipient.d.ts +0 -7
  1045. package/dist/lib/notify-recipient.js +0 -11
  1046. package/dist/lib/onboarding/checkpoint.d.ts +0 -13
  1047. package/dist/lib/onboarding/checkpoint.js +0 -44
  1048. package/dist/lib/onboarding/cli/onboard.d.ts +0 -53
  1049. package/dist/lib/onboarding/cli/onboard.js +0 -135
  1050. package/dist/lib/onboarding/cli/prompts.d.ts +0 -28
  1051. package/dist/lib/onboarding/cli/prompts.js +0 -83
  1052. package/dist/lib/onboarding/errors.d.ts +0 -34
  1053. package/dist/lib/onboarding/errors.js +0 -59
  1054. package/dist/lib/onboarding/index.d.ts +0 -13
  1055. package/dist/lib/onboarding/index.js +0 -13
  1056. package/dist/lib/onboarding/orchestrator.d.ts +0 -47
  1057. package/dist/lib/onboarding/orchestrator.js +0 -569
  1058. package/dist/lib/onboarding/types.d.ts +0 -79
  1059. package/dist/lib/onboarding/types.js +0 -8
  1060. package/dist/lib/policy-validator.d.ts +0 -7
  1061. package/dist/lib/policy-validator.js +0 -187
  1062. package/dist/lib/process-flag-company-context.d.ts +0 -8
  1063. package/dist/lib/process-flag-company-context.js +0 -67
  1064. package/dist/lib/report-publish.d.ts +0 -175
  1065. package/dist/lib/report-publish.js +0 -421
  1066. package/dist/lib/report-run.d.ts +0 -62
  1067. package/dist/lib/report-run.js +0 -123
  1068. package/dist/lib/report-snapshot.d.ts +0 -12
  1069. package/dist/lib/report-snapshot.js +0 -135
  1070. package/dist/lib/report-templates.d.ts +0 -9
  1071. package/dist/lib/report-templates.js +0 -21
  1072. package/dist/lib/scaffold-cli-floor.d.ts +0 -8
  1073. package/dist/lib/scaffold-cli-floor.js +0 -50
  1074. package/dist/lib/search-index/collection-path-repair-flag.d.ts +0 -4
  1075. package/dist/lib/search-index/collection-path-repair-flag.js +0 -7
  1076. package/dist/lib/search-index/embed-lock.d.ts +0 -34
  1077. package/dist/lib/search-index/embed-lock.js +0 -295
  1078. package/dist/lib/search-index/load-gate.d.ts +0 -57
  1079. package/dist/lib/search-index/load-gate.js +0 -270
  1080. package/dist/lib/search-index/max-doc-bytes.d.ts +0 -219
  1081. package/dist/lib/search-index/max-doc-bytes.js +0 -463
  1082. package/dist/lib/search-index/qmd-exit-diagnostics.d.ts +0 -5
  1083. package/dist/lib/search-index/qmd-exit-diagnostics.js +0 -40
  1084. package/dist/lib/search-index/reindex-single-flight-flag.d.ts +0 -5
  1085. package/dist/lib/search-index/reindex-single-flight-flag.js +0 -8
  1086. package/dist/lib/service-manager/index.d.ts +0 -42
  1087. package/dist/lib/service-manager/index.js +0 -105
  1088. package/dist/lib/service-manager/launchd.d.ts +0 -81
  1089. package/dist/lib/service-manager/launchd.js +0 -212
  1090. package/dist/lib/service-manager/systemd.d.ts +0 -19
  1091. package/dist/lib/service-manager/systemd.js +0 -72
  1092. package/dist/lib/service-manager/types.d.ts +0 -34
  1093. package/dist/lib/service-manager/types.js +0 -26
  1094. package/dist/lib/test-utils/isolated-flag-company-context.d.ts +0 -3
  1095. package/dist/lib/test-utils/isolated-flag-company-context.js +0 -18
  1096. package/dist/lib/work-context/bind-best.d.ts +0 -66
  1097. package/dist/lib/work-context/bind-best.js +0 -344
  1098. package/dist/lib/work-context/bind-calling-session.d.ts +0 -26
  1099. package/dist/lib/work-context/bind-calling-session.js +0 -63
  1100. package/dist/lib/work-context/company-rebind.d.ts +0 -23
  1101. package/dist/lib/work-context/company-rebind.js +0 -59
  1102. package/dist/lib/work-context/default-company.d.ts +0 -43
  1103. package/dist/lib/work-context/default-company.js +0 -83
  1104. package/dist/lib/work-context/outbox-quarantine-status-flag.d.ts +0 -4
  1105. package/dist/lib/work-context/outbox-quarantine-status-flag.js +0 -7
  1106. package/dist/lib/work-context/prd-sync.d.ts +0 -56
  1107. package/dist/lib/work-context/prd-sync.js +0 -197
  1108. package/dist/lib/work-context/preflight-contract.d.ts +0 -28
  1109. package/dist/lib/work-context/preflight-contract.js +0 -85
  1110. package/dist/lib/work-context/prompt-rebind.d.ts +0 -25
  1111. package/dist/lib/work-context/prompt-rebind.js +0 -85
  1112. package/dist/lib/work-context/windows-acl.d.ts +0 -123
  1113. package/dist/lib/work-context/windows-acl.js +0 -425
  1114. package/dist/lib/workers-registry/read.d.ts +0 -15
  1115. package/dist/lib/workers-registry/read.js +0 -17
  1116. package/dist/native-fast-route.d.ts +0 -7
  1117. package/dist/native-fast-route.js +0 -45
  1118. package/dist/node-network-compat-core.d.ts +0 -12
  1119. package/dist/node-network-compat-core.js +0 -41
  1120. package/dist/node-network-compat-fast.d.ts +0 -7
  1121. package/dist/node-network-compat-fast.js +0 -23
  1122. package/dist/secrets-env-fast-path.d.ts +0 -5
  1123. package/dist/secrets-env-fast-path.js +0 -16
  1124. package/dist/secrets-env-fast-route.d.ts +0 -18
  1125. package/dist/secrets-env-fast-route.js +0 -54
  1126. package/dist/utils/checkpoint-stamp-write-error.d.ts +0 -28
  1127. package/dist/utils/checkpoint-stamp-write-error.js +0 -99
  1128. package/dist/utils/cli-network-lifecycle.d.ts +0 -4
  1129. package/dist/utils/cli-network-lifecycle.js +0 -11
  1130. package/dist/utils/cognito-refresh-sentry.d.ts +0 -3
  1131. package/dist/utils/cognito-refresh-sentry.js +0 -49
  1132. package/dist/utils/console-origin.d.ts +0 -9
  1133. package/dist/utils/console-origin.js +0 -28
  1134. package/dist/utils/core-eval-trigger.d.ts +0 -4
  1135. package/dist/utils/core-eval-trigger.js +0 -88
  1136. package/dist/utils/exclusive-lock.d.ts +0 -32
  1137. package/dist/utils/exclusive-lock.js +0 -75
  1138. package/dist/utils/fast-stream-errors.d.ts +0 -12
  1139. package/dist/utils/fast-stream-errors.js +0 -18
  1140. package/dist/utils/files-browse-acl.d.ts +0 -5
  1141. package/dist/utils/files-browse-acl.js +0 -11
  1142. package/dist/utils/hq-core-yaml.d.ts +0 -10
  1143. package/dist/utils/hq-core-yaml.js +0 -40
  1144. package/dist/utils/hq-root-resolver.d.ts +0 -13
  1145. package/dist/utils/hq-root-resolver.js +0 -103
  1146. package/dist/utils/redact-url.d.ts +0 -14
  1147. package/dist/utils/redact-url.js +0 -218
  1148. package/dist/utils/scaffold-fast-import-guard.d.ts +0 -2
  1149. package/dist/utils/scaffold-fast-import-guard.js +0 -40
  1150. package/dist/utils/scaffold-packlist-guard.d.ts +0 -7
  1151. package/dist/utils/scaffold-packlist-guard.js +0 -23
  1152. package/dist/utils/scaffold-sibling-references.d.ts +0 -22
  1153. package/dist/utils/scaffold-sibling-references.js +0 -156
  1154. package/dist/utils/secret-load-availability.d.ts +0 -8
  1155. package/dist/utils/secret-load-availability.js +0 -54
  1156. package/dist/utils/staged-install.d.ts +0 -34
  1157. package/dist/utils/staged-install.js +0 -346
  1158. package/dist/utils/staged-npm-install.d.ts +0 -16
  1159. package/dist/utils/staged-npm-install.js +0 -264
  1160. package/dist/utils/sync-log-sources.d.ts +0 -15
  1161. package/dist/utils/sync-log-sources.js +0 -36
  1162. package/dist/utils/table-width.d.ts +0 -7
  1163. package/dist/utils/table-width.js +0 -15
  1164. package/dist/utils/update-command-supervisor.cjs +0 -247
  1165. package/dist/utils/upload-author.d.ts +0 -15
  1166. package/dist/utils/upload-author.js +0 -39
  1167. package/dist/utils/version-report.d.ts +0 -27
  1168. package/dist/utils/version-report.js +0 -105
  1169. package/dist/version-request.d.ts +0 -14
  1170. package/dist/version-request.js +0 -36
  1171. package/scripts/mesh-daemon-if-stale.mjs +0 -20
  1172. package/templates/reports/blank.md +0 -3
  1173. package/templates/reports/daily-digest.md +0 -11
  1174. package/templates/runbooks/update-report.md +0 -21
@@ -30,193 +30,18 @@
30
30
  * are only READ (their exported symbols), never modified.
31
31
  */
32
32
  import * as nodeFs from "node:fs";
33
- import { homedir } from "node:os";
34
33
  import * as path from "node:path";
35
34
  import { fileURLToPath } from "node:url";
36
35
  import { CLI_NAME } from "../cli-version.js";
37
36
  import { boundedDiagnosticValue } from "./package-root-diagnostics.js";
38
- import { isLockStale, UPDATE_LOCK_STALE_MS } from "./update-lock.js";
37
+ import { isLockStale } from "./update-lock.js";
39
38
  /** Byte caps for the (hq-derived, path-shaped) diagnostic strings. */
40
39
  const SPECIFIER_BYTES = 256;
41
40
  const IMPORTER_BYTES = 256;
42
41
  const PACKAGE_ROOT_BYTES = 256;
43
- /** Byte cap for the lock holder's `tool` (the only foreign string this reads). */
44
- const LOCK_TOOL_BYTES = 64;
45
- /** The eval-throw error name is a short closed-set token; the cap is only a belt. */
46
- const ERRORNAME_BYTES = 64;
47
42
  const ESM_PACKAGE_RE = /^Cannot find package '([^']+)' imported from (.+)$/s;
48
43
  const CJS_MODULE_RE = /^Cannot find module '([^']+)'/s;
49
44
  const ESM_MODULE_IMPORTED_RE = /^Cannot find module '([^']+)' imported from (.+)$/s;
50
- /**
51
- * The Node ESM loader's SOURCE-READ helper in `node:internal/modules/esm/load`
52
- * (Node 22) or `node:internal/modules/esm/loader` (Node 24's sync loader).
53
- * `getSourceSync` must be the first non-`node:fs` caller after the source read;
54
- * an ordinary fs ENOENT that escapes module evaluation therefore stays outside
55
- * recovery even when an outer ModuleLoader frame exists.
56
- */
57
- const ESM_SOURCE_READ_FRAME = /^at getSourceSync \(node:internal[\\/]modules[\\/]esm[\\/](?:load|loader)\b/;
58
- const NODE_FS_FRAME = /^at .* \(node:fs\b/;
59
- /** True only when Node's ESM source-read helper called the failing fs read. */
60
- function hasEsmLoaderSourceReadFrame(stack) {
61
- const frames = stack
62
- .split("\n")
63
- .map((line) => line.trim())
64
- .filter((line) => line.startsWith("at "));
65
- let sawFsRead = false;
66
- for (const frame of frames) {
67
- if (!sawFsRead) {
68
- if (NODE_FS_READ_FRAME.test(frame))
69
- sawFsRead = true;
70
- continue;
71
- }
72
- if (NODE_FS_FRAME.test(frame))
73
- continue;
74
- return ESM_SOURCE_READ_FRAME.test(frame);
75
- }
76
- return false;
77
- }
78
- /**
79
- * The Node module RESOLVER frame — `finalizeResolution` in
80
- * `node:internal/modules/esm/resolve` (the observed HQ-CLI-1S route, where
81
- * realpathSync lstat's a component that vanished after the earlier stat), or the
82
- * CJS `Module._findPath → toRealPath` route in `node:internal/modules/cjs/loader`
83
- * (the same stat-then-lstat TOCTOU, accepted for symmetry). Requiring a resolver
84
- * frame — alongside `syscall === 'lstat'` — is what proves the ENOENT came from
85
- * the resolver's realpath step, so an ordinary `fs.lstatSync` ENOENT written by
86
- * hq's own code (no resolver frame) is NOT misclassified as a torn install.
87
- */
88
- const RESOLVER_FRAME = /node:internal[\\/]modules[\\/](?:esm[\\/]resolve|cjs[\\/]loader)\b/;
89
- /** The closed set of error `name`s the eval-throw dialect accepts (HQ-CLI-1T). */
90
- const EVAL_THROW_NAMES = new Set(["TypeError", "ReferenceError", "SyntaxError"]);
91
- /**
92
- * A CJS module-EVALUATION frame — `Module._compile` / `wrapSafe` in
93
- * `node:internal/modules/cjs/loader`, where a required module's top-level code
94
- * runs (and where a SyntaxError is raised at compile). NOT the resolve frame
95
- * `Module._resolveFilename`, so a resolution failure is never read as an eval.
96
- */
97
- const CJS_EVAL_FRAME = /\bat (?:Module\._compile|wrapSafe) \(node:internal[\\/]modules[\\/]cjs[\\/]loader/;
98
- /** An ESM module-EVALUATION frame — `ModuleJob` run/evaluate in esm/module_job. */
99
- const ESM_EVAL_FRAME = /node:internal[\\/]modules[\\/]esm[\\/]module_job\b/;
100
- /** Whether `stack` carries a CJS or ESM module-EVALUATION loader frame. */
101
- function hasModuleEvalFrame(stack) {
102
- return CJS_EVAL_FRAME.test(stack) || ESM_EVAL_FRAME.test(stack);
103
- }
104
- /**
105
- * The Node CJS loader's SOURCE-READ position (HQ-CLI-20) — the CJS twin of
106
- * {@link hasEsmLoaderSourceReadFrame}. A CJS require whose target was present at RESOLVE (its
107
- * filename cached in Module._pathCache) and gone at READ fails inside the loader's
108
- * source read: `readFileSync (node:fs)` called by `defaultLoadImpl`/`loadSource`
109
- * (Node ≥22) or, on older Node, the `Module._extensions..js` extension handler —
110
- * all frames in `node:internal/modules/cjs/loader`, and (unlike HQ-CLI-1M) with NO
111
- * ESM source-read frame.
112
- *
113
- * The discriminator is POSITIONAL: the innermost `node:fs` read frame's
114
- * IMMEDIATELY-following (caller) frame must be a cjs/loader frame that is NOT a
115
- * module-EVALUATION frame (Module._compile / wrapSafe). That is what proves the
116
- * LOADER was reading the module's source. An ordinary `fs.readFileSync`/`openSync`
117
- * ENOENT that merely ESCAPES a third-party module's own EVALUATION has the
118
- * third-party FILE directly beneath `node:fs`, not a cjs/loader frame, so it stays
119
- * captured (both shapes reproduced frame-for-frame on Node v22.23.1). The
120
- * positional rule is the PRIMARY discriminator; the source-read helper NAMES are
121
- * an accepted closed set, not the sole requirement, so a renamed helper still
122
- * classifies.
123
- *
124
- * The whole-stack presence of Module._compile is deliberately NOT a rejection
125
- * signal: under a raised Error.stackTraceLimit the torn shape ALSO carries the
126
- * requiring module's own Module._compile frame — always at depth 11, past the
127
- * default limit of 10 — so only the frame immediately beneath the node:fs read is
128
- * consulted. Exported so incomplete-install-error.ts (which already imports from
129
- * this module) shares the exact gate rather than duplicating the positional logic,
130
- * mirroring how {@link evalThrowShape} and {@link packageNameOf} are shared.
131
- */
132
- const NODE_FS_READ_FRAME = /^at (?:[\w$.]+\.)?(?:readFileSync|openSync) \(node:fs\b/;
133
- const CJS_LOADER_FRAME = /node:internal[\\/]modules[\\/]cjs[\\/]loader\b/;
134
- export function hasCjsLoaderSourceReadFrame(stack) {
135
- const frames = stack
136
- .split("\n")
137
- .map((line) => line.trim())
138
- .filter((line) => line.startsWith("at "));
139
- for (let i = 0; i < frames.length; i++) {
140
- if (!NODE_FS_READ_FRAME.test(frames[i]))
141
- continue;
142
- const caller = frames[i + 1];
143
- if (caller === undefined)
144
- return false;
145
- return CJS_LOADER_FRAME.test(caller) && !CJS_EVAL_FRAME.test(caller);
146
- }
147
- return false;
148
- }
149
- /**
150
- * A stack LOCATION token — the absolute filesystem path in either an
151
- * `at <fn> (<abs>:L:C)` frame or a bare `<abs>:L` header line (the source
152
- * location a SyntaxError prepends). Anchored at line-start or an opening paren so
153
- * a `node:internal/…` internal frame (never an absolute FS path) is skipped, and
154
- * a Windows drive/UNC path is matched by shape so it classifies on any host.
155
- */
156
- const STACK_LOCATION = /(?:^|\()((?:\/|[A-Za-z]:[\\/]|\\\\)[^():\n]*?):\d+(?::\d+)?(?:\)|$)/;
157
- /**
158
- * A `file:` URL location in a stack frame — the form Node uses for an ESM module
159
- * EVALUATION frame (`at file:///abs/mod.mjs:2:1`, or the same wrapped in parens).
160
- * The whole non-space token is captured; the caller strips the trailing paren and
161
- * `:line[:col]` and decodes it with fileURLToPath.
162
- */
163
- function fileUrlFromFrame(line) {
164
- const token = line.match(/file:\/\/\/\S+/);
165
- if (!token)
166
- return null;
167
- const url = token[0].replace(/\)+$/, "").replace(/:\d+(?::\d+)?$/, "");
168
- try {
169
- return fileURLToPath(url);
170
- }
171
- catch {
172
- return null; // not a decodable file URL
173
- }
174
- }
175
- /**
176
- * The eval-throw THROW SITE — the FIRST absolute filesystem path token in the
177
- * stack, scanning top-down: for an ordinary error that is the throwing frame (a
178
- * raw path for a CJS module, or a `file:` URL for an ESM one); for a SyntaxError
179
- * it is the `<abs>:L` header line the stack carries before the `Error:` line.
180
- * Returns null when no absolute path token is present.
181
- */
182
- function evalThrowSite(stack) {
183
- for (const rawLine of stack.split("\n")) {
184
- const line = rawLine.trim();
185
- const plain = STACK_LOCATION.exec(line);
186
- if (plain)
187
- return plain[1];
188
- const fromUrl = fileUrlFromFrame(line);
189
- if (fromUrl)
190
- return fromUrl;
191
- }
192
- return null;
193
- }
194
- /**
195
- * Lexical `<root>/node_modules/` containment for the eval-throw throw-site gate.
196
- * Separator- and (Windows-shape-only) case-folded and anchored at a true
197
- * directory boundary, so a sibling such as `<root>-old/node_modules/…` never
198
- * matches. Mirrors incomplete-install-error.ts's isUnderNodeModules discipline;
199
- * kept local because that module imports THIS one (a shared import would cycle).
200
- */
201
- function looksWin32(p) {
202
- return /^[a-zA-Z]:[\\/]/.test(p) || /^\\\\/.test(p);
203
- }
204
- function foldForCompare(p) {
205
- const folded = p.replace(/[\\/]+/g, "/").replace(/\/+$/, "");
206
- return looksWin32(p) ? folded.toLowerCase() : folded;
207
- }
208
- function isUnderNodeModules(candidate, root) {
209
- if (!candidate || !root)
210
- return false;
211
- return foldForCompare(candidate).startsWith(`${foldForCompare(root)}/node_modules/`);
212
- }
213
- /**
214
- * A relative module specifier — `./x`, `../x`, `.\x`, `..\x`, or a bare `.`/`..`.
215
- * Mirrors the shape src/utils/incomplete-install-error.ts uses, extended with the
216
- * bare-`.`/`..` case so a token that packageNameOf would reduce to the
217
- * un-probeable name `.` is caught here and re-resolved instead.
218
- */
219
- const RELATIVE_CJS_SPECIFIER = /^\.\.?([\\/]|$)/;
220
45
  /**
221
46
  * Reduce a bare specifier to its PACKAGE name: `@scope/name/sub` → `@scope/name`,
222
47
  * `name/sub` → `name`, `name` → `name`. This is the unit the readiness probe
@@ -229,104 +54,19 @@ export function packageNameOf(specifier) {
229
54
  return parts.slice(0, 2).join("/");
230
55
  return parts[0] ?? specifier;
231
56
  }
232
- /**
233
- * Build a `package` target from an already-reduced name, UNLESS that name is not
234
- * a plausible bare package: empty, a relative token reduced to `.`/`..`, or a
235
- * subpath-imports token (`#internal`). Each of those reduces to a name whose
236
- * `node_modules/<name>/package.json` ancestor probe can NEVER be true, so it
237
- * falls back to `unknown` — readiness then turns on the lock / retired-dir /
238
- * quiet signals rather than a probe that stays permanently false.
239
- */
240
- function barePackageTarget(name, from) {
241
- if (name.length === 0 || name.startsWith(".") || name.startsWith("#")) {
242
- return { kind: "unknown" };
243
- }
244
- return { kind: "package", name, from };
245
- }
246
57
  /**
247
58
  * Classify a thrown value as a module-resolution failure and extract the missing
248
59
  * target, or return `null` for anything that is not one. The decision is
249
- * STRUCTURAL: `err.code` must be exactly `ERR_MODULE_NOT_FOUND`,
250
- * `MODULE_NOT_FOUND`, or — for the esm-loader ENOENT dialect — `ENOENT` under
251
- * the full conjunction below. No argv, env, or free text is ever consulted, and
252
- * any other error (including an import-time throw of another class) returns
253
- * `null` so it is rethrown to the existing boundary unchanged.
60
+ * STRUCTURAL: `err.code` must be exactly `ERR_MODULE_NOT_FOUND` or
61
+ * `MODULE_NOT_FOUND` — no argv, env, or free text is ever consulted, and any
62
+ * other error (including an import-time throw of another class) returns `null`
63
+ * so it is rethrown to the existing boundary unchanged.
254
64
  */
255
65
  export function classifyModuleNotFound(err) {
256
66
  if (err === null || typeof err !== "object")
257
67
  return null;
258
68
  const record = err;
259
69
  const code = record.code;
260
- // (0) esm-loader ENOENT (HQ-CLI-1M): a module present at RESOLVE and gone at
261
- // READ, so Node's ESM loader raises ENOENT from getSourceSync/openSync rather
262
- // than ERR_MODULE_NOT_FOUND at resolve. Gated on the FULL conjunction — code
263
- // ENOENT AND syscall 'open' AND an esm-loader stack frame AND a string path —
264
- // so an ordinary fs.readFileSync/openSync ENOENT written by hq's own code (no
265
- // loader frame) cannot enter it. The vanished file IS the re-resolvable target
266
- // the settle wait polls; recovery then waits and re-execs exactly as for the
267
- // other dialects.
268
- if (code === "ENOENT") {
269
- if (record.syscall === "open" &&
270
- typeof record.path === "string" &&
271
- typeof record.stack === "string" &&
272
- hasEsmLoaderSourceReadFrame(record.stack)) {
273
- return {
274
- code,
275
- dialect: "esm-enoent",
276
- specifier: record.path,
277
- importer: "",
278
- target: { kind: "path", path: record.path },
279
- };
280
- }
281
- // cjs-loader source-read ENOENT (HQ-CLI-20): the CJS twin of esm-enoent — a
282
- // require() whose target was present at RESOLVE (its filename held in
283
- // Module._pathCache) and gone at READ, so the CJS loader's source read raises
284
- // ENOENT with syscall 'open' and a cjs/loader frame but NO ESM source-read frame
285
- // (which is why arm (0) missed it and classifyModuleNotFound returned null,
286
- // filing the bare HQ-CLI-20 capture). Gated on the FULL conjunction — code
287
- // ENOENT AND syscall 'open' AND a string path AND the POSITIONAL CJS
288
- // source-read gate — so a third-party module's own top-level fs.readFileSync
289
- // ENOENT (module EVALUATION, its own frame directly beneath node:fs) stays null
290
- // and keeps its capture. Ordered AFTER the esm-enoent arm so HQ-CLI-1M keeps
291
- // its byte-for-byte classification. Target 'path': the vanished file is a
292
- // regular .js/.json file Node's CJS LOAD_AS_FILE step re-resolves, so the probe
293
- // and settle wait reuse the same machinery as esm-enoent, unchanged.
294
- if (record.syscall === "open" &&
295
- typeof record.path === "string" &&
296
- typeof record.stack === "string" &&
297
- hasCjsLoaderSourceReadFrame(record.stack)) {
298
- return {
299
- code,
300
- dialect: "cjs-enoent",
301
- specifier: record.path,
302
- importer: "",
303
- target: { kind: "path", path: record.path },
304
- };
305
- }
306
- // resolve-time ENOENT (HQ-CLI-1S): Node's resolver stat'ed a path OK, then
307
- // realpathSync lstat'ed a component that a concurrent reinstall renamed away
308
- // between the two, throwing ENOENT with syscall `lstat` from a RESOLVER frame
309
- // (finalizeResolution / Module._findPath→toRealPath). Gated on the FULL
310
- // conjunction so an ordinary fs.lstatSync ENOENT from hq's own code (no
311
- // resolver frame) and a rename/unlink ENOENT (syscall not `lstat`) both stay
312
- // null. The vanished component may be a package/scope DIRECTORY whose bare
313
- // existence precedes its `package.json`, so the target is `exists` (presence
314
- // only); readiness still rides the lock / manifest-health / retired-sibling /
315
- // quiet guards. Structurally a loader race like esm-enoent — no writer gate.
316
- if (record.syscall === "lstat" &&
317
- typeof record.path === "string" &&
318
- typeof record.stack === "string" &&
319
- RESOLVER_FRAME.test(record.stack)) {
320
- return {
321
- code,
322
- dialect: "resolve-enoent",
323
- specifier: record.path,
324
- importer: "",
325
- target: { kind: "exists", path: record.path },
326
- };
327
- }
328
- return null;
329
- }
330
70
  if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND")
331
71
  return null;
332
72
  const message = typeof record.message === "string" ? record.message : "";
@@ -354,7 +94,7 @@ export function classifyModuleNotFound(err) {
354
94
  dialect: "esm-package",
355
95
  specifier: spec,
356
96
  importer,
357
- target: barePackageTarget(spec, path.dirname(importer)),
97
+ target: { kind: "package", name: spec, from: path.dirname(importer) },
358
98
  };
359
99
  }
360
100
  // (c) CJS `Cannot find module '<spec>'` (+ Require stack). Absolute → a path
@@ -368,32 +108,12 @@ export function classifyModuleNotFound(err) {
368
108
  if (path.isAbsolute(spec)) {
369
109
  return { code, dialect: "cjs-path", specifier: spec, importer, target: { kind: "path", path: spec } };
370
110
  }
371
- // Relative specifier (`./x`, `../x`): Node reports the RAW token, so
372
- // packageNameOf would reduce it to `.`/`..` and build a package target
373
- // whose ancestor probe can never be true. Re-resolve it from the importer's
374
- // directory, and report the RESOLVED path as the diagnostic specifier
375
- // (actionable — the missing sibling's real location), mirroring esm-path.
376
- if (RELATIVE_CJS_SPECIFIER.test(spec)) {
377
- if (importer && path.isAbsolute(importer)) {
378
- const from = path.dirname(importer);
379
- return {
380
- code,
381
- dialect: "cjs-relative",
382
- specifier: path.resolve(from, spec),
383
- importer,
384
- target: { kind: "relative", specifier: spec, from },
385
- };
386
- }
387
- // No usable (absolute) importer survived — fall back to the lock /
388
- // retired-dir / quiet signals rather than a probe that cannot be true.
389
- return { code, dialect: "cjs-relative", specifier: spec, importer, target: { kind: "unknown" } };
390
- }
391
111
  return {
392
112
  code,
393
113
  dialect: "cjs-package",
394
114
  specifier: spec,
395
115
  importer,
396
- target: barePackageTarget(packageNameOf(spec), path.dirname(importer)),
116
+ target: { kind: "package", name: packageNameOf(spec), from: path.dirname(importer) },
397
117
  };
398
118
  }
399
119
  }
@@ -409,65 +129,9 @@ export function classifyModuleNotFound(err) {
409
129
  // the lock / retired-dir / quiet signals only.
410
130
  return { code, dialect: "unknown", specifier: "", importer: "", target: { kind: "unknown" } };
411
131
  }
412
- /**
413
- * Detect a module-EVALUATION throw STRUCTURALLY, WITHOUT the node_modules
414
- * boundary gate: an error with NO `code`, a `name` in the closed set
415
- * {TypeError, ReferenceError, SyntaxError}, a CJS/ESM module-evaluation loader
416
- * frame, and a resolvable throw-site path. This is the shape a half-written
417
- * dependency file produces — require() read an empty module and returned `{}`, so
418
- * calling one of its exports throws a code-less TypeError while the module's own
419
- * top-level code runs. No message text is ever parsed. The caller applies its own
420
- * packageRoot gate ({@link classifyEvalThrow} for recovery, the boundary for
421
- * capture context), so this stays pure and reusable. Returns null for anything
422
- * that is not this shape — a coded error (ERR_REQUIRE_ESM etc.), an Error /
423
- * RangeError name, a throw with no loader frame, or no absolute throw site.
424
- */
425
- export function evalThrowShape(err) {
426
- if (err === null || typeof err !== "object")
427
- return null;
428
- const record = err;
429
- if (record.code !== undefined)
430
- return null;
431
- const name = typeof record.name === "string" ? record.name : "";
432
- if (!EVAL_THROW_NAMES.has(name))
433
- return null;
434
- if (typeof record.stack !== "string" || !hasModuleEvalFrame(record.stack))
435
- return null;
436
- const throwSite = evalThrowSite(record.stack);
437
- if (throwSite === null)
438
- return null;
439
- return { errorName: name, throwSite };
440
- }
441
- /**
442
- * Classify a module-EVALUATION throw as a torn-install recovery candidate
443
- * (HQ-CLI-1T) — the {@link evalThrowShape} fingerprint AND a throw site under
444
- * `<packageRoot>/node_modules/`. A throw under the install's own `dist/` or
445
- * `assets/`, outside the root, or with an unresolved root is NOT classified, so a
446
- * genuine hq-cli code defect keeps its raw capture. Unlike the loader-race
447
- * dialects the recovery seam gates this on a live writer signal before waiting.
448
- * `packageRoot` comes from the seam's resolvePackageRoot (running-install → derived
449
- * fallback). The target is `unknown` — an eval-throw carries no re-resolvable
450
- * missing file, so recovery keys entirely on the writer signal + quiet window.
451
- */
452
- export function classifyEvalThrow(err, packageRoot) {
453
- const shape = evalThrowShape(err);
454
- if (shape === null)
455
- return null;
456
- if (!packageRoot || !isUnderNodeModules(shape.throwSite, packageRoot))
457
- return null;
458
- return {
459
- code: "EVAL_THROW",
460
- dialect: "eval-throw",
461
- specifier: shape.throwSite,
462
- importer: "",
463
- target: { kind: "unknown" },
464
- errorName: shape.errorName,
465
- };
466
- }
467
132
  const nodeInstallTreeFs = {
468
133
  existsSync: (p) => nodeFs.existsSync(p),
469
134
  statSync: (p) => nodeFs.statSync(p),
470
- lstatSync: (p) => nodeFs.lstatSync(p),
471
135
  readFileSync: (p, encoding) => nodeFs.readFileSync(p, encoding),
472
136
  readdirSync: (p) => nodeFs.readdirSync(p),
473
137
  };
@@ -481,58 +145,6 @@ function defaultIsPidAlive(pid) {
481
145
  return err.code === "EPERM";
482
146
  }
483
147
  }
484
- /** CJS extensions Node's LOAD_AS_FILE / LOAD_INDEX try, in order. */
485
- const CJS_FILE_EXTENSIONS = [".js", ".json", ".node"];
486
- /** Whether `p` exists AND is a regular file (not a directory); any fs error → false. */
487
- function isResolvableFile(p, fs) {
488
- try {
489
- return fs.existsSync(p) && !fs.statSync(p).isDirectory();
490
- }
491
- catch {
492
- return false;
493
- }
494
- }
495
- /** Node's LOAD_AS_FILE(X): X itself, then X + each CJS extension — each must be a file. */
496
- function loadAsFile(base, fs) {
497
- if (isResolvableFile(base, fs))
498
- return true;
499
- return CJS_FILE_EXTENSIONS.some((ext) => isResolvableFile(base + ext, fs));
500
- }
501
- /** Node's LOAD_INDEX(X): X/index.{js,json,node} — each must be a file. */
502
- function loadIndex(dir, fs) {
503
- return CJS_FILE_EXTENSIONS.some((ext) => isResolvableFile(path.join(dir, `index${ext}`), fs));
504
- }
505
- /**
506
- * Whether a relative target's resolved `base` is loadable exactly as Node's CJS
507
- * require would load it: LOAD_AS_FILE(base), else LOAD_AS_DIRECTORY(base) — its
508
- * package.json `main` resolved as a file (or that main's index), else
509
- * base/index.*. A bare or partially-extracted directory — one that holds neither
510
- * a resolvable `main` nor an index file — is deliberately NOT loadable, so it
511
- * reads as not-present and the single re-exec cannot fire on a still-torn tree
512
- * (mirrors the MODULE_NOT_FOUND Node would still throw for that state).
513
- */
514
- function relativeTargetResolvable(base, fs) {
515
- if (loadAsFile(base, fs))
516
- return true;
517
- const manifest = path.join(base, "package.json");
518
- if (isResolvableFile(manifest, fs)) {
519
- let main = null;
520
- try {
521
- const parsed = JSON.parse(fs.readFileSync(manifest, "utf-8"));
522
- if (typeof parsed.main === "string" && parsed.main.trim() !== "")
523
- main = parsed.main;
524
- }
525
- catch {
526
- main = null; // unreadable / unparseable manifest — fall back to index.*
527
- }
528
- if (main !== null) {
529
- const mainBase = path.resolve(base, main);
530
- if (loadAsFile(mainBase, fs) || loadIndex(mainBase, fs))
531
- return true;
532
- }
533
- }
534
- return loadIndex(base, fs);
535
- }
536
148
  /**
537
149
  * Whether the missing target is now present on disk — the readiness signal the
538
150
  * settle wait polls. It re-resolves the SAME step Node's resolver took:
@@ -543,13 +155,6 @@ function relativeTargetResolvable(base, fs) {
543
155
  * exact ancestor walk `getPackageJSONURL` performs, done WITHOUT
544
156
  * `createRequire` so an ESM-only / export-conditioned package
545
157
  * cannot false-negative.
546
- * - `relative`: re-resolve `path.resolve(from, specifier)` as Node's CJS
547
- * require would — a real file (exact / `.js` / `.json` / `.node`),
548
- * or a directory whose package.json `main` (or that main's index)
549
- * or own `index.*` is a real file. A bare or partially-extracted
550
- * directory is NOT loadable and reads as not-present.
551
- * - `exists`: the path exists at all (any file type) — presence only, because
552
- * the vanished component may be a package/scope directory.
553
158
  * - `unknown`: true (readiness turns on the other signals).
554
159
  * Any filesystem error reads as "not present" rather than throwing.
555
160
  */
@@ -557,12 +162,6 @@ export function installTargetPresent(target, fs = nodeInstallTreeFs) {
557
162
  try {
558
163
  if (target.kind === "unknown")
559
164
  return true;
560
- // `exists` (resolve-enoent, HQ-CLI-1S): the lstat'ed component may be a
561
- // package/scope DIRECTORY whose bare existence precedes its `package.json`, so
562
- // presence alone is the signal here — the surrounding manifest-health /
563
- // retired-sibling / quiet guards keep a premature re-exec bounded.
564
- if (target.kind === "exists")
565
- return fs.existsSync(target.path);
566
165
  if (target.kind === "path") {
567
166
  if (!fs.existsSync(target.path))
568
167
  return false;
@@ -576,15 +175,6 @@ export function installTargetPresent(target, fs = nodeInstallTreeFs) {
576
175
  }
577
176
  return true;
578
177
  }
579
- if (target.kind === "relative") {
580
- // Re-resolve exactly as Node's CJS require would from `from`, so the probe
581
- // turns true only when the missing module is ACTUALLY loadable again — a
582
- // bare or partially-extracted directory must not read as present, or the
583
- // single re-exec would fire on a still-torn tree. The extensionless case
584
- // matters — a production sibling shape (`./Base/TreeIterator`, HQ-CLI-1N)
585
- // carries no extension, so an exact-path-only probe would stay false for it.
586
- return relativeTargetResolvable(path.resolve(target.from, target.specifier), fs);
587
- }
588
178
  // package: ancestor walk from `from`.
589
179
  let dir = path.resolve(target.from);
590
180
  for (;;) {
@@ -601,15 +191,6 @@ export function installTargetPresent(target, fs = nodeInstallTreeFs) {
601
191
  return false;
602
192
  }
603
193
  }
604
- /**
605
- * Default ceiling on the CUMULATIVE time the wait may spend observing a FRESH
606
- * foreign lock held by a live pid. Equal to the shared update-lock contract's own
607
- * staleness window ({@link UPDATE_LOCK_STALE_MS} — "no healthy npm install -g of
608
- * this package runs 10 minutes"), so the wait trusts a live cooperating writer for
609
- * exactly as long as the contract legitimises holding the lock, and never longer.
610
- * Overridable by the seam (env HQ_INSTALL_SETTLE_LOCK_TIMEOUT_MS).
611
- */
612
- const DEFAULT_INSTALL_SETTLE_LOCK_WAIT_MS = UPDATE_LOCK_STALE_MS;
613
194
  /** The scope/leaf split of CLI_NAME, e.g. `@indigoai-us` / `hq-cli`. */
614
195
  function cliNameParts() {
615
196
  const slash = CLI_NAME.indexOf("/");
@@ -617,32 +198,26 @@ function cliNameParts() {
617
198
  return { scope: null, leaf: CLI_NAME };
618
199
  return { scope: CLI_NAME.slice(0, slash), leaf: CLI_NAME.slice(slash + 1) };
619
200
  }
620
- /**
621
- * The FRESH update lock held by a DIFFERENT live pid, or null. A non-null result
622
- * blocks readiness AND extends the wait under the lock ceiling; the lock file is
623
- * only ever READ. Freshness is decided by {@link isLockStale} exactly as before
624
- * (parseable, `startedAt` younger than {@link UPDATE_LOCK_STALE_MS}, pid alive),
625
- * and our own pid never counts.
626
- */
627
- function freshForeignLock(lockPath, nowMs, isPidAlive, fs) {
201
+ /** Whether a FRESH update lock is held by a DIFFERENT live pid (blocks readiness). */
202
+ function freshForeignLockHeld(lockPath, nowMs, isPidAlive, fs) {
628
203
  let raw;
629
204
  try {
630
205
  raw = fs.readFileSync(lockPath, "utf-8");
631
206
  }
632
207
  catch {
633
- return null; // no lock (ENOENT) or unreadable — not a fresh foreign holder
208
+ return false; // no lock (ENOENT) or unreadable — not a fresh foreign holder
634
209
  }
635
210
  if (isLockStale(raw, nowMs, isPidAlive))
636
- return null;
211
+ return false;
637
212
  try {
638
213
  const info = JSON.parse(raw);
639
214
  if (info.pid === process.pid)
640
- return null; // our own lock never blocks us
641
- return info;
215
+ return false; // our own lock never blocks us
642
216
  }
643
217
  catch {
644
- return null; // isLockStale already treats unparseable as stale, unreachable
218
+ return false; // isLockStale already treats unparseable as stale, unreachable
645
219
  }
220
+ return true;
646
221
  }
647
222
  /** Whether an npm retired/staging sibling (`.<leaf>-*`) sits beside packageRoot. */
648
223
  function retiredSiblingPresent(packageRoot, fs) {
@@ -652,302 +227,20 @@ function retiredSiblingPresent(packageRoot, fs) {
652
227
  const entries = fs.readdirSync(parent); // caller treats a throw as "not ready"
653
228
  return entries.some((entry) => entry.startsWith(stagingPrefix));
654
229
  }
655
- /** Reduce an observed sibling basename to a closed kind without retaining it. */
656
- function retiredSiblingKind(packageRoot, fs) {
657
- if (!packageRoot)
658
- return "unknown";
659
- try {
660
- const { leaf } = cliNameParts();
661
- const prefix = "." + leaf + "-";
662
- const siblings = fs
663
- .readdirSync(path.dirname(packageRoot))
664
- .filter((entry) => entry.startsWith(prefix))
665
- .sort();
666
- if (siblings.length === 0)
667
- return "unknown";
668
- const name = siblings[0];
669
- if (/^\.hq-cli-staging-[A-Za-z0-9-]+$/.test(name))
670
- return "hq_staging";
671
- if (/^\.hq-cli-backup-[A-Za-z0-9-]+$/.test(name))
672
- return "hq_backup";
673
- if (/^\.hq-cli-[A-Za-z0-9]{8}$/.test(name))
674
- return "npm_hash_retired";
675
- return "other";
676
- }
677
- catch {
678
- return "unknown";
679
- }
680
- }
681
- /** Classify current target/manifest state without retaining paths or file contents. */
682
- function installTargetState(target, packageRoot, fs) {
683
- if (target.kind === "unknown")
684
- return "unknown";
685
- if (!installTargetPresent(target, fs))
686
- return "missing";
687
- if (!packageRoot)
688
- return "unknown";
689
- try {
690
- const raw = fs.readFileSync(path.join(packageRoot, "package.json"), "utf-8");
691
- let manifest;
692
- try {
693
- manifest = JSON.parse(raw);
694
- }
695
- catch {
696
- return "manifest_invalid";
697
- }
698
- return manifest.name === CLI_NAME ? "manifest_valid" : "manifest_invalid";
699
- }
700
- catch (error) {
701
- return error?.code === "ENOENT" ? "missing" : "unreadable";
702
- }
703
- }
704
- /** Read only the lock's recorded owner PID; never retain or report the PID. */
705
- function updaterPidAlive(lockPath, fs, isPidAlive) {
706
- try {
707
- const lock = JSON.parse(fs.readFileSync(lockPath, "utf-8"));
708
- if (typeof lock.pid !== "number" || !Number.isSafeInteger(lock.pid) || lock.pid <= 0) {
709
- return "unknown";
710
- }
711
- return isPidAlive(lock.pid) ? "true" : "false";
712
- }
713
- catch {
714
- return "unknown";
715
- }
716
- }
717
- /** Snapshot retired sibling trees so changes below their root stay observable. */
718
- function retiredSiblingActivitySignature(packageRoot, fs) {
719
- const { leaf } = cliNameParts();
720
- const stagingPrefix = `.${leaf}-`;
721
- const parent = path.dirname(packageRoot);
722
- const siblings = fs.readdirSync(parent).filter((entry) => entry.startsWith(stagingPrefix)).sort();
723
- const snapshots = [["names", siblings]];
724
- let observed = true;
725
- let visited = 0;
726
- const maxEntries = 20_000;
727
- const maxDepth = 64;
728
- const visit = (absolutePath, relativePath, depth) => {
729
- visited += 1;
730
- if (visited > maxEntries) {
731
- observed = false;
732
- return;
733
- }
734
- try {
735
- const stat = fs.lstatSync ? fs.lstatSync(absolutePath) : fs.statSync(absolutePath);
736
- const symbolicLink = stat.isSymbolicLink?.() ?? false;
737
- const directory = !symbolicLink && stat.isDirectory();
738
- const mtimeMs = stat.mtimeMs;
739
- if (typeof mtimeMs !== "number" || !Number.isFinite(mtimeMs))
740
- observed = false;
741
- snapshots.push([
742
- relativePath,
743
- symbolicLink ? "symlink" : directory ? "directory" : "file",
744
- stat.size ?? null,
745
- typeof mtimeMs === "number" && Number.isFinite(mtimeMs) ? mtimeMs : null,
746
- ]);
747
- if (!directory)
748
- return;
749
- if (depth >= maxDepth) {
750
- observed = false;
751
- return;
752
- }
753
- for (const child of fs.readdirSync(absolutePath).sort()) {
754
- visit(path.join(absolutePath, child), path.join(relativePath, child), depth + 1);
755
- }
756
- }
757
- catch {
758
- observed = false;
759
- snapshots.push([relativePath, "unreadable"]);
760
- }
761
- };
762
- for (const sibling of siblings) {
763
- visit(path.join(parent, sibling), sibling, 0);
764
- }
765
- return { value: JSON.stringify(snapshots), observed, present: siblings.length > 0 };
766
- }
767
230
  /** Whether packageRoot's own manifest is healthy (`name === CLI_NAME`). */
768
231
  function packageRootHealthy(packageRoot, fs) {
769
232
  const manifest = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf-8"));
770
233
  return manifest.name === CLI_NAME;
771
234
  }
772
- function isWithinPath(candidate, root) {
773
- const relative = path.relative(root, candidate);
774
- return relative === "" ||
775
- (!path.isAbsolute(relative) && relative !== ".." && !relative.startsWith(`..${path.sep}`));
776
- }
777
- /** Paths whose presence, metadata, or immediate entries show activity for this import. */
778
- function installTreeActivityPaths(target, packageRoot) {
779
- const root = packageRoot ? path.resolve(packageRoot) : null;
780
- const paths = new Set();
781
- const directories = new Set();
782
- const addPath = (candidate) => {
783
- const resolved = path.resolve(candidate);
784
- paths.add(resolved);
785
- directories.add(path.dirname(resolved));
786
- if (!root || !isWithinPath(resolved, root))
787
- return;
788
- let current = path.dirname(resolved);
789
- for (;;) {
790
- paths.add(current);
791
- directories.add(current);
792
- if (current === root)
793
- break;
794
- const parent = path.dirname(current);
795
- if (parent === current || !isWithinPath(parent, root))
796
- break;
797
- current = parent;
798
- }
799
- };
800
- if (root) {
801
- for (const candidate of [
802
- root,
803
- path.join(root, "package.json"),
804
- path.join(root, "dist"),
805
- path.join(root, "node_modules"),
806
- ]) {
807
- addPath(candidate);
808
- directories.add(candidate);
809
- }
810
- }
811
- if (target.kind === "path" || target.kind === "exists") {
812
- addPath(target.path);
813
- }
814
- else if (target.kind === "relative") {
815
- const base = path.resolve(target.from, target.specifier);
816
- const candidates = [
817
- base,
818
- ...CJS_FILE_EXTENSIONS.map((ext) => base + ext),
819
- ...CJS_FILE_EXTENSIONS.map((ext) => path.join(base, `index${ext}`)),
820
- ];
821
- for (const candidate of candidates)
822
- addPath(candidate);
823
- }
824
- else if (target.kind === "package") {
825
- let from = path.resolve(target.from);
826
- let ancestorCount = 0;
827
- for (;;) {
828
- if (root && !isWithinPath(from, root))
829
- break;
830
- addPath(path.join(from, "node_modules", target.name));
831
- if (from === root)
832
- break;
833
- ancestorCount += 1;
834
- if (!root && ancestorCount >= 12)
835
- break;
836
- const parent = path.dirname(from);
837
- if (parent === from)
838
- break;
839
- from = parent;
840
- }
841
- }
842
- return {
843
- paths: [...paths].sort(),
844
- directories: [...directories].sort(),
845
- };
846
- }
847
- /** A local-only snapshot of the missing target and directories an installer may change. */
848
- function installTreeActivitySignature(target, packageRoot, fs) {
849
- const activity = installTreeActivityPaths(target, packageRoot);
850
- const snapshots = [];
851
- let observed = true;
852
- let nonRetiredObserved = true;
853
- let retiredSiblingPresent = null;
854
- const errorCode = (err) => {
855
- if (err !== null && typeof err === "object" && "code" in err && typeof err.code === "string") {
856
- return err.code;
857
- }
858
- return "error";
859
- };
860
- for (const candidate of activity.paths) {
861
- try {
862
- if (!fs.existsSync(candidate)) {
863
- snapshots.push([candidate, "missing"]);
864
- continue;
865
- }
866
- const stat = fs.statSync(candidate);
867
- snapshots.push([
868
- candidate,
869
- stat.isDirectory() ? "directory" : "file",
870
- stat.size ?? null,
871
- stat.mtimeMs ?? null,
872
- ]);
873
- }
874
- catch (err) {
875
- observed = false;
876
- nonRetiredObserved = false;
877
- snapshots.push([candidate, `unreadable:${errorCode(err)}`]);
878
- }
879
- }
880
- for (const directory of activity.directories) {
881
- try {
882
- if (!fs.existsSync(directory) || !fs.statSync(directory).isDirectory())
883
- continue;
884
- snapshots.push([directory, "entries", fs.readdirSync(directory).sort()]);
885
- }
886
- catch (err) {
887
- observed = false;
888
- nonRetiredObserved = false;
889
- snapshots.push([directory, `entries-unreadable:${errorCode(err)}`]);
890
- }
891
- }
892
- if (packageRoot) {
893
- try {
894
- const retired = retiredSiblingActivitySignature(packageRoot, fs);
895
- snapshots.push(["retired-siblings", retired.value]);
896
- retiredSiblingPresent = retired.present;
897
- if (!retired.observed)
898
- observed = false;
899
- }
900
- catch (err) {
901
- observed = false;
902
- snapshots.push(["retired-siblings-unreadable", errorCode(err)]);
903
- }
904
- }
905
- return { value: JSON.stringify(snapshots), observed, nonRetiredObserved, retiredSiblingPresent };
906
- }
907
- function canProbeUnsettledRetiredSibling(snapshot) {
908
- // A very large or unreadable retired npm tree can exceed the bounded recursive
909
- // activity scan. Its stable partial signature is still useful when the live
910
- // install paths are observable and npm's named retired sibling is present.
911
- // This only selects the existing stale-tree repair outcome; it never removes
912
- // files, and any observed signature change still suppresses stale classification.
913
- return snapshot.observed ||
914
- (snapshot.nonRetiredObserved && snapshot.retiredSiblingPresent === true);
915
- }
916
- const DEFAULT_INSTALL_TREE_STALE_PROBE_MS = 1_500;
917
235
  /**
918
236
  * Poll until the install tree has been continuously READY for `quietMs`, or the
919
- * wait exhausts its bounds. READY means: (i) no FRESH update lock held by another
920
- * pid, (ii) the missing target is present, and — when `packageRoot` is known —
921
- * (iii) `<packageRoot>/package.json` parses with `name === CLI_NAME` and (iv) no
922
- * `.<leaf>-<rand>` retired sibling remains beside it. Every filesystem error makes
923
- * its condition "not ready" rather than throwing.
924
- *
925
- * The wait is LOCK-AWARE and bounded, so a live cooperating writer (the desktop
926
- * app, the box's update timer, another `hq`) cannot make a legitimately-in-progress
927
- * reinstall look stale:
928
- * - UNLOCKED time — wall time observed with no fresh foreign lock — is bounded
929
- * by `deadlineMs`. If the target is still missing and the observable tree
930
- * signature stays unchanged for `staleProbeMs`, the wait returns `staleTree`
931
- * early. When only a named retired npm sibling's deep scan is incomplete,
932
- * a stable partial signature ends the wait early as `retiredSiblingUnverified`
933
- * instead. That outcome preserves uncertainty and tells the user to wait for
934
- * any installer before attempting a repair. Any observed signature change
935
- * keeps the ordinary settle deadline in force. `deadlineMs === 0` evaluates
936
- * readiness once.
937
- * - LOCKED time — wall time observed under a fresh foreign lock held by a live
938
- * pid — is bounded SEPARATELY by `lockWaitMs` (default the lock contract's own
939
- * 10-minute staleness window) and does NOT consume the settle budget. When
940
- * that ceiling is reached with the lock still held, the result is unsettled
941
- * with `lockHeldAtEnd` true so the seam can report a distinct `lock-held`
942
- * outcome and remedy rather than telling the user to reinstall over a live
943
- * writer.
944
- * Each poll's REAL elapsed interval (now() deltas) is attributed to the locked or
945
- * unlocked bucket by whether a fresh foreign lock was held when the interval
946
- * began, so a starved event loop only makes the wait coarser, never unbounded. A
947
- * stale lock (dead pid, older than the staleness window, unparseable) or our own
948
- * pid never extends anything. The whole wait is bounded (≤ `deadlineMs +
949
- * lockWaitMs`), and the unchanged-tree path normally returns after the much
950
- * shorter `staleProbeMs` observation window.
237
+ * `deadlineMs` passes. READY means: (i) no FRESH update lock held by another pid,
238
+ * (ii) the missing target is present, and — when `packageRoot` is known —
239
+ * (iii) `<packageRoot>/package.json` parses with `name === CLI_NAME` and
240
+ * (iv) no `.<leaf>-<rand>` retired sibling remains beside it. Every filesystem
241
+ * error makes its condition "not ready" rather than throwing. `deadlineMs === 0`
242
+ * evaluates readiness exactly once (no waiting); otherwise the whole wait is
243
+ * bounded, so the caller can never hang.
951
244
  */
952
245
  export async function waitForInstallTreeSettled(args) {
953
246
  const now = args.now ?? Date.now;
@@ -957,65 +250,16 @@ export async function waitForInstallTreeSettled(args) {
957
250
  const pollMs = args.pollMs ?? 250;
958
251
  const quietMs = args.quietMs ?? 1500;
959
252
  const deadlineMs = args.deadlineMs;
960
- const lockWaitMs = args.lockWaitMs ?? DEFAULT_INSTALL_SETTLE_LOCK_WAIT_MS;
961
- const staleProbeMs = Math.max(0, args.staleProbeMs ?? DEFAULT_INSTALL_TREE_STALE_PROBE_MS);
962
253
  const start = now();
963
- let lastActivitySnapshot = installTreeActivitySignature(args.target, args.packageRoot, fs);
964
- let staleObservationStartedAt = canProbeUnsettledRetiredSibling(lastActivitySnapshot) ? start : null;
965
- let sawTreeChange = false;
966
254
  let readySince = null;
967
255
  let sawLock = false;
968
256
  let sawRetired = false;
969
- let lockedMs = 0;
970
- let unlockedMs = 0;
971
- let lockTool = "";
972
- let prevT = start;
973
- let prevForeignLockHeld = false;
974
- let lockExtendedFired = false;
975
257
  for (;;) {
976
258
  const t = now();
977
- // Attribute the interval that just elapsed [prevT, t) to the bucket for the
978
- // lock state that held when it BEGAN (real now() deltas, never nominal pollMs).
979
- if (prevForeignLockHeld)
980
- lockedMs += t - prevT;
981
- else
982
- unlockedMs += t - prevT;
983
- const lock = freshForeignLock(args.lockPath, t, isPidAlive, fs);
984
- const foreignLockHeld = lock !== null;
985
- if (foreignLockHeld) {
259
+ const foreignLock = freshForeignLockHeld(args.lockPath, t, isPidAlive, fs);
260
+ if (foreignLock)
986
261
  sawLock = true;
987
- lockTool = boundedDiagnosticValue(lock.tool, LOCK_TOOL_BYTES);
988
- }
989
- if (!sawTreeChange) {
990
- const activitySnapshot = installTreeActivitySignature(args.target, args.packageRoot, fs);
991
- const previousCanProbe = canProbeUnsettledRetiredSibling(lastActivitySnapshot);
992
- const currentCanProbe = canProbeUnsettledRetiredSibling(activitySnapshot);
993
- if (previousCanProbe && currentCanProbe && activitySnapshot.value !== lastActivitySnapshot.value) {
994
- sawTreeChange = true;
995
- staleObservationStartedAt = null;
996
- }
997
- else if (!currentCanProbe) {
998
- staleObservationStartedAt = null;
999
- }
1000
- else if (!previousCanProbe) {
1001
- staleObservationStartedAt = t;
1002
- }
1003
- lastActivitySnapshot = activitySnapshot;
1004
- }
1005
- let retiredPresent = null;
1006
- let retiredCheckFailed = false;
1007
- if (args.packageRoot) {
1008
- try {
1009
- retiredPresent = retiredSiblingPresent(args.packageRoot, fs);
1010
- if (retiredPresent)
1011
- sawRetired = true;
1012
- }
1013
- catch {
1014
- retiredPresent = null;
1015
- retiredCheckFailed = true;
1016
- }
1017
- }
1018
- let ready = !foreignLockHeld && installTargetPresent(args.target, fs);
262
+ let ready = !foreignLock && installTargetPresent(args.target, fs);
1019
263
  if (ready && args.packageRoot) {
1020
264
  try {
1021
265
  if (!packageRootHealthy(args.packageRoot, fs))
@@ -1024,8 +268,17 @@ export async function waitForInstallTreeSettled(args) {
1024
268
  catch {
1025
269
  ready = false;
1026
270
  }
1027
- if (ready && (retiredPresent || retiredCheckFailed))
1028
- ready = false;
271
+ if (ready) {
272
+ try {
273
+ if (retiredSiblingPresent(args.packageRoot, fs)) {
274
+ sawRetired = true;
275
+ ready = false;
276
+ }
277
+ }
278
+ catch {
279
+ ready = false;
280
+ }
281
+ }
1029
282
  }
1030
283
  if (ready) {
1031
284
  if (readySince === null)
@@ -1036,137 +289,16 @@ export async function waitForInstallTreeSettled(args) {
1036
289
  }
1037
290
  const waitedMs = t - start;
1038
291
  if (ready && (deadlineMs === 0 || t - readySince >= quietMs)) {
1039
- // Settling requires no foreign lock, so it is never held at the end here.
1040
- return {
1041
- settled: true,
1042
- waitedMs,
1043
- sawLock,
1044
- sawRetired,
1045
- lockHeldAtEnd: false,
1046
- lockedMs,
1047
- lockTool,
1048
- sawTreeChange,
1049
- staleTree: false,
1050
- retiredSiblingPresent: retiredPresent,
1051
- retiredSiblingKind: retiredSiblingKind(args.packageRoot, fs),
1052
- installTargetState: installTargetState(args.target, args.packageRoot, fs),
1053
- updaterPidAlive: updaterPidAlive(args.lockPath, fs, isPidAlive),
1054
- };
1055
- }
1056
- if (!ready &&
1057
- !foreignLockHeld &&
1058
- !retiredCheckFailed &&
1059
- !sawLock &&
1060
- !sawTreeChange &&
1061
- staleObservationStartedAt !== null &&
1062
- t - staleObservationStartedAt >= staleProbeMs) {
1063
- return {
1064
- settled: false,
1065
- waitedMs,
1066
- sawLock,
1067
- sawRetired,
1068
- lockHeldAtEnd: false,
1069
- lockedMs,
1070
- lockTool,
1071
- sawTreeChange,
1072
- staleTree: lastActivitySnapshot.observed,
1073
- retiredSiblingPresent: retiredPresent,
1074
- retiredSiblingUnverified: !lastActivitySnapshot.observed && lastActivitySnapshot.retiredSiblingPresent === true,
1075
- retiredSiblingKind: retiredSiblingKind(args.packageRoot, fs),
1076
- installTargetState: installTargetState(args.target, args.packageRoot, fs),
1077
- updaterPidAlive: updaterPidAlive(args.lockPath, fs, isPidAlive),
1078
- };
1079
- }
1080
- // Give up when the TREE has had a full unlocked budget with no writer visible,
1081
- // OR a writer is STILL holding the lock and has held it past its own staleness
1082
- // ceiling. The lock ceiling is gated on a lock being held RIGHT NOW so that a
1083
- // ceiling of 0 (HQ_INSTALL_SETTLE_LOCK_TIMEOUT_MS=0, "do not extend under a
1084
- // lock") disables only the extension and does not collapse the ordinary
1085
- // deadlineMs settle when no lock exists — `lockedMs` is 0 ≥ 0 on every poll.
1086
- // `deadlineMs` 0 makes the unlocked test fire on the first poll (evaluate-once),
1087
- // matching the pre-lock-aware contract; `lockHeldAtEnd` distinguishes the causes.
1088
- if (unlockedMs >= deadlineMs || (foreignLockHeld && lockedMs >= lockWaitMs)) {
1089
- return {
1090
- settled: false,
1091
- waitedMs,
1092
- sawLock,
1093
- sawRetired,
1094
- lockHeldAtEnd: foreignLockHeld,
1095
- lockedMs,
1096
- lockTool,
1097
- sawTreeChange,
1098
- staleTree: false,
1099
- retiredSiblingPresent: retiredPresent,
1100
- retiredSiblingKind: retiredSiblingKind(args.packageRoot, fs),
1101
- installTargetState: installTargetState(args.target, args.packageRoot, fs),
1102
- updaterPidAlive: updaterPidAlive(args.lockPath, fs, isPidAlive),
1103
- };
292
+ return { settled: true, waitedMs, sawLock, sawRetired };
1104
293
  }
1105
- // The first poll at which the wait has reached `deadlineMs` while a lock is
1106
- // still held is exactly where the pre-lock-aware wait gave up — announce the
1107
- // extension once, and only when we are genuinely going to keep waiting.
1108
- if (!lockExtendedFired && foreignLockHeld && waitedMs >= deadlineMs) {
1109
- lockExtendedFired = true;
1110
- args.onLockExtended?.();
294
+ if (waitedMs >= deadlineMs) {
295
+ return { settled: false, waitedMs, sawLock, sawRetired };
1111
296
  }
1112
- prevT = t;
1113
- prevForeignLockHeld = foreignLockHeld;
1114
297
  await sleep(pollMs);
1115
298
  }
1116
299
  }
1117
- /**
1118
- * Whether packageRoot's own manifest is ABSENT (ENOENT) or name-mismatched — a
1119
- * mid-extraction rewrite signal (npm has renamed the dir aside and is re-writing
1120
- * package.json). A read error OTHER than ENOENT (EACCES/EPERM) is a benign
1121
- * permission fault, not a rewrite, so it returns false rather than a false signal.
1122
- */
1123
- function manifestRewriteSignal(packageRoot, fs) {
1124
- let raw;
1125
- try {
1126
- raw = fs.readFileSync(path.join(packageRoot, "package.json"), "utf-8");
1127
- }
1128
- catch (err) {
1129
- return err?.code === "ENOENT";
1130
- }
1131
- try {
1132
- return JSON.parse(raw).name !== CLI_NAME;
1133
- }
1134
- catch {
1135
- return true; // present but unparseable → mid-write
1136
- }
1137
- }
1138
- /**
1139
- * Whether a global reinstall is PROVABLY rewriting the install tree right now —
1140
- * the positive writer signal the eval-throw gate requires before it will pay a
1141
- * settle wait. True iff (i) a fresh foreign update lock is held, (ii) packageRoot's
1142
- * manifest is absent or name-mismatched (mid-extraction), or (iii) a
1143
- * `.<leaf>-<hash>` retired sibling sits beside it. Crucially it is POSITIVE: a
1144
- * benign filesystem error that merely prevents READING the manifest or LISTING the
1145
- * parent (EACCES/EPERM) is NOT a signal, so a persistent third-party load-time
1146
- * defect on an otherwise-usable install never pays a spurious 90s wait. Every
1147
- * dependency is injectable so the recovery seam stays hermetic.
1148
- */
1149
- export function installRewriteInProgress(args) {
1150
- const now = (args.now ?? Date.now)();
1151
- const fs = args.fs ?? nodeInstallTreeFs;
1152
- const isPidAlive = args.isPidAlive ?? defaultIsPidAlive;
1153
- // #570 renamed freshForeignLockHeld → freshForeignLock, which returns the lock
1154
- // info (or null) instead of a boolean; a fresh foreign lock is held iff non-null.
1155
- if (freshForeignLock(args.lockPath, now, isPidAlive, fs) !== null)
1156
- return true;
1157
- if (!args.packageRoot)
1158
- return false;
1159
- if (manifestRewriteSignal(args.packageRoot, fs))
1160
- return true;
1161
- try {
1162
- return retiredSiblingPresent(args.packageRoot, fs);
1163
- }
1164
- catch {
1165
- return false; // parent not listable — benign, not a rewrite signal
1166
- }
1167
- }
1168
300
  /** The fixed, input-free carrier message (grouping cardinality stays bounded). */
1169
- const INSTALL_TREE_TORN_MESSAGE = "hq-cli could not load a module from its install tree and automatic recovery did not complete";
301
+ const INSTALL_TREE_TORN_MESSAGE = "hq-cli install tree was being rewritten while this command started";
1170
302
  /**
1171
303
  * A torn-install failure that stays VISIBLE in Sentry with bounded, hq-derived
1172
304
  * diagnostics. Fixed `name`/`message` (no argv, path, or free text in either),
@@ -1180,35 +312,19 @@ export class InstallTreeTornError extends Error {
1180
312
  super(INSTALL_TREE_TORN_MESSAGE);
1181
313
  this.name = "InstallTreeTornError";
1182
314
  this.cause = init.cause;
1183
- const sawTreeChange = init.sawTreeChange ?? false;
1184
- const treeState = init.treeState ?? (init.outcome === "stale_tree" ? "stale" : "in_flight");
1185
- const diagnostics = {
315
+ this.diagnostics = {
1186
316
  dialect: init.classified.dialect,
1187
317
  code: init.classified.code,
1188
318
  specifier: boundedDiagnosticValue(init.classified.specifier, SPECIFIER_BYTES),
1189
319
  importer: boundedDiagnosticValue(init.classified.importer, IMPORTER_BYTES),
1190
320
  packageRoot: boundedDiagnosticValue(init.packageRoot ?? "", PACKAGE_ROOT_BYTES),
1191
321
  outcome: init.outcome,
1192
- treeState,
1193
322
  attempt: init.attempt,
1194
323
  waitedMs: init.waitedMs,
1195
324
  sawLock: init.sawLock,
1196
325
  sawRetired: init.sawRetired,
1197
- sawTreeChange,
1198
- lockHeldAtEnd: init.lockHeldAtEnd ?? false,
1199
- lockedMs: init.lockedMs ?? 0,
1200
- lockTool: boundedDiagnosticValue(init.lockTool ?? "", LOCK_TOOL_BYTES),
1201
326
  node: process.version,
1202
- errorName: boundedDiagnosticValue(init.classified.errorName ?? "", ERRORNAME_BYTES),
1203
- retiredSiblingKind: init.retiredSiblingKind ?? "unknown",
1204
- installTargetState: init.installTargetState ?? "unknown",
1205
- versionGatePhase: init.versionGatePhase ?? "unknown",
1206
- updaterPidAlive: init.updaterPidAlive ?? "unknown",
1207
327
  };
1208
- if (typeof init.retiredSiblingPresent === "boolean") {
1209
- diagnostics.retiredSiblingPresent = init.retiredSiblingPresent;
1210
- }
1211
- this.diagnostics = diagnostics;
1212
328
  Object.setPrototypeOf(this, new.target.prototype);
1213
329
  }
1214
330
  }
@@ -1216,45 +332,8 @@ export function isInstallTreeTornError(err) {
1216
332
  return err instanceof InstallTreeTornError;
1217
333
  }
1218
334
  /** The exact Sentry `contexts` payload for a captured torn-install failure. */
1219
- export function installTreeTornCaptureContext(err, homeDirectory = homedir()) {
1220
- const diagnostics = err.diagnostics;
1221
- return {
1222
- contexts: {
1223
- install_tree_torn: {
1224
- ...diagnostics,
1225
- specifier: scrubHomeDirectoryPrefix(diagnostics.specifier, homeDirectory),
1226
- importer: scrubHomeDirectoryPrefix(diagnostics.importer, homeDirectory),
1227
- packageRoot: scrubHomeDirectoryPrefix(diagnostics.packageRoot, homeDirectory),
1228
- },
1229
- },
1230
- };
1231
- }
1232
- function looksLikeWindowsPath(value) {
1233
- return /^[a-zA-Z]:[\\/]/.test(value) || /^\\\\/.test(value);
1234
- }
1235
- /** Replace a home-directory prefix without matching similarly-named sibling folders. */
1236
- export function scrubHomeDirectoryPrefix(value, homeDirectory = homedir()) {
1237
- if (!value || !homeDirectory)
1238
- return value;
1239
- if (looksLikeWindowsPath(value) || looksLikeWindowsPath(homeDirectory)) {
1240
- const home = path.win32.normalize(homeDirectory).replace(/[\\/]+$/, "");
1241
- const normalized = path.win32.normalize(value);
1242
- const foldedHome = home.toLowerCase();
1243
- const foldedValue = normalized.toLowerCase();
1244
- if (foldedValue === foldedHome)
1245
- return "~";
1246
- const prefix = `${foldedHome}\\`;
1247
- if (foldedValue.startsWith(prefix))
1248
- return `~\\${normalized.slice(home.length + 1)}`;
1249
- return value;
1250
- }
1251
- const home = path.posix.normalize(homeDirectory).replace(/\/+$/, "");
1252
- const normalized = path.posix.normalize(value);
1253
- if (normalized === home)
1254
- return "~";
1255
- if (normalized.startsWith(`${home}/`))
1256
- return `~/${normalized.slice(home.length + 1)}`;
1257
- return value;
335
+ export function installTreeTornCaptureContext(err) {
336
+ return { contexts: { install_tree_torn: err.diagnostics } };
1258
337
  }
1259
338
  /**
1260
339
  * The fixed, input-free operator remedy. It names the likely writers (so a
@@ -1262,45 +341,19 @@ export function scrubHomeDirectoryPrefix(value, homeDirectory = homedir()) {
1262
341
  * and interpolates NOTHING — the only per-event value is the bounded specifier
1263
342
  * appended by {@link installTreeTornStderrLine}.
1264
343
  */
1265
- export const INSTALL_TREE_TORN_REMEDY = "hq-cli could not finish automatic install-tree recovery. Re-run your command; " +
1266
- "if it still fails, reinstall with `npm install -g @indigoai-us/hq-cli@latest` " +
1267
- "(or `pnpm add -g @indigoai-us/hq-cli@latest` / `bun add -g @indigoai-us/hq-cli@latest` " +
1268
- "when that manager owns your install).";
1269
- /** Fixed repair guidance for an unchanged tree with no active updater signal. */
1270
- export const INSTALL_TREE_STALE_REMEDY = "hq-cli's install tree is incomplete and no active updater was detected. " +
1271
- "Reinstall with `npm install -g @indigoai-us/hq-cli@latest` " +
1272
- "(or `pnpm add -g @indigoai-us/hq-cli@latest` / `bun add -g @indigoai-us/hq-cli@latest` " +
1273
- "when that manager owns your install), then run the command again.";
1274
- /** Guidance when a retired package sibling's activity could not be verified. */
1275
- export const INSTALL_TREE_RETIRED_UNVERIFIED_REMEDY = "hq-cli found a retired install sibling but could not verify whether an installer is still using it. Wait for any npm or desktop CLI update to finish, then run the command again. If no install is running, repair with `npm install -g @indigoai-us/hq-cli@latest` " +
1276
- "(or `pnpm add -g @indigoai-us/hq-cli@latest` / `bun add -g @indigoai-us/hq-cli@latest` " +
1277
- "when that manager owns your install).";
1278
- /**
1279
- * The fixed, input-free remedy for the 'lock-held' outcome: a cooperating writer
1280
- * held the shared update lock past its own staleness ceiling. Telling the user to
1281
- * `npm i -g` here would collide with a live installer mid-rename — the exact race
1282
- * update-lock.ts exists to prevent — so this remedy tells them to let the running
1283
- * update finish and NEVER to reinstall over it. Interpolates NOTHING.
1284
- */
1285
- export const INSTALL_TREE_LOCK_HELD_REMEDY = "another hq updater (the desktop app, the box's hq-cli-update timer, or another " +
1286
- "hq command) was still installing hq-cli when this command stopped waiting. Let " +
1287
- "that update finish, then re-run your command; do not reinstall while it is running.";
344
+ export const INSTALL_TREE_TORN_REMEDY = "the hq-cli install was being updated by another process (the box's hq-cli-update " +
345
+ "timer, the desktop app, or another hq command) while this command started. " +
346
+ "Re-run your command; if it keeps failing, reinstall with " +
347
+ "`npm i -g @indigoai-us/hq-cli` (or `pnpm add -g @indigoai-us/hq-cli`).";
1288
348
  /**
1289
349
  * The single actionable stderr line for a captured torn-install failure: the
1290
- * outcome's fixed remedy plus the bounded, hq-derived missing specifier — the only
1291
- * interpolated value, never argv. A 'lock-held' outcome selects the "let the
1292
- * update finish" remedy (never the reinstall advice); every other outcome keeps
1293
- * {@link INSTALL_TREE_TORN_REMEDY} byte-for-byte.
350
+ * fixed remedy plus the bounded, hq-derived missing specifier — the only
351
+ * interpolated value, never argv.
1294
352
  */
1295
353
  export function installTreeTornStderrLine(err) {
1296
- const remedy = err.diagnostics.outcome === "lock-held"
1297
- ? INSTALL_TREE_LOCK_HELD_REMEDY
1298
- : err.diagnostics.outcome === "stale_tree"
1299
- ? INSTALL_TREE_STALE_REMEDY
1300
- : err.diagnostics.outcome === "retired_unverified"
1301
- ? INSTALL_TREE_RETIRED_UNVERIFIED_REMEDY
1302
- : INSTALL_TREE_TORN_REMEDY;
1303
354
  const specifier = err.diagnostics.specifier;
1304
- return specifier ? `${remedy} (missing: ${specifier})` : remedy;
355
+ return specifier
356
+ ? `${INSTALL_TREE_TORN_REMEDY} (missing: ${specifier})`
357
+ : INSTALL_TREE_TORN_REMEDY;
1305
358
  }
1306
359
  //# sourceMappingURL=install-tree-torn.js.map