@lannguyensi/harness 0.63.0 → 1.0.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 (702) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +46 -42
  3. package/dist/cli/add/index.js +17 -21
  4. package/dist/cli/add/index.js.map +1 -1
  5. package/dist/cli/adopt/derive.d.ts +2 -2
  6. package/dist/cli/adopt/derive.js +2 -19
  7. package/dist/cli/adopt/derive.js.map +1 -1
  8. package/dist/cli/adopt/index.d.ts +1 -1
  9. package/dist/cli/adopt/index.js +1 -12
  10. package/dist/cli/adopt/index.js.map +1 -1
  11. package/dist/cli/apply/apply.d.ts +20 -35
  12. package/dist/cli/apply/apply.js +61 -136
  13. package/dist/cli/apply/apply.js.map +1 -1
  14. package/dist/cli/apply/generate-codex-config.js +10 -58
  15. package/dist/cli/apply/generate-codex-config.js.map +1 -1
  16. package/dist/cli/apply/generate-memory-index.js +1 -2
  17. package/dist/cli/apply/generate-memory-index.js.map +1 -1
  18. package/dist/cli/apply/generate-opencode-config.d.ts +2 -10
  19. package/dist/cli/apply/generate-opencode-config.js +74 -113
  20. package/dist/cli/apply/generate-opencode-config.js.map +1 -1
  21. package/dist/cli/apply/generate-settings.d.ts +11 -64
  22. package/dist/cli/apply/generate-settings.js +27 -132
  23. package/dist/cli/apply/generate-settings.js.map +1 -1
  24. package/dist/cli/apply/index.d.ts +1 -1
  25. package/dist/cli/apply/index.js +1 -1
  26. package/dist/cli/apply/index.js.map +1 -1
  27. package/dist/cli/apply/install-codex-config.d.ts +153 -1
  28. package/dist/cli/apply/install-codex-config.js +445 -70
  29. package/dist/cli/apply/install-codex-config.js.map +1 -1
  30. package/dist/cli/apply/next-steps.d.ts +7 -0
  31. package/dist/cli/apply/next-steps.js +13 -1
  32. package/dist/cli/apply/next-steps.js.map +1 -1
  33. package/dist/cli/bounded-stdin.d.ts +0 -23
  34. package/dist/cli/bounded-stdin.js +2 -49
  35. package/dist/cli/bounded-stdin.js.map +1 -1
  36. package/dist/cli/describe.d.ts +1 -1
  37. package/dist/cli/describe.js +0 -3
  38. package/dist/cli/describe.js.map +1 -1
  39. package/dist/cli/diff/engine.d.ts +0 -11
  40. package/dist/cli/diff/engine.js +1 -17
  41. package/dist/cli/diff/engine.js.map +1 -1
  42. package/dist/cli/diff/index.js +14 -25
  43. package/dist/cli/diff/index.js.map +1 -1
  44. package/dist/cli/doctor/claude-mcp.d.ts +4 -19
  45. package/dist/cli/doctor/claude-mcp.js +11 -22
  46. package/dist/cli/doctor/claude-mcp.js.map +1 -1
  47. package/dist/cli/doctor/codex.d.ts +12 -14
  48. package/dist/cli/doctor/codex.js +31 -144
  49. package/dist/cli/doctor/codex.js.map +1 -1
  50. package/dist/cli/doctor/format.js +23 -338
  51. package/dist/cli/doctor/format.js.map +1 -1
  52. package/dist/cli/doctor/hook-liveness.d.ts +56 -0
  53. package/dist/cli/doctor/hook-liveness.js +455 -0
  54. package/dist/cli/doctor/hook-liveness.js.map +1 -0
  55. package/dist/cli/doctor/index.d.ts +13 -87
  56. package/dist/cli/doctor/index.js +57 -705
  57. package/dist/cli/doctor/index.js.map +1 -1
  58. package/dist/cli/doctor/opencode.d.ts +2 -1
  59. package/dist/cli/doctor/opencode.js.map +1 -1
  60. package/dist/cli/doctor/types.d.ts +21 -378
  61. package/dist/cli/doctor/types.js.map +1 -1
  62. package/dist/cli/drain-stdio.d.ts +31 -0
  63. package/dist/cli/drain-stdio.js +76 -0
  64. package/dist/cli/drain-stdio.js.map +1 -0
  65. package/dist/cli/export.d.ts +3 -1
  66. package/dist/cli/export.js +7 -16
  67. package/dist/cli/export.js.map +1 -1
  68. package/dist/cli/gate/codex-disable.d.ts +29 -0
  69. package/dist/cli/gate/codex-disable.js +195 -0
  70. package/dist/cli/gate/codex-disable.js.map +1 -0
  71. package/dist/cli/gate/codex-enable.d.ts +41 -0
  72. package/dist/cli/gate/codex-enable.js +127 -0
  73. package/dist/cli/gate/codex-enable.js.map +1 -0
  74. package/dist/cli/gate/codex-snapshot.d.ts +208 -0
  75. package/dist/cli/gate/codex-snapshot.js +402 -0
  76. package/dist/cli/gate/codex-snapshot.js.map +1 -0
  77. package/dist/cli/gate/disable.d.ts +9 -0
  78. package/dist/cli/gate/disable.js +263 -28
  79. package/dist/cli/gate/disable.js.map +1 -1
  80. package/dist/cli/gate/enable.d.ts +26 -6
  81. package/dist/cli/gate/enable.js +152 -80
  82. package/dist/cli/gate/enable.js.map +1 -1
  83. package/dist/cli/gate/link-chain.d.ts +53 -0
  84. package/dist/cli/gate/link-chain.js +122 -0
  85. package/dist/cli/gate/link-chain.js.map +1 -0
  86. package/dist/cli/gate/snapshot.d.ts +289 -12
  87. package/dist/cli/gate/snapshot.js +481 -22
  88. package/dist/cli/gate/snapshot.js.map +1 -1
  89. package/dist/cli/index.d.ts +0 -9
  90. package/dist/cli/index.js +15 -2607
  91. package/dist/cli/index.js.map +1 -1
  92. package/dist/cli/init/composer.d.ts +3 -6
  93. package/dist/cli/init/composer.js +6 -370
  94. package/dist/cli/init/composer.js.map +1 -1
  95. package/dist/cli/init/dependencies.d.ts +1 -2
  96. package/dist/cli/init/dependencies.js +4 -80
  97. package/dist/cli/init/dependencies.js.map +1 -1
  98. package/dist/cli/init/detect.js +5 -4
  99. package/dist/cli/init/detect.js.map +1 -1
  100. package/dist/cli/init/interactive.d.ts +1 -23
  101. package/dist/cli/init/interactive.js +33 -247
  102. package/dist/cli/init/interactive.js.map +1 -1
  103. package/dist/cli/init/profiles.d.ts +2 -2
  104. package/dist/cli/init/profiles.js +51 -243
  105. package/dist/cli/init/profiles.js.map +1 -1
  106. package/dist/cli/init/templates.d.ts +2 -37
  107. package/dist/cli/init/templates.js +25 -1237
  108. package/dist/cli/init/templates.js.map +1 -1
  109. package/dist/cli/list.d.ts +1 -1
  110. package/dist/cli/list.js +1 -38
  111. package/dist/cli/list.js.map +1 -1
  112. package/dist/cli/loader.d.ts +15 -1
  113. package/dist/cli/loader.js +56 -39
  114. package/dist/cli/loader.js.map +1 -1
  115. package/dist/cli/main.js +7 -2
  116. package/dist/cli/main.js.map +1 -1
  117. package/dist/cli/migrate-home/index.js +2 -2
  118. package/dist/cli/migrate-home/index.js.map +1 -1
  119. package/dist/cli/pack/add.js +1 -1
  120. package/dist/cli/pack/add.js.map +1 -1
  121. package/dist/cli/pack/hook-bootstrap.d.ts +5 -164
  122. package/dist/cli/pack/hook-bootstrap.js +15 -291
  123. package/dist/cli/pack/hook-bootstrap.js.map +1 -1
  124. package/dist/cli/pack/hook-branch-protection.d.ts +28 -21
  125. package/dist/cli/pack/hook-branch-protection.js +365 -340
  126. package/dist/cli/pack/hook-branch-protection.js.map +1 -1
  127. package/dist/cli/pack/index.d.ts +0 -1
  128. package/dist/cli/pack/index.js +0 -1
  129. package/dist/cli/pack/index.js.map +1 -1
  130. package/dist/cli/pack/list.js +1 -6
  131. package/dist/cli/pack/list.js.map +1 -1
  132. package/dist/cli/pack/mutate.d.ts +7 -9
  133. package/dist/cli/pack/mutate.js +6 -9
  134. package/dist/cli/pack/mutate.js.map +1 -1
  135. package/dist/cli/pack/reseed.d.ts +2 -2
  136. package/dist/cli/pack/reseed.js +16 -22
  137. package/dist/cli/pack/reseed.js.map +1 -1
  138. package/dist/cli/register-gate-group.d.ts +5 -0
  139. package/dist/cli/register-gate-group.js +348 -0
  140. package/dist/cli/register-gate-group.js.map +1 -0
  141. package/dist/cli/register-inspect-group.d.ts +6 -0
  142. package/dist/cli/register-inspect-group.js +189 -0
  143. package/dist/cli/register-inspect-group.js.map +1 -0
  144. package/dist/cli/register-operator-lifecycle.d.ts +5 -0
  145. package/dist/cli/register-operator-lifecycle.js +20 -0
  146. package/dist/cli/register-operator-lifecycle.js.map +1 -0
  147. package/dist/cli/register-pack-group.d.ts +5 -0
  148. package/dist/cli/register-pack-group.js +134 -0
  149. package/dist/cli/register-pack-group.js.map +1 -0
  150. package/dist/cli/register-setup-group.d.ts +5 -0
  151. package/dist/cli/register-setup-group.js +495 -0
  152. package/dist/cli/register-setup-group.js.map +1 -0
  153. package/dist/cli/remove/index.d.ts +0 -14
  154. package/dist/cli/remove/index.js +2 -115
  155. package/dist/cli/remove/index.js.map +1 -1
  156. package/dist/cli/remove/mutate.d.ts +0 -2
  157. package/dist/cli/remove/mutate.js +1 -19
  158. package/dist/cli/remove/mutate.js.map +1 -1
  159. package/dist/cli/remove/register.d.ts +5 -0
  160. package/dist/cli/remove/register.js +25 -0
  161. package/dist/cli/remove/register.js.map +1 -0
  162. package/dist/cli/shell-quote.d.ts +7 -0
  163. package/dist/cli/shell-quote.js +17 -0
  164. package/dist/cli/shell-quote.js.map +1 -0
  165. package/dist/cli/uninstall/index.d.ts +4 -2
  166. package/dist/cli/uninstall/index.js +15 -7
  167. package/dist/cli/uninstall/index.js.map +1 -1
  168. package/dist/cli/uninstall/register.d.ts +5 -0
  169. package/dist/cli/uninstall/register.js +171 -0
  170. package/dist/cli/uninstall/register.js.map +1 -0
  171. package/dist/cli/uninstall/snapshot.d.ts +15 -0
  172. package/dist/cli/uninstall/snapshot.js +38 -0
  173. package/dist/cli/uninstall/snapshot.js.map +1 -1
  174. package/dist/cli/validate/checks.d.ts +0 -77
  175. package/dist/cli/validate/checks.js +3 -1049
  176. package/dist/cli/validate/checks.js.map +1 -1
  177. package/dist/cli/validate/index.js +19 -15
  178. package/dist/cli/validate/index.js.map +1 -1
  179. package/dist/index.d.ts +0 -3
  180. package/dist/index.js +0 -3
  181. package/dist/index.js.map +1 -1
  182. package/dist/io/claude-mcp.d.ts +1 -1
  183. package/dist/io/claude-mcp.js +27 -14
  184. package/dist/io/claude-mcp.js.map +1 -1
  185. package/dist/io/harness-lock.js +2 -2
  186. package/dist/io/harness-lock.js.map +1 -1
  187. package/dist/io/lock.d.ts +0 -26
  188. package/dist/io/lock.js +10 -27
  189. package/dist/io/lock.js.map +1 -1
  190. package/dist/io/merge-settings.js +6 -4
  191. package/dist/io/merge-settings.js.map +1 -1
  192. package/dist/io/project-name.d.ts +22 -39
  193. package/dist/io/project-name.js +25 -42
  194. package/dist/io/project-name.js.map +1 -1
  195. package/dist/io/read-regular-file.d.ts +103 -40
  196. package/dist/io/read-regular-file.js +196 -35
  197. package/dist/io/read-regular-file.js.map +1 -1
  198. package/dist/io/restart-hints.js +3 -6
  199. package/dist/io/restart-hints.js.map +1 -1
  200. package/dist/io/version-compare.d.ts +1 -3
  201. package/dist/io/version-compare.js +1 -3
  202. package/dist/io/version-compare.js.map +1 -1
  203. package/dist/io/write-regular-file.d.ts +30 -0
  204. package/dist/io/write-regular-file.js +85 -0
  205. package/dist/io/write-regular-file.js.map +1 -0
  206. package/dist/overrides/index.d.ts +1 -0
  207. package/dist/overrides/index.js +1 -0
  208. package/dist/overrides/index.js.map +1 -1
  209. package/dist/overrides/merge-layers.d.ts +43 -0
  210. package/dist/overrides/merge-layers.js +76 -0
  211. package/dist/overrides/merge-layers.js.map +1 -0
  212. package/dist/overrides/merge.d.ts +16 -0
  213. package/dist/overrides/merge.js +21 -8
  214. package/dist/overrides/merge.js.map +1 -1
  215. package/dist/policy-packs/builtin/branch-protection-runtime.d.ts +4 -69
  216. package/dist/policy-packs/builtin/branch-protection-runtime.js +12 -84
  217. package/dist/policy-packs/builtin/branch-protection-runtime.js.map +1 -1
  218. package/dist/policy-packs/builtin/branch-protection.d.ts +7 -30
  219. package/dist/policy-packs/builtin/branch-protection.js +56 -89
  220. package/dist/policy-packs/builtin/branch-protection.js.map +1 -1
  221. package/dist/policy-packs/config-check.d.ts +7 -5
  222. package/dist/policy-packs/config-check.js +2 -2
  223. package/dist/policy-packs/config-check.js.map +1 -1
  224. package/dist/policy-packs/expand.d.ts +1 -3
  225. package/dist/policy-packs/expand.js +5 -42
  226. package/dist/policy-packs/expand.js.map +1 -1
  227. package/dist/policy-packs/index.d.ts +3 -3
  228. package/dist/policy-packs/index.js +2 -2
  229. package/dist/policy-packs/index.js.map +1 -1
  230. package/dist/policy-packs/registry.d.ts +9 -38
  231. package/dist/policy-packs/registry.js +5 -65
  232. package/dist/policy-packs/registry.js.map +1 -1
  233. package/dist/policy-packs/runtime.d.ts +0 -4
  234. package/dist/policy-packs/runtime.js +9 -22
  235. package/dist/policy-packs/runtime.js.map +1 -1
  236. package/dist/policy-packs/types.d.ts +0 -19
  237. package/dist/policy-packs/ux-compare.d.ts +1 -11
  238. package/dist/policy-packs/ux-compare.js +6 -42
  239. package/dist/policy-packs/ux-compare.js.map +1 -1
  240. package/dist/policy-packs/ux-drift-check.d.ts +5 -5
  241. package/dist/policy-packs/ux-drift-check.js +17 -22
  242. package/dist/policy-packs/ux-drift-check.js.map +1 -1
  243. package/dist/policy-packs/version-check.d.ts +5 -26
  244. package/dist/policy-packs/version-check.js +19 -74
  245. package/dist/policy-packs/version-check.js.map +1 -1
  246. package/dist/probes/memory.d.ts +1 -1
  247. package/dist/probes/memory.js +1 -1
  248. package/dist/probes/memory.js.map +1 -1
  249. package/dist/runtime/agent-facing.d.ts +9 -0
  250. package/dist/runtime/agent-facing.js +28 -14
  251. package/dist/runtime/agent-facing.js.map +1 -1
  252. package/dist/runtime/bounded-text.d.ts +15 -0
  253. package/dist/runtime/bounded-text.js +27 -0
  254. package/dist/runtime/bounded-text.js.map +1 -0
  255. package/dist/runtime/git-branch.d.ts +125 -0
  256. package/dist/runtime/git-branch.js +381 -0
  257. package/dist/runtime/git-branch.js.map +1 -0
  258. package/dist/runtime/hermetic-spawn-guard.d.ts +2 -2
  259. package/dist/runtime/hermetic-spawn-guard.js +24 -34
  260. package/dist/runtime/hermetic-spawn-guard.js.map +1 -1
  261. package/dist/runtime/home-dir.js +3 -2
  262. package/dist/runtime/home-dir.js.map +1 -1
  263. package/dist/runtime/tool-name-aliases.d.ts +0 -6
  264. package/dist/runtime/tool-name-aliases.js +5 -18
  265. package/dist/runtime/tool-name-aliases.js.map +1 -1
  266. package/dist/schema/grounding.d.ts +7 -54
  267. package/dist/schema/grounding.js +10 -12
  268. package/dist/schema/grounding.js.map +1 -1
  269. package/dist/schema/hooks.d.ts +39 -136
  270. package/dist/schema/hooks.js +3 -6
  271. package/dist/schema/hooks.js.map +1 -1
  272. package/dist/schema/index.d.ts +114 -3828
  273. package/dist/schema/index.js +41 -80
  274. package/dist/schema/index.js.map +1 -1
  275. package/dist/schema/memory.d.ts +54 -131
  276. package/dist/schema/memory.js +2 -2
  277. package/dist/schema/memory.js.map +1 -1
  278. package/dist/schema/policy-packs.d.ts +3 -45
  279. package/dist/schema/policy-packs.js +7 -13
  280. package/dist/schema/policy-packs.js.map +1 -1
  281. package/dist/schema/policy-ux.d.ts +7 -0
  282. package/dist/schema/policy-ux.js +18 -0
  283. package/dist/schema/policy-ux.js.map +1 -0
  284. package/dist/schema/removed-keys.d.ts +185 -0
  285. package/dist/schema/removed-keys.js +531 -0
  286. package/dist/schema/removed-keys.js.map +1 -0
  287. package/dist/schema/tools.d.ts +30 -268
  288. package/dist/schema/tools.js +4 -4
  289. package/dist/schema/tools.js.map +1 -1
  290. package/package.json +5 -16
  291. package/dist/cli/approve/branch-protection.d.ts +0 -69
  292. package/dist/cli/approve/branch-protection.js +0 -144
  293. package/dist/cli/approve/branch-protection.js.map +0 -1
  294. package/dist/cli/approve/risk.d.ts +0 -112
  295. package/dist/cli/approve/risk.js +0 -197
  296. package/dist/cli/approve/risk.js.map +0 -1
  297. package/dist/cli/approve/stdin-report.d.ts +0 -57
  298. package/dist/cli/approve/stdin-report.js +0 -145
  299. package/dist/cli/approve/stdin-report.js.map +0 -1
  300. package/dist/cli/approve/understanding.d.ts +0 -410
  301. package/dist/cli/approve/understanding.js +0 -996
  302. package/dist/cli/approve/understanding.js.map +0 -1
  303. package/dist/cli/audit.d.ts +0 -80
  304. package/dist/cli/audit.js +0 -252
  305. package/dist/cli/audit.js.map +0 -1
  306. package/dist/cli/delegate/index.d.ts +0 -76
  307. package/dist/cli/delegate/index.js +0 -443
  308. package/dist/cli/delegate/index.js.map +0 -1
  309. package/dist/cli/doctor/auto-approve-mode.d.ts +0 -37
  310. package/dist/cli/doctor/auto-approve-mode.js +0 -80
  311. package/dist/cli/doctor/auto-approve-mode.js.map +0 -1
  312. package/dist/cli/doctor/bypass-without-auto-approve.d.ts +0 -38
  313. package/dist/cli/doctor/bypass-without-auto-approve.js +0 -95
  314. package/dist/cli/doctor/bypass-without-auto-approve.js.map +0 -1
  315. package/dist/cli/doctor/codex-config-drift.d.ts +0 -28
  316. package/dist/cli/doctor/codex-config-drift.js +0 -240
  317. package/dist/cli/doctor/codex-config-drift.js.map +0 -1
  318. package/dist/cli/doctor/rogue-ledger.d.ts +0 -53
  319. package/dist/cli/doctor/rogue-ledger.js +0 -153
  320. package/dist/cli/doctor/rogue-ledger.js.map +0 -1
  321. package/dist/cli/doctor/session-start-preflight-setup-version.d.ts +0 -83
  322. package/dist/cli/doctor/session-start-preflight-setup-version.js +0 -114
  323. package/dist/cli/doctor/session-start-preflight-setup-version.js.map +0 -1
  324. package/dist/cli/doctor/settings-drift.d.ts +0 -25
  325. package/dist/cli/doctor/settings-drift.js +0 -213
  326. package/dist/cli/doctor/settings-drift.js.map +0 -1
  327. package/dist/cli/doctor/toolchain-parity.d.ts +0 -63
  328. package/dist/cli/doctor/toolchain-parity.js +0 -154
  329. package/dist/cli/doctor/toolchain-parity.js.map +0 -1
  330. package/dist/cli/doctor/ug-auto-approvals.d.ts +0 -40
  331. package/dist/cli/doctor/ug-auto-approvals.js +0 -91
  332. package/dist/cli/doctor/ug-auto-approvals.js.map +0 -1
  333. package/dist/cli/doctor/ug-delegations.d.ts +0 -26
  334. package/dist/cli/doctor/ug-delegations.js +0 -121
  335. package/dist/cli/doctor/ug-delegations.js.map +0 -1
  336. package/dist/cli/doctor/ug-inflight.d.ts +0 -35
  337. package/dist/cli/doctor/ug-inflight.js +0 -57
  338. package/dist/cli/doctor/ug-inflight.js.map +0 -1
  339. package/dist/cli/doctor/understanding-mode-env.d.ts +0 -51
  340. package/dist/cli/doctor/understanding-mode-env.js +0 -98
  341. package/dist/cli/doctor/understanding-mode-env.js.map +0 -1
  342. package/dist/cli/dry-run.d.ts +0 -46
  343. package/dist/cli/dry-run.js +0 -250
  344. package/dist/cli/dry-run.js.map +0 -1
  345. package/dist/cli/event-input.d.ts +0 -28
  346. package/dist/cli/event-input.js +0 -73
  347. package/dist/cli/event-input.js.map +0 -1
  348. package/dist/cli/explain-action.d.ts +0 -20
  349. package/dist/cli/explain-action.js +0 -27
  350. package/dist/cli/explain-action.js.map +0 -1
  351. package/dist/cli/explain-policy.d.ts +0 -135
  352. package/dist/cli/explain-policy.js +0 -266
  353. package/dist/cli/explain-policy.js.map +0 -1
  354. package/dist/cli/explain.d.ts +0 -31
  355. package/dist/cli/explain.js +0 -159
  356. package/dist/cli/explain.js.map +0 -1
  357. package/dist/cli/gc/index.d.ts +0 -63
  358. package/dist/cli/gc/index.js +0 -566
  359. package/dist/cli/gc/index.js.map +0 -1
  360. package/dist/cli/pack/approve-escape.d.ts +0 -19
  361. package/dist/cli/pack/approve-escape.js +0 -190
  362. package/dist/cli/pack/approve-escape.js.map +0 -1
  363. package/dist/cli/pack/auto-approve-path.d.ts +0 -146
  364. package/dist/cli/pack/auto-approve-path.js +0 -462
  365. package/dist/cli/pack/auto-approve-path.js.map +0 -1
  366. package/dist/cli/pack/hook-codex-post-tool-use.d.ts +0 -25
  367. package/dist/cli/pack/hook-codex-post-tool-use.js +0 -160
  368. package/dist/cli/pack/hook-codex-post-tool-use.js.map +0 -1
  369. package/dist/cli/pack/hook-codex-pre-tool-use.d.ts +0 -48
  370. package/dist/cli/pack/hook-codex-pre-tool-use.js +0 -474
  371. package/dist/cli/pack/hook-codex-pre-tool-use.js.map +0 -1
  372. package/dist/cli/pack/hook-codex-stop.d.ts +0 -35
  373. package/dist/cli/pack/hook-codex-stop.js +0 -329
  374. package/dist/cli/pack/hook-codex-stop.js.map +0 -1
  375. package/dist/cli/pack/hook-codex-user-prompt-submit.d.ts +0 -24
  376. package/dist/cli/pack/hook-codex-user-prompt-submit.js +0 -93
  377. package/dist/cli/pack/hook-codex-user-prompt-submit.js.map +0 -1
  378. package/dist/cli/pack/hook-post-merge-gate-record.d.ts +0 -37
  379. package/dist/cli/pack/hook-post-merge-gate-record.js +0 -190
  380. package/dist/cli/pack/hook-post-merge-gate-record.js.map +0 -1
  381. package/dist/cli/pack/hook-post-merge-gate.d.ts +0 -34
  382. package/dist/cli/pack/hook-post-merge-gate.js +0 -277
  383. package/dist/cli/pack/hook-post-merge-gate.js.map +0 -1
  384. package/dist/cli/pack/hook-post-tool-use.d.ts +0 -45
  385. package/dist/cli/pack/hook-post-tool-use.js +0 -137
  386. package/dist/cli/pack/hook-post-tool-use.js.map +0 -1
  387. package/dist/cli/pack/hook-pre-tool-use.d.ts +0 -92
  388. package/dist/cli/pack/hook-pre-tool-use.js +0 -1328
  389. package/dist/cli/pack/hook-pre-tool-use.js.map +0 -1
  390. package/dist/cli/pack/hook-runtime-reality.d.ts +0 -63
  391. package/dist/cli/pack/hook-runtime-reality.js +0 -210
  392. package/dist/cli/pack/hook-runtime-reality.js.map +0 -1
  393. package/dist/cli/pack/hook-solution-acceptance-writeguard.d.ts +0 -32
  394. package/dist/cli/pack/hook-solution-acceptance-writeguard.js +0 -337
  395. package/dist/cli/pack/hook-solution-acceptance-writeguard.js.map +0 -1
  396. package/dist/cli/pack/hook-solution-acceptance.d.ts +0 -157
  397. package/dist/cli/pack/hook-solution-acceptance.js +0 -530
  398. package/dist/cli/pack/hook-solution-acceptance.js.map +0 -1
  399. package/dist/cli/pack/hook-stay-in-scope.d.ts +0 -37
  400. package/dist/cli/pack/hook-stay-in-scope.js +0 -128
  401. package/dist/cli/pack/hook-stay-in-scope.js.map +0 -1
  402. package/dist/cli/pack/hook-subagent-start.d.ts +0 -23
  403. package/dist/cli/pack/hook-subagent-start.js +0 -88
  404. package/dist/cli/pack/hook-subagent-start.js.map +0 -1
  405. package/dist/cli/pack/hook-subagent-stop.d.ts +0 -19
  406. package/dist/cli/pack/hook-subagent-stop.js +0 -41
  407. package/dist/cli/pack/hook-subagent-stop.js.map +0 -1
  408. package/dist/cli/pack/hook-track-active-claim.d.ts +0 -27
  409. package/dist/cli/pack/hook-track-active-claim.js +0 -275
  410. package/dist/cli/pack/hook-track-active-claim.js.map +0 -1
  411. package/dist/cli/pack/transcript-report-scan.d.ts +0 -71
  412. package/dist/cli/pack/transcript-report-scan.js +0 -359
  413. package/dist/cli/pack/transcript-report-scan.js.map +0 -1
  414. package/dist/cli/pack/understanding-report-schema-hint.d.ts +0 -26
  415. package/dist/cli/pack/understanding-report-schema-hint.js +0 -120
  416. package/dist/cli/pack/understanding-report-schema-hint.js.map +0 -1
  417. package/dist/cli/pack/upgrade.d.ts +0 -32
  418. package/dist/cli/pack/upgrade.js +0 -273
  419. package/dist/cli/pack/upgrade.js.map +0 -1
  420. package/dist/cli/pause/index.d.ts +0 -113
  421. package/dist/cli/pause/index.js +0 -251
  422. package/dist/cli/pause/index.js.map +0 -1
  423. package/dist/cli/pause-check.d.ts +0 -22
  424. package/dist/cli/pause-check.js +0 -54
  425. package/dist/cli/pause-check.js.map +0 -1
  426. package/dist/cli/policy/intercept.d.ts +0 -233
  427. package/dist/cli/policy/intercept.js +0 -1020
  428. package/dist/cli/policy/intercept.js.map +0 -1
  429. package/dist/cli/policy/risk-envelope-enrichment.d.ts +0 -40
  430. package/dist/cli/policy/risk-envelope-enrichment.js +0 -108
  431. package/dist/cli/policy/risk-envelope-enrichment.js.map +0 -1
  432. package/dist/cli/record/index.d.ts +0 -81
  433. package/dist/cli/record/index.js +0 -348
  434. package/dist/cli/record/index.js.map +0 -1
  435. package/dist/cli/resolve-env.d.ts +0 -32
  436. package/dist/cli/resolve-env.js +0 -47
  437. package/dist/cli/resolve-env.js.map +0 -1
  438. package/dist/cli/session-export/index.d.ts +0 -46
  439. package/dist/cli/session-export/index.js +0 -169
  440. package/dist/cli/session-export/index.js.map +0 -1
  441. package/dist/cli/session-export/redact.d.ts +0 -22
  442. package/dist/cli/session-export/redact.js +0 -47
  443. package/dist/cli/session-export/redact.js.map +0 -1
  444. package/dist/cli/session-export/transcript.d.ts +0 -24
  445. package/dist/cli/session-export/transcript.js +0 -164
  446. package/dist/cli/session-export/transcript.js.map +0 -1
  447. package/dist/cli/session-start/branch-check.d.ts +0 -18
  448. package/dist/cli/session-start/branch-check.js +0 -140
  449. package/dist/cli/session-start/branch-check.js.map +0 -1
  450. package/dist/cli/session-start/index.d.ts +0 -121
  451. package/dist/cli/session-start/index.js +0 -591
  452. package/dist/cli/session-start/index.js.map +0 -1
  453. package/dist/cli/session-start/shared-options.d.ts +0 -103
  454. package/dist/cli/session-start/shared-options.js +0 -107
  455. package/dist/cli/session-start/shared-options.js.map +0 -1
  456. package/dist/cli/session-start/stale-base-check.d.ts +0 -46
  457. package/dist/cli/session-start/stale-base-check.js +0 -352
  458. package/dist/cli/session-start/stale-base-check.js.map +0 -1
  459. package/dist/cli/session-start/toolchain-parity.d.ts +0 -267
  460. package/dist/cli/session-start/toolchain-parity.js +0 -797
  461. package/dist/cli/session-start/toolchain-parity.js.map +0 -1
  462. package/dist/cli/smoke/assertions.d.ts +0 -46
  463. package/dist/cli/smoke/assertions.js +0 -170
  464. package/dist/cli/smoke/assertions.js.map +0 -1
  465. package/dist/cli/smoke/index.d.ts +0 -76
  466. package/dist/cli/smoke/index.js +0 -245
  467. package/dist/cli/smoke/index.js.map +0 -1
  468. package/dist/cli/smoke/runner.d.ts +0 -55
  469. package/dist/cli/smoke/runner.js +0 -134
  470. package/dist/cli/smoke/runner.js.map +0 -1
  471. package/dist/cli/smoke/stream-parser.d.ts +0 -65
  472. package/dist/cli/smoke/stream-parser.js +0 -115
  473. package/dist/cli/smoke/stream-parser.js.map +0 -1
  474. package/dist/cli/test-risk.d.ts +0 -26
  475. package/dist/cli/test-risk.js +0 -34
  476. package/dist/cli/test-risk.js.map +0 -1
  477. package/dist/io/display-path.d.ts +0 -11
  478. package/dist/io/display-path.js +0 -29
  479. package/dist/io/display-path.js.map +0 -1
  480. package/dist/io/duration.d.ts +0 -5
  481. package/dist/io/duration.js +0 -50
  482. package/dist/io/duration.js.map +0 -1
  483. package/dist/io/extract.d.ts +0 -79
  484. package/dist/io/extract.js +0 -226
  485. package/dist/io/extract.js.map +0 -1
  486. package/dist/io/ledger-record.d.ts +0 -83
  487. package/dist/io/ledger-record.js +0 -301
  488. package/dist/io/ledger-record.js.map +0 -1
  489. package/dist/io/read-json-dir-entries.d.ts +0 -36
  490. package/dist/io/read-json-dir-entries.js +0 -48
  491. package/dist/io/read-json-dir-entries.js.map +0 -1
  492. package/dist/io/safe-json-parse.d.ts +0 -5
  493. package/dist/io/safe-json-parse.js +0 -21
  494. package/dist/io/safe-json-parse.js.map +0 -1
  495. package/dist/policies/index.d.ts +0 -5
  496. package/dist/policies/index.js +0 -6
  497. package/dist/policies/index.js.map +0 -1
  498. package/dist/policies/ledger-client.d.ts +0 -113
  499. package/dist/policies/ledger-client.js +0 -500
  500. package/dist/policies/ledger-client.js.map +0 -1
  501. package/dist/policies/producers.d.ts +0 -12
  502. package/dist/policies/producers.js +0 -61
  503. package/dist/policies/producers.js.map +0 -1
  504. package/dist/policies/requires.d.ts +0 -75
  505. package/dist/policies/requires.js +0 -240
  506. package/dist/policies/requires.js.map +0 -1
  507. package/dist/policies/timestamp.d.ts +0 -14
  508. package/dist/policies/timestamp.js +0 -36
  509. package/dist/policies/timestamp.js.map +0 -1
  510. package/dist/policy-packs/builtin/permission-profiles.d.ts +0 -11
  511. package/dist/policy-packs/builtin/permission-profiles.js +0 -74
  512. package/dist/policy-packs/builtin/permission-profiles.js.map +0 -1
  513. package/dist/policy-packs/builtin/post-merge-gate-runtime.d.ts +0 -286
  514. package/dist/policy-packs/builtin/post-merge-gate-runtime.js +0 -397
  515. package/dist/policy-packs/builtin/post-merge-gate-runtime.js.map +0 -1
  516. package/dist/policy-packs/builtin/post-merge-gate.d.ts +0 -56
  517. package/dist/policy-packs/builtin/post-merge-gate.js +0 -347
  518. package/dist/policy-packs/builtin/post-merge-gate.js.map +0 -1
  519. package/dist/policy-packs/builtin/solution-acceptance-reconnect.d.ts +0 -50
  520. package/dist/policy-packs/builtin/solution-acceptance-reconnect.js +0 -151
  521. package/dist/policy-packs/builtin/solution-acceptance-reconnect.js.map +0 -1
  522. package/dist/policy-packs/builtin/solution-acceptance-runtime.d.ts +0 -323
  523. package/dist/policy-packs/builtin/solution-acceptance-runtime.js +0 -672
  524. package/dist/policy-packs/builtin/solution-acceptance-runtime.js.map +0 -1
  525. package/dist/policy-packs/builtin/solution-acceptance.d.ts +0 -45
  526. package/dist/policy-packs/builtin/solution-acceptance.js +0 -226
  527. package/dist/policy-packs/builtin/solution-acceptance.js.map +0 -1
  528. package/dist/policy-packs/builtin/understanding-before-execution/active-claim.d.ts +0 -25
  529. package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js +0 -94
  530. package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js.map +0 -1
  531. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.d.ts +0 -35
  532. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js +0 -86
  533. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js.map +0 -1
  534. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.d.ts +0 -210
  535. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js +0 -361
  536. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js.map +0 -1
  537. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.d.ts +0 -304
  538. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js +0 -734
  539. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js.map +0 -1
  540. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.d.ts +0 -36
  541. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js +0 -73
  542. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js.map +0 -1
  543. package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +0 -19
  544. package/dist/policy-packs/builtin/understanding-before-execution/index.js +0 -83
  545. package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +0 -1
  546. package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.d.ts +0 -135
  547. package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js +0 -618
  548. package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js.map +0 -1
  549. package/dist/policy-packs/builtin/understanding-before-execution/ledger.d.ts +0 -25
  550. package/dist/policy-packs/builtin/understanding-before-execution/ledger.js +0 -56
  551. package/dist/policy-packs/builtin/understanding-before-execution/ledger.js.map +0 -1
  552. package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.d.ts +0 -20
  553. package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js +0 -93
  554. package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js.map +0 -1
  555. package/dist/policy-packs/builtin/understanding-before-execution/markers.d.ts +0 -126
  556. package/dist/policy-packs/builtin/understanding-before-execution/markers.js +0 -245
  557. package/dist/policy-packs/builtin/understanding-before-execution/markers.js.map +0 -1
  558. package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.d.ts +0 -29
  559. package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.js +0 -82
  560. package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.js.map +0 -1
  561. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.d.ts +0 -71
  562. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js +0 -175
  563. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js.map +0 -1
  564. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.d.ts +0 -620
  565. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +0 -1047
  566. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js.map +0 -1
  567. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.d.ts +0 -128
  568. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js +0 -213
  569. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js.map +0 -1
  570. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.d.ts +0 -129
  571. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js +0 -166
  572. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js.map +0 -1
  573. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.d.ts +0 -164
  574. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js +0 -275
  575. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js.map +0 -1
  576. package/dist/policy-packs/builtin/understanding-before-execution-runtime.d.ts +0 -1
  577. package/dist/policy-packs/builtin/understanding-before-execution-runtime.js +0 -10
  578. package/dist/policy-packs/builtin/understanding-before-execution-runtime.js.map +0 -1
  579. package/dist/policy-packs/builtin/understanding-before-execution.d.ts +0 -526
  580. package/dist/policy-packs/builtin/understanding-before-execution.js +0 -1074
  581. package/dist/policy-packs/builtin/understanding-before-execution.js.map +0 -1
  582. package/dist/policy-packs/permission-translator.d.ts +0 -9
  583. package/dist/policy-packs/permission-translator.js +0 -76
  584. package/dist/policy-packs/permission-translator.js.map +0 -1
  585. package/dist/runtime/action-envelope.d.ts +0 -64
  586. package/dist/runtime/action-envelope.js +0 -46
  587. package/dist/runtime/action-envelope.js.map +0 -1
  588. package/dist/runtime/approval-signing.d.ts +0 -111
  589. package/dist/runtime/approval-signing.js +0 -384
  590. package/dist/runtime/approval-signing.js.map +0 -1
  591. package/dist/runtime/bash-match-facts.d.ts +0 -60
  592. package/dist/runtime/bash-match-facts.js +0 -196
  593. package/dist/runtime/bash-match-facts.js.map +0 -1
  594. package/dist/runtime/bash-match-registry.d.ts +0 -112
  595. package/dist/runtime/bash-match-registry.js +0 -406
  596. package/dist/runtime/bash-match-registry.js.map +0 -1
  597. package/dist/runtime/bash-prefix-parse.d.ts +0 -31
  598. package/dist/runtime/bash-prefix-parse.js +0 -576
  599. package/dist/runtime/bash-prefix-parse.js.map +0 -1
  600. package/dist/runtime/command-normalize.d.ts +0 -658
  601. package/dist/runtime/command-normalize.js +0 -2410
  602. package/dist/runtime/command-normalize.js.map +0 -1
  603. package/dist/runtime/deletion-target-resolve.d.ts +0 -28
  604. package/dist/runtime/deletion-target-resolve.js +0 -1078
  605. package/dist/runtime/deletion-target-resolve.js.map +0 -1
  606. package/dist/runtime/destructive-shell-floor.d.ts +0 -19
  607. package/dist/runtime/destructive-shell-floor.js +0 -611
  608. package/dist/runtime/destructive-shell-floor.js.map +0 -1
  609. package/dist/runtime/environment-resolver.d.ts +0 -36
  610. package/dist/runtime/environment-resolver.js +0 -138
  611. package/dist/runtime/environment-resolver.js.map +0 -1
  612. package/dist/runtime/git-context.d.ts +0 -201
  613. package/dist/runtime/git-context.js +0 -422
  614. package/dist/runtime/git-context.js.map +0 -1
  615. package/dist/runtime/index.d.ts +0 -12
  616. package/dist/runtime/index.js +0 -13
  617. package/dist/runtime/index.js.map +0 -1
  618. package/dist/runtime/intercept.d.ts +0 -494
  619. package/dist/runtime/intercept.js +0 -1313
  620. package/dist/runtime/intercept.js.map +0 -1
  621. package/dist/runtime/kube-context.d.ts +0 -16
  622. package/dist/runtime/kube-context.js +0 -63
  623. package/dist/runtime/kube-context.js.map +0 -1
  624. package/dist/runtime/kubectl-target-parse.d.ts +0 -31
  625. package/dist/runtime/kubectl-target-parse.js +0 -249
  626. package/dist/runtime/kubectl-target-parse.js.map +0 -1
  627. package/dist/runtime/ledger-add.d.ts +0 -16
  628. package/dist/runtime/ledger-add.js +0 -150
  629. package/dist/runtime/ledger-add.js.map +0 -1
  630. package/dist/runtime/ledger-writer.d.ts +0 -27
  631. package/dist/runtime/ledger-writer.js +0 -46
  632. package/dist/runtime/ledger-writer.js.map +0 -1
  633. package/dist/runtime/pause-sentinel.d.ts +0 -60
  634. package/dist/runtime/pause-sentinel.js +0 -156
  635. package/dist/runtime/pause-sentinel.js.map +0 -1
  636. package/dist/runtime/pending-approval.d.ts +0 -23
  637. package/dist/runtime/pending-approval.js +0 -67
  638. package/dist/runtime/pending-approval.js.map +0 -1
  639. package/dist/runtime/read-only-bash.d.ts +0 -141
  640. package/dist/runtime/read-only-bash.js +0 -2204
  641. package/dist/runtime/read-only-bash.js.map +0 -1
  642. package/dist/runtime/recovery-git-commit.d.ts +0 -22
  643. package/dist/runtime/recovery-git-commit.js +0 -284
  644. package/dist/runtime/recovery-git-commit.js.map +0 -1
  645. package/dist/runtime/reject-malformed-session-id.d.ts +0 -8
  646. package/dist/runtime/reject-malformed-session-id.js +0 -16
  647. package/dist/runtime/reject-malformed-session-id.js.map +0 -1
  648. package/dist/runtime/risk-classifier.d.ts +0 -38
  649. package/dist/runtime/risk-classifier.js +0 -311
  650. package/dist/runtime/risk-classifier.js.map +0 -1
  651. package/dist/runtime/session-id.d.ts +0 -113
  652. package/dist/runtime/session-id.js +0 -193
  653. package/dist/runtime/session-id.js.map +0 -1
  654. package/dist/runtime/shell-word.d.ts +0 -62
  655. package/dist/runtime/shell-word.js +0 -410
  656. package/dist/runtime/shell-word.js.map +0 -1
  657. package/dist/runtime/task-providers/agent-tasks.d.ts +0 -103
  658. package/dist/runtime/task-providers/agent-tasks.js +0 -245
  659. package/dist/runtime/task-providers/agent-tasks.js.map +0 -1
  660. package/dist/runtime/when-eval.d.ts +0 -62
  661. package/dist/runtime/when-eval.js +0 -212
  662. package/dist/runtime/when-eval.js.map +0 -1
  663. package/dist/runtime/workflow-policies.d.ts +0 -207
  664. package/dist/runtime/workflow-policies.js +0 -596
  665. package/dist/runtime/workflow-policies.js.map +0 -1
  666. package/dist/schema/audit.d.ts +0 -71
  667. package/dist/schema/audit.js +0 -32
  668. package/dist/schema/audit.js.map +0 -1
  669. package/dist/schema/doctor.d.ts +0 -25
  670. package/dist/schema/doctor.js +0 -23
  671. package/dist/schema/doctor.js.map +0 -1
  672. package/dist/schema/environments.d.ts +0 -215
  673. package/dist/schema/environments.js +0 -101
  674. package/dist/schema/environments.js.map +0 -1
  675. package/dist/schema/extract.d.ts +0 -9
  676. package/dist/schema/extract.js +0 -86
  677. package/dist/schema/extract.js.map +0 -1
  678. package/dist/schema/permission-profiles.d.ts +0 -2292
  679. package/dist/schema/permission-profiles.js +0 -60
  680. package/dist/schema/permission-profiles.js.map +0 -1
  681. package/dist/schema/policies.d.ts +0 -974
  682. package/dist/schema/policies.js +0 -298
  683. package/dist/schema/policies.js.map +0 -1
  684. package/dist/schema/requires.d.ts +0 -131
  685. package/dist/schema/requires.js +0 -88
  686. package/dist/schema/requires.js.map +0 -1
  687. package/dist/schema/risk.d.ts +0 -144
  688. package/dist/schema/risk.js +0 -194
  689. package/dist/schema/risk.js.map +0 -1
  690. package/dist/schema/session-start-preflight.d.ts +0 -10
  691. package/dist/schema/session-start-preflight.js +0 -106
  692. package/dist/schema/session-start-preflight.js.map +0 -1
  693. package/dist/schema/stale-base-check.d.ts +0 -18
  694. package/dist/schema/stale-base-check.js +0 -37
  695. package/dist/schema/stale-base-check.js.map +0 -1
  696. package/dist/schema/toolchain-parity.d.ts +0 -21
  697. package/dist/schema/toolchain-parity.js +0 -48
  698. package/dist/schema/toolchain-parity.js.map +0 -1
  699. package/dist/schema/workflows.d.ts +0 -519
  700. package/dist/schema/workflows.js +0 -81
  701. package/dist/schema/workflows.js.map +0 -1
  702. package/scripts/runtime-reality-docker-probe.mjs +0 -71
@@ -1,103 +0,0 @@
1
- import type { Command } from "commander";
2
- import type { ResolveReadSessionOptions } from "../../runtime/session-id.js";
3
- import type { Manifest } from "../../schema/index.js";
4
- import type { LoaderOptions } from "../loader.js";
5
- /** The literal session id every producer falls back to when none is known. */
6
- export declare const FALLBACK_SESSION = "default";
7
- /** Which tier of the session-id resolution chain produced the id. */
8
- export type SessionSource = "flag" | "stdin" | "env" | "transcript" | "default";
9
- /** The slice of the SessionStart hook event JSON the producers read. */
10
- export interface SessionStartEvent {
11
- session_id?: unknown;
12
- cwd?: unknown;
13
- hook_event_name?: unknown;
14
- }
15
- /** The ledger-writer seam every producer exposes to tests. */
16
- export type SessionStartLedgerWriter = (args: {
17
- sessionId: string;
18
- content: string;
19
- source: string;
20
- }) => Promise<{
21
- ok: boolean;
22
- reason?: string;
23
- }>;
24
- /** Options every session-start producer takes. */
25
- export interface SessionStartCommonOptions extends LoaderOptions {
26
- /** Defaults to process.stdin. */
27
- stdin?: NodeJS.ReadableStream;
28
- /** Defaults to process.stderr. stdout is never written (SessionStart). */
29
- stderr?: NodeJS.WritableStream;
30
- /** Explicit session id (overrides every other source). */
31
- session?: string;
32
- /**
33
- * Idle bound, in ms, for the stdin read (default STDIN_IDLE_TIMEOUT_MS).
34
- * Tests inject a short value.
35
- */
36
- stdinIdleTimeoutMs?: number;
37
- /** Per-call ledger timeout in ms. */
38
- ledgerTimeoutMs?: number;
39
- /** Inject the ledger writer (tests). */
40
- writeLedger?: SessionStartLedgerWriter;
41
- /** Inject the read-path session resolver (env + transcript discovery). Test seam. */
42
- resolveSession?: (explicit: string | undefined, opts: ResolveReadSessionOptions) => string;
43
- /** Inject a manifest (tests). Bypasses loadManifest. */
44
- manifest?: Manifest;
45
- }
46
- /** Common options plus the `--cwd` override, for the producers that take one. */
47
- export interface SessionStartCwdOptions extends SessionStartCommonOptions {
48
- /** Override the cwd resolution (test injection). Falls back to event.cwd then process.cwd(). */
49
- cwd?: string;
50
- }
51
- /** Parse the text of a SessionStart event (empty text is an empty event). */
52
- export declare function parseSessionStartEvent(text: string): SessionStartEvent;
53
- /**
54
- * Read and parse the SessionStart event JSON from a stream. The read is
55
- * idle-bounded (see bounded-stdin.ts): when stdin never closes, the text read
56
- * so far is parsed (empty text is an empty event) and `onTimeout` receives the
57
- * stderr note the producer logs.
58
- */
59
- export declare function readSessionStartEvent(stream: NodeJS.ReadableStream, opts?: {
60
- idleTimeoutMs?: number;
61
- onTimeout?: (note: string) => void;
62
- }): Promise<SessionStartEvent>;
63
- /** The reason line a producer logs when the event JSON does not parse. */
64
- export declare function malformedEventReason(err: unknown): string;
65
- /** `--cwd` first, then the event's cwd, then the process cwd. */
66
- export declare function resolveEventCwd(optCwd: unknown, event: SessionStartEvent): string;
67
- /** The session id handed to the resolver: the flag, else the event's, else none. */
68
- export declare function explicitSessionId(optSession: unknown, event: SessionStartEvent): string | undefined;
69
- /**
70
- * Classify where a resolved session id came from: the flag, the stdin
71
- * event, an env var, a discovered transcript, or the literal default.
72
- * `resolverThrew` forces "default" (the id recorded is the fallback even
73
- * when the flag or event carried one).
74
- */
75
- export declare function classifySessionSource(optSession: unknown, event: SessionStartEvent, sessionId: string, resolverThrew?: boolean): SessionSource;
76
- /** The option bag commander hands the action of a session-start subcommand. */
77
- export interface SessionStartCliOptions {
78
- config?: string;
79
- project?: string;
80
- session?: string;
81
- cwd?: string;
82
- ledgerTimeout?: string;
83
- }
84
- /** `--config` and `--project`, then `--session` with the caller's description. */
85
- export declare function addIdentityOptions(cmd: Command, sessionDescription: string): Command;
86
- /** `--cwd`. */
87
- export declare function addCwdOption(cmd: Command): Command;
88
- /** `--ledger-timeout`. */
89
- export declare function addLedgerTimeoutOption(cmd: Command): Command;
90
- /** The `run*` options a parsed CLI option bag fills in. */
91
- export interface SessionStartCliTarget {
92
- configPath?: string;
93
- project?: string;
94
- session?: string;
95
- cwd?: string;
96
- ledgerTimeoutMs?: number;
97
- }
98
- /**
99
- * Copy the shared CLI options into a producer's options. A value that is
100
- * absent is left unset; a `--ledger-timeout` that is not a positive
101
- * integer is ignored (the producer's default timeout applies).
102
- */
103
- export declare function applyCliOptions(options: SessionStartCliOptions, target: SessionStartCliTarget): void;
@@ -1,107 +0,0 @@
1
- // Shared plumbing for the `harness session-start` producers
2
- // (preflight, branch-check, toolchain-parity, stale-base-check) and the
3
- // top-level `preflight` alias: the SessionStart event type, the stdin
4
- // read, the cwd and session-source resolution, the options every
5
- // producer takes, and the commander options every subcommand declares.
6
- //
7
- // Pure extraction: each producer used to carry its own copy of these
8
- // pieces, and every copy behaved the same. Nothing here changes what a
9
- // producer reads, writes or prints.
10
- import { readStdinBounded, STDIN_IDLE_TIMEOUT_MS, stdinTimeoutNote } from "../bounded-stdin.js";
11
- /** The literal session id every producer falls back to when none is known. */
12
- export const FALLBACK_SESSION = "default";
13
- /** Parse the text of a SessionStart event (empty text is an empty event). */
14
- export function parseSessionStartEvent(text) {
15
- return JSON.parse(text.trim() || "{}");
16
- }
17
- /**
18
- * Read and parse the SessionStart event JSON from a stream. The read is
19
- * idle-bounded (see bounded-stdin.ts): when stdin never closes, the text read
20
- * so far is parsed (empty text is an empty event) and `onTimeout` receives the
21
- * stderr note the producer logs.
22
- */
23
- export async function readSessionStartEvent(stream, opts = {}) {
24
- const idleTimeoutMs = opts.idleTimeoutMs ?? STDIN_IDLE_TIMEOUT_MS;
25
- const read = await readStdinBounded(stream, idleTimeoutMs);
26
- if (read.timedOut)
27
- opts.onTimeout?.(stdinTimeoutNote(read, idleTimeoutMs));
28
- return parseSessionStartEvent(read.text);
29
- }
30
- /** The reason line a producer logs when the event JSON does not parse. */
31
- export function malformedEventReason(err) {
32
- return `malformed event JSON: ${err.message}`;
33
- }
34
- /** `--cwd` first, then the event's cwd, then the process cwd. */
35
- export function resolveEventCwd(optCwd, event) {
36
- return typeof optCwd === "string" && optCwd.length > 0
37
- ? optCwd
38
- : typeof event.cwd === "string" && event.cwd.length > 0
39
- ? event.cwd
40
- : process.cwd();
41
- }
42
- /** The session id handed to the resolver: the flag, else the event's, else none. */
43
- export function explicitSessionId(optSession, event) {
44
- return typeof optSession === "string" && optSession.length > 0
45
- ? optSession
46
- : typeof event.session_id === "string" && event.session_id.length > 0
47
- ? event.session_id
48
- : undefined;
49
- }
50
- /**
51
- * Classify where a resolved session id came from: the flag, the stdin
52
- * event, an env var, a discovered transcript, or the literal default.
53
- * `resolverThrew` forces "default" (the id recorded is the fallback even
54
- * when the flag or event carried one).
55
- */
56
- export function classifySessionSource(optSession, event, sessionId, resolverThrew = false) {
57
- return resolverThrew
58
- ? "default"
59
- : typeof optSession === "string" && optSession.length > 0
60
- ? "flag"
61
- : typeof event.session_id === "string" && event.session_id.length > 0
62
- ? "stdin"
63
- : sessionId === FALLBACK_SESSION
64
- ? "default"
65
- : (typeof process.env.CLAUDE_CODE_SESSION_ID === "string" &&
66
- process.env.CLAUDE_CODE_SESSION_ID === sessionId) ||
67
- (typeof process.env.CLAUDE_SESSION_ID === "string" &&
68
- process.env.CLAUDE_SESSION_ID === sessionId)
69
- ? "env"
70
- : "transcript";
71
- }
72
- /** `--config` and `--project`, then `--session` with the caller's description. */
73
- export function addIdentityOptions(cmd, sessionDescription) {
74
- return cmd
75
- .option("--config <path>", "manifest path (default: ~/.harness/harness.yaml; legacy fallback ~/.claude/harness.yaml)")
76
- .option("--project <name>", "apply per-project overrides")
77
- .option("--session <id>", sessionDescription);
78
- }
79
- /** `--cwd`. */
80
- export function addCwdOption(cmd) {
81
- return cmd.option("--cwd <path>", "override cwd resolution (default: stdin event.cwd then process.cwd())");
82
- }
83
- /** `--ledger-timeout`. */
84
- export function addLedgerTimeoutOption(cmd) {
85
- return cmd.option("--ledger-timeout <ms>", "per-call ledger timeout in milliseconds");
86
- }
87
- /**
88
- * Copy the shared CLI options into a producer's options. A value that is
89
- * absent is left unset; a `--ledger-timeout` that is not a positive
90
- * integer is ignored (the producer's default timeout applies).
91
- */
92
- export function applyCliOptions(options, target) {
93
- if (options.config)
94
- target.configPath = options.config;
95
- if (options.project)
96
- target.project = options.project;
97
- if (options.session)
98
- target.session = options.session;
99
- if (options.cwd)
100
- target.cwd = options.cwd;
101
- if (options.ledgerTimeout) {
102
- const n = Number.parseInt(options.ledgerTimeout, 10);
103
- if (Number.isFinite(n) && n > 0)
104
- target.ledgerTimeoutMs = n;
105
- }
106
- }
107
- //# sourceMappingURL=shared-options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared-options.js","sourceRoot":"","sources":["../../../src/cli/session-start/shared-options.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,wEAAwE;AACxE,sEAAsE;AACtE,iEA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AAG;SACP,MAAM,CACL,iBAAiB,EACjB,0FAA0F,CAC3F;SACA,MAAM,CAAC,kBAAkB,EAAE,6BAA6B,CAAC;SACzD,MAAM,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;AAClD,CAAC;AAED,eAAe;AACf,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,OAAO,GAAG,CAAC,MAAM,CACf,cAAc,EACd,uEAAuE,CACxE,CAAC;AACJ,CAAC;AAED,0BAA0B;AAC1B,MAAM,UAAU,sBAAsB,CAAC,GAAY;IACjD,OAAO,GAAG,CAAC,MAAM,CAAC,uBAAuB,EAAE,yCAAyC,CAAC,CAAC;AACxF,CAAC;AAWD;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAA+B,EAAE,MAA6B;IAC5F,IAAI,OAAO,CAAC,MAAM;QAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IACvD,IAAI,OAAO,CAAC,OAAO;QAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACtD,IAAI,OAAO,CAAC,OAAO;QAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACtD,IAAI,OAAO,CAAC,GAAG;QAAE,MAAM,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAC1C,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,MAAM,CAAC,eAAe,GAAG,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC"}
@@ -1,46 +0,0 @@
1
- import { type SessionSource, type SessionStartCwdOptions } from "./shared-options.js";
2
- export interface StaleBaseCheckArgs {
3
- cwd: string;
4
- remote: string;
5
- defaultBranch: string;
6
- branch: string;
7
- timeoutMs: number;
8
- }
9
- export type StaleBaseCheckResult = {
10
- ok: true;
11
- /** Commits on `branch` not reachable from the live remote tip. */
12
- aheadCount: number;
13
- /** Commits on the live remote tip not reachable from `branch` — the staleness signal. */
14
- behindCount: number;
15
- /** Only set when `behindCount > 0`: the live remote tip's own sha. */
16
- remoteSha?: string;
17
- /** Only set when `behindCount > 0`: ISO commit date of the live remote tip. */
18
- latestRemoteCommitIso?: string;
19
- } | {
20
- ok: false;
21
- reason: string;
22
- };
23
- export interface SessionStartStaleBaseCheckOptions extends SessionStartCwdOptions {
24
- /** Override "now" for deterministic age-formatting tests. */
25
- now?: Date;
26
- /** Inject the live check (tests) — see realCheckStaleBase's doc. */
27
- runCheck?: (args: StaleBaseCheckArgs) => Promise<StaleBaseCheckResult>;
28
- }
29
- export interface SessionStartStaleBaseCheckResult {
30
- /** Always 0 — a SessionStart hook must never break the session loop. */
31
- exitCode: number;
32
- /** Whether the `stale-base:` ledger fact was written. */
33
- wrote: boolean;
34
- /** Resolved repo name. */
35
- repo: string;
36
- /** Resolved branch ("" if detached or outside a repo). */
37
- branch: string;
38
- /** Commits the branch's base is behind the live remote default, when the check ran. */
39
- behindCount?: number;
40
- /** Resolved session id. */
41
- sessionId: string;
42
- sessionSource: SessionSource;
43
- /** Human-readable explanation of a non-write outcome, for diagnostics. */
44
- reason?: string;
45
- }
46
- export declare function runSessionStartStaleBaseCheck(opts?: SessionStartStaleBaseCheckOptions): Promise<SessionStartStaleBaseCheckResult>;
@@ -1,352 +0,0 @@
1
- // `harness session-start stale-base-check` — SessionStart hook
2
- // entrypoint, fourth sibling of `harness session-start preflight` /
3
- // `branch-check` / `toolchain-parity`.
4
- //
5
- // Incident (task ea8becf5): a task branch was cut from a local `master`
6
- // that had not been fetched in 4 days. The v0.42.0 release had already
7
- // landed on `origin/master` 6h before the branch point. The resulting PR
8
- // went straight to CONFLICTING and its CI never ran. Nothing surfaced the
9
- // gap at the time it was still cheap to fix (before work landed on the
10
- // branch), because:
11
- // - `harness preflight` checks the working TREE, never the remote.
12
- // - `harness session-start branch-check` reads `.git/HEAD` and a
13
- // protected-branch list; it has no notion of "is this branch's base
14
- // current".
15
- // - the post-merge-gate convention only ever fires AFTER a merge.
16
- // And the obvious-looking fix is itself the trap this module exists to
17
- // avoid: `git merge-base HEAD origin/master` LOOKS authoritative, but
18
- // `origin/master` is a LOCAL, cached ref — exactly the ref that was 4
19
- // days stale in the incident. Computing "how stale" from a stale ref
20
- // answers a different question than the one that matters.
21
- //
22
- // --- WHERE this sits (task brief step 3) ---
23
- // SessionStart companion, not a `preflight`-check addition and not a
24
- // PreToolUse gate:
25
- // - `harness policy intercept` (the PreToolUse hot path, evaluated on
26
- // EVERY Bash/Edit/Write tool call — see runtime/intercept.ts) must
27
- // never do network I/O; a `git fetch` there would add real latency to
28
- // every single tool call for the life of the session. This module is
29
- // wired ONLY under `harness session-start ...` (this file lives in
30
- // src/cli/, which src/runtime/intercept.ts is structurally forbidden
31
- // from importing — enforced by .dependency-cruiser.cjs's
32
- // "runtime-no-upward-imports" rule, i.e. `npm run check:boundaries`
33
- // fails the build if that ever changes), so the one network call this
34
- // module makes can only ever happen once per SessionStart, never on
35
- // the hot path.
36
- // - `agent-preflight` (the external `preflight` binary
37
- // `session-start/index.ts` wraps) is a SEPARATE npm package; teaching
38
- // it to do remote checks is out of this task's scope (task brief
39
- // "Out of scope").
40
- // - A PreToolUse gate (`requires.ledger_tag`-style, like
41
- // `preflight-before-push`) was considered and REJECTED: every such
42
- // gate in this codebase fails CLOSED for a SECURITY invariant (an
43
- // absent/expired tag blocks the action). A stale base is a
44
- // time-loss problem, not a security problem — blocking on it would
45
- // violate the task's hard constraint ("Keine Aussperrung: ein
46
- // veralteter Base darf die Arbeit nicht verhindern") for zero
47
- // security benefit. A SessionStart producer's own contract
48
- // (`blocking:false`, always exit 0) makes the non-blocking posture
49
- // structural rather than a policy authors could get wrong later.
50
- //
51
- // --- SCHÄRFE (severity) chosen: WARNUNG, not Hinweis, not Block ---
52
- // - Block is impossible by construction here (see above) and would
53
- // directly violate the hard constraint anyway.
54
- // - A quiet Hinweis (a single low-key note easy to scroll past) risks
55
- // reproducing the founding incident's own failure mode almost
56
- // exactly: "nichts fiel auf" is the whole reason this task exists.
57
- // - So: a loud stderr WARNING line — same visibility tier as the two
58
- // existing loud-but-non-blocking SessionStart producers
59
- // (`toolchain-parity`'s drift lines, `preflight`'s not-ready
60
- // diagnostic) — naming the concrete commit count, how old the missing
61
- // work is, and the exact recovery command. Purely advisory: no
62
- // PreToolUse gate consumes the `stale-base:` ledger fact this writes
63
- // (same posture as `toolchain-parity:`, audit-trail only for
64
- // `harness audit`/forensics).
65
- //
66
- // --- Fetch cost / why opt-in (task brief: "inkl. Fetch-Kosten") ---
67
- // `stale_base_check.enabled` defaults to `false` (schema:
68
- // src/schema/stale-base-check.ts). An operator who has not asked for
69
- // this pays ZERO extra session-start latency or network egress — the
70
- // producer returns before touching `child_process` at all when
71
- // unconfigured. Once enabled, the cost is bounded by
72
- // `fetch_timeout_ms` (default 8000ms) per `git` subprocess call (at most
73
- // three: fetch, rev-list, log — see `realCheckStaleBase` below), and the
74
- // fetch itself is normally near-instant: `git fetch <remote>
75
- // <defaultBranch>` only ever needs to transfer the commits this checkout
76
- // doesn't already have. It always writes `FETCH_HEAD`; on a normal clone
77
- // (whose configured `remote.<remote>.fetch` refspec matches the named
78
- // branch) `git` ALSO refreshes the local `refs/remotes/<remote>/
79
- // <defaultBranch>` tracking ref as a side effect — a welcome bonus (it
80
- // self-heals the exact staleness the incident hit) but never something
81
- // this module relies on or reads back: see below.
82
- //
83
- // --- The ref-staleness trap, closed ---
84
- // The remote's default-branch NAME (e.g. "master") is resolved from the
85
- // local `refs/remotes/origin/HEAD` file via `resolveOriginHeadBase` — that
86
- // is safe to trust: a repo's default branch NAME essentially never
87
- // changes after initial setup. What must NEVER be trusted is that same
88
- // ref's SHA as a staleness signal — that is precisely what went stale in
89
- // the incident. This module never READS a local `refs/remotes/<remote>/
90
- // <defaultBranch>` sha for comparison (regardless of whether the fetch
91
- // above happened to refresh it); the only sha it ever compares `branch`
92
- // against is `FETCH_HEAD`, populated by a live `git fetch` performed
93
- // THIS run.
94
- //
95
- // SessionStart contract, same as the three siblings: `blocking:false`.
96
- // Every failure path (not configured, not a git repo, detached HEAD,
97
- // default branch unresolved, `git` not on PATH, no remote configured, no
98
- // credentials, offline/timeout, unparseable output, a ledger-write
99
- // failure) logs one line to stderr and exits 0 — never blocking, never
100
- // throwing (except the hermetic-spawn-guard violation under vitest
101
- // without an injected `runCheck`, which — like the sibling producers —
102
- // must propagate rather than be swallowed; see hermetic-spawn-guard.ts).
103
- import { execFile } from "node:child_process";
104
- import { findGitEntry, resolveCommonDir, resolveGitContext, resolveOriginHeadBase, } from "../../runtime/git-context.js";
105
- import { assertNoRealSpawnInTests } from "../../runtime/hermetic-spawn-guard.js";
106
- import { resolveManifestLedgerWriter } from "../../runtime/ledger-writer.js";
107
- import { resolveReadSessionId } from "../../runtime/session-id.js";
108
- import { loadManifest } from "../loader.js";
109
- import { classifySessionSource, explicitSessionId, FALLBACK_SESSION, malformedEventReason, readSessionStartEvent, resolveEventCwd, } from "./shared-options.js";
110
- import { formatSnapshotAge } from "./toolchain-parity.js";
111
- const LEDGER_SOURCE = "harness-session-start-stale-base-check";
112
- const DEFAULT_REMOTE = "origin";
113
- const DEFAULT_FETCH_TIMEOUT_MS = 8_000;
114
- /**
115
- * Run one `git <args>` in `cwd`, classifying the common failure shapes
116
- * (missing binary / timeout / non-zero exit) the same way the sibling
117
- * producers' subprocess wrappers do (`spawnPreflight` in
118
- * session-start/index.ts, `realNpmGlobalsSpawn` in toolchain-parity.ts).
119
- * Never rejects.
120
- */
121
- function execGit(args, cwd, timeoutMs) {
122
- return new Promise((resolve) => {
123
- execFile("git", args, { cwd, timeout: timeoutMs, maxBuffer: 4 * 1024 * 1024, encoding: "utf8" }, (err, stdout, stderr) => {
124
- const text = (stdout ?? "").toString().trim();
125
- if (!err) {
126
- resolve({ ok: true, stdout: text, reason: "" });
127
- return;
128
- }
129
- const e = err;
130
- if (e.code === "ENOENT") {
131
- resolve({ ok: false, stdout: "", reason: "`git` not on PATH" });
132
- return;
133
- }
134
- if (e.killed) {
135
- resolve({
136
- ok: false,
137
- stdout: "",
138
- reason: `\`git ${args.join(" ")}\` timed out after ${timeoutMs}ms (remote unreachable or very slow)`,
139
- });
140
- return;
141
- }
142
- const stderrText = (stderr ?? "").toString().trim().split("\n")[0] ?? "";
143
- const capped = stderrText.length > 200 ? `${stderrText.slice(0, 199)}…` : stderrText;
144
- resolve({
145
- ok: false,
146
- stdout: "",
147
- reason: `\`git ${args.join(" ")}\` failed${capped ? `: ${capped}` : ` (exit ${e.code ?? "?"})`}`,
148
- });
149
- });
150
- });
151
- }
152
- /**
153
- * The real, network-touching implementation. Guarded by
154
- * `assertNoRealSpawnInTests` (see that module's doc) so an un-injected
155
- * test can never accidentally exercise a real `git fetch` — every test in
156
- * this module's suite either injects `runCheck` or opts into the real
157
- * path via the documented `HARNESS_ALLOW_REAL_SPAWN=1` escape hatch
158
- * against a local fixture repo (never a real network host).
159
- *
160
- * Sequence: `git fetch --no-tags <remote> <defaultBranch>` (always writes
161
- * FETCH_HEAD; may also refresh the local remote-tracking ref as a normal
162
- * git side effect — see the module header), then `git rev-list
163
- * --left-right --count <branch>...FETCH_HEAD` for the ahead/behind counts,
164
- * then — only when behind > 0, since that is the only case the caller's
165
- * message needs it — `git log -1 --format=%H%x09%cI FETCH_HEAD` for the
166
- * live remote tip's sha + committer date. Comparison is always against
167
- * `FETCH_HEAD` (this run's live result), never a cached tracking ref.
168
- */
169
- function realCheckStaleBase(args) {
170
- assertNoRealSpawnInTests("git fetch (stale-base-check)", "Inject a fake `runCheck` (SessionStartStaleBaseCheckOptions.runCheck), or opt into the " +
171
- "real path against a LOCAL fixture repo via HARNESS_ALLOW_REAL_SPAWN=1 for a dedicated " +
172
- "real-git plumbing test — never exercise this against a real network host in a test.");
173
- const { cwd, remote, defaultBranch, branch, timeoutMs } = args;
174
- return (async () => {
175
- const fetch = await execGit(["fetch", "--no-tags", "--", remote, defaultBranch], cwd, timeoutMs);
176
- if (!fetch.ok)
177
- return { ok: false, reason: fetch.reason };
178
- const counts = await execGit(["rev-list", "--left-right", "--count", `${branch}...FETCH_HEAD`], cwd, timeoutMs);
179
- if (!counts.ok)
180
- return { ok: false, reason: counts.reason };
181
- const parts = counts.stdout.split(/\s+/).filter((p) => p.length > 0);
182
- const aheadCount = Number.parseInt(parts[0] ?? "", 10);
183
- const behindCount = Number.parseInt(parts[1] ?? "", 10);
184
- if (!Number.isFinite(aheadCount) || !Number.isFinite(behindCount)) {
185
- return { ok: false, reason: `\`git rev-list --left-right --count\` produced unparseable output: "${counts.stdout}"` };
186
- }
187
- if (behindCount === 0)
188
- return { ok: true, aheadCount, behindCount };
189
- const log = await execGit(["log", "-1", "--format=%H%x09%cI", "FETCH_HEAD"], cwd, timeoutMs);
190
- if (!log.ok) {
191
- // The counts themselves are still good evidence — degrade the
192
- // extra detail, not the whole result.
193
- return { ok: true, aheadCount, behindCount };
194
- }
195
- const [remoteSha, latestRemoteCommitIso] = log.stdout.split("\t");
196
- return {
197
- ok: true,
198
- aheadCount,
199
- behindCount,
200
- ...(remoteSha ? { remoteSha } : {}),
201
- ...(latestRemoteCommitIso ? { latestRemoteCommitIso } : {}),
202
- };
203
- })();
204
- }
205
- export async function runSessionStartStaleBaseCheck(opts = {}) {
206
- const stdin = opts.stdin ?? process.stdin;
207
- const stderr = opts.stderr ?? process.stderr;
208
- const now = opts.now ?? new Date();
209
- const note = (msg) => {
210
- stderr.write(`harness session-start stale-base-check: ${msg}\n`);
211
- };
212
- const done = (wrote, repo, branch, sessionId, sessionSource, reason, behindCount) => ({
213
- exitCode: 0,
214
- wrote,
215
- repo,
216
- branch,
217
- sessionId,
218
- sessionSource,
219
- ...(behindCount !== undefined && { behindCount }),
220
- ...(reason !== undefined && { reason }),
221
- });
222
- let event;
223
- try {
224
- event = await readSessionStartEvent(stdin, {
225
- onTimeout: note,
226
- ...(opts.stdinIdleTimeoutMs !== undefined && { idleTimeoutMs: opts.stdinIdleTimeoutMs }),
227
- });
228
- }
229
- catch (err) {
230
- const reason = malformedEventReason(err);
231
- note(reason);
232
- return done(false, "", "", FALLBACK_SESSION, "default", reason);
233
- }
234
- const cwd = resolveEventCwd(opts.cwd, event);
235
- const explicit = explicitSessionId(opts.session, event);
236
- const resolveSession = opts.resolveSession ?? resolveReadSessionId;
237
- const sessionId = resolveSession(explicit, {});
238
- const sessionSource = classifySessionSource(opts.session, event, sessionId);
239
- let manifest;
240
- if (opts.manifest) {
241
- manifest = opts.manifest;
242
- }
243
- else {
244
- try {
245
- manifest = loadManifest(opts).manifest;
246
- }
247
- catch (err) {
248
- const reason = `manifest load failed: ${err.message}`;
249
- note(reason);
250
- return done(false, "", "", sessionId, sessionSource, reason);
251
- }
252
- }
253
- const config = manifest.stale_base_check;
254
- if (!config.enabled) {
255
- const reason = "not configured (add `stale_base_check: { enabled: true }` to harness.yaml); skipping — no network touched";
256
- note(reason);
257
- return done(false, "", "", sessionId, sessionSource, reason);
258
- }
259
- const { repo, branch } = resolveGitContext(cwd);
260
- if (repo === "") {
261
- const reason = `cwd is not inside a git work tree (${cwd}); nothing to check`;
262
- note(reason);
263
- return done(false, "", "", sessionId, sessionSource, reason);
264
- }
265
- if (branch === "") {
266
- const reason = "detached HEAD (or unreadable HEAD) — no branch to check a base for";
267
- note(reason);
268
- return done(false, repo, "", sessionId, sessionSource, reason);
269
- }
270
- const remote = config.remote ?? DEFAULT_REMOTE;
271
- const timeoutMs = config.fetch_timeout_ms ?? DEFAULT_FETCH_TIMEOUT_MS;
272
- let defaultBranch = config.default_branch;
273
- if (!defaultBranch) {
274
- // NOTE: `resolveOriginHeadBase` reads `refs/remotes/origin/HEAD`
275
- // specifically (hardcoded "origin" — see runtime/git-context.ts), not
276
- // `refs/remotes/<remote>/HEAD`. For the overwhelming common case
277
- // (`remote` left at its "origin" default) this is exactly right. A
278
- // manifest that configures a NON-"origin" `remote` without also
279
- // setting `default_branch` explicitly will fail this auto-resolution
280
- // and fall into the "could not be resolved" degrade path below —
281
- // fail-open (skip, no fact written), never a wrong/misleading result,
282
- // so this is a completeness gap, not a correctness risk.
283
- const gitDir = findGitEntry(cwd)?.gitDir;
284
- defaultBranch = gitDir ? (resolveOriginHeadBase(resolveCommonDir(gitDir)) ?? undefined) : undefined;
285
- }
286
- if (!defaultBranch) {
287
- const reason = `default branch could not be resolved (checked \`stale_base_check.default_branch\` and ` +
288
- `refs/remotes/${remote}/HEAD / packed-refs); skipping. Set \`stale_base_check.default_branch\` ` +
289
- "explicitly to fix this.";
290
- note(reason);
291
- return done(false, repo, branch, sessionId, sessionSource, reason);
292
- }
293
- if (branch === defaultBranch) {
294
- const reason = `on ${defaultBranch} itself; nothing to compare a base against`;
295
- note(reason);
296
- return done(false, repo, branch, sessionId, sessionSource, reason);
297
- }
298
- const runCheck = opts.runCheck ?? realCheckStaleBase;
299
- const result = await runCheck({ cwd, remote, defaultBranch, branch, timeoutMs });
300
- if (!result.ok) {
301
- // Fail-open by construction (task hard constraint): every reason here
302
- // — no remote configured, no credentials, offline, timeout, git
303
- // missing — degrades to "no fact written", never a thrown error and
304
- // never a block. A stale base costs time, not safety.
305
- note(`${result.reason} — degrading cleanly (not blocking; the base-staleness check is advisory-only)`);
306
- return done(false, repo, branch, sessionId, sessionSource, result.reason);
307
- }
308
- const remoteRef = `${remote}/${defaultBranch}`;
309
- if (result.behindCount === 0) {
310
- note(`base is current with ${remoteRef} (live check via \`git fetch\`)`);
311
- }
312
- else {
313
- const ageSuffix = result.latestRemoteCommitIso
314
- ? ` (newest missing commit landed ${formatSnapshotAge(Math.max(0, now.getTime() - Date.parse(result.latestRemoteCommitIso)))} ago, ${result.latestRemoteCommitIso})`
315
- : "";
316
- const aheadSuffix = result.aheadCount > 0 ? `; this branch itself is ${result.aheadCount} commit(s) ahead of that base` : "";
317
- note(`WARNING: this branch's base is ${result.behindCount} commit(s) behind ${remoteRef}${ageSuffix}${aheadSuffix}. ` +
318
- `This is a LIVE check (a real \`git fetch\`, not the local ${remoteRef} ref, which may itself be stale). ` +
319
- `Recommended before continuing: \`git fetch ${remote} && git rebase ${remoteRef}\` (or merge) — ` +
320
- "otherwise this PR risks landing CONFLICTING with CI never running (the incident this check exists to catch).");
321
- }
322
- const content = result.behindCount === 0
323
- ? `stale-base:${repo}:${branch} ok base:${remoteRef}`
324
- : `stale-base:${repo}:${branch} behind:${result.behindCount} ahead:${result.aheadCount} base:${remoteRef}` +
325
- (result.remoteSha ? ` remote_sha:${result.remoteSha}` : "");
326
- let writeLedger = opts.writeLedger;
327
- if (!writeLedger) {
328
- const resolved = resolveManifestLedgerWriter(manifest, {
329
- ...(opts.ledgerTimeoutMs !== undefined ? { ledgerTimeoutMs: opts.ledgerTimeoutMs } : {}),
330
- });
331
- if (!resolved.ok) {
332
- const reason = `${resolved.reason}; cannot record ${content}`;
333
- note(reason);
334
- return done(false, repo, branch, sessionId, sessionSource, reason, result.behindCount);
335
- }
336
- writeLedger = resolved.write;
337
- }
338
- const written = await writeLedger({ sessionId, content, source: LEDGER_SOURCE });
339
- if (!written.ok) {
340
- const reason = `ledger write failed: ${written.reason ?? "unknown error"}`;
341
- note(reason);
342
- return done(false, repo, branch, sessionId, sessionSource, reason, result.behindCount);
343
- }
344
- note(`recorded ${content} for session ${sessionId}`);
345
- if (sessionSource === "default") {
346
- note("WARNING: session resolved to the literal \"default\". This tag is audit-only (no gate consumes " +
347
- "stale-base: yet), but pipe SessionStart event JSON on stdin, export $CLAUDE_SESSION_ID, or pass " +
348
- "--session <id> for manual / scripted use to keep the audit trail useful.");
349
- }
350
- return done(true, repo, branch, sessionId, sessionSource, undefined, result.behindCount);
351
- }
352
- //# sourceMappingURL=stale-base-check.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stale-base-check.js","sourceRoot":"","sources":["../../../src/cli/session-start/stale-base-check.ts"],"names":[],"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