@lannguyensi/harness 0.40.0 → 0.42.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 (189) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +9 -0
  3. package/dist/cli/adopt/derive.d.ts +15 -0
  4. package/dist/cli/adopt/derive.js +34 -7
  5. package/dist/cli/adopt/derive.js.map +1 -1
  6. package/dist/cli/adopt/index.d.ts +30 -0
  7. package/dist/cli/adopt/index.js +23 -3
  8. package/dist/cli/adopt/index.js.map +1 -1
  9. package/dist/cli/apply/generate-settings.d.ts +14 -1
  10. package/dist/cli/apply/generate-settings.js +7 -3
  11. package/dist/cli/apply/generate-settings.js.map +1 -1
  12. package/dist/cli/approve/stdin-report.js +2 -0
  13. package/dist/cli/approve/stdin-report.js.map +1 -1
  14. package/dist/cli/approve/understanding.js +28 -0
  15. package/dist/cli/approve/understanding.js.map +1 -1
  16. package/dist/cli/doctor/claude-mcp.d.ts +50 -0
  17. package/dist/cli/doctor/claude-mcp.js +170 -0
  18. package/dist/cli/doctor/claude-mcp.js.map +1 -0
  19. package/dist/cli/doctor/codex.d.ts +8 -0
  20. package/dist/cli/doctor/codex.js +8 -1
  21. package/dist/cli/doctor/codex.js.map +1 -1
  22. package/dist/cli/doctor/format.js +60 -11
  23. package/dist/cli/doctor/format.js.map +1 -1
  24. package/dist/cli/doctor/index.d.ts +46 -0
  25. package/dist/cli/doctor/index.js +155 -29
  26. package/dist/cli/doctor/index.js.map +1 -1
  27. package/dist/cli/doctor/npm-bin-path.js +42 -0
  28. package/dist/cli/doctor/npm-bin-path.js.map +1 -1
  29. package/dist/cli/doctor/types.d.ts +37 -0
  30. package/dist/cli/doctor/types.js.map +1 -1
  31. package/dist/cli/dry-run.js +5 -0
  32. package/dist/cli/dry-run.js.map +1 -1
  33. package/dist/cli/explain.js +16 -3
  34. package/dist/cli/explain.js.map +1 -1
  35. package/dist/cli/index.js +328 -11
  36. package/dist/cli/index.js.map +1 -1
  37. package/dist/cli/init/agent-tasks-auth.js +32 -0
  38. package/dist/cli/init/agent-tasks-auth.js.map +1 -1
  39. package/dist/cli/init/composer.js +13 -40
  40. package/dist/cli/init/composer.js.map +1 -1
  41. package/dist/cli/init/dependencies.js +21 -0
  42. package/dist/cli/init/dependencies.js.map +1 -1
  43. package/dist/cli/init/detect.d.ts +20 -3
  44. package/dist/cli/init/detect.js +34 -36
  45. package/dist/cli/init/detect.js.map +1 -1
  46. package/dist/cli/init/index.d.ts +18 -0
  47. package/dist/cli/init/index.js +28 -2
  48. package/dist/cli/init/index.js.map +1 -1
  49. package/dist/cli/init/interactive.d.ts +41 -0
  50. package/dist/cli/init/interactive.js +421 -6
  51. package/dist/cli/init/interactive.js.map +1 -1
  52. package/dist/cli/init/profiles.d.ts +2 -2
  53. package/dist/cli/init/profiles.js +10 -1
  54. package/dist/cli/init/profiles.js.map +1 -1
  55. package/dist/cli/init/templates.d.ts +1 -1
  56. package/dist/cli/init/templates.js +217 -8
  57. package/dist/cli/init/templates.js.map +1 -1
  58. package/dist/cli/list.js +3 -1
  59. package/dist/cli/list.js.map +1 -1
  60. package/dist/cli/main.js +10 -0
  61. package/dist/cli/main.js.map +1 -1
  62. package/dist/cli/pack/hook-bootstrap.d.ts +24 -0
  63. package/dist/cli/pack/hook-bootstrap.js +47 -1
  64. package/dist/cli/pack/hook-bootstrap.js.map +1 -1
  65. package/dist/cli/pack/hook-branch-protection.js +9 -1
  66. package/dist/cli/pack/hook-branch-protection.js.map +1 -1
  67. package/dist/cli/pack/hook-codex-post-tool-use.d.ts +25 -0
  68. package/dist/cli/pack/hook-codex-post-tool-use.js +160 -0
  69. package/dist/cli/pack/hook-codex-post-tool-use.js.map +1 -0
  70. package/dist/cli/pack/hook-codex-pre-tool-use.d.ts +1 -0
  71. package/dist/cli/pack/hook-codex-pre-tool-use.js +43 -10
  72. package/dist/cli/pack/hook-codex-pre-tool-use.js.map +1 -1
  73. package/dist/cli/pack/hook-codex-stop.js +1 -8
  74. package/dist/cli/pack/hook-codex-stop.js.map +1 -1
  75. package/dist/cli/pack/hook-post-merge-gate-record.d.ts +30 -0
  76. package/dist/cli/pack/hook-post-merge-gate-record.js +153 -0
  77. package/dist/cli/pack/hook-post-merge-gate-record.js.map +1 -0
  78. package/dist/cli/pack/hook-post-merge-gate.d.ts +28 -0
  79. package/dist/cli/pack/hook-post-merge-gate.js +244 -0
  80. package/dist/cli/pack/hook-post-merge-gate.js.map +1 -0
  81. package/dist/cli/pack/hook-post-tool-use.js +16 -131
  82. package/dist/cli/pack/hook-post-tool-use.js.map +1 -1
  83. package/dist/cli/pack/hook-pre-tool-use.js +54 -2
  84. package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
  85. package/dist/cli/pack/hook-solution-acceptance-writeguard.js +148 -2
  86. package/dist/cli/pack/hook-solution-acceptance-writeguard.js.map +1 -1
  87. package/dist/cli/pack/hook-stay-in-scope.js +63 -20
  88. package/dist/cli/pack/hook-stay-in-scope.js.map +1 -1
  89. package/dist/cli/pack/hook-track-active-claim.js +33 -9
  90. package/dist/cli/pack/hook-track-active-claim.js.map +1 -1
  91. package/dist/cli/pack/index.d.ts +2 -1
  92. package/dist/cli/pack/index.js +2 -1
  93. package/dist/cli/pack/index.js.map +1 -1
  94. package/dist/cli/pack/mutate.d.ts +19 -0
  95. package/dist/cli/pack/mutate.js +38 -0
  96. package/dist/cli/pack/mutate.js.map +1 -1
  97. package/dist/cli/pack/reseed.d.ts +19 -0
  98. package/dist/cli/pack/reseed.js +118 -0
  99. package/dist/cli/pack/reseed.js.map +1 -0
  100. package/dist/cli/pack/understanding-report-schema-hint.js +1 -1
  101. package/dist/cli/pack/understanding-report-schema-hint.js.map +1 -1
  102. package/dist/cli/pause/index.js +12 -3
  103. package/dist/cli/pause/index.js.map +1 -1
  104. package/dist/cli/record/index.d.ts +64 -0
  105. package/dist/cli/record/index.js +211 -0
  106. package/dist/cli/record/index.js.map +1 -0
  107. package/dist/cli/session-start/index.d.ts +21 -0
  108. package/dist/cli/session-start/index.js +160 -25
  109. package/dist/cli/session-start/index.js.map +1 -1
  110. package/dist/cli/session-start/toolchain-parity.d.ts +149 -0
  111. package/dist/cli/session-start/toolchain-parity.js +618 -0
  112. package/dist/cli/session-start/toolchain-parity.js.map +1 -0
  113. package/dist/cli/uninstall/index.d.ts +73 -1
  114. package/dist/cli/uninstall/index.js +134 -2
  115. package/dist/cli/uninstall/index.js.map +1 -1
  116. package/dist/cli/validate/checks.js +8 -0
  117. package/dist/cli/validate/checks.js.map +1 -1
  118. package/dist/io/claude-mcp.d.ts +258 -0
  119. package/dist/io/claude-mcp.js +544 -0
  120. package/dist/io/claude-mcp.js.map +1 -0
  121. package/dist/policies/ledger-client.d.ts +34 -1
  122. package/dist/policies/ledger-client.js +21 -16
  123. package/dist/policies/ledger-client.js.map +1 -1
  124. package/dist/policy-packs/builtin/branch-protection-runtime.d.ts +4 -2
  125. package/dist/policy-packs/builtin/branch-protection-runtime.js +4 -2
  126. package/dist/policy-packs/builtin/branch-protection-runtime.js.map +1 -1
  127. package/dist/policy-packs/builtin/branch-protection.d.ts +10 -1
  128. package/dist/policy-packs/builtin/branch-protection.js +17 -0
  129. package/dist/policy-packs/builtin/branch-protection.js.map +1 -1
  130. package/dist/policy-packs/builtin/post-merge-gate-runtime.d.ts +195 -0
  131. package/dist/policy-packs/builtin/post-merge-gate-runtime.js +290 -0
  132. package/dist/policy-packs/builtin/post-merge-gate-runtime.js.map +1 -0
  133. package/dist/policy-packs/builtin/post-merge-gate.d.ts +56 -0
  134. package/dist/policy-packs/builtin/post-merge-gate.js +291 -0
  135. package/dist/policy-packs/builtin/post-merge-gate.js.map +1 -0
  136. package/dist/policy-packs/builtin/solution-acceptance-runtime.js +28 -13
  137. package/dist/policy-packs/builtin/solution-acceptance-runtime.js.map +1 -1
  138. package/dist/policy-packs/builtin/understanding-before-execution-runtime.d.ts +197 -24
  139. package/dist/policy-packs/builtin/understanding-before-execution-runtime.js +342 -40
  140. package/dist/policy-packs/builtin/understanding-before-execution-runtime.js.map +1 -1
  141. package/dist/policy-packs/builtin/understanding-before-execution.d.ts +26 -1
  142. package/dist/policy-packs/builtin/understanding-before-execution.js +302 -17
  143. package/dist/policy-packs/builtin/understanding-before-execution.js.map +1 -1
  144. package/dist/policy-packs/registry.d.ts +23 -2
  145. package/dist/policy-packs/registry.js +31 -2
  146. package/dist/policy-packs/registry.js.map +1 -1
  147. package/dist/policy-packs/ux-compare.d.ts +14 -0
  148. package/dist/policy-packs/ux-compare.js +58 -0
  149. package/dist/policy-packs/ux-compare.js.map +1 -0
  150. package/dist/policy-packs/ux-drift-check.d.ts +27 -0
  151. package/dist/policy-packs/ux-drift-check.js +78 -0
  152. package/dist/policy-packs/ux-drift-check.js.map +1 -0
  153. package/dist/probes/mcp.d.ts +13 -0
  154. package/dist/probes/mcp.js +57 -0
  155. package/dist/probes/mcp.js.map +1 -1
  156. package/dist/runtime/approval-signing.d.ts +82 -0
  157. package/dist/runtime/approval-signing.js +275 -0
  158. package/dist/runtime/approval-signing.js.map +1 -0
  159. package/dist/runtime/git-context.d.ts +50 -0
  160. package/dist/runtime/git-context.js +108 -1
  161. package/dist/runtime/git-context.js.map +1 -1
  162. package/dist/runtime/hermetic-spawn-guard.d.ts +25 -0
  163. package/dist/runtime/hermetic-spawn-guard.js +136 -0
  164. package/dist/runtime/hermetic-spawn-guard.js.map +1 -0
  165. package/dist/runtime/intercept.js +62 -5
  166. package/dist/runtime/intercept.js.map +1 -1
  167. package/dist/runtime/ledger-writer.d.ts +27 -0
  168. package/dist/runtime/ledger-writer.js +46 -0
  169. package/dist/runtime/ledger-writer.js.map +1 -0
  170. package/dist/runtime/pause-sentinel.js +14 -3
  171. package/dist/runtime/pause-sentinel.js.map +1 -1
  172. package/dist/runtime/read-only-bash.js +118 -0
  173. package/dist/runtime/read-only-bash.js.map +1 -1
  174. package/dist/runtime/recovery-git-commit.d.ts +22 -0
  175. package/dist/runtime/recovery-git-commit.js +284 -0
  176. package/dist/runtime/recovery-git-commit.js.map +1 -0
  177. package/dist/runtime/tool-name-aliases.d.ts +1 -0
  178. package/dist/runtime/tool-name-aliases.js +7 -1
  179. package/dist/runtime/tool-name-aliases.js.map +1 -1
  180. package/dist/schema/index.d.ts +94 -42
  181. package/dist/schema/index.js +5 -0
  182. package/dist/schema/index.js.map +1 -1
  183. package/dist/schema/policies.d.ts +56 -44
  184. package/dist/schema/policies.js +79 -9
  185. package/dist/schema/policies.js.map +1 -1
  186. package/dist/schema/toolchain-parity.d.ts +18 -0
  187. package/dist/schema/toolchain-parity.js +35 -0
  188. package/dist/schema/toolchain-parity.js.map +1 -0
  189. package/package.json +4 -2
@@ -299,20 +299,35 @@ export function bashReferencesVerdictDir(command, dir) {
299
299
  (leaf.length >= 6 && command.includes(leaf))) {
300
300
  return true;
301
301
  }
302
- // Glob-obscured references. bash expands `*?[` against EXISTING paths at
303
- // runtime, so a glob like `solution-ver*/<id>.json` reaches the dir
304
- // without the literal leaf ever appearing in the command text, and a
302
+ // Glob- and brace-obscured references. bash expands `*?[` against EXISTING
303
+ // paths at runtime, so a glob like `solution-ver*/<id>.json` reaches the
304
+ // dir without the literal leaf ever appearing in the command text, and a
305
305
  // matching glob can OVERWRITE an existing marker (flipping ready:false ->
306
- // true). We cannot safely expand globs (that is the shell-eval surface
307
- // read-only-bash refuses), so when a glob metachar is present we match the
308
- // leaf's distinctive sub-words: a single glob can split the hyphenated
309
- // leaf but not erase every >=6-char word of it (`solution-ver*` keeps
310
- // "solution"; `solu*verdicts` keeps "verdicts"). The leaf words, not the
311
- // parent segment, are used on purpose: the parent here is `agent-grounding`,
312
- // which is also a repo name and would over-block legitimate work. A command
313
- // that globs EVERY path segment is the residual the marker-signing
314
- // follow-up closes.
315
- if (/[*?[]/.test(command)) {
306
+ // true). `{...,...}` brace expansion is unconditional (no filesystem
307
+ // lookup needed) and can split the leaf the same way: `solution-verdict{s,}`
308
+ // expands to `solution-verdicts` / `solution-verdict`, neither of which
309
+ // contains the literal leaf as a contiguous substring, so the direct check
310
+ // above misses it. We cannot safely expand either (that is the shell-eval
311
+ // surface read-only-bash refuses), so when a glob OR brace metacharacter is
312
+ // present we match the leaf's distinctive sub-words: a single glob or
313
+ // brace can split the hyphenated leaf but not erase every >=6-char word of
314
+ // it (`solution-ver*` and `solution-verdict{s,}` both keep "solution";
315
+ // `solu*verdicts` keeps "verdicts"). The leaf words, not the parent
316
+ // segment, are used on purpose: the parent here is `agent-grounding`,
317
+ // which is also a repo name and would over-block legitimate work. A
318
+ // command that globs/braces EVERY path segment is the residual the
319
+ // marker-signing follow-up closes.
320
+ //
321
+ // ACCEPTED COST of including `{` here: any brace now enters this
322
+ // leaf-word fallback, so a command carrying a brace AND one of the
323
+ // generic words above trips it even when it never reaches the dir.
324
+ // Measured examples that block today and did not before: `cd
325
+ // /repo/{solution,notes}`, `cd /repo/{a,b}/solution-docs`, and any
326
+ // non-read-only command containing a brace plus "solution"/"verdicts".
327
+ // "solution" is a common word, so this is not rare. It is deliberate:
328
+ // it fails safe, and the tighter alternative (dropping `{`) reopens
329
+ // the `solution-verdict{s,}` split-leaf hole, which fails open.
330
+ if (/[*?[{]/.test(command)) {
316
331
  const leafWords = leaf.split(/[^A-Za-z0-9]+/).filter((w) => w.length >= 6);
317
332
  if (leafWords.some((w) => command.includes(w)))
318
333
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"solution-acceptance-runtime.js","sourceRoot":"","sources":["../../../src/policy-packs/builtin/solution-acceptance-runtime.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,sEAAsE;AACtE,8EAA8E;AAC9E,4EAA4E;AAC5E,sEAAsE;AACtE,wEAAwE;AACxE,4EAA4E;AAC5E,6CAA6C;AAC7C,EAAE;AACF,uEAAuE;AACvE,yEAAyE;AACzE,2DAA2D;AAC3D,4EAA4E;AAC5E,yEAAyE;AACzE,8EAA8E;AAC9E,2EAA2E;AAC3E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,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IAC9D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"solution-acceptance-runtime.js","sourceRoot":"","sources":["../../../src/policy-packs/builtin/solution-acceptance-runtime.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,sEAAsE;AACtE,8EAA8E;AAC9E,4EAA4E;AAC5E,sEAAsE;AACtE,wEAAwE;AACxE,4EAA4E;AAC5E,6CAA6C;AAC7C,EAAE;AACF,uEAAuE;AACvE,yEAAyE;AACzE,2DAA2D;AAC3D,4EAA4E;AAC5E,yEAAyE;AACzE,8EAA8E;AAC9E,2EAA2E;AAC3E,0EAA0E;AAC1E,gEAAgE;AAChE,EAAE;AACF,2EAA2E;AAC3E,oCAAoC;AACpC,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,wEAAwE;AACxE,8DAA8D;AAC9D,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,uEAAuE;AACvE,EAAE;AACF,sEAAsE;AACtE,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,gBAAgB;AAEhB,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAGhF,MAAM,CAAC,MAAM,SAAS,GAAG,qBAAqB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,aAAa;IACb,gBAAgB;IAChB,YAAY;IACZ,qBAAqB;CACb,CAAC;AAEX;;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C;QAClC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAC5C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,2EAA2E;IAC3E,yEAAyE;IACzE,yEAAyE;IACzE,0EAA0E;IAC1E,qEAAqE;IACrE,6EAA6E;IAC7E,wEAAwE;IACxE,2EAA2E;IAC3E,0EAA0E;IAC1E,4EAA4E;IAC5E,sEAAsE;IACtE,2EAA2E;IAC3E,uEAAuE;IACvE,oEAAoE;IACpE,sEAAsE;IACtE,oEAAoE;IACpE,mEAAmE;IACnE,mCAAmC;IACnC,EAAE;IACF,iEAAiE;IACjE,mEAAmE;IACnE,mEAAmE;IACnE,6DAA6D;IAC7D,mEAAmE;IACnE,uEAAuE;IACvE,sEAAsE;IACtE,oEAAoE;IACpE,gEAAgE;IAChE,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;QAC3E,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IAC9D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type LedgerEntry } from "../../policies/index.js";
2
2
  export declare const APPROVED_LEDGER_TAG_PREFIX = "understanding-approved:";
3
3
  export declare const APPROVAL_MARKER_DIRNAME = ".approvals";
4
- export type ApprovalSource = "marker" | "ledger" | "persisted-report" | "none";
4
+ export type ApprovalSource = "marker" | "ledger" | "persisted-report" | "none" | "recovery-commit";
5
5
  export interface ApprovalCheckResult {
6
6
  approved: boolean;
7
7
  source: ApprovalSource;
@@ -184,6 +184,14 @@ export declare function approvalMarkerPathFor(generatedDir: string, sessionId: s
184
184
  export interface ApprovalMarker {
185
185
  approvedAt: string;
186
186
  approvedBy: string;
187
+ /**
188
+ * sha256 hex of the persisted-report content this approval is bound to
189
+ * at sign-time (harness/f9485cc7). Optional on write (defaults to
190
+ * `null` — a marker with no report to bind, e.g. `harness approve
191
+ * branch-protection`, or a ledger-only approval); always present
192
+ * (possibly `null`) on a marker `checkApprovalMarker` returns.
193
+ */
194
+ reportContentHash?: string | null;
187
195
  }
188
196
  /**
189
197
  * Operator-side: write the marker file the gate consults. Atomic so a
@@ -192,12 +200,50 @@ export interface ApprovalMarker {
192
200
  * operator runs from their un-hooked shell; if the agent could call
193
201
  * this path the gate's value would collapse, so it lives behind the
194
202
  * approve CLI rather than as a generally importable verb.
203
+ *
204
+ * The marker is HMAC-signed (harness/f9485cc7) over (sessionId,
205
+ * approvedAt, approvedBy, reportContentHash) using an operator-side key
206
+ * lazily generated at `<generatedDir>/.approval-signing.key` — see
207
+ * `src/runtime/approval-signing.ts` for the key-management contract and
208
+ * the honest trust model. Mode 0600 on the marker file itself, best-
209
+ * effort (matches the signing key's own permission convention); this is
210
+ * defense-in-depth alongside the signature, not a substitute for it.
195
211
  */
196
212
  export declare function writeApprovalMarker(generatedDir: string, sessionId: string, marker: ApprovalMarker): string;
197
213
  export interface MarkerCheck {
198
214
  matched: boolean;
199
215
  detail: string;
200
216
  marker: ApprovalMarker | null;
217
+ /**
218
+ * True when `matched` is false SPECIFICALLY because a readable marker
219
+ * existed but its `approvedAt` exceeded `opts.maxAgeMs`
220
+ * (agent-tasks/d8ee60ca) — as opposed to the marker being absent
221
+ * (never approved, or cleared by a task-completion boundary tool via
222
+ * `clearApprovalMarker`), corrupted, or the session id malformed.
223
+ * False whenever `matched` is true. This is the signal task 6e888423's
224
+ * recovery-git-commit exemption keys off: "this session/task DID have
225
+ * a real operator approval and it merely aged out" is safe to treat
226
+ * differently from "this session/task was never approved" or "a task
227
+ * boundary just cleared it for a new task" — see
228
+ * src/runtime/recovery-git-commit.ts for the full argument.
229
+ */
230
+ expired: boolean;
231
+ /**
232
+ * True when a marker FILE existed at the expected path but failed
233
+ * signature verification (harness/f9485cc7): missing `signature`/`alg`
234
+ * fields (a legacy pre-signing marker, or a marker planted without the
235
+ * operator-side key), a mismatched `alg`, or a signature that does not
236
+ * verify against the current key. Distinct from the marker being
237
+ * simply absent (`forged: false`, `matched: false`) so a caller can
238
+ * log/alert on an active forgery attempt instead of the routine
239
+ * "nobody has approved yet" case. `matched` is always false when
240
+ * `forged` is true — a forged marker never satisfies the gate,
241
+ * regardless of `approval_lifecycle.max_age`. A transient I/O read
242
+ * failure (`forged: false`, `matched: false`) is kept distinct from
243
+ * both: it is neither "no marker" nor evidence of tampering, just a
244
+ * marker whose integrity cannot be proven right now.
245
+ */
246
+ forged: boolean;
201
247
  }
202
248
  export interface CheckApprovalMarkerOptions {
203
249
  /**
@@ -206,35 +252,31 @@ export interface CheckApprovalMarkerOptions {
206
252
  * treated as expired and returns `matched:false` with an
207
253
  * "expired" detail. When omitted, the marker has no TTL — the
208
254
  * legacy contract (one approval per session, no expiry).
209
- *
210
- * A marker whose body is unreadable (malformed JSON, missing
211
- * `approvedAt`) is treated as approved-but-undateable: the
212
- * existence-only contract documented above wins, so an operator
213
- * who hand-wrote an empty marker file still gets through. This
214
- * matters because the legacy DoS-resistance argument still holds.
215
255
  */
216
256
  maxAgeMs?: number;
217
257
  /** Override "now" for deterministic tests. */
218
258
  now?: Date;
219
259
  }
220
260
  /**
221
- * Gate-side: is the per-session marker file present and readable?
222
- * Returns `matched: true` even if the marker JSON is malformed: the
223
- * file's *existence* is the operator's intent. Corrupted contents
224
- * surface as `marker: null` in the diagnostic but do not invalidate the
225
- * approval, since invalidating on a parse error would hand a denial-
226
- * of-service vector to anyone (including the agent) who could append a
227
- * stray byte to the file. Edit / Write / Bash are gated, so writing
228
- * stray bytes from inside Claude is not possible today, but the
229
- * existence-only contract is the defensible boundary regardless.
261
+ * Gate-side: is the per-session marker file present, readable, AND
262
+ * validly signed? (harness/f9485cc7 this replaced the earlier
263
+ * "existence is enough" contract: a marker's mere presence used to
264
+ * satisfy the gate even with a malformed or corrupted body, on the
265
+ * theory that Edit/Write/Bash being gated meant only the operator could
266
+ * ever create the file. That theory holds only as long as no OTHER
267
+ * write primitive reaches `harness.generated/` exactly the invariant
268
+ * this signing scheme no longer has to trust blindly.) A marker with no
269
+ * `signature`, a wrong `alg`, or a signature that fails to verify is
270
+ * REJECTED — see `MarkerCheck.forged` — with the SAME `matched: false`
271
+ * outcome as no marker at all, but a distinct, forgery-specific detail
272
+ * string so callers can tell the two apart for audit.
230
273
  *
231
- * `opts.maxAgeMs` (agent-tasks/d8ee60ca): when set, a marker whose
232
- * `approvedAt` is older than the cutoff returns `matched:false` with
233
- * an "expired" detail so the agent gets the same "no approval" UX as
234
- * a never-approved session and must re-approve. A marker with no
235
- * readable `approvedAt` (body corrupted) skips the freshness check
236
- * and is treated as approved — same DoS-resistance rationale as the
237
- * body-unreadable branch below.
274
+ * `opts.maxAgeMs` (agent-tasks/d8ee60ca): when set, a validly-signed
275
+ * marker whose `approvedAt` is older than the cutoff returns
276
+ * `matched:false` with an "expired" detail so the agent gets the same
277
+ * "no approval" UX as a never-approved session and must re-approve.
278
+ * Expiry is only evaluated AFTER signature verification succeeds — an
279
+ * unsigned/forged marker is rejected outright, never "expired".
238
280
  */
239
281
  export declare function checkApprovalMarker(generatedDir: string, sessionId: string, opts?: CheckApprovalMarkerOptions): MarkerCheck;
240
282
  export interface ApprovalLifecycle {
@@ -292,6 +334,12 @@ export declare function taskApprovalMarkerPathFor(generatedDir: string, taskId:
292
334
  * Operator-side: write a task-scoped marker file. Atomic. Caller is
293
335
  * `harness approve understanding --task <id>`. The session marker is
294
336
  * written separately by the same caller for back-compat.
337
+ *
338
+ * Signed the same way as `writeApprovalMarker` (harness/f9485cc7), using
339
+ * `task-<id>` (the exact string `checkActiveClaimApprovalMarker` looks
340
+ * up) as the signed markerId — so a validly-signed task marker cannot be
341
+ * copied onto a different task id (or the session marker's id) and still
342
+ * verify.
295
343
  */
296
344
  export declare function writeTaskApprovalMarker(generatedDir: string, taskId: string, marker: ApprovalMarker): string;
297
345
  /**
@@ -307,7 +355,7 @@ export declare function writeTaskApprovalMarker(generatedDir: string, taskId: st
307
355
  * because the scan returned the first existing marker regardless of
308
356
  * which task the agent had actually claimed.
309
357
  *
310
- * Same safety filters as `checkApprovalMarker` (existence-is-enough,
358
+ * Same safety filters as `checkApprovalMarker` (signature verification,
311
359
  * symlink rejection, optional freshness via `maxAgeMs`); the only
312
360
  * difference is the filename suffix derived from `active-claim`.
313
361
  */
@@ -320,6 +368,27 @@ export interface OperatorMarkerApproval {
320
368
  detail: string;
321
369
  /** Task-scoped check detail, for callers that trace the fall-through. */
322
370
  taskCheckDetail: string;
371
+ /**
372
+ * True when EITHER the task-scoped or the session-scoped marker
373
+ * existed but aged past `approval_lifecycle.max_age` (task 6e888423).
374
+ * False when `matched` is true, and false when a marker was simply
375
+ * absent (never approved, or cleared by a task-completion boundary
376
+ * tool) — distinguishing "this identity had a real approval that
377
+ * merely expired" from "this identity was never approved" / "a new
378
+ * task just started". PreToolUse hooks use this (never on its own —
379
+ * always alongside `isRecoveryGitCommit`) to decide whether a bare
380
+ * recovery `git commit` may proceed without a fresh Understanding
381
+ * Report; see src/runtime/recovery-git-commit.ts.
382
+ */
383
+ expired: boolean;
384
+ /**
385
+ * True when EITHER the task-scoped or the session-scoped marker
386
+ * existed but FAILED signature verification (harness/f9485cc7) —
387
+ * missing/invalid signature, wrong `alg`, or tampered payload. Distinct
388
+ * from a marker simply being absent, so a caller can log a forgery
389
+ * attempt distinctly from the routine "not approved yet" case.
390
+ */
391
+ forged: boolean;
323
392
  }
324
393
  /**
325
394
  * Shared marker resolution for the Claude and Codex understanding-gate
@@ -335,6 +404,110 @@ export declare function checkOperatorApprovalMarkers(generatedDir: string, sessi
335
404
  } | null): OperatorMarkerApproval;
336
405
  /** Clear a specific task-scoped marker. Used by the post-tool-use hook. */
337
406
  export declare function clearTaskApprovalMarker(generatedDir: string, taskId: string): void;
407
+ /**
408
+ * Tool names treated as "the Bash tool" for `expire_on_bash_match`
409
+ * command-regex matching. Claude Code has exactly one Bash tool name;
410
+ * a runtime with shell-tool aliases (e.g. Codex's `shell` /
411
+ * `exec_command` / `functions.exec_command`) passes its own set.
412
+ */
413
+ export declare const DEFAULT_BASH_TOOL_NAMES: ReadonlySet<string>;
414
+ /**
415
+ * Tool-name membership test against `expire_on_tool_match`. No GLOB
416
+ * wildcard expansion by design (agent-tasks/d8ee60ca): operators write
417
+ * the exact tool name they mean.
418
+ *
419
+ * It IS alias-aware, though: a tool name is compared against `patterns`
420
+ * after expanding it through `expandToolNameAliases` (shell-tool
421
+ * aliases `Bash`/`shell`/`exec_command`/`functions.exec_command`, and
422
+ * MCP tool-name variants — server hyphen/underscore swap, the
423
+ * `mcp__server__.tool` dotted form). This mirrors the normalization
424
+ * `harness policy intercept`'s `policyMatchesEvent` already applies to
425
+ * the incoming `event.tool_name` (`src/runtime/intercept.ts`, commit
426
+ * 9aacbcd "Fix Codex hook tool matching") — that fix exists precisely
427
+ * because Codex can emit an MCP tool name in one of these variant
428
+ * forms for the identical tool. Before this, a Codex session sending
429
+ * `mcp__agent-tasks__.task_finish` (dotted) or an underscore-server
430
+ * variant would silently never expire the marker: the Codex generator
431
+ * alias-expands the EMITTED TOML `matcher` (`expandCodexHookMatchPattern`
432
+ * in `generate-codex-config.ts`) so Codex's own dispatcher still
433
+ * invokes the hook command, but this function's comparison against the
434
+ * canonical `expire_on_tool_match` config list would reject the
435
+ * variant `tool_name` once inside the hook body — the boundary would
436
+ * silently never fire even though the hook ran (review finding on task
437
+ * a1348c89).
438
+ */
439
+ export declare function toolNameMatchesAny(toolName: string, patterns: readonly string[]): boolean;
440
+ /** First `expire_on_bash_match` regex the command satisfies, or
441
+ * undefined. Patterns are pre-compiled by `parseApprovalLifecycle`
442
+ * (invalid ones already dropped with a warning). Empty command
443
+ * short-circuits to undefined. */
444
+ export declare function bashCommandMatchesAny(command: string, patterns: readonly RegExp[]): RegExp | undefined;
445
+ /** Pull the Bash command out of a tool_input payload, `""` when absent
446
+ * or malformed. */
447
+ export declare function extractBashCommandFromToolInput(toolInput: unknown): string;
448
+ /** Pull `taskId` out of an MCP tool_input payload (`""` when absent /
449
+ * malformed). Task-boundary agent-tasks verbs carry this as a
450
+ * top-level string field. */
451
+ export declare function extractTaskIdFromToolInput(toolInput: unknown): string;
452
+ /** Pull the legacy v1 `tasks_transition` `status` field out of a
453
+ * tool_input payload (`""` when absent / malformed). Only `"done"`
454
+ * releases the work claim; the caller treats any other value as
455
+ * keep-claim. */
456
+ export declare function extractTasksTransitionStatusFromToolInput(toolInput: unknown): string;
457
+ export interface PostToolUseBoundaryMatch {
458
+ /** Final match decision: `toolNameMatched || bashRegex !== undefined`. */
459
+ matched: boolean;
460
+ /** Tool-name match, refined by the tasks_transition status filter. */
461
+ toolNameMatched: boolean;
462
+ /** Tool-name match BEFORE the tasks_transition status filter — lets
463
+ * the caller distinguish "not in the list" from "in the list, but
464
+ * status keeps the claim" for its diagnostic. */
465
+ rawToolNameMatched: boolean;
466
+ /** The `expire_on_bash_match` regex the command satisfied, if any. */
467
+ bashRegex: RegExp | undefined;
468
+ }
469
+ /**
470
+ * Decide whether `toolName` (+ its `tool_input`) crosses one of the
471
+ * configured `approval_lifecycle` boundaries. Pure — no filesystem
472
+ * access. Callers branch on `.matched` before touching marker/report
473
+ * state (see `applyPostToolUseExpiry`).
474
+ */
475
+ export declare function matchPostToolUseBoundary(toolName: string, toolInput: unknown, lifecycle: Pick<ApprovalLifecycle, "expireOnToolMatch" | "expireOnBashMatch">, bashToolNames?: ReadonlySet<string>): PostToolUseBoundaryMatch;
476
+ export interface ApplyPostToolUseExpiryResult {
477
+ /** Did the session marker exist before this call cleared it? */
478
+ wasMarkerPresent: boolean;
479
+ /** Was a task-scoped marker also cleared? Only possible when
480
+ * `toolNameMatched` (Bash regex boundaries never carry a taskId). */
481
+ taskMarkerCleared: boolean;
482
+ /** The task id whose marker was cleared, `""` when none. */
483
+ clearedTaskId: string;
484
+ /** Did the persisted-report expiry succeed? */
485
+ persistedReportExpired: boolean;
486
+ /** Full expiry result (success detail or skip reason) for diagnostics. */
487
+ reportExpiry: ReturnType<typeof expirePersistedReport>;
488
+ }
489
+ /**
490
+ * Side-effecting: clear the session marker, the task-scoped marker
491
+ * (when `toolNameMatched` and `tool_input.taskId` names an existing
492
+ * marker), and expire the persisted report. Call ONLY after
493
+ * `matchPostToolUseBoundary(...).matched` is true — this function does
494
+ * not re-check the match itself. Mirrors the Claude hook's original
495
+ * side effects exactly so both runtimes share one clearing
496
+ * implementation (task a1348c89).
497
+ */
498
+ export declare function applyPostToolUseExpiry(generatedDir: string, sessionId: string, toolInput: unknown, toolNameMatched: boolean, reportsDir: string, now?: Date): ApplyPostToolUseExpiryResult;
499
+ /**
500
+ * Compose the stderr diagnostic line for a matched-and-applied PostToolUse
501
+ * expiry. Shared by `harness pack hook post-tool-use` (Claude) and
502
+ * `harness pack hook codex-post-tool-use` (Codex) — before this extraction
503
+ * the two hooks each built this line by hand from the same four pieces
504
+ * (`matchSource`/`taskNote`/`reportNote`/the present-vs-absent branch),
505
+ * which `check:duplication` flagged as new clones the moment the Codex
506
+ * sibling landed (task a1348c89). `hookLabel` is the caller's own
507
+ * `harness pack hook ...` command string so the message still names the
508
+ * right verb.
509
+ */
510
+ export declare function describePostToolUseExpiry(hookLabel: string, sessionId: string, toolName: string, bashRegex: RegExp | undefined, expiry: ApplyPostToolUseExpiryResult): string;
338
511
  export declare const ACTIVE_CLAIM_FILENAME = "active-claim";
339
512
  export declare function activeClaimPathFor(generatedDir: string): string;
340
513
  /**