@agentic-kit/harness 0.11.0 → 0.13.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.
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The declared half of the run gate: which tool calls run, which are refused,
3
+ * and which need a human. A policy is data — an ordered rule list evaluated with
4
+ * no I/O — so the same policy can be asserted in a test, stored on a run row,
5
+ * and shown in a UI.
6
+ *
7
+ * This is the *run's* policy, decided wherever the run is configured and
8
+ * enforceable without a UI, as opposed to `ConfirmGatePolicy` in
9
+ * `./policy`, which is a host's interactive confirm surface. Harness-neutral:
10
+ * an adapter maps its own tool-call event onto `RunGateRequest`.
11
+ */
12
+ export type RunGateDecision = 'allow' | 'deny' | 'ask';
13
+ export interface RunGateRequest {
14
+ toolName: string;
15
+ input: Record<string, unknown>;
16
+ }
17
+ export interface RunGateRule {
18
+ /** Tool name, or `*` for every tool. */
19
+ tool: string;
20
+ decision: RunGateDecision;
21
+ /** Narrow the rule to particular arguments (e.g. a bash command pattern). */
22
+ match?: (request: RunGateRequest) => boolean;
23
+ /** Shown to the model when denied, and to the human when asked. */
24
+ reason?: string;
25
+ }
26
+ export interface RunGateVerdict {
27
+ decision: RunGateDecision;
28
+ reason?: string;
29
+ /** The rule that decided, or `undefined` when the default applied. */
30
+ rule?: RunGateRule;
31
+ }
32
+ export interface RunGatePolicyOptions {
33
+ rules?: readonly RunGateRule[];
34
+ /** Verdict when no rule matches. Defaults to `ask` — an undeclared tool is
35
+ * not implicitly trusted, and denying outright would strand the run. */
36
+ defaultDecision?: RunGateDecision;
37
+ defaultReason?: string;
38
+ }
39
+ export declare class RunGatePolicy {
40
+ readonly rules: readonly RunGateRule[];
41
+ readonly defaultDecision: RunGateDecision;
42
+ private readonly defaultReason;
43
+ constructor(options?: RunGatePolicyOptions);
44
+ /** First matching rule wins, so order the list most specific first. */
45
+ evaluate(request: RunGateRequest): RunGateVerdict;
46
+ }
47
+ export declare function runGatePolicy(options?: RunGatePolicyOptions): RunGatePolicy;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /**
3
+ * The declared half of the run gate: which tool calls run, which are refused,
4
+ * and which need a human. A policy is data — an ordered rule list evaluated with
5
+ * no I/O — so the same policy can be asserted in a test, stored on a run row,
6
+ * and shown in a UI.
7
+ *
8
+ * This is the *run's* policy, decided wherever the run is configured and
9
+ * enforceable without a UI, as opposed to `ConfirmGatePolicy` in
10
+ * `./policy`, which is a host's interactive confirm surface. Harness-neutral:
11
+ * an adapter maps its own tool-call event onto `RunGateRequest`.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.RunGatePolicy = void 0;
15
+ exports.runGatePolicy = runGatePolicy;
16
+ class RunGatePolicy {
17
+ rules;
18
+ defaultDecision;
19
+ defaultReason;
20
+ constructor(options = {}) {
21
+ this.rules = options.rules ?? [];
22
+ this.defaultDecision = options.defaultDecision ?? 'ask';
23
+ this.defaultReason = options.defaultReason;
24
+ for (const rule of this.rules) {
25
+ if (!rule.tool)
26
+ throw new Error('gate: every rule needs a tool name (or "*")');
27
+ }
28
+ }
29
+ /** First matching rule wins, so order the list most specific first. */
30
+ evaluate(request) {
31
+ for (const rule of this.rules) {
32
+ if (rule.tool !== '*' && rule.tool !== request.toolName)
33
+ continue;
34
+ if (rule.match && !rule.match(request))
35
+ continue;
36
+ return rule.reason === undefined
37
+ ? { decision: rule.decision, rule }
38
+ : { decision: rule.decision, reason: rule.reason, rule };
39
+ }
40
+ return this.defaultReason === undefined
41
+ ? { decision: this.defaultDecision }
42
+ : { decision: this.defaultDecision, reason: this.defaultReason };
43
+ }
44
+ }
45
+ exports.RunGatePolicy = RunGatePolicy;
46
+ function runGatePolicy(options = {}) {
47
+ return new RunGatePolicy(options);
48
+ }
package/index.d.ts CHANGED
@@ -1,12 +1,18 @@
1
+ export * from './adapter';
1
2
  export * from './blueprint/blueprint-defaults';
2
3
  export * from './blueprint/blueprint-schema';
3
4
  export * from './blueprint/field-type';
4
5
  export * from './blueprint/internal-policies';
5
6
  export * from './blueprint/policy-provisioning';
7
+ export * from './gating/approvals';
6
8
  export * from './gating/confirm-gate';
9
+ export * from './gating/constructive-policy';
7
10
  export * from './gating/decline-guard';
11
+ export * from './gating/policy';
8
12
  export * from './gating/preview';
9
13
  export * from './gating/prompts';
14
+ export * from './gating/run-gate';
15
+ export * from './gating/run-policy';
10
16
  export * from './skills/default-source';
11
17
  export * from './skills/fetch';
12
18
  export * from './skills/frontmatter';
package/index.js CHANGED
@@ -14,15 +14,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./adapter"), exports);
17
18
  __exportStar(require("./blueprint/blueprint-defaults"), exports);
18
19
  __exportStar(require("./blueprint/blueprint-schema"), exports);
19
20
  __exportStar(require("./blueprint/field-type"), exports);
20
21
  __exportStar(require("./blueprint/internal-policies"), exports);
21
22
  __exportStar(require("./blueprint/policy-provisioning"), exports);
23
+ __exportStar(require("./gating/approvals"), exports);
22
24
  __exportStar(require("./gating/confirm-gate"), exports);
25
+ __exportStar(require("./gating/constructive-policy"), exports);
23
26
  __exportStar(require("./gating/decline-guard"), exports);
27
+ __exportStar(require("./gating/policy"), exports);
24
28
  __exportStar(require("./gating/preview"), exports);
25
29
  __exportStar(require("./gating/prompts"), exports);
30
+ __exportStar(require("./gating/run-gate"), exports);
31
+ __exportStar(require("./gating/run-policy"), exports);
26
32
  __exportStar(require("./skills/default-source"), exports);
27
33
  __exportStar(require("./skills/fetch"), exports);
28
34
  __exportStar(require("./skills/frontmatter"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentic-kit/harness",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "author": "Dan Lynch <pyramation@gmail.com>",
5
5
  "description": "Host-agnostic Constructive harness core — skill overlay resolution, materialization, and on-disk layout for harness hosts (desktop, CLI, MCP)",
6
6
  "main": "index.js",
@@ -38,5 +38,5 @@
38
38
  "@types/semver": "^7.8.0"
39
39
  },
40
40
  "keywords": [],
41
- "gitHead": "4839d3c123304735a7aa74fb4e45af41cf947567"
41
+ "gitHead": "44a670631c98f7174db0e4c25dc30a3c81fd4437"
42
42
  }