@fifthrevision/axle 0.9.0 → 0.10.1
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/ProceduralMemory-g6rvICO7.js +42 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +5 -7
- package/dist/index.d.ts +981 -761
- package/dist/index.js +1 -1
- package/package.json +19 -17
- package/dist/ProceduralMemory-BtEMO_Cx.js +0 -59
package/dist/index.d.ts
CHANGED
|
@@ -1,289 +1,294 @@
|
|
|
1
|
-
import * as z from
|
|
2
|
-
import { ZodObject, z
|
|
1
|
+
import * as z$2 from "zod";
|
|
2
|
+
import { ZodObject, z } from "zod";
|
|
3
3
|
|
|
4
|
+
//#region src/types.d.ts
|
|
4
5
|
interface Stats {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
in: number;
|
|
7
|
+
out: number;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/messages/stream.d.ts
|
|
9
11
|
interface StreamChunk {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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;
|
|
13
15
|
}
|
|
14
16
|
interface StreamStartChunk extends StreamChunk {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
type: "start";
|
|
18
|
+
id: string;
|
|
19
|
+
data: {
|
|
20
|
+
model: string;
|
|
21
|
+
timestamp: number;
|
|
22
|
+
};
|
|
21
23
|
}
|
|
22
24
|
interface StreamCompleteChunk extends StreamChunk {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
type: "complete";
|
|
26
|
+
data: {
|
|
27
|
+
finishReason: AxleStopReason;
|
|
28
|
+
usage: Stats;
|
|
29
|
+
};
|
|
28
30
|
}
|
|
29
31
|
interface StreamErrorChunk extends StreamChunk {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
type: "error";
|
|
33
|
+
data: {
|
|
34
|
+
type: string;
|
|
35
|
+
message: string;
|
|
36
|
+
usage?: Stats;
|
|
37
|
+
raw?: any;
|
|
38
|
+
};
|
|
37
39
|
}
|
|
38
40
|
interface StreamTextStartChunk extends StreamChunk {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
type: "text-start";
|
|
42
|
+
data: {
|
|
43
|
+
index: number;
|
|
44
|
+
};
|
|
43
45
|
}
|
|
44
46
|
interface StreamTextDeltaChunk extends StreamChunk {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
type: "text-delta";
|
|
48
|
+
data: {
|
|
49
|
+
index: number;
|
|
50
|
+
text: string;
|
|
51
|
+
};
|
|
50
52
|
}
|
|
51
53
|
interface StreamTextCompleteChunk extends StreamChunk {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
type: "text-complete";
|
|
55
|
+
data: {
|
|
56
|
+
index: number;
|
|
57
|
+
};
|
|
56
58
|
}
|
|
57
59
|
interface StreamThinkingStartChunk extends StreamChunk {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
type: "thinking-start";
|
|
61
|
+
data: {
|
|
62
|
+
index: number;
|
|
63
|
+
id?: string;
|
|
64
|
+
redacted?: boolean;
|
|
65
|
+
signature?: string;
|
|
66
|
+
};
|
|
65
67
|
}
|
|
66
68
|
interface StreamThinkingDeltaChunk extends StreamChunk {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
type: "thinking-delta";
|
|
70
|
+
data: {
|
|
71
|
+
index: number;
|
|
72
|
+
text: string;
|
|
73
|
+
};
|
|
72
74
|
}
|
|
73
75
|
interface StreamThinkingSummaryDeltaChunk extends StreamChunk {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
type: "thinking-summary-delta";
|
|
77
|
+
data: {
|
|
78
|
+
index: number;
|
|
79
|
+
text: string;
|
|
80
|
+
};
|
|
79
81
|
}
|
|
80
82
|
interface StreamThinkingCompleteChunk extends StreamChunk {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
type: "thinking-complete";
|
|
84
|
+
data: {
|
|
85
|
+
index: number;
|
|
86
|
+
};
|
|
85
87
|
}
|
|
86
88
|
interface StreamToolCallStartChunk extends StreamChunk {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
type: "tool-call-start";
|
|
90
|
+
data: {
|
|
91
|
+
index: number;
|
|
92
|
+
id: string;
|
|
93
|
+
name: string;
|
|
94
|
+
};
|
|
93
95
|
}
|
|
94
96
|
interface StreamToolCallCompleteChunk extends StreamChunk {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
+
};
|
|
103
105
|
}
|
|
104
106
|
interface StreamInternalToolStartChunk extends StreamChunk {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
type: "internal-tool-start";
|
|
108
|
+
data: {
|
|
109
|
+
index: number;
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
};
|
|
111
113
|
}
|
|
112
114
|
interface StreamInternalToolCompleteChunk extends StreamChunk {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
type: "internal-tool-complete";
|
|
116
|
+
data: {
|
|
117
|
+
index: number;
|
|
118
|
+
id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
output?: unknown;
|
|
121
|
+
};
|
|
120
122
|
}
|
|
121
123
|
type AnyStreamChunk = StreamStartChunk | StreamCompleteChunk | StreamErrorChunk | StreamTextStartChunk | StreamTextDeltaChunk | StreamTextCompleteChunk | StreamThinkingStartChunk | StreamThinkingDeltaChunk | StreamThinkingSummaryDeltaChunk | StreamThinkingCompleteChunk | StreamToolCallStartChunk | StreamToolCallCompleteChunk | StreamInternalToolStartChunk | StreamInternalToolCompleteChunk;
|
|
122
|
-
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/tracer/types.d.ts
|
|
123
126
|
type SpanStatus = "ok" | "error";
|
|
124
127
|
type EventLevel = "debug" | "info" | "warn" | "error";
|
|
125
128
|
type SpanType = string;
|
|
126
129
|
interface SpanEvent {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
name: string;
|
|
131
|
+
timestamp: number;
|
|
132
|
+
level: EventLevel;
|
|
133
|
+
attributes?: Record<string, unknown>;
|
|
131
134
|
}
|
|
132
135
|
interface SpanData {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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;
|
|
144
147
|
}
|
|
145
148
|
interface SpanOptions {
|
|
146
|
-
|
|
149
|
+
type?: SpanType;
|
|
147
150
|
}
|
|
148
151
|
type SpanResult = LLMResult | ToolResult;
|
|
149
152
|
interface LLMResult {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
kind: "llm";
|
|
154
|
+
model: string;
|
|
155
|
+
request: LLMRequest;
|
|
156
|
+
response: LLMResponse;
|
|
157
|
+
usage?: TokenUsage;
|
|
158
|
+
finishReason?: string;
|
|
156
159
|
}
|
|
157
160
|
interface LLMRequest {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
messages: unknown[];
|
|
162
|
+
system?: string;
|
|
163
|
+
tools?: unknown[];
|
|
161
164
|
}
|
|
162
165
|
interface LLMResponse {
|
|
163
|
-
|
|
166
|
+
content: unknown;
|
|
164
167
|
}
|
|
165
168
|
interface TokenUsage {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
+
inputTokens?: number;
|
|
170
|
+
outputTokens?: number;
|
|
171
|
+
totalTokens?: number;
|
|
169
172
|
}
|
|
170
173
|
interface ToolResult {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
kind: "tool";
|
|
175
|
+
name: string;
|
|
176
|
+
input: unknown;
|
|
177
|
+
output: unknown;
|
|
175
178
|
}
|
|
176
179
|
interface TraceWriter {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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>;
|
|
182
185
|
}
|
|
183
186
|
/**
|
|
184
187
|
* Tracing context for a span. Created by Tracer.startSpan().
|
|
185
188
|
* Can create child spans and log events within the span's scope.
|
|
186
189
|
*/
|
|
187
190
|
interface TracingContext {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
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
|
|
199
203
|
interface AIProvider {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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>;
|
|
238
242
|
}
|
|
239
243
|
interface ModelResponse {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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;
|
|
249
253
|
}
|
|
250
254
|
interface ModelError {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
255
|
+
type: "error";
|
|
256
|
+
error: {
|
|
257
|
+
type: string;
|
|
258
|
+
message: string;
|
|
259
|
+
};
|
|
260
|
+
usage?: Stats;
|
|
261
|
+
raw?: any;
|
|
258
262
|
}
|
|
259
263
|
type ModelResult = ModelResponse | ModelError;
|
|
260
264
|
declare enum AxleStopReason {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
|
|
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
|
|
269
274
|
interface FileInfo {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
path: string;
|
|
276
|
+
base64?: string;
|
|
277
|
+
content?: string;
|
|
278
|
+
mimeType: string;
|
|
279
|
+
size: number;
|
|
280
|
+
name: string;
|
|
281
|
+
type: "image" | "document" | "text";
|
|
277
282
|
}
|
|
278
283
|
type TextFileInfo = FileInfo & {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
284
|
+
content: string;
|
|
285
|
+
base64?: never;
|
|
286
|
+
type: "text";
|
|
282
287
|
};
|
|
283
288
|
type Base64FileInfo = FileInfo & {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
289
|
+
base64: string;
|
|
290
|
+
content?: never;
|
|
291
|
+
type: "image" | "document";
|
|
287
292
|
};
|
|
288
293
|
/**
|
|
289
294
|
* Load a file with the specified encoding or auto-detect based on file extension
|
|
@@ -294,660 +299,875 @@ type Base64FileInfo = FileInfo & {
|
|
|
294
299
|
declare function loadFileContent(filePath: string): Promise<FileInfo>;
|
|
295
300
|
declare function loadFileContent(filePath: string, encoding: "utf-8"): Promise<TextFileInfo>;
|
|
296
301
|
declare function loadFileContent(filePath: string, encoding: "base64"): Promise<Base64FileInfo>;
|
|
297
|
-
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/messages/message.d.ts
|
|
298
304
|
type AxleMessage = AxleUserMessage | AxleAssistantMessage | AxleToolCallMessage;
|
|
299
305
|
interface AxleUserMessage {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
306
|
+
role: "user";
|
|
307
|
+
id?: string;
|
|
308
|
+
name?: string;
|
|
309
|
+
content: string | Array<ContentPart>;
|
|
303
310
|
}
|
|
304
311
|
interface AxleAssistantMessage {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
312
|
+
role: "assistant";
|
|
313
|
+
id: string;
|
|
314
|
+
model?: string;
|
|
315
|
+
content: Array<ContentPartText | ContentPartThinking | ContentPartToolCall | ContentPartInternalTool>;
|
|
316
|
+
finishReason?: AxleStopReason;
|
|
310
317
|
}
|
|
311
318
|
interface AxleToolCallMessage {
|
|
312
|
-
|
|
313
|
-
|
|
319
|
+
role: "tool";
|
|
320
|
+
id: string;
|
|
321
|
+
content: Array<AxleToolCallResult>;
|
|
314
322
|
}
|
|
315
323
|
type ToolResultPart = {
|
|
316
|
-
|
|
317
|
-
|
|
324
|
+
type: "text";
|
|
325
|
+
text: string;
|
|
318
326
|
} | {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
327
|
+
type: "image";
|
|
328
|
+
data: string;
|
|
329
|
+
mimeType: string;
|
|
322
330
|
};
|
|
323
331
|
interface AxleToolCallResult {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
332
|
+
id: string;
|
|
333
|
+
name: string;
|
|
334
|
+
content: string | ToolResultPart[];
|
|
335
|
+
isError?: boolean;
|
|
328
336
|
}
|
|
329
337
|
type ContentPart = ContentPartText | ContentPartFile | ContentPartToolCall | ContentPartThinking | ContentPartInternalTool;
|
|
330
338
|
interface ContentPartText {
|
|
331
|
-
|
|
332
|
-
|
|
339
|
+
type: "text";
|
|
340
|
+
text: string;
|
|
333
341
|
}
|
|
334
342
|
interface ContentPartFile {
|
|
335
|
-
|
|
336
|
-
|
|
343
|
+
type: "file";
|
|
344
|
+
file: FileInfo;
|
|
337
345
|
}
|
|
338
346
|
interface ContentPartThinking {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
347
|
+
type: "thinking";
|
|
348
|
+
id?: string;
|
|
349
|
+
text: string;
|
|
350
|
+
summary?: string;
|
|
351
|
+
redacted?: boolean;
|
|
352
|
+
encrypted?: string;
|
|
353
|
+
signature?: string;
|
|
346
354
|
}
|
|
347
355
|
interface ContentPartToolCall {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
356
|
+
type: "tool-call";
|
|
357
|
+
id: string;
|
|
358
|
+
name: string;
|
|
359
|
+
parameters: Record<string, unknown>;
|
|
360
|
+
providerMetadata?: Record<string, unknown>;
|
|
353
361
|
}
|
|
354
362
|
interface ContentPartInternalTool {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}
|
|
361
|
-
|
|
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
|
|
362
371
|
interface ExecutableTool<TSchema extends ZodObject<any> = ZodObject<any>> {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
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;
|
|
370
379
|
}
|
|
371
380
|
interface ServerTool {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
381
|
+
type: "server";
|
|
382
|
+
name: string;
|
|
383
|
+
config?: Record<string, unknown>;
|
|
375
384
|
}
|
|
376
385
|
type AxleTool = ExecutableTool | ServerTool;
|
|
377
386
|
type ToolDefinition = Pick<ExecutableTool, "name" | "description" | "schema">;
|
|
378
|
-
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/mcp/MCP.d.ts
|
|
379
389
|
interface MCPStdioConfig {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
390
|
+
transport: "stdio";
|
|
391
|
+
name?: string;
|
|
392
|
+
command: string;
|
|
393
|
+
args?: string[];
|
|
394
|
+
env?: Record<string, string>;
|
|
385
395
|
}
|
|
386
396
|
interface MCPHttpConfig {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
397
|
+
transport: "http";
|
|
398
|
+
name?: string;
|
|
399
|
+
url: string;
|
|
400
|
+
headers?: Record<string, string>;
|
|
391
401
|
}
|
|
392
402
|
type MCPConfig = MCPStdioConfig | MCPHttpConfig;
|
|
393
403
|
declare class MCP {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
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;
|
|
419
429
|
}
|
|
420
|
-
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region src/store/types.d.ts
|
|
421
432
|
interface FileStore {
|
|
422
|
-
|
|
423
|
-
|
|
433
|
+
read(path: string): Promise<string | null>;
|
|
434
|
+
write(path: string, content: string): Promise<void>;
|
|
424
435
|
}
|
|
425
|
-
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region src/memory/types.d.ts
|
|
426
438
|
interface MemoryContext {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
439
|
+
name?: string;
|
|
440
|
+
scope?: Record<string, string>;
|
|
441
|
+
system?: string;
|
|
442
|
+
messages: AxleMessage[];
|
|
443
|
+
newMessages?: AxleMessage[];
|
|
444
|
+
store: FileStore;
|
|
445
|
+
tracer?: TracingContext;
|
|
434
446
|
}
|
|
435
447
|
interface RecallResult {
|
|
436
|
-
|
|
448
|
+
systemSuffix?: string;
|
|
437
449
|
}
|
|
438
450
|
interface AgentMemory {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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
|
+
};
|
|
458
496
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
[key: string]: any;
|
|
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
|
+
};
|
|
468
505
|
}
|
|
469
|
-
interface
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
options?: GenerateTurnOptions;
|
|
506
|
+
interface InternalToolAction extends ActionPartBase {
|
|
507
|
+
kind: "internal-tool";
|
|
508
|
+
detail: {
|
|
509
|
+
name: string;
|
|
510
|
+
input?: unknown;
|
|
511
|
+
result?: ActionResult;
|
|
512
|
+
};
|
|
477
513
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
type
|
|
481
|
-
|
|
482
|
-
content: string | ToolResultPart[];
|
|
483
|
-
} | {
|
|
484
|
-
type: "error";
|
|
485
|
-
error: {
|
|
486
|
-
type: string;
|
|
487
|
-
message: string;
|
|
488
|
-
fatal?: boolean;
|
|
489
|
-
retryable?: boolean;
|
|
490
|
-
};
|
|
491
|
-
};
|
|
492
|
-
type ToolCallCallback = (name: string, parameters: Record<string, unknown>) => Promise<ToolCallResult | null | undefined>;
|
|
493
|
-
type GenerateError = {
|
|
494
|
-
type: "model";
|
|
495
|
-
error: ModelError;
|
|
514
|
+
type ActionPart = ToolAction | SubagentAction | InternalToolAction;
|
|
515
|
+
type ActionResult = {
|
|
516
|
+
type: "success";
|
|
517
|
+
content: unknown;
|
|
496
518
|
} | {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
519
|
+
type: "error";
|
|
520
|
+
error: {
|
|
521
|
+
type: string;
|
|
522
|
+
message: string;
|
|
523
|
+
};
|
|
502
524
|
};
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/turns/events.d.ts
|
|
527
|
+
type AgentEvent = {
|
|
528
|
+
type: "session:restore";
|
|
529
|
+
turns: Turn[];
|
|
530
|
+
config?: Record<string, unknown>;
|
|
508
531
|
} | {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
error: GenerateError;
|
|
512
|
-
usage?: Stats;
|
|
513
|
-
};
|
|
514
|
-
type StreamResult = GenerateResult | {
|
|
515
|
-
result: "cancelled";
|
|
516
|
-
messages: AxleMessage[];
|
|
517
|
-
partial?: AxleAssistantMessage;
|
|
518
|
-
usage: Stats;
|
|
519
|
-
};
|
|
520
|
-
|
|
521
|
-
type StreamEvent = {
|
|
522
|
-
type: "text:start";
|
|
523
|
-
index: number;
|
|
532
|
+
type: "turn:user";
|
|
533
|
+
turn: Turn;
|
|
524
534
|
} | {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
delta: string;
|
|
528
|
-
accumulated: string;
|
|
535
|
+
type: "turn:start";
|
|
536
|
+
turnId: string;
|
|
529
537
|
} | {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
538
|
+
type: "turn:end";
|
|
539
|
+
turnId: string;
|
|
540
|
+
status: TurnStatus;
|
|
541
|
+
usage: Stats;
|
|
533
542
|
} | {
|
|
534
|
-
|
|
535
|
-
|
|
543
|
+
type: "part:start";
|
|
544
|
+
turnId: string;
|
|
545
|
+
part: TurnPart;
|
|
536
546
|
} | {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
547
|
+
type: "text:delta";
|
|
548
|
+
turnId: string;
|
|
549
|
+
partId: string;
|
|
550
|
+
delta: string;
|
|
541
551
|
} | {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
552
|
+
type: "thinking:delta";
|
|
553
|
+
turnId: string;
|
|
554
|
+
partId: string;
|
|
555
|
+
delta: string;
|
|
545
556
|
} | {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
name: string;
|
|
557
|
+
type: "part:end";
|
|
558
|
+
turnId: string;
|
|
559
|
+
partId: string;
|
|
550
560
|
} | {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
parameters: Record<string, unknown>;
|
|
561
|
+
type: "action:running";
|
|
562
|
+
turnId: string;
|
|
563
|
+
partId: string;
|
|
564
|
+
parameters?: Record<string, unknown>;
|
|
556
565
|
} | {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
result: ToolCallResult | null;
|
|
566
|
+
type: "action:complete";
|
|
567
|
+
turnId: string;
|
|
568
|
+
partId: string;
|
|
569
|
+
result: ActionResult;
|
|
562
570
|
} | {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
571
|
+
type: "action:error";
|
|
572
|
+
turnId: string;
|
|
573
|
+
partId: string;
|
|
574
|
+
error: {
|
|
575
|
+
type: string;
|
|
576
|
+
message: string;
|
|
577
|
+
};
|
|
567
578
|
} | {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
output?: unknown;
|
|
579
|
+
type: "action:child-event";
|
|
580
|
+
turnId: string;
|
|
581
|
+
partId: string;
|
|
582
|
+
event: AgentEvent;
|
|
573
583
|
} | {
|
|
574
|
-
|
|
575
|
-
|
|
584
|
+
type: "error";
|
|
585
|
+
error: {
|
|
586
|
+
type: string;
|
|
587
|
+
message: string;
|
|
588
|
+
};
|
|
576
589
|
};
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
system?: string;
|
|
583
|
-
tools?: Array<ToolDefinition>;
|
|
584
|
-
serverTools?: Array<ServerTool>;
|
|
585
|
-
onToolCall?: ToolCallCallback;
|
|
586
|
-
maxIterations?: number;
|
|
587
|
-
tracer?: TracingContext;
|
|
588
|
-
options?: GenerateTurnOptions;
|
|
589
|
-
}
|
|
590
|
-
interface StreamHandle {
|
|
591
|
-
on(callback: StreamEventCallback): void;
|
|
592
|
-
cancel(): void;
|
|
593
|
-
readonly final: Promise<StreamResult>;
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/utils/utils.d.ts
|
|
592
|
+
interface Handle<T> {
|
|
593
|
+
cancel(): void;
|
|
594
|
+
readonly final: Promise<T>;
|
|
594
595
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
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>;
|
|
600
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]> };
|
|
601
626
|
declare function parseResponse<T extends OutputSchema>(rawValue: string, schema?: T): ParsedSchema<T> | string;
|
|
602
|
-
|
|
627
|
+
//#endregion
|
|
628
|
+
//#region src/core/Instruct.d.ts
|
|
603
629
|
declare class Instruct<TSchema extends OutputSchema | undefined = undefined> {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
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;
|
|
621
647
|
}
|
|
622
|
-
|
|
648
|
+
//#endregion
|
|
649
|
+
//#region src/core/Agent.d.ts
|
|
623
650
|
interface AgentOptions {
|
|
624
|
-
|
|
651
|
+
strictVariables?: boolean;
|
|
625
652
|
}
|
|
626
653
|
interface AgentConfig {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
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;
|
|
637
664
|
}
|
|
638
665
|
interface AgentResult<T = string> {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
usage: Stats;
|
|
666
|
+
response: T | null;
|
|
667
|
+
turn: Turn | undefined;
|
|
668
|
+
usage: Stats;
|
|
643
669
|
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
670
|
+
type AgentHandle<T = string> = Handle<AgentResult<T>>;
|
|
671
|
+
type AgentEventCallback = (event: AgentEvent) => void;
|
|
672
|
+
interface SendMessageOptions {
|
|
673
|
+
signal?: AbortSignal;
|
|
647
674
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
readonly model: string;
|
|
651
|
-
readonly history: History;
|
|
652
|
-
readonly tracer?: TracingContext;
|
|
653
|
-
readonly name?: string;
|
|
654
|
-
readonly scope?: Record<string, string>;
|
|
655
|
-
readonly store: FileStore;
|
|
656
|
-
system: string | undefined;
|
|
657
|
-
tools: Record<string, ExecutableTool>;
|
|
658
|
-
serverTools: ServerTool[];
|
|
659
|
-
private mcps;
|
|
660
|
-
private mcpToolsResolved;
|
|
661
|
-
private memory?;
|
|
662
|
-
private options;
|
|
663
|
-
private eventCallbacks;
|
|
664
|
-
constructor(config: AgentConfig);
|
|
665
|
-
addTool(tool: AxleTool): void;
|
|
666
|
-
addTools(tools: AxleTool[]): void;
|
|
667
|
-
addMcp(mcp: MCP): void;
|
|
668
|
-
addMcps(mcps: MCP[]): void;
|
|
669
|
-
hasTools(): boolean;
|
|
670
|
-
on(callback: StreamEventCallback): void;
|
|
671
|
-
send(message: string): AgentHandle<string>;
|
|
672
|
-
send(instruct: Instruct<undefined>, variables?: Record<string, string>): AgentHandle<string>;
|
|
673
|
-
send<TSchema extends OutputSchema>(instruct: Instruct<TSchema>, variables?: Record<string, string>): AgentHandle<ParsedSchema<TSchema>>;
|
|
674
|
-
private resolveMcpTools;
|
|
675
|
-
private execute;
|
|
675
|
+
interface SendInstructOptions extends SendMessageOptions {
|
|
676
|
+
variables?: Record<string, string>;
|
|
676
677
|
}
|
|
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
|
|
678
711
|
interface CompileOptions {
|
|
679
|
-
|
|
712
|
+
strictVariables?: boolean;
|
|
680
713
|
}
|
|
681
714
|
declare function compileInstruct(instruct: Instruct<any>, variables?: Record<string, string>, options?: CompileOptions): string;
|
|
682
|
-
|
|
715
|
+
//#endregion
|
|
716
|
+
//#region src/providers/anthropic/provider.d.ts
|
|
683
717
|
declare function anthropic(apiKey: string): AIProvider;
|
|
684
|
-
|
|
718
|
+
//#endregion
|
|
719
|
+
//#region src/providers/anthropic/index.d.ts
|
|
685
720
|
declare const Anthropic: {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
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";
|
|
705
740
|
};
|
|
706
|
-
|
|
741
|
+
//#endregion
|
|
742
|
+
//#region src/providers/chatcompletions/provider.d.ts
|
|
707
743
|
declare function chatCompletions(baseUrl: string, apiKey?: string): AIProvider;
|
|
708
|
-
|
|
744
|
+
//#endregion
|
|
745
|
+
//#region src/providers/gemini/provider.d.ts
|
|
709
746
|
declare function gemini(apiKey: string): AIProvider;
|
|
710
|
-
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/providers/gemini/index.d.ts
|
|
711
749
|
declare const Gemini: {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
readonly
|
|
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";
|
|
736
776
|
};
|
|
737
|
-
|
|
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
|
|
738
842
|
interface GenerateOptions {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
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;
|
|
748
852
|
}
|
|
749
853
|
declare function generate(options: GenerateOptions): Promise<GenerateResult>;
|
|
750
|
-
|
|
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
|
|
751
948
|
declare function openai(apiKey: string): AIProvider;
|
|
752
|
-
|
|
949
|
+
//#endregion
|
|
950
|
+
//#region src/providers/openai/index.d.ts
|
|
753
951
|
declare const OpenAI: {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
readonly O1_2024_12_17: "o1-2024-12-17";
|
|
807
|
-
readonly O1_PRO: "o1-pro";
|
|
808
|
-
readonly O1_PRO_2025_03_19: "o1-pro-2025-03-19";
|
|
809
|
-
};
|
|
810
|
-
readonly DefaultModel: "gpt-5-mini";
|
|
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";
|
|
811
1004
|
};
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
type BraveProviderConfig = z$1.infer<typeof BraveProviderConfigSchema>;
|
|
818
|
-
|
|
819
|
-
declare const braveSearchSchema: z.ZodObject<{
|
|
820
|
-
searchTerm: z.ZodString;
|
|
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>;
|
|
821
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>;
|
|
822
1017
|
declare class BraveSearchTool implements ExecutableTool<typeof braveSearchSchema> {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
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>;
|
|
834
1029
|
}
|
|
835
1030
|
declare const braveSearchTool: BraveSearchTool;
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
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>;
|
|
847
1043
|
declare const calculatorTool: ExecutableTool<typeof calculatorSchema>;
|
|
848
|
-
|
|
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
|
|
849
1067
|
/**
|
|
850
1068
|
* Root tracer that manages writers and creates spans.
|
|
851
1069
|
* Use startSpan() to create TracingContext instances for hierarchical tracing.
|
|
852
1070
|
* All logging happens within spans - the Tracer itself is just configuration and factory.
|
|
853
1071
|
*/
|
|
854
1072
|
declare class Tracer {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
}
|
|
874
|
-
|
|
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
|
|
875
1094
|
interface SimpleWriterOptions {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
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;
|
|
888
1107
|
}
|
|
889
1108
|
declare class SimpleWriter implements TraceWriter {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
}
|
|
921
|
-
|
|
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
|
|
922
1142
|
interface ProceduralMemoryConfig {
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1143
|
+
provider: AIProvider;
|
|
1144
|
+
model: string;
|
|
1145
|
+
enableTools?: boolean;
|
|
926
1146
|
}
|
|
927
1147
|
declare class ProceduralMemory implements AgentMemory {
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
}
|
|
944
|
-
|
|
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
|
|
945
1166
|
declare class LocalFileStore implements FileStore {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1167
|
+
readonly rootPath: string;
|
|
1168
|
+
constructor(rootPath: string);
|
|
1169
|
+
read(path: string): Promise<string | null>;
|
|
1170
|
+
write(path: string, content: string): Promise<void>;
|
|
950
1171
|
}
|
|
951
|
-
|
|
952
|
-
export { Agent, Anthropic, AxleStopReason, Gemini, History, Instruct, LocalFileStore, MCP, OpenAI, ProceduralMemory, SimpleWriter, Tracer, anthropic, braveSearchTool, calculatorTool, chatCompletions, compileInstruct, gemini, generate, generateTurn, loadFileContent, openai, parseResponse, stream };
|
|
953
|
-
export type { AIProvider, AgentConfig, AgentHandle, AgentMemory, AgentResult, AxleAssistantMessage, AxleMessage, AxleTool, AxleToolCallMessage, AxleToolCallResult, AxleUserMessage, ContentPart, ContentPartFile, ContentPartText, ContentPartThinking, ContentPartToolCall, EventLevel, ExecutableTool, FileInfo, FileStore, MCPConfig, MCPHttpConfig, MCPStdioConfig, MemoryContext, ProceduralMemoryConfig, RecallResult, ServerTool, SimpleWriterOptions, SpanData, SpanOptions, SpanType, StreamEvent, StreamEventCallback, ToolDefinition, ToolResultPart, TraceWriter, TracingContext };
|
|
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 };
|