avantgate 1.3.0 → 1.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 +8 -3
- package/dist/agent/index.mjs +12 -279
- package/dist/agent/types.d.ts +5 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/chunk-4XWO3NZW.mjs +303 -0
- package/dist/chunk-5VA3EKPJ.mjs +344 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +531 -0
- package/dist/index.mjs +17 -3
- package/dist/workflow/define-workflow.d.ts +3 -0
- package/dist/workflow/define-workflow.d.ts.map +1 -0
- package/dist/workflow/engine.d.ts +3 -0
- package/dist/workflow/engine.d.ts.map +1 -0
- package/dist/workflow/errors.d.ts +31 -0
- package/dist/workflow/errors.d.ts.map +1 -0
- package/dist/workflow/index.d.ts +5 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +611 -0
- package/dist/workflow/index.mjs +17 -0
- package/dist/workflow/types.d.ts +67 -0
- package/dist/workflow/types.d.ts.map +1 -0
- package/package.json +9 -3
- package/dist/chunk-DVCF4CSV.mjs +0 -56
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# 🛡️ AvantGate (`avantgate`)
|
|
2
2
|
|
|
3
|
-
> **The Zero-Infrastructure, In-Process AI Application Firewall (AI-WAF) & Privacy Guard for TypeScript.**
|
|
4
|
-
> Real-time prompt guardrails, zero-egress PII redaction, anti-IDOR tool boundary, and pre-flight token defense **without hosting Docker, proxies, PostgreSQL, ClickHouse, or Redis.**
|
|
3
|
+
> **The Zero-Infrastructure, In-Process AI Application Firewall (AI-WAF), Deterministic Workflow Engine & Privacy Guard for TypeScript.**
|
|
4
|
+
> Real-time prompt guardrails, zero-egress PII redaction, deterministic Saga workflows, anti-IDOR tool boundary, and pre-flight token defense **without hosting Docker, proxies, PostgreSQL, ClickHouse, or Redis.**
|
|
5
5
|
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
@@ -47,6 +47,7 @@ Available as a **Managed Cloud Control Plane** or an **Out-of-Process High-Avail
|
|
|
47
47
|
|
|
48
48
|
- 🛡️ **Active Threat Defense & Prompt Guardrails**: Blocks prompt injections, DAN jailbreaks, adversarial noise, and system prompt exfiltration *before* external API invocation.
|
|
49
49
|
- 🔒 **Zero-Egress Data Loss Prevention (DLP)**: Automated local redaction of emails, phone numbers, IBAN/BIC, and French/EU identifiers (NIR SSN, SPI tax ID) before network egress.
|
|
50
|
+
- ⚡ **Deterministic Workflow Engine (`avantgate/workflow`)**: In-process sequential state machine for multi-step agent orchestrations. Features automatic reverse compensation (Saga Pattern), non-blocking Human-in-the-Loop checkpoints, and safe-by-default AI tool conversion (`asTool()`).
|
|
50
51
|
- 🎭 **Dual-Channel Tool Isolation (`avantgate/agent`)**: Decouples sensitive database records (streamed out-of-band directly to client UIs) from minimal cognitive LLM context (`llmDto`), keeping confidential fields out of context windows.
|
|
51
52
|
- 🛑 **Anti-IDOR & Access Governance**: Enforces Row-Level Security (`dataAccessGuard`), business domain partitioning, and granular role-based permissions at the agent tool boundary.
|
|
52
53
|
- 💰 **Denial-of-Wallet & Pre-Flight Budgeting**: Enforces strict token and cent-level USD budget limits, rejecting abusive requests before paying for upstream inference.
|
|
@@ -91,6 +92,7 @@ yarn add avantgate zod
|
|
|
91
92
|
| `avantgate` | Core control plane: token budgets, cost ledger, prompt guards, multi-model failover & Zod repair. |
|
|
92
93
|
| `avantgate/finance` | Financial data normalizer (accounting parentheses, EU/US/UK/CH currencies & magnitudes). |
|
|
93
94
|
| `avantgate/agent` | *(Preview / Experimental)* Durable step runner, Human-in-the-Loop, dual-channel PII tool isolation & storage adapters. |
|
|
95
|
+
| `avantgate/workflow` | Deterministic sequential state machine, automatic reverse Saga rollback, durable HITL checkpoints & agent tool conversion. |
|
|
94
96
|
|
|
95
97
|
---
|
|
96
98
|
|
|
@@ -100,6 +102,7 @@ Comprehensive guides, copy-pasteable integration recipes, and architectural refe
|
|
|
100
102
|
|
|
101
103
|
| Guide | Description |
|
|
102
104
|
|---|---|
|
|
105
|
+
| **[Deterministic Workflow Engine](docs/workflow.md)** | Zero-infra Saga orchestrator, linear FSM rationale, reverse compensation, HITL checkpoints & agent tool conversion. |
|
|
103
106
|
| **[Code Examples & Recipes](docs/examples.md)** | End-to-end security guardrails, PII redaction, anti-IDOR tool boundaries, cost tracking, Zod self-repair, and multi-model failover. |
|
|
104
107
|
| **[Decoupled Pricing & DB Adapters](docs/pricing.md)** | Dynamic token pricing, database integration (Prisma / PostgreSQL / Drizzle), in-memory TTL caching, and runtime overrides. |
|
|
105
108
|
| **[Durable Agent Harness & Tool Isolation](docs/agent.md)** | Serverless durable step execution, Human-in-the-Loop suspension, dual-channel DTO tool isolation, and telemetry streaming. |
|
|
@@ -148,6 +151,7 @@ AvantGate is built around clean **Ports and Adapters**:
|
|
|
148
151
|
|
|
149
152
|
### 📦 Modular Ecosystem & Extensions
|
|
150
153
|
|
|
154
|
+
- **`avantgate/workflow`**: Deterministic sequential state machine, automatic reverse Saga rollback ($k-1 \to 0$), and durable HITL checkpoints.
|
|
151
155
|
- **`avantgate/agent`**: Zero-infra durable step orchestration, human-in-the-loop pauses, and dual-channel PII tool isolation.
|
|
152
156
|
- **`avantgate/finance`**: Zero-overhead financial accounting normalizer across international jurisdictions (FR PCG, US GAAP, UK IFRS, Swiss CO).
|
|
153
157
|
- **Launch Readiness Linter**: Standalone developer tool to audit codebases before launch for exposed keys, unbudgeted endpoints, and missing guards.
|
|
@@ -183,7 +187,8 @@ AvantGate builds upon foundational ideas and inspirations from the open source A
|
|
|
183
187
|
- **[Helicone](https://github.com/Helicone/helicone)** — Pioneering LLM request caching, granular cost estimation, and developer-first proxy design that inspired our FinOps engine and semantic tool caching patterns.
|
|
184
188
|
- **[AgentOps](https://github.com/AgentOps-AI/agentops)** — State-of-the-art agent tracking, session replay visualization, and recursive loop detection that inspired our Session Replay and Infinite Loop Shield.
|
|
185
189
|
|
|
186
|
-
### 🤖 Durable Workflows & Agent Architecture (`avantgate/agent`)
|
|
190
|
+
### 🤖 Durable Workflows & Agent Architecture (`avantgate/agent` & `avantgate/workflow`)
|
|
191
|
+
- **Deterministic FSM & Saga Pattern** — Architectural rejection of fragile cyclic graphs in favor of strictly ordered, hallucination-resistant linear state machines with mathematically guaranteed reverse rollback ($k-1 \to 0$).
|
|
187
192
|
- **[Inngest](https://www.inngest.com)** & **[Temporal](https://temporal.io)** — The developer experience of durable step memoization (`step.run()`) and human validation pauses (`step.waitForApproval()`), reimagined here as a **$0-infrastructure, serverless in-process harness** without requiring external worker queues or Redis clusters.
|
|
188
193
|
- **[Vercel AI SDK (`ai`)](https://sdk.vercel.ai)** — Standardized TypeScript tool schema contracts (`parameters`, `execute`) natively embraced and augmented by `createIsolatedTool`.
|
|
189
194
|
- **Least-Privilege & Dual-Channel Isolation** — Security patterns separating sensitive payload data (streamed out-of-band directly to trusted user interfaces) from LLM prompts (receiving sanitized summaries), preventing context pollution and PII leakage.
|
package/dist/agent/index.mjs
CHANGED
|
@@ -1,283 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.workflowId = workflowId;
|
|
15
|
-
this.metadata = metadata;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
var PiiLeakError = class extends Error {
|
|
19
|
-
toolName;
|
|
20
|
-
maskedCount;
|
|
21
|
-
constructor(toolName, maskedCount) {
|
|
22
|
-
super(`PII leak detected in tool output for "${toolName}" (${maskedCount} occurrences detected).`);
|
|
23
|
-
this.name = "PiiLeakError";
|
|
24
|
-
this.toolName = toolName;
|
|
25
|
-
this.maskedCount = maskedCount;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var StepExecutionError = class extends Error {
|
|
29
|
-
stepId;
|
|
30
|
-
workflowId;
|
|
31
|
-
originalError;
|
|
32
|
-
constructor(stepId, workflowId, message, originalError) {
|
|
33
|
-
super(`Execution failed at step [${workflowId}::${stepId}]: ${message}`);
|
|
34
|
-
this.name = "StepExecutionError";
|
|
35
|
-
this.stepId = stepId;
|
|
36
|
-
this.workflowId = workflowId;
|
|
37
|
-
this.originalError = originalError;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var ToolAccessDeniedError = class extends Error {
|
|
41
|
-
toolName;
|
|
42
|
-
requiredRole;
|
|
43
|
-
reason;
|
|
44
|
-
constructor(toolName, reasonOrRole) {
|
|
45
|
-
const isRole = Boolean(reasonOrRole && !reasonOrRole.includes(" "));
|
|
46
|
-
const roleMsg = isRole ? ` (requires role "${reasonOrRole}")` : "";
|
|
47
|
-
const reasonMsg = reasonOrRole && !isRole ? `: ${reasonOrRole}` : "";
|
|
48
|
-
super(`Access denied for tool "${toolName}"${roleMsg}${reasonMsg}.`);
|
|
49
|
-
this.name = "ToolAccessDeniedError";
|
|
50
|
-
this.toolName = toolName;
|
|
51
|
-
if (isRole) {
|
|
52
|
-
this.requiredRole = reasonOrRole;
|
|
53
|
-
} else {
|
|
54
|
-
this.reason = reasonOrRole;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
var CircularToolCallError = class extends Error {
|
|
59
|
-
cycle;
|
|
60
|
-
constructor(cycle) {
|
|
61
|
-
super(`Circular tool call detected: ${cycle.join(" -> ")}`);
|
|
62
|
-
this.name = "CircularToolCallError";
|
|
63
|
-
this.cycle = cycle;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
var ToolCallDepthExceededError = class extends Error {
|
|
67
|
-
depth;
|
|
68
|
-
maxDepth;
|
|
69
|
-
constructor(depth, maxDepth) {
|
|
70
|
-
super(`Tool call depth limit exceeded: depth ${depth} exceeds max allowed depth of ${maxDepth}.`);
|
|
71
|
-
this.name = "ToolCallDepthExceededError";
|
|
72
|
-
this.depth = depth;
|
|
73
|
-
this.maxDepth = maxDepth;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
var ToolSubCallQuotaError = class extends Error {
|
|
77
|
-
totalCalls;
|
|
78
|
-
maxCalls;
|
|
79
|
-
constructor(totalCalls, maxCalls) {
|
|
80
|
-
super(`Tool sub-call quota exceeded: ${totalCalls} calls exceeds session quota of ${maxCalls}.`);
|
|
81
|
-
this.name = "ToolSubCallQuotaError";
|
|
82
|
-
this.totalCalls = totalCalls;
|
|
83
|
-
this.maxCalls = maxCalls;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
var ToolNotFoundError = class extends Error {
|
|
87
|
-
toolId;
|
|
88
|
-
constructor(toolId) {
|
|
89
|
-
super(`Tool not found in registry: "${toolId}".`);
|
|
90
|
-
this.name = "ToolNotFoundError";
|
|
91
|
-
this.toolId = toolId;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
var DtoValidationError = class extends Error {
|
|
95
|
-
toolName;
|
|
96
|
-
issues;
|
|
97
|
-
constructor(toolName, message, issues = []) {
|
|
98
|
-
super(`LLM DTO validation failed for tool "${toolName}": ${message}`);
|
|
99
|
-
this.name = "DtoValidationError";
|
|
100
|
-
this.toolName = toolName;
|
|
101
|
-
this.issues = issues;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// src/agent/guardrails.ts
|
|
106
|
-
function sanitizeString(value) {
|
|
107
|
-
const result = sanitizePII(value);
|
|
108
|
-
return { text: result.text, count: result.maskedCount };
|
|
109
|
-
}
|
|
110
|
-
function sanitizeArray(items, options, visited) {
|
|
111
|
-
let totalCount = 0;
|
|
112
|
-
const sanitized = items.map((item) => {
|
|
113
|
-
const res = recursivelySanitize(item, options, visited);
|
|
114
|
-
totalCount += res.count;
|
|
115
|
-
return res.sanitized;
|
|
116
|
-
});
|
|
117
|
-
return { sanitized, count: totalCount };
|
|
118
|
-
}
|
|
119
|
-
function sanitizeObject(target, options, visited) {
|
|
120
|
-
let totalCount = 0;
|
|
121
|
-
const copy = {};
|
|
122
|
-
for (const [key, val] of Object.entries(target)) {
|
|
123
|
-
const res = recursivelySanitize(val, options, visited);
|
|
124
|
-
copy[key] = res.sanitized;
|
|
125
|
-
totalCount += res.count;
|
|
126
|
-
}
|
|
127
|
-
return { sanitized: copy, count: totalCount };
|
|
128
|
-
}
|
|
129
|
-
function recursivelySanitize(data, options, visited = /* @__PURE__ */ new WeakSet()) {
|
|
130
|
-
if (typeof data === "string") {
|
|
131
|
-
const res = sanitizeString(data);
|
|
132
|
-
return { sanitized: res.text, count: res.count };
|
|
133
|
-
}
|
|
134
|
-
if (data !== null && typeof data === "object") {
|
|
135
|
-
if (visited.has(data)) {
|
|
136
|
-
return { sanitized: "[CIRCULAR_REFERENCE]", count: 0 };
|
|
137
|
-
}
|
|
138
|
-
visited.add(data);
|
|
139
|
-
if (Array.isArray(data)) {
|
|
140
|
-
return sanitizeArray(data, options, visited);
|
|
141
|
-
}
|
|
142
|
-
return sanitizeObject(data, options, visited);
|
|
143
|
-
}
|
|
144
|
-
return { sanitized: data, count: 0 };
|
|
145
|
-
}
|
|
146
|
-
function auditToolResult(data, options) {
|
|
147
|
-
const { sanitized, count } = recursivelySanitize(data, options);
|
|
148
|
-
if (options.throwOnPii && count > 0) {
|
|
149
|
-
throw new PiiLeakError(options.toolName, count);
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
sanitizedData: sanitized,
|
|
153
|
-
maskedCount: count
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// src/agent/isolated-tool.ts
|
|
158
|
-
async function verifyDataAccessGuard(guard, args, context, toolIdentifier) {
|
|
159
|
-
if (!guard) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const isAllowed = await guard(args, context);
|
|
163
|
-
if (!isAllowed) {
|
|
164
|
-
throw new ToolAccessDeniedError(toolIdentifier, "Access denied by data access guard");
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
async function resolveInvalidationTags(config, args, rawResult, context) {
|
|
168
|
-
if (!config.invalidationTags) {
|
|
169
|
-
return void 0;
|
|
170
|
-
}
|
|
171
|
-
const tags = typeof config.invalidationTags === "function" ? await config.invalidationTags(args, rawResult) : config.invalidationTags;
|
|
172
|
-
if (tags && tags.length > 0 && context?.onInvalidationTags) {
|
|
173
|
-
await context.onInvalidationTags(tags);
|
|
174
|
-
}
|
|
175
|
-
return tags;
|
|
176
|
-
}
|
|
177
|
-
async function dispatchClientData(rawResult, callback) {
|
|
178
|
-
if (!callback) {
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
await callback(rawResult);
|
|
182
|
-
}
|
|
183
|
-
async function produceLlmPayload(rawResult, args, context, transformer) {
|
|
184
|
-
if (transformer) {
|
|
185
|
-
return await transformer(rawResult, args, context);
|
|
186
|
-
}
|
|
187
|
-
return rawResult;
|
|
188
|
-
}
|
|
189
|
-
function validateLlmDto(payload, schema, toolIdentifier) {
|
|
190
|
-
const parseResult = schema.safeParse(payload);
|
|
191
|
-
if (!parseResult.success) {
|
|
192
|
-
const issues = parseResult.error.issues ?? [];
|
|
193
|
-
const errorMessages = issues.map((issue) => `${issue.path.join(".") || "root"}: ${issue.message}`).join(", ");
|
|
194
|
-
throw new DtoValidationError(
|
|
195
|
-
toolIdentifier,
|
|
196
|
-
errorMessages,
|
|
197
|
-
issues
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
return parseResult.data;
|
|
201
|
-
}
|
|
202
|
-
function protectLlmPayload(payload, toolIdentifier, sanitizePii = true, throwOnPii = false) {
|
|
203
|
-
if (!sanitizePii) {
|
|
204
|
-
return { sanitized: payload, count: 0 };
|
|
205
|
-
}
|
|
206
|
-
const { sanitizedData, maskedCount } = auditToolResult(payload, {
|
|
207
|
-
toolName: toolIdentifier,
|
|
208
|
-
throwOnPii
|
|
209
|
-
});
|
|
210
|
-
return { sanitized: sanitizedData, count: maskedCount };
|
|
211
|
-
}
|
|
212
|
-
async function processLlmPayload(rawResult, args, context, config, toolIdentifier) {
|
|
213
|
-
let payload = await produceLlmPayload(rawResult, args, context, config.llmDto);
|
|
214
|
-
if (config.llmDtoSchema) {
|
|
215
|
-
payload = validateLlmDto(payload, config.llmDtoSchema, toolIdentifier);
|
|
216
|
-
}
|
|
217
|
-
return protectLlmPayload(
|
|
218
|
-
payload,
|
|
219
|
-
toolIdentifier,
|
|
220
|
-
config.sanitizePii !== false,
|
|
221
|
-
config.throwOnPii === true
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
function createIsolatedTool(config) {
|
|
225
|
-
const toolId = config.id || config.name;
|
|
226
|
-
const toolAlias = config.alias;
|
|
227
|
-
const clientCallback = config.clientDto;
|
|
228
|
-
const toolIdentifier = toolAlias || config.name;
|
|
229
|
-
const toolImpact = config.impact ?? "READ_ONLY";
|
|
230
|
-
const requireApproval = config.requireApproval ?? toolImpact === "DESTRUCTIVE";
|
|
231
|
-
const tool = {
|
|
232
|
-
description: config.description,
|
|
233
|
-
parameters: config.parameters,
|
|
234
|
-
_toolId: toolId,
|
|
235
|
-
_toolName: config.name,
|
|
236
|
-
_toolAlias: toolAlias,
|
|
237
|
-
_isIsolated: true,
|
|
238
|
-
_cacheTTL: config.cacheTTL,
|
|
239
|
-
_domain: config.domain,
|
|
240
|
-
_resource: config.resource,
|
|
241
|
-
_roles: config.roles ? Object.freeze([...config.roles]) : void 0,
|
|
242
|
-
_impact: toolImpact,
|
|
243
|
-
_requireApproval: requireApproval,
|
|
244
|
-
_lastPiiFilteredCount: 0,
|
|
245
|
-
_lastInvalidationTags: void 0,
|
|
246
|
-
async execute(args, context) {
|
|
247
|
-
const updatedContext = {
|
|
248
|
-
...context,
|
|
249
|
-
callChain: context?.callChain ?? Object.freeze([toolId])
|
|
250
|
-
};
|
|
251
|
-
await verifyDataAccessGuard(
|
|
252
|
-
config.dataAccessGuard,
|
|
253
|
-
args,
|
|
254
|
-
updatedContext,
|
|
255
|
-
toolIdentifier
|
|
256
|
-
);
|
|
257
|
-
const rawResult = await config.execute(args, updatedContext);
|
|
258
|
-
const tags = await resolveInvalidationTags(
|
|
259
|
-
config,
|
|
260
|
-
args,
|
|
261
|
-
rawResult,
|
|
262
|
-
updatedContext
|
|
263
|
-
);
|
|
264
|
-
if (tags) {
|
|
265
|
-
tool._lastInvalidationTags = tags;
|
|
266
|
-
}
|
|
267
|
-
await dispatchClientData(rawResult, clientCallback);
|
|
268
|
-
const protection = await processLlmPayload(
|
|
269
|
-
rawResult,
|
|
270
|
-
args,
|
|
271
|
-
updatedContext,
|
|
272
|
-
config,
|
|
273
|
-
toolIdentifier
|
|
274
|
-
);
|
|
275
|
-
tool._lastPiiFilteredCount = protection.count;
|
|
276
|
-
return protection.sanitized;
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
return tool;
|
|
280
|
-
}
|
|
2
|
+
CircularToolCallError,
|
|
3
|
+
DtoValidationError,
|
|
4
|
+
PiiLeakError,
|
|
5
|
+
StepExecutionError,
|
|
6
|
+
StepSuspendedError,
|
|
7
|
+
ToolAccessDeniedError,
|
|
8
|
+
ToolCallDepthExceededError,
|
|
9
|
+
ToolNotFoundError,
|
|
10
|
+
ToolSubCallQuotaError,
|
|
11
|
+
auditToolResult,
|
|
12
|
+
createIsolatedTool
|
|
13
|
+
} from "../chunk-5VA3EKPJ.mjs";
|
|
281
14
|
|
|
282
15
|
// src/agent/dto.ts
|
|
283
16
|
function extractWhitelistedFields(data, keys) {
|
package/dist/agent/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { z } from "zod";
|
|
|
2
2
|
/**
|
|
3
3
|
* Lifecycle status for durable agent workflow steps.
|
|
4
4
|
*/
|
|
5
|
-
export type StepStatus = "PENDING" | "RUNNING" | "COMPLETED" | "FAILED" | "WAITING_APPROVAL";
|
|
5
|
+
export type StepStatus = "PENDING" | "RUNNING" | "COMPLETED" | "FAILED" | "WAITING_APPROVAL" | "ABORTED";
|
|
6
6
|
/**
|
|
7
7
|
* Token usage metrics for LLM calls and tool executions.
|
|
8
8
|
*/
|
|
@@ -203,6 +203,10 @@ export interface VercelAiCoreTool<TArgs = any, TResult = any> {
|
|
|
203
203
|
_lastPiiFilteredCount?: number;
|
|
204
204
|
_lastInvalidationTags?: string[];
|
|
205
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Isolated Tool contract returned by createIsolatedTool and asTool().
|
|
208
|
+
*/
|
|
209
|
+
export type IsolatedTool<TArgs = any, TResult = any> = VercelAiCoreTool<TArgs, TResult>;
|
|
206
210
|
/**
|
|
207
211
|
* Metadata and descriptor for registered tools in the registry.
|
|
208
212
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,SAAS,GACT,WAAW,GACX,QAAQ,GACR,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,SAAS,GACT,WAAW,GACX,QAAQ,GACR,kBAAkB,GAClB,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,OAAO,GAAG,OAAO;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,E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