@lannguyensi/harness 0.53.0 → 0.55.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 +70 -1
- package/dist/cli/delegate/index.d.ts +15 -2
- package/dist/cli/delegate/index.js +128 -4
- package/dist/cli/delegate/index.js.map +1 -1
- package/dist/cli/doctor/bypass-without-auto-approve.js +10 -4
- package/dist/cli/doctor/bypass-without-auto-approve.js.map +1 -1
- package/dist/cli/dry-run.js +32 -1
- package/dist/cli/dry-run.js.map +1 -1
- package/dist/cli/index.js +13 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/profiles.js +89 -8
- package/dist/cli/init/profiles.js.map +1 -1
- package/dist/cli/init/templates.js +163 -3
- package/dist/cli/init/templates.js.map +1 -1
- package/dist/cli/pack/hook-pre-tool-use.js +217 -95
- package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
- package/dist/cli/record/index.d.ts +8 -0
- package/dist/cli/record/index.js +55 -7
- package/dist/cli/record/index.js.map +1 -1
- package/dist/cli/validate/checks.js +61 -9
- package/dist/cli/validate/checks.js.map +1 -1
- package/dist/io/extract.d.ts +29 -0
- package/dist/io/extract.js +36 -0
- package/dist/io/extract.js.map +1 -1
- package/dist/io/read-regular-file.d.ts +33 -2
- package/dist/io/read-regular-file.js +41 -8
- package/dist/io/read-regular-file.js.map +1 -1
- package/dist/policies/index.d.ts +1 -1
- package/dist/policies/index.js +1 -1
- package/dist/policies/index.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.d.ts +71 -4
- package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js +75 -4
- package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/index.js +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js +9 -3
- package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js.map +1 -1
- package/dist/runtime/destructive-shell-floor.d.ts +19 -0
- package/dist/runtime/destructive-shell-floor.js +597 -0
- package/dist/runtime/destructive-shell-floor.js.map +1 -0
- package/dist/runtime/intercept.d.ts +10 -7
- package/dist/runtime/intercept.js +108 -9
- package/dist/runtime/intercept.js.map +1 -1
- package/dist/runtime/read-only-bash.d.ts +54 -0
- package/dist/runtime/read-only-bash.js +775 -7
- package/dist/runtime/read-only-bash.js.map +1 -1
- package/dist/runtime/risk-classifier.js +72 -13
- package/dist/runtime/risk-classifier.js.map +1 -1
- package/dist/runtime/when-eval.d.ts +18 -5
- package/dist/runtime/when-eval.js +64 -11
- package/dist/runtime/when-eval.js.map +1 -1
- package/dist/runtime/workflow-policies.d.ts +43 -1
- package/dist/runtime/workflow-policies.js +158 -1
- package/dist/runtime/workflow-policies.js.map +1 -1
- package/dist/schema/extract.d.ts +4 -0
- package/dist/schema/extract.js +64 -1
- package/dist/schema/extract.js.map +1 -1
- package/dist/schema/index.d.ts +13 -0
- package/dist/schema/policies.d.ts +19 -0
- package/dist/schema/policies.js +17 -1
- package/dist/schema/policies.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,11 +14,20 @@
|
|
|
14
14
|
* later index in the same workflow) by a `merge` step. When BOTH
|
|
15
15
|
* `require-review-evidence` and `require-review-evidence-bash` are
|
|
16
16
|
* declared in `manifest.hooks[]`, `deriveWorkflowGatePolicies` returns
|
|
17
|
-
* the SAME
|
|
17
|
+
* the SAME policies `harness init --template full` would hand-author
|
|
18
18
|
* (`src/cli/init/templates.ts` `review-before-merge` /
|
|
19
19
|
* `review-before-merge-bash`), renamed per workflow so the provenance
|
|
20
20
|
* is visible in `harness list policies` / `harness explain`.
|
|
21
21
|
*
|
|
22
|
+
* Task 2699b476 added the two task-scoped merge surfaces to that set:
|
|
23
|
+
* `review-before-task-merge` (`mcp__agent-tasks__task_merge`) and
|
|
24
|
+
* `review-before-task-finish-automerge`
|
|
25
|
+
* (`mcp__agent-tasks__task_finish` narrowed by `trigger.input_match` to
|
|
26
|
+
* `autoMerge: true`), each derived only when its own hook
|
|
27
|
+
* (`require-review-evidence-task-merge` /
|
|
28
|
+
* `require-review-evidence-task-finish`) is declared. A manifest that
|
|
29
|
+
* predates those hooks derives exactly the pair it always did.
|
|
30
|
+
*
|
|
22
31
|
* Deliberately does NOT touch `src/runtime/intercept.ts`: the engine
|
|
23
32
|
* already knows how to evaluate a `Policy`, so the only thing missing
|
|
24
33
|
* was a `Policy` to hand it. `src/cli/loader.ts#loadManifest` calls
|
|
@@ -67,6 +76,26 @@
|
|
|
67
76
|
/** The two hooks templates.ts wires for the hand-authored merge gate. */
|
|
68
77
|
export const REVIEW_EVIDENCE_HOOK_MCP = "require-review-evidence";
|
|
69
78
|
export const REVIEW_EVIDENCE_HOOK_BASH = "require-review-evidence-bash";
|
|
79
|
+
/**
|
|
80
|
+
* The two hooks templates.ts wires for the task-scoped merge surfaces
|
|
81
|
+
* (task 2699b476). Unlike the pair above these are NOT part of
|
|
82
|
+
* `hasWiredMergeGateHooks`: a manifest that predates them still derives
|
|
83
|
+
* the `pull_requests_merge` / `gh pr merge` gates exactly as before, and
|
|
84
|
+
* each task-scoped gate is derived only when ITS OWN hook is declared.
|
|
85
|
+
*
|
|
86
|
+
* That per-hook gating is not a style choice. A derived policy's `hook:`
|
|
87
|
+
* must name a declared hook (`ManifestSchema`'s superRefine), and, more
|
|
88
|
+
* importantly, the hook's `match` is what `harness apply` projects into
|
|
89
|
+
* settings.json's tool-name matcher: without a matcher for
|
|
90
|
+
* `mcp__agent-tasks__task_merge`, Claude Code never spawns `harness
|
|
91
|
+
* policy intercept` for that verb, so a gate derived anyway would be
|
|
92
|
+
* INERT while looking enforced in `harness list policies` (the exact
|
|
93
|
+
* "No-Op that LOOKS protective" shape `checkWorkflowGateWiring` exists
|
|
94
|
+
* to prevent). Deriving nothing until the hook is wired keeps the
|
|
95
|
+
* absence visible instead of fake-covering it.
|
|
96
|
+
*/
|
|
97
|
+
export const REVIEW_EVIDENCE_HOOK_TASK_MERGE = "require-review-evidence-task-merge";
|
|
98
|
+
export const REVIEW_EVIDENCE_HOOK_TASK_FINISH = "require-review-evidence-task-finish";
|
|
70
99
|
// Exported (review round 2, F5) so `src/cli/validate/checks.ts` can check a
|
|
71
100
|
// declared hook's `match`/`bash_match` against the EXACT surface the
|
|
72
101
|
// derivation binds to, instead of trusting the hook name alone. See
|
|
@@ -78,6 +107,25 @@ export const MERGE_MCP_MATCH = "mcp__agent-tasks__pull_requests_merge";
|
|
|
78
107
|
// by tests/runtime/workflow-policies.test.ts's parity assertion so the
|
|
79
108
|
// two cannot silently drift apart).
|
|
80
109
|
export const MERGE_BASH_MATCH = "(^|\\n|;|\\||&|\\()\\s*(\\w+=\\S+\\s+)*gh pr merge\\b";
|
|
110
|
+
// The two task-scoped agent-tasks merge surfaces (task 2699b476), pinned
|
|
111
|
+
// here the same way `MERGE_MCP_MATCH` / `MERGE_BASH_MATCH` are and held
|
|
112
|
+
// byte-identical to templates.ts by this module's parity assertion in
|
|
113
|
+
// tests/runtime/workflow-policies.test.ts.
|
|
114
|
+
export const TASK_MERGE_MCP_MATCH = "mcp__agent-tasks__task_merge";
|
|
115
|
+
export const TASK_FINISH_MCP_MATCH = "mcp__agent-tasks__task_finish";
|
|
116
|
+
/**
|
|
117
|
+
* The `trigger.input_match` predicate that separates the merging mode of
|
|
118
|
+
* `task_finish` from the ordinary one. Both auto-merge modes the MCP
|
|
119
|
+
* server documents (soloMode work claim, review claim + approve) carry
|
|
120
|
+
* `autoMerge: true`; a plain finish omits the argument entirely, and a
|
|
121
|
+
* missing path never satisfies an `input_match` entry, so the gate stays
|
|
122
|
+
* out of the way of the non-merging call.
|
|
123
|
+
*/
|
|
124
|
+
export const TASK_FINISH_AUTOMERGE_INPUT_MATCH = {
|
|
125
|
+
"toolArgs.autoMerge": true,
|
|
126
|
+
};
|
|
127
|
+
/** `toolArgs.taskId` is the only identifier either task-scoped verb carries. */
|
|
128
|
+
export const TASK_ID_EXTRACT = { TASK_ID: "toolArgs.taskId" };
|
|
81
129
|
/**
|
|
82
130
|
* True when `workflow.steps` contains a `review_subagent` step with
|
|
83
131
|
* `spawn: "required"` at an index earlier than some `merge` step
|
|
@@ -118,9 +166,34 @@ function triggerSurfaceKey(policy) {
|
|
|
118
166
|
event: policy.trigger.event,
|
|
119
167
|
match: policy.trigger.match ?? null,
|
|
120
168
|
bash_match: policy.trigger.bash_match ?? null,
|
|
169
|
+
input_match: inputMatchKey(policy),
|
|
121
170
|
ledger_tag: policy.requires?.ledger_tag ?? null,
|
|
122
171
|
});
|
|
123
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Canonical form of `trigger.input_match` for the surface key: key-sorted
|
|
175
|
+
* so authoring order does not change identity, `null` when the policy
|
|
176
|
+
* declares none.
|
|
177
|
+
*
|
|
178
|
+
* `input_match` is part of the SURFACE, not of the extract comparison
|
|
179
|
+
* (task 2699b476): two policies on `mcp__agent-tasks__task_finish` that
|
|
180
|
+
* disagree about which `autoMerge` value they gate intercept DIFFERENT
|
|
181
|
+
* tool calls, so they are no more interchangeable than a policy on a
|
|
182
|
+
* different tool name would be. Leaving it out of the key would let a
|
|
183
|
+
* hand-authored `input_match: { toolArgs.autoMerge: false }` policy dedupe
|
|
184
|
+
* the derived `autoMerge: true` gate away and leave the merging call
|
|
185
|
+
* ungated while the manifest still reads as covered.
|
|
186
|
+
*/
|
|
187
|
+
function inputMatchKey(policy) {
|
|
188
|
+
const inputMatch = policy.trigger.input_match;
|
|
189
|
+
if (inputMatch === undefined)
|
|
190
|
+
return null;
|
|
191
|
+
const sorted = {};
|
|
192
|
+
for (const key of Object.keys(inputMatch).sort()) {
|
|
193
|
+
sorted[key] = inputMatch[key];
|
|
194
|
+
}
|
|
195
|
+
return sorted;
|
|
196
|
+
}
|
|
124
197
|
/**
|
|
125
198
|
* Canonical form of `trigger.extract` for equality: key-sorted so two
|
|
126
199
|
* maps that declare the same variables from the same paths compare equal
|
|
@@ -264,6 +337,76 @@ function buildBashMergeGatePolicy(workflowName) {
|
|
|
264
337
|
},
|
|
265
338
|
};
|
|
266
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* The two task-scoped merge gates (task 2699b476), structurally identical
|
|
342
|
+
* to templates.ts's `review-before-task-merge` /
|
|
343
|
+
* `review-before-task-finish-automerge` apart from name and description.
|
|
344
|
+
* They key on `review:${TASK_ID}` rather than the PR number because both
|
|
345
|
+
* verbs derive owner/repo/PR from the task, so `toolArgs.taskId` is the
|
|
346
|
+
* only identifier in the payload; `harness record review --pr <pr> --task
|
|
347
|
+
* <id>` writes both tag families in ONE fact so a single recorded review
|
|
348
|
+
* opens every merge surface.
|
|
349
|
+
*/
|
|
350
|
+
function buildTaskMergeGatePolicy(workflowName) {
|
|
351
|
+
return {
|
|
352
|
+
name: `workflow:${workflowName}:review-before-task-merge`,
|
|
353
|
+
description: `Derived from workflows[] (workflow "${workflowName}"): a review_subagent step ` +
|
|
354
|
+
`with spawn: "required" precedes a merge step, so block agent-tasks task_merge ` +
|
|
355
|
+
"unless a ledger entry tagged review:<task-id> exists for this session.",
|
|
356
|
+
trigger: {
|
|
357
|
+
event: "PreToolUse",
|
|
358
|
+
match: TASK_MERGE_MCP_MATCH,
|
|
359
|
+
extract: { ...TASK_ID_EXTRACT },
|
|
360
|
+
},
|
|
361
|
+
requires: { ledger_tag: "review:${TASK_ID}" },
|
|
362
|
+
hook: REVIEW_EVIDENCE_HOOK_TASK_MERGE,
|
|
363
|
+
enforcement: "block",
|
|
364
|
+
producers: [
|
|
365
|
+
{
|
|
366
|
+
kind: "mcp",
|
|
367
|
+
verb: "mcp__grounding-mcp__ledger_add",
|
|
368
|
+
example: '{sessionId:"${SESSION_ID}", type:"fact", content:"review:${TASK_ID}: <verdict + key findings + nits>", source:"Agent(general-purpose) review"}',
|
|
369
|
+
description: "Spawn a review subagent against the PR diff, capture its verdict, then persist a ledger entry tagged with the task id. Mirror of the review-before-merge producer for the task-scoped merge surface.",
|
|
370
|
+
},
|
|
371
|
+
],
|
|
372
|
+
ux: {
|
|
373
|
+
cannot: "You cannot merge the PR for task ${TASK_ID} yet.",
|
|
374
|
+
required: ["a recorded review of task ${TASK_ID}"],
|
|
375
|
+
run: ['harness record review --pr <pr> --task ${TASK_ID} "<summary>"'],
|
|
376
|
+
},
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
function buildTaskFinishAutoMergeGatePolicy(workflowName) {
|
|
380
|
+
return {
|
|
381
|
+
name: `workflow:${workflowName}:review-before-task-finish-automerge`,
|
|
382
|
+
description: `Derived from workflows[] (workflow "${workflowName}"): a review_subagent step ` +
|
|
383
|
+
`with spawn: "required" precedes a merge step, so block agent-tasks task_finish ` +
|
|
384
|
+
"in its auto-merge mode unless a ledger entry tagged review:<task-id> exists for " +
|
|
385
|
+
"this session.",
|
|
386
|
+
trigger: {
|
|
387
|
+
event: "PreToolUse",
|
|
388
|
+
match: TASK_FINISH_MCP_MATCH,
|
|
389
|
+
input_match: { ...TASK_FINISH_AUTOMERGE_INPUT_MATCH },
|
|
390
|
+
extract: { ...TASK_ID_EXTRACT },
|
|
391
|
+
},
|
|
392
|
+
requires: { ledger_tag: "review:${TASK_ID}" },
|
|
393
|
+
hook: REVIEW_EVIDENCE_HOOK_TASK_FINISH,
|
|
394
|
+
enforcement: "block",
|
|
395
|
+
producers: [
|
|
396
|
+
{
|
|
397
|
+
kind: "mcp",
|
|
398
|
+
verb: "mcp__grounding-mcp__ledger_add",
|
|
399
|
+
example: '{sessionId:"${SESSION_ID}", type:"fact", content:"review:${TASK_ID}: <verdict + key findings + nits>", source:"Agent(general-purpose) review"}',
|
|
400
|
+
description: "Spawn a review subagent against the PR diff, capture its verdict, then persist a ledger entry tagged with the task id. Same evidence the task_merge gate reads, so one recorded review opens both.",
|
|
401
|
+
},
|
|
402
|
+
],
|
|
403
|
+
ux: {
|
|
404
|
+
cannot: "You cannot finish task ${TASK_ID} with autoMerge yet.",
|
|
405
|
+
required: ["a recorded review of task ${TASK_ID}"],
|
|
406
|
+
run: ['harness record review --pr <pr> --task ${TASK_ID} "<summary>"'],
|
|
407
|
+
},
|
|
408
|
+
};
|
|
409
|
+
}
|
|
267
410
|
// F7 (review round 2): a registry of every `Policy` object this module has
|
|
268
411
|
// ever handed back from `deriveWorkflowGatePolicies`. `WeakSet` keys on
|
|
269
412
|
// object identity, not value equality, deliberately: two DIFFERENT
|
|
@@ -306,6 +449,7 @@ function deriveWorkflowGates(manifest) {
|
|
|
306
449
|
if (!hasWiredMergeGateHooks(manifest))
|
|
307
450
|
return empty;
|
|
308
451
|
const hand = handAuthoredPolicies(manifest);
|
|
452
|
+
const declaredHookNames = new Set(manifest.hooks.map((h) => h.name));
|
|
309
453
|
const bySurface = new Map();
|
|
310
454
|
for (const policy of hand) {
|
|
311
455
|
const key = triggerSurfaceKey(policy);
|
|
@@ -327,8 +471,21 @@ function deriveWorkflowGates(manifest) {
|
|
|
327
471
|
const candidates = [
|
|
328
472
|
{ policy: buildMcpMergeGatePolicy(workflow.name), surface: MERGE_MCP_MATCH },
|
|
329
473
|
{ policy: buildBashMergeGatePolicy(workflow.name), surface: "`gh pr merge` (Bash)" },
|
|
474
|
+
{ policy: buildTaskMergeGatePolicy(workflow.name), surface: TASK_MERGE_MCP_MATCH },
|
|
475
|
+
{
|
|
476
|
+
policy: buildTaskFinishAutoMergeGatePolicy(workflow.name),
|
|
477
|
+
surface: `${TASK_FINISH_MCP_MATCH} (autoMerge: true)`,
|
|
478
|
+
},
|
|
330
479
|
];
|
|
331
480
|
for (const { policy: candidate, surface } of candidates) {
|
|
481
|
+
// A candidate whose own hook is not declared is skipped rather than
|
|
482
|
+
// derived (task 2699b476): see REVIEW_EVIDENCE_HOOK_TASK_MERGE's
|
|
483
|
+
// doc for why an unwired hook makes a derived gate inert rather
|
|
484
|
+
// than enforcing. `hasWiredMergeGateHooks` above already guarantees
|
|
485
|
+
// this holds for the two pull_requests_merge / gh pr merge
|
|
486
|
+
// candidates, so their behaviour is unchanged.
|
|
487
|
+
if (!declaredHookNames.has(candidate.hook))
|
|
488
|
+
continue;
|
|
332
489
|
const key = triggerSurfaceKey(candidate);
|
|
333
490
|
if (seen.has(key))
|
|
334
491
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-policies.js","sourceRoot":"","sources":["../../src/runtime/workflow-policies.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"workflow-policies.js","sourceRoot":"","sources":["../../src/runtime/workflow-policies.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,wBAAwB,GAAG,yBAAyB,CAAC;AAClE,MAAM,CAAC,MAAM,yBAAyB,GAAG,8BAA8B,CAAC;AAExE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,oCAAoC,CAAC;AACpF,MAAM,CAAC,MAAM,gCAAgC,GAAG,qCAAqC,CAAC;AAEtF,4EAA4E;AAC5E,qEAAqE;AACrE,oEAAoE;AACpE,yEAAyE;AACzE,mBAAmB;AACnB,MAAM,CAAC,MAAM,eAAe,GAAG,uCAAuC,CAAC;AACvE,sEAAsE;AACtE,uEAAuE;AACvE,uEAAuE;AACvE,oCAAoC;AACpC,MAAM,CAAC,MAAM,gBAAgB,GAAG,uDAAuD,CAAC;AAExF,yEAAyE;AACzE,wEAAwE;AACxE,sEAAsE;AACtE,2CAA2C;AAC3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAAG,+BAA+B,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAA4B;IACxE,oBA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M,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,QAAQ,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IAC9F,KAAK,MAAM,MAAM,IAAI,eAAe;QAAE,qBAAqB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxE,OAAO,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,eAAe,CAAC,EAAE,CAAC;AAClE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAkB;IACvD,MAAM,IAAI,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC5C,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,QAAQ,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IAC9D,OAAO,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACzC,CAAC"}
|
package/dist/schema/extract.d.ts
CHANGED
|
@@ -3,3 +3,7 @@ export declare const ExtractExpressionSchema: z.ZodEffects<z.ZodString, string,
|
|
|
3
3
|
export type ExtractExpression = z.infer<typeof ExtractExpressionSchema>;
|
|
4
4
|
export declare const ExtractMapSchema: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>, Record<string, string>, Record<string, string>>;
|
|
5
5
|
export type ExtractMap = z.infer<typeof ExtractMapSchema>;
|
|
6
|
+
export declare const ToolArgsExtractExpressionSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
7
|
+
export declare const InputMatchLiteralSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
8
|
+
export declare const InputMatchMapSchema: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>, Record<string, string | number | boolean>, Record<string, string | number | boolean>>;
|
|
9
|
+
export type InputMatchMap = z.infer<typeof InputMatchMapSchema>;
|
package/dist/schema/extract.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { ExtractGrammarError, validateExtractGrammar, } from "../io/extract.js";
|
|
2
|
+
import { ExtractGrammarError, parseExtractExpression, validateExtractGrammar, } from "../io/extract.js";
|
|
3
3
|
export const ExtractExpressionSchema = z.string().min(1).superRefine((v, ctx) => {
|
|
4
4
|
try {
|
|
5
5
|
validateExtractGrammar(v);
|
|
@@ -20,4 +20,67 @@ const VAR_NAME_RE = /^[A-Z][A-Z0-9_]*$/;
|
|
|
20
20
|
export const ExtractMapSchema = z
|
|
21
21
|
.record(ExtractExpressionSchema)
|
|
22
22
|
.refine((m) => Object.keys(m).every((k) => VAR_NAME_RE.test(k)), { message: "extract variable names must be SCREAMING_SNAKE_CASE" });
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// trigger.input_match (task 2699b476)
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
//
|
|
27
|
+
// Same expression grammar as `trigger.extract`, but restricted to the
|
|
28
|
+
// `toolArgs.` namespace: the predicate answers "did THIS tool call carry
|
|
29
|
+
// this argument value?", and `event` / `session` / `git` are not tool
|
|
30
|
+
// arguments. Rejecting the other three namespaces here (rather than
|
|
31
|
+
// silently never matching them at runtime) is what makes a typo like
|
|
32
|
+
// `event.autoMerge` a loud `harness validate` error instead of a gate
|
|
33
|
+
// that quietly never fires.
|
|
34
|
+
//
|
|
35
|
+
// This is the same layer `bash_match` and `path_match` are declared at
|
|
36
|
+
// (`PolicyTriggerSchema`), so every consumer that parses a manifest,
|
|
37
|
+
// `harness validate`, `apply`, `doctor`, `loadManifest`, the intercept
|
|
38
|
+
// entrypoint, refuses the bad shape, not just the two report verbs.
|
|
39
|
+
export const ToolArgsExtractExpressionSchema = z
|
|
40
|
+
.string()
|
|
41
|
+
.min(1)
|
|
42
|
+
.superRefine((v, ctx) => {
|
|
43
|
+
let parsed;
|
|
44
|
+
try {
|
|
45
|
+
parsed = parseExtractExpression(v);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
if (err instanceof ExtractGrammarError) {
|
|
49
|
+
ctx.addIssue({
|
|
50
|
+
code: z.ZodIssueCode.custom,
|
|
51
|
+
message: err.message.replace(/^extract expression "[^"]*": /, ""),
|
|
52
|
+
});
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
throw err;
|
|
56
|
+
}
|
|
57
|
+
if (parsed.namespace !== "toolArgs") {
|
|
58
|
+
ctx.addIssue({
|
|
59
|
+
code: z.ZodIssueCode.custom,
|
|
60
|
+
message: `input_match keys must read from the toolArgs namespace ` +
|
|
61
|
+
`(the tool call's own arguments); "${v}" reads from ${parsed.namespace}`,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export const InputMatchLiteralSchema = z.union([z.string(), z.number(), z.boolean()]);
|
|
66
|
+
export const InputMatchMapSchema = z
|
|
67
|
+
.record(InputMatchLiteralSchema)
|
|
68
|
+
.superRefine((map, ctx) => {
|
|
69
|
+
const keys = Object.keys(map);
|
|
70
|
+
if (keys.length === 0) {
|
|
71
|
+
ctx.addIssue({
|
|
72
|
+
code: z.ZodIssueCode.custom,
|
|
73
|
+
message: "trigger.input_match must declare at least one entry; an empty map is a silent no-op",
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
for (const key of keys) {
|
|
78
|
+
const result = ToolArgsExtractExpressionSchema.safeParse(key);
|
|
79
|
+
if (result.success)
|
|
80
|
+
continue;
|
|
81
|
+
for (const issue of result.error.issues) {
|
|
82
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: [key], message: issue.message });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
23
86
|
//# sourceMappingURL=extract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/schema/extract.ts"],"names":[],"mapp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B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EACL,qFAAqF;SACxF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,+BAA+B,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC9D,IAAI,MAAM,CAAC,OAAO;YAAE,SAAS;QAC7B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACxC,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -431,6 +431,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
431
431
|
match: z.ZodOptional<z.ZodString>;
|
|
432
432
|
path_match: z.ZodOptional<z.ZodString>;
|
|
433
433
|
bash_match: z.ZodOptional<z.ZodString>;
|
|
434
|
+
input_match: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>, Record<string, string | number | boolean>, Record<string, string | number | boolean>>>;
|
|
434
435
|
extract: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>, Record<string, string>, Record<string, string>>>;
|
|
435
436
|
}, "strict", z.ZodTypeAny, {
|
|
436
437
|
event: "SessionStart" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "Stop" | "SubagentStop" | "PreCompact";
|
|
@@ -438,12 +439,14 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
438
439
|
path_match?: string | undefined;
|
|
439
440
|
bash_match?: string | undefined;
|
|
440
441
|
extract?: Record<string, string> | undefined;
|
|
442
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
441
443
|
}, {
|
|
442
444
|
event: "SessionStart" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "Stop" | "SubagentStop" | "PreCompact";
|
|
443
445
|
match?: string | undefined;
|
|
444
446
|
path_match?: string | undefined;
|
|
445
447
|
bash_match?: string | undefined;
|
|
446
448
|
extract?: Record<string, string> | undefined;
|
|
449
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
447
450
|
}>;
|
|
448
451
|
requires: z.ZodOptional<z.ZodObject<{
|
|
449
452
|
ledger_tag: z.ZodString;
|
|
@@ -609,6 +612,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
609
612
|
path_match?: string | undefined;
|
|
610
613
|
bash_match?: string | undefined;
|
|
611
614
|
extract?: Record<string, string> | undefined;
|
|
615
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
612
616
|
};
|
|
613
617
|
hook: string;
|
|
614
618
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -658,6 +662,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
658
662
|
path_match?: string | undefined;
|
|
659
663
|
bash_match?: string | undefined;
|
|
660
664
|
extract?: Record<string, string> | undefined;
|
|
665
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
661
666
|
};
|
|
662
667
|
hook: string;
|
|
663
668
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -707,6 +712,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
707
712
|
path_match?: string | undefined;
|
|
708
713
|
bash_match?: string | undefined;
|
|
709
714
|
extract?: Record<string, string> | undefined;
|
|
715
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
710
716
|
};
|
|
711
717
|
hook: string;
|
|
712
718
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -756,6 +762,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
756
762
|
path_match?: string | undefined;
|
|
757
763
|
bash_match?: string | undefined;
|
|
758
764
|
extract?: Record<string, string> | undefined;
|
|
765
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
759
766
|
};
|
|
760
767
|
hook: string;
|
|
761
768
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -805,6 +812,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
805
812
|
path_match?: string | undefined;
|
|
806
813
|
bash_match?: string | undefined;
|
|
807
814
|
extract?: Record<string, string> | undefined;
|
|
815
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
808
816
|
};
|
|
809
817
|
hook: string;
|
|
810
818
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -854,6 +862,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
854
862
|
path_match?: string | undefined;
|
|
855
863
|
bash_match?: string | undefined;
|
|
856
864
|
extract?: Record<string, string> | undefined;
|
|
865
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
857
866
|
};
|
|
858
867
|
hook: string;
|
|
859
868
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -2638,6 +2647,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2638
2647
|
path_match?: string | undefined;
|
|
2639
2648
|
bash_match?: string | undefined;
|
|
2640
2649
|
extract?: Record<string, string> | undefined;
|
|
2650
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
2641
2651
|
};
|
|
2642
2652
|
hook: string;
|
|
2643
2653
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -2954,6 +2964,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2954
2964
|
path_match?: string | undefined;
|
|
2955
2965
|
bash_match?: string | undefined;
|
|
2956
2966
|
extract?: Record<string, string> | undefined;
|
|
2967
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
2957
2968
|
};
|
|
2958
2969
|
hook: string;
|
|
2959
2970
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -3270,6 +3281,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
3270
3281
|
path_match?: string | undefined;
|
|
3271
3282
|
bash_match?: string | undefined;
|
|
3272
3283
|
extract?: Record<string, string> | undefined;
|
|
3284
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
3273
3285
|
};
|
|
3274
3286
|
hook: string;
|
|
3275
3287
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -3586,6 +3598,7 @@ export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
3586
3598
|
path_match?: string | undefined;
|
|
3587
3599
|
bash_match?: string | undefined;
|
|
3588
3600
|
extract?: Record<string, string> | undefined;
|
|
3601
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
3589
3602
|
};
|
|
3590
3603
|
hook: string;
|
|
3591
3604
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -4,6 +4,7 @@ export declare const PolicyTriggerSchema: z.ZodObject<{
|
|
|
4
4
|
match: z.ZodOptional<z.ZodString>;
|
|
5
5
|
path_match: z.ZodOptional<z.ZodString>;
|
|
6
6
|
bash_match: z.ZodOptional<z.ZodString>;
|
|
7
|
+
input_match: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>, Record<string, string | number | boolean>, Record<string, string | number | boolean>>>;
|
|
7
8
|
extract: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>, Record<string, string>, Record<string, string>>>;
|
|
8
9
|
}, "strict", z.ZodTypeAny, {
|
|
9
10
|
event: "SessionStart" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "Stop" | "SubagentStop" | "PreCompact";
|
|
@@ -11,12 +12,14 @@ export declare const PolicyTriggerSchema: z.ZodObject<{
|
|
|
11
12
|
path_match?: string | undefined;
|
|
12
13
|
bash_match?: string | undefined;
|
|
13
14
|
extract?: Record<string, string> | undefined;
|
|
15
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
14
16
|
}, {
|
|
15
17
|
event: "SessionStart" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "Stop" | "SubagentStop" | "PreCompact";
|
|
16
18
|
match?: string | undefined;
|
|
17
19
|
path_match?: string | undefined;
|
|
18
20
|
bash_match?: string | undefined;
|
|
19
21
|
extract?: Record<string, string> | undefined;
|
|
22
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
20
23
|
}>;
|
|
21
24
|
export declare const PolicyEnforcementSchema: z.ZodEnum<["block", "warn", "require_approval"]>;
|
|
22
25
|
export declare const ProducerSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
@@ -111,6 +114,7 @@ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
111
114
|
match: z.ZodOptional<z.ZodString>;
|
|
112
115
|
path_match: z.ZodOptional<z.ZodString>;
|
|
113
116
|
bash_match: z.ZodOptional<z.ZodString>;
|
|
117
|
+
input_match: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>, Record<string, string | number | boolean>, Record<string, string | number | boolean>>>;
|
|
114
118
|
extract: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>, Record<string, string>, Record<string, string>>>;
|
|
115
119
|
}, "strict", z.ZodTypeAny, {
|
|
116
120
|
event: "SessionStart" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "Stop" | "SubagentStop" | "PreCompact";
|
|
@@ -118,12 +122,14 @@ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
118
122
|
path_match?: string | undefined;
|
|
119
123
|
bash_match?: string | undefined;
|
|
120
124
|
extract?: Record<string, string> | undefined;
|
|
125
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
121
126
|
}, {
|
|
122
127
|
event: "SessionStart" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "Stop" | "SubagentStop" | "PreCompact";
|
|
123
128
|
match?: string | undefined;
|
|
124
129
|
path_match?: string | undefined;
|
|
125
130
|
bash_match?: string | undefined;
|
|
126
131
|
extract?: Record<string, string> | undefined;
|
|
132
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
127
133
|
}>;
|
|
128
134
|
requires: z.ZodOptional<z.ZodObject<{
|
|
129
135
|
ledger_tag: z.ZodString;
|
|
@@ -289,6 +295,7 @@ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
289
295
|
path_match?: string | undefined;
|
|
290
296
|
bash_match?: string | undefined;
|
|
291
297
|
extract?: Record<string, string> | undefined;
|
|
298
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
292
299
|
};
|
|
293
300
|
hook: string;
|
|
294
301
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -338,6 +345,7 @@ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
338
345
|
path_match?: string | undefined;
|
|
339
346
|
bash_match?: string | undefined;
|
|
340
347
|
extract?: Record<string, string> | undefined;
|
|
348
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
341
349
|
};
|
|
342
350
|
hook: string;
|
|
343
351
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -387,6 +395,7 @@ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
387
395
|
path_match?: string | undefined;
|
|
388
396
|
bash_match?: string | undefined;
|
|
389
397
|
extract?: Record<string, string> | undefined;
|
|
398
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
390
399
|
};
|
|
391
400
|
hook: string;
|
|
392
401
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -436,6 +445,7 @@ export declare const PolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
436
445
|
path_match?: string | undefined;
|
|
437
446
|
bash_match?: string | undefined;
|
|
438
447
|
extract?: Record<string, string> | undefined;
|
|
448
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
439
449
|
};
|
|
440
450
|
hook: string;
|
|
441
451
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -485,6 +495,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
485
495
|
match: z.ZodOptional<z.ZodString>;
|
|
486
496
|
path_match: z.ZodOptional<z.ZodString>;
|
|
487
497
|
bash_match: z.ZodOptional<z.ZodString>;
|
|
498
|
+
input_match: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>, Record<string, string | number | boolean>, Record<string, string | number | boolean>>>;
|
|
488
499
|
extract: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>, Record<string, string>, Record<string, string>>>;
|
|
489
500
|
}, "strict", z.ZodTypeAny, {
|
|
490
501
|
event: "SessionStart" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "Stop" | "SubagentStop" | "PreCompact";
|
|
@@ -492,12 +503,14 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
492
503
|
path_match?: string | undefined;
|
|
493
504
|
bash_match?: string | undefined;
|
|
494
505
|
extract?: Record<string, string> | undefined;
|
|
506
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
495
507
|
}, {
|
|
496
508
|
event: "SessionStart" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "Stop" | "SubagentStop" | "PreCompact";
|
|
497
509
|
match?: string | undefined;
|
|
498
510
|
path_match?: string | undefined;
|
|
499
511
|
bash_match?: string | undefined;
|
|
500
512
|
extract?: Record<string, string> | undefined;
|
|
513
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
501
514
|
}>;
|
|
502
515
|
requires: z.ZodOptional<z.ZodObject<{
|
|
503
516
|
ledger_tag: z.ZodString;
|
|
@@ -663,6 +676,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
663
676
|
path_match?: string | undefined;
|
|
664
677
|
bash_match?: string | undefined;
|
|
665
678
|
extract?: Record<string, string> | undefined;
|
|
679
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
666
680
|
};
|
|
667
681
|
hook: string;
|
|
668
682
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -712,6 +726,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
712
726
|
path_match?: string | undefined;
|
|
713
727
|
bash_match?: string | undefined;
|
|
714
728
|
extract?: Record<string, string> | undefined;
|
|
729
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
715
730
|
};
|
|
716
731
|
hook: string;
|
|
717
732
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -761,6 +776,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
761
776
|
path_match?: string | undefined;
|
|
762
777
|
bash_match?: string | undefined;
|
|
763
778
|
extract?: Record<string, string> | undefined;
|
|
779
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
764
780
|
};
|
|
765
781
|
hook: string;
|
|
766
782
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -810,6 +826,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
810
826
|
path_match?: string | undefined;
|
|
811
827
|
bash_match?: string | undefined;
|
|
812
828
|
extract?: Record<string, string> | undefined;
|
|
829
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
813
830
|
};
|
|
814
831
|
hook: string;
|
|
815
832
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -859,6 +876,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
859
876
|
path_match?: string | undefined;
|
|
860
877
|
bash_match?: string | undefined;
|
|
861
878
|
extract?: Record<string, string> | undefined;
|
|
879
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
862
880
|
};
|
|
863
881
|
hook: string;
|
|
864
882
|
enforcement: "warn" | "block" | "require_approval";
|
|
@@ -908,6 +926,7 @@ export declare const PoliciesSchema: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodO
|
|
|
908
926
|
path_match?: string | undefined;
|
|
909
927
|
bash_match?: string | undefined;
|
|
910
928
|
extract?: Record<string, string> | undefined;
|
|
929
|
+
input_match?: Record<string, string | number | boolean> | undefined;
|
|
911
930
|
};
|
|
912
931
|
hook: string;
|
|
913
932
|
enforcement: "warn" | "block" | "require_approval";
|
package/dist/schema/policies.js
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { MatchableEnvironmentSchema } from "./environments.js";
|
|
3
|
-
import { ExtractMapSchema } from "./extract.js";
|
|
3
|
+
import { ExtractMapSchema, InputMatchMapSchema } from "./extract.js";
|
|
4
4
|
import { HookEventSchema } from "./hooks.js";
|
|
5
5
|
import { RequiresSchema, isBuiltinVariable, referencedVariables } from "./requires.js";
|
|
6
6
|
import { RiskCategorySchema, RiskSeveritySchema } from "./risk.js";
|
|
7
|
+
// `trigger:`: the WHICH-tool-calls filter. Every declared field is
|
|
8
|
+
// ANDed: `match` on the tool name, `path_match` on the edited file path,
|
|
9
|
+
// `bash_match` on the shell command text, and `input_match` (task
|
|
10
|
+
// 2699b476) on the tool call's own arguments.
|
|
11
|
+
//
|
|
12
|
+
// `input_match` exists because the other three cannot express "this MCP
|
|
13
|
+
// verb, but only in the mode that actually does the dangerous thing".
|
|
14
|
+
// `mcp__agent-tasks__task_finish` is the motivating shape: the same verb
|
|
15
|
+
// either merges the PR (`autoMerge: true`) or just advances the task, and
|
|
16
|
+
// a name-only trigger would have to gate both or neither. Keys are
|
|
17
|
+
// `toolArgs.`-namespaced extract expressions (the SAME grammar and parser
|
|
18
|
+
// `extract` uses, `src/schema/extract.ts` + `src/io/extract.ts`), values
|
|
19
|
+
// are literals compared by strict equality; a missing path never matches.
|
|
20
|
+
// See `firstInputMatchMismatch` in `src/io/extract.ts` for the evaluator
|
|
21
|
+
// `policyMatchesEvent` and `harness policy dry-run` both call.
|
|
7
22
|
export const PolicyTriggerSchema = z
|
|
8
23
|
.object({
|
|
9
24
|
event: HookEventSchema,
|
|
10
25
|
match: z.string().min(1).optional(),
|
|
11
26
|
path_match: z.string().min(1).optional(),
|
|
12
27
|
bash_match: z.string().min(1).optional(),
|
|
28
|
+
input_match: InputMatchMapSchema.optional(),
|
|
13
29
|
extract: ExtractMapSchema.optional(),
|
|
14
30
|
})
|
|
15
31
|
.strict();
|