@lannguyensi/harness 0.40.0 → 0.41.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 +37 -0
- package/dist/cli/approve/understanding.js +28 -0
- package/dist/cli/approve/understanding.js.map +1 -1
- package/dist/cli/doctor/codex.d.ts +8 -0
- package/dist/cli/doctor/codex.js +8 -1
- package/dist/cli/doctor/codex.js.map +1 -1
- package/dist/cli/doctor/format.js +23 -11
- package/dist/cli/doctor/format.js.map +1 -1
- package/dist/cli/doctor/index.d.ts +36 -0
- package/dist/cli/doctor/index.js +131 -29
- package/dist/cli/doctor/index.js.map +1 -1
- package/dist/cli/doctor/types.d.ts +26 -0
- package/dist/cli/dry-run.js +5 -0
- package/dist/cli/dry-run.js.map +1 -1
- package/dist/cli/explain.js +16 -3
- package/dist/cli/explain.js.map +1 -1
- package/dist/cli/index.js +75 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/composer.js +10 -31
- package/dist/cli/init/composer.js.map +1 -1
- package/dist/cli/init/index.d.ts +18 -0
- package/dist/cli/init/index.js +28 -2
- package/dist/cli/init/index.js.map +1 -1
- package/dist/cli/init/interactive.d.ts +8 -0
- package/dist/cli/init/interactive.js +22 -1
- package/dist/cli/init/interactive.js.map +1 -1
- package/dist/cli/init/profiles.d.ts +2 -2
- package/dist/cli/init/profiles.js +9 -0
- package/dist/cli/init/profiles.js.map +1 -1
- package/dist/cli/init/templates.d.ts +1 -1
- package/dist/cli/init/templates.js +153 -3
- package/dist/cli/init/templates.js.map +1 -1
- package/dist/cli/list.js +3 -1
- package/dist/cli/list.js.map +1 -1
- package/dist/cli/pack/hook-bootstrap.d.ts +24 -0
- package/dist/cli/pack/hook-bootstrap.js +47 -1
- package/dist/cli/pack/hook-bootstrap.js.map +1 -1
- package/dist/cli/pack/hook-branch-protection.js +9 -1
- package/dist/cli/pack/hook-branch-protection.js.map +1 -1
- package/dist/cli/pack/hook-codex-post-tool-use.d.ts +25 -0
- package/dist/cli/pack/hook-codex-post-tool-use.js +160 -0
- package/dist/cli/pack/hook-codex-post-tool-use.js.map +1 -0
- package/dist/cli/pack/hook-codex-pre-tool-use.d.ts +1 -0
- package/dist/cli/pack/hook-codex-pre-tool-use.js +43 -10
- package/dist/cli/pack/hook-codex-pre-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-codex-stop.js +1 -8
- package/dist/cli/pack/hook-codex-stop.js.map +1 -1
- package/dist/cli/pack/hook-post-tool-use.js +16 -131
- package/dist/cli/pack/hook-post-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-pre-tool-use.js +54 -2
- package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-stay-in-scope.js +63 -20
- package/dist/cli/pack/hook-stay-in-scope.js.map +1 -1
- package/dist/cli/pack/hook-track-active-claim.js +33 -9
- package/dist/cli/pack/hook-track-active-claim.js.map +1 -1
- package/dist/cli/pack/index.d.ts +2 -1
- package/dist/cli/pack/index.js +2 -1
- package/dist/cli/pack/index.js.map +1 -1
- package/dist/cli/pack/mutate.d.ts +19 -0
- package/dist/cli/pack/mutate.js +38 -0
- package/dist/cli/pack/mutate.js.map +1 -1
- package/dist/cli/pack/reseed.d.ts +19 -0
- package/dist/cli/pack/reseed.js +118 -0
- package/dist/cli/pack/reseed.js.map +1 -0
- package/dist/cli/pause/index.js +12 -3
- package/dist/cli/pause/index.js.map +1 -1
- package/dist/cli/session-start/index.d.ts +14 -0
- package/dist/cli/session-start/index.js +42 -2
- package/dist/cli/session-start/index.js.map +1 -1
- package/dist/cli/validate/checks.js +8 -0
- package/dist/cli/validate/checks.js.map +1 -1
- package/dist/policy-packs/builtin/branch-protection-runtime.d.ts +4 -2
- package/dist/policy-packs/builtin/branch-protection-runtime.js +4 -2
- package/dist/policy-packs/builtin/branch-protection-runtime.js.map +1 -1
- package/dist/policy-packs/builtin/branch-protection.d.ts +10 -1
- package/dist/policy-packs/builtin/branch-protection.js +17 -0
- package/dist/policy-packs/builtin/branch-protection.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.d.ts +197 -24
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.js +342 -40
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution.d.ts +26 -1
- package/dist/policy-packs/builtin/understanding-before-execution.js +302 -17
- package/dist/policy-packs/builtin/understanding-before-execution.js.map +1 -1
- package/dist/policy-packs/registry.d.ts +22 -1
- package/dist/policy-packs/registry.js +19 -2
- package/dist/policy-packs/registry.js.map +1 -1
- package/dist/policy-packs/ux-compare.d.ts +14 -0
- package/dist/policy-packs/ux-compare.js +58 -0
- package/dist/policy-packs/ux-compare.js.map +1 -0
- package/dist/policy-packs/ux-drift-check.d.ts +27 -0
- package/dist/policy-packs/ux-drift-check.js +78 -0
- package/dist/policy-packs/ux-drift-check.js.map +1 -0
- package/dist/probes/mcp.d.ts +13 -0
- package/dist/probes/mcp.js +57 -0
- package/dist/probes/mcp.js.map +1 -1
- package/dist/runtime/approval-signing.d.ts +82 -0
- package/dist/runtime/approval-signing.js +275 -0
- package/dist/runtime/approval-signing.js.map +1 -0
- package/dist/runtime/intercept.js +62 -5
- package/dist/runtime/intercept.js.map +1 -1
- package/dist/runtime/pause-sentinel.js +14 -3
- package/dist/runtime/pause-sentinel.js.map +1 -1
- package/dist/runtime/recovery-git-commit.d.ts +22 -0
- package/dist/runtime/recovery-git-commit.js +284 -0
- package/dist/runtime/recovery-git-commit.js.map +1 -0
- package/dist/runtime/tool-name-aliases.d.ts +1 -0
- package/dist/runtime/tool-name-aliases.js +7 -1
- package/dist/runtime/tool-name-aliases.js.map +1 -1
- package/dist/schema/index.d.ts +53 -42
- package/dist/schema/policies.d.ts +56 -44
- package/dist/schema/policies.js +79 -9
- package/dist/schema/policies.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch-protection-runtime.js","sourceRoot":"","sources":["../../../src/policy-packs/builtin/branch-protection-runtime.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,kEAAkE;AAClE,yEAAyE;AACzE,sEAAsE;AACtE,yEAAyE;AACzE,mEAAmE;AACnE,kCAAkC;AAGlC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,GAIpB,MAAM,6CAA6C,CAAC;AAErD,MAAM,CAAC,MAAM,SAAS,GAAG,mBAAmB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAE/D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,oBAAoB,CAAC;AAEpE,yFAAyF;AACzF,MAAM,UAAU,0BAA0B,CAAC,SAAiB;IAC1D,OAAO,GAAG,+BAA+B,GAAG,SAAS,EAAE,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,YAAoB,EACpB,SAAiB,EACjB,MAAsB;IAEtB,OAAO,mBAAmB,CAAC,YAAY,EAAE,0BAA0B,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;AAC1F,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"branch-protection-runtime.js","sourceRoot":"","sources":["../../../src/policy-packs/builtin/branch-protection-runtime.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,kEAAkE;AAClE,yEAAyE;AACzE,sEAAsE;AACtE,yEAAyE;AACzE,mEAAmE;AACnE,kCAAkC;AAGlC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,GAIpB,MAAM,6CAA6C,CAAC;AAErD,MAAM,CAAC,MAAM,SAAS,GAAG,mBAAmB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,s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ACH,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,aAAgC;IAChF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,OAAO,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { PolicyPack } from "../../schema/index.js";
|
|
2
|
+
import type { PolicyPack, PolicyUx } from "../../schema/index.js";
|
|
3
3
|
import { type Runtime } from "../runtime.js";
|
|
4
4
|
import type { PackContribution } from "../types.js";
|
|
5
5
|
import { PACK_NAME } from "./branch-protection-runtime.js";
|
|
@@ -41,6 +41,15 @@ export declare const configSchema: z.ZodObject<{
|
|
|
41
41
|
} | undefined;
|
|
42
42
|
protected_branches?: string[] | undefined;
|
|
43
43
|
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Shipped default `config.ux` for this pack (agent-tasks/9806d4f8).
|
|
46
|
+
* Canonical source for the `full` init template and `harness pack
|
|
47
|
+
* reseed` (task 68b9ad9c): a future wording fix to the deny-message
|
|
48
|
+
* text lands here once and reaches both a fresh `harness init --template
|
|
49
|
+
* full` and an operator running `harness pack reseed branch-protection`
|
|
50
|
+
* against an already-installed manifest.
|
|
51
|
+
*/
|
|
52
|
+
export declare function defaultUx(): PolicyUx;
|
|
44
53
|
export declare function resolve(pack: PolicyPack, runtime?: Runtime): {
|
|
45
54
|
contribution: PackContribution;
|
|
46
55
|
warnings: string[];
|
|
@@ -53,6 +53,23 @@ export const configSchema = z
|
|
|
53
53
|
ux: PolicyUxSchema.optional(),
|
|
54
54
|
})
|
|
55
55
|
.strict();
|
|
56
|
+
/**
|
|
57
|
+
* Shipped default `config.ux` for this pack (agent-tasks/9806d4f8).
|
|
58
|
+
* Canonical source for the `full` init template and `harness pack
|
|
59
|
+
* reseed` (task 68b9ad9c): a future wording fix to the deny-message
|
|
60
|
+
* text lands here once and reaches both a fresh `harness init --template
|
|
61
|
+
* full` and an operator running `harness pack reseed branch-protection`
|
|
62
|
+
* against an already-installed manifest.
|
|
63
|
+
*/
|
|
64
|
+
export function defaultUx() {
|
|
65
|
+
return {
|
|
66
|
+
cannot: "You cannot edit files on protected branch ${BRANCH} yet.",
|
|
67
|
+
required: [
|
|
68
|
+
"a checkout of a non-protected branch (current `${BRANCH}` is protected)",
|
|
69
|
+
],
|
|
70
|
+
run: ["git checkout -b feat/<your-task>", "harness session-start branch-check"],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
56
73
|
const HOOK_NAME_PREFIX = `policy-pack:${PACK_NAME}`;
|
|
57
74
|
const PRE_TOOL_USE_MATCH_CLAUDE = "Write|Edit";
|
|
58
75
|
const PRE_TOOL_USE_MATCH_CODEX = "apply_patch";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch-protection.js","sourceRoot":"","sources":["../../../src/policy-packs/builtin/branch-protection.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,sEAAsE;AACtE,wEAAwE;AACxE,EAAE;AACF,yDAAyD;AACzD,EAAE;AACF,0EAA0E;AAC1E,oEAAoE;AACpE,qEAAqE;AACrE,uCAAuC;AACvC,EAAE;AACF,kEAAkE;AAClE,sEAAsE;AACtE,wDAAwD;AACxD,+DAA+D;AAC/D,uDAAuD;AACvD,yEAAyE;AACzE,sEAAsE;AACtE,0EAA0E;AAC1E,kEAAkE;AAClE,yEAAyE;AACzE,2EAA2E;AAC3E,oDAAoD;AACpD,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,iEAAiE;AACjE,WAAW;AACX,EAAE;AACF,qEAAqE;AACrE,8DAA8D;AAC9D,oEAAoE;AAEpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAgB,MAAM,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CAAC;IAClC,MAAM,KAAK,GAA2B;QACpC;YACE,YAAY,EAAE,gBAAgB,SAAS,kBAAkB;YACzD,OAAO,EAAE,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC;SACpD;KACF,CAAC;IACF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,OAAO;QAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC;AACtD,CAAC"}
|
|
1
|
+
{"version":3,"file":"branch-protection.js","sourceRoot":"","sources":["../../../src/policy-packs/builtin/branch-protection.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,sEAAsE;AACtE,wEAAwE;AACxE,EAAE;AACF,yDAAyD;AACzD,EAAE;AACF,0EAA0E;AAC1E,oEAAoE;AACpE,qEAAqE;AACrE,uCAAuC;AACvC,EAAE;AACF,kEAAkE;AAClE,sEAAsE;AACtE,wDAAwD;AACxD,+DAA+D;AAC/D,uDAAuD;AACvD,yEAAyE;AACzE,sEAAsE;AACtE,0EAA0E;AAC1E,kEAAkE;AAClE,yEAAyE;AACzE,2EAA2E;AAC3E,oDAAoD;AACpD,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,iEAAiE;AACjE,WAAW;AACX,EAAE;AACF,qEAAqE;AACrE,8DAA8D;AAC9D,oEAAoE;AAEpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAgB,MAAM,eAAe,CAAC;AAE9D,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,wBAAwB,EACxB,SAAS,EACT,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EA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AC7D,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,KAAK,GAA2B;QACpC;YACE,YAAY,EAAE,gBAAgB,SAAS,kBAAkB;YACzD,OAAO,EAAE,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC;SACpD;KACF,CAAC;IACF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,OAAO;QAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC;AACtD,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
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
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
|
|
232
|
-
* `approvedAt` is older than the cutoff returns
|
|
233
|
-
* an "expired" detail so the agent gets the same
|
|
234
|
-
* a never-approved session and must re-approve.
|
|
235
|
-
*
|
|
236
|
-
*
|
|
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` (
|
|
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
|
/**
|