@intutic/gate 2.0.0 → 2.2.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 +18 -10
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +2 -0
- package/dist/actions.js.map +1 -1
- package/dist/dsh.d.ts +27 -2
- package/dist/dsh.d.ts.map +1 -1
- package/dist/dsh.js +23 -1
- package/dist/dsh.js.map +1 -1
- package/dist/eve.d.ts +81 -14
- package/dist/eve.d.ts.map +1 -1
- package/dist/eve.js +93 -10
- package/dist/eve.js.map +1 -1
- package/dist/gate.d.ts +3 -4
- package/dist/gate.d.ts.map +1 -1
- package/dist/gate.js +21 -10
- package/dist/gate.js.map +1 -1
- package/dist/harness.d.ts +86 -31
- package/dist/harness.d.ts.map +1 -1
- package/dist/harness.js +103 -28
- package/dist/harness.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/managedAgents.d.ts +35 -6
- package/dist/managedAgents.d.ts.map +1 -1
- package/dist/managedAgents.js +26 -6
- package/dist/managedAgents.js.map +1 -1
- package/dist/mastra.d.ts +5 -2
- package/dist/mastra.d.ts.map +1 -1
- package/dist/mastra.js +3 -1
- package/dist/mastra.js.map +1 -1
- package/dist/openai.d.ts +5 -3
- package/dist/openai.d.ts.map +1 -1
- package/dist/openai.js +5 -3
- package/dist/openai.js.map +1 -1
- package/dist/registry.d.ts +18 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +24 -0
- package/dist/registry.js.map +1 -0
- package/dist/snapshot.d.ts +8 -0
- package/dist/snapshot.d.ts.map +1 -1
- package/dist/snapshot.js +17 -1
- package/dist/snapshot.js.map +1 -1
- package/dist/ssoGroups.d.ts +44 -0
- package/dist/ssoGroups.d.ts.map +1 -0
- package/dist/ssoGroups.js +81 -0
- package/dist/ssoGroups.js.map +1 -0
- package/dist/vercel.d.ts +3 -3
- package/dist/vercel.d.ts.map +1 -1
- package/dist/vercel.js +1 -1
- package/dist/vercel.js.map +1 -1
- package/dist/workflow.d.ts +153 -39
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +162 -49
- package/dist/workflow.js.map +1 -1
- package/dist/wrapTools.d.ts +1 -1
- package/dist/wrapTools.d.ts.map +1 -1
- package/dist/wrapTools.js +1 -1
- package/dist/wrapTools.js.map +1 -1
- package/package.json +11 -10
package/dist/workflow.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@ai-sdk/workflow` adapter: `
|
|
3
|
-
* `wrapWorkflowTools()`, and the FatalError-compatible
|
|
2
|
+
* `@ai-sdk/workflow` adapter: `withIntuticApproval()`, `intuticNeedsApproval()`,
|
|
3
|
+
* `intuticApprovalStep()`, `wrapWorkflowTools()`, and the FatalError-compatible
|
|
4
|
+
* `IntuticWorkflowRefusal`.
|
|
4
5
|
*
|
|
5
6
|
* `@intutic/gate/workflow` — the same idea `vercel.ts` implements for the base
|
|
6
7
|
* `ai` package (wrap the framework's own veto point around this package's
|
|
@@ -9,10 +10,11 @@
|
|
|
9
10
|
*
|
|
10
11
|
* ## 1. The veto surface is per-tool `needsApproval`, not an agent option
|
|
11
12
|
*
|
|
12
|
-
* Confirmed against a real install (`@ai-sdk/workflow@1.0.69
|
|
13
|
-
* `WorkflowAgent`/`WorkflowAgentOptions` carry
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Confirmed against a real install (`@ai-sdk/workflow@1.0.69`, re-read on
|
|
14
|
+
* 2.0.58): `WorkflowAgent`/`WorkflowAgentOptions` carry NO approval-policy
|
|
15
|
+
* field — 1.x's shipped `.d.ts` never mentions `toolApproval`, and 2.x adds
|
|
16
|
+
* only `experimental_toolApprovalSecret`, an HMAC secret that signs approval
|
|
17
|
+
* requests so a replayed approval can be verified, not a veto. The veto surface is `needsApproval` (boolean | function) on the
|
|
16
18
|
* TOOL definition, exactly as the framework's own workflow-agent docs
|
|
17
19
|
* describe under "Tool Approval". The compiled agent loop confirms the
|
|
18
20
|
* semantics (dist/index.js): `needsApproval == null` → no approval; a
|
|
@@ -22,9 +24,9 @@
|
|
|
22
24
|
* later — so this framework, uniquely in this package, has a real
|
|
23
25
|
* human-in-the-loop lane for the gate to route into.
|
|
24
26
|
*
|
|
25
|
-
* (`ai@7.0.
|
|
26
|
-
* generateText-level `toolApproval` — but `@ai-sdk/workflow`'s
|
|
27
|
-
* reads the tool-level field and exposes no other veto surface, so it is the
|
|
27
|
+
* (`ai@7` — still in 7.0.127 — marks tool-level `needsApproval` `@deprecated`
|
|
28
|
+
* in favour of generateText-level `toolApproval` — but `@ai-sdk/workflow`'s
|
|
29
|
+
* OWN agent loop (1.x and 2.0.58 alike) reads the tool-level field and exposes no other veto surface, so it is the
|
|
28
30
|
* correct — indeed the only — integration point here. Noted in the TD entry
|
|
29
31
|
* this phase filed, so a future @ai-sdk/workflow release moving to the
|
|
30
32
|
* generateText-shaped surface gets caught rather than silently ungated.)
|
|
@@ -33,11 +35,13 @@
|
|
|
33
35
|
*
|
|
34
36
|
* A durable workflow retries failed steps. Confirmed against real installs
|
|
35
37
|
* (`workflow@4.8.3` re-exporting `@workflow/errors@4.2.1` via
|
|
36
|
-
* `@workflow/core
|
|
37
|
-
* `FatalError.is(err)`
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
38
|
+
* `@workflow/core`; re-read on `workflow@5.0.1` / `@workflow/errors@5.0.1`):
|
|
39
|
+
* the runtime's retry/abort decision consults `FatalError.is(err)`
|
|
40
|
+
* (`@workflow/core`'s `runtime/step-handler.js` in 4.x,
|
|
41
|
+
* `runtime/step-executor.js` in 5.x — a fatal error "bubbl[es] up to parent
|
|
42
|
+
* workflow"; anything else is retried toward `maxAttempts`), and
|
|
43
|
+
* `FatalError.is()` DUCK-TYPES: it checks `err.name === 'FatalError'` (5.x
|
|
44
|
+
* also accepts `err.fatal === true`) on any Error-shaped object, precisely because
|
|
41
45
|
* workflows execute in a separate `vm` realm where `instanceof` fails across
|
|
42
46
|
* the boundary. A plain `IntuticGateRefusal` thrown from `needsApproval` or a
|
|
43
47
|
* tool body would therefore be RETRIED — a governance denial replayed on a
|
|
@@ -56,10 +60,45 @@
|
|
|
56
60
|
* "no gate configured" case, which is deterministic and would fail every
|
|
57
61
|
* retry identically) is made fatal.
|
|
58
62
|
*
|
|
63
|
+
* ## 3. `needsApproval` runs in the workflow VM — the gate must run in a step
|
|
64
|
+
*
|
|
65
|
+
* Observed in a live run on the Workflow DevKit's local world (TD-498):
|
|
66
|
+
* `WorkflowAgent`'s loop runs inside the `"use workflow"` function, so it
|
|
67
|
+
* calls `needsApproval` in the workflow VM, which has no Node.js modules.
|
|
68
|
+
* `Gate` reads its policy snapshot with `node:fs`, so evaluating it there
|
|
69
|
+
* fails with `require is not defined` — and when the workflow bundle pulls
|
|
70
|
+
* `node:fs` in at module level, EVERY workflow sharing that bundle fails at
|
|
71
|
+
* load (observed with `workflow/nitro`).
|
|
72
|
+
*
|
|
73
|
+
* So the gate runs in a STEP, which has full Node.js and is durable. The
|
|
74
|
+
* caller declares one `"use step"` function in their own module — the
|
|
75
|
+
* directive must sit in a module the workflow bundler transforms, and the
|
|
76
|
+
* step's body must build/receive the `Gate` itself, because step arguments
|
|
77
|
+
* are serialized and a `Gate` instance is not serializable — whose body is
|
|
78
|
+
* {@link intuticApprovalStep}, and passes it as `{ step }`:
|
|
79
|
+
*
|
|
80
|
+
* ```ts
|
|
81
|
+
* export async function intuticGate(toolName: string, input: unknown) {
|
|
82
|
+
* 'use step'
|
|
83
|
+
* return intuticApprovalStep(toolName, input, { gate: new Gate({ ... }) })
|
|
84
|
+
* }
|
|
85
|
+
* // in the workflow: tools: withIntuticApproval(tools, { step: intuticGate })
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* With `{ step }`, the `needsApproval` this module builds only calls the step
|
|
89
|
+
* (a durable step invocation from the VM's point of view) and maps its
|
|
90
|
+
* boolean; nothing Node-only runs in the VM. This module itself is safe to
|
|
91
|
+
* import into workflow code: it imports nothing that touches Node.js
|
|
92
|
+
* (`errors.ts`, `registry.ts`, `wrapTools.ts`; `Gate` is a type-only
|
|
93
|
+
* import). Without `{ step }`, the gate is evaluated in-process, which still
|
|
94
|
+
* works wherever Node.js is available (inside a step, or any plain `ai`
|
|
95
|
+
* loop); called in the workflow VM it throws an {@link IntuticWorkflowRefusal}
|
|
96
|
+
* naming this fix instead of failing with `require is not defined`.
|
|
97
|
+
*
|
|
59
98
|
* @module
|
|
60
99
|
*/
|
|
61
|
-
import { active as activeGate } from './gate.js';
|
|
62
100
|
import { IntuticGateRefusal } from './errors.js';
|
|
101
|
+
import { active as activeGate } from './registry.js';
|
|
63
102
|
import { wrapTools } from './wrapTools.js';
|
|
64
103
|
/**
|
|
65
104
|
* A refused call inside a durable workflow.
|
|
@@ -97,6 +136,25 @@ export class IntuticWorkflowRefusal extends IntuticGateRefusal {
|
|
|
97
136
|
(value.message.startsWith('[Intutic Governance] BLOCKED:')));
|
|
98
137
|
}
|
|
99
138
|
}
|
|
139
|
+
// Set on the workflow VM's global object by the Workflow DevKit runtime
|
|
140
|
+
// (`@workflow/core`'s `workflow.js`: `vmGlobalThis[WORKFLOW_USE_STEP] =
|
|
141
|
+
// useStep`); never set in the Node.js realm where steps execute.
|
|
142
|
+
const WORKFLOW_USE_STEP = Symbol.for('WORKFLOW_USE_STEP');
|
|
143
|
+
function inWorkflowSandbox() {
|
|
144
|
+
return typeof globalThis[WORKFLOW_USE_STEP] === 'function';
|
|
145
|
+
}
|
|
146
|
+
function refuseInWorkflowSandbox(helper) {
|
|
147
|
+
if (!inWorkflowSandbox())
|
|
148
|
+
return;
|
|
149
|
+
// Fail closed, FatalError-shaped, and NAME THE FIX: the gate needs
|
|
150
|
+
// Node.js, which the workflow VM does not have, and retrying cannot
|
|
151
|
+
// change that.
|
|
152
|
+
throw new IntuticWorkflowRefusal(`${helper} ran inside the workflow sandbox, which has no Node.js, so the gate cannot evaluate ` +
|
|
153
|
+
'the call there. Run it in a "use step" function: declare ' +
|
|
154
|
+
"`async function intuticGate(toolName, input) { 'use step'; return intuticApprovalStep(toolName, input, { gate }) }` " +
|
|
155
|
+
'and pass { step: intuticGate } to withIntuticApproval()/intuticNeedsApproval(). ' +
|
|
156
|
+
'Refusing to run the tool unguarded.', 'WORKFLOW_SANDBOX');
|
|
157
|
+
}
|
|
100
158
|
function requireGate(gate, helper) {
|
|
101
159
|
const g = gate ?? activeGate();
|
|
102
160
|
if (g === null) {
|
|
@@ -116,26 +174,60 @@ function renderWorkflowToolInput(input) {
|
|
|
116
174
|
return { args: [input] };
|
|
117
175
|
}
|
|
118
176
|
/**
|
|
119
|
-
*
|
|
177
|
+
* The gate evaluation for ONE call, written to be the body of the caller's
|
|
178
|
+
* `"use step"` function (see module doc, section 3):
|
|
120
179
|
*
|
|
121
180
|
* ```ts
|
|
122
|
-
*
|
|
123
|
-
* import { Gate
|
|
124
|
-
* import {
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* }
|
|
181
|
+
* // workflows/intutic-gate.ts
|
|
182
|
+
* import { Gate } from '@intutic/gate'
|
|
183
|
+
* import { intuticApprovalStep } from '@intutic/gate/workflow'
|
|
184
|
+
*
|
|
185
|
+
* export async function intuticGate(toolName: string, input: unknown): Promise<boolean> {
|
|
186
|
+
* 'use step'
|
|
187
|
+
* return intuticApprovalStep(toolName, input, {
|
|
188
|
+
* gate: new Gate({ workspaceId: process.env.INTUTIC_WORKSPACE_ID }),
|
|
189
|
+
* })
|
|
190
|
+
* }
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* Reference `@intutic/gate` only inside step bodies in that module: the
|
|
194
|
+
* workflow bundler also bundles it into the VM with the step bodies
|
|
195
|
+
* replaced, and a module-level use would keep the Node-only gate there.
|
|
196
|
+
*
|
|
197
|
+
* Verdict mapping: BLOCK → throws {@link IntuticWorkflowRefusal} (fatal — the
|
|
198
|
+
* step runs once and the run fails instead of retry-looping; see module doc);
|
|
199
|
+
* ALLOW → `false`, or `true` with `onAllow: 'human'`. A non-refusal crash in
|
|
200
|
+
* the gate is re-thrown untouched (the step retries — correct for
|
|
201
|
+
* transients). Requires a gate (`{ gate }` or `install()` in the process
|
|
202
|
+
* that runs steps); called in the workflow VM itself, it throws naming the
|
|
203
|
+
* fix.
|
|
204
|
+
*/
|
|
205
|
+
export async function intuticApprovalStep(toolName, input, opts = {}) {
|
|
206
|
+
refuseInWorkflowSandbox('intuticApprovalStep()');
|
|
207
|
+
const g = requireGate(opts.gate, 'intuticApprovalStep()');
|
|
208
|
+
try {
|
|
209
|
+
await g.guard(toolName, renderWorkflowToolInput(input));
|
|
210
|
+
}
|
|
211
|
+
catch (exc) {
|
|
212
|
+
if (exc instanceof IntuticGateRefusal && !(exc instanceof IntuticWorkflowRefusal)) {
|
|
213
|
+
throw IntuticWorkflowRefusal.from(exc);
|
|
214
|
+
}
|
|
215
|
+
throw exc;
|
|
216
|
+
}
|
|
217
|
+
return opts.onAllow === 'human';
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Build an async `needsApproval` function for ONE workflow tool. On a
|
|
221
|
+
* `WorkflowAgent`, pass the caller's gate step (see
|
|
222
|
+
* {@link intuticApprovalStep}):
|
|
223
|
+
*
|
|
224
|
+
* ```ts
|
|
225
|
+
* deployService: {
|
|
226
|
+
* description: '...',
|
|
227
|
+
* inputSchema,
|
|
228
|
+
* execute: deployStep,
|
|
229
|
+
* needsApproval: intuticNeedsApproval('deployService', { step: intuticGate }),
|
|
230
|
+
* },
|
|
139
231
|
* ```
|
|
140
232
|
*
|
|
141
233
|
* The tool name is a parameter because the framework's `needsApproval`
|
|
@@ -144,25 +236,28 @@ function renderWorkflowToolInput(input) {
|
|
|
144
236
|
* {@link withIntuticApproval} to attach this to a whole tools record without
|
|
145
237
|
* hand-repeating each name.
|
|
146
238
|
*
|
|
239
|
+
* With `{ step }`, the returned function only calls the step and maps its
|
|
240
|
+
* answer — safe in the workflow VM. Without it, the gate is evaluated
|
|
241
|
+
* in-process (`{ gate }` or the installed gate), which needs Node.js: fine in
|
|
242
|
+
* a plain `ai` loop or inside a step, and in the workflow VM it throws an
|
|
243
|
+
* {@link IntuticWorkflowRefusal} naming the `{ step }` fix.
|
|
244
|
+
*
|
|
147
245
|
* Verdict mapping: BLOCK → throws {@link IntuticWorkflowRefusal} (fatal —
|
|
148
246
|
* aborts instead of retry-looping; see module doc); ALLOW → `false` or `true`
|
|
149
247
|
* per `onAllow`. A non-refusal crash in the gate is re-thrown untouched
|
|
150
248
|
* (retryable — correct for transients).
|
|
151
249
|
*/
|
|
152
250
|
export function intuticNeedsApproval(toolName, opts = {}) {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
throw exc;
|
|
164
|
-
}
|
|
165
|
-
return onAllow === 'human';
|
|
251
|
+
const human = (opts.onAllow ?? 'auto') === 'human';
|
|
252
|
+
const step = opts.step;
|
|
253
|
+
if (step !== undefined) {
|
|
254
|
+
// A refusal thrown by the step reaches here already FatalError-shaped
|
|
255
|
+
// (it crossed the step boundary as one) and is rethrown untouched.
|
|
256
|
+
return async (input) => (await step(toolName, input)) || human;
|
|
257
|
+
}
|
|
258
|
+
return async (input) => {
|
|
259
|
+
refuseInWorkflowSandbox('intuticNeedsApproval()');
|
|
260
|
+
return intuticApprovalStep(toolName, input, { gate: opts.gate, onAllow: opts.onAllow });
|
|
166
261
|
};
|
|
167
262
|
}
|
|
168
263
|
/**
|
|
@@ -170,13 +265,29 @@ export function intuticNeedsApproval(toolName, opts = {}) {
|
|
|
170
265
|
* `needsApproval` the tool already declares:
|
|
171
266
|
*
|
|
172
267
|
* ```ts
|
|
173
|
-
*
|
|
268
|
+
* import { WorkflowAgent } from '@ai-sdk/workflow'
|
|
269
|
+
* import { withIntuticApproval } from '@intutic/gate/workflow'
|
|
270
|
+
* import { intuticGate } from './intutic-gate' // the "use step" function
|
|
271
|
+
*
|
|
272
|
+
* export async function deployAgent(messages: ModelMessage[]) {
|
|
273
|
+
* 'use workflow'
|
|
274
|
+
* const agent = new WorkflowAgent({
|
|
275
|
+
* model,
|
|
276
|
+
* tools: withIntuticApproval(tools, { step: intuticGate }),
|
|
277
|
+
* })
|
|
278
|
+
* // ...
|
|
279
|
+
* }
|
|
174
280
|
* ```
|
|
175
281
|
*
|
|
282
|
+
* (`{ step }` is what makes this work on a `WorkflowAgent`, whose
|
|
283
|
+
* `needsApproval` runs in the workflow VM — see {@link intuticApprovalStep}
|
|
284
|
+
* and the module doc, section 3. Without it the gate is evaluated
|
|
285
|
+
* in-process, which needs Node.js.)
|
|
286
|
+
*
|
|
176
287
|
* For each tool (the record KEY is the tool name reported to the gate — the
|
|
177
288
|
* same identity the framework itself dispatches on):
|
|
178
289
|
*
|
|
179
|
-
* 1.
|
|
290
|
+
* 1. The gate runs first. BLOCK throws {@link IntuticWorkflowRefusal}.
|
|
180
291
|
* 2. On allow, the tool's OWN prior `needsApproval` still applies: a
|
|
181
292
|
* boolean is returned as-is; a function is awaited with the original
|
|
182
293
|
* arguments; a tool with none falls back to `onAllow` ('auto' → false).
|
|
@@ -217,7 +328,9 @@ export function withIntuticApproval(tools, opts = {}) {
|
|
|
217
328
|
* "no gate configured" handling and the record-key-is-tool-name convention —
|
|
218
329
|
* is `wrapTools`'s own behaviour, reused rather than reimplemented.
|
|
219
330
|
*
|
|
220
|
-
*
|
|
331
|
+
* Call it inside the tool's `"use step"` body (it evaluates the gate
|
|
332
|
+
* in-process, so it needs Node.js). Prefer {@link withIntuticApproval} as the
|
|
333
|
+
* primary integration: it uses the
|
|
221
334
|
* framework's own pre-execution veto surface, refuses BEFORE the durable
|
|
222
335
|
* step ever starts, and keeps the human-approval lane available. This
|
|
223
336
|
* execute-level wrapper is defense in depth (or the option for callers whose
|
package/dist/workflow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AAMH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,SAAS,EAAmC,MAAM,gBAAgB,CAAA;AAE3E;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAC5C,KAAK,GAAG,IAAa,CAAA;IACrC,YAAY,MAAc,EAAE,IAAY,EAAE,UAAmB;QAC3D,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAA;QAC/B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAA;IAC1B,CAAC;IAED,uEAAuE;IACvE,MAAM,CAAC,IAAI,CAAC,OAA2B;QACrC,OAAO,IAAI,sBAAsB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;IACrF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,KAAc;QACtB,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;YACzB,KAAK,KAAK,IAAI;YACb,KAA4B,CAAC,IAAI,KAAK,YAAY;YACnD,OAAQ,KAA+B,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AAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;YAC/B,GAAG,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAM,CAAA;QACjC,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAI,IAAuB,EAAE,OAAO,EAAE,QAAQ,CAAE,IAAuB,CAAC,OAAO,CAAC,EAAO,CAAA;QACvG,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,QAAQ,CAAC,EAAS;IACzB,8DAA8D;IAC9D,OAAO,KAAK,EAAE,GAAG,IAAW,EAAE,EAAE;QAC9B,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;QAC1B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,kBAAkB,IAAI,CAAC,CAAC,GAAG,YAAY,sBAAsB,CAAC,EAAE,CAAC;gBAClF,MAAM,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACxC,CAAC;YACD,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
package/dist/wrapTools.d.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* wrapped tool with neither throws, refusing to run the tool unguarded
|
|
29
29
|
* rather than silently skipping enforcement.
|
|
30
30
|
*/
|
|
31
|
-
import {
|
|
31
|
+
import type { Gate } from './gate.js';
|
|
32
32
|
export type AnyFn = (...args: any[]) => any;
|
|
33
33
|
export interface ExecutableTool {
|
|
34
34
|
execute: AnyFn;
|
package/dist/wrapTools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapTools.d.ts","sourceRoot":"","sources":["../src/wrap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AAA"}
|
package/dist/wrapTools.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* wrapped tool with neither throws, refusing to run the tool unguarded
|
|
29
29
|
* rather than silently skipping enforcement.
|
|
30
30
|
*/
|
|
31
|
-
import { active as activeGate } from './
|
|
31
|
+
import { active as activeGate } from './registry.js';
|
|
32
32
|
const GUARDED = Symbol.for('intutic.gate.guarded');
|
|
33
33
|
function isGuarded(fn) {
|
|
34
34
|
return fn[GUARDED] === true;
|
package/dist/wrapTools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapTools.js","sourceRoot":"","sources":["../src/wrapTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;
|
|
1
|
+
{"version":3,"file":"wrapTools.js","sourceRoot":"","sources":["../src/wrapTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,eAAe,CAAA;AAmBpD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;AAElD,SAAS,SAAS,CAAC,EAAS;IAC1B,OAAQ,EAAyC,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;AACrE,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,eAAe,CAAC,IAAe;IACtC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IACpB,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzE,OAAO,KAAgC,CAAA;IACzC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,CAAA;AACjB,CAAC;AAED,SAAS,MAAM,CAAC,EAAS,EAAE,QAAgB,EAAE,IAAsB;IACjE,IAAI,SAAS,CAAC,EAAE,CAAC;QAA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,EAAE,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;IAC5E,CAAC;IACD,MAAM,IAAI,SAAS,CACjB,sFAAsF;QACpF,GAAG,OAAO,QAAQ,EAAE,CACvB,CAAA;AACH,CAAC;AAgBD,MAAM,UAAU,SAAS,CACvB,KAAuC,EACvC,IAAW;IAEX,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,8DAA8D;QAC9D,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAQ,CAAA;IAC9D,CAAC;IACD,MAAM,GAAG,GAAsB,EAAE,CAAA;IACjC,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7C,8DAA8D;QAC9D,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAA;IACpD,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intutic/gate",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Intutic pre-execution tool gate for JS/TS agent frameworks without a shipped Intutic harness (Mastra, the Vercel AI SDK, LangChain.js, dsh, and hand-rolled agent loops)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -95,20 +95,21 @@
|
|
|
95
95
|
"yaml": "^2.9.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@ai-sdk/harness": "^1.0.
|
|
99
|
-
"@anthropic-ai/sdk": "^0.
|
|
100
|
-
"@ai-sdk/openai": "^4.0.
|
|
101
|
-
"@ai-sdk/workflow": "^
|
|
102
|
-
"@mastra/core": "^1.
|
|
98
|
+
"@ai-sdk/harness": "^1.0.138",
|
|
99
|
+
"@anthropic-ai/sdk": "^0.131.0",
|
|
100
|
+
"@ai-sdk/openai": "^4.0.83",
|
|
101
|
+
"@ai-sdk/workflow": "^2.0.58",
|
|
102
|
+
"@mastra/core": "^1.74.0",
|
|
103
103
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
104
104
|
"@openai/agents": "0.16.1",
|
|
105
|
+
"@openai/agents-realtime": "0.16.1",
|
|
105
106
|
"@truefoundry/trueforge-core": "^0.1.4",
|
|
106
107
|
"@types/node": "^22",
|
|
107
|
-
"ai": "^7.0.
|
|
108
|
-
"eve": "^0.
|
|
108
|
+
"ai": "^7.0.127",
|
|
109
|
+
"eve": "^0.71.0",
|
|
109
110
|
"typescript": "^5.5",
|
|
110
111
|
"vitest": "^4",
|
|
111
|
-
"workflow": "^
|
|
112
|
+
"workflow": "^5.0.1",
|
|
112
113
|
"zod": "^4.2.0"
|
|
113
114
|
},
|
|
114
115
|
"engines": {
|
|
@@ -117,7 +118,7 @@
|
|
|
117
118
|
"scripts": {
|
|
118
119
|
"lint": "eslint src",
|
|
119
120
|
"build": "tsc",
|
|
120
|
-
"typecheck": "tsc --noEmit",
|
|
121
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
121
122
|
"test": "vitest run --passWithNoTests"
|
|
122
123
|
}
|
|
123
124
|
}
|