@intutic/gate 2.1.0 → 2.3.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.
Files changed (74) hide show
  1. package/README.md +29 -12
  2. package/dist/actions.d.ts.map +1 -1
  3. package/dist/actions.js +20 -6
  4. package/dist/actions.js.map +1 -1
  5. package/dist/client.d.ts +19 -1
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +48 -4
  8. package/dist/client.js.map +1 -1
  9. package/dist/dsh.d.ts +1 -1
  10. package/dist/dsh.js +1 -1
  11. package/dist/errors.d.ts +25 -2
  12. package/dist/errors.d.ts.map +1 -1
  13. package/dist/errors.js +53 -0
  14. package/dist/errors.js.map +1 -1
  15. package/dist/eve.d.ts +11 -11
  16. package/dist/eve.d.ts.map +1 -1
  17. package/dist/eve.js +10 -10
  18. package/dist/eve.js.map +1 -1
  19. package/dist/gate.d.ts +34 -1
  20. package/dist/gate.d.ts.map +1 -1
  21. package/dist/gate.js +135 -9
  22. package/dist/gate.js.map +1 -1
  23. package/dist/harness.d.ts +28 -20
  24. package/dist/harness.d.ts.map +1 -1
  25. package/dist/harness.js +165 -26
  26. package/dist/harness.js.map +1 -1
  27. package/dist/hold.d.ts +69 -0
  28. package/dist/hold.d.ts.map +1 -0
  29. package/dist/hold.js +127 -0
  30. package/dist/hold.js.map +1 -0
  31. package/dist/imagecheck.d.ts +14 -7
  32. package/dist/imagecheck.d.ts.map +1 -1
  33. package/dist/imagecheck.js +3 -3
  34. package/dist/imagecheck.js.map +1 -1
  35. package/dist/index.d.ts +8 -3
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +4 -2
  38. package/dist/index.js.map +1 -1
  39. package/dist/limits.d.ts +26 -0
  40. package/dist/limits.d.ts.map +1 -0
  41. package/dist/limits.js +45 -0
  42. package/dist/limits.js.map +1 -0
  43. package/dist/managedAgents.d.ts +3 -3
  44. package/dist/managedAgents.d.ts.map +1 -1
  45. package/dist/managedAgents.js +2 -2
  46. package/dist/mcpRegistryRecord.d.ts +143 -0
  47. package/dist/mcpRegistryRecord.d.ts.map +1 -0
  48. package/dist/mcpRegistryRecord.js +217 -0
  49. package/dist/mcpRegistryRecord.js.map +1 -0
  50. package/dist/openai.d.ts +3 -3
  51. package/dist/openai.d.ts.map +1 -1
  52. package/dist/openai.js +9 -8
  53. package/dist/openai.js.map +1 -1
  54. package/dist/phrases.d.ts +87 -0
  55. package/dist/phrases.d.ts.map +1 -0
  56. package/dist/phrases.js +236 -0
  57. package/dist/phrases.js.map +1 -0
  58. package/dist/sequence.d.ts +52 -0
  59. package/dist/sequence.d.ts.map +1 -0
  60. package/dist/sequence.js +121 -0
  61. package/dist/sequence.js.map +1 -0
  62. package/dist/snapshot.d.ts +58 -36
  63. package/dist/snapshot.d.ts.map +1 -1
  64. package/dist/snapshot.js +106 -48
  65. package/dist/snapshot.js.map +1 -1
  66. package/dist/ssoGroups.d.ts +50 -0
  67. package/dist/ssoGroups.d.ts.map +1 -0
  68. package/dist/ssoGroups.js +101 -0
  69. package/dist/ssoGroups.js.map +1 -0
  70. package/dist/workflow.d.ts +5 -3
  71. package/dist/workflow.d.ts.map +1 -1
  72. package/dist/workflow.js +8 -4
  73. package/dist/workflow.js.map +1 -1
  74. package/package.json +1 -1
package/README.md CHANGED
@@ -35,8 +35,9 @@ const guardedTools = wrapTools(myTools) // array or {name: tool} record
35
35
  ```
36
36
 
37
37
  On a refused call, the wrapped tool throws `IntuticGateRefusal` (message
38
- prefixed `[Intutic Governance] BLOCKED:`) BEFORE the real implementation
39
- runs — this package's throw-based refusal contract, the same one
38
+ prefixed `[Intutic Governance] BLOCKED:`, or `IntuticGateHold`, prefixed
39
+ `[Intutic Governance] HELD:`, for a call held for approval) BEFORE the real
40
+ implementation runs — this package's throw-based refusal contract, the same one
40
41
  `services/sync-daemon/src/harness/gateBody.ts`'s emitted gates and
41
42
  `packages/mcp-proxy/src/policy.ts` use elsewhere in this repo's gate
42
43
  vocabulary.
@@ -45,16 +46,30 @@ vocabulary.
45
46
 
46
47
  | Export | From | What it is |
47
48
  |---|---|---|
48
- | `Gate`, `GateConfig` | `gate.ts` | The four-tier evaluator. `new Gate(cfg, client?)`, `await gate.guard(toolName, toolInput)`. |
49
+ | `Gate`, `GateConfig` | `gate.ts` | The six-tier evaluator. `new Gate(cfg, client?)`, `await gate.guard(toolName, toolInput)`. |
49
50
  | `install(gate)`, `active()` | `gate.ts` | Process-wide default gate, so wrapped tools don't need the instance threaded through every call site. |
50
- | `IntuticGateRefusal`, `GateError`, `GateConnectionError` | `errors.ts` | Thrown on refusal. `.reason`, `.code`, `.incidentId` carry the structured verdict; `.message` carries the `[Intutic Governance] BLOCKED: ...` text. |
51
+ | `IntuticGateRefusal`, `GateError`, `GateConnectionError` | `errors.ts` | Thrown on refusal. `.reason`, `.code` (a `GateRefusalCode`, listed in `GATE_REFUSAL_CODES`), `.incidentId` carry the structured verdict; `.message` carries the `[Intutic Governance] BLOCKED: ...` text. |
52
+ | `IntuticGateHold` | `errors.ts` | The `IntuticGateRefusal` a hold rule throws (`code` `HELD`) after recording the hold for approval; `.holdId` names it. See `hold.ts`. |
51
53
  | `GateClient` | `client.ts` | Control-plane client (`hookGate`, `emit`, `GateClient.fromEnv(...)`). |
52
54
  | `wrapTool(fn \| tool, opts?)`, `wrapTools(list \| record, gate?)` | `wrapTools.ts` | Generic wrapping for a plain async function or an `{ execute, ... }`-shaped tool object. **This is the integration point for any JS framework without a dedicated adapter — LangChain.js included.** |
53
55
  | `intuticHeaders(opts?)` | `headers.ts` | Headers for a proxy-pointed HTTP/OpenAI-compatible client (`x-session-id`, `x-workspace-id`, `x-intutic-harness`). |
54
56
  | `loadSnapshot`, `evaluate`, `Snapshot`, `guardDisabledFromEnv` | `snapshot.ts` | Tier A1: reads `~/.intutic/hooks/policy-snapshot.rules`. |
55
57
  | `parseRules`, `firstMatch`, `fetchRules`, `SopRule` | `soprules.ts` | Tier A3: SOP-authored `WHERE`-clause rules. |
56
58
  | `checkCommand`, `checkImages`, `checkWrittenManifest`, `ImageVerdict` | `imagecheck.ts` | Tier A2: container-image provenance on deploy commands. |
59
+ | `McpRegistryRecord`, `McpAllowlistRecord` | `mcpRegistryRecord.ts` | Tier M: the snapshot's MCP server registry and allowlist (`Snapshot.mcpRegistry`, `Snapshot.mcpAllowlist`), decided as the hook gates and the MCP proxy decide them; a byte-identical copy of `@intutic/shared-types`' module. |
57
60
  | `classify`, `isDeploy`, `isTest`, `touchesInfra` | `actions.ts` | Command classifier shared by A2's deploy trigger. |
61
+ | `canonicalJson`, `holdKey`, `holdMessage` | `hold.ts` | The hold helpers: key-sorted JSON, the tool name and argument hash an approved hold is matched on, and the message a held call carries. |
62
+ | `COMMAND_SIZE_LIMIT`, `ARGUMENTS_SIZE_LIMIT`, `GATE_DEADLINE_MS` | `limits.ts` | A command over 256 KiB or arguments over 1 MiB are refused with `COMMAND_TOO_LARGE` before any tier runs. `GATE_DEADLINE_MS` (9000) is how long the hook script `intuticSandboxBootstrap()` writes may evaluate, from process start, before it refuses with `GATE_DEADLINE`: one second under that hook entry's 10-second timeout, so a slow rule is refused rather than left to the harness. |
63
+
64
+ The snapshot must carry the `#digest <hash>` line the sync daemon writes (the
65
+ first 32 hex characters of the SHA-256 of its non-comment lines) and, when the
66
+ gate is given a workspace id, that workspace's id. A file without the line, or
67
+ one whose digest or workspace does not match, is not trusted: its rules are
68
+ dropped, the SSO group policy still refuses, and every MCP call is refused with
69
+ `POLICY_SNAPSHOT_UNVERIFIED`. A hand-written snapshot for a test needs the line
70
+ too.
71
+
72
+ Full reference: [Gate SDK](https://docs.intutic.ai/reference/gate-sdk).
58
73
 
59
74
  ### A note for sibling adapter phases
60
75
 
@@ -159,10 +174,11 @@ to match. Confirmed against `@ai-sdk/harness@1.0.75` and re-verified on
159
174
  `PreToolUse` hook + `.claude/settings.json` directly into the sandbox
160
175
  filesystem via `HarnessAgentSettings.sandboxConfig.onBootstrap` — the only
161
176
  way to put anything resembling the native Intutic gate inside the
162
- microVM. Claude Code only; a strict subset of a laptop gate (no SOP tier,
163
- review-hold, or event draining — those need a live control-plane
164
- connection a bootstrap function can't have). Spread its output into
165
- `sandboxConfig` alongside `recommendedHarnessSettings()`. See TD-417 and
177
+ microVM. Claude Code only; a strict subset of a laptop gate (no SOP tier
178
+ or event draining, and a hold rule refuses the call outright because no
179
+ approval can be requested — those need a live control-plane connection a
180
+ bootstrap function can't have). Spread its output into
181
+ `sandboxConfig` alongside `recommendedHarnessSettings()`. See
166
182
  `apps/docs/integrations/ai-sdk-harness.md` for what has and hasn't been
167
183
  live-verified.
168
184
 
@@ -206,7 +222,8 @@ arrives — a real, documented pre-execution veto ("Denied tools do not run.").
206
222
  `IntuticSessionConfirmer` answers those pauses with a `Gate.guard()` verdict,
207
223
  via polling, a webhook (`session.requires_action`), or a live stream. A tool
208
224
  configured `always_allow` never pauses and is therefore never seen by
209
- Intutic at all — see TD-425.
225
+ Intutic at all — coverage is opt-in per tool, so configure `always_ask` on
226
+ every tool you want gated.
210
227
 
211
228
  `agent.custom_tool_use` (your own tools) has no pause concept — it is gated
212
229
  at the point YOUR code executes it instead, via
@@ -215,7 +232,7 @@ at the point YOUR code executes it instead, via
215
232
  does not apply here). See `apps/docs/integrations/anthropic-managed-agents.md`
216
233
  for the full operator-facing version, including the self-hosted
217
234
  `EnvironmentWorker` coverage story and the Python-side custom-tool decorator
218
- ordering gotcha (TD-427).
235
+ ordering gotcha.
219
236
 
220
237
  ## Subpath convention
221
238
 
@@ -227,7 +244,7 @@ Eight adapters exist today, one source file each: `@intutic/gate/dsh`
227
244
  `@intutic/gate/eve` (`src/eve.ts` — approval policies for eve's
228
245
  per-tool/per-connection `approval` surface, plus the observe-only
229
246
  `intuticAuditHooks()`; verified against a pinned `eve@0.71.0` install — a
230
- pre-1.0 Preview product, see its module doc and TD-410), `@intutic/gate/harness`
247
+ pre-1.0 Preview product, see its module doc), `@intutic/gate/harness`
231
248
  (`src/harness.ts` — see above), `@intutic/gate/workflow` (`src/workflow.ts`
232
249
  — see above), and `@intutic/gate/managed-agents` (`src/managedAgents.ts` — see
233
250
  above). Later adapter phases follow the SAME convention (also
@@ -247,7 +264,7 @@ above). Later adapter phases follow the SAME convention (also
247
264
  ```
248
265
  4. Each adapter file imports from `./gate.js`, `./errors.js`, etc. (this
249
266
  package's core, already built) rather than re-implementing any tier —
250
- the whole point of splitting core from adapters is that the four-tier
267
+ the whole point of splitting core from adapters is that the tiered
251
268
  evaluation logic lives in exactly one place.
252
269
 
253
270
  No stub files are checked in for future adapters; the `exports` map above
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,eAAO,MAAM,aAAa,YAAY,CAAA;AAEtC,0DAA0D;AAC1D,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAe5C,CAAA;AAED,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAS7C,CAAA;AAED,mCAAmC;AACnC,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAO7C,CAAA;AAED,sCAAsC;AACtC,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAqB1C,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAO/C,CAAA;AAED,yCAAyC;AACzC,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAO9C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAclD,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAO/C,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAUxC,CAAA;AAED,kDAAkD;AAClD,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAAqD,CAAA;AAE7F,kDAAkD;AAClD,eAAO,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AAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAErE"}
package/dist/actions.js CHANGED
@@ -17,6 +17,7 @@
17
17
  * Note the trailing spaces in `'update '`, `'truncate '` and `'curl -d '` —
18
18
  * they are load-bearing and must survive editing.
19
19
  */
20
+ import { hasPhrase, phraseText } from './phrases.js';
20
21
  export const ACTION_PREFIX = 'action:';
21
22
  /** Commands that put code or artefacts somewhere real. */
22
23
  export const DEPLOY_PATTERNS = [
@@ -93,6 +94,8 @@ export const DB_WRITE_PATTERNS = [
93
94
  'update ',
94
95
  'delete from',
95
96
  'drop table',
97
+ 'drop database',
98
+ 'drop schema',
96
99
  'truncate ',
97
100
  'alter table',
98
101
  ];
@@ -134,6 +137,8 @@ export const SHELL_TOOLS = [
134
137
  'runcommand',
135
138
  // Cline / Roo Code's shell tool (kept in step with the Rust SHELL_TOOLS).
136
139
  'execute_command',
140
+ // Gemini CLI's shell tool.
141
+ 'run_shell_command',
137
142
  'terminal',
138
143
  'execute',
139
144
  'exec',
@@ -181,6 +186,13 @@ export function flattenInput(value) {
181
186
  // Numbers, booleans and null/undefined contribute nothing.
182
187
  return '';
183
188
  }
189
+ /**
190
+ * Does `words` contain any of `patterns`, whatever separates each phrase's
191
+ * words? A one-word pattern is a plain substring (see phrases.ts).
192
+ */
193
+ function matchesPhrase(words, patterns) {
194
+ return patterns.some((p) => hasPhrase(words, p));
195
+ }
184
196
  export function matchesAny(haystack, patterns) {
185
197
  return patterns.some((p) => haystack.includes(p));
186
198
  }
@@ -203,16 +215,18 @@ export function toolIs(name, group) {
203
215
  export function classify(toolName, toolInput) {
204
216
  const args = flattenInput(toolInput);
205
217
  const actions = [];
218
+ // Cut into words once, for every phrase list below (see phrases.ts).
219
+ const words = phraseText(args);
206
220
  if (toolIs(toolName, SHELL_TOOLS)) {
207
221
  // Tests first: `make test && git push` is both, and the ordering rule
208
222
  // needs the test to be seen as having happened before the deploy.
209
- if (matchesAny(args, TEST_PATTERNS))
223
+ if (matchesPhrase(words, TEST_PATTERNS))
210
224
  actions.push('run_tests');
211
- if (matchesAny(args, DEPLOY_PATTERNS))
225
+ if (matchesPhrase(words, DEPLOY_PATTERNS))
212
226
  actions.push('deploy');
213
- if (matchesAny(args, PUBLISH_PATTERNS))
227
+ if (matchesPhrase(words, PUBLISH_PATTERNS))
214
228
  actions.push('publish');
215
- if (matchesAny(args, RELEASE_PATTERNS))
229
+ if (matchesPhrase(words, RELEASE_PATTERNS))
216
230
  actions.push('release');
217
231
  // Source before sink, so that (secret_read -> http_post) can still fire
218
232
  // on a single command that does both.
@@ -220,9 +234,9 @@ export function classify(toolName, toolInput) {
220
234
  actions.push('secret_read');
221
235
  if (matchesAny(args, PII_PATH_FRAGMENTS))
222
236
  actions.push('pii_export');
223
- if (matchesAny(args, HTTP_POST_PATTERNS))
237
+ if (matchesPhrase(words, HTTP_POST_PATTERNS))
224
238
  actions.push('http_post');
225
- if (matchesAny(args, DB_WRITE_PATTERNS))
239
+ if (matchesPhrase(words, DB_WRITE_PATTERNS))
226
240
  actions.push('db_write');
227
241
  }
228
242
  return actions.map((a) => ACTION_PREFIX + a);
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAA;AAEtC,0DAA0D;AAC1D,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,UAAU;IACV,eAAe;IACf,iBAAiB;IACjB,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,mBAAmB;IACnB,YAAY;IACZ,eAAe;IACf,mBAAmB;IACnB,YAAY;IACZ,aAAa;IACb,WAAW;CACZ,CAAA;AAED,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IACjD,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,UAAU;IACV,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entId?}
8
+ * POST /api/v1/hook-gate synchronous allow/deny -> {allowed, reason, incidentId?, code?}
9
9
  * POST /api/v1/hook-events batched telemetry -> creates governance_incidents rows
10
+ * POST /api/v1/decisions record a hold -> joins the review queue (hold.ts)
11
+ * GET /api/v1/decisions/approved-bypasses -> approvals that let a held call through
10
12
  *
11
13
  * Two behaviours that must not be "improved":
12
14
  *
@@ -25,6 +27,8 @@ export interface GateResponse {
25
27
  allowed: boolean;
26
28
  reason: string;
27
29
  incidentId?: string | undefined;
30
+ /** The refusal code the hook gate names, when it names one (the MCP registry's). */
31
+ code?: string | undefined;
28
32
  /** False when the call failed and `failClosed` decided the verdict. */
29
33
  reached: boolean;
30
34
  }
@@ -59,6 +63,7 @@ export declare class GateClient {
59
63
  readonly timeoutMs: number;
60
64
  constructor(opts?: GateClientOptions);
61
65
  private post;
66
+ private request;
62
67
  /**
63
68
  * Synchronous allow/deny for one tool call.
64
69
  *
@@ -79,6 +84,19 @@ export declare class GateClient {
79
84
  * description embeds the reason verbatim.
80
85
  */
81
86
  emit(event: string, toolName: string, reason?: string, toolInput?: unknown, incidentId?: string, filePath?: string): Promise<boolean>;
87
+ /**
88
+ * Records one hold in the review queue (`POST /api/v1/decisions`), the way
89
+ * the hook gates' records reach it. Never throws; `false` when the control
90
+ * plane did not accept it, so the refusal can say there is nothing to
91
+ * approve yet.
92
+ */
93
+ recordHold(hold: Record<string, unknown>): Promise<boolean>;
94
+ /**
95
+ * The workspace's approved bypasses (`GET /api/v1/decisions/approved-bypasses`),
96
+ * or `null` when they cannot be read. Never throws: a hold that cannot be
97
+ * checked for an approval stays held.
98
+ */
99
+ approvedBypasses(): Promise<unknown[] | null>;
82
100
  /**
83
101
  * Build a client from the environment, falling back to CLI credentials.
84
102
  *
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAyBH,MAAM,WAAW,YAAY;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AQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC;IAqC3E;;;;;OAKG;IACG,IAAI,CACR,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,MAAM,SAAK,EACX,SAAS,CAAC,EAAE,OAAO,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC;IA4BnB;;;;;OAKG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,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,8 +5,10 @@
5
5
  *
6
6
  * Endpoints used:
7
7
  *
8
- * POST /api/v1/hook-gate synchronous allow/deny -> {allowed, reason, incidentId?}
8
+ * POST /api/v1/hook-gate synchronous allow/deny -> {allowed, reason, incidentId?, code?}
9
9
  * POST /api/v1/hook-events batched telemetry -> creates governance_incidents rows
10
+ * POST /api/v1/decisions record a hold -> joins the review queue (hold.ts)
11
+ * GET /api/v1/decisions/approved-bypasses -> approvals that let a held call through
10
12
  *
11
13
  * Two behaviours that must not be "improved":
12
14
  *
@@ -21,6 +23,7 @@
21
23
  * * `emit` NEVER throws. Telemetry that can break a run is worse than no
22
24
  * telemetry.
23
25
  */
26
+ import { randomBytes } from 'node:crypto';
24
27
  import { readFileSync } from 'node:fs';
25
28
  import { homedir } from 'node:os';
26
29
  import { join } from 'node:path';
@@ -40,6 +43,8 @@ const VALID_EVENTS = new Set([
40
43
  'snapshot_stale',
41
44
  'snapshot_invalid',
42
45
  'snapshot_empty',
46
+ 'tool_held',
47
+ 'hold_approved_bypass_used',
43
48
  ]);
44
49
  /**
45
50
  * Control-plane client for the pre-execution gate.
@@ -67,17 +72,20 @@ export class GateClient {
67
72
  this.timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
68
73
  }
69
74
  async post(path, body, timeoutMs) {
75
+ return this.request('POST', path, body, timeoutMs);
76
+ }
77
+ async request(method, path, body, timeoutMs) {
70
78
  const controller = new AbortController();
71
79
  const timer = setTimeout(() => controller.abort(), timeoutMs);
72
80
  try {
73
81
  const res = await fetch(this.baseUrl + path, {
74
- method: 'POST',
82
+ method,
75
83
  headers: {
76
- 'Content-Type': 'application/json',
84
+ ...(body === undefined ? {} : { 'Content-Type': 'application/json' }),
77
85
  Authorization: `Bearer ${this.apiKey}`,
78
86
  'X-Workspace-Id': this.workspaceId,
79
87
  },
80
- body: JSON.stringify(body),
88
+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),
81
89
  signal: controller.signal,
82
90
  });
83
91
  if (!res.ok)
@@ -114,6 +122,7 @@ export class GateClient {
114
122
  allowed: Boolean(d.allowed ?? true),
115
123
  reason: String(d.reason ?? ''),
116
124
  incidentId: typeof d.incidentId === 'string' ? d.incidentId : undefined,
125
+ code: typeof d.code === 'string' ? d.code : undefined,
117
126
  reached: true,
118
127
  };
119
128
  }
@@ -149,7 +158,13 @@ export class GateClient {
149
158
  workspaceId: this.workspaceId,
150
159
  sessionId: this.sessionId,
151
160
  harnessType: this.harness,
161
+ // No daemon reports an SDK gate, so the control plane expects one from
162
+ // its own events: one that keeps reporting and stops is a silent gate.
163
+ gateSource: 'sdk',
152
164
  timestamp: new Date().toISOString(),
165
+ // The event's id, made once: if this post is ever repeated, the control
166
+ // plane processes the event once.
167
+ eventId: randomBytes(16).toString('hex'),
153
168
  };
154
169
  if (toolInput !== undefined)
155
170
  ev.toolInput = toolInput;
@@ -165,6 +180,35 @@ export class GateClient {
165
180
  return false;
166
181
  }
167
182
  }
183
+ /**
184
+ * Records one hold in the review queue (`POST /api/v1/decisions`), the way
185
+ * the hook gates' records reach it. Never throws; `false` when the control
186
+ * plane did not accept it, so the refusal can say there is nothing to
187
+ * approve yet.
188
+ */
189
+ async recordHold(hold) {
190
+ try {
191
+ const d = await this.post('/api/v1/decisions', { holds: [hold] }, this.timeoutMs);
192
+ return d.accepted === 1;
193
+ }
194
+ catch {
195
+ return false;
196
+ }
197
+ }
198
+ /**
199
+ * The workspace's approved bypasses (`GET /api/v1/decisions/approved-bypasses`),
200
+ * or `null` when they cannot be read. Never throws: a hold that cannot be
201
+ * checked for an approval stays held.
202
+ */
203
+ async approvedBypasses() {
204
+ try {
205
+ const d = await this.request('GET', '/api/v1/decisions/approved-bypasses', undefined, this.timeoutMs);
206
+ return Array.isArray(d.bypasses) ? d.bypasses : null;
207
+ }
208
+ catch {
209
+ return null;
210
+ }
211
+ }
168
212
  /**
169
213
  * Build a client from the environment, falling back to CLI credentials.
170
214
  *
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,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;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ind:'cancel'}` exists); this listener never produces those, but a
43
43
  * later listener's `next()` result may be one, so the type below says so.
44
44
  *
45
- * ## Re-verified against dsh 0.2.0-rc.2 (2026-10-03, TD-370)
45
+ * ## Re-verified against dsh 0.2.0-rc.2 (2026-10-03)
46
46
  *
47
47
  * Read from `@deepseek-ai/dsh-tools@0.2.0-rc.2`'s shipped `lib/index.js`, not
48
48
  * only its types: the registry runs the `tools/pre-execute` waterfall with
package/dist/dsh.js CHANGED
@@ -42,7 +42,7 @@
42
42
  * `{kind:'cancel'}` exists); this listener never produces those, but a
43
43
  * later listener's `next()` result may be one, so the type below says so.
44
44
  *
45
- * ## Re-verified against dsh 0.2.0-rc.2 (2026-10-03, TD-370)
45
+ * ## Re-verified against dsh 0.2.0-rc.2 (2026-10-03)
46
46
  *
47
47
  * Read from `@deepseek-ai/dsh-tools@0.2.0-rc.2`'s shipped `lib/index.js`, not
48
48
  * only its types: the registry runs the `tools/pre-execute` waterfall with
package/dist/errors.d.ts CHANGED
@@ -25,6 +25,14 @@ export declare class GateError extends Error {
25
25
  export declare class GateConnectionError extends GateError {
26
26
  constructor(message: string);
27
27
  }
28
+ /**
29
+ * Every `code` an {@link IntuticGateRefusal} can carry: the tier that refused,
30
+ * or for the image-integrity tier the specific failure. Held to
31
+ * `packages/shared-types/fixtures/refusal-codes.json` (`gate`) by a test, as
32
+ * the Python gate's list and the gate SDK reference are.
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"];
35
+ export type GateRefusalCode = (typeof GATE_REFUSAL_CODES)[number];
28
36
  /**
29
37
  * Raised when a tool call must not run.
30
38
  *
@@ -34,8 +42,23 @@ export declare class GateConnectionError extends GateError {
34
42
  */
35
43
  export declare class IntuticGateRefusal extends GateError {
36
44
  readonly reason: string;
37
- readonly code: string;
45
+ readonly code: GateRefusalCode;
38
46
  readonly incidentId: string | undefined;
39
- constructor(reason: string, code: string, incidentId?: string);
47
+ constructor(reason: string, code: GateRefusalCode, incidentId?: string);
48
+ }
49
+ /**
50
+ * Raised when a hold rule stopped the call to ask a person first (`code`
51
+ * `HELD`). A subclass, so a caller that stops on every refusal stops on this
52
+ * too; one that tells the user about holds catches it first.
53
+ *
54
+ * `holdId` names the hold in the review queue, and is `undefined` when the
55
+ * hold could not be recorded (no control plane to record it in), in which
56
+ * case there is nothing to approve yet. `.message` starts
57
+ * `[Intutic Governance] HELD:`, as the hook gates print a hold, and says who
58
+ * can approve it and when a retry passes. See hold.ts.
59
+ */
60
+ export declare class IntuticGateHold extends IntuticGateRefusal {
61
+ readonly holdId: string | undefined;
62
+ constructor(reason: string, holdId: string | undefined);
40
63
  }
41
64
  //# sourceMappingURL=errors.d.ts.map
@@ -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;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,SAAgB,MAAM,EAAE,MAAM,CAAA;IAC9B,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;gBAElC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAO9D"}
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,qXA0BrB,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
@@ -31,6 +31,39 @@ export class GateConnectionError extends GateError {
31
31
  this.name = 'GateConnectionError';
32
32
  }
33
33
  }
34
+ /**
35
+ * Every `code` an {@link IntuticGateRefusal} can carry: the tier that refused,
36
+ * or for the image-integrity tier the specific failure. Held to
37
+ * `packages/shared-types/fixtures/refusal-codes.json` (`gate`) by a test, as
38
+ * the Python gate's list and the gate SDK reference are.
39
+ */
40
+ export const GATE_REFUSAL_CODES = [
41
+ 'SSO_GROUP',
42
+ 'SNAPSHOT',
43
+ 'HELD',
44
+ // The MCP server registry and allowlist, from the policy snapshot or the
45
+ // control plane's hook gate.
46
+ 'SERVER_BLOCKED',
47
+ 'SERVER_HELD',
48
+ 'SERVER_NOT_APPROVED',
49
+ 'TOOL_DISABLED',
50
+ 'SERVER_NOT_ALLOWED',
51
+ // Any MCP call on a policy snapshot that failed its integrity check.
52
+ 'POLICY_SNAPSHOT_UNVERIFIED',
53
+ 'SOP_RULE',
54
+ 'HOOK_GATE',
55
+ // The call is too large to evaluate (limits.ts), before any tier runs.
56
+ 'COMMAND_TOO_LARGE',
57
+ 'E_UNPINNED_LATEST',
58
+ 'E_UNPINNED_TAG',
59
+ 'E_UNKNOWN_REGISTRY',
60
+ 'E_UNKNOWN_IMAGE',
61
+ 'E_DIGEST_MISMATCH',
62
+ 'E_MANIFEST_UNPARSEABLE',
63
+ // The Workflow DevKit adapter (workflow.ts), before any tier runs.
64
+ 'WORKFLOW_SANDBOX',
65
+ 'NO_GATE',
66
+ ];
34
67
  /**
35
68
  * Raised when a tool call must not run.
36
69
  *
@@ -50,4 +83,24 @@ export class IntuticGateRefusal extends GateError {
50
83
  this.incidentId = incidentId;
51
84
  }
52
85
  }
86
+ /**
87
+ * Raised when a hold rule stopped the call to ask a person first (`code`
88
+ * `HELD`). A subclass, so a caller that stops on every refusal stops on this
89
+ * too; one that tells the user about holds catches it first.
90
+ *
91
+ * `holdId` names the hold in the review queue, and is `undefined` when the
92
+ * hold could not be recorded (no control plane to record it in), in which
93
+ * case there is nothing to approve yet. `.message` starts
94
+ * `[Intutic Governance] HELD:`, as the hook gates print a hold, and says who
95
+ * can approve it and when a retry passes. See hold.ts.
96
+ */
97
+ export class IntuticGateHold extends IntuticGateRefusal {
98
+ holdId;
99
+ constructor(reason, holdId) {
100
+ super(reason, 'HELD');
101
+ this.name = 'IntuticGateHold';
102
+ this.message = `[Intutic Governance] HELD: ${reason}`;
103
+ this.holdId = holdId;
104
+ }
105
+ }
53
106
  //# sourceMappingURL=errors.js.map
@@ -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;;;;;;GAMG;AACH,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/B,MAAM,CAAQ;IACd,IAAI,CAAQ;IACZ,UAAU,CAAoB;IAE9C,YAAY,MAAc,EAAE,IAAY,EAAE,UAAmB;QAC3D,KAAK,CAAC,iCAAiC,MAAM,EAAE,CAAC,CAAA;QAChD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;CACF"}
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,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ts`, `agent/connections/*.ts`,
12
12
  * `agent/hooks/*.ts`, ...) that eve builds by walking the tree. It is a
13
13
  * pre-1.0 PREVIEW product (integrated at 0.39.1, re-verified at 0.71.0; very active) —
14
- * see docs/TECH_DEBT.md TD-410 for the churn shield this adapter carries,
15
- * the same posture the dsh integration established.
14
+ * this adapter carries a churn shield (structural copies of eve's types,
15
+ * re-checked against the real ones on every eve upgrade), the same posture
16
+ * the dsh integration established.
16
17
  *
17
18
  * ## The veto mechanism — CONFIRMED against a real install, not assumed
18
19
  *
@@ -94,7 +95,7 @@
94
95
  * `requestId`/`responderPrincipalId`/`turnId`/`stepIndex` but NOT the tool
95
96
  * name or input.
96
97
  *
97
- * TD-411 half 2, revisited: `intuticApproval()` and `intuticAuditHooks()` are
98
+ * Recovering the tool name: `intuticApproval()` and `intuticAuditHooks()` are
98
99
  * both plain functions exported from this one module and cannot be assumed to
99
100
  * run in the same process at settlement time — eve's own docs state a parked
100
101
  * approval survives a process restart verbatim ("the process can restart and
@@ -124,11 +125,10 @@
124
125
  * name too WHEN this cache is still warm (same-process, or a short-lived
125
126
  * pause). When it is not — a genuinely long-parked, cross-restart approval —
126
127
  * settlement still falls back to the synthetic {@link EVE_APPROVAL_TOOL_NAME},
127
- * exactly the pre-existing behaviour, never worse. See TD-411 for the full
128
- * reasoning and what a persistent (non-memory) correlation store would take
129
- * to close that residual gap.
128
+ * exactly the pre-existing behaviour, never worse. Closing that residual gap
129
+ * would take a persistent (non-memory) correlation store.
130
130
  *
131
- * TD-498: a live `eve start` run showed that `approval.candidate`/
131
+ * A live `eve start` run showed that `approval.candidate`/
132
132
  * `approval.settled` fire ONLY for the `approval: { request, response }`
133
133
  * form. The bare form this adapter documents (`approval: intuticApproval()`)
134
134
  * settles through a fourth hookable event, `input.resolved` (`HookEventMap`,
@@ -147,7 +147,7 @@
147
147
  * `VERCEL_OIDC_TOKEN` credentials — confirmed in `docs/agent-config.md` and
148
148
  * `docs/getting-started.mdx`). The AI Gateway wire protocol is NOT something
149
149
  * the Intutic proxy parses, so gateway-routed egress is ungoverned by the
150
- * proxy — full stop, and TD-412 tracks it. The governable path is eve's
150
+ * proxy — full stop. The governable path is eve's
151
151
  * other documented option: passing a provider-authored `LanguageModel`
152
152
  * (`createOpenAI(...)` etc.) to `defineAgent({ model })`, where the
153
153
  * `withIntuticProxy()` helper — implemented once in `vercel.ts` and
@@ -340,7 +340,7 @@ export interface EveApprovalSettledEvent {
340
340
  * read from the shipped zod schema, not just its `.d.ts`) — narrowed to the
341
341
  * fields this module reads. Unlike {@link EveApprovalCandidateEvent} /
342
342
  * {@link EveApprovalSettledEvent}, this DOES carry the real tool name
343
- * (`action.toolName`) alongside `requestId`, in the same object. See TD-411.
343
+ * (`action.toolName`) alongside `requestId`, in the same object.
344
344
  */
345
345
  export interface EveInputRequest {
346
346
  readonly requestId: string;
@@ -390,7 +390,7 @@ export interface EveInputResolution {
390
390
  * human-input requests. It is how a BARE approval policy
391
391
  * (`approval: intuticApproval(...)`) settles: eve emits `approval.candidate`/
392
392
  * `approval.settled` only for the `{ request, response }` form (observed on
393
- * a live `eve start` server, TD-498). */
393
+ * a live `eve start` server). */
394
394
  export interface EveInputResolvedEvent {
395
395
  readonly type: 'input.resolved';
396
396
  readonly data: {
@@ -451,7 +451,7 @@ export interface IntuticAuditHooksOptions {
451
451
  * - `input.requested`, one `kind: 'tool-approval'` request → `tool_flagged`,
452
452
  * under the REAL tool name (`request.action.toolName`) — a genuinely new
453
453
  * signal this adapter did not emit before: a call is now pending human
454
- * approval. See the module doc (TD-411) for why this event, not a
454
+ * approval. See the module doc for why this event, not a
455
455
  * process-memory map, is what closes "no tool identity" here.
456
456
  * - `approval.settled` `outcome: 'approved'` → `tool_allowed` — a human
457
457
  * explicitly approved the parked call.