@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
@@ -0,0 +1,208 @@
1
+ import { type CodexManagedHookUnit } from "../apply/install-codex-config.js";
2
+ export declare const CODEX_SNAPSHOT_BASENAME_PREFIX = "harness.gate-disable-codex.";
3
+ /** Why `gate enable --runtime codex` retired a snapshot: it was applied or
4
+ * found already applied (`restored`), or its units were brought back by
5
+ * something else since it was taken, such as a re-install (`superseded`). */
6
+ export type CodexSnapshotRetirement = "restored" | "superseded";
7
+ export declare const CODEX_SNAPSHOT_VERSION: 3;
8
+ export declare const CODEX_SNAPSHOT_TARGET: "codex";
9
+ /** The value a neutralised unit's `hooks` line carries. */
10
+ export declare const CODEX_NEUTRALISED_HOOKS = "hooks = []";
11
+ export interface CodexDisabledUnit {
12
+ event: string;
13
+ /** Position of the unit among the units of its event in the block. */
14
+ eventIndex: number;
15
+ /** Position of the unit among all units of the block. */
16
+ ordinal: number;
17
+ id: string;
18
+ matcher: string | null;
19
+ /** The unit's original `hooks = [...]` line, verbatim, without its line terminator. */
20
+ hooksText: string;
21
+ }
22
+ /** One later `gate disable` merged into a live snapshot, kept for audit. */
23
+ export interface CodexSnapshotMerge {
24
+ createdAt: string;
25
+ matcher: string;
26
+ /** The pre-merge copy of the config that disable wrote. */
27
+ configBackupPath: string;
28
+ }
29
+ export interface CodexGateSnapshot {
30
+ version: typeof CODEX_SNAPSHOT_VERSION;
31
+ target: typeof CODEX_SNAPSHOT_TARGET;
32
+ createdAt: string;
33
+ /** Absolute path as requested (the symlink when the config is one). */
34
+ configPath: string;
35
+ /** Absolute path the pre-mutation copy was written to. */
36
+ configBackupPath: string;
37
+ /** The config before the first disable this snapshot covers. */
38
+ configBeforeSha256: string;
39
+ /** The config after the latest disable merged into this snapshot. */
40
+ configAfterSha256: string;
41
+ filter: {
42
+ matcher?: string;
43
+ };
44
+ /** The neutralised units in block order, merged over every disable since the snapshot was created. */
45
+ neutralised: CodexDisabledUnit[];
46
+ /** Later disables merged into this snapshot, oldest first (absent when there were none). */
47
+ merges?: CodexSnapshotMerge[];
48
+ /** The generation marker of the block the snapshot was taken from
49
+ * (`CODEX_BLOCK_GENERATION_PREFIX`); absent when that block carried none,
50
+ * and in a snapshot written before the marker existed. */
51
+ blockGeneration?: string;
52
+ }
53
+ export interface ResolvedCodexConfig {
54
+ /** The requested path, absolute. Snapshots and backups sit beside it. */
55
+ requestedPath: string;
56
+ /** The regular file read and written (the symlink's target when linked). */
57
+ configPath: string;
58
+ /** `requestedPath` when the call named a config (`--config`), else null: a
59
+ * command a message prints repeats the flag only when the call had it. */
60
+ namedPath: string | null;
61
+ }
62
+ /** ` <flag> <path>` with the path shell-quoted when the call named a config, else "". */
63
+ export declare function codexConfigFlag(namedPath: string | null, flag?: string): string;
64
+ /** The install command the installer's refusal texts and hints print. */
65
+ export declare const CODEX_INSTALL_COMMAND = "harness apply --runtime codex --install";
66
+ /** `message` with every bare install command followed by the call's
67
+ * `--codex-config <path>` (shell-quoted) when the call named a config, so a
68
+ * pasted command acts on the config the call acted on and not on the default
69
+ * `~/.codex/config.toml`. A call without a named config prints it unchanged.
70
+ * Apply once, at the boundary that knows the call's path. */
71
+ export declare function nameInstallConfig(message: string, namedPath: string | null): string;
72
+ /** The message of an installer refusal in the gate's wording. */
73
+ export declare function gateWording(message: string): string;
74
+ /** An installer refusal becomes the gate verb's own error type (same text in
75
+ * the gate's wording, its install commands naming the config the call named,
76
+ * `namedPath`); anything else is rethrown unchanged by the caller. */
77
+ export declare function toGateError(err: unknown, makeError: (message: string) => Error, namedPath?: string | null): unknown;
78
+ /** Resolves `--config` (or the default `~/.codex/config.toml`) the way the
79
+ * installer does: a symlinked config is edited at its resolved target. The
80
+ * symlink refusals (dangling, not a regular file) surface as `makeError`. */
81
+ export declare function resolveCodexConfig(opts: {
82
+ configPath?: string | undefined;
83
+ homeDir?: string | undefined;
84
+ }, makeError: (message: string) => Error): ResolvedCodexConfig;
85
+ export declare function codexSnapshotPath(requestedPath: string, now: Date): string;
86
+ /** The name a snapshot is renamed to once retired. The file stays for audit;
87
+ * `listCodexSnapshots` never offers it again. */
88
+ export declare function retiredCodexSnapshotPath(snapPath: string, why: CodexSnapshotRetirement): string;
89
+ /** The snapshot a call retired: `from` was renamed to `to`. */
90
+ export interface CodexRetiredSnapshot {
91
+ from: string;
92
+ to: string;
93
+ why: CodexSnapshotRetirement;
94
+ /** For an install-superseded snapshot: the installer backup that dates the install. */
95
+ installBackup?: string;
96
+ /** For a snapshot superseded because the block carries another generation
97
+ * marker than the one it recorded: both markers. */
98
+ generation?: {
99
+ snapshot: string;
100
+ block: string;
101
+ };
102
+ }
103
+ /** Renames a live snapshot to its retired name and returns that name; the
104
+ * file stays for audit. A failed rename surfaces as `makeError`: `context`
105
+ * (what the call has done so far) and the move-aside step. */
106
+ export declare function retireCodexSnapshot(snapPath: string, why: CodexSnapshotRetirement, makeError: (message: string) => Error, context?: string): string;
107
+ /** The ways out of a live snapshot that no gate command can apply. */
108
+ export declare function codexSnapshotExits(live: LoadedCodexSnapshot, namedPath?: string | null): string;
109
+ export type CodexRestorePlan = {
110
+ ok: true;
111
+ text: string;
112
+ restored: CodexDisabledUnit[];
113
+ skipped: string[];
114
+ } | {
115
+ ok: false;
116
+ reason: string;
117
+ };
118
+ /** The config with each still-neutralised unit of the snapshot given its
119
+ * original `hooks` line back, found by id in the block as it is now. A unit
120
+ * that is present once and not neutralised is back already, whatever its
121
+ * event or matcher now: it is skipped and named in `skipped`, and its current
122
+ * line is never overwritten. A unit that is missing, listed twice, or still
123
+ * neutralised under another event or matcher cannot be restored by any gate
124
+ * command, so the plan fails and its reason names the ways out. `units` is
125
+ * null when the config has no managed block. */
126
+ export declare function planCodexRestore(current: string, units: readonly CodexManagedHookUnit[] | null, configPath: string, live: LoadedCodexSnapshot, namedPath?: string | null): CodexRestorePlan;
127
+ /** The installer's newest write of the config, read from its backups beside
128
+ * the requested path, beside every further hop of its link chain and beside
129
+ * the resolved target (an install leaves them beside the path it was run
130
+ * through, which may be any of these). An install through a link outside this
131
+ * chain leaves its backups where this cannot look. */
132
+ export declare function latestInstall(requestedPath: string, configPath: string): {
133
+ ms: number;
134
+ path: string;
135
+ } | null;
136
+ /** Whether a live snapshot is spent, i.e. `gate enable` would only retire it
137
+ * without writing: an install re-rendered the block after it was taken (its
138
+ * hooks lines may be outdated), the config already matches its pre-disable
139
+ * sha, or none of its units is disabled any more. The last case counts only
140
+ * when every unit it names is still in the block: a unit deleted by hand is
141
+ * neither enabled nor restorable, so the snapshot stays live and `missing`
142
+ * names it. `units` is null when the config has no managed block.
143
+ *
144
+ * An install is dated two ways: by the installer's backup files (`install`,
145
+ * newer than the snapshot), and by the block's generation marker
146
+ * (`blockGeneration`, null when the block carries none): a snapshot that
147
+ * recorded a marker and finds the block carrying another one was taken from a
148
+ * block an install has re-rendered since, which no link spelling and no
149
+ * deleted backup file hides. A snapshot without a recorded marker, or a block
150
+ * without one, is dated by the backup files alone. */
151
+ export declare function spentCodexSnapshot(snapshot: CodexGateSnapshot, currentSha: string, units: ReadonlyArray<{
152
+ id: string;
153
+ disabled: boolean;
154
+ }> | null, install: {
155
+ ms: number;
156
+ path: string;
157
+ } | null, blockGeneration: string | null): {
158
+ retire: Pick<CodexRetiredSnapshot, "why" | "installBackup" | "generation"> | null;
159
+ missing: string[];
160
+ };
161
+ /** The Codex snapshots beside a config that are still live (not retired). */
162
+ export declare function listCodexSnapshots(dir: string): string[];
163
+ export interface LoadedCodexSnapshot {
164
+ path: string;
165
+ snapshot: CodexGateSnapshot;
166
+ }
167
+ /** A live snapshot beside a config that was taken for another config. */
168
+ export interface ForeignCodexSnapshot {
169
+ /** The snapshot file. */
170
+ path: string;
171
+ /** The config it was taken for: its recorded basename in the snapshot's directory. */
172
+ configPath: string;
173
+ /** Whether a file (or link) is at `configPath` now. */
174
+ configExists: boolean;
175
+ /** The backup its first disable wrote: the pre-disable copy of that config. */
176
+ configBackupPath: string;
177
+ }
178
+ /** The way out of a snapshot taken for another config: the gate command that
179
+ * restores the config the snapshot was taken for (with the extra steps when
180
+ * no file is at that name any more). */
181
+ export declare function foreignCodexExit(f: ForeignCodexSnapshot): string;
182
+ /** The live snapshots beside a config, split into those taken for it, newest
183
+ * first by their recorded `createdAt` (equal times by file name, newest name
184
+ * first; never by file mtime, which a directory copy reorders), and those
185
+ * taken for another config. Snapshots sit beside their config and record its
186
+ * path, so only the basename counts, never how the directory was spelled; a
187
+ * snapshot is the config's own when the requested path names the directory
188
+ * entry that basename names (`namesSameEntry`, the Claude gate's rule): the
189
+ * same spelling, or another spelling of the one entry on a filesystem that
190
+ * folds letter case or normalization. A hard link or a symlink to the config
191
+ * under another name is another entry, so a snapshot recorded for either is
192
+ * foreign to the other. An unreadable snapshot refuses via `makeError`. */
193
+ export declare function readLiveCodexSnapshots(requestedPath: string, makeError: (message: string) => Error, namedPath?: string | null): {
194
+ own: LoadedCodexSnapshot[];
195
+ foreign: ForeignCodexSnapshot[];
196
+ };
197
+ export interface CodexSnapshotReadOk {
198
+ ok: true;
199
+ snapshot: CodexGateSnapshot;
200
+ }
201
+ export interface CodexSnapshotReadErr {
202
+ ok: false;
203
+ reason: string;
204
+ }
205
+ /** Parses a Codex snapshot. Anything that is not a version-3 snapshot with
206
+ * `target: "codex"` is refused, so a Claude snapshot renamed into place is
207
+ * never restored into a TOML file. */
208
+ export declare function readCodexSnapshot(filePath: string, namedPath?: string | null): CodexSnapshotReadOk | CodexSnapshotReadErr;
@@ -0,0 +1,402 @@
1
+ // Snapshot file format and shared path handling for `harness gate disable
2
+ // --runtime codex` / `harness gate enable --runtime codex`.
3
+ //
4
+ // `gate disable --runtime codex` does not delete a hook unit: it neutralises
5
+ // it in place, replacing the unit's `hooks = [...]` line with `hooks = []`.
6
+ // Codex keys a user hook's trust and enabled state by its position in the
7
+ // event's array, and an empty group takes its position without registering
8
+ // a handler, so every other hook keeps its trust. A Codex snapshot records
9
+ // the neutralised units: per unit its identity and the verbatim original
10
+ // `hooks = [...]` line, plus the sha256 of the config before the first
11
+ // disable and after the latest one, and the generation marker of the block it
12
+ // was taken from, which dates it against a later install. At most one
13
+ // snapshot per config is live: a later disable merges its units into it. It
14
+ // lives beside the Codex config under its own file prefix and carries
15
+ // `version: 3` and `target: "codex"`,
16
+ // so a Claude settings snapshot (version 1 or 2, no target) can never be restored
17
+ // into TOML and a Codex snapshot can never be read as a settings.json one
18
+ // (`readSnapshot` rejects version 3). Once `gate enable` has applied a
19
+ // snapshot, or found it applied or superseded, it renames the file to
20
+ // `*.restored.json` or `*.superseded.json`, and so does a `gate disable` that
21
+ // finds the live snapshot spent: the file stays for audit,
22
+ // `listCodexSnapshots` never offers it again.
23
+ import * as fs from "node:fs";
24
+ import * as path from "node:path";
25
+ import { CodexInstallRefusalError, defaultCodexConfigPath, latestCodexInstallBackup, resolveConfigSymlink, } from "../apply/install-codex-config.js";
26
+ import { kernelEntry, linkChain } from "./link-chain.js";
27
+ import { shellQuote } from "../shell-quote.js";
28
+ import { listSnapshots, namesSameEntry, SNAPSHOT_BASENAME_SUFFIX, snapshotFieldProblem } from "./snapshot.js";
29
+ export const CODEX_SNAPSHOT_BASENAME_PREFIX = "harness.gate-disable-codex.";
30
+ const RETIRED_SUFFIXES = [".restored", ".superseded"].map((s) => `${s}${SNAPSHOT_BASENAME_SUFFIX}`);
31
+ export const CODEX_SNAPSHOT_VERSION = 3;
32
+ export const CODEX_SNAPSHOT_TARGET = "codex";
33
+ /** The value a neutralised unit's `hooks` line carries. */
34
+ export const CODEX_NEUTRALISED_HOOKS = "hooks = []";
35
+ /** ` <flag> <path>` with the path shell-quoted when the call named a config, else "". */
36
+ export function codexConfigFlag(namedPath, flag = "--config") {
37
+ return namedPath === null ? "" : ` ${flag} ${shellQuote(namedPath)}`;
38
+ }
39
+ /** The install command the installer's refusal texts and hints print. */
40
+ export const CODEX_INSTALL_COMMAND = "harness apply --runtime codex --install";
41
+ /** `message` with every bare install command followed by the call's
42
+ * `--codex-config <path>` (shell-quoted) when the call named a config, so a
43
+ * pasted command acts on the config the call acted on and not on the default
44
+ * `~/.codex/config.toml`. A call without a named config prints it unchanged.
45
+ * Apply once, at the boundary that knows the call's path. */
46
+ export function nameInstallConfig(message, namedPath) {
47
+ if (namedPath === null)
48
+ return message;
49
+ return message
50
+ .split(CODEX_INSTALL_COMMAND)
51
+ .join(`${CODEX_INSTALL_COMMAND}${codexConfigFlag(namedPath, "--codex-config")}`);
52
+ }
53
+ /** Installer refusal texts are worded for `harness apply --install`. Reached
54
+ * through the gate they would tell the operator about an install that never
55
+ * ran, so each known phrase is mapped to the gate's own wording. */
56
+ const GATE_WORDING = [
57
+ [
58
+ "refusing to install, because without parsing it harness cannot confirm that every table outside the harness-managed hook block would survive the install",
59
+ "refusing to edit, because without parsing it harness cannot confirm that every table outside the harness-managed hook block would survive the edit",
60
+ ],
61
+ ["installing would change", "the gate edit would change"],
62
+ ["refusing to install rather than risk", "refusing to edit rather than risk"],
63
+ ["refusing to install, nothing was written", "refusing to edit, nothing was written"],
64
+ ["The Codex config harness would write to", "The Codex config the gate would write to"],
65
+ [
66
+ "restore it from the most recent .harness-backup-* file (if one exists)",
67
+ "restore it from the backup the gate wrote beside it (<config>.bak.<timestamp>, if one exists)",
68
+ ],
69
+ ];
70
+ /** The message of an installer refusal in the gate's wording. */
71
+ export function gateWording(message) {
72
+ let out = message;
73
+ for (const [from, to] of GATE_WORDING)
74
+ out = out.split(from).join(to);
75
+ return out;
76
+ }
77
+ /** An installer refusal becomes the gate verb's own error type (same text in
78
+ * the gate's wording, its install commands naming the config the call named,
79
+ * `namedPath`); anything else is rethrown unchanged by the caller. */
80
+ export function toGateError(err, makeError, namedPath = null) {
81
+ return err instanceof CodexInstallRefusalError
82
+ ? makeError(nameInstallConfig(gateWording(err.message), namedPath))
83
+ : err;
84
+ }
85
+ /** The absolute spelling of a config path. One with a `..` segment is taken
86
+ * through the directory the kernel reaches (`kernelEntry`), not folded
87
+ * lexically: `via/..` is the parent of where the directory link `via` leads,
88
+ * and the snapshot and the backup sit beside the config as the kernel finds it. */
89
+ function absoluteEntry(spelled) {
90
+ if (!spelled.split(path.sep).includes(".."))
91
+ return path.resolve(spelled);
92
+ const entry = kernelEntry(spelled);
93
+ // A directory that cannot be resolved stays as written (nothing can be read
94
+ // or written through it), made absolute without a fold.
95
+ return path.isAbsolute(entry) ? entry : `${process.cwd()}${path.sep}${entry}`;
96
+ }
97
+ /** Resolves `--config` (or the default `~/.codex/config.toml`) the way the
98
+ * installer does: a symlinked config is edited at its resolved target. The
99
+ * symlink refusals (dangling, not a regular file) surface as `makeError`. */
100
+ export function resolveCodexConfig(opts, makeError) {
101
+ const named = typeof opts.configPath === "string" && opts.configPath.length > 0;
102
+ const requestedPath = absoluteEntry(named ? opts.configPath : defaultCodexConfigPath(opts.homeDir));
103
+ try {
104
+ return { requestedPath, configPath: resolveConfigSymlink(requestedPath), namedPath: named ? requestedPath : null };
105
+ }
106
+ catch (err) {
107
+ throw toGateError(err, makeError, named ? requestedPath : null);
108
+ }
109
+ }
110
+ function stamp(now) {
111
+ return now.toISOString().replace(/:/g, "-");
112
+ }
113
+ export function codexSnapshotPath(requestedPath, now) {
114
+ return path.join(path.dirname(requestedPath), `${CODEX_SNAPSHOT_BASENAME_PREFIX}${stamp(now)}${SNAPSHOT_BASENAME_SUFFIX}`);
115
+ }
116
+ /** The name a snapshot is renamed to once retired. The file stays for audit;
117
+ * `listCodexSnapshots` never offers it again. */
118
+ export function retiredCodexSnapshotPath(snapPath, why) {
119
+ return `${snapPath.slice(0, snapPath.length - SNAPSHOT_BASENAME_SUFFIX.length)}.${why}${SNAPSHOT_BASENAME_SUFFIX}`;
120
+ }
121
+ /** Renames a live snapshot to its retired name and returns that name; the
122
+ * file stays for audit. A failed rename surfaces as `makeError`: `context`
123
+ * (what the call has done so far) and the move-aside step. */
124
+ export function retireCodexSnapshot(snapPath, why, makeError, context = "") {
125
+ const to = retiredCodexSnapshotPath(snapPath, why);
126
+ try {
127
+ fs.renameSync(snapPath, to);
128
+ }
129
+ catch (err) {
130
+ throw makeError(`${context}cannot retire the snapshot ${snapPath} (${err.message}); move it out of this ` +
131
+ "directory by hand so it is never applied again, then run the command again.");
132
+ }
133
+ return to;
134
+ }
135
+ /** The ways out of a live snapshot that no gate command can apply. */
136
+ export function codexSnapshotExits(live, namedPath = null) {
137
+ return (`Ways out: run \`harness apply --runtime codex --install${codexConfigFlag(namedPath, "--codex-config")}\`, which ` +
138
+ `re-renders the block and supersedes the snapshot, or restore the config from ${live.snapshot.configBackupPath} ` +
139
+ `(its state before the snapshot's first disable); either way the next ` +
140
+ `\`harness gate enable --runtime codex${codexConfigFlag(namedPath)}\` (or disable) retires the ` +
141
+ `snapshot. Or move ${live.path} out of this directory and put back by hand any unit it names that is ` +
142
+ "still disabled.");
143
+ }
144
+ /** The config with each still-neutralised unit of the snapshot given its
145
+ * original `hooks` line back, found by id in the block as it is now. A unit
146
+ * that is present once and not neutralised is back already, whatever its
147
+ * event or matcher now: it is skipped and named in `skipped`, and its current
148
+ * line is never overwritten. A unit that is missing, listed twice, or still
149
+ * neutralised under another event or matcher cannot be restored by any gate
150
+ * command, so the plan fails and its reason names the ways out. `units` is
151
+ * null when the config has no managed block. */
152
+ export function planCodexRestore(current, units, configPath, live, namedPath = null) {
153
+ if (units === null) {
154
+ return {
155
+ ok: false,
156
+ reason: `${configPath} has no harness-managed Codex hook block any more; the snapshot ${live.path} cannot ` +
157
+ `restore units into it. The config is untouched. ${codexSnapshotExits(live, namedPath)}`,
158
+ };
159
+ }
160
+ const edits = [];
161
+ const restored = [];
162
+ const skipped = [];
163
+ for (const wanted of live.snapshot.neutralised) {
164
+ const found = units.filter((u) => u.id === wanted.id);
165
+ const unit = found.length === 1 ? found[0] : undefined;
166
+ if (unit !== undefined && !unit.disabled) {
167
+ skipped.push(wanted.id);
168
+ continue;
169
+ }
170
+ if (unit === undefined || unit.event !== wanted.event || unit.matcher !== wanted.matcher) {
171
+ return {
172
+ ok: false,
173
+ reason: `the hook unit ${JSON.stringify(wanted.id)} of the snapshot ${live.path} is not in the block of ` +
174
+ `${configPath} as it was (missing, listed twice, or changed event or matcher while still disabled), ` +
175
+ `so no gate command can restore it. The config is untouched. ${codexSnapshotExits(live, namedPath)}`,
176
+ };
177
+ }
178
+ edits.push({ start: unit.hooksStart, end: unit.hooksEnd, text: wanted.hooksText });
179
+ restored.push(wanted);
180
+ }
181
+ edits.sort((a, b) => a.start - b.start);
182
+ let out = "";
183
+ let cursor = 0;
184
+ for (const edit of edits) {
185
+ out += current.slice(cursor, edit.start) + edit.text;
186
+ cursor = edit.end;
187
+ }
188
+ return { ok: true, text: out + current.slice(cursor), restored, skipped };
189
+ }
190
+ /** The installer's newest write of the config, read from its backups beside
191
+ * the requested path, beside every further hop of its link chain and beside
192
+ * the resolved target (an install leaves them beside the path it was run
193
+ * through, which may be any of these). An install through a link outside this
194
+ * chain leaves its backups where this cannot look. */
195
+ export function latestInstall(requestedPath, configPath) {
196
+ const found = [...new Set([...linkChain(requestedPath), configPath])]
197
+ .map(latestCodexInstallBackup)
198
+ .filter((t) => t !== null);
199
+ return found.reduce((a, b) => (a === null || b.ms > a.ms ? b : a), null);
200
+ }
201
+ /** Whether a live snapshot is spent, i.e. `gate enable` would only retire it
202
+ * without writing: an install re-rendered the block after it was taken (its
203
+ * hooks lines may be outdated), the config already matches its pre-disable
204
+ * sha, or none of its units is disabled any more. The last case counts only
205
+ * when every unit it names is still in the block: a unit deleted by hand is
206
+ * neither enabled nor restorable, so the snapshot stays live and `missing`
207
+ * names it. `units` is null when the config has no managed block.
208
+ *
209
+ * An install is dated two ways: by the installer's backup files (`install`,
210
+ * newer than the snapshot), and by the block's generation marker
211
+ * (`blockGeneration`, null when the block carries none): a snapshot that
212
+ * recorded a marker and finds the block carrying another one was taken from a
213
+ * block an install has re-rendered since, which no link spelling and no
214
+ * deleted backup file hides. A snapshot without a recorded marker, or a block
215
+ * without one, is dated by the backup files alone. */
216
+ export function spentCodexSnapshot(snapshot, currentSha, units, install, blockGeneration) {
217
+ if (install !== null && install.ms > Date.parse(snapshot.createdAt)) {
218
+ return { retire: { why: "superseded", installBackup: install.path }, missing: [] };
219
+ }
220
+ const recorded = snapshot.blockGeneration;
221
+ if (recorded !== undefined && blockGeneration !== null && recorded !== blockGeneration) {
222
+ return {
223
+ retire: { why: "superseded", generation: { snapshot: recorded, block: blockGeneration } },
224
+ missing: [],
225
+ };
226
+ }
227
+ if (currentSha === snapshot.configBeforeSha256)
228
+ return { retire: { why: "restored" }, missing: [] };
229
+ const ids = snapshot.neutralised.map((u) => u.id);
230
+ if (units !== null && !units.some((u) => u.disabled && ids.includes(u.id))) {
231
+ const missing = ids.filter((id) => !units.some((u) => u.id === id));
232
+ return { retire: missing.length === 0 ? { why: "superseded" } : null, missing };
233
+ }
234
+ return { retire: null, missing: [] };
235
+ }
236
+ /** The Codex snapshots beside a config that are still live (not retired). */
237
+ export function listCodexSnapshots(dir) {
238
+ return listSnapshots(dir, CODEX_SNAPSHOT_BASENAME_PREFIX).filter((p) => !RETIRED_SUFFIXES.some((suffix) => p.endsWith(suffix)));
239
+ }
240
+ /** The way out of a snapshot taken for another config: the gate command that
241
+ * restores the config the snapshot was taken for (with the extra steps when
242
+ * no file is at that name any more). */
243
+ export function foreignCodexExit(f) {
244
+ return (`run \`harness gate enable --runtime codex --config ${shellQuote(f.configPath)}\`` +
245
+ (f.configExists
246
+ ? ""
247
+ : ` (no file is at that name now: if the config was renamed after the disable, rename it back first; ` +
248
+ `if it is gone, restore it from ${f.configBackupPath}, which is the file before that disable, then run ` +
249
+ "that command, which retires the snapshot; or move the snapshot out of the directory by hand once its " +
250
+ "units are back)"));
251
+ }
252
+ /** The live snapshots beside a config, split into those taken for it, newest
253
+ * first by their recorded `createdAt` (equal times by file name, newest name
254
+ * first; never by file mtime, which a directory copy reorders), and those
255
+ * taken for another config. Snapshots sit beside their config and record its
256
+ * path, so only the basename counts, never how the directory was spelled; a
257
+ * snapshot is the config's own when the requested path names the directory
258
+ * entry that basename names (`namesSameEntry`, the Claude gate's rule): the
259
+ * same spelling, or another spelling of the one entry on a filesystem that
260
+ * folds letter case or normalization. A hard link or a symlink to the config
261
+ * under another name is another entry, so a snapshot recorded for either is
262
+ * foreign to the other. An unreadable snapshot refuses via `makeError`. */
263
+ export function readLiveCodexSnapshots(requestedPath, makeError, namedPath = null) {
264
+ const own = [];
265
+ const foreign = [];
266
+ const dir = path.dirname(requestedPath);
267
+ const targetName = path.basename(requestedPath);
268
+ for (const snapPath of listCodexSnapshots(dir)) {
269
+ const read = readCodexSnapshot(snapPath, namedPath);
270
+ if (!read.ok) {
271
+ throw makeError(`${read.reason.replace(/\.$/, "")}. A live Codex snapshot beside ${requestedPath} that harness cannot read blocks the gate: ` +
272
+ `move ${snapPath} aside (rename it out of this directory) and run the command again.`);
273
+ }
274
+ const recordedName = path.basename(read.snapshot.configPath);
275
+ if (namesSameEntry(dir, recordedName, targetName, { symlinks: true })) {
276
+ own.push({ path: snapPath, snapshot: read.snapshot });
277
+ }
278
+ else {
279
+ const configPath = path.join(dir, recordedName);
280
+ foreign.push({
281
+ path: snapPath,
282
+ configPath,
283
+ configExists: pathExists(configPath),
284
+ configBackupPath: read.snapshot.configBackupPath,
285
+ });
286
+ }
287
+ }
288
+ const time = (l) => Date.parse(l.snapshot.createdAt);
289
+ own.sort((a, b) => time(b) - time(a) || (a.path < b.path ? 1 : -1));
290
+ return { own, foreign };
291
+ }
292
+ /** Whether anything, a dangling symlink included, is at `p`. */
293
+ function pathExists(p) {
294
+ try {
295
+ fs.lstatSync(p);
296
+ return true;
297
+ }
298
+ catch {
299
+ return false;
300
+ }
301
+ }
302
+ /** A block generation marker as the installer writes it: a sha256 in lowercase hex. */
303
+ const GENERATION_RE = /^[0-9a-f]{64}$/;
304
+ function isNonNegativeInteger(value) {
305
+ return Number.isInteger(value) && value >= 0;
306
+ }
307
+ function isRecord(value) {
308
+ return value !== null && typeof value === "object" && !Array.isArray(value);
309
+ }
310
+ function isMerge(value) {
311
+ if (!isRecord(value))
312
+ return false;
313
+ const m = value;
314
+ return typeof m["createdAt"] === "string" && typeof m["matcher"] === "string" && typeof m["configBackupPath"] === "string";
315
+ }
316
+ function isDisabledUnit(value) {
317
+ if (!isRecord(value))
318
+ return false;
319
+ const u = value;
320
+ return (typeof u["event"] === "string" &&
321
+ typeof u["id"] === "string" &&
322
+ (u["matcher"] === null || typeof u["matcher"] === "string") &&
323
+ isNonNegativeInteger(u["eventIndex"]) &&
324
+ isNonNegativeInteger(u["ordinal"]) &&
325
+ typeof u["hooksText"] === "string" &&
326
+ u["hooksText"].startsWith("hooks = [") &&
327
+ !/[\r\n]/.test(u["hooksText"]));
328
+ }
329
+ /** Parses a Codex snapshot. Anything that is not a version-3 snapshot with
330
+ * `target: "codex"` is refused, so a Claude snapshot renamed into place is
331
+ * never restored into a TOML file. */
332
+ export function readCodexSnapshot(filePath, namedPath = null) {
333
+ let parsed;
334
+ try {
335
+ parsed = JSON.parse(fs.readFileSync(filePath, "utf8"));
336
+ }
337
+ catch (err) {
338
+ return { ok: false, reason: `cannot read snapshot ${filePath}: ${err.message}` };
339
+ }
340
+ if (!isRecord(parsed)) {
341
+ return { ok: false, reason: `snapshot ${filePath} is not a JSON object` };
342
+ }
343
+ const obj = parsed;
344
+ if (obj["target"] === CODEX_SNAPSHOT_TARGET && obj["version"] === 2) {
345
+ return {
346
+ ok: false,
347
+ reason: `snapshot ${filePath} is a version 2 Codex gate snapshot, written by an earlier build that ` +
348
+ "deleted the hook unit instead of neutralising it; it cannot be restored. Re-run " +
349
+ `\`${CODEX_INSTALL_COMMAND}${codexConfigFlag(namedPath, "--codex-config")}\` to rewrite the block, or restore the config ` +
350
+ "from the backup beside it, then remove this snapshot.",
351
+ };
352
+ }
353
+ if (obj["version"] !== CODEX_SNAPSHOT_VERSION || obj["target"] !== CODEX_SNAPSHOT_TARGET) {
354
+ return {
355
+ ok: false,
356
+ reason: `snapshot ${filePath} is not a Codex gate snapshot (expected version ${CODEX_SNAPSHOT_VERSION} ` +
357
+ `with target ${JSON.stringify(CODEX_SNAPSHOT_TARGET)}, got version ${JSON.stringify(obj["version"])} ` +
358
+ `with target ${JSON.stringify(obj["target"] ?? null)})`,
359
+ };
360
+ }
361
+ const problem = snapshotFieldProblem(filePath, obj, [
362
+ "createdAt",
363
+ "configPath",
364
+ "configBackupPath",
365
+ "configBeforeSha256",
366
+ "configAfterSha256",
367
+ ]);
368
+ if (problem !== null)
369
+ return { ok: false, reason: problem };
370
+ // Ownership is decided by the recorded file name, so a path with none (empty, `.`, `..`, `/`) is unreadable.
371
+ const recordedName = path.basename(obj["configPath"]);
372
+ if (recordedName === "" || recordedName === "." || recordedName === "..") {
373
+ return { ok: false, reason: `snapshot ${filePath} has a "configPath" that names no file` };
374
+ }
375
+ // Several live snapshots (an earlier build kept one per disable) are ordered by this time, never by file mtime.
376
+ if (Number.isNaN(Date.parse(obj["createdAt"]))) {
377
+ return { ok: false, reason: `snapshot ${filePath} has a "createdAt" that is not a timestamp` };
378
+ }
379
+ const units = obj["neutralised"];
380
+ if (!Array.isArray(units) || units.length === 0 || !units.every(isDisabledUnit)) {
381
+ return { ok: false, reason: `snapshot ${filePath} has a malformed "neutralised" list` };
382
+ }
383
+ const ids = new Set(units.map((u) => u.id));
384
+ const ordinals = new Set(units.map((u) => u.ordinal));
385
+ if (ids.size !== units.length || ordinals.size !== units.length) {
386
+ return {
387
+ ok: false,
388
+ reason: `snapshot ${filePath} lists the same hook unit id or block position twice in "neutralised"`,
389
+ };
390
+ }
391
+ const merges = obj["merges"];
392
+ if (merges !== undefined && !(Array.isArray(merges) && merges.every(isMerge))) {
393
+ return { ok: false, reason: `snapshot ${filePath} has a malformed "merges" list` };
394
+ }
395
+ // The marker decides whether the snapshot is applied at all, so a value that is not one is not guessed at.
396
+ const generation = obj["blockGeneration"];
397
+ if (generation !== undefined && !(typeof generation === "string" && GENERATION_RE.test(generation))) {
398
+ return { ok: false, reason: `snapshot ${filePath} has a "blockGeneration" that is not a block generation marker` };
399
+ }
400
+ return { ok: true, snapshot: obj };
401
+ }
402
+ //# sourceMappingURL=codex-snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-snapshot.js","sourceRoot":"","sources":["../../../src/cli/gate/codex-snapshot.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,4DAA4D;AAC5D,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,uEAAuE;AACvE,8EAA8E;AAC9E,sEAAsE;AACtE,4EAA4E;AAC5E,sEAAsE;AACtE,sCAAsC;AACtC,kFAAkF;AAClF,0EAA0E;AAC1E,uEAAuE;AACvE,sE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,iBAAiB,CAAC,CAAC;IAC1C,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,CAAC,OAAO,UAAU,KAAK,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QACpG,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,QAAQ,gEAAgE,EAAE,CAAC;IACrH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAmC,EAAE,CAAC;AACrE,CAAC"}
@@ -35,6 +35,15 @@ export type GateDisableResult = {
35
35
  backupPath: string;
36
36
  snapshotPath: string;
37
37
  removed: RemovedGroup[];
38
+ /** True when the groups were merged into an already live snapshot. */
39
+ merged: boolean;
40
+ /** Spent snapshots this call retired, under their retired names. */
41
+ retired: string[];
42
+ /** A merge into a snapshot beside the settings path moved the snapshot beside the file the path leads to; the old one, under its retired name. */
43
+ carriedFrom?: {
44
+ from: string;
45
+ to: string;
46
+ };
38
47
  };
39
48
  export declare class GateDisableError extends Error {
40
49
  constructor(message: string);