@lannguyensi/harness 0.64.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (710) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +46 -42
  3. package/dist/cli/add/index.js +17 -21
  4. package/dist/cli/add/index.js.map +1 -1
  5. package/dist/cli/adopt/derive.d.ts +2 -2
  6. package/dist/cli/adopt/derive.js +2 -19
  7. package/dist/cli/adopt/derive.js.map +1 -1
  8. package/dist/cli/adopt/index.d.ts +1 -1
  9. package/dist/cli/adopt/index.js +1 -12
  10. package/dist/cli/adopt/index.js.map +1 -1
  11. package/dist/cli/apply/apply.d.ts +20 -35
  12. package/dist/cli/apply/apply.js +61 -136
  13. package/dist/cli/apply/apply.js.map +1 -1
  14. package/dist/cli/apply/generate-codex-config.js +10 -58
  15. package/dist/cli/apply/generate-codex-config.js.map +1 -1
  16. package/dist/cli/apply/generate-memory-index.js +1 -2
  17. package/dist/cli/apply/generate-memory-index.js.map +1 -1
  18. package/dist/cli/apply/generate-opencode-config.d.ts +2 -10
  19. package/dist/cli/apply/generate-opencode-config.js +74 -113
  20. package/dist/cli/apply/generate-opencode-config.js.map +1 -1
  21. package/dist/cli/apply/generate-settings.d.ts +11 -64
  22. package/dist/cli/apply/generate-settings.js +27 -132
  23. package/dist/cli/apply/generate-settings.js.map +1 -1
  24. package/dist/cli/apply/index.d.ts +1 -1
  25. package/dist/cli/apply/index.js +1 -1
  26. package/dist/cli/apply/index.js.map +1 -1
  27. package/dist/cli/apply/install-codex-config.d.ts +153 -1
  28. package/dist/cli/apply/install-codex-config.js +445 -70
  29. package/dist/cli/apply/install-codex-config.js.map +1 -1
  30. package/dist/cli/apply/next-steps.d.ts +7 -0
  31. package/dist/cli/apply/next-steps.js +13 -1
  32. package/dist/cli/apply/next-steps.js.map +1 -1
  33. package/dist/cli/bounded-stdin.d.ts +0 -23
  34. package/dist/cli/bounded-stdin.js +2 -49
  35. package/dist/cli/bounded-stdin.js.map +1 -1
  36. package/dist/cli/describe.d.ts +1 -1
  37. package/dist/cli/describe.js +0 -3
  38. package/dist/cli/describe.js.map +1 -1
  39. package/dist/cli/diff/engine.d.ts +0 -11
  40. package/dist/cli/diff/engine.js +1 -17
  41. package/dist/cli/diff/engine.js.map +1 -1
  42. package/dist/cli/diff/index.js +14 -25
  43. package/dist/cli/diff/index.js.map +1 -1
  44. package/dist/cli/doctor/claude-mcp.d.ts +4 -19
  45. package/dist/cli/doctor/claude-mcp.js +11 -22
  46. package/dist/cli/doctor/claude-mcp.js.map +1 -1
  47. package/dist/cli/doctor/codex.d.ts +12 -14
  48. package/dist/cli/doctor/codex.js +31 -144
  49. package/dist/cli/doctor/codex.js.map +1 -1
  50. package/dist/cli/doctor/format.js +23 -345
  51. package/dist/cli/doctor/format.js.map +1 -1
  52. package/dist/cli/doctor/hook-liveness.d.ts +56 -0
  53. package/dist/cli/doctor/hook-liveness.js +455 -0
  54. package/dist/cli/doctor/hook-liveness.js.map +1 -0
  55. package/dist/cli/doctor/index.d.ts +13 -87
  56. package/dist/cli/doctor/index.js +57 -713
  57. package/dist/cli/doctor/index.js.map +1 -1
  58. package/dist/cli/doctor/opencode.d.ts +2 -1
  59. package/dist/cli/doctor/opencode.js.map +1 -1
  60. package/dist/cli/doctor/types.d.ts +21 -387
  61. package/dist/cli/doctor/types.js.map +1 -1
  62. package/dist/cli/drain-stdio.d.ts +31 -0
  63. package/dist/cli/drain-stdio.js +76 -0
  64. package/dist/cli/drain-stdio.js.map +1 -0
  65. package/dist/cli/export.d.ts +3 -1
  66. package/dist/cli/export.js +7 -16
  67. package/dist/cli/export.js.map +1 -1
  68. package/dist/cli/gate/codex-disable.d.ts +29 -0
  69. package/dist/cli/gate/codex-disable.js +195 -0
  70. package/dist/cli/gate/codex-disable.js.map +1 -0
  71. package/dist/cli/gate/codex-enable.d.ts +41 -0
  72. package/dist/cli/gate/codex-enable.js +127 -0
  73. package/dist/cli/gate/codex-enable.js.map +1 -0
  74. package/dist/cli/gate/codex-snapshot.d.ts +208 -0
  75. package/dist/cli/gate/codex-snapshot.js +402 -0
  76. package/dist/cli/gate/codex-snapshot.js.map +1 -0
  77. package/dist/cli/gate/disable.d.ts +9 -0
  78. package/dist/cli/gate/disable.js +263 -28
  79. package/dist/cli/gate/disable.js.map +1 -1
  80. package/dist/cli/gate/enable.d.ts +26 -6
  81. package/dist/cli/gate/enable.js +152 -80
  82. package/dist/cli/gate/enable.js.map +1 -1
  83. package/dist/cli/gate/link-chain.d.ts +53 -0
  84. package/dist/cli/gate/link-chain.js +122 -0
  85. package/dist/cli/gate/link-chain.js.map +1 -0
  86. package/dist/cli/gate/snapshot.d.ts +289 -12
  87. package/dist/cli/gate/snapshot.js +481 -22
  88. package/dist/cli/gate/snapshot.js.map +1 -1
  89. package/dist/cli/index.d.ts +0 -9
  90. package/dist/cli/index.js +9 -2131
  91. package/dist/cli/index.js.map +1 -1
  92. package/dist/cli/init/composer.d.ts +3 -6
  93. package/dist/cli/init/composer.js +6 -370
  94. package/dist/cli/init/composer.js.map +1 -1
  95. package/dist/cli/init/dependencies.d.ts +1 -2
  96. package/dist/cli/init/dependencies.js +4 -80
  97. package/dist/cli/init/dependencies.js.map +1 -1
  98. package/dist/cli/init/detect.js +5 -4
  99. package/dist/cli/init/detect.js.map +1 -1
  100. package/dist/cli/init/interactive.d.ts +1 -23
  101. package/dist/cli/init/interactive.js +33 -247
  102. package/dist/cli/init/interactive.js.map +1 -1
  103. package/dist/cli/init/profiles.d.ts +2 -2
  104. package/dist/cli/init/profiles.js +51 -245
  105. package/dist/cli/init/profiles.js.map +1 -1
  106. package/dist/cli/init/templates.d.ts +2 -37
  107. package/dist/cli/init/templates.js +25 -1237
  108. package/dist/cli/init/templates.js.map +1 -1
  109. package/dist/cli/list.d.ts +1 -1
  110. package/dist/cli/list.js +1 -38
  111. package/dist/cli/list.js.map +1 -1
  112. package/dist/cli/loader.d.ts +15 -1
  113. package/dist/cli/loader.js +56 -39
  114. package/dist/cli/loader.js.map +1 -1
  115. package/dist/cli/main.js +7 -2
  116. package/dist/cli/main.js.map +1 -1
  117. package/dist/cli/migrate-home/index.js +2 -2
  118. package/dist/cli/migrate-home/index.js.map +1 -1
  119. package/dist/cli/pack/add.js +1 -1
  120. package/dist/cli/pack/add.js.map +1 -1
  121. package/dist/cli/pack/hook-bootstrap.d.ts +5 -164
  122. package/dist/cli/pack/hook-bootstrap.js +15 -291
  123. package/dist/cli/pack/hook-bootstrap.js.map +1 -1
  124. package/dist/cli/pack/hook-branch-protection.d.ts +28 -21
  125. package/dist/cli/pack/hook-branch-protection.js +365 -340
  126. package/dist/cli/pack/hook-branch-protection.js.map +1 -1
  127. package/dist/cli/pack/index.d.ts +0 -1
  128. package/dist/cli/pack/index.js +0 -1
  129. package/dist/cli/pack/index.js.map +1 -1
  130. package/dist/cli/pack/list.js +1 -6
  131. package/dist/cli/pack/list.js.map +1 -1
  132. package/dist/cli/pack/mutate.d.ts +7 -9
  133. package/dist/cli/pack/mutate.js +6 -9
  134. package/dist/cli/pack/mutate.js.map +1 -1
  135. package/dist/cli/pack/reseed.d.ts +2 -2
  136. package/dist/cli/pack/reseed.js +16 -22
  137. package/dist/cli/pack/reseed.js.map +1 -1
  138. package/dist/cli/{delegate/register.d.ts → register-gate-group.d.ts} +1 -1
  139. package/dist/cli/register-gate-group.js +348 -0
  140. package/dist/cli/register-gate-group.js.map +1 -0
  141. package/dist/cli/register-inspect-group.d.ts +6 -0
  142. package/dist/cli/register-inspect-group.js +189 -0
  143. package/dist/cli/register-inspect-group.js.map +1 -0
  144. package/dist/cli/register-operator-lifecycle.d.ts +1 -1
  145. package/dist/cli/register-operator-lifecycle.js +3 -100
  146. package/dist/cli/register-operator-lifecycle.js.map +1 -1
  147. package/dist/cli/register-pack-group.d.ts +5 -0
  148. package/dist/cli/register-pack-group.js +134 -0
  149. package/dist/cli/register-pack-group.js.map +1 -0
  150. package/dist/cli/{register-audit-group.d.ts → register-setup-group.d.ts} +1 -1
  151. package/dist/cli/register-setup-group.js +495 -0
  152. package/dist/cli/register-setup-group.js.map +1 -0
  153. package/dist/cli/remove/index.d.ts +0 -14
  154. package/dist/cli/remove/index.js +2 -115
  155. package/dist/cli/remove/index.js.map +1 -1
  156. package/dist/cli/remove/mutate.d.ts +0 -2
  157. package/dist/cli/remove/mutate.js +1 -19
  158. package/dist/cli/remove/mutate.js.map +1 -1
  159. package/dist/cli/remove/register.js +2 -19
  160. package/dist/cli/remove/register.js.map +1 -1
  161. package/dist/cli/shell-quote.d.ts +7 -0
  162. package/dist/cli/shell-quote.js +17 -0
  163. package/dist/cli/shell-quote.js.map +1 -0
  164. package/dist/cli/uninstall/index.d.ts +4 -2
  165. package/dist/cli/uninstall/index.js +15 -7
  166. package/dist/cli/uninstall/index.js.map +1 -1
  167. package/dist/cli/uninstall/register.js +6 -4
  168. package/dist/cli/uninstall/register.js.map +1 -1
  169. package/dist/cli/uninstall/snapshot.d.ts +15 -0
  170. package/dist/cli/uninstall/snapshot.js +38 -0
  171. package/dist/cli/uninstall/snapshot.js.map +1 -1
  172. package/dist/cli/validate/checks.d.ts +0 -77
  173. package/dist/cli/validate/checks.js +3 -1049
  174. package/dist/cli/validate/checks.js.map +1 -1
  175. package/dist/cli/validate/index.js +19 -15
  176. package/dist/cli/validate/index.js.map +1 -1
  177. package/dist/index.d.ts +0 -3
  178. package/dist/index.js +0 -3
  179. package/dist/index.js.map +1 -1
  180. package/dist/io/claude-mcp.d.ts +1 -1
  181. package/dist/io/claude-mcp.js +27 -14
  182. package/dist/io/claude-mcp.js.map +1 -1
  183. package/dist/io/harness-lock.js +2 -2
  184. package/dist/io/harness-lock.js.map +1 -1
  185. package/dist/io/lock.d.ts +0 -26
  186. package/dist/io/lock.js +10 -27
  187. package/dist/io/lock.js.map +1 -1
  188. package/dist/io/merge-settings.js +6 -4
  189. package/dist/io/merge-settings.js.map +1 -1
  190. package/dist/io/project-name.d.ts +22 -39
  191. package/dist/io/project-name.js +25 -42
  192. package/dist/io/project-name.js.map +1 -1
  193. package/dist/io/read-regular-file.d.ts +103 -40
  194. package/dist/io/read-regular-file.js +196 -35
  195. package/dist/io/read-regular-file.js.map +1 -1
  196. package/dist/io/restart-hints.js +3 -6
  197. package/dist/io/restart-hints.js.map +1 -1
  198. package/dist/io/version-compare.d.ts +1 -3
  199. package/dist/io/version-compare.js +1 -3
  200. package/dist/io/version-compare.js.map +1 -1
  201. package/dist/io/write-regular-file.d.ts +30 -0
  202. package/dist/io/write-regular-file.js +85 -0
  203. package/dist/io/write-regular-file.js.map +1 -0
  204. package/dist/overrides/index.d.ts +1 -0
  205. package/dist/overrides/index.js +1 -0
  206. package/dist/overrides/index.js.map +1 -1
  207. package/dist/overrides/merge-layers.d.ts +43 -0
  208. package/dist/overrides/merge-layers.js +76 -0
  209. package/dist/overrides/merge-layers.js.map +1 -0
  210. package/dist/overrides/merge.d.ts +16 -0
  211. package/dist/overrides/merge.js +21 -8
  212. package/dist/overrides/merge.js.map +1 -1
  213. package/dist/policy-packs/builtin/branch-protection-runtime.d.ts +4 -69
  214. package/dist/policy-packs/builtin/branch-protection-runtime.js +12 -84
  215. package/dist/policy-packs/builtin/branch-protection-runtime.js.map +1 -1
  216. package/dist/policy-packs/builtin/branch-protection.d.ts +7 -30
  217. package/dist/policy-packs/builtin/branch-protection.js +56 -89
  218. package/dist/policy-packs/builtin/branch-protection.js.map +1 -1
  219. package/dist/policy-packs/config-check.d.ts +7 -5
  220. package/dist/policy-packs/config-check.js +2 -2
  221. package/dist/policy-packs/config-check.js.map +1 -1
  222. package/dist/policy-packs/expand.d.ts +1 -3
  223. package/dist/policy-packs/expand.js +5 -42
  224. package/dist/policy-packs/expand.js.map +1 -1
  225. package/dist/policy-packs/index.d.ts +3 -3
  226. package/dist/policy-packs/index.js +2 -2
  227. package/dist/policy-packs/index.js.map +1 -1
  228. package/dist/policy-packs/registry.d.ts +9 -38
  229. package/dist/policy-packs/registry.js +5 -65
  230. package/dist/policy-packs/registry.js.map +1 -1
  231. package/dist/policy-packs/runtime.d.ts +0 -4
  232. package/dist/policy-packs/runtime.js +9 -22
  233. package/dist/policy-packs/runtime.js.map +1 -1
  234. package/dist/policy-packs/types.d.ts +0 -19
  235. package/dist/policy-packs/ux-compare.d.ts +1 -11
  236. package/dist/policy-packs/ux-compare.js +6 -42
  237. package/dist/policy-packs/ux-compare.js.map +1 -1
  238. package/dist/policy-packs/ux-drift-check.d.ts +5 -5
  239. package/dist/policy-packs/ux-drift-check.js +17 -22
  240. package/dist/policy-packs/ux-drift-check.js.map +1 -1
  241. package/dist/policy-packs/version-check.d.ts +5 -26
  242. package/dist/policy-packs/version-check.js +19 -74
  243. package/dist/policy-packs/version-check.js.map +1 -1
  244. package/dist/probes/memory.d.ts +1 -1
  245. package/dist/probes/memory.js +1 -1
  246. package/dist/probes/memory.js.map +1 -1
  247. package/dist/runtime/agent-facing.d.ts +9 -0
  248. package/dist/runtime/agent-facing.js +28 -14
  249. package/dist/runtime/agent-facing.js.map +1 -1
  250. package/dist/runtime/bounded-text.d.ts +15 -0
  251. package/dist/runtime/bounded-text.js +27 -0
  252. package/dist/runtime/bounded-text.js.map +1 -0
  253. package/dist/runtime/git-branch.d.ts +125 -0
  254. package/dist/runtime/git-branch.js +381 -0
  255. package/dist/runtime/git-branch.js.map +1 -0
  256. package/dist/runtime/hermetic-spawn-guard.d.ts +2 -2
  257. package/dist/runtime/hermetic-spawn-guard.js +24 -34
  258. package/dist/runtime/hermetic-spawn-guard.js.map +1 -1
  259. package/dist/runtime/home-dir.js +3 -2
  260. package/dist/runtime/home-dir.js.map +1 -1
  261. package/dist/runtime/tool-name-aliases.d.ts +0 -6
  262. package/dist/runtime/tool-name-aliases.js +5 -18
  263. package/dist/runtime/tool-name-aliases.js.map +1 -1
  264. package/dist/schema/grounding.d.ts +7 -54
  265. package/dist/schema/grounding.js +10 -12
  266. package/dist/schema/grounding.js.map +1 -1
  267. package/dist/schema/hooks.d.ts +39 -136
  268. package/dist/schema/hooks.js +3 -6
  269. package/dist/schema/hooks.js.map +1 -1
  270. package/dist/schema/index.d.ts +114 -3828
  271. package/dist/schema/index.js +41 -80
  272. package/dist/schema/index.js.map +1 -1
  273. package/dist/schema/memory.d.ts +54 -131
  274. package/dist/schema/memory.js +2 -2
  275. package/dist/schema/memory.js.map +1 -1
  276. package/dist/schema/policy-packs.d.ts +3 -45
  277. package/dist/schema/policy-packs.js +7 -13
  278. package/dist/schema/policy-packs.js.map +1 -1
  279. package/dist/schema/policy-ux.d.ts +7 -0
  280. package/dist/schema/policy-ux.js +18 -0
  281. package/dist/schema/policy-ux.js.map +1 -0
  282. package/dist/schema/removed-keys.d.ts +185 -0
  283. package/dist/schema/removed-keys.js +531 -0
  284. package/dist/schema/removed-keys.js.map +1 -0
  285. package/dist/schema/tools.d.ts +30 -268
  286. package/dist/schema/tools.js +4 -4
  287. package/dist/schema/tools.js.map +1 -1
  288. package/package.json +5 -16
  289. package/dist/cli/approve/branch-protection.d.ts +0 -69
  290. package/dist/cli/approve/branch-protection.js +0 -144
  291. package/dist/cli/approve/branch-protection.js.map +0 -1
  292. package/dist/cli/approve/risk.d.ts +0 -112
  293. package/dist/cli/approve/risk.js +0 -197
  294. package/dist/cli/approve/risk.js.map +0 -1
  295. package/dist/cli/approve/stdin-report.d.ts +0 -57
  296. package/dist/cli/approve/stdin-report.js +0 -145
  297. package/dist/cli/approve/stdin-report.js.map +0 -1
  298. package/dist/cli/approve/understanding.d.ts +0 -410
  299. package/dist/cli/approve/understanding.js +0 -996
  300. package/dist/cli/approve/understanding.js.map +0 -1
  301. package/dist/cli/audit.d.ts +0 -80
  302. package/dist/cli/audit.js +0 -252
  303. package/dist/cli/audit.js.map +0 -1
  304. package/dist/cli/delegate/index.d.ts +0 -76
  305. package/dist/cli/delegate/index.js +0 -444
  306. package/dist/cli/delegate/index.js.map +0 -1
  307. package/dist/cli/delegate/register.js +0 -90
  308. package/dist/cli/delegate/register.js.map +0 -1
  309. package/dist/cli/doctor/auto-approve-mode.d.ts +0 -37
  310. package/dist/cli/doctor/auto-approve-mode.js +0 -80
  311. package/dist/cli/doctor/auto-approve-mode.js.map +0 -1
  312. package/dist/cli/doctor/bypass-without-auto-approve.d.ts +0 -38
  313. package/dist/cli/doctor/bypass-without-auto-approve.js +0 -95
  314. package/dist/cli/doctor/bypass-without-auto-approve.js.map +0 -1
  315. package/dist/cli/doctor/codex-config-drift.d.ts +0 -28
  316. package/dist/cli/doctor/codex-config-drift.js +0 -240
  317. package/dist/cli/doctor/codex-config-drift.js.map +0 -1
  318. package/dist/cli/doctor/expire-on-tool-match.d.ts +0 -15
  319. package/dist/cli/doctor/expire-on-tool-match.js +0 -58
  320. package/dist/cli/doctor/expire-on-tool-match.js.map +0 -1
  321. package/dist/cli/doctor/rogue-ledger.d.ts +0 -53
  322. package/dist/cli/doctor/rogue-ledger.js +0 -153
  323. package/dist/cli/doctor/rogue-ledger.js.map +0 -1
  324. package/dist/cli/doctor/session-start-preflight-setup-version.d.ts +0 -83
  325. package/dist/cli/doctor/session-start-preflight-setup-version.js +0 -114
  326. package/dist/cli/doctor/session-start-preflight-setup-version.js.map +0 -1
  327. package/dist/cli/doctor/settings-drift.d.ts +0 -25
  328. package/dist/cli/doctor/settings-drift.js +0 -213
  329. package/dist/cli/doctor/settings-drift.js.map +0 -1
  330. package/dist/cli/doctor/toolchain-parity.d.ts +0 -63
  331. package/dist/cli/doctor/toolchain-parity.js +0 -154
  332. package/dist/cli/doctor/toolchain-parity.js.map +0 -1
  333. package/dist/cli/doctor/ug-auto-approvals.d.ts +0 -40
  334. package/dist/cli/doctor/ug-auto-approvals.js +0 -91
  335. package/dist/cli/doctor/ug-auto-approvals.js.map +0 -1
  336. package/dist/cli/doctor/ug-delegations.d.ts +0 -26
  337. package/dist/cli/doctor/ug-delegations.js +0 -121
  338. package/dist/cli/doctor/ug-delegations.js.map +0 -1
  339. package/dist/cli/doctor/ug-inflight.d.ts +0 -35
  340. package/dist/cli/doctor/ug-inflight.js +0 -57
  341. package/dist/cli/doctor/ug-inflight.js.map +0 -1
  342. package/dist/cli/doctor/understanding-mode-env.d.ts +0 -51
  343. package/dist/cli/doctor/understanding-mode-env.js +0 -98
  344. package/dist/cli/doctor/understanding-mode-env.js.map +0 -1
  345. package/dist/cli/dry-run.d.ts +0 -58
  346. package/dist/cli/dry-run.js +0 -283
  347. package/dist/cli/dry-run.js.map +0 -1
  348. package/dist/cli/enriched-event.d.ts +0 -35
  349. package/dist/cli/enriched-event.js +0 -60
  350. package/dist/cli/enriched-event.js.map +0 -1
  351. package/dist/cli/event-input.d.ts +0 -28
  352. package/dist/cli/event-input.js +0 -73
  353. package/dist/cli/event-input.js.map +0 -1
  354. package/dist/cli/explain-action.d.ts +0 -25
  355. package/dist/cli/explain-action.js +0 -57
  356. package/dist/cli/explain-action.js.map +0 -1
  357. package/dist/cli/explain-policy.d.ts +0 -147
  358. package/dist/cli/explain-policy.js +0 -248
  359. package/dist/cli/explain-policy.js.map +0 -1
  360. package/dist/cli/explain.d.ts +0 -31
  361. package/dist/cli/explain.js +0 -159
  362. package/dist/cli/explain.js.map +0 -1
  363. package/dist/cli/gc/index.d.ts +0 -63
  364. package/dist/cli/gc/index.js +0 -566
  365. package/dist/cli/gc/index.js.map +0 -1
  366. package/dist/cli/pack/approve-escape.d.ts +0 -19
  367. package/dist/cli/pack/approve-escape.js +0 -190
  368. package/dist/cli/pack/approve-escape.js.map +0 -1
  369. package/dist/cli/pack/auto-approve-path.d.ts +0 -146
  370. package/dist/cli/pack/auto-approve-path.js +0 -462
  371. package/dist/cli/pack/auto-approve-path.js.map +0 -1
  372. package/dist/cli/pack/hook-codex-post-tool-use.d.ts +0 -25
  373. package/dist/cli/pack/hook-codex-post-tool-use.js +0 -160
  374. package/dist/cli/pack/hook-codex-post-tool-use.js.map +0 -1
  375. package/dist/cli/pack/hook-codex-pre-tool-use.d.ts +0 -48
  376. package/dist/cli/pack/hook-codex-pre-tool-use.js +0 -474
  377. package/dist/cli/pack/hook-codex-pre-tool-use.js.map +0 -1
  378. package/dist/cli/pack/hook-codex-stop.d.ts +0 -35
  379. package/dist/cli/pack/hook-codex-stop.js +0 -329
  380. package/dist/cli/pack/hook-codex-stop.js.map +0 -1
  381. package/dist/cli/pack/hook-codex-user-prompt-submit.d.ts +0 -24
  382. package/dist/cli/pack/hook-codex-user-prompt-submit.js +0 -93
  383. package/dist/cli/pack/hook-codex-user-prompt-submit.js.map +0 -1
  384. package/dist/cli/pack/hook-post-merge-gate-record.d.ts +0 -37
  385. package/dist/cli/pack/hook-post-merge-gate-record.js +0 -190
  386. package/dist/cli/pack/hook-post-merge-gate-record.js.map +0 -1
  387. package/dist/cli/pack/hook-post-merge-gate.d.ts +0 -34
  388. package/dist/cli/pack/hook-post-merge-gate.js +0 -277
  389. package/dist/cli/pack/hook-post-merge-gate.js.map +0 -1
  390. package/dist/cli/pack/hook-post-tool-use.d.ts +0 -45
  391. package/dist/cli/pack/hook-post-tool-use.js +0 -137
  392. package/dist/cli/pack/hook-post-tool-use.js.map +0 -1
  393. package/dist/cli/pack/hook-pre-tool-use.d.ts +0 -92
  394. package/dist/cli/pack/hook-pre-tool-use.js +0 -1328
  395. package/dist/cli/pack/hook-pre-tool-use.js.map +0 -1
  396. package/dist/cli/pack/hook-runtime-reality.d.ts +0 -63
  397. package/dist/cli/pack/hook-runtime-reality.js +0 -210
  398. package/dist/cli/pack/hook-runtime-reality.js.map +0 -1
  399. package/dist/cli/pack/hook-solution-acceptance-writeguard.d.ts +0 -32
  400. package/dist/cli/pack/hook-solution-acceptance-writeguard.js +0 -438
  401. package/dist/cli/pack/hook-solution-acceptance-writeguard.js.map +0 -1
  402. package/dist/cli/pack/hook-solution-acceptance.d.ts +0 -157
  403. package/dist/cli/pack/hook-solution-acceptance.js +0 -530
  404. package/dist/cli/pack/hook-solution-acceptance.js.map +0 -1
  405. package/dist/cli/pack/hook-stay-in-scope.d.ts +0 -37
  406. package/dist/cli/pack/hook-stay-in-scope.js +0 -128
  407. package/dist/cli/pack/hook-stay-in-scope.js.map +0 -1
  408. package/dist/cli/pack/hook-subagent-start.d.ts +0 -23
  409. package/dist/cli/pack/hook-subagent-start.js +0 -88
  410. package/dist/cli/pack/hook-subagent-start.js.map +0 -1
  411. package/dist/cli/pack/hook-subagent-stop.d.ts +0 -19
  412. package/dist/cli/pack/hook-subagent-stop.js +0 -41
  413. package/dist/cli/pack/hook-subagent-stop.js.map +0 -1
  414. package/dist/cli/pack/hook-track-active-claim.d.ts +0 -27
  415. package/dist/cli/pack/hook-track-active-claim.js +0 -275
  416. package/dist/cli/pack/hook-track-active-claim.js.map +0 -1
  417. package/dist/cli/pack/transcript-report-scan.d.ts +0 -71
  418. package/dist/cli/pack/transcript-report-scan.js +0 -359
  419. package/dist/cli/pack/transcript-report-scan.js.map +0 -1
  420. package/dist/cli/pack/understanding-report-schema-hint.d.ts +0 -26
  421. package/dist/cli/pack/understanding-report-schema-hint.js +0 -120
  422. package/dist/cli/pack/understanding-report-schema-hint.js.map +0 -1
  423. package/dist/cli/pack/upgrade.d.ts +0 -32
  424. package/dist/cli/pack/upgrade.js +0 -273
  425. package/dist/cli/pack/upgrade.js.map +0 -1
  426. package/dist/cli/pause/index.d.ts +0 -113
  427. package/dist/cli/pause/index.js +0 -251
  428. package/dist/cli/pause/index.js.map +0 -1
  429. package/dist/cli/pause-check.d.ts +0 -22
  430. package/dist/cli/pause-check.js +0 -54
  431. package/dist/cli/pause-check.js.map +0 -1
  432. package/dist/cli/policy/intercept.d.ts +0 -233
  433. package/dist/cli/policy/intercept.js +0 -1022
  434. package/dist/cli/policy/intercept.js.map +0 -1
  435. package/dist/cli/policy/risk-envelope-enrichment.d.ts +0 -40
  436. package/dist/cli/policy/risk-envelope-enrichment.js +0 -110
  437. package/dist/cli/policy/risk-envelope-enrichment.js.map +0 -1
  438. package/dist/cli/record/index.d.ts +0 -81
  439. package/dist/cli/record/index.js +0 -348
  440. package/dist/cli/record/index.js.map +0 -1
  441. package/dist/cli/register-audit-group.js +0 -91
  442. package/dist/cli/register-audit-group.js.map +0 -1
  443. package/dist/cli/resolve-env.d.ts +0 -32
  444. package/dist/cli/resolve-env.js +0 -46
  445. package/dist/cli/resolve-env.js.map +0 -1
  446. package/dist/cli/session-export/index.d.ts +0 -46
  447. package/dist/cli/session-export/index.js +0 -169
  448. package/dist/cli/session-export/index.js.map +0 -1
  449. package/dist/cli/session-export/redact.d.ts +0 -22
  450. package/dist/cli/session-export/redact.js +0 -47
  451. package/dist/cli/session-export/redact.js.map +0 -1
  452. package/dist/cli/session-export/transcript.d.ts +0 -24
  453. package/dist/cli/session-export/transcript.js +0 -164
  454. package/dist/cli/session-export/transcript.js.map +0 -1
  455. package/dist/cli/session-start/branch-check.d.ts +0 -18
  456. package/dist/cli/session-start/branch-check.js +0 -140
  457. package/dist/cli/session-start/branch-check.js.map +0 -1
  458. package/dist/cli/session-start/index.d.ts +0 -121
  459. package/dist/cli/session-start/index.js +0 -591
  460. package/dist/cli/session-start/index.js.map +0 -1
  461. package/dist/cli/session-start/shared-options.d.ts +0 -103
  462. package/dist/cli/session-start/shared-options.js +0 -107
  463. package/dist/cli/session-start/shared-options.js.map +0 -1
  464. package/dist/cli/session-start/stale-base-check.d.ts +0 -46
  465. package/dist/cli/session-start/stale-base-check.js +0 -352
  466. package/dist/cli/session-start/stale-base-check.js.map +0 -1
  467. package/dist/cli/session-start/toolchain-parity.d.ts +0 -267
  468. package/dist/cli/session-start/toolchain-parity.js +0 -797
  469. package/dist/cli/session-start/toolchain-parity.js.map +0 -1
  470. package/dist/cli/smoke/assertions.d.ts +0 -46
  471. package/dist/cli/smoke/assertions.js +0 -170
  472. package/dist/cli/smoke/assertions.js.map +0 -1
  473. package/dist/cli/smoke/index.d.ts +0 -76
  474. package/dist/cli/smoke/index.js +0 -245
  475. package/dist/cli/smoke/index.js.map +0 -1
  476. package/dist/cli/smoke/runner.d.ts +0 -55
  477. package/dist/cli/smoke/runner.js +0 -134
  478. package/dist/cli/smoke/runner.js.map +0 -1
  479. package/dist/cli/smoke/stream-parser.d.ts +0 -65
  480. package/dist/cli/smoke/stream-parser.js +0 -115
  481. package/dist/cli/smoke/stream-parser.js.map +0 -1
  482. package/dist/cli/test-risk.d.ts +0 -27
  483. package/dist/cli/test-risk.js +0 -38
  484. package/dist/cli/test-risk.js.map +0 -1
  485. package/dist/io/display-path.d.ts +0 -11
  486. package/dist/io/display-path.js +0 -29
  487. package/dist/io/display-path.js.map +0 -1
  488. package/dist/io/duration.d.ts +0 -5
  489. package/dist/io/duration.js +0 -50
  490. package/dist/io/duration.js.map +0 -1
  491. package/dist/io/extract.d.ts +0 -79
  492. package/dist/io/extract.js +0 -226
  493. package/dist/io/extract.js.map +0 -1
  494. package/dist/io/ledger-record.d.ts +0 -83
  495. package/dist/io/ledger-record.js +0 -301
  496. package/dist/io/ledger-record.js.map +0 -1
  497. package/dist/io/read-json-dir-entries.d.ts +0 -36
  498. package/dist/io/read-json-dir-entries.js +0 -48
  499. package/dist/io/read-json-dir-entries.js.map +0 -1
  500. package/dist/io/safe-json-parse.d.ts +0 -5
  501. package/dist/io/safe-json-parse.js +0 -21
  502. package/dist/io/safe-json-parse.js.map +0 -1
  503. package/dist/policies/index.d.ts +0 -5
  504. package/dist/policies/index.js +0 -6
  505. package/dist/policies/index.js.map +0 -1
  506. package/dist/policies/ledger-client.d.ts +0 -113
  507. package/dist/policies/ledger-client.js +0 -500
  508. package/dist/policies/ledger-client.js.map +0 -1
  509. package/dist/policies/producers.d.ts +0 -12
  510. package/dist/policies/producers.js +0 -61
  511. package/dist/policies/producers.js.map +0 -1
  512. package/dist/policies/requires.d.ts +0 -75
  513. package/dist/policies/requires.js +0 -240
  514. package/dist/policies/requires.js.map +0 -1
  515. package/dist/policies/timestamp.d.ts +0 -14
  516. package/dist/policies/timestamp.js +0 -36
  517. package/dist/policies/timestamp.js.map +0 -1
  518. package/dist/policy-packs/builtin/permission-profiles.d.ts +0 -11
  519. package/dist/policy-packs/builtin/permission-profiles.js +0 -74
  520. package/dist/policy-packs/builtin/permission-profiles.js.map +0 -1
  521. package/dist/policy-packs/builtin/post-merge-gate-runtime.d.ts +0 -286
  522. package/dist/policy-packs/builtin/post-merge-gate-runtime.js +0 -397
  523. package/dist/policy-packs/builtin/post-merge-gate-runtime.js.map +0 -1
  524. package/dist/policy-packs/builtin/post-merge-gate.d.ts +0 -56
  525. package/dist/policy-packs/builtin/post-merge-gate.js +0 -347
  526. package/dist/policy-packs/builtin/post-merge-gate.js.map +0 -1
  527. package/dist/policy-packs/builtin/solution-acceptance-reconnect.d.ts +0 -50
  528. package/dist/policy-packs/builtin/solution-acceptance-reconnect.js +0 -151
  529. package/dist/policy-packs/builtin/solution-acceptance-reconnect.js.map +0 -1
  530. package/dist/policy-packs/builtin/solution-acceptance-runtime.d.ts +0 -323
  531. package/dist/policy-packs/builtin/solution-acceptance-runtime.js +0 -672
  532. package/dist/policy-packs/builtin/solution-acceptance-runtime.js.map +0 -1
  533. package/dist/policy-packs/builtin/solution-acceptance.d.ts +0 -45
  534. package/dist/policy-packs/builtin/solution-acceptance.js +0 -226
  535. package/dist/policy-packs/builtin/solution-acceptance.js.map +0 -1
  536. package/dist/policy-packs/builtin/understanding-before-execution/active-claim.d.ts +0 -25
  537. package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js +0 -94
  538. package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js.map +0 -1
  539. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.d.ts +0 -35
  540. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js +0 -86
  541. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js.map +0 -1
  542. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.d.ts +0 -210
  543. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js +0 -361
  544. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js.map +0 -1
  545. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.d.ts +0 -304
  546. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js +0 -734
  547. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js.map +0 -1
  548. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.d.ts +0 -36
  549. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js +0 -73
  550. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js.map +0 -1
  551. package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +0 -19
  552. package/dist/policy-packs/builtin/understanding-before-execution/index.js +0 -83
  553. package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +0 -1
  554. package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.d.ts +0 -135
  555. package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js +0 -643
  556. package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js.map +0 -1
  557. package/dist/policy-packs/builtin/understanding-before-execution/ledger.d.ts +0 -25
  558. package/dist/policy-packs/builtin/understanding-before-execution/ledger.js +0 -56
  559. package/dist/policy-packs/builtin/understanding-before-execution/ledger.js.map +0 -1
  560. package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.d.ts +0 -20
  561. package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js +0 -106
  562. package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js.map +0 -1
  563. package/dist/policy-packs/builtin/understanding-before-execution/markers.d.ts +0 -126
  564. package/dist/policy-packs/builtin/understanding-before-execution/markers.js +0 -245
  565. package/dist/policy-packs/builtin/understanding-before-execution/markers.js.map +0 -1
  566. package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.d.ts +0 -29
  567. package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.js +0 -82
  568. package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.js.map +0 -1
  569. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.d.ts +0 -71
  570. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js +0 -175
  571. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js.map +0 -1
  572. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.d.ts +0 -625
  573. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +0 -1076
  574. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js.map +0 -1
  575. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.d.ts +0 -128
  576. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js +0 -213
  577. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js.map +0 -1
  578. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.d.ts +0 -129
  579. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js +0 -166
  580. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js.map +0 -1
  581. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.d.ts +0 -164
  582. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js +0 -275
  583. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js.map +0 -1
  584. package/dist/policy-packs/builtin/understanding-before-execution-runtime.d.ts +0 -1
  585. package/dist/policy-packs/builtin/understanding-before-execution-runtime.js +0 -10
  586. package/dist/policy-packs/builtin/understanding-before-execution-runtime.js.map +0 -1
  587. package/dist/policy-packs/builtin/understanding-before-execution.d.ts +0 -526
  588. package/dist/policy-packs/builtin/understanding-before-execution.js +0 -1078
  589. package/dist/policy-packs/builtin/understanding-before-execution.js.map +0 -1
  590. package/dist/policy-packs/permission-translator.d.ts +0 -9
  591. package/dist/policy-packs/permission-translator.js +0 -76
  592. package/dist/policy-packs/permission-translator.js.map +0 -1
  593. package/dist/runtime/action-envelope.d.ts +0 -64
  594. package/dist/runtime/action-envelope.js +0 -46
  595. package/dist/runtime/action-envelope.js.map +0 -1
  596. package/dist/runtime/approval-signing.d.ts +0 -111
  597. package/dist/runtime/approval-signing.js +0 -384
  598. package/dist/runtime/approval-signing.js.map +0 -1
  599. package/dist/runtime/bash-match-facts.d.ts +0 -60
  600. package/dist/runtime/bash-match-facts.js +0 -196
  601. package/dist/runtime/bash-match-facts.js.map +0 -1
  602. package/dist/runtime/bash-match-registry.d.ts +0 -112
  603. package/dist/runtime/bash-match-registry.js +0 -406
  604. package/dist/runtime/bash-match-registry.js.map +0 -1
  605. package/dist/runtime/bash-prefix-parse.d.ts +0 -31
  606. package/dist/runtime/bash-prefix-parse.js +0 -576
  607. package/dist/runtime/bash-prefix-parse.js.map +0 -1
  608. package/dist/runtime/command-normalize.d.ts +0 -658
  609. package/dist/runtime/command-normalize.js +0 -2410
  610. package/dist/runtime/command-normalize.js.map +0 -1
  611. package/dist/runtime/deletion-target-resolve.d.ts +0 -28
  612. package/dist/runtime/deletion-target-resolve.js +0 -1078
  613. package/dist/runtime/deletion-target-resolve.js.map +0 -1
  614. package/dist/runtime/destructive-shell-floor.d.ts +0 -19
  615. package/dist/runtime/destructive-shell-floor.js +0 -611
  616. package/dist/runtime/destructive-shell-floor.js.map +0 -1
  617. package/dist/runtime/environment-resolver.d.ts +0 -36
  618. package/dist/runtime/environment-resolver.js +0 -138
  619. package/dist/runtime/environment-resolver.js.map +0 -1
  620. package/dist/runtime/git-context.d.ts +0 -201
  621. package/dist/runtime/git-context.js +0 -422
  622. package/dist/runtime/git-context.js.map +0 -1
  623. package/dist/runtime/index.d.ts +0 -12
  624. package/dist/runtime/index.js +0 -13
  625. package/dist/runtime/index.js.map +0 -1
  626. package/dist/runtime/intercept.d.ts +0 -623
  627. package/dist/runtime/intercept.js +0 -1384
  628. package/dist/runtime/intercept.js.map +0 -1
  629. package/dist/runtime/kube-context.d.ts +0 -16
  630. package/dist/runtime/kube-context.js +0 -63
  631. package/dist/runtime/kube-context.js.map +0 -1
  632. package/dist/runtime/kubectl-target-parse.d.ts +0 -31
  633. package/dist/runtime/kubectl-target-parse.js +0 -249
  634. package/dist/runtime/kubectl-target-parse.js.map +0 -1
  635. package/dist/runtime/ledger-add.d.ts +0 -16
  636. package/dist/runtime/ledger-add.js +0 -150
  637. package/dist/runtime/ledger-add.js.map +0 -1
  638. package/dist/runtime/ledger-writer.d.ts +0 -27
  639. package/dist/runtime/ledger-writer.js +0 -46
  640. package/dist/runtime/ledger-writer.js.map +0 -1
  641. package/dist/runtime/pause-sentinel.d.ts +0 -60
  642. package/dist/runtime/pause-sentinel.js +0 -156
  643. package/dist/runtime/pause-sentinel.js.map +0 -1
  644. package/dist/runtime/pending-approval.d.ts +0 -23
  645. package/dist/runtime/pending-approval.js +0 -67
  646. package/dist/runtime/pending-approval.js.map +0 -1
  647. package/dist/runtime/read-only-bash.d.ts +0 -141
  648. package/dist/runtime/read-only-bash.js +0 -2204
  649. package/dist/runtime/read-only-bash.js.map +0 -1
  650. package/dist/runtime/recovery-git-commit.d.ts +0 -22
  651. package/dist/runtime/recovery-git-commit.js +0 -284
  652. package/dist/runtime/recovery-git-commit.js.map +0 -1
  653. package/dist/runtime/reject-malformed-session-id.d.ts +0 -8
  654. package/dist/runtime/reject-malformed-session-id.js +0 -16
  655. package/dist/runtime/reject-malformed-session-id.js.map +0 -1
  656. package/dist/runtime/risk-classifier.d.ts +0 -38
  657. package/dist/runtime/risk-classifier.js +0 -311
  658. package/dist/runtime/risk-classifier.js.map +0 -1
  659. package/dist/runtime/session-id.d.ts +0 -113
  660. package/dist/runtime/session-id.js +0 -193
  661. package/dist/runtime/session-id.js.map +0 -1
  662. package/dist/runtime/shell-word.d.ts +0 -62
  663. package/dist/runtime/shell-word.js +0 -410
  664. package/dist/runtime/shell-word.js.map +0 -1
  665. package/dist/runtime/task-providers/agent-tasks.d.ts +0 -105
  666. package/dist/runtime/task-providers/agent-tasks.js +0 -247
  667. package/dist/runtime/task-providers/agent-tasks.js.map +0 -1
  668. package/dist/runtime/when-eval.d.ts +0 -62
  669. package/dist/runtime/when-eval.js +0 -212
  670. package/dist/runtime/when-eval.js.map +0 -1
  671. package/dist/runtime/workflow-policies.d.ts +0 -207
  672. package/dist/runtime/workflow-policies.js +0 -596
  673. package/dist/runtime/workflow-policies.js.map +0 -1
  674. package/dist/schema/audit.d.ts +0 -71
  675. package/dist/schema/audit.js +0 -32
  676. package/dist/schema/audit.js.map +0 -1
  677. package/dist/schema/doctor.d.ts +0 -25
  678. package/dist/schema/doctor.js +0 -23
  679. package/dist/schema/doctor.js.map +0 -1
  680. package/dist/schema/environments.d.ts +0 -215
  681. package/dist/schema/environments.js +0 -101
  682. package/dist/schema/environments.js.map +0 -1
  683. package/dist/schema/extract.d.ts +0 -9
  684. package/dist/schema/extract.js +0 -86
  685. package/dist/schema/extract.js.map +0 -1
  686. package/dist/schema/permission-profiles.d.ts +0 -2292
  687. package/dist/schema/permission-profiles.js +0 -60
  688. package/dist/schema/permission-profiles.js.map +0 -1
  689. package/dist/schema/policies.d.ts +0 -974
  690. package/dist/schema/policies.js +0 -298
  691. package/dist/schema/policies.js.map +0 -1
  692. package/dist/schema/requires.d.ts +0 -131
  693. package/dist/schema/requires.js +0 -88
  694. package/dist/schema/requires.js.map +0 -1
  695. package/dist/schema/risk.d.ts +0 -144
  696. package/dist/schema/risk.js +0 -194
  697. package/dist/schema/risk.js.map +0 -1
  698. package/dist/schema/session-start-preflight.d.ts +0 -10
  699. package/dist/schema/session-start-preflight.js +0 -106
  700. package/dist/schema/session-start-preflight.js.map +0 -1
  701. package/dist/schema/stale-base-check.d.ts +0 -18
  702. package/dist/schema/stale-base-check.js +0 -37
  703. package/dist/schema/stale-base-check.js.map +0 -1
  704. package/dist/schema/toolchain-parity.d.ts +0 -21
  705. package/dist/schema/toolchain-parity.js +0 -48
  706. package/dist/schema/toolchain-parity.js.map +0 -1
  707. package/dist/schema/workflows.d.ts +0 -519
  708. package/dist/schema/workflows.js +0 -81
  709. package/dist/schema/workflows.js.map +0 -1
  710. package/scripts/runtime-reality-docker-probe.mjs +0 -71
@@ -1 +0,0 @@
1
- {"version":3,"file":"hook-track-active-claim.js","sourceRoot":"","sources":["../../../src/c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,CAAC,KAAK,CAAC,GAAG,UAAU,IAAI,CAAC,CAAC;QAChC,OAAO;YACL,QAAQ,EAAE,CAAC;YACX,YAAY,EAAE,KAAK;YACnB,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;YACrC,UAAU;SACX,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CACT,8CAA8C,QAAQ,wBAAwB,EAC9E,MAAM,CACP,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,OAAO,4BAA4B,CAAC,QAAQ,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACtE,CAAC"}
@@ -1,71 +0,0 @@
1
- export interface TranscriptReportScanArgs {
2
- /** The `transcript_path` from the hook payload. The ONLY file this scan opens. */
3
- transcriptPath: string;
4
- /** The session being decided; an entry's own `sessionId` must equal this. */
5
- sessionId: string;
6
- /** Bound of the poll, from `auto_approve.report_scan.max_wait`. */
7
- maxWaitMs: number;
8
- /** Re-read interval. */
9
- pollMs?: number;
10
- /** Injectable clock (epoch ms). */
11
- now?: () => number;
12
- /** Injectable sleep, so tests never wait for real time. */
13
- sleep?: (ms: number) => Promise<void>;
14
- /**
15
- * Entry ids (see {@link TranscriptReportScanResult}'s `entryId`) this
16
- * session has ALREADY adopted. A hit whose id is in here is skipped as
17
- * if it were not a report at all, and a transcript that carries nothing
18
- * else times out with `adoptedOnly: true`. Absent means "nothing
19
- * adopted yet", the first-call case.
20
- */
21
- adopted?: ReadonlySet<string>;
22
- }
23
- export type TranscriptReportScanResult = {
24
- found: true;
25
- /** The report markdown, from its heading line to the end of the text block that carried it. */
26
- markdown: string;
27
- /** Zero-based index of the JSONL line the report was found on. */
28
- lineIndex: number;
29
- /**
30
- * Stable identity of the adopted entry, for the caller's
31
- * once-per-session adoption ledger: the entry's own `uuid` when it
32
- * carries a usable one, otherwise a digest of the adopted markdown
33
- * and its line index. Never contains a newline, so the caller can
34
- * store one id per line.
35
- */
36
- entryId: string;
37
- waitedMs: number;
38
- } | {
39
- found: false;
40
- /**
41
- * `timeout`: the bound elapsed with no eligible report (this
42
- * includes a transcript file that never appeared, since the file
43
- * may still be created while the poll runs).
44
- * `unreadable`: the file IS there and could not be read (a
45
- * permission error, a directory at that path, a symlink loop).
46
- */
47
- reason: "timeout" | "unreadable";
48
- /**
49
- * Set when the ONLY report(s) in the transcript were entries this
50
- * session had already adopted. The outcome is the same block, but
51
- * the caller can say so: the child must emit a FRESH report, not
52
- * retry against the one it already spent.
53
- */
54
- adoptedOnly?: true;
55
- waitedMs: number;
56
- };
57
- /**
58
- * Poll the payload's own transcript for this session's Understanding
59
- * Report until it appears or `maxWaitMs` elapses. See the module header
60
- * for the filters and why each one is there.
61
- *
62
- * The poll timer is deliberately NOT `unref`'d. A hook process whose
63
- * stdin has been drained has no other ref'd handle, so an unref'd timer
64
- * lets Node exit mid-poll: the process would end with an empty stdout,
65
- * which Claude Code reads as ALLOW: a silent fail-open on precisely the
66
- * delegation path this scan exists for. The loop is bounded twice over
67
- * (`maxWaitMs`, itself capped by the config's 5 s ceiling, and the
68
- * `maxPolls` count below), so it can never hold the process open beyond
69
- * the bound.
70
- */
71
- export declare function scanTranscriptForReport(args: TranscriptReportScanArgs): Promise<TranscriptReportScanResult>;
@@ -1,359 +0,0 @@
1
- // Session-scoped, role-aware transcript scan for the child's own
2
- // Understanding Report: slice 3 of
3
- // docs/decisions/2026-08-27-ug-auto-mode-approval.md ("Report capture
4
- // under `-p`", agent-tasks 37ad0b05).
5
- //
6
- // WHY THIS EXISTS. Under `claude -p` there is no operator to run
7
- // `harness approve understanding`, and the Stop hook fires only at the
8
- // end of the run, so neither channel can supply key two (the child's own
9
- // report) at the instant the first gated tool call is decided. The
10
- // session transcript is the remaining channel, and it LAGS: at the
11
- // PreToolUse instant the report the agent just emitted is not in the
12
- // JSONL yet; it lands tens of milliseconds later (measured, see
13
- // `docs/okf/understanding-gate-auto-mode-signals.md` and
14
- // `dogfood/ug-auto-mode-signals/`). This module is the bounded poll the
15
- // ADR chose over a lone block-and-retry: it waits for the flush itself,
16
- // for at most `auto_approve.report_scan.max_wait`, and then gives up.
17
- //
18
- // FAIL CLOSED. There is no branch here that turns an absent report into
19
- // anything but `found: false`. The caller blocks on that; the timeout is
20
- // a block, never an allow.
21
- //
22
- // WHAT IT WILL NOT DO, AND WHY EACH REFUSAL IS LOAD-BEARING:
23
- //
24
- // - It opens exactly ONE file, the `transcript_path` the payload names,
25
- // and never a directory. A directory scan could reach another
26
- // session's transcript, and (per the ADR's subagent measurement) the
27
- // separate `agent-<agent_id>.jsonl` a subagent's turns live in.
28
- // - Only `type: "assistant"` entries count. A report the agent quoted
29
- // back inside a user message is the PROMPT's text, not the model's
30
- // own report, and adopting it would let the launcher's prompt supply
31
- // key two.
32
- // - Only entries whose own `sessionId` equals the session being decided
33
- // count. The payload names the file, but a file can hold entries from
34
- // more than one session id (a resumed / forked transcript), and an
35
- // entry stamped with a foreign id is not this session's report.
36
- // - `isSidechain: true` entries are excluded. The measured shape never
37
- // puts one in the payload's own transcript (subagent turns live in a
38
- // separate file), so this is defence in depth against a shape the
39
- // measurement did not produce, not the mechanism the separation
40
- // relies on.
41
- // - EACH TRANSCRIPT ENTRY IS ADOPTED AT MOST ONCE PER SESSION: the
42
- // caller passes the entry ids it has already spent (`adopted`) and
43
- // this scan returns the newest NON-adopted hit, so one report cannot
44
- // mint a second marker after the first one expired or a task boundary
45
- // cleared it. Without that rule the delegation's TTL would silently
46
- // replace the marker's, which is the lifetime the ADR's two-key
47
- // design deliberately keeps short.
48
- //
49
- // HOW IT READS. The first poll reads the whole file; every later poll
50
- // reads only the bytes appended since the previous one, carrying a
51
- // partial trailing line over, and keeps the best hit found so far. A
52
- // transcript that SHRANK between polls (truncated or replaced by a
53
- // shorter file), or whose underlying file identity changed (inode/device,
54
- // from `fs.fstatSync`, even when the new file is the same size or LARGER,
55
- // as in a rename swapping in a different file in place), resets the
56
- // reader and it is re-read from the top. Size alone cannot catch the
57
- // second case: a same-size-or-larger replacement passes the size check
58
- // but its bytes at the old offset are not a continuation of anything
59
- // this reader has seen.
60
- //
61
- // The clock and the sleep are injected so the tests drive the poll
62
- // deterministically and never sleep for real.
63
- import * as fs from "node:fs";
64
- import { sha256Hex } from "../../runtime/approval-signing.js";
65
- /**
66
- * The report heading the scan looks for, anchored to a whole line.
67
- *
68
- * ANY heading level, `#` through `######`: the deny text the child is
69
- * given (`renderReportSchemaHint`) says "any heading level (#, ##, ###)"
70
- * and shows a `##` example, so a scan that accepted only `#` would refuse
71
- * exactly the shape its own instruction asked for.
72
- *
73
- * Deliberately `[ \t]` rather than `\s` around the words: `\s` matches
74
- * newlines, so `^#\s*Understanding Report\s*$` under the `m` flag would
75
- * also match a bare `#` on one line followed by the words on the next,
76
- * which is not a heading. Case-insensitive on the words themselves (an
77
- * agent that writes `# UNDERSTANDING REPORT` has still emitted the
78
- * section the deny text asked for); a trailing `\r` is tolerated for a
79
- * CRLF-written transcript.
80
- */
81
- const REPORT_HEADING = /^#{1,6}[ \t]*understanding[ \t]+report[ \t]*\r?$/i;
82
- /**
83
- * The text blocks of one entry's `message.content`, in order. A string
84
- * `content` counts as exactly one text block; in the array shape only
85
- * `{ type: "text", text: <string> }` blocks contribute, so `tool_use` and
86
- * `thinking` blocks are ignored (a report the model only ever "thought"
87
- * is not a report it emitted).
88
- */
89
- function textBlocksOf(entry) {
90
- const message = entry.message;
91
- if (message === null || typeof message !== "object" || Array.isArray(message))
92
- return [];
93
- const content = message.content;
94
- if (typeof content === "string")
95
- return [content];
96
- if (!Array.isArray(content))
97
- return [];
98
- const blocks = [];
99
- for (const block of content) {
100
- if (block === null || typeof block !== "object" || Array.isArray(block))
101
- continue;
102
- const b = block;
103
- if (b.type !== "text")
104
- continue;
105
- if (typeof b.text !== "string")
106
- continue;
107
- blocks.push(b.text);
108
- }
109
- return blocks;
110
- }
111
- /** The report markdown inside one text block, or null when it carries no heading. */
112
- function reportInBlock(block) {
113
- const lines = block.split("\n");
114
- for (let i = lines.length - 1; i >= 0; i -= 1) {
115
- if (REPORT_HEADING.test(lines[i])) {
116
- return lines.slice(i).join("\n");
117
- }
118
- }
119
- return null;
120
- }
121
- /** Longest `uuid` accepted verbatim as an adoption id; anything longer falls back to the digest. */
122
- const ENTRY_UUID_MAX_LENGTH = 200;
123
- /**
124
- * Stable identity of one adopted entry. The transcript's own `uuid` is
125
- * preferred (Claude Code stamps one on every entry, and it survives the
126
- * file being rewritten or resumed); a value that is missing, empty,
127
- * over-long, or carries a line break (all of which would corrupt the
128
- * caller's one-id-per-line ledger) falls back to a digest of the adopted
129
- * markdown plus its line index. The two forms are namespaced so a crafted
130
- * `uuid` cannot impersonate a digest id.
131
- */
132
- function entryIdFor(entry, markdown, lineIndex) {
133
- const uuid = entry.uuid;
134
- if (typeof uuid === "string" &&
135
- uuid.length > 0 &&
136
- uuid.length <= ENTRY_UUID_MAX_LENGTH &&
137
- !/[\r\n]/.test(uuid)) {
138
- return `uuid:${uuid}`;
139
- }
140
- return `sha256:${sha256Hex(`${lineIndex}\n${markdown}`)}`;
141
- }
142
- /**
143
- * The eligible report on ONE JSONL line, or null. Unparseable and blank
144
- * lines yield null rather than aborting the scan: a transcript being
145
- * written while it is read can end in a half-flushed line, and refusing
146
- * the whole file for that would turn a routine race into a block.
147
- */
148
- function reportHitInLine(line, lineIndex, sessionId) {
149
- const trimmed = line.trim();
150
- if (trimmed.length === 0)
151
- return null;
152
- let entry;
153
- try {
154
- entry = JSON.parse(trimmed);
155
- }
156
- catch {
157
- return null;
158
- }
159
- if (entry === null || typeof entry !== "object" || Array.isArray(entry))
160
- return null;
161
- if (entry.type !== "assistant")
162
- return null;
163
- if (entry.isSidechain === true)
164
- return null;
165
- if (entry.sessionId !== sessionId)
166
- return null;
167
- const blocks = textBlocksOf(entry);
168
- for (let b = blocks.length - 1; b >= 0; b -= 1) {
169
- const markdown = reportInBlock(blocks[b]);
170
- if (markdown !== null) {
171
- return { markdown, lineIndex, entryId: entryIdFor(entry, markdown, lineIndex) };
172
- }
173
- }
174
- return null;
175
- }
176
- const DEFAULT_POLL_MS = 50;
177
- const NEWLINE = 0x0a;
178
- const CLOSING_BRACE = 0x7d;
179
- const EMPTY_ADOPTED = new Set();
180
- function newScanState() {
181
- return {
182
- offset: 0,
183
- carry: Buffer.alloc(0),
184
- lineIndex: 0,
185
- best: null,
186
- tentative: null,
187
- adoptedSkipped: false,
188
- ino: null,
189
- dev: null,
190
- };
191
- }
192
- /** A hit the caller may still take: skips (and records) an already-adopted one. */
193
- function eligible(hit, adopted, state) {
194
- if (hit === null)
195
- return null;
196
- if (adopted.has(hit.entryId)) {
197
- state.adoptedSkipped = true;
198
- return null;
199
- }
200
- return hit;
201
- }
202
- /** Read `length` bytes from `offset`, tolerating a short `readSync`. */
203
- function readAt(fd, offset, length) {
204
- const buf = Buffer.allocUnsafe(length);
205
- let read = 0;
206
- while (read < length) {
207
- const n = fs.readSync(fd, buf, read, length - read, offset + read);
208
- if (n <= 0)
209
- break;
210
- read += n;
211
- }
212
- return read === length ? buf : buf.subarray(0, read);
213
- }
214
- /**
215
- * The trailing, newline-less bytes as a PROVISIONAL hit for this poll
216
- * only. A writer that has flushed a complete JSONL entry but not yet its
217
- * newline is the one case the append-only reader would otherwise miss
218
- * until the next flush, and the whole-file reader this replaced did see
219
- * it. Only attempted when the carry ends in `}`, which both keeps the
220
- * cost off every poll's partial line and guarantees the decoded bytes end
221
- * on a character boundary.
222
- */
223
- function scanCarry(state, sessionId, adopted) {
224
- const carry = state.carry;
225
- if (carry.length === 0 || carry[carry.length - 1] !== CLOSING_BRACE)
226
- return;
227
- state.tentative = eligible(reportHitInLine(carry.toString("utf8"), state.lineIndex, sessionId), adopted, state);
228
- }
229
- /**
230
- * Consume everything appended to the transcript since the previous poll,
231
- * updating `state` in place.
232
- *
233
- * ENOENT is "not there YET": under `-p` the hook can fire before the
234
- * transcript file exists, and it may appear inside the bound. Every other
235
- * failure, and anything at that path that is not a regular file, means
236
- * something IS there and cannot be read as a transcript, which is a
237
- * distinct, immediately-reported condition rather than something waiting
238
- * will fix.
239
- */
240
- function pollTranscript(transcriptPath, state, sessionId, adopted) {
241
- // Provisional only for the poll that produced it: a file that vanished
242
- // (or shrank) between polls must not leave a hit behind.
243
- state.tentative = null;
244
- let fd;
245
- try {
246
- fd = fs.openSync(transcriptPath, "r");
247
- }
248
- catch (err) {
249
- if (err.code === "ENOENT")
250
- return "absent";
251
- return "unreadable";
252
- }
253
- try {
254
- const stat = fs.fstatSync(fd);
255
- if (!stat.isFile())
256
- return "unreadable";
257
- // Identity change: the file at this path was replaced (rename, or a
258
- // recreate) between polls. Checked BEFORE the size comparison and
259
- // independently of it, because a replacement can be the same size or
260
- // larger, which the size check alone would read straight through as
261
- // ordinary growth.
262
- const identityChanged = state.ino !== null && (stat.ino !== state.ino || stat.dev !== state.dev);
263
- if (identityChanged || stat.size < state.offset) {
264
- // The file shrank, or was replaced in place: truncated, or a
265
- // different file now sits at this path. The bytes the offset
266
- // pointed past are stale (shrink) or belong to a different file
267
- // entirely (identity change), so start over from the top.
268
- Object.assign(state, newScanState());
269
- }
270
- state.ino = stat.ino;
271
- state.dev = stat.dev;
272
- if (stat.size > state.offset) {
273
- const chunk = readAt(fd, state.offset, stat.size - state.offset);
274
- state.offset += chunk.length;
275
- const data = state.carry.length > 0 ? Buffer.concat([state.carry, chunk]) : chunk;
276
- let start = 0;
277
- for (;;) {
278
- const nl = data.indexOf(NEWLINE, start);
279
- if (nl === -1)
280
- break;
281
- const hit = eligible(reportHitInLine(data.subarray(start, nl).toString("utf8"), state.lineIndex, sessionId), adopted, state);
282
- if (hit !== null)
283
- state.best = hit;
284
- state.lineIndex += 1;
285
- start = nl + 1;
286
- }
287
- state.carry = start < data.length ? Buffer.from(data.subarray(start)) : Buffer.alloc(0);
288
- }
289
- scanCarry(state, sessionId, adopted);
290
- return "ok";
291
- }
292
- catch {
293
- return "unreadable";
294
- }
295
- finally {
296
- fs.closeSync(fd);
297
- }
298
- }
299
- function defaultSleep(ms) {
300
- return new Promise((resolve) => {
301
- setTimeout(resolve, ms);
302
- });
303
- }
304
- /**
305
- * Poll the payload's own transcript for this session's Understanding
306
- * Report until it appears or `maxWaitMs` elapses. See the module header
307
- * for the filters and why each one is there.
308
- *
309
- * The poll timer is deliberately NOT `unref`'d. A hook process whose
310
- * stdin has been drained has no other ref'd handle, so an unref'd timer
311
- * lets Node exit mid-poll: the process would end with an empty stdout,
312
- * which Claude Code reads as ALLOW: a silent fail-open on precisely the
313
- * delegation path this scan exists for. The loop is bounded twice over
314
- * (`maxWaitMs`, itself capped by the config's 5 s ceiling, and the
315
- * `maxPolls` count below), so it can never hold the process open beyond
316
- * the bound.
317
- */
318
- export async function scanTranscriptForReport(args) {
319
- const now = args.now ?? (() => Date.now());
320
- const sleep = args.sleep ?? defaultSleep;
321
- const pollMs = args.pollMs !== undefined && args.pollMs > 0 ? args.pollMs : DEFAULT_POLL_MS;
322
- const maxWaitMs = Number.isFinite(args.maxWaitMs) && args.maxWaitMs > 0 ? args.maxWaitMs : 0;
323
- const adopted = args.adopted ?? EMPTY_ADOPTED;
324
- const start = now();
325
- // Belt and braces against a clock that does not advance (an injected
326
- // one that forgets to, a suspended VM): the poll count is bounded on
327
- // its own, so this can never become an unbounded loop inside a hook.
328
- // Generous enough that it never pre-empts the real time bound.
329
- const maxPolls = Math.ceil(maxWaitMs / pollMs) + 2;
330
- const state = newScanState();
331
- for (let poll = 0;; poll += 1) {
332
- const outcome = pollTranscript(args.transcriptPath, state, args.sessionId, adopted);
333
- if (outcome === "unreadable") {
334
- return { found: false, reason: "unreadable", waitedMs: now() - start };
335
- }
336
- // The provisional trailing-line hit is newer than any complete one.
337
- const hit = state.tentative ?? state.best;
338
- if (hit !== null) {
339
- return {
340
- found: true,
341
- markdown: hit.markdown,
342
- lineIndex: hit.lineIndex,
343
- entryId: hit.entryId,
344
- waitedMs: now() - start,
345
- };
346
- }
347
- const elapsed = now() - start;
348
- if (elapsed >= maxWaitMs || poll >= maxPolls) {
349
- return {
350
- found: false,
351
- reason: "timeout",
352
- ...(state.adoptedSkipped ? { adoptedOnly: true } : {}),
353
- waitedMs: elapsed,
354
- };
355
- }
356
- await sleep(pollMs);
357
- }
358
- }
359
- //# sourceMappingURL=transcript-report-scan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transcript-report-scan.js","sourceRoot":"","sources":["../../../src/cli/pack/transcript-report-scan.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,mCAAmC;AACnC,sEAAsE;AACtE,sCAAsC;AACtC,EAAE;AACF,iEAAiE;AACjE,uEAAuE;AACvE,yEAAyE;AACzE,mEAAmE;AACnE,mEAAmE;AACnE,qEAAqE;AACrE,gEAAgE;AAChE,yDAAyD;AACzD,wEAAwE;AACxE,wEAAwE;AACxE,sEAAsE;AACtE,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACzE,2BAA2B;AAC3B,EAAE;AACF,6DAA6D;AAC7D,EAAE;AACF,0EAA0E;AAC1E,kEAAkE;AAClE,yEAAyE;AACzE,oEAAoE;AACpE,wEAAwE;AACxE,uEAAuE;AACvE,yEAAyE;AACzE,eAAe;AACf,0EAA0E;AAC1E,0EAA0E;AAC1E,uEAAuE;AACvE,oEAAoE;AACpE,yEAAyE;AACzE,yEAAyE;AACzE,sEAAsE;AACtE,oEAAoE;AACpE,iBAAiB;AACjB,qEAAqE;AACrE,uEAAuE;AACvE,yEAAyE;AACzE,0EAA0E;AAC1E,wEAAwE;AACxE,oEAAoE;AACpE,uCAAuC;AACvC,EAAE;AACF,sEAAsE;AACtE,mEAAmE;AACnE,qEAAqE;AACrE,mEAAmE;AACnE,0EAA0E;AAC1E,0EAA0E;AAC1E,oEAAoE;AACpE,qEAAqE;AACrE,uEAAuE;AACvE,qEAAqE;AACrE,wBAAwB;AACxB,EAAE;AACF,mEAAmE;AACnE,8CAA8C;AAE9C,OAAO,KAAK,EAAE,MAAM,SA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KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACpF,IAAI,OAAO,KAAK,YAAY,EAAE,CAAC;YAC7B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;QACzE,CAAC;QACD,oEAAoE;QACpE,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC;QAC1C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACjB,OAAO;gBACL,KAAK,EAAE,IAAI;gBACX,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,QAAQ,EAAE,GAAG,EAAE,GAAG,KAAK;aACxB,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,GAAG,GAAG,EAAE,GAAG,KAAK,CAAC;QAC9B,IAAI,OAAO,IAAI,SAAS,IAAI,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC7C,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,SAAS;gBACjB,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/D,QAAQ,EAAE,OAAO;aAClB,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;AACH,CAAC"}
@@ -1,26 +0,0 @@
1
- export declare const UNDERSTANDING_REPORT_REQUIRED_SECTIONS: readonly ["Current Understanding (paragraph)", "Intended Outcome (paragraph)", "Derived Todos (list)", "Acceptance Criteria (list)", "Assumptions (list)", "Open Questions (list)", "Out Of Scope (list)", "Risks (list)", "Verification Plan (list)", "Prior Art (list)"];
2
- /**
3
- * Map a parser section key (e.g. `"priorArt"`) to an agent-facing label
4
- * that pairs it with its display name (e.g. `"Prior Art (priorArt)"`),
5
- * for surfaces that name a SPECIFIC section (like a malformed-sections
6
- * notice) right next to this file's display-name hint (task 823837fd
7
- * review: printing the raw camelCase key alone next to
8
- * `renderReportSchemaHint`'s "Prior Art (list)" bullets read as two
9
- * unrelated vocabularies for the same section). Falls back to the raw
10
- * key unchanged when it is not one of the recognised keys, so a future
11
- * parser section this mirror has not caught up with yet degrades
12
- * gracefully instead of throwing.
13
- */
14
- export declare function describeSectionKey(key: string): string;
15
- /**
16
- * Render a compact, agent-readable hint listing the canonical sections
17
- * the `@lannguyensi/understanding-gate` parser expects. Suitable for
18
- * inlining in a `permissionDecisionReason` string (claude-code) or a
19
- * stderr diagnostic (codex).
20
- *
21
- * Format chosen for legibility in both a JSON-stringified block envelope
22
- * and a plain stderr write: single newline-separated lines, "- " bullets,
23
- * no surrounding code-fence (Claude Code wraps the reason in its own
24
- * formatter, and stderr is read as-is by the operator).
25
- */
26
- export declare function renderReportSchemaHint(): string;
@@ -1,120 +0,0 @@
1
- // Single source of truth (within harness) for the Understanding-Report
2
- // schema hint that the PreToolUse gate emits when blocking a tool call.
3
- //
4
- // The canonical parser lives in `@lannguyensi/understanding-gate`
5
- // (its `core/parser.js` SECTIONS array). Harness inlines the section
6
- // names here so the gate's block message tells the agent exactly what
7
- // to produce — without this, a freeform prose report parses to "Missing
8
- // required sections" and the audit trail is silently empty. (Since the
9
- // task 5d73d78d review HIGH-2 fix, a malformed report also refuses the
10
- // gate-approval marker unless the operator passes --force; this used to
11
- // read "even though the gate-approval marker still gets written", true
12
- // only before that fix.)
13
- //
14
- // Drift risk: if the standalone parser adds, renames, or reorders
15
- // sections, this constant goes out of sync. Mitigation:
16
- // 1. Keep the comment + linked file path at the top, so a reviewer
17
- // who touches the standalone parser notices the harness mirror.
18
- // 2. The standalone Stop hook still logs the actual reject-list to
19
- // `.understanding-gate/parse-errors/`, so a stale harness hint
20
- // gracefully degrades to "your report has the wrong sections —
21
- // here is what the parser wanted" rather than silent failure.
22
- export const UNDERSTANDING_REPORT_REQUIRED_SECTIONS = [
23
- "Current Understanding (paragraph)",
24
- "Intended Outcome (paragraph)",
25
- "Derived Todos (list)",
26
- "Acceptance Criteria (list)",
27
- "Assumptions (list)",
28
- "Open Questions (list)",
29
- "Out Of Scope (list)",
30
- "Risks (list)",
31
- "Verification Plan (list)",
32
- // Section 10 (agent-grounding 0.4.0): state what was searched for an
33
- // existing solution and what was found, with an explicit
34
- // adopt-or-build judgment. Required by the Stop-capture parser in
35
- // grill_me / full mode; relaxed in fast_confirm. See harness task
36
- // 798d7173 / agent-grounding PR #85.
37
- "Prior Art (list)",
38
- ];
39
- // Derives a display label's camelCase parser key, e.g.
40
- // "Out Of Scope (list)" -> "outOfScope". Intentionally the SAME
41
- // conversion `scripts/check-ug-schema-drift.mjs`'s `labelToCamelKey`
42
- // already uses to diff this file's display names against the upstream
43
- // package's real `SECTIONS[].key` values in CI; reusing the rule here
44
- // (rather than hand-maintaining a second, independently-typed camelCase
45
- // array next to UNDERSTANDING_REPORT_REQUIRED_SECTIONS) means there is
46
- // exactly one list to keep in sync with the parser, not two that could
47
- // silently diverge from EACH OTHER even while both still matched
48
- // upstream individually.
49
- function labelToCamelKey(label) {
50
- const stripped = label.replace(/\s*\([^)]*\)\s*$/, "").trim();
51
- const parts = stripped.split(/\s+/);
52
- return parts
53
- .map((part, idx) => idx === 0
54
- ? part.charAt(0).toLowerCase() + part.slice(1)
55
- : part.charAt(0).toUpperCase() + part.slice(1))
56
- .join("");
57
- }
58
- /**
59
- * Map a parser section key (e.g. `"priorArt"`) to an agent-facing label
60
- * that pairs it with its display name (e.g. `"Prior Art (priorArt)"`),
61
- * for surfaces that name a SPECIFIC section (like a malformed-sections
62
- * notice) right next to this file's display-name hint (task 823837fd
63
- * review: printing the raw camelCase key alone next to
64
- * `renderReportSchemaHint`'s "Prior Art (list)" bullets read as two
65
- * unrelated vocabularies for the same section). Falls back to the raw
66
- * key unchanged when it is not one of the recognised keys, so a future
67
- * parser section this mirror has not caught up with yet degrades
68
- * gracefully instead of throwing.
69
- */
70
- export function describeSectionKey(key) {
71
- const match = UNDERSTANDING_REPORT_REQUIRED_SECTIONS.find((label) => labelToCamelKey(label) === key);
72
- if (!match)
73
- return key;
74
- const label = match.replace(/\s*\((?:paragraph|list)\)$/, "");
75
- return `${label} (${key})`;
76
- }
77
- /**
78
- * Render a compact, agent-readable hint listing the canonical sections
79
- * the `@lannguyensi/understanding-gate` parser expects. Suitable for
80
- * inlining in a `permissionDecisionReason` string (claude-code) or a
81
- * stderr diagnostic (codex).
82
- *
83
- * Format chosen for legibility in both a JSON-stringified block envelope
84
- * and a plain stderr write: single newline-separated lines, "- " bullets,
85
- * no surrounding code-fence (Claude Code wraps the reason in its own
86
- * formatter, and stderr is read as-is by the operator).
87
- */
88
- export function renderReportSchemaHint() {
89
- // Note on the intro wording: the previous iteration included an "e.g."
90
- // alias example ("Current Understanding" or "My Current Understanding")
91
- // that suggested those two were the canonical pair. The parser
92
- // actually accepts more aliases (e.g. `derivedTodos` ⇄ "todos", "derived
93
- // todos / specs"; `verificationPlan` ⇄ "verification"), and listing
94
- // one pair implied exhaustiveness. The bullets below show the canonical
95
- // names; the parser's alias-tolerance is a quiet bonus, not something
96
- // the agent needs to choose between.
97
- // Task 5d73d78d review MEDIUM (fix-round-3): this closing sentence used
98
- // to claim the gate-approval marker "still gets written" for a
99
- // malformed report. That was true before the HIGH-2 enforcement fix
100
- // (harness approve understanding's stdin-report path silently approved
101
- // a rejected submission); it is now false and would teach the agent
102
- // the wrong recovery model. The marker is REFUSED for a malformed
103
- // stdin submission (unless the operator passes --force), same as any
104
- // other validation failure.
105
- const intro = "Report format (parsed by `@lannguyensi/understanding-gate`): markdown with these ten sections, any heading level (#, ##, ###), names case-insensitive. Sections marked (list) need markdown list items ('- ' or '1.') in the body — a prose paragraph under a (list) heading is rejected the same as a missing section. Missing any section produces a parse-error under `.understanding-gate/parse-errors/`, and the approval marker is REFUSED (no ledger tag, no report flip) unless the operator passes --force.";
106
- const bullets = UNDERSTANDING_REPORT_REQUIRED_SECTIONS.map((s) => ` - ${s}`).join("\n");
107
- // Submission recipe (task 61fd36db): the Stop-hook producer fires only
108
- // at END of turn — after `harness approve understanding` already ran —
109
- // so attaching the report to the approve command itself is the one
110
- // path that reliably persists it. The gate's escape matcher accepts
111
- // exactly this heredoc shape (see approve-escape.ts).
112
- const submit = "To persist the report for audit, attach it to the approval command as a quoted heredoc " +
113
- "(the only extra shape the gate allows — no other pipes, chaining, or redirection):\n" +
114
- " harness approve understanding <<'UNDERSTANDING_REPORT'\n" +
115
- " ## Understanding Report\n" +
116
- " ...your report...\n" +
117
- " UNDERSTANDING_REPORT";
118
- return `${intro}\n${bullets}\n${submit}`;
119
- }
120
- //# sourceMappingURL=understanding-report-schema-hint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"understanding-report-schema-hint.js","sourceRoot":"","sources":["../../../src/cli/pack/understanding-report-schema-hint.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wEAAwE;AACxE,EAAE;AACF,kEAAkE;AAClE,qEAAqE;AACrE,sEAAsE;AACtE,wEAAwE;AACxE,uEAAuE;AACvE,uEAAuE;AACvE,wEAAwE;AACxE,uEAAuE;AACvE,yBAAyB;AACzB,EAAE;AACF,kEAAkE;AAClE,wDAAwD;AACxD,qEAAqE;AACrE,qEAAqE;AACrE,qEAAqE;AACrE,oEAAoE;AACpE,oEAAoE;AACpE,mEAAmE;AAEnE,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,mCAAmC;IACnC,8BAA8B;IAC9B,sBAAsB;IACtB,4BAA4B;IAC5B,oBAAoB;IACpB,uBAAuB;IACvB,qBAAqB;IACrB,cAAc;IACd,0BAA0B;IAC1B,qEAAqE;IACrE,yDAAyD;IACzD,kEAAkE;IAClE,kEAAkE;IAClE,qCAAqC;IACrC,kBAAkB;CACV,CAAC;AAEX,uDAAuD;AACvD,gEAAgE;AA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IACrC,wEAAwE;IACxE,+DAA+D;IAC/D,oEAAoE;IACpE,uEAAuE;IACvE,oEAAoE;IACpE,kEAAkE;IAClE,qEAAqE;IACrE,4BAA4B;IAC5B,MAAM,KAAK,GACT,sfAAsf,CAAC;IACzf,MAAM,OAAO,GAAG,sCAAsC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzF,uEAAuE;IACvE,uEAAuE;IACvE,mEAAmE;IACnE,oEAAoE;IACpE,sDAAsD;IACtD,MAAM,MAAM,GACV,yFAAyF;QACzF,sFAAsF;QACtF,4DAA4D;QAC5D,6BAA6B;QAC7B,uBAAuB;QACvB,wBAAwB,CAAC;IAC3B,OAAO,GAAG,KAAK,KAAK,OAAO,KAAK,MAAM,EAAE,CAAC;AAC3C,CAAC"}
@@ -1,32 +0,0 @@
1
- /** Pack names this verb knows how to upgrade. Grows as more upgrades ship. */
2
- export type PackUpgradeName = "understanding-before-execution";
3
- export interface PackUpgradeOptions {
4
- configPath?: string;
5
- homeDir?: string;
6
- dryRun?: boolean;
7
- }
8
- export interface PackUpgradeResult {
9
- path: string;
10
- name: string;
11
- diff: string;
12
- /** True when the manifest was actually written. */
13
- applied: boolean;
14
- /** True when the block was already present: a byte-identical no-op. */
15
- alreadyPresent: boolean;
16
- }
17
- export type ApplyAutoApproveUpgradeResult = {
18
- ok: true;
19
- text: string;
20
- changed: boolean;
21
- } | {
22
- ok: false;
23
- error: string;
24
- };
25
- export declare function applyAutoApproveUpgrade(original: string): ApplyAutoApproveUpgradeResult;
26
- /**
27
- * `harness pack upgrade <name>` implementation. `name` is validated
28
- * against the (currently one-entry) set of known upgrades before any
29
- * file I/O; an unknown name refuses with `EX_FAIL` rather than silently
30
- * doing nothing.
31
- */
32
- export declare function packUpgrade(name: string, opts?: PackUpgradeOptions): Promise<PackUpgradeResult>;