@fifthrevision/axle 0.9.0 → 0.10.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 +23 -8
- package/dist/index.d.mts +1173 -0
- package/dist/index.mjs +38 -0
- package/package.json +15 -13
- package/dist/ProceduralMemory-BtEMO_Cx.js +0 -59
- package/dist/cli.js +0 -8
- package/dist/index.d.ts +0 -953
- package/dist/index.js +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1173 @@
|
|
|
1
|
+
import * as z$2 from "zod";
|
|
2
|
+
import { ZodObject, z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
interface Stats {
|
|
6
|
+
in: number;
|
|
7
|
+
out: number;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/messages/stream.d.ts
|
|
11
|
+
interface StreamChunk {
|
|
12
|
+
type: "start" | "text-start" | "text-delta" | "text-complete" | "tool-call-start" | "tool-call-complete" | "thinking-start" | "thinking-delta" | "thinking-summary-delta" | "thinking-complete" | "internal-tool-start" | "internal-tool-complete" | "complete" | "error";
|
|
13
|
+
id?: string;
|
|
14
|
+
data?: any;
|
|
15
|
+
}
|
|
16
|
+
interface StreamStartChunk extends StreamChunk {
|
|
17
|
+
type: "start";
|
|
18
|
+
id: string;
|
|
19
|
+
data: {
|
|
20
|
+
model: string;
|
|
21
|
+
timestamp: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface StreamCompleteChunk extends StreamChunk {
|
|
25
|
+
type: "complete";
|
|
26
|
+
data: {
|
|
27
|
+
finishReason: AxleStopReason;
|
|
28
|
+
usage: Stats;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface StreamErrorChunk extends StreamChunk {
|
|
32
|
+
type: "error";
|
|
33
|
+
data: {
|
|
34
|
+
type: string;
|
|
35
|
+
message: string;
|
|
36
|
+
usage?: Stats;
|
|
37
|
+
raw?: any;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
interface StreamTextStartChunk extends StreamChunk {
|
|
41
|
+
type: "text-start";
|
|
42
|
+
data: {
|
|
43
|
+
index: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
interface StreamTextDeltaChunk extends StreamChunk {
|
|
47
|
+
type: "text-delta";
|
|
48
|
+
data: {
|
|
49
|
+
index: number;
|
|
50
|
+
text: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
interface StreamTextCompleteChunk extends StreamChunk {
|
|
54
|
+
type: "text-complete";
|
|
55
|
+
data: {
|
|
56
|
+
index: number;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
interface StreamThinkingStartChunk extends StreamChunk {
|
|
60
|
+
type: "thinking-start";
|
|
61
|
+
data: {
|
|
62
|
+
index: number;
|
|
63
|
+
id?: string;
|
|
64
|
+
redacted?: boolean;
|
|
65
|
+
signature?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
interface StreamThinkingDeltaChunk extends StreamChunk {
|
|
69
|
+
type: "thinking-delta";
|
|
70
|
+
data: {
|
|
71
|
+
index: number;
|
|
72
|
+
text: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
interface StreamThinkingSummaryDeltaChunk extends StreamChunk {
|
|
76
|
+
type: "thinking-summary-delta";
|
|
77
|
+
data: {
|
|
78
|
+
index: number;
|
|
79
|
+
text: string;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
interface StreamThinkingCompleteChunk extends StreamChunk {
|
|
83
|
+
type: "thinking-complete";
|
|
84
|
+
data: {
|
|
85
|
+
index: number;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
interface StreamToolCallStartChunk extends StreamChunk {
|
|
89
|
+
type: "tool-call-start";
|
|
90
|
+
data: {
|
|
91
|
+
index: number;
|
|
92
|
+
id: string;
|
|
93
|
+
name: string;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
interface StreamToolCallCompleteChunk extends StreamChunk {
|
|
97
|
+
type: "tool-call-complete";
|
|
98
|
+
data: {
|
|
99
|
+
index: number;
|
|
100
|
+
id: string;
|
|
101
|
+
name: string;
|
|
102
|
+
arguments: any;
|
|
103
|
+
providerMetadata?: Record<string, unknown>;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
interface StreamInternalToolStartChunk extends StreamChunk {
|
|
107
|
+
type: "internal-tool-start";
|
|
108
|
+
data: {
|
|
109
|
+
index: number;
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
interface StreamInternalToolCompleteChunk extends StreamChunk {
|
|
115
|
+
type: "internal-tool-complete";
|
|
116
|
+
data: {
|
|
117
|
+
index: number;
|
|
118
|
+
id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
output?: unknown;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
type AnyStreamChunk = StreamStartChunk | StreamCompleteChunk | StreamErrorChunk | StreamTextStartChunk | StreamTextDeltaChunk | StreamTextCompleteChunk | StreamThinkingStartChunk | StreamThinkingDeltaChunk | StreamThinkingSummaryDeltaChunk | StreamThinkingCompleteChunk | StreamToolCallStartChunk | StreamToolCallCompleteChunk | StreamInternalToolStartChunk | StreamInternalToolCompleteChunk;
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/tracer/types.d.ts
|
|
126
|
+
type SpanStatus = "ok" | "error";
|
|
127
|
+
type EventLevel = "debug" | "info" | "warn" | "error";
|
|
128
|
+
type SpanType = string;
|
|
129
|
+
interface SpanEvent {
|
|
130
|
+
name: string;
|
|
131
|
+
timestamp: number;
|
|
132
|
+
level: EventLevel;
|
|
133
|
+
attributes?: Record<string, unknown>;
|
|
134
|
+
}
|
|
135
|
+
interface SpanData {
|
|
136
|
+
traceId: string;
|
|
137
|
+
spanId: string;
|
|
138
|
+
parentSpanId?: string;
|
|
139
|
+
name: string;
|
|
140
|
+
type?: SpanType;
|
|
141
|
+
startTime: number;
|
|
142
|
+
endTime?: number;
|
|
143
|
+
status: SpanStatus;
|
|
144
|
+
attributes: Record<string, unknown>;
|
|
145
|
+
events: SpanEvent[];
|
|
146
|
+
result?: SpanResult;
|
|
147
|
+
}
|
|
148
|
+
interface SpanOptions {
|
|
149
|
+
type?: SpanType;
|
|
150
|
+
}
|
|
151
|
+
type SpanResult = LLMResult | ToolResult;
|
|
152
|
+
interface LLMResult {
|
|
153
|
+
kind: "llm";
|
|
154
|
+
model: string;
|
|
155
|
+
request: LLMRequest;
|
|
156
|
+
response: LLMResponse;
|
|
157
|
+
usage?: TokenUsage;
|
|
158
|
+
finishReason?: string;
|
|
159
|
+
}
|
|
160
|
+
interface LLMRequest {
|
|
161
|
+
messages: unknown[];
|
|
162
|
+
system?: string;
|
|
163
|
+
tools?: unknown[];
|
|
164
|
+
}
|
|
165
|
+
interface LLMResponse {
|
|
166
|
+
content: unknown;
|
|
167
|
+
}
|
|
168
|
+
interface TokenUsage {
|
|
169
|
+
inputTokens?: number;
|
|
170
|
+
outputTokens?: number;
|
|
171
|
+
totalTokens?: number;
|
|
172
|
+
}
|
|
173
|
+
interface ToolResult {
|
|
174
|
+
kind: "tool";
|
|
175
|
+
name: string;
|
|
176
|
+
input: unknown;
|
|
177
|
+
output: unknown;
|
|
178
|
+
}
|
|
179
|
+
interface TraceWriter {
|
|
180
|
+
onSpanStart(span: SpanData): void;
|
|
181
|
+
onSpanUpdate?(span: SpanData): void;
|
|
182
|
+
onSpanEnd(span: SpanData): void;
|
|
183
|
+
onEvent?(span: SpanData, event: SpanEvent): void;
|
|
184
|
+
flush?(): Promise<void>;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Tracing context for a span. Created by Tracer.startSpan().
|
|
188
|
+
* Can create child spans and log events within the span's scope.
|
|
189
|
+
*/
|
|
190
|
+
interface TracingContext {
|
|
191
|
+
startSpan(name: string, options?: SpanOptions): TracingContext;
|
|
192
|
+
end(status?: SpanStatus): void;
|
|
193
|
+
debug(message: string, attributes?: Record<string, unknown>): void;
|
|
194
|
+
info(message: string, attributes?: Record<string, unknown>): void;
|
|
195
|
+
warn(message: string, attributes?: Record<string, unknown>): void;
|
|
196
|
+
error(message: string, attributes?: Record<string, unknown>): void;
|
|
197
|
+
setAttribute(key: string, value: unknown): void;
|
|
198
|
+
setAttributes(attributes: Record<string, unknown>): void;
|
|
199
|
+
setResult(result: SpanResult): void;
|
|
200
|
+
}
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/providers/types.d.ts
|
|
203
|
+
interface AIProvider {
|
|
204
|
+
get name(): string;
|
|
205
|
+
/** @internal */
|
|
206
|
+
createGenerationRequest(model: string, params: {
|
|
207
|
+
messages: Array<AxleMessage>;
|
|
208
|
+
system?: string;
|
|
209
|
+
tools?: Array<ToolDefinition>;
|
|
210
|
+
context: {
|
|
211
|
+
tracer?: TracingContext;
|
|
212
|
+
};
|
|
213
|
+
options?: {
|
|
214
|
+
temperature?: number;
|
|
215
|
+
top_p?: number;
|
|
216
|
+
max_tokens?: number;
|
|
217
|
+
frequency_penalty?: number;
|
|
218
|
+
presence_penalty?: number;
|
|
219
|
+
stop?: string | string[];
|
|
220
|
+
[key: string]: any;
|
|
221
|
+
};
|
|
222
|
+
}): Promise<ModelResult>;
|
|
223
|
+
/** @internal */
|
|
224
|
+
createStreamingRequest?(model: string, params: {
|
|
225
|
+
messages: Array<AxleMessage>;
|
|
226
|
+
system?: string;
|
|
227
|
+
tools?: Array<ToolDefinition>;
|
|
228
|
+
context: {
|
|
229
|
+
tracer?: TracingContext;
|
|
230
|
+
};
|
|
231
|
+
signal?: AbortSignal;
|
|
232
|
+
options?: {
|
|
233
|
+
temperature?: number;
|
|
234
|
+
top_p?: number;
|
|
235
|
+
max_tokens?: number;
|
|
236
|
+
frequency_penalty?: number;
|
|
237
|
+
presence_penalty?: number;
|
|
238
|
+
stop?: string | string[];
|
|
239
|
+
[key: string]: any;
|
|
240
|
+
};
|
|
241
|
+
}): AsyncGenerator<AnyStreamChunk, void, unknown>;
|
|
242
|
+
}
|
|
243
|
+
interface ModelResponse {
|
|
244
|
+
type: "success";
|
|
245
|
+
role: "assistant";
|
|
246
|
+
id: string;
|
|
247
|
+
model: string;
|
|
248
|
+
text: string;
|
|
249
|
+
content: Array<ContentPartText | ContentPartThinking | ContentPartToolCall>;
|
|
250
|
+
finishReason: AxleStopReason;
|
|
251
|
+
usage: Stats;
|
|
252
|
+
raw: any;
|
|
253
|
+
}
|
|
254
|
+
interface ModelError {
|
|
255
|
+
type: "error";
|
|
256
|
+
error: {
|
|
257
|
+
type: string;
|
|
258
|
+
message: string;
|
|
259
|
+
};
|
|
260
|
+
usage?: Stats;
|
|
261
|
+
raw?: any;
|
|
262
|
+
}
|
|
263
|
+
type ModelResult = ModelResponse | ModelError;
|
|
264
|
+
declare enum AxleStopReason {
|
|
265
|
+
Stop = "stop",
|
|
266
|
+
Length = "length",
|
|
267
|
+
FunctionCall = "function_call",
|
|
268
|
+
Error = "error",
|
|
269
|
+
Custom = "custom",
|
|
270
|
+
Cancelled = "cancelled"
|
|
271
|
+
}
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/utils/file.d.ts
|
|
274
|
+
interface FileInfo {
|
|
275
|
+
path: string;
|
|
276
|
+
base64?: string;
|
|
277
|
+
content?: string;
|
|
278
|
+
mimeType: string;
|
|
279
|
+
size: number;
|
|
280
|
+
name: string;
|
|
281
|
+
type: "image" | "document" | "text";
|
|
282
|
+
}
|
|
283
|
+
type TextFileInfo = FileInfo & {
|
|
284
|
+
content: string;
|
|
285
|
+
base64?: never;
|
|
286
|
+
type: "text";
|
|
287
|
+
};
|
|
288
|
+
type Base64FileInfo = FileInfo & {
|
|
289
|
+
base64: string;
|
|
290
|
+
content?: never;
|
|
291
|
+
type: "image" | "document";
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Load a file with the specified encoding or auto-detect based on file extension
|
|
295
|
+
* @param filePath - Path to the file
|
|
296
|
+
* @param encoding - How to load the file: "utf-8" for text, "base64" for binary, or omit for auto-detection
|
|
297
|
+
* @returns FileInfo object with appropriate content based on encoding
|
|
298
|
+
*/
|
|
299
|
+
declare function loadFileContent(filePath: string): Promise<FileInfo>;
|
|
300
|
+
declare function loadFileContent(filePath: string, encoding: "utf-8"): Promise<TextFileInfo>;
|
|
301
|
+
declare function loadFileContent(filePath: string, encoding: "base64"): Promise<Base64FileInfo>;
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/messages/message.d.ts
|
|
304
|
+
type AxleMessage = AxleUserMessage | AxleAssistantMessage | AxleToolCallMessage;
|
|
305
|
+
interface AxleUserMessage {
|
|
306
|
+
role: "user";
|
|
307
|
+
id?: string;
|
|
308
|
+
name?: string;
|
|
309
|
+
content: string | Array<ContentPart>;
|
|
310
|
+
}
|
|
311
|
+
interface AxleAssistantMessage {
|
|
312
|
+
role: "assistant";
|
|
313
|
+
id: string;
|
|
314
|
+
model?: string;
|
|
315
|
+
content: Array<ContentPartText | ContentPartThinking | ContentPartToolCall | ContentPartInternalTool>;
|
|
316
|
+
finishReason?: AxleStopReason;
|
|
317
|
+
}
|
|
318
|
+
interface AxleToolCallMessage {
|
|
319
|
+
role: "tool";
|
|
320
|
+
id: string;
|
|
321
|
+
content: Array<AxleToolCallResult>;
|
|
322
|
+
}
|
|
323
|
+
type ToolResultPart = {
|
|
324
|
+
type: "text";
|
|
325
|
+
text: string;
|
|
326
|
+
} | {
|
|
327
|
+
type: "image";
|
|
328
|
+
data: string;
|
|
329
|
+
mimeType: string;
|
|
330
|
+
};
|
|
331
|
+
interface AxleToolCallResult {
|
|
332
|
+
id: string;
|
|
333
|
+
name: string;
|
|
334
|
+
content: string | ToolResultPart[];
|
|
335
|
+
isError?: boolean;
|
|
336
|
+
}
|
|
337
|
+
type ContentPart = ContentPartText | ContentPartFile | ContentPartToolCall | ContentPartThinking | ContentPartInternalTool;
|
|
338
|
+
interface ContentPartText {
|
|
339
|
+
type: "text";
|
|
340
|
+
text: string;
|
|
341
|
+
}
|
|
342
|
+
interface ContentPartFile {
|
|
343
|
+
type: "file";
|
|
344
|
+
file: FileInfo;
|
|
345
|
+
}
|
|
346
|
+
interface ContentPartThinking {
|
|
347
|
+
type: "thinking";
|
|
348
|
+
id?: string;
|
|
349
|
+
text: string;
|
|
350
|
+
summary?: string;
|
|
351
|
+
redacted?: boolean;
|
|
352
|
+
encrypted?: string;
|
|
353
|
+
signature?: string;
|
|
354
|
+
}
|
|
355
|
+
interface ContentPartToolCall {
|
|
356
|
+
type: "tool-call";
|
|
357
|
+
id: string;
|
|
358
|
+
name: string;
|
|
359
|
+
parameters: Record<string, unknown>;
|
|
360
|
+
providerMetadata?: Record<string, unknown>;
|
|
361
|
+
}
|
|
362
|
+
interface ContentPartInternalTool {
|
|
363
|
+
type: "internal-tool";
|
|
364
|
+
id: string;
|
|
365
|
+
name: string;
|
|
366
|
+
input?: unknown;
|
|
367
|
+
output?: unknown;
|
|
368
|
+
}
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/tools/types.d.ts
|
|
371
|
+
interface ExecutableTool<TSchema extends ZodObject<any> = ZodObject<any>> {
|
|
372
|
+
type?: "function";
|
|
373
|
+
name: string;
|
|
374
|
+
description: string;
|
|
375
|
+
schema: TSchema;
|
|
376
|
+
execute(input: z.infer<TSchema>): Promise<string | ToolResultPart[]>;
|
|
377
|
+
configure?(config: Record<string, any>): void;
|
|
378
|
+
summarize?(input: z.infer<TSchema>): string;
|
|
379
|
+
}
|
|
380
|
+
interface ServerTool {
|
|
381
|
+
type: "server";
|
|
382
|
+
name: string;
|
|
383
|
+
config?: Record<string, unknown>;
|
|
384
|
+
}
|
|
385
|
+
type AxleTool = ExecutableTool | ServerTool;
|
|
386
|
+
type ToolDefinition = Pick<ExecutableTool, "name" | "description" | "schema">;
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/mcp/MCP.d.ts
|
|
389
|
+
interface MCPStdioConfig {
|
|
390
|
+
transport: "stdio";
|
|
391
|
+
name?: string;
|
|
392
|
+
command: string;
|
|
393
|
+
args?: string[];
|
|
394
|
+
env?: Record<string, string>;
|
|
395
|
+
}
|
|
396
|
+
interface MCPHttpConfig {
|
|
397
|
+
transport: "http";
|
|
398
|
+
name?: string;
|
|
399
|
+
url: string;
|
|
400
|
+
headers?: Record<string, string>;
|
|
401
|
+
}
|
|
402
|
+
type MCPConfig = MCPStdioConfig | MCPHttpConfig;
|
|
403
|
+
declare class MCP {
|
|
404
|
+
private config;
|
|
405
|
+
private client;
|
|
406
|
+
private transport;
|
|
407
|
+
private cachedMcpTools;
|
|
408
|
+
private _connected;
|
|
409
|
+
constructor(config: MCPConfig);
|
|
410
|
+
get name(): string | undefined;
|
|
411
|
+
get connected(): boolean;
|
|
412
|
+
connect(options?: {
|
|
413
|
+
tracer?: TracingContext;
|
|
414
|
+
}): Promise<void>;
|
|
415
|
+
listTools(options?: {
|
|
416
|
+
prefix?: string;
|
|
417
|
+
tracer?: TracingContext;
|
|
418
|
+
}): Promise<ExecutableTool[]>;
|
|
419
|
+
listToolDefinitions(options?: {
|
|
420
|
+
prefix?: string;
|
|
421
|
+
tracer?: TracingContext;
|
|
422
|
+
}): Promise<ToolDefinition[]>;
|
|
423
|
+
refreshTools(): Promise<ExecutableTool[]>;
|
|
424
|
+
close(options?: {
|
|
425
|
+
tracer?: TracingContext;
|
|
426
|
+
}): Promise<void>;
|
|
427
|
+
private fetchTools;
|
|
428
|
+
private assertConnected;
|
|
429
|
+
}
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region src/store/types.d.ts
|
|
432
|
+
interface FileStore {
|
|
433
|
+
read(path: string): Promise<string | null>;
|
|
434
|
+
write(path: string, content: string): Promise<void>;
|
|
435
|
+
}
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region src/memory/types.d.ts
|
|
438
|
+
interface MemoryContext {
|
|
439
|
+
name?: string;
|
|
440
|
+
scope?: Record<string, string>;
|
|
441
|
+
system?: string;
|
|
442
|
+
messages: AxleMessage[];
|
|
443
|
+
newMessages?: AxleMessage[];
|
|
444
|
+
store: FileStore;
|
|
445
|
+
tracer?: TracingContext;
|
|
446
|
+
}
|
|
447
|
+
interface RecallResult {
|
|
448
|
+
systemSuffix?: string;
|
|
449
|
+
}
|
|
450
|
+
interface AgentMemory {
|
|
451
|
+
recall(context: MemoryContext): Promise<RecallResult>;
|
|
452
|
+
record(context: MemoryContext): Promise<void>;
|
|
453
|
+
tools?(): ExecutableTool[];
|
|
454
|
+
}
|
|
455
|
+
//#endregion
|
|
456
|
+
//#region src/turns/types.d.ts
|
|
457
|
+
type TurnStatus = "streaming" | "complete" | "cancelled" | "error";
|
|
458
|
+
interface Turn {
|
|
459
|
+
id: string;
|
|
460
|
+
owner: "user" | "agent";
|
|
461
|
+
parts: TurnPart[];
|
|
462
|
+
status: TurnStatus;
|
|
463
|
+
usage?: Stats;
|
|
464
|
+
}
|
|
465
|
+
type TurnPart = TextPart | FilePart | ThinkingPart | ActionPart;
|
|
466
|
+
interface TextPart {
|
|
467
|
+
id: string;
|
|
468
|
+
type: "text";
|
|
469
|
+
text: string;
|
|
470
|
+
}
|
|
471
|
+
interface FilePart {
|
|
472
|
+
id: string;
|
|
473
|
+
type: "file";
|
|
474
|
+
file: FileInfo;
|
|
475
|
+
}
|
|
476
|
+
interface ThinkingPart {
|
|
477
|
+
id: string;
|
|
478
|
+
type: "thinking";
|
|
479
|
+
text: string;
|
|
480
|
+
summary?: string;
|
|
481
|
+
redacted?: boolean;
|
|
482
|
+
}
|
|
483
|
+
interface ActionPartBase {
|
|
484
|
+
id: string;
|
|
485
|
+
type: "action";
|
|
486
|
+
kind: string;
|
|
487
|
+
status: "pending" | "running" | "complete" | "cancelled" | "error";
|
|
488
|
+
}
|
|
489
|
+
interface ToolAction extends ActionPartBase {
|
|
490
|
+
kind: "tool";
|
|
491
|
+
detail: {
|
|
492
|
+
name: string;
|
|
493
|
+
parameters: Record<string, unknown>;
|
|
494
|
+
result?: ActionResult;
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
interface SubagentAction extends ActionPartBase {
|
|
498
|
+
kind: "agent";
|
|
499
|
+
detail: {
|
|
500
|
+
name: string;
|
|
501
|
+
config?: Record<string, unknown>;
|
|
502
|
+
children: Turn[];
|
|
503
|
+
result?: ActionResult;
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
interface InternalToolAction extends ActionPartBase {
|
|
507
|
+
kind: "internal-tool";
|
|
508
|
+
detail: {
|
|
509
|
+
name: string;
|
|
510
|
+
input?: unknown;
|
|
511
|
+
result?: ActionResult;
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
type ActionPart = ToolAction | SubagentAction | InternalToolAction;
|
|
515
|
+
type ActionResult = {
|
|
516
|
+
type: "success";
|
|
517
|
+
content: unknown;
|
|
518
|
+
} | {
|
|
519
|
+
type: "error";
|
|
520
|
+
error: {
|
|
521
|
+
type: string;
|
|
522
|
+
message: string;
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/turns/events.d.ts
|
|
527
|
+
type AgentEvent = {
|
|
528
|
+
type: "session:restore";
|
|
529
|
+
turns: Turn[];
|
|
530
|
+
config?: Record<string, unknown>;
|
|
531
|
+
} | {
|
|
532
|
+
type: "turn:user";
|
|
533
|
+
turn: Turn;
|
|
534
|
+
} | {
|
|
535
|
+
type: "turn:start";
|
|
536
|
+
turnId: string;
|
|
537
|
+
} | {
|
|
538
|
+
type: "turn:end";
|
|
539
|
+
turnId: string;
|
|
540
|
+
status: TurnStatus;
|
|
541
|
+
usage: Stats;
|
|
542
|
+
} | {
|
|
543
|
+
type: "part:start";
|
|
544
|
+
turnId: string;
|
|
545
|
+
part: TurnPart;
|
|
546
|
+
} | {
|
|
547
|
+
type: "text:delta";
|
|
548
|
+
turnId: string;
|
|
549
|
+
partId: string;
|
|
550
|
+
delta: string;
|
|
551
|
+
} | {
|
|
552
|
+
type: "thinking:delta";
|
|
553
|
+
turnId: string;
|
|
554
|
+
partId: string;
|
|
555
|
+
delta: string;
|
|
556
|
+
} | {
|
|
557
|
+
type: "part:end";
|
|
558
|
+
turnId: string;
|
|
559
|
+
partId: string;
|
|
560
|
+
} | {
|
|
561
|
+
type: "action:running";
|
|
562
|
+
turnId: string;
|
|
563
|
+
partId: string;
|
|
564
|
+
parameters?: Record<string, unknown>;
|
|
565
|
+
} | {
|
|
566
|
+
type: "action:complete";
|
|
567
|
+
turnId: string;
|
|
568
|
+
partId: string;
|
|
569
|
+
result: ActionResult;
|
|
570
|
+
} | {
|
|
571
|
+
type: "action:error";
|
|
572
|
+
turnId: string;
|
|
573
|
+
partId: string;
|
|
574
|
+
error: {
|
|
575
|
+
type: string;
|
|
576
|
+
message: string;
|
|
577
|
+
};
|
|
578
|
+
} | {
|
|
579
|
+
type: "action:child-event";
|
|
580
|
+
turnId: string;
|
|
581
|
+
partId: string;
|
|
582
|
+
event: AgentEvent;
|
|
583
|
+
} | {
|
|
584
|
+
type: "error";
|
|
585
|
+
error: {
|
|
586
|
+
type: string;
|
|
587
|
+
message: string;
|
|
588
|
+
};
|
|
589
|
+
};
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/utils/utils.d.ts
|
|
592
|
+
interface Handle<T> {
|
|
593
|
+
cancel(): void;
|
|
594
|
+
readonly final: Promise<T>;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Creates a cancellable, queued async handle.
|
|
598
|
+
* Waits for `queue` before running `work`, merges an optional external signal
|
|
599
|
+
* with an internal abort controller, and returns the handle + settled promise
|
|
600
|
+
* for queue chaining.
|
|
601
|
+
*/
|
|
602
|
+
declare function createHandle<T>(queue: Promise<void>, work: (signal: AbortSignal) => Promise<T>, externalSignal?: AbortSignal): {
|
|
603
|
+
handle: Handle<T>;
|
|
604
|
+
settled: Promise<void>;
|
|
605
|
+
};
|
|
606
|
+
//#endregion
|
|
607
|
+
//#region src/core/history.d.ts
|
|
608
|
+
declare class History {
|
|
609
|
+
private _turns;
|
|
610
|
+
private _log;
|
|
611
|
+
constructor(init?: {
|
|
612
|
+
turns?: Turn[];
|
|
613
|
+
log?: AxleMessage[];
|
|
614
|
+
});
|
|
615
|
+
get turns(): Turn[];
|
|
616
|
+
get log(): AxleMessage[];
|
|
617
|
+
addTurn(turn: Turn): void;
|
|
618
|
+
appendToLog(messages: AxleMessage | AxleMessage[]): void;
|
|
619
|
+
latestTurn(): Turn | undefined;
|
|
620
|
+
toString(): string;
|
|
621
|
+
}
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/core/parse.d.ts
|
|
624
|
+
type OutputSchema = Record<string, z$2.ZodTypeAny>;
|
|
625
|
+
type ParsedSchema<T extends OutputSchema> = { [K in keyof T]: z$2.output<T[K]> };
|
|
626
|
+
declare function parseResponse<T extends OutputSchema>(rawValue: string, schema?: T): ParsedSchema<T> | string;
|
|
627
|
+
//#endregion
|
|
628
|
+
//#region src/core/Instruct.d.ts
|
|
629
|
+
declare class Instruct<TSchema extends OutputSchema | undefined = undefined> {
|
|
630
|
+
prompt: string;
|
|
631
|
+
inputs: Record<string, string>;
|
|
632
|
+
files: Base64FileInfo[];
|
|
633
|
+
textReferences: Array<{
|
|
634
|
+
content: string;
|
|
635
|
+
name?: string;
|
|
636
|
+
}>;
|
|
637
|
+
instructions: string[];
|
|
638
|
+
schema: TSchema;
|
|
639
|
+
constructor(prompt: string, schema?: TSchema);
|
|
640
|
+
setInputs(inputs: Record<string, string>): void;
|
|
641
|
+
addInput(name: string, value: string): void;
|
|
642
|
+
addFile(file: FileInfo | string, options?: {
|
|
643
|
+
name?: string;
|
|
644
|
+
}): void;
|
|
645
|
+
addInstructions(instruction: string): void;
|
|
646
|
+
hasFiles(): boolean;
|
|
647
|
+
}
|
|
648
|
+
//#endregion
|
|
649
|
+
//#region src/core/Agent.d.ts
|
|
650
|
+
interface AgentOptions {
|
|
651
|
+
strictVariables?: boolean;
|
|
652
|
+
}
|
|
653
|
+
interface AgentConfig {
|
|
654
|
+
provider: AIProvider;
|
|
655
|
+
model: string;
|
|
656
|
+
system?: string;
|
|
657
|
+
name?: string;
|
|
658
|
+
scope?: Record<string, string>;
|
|
659
|
+
tools?: AxleTool[];
|
|
660
|
+
mcps?: MCP[];
|
|
661
|
+
memory?: AgentMemory;
|
|
662
|
+
tracer?: TracingContext;
|
|
663
|
+
options?: AgentOptions;
|
|
664
|
+
}
|
|
665
|
+
interface AgentResult<T = string> {
|
|
666
|
+
response: T | null;
|
|
667
|
+
turn: Turn | undefined;
|
|
668
|
+
usage: Stats;
|
|
669
|
+
}
|
|
670
|
+
type AgentHandle<T = string> = Handle<AgentResult<T>>;
|
|
671
|
+
type AgentEventCallback = (event: AgentEvent) => void;
|
|
672
|
+
interface SendMessageOptions {
|
|
673
|
+
signal?: AbortSignal;
|
|
674
|
+
}
|
|
675
|
+
interface SendInstructOptions extends SendMessageOptions {
|
|
676
|
+
variables?: Record<string, string>;
|
|
677
|
+
}
|
|
678
|
+
declare class Agent {
|
|
679
|
+
readonly provider: AIProvider;
|
|
680
|
+
readonly model: string;
|
|
681
|
+
readonly history: History;
|
|
682
|
+
readonly tracer?: TracingContext;
|
|
683
|
+
readonly name?: string;
|
|
684
|
+
readonly scope?: Record<string, string>;
|
|
685
|
+
readonly store: FileStore;
|
|
686
|
+
system: string | undefined;
|
|
687
|
+
tools: Record<string, ExecutableTool>;
|
|
688
|
+
serverTools: ServerTool[];
|
|
689
|
+
private mcps;
|
|
690
|
+
private mcpToolsResolved;
|
|
691
|
+
private memory?;
|
|
692
|
+
private options;
|
|
693
|
+
private eventCallbacks;
|
|
694
|
+
private sendQueue;
|
|
695
|
+
constructor(config: AgentConfig);
|
|
696
|
+
addTool(tool: AxleTool): void;
|
|
697
|
+
addTools(tools: AxleTool[]): void;
|
|
698
|
+
addMcp(mcp: MCP): void;
|
|
699
|
+
addMcps(mcps: MCP[]): void;
|
|
700
|
+
hasTools(): boolean;
|
|
701
|
+
on(callback: AgentEventCallback): void;
|
|
702
|
+
send(message: string, options?: SendMessageOptions): AgentHandle<string>;
|
|
703
|
+
send(instruct: Instruct<undefined>, options?: SendInstructOptions): AgentHandle<string>;
|
|
704
|
+
send<TSchema extends OutputSchema>(instruct: Instruct<TSchema>, options?: SendInstructOptions): AgentHandle<ParsedSchema<TSchema>>;
|
|
705
|
+
private resolveMcpTools;
|
|
706
|
+
private emitEvent;
|
|
707
|
+
private run;
|
|
708
|
+
}
|
|
709
|
+
//#endregion
|
|
710
|
+
//#region src/core/compile.d.ts
|
|
711
|
+
interface CompileOptions {
|
|
712
|
+
strictVariables?: boolean;
|
|
713
|
+
}
|
|
714
|
+
declare function compileInstruct(instruct: Instruct<any>, variables?: Record<string, string>, options?: CompileOptions): string;
|
|
715
|
+
//#endregion
|
|
716
|
+
//#region src/providers/anthropic/provider.d.ts
|
|
717
|
+
declare function anthropic(apiKey: string): AIProvider;
|
|
718
|
+
//#endregion
|
|
719
|
+
//#region src/providers/anthropic/index.d.ts
|
|
720
|
+
declare const Anthropic: {
|
|
721
|
+
readonly Models: {
|
|
722
|
+
readonly CLAUDE_SONNET_4_6: "claude-sonnet-4-6";
|
|
723
|
+
readonly CLAUDE_OPUS_4_6: "claude-opus-4-6";
|
|
724
|
+
readonly CLAUDE_OPUS_4_5_20251101: "claude-opus-4-5-20251101";
|
|
725
|
+
readonly CLAUDE_OPUS_4_5: "claude-opus-4-5-20251101";
|
|
726
|
+
readonly CLAUDE_SONNET_4_5_20250929: "claude-sonnet-4-5-20250929";
|
|
727
|
+
readonly CLAUDE_SONNET_4_5: "claude-sonnet-4-5-20250929";
|
|
728
|
+
readonly CLAUDE_HAIKU_4_5_20251001: "claude-haiku-4-5-20251001";
|
|
729
|
+
readonly CLAUDE_HAIKU_4_5: "claude-haiku-4-5-20251001";
|
|
730
|
+
readonly CLAUDE_OPUS_4_1_20250805: "claude-opus-4-1-20250805";
|
|
731
|
+
readonly CLAUDE_OPUS_4_1: "claude-opus-4-1-20250805";
|
|
732
|
+
readonly CLAUDE_OPUS_4_20250514: "claude-opus-4-20250514";
|
|
733
|
+
readonly CLAUDE_OPUS_4: "claude-opus-4-20250514";
|
|
734
|
+
readonly CLAUDE_SONNET_4_20250514: "claude-sonnet-4-20250514";
|
|
735
|
+
readonly CLAUDE_SONNET_4: "claude-sonnet-4-20250514";
|
|
736
|
+
readonly CLAUDE_3_HAIKU_20240307: "claude-3-haiku-20240307";
|
|
737
|
+
readonly CLAUDE_3_HAIKU: "claude-3-haiku-20240307";
|
|
738
|
+
};
|
|
739
|
+
readonly DefaultModel: "claude-haiku-4-5-20251001";
|
|
740
|
+
};
|
|
741
|
+
//#endregion
|
|
742
|
+
//#region src/providers/chatcompletions/provider.d.ts
|
|
743
|
+
declare function chatCompletions(baseUrl: string, apiKey?: string): AIProvider;
|
|
744
|
+
//#endregion
|
|
745
|
+
//#region src/providers/gemini/provider.d.ts
|
|
746
|
+
declare function gemini(apiKey: string): AIProvider;
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/providers/gemini/index.d.ts
|
|
749
|
+
declare const Gemini: {
|
|
750
|
+
readonly Models: {
|
|
751
|
+
readonly GEMINI_3_1_PRO_PREVIEW: "gemini-3.1-pro-preview";
|
|
752
|
+
readonly GEMINI_3_1_PRO_PREVIEW_CUSTOMTOOLS: "gemini-3.1-pro-preview-customtools";
|
|
753
|
+
readonly GEMINI_3_1_FLASH_LITE_PREVIEW: "gemini-3.1-flash-lite-preview";
|
|
754
|
+
readonly GEMINI_3_PRO_PREVIEW: "gemini-3-pro-preview";
|
|
755
|
+
readonly GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview";
|
|
756
|
+
readonly GEMINI_2_5_PRO: "gemini-2.5-pro";
|
|
757
|
+
readonly GEMINI_2_5_FLASH: "gemini-2.5-flash";
|
|
758
|
+
readonly GEMINI_2_5_FLASH_LITE: "gemini-2.5-flash-lite";
|
|
759
|
+
readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
|
|
760
|
+
readonly GEMINI_2_0_FLASH_001: "gemini-2.0-flash-001";
|
|
761
|
+
readonly GEMINI_2_0_FLASH_LITE: "gemini-2.0-flash-lite";
|
|
762
|
+
readonly GEMINI_2_0_FLASH_LITE_001: "gemini-2.0-flash-lite-001";
|
|
763
|
+
readonly GEMINI_FLASH_LATEST: "gemini-flash-latest";
|
|
764
|
+
readonly GEMINI_FLASH_LITE_LATEST: "gemini-flash-lite-latest";
|
|
765
|
+
readonly GEMINI_PRO_LATEST: "gemini-pro-latest";
|
|
766
|
+
readonly GEMMA_4_31B_IT: "gemma-4-31b-it";
|
|
767
|
+
readonly GEMMA_4_E4B_IT: "gemma-4-26b-a4b-it";
|
|
768
|
+
readonly GEMMA_3_27B_IT: "gemma-3-27b-it";
|
|
769
|
+
readonly GEMMA_3_12B_IT: "gemma-3-12b-it";
|
|
770
|
+
readonly GEMMA_3_4B_IT: "gemma-3-4b-it";
|
|
771
|
+
readonly GEMMA_3_1B_IT: "gemma-3-1b-it";
|
|
772
|
+
readonly GEMMA_3N_E4B_IT: "gemma-3n-e4b-it";
|
|
773
|
+
readonly GEMMA_3N_E2B_IT: "gemma-3n-e2b-it";
|
|
774
|
+
};
|
|
775
|
+
readonly DefaultModel: "gemini-3.1-flash-lite-preview";
|
|
776
|
+
};
|
|
777
|
+
//#endregion
|
|
778
|
+
//#region src/providers/helpers.d.ts
|
|
779
|
+
type ToolCallResult = {
|
|
780
|
+
type: "success";
|
|
781
|
+
content: string | ToolResultPart[];
|
|
782
|
+
} | {
|
|
783
|
+
type: "error";
|
|
784
|
+
error: {
|
|
785
|
+
type: string;
|
|
786
|
+
message: string;
|
|
787
|
+
fatal?: boolean;
|
|
788
|
+
retryable?: boolean;
|
|
789
|
+
};
|
|
790
|
+
};
|
|
791
|
+
type ToolCallCallback = (name: string, parameters: Record<string, unknown>) => Promise<ToolCallResult | null | undefined>;
|
|
792
|
+
type GenerateError = {
|
|
793
|
+
type: "model";
|
|
794
|
+
error: ModelError;
|
|
795
|
+
} | {
|
|
796
|
+
type: "tool";
|
|
797
|
+
error: {
|
|
798
|
+
name: string;
|
|
799
|
+
message: string;
|
|
800
|
+
};
|
|
801
|
+
};
|
|
802
|
+
type GenerateResult = {
|
|
803
|
+
result: "success";
|
|
804
|
+
messages: AxleMessage[];
|
|
805
|
+
final?: AxleAssistantMessage;
|
|
806
|
+
usage?: Stats;
|
|
807
|
+
} | {
|
|
808
|
+
result: "error";
|
|
809
|
+
messages: AxleMessage[];
|
|
810
|
+
error: GenerateError;
|
|
811
|
+
usage?: Stats;
|
|
812
|
+
};
|
|
813
|
+
type StreamResult = GenerateResult | {
|
|
814
|
+
result: "cancelled";
|
|
815
|
+
messages: AxleMessage[];
|
|
816
|
+
partial?: AxleAssistantMessage;
|
|
817
|
+
usage: Stats;
|
|
818
|
+
};
|
|
819
|
+
//#endregion
|
|
820
|
+
//#region src/providers/generateTurn.d.ts
|
|
821
|
+
interface GenerateTurnOptions {
|
|
822
|
+
temperature?: number;
|
|
823
|
+
top_p?: number;
|
|
824
|
+
max_tokens?: number;
|
|
825
|
+
frequency_penalty?: number;
|
|
826
|
+
presence_penalty?: number;
|
|
827
|
+
stop?: string | string[];
|
|
828
|
+
[key: string]: any;
|
|
829
|
+
}
|
|
830
|
+
interface GenerateTurnProps {
|
|
831
|
+
provider: AIProvider;
|
|
832
|
+
model: string;
|
|
833
|
+
messages: Array<AxleMessage>;
|
|
834
|
+
system?: string;
|
|
835
|
+
tools?: Array<ToolDefinition>;
|
|
836
|
+
tracer?: TracingContext;
|
|
837
|
+
options?: GenerateTurnOptions;
|
|
838
|
+
}
|
|
839
|
+
declare function generateTurn(props: GenerateTurnProps): Promise<ModelResult>;
|
|
840
|
+
//#endregion
|
|
841
|
+
//#region src/providers/generate.d.ts
|
|
842
|
+
interface GenerateOptions {
|
|
843
|
+
provider: AIProvider;
|
|
844
|
+
model: string;
|
|
845
|
+
messages: Array<AxleMessage>;
|
|
846
|
+
system?: string;
|
|
847
|
+
tools?: Array<ToolDefinition>;
|
|
848
|
+
onToolCall?: ToolCallCallback;
|
|
849
|
+
maxIterations?: number;
|
|
850
|
+
tracer?: TracingContext;
|
|
851
|
+
options?: GenerateTurnOptions;
|
|
852
|
+
}
|
|
853
|
+
declare function generate(options: GenerateOptions): Promise<GenerateResult>;
|
|
854
|
+
//#endregion
|
|
855
|
+
//#region src/providers/stream.d.ts
|
|
856
|
+
type StreamEvent = {
|
|
857
|
+
type: "turn:start";
|
|
858
|
+
id: string;
|
|
859
|
+
model: string;
|
|
860
|
+
} | {
|
|
861
|
+
type: "turn:complete";
|
|
862
|
+
message: AxleAssistantMessage;
|
|
863
|
+
usage?: Stats;
|
|
864
|
+
} | {
|
|
865
|
+
type: "tool-results:start";
|
|
866
|
+
id: string;
|
|
867
|
+
} | {
|
|
868
|
+
type: "tool-results:complete";
|
|
869
|
+
message: AxleToolCallMessage;
|
|
870
|
+
} | {
|
|
871
|
+
type: "text:start";
|
|
872
|
+
index: number;
|
|
873
|
+
} | {
|
|
874
|
+
type: "text:delta";
|
|
875
|
+
index: number;
|
|
876
|
+
delta: string;
|
|
877
|
+
accumulated: string;
|
|
878
|
+
} | {
|
|
879
|
+
type: "text:end";
|
|
880
|
+
index: number;
|
|
881
|
+
final: string;
|
|
882
|
+
} | {
|
|
883
|
+
type: "thinking:start";
|
|
884
|
+
index: number;
|
|
885
|
+
} | {
|
|
886
|
+
type: "thinking:delta";
|
|
887
|
+
index: number;
|
|
888
|
+
delta: string;
|
|
889
|
+
accumulated: string;
|
|
890
|
+
} | {
|
|
891
|
+
type: "thinking:end";
|
|
892
|
+
index: number;
|
|
893
|
+
final: string;
|
|
894
|
+
} | {
|
|
895
|
+
type: "tool:request";
|
|
896
|
+
index: number;
|
|
897
|
+
id: string;
|
|
898
|
+
name: string;
|
|
899
|
+
} | {
|
|
900
|
+
type: "tool:exec-start";
|
|
901
|
+
index: number;
|
|
902
|
+
id: string;
|
|
903
|
+
name: string;
|
|
904
|
+
parameters: Record<string, unknown>;
|
|
905
|
+
} | {
|
|
906
|
+
type: "tool:exec-complete";
|
|
907
|
+
index: number;
|
|
908
|
+
id: string;
|
|
909
|
+
name: string;
|
|
910
|
+
result: ToolCallResult;
|
|
911
|
+
} | {
|
|
912
|
+
type: "internal-tool:start";
|
|
913
|
+
index: number;
|
|
914
|
+
id: string;
|
|
915
|
+
name: string;
|
|
916
|
+
} | {
|
|
917
|
+
type: "internal-tool:complete";
|
|
918
|
+
index: number;
|
|
919
|
+
id: string;
|
|
920
|
+
name: string;
|
|
921
|
+
output?: unknown;
|
|
922
|
+
} | {
|
|
923
|
+
type: "error";
|
|
924
|
+
error: GenerateError;
|
|
925
|
+
};
|
|
926
|
+
type StreamEventCallback = (event: StreamEvent) => void;
|
|
927
|
+
interface StreamOptions {
|
|
928
|
+
provider: AIProvider;
|
|
929
|
+
model: string;
|
|
930
|
+
messages: Array<AxleMessage>;
|
|
931
|
+
system?: string;
|
|
932
|
+
tools?: Array<ToolDefinition>;
|
|
933
|
+
serverTools?: Array<ServerTool>;
|
|
934
|
+
onToolCall?: ToolCallCallback;
|
|
935
|
+
maxIterations?: number;
|
|
936
|
+
tracer?: TracingContext;
|
|
937
|
+
options?: GenerateTurnOptions;
|
|
938
|
+
signal?: AbortSignal;
|
|
939
|
+
}
|
|
940
|
+
interface StreamHandle {
|
|
941
|
+
on(callback: StreamEventCallback): void;
|
|
942
|
+
cancel(): void;
|
|
943
|
+
readonly final: Promise<StreamResult>;
|
|
944
|
+
}
|
|
945
|
+
declare function stream(options: StreamOptions): StreamHandle;
|
|
946
|
+
//#endregion
|
|
947
|
+
//#region src/providers/openai/provider.d.ts
|
|
948
|
+
declare function openai(apiKey: string): AIProvider;
|
|
949
|
+
//#endregion
|
|
950
|
+
//#region src/providers/openai/index.d.ts
|
|
951
|
+
declare const OpenAI: {
|
|
952
|
+
readonly Models: {
|
|
953
|
+
readonly GPT_5_4_2026_03_05: "gpt-5.4-2026-03-05";
|
|
954
|
+
readonly GPT_5_4: "gpt-5.4";
|
|
955
|
+
readonly GPT_5_4_PRO_2026_03_05: "gpt-5.4-pro-2026-03-05";
|
|
956
|
+
readonly GPT_5_4_PRO: "gpt-5.4-pro";
|
|
957
|
+
readonly GPT_5_4_MINI_2026_03_17: "gpt-5.4-mini-2026-03-17";
|
|
958
|
+
readonly GPT_5_4_MINI: "gpt-5.4-mini";
|
|
959
|
+
readonly GPT_5_4_NANO_2026_03_17: "gpt-5.4-nano-2026-03-17";
|
|
960
|
+
readonly GPT_5_4_NANO: "gpt-5.4-nano";
|
|
961
|
+
readonly GPT_5_2_2025_12_11: "gpt-5.2-2025-12-11";
|
|
962
|
+
readonly GPT_5_2: "gpt-5.2";
|
|
963
|
+
readonly GPT_5_2_CHAT_LATEST: "gpt-5.2-chat-latest";
|
|
964
|
+
readonly GPT_5_2_PRO_2025_12_11: "gpt-5.2-pro-2025-12-11";
|
|
965
|
+
readonly GPT_5_2_PRO: "gpt-5.2-pro";
|
|
966
|
+
readonly GPT_5_1_2025_11_13: "gpt-5.1-2025-11-13";
|
|
967
|
+
readonly GPT_5_1: "gpt-5.1";
|
|
968
|
+
readonly GPT_5_1_CHAT_LATEST: "gpt-5.1-chat-latest";
|
|
969
|
+
readonly GPT_5_2025_08_07: "gpt-5-2025-08-07";
|
|
970
|
+
readonly GPT_5: "gpt-5";
|
|
971
|
+
readonly GPT_5_CHAT_LATEST: "gpt-5-chat-latest";
|
|
972
|
+
readonly GPT_5_PRO_2025_10_06: "gpt-5-pro-2025-10-06";
|
|
973
|
+
readonly GPT_5_PRO: "gpt-5-pro";
|
|
974
|
+
readonly GPT_5_MINI_2025_08_07: "gpt-5-mini-2025-08-07";
|
|
975
|
+
readonly GPT_5_MINI: "gpt-5-mini";
|
|
976
|
+
readonly GPT_5_NANO_2025_08_07: "gpt-5-nano-2025-08-07";
|
|
977
|
+
readonly GPT_5_NANO: "gpt-5-nano";
|
|
978
|
+
readonly GPT_4_1_2025_04_14: "gpt-4.1-2025-04-14";
|
|
979
|
+
readonly GPT_4_1: "gpt-4.1";
|
|
980
|
+
readonly GPT_4_1_MINI_2025_04_14: "gpt-4.1-mini-2025-04-14";
|
|
981
|
+
readonly GPT_4_1_MINI: "gpt-4.1-mini";
|
|
982
|
+
readonly GPT_4_1_NANO_2025_04_14: "gpt-4.1-nano-2025-04-14";
|
|
983
|
+
readonly GPT_4_1_NANO: "gpt-4.1-nano";
|
|
984
|
+
readonly GPT_4O_2024_11_20: "gpt-4o-2024-11-20";
|
|
985
|
+
readonly GPT_4O_2024_08_06: "gpt-4o-2024-08-06";
|
|
986
|
+
readonly GPT_4O_2024_05_13: "gpt-4o-2024-05-13";
|
|
987
|
+
readonly GPT_4O: "gpt-4o";
|
|
988
|
+
readonly GPT_4O_MINI_2024_07_18: "gpt-4o-mini-2024-07-18";
|
|
989
|
+
readonly GPT_4O_MINI: "gpt-4o-mini";
|
|
990
|
+
readonly O4_MINI_2025_04_16: "o4-mini-2025-04-16";
|
|
991
|
+
readonly O4_MINI: "o4-mini";
|
|
992
|
+
readonly O3_2025_04_16: "o3-2025-04-16";
|
|
993
|
+
readonly O3: "o3";
|
|
994
|
+
readonly O3_PRO_2025_06_10: "o3-pro-2025-06-10";
|
|
995
|
+
readonly O3_PRO: "o3-pro";
|
|
996
|
+
readonly O3_MINI_2025_01_31: "o3-mini-2025-01-31";
|
|
997
|
+
readonly O3_MINI: "o3-mini";
|
|
998
|
+
readonly O1_2024_12_17: "o1-2024-12-17";
|
|
999
|
+
readonly O1: "o1";
|
|
1000
|
+
readonly O1_PRO_2025_03_19: "o1-pro-2025-03-19";
|
|
1001
|
+
readonly O1_PRO: "o1-pro";
|
|
1002
|
+
};
|
|
1003
|
+
readonly DefaultModel: "gpt-5.4-mini";
|
|
1004
|
+
};
|
|
1005
|
+
//#endregion
|
|
1006
|
+
//#region src/cli/configs/schemas.d.ts
|
|
1007
|
+
declare const BraveProviderConfigSchema: z.ZodObject<{
|
|
1008
|
+
"api-key": z.ZodString;
|
|
1009
|
+
rateLimit: z.ZodOptional<z.ZodNumber>;
|
|
1010
|
+
}, z.core.$strip>;
|
|
1011
|
+
type BraveProviderConfig = z.infer<typeof BraveProviderConfigSchema>;
|
|
1012
|
+
//#endregion
|
|
1013
|
+
//#region src/tools/brave.d.ts
|
|
1014
|
+
declare const braveSearchSchema: z$2.ZodObject<{
|
|
1015
|
+
searchTerm: z$2.ZodString;
|
|
1016
|
+
}, z$2.core.$strip>;
|
|
1017
|
+
declare class BraveSearchTool implements ExecutableTool<typeof braveSearchSchema> {
|
|
1018
|
+
name: string;
|
|
1019
|
+
description: string;
|
|
1020
|
+
schema: z$2.ZodObject<{
|
|
1021
|
+
searchTerm: z$2.ZodString;
|
|
1022
|
+
}, z$2.core.$strip>;
|
|
1023
|
+
apiKey: string | undefined;
|
|
1024
|
+
throttle: number | undefined;
|
|
1025
|
+
lastExecTime: number;
|
|
1026
|
+
constructor(config?: BraveProviderConfig);
|
|
1027
|
+
configure(config: BraveProviderConfig): void;
|
|
1028
|
+
execute(params: z$2.infer<typeof braveSearchSchema>): Promise<string>;
|
|
1029
|
+
}
|
|
1030
|
+
declare const braveSearchTool: BraveSearchTool;
|
|
1031
|
+
//#endregion
|
|
1032
|
+
//#region src/tools/calculator.d.ts
|
|
1033
|
+
declare const calculatorSchema: z.ZodObject<{
|
|
1034
|
+
operation: z.ZodEnum<{
|
|
1035
|
+
add: "add";
|
|
1036
|
+
subtract: "subtract";
|
|
1037
|
+
multiply: "multiply";
|
|
1038
|
+
divide: "divide";
|
|
1039
|
+
}>;
|
|
1040
|
+
a: z.ZodNumber;
|
|
1041
|
+
b: z.ZodNumber;
|
|
1042
|
+
}, z.core.$strip>;
|
|
1043
|
+
declare const calculatorTool: ExecutableTool<typeof calculatorSchema>;
|
|
1044
|
+
//#endregion
|
|
1045
|
+
//#region src/turns/builder.d.ts
|
|
1046
|
+
declare class TurnBuilder {
|
|
1047
|
+
private currentTurn;
|
|
1048
|
+
private currentTextPart;
|
|
1049
|
+
private currentThinkingPart;
|
|
1050
|
+
private toolIdMap;
|
|
1051
|
+
private accumulatedUsage;
|
|
1052
|
+
createUserTurn(message: AxleUserMessage): {
|
|
1053
|
+
turn: Turn;
|
|
1054
|
+
events: AgentEvent[];
|
|
1055
|
+
};
|
|
1056
|
+
startAgentTurn(): {
|
|
1057
|
+
turn: Turn;
|
|
1058
|
+
events: AgentEvent[];
|
|
1059
|
+
};
|
|
1060
|
+
handleStreamEvent(event: StreamEvent): AgentEvent[];
|
|
1061
|
+
finalizeTurn(outcome?: "complete" | "cancelled" | "error"): AgentEvent[];
|
|
1062
|
+
private closeOpenParts;
|
|
1063
|
+
private findActionPart;
|
|
1064
|
+
}
|
|
1065
|
+
//#endregion
|
|
1066
|
+
//#region src/tracer/tracer.d.ts
|
|
1067
|
+
/**
|
|
1068
|
+
* Root tracer that manages writers and creates spans.
|
|
1069
|
+
* Use startSpan() to create TracingContext instances for hierarchical tracing.
|
|
1070
|
+
* All logging happens within spans - the Tracer itself is just configuration and factory.
|
|
1071
|
+
*/
|
|
1072
|
+
declare class Tracer {
|
|
1073
|
+
private writers;
|
|
1074
|
+
private _minLevel;
|
|
1075
|
+
get minLevel(): EventLevel;
|
|
1076
|
+
set minLevel(level: EventLevel);
|
|
1077
|
+
addWriter(writer: TraceWriter): void;
|
|
1078
|
+
removeWriter(writer: TraceWriter): void;
|
|
1079
|
+
startSpan(name: string, options?: SpanOptions): TracingContext;
|
|
1080
|
+
flush(): Promise<void>;
|
|
1081
|
+
/** @internal */
|
|
1082
|
+
_notifySpanEnd(spanData: SpanData): void;
|
|
1083
|
+
/** @internal */
|
|
1084
|
+
_notifySpanUpdate(spanData: SpanData): void;
|
|
1085
|
+
/** @internal */
|
|
1086
|
+
_notifyEvent(spanData: SpanData, event: SpanEvent): void;
|
|
1087
|
+
/** @internal */
|
|
1088
|
+
_notifySpanStart(spanData: SpanData): void;
|
|
1089
|
+
/** @internal */
|
|
1090
|
+
_shouldLog(level: EventLevel): boolean;
|
|
1091
|
+
}
|
|
1092
|
+
//#endregion
|
|
1093
|
+
//#region src/tracer/writers/simple.d.ts
|
|
1094
|
+
interface SimpleWriterOptions {
|
|
1095
|
+
/** Minimum event level to display (default: "info") */
|
|
1096
|
+
minLevel?: EventLevel;
|
|
1097
|
+
/** Show internal spans - typically enabled via --debug flag (default: false) */
|
|
1098
|
+
showInternal?: boolean;
|
|
1099
|
+
/** Show timestamps (default: true) */
|
|
1100
|
+
showTimestamp?: boolean;
|
|
1101
|
+
/** Show duration on span end (default: true) */
|
|
1102
|
+
showDuration?: boolean;
|
|
1103
|
+
/** Render markdown in event messages that have markdown: true attribute (default: false) */
|
|
1104
|
+
markdown?: boolean;
|
|
1105
|
+
/** Custom output function (default: console.log) */
|
|
1106
|
+
output?: (line: string) => void;
|
|
1107
|
+
}
|
|
1108
|
+
declare class SimpleWriter implements TraceWriter {
|
|
1109
|
+
private minLevel;
|
|
1110
|
+
private showInternal;
|
|
1111
|
+
private showTimestamp;
|
|
1112
|
+
private showDuration;
|
|
1113
|
+
private markdown;
|
|
1114
|
+
private output;
|
|
1115
|
+
private spans;
|
|
1116
|
+
private visibleDepths;
|
|
1117
|
+
constructor(options?: SimpleWriterOptions);
|
|
1118
|
+
private shouldShowEvent;
|
|
1119
|
+
private isSpanVisible;
|
|
1120
|
+
/**
|
|
1121
|
+
* Find the nearest visible ancestor span for a given span.
|
|
1122
|
+
* Returns null if no visible ancestor exists (root level).
|
|
1123
|
+
*/
|
|
1124
|
+
private findVisibleAncestor;
|
|
1125
|
+
/**
|
|
1126
|
+
* Calculate the visible depth for a span.
|
|
1127
|
+
* Only counts visible ancestors in the depth.
|
|
1128
|
+
*/
|
|
1129
|
+
private calculateVisibleDepth;
|
|
1130
|
+
private formatTimestamp;
|
|
1131
|
+
private formatDuration;
|
|
1132
|
+
private formatIndent;
|
|
1133
|
+
private formatSpanName;
|
|
1134
|
+
private renderMarkdown;
|
|
1135
|
+
onSpanStart(span: SpanData): void;
|
|
1136
|
+
onSpanEnd(span: SpanData): void;
|
|
1137
|
+
onSpanUpdate(span: SpanData): void;
|
|
1138
|
+
onEvent(span: SpanData, event: SpanEvent): void;
|
|
1139
|
+
}
|
|
1140
|
+
//#endregion
|
|
1141
|
+
//#region src/memory/ProceduralMemory.d.ts
|
|
1142
|
+
interface ProceduralMemoryConfig {
|
|
1143
|
+
provider: AIProvider;
|
|
1144
|
+
model: string;
|
|
1145
|
+
enableTools?: boolean;
|
|
1146
|
+
}
|
|
1147
|
+
declare class ProceduralMemory implements AgentMemory {
|
|
1148
|
+
private provider;
|
|
1149
|
+
private model;
|
|
1150
|
+
private enableTools;
|
|
1151
|
+
private lastStore?;
|
|
1152
|
+
private lastName?;
|
|
1153
|
+
private lastScope?;
|
|
1154
|
+
constructor(config: ProceduralMemoryConfig);
|
|
1155
|
+
recall(context: MemoryContext): Promise<RecallResult>;
|
|
1156
|
+
record(context: MemoryContext): Promise<void>;
|
|
1157
|
+
tools(): ExecutableTool[];
|
|
1158
|
+
private formatMessages;
|
|
1159
|
+
private parseInstructions;
|
|
1160
|
+
private getStorePath;
|
|
1161
|
+
private loadStore;
|
|
1162
|
+
private saveStore;
|
|
1163
|
+
}
|
|
1164
|
+
//#endregion
|
|
1165
|
+
//#region src/store/LocalFileStore.d.ts
|
|
1166
|
+
declare class LocalFileStore implements FileStore {
|
|
1167
|
+
readonly rootPath: string;
|
|
1168
|
+
constructor(rootPath: string);
|
|
1169
|
+
read(path: string): Promise<string | null>;
|
|
1170
|
+
write(path: string, content: string): Promise<void>;
|
|
1171
|
+
}
|
|
1172
|
+
//#endregion
|
|
1173
|
+
export { type AIProvider, type ActionPart, type ActionResult, Agent, type AgentConfig, type AgentEvent, type AgentEventCallback, type AgentHandle, type AgentMemory, type AgentResult, Anthropic, type AxleAssistantMessage, type AxleMessage, AxleStopReason, type AxleTool, type AxleToolCallMessage, type AxleToolCallResult, type AxleUserMessage, type ContentPart, type ContentPartFile, type ContentPartInternalTool, type ContentPartText, type ContentPartThinking, type ContentPartToolCall, type EventLevel, type ExecutableTool, type FileInfo, type FilePart, type FileStore, Gemini, type Handle, History, Instruct, type InternalToolAction, LocalFileStore, MCP, type MCPConfig, type MCPHttpConfig, type MCPStdioConfig, type MemoryContext, OpenAI, ProceduralMemory, type ProceduralMemoryConfig, type RecallResult, type SendInstructOptions, type SendMessageOptions, type ServerTool, SimpleWriter, type SimpleWriterOptions, type SpanData, type SpanOptions, type SpanType, type StreamEvent, type StreamEventCallback, type StreamHandle, type StreamResult, type SubagentAction, type TextPart, type ThinkingPart, type ToolAction, type ToolDefinition, type ToolResultPart, type TraceWriter, Tracer, type TracingContext, type Turn, TurnBuilder, type TurnPart, type TurnStatus, anthropic, braveSearchTool, calculatorTool, chatCompletions, compileInstruct, createHandle, gemini, generate, generateTurn, loadFileContent, openai, parseResponse, stream };
|