@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.
- package/CHANGELOG.md +66 -0
- package/README.md +1 -1
- package/dist/cli/apply/apply.d.ts +20 -0
- package/dist/cli/apply/apply.js +13 -7
- package/dist/cli/apply/apply.js.map +1 -1
- package/dist/cli/apply/install-codex-config.d.ts +26 -4
- package/dist/cli/apply/install-codex-config.js +299 -120
- package/dist/cli/apply/install-codex-config.js.map +1 -1
- package/dist/cli/approve/understanding.d.ts +6 -6
- package/dist/cli/approve/understanding.js +62 -58
- package/dist/cli/approve/understanding.js.map +1 -1
- package/dist/cli/bounded-stdin.d.ts +27 -0
- package/dist/cli/bounded-stdin.js +82 -0
- package/dist/cli/bounded-stdin.js.map +1 -0
- package/dist/cli/doctor/format.js +22 -0
- package/dist/cli/doctor/format.js.map +1 -1
- package/dist/cli/doctor/index.js +60 -31
- package/dist/cli/doctor/index.js.map +1 -1
- package/dist/cli/doctor/settings-drift.js +12 -2
- package/dist/cli/doctor/settings-drift.js.map +1 -1
- package/dist/cli/doctor/types.d.ts +17 -0
- package/dist/cli/dry-run.js +7 -0
- package/dist/cli/dry-run.js.map +1 -1
- package/dist/cli/index.js +46 -144
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/pack/auto-approve-path.js +47 -13
- package/dist/cli/pack/auto-approve-path.js.map +1 -1
- package/dist/cli/pack/hook-bootstrap.d.ts +71 -5
- package/dist/cli/pack/hook-bootstrap.js +92 -18
- package/dist/cli/pack/hook-bootstrap.js.map +1 -1
- package/dist/cli/pack/hook-branch-protection.d.ts +6 -0
- package/dist/cli/pack/hook-branch-protection.js +11 -2
- package/dist/cli/pack/hook-branch-protection.js.map +1 -1
- package/dist/cli/pack/hook-codex-post-tool-use.js +2 -2
- package/dist/cli/pack/hook-codex-post-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-codex-pre-tool-use.d.ts +6 -0
- package/dist/cli/pack/hook-codex-pre-tool-use.js +52 -7
- package/dist/cli/pack/hook-codex-pre-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-post-merge-gate-record.d.ts +7 -0
- package/dist/cli/pack/hook-post-merge-gate-record.js +39 -2
- package/dist/cli/pack/hook-post-merge-gate-record.js.map +1 -1
- package/dist/cli/pack/hook-post-merge-gate.d.ts +6 -0
- package/dist/cli/pack/hook-post-merge-gate.js +17 -2
- package/dist/cli/pack/hook-post-merge-gate.js.map +1 -1
- package/dist/cli/pack/hook-post-tool-use.js +2 -2
- package/dist/cli/pack/hook-post-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-pre-tool-use.d.ts +7 -0
- package/dist/cli/pack/hook-pre-tool-use.js +84 -18
- package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-runtime-reality.d.ts +2 -0
- package/dist/cli/pack/hook-runtime-reality.js +49 -9
- package/dist/cli/pack/hook-runtime-reality.js.map +1 -1
- package/dist/cli/pack/hook-solution-acceptance-writeguard.d.ts +6 -0
- package/dist/cli/pack/hook-solution-acceptance-writeguard.js +11 -2
- package/dist/cli/pack/hook-solution-acceptance-writeguard.js.map +1 -1
- package/dist/cli/pack/hook-solution-acceptance.d.ts +6 -0
- package/dist/cli/pack/hook-solution-acceptance.js +11 -2
- package/dist/cli/pack/hook-solution-acceptance.js.map +1 -1
- package/dist/cli/pack/hook-subagent-start.d.ts +2 -0
- package/dist/cli/pack/hook-subagent-start.js +21 -4
- package/dist/cli/pack/hook-subagent-start.js.map +1 -1
- package/dist/cli/policy/intercept.d.ts +2 -0
- package/dist/cli/policy/intercept.js +14 -13
- package/dist/cli/policy/intercept.js.map +1 -1
- package/dist/cli/record/index.d.ts +11 -2
- package/dist/cli/record/index.js +114 -25
- package/dist/cli/record/index.js.map +1 -1
- package/dist/cli/session-start/branch-check.d.ts +3 -29
- package/dist/cli/session-start/branch-check.js +10 -37
- package/dist/cli/session-start/branch-check.js.map +1 -1
- package/dist/cli/session-start/index.d.ts +3 -32
- package/dist/cli/session-start/index.js +19 -31
- package/dist/cli/session-start/index.js.map +1 -1
- package/dist/cli/session-start/shared-options.d.ts +103 -0
- package/dist/cli/session-start/shared-options.js +107 -0
- package/dist/cli/session-start/shared-options.js.map +1 -0
- package/dist/cli/session-start/stale-base-check.d.ts +3 -28
- package/dist/cli/session-start/stale-base-check.js +10 -37
- package/dist/cli/session-start/stale-base-check.js.map +1 -1
- package/dist/cli/session-start/toolchain-parity.d.ts +5 -21
- package/dist/cli/session-start/toolchain-parity.js +9 -38
- package/dist/cli/session-start/toolchain-parity.js.map +1 -1
- package/dist/cli/smoke/index.d.ts +1 -1
- package/dist/cli/smoke/index.js +8 -11
- package/dist/cli/smoke/index.js.map +1 -1
- package/dist/policy-packs/builtin/post-merge-gate-runtime.d.ts +11 -0
- package/dist/policy-packs/builtin/post-merge-gate-runtime.js +11 -0
- package/dist/policy-packs/builtin/post-merge-gate-runtime.js.map +1 -1
- package/dist/policy-packs/builtin/post-merge-gate.js +5 -2
- package/dist/policy-packs/builtin/post-merge-gate.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.d.ts +36 -0
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js +73 -0
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js.map +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +3 -2
- package/dist/policy-packs/builtin/understanding-before-execution/index.js +5 -2
- package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.d.ts +253 -1
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +429 -13
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.d.ts +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js +2 -2
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.d.ts +36 -0
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js +50 -0
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution.d.ts +3 -2
- package/dist/policy-packs/builtin/understanding-before-execution.js +4 -1
- package/dist/policy-packs/builtin/understanding-before-execution.js.map +1 -1
- package/dist/runtime/bash-prefix-parse.js +319 -126
- package/dist/runtime/bash-prefix-parse.js.map +1 -1
- package/dist/runtime/deletion-target-resolve.js +24 -1
- package/dist/runtime/deletion-target-resolve.js.map +1 -1
- package/dist/runtime/destructive-shell-floor.js +15 -1
- package/dist/runtime/destructive-shell-floor.js.map +1 -1
- package/dist/runtime/intercept.d.ts +38 -0
- package/dist/runtime/intercept.js +224 -5
- package/dist/runtime/intercept.js.map +1 -1
- package/dist/runtime/read-only-bash.js +11 -1
- package/dist/runtime/read-only-bash.js.map +1 -1
- package/dist/runtime/shell-word.d.ts +42 -1
- package/dist/runtime/shell-word.js +174 -6
- package/dist/runtime/shell-word.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
// Receives Claude Code's PostToolUse event JSON on stdin. Fires only when
|
|
5
5
|
// the just-completed tool was Bash AND the command matched `gh pr merge`
|
|
6
|
-
// AND the merge is CONFIRMED by one of two contracts (see
|
|
6
|
+
// (see "Trigger arms" below) AND the merge is CONFIRMED by one of two contracts (see
|
|
7
7
|
// `resolveMergeConfirmation` in post-merge-gate-runtime.ts, "PAYLOAD
|
|
8
8
|
// REALITY" follow-up):
|
|
9
9
|
//
|
|
@@ -27,6 +27,27 @@
|
|
|
27
27
|
// (see post-merge-gate-runtime.ts's header for the full squash-fest
|
|
28
28
|
// rationale — no ancestry walk, no `git` subprocess).
|
|
29
29
|
//
|
|
30
|
+
// Trigger arms: the trigger mirrors the four arms the `gh pr merge` gate
|
|
31
|
+
// policies test in `policyMatchesEvent` (src/runtime/intercept.ts), in the
|
|
32
|
+
// same raw-first, lazy order: `GH_PR_MERGE_BASH_RE` against (1) the raw
|
|
33
|
+
// command, then (2) `normalizeCommand`, (3) `normalizeCommandAmpAware`,
|
|
34
|
+
// (4) `normalizeCommandQuoteAware`. Each later arm is computed only when
|
|
35
|
+
// every earlier arm missed, so a raw match never normalizes, and the
|
|
36
|
+
// result is strictly additive (a command that matched raw keeps matching;
|
|
37
|
+
// no arm removes a hit). That closes wrapper spellings (`nice`/`env`/
|
|
38
|
+
// `command`/`time`), the bare-`&` chain (`echo hi & nice gh pr merge 1`)
|
|
39
|
+
// and a boundary character inside a quoted assignment value
|
|
40
|
+
// (`VAR='a; b' gh pr merge 1`), which the raw regex alone missed while the
|
|
41
|
+
// gate blocked them. Normalisation is skipped above MAX_NORMALIZE_LENGTH,
|
|
42
|
+
// like the gate; such a command is tested raw only, which is the one named
|
|
43
|
+
// residual (a wrapper spelling in a command longer than that bound).
|
|
44
|
+
// Like the gate, quoted text that holds a wrapper plus `gh pr merge` behind
|
|
45
|
+
// a boundary (`git commit -m 'x; env gh pr merge 1'`) also matches; the
|
|
46
|
+
// merged fact is still written only on a confirmed merge result.
|
|
47
|
+
// Only the TRIGGER is widened: the PR number is still read from the raw
|
|
48
|
+
// command and the merged fact is still written only when
|
|
49
|
+
// `resolveMergeConfirmation` confirms the merge.
|
|
50
|
+
//
|
|
30
51
|
// Every non-match / failure path is a no-op: wrong tool, non-matching
|
|
31
52
|
// command, neither contract confirms, an unresolvable git context, no
|
|
32
53
|
// session id, a manifest/ledger failure. `PostToolUse` is `blocking:false`
|
|
@@ -34,6 +55,7 @@
|
|
|
34
55
|
// session; the only observable effect of a miss is that the blocker has
|
|
35
56
|
// no merged-tip fact to compare against for this particular merge.
|
|
36
57
|
import { buildMergedTagContent, GH_PR_MERGE_BASH_RE, PACK_NAME, resolveMergeConfirmation, } from "../../policy-packs/builtin/post-merge-gate-runtime.js";
|
|
58
|
+
import { normalizeCommand, normalizeCommandAmpAware, normalizeCommandQuoteAware, } from "../../runtime/command-normalize.js";
|
|
37
59
|
import { resolveGitContext } from "../../runtime/git-context.js";
|
|
38
60
|
import { resolveManifestLedgerWriter } from "../../runtime/ledger-writer.js";
|
|
39
61
|
import { checkHookPause, loadManifestOrInjected, readStdin } from "./hook-bootstrap.js";
|
|
@@ -44,6 +66,21 @@ function bashCommandOf(toolInput) {
|
|
|
44
66
|
const cmd = toolInput["command"];
|
|
45
67
|
return typeof cmd === "string" ? cmd : "";
|
|
46
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Does `command` look like a `gh pr merge` invocation to any of the four
|
|
71
|
+
* arms the gate policies use? Raw first, then each normalised form, lazily:
|
|
72
|
+
* a later arm runs only after every earlier arm missed. Exported for the
|
|
73
|
+
* divergence measurement and the ordering test.
|
|
74
|
+
*/
|
|
75
|
+
export function recorderTriggerMatches(command) {
|
|
76
|
+
if (GH_PR_MERGE_BASH_RE.test(command))
|
|
77
|
+
return true;
|
|
78
|
+
if (GH_PR_MERGE_BASH_RE.test(normalizeCommand(command).normalized))
|
|
79
|
+
return true;
|
|
80
|
+
if (GH_PR_MERGE_BASH_RE.test(normalizeCommandAmpAware(command).normalized))
|
|
81
|
+
return true;
|
|
82
|
+
return GH_PR_MERGE_BASH_RE.test(normalizeCommandQuoteAware(command).normalized);
|
|
83
|
+
}
|
|
47
84
|
export async function runPackHookPostMergeGateRecordCli(opts = {}) {
|
|
48
85
|
const stdin = opts.stdin ?? process.stdin;
|
|
49
86
|
const stderr = opts.stderr ?? process.stderr;
|
|
@@ -73,7 +110,7 @@ export async function runPackHookPostMergeGateRecordCli(opts = {}) {
|
|
|
73
110
|
return { exitCode: 0, wrote: false, diagnostic };
|
|
74
111
|
}
|
|
75
112
|
const command = bashCommandOf(event.tool_input);
|
|
76
|
-
if (!command || !
|
|
113
|
+
if (!command || !recorderTriggerMatches(command)) {
|
|
77
114
|
const diagnostic = "command did not match gh pr merge, skipping";
|
|
78
115
|
note(diagnostic);
|
|
79
116
|
return { exitCode: 0, wrote: false, diagnostic };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-post-merge-gate-record.js","sourceRoot":"","sources":["../../../src/cli/pack/hook-post-merge-gate-record.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,qCAAqC;AACrC,EAAE;AACF,0EAA0E;AAC1E,yEAAyE;AACzE,
|
|
1
|
+
{"version":3,"file":"hook-post-merge-gate-record.js","sourceRoot":"","sources":["../../../src/cli/pack/hook-post-merge-gate-record.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,qCAAqC;AACrC,EAAE;AACF,0EAA0E;AAC1E,yEAAyE;AACzE,qFAAqF;AACrF,qEAAqE;AACrE,uBAAuB;AACvB,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,sEAAsE;AACtE,0EAA0E;AAC1E,EAAE;AACF,wEAAwE;AACxE,wEAAwE;AACxE,4DAA4D;AAC5D,0EAA0E;AAC1E,6DAA6D;AAC7D,6DAA6D;AAC7D,0DAA0D;AAC1D,yDAAyD;AACzD,EAAE;AACF,qEAAqE;AACrE,0EAA0E;AAC1E,wEAAwE;AACxE,oEAAoE;AACpE,sDAAsD;AACtD,EAAE;AACF,yEAAyE;AACzE,2EAA2E;AAC3E,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,qEAAqE;AACrE,0EAA0E;AAC1E,sEAAsE;AACtE,yEAAyE;AACzE,4DAA4D;AAC5D,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,qEAAqE;AACrE,4EAA4E;AAC5E,wEAAwE;AACxE,iEAAiE;AACjE,wEAAwE;AACxE,yDAAyD;AACzD,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2E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,eAAe,EAAE,CAAC;QAC9E,IAAI,CAAC,UAAU,CAAC,CAAC;QACjB,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;IACnD,CAAC;IACD,MAAM,UAAU,GAAG,YAAY,OAAO,gBAAgB,SAAS,EAAE,CAAC;IAClE,IAAI,CAAC,UAAU,CAAC,CAAC;IACjB,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -25,4 +25,10 @@ export interface PackHookPostMergeGateResult {
|
|
|
25
25
|
/** Diagnostic line emitted to stderr (always, even on allow). */
|
|
26
26
|
diagnostic: string;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* `harness pack hook post-merge-gate`. A stdin read that times out is refused here
|
|
30
|
+
* instead of being handed to the gate as an empty or truncated event it would
|
|
31
|
+
* treat as malformed input (task 7dfdcaaf). The operator pause still wins;
|
|
32
|
+
* every other input runs the gate unchanged.
|
|
33
|
+
*/
|
|
28
34
|
export declare function runPackHookPostMergeGateCli(opts?: PackHookPostMergeGateOptions): Promise<PackHookPostMergeGateResult>;
|
|
@@ -45,12 +45,18 @@
|
|
|
45
45
|
// indistinguishable, and fail-closed here would block ordinary git
|
|
46
46
|
// history work on every branch whenever grounding-mcp hiccups. See
|
|
47
47
|
// post-merge-gate-runtime.ts's header for the full rationale.
|
|
48
|
+
//
|
|
49
|
+
// The one exception is a stdin read that times out (the idle bound in
|
|
50
|
+
// src/cli/bounded-stdin.ts fired before stdin closed): the event never
|
|
51
|
+
// finished arriving, so the command cannot even be classified, and the gate
|
|
52
|
+
// BLOCKS instead of allowing (the operator pause still yields). That refusal
|
|
53
|
+
// sits in the exported wrapper at the end of this file.
|
|
48
54
|
import { isEscapeCommand, isGateEligibleCommand, MERGED_TAG_PREFIX, mergedTagMatchKey, PACK_NAME, resolveDefaultBranchName, } from "../../policy-packs/builtin/post-merge-gate-runtime.js";
|
|
49
55
|
import { queryLedgerByTag } from "../../policies/index.js";
|
|
50
56
|
import { resolveGitContext } from "../../runtime/git-context.js";
|
|
51
57
|
import { renderAgentFacing } from "../../runtime/agent-facing.js";
|
|
52
58
|
import { POLICY_DECISION_TYPE } from "../../io/ledger-record.js";
|
|
53
|
-
import { checkHookPause, loadManifestOrInjected, parseConfigUx, readStdin } from "./hook-bootstrap.js";
|
|
59
|
+
import { checkHookPause, loadManifestOrInjected, parseConfigUx, readStdin, runGateWithStdinRefusal, stdoutBlockRefusal, } from "./hook-bootstrap.js";
|
|
54
60
|
const DEFAULT_BRANCH_PLACEHOLDER = "<default-branch>";
|
|
55
61
|
function bashCommandOf(toolInput) {
|
|
56
62
|
if (typeof toolInput !== "object" || toolInput === null)
|
|
@@ -149,7 +155,7 @@ function blockJson(toolName, command, branch, defaultBranch, matchedContent, ux,
|
|
|
149
155
|
},
|
|
150
156
|
});
|
|
151
157
|
}
|
|
152
|
-
|
|
158
|
+
async function runPackHookPostMergeGateCliInner(opts = {}) {
|
|
153
159
|
const stdin = opts.stdin ?? process.stdin;
|
|
154
160
|
const stdout = opts.stdout ?? process.stdout;
|
|
155
161
|
const stderr = opts.stderr ?? process.stderr;
|
|
@@ -259,4 +265,13 @@ export async function runPackHookPostMergeGateCli(opts = {}) {
|
|
|
259
265
|
stdout.write(`${blockJson(toolName, command, branch, defaultBranch, check.matchedContent ?? matchKey, configUx, sessionId)}\n`);
|
|
260
266
|
return { exitCode: 0, blocked: true, diagnostic };
|
|
261
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* `harness pack hook post-merge-gate`. A stdin read that times out is refused here
|
|
270
|
+
* instead of being handed to the gate as an empty or truncated event it would
|
|
271
|
+
* treat as malformed input (task 7dfdcaaf). The operator pause still wins;
|
|
272
|
+
* every other input runs the gate unchanged.
|
|
273
|
+
*/
|
|
274
|
+
export function runPackHookPostMergeGateCli(opts = {}) {
|
|
275
|
+
return runGateWithStdinRefusal(opts, (stderr) => checkHookPause(PACK_NAME, stderr, opts).paused, stdoutBlockRefusal("post-merge-gate"), runPackHookPostMergeGateCliInner);
|
|
276
|
+
}
|
|
262
277
|
//# sourceMappingURL=hook-post-merge-gate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-post-merge-gate.js","sourceRoot":"","sources":["../../../src/cli/pack/hook-post-merge-gate.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,iCAAiC;AACjC,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,wEAAwE;AACxE,gFAAgF;AAChF,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACzE,yDAAyD;AACzD,EAAE;AACF,yEAAyE;AACzE,oDAAoD;AACpD,wEAAwE;AACxE,wBAAwB;AACxB,2EAA2E;AAC3E,2EAA2E;AAC3E,uEAAuE;AACvE,wEAAwE;AACxE,wEAAwE;AACxE,2EAA2E;AAC3E,0EAA0E;AAC1E,0EAA0E;AAC1E,0EAA0E;AAC1E,uEAAuE;AACvE,uEAAuE;AACvE,wEAAwE;AACxE,yEAAyE;AACzE,yEAAyE;AACzE,mCAAmC;AACnC,sEAAsE;AACtE,uEAAuE;AACvE,yEAAyE;AACzE,6DAA6D;AAC7D,iEAAiE;AACjE,uEAAuE;AACvE,qBAAqB;AACrB,wEAAwE;AACxE,4DAA4D;AAC5D,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,0EAA0E;AAC1E,mEAAmE;AACnE,mEAAmE;AACnE,8DAA8D;
|
|
1
|
+
{"version":3,"file":"hook-post-merge-gate.js","sourceRoot":"","sources":["../../../src/cli/pack/hook-post-merge-gate.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,iCAAiC;AACjC,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,wEAAwE;AACxE,gFAAgF;AAChF,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACzE,yDAAyD;AACzD,EAAE;AACF,yEAAyE;AACzE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AC;IAC/H,IAAI,CAAC,UAAU,CAAC,CAAC;IACjB,MAAM,CAAC,KAAK,CACV,GAAG,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC,cAAc,IAAI,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,IAAI,CAClH,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAqC,EAAE;IAEvC,OAAO,uBAAuB,CAC5B,IAAI,EACJ,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,MAAM,EAC1D,kBAAkB,CAAC,iBAAiB,CAAC,EACrC,gCAAgC,CACjC,CAAC;AACJ,CAAC"}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
// (task 5018c0c4; this hook is not emitted under `mode: session`, the
|
|
30
30
|
// one mode where that binding is not applied), so it degrades to a
|
|
31
31
|
// per-task approval, not to the legacy per-session contract.
|
|
32
|
-
import { applyPostToolUseExpiry, defaultReportsDir, describePostToolUseExpiry, matchPostToolUseBoundary, parseApprovalLifecycle, } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
|
|
32
|
+
import { applyPostToolUseExpiry, defaultReportsDir, describePostToolUseExpiry, describePostToolUseTrigger, matchPostToolUseBoundary, parseApprovalLifecycle, } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
|
|
33
33
|
import { resolveGeneratedDir } from "../../runtime/pending-approval.js";
|
|
34
34
|
import { checkHookPause, loadManifestOrInjected, readStdin, } from "./hook-bootstrap.js";
|
|
35
35
|
const PACK_NAME = "understanding-before-execution";
|
|
@@ -122,7 +122,7 @@ export async function runPackHookPostToolUseCli(opts = {}) {
|
|
|
122
122
|
// and expire the persisted report — same side effects the Codex
|
|
123
123
|
// sibling hook applies via the shared `applyPostToolUseExpiry`.
|
|
124
124
|
const reportsDir = opts.reportsDir ?? defaultReportsDir();
|
|
125
|
-
const expiry = applyPostToolUseExpiry(generatedDir, sessionId, event.tool_input, boundary.toolNameMatched, reportsDir, opts.now);
|
|
125
|
+
const expiry = applyPostToolUseExpiry(generatedDir, sessionId, event.tool_input, boundary.toolNameMatched, reportsDir, opts.now, describePostToolUseTrigger(toolName, boundary));
|
|
126
126
|
const diagnostic = describePostToolUseExpiry("harness pack hook post-tool-use", sessionId, toolName, boundary.bashRegex, expiry);
|
|
127
127
|
stderr.write(`${diagnostic}\n`);
|
|
128
128
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-post-tool-use.js","sourceRoot":"","sources":["../../../src/cli/pack/hook-post-tool-use.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,sEAAsE;AACtE,mEAAmE;AACnE,oDAAoD;AACpD,EAAE;AACF,qEAAqE;AACrE,wEAAwE;AACxE,sEAAsE;AACtE,wEAAwE;AACxE,qEAAqE;AACrE,sEAAsE;AACtE,2EAA2E;AAC3E,qEAAqE;AACrE,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,uEAAuE;AACvE,sEAAsE;AACtE,uEAAuE;AACvE,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,qEAAqE;AACrE,uEAAuE;AACvE,gEAAgE;AAChE,sEAAsE;AACtE,mEAAmE;AACnE,6DAA6D;AAE7D,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,sEAAsE,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,SAAS,GACV,MAAM,qBAAqB,CAAC;AAE7B,MAAM,SAAS,GAAG,gCAAg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AAC;IACjB,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,IAAI,CACT,oFAAoF,EACpF,MAAM,CACP,CAAC;IACJ,CAAC;IAED,sEAAsE;IACtE,gEAAgE;IAChE,gEAAgE;IAChE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,iBAAiB,EAAE,CAAC;IAC1D,MAAM,MAAM,GAAG,sBAAsB,CACnC,YAAY,EACZ,SAAS,EACT,KAAK,CAAC,UAAU,EAChB,QAAQ,CAAC,eAAe,EACxB,UAAU,EACV,IAAI,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"hook-post-tool-use.js","sourceRoot":"","sources":["../../../src/cli/pack/hook-post-tool-use.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,sEAAsE;AACtE,mEAAmE;AACnE,oDAAoD;AACpD,EAAE;AACF,qEAAqE;AACrE,wEAAwE;AACxE,sEAAsE;AACtE,wEAAwE;AACxE,qEAAqE;AACrE,sEAAsE;AACtE,2EAA2E;AAC3E,qEAAqE;AACrE,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,uEAAuE;AACvE,sEAAsE;AACtE,uEAAuE;AACvE,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,qEAAqE;AACrE,uEAAuE;AACvE,gEAAgE;AAChE,sEAAsE;AACtE,mEAAmE;AACnE,6DAA6D;AAE7D,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,sEAAsE,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,SAAS,GACV,MAAM,qBAAqB,CAAC;AAE7B,MAAM,SAAS,GAAG,gCAAgC,CAAC;AAqDnD,SAAS,IAAI,CACX,UAAkB,EAClB,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QAC/B,OAAO,IAAI,CACT,oFAAoF,EACpF,MAAM,CACP,CAAC;IACJ,CAAC;IAED,sEAAsE;IACtE,gEAAgE;IAChE,gEAAgE;IAChE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,iBAAiB,EAAE,CAAC;IAC1D,MAAM,MAAM,GAAG,sBAAsB,CACnC,YAAY,EACZ,SAAS,EACT,KAAK,CAAC,UAAU,EAChB,QAAQ,CAAC,eAAe,EACxB,UAAU,EACV,IAAI,CAAC,GAAG,EACR,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAC/C,CAAC;IAEF,MAAM,UAAU,GAAG,yBAAyB,CAC1C,iCAAiC,EACjC,SAAS,EACT,QAAQ,EACR,QAAQ,CAAC,SAAS,EAClB,MAAM,CACP,CAAC;IACF,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,IAAI,CAAC,CAAC;IAChC,OAAO;QACL,QAAQ,EAAE,CAAC;QACX,aAAa,EAAE,IAAI;QACnB,aAAa,EAAE,MAAM,CAAC,gBAAgB;QACtC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,sBAAsB,EAAE,MAAM,CAAC,sBAAsB;QACrD,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -82,4 +82,11 @@ export interface PackHookPreToolUseResult {
|
|
|
82
82
|
* different heading rules in one deny text.
|
|
83
83
|
*/
|
|
84
84
|
export declare const DELEGATION_REPORT_RETRY_INSTRUCTION = "Emit or re-emit your Understanding Report as an `Understanding Report` section (any heading level), then retry this command; if it is denied again, retry again.";
|
|
85
|
+
/**
|
|
86
|
+
* `harness pack hook pre-tool-use`. A stdin read that times out (the idle
|
|
87
|
+
* bound fired before stdin closed) is refused here instead of being handed to
|
|
88
|
+
* the gate as an empty or truncated event it would allow: the event never
|
|
89
|
+
* finished arriving, so the gate cannot judge the tool call (task 7dfdcaaf).
|
|
90
|
+
* The operator pause still wins; every other input runs the gate unchanged.
|
|
91
|
+
*/
|
|
85
92
|
export declare function runPackHookPreToolUseCli(opts?: PackHookPreToolUseOptions): Promise<PackHookPreToolUseResult>;
|
|
@@ -56,7 +56,7 @@ import * as path from "node:path";
|
|
|
56
56
|
import { readRegularFileRejectingSymlink } from "../../io/read-regular-file.js";
|
|
57
57
|
import { queryLedgerByTag, } from "../../policies/index.js";
|
|
58
58
|
import { renderProducers } from "../../policies/producers.js";
|
|
59
|
-
import { ADOPTION_LEDGER_DIRNAME, CLAUDE_CODE_HARNESS, checkOperatorApprovalMarkers, checkPersistedReport, defaultReportsDir, delegationMarkerPathFor, delegationReportPathFor, harnessAllowed,
|
|
59
|
+
import { ADOPTION_LEDGER_DIRNAME, CLAUDE_CODE_HARNESS, approvalExpiryNotice, checkOperatorApprovalMarkers, checkPersistedReport, defaultReportsDir, delegationMarkerPathFor, delegationReportPathFor, describeMarkerTtlExpiry, harnessAllowed, listPersistedReportsBoundedWithSkips, matchLedgerEntries, noApprovalMarkerReason, parseAutoApprove, readActiveClaim, recordPermissionModeObservation, sanitizeForDisplay, selectNewestStrictSessionReport, verifyDelegation, verifyInflightRecord, verifyMatchedMarkerReport, } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
|
|
60
60
|
import { resolveMode, toPackageMode, } from "../../policy-packs/builtin/understanding-before-execution.js";
|
|
61
61
|
import { sha256Hex, signingKeyExists } from "../../runtime/approval-signing.js";
|
|
62
62
|
import { findLatestParseError, renderMalformedSectionsNotice } from "../approve/understanding.js";
|
|
@@ -71,7 +71,7 @@ import { ProducerSchema, } from "../../schema/index.js";
|
|
|
71
71
|
import { renderAgentFacing } from "../../runtime/agent-facing.js";
|
|
72
72
|
import { z } from "zod";
|
|
73
73
|
import { isEscapeCommand } from "./approve-escape.js";
|
|
74
|
-
import { checkHookPause, loadManifestOrInjected, parseConfigUx, readStdin, } from "./hook-bootstrap.js";
|
|
74
|
+
import { checkHookPause, loadManifestOrInjected, parseConfigUx, readStdin, runGateWithStdinRefusal, stdinTimeoutBlockJson, } from "./hook-bootstrap.js";
|
|
75
75
|
import { renderReportSchemaHint } from "./understanding-report-schema-hint.js";
|
|
76
76
|
const PACK_NAME = "understanding-before-execution";
|
|
77
77
|
/**
|
|
@@ -233,7 +233,7 @@ function parseConfigProducers(raw, stderr) {
|
|
|
233
233
|
// the deny envelope the agent sees becomes the plain-language
|
|
234
234
|
// `{ cannot, required, run }` shape and the legacy "Understanding Gate:
|
|
235
235
|
// no approved..." + schemaHint + producers vocabulary is suppressed.
|
|
236
|
-
function blockJson(toolName, reason, producers, ux, sessionId, escapeHint, malformedSections, retryInstruction) {
|
|
236
|
+
function blockJson(toolName, reason, producers, ux, sessionId, escapeHint, malformedSections, retryInstruction, expiryNotice) {
|
|
237
237
|
// When the pack config declares `ux:`, the agent-facing surface
|
|
238
238
|
// becomes the plain-language `{ cannot, required, run }` shape, and
|
|
239
239
|
// the legacy schemaHint + producers block is suppressed (the ux
|
|
@@ -261,6 +261,13 @@ function blockJson(toolName, reason, producers, ux, sessionId, escapeHint, malfo
|
|
|
261
261
|
const producersBlock = renderProducers(producers, { SESSION_ID: sessionId });
|
|
262
262
|
reasonText = `Understanding Gate: ${reason}. Tool: ${toolName}. ${suffix}\n${schemaHint}${producersBlock}`;
|
|
263
263
|
}
|
|
264
|
+
// Say why the approval lapsed (max_age elapsed, or the PostToolUse event
|
|
265
|
+
// that expired it), after the ux/legacy envelope for the same reason the
|
|
266
|
+
// malformed-sections notice below is appended there: both envelopes omit
|
|
267
|
+
// the engine vocabulary, so without this the agent would not see it.
|
|
268
|
+
if (expiryNotice) {
|
|
269
|
+
reasonText = `${reasonText}\n\n${expiryNotice}`;
|
|
270
|
+
}
|
|
264
271
|
// Name the malformed sections from the session's own latest parse-error
|
|
265
272
|
// log, when it carries any (task 823837fd, follow-up to 7e29e5d7): a
|
|
266
273
|
// (list) heading that WAS present but whose body was prose instead of
|
|
@@ -424,7 +431,7 @@ async function checkLedger(manifest, sessionId, opts) {
|
|
|
424
431
|
}
|
|
425
432
|
return matchLedgerEntries(result.entries, sessionId);
|
|
426
433
|
}
|
|
427
|
-
|
|
434
|
+
async function runPackHookPreToolUseCliInner(opts = {}) {
|
|
428
435
|
const stdin = opts.stdin ?? process.stdin;
|
|
429
436
|
const stdout = opts.stdout ?? process.stdout;
|
|
430
437
|
const stderr = opts.stderr ?? process.stderr;
|
|
@@ -543,6 +550,9 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
543
550
|
// runtime.ts's `OperatorMarkerApproval.expired` doc for the full
|
|
544
551
|
// distinction.
|
|
545
552
|
let markerExpired = false;
|
|
553
|
+
// The max_age sentence for the block reason (wording only, never read by a
|
|
554
|
+
// gate decision); set when the marker check reported a TTL expiry.
|
|
555
|
+
let markerTtlExpiry;
|
|
546
556
|
// True when checkOperatorApprovalMarkers found a marker FILE that failed
|
|
547
557
|
// signature verification (harness/f9485cc7) — missing/invalid signature,
|
|
548
558
|
// wrong alg, or tampered payload — for either the task-scoped or
|
|
@@ -562,6 +572,15 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
562
572
|
// text below differs, so the operator sees why an approval that exists
|
|
563
573
|
// on disk does not open the gate.
|
|
564
574
|
let sessionBindingRefusedDetail;
|
|
575
|
+
// Set when a marker matched but no persisted report file hashes to the
|
|
576
|
+
// content that marker was signed for any more (task fa423e9b).
|
|
577
|
+
// The marker is then treated as not matching: the call falls through to the
|
|
578
|
+
// ordinary block path (read-only Bash and the operator-approval command
|
|
579
|
+
// keep their exemptions) with this as the reason, and the in-flight
|
|
580
|
+
// subagent record below is not consulted, because it would otherwise
|
|
581
|
+
// re-open the gate for a subagent under the very approval just refused.
|
|
582
|
+
let reportHashMismatchDetail;
|
|
583
|
+
const reportsDir = opts.reportsDir ?? defaultReportsDir();
|
|
565
584
|
if (generatedDir !== undefined) {
|
|
566
585
|
// Source 1a/1b: task-scoped marker for the currently-claimed task
|
|
567
586
|
// (harness/1ee26e77 + PR #198 correctness fix), then the
|
|
@@ -571,6 +590,7 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
571
590
|
// runtimes cannot drift on lifecycle semantics again.
|
|
572
591
|
const markers = checkOperatorApprovalMarkers(generatedDir, sessionId, declared.config, stderr);
|
|
573
592
|
markerExpired = markers.expired;
|
|
593
|
+
markerTtlExpiry = describeMarkerTtlExpiry(markers);
|
|
574
594
|
markerForged = markers.forged;
|
|
575
595
|
if (markers.sessionBindingRefused)
|
|
576
596
|
sessionBindingRefusedDetail = markers.detail;
|
|
@@ -595,14 +615,22 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
595
615
|
stderr.write(`harness pack hook: task-scoped check: ${markers.taskCheckDetail}\n`);
|
|
596
616
|
}
|
|
597
617
|
if (markers.matched) {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
diagnostic,
|
|
605
|
-
|
|
618
|
+
// Cross-check the matched marker's signed report hash against the
|
|
619
|
+
// persisted reports (task fa423e9b): the task marker first, the
|
|
620
|
+
// session marker as fallback, so the verdict never depends on which
|
|
621
|
+
// marker the check order picked.
|
|
622
|
+
const reportHash = verifyMatchedMarkerReport(reportsDir, markers);
|
|
623
|
+
if (reportHash.ok) {
|
|
624
|
+
const diagnostic = `harness pack hook: ${reportHash.detail}, allowing.`;
|
|
625
|
+
stderr.write(`${diagnostic}\n`);
|
|
626
|
+
return {
|
|
627
|
+
exitCode: 0,
|
|
628
|
+
blocked: false,
|
|
629
|
+
approvalCheck: { approved: true, source: "marker", detail: reportHash.detail },
|
|
630
|
+
diagnostic,
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
reportHashMismatchDetail = reportHash.detail;
|
|
606
634
|
}
|
|
607
635
|
}
|
|
608
636
|
// Source 1c: in-flight subagent record (ADR "TTL, cwd, and subagents").
|
|
@@ -634,7 +662,9 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
634
662
|
// from a record simply never existing, so the subagent sentence below
|
|
635
663
|
// can name the actual cause instead of always saying "no record".
|
|
636
664
|
let inflightStale = false;
|
|
637
|
-
if (generatedDir !== undefined &&
|
|
665
|
+
if (generatedDir !== undefined &&
|
|
666
|
+
agentId !== undefined &&
|
|
667
|
+
reportHashMismatchDetail === undefined) {
|
|
638
668
|
const record = verifyInflightRecord(generatedDir, sessionId, agentId, opts.now !== undefined ? { now: opts.now } : {});
|
|
639
669
|
inflightForged = record.forged;
|
|
640
670
|
inflightStale = record.stale;
|
|
@@ -673,7 +703,6 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
673
703
|
// source that opens the gate. The carve-outs below (read-only Bash,
|
|
674
704
|
// recovery git-commit, escape-ask) are separate, independently-argued
|
|
675
705
|
// exemptions, not a second approval source.
|
|
676
|
-
const reportsDir = opts.reportsDir ?? defaultReportsDir();
|
|
677
706
|
const report = checkPersistedReport(reportsDir, sessionId);
|
|
678
707
|
// Audit-only ledger probe: the ledger row is still recorded by
|
|
679
708
|
// `harness approve understanding`, and we surface its presence in
|
|
@@ -713,15 +742,22 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
713
742
|
// record gets its own distinct phrase for the same reason, checked
|
|
714
743
|
// second so a forged SESSION/TASK marker (the higher-authority forgery)
|
|
715
744
|
// is never masked by a merely-forged copy of it.
|
|
716
|
-
const
|
|
745
|
+
const unapprovedReason = generatedDir !== undefined
|
|
717
746
|
? markerForged
|
|
718
747
|
? `forged/unsigned marker rejected for session ${sessionId}; ${report.detail}; ${ledger.detail}`
|
|
719
748
|
: inflightForged
|
|
720
749
|
? `forged/unsigned in-flight record for agent ${displayAgentId} rejected for session ${sessionId}; ${report.detail}; ${ledger.detail}`
|
|
721
750
|
: sessionBindingRefusedDetail !== undefined
|
|
722
751
|
? `${sessionBindingRefusedDetail}; ${report.detail}; ${ledger.detail}${subagentRecordSentence}`
|
|
723
|
-
:
|
|
752
|
+
: noApprovalMarkerReason(sessionId, markerTtlExpiry, report.detail, ledger.detail, subagentRecordSentence)
|
|
724
753
|
: `generatedDir not resolvable (test/injection path); ${report.detail}; ${ledger.detail}`;
|
|
754
|
+
// A marker that matched but whose signed report content is gone (the
|
|
755
|
+
// approved report was edited or removed after approval, task fa423e9b)
|
|
756
|
+
// gets its own reason, naming the marker kind and the one-command fix; no
|
|
757
|
+
// "no approval marker" wording applies to it.
|
|
758
|
+
const reason = reportHashMismatchDetail !== undefined
|
|
759
|
+
? `${reportHashMismatchDetail}; ${ledger.detail}`
|
|
760
|
+
: unapprovedReason;
|
|
725
761
|
// Stage the session id so `harness approve`, run from the operator's
|
|
726
762
|
// shell where $CLAUDE_CODE_SESSION_ID / $CLAUDE_SESSION_ID is unset, can resolve it without
|
|
727
763
|
// guessing from transcript filenames. Covers both the ask and the
|
|
@@ -940,7 +976,8 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
940
976
|
// payload session_id. Spelling it out keeps the report this
|
|
941
977
|
// branch looks for bound to the same session the delegation,
|
|
942
978
|
// the scan and the adoption ledger are all keyed by.
|
|
943
|
-
const existing = selectNewestStrictSessionReport(
|
|
979
|
+
const existing = selectNewestStrictSessionReport(listPersistedReportsBoundedWithSkips(reportsDir).reports, // bounded: agent-writable dir; a skipped entry is no report
|
|
980
|
+
childSessionId);
|
|
944
981
|
// A report-bound delegation (the `--report` fallback shape,
|
|
945
982
|
// `verified.reportPathHash !== undefined`) never falls through
|
|
946
983
|
// to the transcript scan: the launcher already supplied and
|
|
@@ -1217,6 +1254,15 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
1217
1254
|
const latestParseError = report.report === null
|
|
1218
1255
|
? findLatestParseError(path.join(path.dirname(reportsDir), "parse-errors"), sessionId)
|
|
1219
1256
|
: null;
|
|
1257
|
+
// The expiry notice belongs to the routine "no approval marker" reason
|
|
1258
|
+
// only: a forged marker, a forged in-flight record or a refused task
|
|
1259
|
+
// binding keep their own reasons and never carry it.
|
|
1260
|
+
const expiryNotice = generatedDir !== undefined &&
|
|
1261
|
+
!markerForged &&
|
|
1262
|
+
!inflightForged &&
|
|
1263
|
+
sessionBindingRefusedDetail === undefined
|
|
1264
|
+
? approvalExpiryNotice(markerTtlExpiry, report.report)
|
|
1265
|
+
: undefined;
|
|
1220
1266
|
// The subagent record sentence, delivered to the AGENT through the
|
|
1221
1267
|
// same channel the slice-3 retry instruction uses (appended after both
|
|
1222
1268
|
// the `ux:` and legacy envelopes, so it survives either one) rather
|
|
@@ -1237,7 +1283,7 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
1237
1283
|
: displayAgentId !== undefined && subagentRecordSentence.length > 0
|
|
1238
1284
|
? subagentRecordSentence.trim()
|
|
1239
1285
|
: null;
|
|
1240
|
-
stdout.write(`${blockJson(toolName, "no approved Understanding Report for this session", configProducers, configUx, sessionId, escapeHint, latestParseError?.malformedSections, agentInstruction)}\n`);
|
|
1286
|
+
stdout.write(`${blockJson(toolName, "no approved Understanding Report for this session", configProducers, configUx, sessionId, escapeHint, latestParseError?.malformedSections, agentInstruction, expiryNotice)}\n`);
|
|
1241
1287
|
return {
|
|
1242
1288
|
exitCode: 0,
|
|
1243
1289
|
blocked: true,
|
|
@@ -1245,4 +1291,24 @@ export async function runPackHookPreToolUseCli(opts = {}) {
|
|
|
1245
1291
|
diagnostic,
|
|
1246
1292
|
};
|
|
1247
1293
|
}
|
|
1294
|
+
/**
|
|
1295
|
+
* `harness pack hook pre-tool-use`. A stdin read that times out (the idle
|
|
1296
|
+
* bound fired before stdin closed) is refused here instead of being handed to
|
|
1297
|
+
* the gate as an empty or truncated event it would allow: the event never
|
|
1298
|
+
* finished arriving, so the gate cannot judge the tool call (task 7dfdcaaf).
|
|
1299
|
+
* The operator pause still wins; every other input runs the gate unchanged.
|
|
1300
|
+
*/
|
|
1301
|
+
export function runPackHookPreToolUseCli(opts = {}) {
|
|
1302
|
+
return runGateWithStdinRefusal(opts, (stderr) => checkHookPause("pre-tool-use", stderr, opts, opts.generatedDir, opts.now).paused, (reason, stdout, stderr) => {
|
|
1303
|
+
const diagnostic = `harness pack hook: BLOCK: ${reason}`;
|
|
1304
|
+
stderr.write(`${diagnostic}\n`);
|
|
1305
|
+
stdout.write(`${stdinTimeoutBlockJson(reason)}\n`);
|
|
1306
|
+
return {
|
|
1307
|
+
exitCode: 0,
|
|
1308
|
+
blocked: true,
|
|
1309
|
+
approvalCheck: { approved: false, source: "none", detail: reason },
|
|
1310
|
+
diagnostic,
|
|
1311
|
+
};
|
|
1312
|
+
}, runPackHookPreToolUseCliInner);
|
|
1313
|
+
}
|
|
1248
1314
|
//# sourceMappingURL=hook-pre-tool-use.js.map
|