@intutic/gate 2.4.0 → 2.5.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/README.md +13 -0
- package/dist/chaosGate.d.ts +166 -0
- package/dist/chaosGate.d.ts.map +1 -0
- package/dist/chaosGate.js +372 -0
- package/dist/chaosGate.js.map +1 -0
- package/dist/client.d.ts +26 -15
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +71 -32
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +3 -0
- package/dist/errors.js.map +1 -1
- package/dist/gate.d.ts +46 -2
- package/dist/gate.d.ts.map +1 -1
- package/dist/gate.js +143 -13
- package/dist/gate.js.map +1 -1
- package/dist/harness.d.ts.map +1 -1
- package/dist/harness.js +17 -4
- package/dist/harness.js.map +1 -1
- package/dist/hold.d.ts.map +1 -1
- package/dist/hold.js +5 -2
- package/dist/hold.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/opaqueRefusal.d.ts +40 -0
- package/dist/opaqueRefusal.d.ts.map +1 -0
- package/dist/opaqueRefusal.js +47 -0
- package/dist/opaqueRefusal.js.map +1 -0
- package/dist/snapshot.d.ts +7 -0
- package/dist/snapshot.d.ts.map +1 -1
- package/dist/snapshot.js +12 -0
- package/dist/snapshot.js.map +1 -1
- package/dist/soprules.d.ts +14 -0
- package/dist/soprules.d.ts.map +1 -1
- package/dist/soprules.js +14 -1
- package/dist/soprules.js.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -5,21 +5,23 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Endpoints used:
|
|
7
7
|
*
|
|
8
|
-
* POST /api/v1/hook-gate synchronous allow/deny -> {allowed, reason, incidentId?, code?}
|
|
8
|
+
* POST /api/v1/hook-gate synchronous allow/deny -> {allowed, reason, incidentId?, code?, degraded?}
|
|
9
9
|
* POST /api/v1/hook-events batched telemetry -> creates governance_incidents rows
|
|
10
10
|
* POST /api/v1/decisions record a hold -> joins the review queue (hold.ts)
|
|
11
11
|
* GET /api/v1/decisions/approved-bypasses -> approvals that let a held call through
|
|
12
12
|
*
|
|
13
13
|
* Two behaviours that must not be "improved":
|
|
14
14
|
*
|
|
15
|
-
* * The hook
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `
|
|
22
|
-
* tier as advisory
|
|
15
|
+
* * The hook gate fails CLOSED, on both sides. The server refuses a call
|
|
16
|
+
* whose checks could not run (403 `GOVERNANCE_UNAVAILABLE`; a shadow-mode
|
|
17
|
+
* workspace gets a degraded allow instead) and a body it cannot read
|
|
18
|
+
* (400 `INVALID_REQUEST`). This client treats `GOVERNANCE_UNAVAILABLE`
|
|
19
|
+
* exactly as it treats a control plane it cannot reach, a non-2xx answer,
|
|
20
|
+
* or an answer with no boolean `allowed`: there is no verdict to defer to,
|
|
21
|
+
* and `failClosed` (default true) decides, reporting `allowed=false`. Set
|
|
22
|
+
* `failClosed=false` to treat the tier as advisory during an outage. A 400
|
|
23
|
+
* is refused whatever `failClosed` says: it is this client's request that
|
|
24
|
+
* is wrong, not the control plane that is down, and allowing would hide it.
|
|
23
25
|
* * `emit` NEVER throws. Telemetry that can break a run is worse than no
|
|
24
26
|
* telemetry.
|
|
25
27
|
*/
|
|
@@ -27,9 +29,13 @@ export interface GateResponse {
|
|
|
27
29
|
allowed: boolean;
|
|
28
30
|
reason: string;
|
|
29
31
|
incidentId?: string | undefined;
|
|
30
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* The code the hook gate names, when it names one: the MCP registry's on its
|
|
34
|
+
* refusals, `GOVERNANCE_UNAVAILABLE` when its checks could not run, and
|
|
35
|
+
* `INVALID_REQUEST` when it could not read the request.
|
|
36
|
+
*/
|
|
31
37
|
code?: string | undefined;
|
|
32
|
-
/** False when the
|
|
38
|
+
/** False when the hook gate gave no verdict and `failClosed` decided it. */
|
|
33
39
|
reached: boolean;
|
|
34
40
|
}
|
|
35
41
|
export interface GateClientOptions {
|
|
@@ -71,12 +77,17 @@ export declare class GateClient {
|
|
|
71
77
|
* plus SOP rules. It is defence in depth on top of the local tiers, not a
|
|
72
78
|
* replacement for them.
|
|
73
79
|
*
|
|
74
|
-
* When
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
80
|
+
* When there is no verdict (the control plane cannot be reached, answers
|
|
81
|
+
* non-2xx or without a boolean `allowed`, or answers
|
|
82
|
+
* `GOVERNANCE_UNAVAILABLE` because its own checks could not run), the
|
|
83
|
+
* verdict is decided by `failClosed`: true (the default) reports BLOCK,
|
|
84
|
+
* because a client with no verdict has nothing to defer to; false reports
|
|
85
|
+
* allow. A 400 `INVALID_REQUEST` is a BLOCK whatever `failClosed` says. A
|
|
86
|
+
* shadow-mode workspace's `{allowed: true, degraded: true}` is an allow.
|
|
78
87
|
*/
|
|
79
88
|
hookGate(toolName: string, toolInput: unknown): Promise<GateResponse>;
|
|
89
|
+
/** The answer when the hook gate gave no verdict: `failClosed` decides. */
|
|
90
|
+
private noVerdict;
|
|
80
91
|
/**
|
|
81
92
|
* Fire-and-forget telemetry. Never throws.
|
|
82
93
|
*
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AA4BH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B;;;;OAI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C,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IASjE;;;;OAIG;IACG,gBAAgB,IAAI,OAAO,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IASnD;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,IAAI,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,UAAU;CAoCtG"}
|
package/dist/client.js
CHANGED
|
@@ -5,21 +5,23 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Endpoints used:
|
|
7
7
|
*
|
|
8
|
-
* POST /api/v1/hook-gate synchronous allow/deny -> {allowed, reason, incidentId?, code?}
|
|
8
|
+
* POST /api/v1/hook-gate synchronous allow/deny -> {allowed, reason, incidentId?, code?, degraded?}
|
|
9
9
|
* POST /api/v1/hook-events batched telemetry -> creates governance_incidents rows
|
|
10
10
|
* POST /api/v1/decisions record a hold -> joins the review queue (hold.ts)
|
|
11
11
|
* GET /api/v1/decisions/approved-bypasses -> approvals that let a held call through
|
|
12
12
|
*
|
|
13
13
|
* Two behaviours that must not be "improved":
|
|
14
14
|
*
|
|
15
|
-
* * The hook
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `
|
|
22
|
-
* tier as advisory
|
|
15
|
+
* * The hook gate fails CLOSED, on both sides. The server refuses a call
|
|
16
|
+
* whose checks could not run (403 `GOVERNANCE_UNAVAILABLE`; a shadow-mode
|
|
17
|
+
* workspace gets a degraded allow instead) and a body it cannot read
|
|
18
|
+
* (400 `INVALID_REQUEST`). This client treats `GOVERNANCE_UNAVAILABLE`
|
|
19
|
+
* exactly as it treats a control plane it cannot reach, a non-2xx answer,
|
|
20
|
+
* or an answer with no boolean `allowed`: there is no verdict to defer to,
|
|
21
|
+
* and `failClosed` (default true) decides, reporting `allowed=false`. Set
|
|
22
|
+
* `failClosed=false` to treat the tier as advisory during an outage. A 400
|
|
23
|
+
* is refused whatever `failClosed` says: it is this client's request that
|
|
24
|
+
* is wrong, not the control plane that is down, and allowing would hide it.
|
|
23
25
|
* * `emit` NEVER throws. Telemetry that can break a run is worse than no
|
|
24
26
|
* telemetry.
|
|
25
27
|
*/
|
|
@@ -46,6 +48,19 @@ const VALID_EVENTS = new Set([
|
|
|
46
48
|
'tool_held',
|
|
47
49
|
'hold_approved_bypass_used',
|
|
48
50
|
]);
|
|
51
|
+
/** The hook gate's code for a call whose checks could not run. */
|
|
52
|
+
const GOVERNANCE_UNAVAILABLE = 'GOVERNANCE_UNAVAILABLE';
|
|
53
|
+
/** A non-2xx answer, with its status and whatever JSON body it carried. */
|
|
54
|
+
class HttpStatusError extends Error {
|
|
55
|
+
status;
|
|
56
|
+
body;
|
|
57
|
+
constructor(path, status, body) {
|
|
58
|
+
super(`HTTP ${status} from ${path}`);
|
|
59
|
+
this.status = status;
|
|
60
|
+
this.body = body;
|
|
61
|
+
this.name = 'HttpStatusError';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
49
64
|
/**
|
|
50
65
|
* Control-plane client for the pre-execution gate.
|
|
51
66
|
*
|
|
@@ -88,9 +103,17 @@ export class GateClient {
|
|
|
88
103
|
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
89
104
|
signal: controller.signal,
|
|
90
105
|
});
|
|
91
|
-
if (!res.ok)
|
|
92
|
-
throw new Error(`HTTP ${res.status} from ${path}`);
|
|
93
106
|
const text = await res.text();
|
|
107
|
+
if (!res.ok) {
|
|
108
|
+
let body = null;
|
|
109
|
+
try {
|
|
110
|
+
body = text ? JSON.parse(text) : null;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// Not JSON: the status alone is the answer.
|
|
114
|
+
}
|
|
115
|
+
throw new HttpStatusError(path, res.status, body !== null && typeof body === 'object' ? body : {});
|
|
116
|
+
}
|
|
94
117
|
return text ? JSON.parse(text) : {};
|
|
95
118
|
}
|
|
96
119
|
finally {
|
|
@@ -104,43 +127,59 @@ export class GateClient {
|
|
|
104
127
|
* plus SOP rules. It is defence in depth on top of the local tiers, not a
|
|
105
128
|
* replacement for them.
|
|
106
129
|
*
|
|
107
|
-
* When
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
130
|
+
* When there is no verdict (the control plane cannot be reached, answers
|
|
131
|
+
* non-2xx or without a boolean `allowed`, or answers
|
|
132
|
+
* `GOVERNANCE_UNAVAILABLE` because its own checks could not run), the
|
|
133
|
+
* verdict is decided by `failClosed`: true (the default) reports BLOCK,
|
|
134
|
+
* because a client with no verdict has nothing to defer to; false reports
|
|
135
|
+
* allow. A 400 `INVALID_REQUEST` is a BLOCK whatever `failClosed` says. A
|
|
136
|
+
* shadow-mode workspace's `{allowed: true, degraded: true}` is an allow.
|
|
111
137
|
*/
|
|
112
138
|
async hookGate(toolName, toolInput) {
|
|
139
|
+
let d;
|
|
113
140
|
try {
|
|
114
|
-
|
|
141
|
+
d = await this.post('/api/v1/hook-gate', {
|
|
115
142
|
toolName,
|
|
116
143
|
toolInput,
|
|
117
144
|
workspaceId: this.workspaceId,
|
|
118
145
|
sessionId: this.sessionId,
|
|
119
146
|
harnessType: this.harness,
|
|
120
147
|
}, this.timeoutMs);
|
|
121
|
-
return {
|
|
122
|
-
allowed: Boolean(d.allowed ?? true),
|
|
123
|
-
reason: String(d.reason ?? ''),
|
|
124
|
-
incidentId: typeof d.incidentId === 'string' ? d.incidentId : undefined,
|
|
125
|
-
code: typeof d.code === 'string' ? d.code : undefined,
|
|
126
|
-
reached: true,
|
|
127
|
-
};
|
|
128
148
|
}
|
|
129
149
|
catch (exc) {
|
|
130
|
-
|
|
131
|
-
|
|
150
|
+
if (exc instanceof HttpStatusError && exc.status === 400) {
|
|
151
|
+
const why = typeof exc.body.reason === 'string' ? exc.body.reason : exc.message;
|
|
132
152
|
return {
|
|
133
153
|
allowed: false,
|
|
134
|
-
reason: `hook-gate
|
|
135
|
-
|
|
154
|
+
reason: `hook-gate rejected the request (INVALID_REQUEST): ${why}`,
|
|
155
|
+
code: 'INVALID_REQUEST',
|
|
156
|
+
reached: true,
|
|
136
157
|
};
|
|
137
158
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
};
|
|
159
|
+
if (exc instanceof HttpStatusError && exc.body.code === GOVERNANCE_UNAVAILABLE) {
|
|
160
|
+
return this.noVerdict(`governance check unavailable (${GOVERNANCE_UNAVAILABLE})`, GOVERNANCE_UNAVAILABLE);
|
|
161
|
+
}
|
|
162
|
+
const name = exc instanceof Error ? exc.constructor.name : 'Error';
|
|
163
|
+
return this.noVerdict(`unreachable (${name})`);
|
|
164
|
+
}
|
|
165
|
+
if (d.allowed === false && d.code === GOVERNANCE_UNAVAILABLE) {
|
|
166
|
+
return this.noVerdict(`governance check unavailable (${GOVERNANCE_UNAVAILABLE})`, GOVERNANCE_UNAVAILABLE);
|
|
143
167
|
}
|
|
168
|
+
if (typeof d.allowed !== 'boolean')
|
|
169
|
+
return this.noVerdict('answered without a verdict');
|
|
170
|
+
return {
|
|
171
|
+
allowed: d.allowed,
|
|
172
|
+
reason: String(d.reason ?? ''),
|
|
173
|
+
incidentId: typeof d.incidentId === 'string' ? d.incidentId : undefined,
|
|
174
|
+
code: typeof d.code === 'string' ? d.code : undefined,
|
|
175
|
+
reached: true,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/** The answer when the hook gate gave no verdict: `failClosed` decides. */
|
|
179
|
+
noVerdict(what, code) {
|
|
180
|
+
return this.failClosed
|
|
181
|
+
? { allowed: false, reason: `hook-gate ${what} — failing closed (failClosed=true)`, code, reached: false }
|
|
182
|
+
: { allowed: true, reason: `hook-gate ${what} — failing open (failClosed=false)`, code, reached: false };
|
|
144
183
|
}
|
|
145
184
|
/**
|
|
146
185
|
* Fire-and-forget telemetry. Never throws.
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,kBAAkB,GAAG,KAAK,CAAA;AAChC,MAAM,gBAAgB,GAAG,KAAK,CAAA;AAC9B,MAAM,UAAU,GAAG,GAAG,CAAA,CAAC,2DAA2D;AAElF,8EAA8E;AAC9E,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,cAAc;IACd,cAAc;IACd,cAAc;IACd,kBAAkB;IAClB,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,WAAW;IACX,2BAA2B;CAC5B,CAAC,CAAA;AAgBF,kEAAkE;AAClE,MAAM,sBAAsB,GAAG,wBAAwB,CAAA;AAEvD,2EAA2E;AAC3E,MAAM,eAAgB,SAAQ,KAAK;IAGtB;IACA;IAHX,YACE,IAAY,EACH,MAAc,EACd,IAA6B;QAEtC,KAAK,CAAC,QAAQ,MAAM,SAAS,IAAI,EAAE,CAAC,CAAA;QAH3B,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAyB;QAGtC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;IAC/B,CAAC;CACF;AAgBD;;;;;;;GAOG;AACH,MAAM,OAAO,UAAU;IACZ,OAAO,CAAQ;IACf,MAAM,CAAQ;IACd,WAAW,CAAQ;IACn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FAAgF;gBAChF,oBAAoB,CACvB,CAAA;QACH,CAAC;QAED,OAAO,IAAI,UAAU,CAAC;YACpB,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,GAAG;YACX,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,SAAS;YAClC,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI;SACpC,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare class GateConnectionError extends GateError {
|
|
|
31
31
|
* `packages/shared-types/fixtures/refusal-codes.json` (`gate`) by a test, as
|
|
32
32
|
* the Python gate's list and the gate SDK reference are.
|
|
33
33
|
*/
|
|
34
|
-
export declare const GATE_REFUSAL_CODES: readonly ["SSO_GROUP", "SNAPSHOT", "HELD", "SERVER_BLOCKED", "SERVER_HELD", "SERVER_NOT_APPROVED", "TOOL_DISABLED", "SERVER_NOT_ALLOWED", "POLICY_SNAPSHOT_UNVERIFIED", "SOP_RULE", "HOOK_GATE", "COMMAND_TOO_LARGE", "E_UNPINNED_LATEST", "E_UNPINNED_TAG", "E_UNKNOWN_REGISTRY", "E_UNKNOWN_IMAGE", "E_DIGEST_MISMATCH", "E_MANIFEST_UNPARSEABLE", "WORKFLOW_SANDBOX", "NO_GATE"];
|
|
34
|
+
export declare const GATE_REFUSAL_CODES: readonly ["SSO_GROUP", "SNAPSHOT", "HELD", "SERVER_BLOCKED", "SERVER_HELD", "SERVER_NOT_APPROVED", "TOOL_DISABLED", "SERVER_NOT_ALLOWED", "POLICY_SNAPSHOT_UNVERIFIED", "SOP_RULE", "HOOK_GATE", "COMMAND_TOO_LARGE", "CHAOS_FAULT", "E_UNPINNED_LATEST", "E_UNPINNED_TAG", "E_UNKNOWN_REGISTRY", "E_UNKNOWN_IMAGE", "E_DIGEST_MISMATCH", "E_MANIFEST_UNPARSEABLE", "WORKFLOW_SANDBOX", "NO_GATE"];
|
|
35
35
|
export type GateRefusalCode = (typeof GATE_REFUSAL_CODES)[number];
|
|
36
36
|
/**
|
|
37
37
|
* Raised when a tool call must not run.
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sDAAsD;AACtD,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED,kEAAkE;AAClE,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sDAAsD;AACtD,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED,kEAAkE;AAClE,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,oYA6BrB,CAAA;AAEV,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjE;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,SAAgB,MAAM,EAAE,MAAM,CAAA;IAC9B,SAAgB,IAAI,EAAE,eAAe,CAAA;IACrC,SAAgB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;gBAElC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,CAAC,EAAE,MAAM;CAOvE;AAED;;;;;;;;;;GAUG;AACH,qBAAa,eAAgB,SAAQ,kBAAkB;IACrD,SAAgB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;gBAE9B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS;CAMvD"}
|
package/dist/errors.js
CHANGED
|
@@ -54,6 +54,9 @@ export const GATE_REFUSAL_CODES = [
|
|
|
54
54
|
'HOOK_GATE',
|
|
55
55
|
// The call is too large to evaluate (limits.ts), before any tier runs.
|
|
56
56
|
'COMMAND_TOO_LARGE',
|
|
57
|
+
// A chaos run's fault, injected after every tier allowed the call, or its
|
|
58
|
+
// unreadable plan (chaosGate.ts). Never a governance decision.
|
|
59
|
+
'CHAOS_FAULT',
|
|
57
60
|
'E_UNPINNED_LATEST',
|
|
58
61
|
'E_UNPINNED_TAG',
|
|
59
62
|
'E_UNKNOWN_REGISTRY',
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sDAAsD;AACtD,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;IACzB,CAAC;CACF;AAED,kEAAkE;AAClE,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,WAAW;IACX,UAAU;IACV,MAAM;IACN,yEAAyE;IACzE,6BAA6B;IAC7B,gBAAgB;IAChB,aAAa;IACb,qBAAqB;IACrB,eAAe;IACf,oBAAoB;IACpB,qEAAqE;IACrE,4BAA4B;IAC5B,UAAU;IACV,WAAW;IACX,uEAAuE;IACvE,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IACh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36,9 +36,20 @@
|
|
|
36
36
|
* call through — the hook gates' and the MCP proxy's mechanism, through the
|
|
37
37
|
* same decisions API. See hold.ts.
|
|
38
38
|
*
|
|
39
|
+
* Under a chaos run (`intutic chaos run`, which sets `INTUTIC_CHAOS_PLAN` and
|
|
40
|
+
* `INTUTIC_CHAOS_EVENTS`), {@link Gate.guard} reports each call to the run's
|
|
41
|
+
* events file and injects the plan's `tool.error` and
|
|
42
|
+
* `permission.deny_or_delay` faults into a call every tier allowed, exactly
|
|
43
|
+
* as the hook gates do: the same plan decoding and counter files
|
|
44
|
+
* (`chaosGate.ts`, a byte-identical copy of `@intutic/shared-types`'
|
|
45
|
+
* module). A fault refuses with `CHAOS_FAULT`; a held call throws
|
|
46
|
+
* {@link IntuticGateHold} with no `holdId`, until its identical retry is
|
|
47
|
+
* let through or denied.
|
|
48
|
+
*
|
|
39
49
|
* A1 and A2 are load-bearing and local. Tier B contributes the DLP regexes
|
|
40
50
|
* and workspace policy from the control plane; whether an unreachable control
|
|
41
|
-
* plane
|
|
51
|
+
* plane, or one whose checks could not run (`GOVERNANCE_UNAVAILABLE`), blocks
|
|
52
|
+
* is the client's `failClosed` setting (default true).
|
|
42
53
|
*
|
|
43
54
|
* Tier A3 applies rules written in the SOP register rather than in code. It
|
|
44
55
|
* runs BEFORE A2 so that a block, when both would fire, is attributed to the
|
|
@@ -97,6 +108,9 @@ export declare class Gate {
|
|
|
97
108
|
/** `null` = not fetched yet. A failed fetch caches `[]` so one unreachable
|
|
98
109
|
* control plane does not add a timeout to every subsequent tool call. */
|
|
99
110
|
private _sopRules;
|
|
111
|
+
/** The SOP register said the workspace is OPAQUE (read with its rules). */
|
|
112
|
+
private _registerOpaque;
|
|
113
|
+
private _chaos;
|
|
100
114
|
constructor(cfg?: GateConfig, client?: GateClient | null);
|
|
101
115
|
private allowlistAbs;
|
|
102
116
|
getSnapshot(): snapshot.Snapshot;
|
|
@@ -117,6 +131,21 @@ export declare class Gate {
|
|
|
117
131
|
* (or clear the cache) to refresh.
|
|
118
132
|
*/
|
|
119
133
|
getSopRules(): Promise<soprules.SopRule[]>;
|
|
134
|
+
/**
|
|
135
|
+
* What the agent is told of a refusal on workspace policy: the reason, or in
|
|
136
|
+
* an OPAQUE workspace (the snapshot's `@intervention_mode` record) the
|
|
137
|
+
* generic sentence, so it cannot learn the rule to route around it. The
|
|
138
|
+
* code is unchanged, and the event is always emitted with the full reason.
|
|
139
|
+
*/
|
|
140
|
+
private shown;
|
|
141
|
+
/**
|
|
142
|
+
* Whether the workspace is OPAQUE: the policy snapshot's record when there
|
|
143
|
+
* is a snapshot, and the SOP register's `interventionMode` when there is
|
|
144
|
+
* none. Without a snapshot the only tiers that refuse on workspace policy
|
|
145
|
+
* are the register's (A3, which reads the mode with its rules) and the hook
|
|
146
|
+
* gate, which applies the mode itself.
|
|
147
|
+
*/
|
|
148
|
+
private opaque;
|
|
120
149
|
private emit;
|
|
121
150
|
/**
|
|
122
151
|
* Report snapshot condition exactly once per process — otherwise these
|
|
@@ -124,8 +153,23 @@ export declare class Gate {
|
|
|
124
153
|
* "snapshot missing on 400 machines" from "snapshot healthy".
|
|
125
154
|
*/
|
|
126
155
|
private reportSnapshotHealthOnce;
|
|
127
|
-
/**
|
|
156
|
+
/** A chaos run's plan, from `INTUTIC_CHAOS_PLAN` and `INTUTIC_CHAOS_EVENTS`, read once. */
|
|
157
|
+
private chaos;
|
|
158
|
+
/** Reports one call to a chaos run's events file; returns the fault due on an allowed call. */
|
|
159
|
+
private chaosReport;
|
|
160
|
+
/**
|
|
161
|
+
* Throws {@link IntuticGateRefusal} if this call must not run. Resolves to allow.
|
|
162
|
+
*
|
|
163
|
+
* Under a chaos run's plan, the call is reported to the run's events file
|
|
164
|
+
* whatever the tiers decide, and a call they allowed can still be refused
|
|
165
|
+
* by the fault that is due (`CHAOS_FAULT`, or {@link IntuticGateHold} for
|
|
166
|
+
* a held one). A plan that is set but unreadable refuses every call: an
|
|
167
|
+
* experiment run without the faults it asked for reports a resilience it
|
|
168
|
+
* never measured.
|
|
169
|
+
*/
|
|
128
170
|
guard(toolName: string, toolInput: ToolInput): Promise<void>;
|
|
171
|
+
/** The tiers: throws to refuse, resolves to allow. `note` collects a chaos run's record of the call. */
|
|
172
|
+
private decide;
|
|
129
173
|
/**
|
|
130
174
|
* Throws when the workspace's MCP server registry or allowlist refuses an
|
|
131
175
|
* `mcp__<server>__<tool>` call: the registry first, as every gate orders
|
package/dist/gate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AAUH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAGzC;yDACyD;AACzD,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,CAM9C,CAAA;AAEF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAA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