avantgate 2.3.0 → 2.4.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/dist/agent/errors.d.ts +14 -0
- package/dist/agent/errors.d.ts.map +1 -1
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +317 -49
- package/dist/agent/index.mjs +51 -44
- package/dist/agent/isolated-tool.d.ts.map +1 -1
- package/dist/agent/registry.d.ts +2 -15
- package/dist/agent/registry.d.ts.map +1 -1
- package/dist/agent/strategy.d.ts.map +1 -1
- package/dist/agent/tool-resilience.d.ts +5 -0
- package/dist/agent/tool-resilience.d.ts.map +1 -0
- package/dist/agent/types.d.ts +66 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/{chunk-W27A25DK.mjs → chunk-B22KKIQQ.mjs} +271 -6
- package/dist/{chunk-AH5XXSS4.mjs → chunk-KEJ4VNSN.mjs} +1 -1
- package/dist/control-layer.d.ts +11 -2
- package/dist/control-layer.d.ts.map +1 -1
- package/dist/errors.d.ts +16 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +723 -106
- package/dist/index.mjs +452 -102
- package/dist/middleware.d.ts +4 -4
- package/dist/middleware.d.ts.map +1 -1
- package/dist/presets.d.ts.map +1 -1
- package/dist/providers/http-client.d.ts +3 -0
- package/dist/providers/http-client.d.ts.map +1 -1
- package/dist/types.d.ts +53 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/immutability.d.ts +5 -0
- package/dist/utils/immutability.d.ts.map +1 -0
- package/dist/workflow/index.js +264 -6
- package/dist/workflow/index.mjs +2 -2
- package/package.json +5 -4
|
@@ -150,6 +150,25 @@ var DtoValidationError = class extends Error {
|
|
|
150
150
|
this.issues = issues;
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
+
var AmbiguousToolExecutionError = class extends Error {
|
|
154
|
+
toolCallId;
|
|
155
|
+
toolName;
|
|
156
|
+
impact;
|
|
157
|
+
originalError;
|
|
158
|
+
constructor(details, toolName, impact) {
|
|
159
|
+
const isStr = typeof details === "string";
|
|
160
|
+
const callId = isStr ? details : details.toolCallId;
|
|
161
|
+
const name = isStr ? toolName : details.toolName;
|
|
162
|
+
const imp = isStr ? impact ?? "MUTATIVE" : details.impact ?? "MUTATIVE";
|
|
163
|
+
const msg = isStr ? "" : details.message ? `: ${details.message}` : "";
|
|
164
|
+
super(`Ambiguous tool execution detected for [${name || "tool"}::${callId}] (${imp})${msg}. Re-execution blocked without reconciliation.`);
|
|
165
|
+
this.name = "AmbiguousToolExecutionError";
|
|
166
|
+
this.toolCallId = callId;
|
|
167
|
+
this.toolName = name;
|
|
168
|
+
this.impact = imp;
|
|
169
|
+
this.originalError = isStr ? void 0 : details.originalError;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
153
172
|
|
|
154
173
|
// src/agent/guardrails.ts
|
|
155
174
|
function sanitizeString(value) {
|
|
@@ -203,16 +222,223 @@ function auditToolResult(data, options) {
|
|
|
203
222
|
};
|
|
204
223
|
}
|
|
205
224
|
|
|
225
|
+
// src/agent/tool-resilience.ts
|
|
226
|
+
var MAX_FALLBACK_CAP = 1e3;
|
|
227
|
+
var inMemoryFallbackStore = /* @__PURE__ */ new Map();
|
|
228
|
+
var clearResilienceFallbackStore = () => {
|
|
229
|
+
inMemoryFallbackStore.clear();
|
|
230
|
+
};
|
|
231
|
+
var setFallbackRecord = (toolCallId, record) => {
|
|
232
|
+
if (inMemoryFallbackStore.size >= MAX_FALLBACK_CAP) {
|
|
233
|
+
const firstKey = inMemoryFallbackStore.keys().next().value;
|
|
234
|
+
if (firstKey) inMemoryFallbackStore.delete(firstKey);
|
|
235
|
+
}
|
|
236
|
+
inMemoryFallbackStore.set(toolCallId, record);
|
|
237
|
+
};
|
|
238
|
+
var isDeterministicClientError = (error) => {
|
|
239
|
+
if (!error || typeof error !== "object") {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
const err = error;
|
|
243
|
+
const status = Number(err.status ?? err.statusCode);
|
|
244
|
+
if (status >= 400 && status < 500 && status !== 408 && status !== 429) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
return err.name === "DtoValidationError" || err.name === "ToolAccessDeniedError";
|
|
248
|
+
};
|
|
249
|
+
var isAmbiguousTimeoutError = (error, isTimedOut) => {
|
|
250
|
+
if (isTimedOut) return true;
|
|
251
|
+
if (!error || typeof error !== "object") return false;
|
|
252
|
+
const err = error;
|
|
253
|
+
const name = String(err.name ?? "");
|
|
254
|
+
const status = Number(err.status ?? err.statusCode);
|
|
255
|
+
if (name === "AbortError" || name === "TimeoutError") return true;
|
|
256
|
+
if (status === 408 || status === 502 || status === 503 || status === 504) return true;
|
|
257
|
+
const msg = String(err.message ?? "").toLowerCase();
|
|
258
|
+
const code = String(err.code ?? "").toLowerCase();
|
|
259
|
+
return ["timeout", "etimedout", "econnreset", "socket hang up", "network error", "fetch failed"].some((key) => msg.includes(key) || code.includes(key));
|
|
260
|
+
};
|
|
261
|
+
var classifyErrorStatus = (error, isTimedOut) => {
|
|
262
|
+
if (isDeterministicClientError(error)) {
|
|
263
|
+
return "FAILED";
|
|
264
|
+
}
|
|
265
|
+
if (isAmbiguousTimeoutError(error, isTimedOut)) {
|
|
266
|
+
return "UNCONFIRMED_TIMEOUT";
|
|
267
|
+
}
|
|
268
|
+
return "FAILED";
|
|
269
|
+
};
|
|
270
|
+
var getToolExecutionRecord = async (storage, toolCallId) => {
|
|
271
|
+
if (!storage) {
|
|
272
|
+
return inMemoryFallbackStore.get(toolCallId) ?? null;
|
|
273
|
+
}
|
|
274
|
+
if (storage.getStateValue) {
|
|
275
|
+
const val = await storage.getStateValue(`tool_resilience:${toolCallId}`);
|
|
276
|
+
if (val) return val;
|
|
277
|
+
const directVal = await storage.getStateValue(toolCallId);
|
|
278
|
+
if (directVal) return directVal;
|
|
279
|
+
}
|
|
280
|
+
const step = await storage.getStep("_tool_resilience", toolCallId);
|
|
281
|
+
return step?.metadata?.resilienceRecord ?? null;
|
|
282
|
+
};
|
|
283
|
+
var saveToStateStorage = async (storage, toolCallId, record) => {
|
|
284
|
+
if (!storage.setStateValue) return;
|
|
285
|
+
await storage.setStateValue(`tool_resilience:${toolCallId}`, record);
|
|
286
|
+
await storage.setStateValue(toolCallId, record);
|
|
287
|
+
};
|
|
288
|
+
var saveResilienceRecord = async (storage, record) => {
|
|
289
|
+
if (!storage) {
|
|
290
|
+
setFallbackRecord(record.toolCallId, record);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
await saveToStateStorage(storage, record.toolCallId, record);
|
|
294
|
+
const status = record.status === "COMPLETED" ? "COMPLETED" : record.status === "FAILED" ? "FAILED" : "RUNNING";
|
|
295
|
+
await storage.saveStep({
|
|
296
|
+
workflowId: "_tool_resilience",
|
|
297
|
+
stepId: record.toolCallId,
|
|
298
|
+
status,
|
|
299
|
+
result: record.result,
|
|
300
|
+
error: record.error,
|
|
301
|
+
metadata: { resilienceRecord: record },
|
|
302
|
+
createdAt: new Date(record.startedAt).toISOString(),
|
|
303
|
+
updatedAt: new Date(record.updatedAt).toISOString()
|
|
304
|
+
});
|
|
305
|
+
};
|
|
306
|
+
var handleAmbiguousFailure = (options, originalError) => {
|
|
307
|
+
const workflowId = options.workflowId ?? "_tool_resilience";
|
|
308
|
+
if (options.suspendOnAmbiguous) {
|
|
309
|
+
throw new StepSuspendedError(options.toolCallId, workflowId, {
|
|
310
|
+
toolCallId: options.toolCallId,
|
|
311
|
+
impact: options.impact,
|
|
312
|
+
reason: "Ambiguous mutation requires human intervention",
|
|
313
|
+
originalError
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
throw new AmbiguousToolExecutionError({
|
|
317
|
+
toolCallId: options.toolCallId,
|
|
318
|
+
toolName: options.toolName,
|
|
319
|
+
impact: options.impact,
|
|
320
|
+
message: "Ambiguous execution state (UNCONFIRMED_TIMEOUT). Re-execution blocked without reconciliation.",
|
|
321
|
+
originalError
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
var saveReconciledRecord = async (options, result) => {
|
|
325
|
+
await saveResilienceRecord(options.storage, {
|
|
326
|
+
toolCallId: options.toolCallId,
|
|
327
|
+
status: "COMPLETED",
|
|
328
|
+
result,
|
|
329
|
+
impact: options.impact,
|
|
330
|
+
startedAt: Date.now(),
|
|
331
|
+
updatedAt: Date.now()
|
|
332
|
+
});
|
|
333
|
+
return { result, isCached: true, status: "COMPLETED" };
|
|
334
|
+
};
|
|
335
|
+
var tryReconciliation = async (options) => {
|
|
336
|
+
if (!options.onAmbiguousRetry) {
|
|
337
|
+
return handleAmbiguousFailure(options);
|
|
338
|
+
}
|
|
339
|
+
try {
|
|
340
|
+
const outcome = await options.onAmbiguousRetry({ toolCallId: options.toolCallId, args: options.args });
|
|
341
|
+
if (!outcome.reconciled) {
|
|
342
|
+
return handleAmbiguousFailure(options);
|
|
343
|
+
}
|
|
344
|
+
return await saveReconciledRecord(options, outcome.result);
|
|
345
|
+
} catch (err) {
|
|
346
|
+
if (err instanceof StepSuspendedError || err instanceof AmbiguousToolExecutionError) throw err;
|
|
347
|
+
return handleAmbiguousFailure(options, err);
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
var checkExistingState = async (options) => {
|
|
351
|
+
const existing = await getToolExecutionRecord(options.storage, options.toolCallId);
|
|
352
|
+
if (!existing) {
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
if (existing.status === "COMPLETED") {
|
|
356
|
+
return { result: existing.result, isCached: true, status: "COMPLETED" };
|
|
357
|
+
}
|
|
358
|
+
if (existing.status === "UNCONFIRMED_TIMEOUT") {
|
|
359
|
+
if (options.impact === "READ_ONLY") {
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
return await tryReconciliation(options);
|
|
363
|
+
}
|
|
364
|
+
return null;
|
|
365
|
+
};
|
|
366
|
+
var executeActionWithTimeout = async (action, timeoutMs, idempotencyKey) => {
|
|
367
|
+
const controller = new AbortController();
|
|
368
|
+
let isTimedOut = false;
|
|
369
|
+
const timer = setTimeout(() => {
|
|
370
|
+
isTimedOut = true;
|
|
371
|
+
controller.abort(new Error(`Tool execution timed out after ${timeoutMs}ms`));
|
|
372
|
+
}, timeoutMs);
|
|
373
|
+
try {
|
|
374
|
+
const result = await action(controller.signal, idempotencyKey);
|
|
375
|
+
return { result, isTimedOut: false };
|
|
376
|
+
} catch (error) {
|
|
377
|
+
return { error, isTimedOut };
|
|
378
|
+
} finally {
|
|
379
|
+
clearTimeout(timer);
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
var saveFailureRecord = async (options, startedAt, error, isTimedOut) => {
|
|
383
|
+
const status = classifyErrorStatus(error, isTimedOut);
|
|
384
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
385
|
+
await saveResilienceRecord(options.storage, {
|
|
386
|
+
toolCallId: options.toolCallId,
|
|
387
|
+
status,
|
|
388
|
+
error: errorMsg,
|
|
389
|
+
impact: options.impact,
|
|
390
|
+
startedAt,
|
|
391
|
+
updatedAt: Date.now()
|
|
392
|
+
});
|
|
393
|
+
throw error;
|
|
394
|
+
};
|
|
395
|
+
var saveSuccessRecord = async (options, startedAt, result) => {
|
|
396
|
+
await saveResilienceRecord(options.storage, {
|
|
397
|
+
toolCallId: options.toolCallId,
|
|
398
|
+
status: "COMPLETED",
|
|
399
|
+
result,
|
|
400
|
+
impact: options.impact,
|
|
401
|
+
startedAt,
|
|
402
|
+
updatedAt: Date.now()
|
|
403
|
+
});
|
|
404
|
+
return { result, isCached: false, status: "COMPLETED" };
|
|
405
|
+
};
|
|
406
|
+
var claimExecutionIntent = async (options, startedAt) => {
|
|
407
|
+
await saveResilienceRecord(options.storage, {
|
|
408
|
+
toolCallId: options.toolCallId,
|
|
409
|
+
status: "CLAIMED",
|
|
410
|
+
impact: options.impact,
|
|
411
|
+
startedAt,
|
|
412
|
+
updatedAt: startedAt
|
|
413
|
+
});
|
|
414
|
+
};
|
|
415
|
+
var withToolResilience = async (options) => {
|
|
416
|
+
const existingResult = await checkExistingState(options);
|
|
417
|
+
if (existingResult) {
|
|
418
|
+
return existingResult;
|
|
419
|
+
}
|
|
420
|
+
const startedAt = Date.now();
|
|
421
|
+
const idempotencyKey = options.idempotencyKey || options.toolCallId;
|
|
422
|
+
await claimExecutionIntent(options, startedAt);
|
|
423
|
+
const timeoutMs = options.timeoutMs ?? 3e4;
|
|
424
|
+
const outcome = await executeActionWithTimeout(options.action, timeoutMs, idempotencyKey);
|
|
425
|
+
if (outcome.error) {
|
|
426
|
+
return await saveFailureRecord(options, startedAt, outcome.error, outcome.isTimedOut);
|
|
427
|
+
}
|
|
428
|
+
return await saveSuccessRecord(options, startedAt, outcome.result);
|
|
429
|
+
};
|
|
430
|
+
|
|
206
431
|
// src/agent/isolated-tool.ts
|
|
207
432
|
var verifyRoles = (configuredRoles, context, toolIdentifier) => {
|
|
208
433
|
if (!configuredRoles || configuredRoles.length === 0) {
|
|
209
434
|
return;
|
|
210
435
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
];
|
|
215
|
-
|
|
436
|
+
if (!context.role && (!context.roles || context.roles.length === 0)) {
|
|
437
|
+
throw new ToolAccessDeniedError(toolIdentifier, "Access denied: insufficient role permissions");
|
|
438
|
+
}
|
|
439
|
+
const roleSet = new Set(context.roles ?? []);
|
|
440
|
+
if (context.role) roleSet.add(context.role);
|
|
441
|
+
const hasAllowedRole = configuredRoles.some((role) => roleSet.has(role));
|
|
216
442
|
if (!hasAllowedRole) {
|
|
217
443
|
throw new ToolAccessDeniedError(
|
|
218
444
|
toolIdentifier,
|
|
@@ -329,6 +555,35 @@ var processLlmPayload = async (rawResult, args, context, config, toolIdentifier)
|
|
|
329
555
|
config.throwOnPii === true
|
|
330
556
|
);
|
|
331
557
|
};
|
|
558
|
+
var buildResilientContext = (config, args, context) => {
|
|
559
|
+
const toolCallId = context.toolCallId || `call_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
|
|
560
|
+
const genKey = config.resilience?.idempotencyKeyGenerator?.(args, context);
|
|
561
|
+
const idempotencyKey = context.idempotencyKey || genKey || toolCallId;
|
|
562
|
+
const resilientContext = { ...context, toolCallId, idempotencyKey };
|
|
563
|
+
return { toolCallId, idempotencyKey, resilientContext };
|
|
564
|
+
};
|
|
565
|
+
var executeWithResilienceGuard = async (config, args, context, toolIdentifier) => {
|
|
566
|
+
if (!config.resilience) {
|
|
567
|
+
return await config.execute(args, context);
|
|
568
|
+
}
|
|
569
|
+
const { toolCallId, idempotencyKey, resilientContext } = buildResilientContext(config, args, context);
|
|
570
|
+
const outcome = await withToolResilience({
|
|
571
|
+
toolCallId,
|
|
572
|
+
toolName: toolIdentifier,
|
|
573
|
+
storage: context.storage,
|
|
574
|
+
impact: config.impact ?? "READ_ONLY",
|
|
575
|
+
idempotencyKey,
|
|
576
|
+
timeoutMs: config.resilience.timeoutMs,
|
|
577
|
+
suspendOnAmbiguous: config.resilience.suspendOnAmbiguous,
|
|
578
|
+
workflowId: context.workflowId,
|
|
579
|
+
args,
|
|
580
|
+
action: async (signal, idKey) => {
|
|
581
|
+
return await config.execute(args, { ...resilientContext, abortSignal: signal, idempotencyKey: idKey });
|
|
582
|
+
},
|
|
583
|
+
onAmbiguousRetry: config.resilience.onAmbiguousRetry
|
|
584
|
+
});
|
|
585
|
+
return outcome.result;
|
|
586
|
+
};
|
|
332
587
|
var createIsolatedTool = (config) => {
|
|
333
588
|
const toolId = config.id || config.name;
|
|
334
589
|
const toolAlias = config.alias;
|
|
@@ -350,6 +605,7 @@ var createIsolatedTool = (config) => {
|
|
|
350
605
|
_roles: config.roles ? Object.freeze([...config.roles]) : void 0,
|
|
351
606
|
_impact: toolImpact,
|
|
352
607
|
_requireApproval: requireApproval,
|
|
608
|
+
_resilience: config.resilience,
|
|
353
609
|
_lastPiiFilteredCount: 0,
|
|
354
610
|
_lastInvalidationTags: void 0,
|
|
355
611
|
execute: async (args, context) => {
|
|
@@ -364,7 +620,12 @@ var createIsolatedTool = (config) => {
|
|
|
364
620
|
updatedContext,
|
|
365
621
|
toolIdentifier
|
|
366
622
|
);
|
|
367
|
-
const rawResult = await
|
|
623
|
+
const rawResult = await executeWithResilienceGuard(
|
|
624
|
+
config,
|
|
625
|
+
args,
|
|
626
|
+
updatedContext,
|
|
627
|
+
toolIdentifier
|
|
628
|
+
);
|
|
368
629
|
verifyTenantIsolation(config.assertTenant, rawResult, updatedContext, toolIdentifier);
|
|
369
630
|
await verifyResourceOwnership(
|
|
370
631
|
config.assertOwnership,
|
|
@@ -410,7 +671,11 @@ export {
|
|
|
410
671
|
ToolSubCallQuotaError,
|
|
411
672
|
ToolNotFoundError,
|
|
412
673
|
DtoValidationError,
|
|
674
|
+
AmbiguousToolExecutionError,
|
|
413
675
|
auditToolResult,
|
|
676
|
+
clearResilienceFallbackStore,
|
|
677
|
+
getToolExecutionRecord,
|
|
678
|
+
withToolResilience,
|
|
414
679
|
createIsolatedTool,
|
|
415
680
|
createTenantTool
|
|
416
681
|
};
|
package/dist/control-layer.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { ControlLayerConfig, ExecutionResult, StructuredExecutionResult, GenerateStructuredOutputOptions, LLMProviderPort, ChatMessage } from "./types";
|
|
2
|
+
import type { ControlLayerConfig, ExecutionResult, StructuredExecutionResult, GenerateStructuredOutputOptions, LLMProviderPort, ChatMessage, BudgetReservation } from "./types";
|
|
3
3
|
export declare class AvantGateControlLayer {
|
|
4
4
|
private config;
|
|
5
5
|
private cachedPricingAdapter?;
|
|
6
|
+
private reservations;
|
|
7
|
+
private cachedProviderChain;
|
|
6
8
|
constructor(config: ControlLayerConfig);
|
|
9
|
+
getReservation: (id: string) => BudgetReservation | undefined;
|
|
10
|
+
getAllReservations: () => BudgetReservation[];
|
|
7
11
|
private resolveProviderConfig;
|
|
8
12
|
private findProviderConfig;
|
|
9
13
|
private calculateCost;
|
|
10
14
|
private applySecurityGuards;
|
|
15
|
+
private reScanMessagesAfterHooks;
|
|
11
16
|
private applyOutputSecurityGuards;
|
|
17
|
+
private validateTokenBudget;
|
|
18
|
+
private validatePricingConfigured;
|
|
19
|
+
private evaluatePessimisticSolvency;
|
|
20
|
+
private createBudgetReservation;
|
|
12
21
|
private checkPreflightBudget;
|
|
13
22
|
private checkPostExecutionBudget;
|
|
14
23
|
private buildMessages;
|
|
@@ -24,6 +33,7 @@ export declare class AvantGateControlLayer {
|
|
|
24
33
|
private dispatchPromptExecution;
|
|
25
34
|
private finalizeExecutionResult;
|
|
26
35
|
private runAfterHooks;
|
|
36
|
+
private verifyPromptBudget;
|
|
27
37
|
execute: (options: {
|
|
28
38
|
userQuery?: string;
|
|
29
39
|
systemPrompt?: string;
|
|
@@ -48,7 +58,6 @@ export declare class AvantGateControlLayer {
|
|
|
48
58
|
providerOverride?: LLMProviderPort;
|
|
49
59
|
}) => Promise<StructuredExecutionResult<T>>;
|
|
50
60
|
private sanitizeIncomingMessages;
|
|
51
|
-
private verifyPromptBudget;
|
|
52
61
|
private dispatchOverrideAttempt;
|
|
53
62
|
private dispatchSimulatedAttempt;
|
|
54
63
|
private dispatchPipelineAttempt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-layer.d.ts","sourceRoot":"","sources":["../src/control-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,+BAA+B,EAC/B,eAAe,EACf,WAAW,
|
|
1
|
+
{"version":3,"file":"control-layer.d.ts","sourceRoot":"","sources":["../src/control-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,+BAA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B;IAEF,OAAO,CAAC,gBAAgB,CAQtB;IAEF,OAAO,CAAC,4BAA4B,CAwBlC;IAEF,OAAO,CAAC,uBAAuB,CAoB7B;IAEF,OAAO,CAAC,qBAAqB,CAgC3B;IAEF,wBAAwB,GAAU,CAAC,EACjC,SAAS,+BAA+B,CAAC,CAAC,CAAC,KAC1C,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CA4CtC;CACH;AAED,eAAO,MAAM,qBAAqB,GAAI,QAAQ,kBAAkB,KAAG,qBAElE,CAAC;AAEF,eAAO,MAAM,eAAe,WAJkB,kBAAkB,KAAG,qBAIf,CAAC;AACrD,OAAO,EAAE,qBAAqB,IAAI,kBAAkB,EAAE,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class MiddlewareTimeoutError extends Error {
|
|
2
|
+
readonly middlewareName: string;
|
|
3
|
+
readonly timeoutMs: number;
|
|
4
|
+
readonly phase: "beforeRequest" | "afterResponse";
|
|
5
|
+
constructor(middlewareName: string, phase: "beforeRequest" | "afterResponse", timeoutMs: number);
|
|
6
|
+
}
|
|
7
|
+
export declare class InvalidMessageSchemaError extends Error {
|
|
8
|
+
readonly middlewareName: string;
|
|
9
|
+
readonly validationErrors: unknown;
|
|
10
|
+
constructor(middlewareName: string, validationErrors: unknown);
|
|
11
|
+
}
|
|
12
|
+
export declare class PromptInjectionError extends Error {
|
|
13
|
+
readonly reason: string;
|
|
14
|
+
constructor(reason: string);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,KAAK,EAAE,eAAe,GAAG,eAAe,CAAC;gBAE7C,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,eAAe,EAAE,SAAS,EAAE,MAAM;CAOhG;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC,SAAgB,gBAAgB,EAAE,OAAO,CAAC;gBAE9B,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO;CAM9D;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAEnB,MAAM,EAAE,MAAM;CAK3B"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC"}
|