@memnexus-ai/mx-agent-cli 0.1.296 → 0.1.298

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 (797) hide show
  1. package/dist/agent-config/hooks/gh-pr-edit-guard.sh +21 -9
  2. package/dist/agent-config/settings.json +7 -1
  3. package/dist/commands/check.d.ts +20 -0
  4. package/dist/commands/check.d.ts.map +1 -0
  5. package/dist/commands/check.js +30 -0
  6. package/dist/commands/check.js.map +1 -0
  7. package/dist/commands/create.d.ts +36 -0
  8. package/dist/commands/create.d.ts.map +1 -1
  9. package/dist/commands/create.js +85 -8
  10. package/dist/commands/create.js.map +1 -1
  11. package/dist/commands/gh.d.ts +38 -0
  12. package/dist/commands/gh.d.ts.map +1 -0
  13. package/dist/commands/gh.js +162 -0
  14. package/dist/commands/gh.js.map +1 -0
  15. package/dist/commands/git-credential.d.ts +22 -0
  16. package/dist/commands/git-credential.d.ts.map +1 -0
  17. package/dist/commands/git-credential.js +53 -0
  18. package/dist/commands/git-credential.js.map +1 -0
  19. package/dist/commands/new.d.ts +24 -0
  20. package/dist/commands/new.d.ts.map +1 -1
  21. package/dist/commands/new.js +56 -5
  22. package/dist/commands/new.js.map +1 -1
  23. package/dist/commands/pr-set-body.d.ts +120 -35
  24. package/dist/commands/pr-set-body.d.ts.map +1 -1
  25. package/dist/commands/pr-set-body.js +343 -108
  26. package/dist/commands/pr-set-body.js.map +1 -1
  27. package/dist/commands/pr-sync.d.ts +2 -1
  28. package/dist/commands/pr-sync.d.ts.map +1 -1
  29. package/dist/commands/pr-sync.js +129 -32
  30. package/dist/commands/pr-sync.js.map +1 -1
  31. package/dist/index.d.ts +3 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +82 -2
  34. package/dist/index.js.map +1 -1
  35. package/dist/lib/check-run.d.ts +131 -0
  36. package/dist/lib/check-run.d.ts.map +1 -0
  37. package/dist/lib/check-run.js +291 -0
  38. package/dist/lib/check-run.js.map +1 -0
  39. package/dist/lib/coordination-token.d.ts +33 -1
  40. package/dist/lib/coordination-token.d.ts.map +1 -1
  41. package/dist/lib/coordination-token.js +138 -9
  42. package/dist/lib/coordination-token.js.map +1 -1
  43. package/dist/lib/gh-remote.d.ts +20 -0
  44. package/dist/lib/gh-remote.d.ts.map +1 -1
  45. package/dist/lib/gh-remote.js +26 -0
  46. package/dist/lib/gh-remote.js.map +1 -1
  47. package/dist/lib/gh-token-run.d.ts +551 -0
  48. package/dist/lib/gh-token-run.d.ts.map +1 -0
  49. package/dist/lib/gh-token-run.js +1246 -0
  50. package/dist/lib/gh-token-run.js.map +1 -0
  51. package/dist/lib/git-credential.d.ts +120 -0
  52. package/dist/lib/git-credential.d.ts.map +1 -0
  53. package/dist/lib/git-credential.js +204 -0
  54. package/dist/lib/git-credential.js.map +1 -0
  55. package/dist/lib/github-app-token.d.ts +288 -0
  56. package/dist/lib/github-app-token.d.ts.map +1 -0
  57. package/dist/lib/github-app-token.js +519 -0
  58. package/dist/lib/github-app-token.js.map +1 -0
  59. package/dist/lib/memory.d.ts.map +1 -1
  60. package/dist/lib/memory.js +35 -2
  61. package/dist/lib/memory.js.map +1 -1
  62. package/dist/lib/repo-guard-state-dirs.d.ts +39 -0
  63. package/dist/lib/repo-guard-state-dirs.d.ts.map +1 -0
  64. package/dist/lib/repo-guard-state-dirs.js +170 -0
  65. package/dist/lib/repo-guard-state-dirs.js.map +1 -0
  66. package/dist/standards/decision-request.md +6 -57
  67. package/dist/standards/po-communication-standard.md +0 -34
  68. package/dist/standards/report-format.md +0 -90
  69. package/dist/standards/writing-standard.md +0 -312
  70. package/package.json +3 -1
  71. package/dist/__tests__/agent-attribution.test.d.ts +0 -16
  72. package/dist/__tests__/agent-attribution.test.d.ts.map +0 -1
  73. package/dist/__tests__/agent-attribution.test.js +0 -250
  74. package/dist/__tests__/agent-attribution.test.js.map +0 -1
  75. package/dist/__tests__/agents-md-canonicalization.test.d.ts +0 -23
  76. package/dist/__tests__/agents-md-canonicalization.test.d.ts.map +0 -1
  77. package/dist/__tests__/agents-md-canonicalization.test.js +0 -319
  78. package/dist/__tests__/agents-md-canonicalization.test.js.map +0 -1
  79. package/dist/__tests__/behavioral-compliance.test.d.ts +0 -8
  80. package/dist/__tests__/behavioral-compliance.test.d.ts.map +0 -1
  81. package/dist/__tests__/behavioral-compliance.test.js +0 -226
  82. package/dist/__tests__/behavioral-compliance.test.js.map +0 -1
  83. package/dist/__tests__/behavioral-extraction.test.d.ts +0 -12
  84. package/dist/__tests__/behavioral-extraction.test.d.ts.map +0 -1
  85. package/dist/__tests__/behavioral-extraction.test.js +0 -330
  86. package/dist/__tests__/behavioral-extraction.test.js.map +0 -1
  87. package/dist/__tests__/behavioral-git-read.test.d.ts +0 -21
  88. package/dist/__tests__/behavioral-git-read.test.d.ts.map +0 -1
  89. package/dist/__tests__/behavioral-git-read.test.js +0 -955
  90. package/dist/__tests__/behavioral-git-read.test.js.map +0 -1
  91. package/dist/__tests__/behavioral-injection.test.d.ts +0 -13
  92. package/dist/__tests__/behavioral-injection.test.d.ts.map +0 -1
  93. package/dist/__tests__/behavioral-injection.test.js +0 -384
  94. package/dist/__tests__/behavioral-injection.test.js.map +0 -1
  95. package/dist/__tests__/binary-smoke.test.d.ts +0 -12
  96. package/dist/__tests__/binary-smoke.test.d.ts.map +0 -1
  97. package/dist/__tests__/binary-smoke.test.js +0 -88
  98. package/dist/__tests__/binary-smoke.test.js.map +0 -1
  99. package/dist/__tests__/bootstrap-behavioral-contract.test.d.ts +0 -18
  100. package/dist/__tests__/bootstrap-behavioral-contract.test.d.ts.map +0 -1
  101. package/dist/__tests__/bootstrap-behavioral-contract.test.js +0 -104
  102. package/dist/__tests__/bootstrap-behavioral-contract.test.js.map +0 -1
  103. package/dist/__tests__/bundle-config.test.d.ts +0 -18
  104. package/dist/__tests__/bundle-config.test.d.ts.map +0 -1
  105. package/dist/__tests__/bundle-config.test.js +0 -123
  106. package/dist/__tests__/bundle-config.test.js.map +0 -1
  107. package/dist/__tests__/catalog-interaction.test.d.ts +0 -25
  108. package/dist/__tests__/catalog-interaction.test.d.ts.map +0 -1
  109. package/dist/__tests__/catalog-interaction.test.js +0 -269
  110. package/dist/__tests__/catalog-interaction.test.js.map +0 -1
  111. package/dist/__tests__/catalog-named-memories.test.d.ts +0 -2
  112. package/dist/__tests__/catalog-named-memories.test.d.ts.map +0 -1
  113. package/dist/__tests__/catalog-named-memories.test.js +0 -204
  114. package/dist/__tests__/catalog-named-memories.test.js.map +0 -1
  115. package/dist/__tests__/catalog-origin-main.test.d.ts +0 -15
  116. package/dist/__tests__/catalog-origin-main.test.d.ts.map +0 -1
  117. package/dist/__tests__/catalog-origin-main.test.js +0 -305
  118. package/dist/__tests__/catalog-origin-main.test.js.map +0 -1
  119. package/dist/__tests__/catalog.test.d.ts +0 -2
  120. package/dist/__tests__/catalog.test.d.ts.map +0 -1
  121. package/dist/__tests__/catalog.test.js +0 -131
  122. package/dist/__tests__/catalog.test.js.map +0 -1
  123. package/dist/__tests__/claude-local-sanitizer.test.d.ts +0 -24
  124. package/dist/__tests__/claude-local-sanitizer.test.d.ts.map +0 -1
  125. package/dist/__tests__/claude-local-sanitizer.test.js +0 -906
  126. package/dist/__tests__/claude-local-sanitizer.test.js.map +0 -1
  127. package/dist/__tests__/claude-md-compose.test.d.ts +0 -17
  128. package/dist/__tests__/claude-md-compose.test.d.ts.map +0 -1
  129. package/dist/__tests__/claude-md-compose.test.js +0 -119
  130. package/dist/__tests__/claude-md-compose.test.js.map +0 -1
  131. package/dist/__tests__/claude-sync.test.d.ts +0 -2
  132. package/dist/__tests__/claude-sync.test.d.ts.map +0 -1
  133. package/dist/__tests__/claude-sync.test.js +0 -571
  134. package/dist/__tests__/claude-sync.test.js.map +0 -1
  135. package/dist/__tests__/cli-build-integration.test.d.ts +0 -2
  136. package/dist/__tests__/cli-build-integration.test.d.ts.map +0 -1
  137. package/dist/__tests__/cli-build-integration.test.js +0 -64
  138. package/dist/__tests__/cli-build-integration.test.js.map +0 -1
  139. package/dist/__tests__/cli-build.test.d.ts +0 -2
  140. package/dist/__tests__/cli-build.test.d.ts.map +0 -1
  141. package/dist/__tests__/cli-build.test.js +0 -640
  142. package/dist/__tests__/cli-build.test.js.map +0 -1
  143. package/dist/__tests__/codex-agent-gate.test.d.ts +0 -2
  144. package/dist/__tests__/codex-agent-gate.test.d.ts.map +0 -1
  145. package/dist/__tests__/codex-agent-gate.test.js +0 -480
  146. package/dist/__tests__/codex-agent-gate.test.js.map +0 -1
  147. package/dist/__tests__/codex-deploy-config.test.d.ts +0 -2
  148. package/dist/__tests__/codex-deploy-config.test.d.ts.map +0 -1
  149. package/dist/__tests__/codex-deploy-config.test.js +0 -1230
  150. package/dist/__tests__/codex-deploy-config.test.js.map +0 -1
  151. package/dist/__tests__/codex-trust-keys.test.d.ts +0 -2
  152. package/dist/__tests__/codex-trust-keys.test.d.ts.map +0 -1
  153. package/dist/__tests__/codex-trust-keys.test.js +0 -731
  154. package/dist/__tests__/codex-trust-keys.test.js.map +0 -1
  155. package/dist/__tests__/codex-write-race.test.d.ts +0 -2
  156. package/dist/__tests__/codex-write-race.test.d.ts.map +0 -1
  157. package/dist/__tests__/codex-write-race.test.js +0 -2253
  158. package/dist/__tests__/codex-write-race.test.js.map +0 -1
  159. package/dist/__tests__/completion-rows-discriminate.test.d.ts +0 -20
  160. package/dist/__tests__/completion-rows-discriminate.test.d.ts.map +0 -1
  161. package/dist/__tests__/completion-rows-discriminate.test.js +0 -481
  162. package/dist/__tests__/completion-rows-discriminate.test.js.map +0 -1
  163. package/dist/__tests__/config-command.test.d.ts +0 -9
  164. package/dist/__tests__/config-command.test.d.ts.map +0 -1
  165. package/dist/__tests__/config-command.test.js +0 -75
  166. package/dist/__tests__/config-command.test.js.map +0 -1
  167. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts +0 -2
  168. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts.map +0 -1
  169. package/dist/__tests__/config-fidelity-archived-symlinks.test.js +0 -127
  170. package/dist/__tests__/config-fidelity-archived-symlinks.test.js.map +0 -1
  171. package/dist/__tests__/config-fidelity-display.test.d.ts +0 -2
  172. package/dist/__tests__/config-fidelity-display.test.d.ts.map +0 -1
  173. package/dist/__tests__/config-fidelity-display.test.js +0 -77
  174. package/dist/__tests__/config-fidelity-display.test.js.map +0 -1
  175. package/dist/__tests__/config-fidelity-unreadable-fixture.d.ts +0 -32
  176. package/dist/__tests__/config-fidelity-unreadable-fixture.d.ts.map +0 -1
  177. package/dist/__tests__/config-fidelity-unreadable-fixture.js +0 -37
  178. package/dist/__tests__/config-fidelity-unreadable-fixture.js.map +0 -1
  179. package/dist/__tests__/config-fidelity.test.d.ts +0 -16
  180. package/dist/__tests__/config-fidelity.test.d.ts.map +0 -1
  181. package/dist/__tests__/config-fidelity.test.js +0 -2679
  182. package/dist/__tests__/config-fidelity.test.js.map +0 -1
  183. package/dist/__tests__/config-generation-gate.test.d.ts +0 -46
  184. package/dist/__tests__/config-generation-gate.test.d.ts.map +0 -1
  185. package/dist/__tests__/config-generation-gate.test.js +0 -435
  186. package/dist/__tests__/config-generation-gate.test.js.map +0 -1
  187. package/dist/__tests__/config-generation.test.d.ts +0 -7
  188. package/dist/__tests__/config-generation.test.d.ts.map +0 -1
  189. package/dist/__tests__/config-generation.test.js +0 -141
  190. package/dist/__tests__/config-generation.test.js.map +0 -1
  191. package/dist/__tests__/config-sync.test.d.ts +0 -10
  192. package/dist/__tests__/config-sync.test.d.ts.map +0 -1
  193. package/dist/__tests__/config-sync.test.js +0 -268
  194. package/dist/__tests__/config-sync.test.js.map +0 -1
  195. package/dist/__tests__/coordination-401-production-wiring.test.d.ts +0 -19
  196. package/dist/__tests__/coordination-401-production-wiring.test.d.ts.map +0 -1
  197. package/dist/__tests__/coordination-401-production-wiring.test.js +0 -286
  198. package/dist/__tests__/coordination-401-production-wiring.test.js.map +0 -1
  199. package/dist/__tests__/coordination-401-recovery.test.d.ts +0 -22
  200. package/dist/__tests__/coordination-401-recovery.test.d.ts.map +0 -1
  201. package/dist/__tests__/coordination-401-recovery.test.js +0 -601
  202. package/dist/__tests__/coordination-401-recovery.test.js.map +0 -1
  203. package/dist/__tests__/coordination-brief-pin.test.d.ts +0 -20
  204. package/dist/__tests__/coordination-brief-pin.test.d.ts.map +0 -1
  205. package/dist/__tests__/coordination-brief-pin.test.js +0 -66
  206. package/dist/__tests__/coordination-brief-pin.test.js.map +0 -1
  207. package/dist/__tests__/coordination-brief.test.d.ts +0 -9
  208. package/dist/__tests__/coordination-brief.test.d.ts.map +0 -1
  209. package/dist/__tests__/coordination-brief.test.js +0 -290
  210. package/dist/__tests__/coordination-brief.test.js.map +0 -1
  211. package/dist/__tests__/coordination-client.test.d.ts +0 -9
  212. package/dist/__tests__/coordination-client.test.d.ts.map +0 -1
  213. package/dist/__tests__/coordination-client.test.js +0 -517
  214. package/dist/__tests__/coordination-client.test.js.map +0 -1
  215. package/dist/__tests__/coordination-command.test.d.ts +0 -9
  216. package/dist/__tests__/coordination-command.test.d.ts.map +0 -1
  217. package/dist/__tests__/coordination-command.test.js +0 -1082
  218. package/dist/__tests__/coordination-command.test.js.map +0 -1
  219. package/dist/__tests__/coordination-credential-endpoint.test.d.ts +0 -24
  220. package/dist/__tests__/coordination-credential-endpoint.test.d.ts.map +0 -1
  221. package/dist/__tests__/coordination-credential-endpoint.test.js +0 -1292
  222. package/dist/__tests__/coordination-credential-endpoint.test.js.map +0 -1
  223. package/dist/__tests__/coordination-expected-team.test.d.ts +0 -19
  224. package/dist/__tests__/coordination-expected-team.test.d.ts.map +0 -1
  225. package/dist/__tests__/coordination-expected-team.test.js +0 -423
  226. package/dist/__tests__/coordination-expected-team.test.js.map +0 -1
  227. package/dist/__tests__/coordination-fallback.test.d.ts +0 -9
  228. package/dist/__tests__/coordination-fallback.test.d.ts.map +0 -1
  229. package/dist/__tests__/coordination-fallback.test.js +0 -192
  230. package/dist/__tests__/coordination-fallback.test.js.map +0 -1
  231. package/dist/__tests__/coordination-file-guards.test.d.ts +0 -29
  232. package/dist/__tests__/coordination-file-guards.test.d.ts.map +0 -1
  233. package/dist/__tests__/coordination-file-guards.test.js +0 -380
  234. package/dist/__tests__/coordination-file-guards.test.js.map +0 -1
  235. package/dist/__tests__/coordination-history.test.d.ts +0 -8
  236. package/dist/__tests__/coordination-history.test.d.ts.map +0 -1
  237. package/dist/__tests__/coordination-history.test.js +0 -447
  238. package/dist/__tests__/coordination-history.test.js.map +0 -1
  239. package/dist/__tests__/coordination-memory.test.d.ts +0 -14
  240. package/dist/__tests__/coordination-memory.test.d.ts.map +0 -1
  241. package/dist/__tests__/coordination-memory.test.js +0 -401
  242. package/dist/__tests__/coordination-memory.test.js.map +0 -1
  243. package/dist/__tests__/coordination-mode.test.d.ts +0 -13
  244. package/dist/__tests__/coordination-mode.test.d.ts.map +0 -1
  245. package/dist/__tests__/coordination-mode.test.js +0 -180
  246. package/dist/__tests__/coordination-mode.test.js.map +0 -1
  247. package/dist/__tests__/coordination-plain-shell-commands.test.d.ts +0 -22
  248. package/dist/__tests__/coordination-plain-shell-commands.test.d.ts.map +0 -1
  249. package/dist/__tests__/coordination-plain-shell-commands.test.js +0 -1875
  250. package/dist/__tests__/coordination-plain-shell-commands.test.js.map +0 -1
  251. package/dist/__tests__/coordination-provision.test.d.ts +0 -12
  252. package/dist/__tests__/coordination-provision.test.d.ts.map +0 -1
  253. package/dist/__tests__/coordination-provision.test.js +0 -103
  254. package/dist/__tests__/coordination-provision.test.js.map +0 -1
  255. package/dist/__tests__/coordination-render.test.d.ts +0 -9
  256. package/dist/__tests__/coordination-render.test.d.ts.map +0 -1
  257. package/dist/__tests__/coordination-render.test.js +0 -335
  258. package/dist/__tests__/coordination-render.test.js.map +0 -1
  259. package/dist/__tests__/coordination-setup.test.d.ts +0 -6
  260. package/dist/__tests__/coordination-setup.test.d.ts.map +0 -1
  261. package/dist/__tests__/coordination-setup.test.js +0 -448
  262. package/dist/__tests__/coordination-setup.test.js.map +0 -1
  263. package/dist/__tests__/coordination-status-plain-shell.test.d.ts +0 -19
  264. package/dist/__tests__/coordination-status-plain-shell.test.d.ts.map +0 -1
  265. package/dist/__tests__/coordination-status-plain-shell.test.js +0 -332
  266. package/dist/__tests__/coordination-status-plain-shell.test.js.map +0 -1
  267. package/dist/__tests__/coordination-status-registration.test.d.ts +0 -16
  268. package/dist/__tests__/coordination-status-registration.test.d.ts.map +0 -1
  269. package/dist/__tests__/coordination-status-registration.test.js +0 -480
  270. package/dist/__tests__/coordination-status-registration.test.js.map +0 -1
  271. package/dist/__tests__/coordination-token-multitenant.test.d.ts +0 -11
  272. package/dist/__tests__/coordination-token-multitenant.test.d.ts.map +0 -1
  273. package/dist/__tests__/coordination-token-multitenant.test.js +0 -106
  274. package/dist/__tests__/coordination-token-multitenant.test.js.map +0 -1
  275. package/dist/__tests__/coordination-token.test.d.ts +0 -11
  276. package/dist/__tests__/coordination-token.test.d.ts.map +0 -1
  277. package/dist/__tests__/coordination-token.test.js +0 -201
  278. package/dist/__tests__/coordination-token.test.js.map +0 -1
  279. package/dist/__tests__/coordination-wiring.test.d.ts +0 -11
  280. package/dist/__tests__/coordination-wiring.test.d.ts.map +0 -1
  281. package/dist/__tests__/coordination-wiring.test.js +0 -43
  282. package/dist/__tests__/coordination-wiring.test.js.map +0 -1
  283. package/dist/__tests__/creation-pr-class-check.test.d.ts +0 -17
  284. package/dist/__tests__/creation-pr-class-check.test.d.ts.map +0 -1
  285. package/dist/__tests__/creation-pr-class-check.test.js +0 -346
  286. package/dist/__tests__/creation-pr-class-check.test.js.map +0 -1
  287. package/dist/__tests__/creation-step6a-push-check.test.d.ts +0 -15
  288. package/dist/__tests__/creation-step6a-push-check.test.d.ts.map +0 -1
  289. package/dist/__tests__/creation-step6a-push-check.test.js +0 -150
  290. package/dist/__tests__/creation-step6a-push-check.test.js.map +0 -1
  291. package/dist/__tests__/decision-check.test.d.ts +0 -2
  292. package/dist/__tests__/decision-check.test.d.ts.map +0 -1
  293. package/dist/__tests__/decision-check.test.js +0 -105
  294. package/dist/__tests__/decision-check.test.js.map +0 -1
  295. package/dist/__tests__/digest-fail-closed.test.d.ts +0 -16
  296. package/dist/__tests__/digest-fail-closed.test.d.ts.map +0 -1
  297. package/dist/__tests__/digest-fail-closed.test.js +0 -248
  298. package/dist/__tests__/digest-fail-closed.test.js.map +0 -1
  299. package/dist/__tests__/digest-team-omission.test.d.ts +0 -15
  300. package/dist/__tests__/digest-team-omission.test.d.ts.map +0 -1
  301. package/dist/__tests__/digest-team-omission.test.js +0 -247
  302. package/dist/__tests__/digest-team-omission.test.js.map +0 -1
  303. package/dist/__tests__/doctor-config-fidelity.test.d.ts +0 -19
  304. package/dist/__tests__/doctor-config-fidelity.test.d.ts.map +0 -1
  305. package/dist/__tests__/doctor-config-fidelity.test.js +0 -324
  306. package/dist/__tests__/doctor-config-fidelity.test.js.map +0 -1
  307. package/dist/__tests__/doctor-framework-version.test.d.ts +0 -2
  308. package/dist/__tests__/doctor-framework-version.test.d.ts.map +0 -1
  309. package/dist/__tests__/doctor-framework-version.test.js +0 -146
  310. package/dist/__tests__/doctor-framework-version.test.js.map +0 -1
  311. package/dist/__tests__/doctor-worktree-path.test.d.ts +0 -17
  312. package/dist/__tests__/doctor-worktree-path.test.d.ts.map +0 -1
  313. package/dist/__tests__/doctor-worktree-path.test.js +0 -158
  314. package/dist/__tests__/doctor-worktree-path.test.js.map +0 -1
  315. package/dist/__tests__/doctor.test.d.ts +0 -20
  316. package/dist/__tests__/doctor.test.d.ts.map +0 -1
  317. package/dist/__tests__/doctor.test.js +0 -849
  318. package/dist/__tests__/doctor.test.js.map +0 -1
  319. package/dist/__tests__/event-shipper.test.d.ts +0 -16
  320. package/dist/__tests__/event-shipper.test.d.ts.map +0 -1
  321. package/dist/__tests__/event-shipper.test.js +0 -287
  322. package/dist/__tests__/event-shipper.test.js.map +0 -1
  323. package/dist/__tests__/fleet-data.test.d.ts +0 -2
  324. package/dist/__tests__/fleet-data.test.d.ts.map +0 -1
  325. package/dist/__tests__/fleet-data.test.js +0 -501
  326. package/dist/__tests__/fleet-data.test.js.map +0 -1
  327. package/dist/__tests__/fleet-devpod.test.d.ts +0 -12
  328. package/dist/__tests__/fleet-devpod.test.d.ts.map +0 -1
  329. package/dist/__tests__/fleet-devpod.test.js +0 -260
  330. package/dist/__tests__/fleet-devpod.test.js.map +0 -1
  331. package/dist/__tests__/fleet-tmux.test.d.ts +0 -2
  332. package/dist/__tests__/fleet-tmux.test.d.ts.map +0 -1
  333. package/dist/__tests__/fleet-tmux.test.js +0 -289
  334. package/dist/__tests__/fleet-tmux.test.js.map +0 -1
  335. package/dist/__tests__/fleet.test.d.ts +0 -16
  336. package/dist/__tests__/fleet.test.d.ts.map +0 -1
  337. package/dist/__tests__/fleet.test.js +0 -75
  338. package/dist/__tests__/fleet.test.js.map +0 -1
  339. package/dist/__tests__/generate-claude.test.d.ts +0 -18
  340. package/dist/__tests__/generate-claude.test.d.ts.map +0 -1
  341. package/dist/__tests__/generate-claude.test.js +0 -1015
  342. package/dist/__tests__/generate-claude.test.js.map +0 -1
  343. package/dist/__tests__/gh-remote.test.d.ts +0 -2
  344. package/dist/__tests__/gh-remote.test.d.ts.map +0 -1
  345. package/dist/__tests__/gh-remote.test.js +0 -136
  346. package/dist/__tests__/gh-remote.test.js.map +0 -1
  347. package/dist/__tests__/git-env.test.d.ts +0 -14
  348. package/dist/__tests__/git-env.test.d.ts.map +0 -1
  349. package/dist/__tests__/git-env.test.js +0 -131
  350. package/dist/__tests__/git-env.test.js.map +0 -1
  351. package/dist/__tests__/git-identity-isolation.test.d.ts +0 -33
  352. package/dist/__tests__/git-identity-isolation.test.d.ts.map +0 -1
  353. package/dist/__tests__/git-identity-isolation.test.js +0 -626
  354. package/dist/__tests__/git-identity-isolation.test.js.map +0 -1
  355. package/dist/__tests__/harness-extract.test.d.ts +0 -19
  356. package/dist/__tests__/harness-extract.test.d.ts.map +0 -1
  357. package/dist/__tests__/harness-extract.test.js +0 -566
  358. package/dist/__tests__/harness-extract.test.js.map +0 -1
  359. package/dist/__tests__/harness-wiring.test.d.ts +0 -16
  360. package/dist/__tests__/harness-wiring.test.d.ts.map +0 -1
  361. package/dist/__tests__/harness-wiring.test.js +0 -469
  362. package/dist/__tests__/harness-wiring.test.js.map +0 -1
  363. package/dist/__tests__/hook-completeness.test.d.ts +0 -13
  364. package/dist/__tests__/hook-completeness.test.d.ts.map +0 -1
  365. package/dist/__tests__/hook-completeness.test.js +0 -238
  366. package/dist/__tests__/hook-completeness.test.js.map +0 -1
  367. package/dist/__tests__/hook-heal.test.d.ts +0 -8
  368. package/dist/__tests__/hook-heal.test.d.ts.map +0 -1
  369. package/dist/__tests__/hook-heal.test.js +0 -156
  370. package/dist/__tests__/hook-heal.test.js.map +0 -1
  371. package/dist/__tests__/human-turn-classifier.test.d.ts +0 -17
  372. package/dist/__tests__/human-turn-classifier.test.d.ts.map +0 -1
  373. package/dist/__tests__/human-turn-classifier.test.js +0 -311
  374. package/dist/__tests__/human-turn-classifier.test.js.map +0 -1
  375. package/dist/__tests__/init-coordination-url.test.d.ts +0 -11
  376. package/dist/__tests__/init-coordination-url.test.d.ts.map +0 -1
  377. package/dist/__tests__/init-coordination-url.test.js +0 -217
  378. package/dist/__tests__/init-coordination-url.test.js.map +0 -1
  379. package/dist/__tests__/isolation-probe.test.d.ts +0 -15
  380. package/dist/__tests__/isolation-probe.test.d.ts.map +0 -1
  381. package/dist/__tests__/isolation-probe.test.js +0 -611
  382. package/dist/__tests__/isolation-probe.test.js.map +0 -1
  383. package/dist/__tests__/leader-lock.test.d.ts +0 -12
  384. package/dist/__tests__/leader-lock.test.d.ts.map +0 -1
  385. package/dist/__tests__/leader-lock.test.js +0 -293
  386. package/dist/__tests__/leader-lock.test.js.map +0 -1
  387. package/dist/__tests__/memory-archive-checks.test.d.ts +0 -22
  388. package/dist/__tests__/memory-archive-checks.test.d.ts.map +0 -1
  389. package/dist/__tests__/memory-archive-checks.test.js +0 -748
  390. package/dist/__tests__/memory-archive-checks.test.js.map +0 -1
  391. package/dist/__tests__/memory-archive-prep.test.d.ts +0 -8
  392. package/dist/__tests__/memory-archive-prep.test.d.ts.map +0 -1
  393. package/dist/__tests__/memory-archive-prep.test.js +0 -524
  394. package/dist/__tests__/memory-archive-prep.test.js.map +0 -1
  395. package/dist/__tests__/memory-autocreate.test.d.ts +0 -10
  396. package/dist/__tests__/memory-autocreate.test.d.ts.map +0 -1
  397. package/dist/__tests__/memory-autocreate.test.js +0 -709
  398. package/dist/__tests__/memory-autocreate.test.js.map +0 -1
  399. package/dist/__tests__/memory-log-result.test.d.ts +0 -13
  400. package/dist/__tests__/memory-log-result.test.d.ts.map +0 -1
  401. package/dist/__tests__/memory-log-result.test.js +0 -149
  402. package/dist/__tests__/memory-log-result.test.js.map +0 -1
  403. package/dist/__tests__/memory-named-exists.test.d.ts +0 -16
  404. package/dist/__tests__/memory-named-exists.test.d.ts.map +0 -1
  405. package/dist/__tests__/memory-named-exists.test.js +0 -288
  406. package/dist/__tests__/memory-named-exists.test.js.map +0 -1
  407. package/dist/__tests__/message-bus.test.d.ts +0 -10
  408. package/dist/__tests__/message-bus.test.d.ts.map +0 -1
  409. package/dist/__tests__/message-bus.test.js +0 -526
  410. package/dist/__tests__/message-bus.test.js.map +0 -1
  411. package/dist/__tests__/monitor.test.d.ts +0 -6
  412. package/dist/__tests__/monitor.test.d.ts.map +0 -1
  413. package/dist/__tests__/monitor.test.js +0 -458
  414. package/dist/__tests__/monitor.test.js.map +0 -1
  415. package/dist/__tests__/mx-agent-cli-pin-validation.test.d.ts +0 -2
  416. package/dist/__tests__/mx-agent-cli-pin-validation.test.d.ts.map +0 -1
  417. package/dist/__tests__/mx-agent-cli-pin-validation.test.js +0 -232
  418. package/dist/__tests__/mx-agent-cli-pin-validation.test.js.map +0 -1
  419. package/dist/__tests__/mx-agent-cli-version-pin.test.d.ts +0 -2
  420. package/dist/__tests__/mx-agent-cli-version-pin.test.d.ts.map +0 -1
  421. package/dist/__tests__/mx-agent-cli-version-pin.test.js +0 -236
  422. package/dist/__tests__/mx-agent-cli-version-pin.test.js.map +0 -1
  423. package/dist/__tests__/new-project-first-team.test.d.ts +0 -15
  424. package/dist/__tests__/new-project-first-team.test.d.ts.map +0 -1
  425. package/dist/__tests__/new-project-first-team.test.js +0 -444
  426. package/dist/__tests__/new-project-first-team.test.js.map +0 -1
  427. package/dist/__tests__/otel-env.test.d.ts +0 -2
  428. package/dist/__tests__/otel-env.test.d.ts.map +0 -1
  429. package/dist/__tests__/otel-env.test.js +0 -127
  430. package/dist/__tests__/otel-env.test.js.map +0 -1
  431. package/dist/__tests__/pager-fail-closed.test.d.ts +0 -19
  432. package/dist/__tests__/pager-fail-closed.test.d.ts.map +0 -1
  433. package/dist/__tests__/pager-fail-closed.test.js +0 -229
  434. package/dist/__tests__/pager-fail-closed.test.js.map +0 -1
  435. package/dist/__tests__/pr-set-body.test.d.ts +0 -29
  436. package/dist/__tests__/pr-set-body.test.d.ts.map +0 -1
  437. package/dist/__tests__/pr-set-body.test.js +0 -314
  438. package/dist/__tests__/pr-set-body.test.js.map +0 -1
  439. package/dist/__tests__/prior-sync-failure.test.d.ts +0 -2
  440. package/dist/__tests__/prior-sync-failure.test.d.ts.map +0 -1
  441. package/dist/__tests__/prior-sync-failure.test.js +0 -81
  442. package/dist/__tests__/prior-sync-failure.test.js.map +0 -1
  443. package/dist/__tests__/project-config.test.d.ts +0 -2
  444. package/dist/__tests__/project-config.test.d.ts.map +0 -1
  445. package/dist/__tests__/project-config.test.js +0 -458
  446. package/dist/__tests__/project-config.test.js.map +0 -1
  447. package/dist/__tests__/provision-behavioral-contract.test.d.ts +0 -13
  448. package/dist/__tests__/provision-behavioral-contract.test.d.ts.map +0 -1
  449. package/dist/__tests__/provision-behavioral-contract.test.js +0 -548
  450. package/dist/__tests__/provision-behavioral-contract.test.js.map +0 -1
  451. package/dist/__tests__/provision-catalog-precondition.test.d.ts +0 -26
  452. package/dist/__tests__/provision-catalog-precondition.test.d.ts.map +0 -1
  453. package/dist/__tests__/provision-catalog-precondition.test.js +0 -622
  454. package/dist/__tests__/provision-catalog-precondition.test.js.map +0 -1
  455. package/dist/__tests__/provision-completion-rows.test.d.ts +0 -17
  456. package/dist/__tests__/provision-completion-rows.test.d.ts.map +0 -1
  457. package/dist/__tests__/provision-completion-rows.test.js +0 -3473
  458. package/dist/__tests__/provision-completion-rows.test.js.map +0 -1
  459. package/dist/__tests__/provision-copy-containment.test.d.ts +0 -19
  460. package/dist/__tests__/provision-copy-containment.test.d.ts.map +0 -1
  461. package/dist/__tests__/provision-copy-containment.test.js +0 -187
  462. package/dist/__tests__/provision-copy-containment.test.js.map +0 -1
  463. package/dist/__tests__/provision-identity-gate.test.d.ts +0 -20
  464. package/dist/__tests__/provision-identity-gate.test.d.ts.map +0 -1
  465. package/dist/__tests__/provision-identity-gate.test.js +0 -602
  466. package/dist/__tests__/provision-identity-gate.test.js.map +0 -1
  467. package/dist/__tests__/provision-resume.test.d.ts +0 -26
  468. package/dist/__tests__/provision-resume.test.d.ts.map +0 -1
  469. package/dist/__tests__/provision-resume.test.js +0 -1344
  470. package/dist/__tests__/provision-resume.test.js.map +0 -1
  471. package/dist/__tests__/provision-roleguide-anchors.test.d.ts +0 -27
  472. package/dist/__tests__/provision-roleguide-anchors.test.d.ts.map +0 -1
  473. package/dist/__tests__/provision-roleguide-anchors.test.js +0 -747
  474. package/dist/__tests__/provision-roleguide-anchors.test.js.map +0 -1
  475. package/dist/__tests__/provision-row12-stub-server.test.d.ts +0 -21
  476. package/dist/__tests__/provision-row12-stub-server.test.d.ts.map +0 -1
  477. package/dist/__tests__/provision-row12-stub-server.test.js +0 -264
  478. package/dist/__tests__/provision-row12-stub-server.test.js.map +0 -1
  479. package/dist/__tests__/provision-skeleton-fill.test.d.ts +0 -16
  480. package/dist/__tests__/provision-skeleton-fill.test.d.ts.map +0 -1
  481. package/dist/__tests__/provision-skeleton-fill.test.js +0 -490
  482. package/dist/__tests__/provision-skeleton-fill.test.js.map +0 -1
  483. package/dist/__tests__/provision-step8-commit.test.d.ts +0 -40
  484. package/dist/__tests__/provision-step8-commit.test.d.ts.map +0 -1
  485. package/dist/__tests__/provision-step8-commit.test.js +0 -529
  486. package/dist/__tests__/provision-step8-commit.test.js.map +0 -1
  487. package/dist/__tests__/provision-teambuilder-flow.test.d.ts +0 -22
  488. package/dist/__tests__/provision-teambuilder-flow.test.d.ts.map +0 -1
  489. package/dist/__tests__/provision-teambuilder-flow.test.js +0 -253
  490. package/dist/__tests__/provision-teambuilder-flow.test.js.map +0 -1
  491. package/dist/__tests__/provision-write-integrity.test.d.ts +0 -18
  492. package/dist/__tests__/provision-write-integrity.test.d.ts.map +0 -1
  493. package/dist/__tests__/provision-write-integrity.test.js +0 -141
  494. package/dist/__tests__/provision-write-integrity.test.js.map +0 -1
  495. package/dist/__tests__/repo-guard-wiring.test.d.ts +0 -21
  496. package/dist/__tests__/repo-guard-wiring.test.d.ts.map +0 -1
  497. package/dist/__tests__/repo-guard-wiring.test.js +0 -638
  498. package/dist/__tests__/repo-guard-wiring.test.js.map +0 -1
  499. package/dist/__tests__/report-format.test.d.ts +0 -2
  500. package/dist/__tests__/report-format.test.d.ts.map +0 -1
  501. package/dist/__tests__/report-format.test.js +0 -219
  502. package/dist/__tests__/report-format.test.js.map +0 -1
  503. package/dist/__tests__/row15-detail-sanitizer.test.d.ts +0 -20
  504. package/dist/__tests__/row15-detail-sanitizer.test.d.ts.map +0 -1
  505. package/dist/__tests__/row15-detail-sanitizer.test.js +0 -61
  506. package/dist/__tests__/row15-detail-sanitizer.test.js.map +0 -1
  507. package/dist/__tests__/rows-9-10-zero-remotes.test.d.ts +0 -32
  508. package/dist/__tests__/rows-9-10-zero-remotes.test.d.ts.map +0 -1
  509. package/dist/__tests__/rows-9-10-zero-remotes.test.js +0 -203
  510. package/dist/__tests__/rows-9-10-zero-remotes.test.js.map +0 -1
  511. package/dist/__tests__/runtime-claude-adapter.test.d.ts +0 -2
  512. package/dist/__tests__/runtime-claude-adapter.test.d.ts.map +0 -1
  513. package/dist/__tests__/runtime-claude-adapter.test.js +0 -70
  514. package/dist/__tests__/runtime-claude-adapter.test.js.map +0 -1
  515. package/dist/__tests__/runtime-codex-adapter.test.d.ts +0 -2
  516. package/dist/__tests__/runtime-codex-adapter.test.d.ts.map +0 -1
  517. package/dist/__tests__/runtime-codex-adapter.test.js +0 -558
  518. package/dist/__tests__/runtime-codex-adapter.test.js.map +0 -1
  519. package/dist/__tests__/runtime-codex-config.test.d.ts +0 -2
  520. package/dist/__tests__/runtime-codex-config.test.d.ts.map +0 -1
  521. package/dist/__tests__/runtime-codex-config.test.js +0 -1421
  522. package/dist/__tests__/runtime-codex-config.test.js.map +0 -1
  523. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts +0 -2
  524. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts.map +0 -1
  525. package/dist/__tests__/runtime-codex-gateway-pilot.test.js +0 -309
  526. package/dist/__tests__/runtime-codex-gateway-pilot.test.js.map +0 -1
  527. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts +0 -2
  528. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts.map +0 -1
  529. package/dist/__tests__/runtime-codex-gateway-provider.test.js +0 -163
  530. package/dist/__tests__/runtime-codex-gateway-provider.test.js.map +0 -1
  531. package/dist/__tests__/runtime-codex-guard-proof.test.d.ts +0 -2
  532. package/dist/__tests__/runtime-codex-guard-proof.test.d.ts.map +0 -1
  533. package/dist/__tests__/runtime-codex-guard-proof.test.js +0 -822
  534. package/dist/__tests__/runtime-codex-guard-proof.test.js.map +0 -1
  535. package/dist/__tests__/runtime-codex-version-pin.test.d.ts +0 -2
  536. package/dist/__tests__/runtime-codex-version-pin.test.d.ts.map +0 -1
  537. package/dist/__tests__/runtime-codex-version-pin.test.js +0 -86
  538. package/dist/__tests__/runtime-codex-version-pin.test.js.map +0 -1
  539. package/dist/__tests__/runtime-identity.test.d.ts +0 -2
  540. package/dist/__tests__/runtime-identity.test.d.ts.map +0 -1
  541. package/dist/__tests__/runtime-identity.test.js +0 -117
  542. package/dist/__tests__/runtime-identity.test.js.map +0 -1
  543. package/dist/__tests__/runtime-resolve.test.d.ts +0 -2
  544. package/dist/__tests__/runtime-resolve.test.d.ts.map +0 -1
  545. package/dist/__tests__/runtime-resolve.test.js +0 -172
  546. package/dist/__tests__/runtime-resolve.test.js.map +0 -1
  547. package/dist/__tests__/security-posture.test.d.ts +0 -8
  548. package/dist/__tests__/security-posture.test.d.ts.map +0 -1
  549. package/dist/__tests__/security-posture.test.js +0 -82
  550. package/dist/__tests__/security-posture.test.js.map +0 -1
  551. package/dist/__tests__/session-model.test.d.ts +0 -2
  552. package/dist/__tests__/session-model.test.d.ts.map +0 -1
  553. package/dist/__tests__/session-model.test.js +0 -74
  554. package/dist/__tests__/session-model.test.js.map +0 -1
  555. package/dist/__tests__/session-pause-provisioning.test.d.ts +0 -19
  556. package/dist/__tests__/session-pause-provisioning.test.d.ts.map +0 -1
  557. package/dist/__tests__/session-pause-provisioning.test.js +0 -115
  558. package/dist/__tests__/session-pause-provisioning.test.js.map +0 -1
  559. package/dist/__tests__/session-reclamation.test.d.ts +0 -15
  560. package/dist/__tests__/session-reclamation.test.d.ts.map +0 -1
  561. package/dist/__tests__/session-reclamation.test.js +0 -73
  562. package/dist/__tests__/session-reclamation.test.js.map +0 -1
  563. package/dist/__tests__/session-record-disclosure.test.d.ts +0 -24
  564. package/dist/__tests__/session-record-disclosure.test.d.ts.map +0 -1
  565. package/dist/__tests__/session-record-disclosure.test.js +0 -494
  566. package/dist/__tests__/session-record-disclosure.test.js.map +0 -1
  567. package/dist/__tests__/session-status.test.d.ts +0 -11
  568. package/dist/__tests__/session-status.test.d.ts.map +0 -1
  569. package/dist/__tests__/session-status.test.js +0 -76
  570. package/dist/__tests__/session-status.test.js.map +0 -1
  571. package/dist/__tests__/session.test.d.ts +0 -15
  572. package/dist/__tests__/session.test.d.ts.map +0 -1
  573. package/dist/__tests__/session.test.js +0 -366
  574. package/dist/__tests__/session.test.js.map +0 -1
  575. package/dist/__tests__/shim-deploy-safety.test.d.ts +0 -24
  576. package/dist/__tests__/shim-deploy-safety.test.d.ts.map +0 -1
  577. package/dist/__tests__/shim-deploy-safety.test.js +0 -174
  578. package/dist/__tests__/shim-deploy-safety.test.js.map +0 -1
  579. package/dist/__tests__/slug-validation.test.d.ts +0 -13
  580. package/dist/__tests__/slug-validation.test.d.ts.map +0 -1
  581. package/dist/__tests__/slug-validation.test.js +0 -202
  582. package/dist/__tests__/slug-validation.test.js.map +0 -1
  583. package/dist/__tests__/standards-injection.test.d.ts +0 -2
  584. package/dist/__tests__/standards-injection.test.d.ts.map +0 -1
  585. package/dist/__tests__/standards-injection.test.js +0 -179
  586. package/dist/__tests__/standards-injection.test.js.map +0 -1
  587. package/dist/__tests__/start-config-conflict.test.d.ts +0 -17
  588. package/dist/__tests__/start-config-conflict.test.d.ts.map +0 -1
  589. package/dist/__tests__/start-config-conflict.test.js +0 -101
  590. package/dist/__tests__/start-config-conflict.test.js.map +0 -1
  591. package/dist/__tests__/start-interactive-role.test.d.ts +0 -22
  592. package/dist/__tests__/start-interactive-role.test.d.ts.map +0 -1
  593. package/dist/__tests__/start-interactive-role.test.js +0 -204
  594. package/dist/__tests__/start-interactive-role.test.js.map +0 -1
  595. package/dist/__tests__/start-rebase-never-ran.test.d.ts +0 -25
  596. package/dist/__tests__/start-rebase-never-ran.test.d.ts.map +0 -1
  597. package/dist/__tests__/start-rebase-never-ran.test.js +0 -227
  598. package/dist/__tests__/start-rebase-never-ran.test.js.map +0 -1
  599. package/dist/__tests__/start-report-generation-capture.test.d.ts +0 -17
  600. package/dist/__tests__/start-report-generation-capture.test.d.ts.map +0 -1
  601. package/dist/__tests__/start-report-generation-capture.test.js +0 -127
  602. package/dist/__tests__/start-report-generation-capture.test.js.map +0 -1
  603. package/dist/__tests__/start-report-integration.test.d.ts +0 -12
  604. package/dist/__tests__/start-report-integration.test.d.ts.map +0 -1
  605. package/dist/__tests__/start-report-integration.test.js +0 -138
  606. package/dist/__tests__/start-report-integration.test.js.map +0 -1
  607. package/dist/__tests__/start-runtime-wiring.test.d.ts +0 -31
  608. package/dist/__tests__/start-runtime-wiring.test.d.ts.map +0 -1
  609. package/dist/__tests__/start-runtime-wiring.test.js +0 -735
  610. package/dist/__tests__/start-runtime-wiring.test.js.map +0 -1
  611. package/dist/__tests__/start-stash.test.d.ts +0 -2
  612. package/dist/__tests__/start-stash.test.d.ts.map +0 -1
  613. package/dist/__tests__/start-stash.test.js +0 -131
  614. package/dist/__tests__/start-stash.test.js.map +0 -1
  615. package/dist/__tests__/start-sync-hardstop.test.d.ts +0 -15
  616. package/dist/__tests__/start-sync-hardstop.test.d.ts.map +0 -1
  617. package/dist/__tests__/start-sync-hardstop.test.js +0 -280
  618. package/dist/__tests__/start-sync-hardstop.test.js.map +0 -1
  619. package/dist/__tests__/start-team-identity.test.d.ts +0 -25
  620. package/dist/__tests__/start-team-identity.test.d.ts.map +0 -1
  621. package/dist/__tests__/start-team-identity.test.js +0 -307
  622. package/dist/__tests__/start-team-identity.test.js.map +0 -1
  623. package/dist/__tests__/startup-health-render.test.d.ts +0 -11
  624. package/dist/__tests__/startup-health-render.test.d.ts.map +0 -1
  625. package/dist/__tests__/startup-health-render.test.js +0 -60
  626. package/dist/__tests__/startup-health-render.test.js.map +0 -1
  627. package/dist/__tests__/startup-policy.test.d.ts +0 -2
  628. package/dist/__tests__/startup-policy.test.d.ts.map +0 -1
  629. package/dist/__tests__/startup-policy.test.js +0 -27
  630. package/dist/__tests__/startup-policy.test.js.map +0 -1
  631. package/dist/__tests__/startup-report.test.d.ts +0 -13
  632. package/dist/__tests__/startup-report.test.d.ts.map +0 -1
  633. package/dist/__tests__/startup-report.test.js +0 -278
  634. package/dist/__tests__/startup-report.test.js.map +0 -1
  635. package/dist/__tests__/startup-shipper.test.d.ts +0 -13
  636. package/dist/__tests__/startup-shipper.test.d.ts.map +0 -1
  637. package/dist/__tests__/startup-shipper.test.js +0 -149
  638. package/dist/__tests__/startup-shipper.test.js.map +0 -1
  639. package/dist/__tests__/stream-input-controller.test.d.ts +0 -10
  640. package/dist/__tests__/stream-input-controller.test.d.ts.map +0 -1
  641. package/dist/__tests__/stream-input-controller.test.js +0 -167
  642. package/dist/__tests__/stream-input-controller.test.js.map +0 -1
  643. package/dist/__tests__/team-memory-commands.test.d.ts +0 -11
  644. package/dist/__tests__/team-memory-commands.test.d.ts.map +0 -1
  645. package/dist/__tests__/team-memory-commands.test.js +0 -240
  646. package/dist/__tests__/team-memory-commands.test.js.map +0 -1
  647. package/dist/__tests__/team-name-propagation.test.d.ts +0 -13
  648. package/dist/__tests__/team-name-propagation.test.d.ts.map +0 -1
  649. package/dist/__tests__/team-name-propagation.test.js +0 -198
  650. package/dist/__tests__/team-name-propagation.test.js.map +0 -1
  651. package/dist/__tests__/team-token-probe.test.d.ts +0 -16
  652. package/dist/__tests__/team-token-probe.test.d.ts.map +0 -1
  653. package/dist/__tests__/team-token-probe.test.js +0 -295
  654. package/dist/__tests__/team-token-probe.test.js.map +0 -1
  655. package/dist/__tests__/template-budget.test.d.ts +0 -2
  656. package/dist/__tests__/template-budget.test.d.ts.map +0 -1
  657. package/dist/__tests__/template-budget.test.js +0 -119
  658. package/dist/__tests__/template-budget.test.js.map +0 -1
  659. package/dist/__tests__/template-sync.test.d.ts +0 -19
  660. package/dist/__tests__/template-sync.test.d.ts.map +0 -1
  661. package/dist/__tests__/template-sync.test.js +0 -480
  662. package/dist/__tests__/template-sync.test.js.map +0 -1
  663. package/dist/__tests__/test-project.test.d.ts +0 -18
  664. package/dist/__tests__/test-project.test.d.ts.map +0 -1
  665. package/dist/__tests__/test-project.test.js +0 -465
  666. package/dist/__tests__/test-project.test.js.map +0 -1
  667. package/dist/__tests__/tracked-instruction-files.test.d.ts +0 -21
  668. package/dist/__tests__/tracked-instruction-files.test.d.ts.map +0 -1
  669. package/dist/__tests__/tracked-instruction-files.test.js +0 -489
  670. package/dist/__tests__/tracked-instruction-files.test.js.map +0 -1
  671. package/dist/__tests__/unlock.test.d.ts +0 -11
  672. package/dist/__tests__/unlock.test.d.ts.map +0 -1
  673. package/dist/__tests__/unlock.test.js +0 -100
  674. package/dist/__tests__/unlock.test.js.map +0 -1
  675. package/dist/__tests__/usage-per-call-grouping.test.d.ts +0 -25
  676. package/dist/__tests__/usage-per-call-grouping.test.d.ts.map +0 -1
  677. package/dist/__tests__/usage-per-call-grouping.test.js +0 -952
  678. package/dist/__tests__/usage-per-call-grouping.test.js.map +0 -1
  679. package/dist/__tests__/usage-pricing.test.d.ts +0 -20
  680. package/dist/__tests__/usage-pricing.test.d.ts.map +0 -1
  681. package/dist/__tests__/usage-pricing.test.js +0 -176
  682. package/dist/__tests__/usage-pricing.test.js.map +0 -1
  683. package/dist/__tests__/usage-subagent-discovery.test.d.ts +0 -17
  684. package/dist/__tests__/usage-subagent-discovery.test.d.ts.map +0 -1
  685. package/dist/__tests__/usage-subagent-discovery.test.js +0 -213
  686. package/dist/__tests__/usage-subagent-discovery.test.js.map +0 -1
  687. package/dist/__tests__/verify-hooks-check-all.test.d.ts +0 -32
  688. package/dist/__tests__/verify-hooks-check-all.test.d.ts.map +0 -1
  689. package/dist/__tests__/verify-hooks-check-all.test.js +0 -563
  690. package/dist/__tests__/verify-hooks-check-all.test.js.map +0 -1
  691. package/dist/__tests__/verify-hooks-heal-log.test.d.ts +0 -11
  692. package/dist/__tests__/verify-hooks-heal-log.test.d.ts.map +0 -1
  693. package/dist/__tests__/verify-hooks-heal-log.test.js +0 -172
  694. package/dist/__tests__/verify-hooks-heal-log.test.js.map +0 -1
  695. package/dist/__tests__/worker-cap.test.d.ts +0 -14
  696. package/dist/__tests__/worker-cap.test.d.ts.map +0 -1
  697. package/dist/__tests__/worker-cap.test.js +0 -97
  698. package/dist/__tests__/worker-cap.test.js.map +0 -1
  699. package/dist/__tests__/worktree-link-repair.test.d.ts +0 -2
  700. package/dist/__tests__/worktree-link-repair.test.d.ts.map +0 -1
  701. package/dist/__tests__/worktree-link-repair.test.js +0 -471
  702. package/dist/__tests__/worktree-link-repair.test.js.map +0 -1
  703. package/dist/__tests__/worktree-sync-fixture.test.d.ts +0 -17
  704. package/dist/__tests__/worktree-sync-fixture.test.d.ts.map +0 -1
  705. package/dist/__tests__/worktree-sync-fixture.test.js +0 -519
  706. package/dist/__tests__/worktree-sync-fixture.test.js.map +0 -1
  707. package/dist/__tests__/worktree-sync-hardening.test.d.ts +0 -13
  708. package/dist/__tests__/worktree-sync-hardening.test.d.ts.map +0 -1
  709. package/dist/__tests__/worktree-sync-hardening.test.js +0 -919
  710. package/dist/__tests__/worktree-sync-hardening.test.js.map +0 -1
  711. package/dist/__tests__/worktree-sync-shell-free.test.d.ts +0 -25
  712. package/dist/__tests__/worktree-sync-shell-free.test.d.ts.map +0 -1
  713. package/dist/__tests__/worktree-sync-shell-free.test.js +0 -185
  714. package/dist/__tests__/worktree-sync-shell-free.test.js.map +0 -1
  715. package/dist/__tests__/worktree.test.d.ts +0 -2
  716. package/dist/__tests__/worktree.test.d.ts.map +0 -1
  717. package/dist/__tests__/worktree.test.js +0 -168
  718. package/dist/__tests__/worktree.test.js.map +0 -1
  719. package/dist/lib/code-context-file.test.d.ts +0 -19
  720. package/dist/lib/code-context-file.test.d.ts.map +0 -1
  721. package/dist/lib/code-context-file.test.js +0 -202
  722. package/dist/lib/code-context-file.test.js.map +0 -1
  723. package/dist/lib/harness/console/announce.test.d.ts +0 -2
  724. package/dist/lib/harness/console/announce.test.d.ts.map +0 -1
  725. package/dist/lib/harness/console/announce.test.js +0 -104
  726. package/dist/lib/harness/console/announce.test.js.map +0 -1
  727. package/dist/lib/harness/console/by-session.test.d.ts +0 -2
  728. package/dist/lib/harness/console/by-session.test.d.ts.map +0 -1
  729. package/dist/lib/harness/console/by-session.test.js +0 -86
  730. package/dist/lib/harness/console/by-session.test.js.map +0 -1
  731. package/dist/lib/harness/console/console.test.d.ts +0 -2
  732. package/dist/lib/harness/console/console.test.d.ts.map +0 -1
  733. package/dist/lib/harness/console/console.test.js +0 -269
  734. package/dist/lib/harness/console/console.test.js.map +0 -1
  735. package/dist/lib/harness/console/decision-request.test.d.ts +0 -2
  736. package/dist/lib/harness/console/decision-request.test.d.ts.map +0 -1
  737. package/dist/lib/harness/console/decision-request.test.js +0 -75
  738. package/dist/lib/harness/console/decision-request.test.js.map +0 -1
  739. package/dist/lib/harness/console/rank.test.d.ts +0 -2
  740. package/dist/lib/harness/console/rank.test.d.ts.map +0 -1
  741. package/dist/lib/harness/console/rank.test.js +0 -124
  742. package/dist/lib/harness/console/rank.test.js.map +0 -1
  743. package/dist/lib/harness/console/render.test.d.ts +0 -2
  744. package/dist/lib/harness/console/render.test.d.ts.map +0 -1
  745. package/dist/lib/harness/console/render.test.js +0 -96
  746. package/dist/lib/harness/console/render.test.js.map +0 -1
  747. package/dist/lib/harness/console/replay-cli.test.d.ts +0 -2
  748. package/dist/lib/harness/console/replay-cli.test.d.ts.map +0 -1
  749. package/dist/lib/harness/console/replay-cli.test.js +0 -96
  750. package/dist/lib/harness/console/replay-cli.test.js.map +0 -1
  751. package/dist/lib/harness/console/replay.test.d.ts +0 -2
  752. package/dist/lib/harness/console/replay.test.d.ts.map +0 -1
  753. package/dist/lib/harness/console/replay.test.js +0 -81
  754. package/dist/lib/harness/console/replay.test.js.map +0 -1
  755. package/dist/lib/harness/console/turn-reader.test.d.ts +0 -2
  756. package/dist/lib/harness/console/turn-reader.test.d.ts.map +0 -1
  757. package/dist/lib/harness/console/turn-reader.test.js +0 -108
  758. package/dist/lib/harness/console/turn-reader.test.js.map +0 -1
  759. package/dist/lib/harness/credential.test.d.ts +0 -2
  760. package/dist/lib/harness/credential.test.d.ts.map +0 -1
  761. package/dist/lib/harness/credential.test.js +0 -74
  762. package/dist/lib/harness/credential.test.js.map +0 -1
  763. package/dist/lib/harness/evaluate.test.d.ts +0 -2
  764. package/dist/lib/harness/evaluate.test.d.ts.map +0 -1
  765. package/dist/lib/harness/evaluate.test.js +0 -621
  766. package/dist/lib/harness/evaluate.test.js.map +0 -1
  767. package/dist/lib/harness/gate.test.d.ts +0 -2
  768. package/dist/lib/harness/gate.test.d.ts.map +0 -1
  769. package/dist/lib/harness/gate.test.js +0 -111
  770. package/dist/lib/harness/gate.test.js.map +0 -1
  771. package/dist/lib/harness/self-check.test.d.ts +0 -2
  772. package/dist/lib/harness/self-check.test.d.ts.map +0 -1
  773. package/dist/lib/harness/self-check.test.js +0 -43
  774. package/dist/lib/harness/self-check.test.js.map +0 -1
  775. package/dist/lib/harness/transcript.test.d.ts +0 -2
  776. package/dist/lib/harness/transcript.test.d.ts.map +0 -1
  777. package/dist/lib/harness/transcript.test.js +0 -118
  778. package/dist/lib/harness/transcript.test.js.map +0 -1
  779. package/dist/lib/projects-registry.test.d.ts +0 -2
  780. package/dist/lib/projects-registry.test.d.ts.map +0 -1
  781. package/dist/lib/projects-registry.test.js +0 -176
  782. package/dist/lib/projects-registry.test.js.map +0 -1
  783. package/dist/lib/roster.test.d.ts +0 -15
  784. package/dist/lib/roster.test.d.ts.map +0 -1
  785. package/dist/lib/roster.test.js +0 -299
  786. package/dist/lib/roster.test.js.map +0 -1
  787. package/dist/lib/vault.test.d.ts +0 -17
  788. package/dist/lib/vault.test.d.ts.map +0 -1
  789. package/dist/lib/vault.test.js +0 -169
  790. package/dist/lib/vault.test.js.map +0 -1
  791. package/dist/lib/window-view.test.d.ts +0 -2
  792. package/dist/lib/window-view.test.d.ts.map +0 -1
  793. package/dist/lib/window-view.test.js +0 -168
  794. package/dist/lib/window-view.test.js.map +0 -1
  795. package/dist/standards/fail-loud-standard.md +0 -495
  796. package/dist/standards/known-issues-standard.md +0 -380
  797. package/dist/standards/rulings.md +0 -104
@@ -1,822 +0,0 @@
1
- /**
2
- * The G-7 proof artifact and its producer (#4864, #4851).
3
- *
4
- * WHAT THESE TESTS ARE FOR. `provenGuards` is the difference between "codex launches
5
- * with no guard enforced" and "codex launches". Before #4864 it was permanently empty
6
- * because nothing wrote it; the risk of writing it is the mirror image — a proof that
7
- * is accepted when it should not be. So the bulk of this file is refusals: every way an
8
- * artifact can be absent, malformed, foreign, out of date or unbacked by trust reads as
9
- * NOTHING PROVEN, which leaves the launch refusal exactly as it was.
10
- *
11
- * MUTATION CHECKS (each one verified to fail the named test when applied):
12
- * - drop the `currentSha !== artifact.hooksSha256` comparison in readGuardProof
13
- * → 'a proof of a DIFFERENT hooks.json is stale, not proof' fails.
14
- * - accept a `permittedExitCode` other than 0 in validateGuardProofShape
15
- * → 'an artifact whose permitted half was refused is not a proof' fails.
16
- * - drop the attribution check in proveCodexGuards
17
- * → 'exit 2 from the WRAPPER, not the guard, is not a proof' fails.
18
- * - drop the trust check in readGuardProof
19
- * → 'trust revoked after the proof reads as not proven' fails.
20
- */
21
- import { describe, it, expect, beforeEach, afterEach } from 'vitest';
22
- import { createHash } from 'crypto';
23
- import { chmodSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'fs';
24
- import { join } from 'path';
25
- import { tmpdir } from 'os';
26
- import { CODEX_HOOKS_FILENAME, PHASE1_PORTED_GUARDS, VERIFIED_CODEX_VERSION, buildCodexHooksJson, codexHookTrustKeysForDoc, readDeployedHooksDoc, } from '../lib/runtime/codex-config.js';
27
- import { GUARD_PROOF_FILENAME, GUARD_PROOF_VERSION, readGuardProof, runningCliVersion, serializeGuardProof, validateGuardProofShape, writeGuardProof, } from '../lib/runtime/codex-guard-proof.js';
28
- import { CodexAdapter } from '../lib/runtime/codex-adapter.js';
29
- import { proveCodexGuards } from '../commands/codex-prove-guards.js';
30
- const NOW = '2026-08-02T00:00:00Z';
31
- const CLI_ROOT = join(import.meta.dirname, '..', '..');
32
- /**
33
- * Where the real guard scripts come from.
34
- *
35
- * TRACKED first, generated second — and the order is the whole point. These tests read
36
- * `<repo>/.claude/hooks/` only, which exists in every agent worktree because the config
37
- * generator deploys it there. It is also GITIGNORED (`.gitignore:20` — `/.claude/`), so
38
- * a clean CI checkout does not have it: all 58 tests in this file threw
39
- * `ENOENT … copyfile '…/.claude/hooks/git-mutation-guard.sh'` on the #4871 merge commit
40
- * and turned main red, after passing locally, in QA and in security review — every one
41
- * of those ran inside a worktree where the generated directory was present.
42
- *
43
- * `mx-agent-system/agent-config/hooks/` is the tracked SOURCE the generator copies from,
44
- * so it is present in any checkout. `.claude/hooks/` stays as a fallback for the case
45
- * where the source directory moves without this constant moving with it; it is not the
46
- * preferred path and CI must never depend on it.
47
- */
48
- const TRACKED_HOOKS = join(CLI_ROOT, '..', 'agent-config', 'hooks');
49
- const GENERATED_HOOKS = join(CLI_ROOT, '..', '..', '.claude', 'hooks');
50
- /** First readable source for `script`, or a thrown error naming both places tried. */
51
- function guardSourcePath(script) {
52
- for (const dir of [TRACKED_HOOKS, GENERATED_HOOKS]) {
53
- const candidate = join(dir, script);
54
- if (existsSync(candidate))
55
- return candidate;
56
- }
57
- throw new Error(`guard script ${script} not found in the tracked source ${TRACKED_HOOKS} nor in the ` +
58
- `generated ${GENERATED_HOOKS}. The tracked directory is the one CI has; if it moved, ` +
59
- `update TRACKED_HOOKS rather than relying on the generated copy.`);
60
- }
61
- let worktree;
62
- let codexHome;
63
- /** Copy the real guard scripts in — the reader now hashes them (review MF1). */
64
- function deployGuardScripts() {
65
- mkdirSync(join(worktree, '.claude', 'hooks'), { recursive: true });
66
- for (const script of PHASE1_PORTED_GUARDS) {
67
- copyFileSync(guardSourcePath(script), join(worktree, '.claude', 'hooks', script));
68
- }
69
- }
70
- function scriptSha(guard) {
71
- return createHash('sha256')
72
- .update(readFileSync(join(worktree, '.claude', 'hooks', `${guard}.sh`)))
73
- .digest('hex');
74
- }
75
- /** Deploy the hooks file exactly as `mx-agent start --runtime codex` would. */
76
- function deployHooks() {
77
- mkdirSync(join(worktree, '.codex'), { recursive: true });
78
- writeFileSync(join(worktree, CODEX_HOOKS_FILENAME), buildCodexHooksJson({ worktreePath: worktree }));
79
- }
80
- function hooksSha() {
81
- return createHash('sha256').update(readFileSync(join(worktree, CODEX_HOOKS_FILENAME))).digest('hex');
82
- }
83
- /** Grant hook trust for every entry of the deployed file, plus project trust. */
84
- function grantTrust() {
85
- const hooksPath = join(worktree, CODEX_HOOKS_FILENAME);
86
- const keys = codexHookTrustKeysForDoc(hooksPath, readDeployedHooksDoc(worktree));
87
- mkdirSync(codexHome, { recursive: true });
88
- writeFileSync(join(codexHome, 'config.toml'), `[projects."${worktree}"]\ntrust_level = "trusted"\n\n` +
89
- keys.map((k) => `[hooks.state."${k}"]\nenabled = true\ntrusted_hash = "sha256:aa"\n`).join('\n'));
90
- }
91
- /**
92
- * The hashes `hooks/list` would report for this worktree's entries (#4876).
93
- *
94
- * `grantTrust` records `sha256:aa` for every key, so a HEALTHY observation is the same
95
- * value for the same keys — the fixture's stand-in for Codex agreeing with the config.
96
- * Passing this explicitly is the point: `proveCodexGuards` has no default, because a
97
- * proof that skipped the hash comparison would be the false green #4876 removes.
98
- */
99
- function observedHashes(over = {}) {
100
- const hooksPath = join(worktree, CODEX_HOOKS_FILENAME);
101
- const doc = readDeployedHooksDoc(worktree);
102
- // No deployed file → nothing observable. The tests that delete it assert the refusal
103
- // comes from the missing file, not from an exception in the fixture.
104
- const keys = doc ? codexHookTrustKeysForDoc(hooksPath, doc) : [];
105
- const map = new Map(keys.map((k) => [k, 'sha256:aa']));
106
- for (const [k, v] of Object.entries(over))
107
- map.set(k, v);
108
- return map;
109
- }
110
- const OBSERVED = (over) => ({
111
- kind: 'observed',
112
- hashes: observedHashes(over),
113
- source: 'test fixture',
114
- });
115
- function validArtifact(over = {}) {
116
- return {
117
- version: GUARD_PROOF_VERSION,
118
- hooksPath: join(worktree, CODEX_HOOKS_FILENAME),
119
- hooksSha256: hooksSha(),
120
- provenAt: NOW,
121
- codexVersion: VERIFIED_CODEX_VERSION,
122
- cliVersion: runningCliVersion(),
123
- guards: [
124
- {
125
- guard: 'git-mutation-guard',
126
- scriptPath: '.claude/hooks/git-mutation-guard.sh',
127
- scriptSha256: scriptSha('git-mutation-guard'),
128
- refusedStimulus: 'git reset --hard HEAD',
129
- refusedExitCode: 2,
130
- refusalAttribution: 'BLOCKED: destructive git operation',
131
- permittedStimulus: 'git status --short',
132
- permittedExitCode: 0,
133
- },
134
- {
135
- guard: 'named-memory-write-guard',
136
- scriptPath: '.claude/hooks/named-memory-write-guard.sh',
137
- scriptSha256: scriptSha('named-memory-write-guard'),
138
- refusedStimulus: 'mx memories update --name x --content "y"',
139
- refusedExitCode: 2,
140
- refusalAttribution: 'BLOCKED: truncating write to named memory',
141
- permittedStimulus: 'mx memories update --name x --content "…"',
142
- permittedExitCode: 0,
143
- stubbedDependency: 'mx memories get',
144
- },
145
- ],
146
- spawnGate: {
147
- refusedExitCode: 2,
148
- refusalAttribution: 'subagent spawning is unavailable under codex',
149
- unrelatedToolExitCode: 0,
150
- },
151
- ...over,
152
- };
153
- }
154
- /** Write raw bytes to the artifact path, bypassing validation. */
155
- function writeRaw(text) {
156
- mkdirSync(join(worktree, '.codex'), { recursive: true });
157
- writeFileSync(join(worktree, GUARD_PROOF_FILENAME), text);
158
- }
159
- const read = () => readGuardProof({ worktreePath: worktree, codexHome });
160
- beforeEach(() => {
161
- worktree = mkdtempSync(join(tmpdir(), 'mx-proof-wt-'));
162
- codexHome = join(worktree, 'fake-codex-home');
163
- deployHooks();
164
- deployGuardScripts();
165
- grantTrust();
166
- });
167
- afterEach(() => {
168
- rmSync(worktree, { recursive: true, force: true });
169
- });
170
- describe('readGuardProof — every unreadable state is NOTHING PROVEN', () => {
171
- it('a valid, current artifact proves exactly the guards it names', () => {
172
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
173
- const status = read();
174
- expect(status.valid).toBe(true);
175
- expect(status.provenGuards.sort()).toEqual(['git-mutation-guard', 'named-memory-write-guard']);
176
- // ATTRIBUTED, not asserted (review SF1): the line names the file it read and says
177
- // what that file is, instead of claiming this process watched the refusal.
178
- expect(status.detail).toContain('Per .codex/guard-proof.json');
179
- expect(status.detail).toContain('not a security boundary');
180
- expect(status.detail).not.toContain('observed refusing');
181
- // And it surfaces the weaker class of proof (review SF3).
182
- expect(status.detail).toContain('WEAKER PROOF for named-memory-write-guard');
183
- expect(status.detail).toContain('mx memories get');
184
- });
185
- it('NO artifact proves nothing, and names the command that would produce one', () => {
186
- const status = read();
187
- expect(status.provenGuards).toEqual([]);
188
- expect(status.valid).toBe(false);
189
- expect(status.detail).toContain('mx-agent codex prove-guards');
190
- });
191
- it('an artifact that is not JSON proves nothing', () => {
192
- writeRaw('{ not json');
193
- expect(read().provenGuards).toEqual([]);
194
- });
195
- it('an artifact that is not an object proves nothing', () => {
196
- writeRaw('[]');
197
- expect(read().provenGuards).toEqual([]);
198
- });
199
- /**
200
- * THE STALENESS PROPERTY. This is the one that stops a proof of the old
201
- * configuration authorising the new one: prove the guards, then change the hooks
202
- * file, and the proof is void until it is re-run.
203
- */
204
- it('a proof of a DIFFERENT hooks.json is stale, not proof', () => {
205
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
206
- expect(read().valid).toBe(true);
207
- writeFileSync(join(worktree, CODEX_HOOKS_FILENAME), `${readFileSync(join(worktree, CODEX_HOOKS_FILENAME), 'utf-8')} `);
208
- // Re-grant so the ONLY thing that changed for the reader is the hash.
209
- grantTrust();
210
- const status = read();
211
- expect(status.provenGuards).toEqual([]);
212
- expect(status.detail).toContain('STALE PROOF');
213
- });
214
- it('a hooks.json that cannot be read at all proves nothing', () => {
215
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
216
- rmSync(join(worktree, CODEX_HOOKS_FILENAME));
217
- expect(read().provenGuards).toEqual([]);
218
- });
219
- it('an artifact naming ANOTHER worktree\'s hooks file proves nothing here', () => {
220
- writeRaw(serializeGuardProof(validArtifact({ hooksPath: '/somewhere/else/.codex/hooks.json' })));
221
- const status = read();
222
- expect(status.provenGuards).toEqual([]);
223
- expect(status.detail).toContain('/somewhere/else/.codex/hooks.json');
224
- });
225
- it('an artifact from another codex version proves nothing', () => {
226
- writeRaw(serializeGuardProof(validArtifact({ codexVersion: '0.144.5' })));
227
- expect(read().provenGuards).toEqual([]);
228
- expect(read().detail).toContain('0.144.5');
229
- });
230
- it('trust revoked after the proof reads as not proven', () => {
231
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
232
- expect(read().valid).toBe(true);
233
- // Same artifact, same hooks file — only the human grant is gone. The guard would
234
- // not be invoked at all, so a current proof of its behaviour is not enough.
235
- writeFileSync(join(codexHome, 'config.toml'), `[projects."${worktree}"]\ntrust_level = "trusted"\n`);
236
- const status = read();
237
- expect(status.provenGuards).toEqual([]);
238
- expect(status.detail).toContain('hook-trust');
239
- });
240
- it('PARTIAL proof: one guard proven is one guard proven, and the gate stays shut', () => {
241
- const artifact = validArtifact();
242
- artifact.guards = [artifact.guards[0]];
243
- writeRaw(serializeGuardProof(artifact));
244
- const status = read();
245
- expect(status.provenGuards).toEqual(['git-mutation-guard']);
246
- // The adapter needs BOTH containment guards, so a partial proof still refuses.
247
- expect(new CodexAdapter({ projectRoot: '/repo', provenGuards: status.provenGuards }).guardsProven).toBe(false);
248
- });
249
- it('a full proof satisfies the adapter gate — the transition out of the refusal exists', () => {
250
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
251
- expect(new CodexAdapter({ projectRoot: '/repo', provenGuards: read().provenGuards }).guardsProven).toBe(true);
252
- });
253
- });
254
- describe('#4864 review — the gaps the security review found', () => {
255
- /**
256
- * MF1: the artifact bound sha256(hooks.json) and nothing else. hooks.json only NAMES
257
- * the script; the behaviour is in the script, and `.claude/hooks/` is writable from
258
- * inside a session. See also the executed pair at the end of this file.
259
- *
260
- * MUTATION CHECK: removing the scriptSha256 loop in readGuardProof fails these.
261
- */
262
- describe('MF1 — the proof is bound to the guard SCRIPTS, not only to hooks.json', () => {
263
- it('a changed guard script is a STALE PROOF, named by path', () => {
264
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
265
- expect(read().valid).toBe(true);
266
- writeFileSync(join(worktree, '.claude', 'hooks', 'git-mutation-guard.sh'), '#!/bin/bash\nexit 0\n');
267
- const status = read();
268
- expect(status.provenGuards).toEqual([]);
269
- expect(status.detail).toContain('STALE PROOF');
270
- expect(status.detail).toContain('.claude/hooks/git-mutation-guard.sh');
271
- });
272
- it('a MISSING guard script proves nothing', () => {
273
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
274
- rmSync(join(worktree, '.claude', 'hooks', 'named-memory-write-guard.sh'));
275
- expect(read().provenGuards).toEqual([]);
276
- expect(read().detail).toContain('named-memory-write-guard');
277
- });
278
- it('the recorded scriptPath cannot be pointed somewhere harmless', () => {
279
- // An artifact that named a file nobody runs would carry a hash that always
280
- // matches. The path is pinned to the guard's own script, so this is rejected at
281
- // validation rather than checked against the wrong file.
282
- const artifact = validArtifact();
283
- artifact.guards[0].scriptPath = '.claude/hooks/harmless.sh';
284
- expect(validateGuardProofShape(artifact)).not.toBeNull();
285
- writeRaw(serializeGuardProof(artifact));
286
- expect(read().provenGuards).toEqual([]);
287
- });
288
- it.each([
289
- ['an absolute path', '/etc/hostname'],
290
- ['a traversal', '../../.claude/hooks/git-mutation-guard.sh'],
291
- ])('rejects %s as a scriptPath', (_label, path) => {
292
- const artifact = validArtifact();
293
- artifact.guards[0].scriptPath = path;
294
- expect(validateGuardProofShape(artifact)).not.toBeNull();
295
- });
296
- });
297
- /**
298
- * MF3: the pin must void a proof taken against a different LIVE binary, not only one
299
- * that disagrees with the compiled constant.
300
- *
301
- * MUTATION CHECK: dropping the liveCodexVersion comparison fails the first of these.
302
- */
303
- describe('MF3 — the LIVE codex version, not only the compiled pin', () => {
304
- it('a live version different from the proven one voids the proof', () => {
305
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
306
- const status = readGuardProof({
307
- worktreePath: worktree,
308
- codexHome,
309
- liveCodexVersion: '0.146.0',
310
- });
311
- expect(status.provenGuards).toEqual([]);
312
- expect(status.detail).toContain('0.146.0');
313
- expect(status.detail).toContain('binary on PATH');
314
- });
315
- it('a live version equal to the proven one is accepted', () => {
316
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
317
- expect(readGuardProof({ worktreePath: worktree, codexHome, liveCodexVersion: VERIFIED_CODEX_VERSION }).valid).toBe(true);
318
- });
319
- });
320
- /**
321
- * SF4: the spawn gate's decision lives in the PATH-resolved mx-agent binary, not in
322
- * hooks.json, so a CLI change can alter proven behaviour with every hash matching.
323
- */
324
- it('SF4 — an artifact from a different CLI build voids the proof', () => {
325
- writeRaw(serializeGuardProof(validArtifact({ cliVersion: '0.1.262' })));
326
- const status = read();
327
- expect(status.provenGuards).toEqual([]);
328
- expect(status.detail).toContain('0.1.262');
329
- });
330
- /**
331
- * SF2: `lstat`, not `stat`. A symlinked artifact or hooks file would otherwise be
332
- * read through to its target and reported on as though the path held those bytes.
333
- */
334
- describe('SF2 — symlinks and non-regular files are refused, never followed', () => {
335
- it('a symlinked artifact is refused', () => {
336
- const real = join(worktree, 'elsewhere.json');
337
- writeFileSync(real, serializeGuardProof(validArtifact()));
338
- rmSync(join(worktree, GUARD_PROOF_FILENAME), { force: true });
339
- symlinkSync(real, join(worktree, GUARD_PROOF_FILENAME));
340
- const status = read();
341
- expect(status.provenGuards).toEqual([]);
342
- expect(status.detail).toContain('not a regular file');
343
- });
344
- it('a symlinked hooks.json proves nothing', () => {
345
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
346
- const hooksPath = join(worktree, CODEX_HOOKS_FILENAME);
347
- const real = join(worktree, 'elsewhere-hooks.json');
348
- writeFileSync(real, readFileSync(hooksPath));
349
- rmSync(hooksPath);
350
- symlinkSync(real, hooksPath);
351
- expect(read().provenGuards).toEqual([]);
352
- });
353
- it('a symlinked guard script proves nothing', () => {
354
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
355
- const scriptPath = join(worktree, '.claude', 'hooks', 'git-mutation-guard.sh');
356
- const real = join(worktree, 'elsewhere-guard.sh');
357
- writeFileSync(real, readFileSync(scriptPath));
358
- rmSync(scriptPath);
359
- symlinkSync(real, scriptPath);
360
- expect(read().provenGuards).toEqual([]);
361
- });
362
- it('writeGuardProof refuses to write through a symlink', () => {
363
- const real = join(worktree, 'target.json');
364
- writeFileSync(real, '{}');
365
- rmSync(join(worktree, GUARD_PROOF_FILENAME), { force: true });
366
- symlinkSync(real, join(worktree, GUARD_PROOF_FILENAME));
367
- expect(() => writeGuardProof({ worktreePath: worktree, artifact: validArtifact() })).toThrow(/not a regular file/);
368
- expect(readFileSync(real, 'utf-8')).toBe('{}');
369
- });
370
- });
371
- });
372
- /**
373
- * MF2 — the evaluation that CONTROLS the launch must postdate the last write.
374
- *
375
- * `runStart` read the proof to construct the adapter and rewrote `.codex/hooks.json`
376
- * later in the same run, so the gate decided on a snapshot taken before the file it
377
- * was about was last written — and `launch()`'s second `assertLaunchAllowed` call
378
- * replayed that same snapshot rather than checking again.
379
- *
380
- * These use the adapter directly with a real reader, so what is pinned is the property
381
- * (the gate re-reads) rather than a call count.
382
- *
383
- * MUTATION CHECK: deleting `this.refreshGuardProof(ctx.worktreePath)` from
384
- * assertLaunchAllowed makes 'a proof invalidated AFTER construction refuses at the
385
- * gate' fail.
386
- */
387
- describe('MF2 — the launch gate re-reads the proof, it does not remember it', () => {
388
- const reader = (wt) => {
389
- const status = readGuardProof({ worktreePath: wt, codexHome });
390
- return { provenGuards: status.provenGuards, detail: status.detail };
391
- };
392
- /**
393
- * `assertLaunchAllowed` checks project trust through the adapter's default codexHome
394
- * ($HOME/.codex), so the same grant has to be visible there.
395
- */
396
- let oldHome;
397
- beforeEach(() => {
398
- oldHome = process.env.HOME;
399
- const fakeHome = join(worktree, 'home');
400
- mkdirSync(join(fakeHome, '.codex'), { recursive: true });
401
- writeFileSync(join(fakeHome, '.codex', 'config.toml'), readFileSync(join(codexHome, 'config.toml')));
402
- process.env.HOME = fakeHome;
403
- });
404
- afterEach(() => {
405
- if (oldHome === undefined)
406
- delete process.env.HOME;
407
- else
408
- process.env.HOME = oldHome;
409
- });
410
- function adapterWithReader() {
411
- return new CodexAdapter({
412
- projectRoot: '/repo',
413
- // The stale snapshot a caller might construct with. The gate must not trust it.
414
- provenGuards: ['git-mutation-guard', 'named-memory-write-guard'],
415
- readGuardProof: reader,
416
- });
417
- }
418
- it('a proof invalidated AFTER construction refuses at the gate', () => {
419
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
420
- const adapter = adapterWithReader();
421
- expect(adapter.guardsProven).toBe(true); // constructor snapshot
422
- // Exactly what deployConfig does later in runStart: rewrite the hooks file.
423
- writeFileSync(join(worktree, CODEX_HOOKS_FILENAME), `${readFileSync(join(worktree, CODEX_HOOKS_FILENAME), 'utf-8')} `);
424
- expect(() => adapter.assertLaunchAllowed({ worktreePath: worktree })).toThrow(/gate G-7 is unpassed/);
425
- expect(adapter.guardsProven).toBe(false);
426
- });
427
- /**
428
- * SF5 — the refusal has to name the binding that broke. `refreshGuardProof` has just
429
- * computed the precise reason; throwing a generic message discards it, and the
430
- * operator is left with a banner from the earlier read (possibly green) followed by
431
- * a refusal that says only "G-7 is unpassed".
432
- *
433
- * MUTATION CHECK: dropping the `this.guardProofDetail` interpolation from the throw
434
- * makes this fail.
435
- */
436
- it('the refusal NAMES the binding that broke, not just that the gate is shut', () => {
437
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
438
- const adapter = adapterWithReader();
439
- writeFileSync(join(worktree, CODEX_HOOKS_FILENAME), `${readFileSync(join(worktree, CODEX_HOOKS_FILENAME), 'utf-8')} `);
440
- let message = '';
441
- try {
442
- adapter.assertLaunchAllowed({ worktreePath: worktree });
443
- }
444
- catch (err) {
445
- message = err instanceof Error ? err.message : String(err);
446
- }
447
- expect(message).toContain('gate G-7 is unpassed');
448
- // The specific cause, and enough of it to act on.
449
- expect(message).toContain('STALE PROOF');
450
- expect(message).toContain(CODEX_HOOKS_FILENAME);
451
- expect(message).toContain('prove-guards');
452
- });
453
- it('names a CHANGED GUARD SCRIPT in the refusal too, not only a stale hooks hash', () => {
454
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
455
- const adapter = adapterWithReader();
456
- writeFileSync(join(worktree, '.claude', 'hooks', 'git-mutation-guard.sh'), '#!/bin/bash\nexit 0\n');
457
- let message = '';
458
- try {
459
- adapter.assertLaunchAllowed({ worktreePath: worktree });
460
- }
461
- catch (err) {
462
- message = err instanceof Error ? err.message : String(err);
463
- }
464
- expect(message).toContain('.claude/hooks/git-mutation-guard.sh');
465
- });
466
- it('a guard neutered after construction refuses at the gate', () => {
467
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
468
- const adapter = adapterWithReader();
469
- writeFileSync(join(worktree, '.claude', 'hooks', 'git-mutation-guard.sh'), '#!/bin/bash\nexit 0\n');
470
- expect(() => adapter.assertLaunchAllowed({ worktreePath: worktree })).toThrow(/gate G-7 is unpassed/);
471
- });
472
- it('EVERY gate call re-reads — a proof restored between calls is seen', () => {
473
- const adapter = adapterWithReader();
474
- // No artifact yet: the gate refuses despite the constructor's optimistic list.
475
- expect(() => adapter.assertLaunchAllowed({ worktreePath: worktree })).toThrow(/gate G-7 is unpassed/);
476
- writeGuardProof({ worktreePath: worktree, artifact: validArtifact() });
477
- expect(() => adapter.assertLaunchAllowed({ worktreePath: worktree })).not.toThrow();
478
- expect(adapter.guardsProven).toBe(true);
479
- });
480
- it('the banner detail follows the latest read, not the constructor', () => {
481
- const adapter = adapterWithReader();
482
- try {
483
- adapter.assertLaunchAllowed({ worktreePath: worktree });
484
- }
485
- catch {
486
- // Expected: no artifact exists yet.
487
- }
488
- const notices = adapter.bannerNotices().join('\n');
489
- expect(notices).toContain('NO guard hook is proven enforced');
490
- expect(notices).toContain('prove-guards');
491
- });
492
- });
493
- describe('validateGuardProofShape — strict, and any malformed part voids the whole', () => {
494
- const cases = [
495
- ['a version this reader does not implement', { version: 2 }],
496
- ['a sha that is not 64 hex chars', { hooksSha256: 'deadbeef' }],
497
- ['an uppercase sha (not the digest form written)', { hooksSha256: 'A'.repeat(64) }],
498
- ['a provenAt that is not an ISO-8601 UTC stamp', { provenAt: 'yesterday' }],
499
- ['an empty guards list', { guards: [] }],
500
- [
501
- 'a guard name outside the Phase 1 set',
502
- (a) => {
503
- a.guards[0].guard = 'invented-guard';
504
- },
505
- ],
506
- [
507
- 'the same guard listed twice',
508
- (a) => {
509
- a.guards = [a.guards[0], a.guards[0]];
510
- },
511
- ],
512
- [
513
- 'a refused half that did not exit 2',
514
- (a) => {
515
- a.guards[0].refusedExitCode = 0;
516
- },
517
- ],
518
- [
519
- 'a permitted half that was refused',
520
- (a) => {
521
- a.guards[0].permittedExitCode = 2;
522
- },
523
- ],
524
- [
525
- 'an unattributed refusal',
526
- (a) => {
527
- a.guards[0].refusalAttribution = '';
528
- },
529
- ],
530
- [
531
- 'a junk entry alongside a real one',
532
- (a) => {
533
- a.guards.push({ guard: 'git-mutation-guard' });
534
- },
535
- ],
536
- ['no spawn-gate observation', { spawnGate: undefined }],
537
- [
538
- 'a spawn gate that also refused unrelated tools',
539
- (a) => {
540
- a.spawnGate.unrelatedToolExitCode = 2;
541
- },
542
- ],
543
- ];
544
- it.each(cases)('rejects %s', (_label, mutation) => {
545
- const artifact = validArtifact();
546
- if (typeof mutation === 'function')
547
- mutation(artifact);
548
- else
549
- Object.assign(artifact, mutation);
550
- expect(validateGuardProofShape(artifact)).not.toBeNull();
551
- writeRaw(serializeGuardProof(artifact));
552
- expect(read().provenGuards).toEqual([]);
553
- });
554
- it('an artifact whose permitted half was refused is not a proof', () => {
555
- const artifact = validArtifact();
556
- artifact.guards[0].permittedExitCode = 2;
557
- writeRaw(serializeGuardProof(artifact));
558
- expect(read().provenGuards).toEqual([]);
559
- });
560
- it('writeGuardProof refuses to write what its own reader would reject', () => {
561
- expect(() => writeGuardProof({ worktreePath: worktree, artifact: validArtifact({ hooksSha256: 'nope' }) })).toThrow(/refusing to write an invalid/);
562
- expect(existsSync(join(worktree, GUARD_PROOF_FILENAME))).toBe(false);
563
- });
564
- });
565
- describe('proveCodexGuards — the artifact is only written on an OBSERVED refusal', () => {
566
- const GUARD_MARKERS = {
567
- 'git-mutation-guard.sh': 'BLOCKED: destructive git operation',
568
- 'named-memory-write-guard.sh': 'BLOCKED: truncating write to named memory',
569
- };
570
- const GATE_MARKER = 'subagent spawning is unavailable under codex';
571
- /**
572
- * A fake runtime that behaves the way a healthy configuration does. Each test then
573
- * breaks exactly one thing, so the assertion names the cause it is about.
574
- */
575
- function runner(over = {}) {
576
- return (command, payload) => {
577
- const parsed = JSON.parse(payload);
578
- const isGate = command.includes('internal-codex-agent-gate');
579
- if (isGate) {
580
- if (parsed.tool_name === 'spawn_agent') {
581
- return { status: over.gateStatus ?? 2, stderr: over.gateStderr ?? GATE_MARKER };
582
- }
583
- return { status: over.unrelatedStatus ?? 0, stderr: '' };
584
- }
585
- const script = Object.keys(GUARD_MARKERS).find((s) => command.includes(s));
586
- const forbidden = (parsed.tool_input.command ?? '').includes('reset --hard') ||
587
- (parsed.tool_input.command ?? '').includes('--content "x"');
588
- if (!forbidden)
589
- return { status: over.permittedStatus ?? 0, stderr: '' };
590
- return {
591
- status: over.guardStatus ?? 2,
592
- stderr: over.guardStderr ?? GUARD_MARKERS[script],
593
- };
594
- };
595
- }
596
- const prove = (r) => proveCodexGuards({
597
- worktreePath: worktree,
598
- codexHome,
599
- now: NOW,
600
- codexVersion: VERIFIED_CODEX_VERSION,
601
- hashes: OBSERVED(),
602
- runner: r,
603
- env: { PATH: process.env.PATH ?? '', HOME: worktree },
604
- });
605
- it('writes an artifact the reader accepts, bound to the file it proved', () => {
606
- const result = prove(runner());
607
- expect(result.ok).toBe(true);
608
- expect(result.proven.sort()).toEqual(['git-mutation-guard', 'named-memory-write-guard']);
609
- const status = read();
610
- expect(status.valid).toBe(true);
611
- const artifact = JSON.parse(readFileSync(join(worktree, GUARD_PROOF_FILENAME), 'utf-8'));
612
- expect(artifact.hooksSha256).toBe(hooksSha());
613
- expect(artifact.provenAt).toBe(NOW);
614
- });
615
- it('a guard that ALLOWS the forbidden command writes nothing', () => {
616
- const result = prove(runner({ guardStatus: 0 }));
617
- expect(result.ok).toBe(false);
618
- expect(result.lines.join('\n')).toContain('DID NOT REFUSE');
619
- expect(existsSync(join(worktree, GUARD_PROOF_FILENAME))).toBe(false);
620
- });
621
- /**
622
- * The wrapper refuses too — with `BLOCKED: mx-agent containment guard … could not be
623
- * resolved` — and that refusal means the guard was NEVER REACHED. Exit 2 alone
624
- * cannot tell the two apart, which is why attribution is required (#4851).
625
- */
626
- it('exit 2 from the WRAPPER, not the guard, is not a proof', () => {
627
- const result = prove(runner({ guardStderr: 'BLOCKED: mx-agent containment guard could not be resolved.' }));
628
- expect(result.ok).toBe(false);
629
- expect(result.lines.join('\n')).toContain('cannot be attributed to the guard');
630
- expect(existsSync(join(worktree, GUARD_PROOF_FILENAME))).toBe(false);
631
- });
632
- it('a guard that refuses the PERMITTED command writes nothing — both halves are required', () => {
633
- const result = prove(runner({ permittedStatus: 2 }));
634
- expect(result.ok).toBe(false);
635
- expect(result.lines.join('\n')).toContain('blocks everything is not a control');
636
- });
637
- it('a spawn gate that allows a spawn writes nothing', () => {
638
- const result = prove(runner({ gateStatus: 0 }));
639
- expect(result.ok).toBe(false);
640
- expect(result.lines.join('\n')).toContain('spawn gate did not refuse');
641
- });
642
- it('a spawn gate that refuses unrelated tools writes nothing', () => {
643
- const result = prove(runner({ unrelatedStatus: 2 }));
644
- expect(result.ok).toBe(false);
645
- expect(result.lines.join('\n')).toContain('refused an unrelated Bash call');
646
- });
647
- it('refuses when Codex would not RUN the hooks (trust ungranted)', () => {
648
- writeFileSync(join(codexHome, 'config.toml'), `[projects."${worktree}"]\ntrust_level = "trusted"\n`);
649
- const result = prove(runner());
650
- expect(result.ok).toBe(false);
651
- expect(result.lines.join('\n')).toContain('would not RUN these hooks');
652
- expect(existsSync(join(worktree, GUARD_PROOF_FILENAME))).toBe(false);
653
- });
654
- it('refuses when there is no deployed hooks.json to prove', () => {
655
- rmSync(join(worktree, CODEX_HOOKS_FILENAME));
656
- expect(prove(runner()).ok).toBe(false);
657
- });
658
- /**
659
- * #4876. A proof is a statement that Codex would RUN these hooks. A `trusted_hash`
660
- * bound to bytes that changed is one Codex ignores — silently — so proving that the
661
- * entry's command refuses would prove nothing about a live session.
662
- *
663
- * MUTATION CHECK: drop the hash comparison in `codexHookTrustPreconditions` and this
664
- * test fails. Every pre-#4876 check still passes here: the record is present, enabled
665
- * and carries a non-empty hash.
666
- */
667
- it('refuses to record a proof when a granted hash is STALE', () => {
668
- const keys = codexHookTrustKeysForDoc(join(worktree, CODEX_HOOKS_FILENAME), readDeployedHooksDoc(worktree));
669
- const result = proveCodexGuards({
670
- worktreePath: worktree,
671
- codexHome,
672
- now: NOW,
673
- codexVersion: VERIFIED_CODEX_VERSION,
674
- // Codex reports a DIFFERENT hash for one entry than the config records.
675
- hashes: OBSERVED({ [keys[0]]: 'sha256:bb' }),
676
- runner: runner(),
677
- env: { PATH: process.env.PATH ?? '', HOME: worktree },
678
- });
679
- expect(result.ok).toBe(false);
680
- expect(result.lines.join('\n')).toContain('STALE');
681
- expect(result.lines.join('\n')).toContain(keys[0]);
682
- expect(existsSync(join(worktree, GUARD_PROOF_FILENAME))).toBe(false);
683
- });
684
- /**
685
- * The hashes are unreadable — `codex app-server` did not answer, the project is
686
- * untrusted, the method changed shape. That is not permission to fall back to the
687
- * presence check: a gate that cannot run must refuse.
688
- */
689
- it('refuses when Codex\'s own hashes could not be read at all', () => {
690
- const result = proveCodexGuards({
691
- worktreePath: worktree,
692
- codexHome,
693
- now: NOW,
694
- codexVersion: VERIFIED_CODEX_VERSION,
695
- hashes: { kind: 'unavailable', reason: 'app-server produced no response' },
696
- runner: runner(),
697
- env: { PATH: process.env.PATH ?? '', HOME: worktree },
698
- });
699
- expect(result.ok).toBe(false);
700
- expect(result.lines.join('\n')).toContain('unverifiable grant');
701
- expect(result.lines.join('\n')).toContain('app-server produced no response');
702
- expect(existsSync(join(worktree, GUARD_PROOF_FILENAME))).toBe(false);
703
- });
704
- it('refuses a hooks.json this CLI did not generate — no blessing hand edits', () => {
705
- const text = readFileSync(join(worktree, CODEX_HOOKS_FILENAME), 'utf-8');
706
- writeFileSync(join(worktree, CODEX_HOOKS_FILENAME), text.replace('"description"', '"Description"'));
707
- grantTrust();
708
- const result = prove(runner());
709
- expect(result.ok).toBe(false);
710
- expect(result.lines.join('\n')).toContain('does not match what this CLI generates');
711
- });
712
- it('leaves an existing artifact untouched when a later probe fails', () => {
713
- prove(runner());
714
- const before = readFileSync(join(worktree, GUARD_PROOF_FILENAME), 'utf-8');
715
- const result = prove(runner({ gateStatus: 0 }));
716
- expect(result.ok).toBe(false);
717
- expect(readFileSync(join(worktree, GUARD_PROOF_FILENAME), 'utf-8')).toBe(before);
718
- });
719
- });
720
- /**
721
- * ─── EXECUTED, not mocked ──────────────────────────────────────────────────────
722
- *
723
- * The tests above prove the decision logic. This one proves the thing the decision
724
- * logic is about: the REAL guard scripts, invoked through the REAL generated wrapper,
725
- * by the REAL default runner. A mocked positive control is a positive control that has
726
- * never been observed to fire — which is the defect this whole change exists to remove.
727
- *
728
- * The spawn gate is exercised through a `mx-agent` shim pointing at the built CLI, the
729
- * same lift codex-agent-gate.test.ts uses.
730
- */
731
- describe('proveCodexGuards — executed against the shipped guards and gate', () => {
732
- let shimDir;
733
- beforeEach(() => {
734
- // Guard scripts are already on disk from the outer beforeEach (the wrapper looks
735
- // for them there, and the reader hashes them).
736
- shimDir = mkdtempSync(join(tmpdir(), 'mx-proof-bin-'));
737
- const binary = join(CLI_ROOT, 'dist', 'index.js');
738
- expect(existsSync(binary)).toBe(true); // CI builds before testing (binary-smoke.test.ts)
739
- writeFileSync(join(shimDir, 'mx-agent'), `#!/bin/bash\nexec node ${binary} "$@"\n`, { mode: 0o755 });
740
- chmodSync(join(shimDir, 'mx-agent'), 0o755);
741
- });
742
- afterEach(() => {
743
- rmSync(shimDir, { recursive: true, force: true });
744
- });
745
- it('observes both guards and the gate refusing, and records it', () => {
746
- const result = proveCodexGuards({
747
- worktreePath: worktree,
748
- codexHome,
749
- now: NOW,
750
- codexVersion: VERIFIED_CODEX_VERSION,
751
- hashes: OBSERVED(),
752
- env: { PATH: `${shimDir}:${process.env.PATH ?? ''}`, HOME: worktree },
753
- });
754
- expect(result.lines.join('\n')).toContain('✓ git-mutation-guard');
755
- expect(result.ok).toBe(true);
756
- expect(result.proven.sort()).toEqual(['git-mutation-guard', 'named-memory-write-guard']);
757
- expect(read().valid).toBe(true);
758
- });
759
- it('a guard script that is absent is refused before anything is probed', () => {
760
- rmSync(join(worktree, '.claude', 'hooks', 'git-mutation-guard.sh'));
761
- const result = proveCodexGuards({
762
- worktreePath: worktree,
763
- codexHome,
764
- now: NOW,
765
- codexVersion: VERIFIED_CODEX_VERSION,
766
- hashes: OBSERVED(),
767
- env: { PATH: `${shimDir}:${process.env.PATH ?? ''}`, HOME: worktree },
768
- });
769
- // There is no script to hash, so there is nothing to prove. (Before the script
770
- // hash existed this reached the probe, where the WRAPPER's fail-closed exit 2
771
- // would have been mistaken for the guard refusing had attribution not caught it.)
772
- expect(result.ok).toBe(false);
773
- expect(result.lines.join('\n')).toContain('there is no guard');
774
- expect(existsSync(join(worktree, GUARD_PROOF_FILENAME))).toBe(false);
775
- });
776
- /**
777
- * MF1, EXECUTED. `.claude/hooks/` is writable from inside a Codex session — the
778
- * runtime read-only-binds `.git`, `.agents` and `.codex`, and nothing else. So the
779
- * script that carries the behaviour can be replaced while every byte the earlier
780
- * revision hashed stays untouched.
781
- */
782
- it('a NEUTERED guard script is not recorded as proven', () => {
783
- writeFileSync(join(worktree, '.claude', 'hooks', 'git-mutation-guard.sh'), '#!/bin/bash\nexit 0\n');
784
- const result = proveCodexGuards({
785
- worktreePath: worktree,
786
- codexHome,
787
- now: NOW,
788
- codexVersion: VERIFIED_CODEX_VERSION,
789
- hashes: OBSERVED(),
790
- env: { PATH: `${shimDir}:${process.env.PATH ?? ''}`, HOME: worktree },
791
- });
792
- expect(result.ok).toBe(false);
793
- expect(result.lines.join('\n')).toContain('DID NOT REFUSE');
794
- expect(existsSync(join(worktree, GUARD_PROOF_FILENAME))).toBe(false);
795
- });
796
- /**
797
- * MF1's headline case, EXECUTED end to end: prove honestly, THEN neuter the script.
798
- * Before the script hash, this artifact stayed valid and the banner still reported a
799
- * guard that refused nothing.
800
- *
801
- * MUTATION CHECK: dropping the scriptSha256 comparison in readGuardProof makes this
802
- * fail.
803
- */
804
- it('neutering a guard AFTER an honest proof voids that proof', () => {
805
- const proved = proveCodexGuards({
806
- worktreePath: worktree,
807
- codexHome,
808
- now: NOW,
809
- codexVersion: VERIFIED_CODEX_VERSION,
810
- hashes: OBSERVED(),
811
- env: { PATH: `${shimDir}:${process.env.PATH ?? ''}`, HOME: worktree },
812
- });
813
- expect(proved.ok).toBe(true);
814
- expect(read().valid).toBe(true);
815
- writeFileSync(join(worktree, '.claude', 'hooks', 'git-mutation-guard.sh'), '#!/bin/bash\nexit 0\n');
816
- const status = read();
817
- expect(status.provenGuards).toEqual([]);
818
- expect(status.detail).toContain('STALE PROOF');
819
- expect(status.detail).toContain('.claude/hooks/git-mutation-guard.sh');
820
- });
821
- });
822
- //# sourceMappingURL=runtime-codex-guard-proof.test.js.map