@lannguyensi/harness 0.59.2 → 0.61.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 (125) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +1 -1
  3. package/dist/cli/apply/apply.d.ts +20 -0
  4. package/dist/cli/apply/apply.js +13 -7
  5. package/dist/cli/apply/apply.js.map +1 -1
  6. package/dist/cli/apply/install-codex-config.d.ts +26 -4
  7. package/dist/cli/apply/install-codex-config.js +299 -120
  8. package/dist/cli/apply/install-codex-config.js.map +1 -1
  9. package/dist/cli/approve/understanding.d.ts +6 -6
  10. package/dist/cli/approve/understanding.js +62 -58
  11. package/dist/cli/approve/understanding.js.map +1 -1
  12. package/dist/cli/bounded-stdin.d.ts +27 -0
  13. package/dist/cli/bounded-stdin.js +82 -0
  14. package/dist/cli/bounded-stdin.js.map +1 -0
  15. package/dist/cli/doctor/format.js +22 -0
  16. package/dist/cli/doctor/format.js.map +1 -1
  17. package/dist/cli/doctor/index.js +60 -31
  18. package/dist/cli/doctor/index.js.map +1 -1
  19. package/dist/cli/doctor/settings-drift.js +12 -2
  20. package/dist/cli/doctor/settings-drift.js.map +1 -1
  21. package/dist/cli/doctor/types.d.ts +17 -0
  22. package/dist/cli/dry-run.js +7 -0
  23. package/dist/cli/dry-run.js.map +1 -1
  24. package/dist/cli/index.js +46 -144
  25. package/dist/cli/index.js.map +1 -1
  26. package/dist/cli/pack/auto-approve-path.js +47 -13
  27. package/dist/cli/pack/auto-approve-path.js.map +1 -1
  28. package/dist/cli/pack/hook-bootstrap.d.ts +71 -5
  29. package/dist/cli/pack/hook-bootstrap.js +92 -18
  30. package/dist/cli/pack/hook-bootstrap.js.map +1 -1
  31. package/dist/cli/pack/hook-branch-protection.d.ts +6 -0
  32. package/dist/cli/pack/hook-branch-protection.js +11 -2
  33. package/dist/cli/pack/hook-branch-protection.js.map +1 -1
  34. package/dist/cli/pack/hook-codex-post-tool-use.js +2 -2
  35. package/dist/cli/pack/hook-codex-post-tool-use.js.map +1 -1
  36. package/dist/cli/pack/hook-codex-pre-tool-use.d.ts +6 -0
  37. package/dist/cli/pack/hook-codex-pre-tool-use.js +52 -7
  38. package/dist/cli/pack/hook-codex-pre-tool-use.js.map +1 -1
  39. package/dist/cli/pack/hook-post-merge-gate-record.d.ts +7 -0
  40. package/dist/cli/pack/hook-post-merge-gate-record.js +39 -2
  41. package/dist/cli/pack/hook-post-merge-gate-record.js.map +1 -1
  42. package/dist/cli/pack/hook-post-merge-gate.d.ts +6 -0
  43. package/dist/cli/pack/hook-post-merge-gate.js +17 -2
  44. package/dist/cli/pack/hook-post-merge-gate.js.map +1 -1
  45. package/dist/cli/pack/hook-post-tool-use.js +2 -2
  46. package/dist/cli/pack/hook-post-tool-use.js.map +1 -1
  47. package/dist/cli/pack/hook-pre-tool-use.d.ts +7 -0
  48. package/dist/cli/pack/hook-pre-tool-use.js +84 -18
  49. package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
  50. package/dist/cli/pack/hook-runtime-reality.d.ts +2 -0
  51. package/dist/cli/pack/hook-runtime-reality.js +49 -9
  52. package/dist/cli/pack/hook-runtime-reality.js.map +1 -1
  53. package/dist/cli/pack/hook-solution-acceptance-writeguard.d.ts +6 -0
  54. package/dist/cli/pack/hook-solution-acceptance-writeguard.js +11 -2
  55. package/dist/cli/pack/hook-solution-acceptance-writeguard.js.map +1 -1
  56. package/dist/cli/pack/hook-solution-acceptance.d.ts +6 -0
  57. package/dist/cli/pack/hook-solution-acceptance.js +11 -2
  58. package/dist/cli/pack/hook-solution-acceptance.js.map +1 -1
  59. package/dist/cli/pack/hook-subagent-start.d.ts +2 -0
  60. package/dist/cli/pack/hook-subagent-start.js +21 -4
  61. package/dist/cli/pack/hook-subagent-start.js.map +1 -1
  62. package/dist/cli/policy/intercept.d.ts +2 -0
  63. package/dist/cli/policy/intercept.js +14 -13
  64. package/dist/cli/policy/intercept.js.map +1 -1
  65. package/dist/cli/record/index.d.ts +11 -2
  66. package/dist/cli/record/index.js +114 -25
  67. package/dist/cli/record/index.js.map +1 -1
  68. package/dist/cli/session-start/branch-check.d.ts +3 -29
  69. package/dist/cli/session-start/branch-check.js +10 -37
  70. package/dist/cli/session-start/branch-check.js.map +1 -1
  71. package/dist/cli/session-start/index.d.ts +3 -32
  72. package/dist/cli/session-start/index.js +19 -31
  73. package/dist/cli/session-start/index.js.map +1 -1
  74. package/dist/cli/session-start/shared-options.d.ts +103 -0
  75. package/dist/cli/session-start/shared-options.js +107 -0
  76. package/dist/cli/session-start/shared-options.js.map +1 -0
  77. package/dist/cli/session-start/stale-base-check.d.ts +3 -28
  78. package/dist/cli/session-start/stale-base-check.js +10 -37
  79. package/dist/cli/session-start/stale-base-check.js.map +1 -1
  80. package/dist/cli/session-start/toolchain-parity.d.ts +5 -21
  81. package/dist/cli/session-start/toolchain-parity.js +9 -38
  82. package/dist/cli/session-start/toolchain-parity.js.map +1 -1
  83. package/dist/cli/smoke/index.d.ts +1 -1
  84. package/dist/cli/smoke/index.js +8 -11
  85. package/dist/cli/smoke/index.js.map +1 -1
  86. package/dist/policy-packs/builtin/post-merge-gate-runtime.d.ts +11 -0
  87. package/dist/policy-packs/builtin/post-merge-gate-runtime.js +11 -0
  88. package/dist/policy-packs/builtin/post-merge-gate-runtime.js.map +1 -1
  89. package/dist/policy-packs/builtin/post-merge-gate.js +5 -2
  90. package/dist/policy-packs/builtin/post-merge-gate.js.map +1 -1
  91. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.d.ts +36 -0
  92. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js +73 -0
  93. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js.map +1 -0
  94. package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +3 -2
  95. package/dist/policy-packs/builtin/understanding-before-execution/index.js +5 -2
  96. package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +1 -1
  97. package/dist/policy-packs/builtin/understanding-before-execution/markers.js +1 -0
  98. package/dist/policy-packs/builtin/understanding-before-execution/markers.js.map +1 -1
  99. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.d.ts +253 -1
  100. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +429 -13
  101. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js.map +1 -1
  102. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.d.ts +1 -1
  103. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js +2 -2
  104. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js.map +1 -1
  105. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.d.ts +36 -0
  106. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js +50 -0
  107. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js.map +1 -1
  108. package/dist/policy-packs/builtin/understanding-before-execution.d.ts +3 -2
  109. package/dist/policy-packs/builtin/understanding-before-execution.js +4 -1
  110. package/dist/policy-packs/builtin/understanding-before-execution.js.map +1 -1
  111. package/dist/runtime/bash-prefix-parse.js +319 -126
  112. package/dist/runtime/bash-prefix-parse.js.map +1 -1
  113. package/dist/runtime/deletion-target-resolve.js +24 -1
  114. package/dist/runtime/deletion-target-resolve.js.map +1 -1
  115. package/dist/runtime/destructive-shell-floor.js +15 -1
  116. package/dist/runtime/destructive-shell-floor.js.map +1 -1
  117. package/dist/runtime/intercept.d.ts +38 -0
  118. package/dist/runtime/intercept.js +224 -5
  119. package/dist/runtime/intercept.js.map +1 -1
  120. package/dist/runtime/read-only-bash.js +11 -1
  121. package/dist/runtime/read-only-bash.js.map +1 -1
  122. package/dist/runtime/shell-word.d.ts +42 -1
  123. package/dist/runtime/shell-word.js +174 -6
  124. package/dist/runtime/shell-word.js.map +1 -1
  125. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/policy-packs/builtin/understanding-before-execution/index.ts"],"names":[],"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ACvE,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EAIrB,mBAAmB,EAGnB,oBAAoB,EACpB,mBAAmB,EAEnB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/policy-packs/builtin/understanding-before-execution/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,mEAAmE;AACnE,sEAAsE;AACtE,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,uEAAuE;AACvE,oEAAoE;AACpE,qEAAqE;AACrE,yEAAyE;AACzE,uEAAuE;AACvE,oEAAoE;AACpE,qEAAqE;AACrE,sEAAsE;AACtE,uEAAuE;AACvE,sEAAsE;AACtE,oEAAoE;AACpE,yEAAyE;AACzE,gEAAgE;AAChE,0EAA0E;AAC1E,yEAAyE;AACzE,uEAAuE;AACvE,yEAAyE;AACzE,uEAAuE;AACvE,sEAAsE;AACtE,kEAAkE;AAClE,wEAAwE;AACxE,yDAAyD;AACzD,qEAAqE;AACrE,sEAAsE;AACtE,uEAAuE;AACvE,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,oEAAoE;AACpE,sEAAsE;AAqBtE,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EAErB,mBAAmB,EAGnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEL,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EAEpB,oCAAoC,EACpC,4BAA4B,EAC5B,gCAAgC,EAGhC,sBAAsB,EACtB,+BAA+B,EAC/B,0BAA0B,EAE1B,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EAGvB,q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DAA6D;AAC7D,wEAAwE;AACxE,uEAAuE;AACvE,gEAAgE;AAChE,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EAEjB,yBAAyB,EAGzB,yBAAyB,EAGzB,qBAAqB,EAIrB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAEjC,gEAAgE;AAChE,uEAAuE;AACvE,qEAAqE;AACrE,wDAAwD;AACxD,sEAAsE;AACtE,qEAAqE;AACrE,sEAAsE;AACtE,uEAAuE;AACvE,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EAIrB,mBAAmB,EAGnB,oBAAoB,EACpB,mBAAmB,EAEnB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAE/B,4EAA4E;AAC5E,8DAA8D;AAC9D,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,oBAAoB,CAAC"}
@@ -214,6 +214,7 @@ export function checkApprovalMarker(generatedDir, sessionId, opts = {}) {
214
214
  if (ageMs > opts.maxAgeMs) {
215
215
  const ageMin = Math.round(ageMs / 60_000);
216
216
  const maxMin = Math.round(opts.maxAgeMs / 60_000);
217
+ // KEEP IN SYNC: describeMarkerTtlExpiry (expiry-reason.ts) parses this detail.
217
218
  return {
218
219
  matched: false,
219
220
  detail: `approval marker ${path.basename(filePath)} expired: age ${ageMin}m > max ${maxMin}m (approved at ${approvedAt})`,
@@ -1 +1 @@
1
- {"version":3,"file":"markers.js","sourceRoot":"","sources":["../../../../src/policy-packs/builtin/understanding-before-execution/markers.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,6EAA6E;AAC7E,sEAAsE;AACtE,iDAAiD;AACjD,uEAAuE;AACvE,kCAAkC;AAElC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,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B;IACzE,IAAI,CAAC;QACH,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,kBAAkB;IACpB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"markers.js","sourceRoot":"","sources":["../../../../src/policy-packs/builtin/understanding-before-execution/markers.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,6EAA6E;AAC7E,sEAAsE;AACtE,iDAAiD;AACjD,uEAAuE;AACvE,kCAAkC;AAElC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAEpD,0DAA0D;AAC1D,MAAM,UAAU,qBAAqB,CAAC,YAAoB,EAAE,SAAiB;IAC3E,wBAAwB,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,uBAAuB,EAAE,SAAS,CAAC,CAAC;AACrE,CAAC;AA0BD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,mBAAmB,CACjC,YAAoB,EACpB,SAAiB,EACjB,MAAsB;IAEtB,MAAM,QAAQ,GAAG,qBAAqB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAChE,MAAM,WAAW,GACf,MAAM,CAAC,WA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AM,WAAW,MAAM,kBAAkB,UAAU,GAAG;oBACzH,MAAM;oBACN,OAAO,EAAE,IAAI;oBACb,MAAM,EAAE,KAAK;iBACd,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,uBAAuB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,UAAU,OAAO,UAAU,sBAAsB;QACxH,MAAM;QACN,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,KAAK;KACd,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,mBAAmB,CAAC,YAAoB,EAAE,SAAiB;IACzE,IAAI,CAAC;QACH,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,kBAAkB;IACpB,CAAC;AACH,CAAC"}
@@ -3,6 +3,15 @@ export interface PersistedReport {
3
3
  sessionId: string | null;
4
4
  approvalStatus: string | null;
5
5
  approvedAt: string | null;
6
+ /**
7
+ * Event a PostToolUse boundary expired this report for
8
+ * (`tool:<tool_name>` or `bash:/<regex>/`), stamped by
9
+ * `expirePersistedReport`; null for a report without the field (older
10
+ * reports, package producers, or a TTL-only lapse).
11
+ */
12
+ expiredBy: string | null;
13
+ /** ISO timestamp `expirePersistedReport` stamped; null when absent. */
14
+ expiredAt: string | null;
6
15
  /**
7
16
  * ISO timestamp the producer stamped when it wrote the report; null
8
17
  * for legacy reports without the field.
@@ -165,6 +174,18 @@ export declare function selectNewestStrictSessionReport(reports: PersistedReport
165
174
  * only need the report (the gate read and expiry paths).
166
175
  */
167
176
  export declare function findLatestReportForSession(reports: PersistedReport[], sessionId: string, opts?: FindReportOptions): PersistedReport | null;
177
+ /**
178
+ * `detail` is not an inert log line: both PreToolUse hooks embed it
179
+ * verbatim into their block `reason`, and the Codex hook additionally
180
+ * writes it to stderr, the block-reason surface an operator reads
181
+ * directly. The report file's basename and its `approvedAt` field both
182
+ * come from a JSON file whose content the gated agent controls (it is
183
+ * only unsigned evidence, task 7402301d), so neither is trusted
184
+ * verbatim here: control characters (including newlines, which could
185
+ * forge extra `reason:`-looking lines) are replaced with a space and
186
+ * the result is capped so one field cannot blow out the surface.
187
+ */
188
+ export declare function sanitizeDetailValue(value: string): string;
168
189
  /**
169
190
  * What the gate learns from the persisted report: EVIDENCE, never
170
191
  * authority (task 7402301d). Until that task the report was the second
@@ -209,7 +230,7 @@ export interface PersistedReportEvidence {
209
230
  * best-effort cleanup so a missing report dir or unrelated I/O issue
210
231
  * does not escalate into a session-breaking hook failure.
211
232
  */
212
- export declare function expirePersistedReport(reportsDir: string, sessionId: string, now?: Date): {
233
+ export declare function expirePersistedReport(reportsDir: string, sessionId: string, now?: Date, trigger?: string): {
213
234
  ok: true;
214
235
  filePath: string;
215
236
  previousStatus: string | null;
@@ -235,3 +256,234 @@ export declare function expirePersistedReport(reportsDir: string, sessionId: str
235
256
  * `understanding-gate approve` CLI, which writes no signed marker).
236
257
  */
237
258
  export declare function checkPersistedReport(reportsDir: string, sessionId: string): PersistedReportEvidence;
259
+ /**
260
+ * `approval expired because <event> at <time>` for a report a PostToolUse
261
+ * boundary expired (`expirePersistedReport` stamps `expiredBy` and
262
+ * `expiredAt`), `undefined` for any other report, including an older one or
263
+ * one a package producer wrote that carries no `expiredBy`. Both values come
264
+ * from a JSON file the gated agent can write, so both pass
265
+ * `sanitizeDetailValue`.
266
+ */
267
+ export declare function describeBoundaryExpiry(report: Pick<PersistedReport, "approvalStatus" | "expiredBy" | "expiredAt">): string | undefined;
268
+ /**
269
+ * Largest report file, in bytes, the canonical hash reads from disk (1 MiB).
270
+ * Every `*.json` entry of the reports directory reaches the hash through the
271
+ * gate-read scan, and the agent can write that directory, so without a bound
272
+ * a planted file of a few hundred megabytes made the hook run out of heap or
273
+ * past its time budget instead of deciding (a hook that dies or overruns is a
274
+ * non-blocking error for the runtime). A real report is a few kilobytes, far
275
+ * below the cap. A file over the cap matches nothing at gate read, and both
276
+ * producers refuse to approve such a report.
277
+ */
278
+ export declare const MAX_HASHED_REPORT_BYTES: number;
279
+ /** Result of {@link walkContainerDepth}. */
280
+ export interface ContainerDepthWalk {
281
+ /** True when some array/object nests deeper than the walk's `max` levels. */
282
+ tooDeep: boolean;
283
+ /** Values the walk took off its stack: the root plus every array/object below it. */
284
+ visited: number;
285
+ }
286
+ /**
287
+ * Iterative walk over the arrays and objects of `value` (the value itself is
288
+ * level 1) that stops at the first one nested deeper than `max` levels.
289
+ * Iterative, so the walk itself cannot overflow the stack. Only arrays and
290
+ * objects are pushed: a scalar child (string, number, boolean, null) cannot
291
+ * nest, so a wide array of scalars costs no stack slot per element, and
292
+ * `visited` counts the root plus the containers below it. Exported for tests.
293
+ */
294
+ export declare function walkContainerDepth(value: unknown, max: number): ContainerDepthWalk;
295
+ /**
296
+ * The hash an approval marker signs as its `reportContentHash`, and the one
297
+ * the gate recomputes at read time (task fa423e9b): sha256 over a key-sorted
298
+ * JSON serialisation of the parsed report with the lifecycle fields in
299
+ * `LIFECYCLE_REPORT_FIELDS` removed. A raw-bytes hash cannot do this job: the
300
+ * producers hash before `rewriteReportApproved` re-serialises the file and
301
+ * `expirePersistedReport` rewrites it again, so the raw bytes of an untouched
302
+ * report never match what the marker signed. One function on purpose, shared
303
+ * by both producers (`harness approve understanding`, the auto-approval path)
304
+ * and the verifier.
305
+ *
306
+ * Total: returns null instead of throwing for a report nested deeper than
307
+ * `MAX_CANONICAL_REPORT_DEPTH`. The verifier counts such a file as one that
308
+ * matches nothing; both producers refuse to approve such a report, so no
309
+ * marker is ever signed without a content binding because of it. Report
310
+ * files reach it only after {@link readReportFileBounded} bounded their type
311
+ * and size (the gate-read scan and `harness approve understanding` through
312
+ * {@link hashReportFile}, the auto-approval path directly).
313
+ */
314
+ export declare function canonicalReportHash(report: Record<string, unknown>): string | null;
315
+ /** Why {@link readReportFileBounded} returned no content. */
316
+ export type ReportFileReadFailure = "unreadable" | "not-regular" | "too-large" | "grew";
317
+ export type BoundedReportRead = {
318
+ ok: true;
319
+ raw: string;
320
+ mtimeMs: number;
321
+ } | {
322
+ ok: false;
323
+ reason: ReportFileReadFailure;
324
+ detail: string;
325
+ };
326
+ /**
327
+ * Read a report file for hashing, bounded by type and size. This is the one
328
+ * read every canonical report hash goes through: the gate-read scan (via
329
+ * {@link hashReportFile}) and both producers. The path is opened once,
330
+ * read-only and non-blocking (`O_NONBLOCK`: opening a FIFO with no writer
331
+ * returns at once instead of waiting for one); its type and size come from
332
+ * `fstat` on that descriptor, and the content is read through the same
333
+ * descriptor, so nothing can be swapped in between (no separate stat of the
334
+ * path, which a symlink flipped to a FIFO used to race). Refused without
335
+ * reading: anything that is not a regular file, and a file larger than
336
+ * `MAX_HASHED_REPORT_BYTES`. The read stops one byte past the fstat size
337
+ * (never more than the cap plus one byte); a file that grows into that byte
338
+ * while being read is refused too. The descriptor is always closed. Never
339
+ * throws.
340
+ */
341
+ export declare function readReportFileBounded(filePath: string): BoundedReportRead;
342
+ /** Why a report file has no canonical hash. */
343
+ export type UnhashableReportReason = ReportFileReadFailure | "not-json-object" | "too-deep";
344
+ export type ReportFileHash = {
345
+ ok: true;
346
+ hash: string;
347
+ } | {
348
+ ok: false;
349
+ reason: UnhashableReportReason;
350
+ detail: string;
351
+ };
352
+ /**
353
+ * Canonical hash of the report file at `filePath`, read through
354
+ * {@link readReportFileBounded}, or why it has none: not a regular file, over
355
+ * `MAX_HASHED_REPORT_BYTES`, unreadable, grown while read, not a JSON object,
356
+ * or nested too deeply. `harness approve understanding` refuses a report on
357
+ * any of these (the `detail` is its message); the gate-read scan counts such
358
+ * a file as one that matches nothing. Never throws.
359
+ */
360
+ export declare function hashReportFile(filePath: string): ReportFileHash;
361
+ /** Canonical hash of the report file at `filePath` ({@link hashReportFile}); null when it has none. */
362
+ export declare function canonicalReportHashOfFile(filePath: string): string | null;
363
+ /** Marker kind whose signed report hash the gate checks. */
364
+ export type ApprovalMarkerKind = "task" | "session";
365
+ /** One matched marker's signed `reportContentHash`, tagged with its kind. */
366
+ export interface MarkerReportBinding {
367
+ kind: ApprovalMarkerKind;
368
+ reportContentHash: string | null;
369
+ }
370
+ export type ApprovedReportHashVerification = {
371
+ ok: true;
372
+ kind: ApprovalMarkerKind;
373
+ } | {
374
+ ok: false;
375
+ detail: string;
376
+ };
377
+ /**
378
+ * Gate-read cross-check of a matched approval marker against the persisted
379
+ * reports (task fa423e9b). Both PreToolUse hooks call it after
380
+ * `checkOperatorApprovalMarkers` matched, through `verifyMatchedMarkerReport`.
381
+ *
382
+ * Rule: a marker with a non-null signed `reportContentHash` is valid iff at
383
+ * least one parseable report file in `reportsDir` (any session, any
384
+ * `approvalStatus`) has a canonical hash equal to it. The hash already
385
+ * leaves the lifecycle fields out, so approving, expiring or re-approving
386
+ * the report never changes it. The signed hash therefore proves one thing:
387
+ * the content the operator approved is still on disk unmodified. Editing
388
+ * that file (in place, by swap, by symlink, by an unparseable rewrite)
389
+ * removes the only match and the marker stops opening the gate. Comparing
390
+ * against the session's newest approved report instead would deny
391
+ * legitimate approvals (a newer report approved for the same claim, two
392
+ * sessions on one claim) and would let a swap pass by moving the swapped
393
+ * report out of the selection.
394
+ *
395
+ * Bounded input: only a regular file of at most `MAX_HASHED_REPORT_BYTES`
396
+ * (1 MiB) that parses as a JSON object nested at most 64 levels deep has a
397
+ * canonical hash, read through {@link readReportFileBounded} (opened
398
+ * non-blocking, typed and sized by `fstat` on the open descriptor, read
399
+ * through it). Every other `*.json` entry (a FIFO, a directory, a device, a
400
+ * symlink to one of them, a file over the cap, an unreadable, unparseable or
401
+ * too deeply nested file) still counts as a report file but matches nothing,
402
+ * so it can neither open the gate nor make the scan block, run out of
403
+ * memory or die instead of deciding.
404
+ *
405
+ * Residuals: (1) the check proves only that some file carries the approved
406
+ * content. Any regular `*.json` file within the size cap whose content
407
+ * equals it keeps a match, whether it was kept before the edit (a copy) or
408
+ * re-created after it (the agent wrote that content, so it can write it
409
+ * again), and the marker still opens the gate. (2) A reports directory that
410
+ * is empty, unreadable or holds no `*.json` entry at all (every report
411
+ * deleted, the directory made unreadable, the reports renamed) falls back to
412
+ * the "no report file" allow, the same as before this check existed. The
413
+ * marker and the operator's approval itself are untouched in both cases;
414
+ * only the audit trail loses its claim to be the approved content. (3) The
415
+ * cap bounds each file, not their number: the scan time grows with the
416
+ * total volume of report files, so an agent that plants hundreds of
417
+ * megabytes of files just under the cap can still push one scan past the
418
+ * hook's time budget, which the runtime treats as a non-blocking error (the
419
+ * same allow as before this check existed).
420
+ *
421
+ * Removing the approved report while other report files remain is a deny:
422
+ * nothing on disk carries the signed content any more. `harness gc --apply`
423
+ * can do that legitimately: it ages approved reports out by their createdAt
424
+ * but markers by their file mtime, so a report written long before its
425
+ * approval can go while the marker stays. Re-approving recovers.
426
+ *
427
+ * `primary` is the marker that satisfied the gate (task-scoped first),
428
+ * `fallback` a session marker that matched behind a task marker. The
429
+ * fallback is consulted only when the primary fails the check, so a task
430
+ * marker signed for another report does not hide a session marker that
431
+ * verifies. Unchanged behaviour: a null hash on the accepted marker (no
432
+ * report resolved, or `--force` over a report the producer could not hash:
433
+ * too deeply nested or over the size cap) and a reports directory with no
434
+ * `*.json` entry at all both allow. A forced approval of a hashable report
435
+ * signs its hash and is checked like any other.
436
+ *
437
+ * The `detail` is the block reason. It names the failing marker kind and the
438
+ * one-command fix, which is also the single migration step for a marker
439
+ * written before the canonical hash existed. It carries no report-derived
440
+ * value, so nothing in it needs sanitising.
441
+ */
442
+ export declare function verifyApprovedReportHash(reportsDir: string, primary: MarkerReportBinding, fallback?: MarkerReportBinding | null): ApprovedReportHashVerification;
443
+ /**
444
+ * Why a `*.json` entry of the reports directory is absent from a bounded
445
+ * listing: it could not be read through {@link readReportFileBounded}.
446
+ */
447
+ export interface SkippedReportEntry {
448
+ filePath: string;
449
+ reason: ReportFileReadFailure;
450
+ detail: string;
451
+ }
452
+ /**
453
+ * {@link listPersistedReports} for every read a PreToolUse hook (or the
454
+ * PostToolUse boundary) makes of the reports directory. The directory holds
455
+ * files the gated agent can write, so every entry is opened once through
456
+ * {@link readReportFileBounded}: non-blocking, typed and sized by `fstat` on
457
+ * the open descriptor, read through it. A `*.json` entry that is not a
458
+ * regular file (a FIFO, a directory, a device, a symlink to one of them), is
459
+ * over `MAX_HASHED_REPORT_BYTES`, cannot be opened or read, or grows while it
460
+ * is read is left out of `reports`, as if it were not there, and recorded in
461
+ * `skipped`: it can neither block the hook nor run it out of memory. There is
462
+ * no separate stat of the path (a symlink flipped to a FIFO between that stat
463
+ * and the read used to hang the read), and the modification time comes from
464
+ * the same descriptor.
465
+ *
466
+ * A caller that must not let the selection fall back to an older report when
467
+ * a newer one is unreadable (the auto-approval precondition) declines when
468
+ * `skipped` is not empty. The operator commands (`harness approve
469
+ * understanding`, `harness gc`) keep the unbounded {@link listPersistedReports}
470
+ * on purpose: they must still see an oversized report to refuse or age it.
471
+ *
472
+ * Placement: this block sits at the end of the file, and
473
+ * {@link readPersistedReport} takes the already-read text (`boundedRaw`), so
474
+ * the line numbers the decision record
475
+ * docs/decisions/2026-08-27-ug-auto-mode-approval.md cites in this file stay
476
+ * put (tests/decisions-citations-resolve.test.ts pins them).
477
+ */
478
+ export declare function listPersistedReportsBoundedWithSkips(dir: string): {
479
+ reports: PersistedReport[];
480
+ skipped: SkippedReportEntry[];
481
+ };
482
+ /**
483
+ * {@link listPersistedReportsBoundedWithSkips} without the skipped entries,
484
+ * for the callers that treat a skipped entry as no evidence
485
+ * ({@link checkPersistedReport}, {@link expirePersistedReport}). Expiry acts
486
+ * on the newest report that was within the cap, so an oversized newest
487
+ * approved report is left as it is and the next in-cap one is expired.
488
+ */
489
+ export declare function listPersistedReportsBounded(dir: string): PersistedReport[];