@axlsdk/axl 0.21.1 → 0.22.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 +9 -0
- package/dist/index.cjs +2791 -168
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +580 -47
- package/dist/index.d.ts +580 -47
- package/dist/index.js +2833 -223
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,74 @@ import { z, ZodError } from 'zod';
|
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
import { Readable } from 'node:stream';
|
|
4
4
|
|
|
5
|
+
/** Ordered, model-facing input. Strings retain the legacy shorthand. */
|
|
6
|
+
type ModelInput = string | readonly InputContentPart[];
|
|
7
|
+
type InputTextPart = {
|
|
8
|
+
readonly type: 'text';
|
|
9
|
+
readonly text: string;
|
|
10
|
+
};
|
|
11
|
+
type InputMediaSource = {
|
|
12
|
+
readonly type: 'url';
|
|
13
|
+
readonly url: string;
|
|
14
|
+
readonly mediaType?: string;
|
|
15
|
+
} | {
|
|
16
|
+
readonly type: 'bytes';
|
|
17
|
+
readonly data: Uint8Array;
|
|
18
|
+
readonly mediaType: string;
|
|
19
|
+
} | {
|
|
20
|
+
readonly type: 'base64';
|
|
21
|
+
readonly data: string;
|
|
22
|
+
readonly mediaType: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly type: 'provider-file';
|
|
25
|
+
readonly provider: string;
|
|
26
|
+
readonly reference: string;
|
|
27
|
+
readonly mediaType?: string;
|
|
28
|
+
};
|
|
29
|
+
type InputImagePart = {
|
|
30
|
+
readonly type: 'image';
|
|
31
|
+
readonly source: InputMediaSource;
|
|
32
|
+
readonly label?: string;
|
|
33
|
+
};
|
|
34
|
+
type InputContentPart = InputTextPart | InputImagePart;
|
|
35
|
+
/** Maximum decoded bytes retained across inline images in one logical input. */
|
|
36
|
+
declare const MAX_INLINE_MODEL_INPUT_BYTES: number;
|
|
37
|
+
/** Bounded, observation-safe representation of a rich input. */
|
|
38
|
+
type ModelInputDescriptor = {
|
|
39
|
+
readonly parts: readonly ({
|
|
40
|
+
readonly type: 'text';
|
|
41
|
+
readonly characters: number;
|
|
42
|
+
} | {
|
|
43
|
+
readonly type: 'image';
|
|
44
|
+
readonly source: InputMediaSource['type'];
|
|
45
|
+
readonly mediaType?: string;
|
|
46
|
+
readonly bytes?: number;
|
|
47
|
+
readonly locator?: string;
|
|
48
|
+
readonly label?: string;
|
|
49
|
+
})[];
|
|
50
|
+
};
|
|
51
|
+
/** Return legacy text unchanged, or the deterministic ordered text projection. */
|
|
52
|
+
declare function inputText(input: ModelInput): string;
|
|
53
|
+
|
|
54
|
+
type InputModalitySupport = {
|
|
55
|
+
image?: {
|
|
56
|
+
sources: readonly InputMediaSource['type'][];
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
type ProviderInputValidationRequest = {
|
|
60
|
+
model: string;
|
|
61
|
+
input: ModelInput;
|
|
62
|
+
/** Application-owned history that will accompany this input. Validators must
|
|
63
|
+
* cover every rich part/source across both input and history. */
|
|
64
|
+
history: readonly ChatMessage[];
|
|
65
|
+
stream: boolean;
|
|
66
|
+
hasTools: boolean;
|
|
67
|
+
responseMode: 'text' | 'structured';
|
|
68
|
+
providerOptions?: Record<string, unknown>;
|
|
69
|
+
};
|
|
70
|
+
type ProviderInputValidationResult = {
|
|
71
|
+
effectiveModel: string;
|
|
72
|
+
};
|
|
5
73
|
/**
|
|
6
74
|
* Tool definition in OpenAI-compatible format.
|
|
7
75
|
* All providers normalize to this format internally.
|
|
@@ -126,6 +194,10 @@ type StreamChunk = {
|
|
|
126
194
|
interface Provider {
|
|
127
195
|
/** Human-readable name for the provider (e.g. "openai", "anthropic") */
|
|
128
196
|
readonly name?: string;
|
|
197
|
+
/** Coarse, model-aware input metadata for UI/documentation. */
|
|
198
|
+
inputCapabilities?(model: string): InputModalitySupport;
|
|
199
|
+
/** Authoritative request-scoped rich-input validation. Omission means text-only. */
|
|
200
|
+
validateInput?(request: ProviderInputValidationRequest): ProviderInputValidationResult;
|
|
129
201
|
/**
|
|
130
202
|
* Send a chat completion request and return the full response.
|
|
131
203
|
*/
|
|
@@ -333,6 +405,8 @@ type DelegateOptions<T = unknown> = {
|
|
|
333
405
|
nativeStructuredOutput?: boolean;
|
|
334
406
|
/** Model URI for the internal router agent (default: first candidate's model). */
|
|
335
407
|
routerModel?: string;
|
|
408
|
+
/** Route using the full evidence (default) or only its ordered text projection. */
|
|
409
|
+
routerInput?: 'full' | 'text';
|
|
336
410
|
/** Additional metadata passed to the router and selected agent. */
|
|
337
411
|
metadata?: Record<string, unknown>;
|
|
338
412
|
/** Number of retries for structured output validation (passed to the final ask). */
|
|
@@ -356,11 +430,11 @@ type ExecutionStatus = 'running' | 'completed' | 'failed' | 'waiting';
|
|
|
356
430
|
* derive `AxlEventType` from this tuple and use it to validate stream filters,
|
|
357
431
|
* redaction tables, and exhaustiveness assertions.
|
|
358
432
|
*/
|
|
359
|
-
declare const AXL_EVENT_TYPES: readonly ["workflow_start", "workflow_end", "ask_start", "ask_end", "agent_call_start", "agent_call_end", "token", "tool_call_start", "tool_call_end", "tool_call_rejected", "tool_approval", "delegate", "handoff_start", "handoff_return", "pipeline", "partial_object", "string_delta", "verify", "schema_diagnostic", "log", "memory_remember", "memory_recall", "memory_forget", "checkpoint_save", "checkpoint_replay", "await_human", "await_human_resolved", "guardrail", "schema_check", "validate", "done", "error"];
|
|
433
|
+
declare const AXL_EVENT_TYPES: readonly ["workflow_start", "workflow_end", "transcription_start", "transcription_end", "ask_start", "ask_end", "agent_call_start", "agent_call_end", "token", "tool_call_start", "tool_call_end", "tool_call_rejected", "tool_approval", "delegate", "handoff_start", "handoff_return", "pipeline", "partial_object", "string_delta", "verify", "schema_diagnostic", "log", "memory_remember", "memory_recall", "memory_forget", "checkpoint_save", "checkpoint_replay", "await_human", "await_human_resolved", "guardrail", "schema_check", "validate", "done", "error"];
|
|
360
434
|
/** Discriminator union derived from `AXL_EVENT_TYPES`. */
|
|
361
435
|
type AxlEventType = (typeof AXL_EVENT_TYPES)[number];
|
|
362
436
|
/** Backward-compatible name for the canonical v2 writer discriminator list. */
|
|
363
|
-
declare const AXL_EVENT_TYPES_V2: readonly ["workflow_start", "workflow_end", "ask_start", "ask_end", "agent_call_start", "agent_call_end", "token", "tool_call_start", "tool_call_end", "tool_call_rejected", "tool_approval", "delegate", "handoff_start", "handoff_return", "pipeline", "partial_object", "string_delta", "verify", "schema_diagnostic", "log", "memory_remember", "memory_recall", "memory_forget", "checkpoint_save", "checkpoint_replay", "await_human", "await_human_resolved", "guardrail", "schema_check", "validate", "done", "error"];
|
|
437
|
+
declare const AXL_EVENT_TYPES_V2: readonly ["workflow_start", "workflow_end", "transcription_start", "transcription_end", "ask_start", "ask_end", "agent_call_start", "agent_call_end", "token", "tool_call_start", "tool_call_end", "tool_call_rejected", "tool_approval", "delegate", "handoff_start", "handoff_return", "pipeline", "partial_object", "string_delta", "verify", "schema_diagnostic", "log", "memory_remember", "memory_recall", "memory_forget", "checkpoint_save", "checkpoint_replay", "await_human", "await_human_resolved", "guardrail", "schema_check", "validate", "done", "error"];
|
|
364
438
|
/** Accepted/rejected tool lifecycle discriminators in event schema v2. */
|
|
365
439
|
declare const AXL_TOOL_LIFECYCLE_TYPES_V2: readonly ["tool_call_start", "tool_call_end", "tool_call_rejected"];
|
|
366
440
|
/** Resolved model parameters sent to the provider for an LLM call. */
|
|
@@ -382,6 +456,8 @@ type AgentCallParams = {
|
|
|
382
456
|
type AgentCallStartData = {
|
|
383
457
|
/** Original user prompt passed to `ctx.ask()`. Does not include retry feedback or tool results. */
|
|
384
458
|
prompt: string;
|
|
459
|
+
/** Bounded rich-input shape; omitted for legacy string calls. */
|
|
460
|
+
input?: ModelInputDescriptor;
|
|
385
461
|
/** Resolved system prompt (after evaluating dynamic system selectors). */
|
|
386
462
|
system?: string;
|
|
387
463
|
/** Resolved model parameters sent to the provider for this call. */
|
|
@@ -394,6 +470,12 @@ type AgentCallStartData = {
|
|
|
394
470
|
toolNames?: string[];
|
|
395
471
|
/** Full ChatMessage[] sent to the provider this turn. Only populated when `trace.level === 'full'`. */
|
|
396
472
|
messages?: ChatMessage[];
|
|
473
|
+
/** Descriptor-only counterparts for rich messages in a full snapshot. The
|
|
474
|
+
* matching `messages[index].content` is its text projection, never media. */
|
|
475
|
+
messageInputs?: readonly {
|
|
476
|
+
readonly index: number;
|
|
477
|
+
readonly input: ModelInputDescriptor;
|
|
478
|
+
}[];
|
|
397
479
|
};
|
|
398
480
|
/**
|
|
399
481
|
* Data shape for `agent_call_end` events — the **response** side of the call.
|
|
@@ -402,8 +484,10 @@ type AgentCallStartData = {
|
|
|
402
484
|
*
|
|
403
485
|
* Pair invariant: every `agent_call_start` is followed by exactly one
|
|
404
486
|
* `agent_call_end`, even on provider error. On the error path `response` is
|
|
405
|
-
* empty and `error` carries the provider's message
|
|
406
|
-
*
|
|
487
|
+
* empty and `error` carries the provider's message for legacy string calls.
|
|
488
|
+
* Rich-input calls use a fixed safe message because providers can echo inline
|
|
489
|
+
* media in their request errors. Cost/tokens/duration are still emitted
|
|
490
|
+
* (top-level on the event) when partial usage is available.
|
|
407
491
|
*/
|
|
408
492
|
type AgentCallEndData = {
|
|
409
493
|
/** Final LLM response content for this turn. Empty string on error. */
|
|
@@ -416,8 +500,9 @@ type AgentCallEndData = {
|
|
|
416
500
|
* reading `agent_call_end` (cost lives here) can bucket without joining. */
|
|
417
501
|
retryReason?: 'schema' | 'validate' | 'guardrail';
|
|
418
502
|
/** Provider error message when the call threw (network failure, 4xx/5xx,
|
|
419
|
-
* abort, etc). Mutually exclusive with `response` content.
|
|
420
|
-
*
|
|
503
|
+
* abort, etc). Mutually exclusive with `response` content. Rich-input
|
|
504
|
+
* calls always use a fixed safe projection, independently of trace
|
|
505
|
+
* redaction, because vendor errors can echo request media. */
|
|
421
506
|
error?: string;
|
|
422
507
|
/** HTTP status when the thrown error was a `ProviderError` (`0` for network
|
|
423
508
|
* failures). Omitted for non-provider errors. The raw error body is
|
|
@@ -426,6 +511,14 @@ type AgentCallEndData = {
|
|
|
426
511
|
/** Semantic failover hint from a thrown `ProviderError` (see
|
|
427
512
|
* `ProviderError.retryable`). Omitted for non-provider errors. */
|
|
428
513
|
retryable?: boolean;
|
|
514
|
+
/** Stable typed error code for a rich-input failure, when available. */
|
|
515
|
+
code?: string;
|
|
516
|
+
/** Provider identifier from a typed provider error on a rich-input failure. */
|
|
517
|
+
provider?: string;
|
|
518
|
+
/** Provider request id from a typed provider error on a rich-input failure. */
|
|
519
|
+
requestId?: string;
|
|
520
|
+
/** Retry-after delay in milliseconds from a typed provider error on a rich-input failure. */
|
|
521
|
+
retryAfterMs?: number;
|
|
429
522
|
};
|
|
430
523
|
/** Data shape for `tool_call_end` events. */
|
|
431
524
|
type ToolCallData = {
|
|
@@ -907,6 +1000,7 @@ type LegacyAxlEventPayloadV1 = (AxlEventBase & {
|
|
|
907
1000
|
}) | (AxlEventBase & AskScoped & {
|
|
908
1001
|
type: 'ask_start';
|
|
909
1002
|
prompt: string;
|
|
1003
|
+
input?: ModelInputDescriptor;
|
|
910
1004
|
}) | (AxlEventBase & AskScoped & {
|
|
911
1005
|
type: 'ask_end';
|
|
912
1006
|
/** Discriminated outcome — narrow on `outcome.ok`. Ask-internal throws
|
|
@@ -1109,13 +1203,69 @@ type LegacyAxlEventV1 = LegacyAxlEventPayloadV1 & {
|
|
|
1109
1203
|
type ToolCallRejectedEvent = Extract<ToolLifecycleEventV2, {
|
|
1110
1204
|
type: 'tool_call_rejected';
|
|
1111
1205
|
}>;
|
|
1206
|
+
/** Current-schema-only operation events. Deliberately excluded from the
|
|
1207
|
+
* frozen legacy v1 payload so old persisted records never gain new variants. */
|
|
1208
|
+
type TranscriptionLifecycleEventV2 = (AxlEventBase & {
|
|
1209
|
+
schemaVersion: 2;
|
|
1210
|
+
type: 'transcription_start';
|
|
1211
|
+
transcriptionId: string;
|
|
1212
|
+
model?: string;
|
|
1213
|
+
data: {
|
|
1214
|
+
provider?: string;
|
|
1215
|
+
model?: string;
|
|
1216
|
+
audio: {
|
|
1217
|
+
source: string;
|
|
1218
|
+
bytes?: number;
|
|
1219
|
+
mediaType?: string;
|
|
1220
|
+
};
|
|
1221
|
+
};
|
|
1222
|
+
}) | (AxlEventBase & {
|
|
1223
|
+
schemaVersion: 2;
|
|
1224
|
+
type: 'transcription_end';
|
|
1225
|
+
transcriptionId: string;
|
|
1226
|
+
model?: string;
|
|
1227
|
+
duration: number;
|
|
1228
|
+
cost?: number;
|
|
1229
|
+
tokens?: {
|
|
1230
|
+
input?: number;
|
|
1231
|
+
output?: number;
|
|
1232
|
+
};
|
|
1233
|
+
data: {
|
|
1234
|
+
status: 'completed' | 'failed' | 'aborted';
|
|
1235
|
+
provider?: string;
|
|
1236
|
+
model?: string;
|
|
1237
|
+
audio?: {
|
|
1238
|
+
source: string;
|
|
1239
|
+
bytes?: number;
|
|
1240
|
+
mediaType?: string;
|
|
1241
|
+
};
|
|
1242
|
+
text?: string;
|
|
1243
|
+
usage?: {
|
|
1244
|
+
audioSeconds?: number;
|
|
1245
|
+
inputTokens?: number;
|
|
1246
|
+
outputTokens?: number;
|
|
1247
|
+
totalTokens?: number;
|
|
1248
|
+
cost?: number;
|
|
1249
|
+
};
|
|
1250
|
+
pricingStatus?: 'priced' | 'unpriced' | 'zero';
|
|
1251
|
+
cleanupStatus?: 'not_required' | 'deleted' | 'failed' | 'timed_out';
|
|
1252
|
+
error?: string;
|
|
1253
|
+
errorCode?: 'TRANSCRIPTION_PROVIDER_ERROR';
|
|
1254
|
+
providerError?: {
|
|
1255
|
+
status: number;
|
|
1256
|
+
retryable: boolean;
|
|
1257
|
+
retryAfterMs?: number;
|
|
1258
|
+
requestId?: string;
|
|
1259
|
+
};
|
|
1260
|
+
};
|
|
1261
|
+
});
|
|
1112
1262
|
/** Event contract written by the next breaking runtime.
|
|
1113
1263
|
*
|
|
1114
1264
|
* This additive prototype lets consumers and type tests lock the schema before
|
|
1115
1265
|
* the runtime writer switches. Every v2 event carries the version directly;
|
|
1116
1266
|
* `tool_denied` and the v1 tool end shape cannot be represented.
|
|
1117
1267
|
*/
|
|
1118
|
-
type AxlEventV2 = ToolLifecycleEventV2 | (Exclude<LegacyAxlEventPayloadV1, {
|
|
1268
|
+
type AxlEventV2 = ToolLifecycleEventV2 | TranscriptionLifecycleEventV2 | (Exclude<LegacyAxlEventPayloadV1, {
|
|
1119
1269
|
type: 'tool_call_start' | 'tool_call_end' | 'tool_denied';
|
|
1120
1270
|
}> & {
|
|
1121
1271
|
schemaVersion: 2;
|
|
@@ -1140,6 +1290,7 @@ type GuardrailResult = {
|
|
|
1140
1290
|
/** Input guardrail function. Runs before the LLM call. */
|
|
1141
1291
|
type InputGuardrail = (prompt: string, ctx: {
|
|
1142
1292
|
metadata: Record<string, unknown>;
|
|
1293
|
+
input: ModelInput;
|
|
1143
1294
|
}) => GuardrailResult | Promise<GuardrailResult>;
|
|
1144
1295
|
/** Output guardrail function. Runs after the LLM response. */
|
|
1145
1296
|
type OutputGuardrail = (response: string, ctx: {
|
|
@@ -1243,6 +1394,7 @@ type HandoffRecord = {
|
|
|
1243
1394
|
type AgentCallInfo = {
|
|
1244
1395
|
agent: string;
|
|
1245
1396
|
prompt: string;
|
|
1397
|
+
input?: ModelInputDescriptor;
|
|
1246
1398
|
response: string;
|
|
1247
1399
|
model: string;
|
|
1248
1400
|
cost: number;
|
|
@@ -1264,7 +1416,7 @@ type AgentCallInfo = {
|
|
|
1264
1416
|
type ChatRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
1265
1417
|
type ChatMessage = {
|
|
1266
1418
|
role: ChatRole;
|
|
1267
|
-
content: string;
|
|
1419
|
+
content: string | readonly InputContentPart[];
|
|
1268
1420
|
name?: string;
|
|
1269
1421
|
tool_calls?: ToolCallMessage[];
|
|
1270
1422
|
tool_call_id?: string;
|
|
@@ -1315,6 +1467,78 @@ declare class AxlError extends Error {
|
|
|
1315
1467
|
readonly code: string;
|
|
1316
1468
|
constructor(code: string, message: string);
|
|
1317
1469
|
}
|
|
1470
|
+
/** Thrown when the public logical model-input shape is malformed. */
|
|
1471
|
+
declare class InvalidModelInputError extends AxlError {
|
|
1472
|
+
constructor(message: string);
|
|
1473
|
+
}
|
|
1474
|
+
/** Thrown before dispatch when a provider/model cannot accept a rich input. */
|
|
1475
|
+
declare class UnsupportedModelInputError extends AxlError {
|
|
1476
|
+
readonly provider: string;
|
|
1477
|
+
readonly model: string;
|
|
1478
|
+
readonly modality: string;
|
|
1479
|
+
readonly source?: string;
|
|
1480
|
+
constructor(options: {
|
|
1481
|
+
provider: string;
|
|
1482
|
+
model: string;
|
|
1483
|
+
modality: string;
|
|
1484
|
+
source?: string;
|
|
1485
|
+
feature?: string;
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
/** Thrown when the public transcription request contains unsupported or unsafe input. */
|
|
1489
|
+
declare class InvalidTranscriptionInputError extends AxlError {
|
|
1490
|
+
constructor(message: string);
|
|
1491
|
+
}
|
|
1492
|
+
/** Thrown before dispatch when no explicit transcription adapter can serve a URI. */
|
|
1493
|
+
declare class UnsupportedTranscriptionInputError extends AxlError {
|
|
1494
|
+
readonly provider: string;
|
|
1495
|
+
readonly model: string;
|
|
1496
|
+
constructor(options: {
|
|
1497
|
+
provider: string;
|
|
1498
|
+
model: string;
|
|
1499
|
+
feature?: string;
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
/** Safe boundary error for an adapter failure. The original provider error is
|
|
1503
|
+
* retained only as a non-enumerable cause because vendor messages/bodies may
|
|
1504
|
+
* echo raw audio or provider-file references. */
|
|
1505
|
+
declare class TranscriptionOperationError extends AxlError {
|
|
1506
|
+
readonly provider: string;
|
|
1507
|
+
readonly model: string;
|
|
1508
|
+
readonly usage?: {
|
|
1509
|
+
audioSeconds?: number;
|
|
1510
|
+
inputTokens?: number;
|
|
1511
|
+
outputTokens?: number;
|
|
1512
|
+
totalTokens?: number;
|
|
1513
|
+
cost?: number;
|
|
1514
|
+
};
|
|
1515
|
+
readonly pricingStatus?: 'priced' | 'unpriced' | 'zero';
|
|
1516
|
+
readonly cleanupStatus?: 'not_required' | 'deleted' | 'failed' | 'timed_out';
|
|
1517
|
+
/** Safe HTTP diagnostics projected from ProviderError when available. */
|
|
1518
|
+
readonly status?: number;
|
|
1519
|
+
readonly retryable?: boolean;
|
|
1520
|
+
readonly retryAfterMs?: number;
|
|
1521
|
+
readonly requestId?: string;
|
|
1522
|
+
readonly cause?: unknown;
|
|
1523
|
+
constructor(options: {
|
|
1524
|
+
provider: string;
|
|
1525
|
+
model: string;
|
|
1526
|
+
usage?: {
|
|
1527
|
+
audioSeconds?: number;
|
|
1528
|
+
inputTokens?: number;
|
|
1529
|
+
outputTokens?: number;
|
|
1530
|
+
totalTokens?: number;
|
|
1531
|
+
cost?: number;
|
|
1532
|
+
};
|
|
1533
|
+
pricingStatus?: 'priced' | 'unpriced' | 'zero';
|
|
1534
|
+
cleanupStatus?: 'not_required' | 'deleted' | 'failed' | 'timed_out';
|
|
1535
|
+
status?: number;
|
|
1536
|
+
retryable?: boolean;
|
|
1537
|
+
retryAfterMs?: number;
|
|
1538
|
+
requestId?: string;
|
|
1539
|
+
cause?: unknown;
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1318
1542
|
/**
|
|
1319
1543
|
* Strict observation overflow. Kept in the shared error module so every
|
|
1320
1544
|
* recovery boundary can identify the same non-recoverable control error.
|
|
@@ -1434,7 +1658,7 @@ type Agent = {
|
|
|
1434
1658
|
readonly _config: AgentConfig;
|
|
1435
1659
|
readonly _name: string;
|
|
1436
1660
|
/** Direct invocation for prototyping (no workflow context) */
|
|
1437
|
-
ask<T = string>(prompt:
|
|
1661
|
+
ask<T = string>(prompt: ModelInput, options?: AskOptions<T>): Promise<T>;
|
|
1438
1662
|
/** Resolve model string for given context */
|
|
1439
1663
|
resolveModel(ctx?: {
|
|
1440
1664
|
metadata?: Record<string, unknown>;
|
|
@@ -2139,6 +2363,12 @@ type OpenAICompatibleOptions = {
|
|
|
2139
2363
|
*/
|
|
2140
2364
|
declare class OpenAICompatibleProvider implements Provider {
|
|
2141
2365
|
readonly name: string;
|
|
2366
|
+
inputCapabilities(model: string): {
|
|
2367
|
+
image?: {
|
|
2368
|
+
sources: readonly InputMediaSource['type'][];
|
|
2369
|
+
};
|
|
2370
|
+
};
|
|
2371
|
+
validateInput(request: ProviderInputValidationRequest): ProviderInputValidationResult;
|
|
2142
2372
|
/** `json_schema` is honored natively when the profile's `supportsJsonSchema`
|
|
2143
2373
|
* capability is true for this model (the default); otherwise the engine
|
|
2144
2374
|
* downgrades the request to plain `json_object` (see `buildRequestBody`),
|
|
@@ -2736,6 +2966,96 @@ declare class ProviderRegistry {
|
|
|
2736
2966
|
clearFactories(): void;
|
|
2737
2967
|
}
|
|
2738
2968
|
|
|
2969
|
+
/** Audio supplied to a transcription provider. Network and file-system sources
|
|
2970
|
+
* are deliberately excluded: callers retain control of all I/O. */
|
|
2971
|
+
type RecordedAudioSource = {
|
|
2972
|
+
readonly type: 'bytes';
|
|
2973
|
+
readonly data: Uint8Array;
|
|
2974
|
+
readonly mediaType: string;
|
|
2975
|
+
} | {
|
|
2976
|
+
readonly type: 'base64';
|
|
2977
|
+
readonly data: string;
|
|
2978
|
+
readonly mediaType: string;
|
|
2979
|
+
} | {
|
|
2980
|
+
readonly type: 'provider-file';
|
|
2981
|
+
readonly provider: string;
|
|
2982
|
+
readonly reference: string;
|
|
2983
|
+
readonly mediaType?: string;
|
|
2984
|
+
};
|
|
2985
|
+
type TranscriptionRequest = {
|
|
2986
|
+
readonly model: string;
|
|
2987
|
+
readonly audio: RecordedAudioSource;
|
|
2988
|
+
readonly language?: string;
|
|
2989
|
+
readonly timestamps?: 'segment' | 'word';
|
|
2990
|
+
readonly diarization?: boolean;
|
|
2991
|
+
readonly providerOptions?: Record<string, unknown>;
|
|
2992
|
+
};
|
|
2993
|
+
type Transcript = {
|
|
2994
|
+
readonly text: string;
|
|
2995
|
+
readonly detectedLanguages?: readonly string[];
|
|
2996
|
+
readonly segments?: readonly {
|
|
2997
|
+
readonly text: string;
|
|
2998
|
+
readonly start: number;
|
|
2999
|
+
readonly end: number;
|
|
3000
|
+
readonly speaker?: string;
|
|
3001
|
+
}[];
|
|
3002
|
+
readonly words?: readonly {
|
|
3003
|
+
readonly text: string;
|
|
3004
|
+
readonly start: number;
|
|
3005
|
+
readonly end: number;
|
|
3006
|
+
readonly speaker?: string;
|
|
3007
|
+
}[];
|
|
3008
|
+
readonly usage?: {
|
|
3009
|
+
readonly audioSeconds?: number;
|
|
3010
|
+
readonly inputTokens?: number;
|
|
3011
|
+
readonly outputTokens?: number;
|
|
3012
|
+
readonly totalTokens?: number;
|
|
3013
|
+
readonly cost?: number;
|
|
3014
|
+
};
|
|
3015
|
+
readonly pricingStatus?: 'priced' | 'unpriced' | 'zero';
|
|
3016
|
+
readonly providerMetadata?: Readonly<Record<string, unknown>>;
|
|
3017
|
+
};
|
|
3018
|
+
/** Maximum decoded size of caller-supplied inline audio. */
|
|
3019
|
+
declare const MAX_INLINE_TRANSCRIPTION_BYTES: number;
|
|
3020
|
+
|
|
3021
|
+
type TranscriptionCapabilities = {
|
|
3022
|
+
readonly sources: readonly RecordedAudioSource['type'][];
|
|
3023
|
+
readonly timestamps?: readonly ('segment' | 'word')[];
|
|
3024
|
+
readonly diarization?: boolean;
|
|
3025
|
+
};
|
|
3026
|
+
type TranscriptionProviderRequest = Omit<TranscriptionRequest, 'model'> & {
|
|
3027
|
+
readonly model: string;
|
|
3028
|
+
readonly signal?: AbortSignal;
|
|
3029
|
+
};
|
|
3030
|
+
type TranscriptionProviderResult = {
|
|
3031
|
+
readonly transcript: Transcript;
|
|
3032
|
+
/** Internal cleanup outcome. Never includes a provider file identifier. */
|
|
3033
|
+
readonly cleanupStatus?: 'not_required' | 'deleted' | 'failed' | 'timed_out';
|
|
3034
|
+
};
|
|
3035
|
+
interface TranscriptionProvider {
|
|
3036
|
+
readonly capabilities: (model: string) => TranscriptionCapabilities | undefined;
|
|
3037
|
+
transcribe(request: TranscriptionProviderRequest): Promise<TranscriptionProviderResult>;
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
type TranscriptionProviderFactory = (config: AxlConfig) => TranscriptionProvider;
|
|
3041
|
+
type ResolvedTranscriptionProvider = {
|
|
3042
|
+
provider: TranscriptionProvider;
|
|
3043
|
+
model: string;
|
|
3044
|
+
providerName: string;
|
|
3045
|
+
};
|
|
3046
|
+
/** Dedicated registry: transcription URIs are always explicit `provider:model`.
|
|
3047
|
+
* It intentionally has no chat-provider/default-model or test fallback. */
|
|
3048
|
+
declare class TranscriptionProviderRegistry {
|
|
3049
|
+
private instances;
|
|
3050
|
+
private factories;
|
|
3051
|
+
constructor();
|
|
3052
|
+
register(name: string, factory: TranscriptionProviderFactory): void;
|
|
3053
|
+
registerInstance(name: string, provider: TranscriptionProvider): void;
|
|
3054
|
+
has(name: string): boolean;
|
|
3055
|
+
get(name: string, config?: AxlConfig): TranscriptionProvider;
|
|
3056
|
+
resolve(uri: string, config?: AxlConfig): ResolvedTranscriptionProvider;
|
|
3057
|
+
}
|
|
3058
|
+
|
|
2739
3059
|
/**
|
|
2740
3060
|
* Manages connections to multiple MCP servers.
|
|
2741
3061
|
* Discovers tools, filters by agent config, and routes tool calls.
|
|
@@ -2893,6 +3213,15 @@ declare function zodToJsonSchema(schema: z.ZodType): Record<string, unknown>;
|
|
|
2893
3213
|
* and content with leading/trailing text around a JSON object/array.
|
|
2894
3214
|
*/
|
|
2895
3215
|
declare function extractJson(content: string): string;
|
|
3216
|
+
type ObserverErrorProjection = {
|
|
3217
|
+
readonly message: string;
|
|
3218
|
+
readonly name: string;
|
|
3219
|
+
};
|
|
3220
|
+
type RichFailureState = {
|
|
3221
|
+
associations: unknown[];
|
|
3222
|
+
overflowed: boolean;
|
|
3223
|
+
indeterminate: boolean;
|
|
3224
|
+
};
|
|
2896
3225
|
/**
|
|
2897
3226
|
* Active `ctx.budget()` accounting state. One mutable object per budget block,
|
|
2898
3227
|
* shared by reference across the block's async branches (spawn/race/map).
|
|
@@ -2932,6 +3261,7 @@ type WorkflowContextInit = {
|
|
|
2932
3261
|
metadata?: Record<string, unknown>;
|
|
2933
3262
|
config: AxlConfig;
|
|
2934
3263
|
providerRegistry: ProviderRegistry;
|
|
3264
|
+
transcriptionProviderRegistry?: TranscriptionProviderRegistry;
|
|
2935
3265
|
sessionHistory?: ChatMessage[];
|
|
2936
3266
|
onTrace?: (event: AxlEvent) => void;
|
|
2937
3267
|
pendingDecisions?: Map<string, PendingDecisionResolver>;
|
|
@@ -2997,6 +3327,9 @@ type WorkflowContextInit = {
|
|
|
2997
3327
|
/** Internal: root-shared lifecycle state. Prevents child contexts from
|
|
2998
3328
|
* emitting trace events after the workflow terminal. */
|
|
2999
3329
|
workflowLifecycleState?: WorkflowLifecycleState;
|
|
3330
|
+
/** Internal: bounded rich-failure state shared by child contexts in one
|
|
3331
|
+
* execution. Never pass across independently created contexts. */
|
|
3332
|
+
richFailureState?: RichFailureState;
|
|
3000
3333
|
/** Runtime terminal barrier for abort-ignoring race/quorum branches. */
|
|
3001
3334
|
branchDrainTimeoutMs?: number;
|
|
3002
3335
|
};
|
|
@@ -3033,6 +3366,7 @@ declare class WorkflowContext<TInput = unknown> {
|
|
|
3033
3366
|
get totalCost(): number;
|
|
3034
3367
|
private config;
|
|
3035
3368
|
private providerRegistry;
|
|
3369
|
+
private transcriptionProviderRegistry?;
|
|
3036
3370
|
private sessionHistory;
|
|
3037
3371
|
private onTrace?;
|
|
3038
3372
|
private pendingDecisions?;
|
|
@@ -3058,6 +3392,10 @@ declare class WorkflowContext<TInput = unknown> {
|
|
|
3058
3392
|
*/
|
|
3059
3393
|
private autoCheckpointCounters;
|
|
3060
3394
|
private readonly branchDrainState;
|
|
3395
|
+
/** Bounded exact-identity failure association for this execution tree.
|
|
3396
|
+
* Unlike a process-global marker, this cannot affect another context that
|
|
3397
|
+
* happens to reuse the same Error object. */
|
|
3398
|
+
private readonly richFailureState;
|
|
3061
3399
|
/** Root-shared idempotency guards for workflow lifecycle emission.
|
|
3062
3400
|
* Both `runtime.execute()` and `runtime.stream()` have paths where a
|
|
3063
3401
|
* post-emit side-effect (checkpoint deletion, state-store persistence)
|
|
@@ -3175,6 +3513,10 @@ declare class WorkflowContext<TInput = unknown> {
|
|
|
3175
3513
|
* was removed in 0.16.0.
|
|
3176
3514
|
*/
|
|
3177
3515
|
createChildContext(): WorkflowContext;
|
|
3516
|
+
/** Associate an exact thrown value with rich input in this execution only. */
|
|
3517
|
+
private recordRichFailure;
|
|
3518
|
+
/** @internal Safe observer projection for a failure associated with rich input. */
|
|
3519
|
+
_observerErrorProjection(error: unknown): ObserverErrorProjection | undefined;
|
|
3178
3520
|
/**
|
|
3179
3521
|
* Resolve the current abort signal.
|
|
3180
3522
|
* Branch-scoped signals (from race/spawn/map/budget) in AsyncLocalStorage
|
|
@@ -3190,7 +3532,7 @@ declare class WorkflowContext<TInput = unknown> {
|
|
|
3190
3532
|
* never start. Every accepted request emits one terminal event before a
|
|
3191
3533
|
* continuation message or abort escapes this coordinator. */
|
|
3192
3534
|
private observeToolInvocation;
|
|
3193
|
-
ask<T = string>(agent: Agent, prompt:
|
|
3535
|
+
ask<T = string>(agent: Agent, prompt: ModelInput, options?: AskOptions<T>): Promise<T>;
|
|
3194
3536
|
private executeAgentCall;
|
|
3195
3537
|
/**
|
|
3196
3538
|
* Push the final assistant message into session history, preserving providerMetadata
|
|
@@ -3372,7 +3714,10 @@ declare class WorkflowContext<TInput = unknown> {
|
|
|
3372
3714
|
* @param prompt - The prompt to send to the selected agent
|
|
3373
3715
|
* @param options - Optional: schema, routerModel, metadata, retries
|
|
3374
3716
|
*/
|
|
3375
|
-
delegate<T = string>(agents: Agent[], prompt:
|
|
3717
|
+
delegate<T = string>(agents: Agent[], prompt: ModelInput, options?: DelegateOptions<T>): Promise<T>;
|
|
3718
|
+
/** Transcribe recorded audio through the dedicated transcription registry.
|
|
3719
|
+
* This operation never enters the chat history or chat-provider path. */
|
|
3720
|
+
transcribe(request: TranscriptionRequest): Promise<Transcript>;
|
|
3376
3721
|
/**
|
|
3377
3722
|
* Internal emitter input — intentionally loose so call sites don't need to
|
|
3378
3723
|
* build a perfectly-narrowed discriminated-union member. The resulting
|
|
@@ -3595,7 +3940,7 @@ declare class AxlStream extends Readable implements AsyncIterable<AxlEvent> {
|
|
|
3595
3940
|
/** Signal an error. `executionId` is required for the same reason as
|
|
3596
3941
|
* `_done`: terminal events must carry a real id even when the
|
|
3597
3942
|
* failure happens before any real trace event fires (review S4). */
|
|
3598
|
-
_error(error: Error, executionId: string): void;
|
|
3943
|
+
_error(error: Error, executionId: string, observerMessage?: string, observerName?: string): void;
|
|
3599
3944
|
/** Concatenated root-only text from committed attempts plus the
|
|
3600
3945
|
* current in-flight attempt(s). Retried (gate-rejected) attempts
|
|
3601
3946
|
* are excluded — see spec/16 §4.3. Reading mid-attempt returns the
|
|
@@ -3782,6 +4127,7 @@ declare class AxlRuntime extends EventEmitter {
|
|
|
3782
4127
|
private tools;
|
|
3783
4128
|
private agents;
|
|
3784
4129
|
private providerRegistry;
|
|
4130
|
+
private transcriptionProviderRegistry;
|
|
3785
4131
|
private stateStore;
|
|
3786
4132
|
private executions;
|
|
3787
4133
|
private pendingDecisionResolvers;
|
|
@@ -3974,6 +4320,8 @@ declare class AxlRuntime extends EventEmitter {
|
|
|
3974
4320
|
createContext(options?: CreateContextOptions): WorkflowContext;
|
|
3975
4321
|
/** Register a custom provider instance. */
|
|
3976
4322
|
registerProvider(name: string, provider: Provider): void;
|
|
4323
|
+
/** Register a dedicated transcription adapter. It is never used for chat. */
|
|
4324
|
+
registerTranscriptionProvider(name: string, provider: TranscriptionProvider): void;
|
|
3977
4325
|
/** Resolve a provider:model URI to a Provider instance and model name. */
|
|
3978
4326
|
resolveProvider(uri: string): {
|
|
3979
4327
|
provider: Provider;
|
|
@@ -4487,7 +4835,7 @@ declare function stringStreamFromEvents(source: AsyncIterable<AxlEvent>, opts?:
|
|
|
4487
4835
|
* tuple so exhaustiveness fixtures can cross-check against
|
|
4488
4836
|
* `AXL_EVENT_TYPES`.
|
|
4489
4837
|
*/
|
|
4490
|
-
declare const COST_BEARING_LEAF_TYPES: readonly ["agent_call_end", "tool_call_end", "memory_remember", "memory_recall"];
|
|
4838
|
+
declare const COST_BEARING_LEAF_TYPES: readonly ["agent_call_end", "tool_call_end", "memory_remember", "memory_recall", "transcription_end"];
|
|
4491
4839
|
/**
|
|
4492
4840
|
* True when an event reports a POSITIVE token count — i.e. it did measurable,
|
|
4493
4841
|
* billable work. This is the discriminator the unpriced-cost signal (T2.5) uses:
|
|
@@ -4506,6 +4854,18 @@ declare function hasPositiveTokens(event: {
|
|
|
4506
4854
|
cacheWrite?: number;
|
|
4507
4855
|
} | null;
|
|
4508
4856
|
}): boolean;
|
|
4857
|
+
/** Audio duration is independently billable work even when a provider exposes
|
|
4858
|
+
* no token count. Kept alongside token accounting so unpriced duration cannot
|
|
4859
|
+
* silently look like a free operation. */
|
|
4860
|
+
declare function hasPositiveBillableWork(event: {
|
|
4861
|
+
tokens?: Parameters<typeof hasPositiveTokens>[0]['tokens'];
|
|
4862
|
+
data?: {
|
|
4863
|
+
usage?: {
|
|
4864
|
+
audioSeconds?: number;
|
|
4865
|
+
totalTokens?: number;
|
|
4866
|
+
};
|
|
4867
|
+
} | null;
|
|
4868
|
+
}): boolean;
|
|
4509
4869
|
/**
|
|
4510
4870
|
* True when a cost value is usable for accounting: a finite, non-negative
|
|
4511
4871
|
* number. A NON-usable cost (`undefined`, `NaN`, `Infinity`, negative) on a
|
|
@@ -4635,39 +4995,6 @@ declare function getExecutionEventSchemaVersion(execution: {
|
|
|
4635
4995
|
*/
|
|
4636
4996
|
declare function normalizeStoredExecution(execution: HistoricalExecutionInfo): HistoricalExecutionInfo;
|
|
4637
4997
|
|
|
4638
|
-
/**
|
|
4639
|
-
* Per-variant redaction rules for `AxlEvent`.
|
|
4640
|
-
*
|
|
4641
|
-
* `config.trace.redact` is an observability-boundary filter that scrubs
|
|
4642
|
-
* user/LLM content from events before they reach consumers. Two layers
|
|
4643
|
-
* historically applied this filter independently:
|
|
4644
|
-
*
|
|
4645
|
-
* 1. Core: `WorkflowContext.emitEvent()` — emit-time scrub before `onTrace`.
|
|
4646
|
-
* 2. Studio: `redactStreamEvent()` — wire-boundary scrub before WS broadcast
|
|
4647
|
-
* and again at REST serialization (`redactExecutionInfo`).
|
|
4648
|
-
*
|
|
4649
|
-
* Both layers walked the same `AxlEvent` discriminated union, with separate
|
|
4650
|
-
* if/else and switch/case ladders. Adding a new variant required updating
|
|
4651
|
-
* both. They had drifted: WS missed `workflow_start`/`workflow_end`,
|
|
4652
|
-
* `log`, and the full `memory_*` walk that core applied. Defense-in-depth
|
|
4653
|
-
* also broke for runtimes that flipped `redact` after emitting events —
|
|
4654
|
-
* REST reads of stored `ExecutionInfo.events` would leak fields the WS
|
|
4655
|
-
* layer didn't know to scrub.
|
|
4656
|
-
*
|
|
4657
|
-
* `REDACTION_RULES` is the single source of truth: a `Record<AxlEventType,
|
|
4658
|
-
* RuleFor<...>>` so adding a new variant to `AXL_EVENT_TYPES` without a
|
|
4659
|
-
* corresponding entry is a typecheck error. Every rule is pure (no
|
|
4660
|
-
* mutation), so the same rule runs at emit time and at the wire boundary
|
|
4661
|
-
* with identical results.
|
|
4662
|
-
*
|
|
4663
|
-
* Numeric/structural fields (`cost`, `tokens`, `duration`, `askId`,
|
|
4664
|
-
* `parentAskId`, `depth`, `agent`, `executionId`, `step`, `timestamp`,
|
|
4665
|
-
* `callId`, `tool`, `model`, `workflow`) are NEVER scrubbed — they're
|
|
4666
|
-
* non-PII observability metadata and load-bearing for cost rails. Rules
|
|
4667
|
-
* preserve these by spreading `{ ...event }` and only overriding the
|
|
4668
|
-
* specific user-content field(s) for that variant.
|
|
4669
|
-
*/
|
|
4670
|
-
|
|
4671
4998
|
declare const REDACTED = "[redacted]";
|
|
4672
4999
|
type RuleFor<T extends AxlEventType> = (event: AxlEventOf<T>) => AxlEventOf<T>;
|
|
4673
5000
|
type V2ToolEventType = ToolLifecycleEventV2['type'];
|
|
@@ -4684,6 +5011,126 @@ declare const REDACTION_RULES: {
|
|
|
4684
5011
|
tool_call_rejected: V2ToolRule<"tool_call_rejected">;
|
|
4685
5012
|
workflow_start: RuleFor<"workflow_start">;
|
|
4686
5013
|
workflow_end: RuleFor<"workflow_end">;
|
|
5014
|
+
transcription_start: (e: AxlEventBase & {
|
|
5015
|
+
schemaVersion: 2;
|
|
5016
|
+
type: "transcription_start";
|
|
5017
|
+
transcriptionId: string;
|
|
5018
|
+
model?: string;
|
|
5019
|
+
data: {
|
|
5020
|
+
provider?: string;
|
|
5021
|
+
model?: string;
|
|
5022
|
+
audio: {
|
|
5023
|
+
source: string;
|
|
5024
|
+
bytes?: number;
|
|
5025
|
+
mediaType?: string;
|
|
5026
|
+
};
|
|
5027
|
+
};
|
|
5028
|
+
}) => AxlEventBase & {
|
|
5029
|
+
schemaVersion: 2;
|
|
5030
|
+
type: "transcription_start";
|
|
5031
|
+
transcriptionId: string;
|
|
5032
|
+
model?: string;
|
|
5033
|
+
data: {
|
|
5034
|
+
provider?: string;
|
|
5035
|
+
model?: string;
|
|
5036
|
+
audio: {
|
|
5037
|
+
source: string;
|
|
5038
|
+
bytes?: number;
|
|
5039
|
+
mediaType?: string;
|
|
5040
|
+
};
|
|
5041
|
+
};
|
|
5042
|
+
};
|
|
5043
|
+
transcription_end: (e: AxlEventBase & {
|
|
5044
|
+
schemaVersion: 2;
|
|
5045
|
+
type: "transcription_end";
|
|
5046
|
+
transcriptionId: string;
|
|
5047
|
+
model?: string;
|
|
5048
|
+
duration: number;
|
|
5049
|
+
cost?: number;
|
|
5050
|
+
tokens?: {
|
|
5051
|
+
input?: number;
|
|
5052
|
+
output?: number;
|
|
5053
|
+
};
|
|
5054
|
+
data: {
|
|
5055
|
+
status: "completed" | "failed" | "aborted";
|
|
5056
|
+
provider?: string;
|
|
5057
|
+
model?: string;
|
|
5058
|
+
audio?: {
|
|
5059
|
+
source: string;
|
|
5060
|
+
bytes?: number;
|
|
5061
|
+
mediaType?: string;
|
|
5062
|
+
};
|
|
5063
|
+
text?: string;
|
|
5064
|
+
usage?: {
|
|
5065
|
+
audioSeconds?: number;
|
|
5066
|
+
inputTokens?: number;
|
|
5067
|
+
outputTokens?: number;
|
|
5068
|
+
totalTokens?: number;
|
|
5069
|
+
cost?: number;
|
|
5070
|
+
};
|
|
5071
|
+
pricingStatus?: "priced" | "unpriced" | "zero";
|
|
5072
|
+
cleanupStatus?: "not_required" | "deleted" | "failed" | "timed_out";
|
|
5073
|
+
error?: string;
|
|
5074
|
+
errorCode?: "TRANSCRIPTION_PROVIDER_ERROR";
|
|
5075
|
+
providerError?: {
|
|
5076
|
+
status: number;
|
|
5077
|
+
retryable: boolean;
|
|
5078
|
+
retryAfterMs?: number;
|
|
5079
|
+
requestId?: string;
|
|
5080
|
+
};
|
|
5081
|
+
};
|
|
5082
|
+
}) => {
|
|
5083
|
+
data: {
|
|
5084
|
+
error?: string;
|
|
5085
|
+
text?: string;
|
|
5086
|
+
status: "completed" | "failed" | "aborted";
|
|
5087
|
+
provider?: string;
|
|
5088
|
+
model?: string;
|
|
5089
|
+
audio?: {
|
|
5090
|
+
source: string;
|
|
5091
|
+
bytes?: number;
|
|
5092
|
+
mediaType?: string;
|
|
5093
|
+
};
|
|
5094
|
+
usage?: {
|
|
5095
|
+
audioSeconds?: number;
|
|
5096
|
+
inputTokens?: number;
|
|
5097
|
+
outputTokens?: number;
|
|
5098
|
+
totalTokens?: number;
|
|
5099
|
+
cost?: number;
|
|
5100
|
+
};
|
|
5101
|
+
pricingStatus?: "priced" | "unpriced" | "zero";
|
|
5102
|
+
cleanupStatus?: "not_required" | "deleted" | "failed" | "timed_out";
|
|
5103
|
+
errorCode?: "TRANSCRIPTION_PROVIDER_ERROR";
|
|
5104
|
+
providerError?: {
|
|
5105
|
+
status: number;
|
|
5106
|
+
retryable: boolean;
|
|
5107
|
+
retryAfterMs?: number;
|
|
5108
|
+
requestId?: string;
|
|
5109
|
+
};
|
|
5110
|
+
};
|
|
5111
|
+
executionId: string;
|
|
5112
|
+
step: number;
|
|
5113
|
+
timestamp: number;
|
|
5114
|
+
workflow?: string;
|
|
5115
|
+
agent?: string;
|
|
5116
|
+
model?: string;
|
|
5117
|
+
promptVersion?: string;
|
|
5118
|
+
cost?: number;
|
|
5119
|
+
tokens?: ({
|
|
5120
|
+
input?: number;
|
|
5121
|
+
output?: number;
|
|
5122
|
+
reasoning?: number;
|
|
5123
|
+
cached?: number;
|
|
5124
|
+
cacheWrite?: number;
|
|
5125
|
+
} & {
|
|
5126
|
+
input?: number;
|
|
5127
|
+
output?: number;
|
|
5128
|
+
}) | undefined;
|
|
5129
|
+
duration: number;
|
|
5130
|
+
schemaVersion: 2;
|
|
5131
|
+
type: "transcription_end";
|
|
5132
|
+
transcriptionId: string;
|
|
5133
|
+
};
|
|
4687
5134
|
ask_start: RuleFor<"ask_start">;
|
|
4688
5135
|
ask_end: RuleFor<"ask_end">;
|
|
4689
5136
|
agent_call_start: RuleFor<"agent_call_start">;
|
|
@@ -4837,6 +5284,12 @@ declare class OpenAIProvider extends OpenAICompatibleProvider {
|
|
|
4837
5284
|
*/
|
|
4838
5285
|
declare class OpenAIResponsesProvider implements Provider {
|
|
4839
5286
|
readonly name = "openai-responses";
|
|
5287
|
+
inputCapabilities(model: string): {
|
|
5288
|
+
image?: {
|
|
5289
|
+
sources: readonly InputMediaSource['type'][];
|
|
5290
|
+
};
|
|
5291
|
+
};
|
|
5292
|
+
validateInput(request: ProviderInputValidationRequest): ProviderInputValidationResult;
|
|
4840
5293
|
/** The Responses API honors `json_schema` (structured outputs) natively. */
|
|
4841
5294
|
nativeStructuredOutputSupport(): 'schema';
|
|
4842
5295
|
private baseUrl;
|
|
@@ -4867,6 +5320,8 @@ declare class OpenAIResponsesProvider implements Provider {
|
|
|
4867
5320
|
*/
|
|
4868
5321
|
private mapResponseFormat;
|
|
4869
5322
|
private parseResponse;
|
|
5323
|
+
/** Responses usage does not report a media-inclusive price, so rich calls stay unpriced. */
|
|
5324
|
+
private requestContainsImages;
|
|
4870
5325
|
private parseSSEStream;
|
|
4871
5326
|
private handleStreamEvent;
|
|
4872
5327
|
private extractErrorMessage;
|
|
@@ -4887,6 +5342,12 @@ declare class OpenAIResponsesProvider implements Provider {
|
|
|
4887
5342
|
*/
|
|
4888
5343
|
declare class AnthropicProvider implements Provider {
|
|
4889
5344
|
readonly name = "anthropic";
|
|
5345
|
+
inputCapabilities(model: string): {
|
|
5346
|
+
image?: {
|
|
5347
|
+
sources: readonly InputMediaSource['type'][];
|
|
5348
|
+
};
|
|
5349
|
+
};
|
|
5350
|
+
validateInput(request: ProviderInputValidationRequest): ProviderInputValidationResult;
|
|
4890
5351
|
/** Anthropic ignores native `json_schema` structurally — Axl uses a system
|
|
4891
5352
|
* prompt JSON instruction + client-side Zod validation (see buildRequest). */
|
|
4892
5353
|
nativeStructuredOutputSupport(): 'unsupported';
|
|
@@ -4957,6 +5418,12 @@ declare class AnthropicProvider implements Provider {
|
|
|
4957
5418
|
*/
|
|
4958
5419
|
declare class GeminiProvider implements Provider {
|
|
4959
5420
|
readonly name = "google";
|
|
5421
|
+
inputCapabilities(model: string): {
|
|
5422
|
+
image?: {
|
|
5423
|
+
sources: readonly InputMediaSource['type'][];
|
|
5424
|
+
};
|
|
5425
|
+
};
|
|
5426
|
+
validateInput(request: ProviderInputValidationRequest): ProviderInputValidationResult;
|
|
4960
5427
|
/** Gemini accepts a `responseSchema` but `sanitizeSchemaForGemini` strips
|
|
4961
5428
|
* keywords it doesn't support (`$ref`/`$defs`/`additionalProperties`/…), so a
|
|
4962
5429
|
* derived schema can lose constraints — lossy, not faithful. */
|
|
@@ -4975,6 +5442,14 @@ declare class GeminiProvider implements Provider {
|
|
|
4975
5442
|
private resolveKey;
|
|
4976
5443
|
chat(messages: ChatMessage[], options: ChatOptions): Promise<ProviderResponse>;
|
|
4977
5444
|
stream(messages: ChatMessage[], options: ChatOptions): AsyncGenerator<StreamChunk>;
|
|
5445
|
+
private chatInteraction;
|
|
5446
|
+
private streamInteraction;
|
|
5447
|
+
private buildInteractionRequestBody;
|
|
5448
|
+
private assertSafeInteractionOptions;
|
|
5449
|
+
private mapInteractionInput;
|
|
5450
|
+
private parseInteractionResponse;
|
|
5451
|
+
private parseInteractionSSEStream;
|
|
5452
|
+
private assertInteractionTerminalStatus;
|
|
4978
5453
|
private buildHeaders;
|
|
4979
5454
|
private extractErrorMessage;
|
|
4980
5455
|
private pricingContext;
|
|
@@ -5126,6 +5601,64 @@ declare const SGLANG_PROFILE: ProviderProfile;
|
|
|
5126
5601
|
*/
|
|
5127
5602
|
declare const BUILTIN_PROFILES: ProviderProfile[];
|
|
5128
5603
|
|
|
5604
|
+
declare class OpenAITranscriptionProvider implements TranscriptionProvider {
|
|
5605
|
+
readonly name = "openai-transcription";
|
|
5606
|
+
private readonly baseUrl;
|
|
5607
|
+
private readonly apiKeySource;
|
|
5608
|
+
private readonly governor?;
|
|
5609
|
+
constructor(options?: {
|
|
5610
|
+
apiKey?: ApiKeySource;
|
|
5611
|
+
baseUrl?: string;
|
|
5612
|
+
dangerouslyAllowInsecureHttp?: boolean;
|
|
5613
|
+
rateLimit?: RateLimitConfig;
|
|
5614
|
+
});
|
|
5615
|
+
capabilities(model: string): TranscriptionCapabilities | undefined;
|
|
5616
|
+
transcribe(request: TranscriptionProviderRequest): Promise<TranscriptionProviderResult>;
|
|
5617
|
+
private resolveKey;
|
|
5618
|
+
}
|
|
5619
|
+
|
|
5620
|
+
declare class GeminiTranscriptionProvider implements TranscriptionProvider {
|
|
5621
|
+
readonly name = "gemini-transcription";
|
|
5622
|
+
private readonly baseUrl;
|
|
5623
|
+
private readonly apiKeySource;
|
|
5624
|
+
private readonly governor?;
|
|
5625
|
+
constructor(options?: {
|
|
5626
|
+
apiKey?: ApiKeySource;
|
|
5627
|
+
baseUrl?: string;
|
|
5628
|
+
dangerouslyAllowInsecureHttp?: boolean;
|
|
5629
|
+
rateLimit?: RateLimitConfig;
|
|
5630
|
+
});
|
|
5631
|
+
capabilities(model: string): TranscriptionCapabilities | undefined;
|
|
5632
|
+
transcribe(request: TranscriptionProviderRequest): Promise<TranscriptionProviderResult>;
|
|
5633
|
+
private transcribeReference;
|
|
5634
|
+
private transcribeUpload;
|
|
5635
|
+
/** A finalization response with a name creates a caller-owned cleanup obligation
|
|
5636
|
+
* even when its URI/state is malformed. `transcribeUpload` stores the name before
|
|
5637
|
+
* strictly parsing the rest of the file representation. */
|
|
5638
|
+
private upload;
|
|
5639
|
+
private waitForReady;
|
|
5640
|
+
private infer;
|
|
5641
|
+
private fileFromJson;
|
|
5642
|
+
private cleanup;
|
|
5643
|
+
private resolveKey;
|
|
5644
|
+
}
|
|
5645
|
+
|
|
5646
|
+
declare class OpenRouterTranscriptionProvider implements TranscriptionProvider {
|
|
5647
|
+
readonly name = "openrouter-transcription";
|
|
5648
|
+
private readonly baseUrl;
|
|
5649
|
+
private readonly apiKeySource;
|
|
5650
|
+
private readonly governor?;
|
|
5651
|
+
constructor(options?: {
|
|
5652
|
+
apiKey?: ApiKeySource;
|
|
5653
|
+
baseUrl?: string;
|
|
5654
|
+
dangerouslyAllowInsecureHttp?: boolean;
|
|
5655
|
+
rateLimit?: RateLimitConfig;
|
|
5656
|
+
});
|
|
5657
|
+
capabilities(model: string): TranscriptionCapabilities | undefined;
|
|
5658
|
+
transcribe(request: TranscriptionProviderRequest): Promise<TranscriptionProviderResult>;
|
|
5659
|
+
private resolveKey;
|
|
5660
|
+
}
|
|
5661
|
+
|
|
5129
5662
|
/**
|
|
5130
5663
|
* In-memory implementation of StateStore.
|
|
5131
5664
|
* Fast for development and testing, but lost on process restart.
|
|
@@ -5576,4 +6109,4 @@ declare class NoopSpanManager implements SpanManager {
|
|
|
5576
6109
|
*/
|
|
5577
6110
|
declare function createSpanManager(config?: TelemetryConfig): Promise<SpanManager>;
|
|
5578
6111
|
|
|
5579
|
-
export { AXL_EVENT_TYPES, AXL_EVENT_TYPES_V2, AXL_TOOL_LIFECYCLE_TYPES_V2, AZURE_PROFILE, type Agent, type AgentCallEndData, type AgentCallInfo, type AgentCallParams, type AgentCallStartData, type AgentConfig, AnthropicProvider, type AnyWorkflow, type ApiKeySource, type AskOptions, type AskScoped, type AuthHeader, type AwaitHumanData, type AwaitHumanOptions, type AwaitHumanResolvedData, type AxlConfig, AxlError, type AxlEvent, type AxlEventBase, AxlEventBus, type AxlEventOf, type AxlEventType, type AxlEventV2, type AxlEventV2Of, AxlRuntime, AxlStream, BEDROCK_PROFILE, BUILTIN_PROFILES, BudgetExceededError, type BudgetOptions, type BudgetResult, CONFIG_CANDIDATES, COST_BEARING_LEAF_TYPES, type CapabilityFlags, type ChatMessage, type ChatOptions, type CheckpointEventData, type CoalescedPartialObject, type CreateContextOptions, DEEPSEEK_PROFILE, type DecisionCleanupFailedEvent, type DelegateData, type DelegateOptions, type Effort, type EmbedResult, type EmbedUsage, type Embedder, type EvalExecuteWorkflow, type EvalHistoryEntry, type EventStreamOptions, EventStreamOverflowError, type ExecuteOptions, type ExecutionInfo, type ExecutionInfoV1, type ExecutionInfoV2, type ExecutionState, GROQ_PROFILE, GeminiProvider, type GuardrailBlockHandler, type GuardrailData, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HandoffReturnData, type HandoffStartData, type HistoricalAxlEvent, type HistoricalExecutionInfo, type HumanDecision, InMemoryVectorStore, type InputGuardrail, LLAMACPP_PROFILE, LMSTUDIO_PROFILE, type LegacyAxlEventV1, type LegacyExecutionInfoV1, MISTRAL_PROFILE, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, type MemoryEventData, MemoryManager, MemoryStore, NoConsensus, NoopSpanManager, OLLAMA_PROFILE, OPENAI_PRICING, OPENAI_PROFILE, OPENROUTER_PROFILE, type ObservationStatus, type OpenAICompatibleOptions, OpenAICompatibleProvider, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, type OutputGuardrail, type OutputValidator, type PendingDecision, type PerModel, type PricingSource, type PricingTable, type Provider, type ProviderAdapter, ProviderError, type ProviderProfile, ProviderRegistry, type ProviderResponse, QuorumNotMet, REDACTED, REDACTION_RULES, type RaceOptions, type RateLimitConfig, RateLimiter, type ReasoningCapture, type ReasoningEmit, type ReasoningProfile, type ReasoningRoundTrip, type RecallOptions, type RecallResult, RedisStore, type RememberOptions, type RememberResult, type ResolvedThinkingOptions, type Result, type RetryPolicy, SGLANG_PROFILE, SQLiteStore, type SchemaCheckData, type SchemaDiagnosticData, type SchemaPromptOption, Session, type SessionOptions, type SpanHandle, type SpanManager, type SpawnOptions, SqliteVectorStore, type StateStore, type StreamChunk, type StringDeltaData, type StringStreamEvent, type StringStreamFilter, type TelemetryConfig, ThinkTagScanner, TimeoutError, type Tool, type ToolApprovalData, type ToolArgumentIssue, type ToolCallCancellation, type ToolCallData, type ToolCallEndData, type ToolCallFailure, type ToolCallMessage, type ToolCallOutcome, type ToolCallRejectedData, type ToolCallRejectedEvent, type ToolCallStartData, type ToolCallStartDataV2, type ToolChoice, type ToolConfig, type ToolDeniedData, type ToolEventError, ToolFailure, type ToolFailureConstructor, type ToolFailureOptions, type ToolHooks, type ToolLifecycleEventV2, type ToolModelOutput, ToolModelOutputError, UnsupportedEventSchemaVersionError, VLLM_PROFILE, type ValidateData, type ValidateResult, ValidationError, type VectorEntry, type VectorResult, type VectorStore, type VerifyData, VerifyError, type VerifyOptions, type VerifyRetry, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, type WorkflowEndData, type WorkflowStartData, XAI_PROFILE, agent, createSpanManager, defineConfig, estimateOpenAICost, eventCostContribution, expandGlob, extractJson, extractThinkTags, findConfig, getEventSchemaVersion, getExecutionEventSchemaVersion, hasPositiveTokens, importModule, isCostBearingLeaf, isRetryableStatus, isRootLevel, isUnpricedLeaf, isUsableCost, needsTsxLoader, normalizeStoredExecution, openaiReasoningEmit, parsePartialJson, pickDefault, pickExport, priceFromTable, reasoningEffortEmit, reasoningObjectEmit, redactEvent, redactHistoricalEvent, registerConditions, resolveApiKey, resolvePerModel, resolveRuntime, resolveThinkingOptions, stringStreamFromEvents, tool, workflow, zodToJsonSchema };
|
|
6112
|
+
export { AXL_EVENT_TYPES, AXL_EVENT_TYPES_V2, AXL_TOOL_LIFECYCLE_TYPES_V2, AZURE_PROFILE, type Agent, type AgentCallEndData, type AgentCallInfo, type AgentCallParams, type AgentCallStartData, type AgentConfig, AnthropicProvider, type AnyWorkflow, type ApiKeySource, type AskOptions, type AskScoped, type AuthHeader, type AwaitHumanData, type AwaitHumanOptions, type AwaitHumanResolvedData, type AxlConfig, AxlError, type AxlEvent, type AxlEventBase, AxlEventBus, type AxlEventOf, type AxlEventType, type AxlEventV2, type AxlEventV2Of, AxlRuntime, AxlStream, BEDROCK_PROFILE, BUILTIN_PROFILES, BudgetExceededError, type BudgetOptions, type BudgetResult, CONFIG_CANDIDATES, COST_BEARING_LEAF_TYPES, type CapabilityFlags, type ChatMessage, type ChatOptions, type CheckpointEventData, type CoalescedPartialObject, type CreateContextOptions, DEEPSEEK_PROFILE, type DecisionCleanupFailedEvent, type DelegateData, type DelegateOptions, type Effort, type EmbedResult, type EmbedUsage, type Embedder, type EvalExecuteWorkflow, type EvalHistoryEntry, type EventStreamOptions, EventStreamOverflowError, type ExecuteOptions, type ExecutionInfo, type ExecutionInfoV1, type ExecutionInfoV2, type ExecutionState, GROQ_PROFILE, GeminiProvider, GeminiTranscriptionProvider, type GuardrailBlockHandler, type GuardrailData, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HandoffReturnData, type HandoffStartData, type HistoricalAxlEvent, type HistoricalExecutionInfo, type HumanDecision, InMemoryVectorStore, type InputContentPart, type InputGuardrail, type InputImagePart, type InputMediaSource, type InputModalitySupport, type InputTextPart, InvalidModelInputError, InvalidTranscriptionInputError, LLAMACPP_PROFILE, LMSTUDIO_PROFILE, type LegacyAxlEventV1, type LegacyExecutionInfoV1, MAX_INLINE_MODEL_INPUT_BYTES, MAX_INLINE_TRANSCRIPTION_BYTES, MISTRAL_PROFILE, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, type MemoryEventData, MemoryManager, MemoryStore, type ModelInput, type ModelInputDescriptor, NoConsensus, NoopSpanManager, OLLAMA_PROFILE, OPENAI_PRICING, OPENAI_PROFILE, OPENROUTER_PROFILE, type ObservationStatus, type OpenAICompatibleOptions, OpenAICompatibleProvider, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, OpenAITranscriptionProvider, OpenRouterTranscriptionProvider, type OutputGuardrail, type OutputValidator, type PendingDecision, type PerModel, type PricingSource, type PricingTable, type Provider, type ProviderAdapter, ProviderError, type ProviderInputValidationRequest, type ProviderInputValidationResult, type ProviderProfile, ProviderRegistry, type ProviderResponse, QuorumNotMet, REDACTED, REDACTION_RULES, type RaceOptions, type RateLimitConfig, RateLimiter, type ReasoningCapture, type ReasoningEmit, type ReasoningProfile, type ReasoningRoundTrip, type RecallOptions, type RecallResult, type RecordedAudioSource, RedisStore, type RememberOptions, type RememberResult, type ResolvedThinkingOptions, type Result, type RetryPolicy, SGLANG_PROFILE, SQLiteStore, type SchemaCheckData, type SchemaDiagnosticData, type SchemaPromptOption, Session, type SessionOptions, type SpanHandle, type SpanManager, type SpawnOptions, SqliteVectorStore, type StateStore, type StreamChunk, type StringDeltaData, type StringStreamEvent, type StringStreamFilter, type TelemetryConfig, ThinkTagScanner, TimeoutError, type Tool, type ToolApprovalData, type ToolArgumentIssue, type ToolCallCancellation, type ToolCallData, type ToolCallEndData, type ToolCallFailure, type ToolCallMessage, type ToolCallOutcome, type ToolCallRejectedData, type ToolCallRejectedEvent, type ToolCallStartData, type ToolCallStartDataV2, type ToolChoice, type ToolConfig, type ToolDeniedData, type ToolEventError, ToolFailure, type ToolFailureConstructor, type ToolFailureOptions, type ToolHooks, type ToolLifecycleEventV2, type ToolModelOutput, ToolModelOutputError, type Transcript, type TranscriptionCapabilities, TranscriptionOperationError, type TranscriptionProvider, TranscriptionProviderRegistry, type TranscriptionProviderRequest, type TranscriptionProviderResult, type TranscriptionRequest, UnsupportedEventSchemaVersionError, UnsupportedModelInputError, UnsupportedTranscriptionInputError, VLLM_PROFILE, type ValidateData, type ValidateResult, ValidationError, type VectorEntry, type VectorResult, type VectorStore, type VerifyData, VerifyError, type VerifyOptions, type VerifyRetry, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, type WorkflowEndData, type WorkflowStartData, XAI_PROFILE, agent, createSpanManager, defineConfig, estimateOpenAICost, eventCostContribution, expandGlob, extractJson, extractThinkTags, findConfig, getEventSchemaVersion, getExecutionEventSchemaVersion, hasPositiveBillableWork, hasPositiveTokens, importModule, inputText, isCostBearingLeaf, isRetryableStatus, isRootLevel, isUnpricedLeaf, isUsableCost, needsTsxLoader, normalizeStoredExecution, openaiReasoningEmit, parsePartialJson, pickDefault, pickExport, priceFromTable, reasoningEffortEmit, reasoningObjectEmit, redactEvent, redactHistoricalEvent, registerConditions, resolveApiKey, resolvePerModel, resolveRuntime, resolveThinkingOptions, stringStreamFromEvents, tool, workflow, zodToJsonSchema };
|