@fifthrevision/axle 0.17.0 → 0.19.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 +125 -12
- package/dist/ProceduralMemory-CNxHj5B2.js +45 -0
- package/dist/accumulator-D2NgIGxp.d.ts +547 -0
- package/dist/accumulator-vmmD3pxt.js +1 -0
- package/dist/cli.js +5 -5
- package/dist/index.d.ts +128 -415
- package/dist/index.js +1 -1
- package/dist/models-Bp_jVWHN.js +1 -0
- package/dist/models-C7fdWvZ6.js +1 -0
- package/dist/{models-CI5k-LHn.d.ts → models-Whj6ZP3l.d.ts} +3 -1
- package/dist/providers/models.d.ts +1 -1
- package/dist/providers/models.js +1 -1
- package/dist/ui.d.ts +2 -0
- package/dist/ui.js +1 -0
- package/package.json +15 -11
- package/dist/ProceduralMemory-JWM3glv-.js +0 -45
- package/dist/models-CKz-RHh1.js +0 -1
- package/dist/models-DlE4tfcj.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
+
import { A as FileResolveRequest, B as TracingContext, C as TurnStatus, D as FileKind, E as FileInfo, F as SpanData, I as SpanEvent, L as SpanOptions, M as ResolvedFileSource, N as loadFileContent, O as FileProviderId, P as EventLevel, R as SpanType, S as TurnPart, T as DeferredFileInfo, V as Stats, _ as TextPart, b as ToolAction, c as TurnEvent, d as Annotation, f as AnnotationPlacement, g as SubagentAction, h as ProviderToolAction, i as TurnAccumulatorState, j as FileResolver, k as FileResolveFormat, l as ActionPart, m as FilePart, n as TurnAccumulator, o as AnnotationEvent, p as AnnotationStatus, r as TurnAccumulatorResult, s as AnnotationTarget, t as AccumulatableEvent, u as ActionResult, v as ThinkingPart, w as ConcreteFileInfo, x as Turn, z as TraceWriter } from "./accumulator-D2NgIGxp.js";
|
|
1
2
|
import * as z$2 from "zod";
|
|
2
3
|
import { ZodObject, z } from "zod";
|
|
3
4
|
|
|
4
|
-
//#region src/types.d.ts
|
|
5
|
-
interface Stats {
|
|
6
|
-
in: number;
|
|
7
|
-
out: number;
|
|
8
|
-
}
|
|
9
|
-
//#endregion
|
|
10
5
|
//#region src/messages/stream.d.ts
|
|
11
6
|
interface StreamChunk {
|
|
12
7
|
type: "start" | "text-start" | "text-delta" | "text-complete" | "tool-call-start" | "tool-call-args-delta" | "tool-call-complete" | "thinking-start" | "thinking-delta" | "thinking-summary-delta" | "thinking-complete" | "provider-tool-start" | "provider-tool-complete" | "complete" | "error";
|
|
@@ -132,220 +127,94 @@ interface StreamProviderToolCompleteChunk extends StreamChunk {
|
|
|
132
127
|
}
|
|
133
128
|
type AnyStreamChunk = StreamStartChunk | StreamCompleteChunk | StreamErrorChunk | StreamTextStartChunk | StreamTextDeltaChunk | StreamTextCompleteChunk | StreamThinkingStartChunk | StreamThinkingDeltaChunk | StreamThinkingSummaryDeltaChunk | StreamThinkingCompleteChunk | StreamToolCallStartChunk | StreamToolCallArgsDeltaChunk | StreamToolCallCompleteChunk | StreamProviderToolStartChunk | StreamProviderToolCompleteChunk;
|
|
134
129
|
//#endregion
|
|
135
|
-
//#region src/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
interface
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
interface SpanData {
|
|
146
|
-
traceId: string;
|
|
147
|
-
spanId: string;
|
|
148
|
-
parentSpanId?: string;
|
|
149
|
-
name: string;
|
|
150
|
-
type?: SpanType;
|
|
151
|
-
startTime: number;
|
|
152
|
-
endTime?: number;
|
|
153
|
-
status: SpanStatus;
|
|
154
|
-
attributes: Record<string, unknown>;
|
|
155
|
-
events: SpanEvent[];
|
|
156
|
-
result?: SpanResult;
|
|
157
|
-
}
|
|
158
|
-
interface SpanOptions {
|
|
159
|
-
type?: SpanType;
|
|
160
|
-
}
|
|
161
|
-
type SpanResult = LLMResult | ToolResult;
|
|
162
|
-
interface LLMResult {
|
|
163
|
-
kind: "llm";
|
|
164
|
-
model: string;
|
|
165
|
-
request: LLMRequest;
|
|
166
|
-
response: LLMResponse;
|
|
167
|
-
usage?: TokenUsage;
|
|
168
|
-
finishReason?: string;
|
|
169
|
-
}
|
|
170
|
-
interface LLMRequest {
|
|
171
|
-
messages: unknown[];
|
|
172
|
-
system?: string;
|
|
173
|
-
tools?: unknown[];
|
|
174
|
-
}
|
|
175
|
-
interface LLMResponse {
|
|
176
|
-
content: unknown;
|
|
177
|
-
}
|
|
178
|
-
interface TokenUsage {
|
|
179
|
-
inputTokens?: number;
|
|
180
|
-
outputTokens?: number;
|
|
181
|
-
totalTokens?: number;
|
|
182
|
-
}
|
|
183
|
-
interface ToolResult {
|
|
184
|
-
kind: "tool";
|
|
185
|
-
name: string;
|
|
186
|
-
input: unknown;
|
|
187
|
-
output: unknown;
|
|
188
|
-
}
|
|
189
|
-
interface TraceWriter {
|
|
190
|
-
onSpanStart(span: SpanData): void;
|
|
191
|
-
onSpanUpdate?(span: SpanData): void;
|
|
192
|
-
onSpanEnd(span: SpanData): void;
|
|
193
|
-
onEvent?(span: SpanData, event: SpanEvent): void;
|
|
194
|
-
flush?(): Promise<void>;
|
|
130
|
+
//#region src/providers/types.d.ts
|
|
131
|
+
/**
|
|
132
|
+
* Internal services available to provider adapters while executing a model request.
|
|
133
|
+
*/
|
|
134
|
+
interface ProviderRuntime {
|
|
135
|
+
/** Request-scoped tracing span used by provider adapters. */
|
|
136
|
+
tracer?: TracingContext;
|
|
137
|
+
/** Resolves file references before provider-specific request conversion. */
|
|
138
|
+
fileResolver?: FileResolver;
|
|
195
139
|
}
|
|
196
140
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
141
|
+
* Raw provider-specific request fields.
|
|
142
|
+
*
|
|
143
|
+
* Provider adapters apply this after Axle-normalized options, so these values
|
|
144
|
+
* can intentionally override Axle's provider mappings.
|
|
199
145
|
*/
|
|
200
|
-
interface
|
|
201
|
-
|
|
202
|
-
end(status?: SpanStatus): void;
|
|
203
|
-
debug(message: string, attributes?: Record<string, unknown>): void;
|
|
204
|
-
info(message: string, attributes?: Record<string, unknown>): void;
|
|
205
|
-
warn(message: string, attributes?: Record<string, unknown>): void;
|
|
206
|
-
error(message: string, attributes?: Record<string, unknown>): void;
|
|
207
|
-
setAttribute(key: string, value: unknown): void;
|
|
208
|
-
setAttributes(attributes: Record<string, unknown>): void;
|
|
209
|
-
setResult(result: SpanResult): void;
|
|
146
|
+
interface ProviderOptions {
|
|
147
|
+
[key: string]: any;
|
|
210
148
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
type
|
|
215
|
-
type: "
|
|
216
|
-
content: string;
|
|
217
|
-
} | {
|
|
218
|
-
type: "url";
|
|
219
|
-
url: string;
|
|
220
|
-
} | {
|
|
221
|
-
type: "ref";
|
|
222
|
-
ref: unknown;
|
|
223
|
-
};
|
|
224
|
-
type BinarySource = {
|
|
225
|
-
type: "base64";
|
|
226
|
-
data: string;
|
|
227
|
-
} | {
|
|
228
|
-
type: "url";
|
|
229
|
-
url: string;
|
|
230
|
-
} | {
|
|
231
|
-
type: "ref";
|
|
232
|
-
ref: unknown;
|
|
233
|
-
};
|
|
234
|
-
interface BaseFile {
|
|
235
|
-
mimeType: string;
|
|
149
|
+
/**
|
|
150
|
+
* Controls how the model may use tools during a single model request.
|
|
151
|
+
*/
|
|
152
|
+
type ToolChoice = "auto" | "none" | "required" | {
|
|
153
|
+
type: "tool";
|
|
236
154
|
name: string;
|
|
237
|
-
size?: number;
|
|
238
|
-
}
|
|
239
|
-
type TextFileInfo = BaseFile & {
|
|
240
|
-
kind: "text";
|
|
241
|
-
source: TextSource;
|
|
242
|
-
};
|
|
243
|
-
type BinaryFileInfo = BaseFile & {
|
|
244
|
-
kind: "image" | "document";
|
|
245
|
-
source: BinarySource;
|
|
246
155
|
};
|
|
247
|
-
type FileInfo = TextFileInfo | BinaryFileInfo;
|
|
248
|
-
type InlineTextFile = TextFileInfo & {
|
|
249
|
-
source: {
|
|
250
|
-
type: "text";
|
|
251
|
-
content: string;
|
|
252
|
-
};
|
|
253
|
-
};
|
|
254
|
-
type InlineBinaryFile = BinaryFileInfo & {
|
|
255
|
-
source: {
|
|
256
|
-
type: "base64";
|
|
257
|
-
data: string;
|
|
258
|
-
};
|
|
259
|
-
};
|
|
260
|
-
type DeferredFileInfo = FileInfo & {
|
|
261
|
-
source: {
|
|
262
|
-
type: "ref";
|
|
263
|
-
ref: unknown;
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
type ConcreteFileInfo = FileInfo & {
|
|
267
|
-
source: {
|
|
268
|
-
type: "text";
|
|
269
|
-
} | {
|
|
270
|
-
type: "base64";
|
|
271
|
-
} | {
|
|
272
|
-
type: "url";
|
|
273
|
-
};
|
|
274
|
-
};
|
|
275
|
-
type FileProviderId = "anthropic" | "openai" | "gemini" | "chatcompletions";
|
|
276
|
-
type FileResolveFormat = "base64" | "url" | "text" | "gemini-file-uri";
|
|
277
|
-
type ResolvedFileSource = {
|
|
278
|
-
type: "base64";
|
|
279
|
-
data: string;
|
|
280
|
-
mimeType?: string;
|
|
281
|
-
name?: string;
|
|
282
|
-
} | {
|
|
283
|
-
type: "url";
|
|
284
|
-
url: string;
|
|
285
|
-
mimeType?: string;
|
|
286
|
-
name?: string;
|
|
287
|
-
} | {
|
|
288
|
-
type: "text";
|
|
289
|
-
content: string;
|
|
290
|
-
mimeType?: string;
|
|
291
|
-
name?: string;
|
|
292
|
-
} | {
|
|
293
|
-
type: "gemini-file-uri";
|
|
294
|
-
uri: string;
|
|
295
|
-
mimeType?: string;
|
|
296
|
-
name?: string;
|
|
297
|
-
};
|
|
298
|
-
interface FileResolveRequest {
|
|
299
|
-
file: DeferredFileInfo;
|
|
300
|
-
ref: unknown;
|
|
301
|
-
provider: FileProviderId;
|
|
302
|
-
model: string;
|
|
303
|
-
accepted: FileResolveFormat[];
|
|
304
|
-
signal?: AbortSignal;
|
|
305
|
-
}
|
|
306
|
-
type FileResolver = (request: FileResolveRequest) => Promise<ResolvedFileSource>;
|
|
307
156
|
/**
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
157
|
+
* Provider-portable options for a single model request.
|
|
158
|
+
*
|
|
159
|
+
* These fields are normalized by Axle and mapped to each provider's request
|
|
160
|
+
* shape. Use `providerOptions` for provider-specific controls that are not
|
|
161
|
+
* represented here.
|
|
312
162
|
*/
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
tracer?: TracingContext;
|
|
320
|
-
fileResolver?: FileResolver;
|
|
321
|
-
}
|
|
322
|
-
interface GenerateTurnOptions {
|
|
163
|
+
interface AxleModelRequestOptions {
|
|
164
|
+
/** Enables or disables provider reasoning/thinking controls where supported. */
|
|
165
|
+
reasoning?: boolean;
|
|
166
|
+
/** Maximum output tokens to request from the model. */
|
|
167
|
+
maxOutputTokens?: number;
|
|
168
|
+
/** Sampling temperature, when supported by the provider/model. */
|
|
323
169
|
temperature?: number;
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
presence_penalty?: number;
|
|
170
|
+
/** Nucleus sampling value, mapped to provider-specific casing. */
|
|
171
|
+
topP?: number;
|
|
172
|
+
/** Stop sequence or sequences for text generation. */
|
|
328
173
|
stop?: string | string[];
|
|
329
|
-
|
|
174
|
+
/** Constrains tool use for this model request. */
|
|
175
|
+
toolChoice?: ToolChoice;
|
|
176
|
+
/** Requests that the provider avoid parallel tool calls when supported. */
|
|
177
|
+
parallelToolCalls?: boolean;
|
|
178
|
+
/** Raw provider-specific request fields applied after normalized mappings. */
|
|
179
|
+
providerOptions?: ProviderOptions;
|
|
180
|
+
/** Abort signal for the in-flight model request. */
|
|
181
|
+
signal?: AbortSignal;
|
|
330
182
|
}
|
|
331
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Parameters passed to provider adapters for one non-streaming generation call.
|
|
185
|
+
*/
|
|
186
|
+
interface ProviderGenerationParams extends AxleModelRequestOptions {
|
|
187
|
+
/** Conversation messages to send to the provider. */
|
|
332
188
|
messages: Array<AxleMessage>;
|
|
189
|
+
/** Optional system/developer instruction for the request. */
|
|
333
190
|
system?: string;
|
|
191
|
+
/** Executable tools exposed as provider function tools. */
|
|
334
192
|
tools?: Array<ToolDefinition>;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
193
|
+
/** Provider-managed tools such as web search or code execution. */
|
|
194
|
+
providerTools?: Array<ProviderTool>;
|
|
195
|
+
/** Internal services available during provider request creation. */
|
|
196
|
+
runtime: ProviderRuntime;
|
|
339
197
|
}
|
|
340
|
-
|
|
341
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Parameters passed to provider adapters for one streaming generation call.
|
|
200
|
+
*/
|
|
201
|
+
interface ProviderStreamParams extends ProviderGenerationParams {}
|
|
202
|
+
interface ContextUsage {
|
|
203
|
+
total: number;
|
|
204
|
+
system: number;
|
|
205
|
+
tools: number;
|
|
206
|
+
mcpTools: number;
|
|
207
|
+
providerTools: number;
|
|
208
|
+
messages: number;
|
|
209
|
+
limit?: number;
|
|
210
|
+
free?: number;
|
|
342
211
|
}
|
|
343
212
|
interface AIProvider {
|
|
344
213
|
get name(): string;
|
|
345
214
|
/** @internal */
|
|
346
|
-
createGenerationRequest(model: string, params:
|
|
215
|
+
createGenerationRequest(model: string, params: ProviderGenerationParams): Promise<ModelResult>;
|
|
347
216
|
/** @internal */
|
|
348
|
-
createStreamingRequest(model: string, params:
|
|
217
|
+
createStreamingRequest(model: string, params: ProviderStreamParams): AsyncGenerator<AnyStreamChunk, void, unknown>;
|
|
349
218
|
}
|
|
350
219
|
interface ModelResponse {
|
|
351
220
|
type: "success";
|
|
@@ -445,7 +314,8 @@ interface ContentPartProviderTool {
|
|
|
445
314
|
//#endregion
|
|
446
315
|
//#region src/tools/registry.d.ts
|
|
447
316
|
declare class ToolRegistry {
|
|
448
|
-
private
|
|
317
|
+
private tools;
|
|
318
|
+
private mcpTools;
|
|
449
319
|
private providerTools;
|
|
450
320
|
constructor(init?: {
|
|
451
321
|
tools?: ExecutableTool[];
|
|
@@ -453,6 +323,8 @@ declare class ToolRegistry {
|
|
|
453
323
|
});
|
|
454
324
|
add(tool: ExecutableTool): void;
|
|
455
325
|
add(tools: ExecutableTool[]): void;
|
|
326
|
+
addMcp(tool: ExecutableTool): void;
|
|
327
|
+
addMcp(tools: ExecutableTool[]): void;
|
|
456
328
|
addProvider(tool: ProviderTool): void;
|
|
457
329
|
addProvider(tools: ProviderTool[]): void;
|
|
458
330
|
remove(name: string): boolean;
|
|
@@ -460,6 +332,8 @@ declare class ToolRegistry {
|
|
|
460
332
|
get(name: string): ExecutableTool | undefined;
|
|
461
333
|
getProvider(name: string): ProviderTool | undefined;
|
|
462
334
|
executable(): ExecutableTool[];
|
|
335
|
+
local(): ExecutableTool[];
|
|
336
|
+
mcp(): ExecutableTool[];
|
|
463
337
|
provider(): ProviderTool[];
|
|
464
338
|
get size(): number;
|
|
465
339
|
}
|
|
@@ -602,167 +476,6 @@ type GenerateResult<TResponse = AxleAssistantMessage> = {
|
|
|
602
476
|
};
|
|
603
477
|
type StreamResult<TResponse = AxleAssistantMessage> = GenerateResult<TResponse>;
|
|
604
478
|
//#endregion
|
|
605
|
-
//#region src/turns/types.d.ts
|
|
606
|
-
type TurnStatus = "streaming" | "complete" | "cancelled" | "error";
|
|
607
|
-
interface TimingInfo {
|
|
608
|
-
start: string;
|
|
609
|
-
end?: string;
|
|
610
|
-
}
|
|
611
|
-
interface Turn {
|
|
612
|
-
id: string;
|
|
613
|
-
owner: "user" | "agent";
|
|
614
|
-
parts: TurnPart[];
|
|
615
|
-
status: TurnStatus;
|
|
616
|
-
timing?: TimingInfo;
|
|
617
|
-
usage?: Stats;
|
|
618
|
-
}
|
|
619
|
-
type TurnPart = TextPart | FilePart | ThinkingPart | ActionPart;
|
|
620
|
-
interface TextPart {
|
|
621
|
-
id: string;
|
|
622
|
-
type: "text";
|
|
623
|
-
text: string;
|
|
624
|
-
timing?: TimingInfo;
|
|
625
|
-
}
|
|
626
|
-
interface FilePart {
|
|
627
|
-
id: string;
|
|
628
|
-
type: "file";
|
|
629
|
-
file: FileInfo;
|
|
630
|
-
timing?: TimingInfo;
|
|
631
|
-
}
|
|
632
|
-
interface ThinkingPart {
|
|
633
|
-
id: string;
|
|
634
|
-
type: "thinking";
|
|
635
|
-
text: string;
|
|
636
|
-
summary?: string;
|
|
637
|
-
redacted?: boolean;
|
|
638
|
-
timing?: TimingInfo;
|
|
639
|
-
}
|
|
640
|
-
interface ActionPartBase {
|
|
641
|
-
id: string;
|
|
642
|
-
type: "action";
|
|
643
|
-
kind: string;
|
|
644
|
-
status: "pending" | "running" | "complete" | "cancelled" | "error";
|
|
645
|
-
timing?: TimingInfo;
|
|
646
|
-
}
|
|
647
|
-
interface ToolAction extends ActionPartBase {
|
|
648
|
-
kind: "tool";
|
|
649
|
-
detail: {
|
|
650
|
-
name: string;
|
|
651
|
-
parameters: Record<string, unknown>;
|
|
652
|
-
pendingArgs?: string;
|
|
653
|
-
result?: ActionResult;
|
|
654
|
-
};
|
|
655
|
-
}
|
|
656
|
-
interface SubagentAction extends ActionPartBase {
|
|
657
|
-
kind: "agent";
|
|
658
|
-
detail: {
|
|
659
|
-
name: string;
|
|
660
|
-
config?: Record<string, unknown>;
|
|
661
|
-
children: Turn[];
|
|
662
|
-
result?: ActionResult;
|
|
663
|
-
};
|
|
664
|
-
}
|
|
665
|
-
interface ProviderToolAction extends ActionPartBase {
|
|
666
|
-
kind: "provider-tool";
|
|
667
|
-
detail: {
|
|
668
|
-
name: string;
|
|
669
|
-
input?: unknown;
|
|
670
|
-
result?: ActionResult;
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
type ActionPart = ToolAction | SubagentAction | ProviderToolAction;
|
|
674
|
-
type ActionResult = {
|
|
675
|
-
type: "in-progress";
|
|
676
|
-
content: string;
|
|
677
|
-
} | {
|
|
678
|
-
type: "success";
|
|
679
|
-
content: unknown;
|
|
680
|
-
} | {
|
|
681
|
-
type: "error";
|
|
682
|
-
error: {
|
|
683
|
-
type: string;
|
|
684
|
-
message: string;
|
|
685
|
-
};
|
|
686
|
-
};
|
|
687
|
-
//#endregion
|
|
688
|
-
//#region src/turns/events.d.ts
|
|
689
|
-
type AgentEvent = {
|
|
690
|
-
type: "session:restore";
|
|
691
|
-
turns: Turn[];
|
|
692
|
-
config?: Record<string, unknown>;
|
|
693
|
-
} | {
|
|
694
|
-
type: "turn:user";
|
|
695
|
-
turn: Turn;
|
|
696
|
-
} | {
|
|
697
|
-
type: "turn:start";
|
|
698
|
-
turnId: string;
|
|
699
|
-
} | {
|
|
700
|
-
type: "turn:end";
|
|
701
|
-
turnId: string;
|
|
702
|
-
status: TurnStatus;
|
|
703
|
-
usage: Stats;
|
|
704
|
-
timing?: TimingInfo;
|
|
705
|
-
} | {
|
|
706
|
-
type: "part:start";
|
|
707
|
-
turnId: string;
|
|
708
|
-
part: TurnPart;
|
|
709
|
-
} | {
|
|
710
|
-
type: "text:delta";
|
|
711
|
-
turnId: string;
|
|
712
|
-
partId: string;
|
|
713
|
-
delta: string;
|
|
714
|
-
} | {
|
|
715
|
-
type: "thinking:delta";
|
|
716
|
-
turnId: string;
|
|
717
|
-
partId: string;
|
|
718
|
-
delta: string;
|
|
719
|
-
} | {
|
|
720
|
-
type: "part:end";
|
|
721
|
-
turnId: string;
|
|
722
|
-
partId: string;
|
|
723
|
-
timing?: TimingInfo;
|
|
724
|
-
} | {
|
|
725
|
-
type: "action:args-delta";
|
|
726
|
-
turnId: string;
|
|
727
|
-
partId: string;
|
|
728
|
-
delta: string;
|
|
729
|
-
accumulated: string;
|
|
730
|
-
} | {
|
|
731
|
-
type: "action:running";
|
|
732
|
-
turnId: string;
|
|
733
|
-
partId: string;
|
|
734
|
-
parameters?: Record<string, unknown>;
|
|
735
|
-
} | {
|
|
736
|
-
type: "action:progress";
|
|
737
|
-
turnId: string;
|
|
738
|
-
partId: string;
|
|
739
|
-
chunk: string;
|
|
740
|
-
} | {
|
|
741
|
-
type: "action:complete";
|
|
742
|
-
turnId: string;
|
|
743
|
-
partId: string;
|
|
744
|
-
result: ActionResult;
|
|
745
|
-
} | {
|
|
746
|
-
type: "action:error";
|
|
747
|
-
turnId: string;
|
|
748
|
-
partId: string;
|
|
749
|
-
error: {
|
|
750
|
-
type: string;
|
|
751
|
-
message: string;
|
|
752
|
-
};
|
|
753
|
-
} | {
|
|
754
|
-
type: "action:child-event";
|
|
755
|
-
turnId: string;
|
|
756
|
-
partId: string;
|
|
757
|
-
event: AgentEvent;
|
|
758
|
-
} | {
|
|
759
|
-
type: "error";
|
|
760
|
-
error: {
|
|
761
|
-
type: string;
|
|
762
|
-
message: string;
|
|
763
|
-
};
|
|
764
|
-
};
|
|
765
|
-
//#endregion
|
|
766
479
|
//#region src/utils/utils.d.ts
|
|
767
480
|
interface Handle<T> {
|
|
768
481
|
cancel(reason?: unknown): void;
|
|
@@ -790,6 +503,7 @@ declare class History {
|
|
|
790
503
|
get turns(): Turn[];
|
|
791
504
|
get log(): AxleMessage[];
|
|
792
505
|
addTurn(turn: Turn): void;
|
|
506
|
+
replaceTurns(turns: Turn[]): void;
|
|
793
507
|
appendToLog(messages: AxleMessage | AxleMessage[]): void;
|
|
794
508
|
latestTurn(): Turn | undefined;
|
|
795
509
|
toString(): string;
|
|
@@ -834,7 +548,7 @@ declare class Instruct<TSchema extends OutputSchema | undefined = undefined> {
|
|
|
834
548
|
}
|
|
835
549
|
//#endregion
|
|
836
550
|
//#region src/core/Agent.d.ts
|
|
837
|
-
interface AgentConfig {
|
|
551
|
+
interface AgentConfig extends Omit<AxleModelRequestOptions, "signal"> {
|
|
838
552
|
provider: AIProvider;
|
|
839
553
|
model: string;
|
|
840
554
|
system?: string;
|
|
@@ -846,7 +560,6 @@ interface AgentConfig {
|
|
|
846
560
|
memory?: AgentMemory;
|
|
847
561
|
tracer?: TracingContext;
|
|
848
562
|
fileResolver?: FileResolver;
|
|
849
|
-
reasoning?: boolean;
|
|
850
563
|
}
|
|
851
564
|
interface AgentResult<T = string> {
|
|
852
565
|
ok: true;
|
|
@@ -862,11 +575,9 @@ interface AgentErrorResult {
|
|
|
862
575
|
usage: Stats;
|
|
863
576
|
}
|
|
864
577
|
type AgentHandle<T = string> = Handle<AgentResult<T> | AgentErrorResult>;
|
|
865
|
-
type
|
|
866
|
-
interface SendMessageOptions {
|
|
867
|
-
signal?: AbortSignal;
|
|
578
|
+
type TurnEventCallback = (event: TurnEvent) => void;
|
|
579
|
+
interface SendMessageOptions extends AxleModelRequestOptions {
|
|
868
580
|
fileResolver?: FileResolver;
|
|
869
|
-
reasoning?: boolean;
|
|
870
581
|
}
|
|
871
582
|
declare class Agent {
|
|
872
583
|
readonly provider: AIProvider;
|
|
@@ -877,7 +588,7 @@ declare class Agent {
|
|
|
877
588
|
readonly scope?: Record<string, string>;
|
|
878
589
|
readonly store: FileStore;
|
|
879
590
|
readonly fileResolver?: FileResolver;
|
|
880
|
-
readonly
|
|
591
|
+
readonly requestOptions: Omit<AxleModelRequestOptions, "signal">;
|
|
881
592
|
readonly registry: ToolRegistry;
|
|
882
593
|
system: string | undefined;
|
|
883
594
|
private mcps;
|
|
@@ -889,11 +600,13 @@ declare class Agent {
|
|
|
889
600
|
addMcp(mcp: MCP): void;
|
|
890
601
|
addMcps(mcps: MCP[]): void;
|
|
891
602
|
hasTools(): boolean;
|
|
892
|
-
on(callback:
|
|
603
|
+
on(callback: TurnEventCallback): void;
|
|
604
|
+
context(): ContextUsage;
|
|
893
605
|
send(message: string | Instruct<undefined>, options?: SendMessageOptions): AgentHandle<string>;
|
|
894
606
|
send<TSchema extends OutputSchema>(instruct: Instruct<TSchema>, options?: SendMessageOptions): AgentHandle<ParsedSchema<TSchema>>;
|
|
895
607
|
private resolveMcpTools;
|
|
896
608
|
private emitEvent;
|
|
609
|
+
private toToolDefinitions;
|
|
897
610
|
private run;
|
|
898
611
|
}
|
|
899
612
|
//#endregion
|
|
@@ -958,7 +671,7 @@ declare class AxleAgentAbortError extends AxleAbortError {
|
|
|
958
671
|
usage?: Stats;
|
|
959
672
|
});
|
|
960
673
|
toJSON(): {
|
|
961
|
-
turn?: Turn | undefined;
|
|
674
|
+
turn?: Turn<Annotation<unknown, string>> | undefined;
|
|
962
675
|
usage?: Stats | undefined;
|
|
963
676
|
partial?: AxleAssistantMessage | undefined;
|
|
964
677
|
messages?: AxleMessage[] | undefined;
|
|
@@ -1053,6 +766,17 @@ declare const Anthropic: {
|
|
|
1053
766
|
//#region src/providers/chatcompletions/provider.d.ts
|
|
1054
767
|
declare function chatCompletions(baseUrl: string, apiKey?: string): AIProvider;
|
|
1055
768
|
//#endregion
|
|
769
|
+
//#region src/providers/context.d.ts
|
|
770
|
+
interface ContextEstimateInput {
|
|
771
|
+
system?: string;
|
|
772
|
+
tools?: ToolDefinition[];
|
|
773
|
+
providerTools?: ProviderTool[];
|
|
774
|
+
mcpTools?: ToolDefinition[];
|
|
775
|
+
messages: AxleMessage[];
|
|
776
|
+
limit?: number;
|
|
777
|
+
}
|
|
778
|
+
declare function estimateContextUsage(input: ContextEstimateInput): ContextUsage;
|
|
779
|
+
//#endregion
|
|
1056
780
|
//#region src/providers/gemini/provider.d.ts
|
|
1057
781
|
declare function gemini(apiKey: string): AIProvider;
|
|
1058
782
|
//#endregion
|
|
@@ -1068,6 +792,7 @@ declare const Gemini: {
|
|
|
1068
792
|
readonly GEMINI_3_PRO: "gemini-3-pro-preview";
|
|
1069
793
|
readonly GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview";
|
|
1070
794
|
readonly GEMINI_3_FLASH: "gemini-3-flash-preview";
|
|
795
|
+
readonly GEMINI_3_5_FLASH: "gemini-3.5-flash";
|
|
1071
796
|
readonly GEMINI_2_5_PRO: "gemini-2.5-pro";
|
|
1072
797
|
readonly GEMINI_2_5_FLASH: "gemini-2.5-flash";
|
|
1073
798
|
readonly GEMINI_2_5_FLASH_LITE: "gemini-2.5-flash-lite";
|
|
@@ -1082,23 +807,8 @@ declare const Gemini: {
|
|
|
1082
807
|
readonly DefaultModel: "gemini-3.1-flash-lite-preview";
|
|
1083
808
|
};
|
|
1084
809
|
//#endregion
|
|
1085
|
-
//#region src/providers/generateTurn.d.ts
|
|
1086
|
-
interface GenerateTurnProps {
|
|
1087
|
-
provider: AIProvider;
|
|
1088
|
-
model: string;
|
|
1089
|
-
messages: Array<AxleMessage>;
|
|
1090
|
-
system?: string;
|
|
1091
|
-
tools?: Array<ToolDefinition>;
|
|
1092
|
-
tracer?: TracingContext;
|
|
1093
|
-
fileResolver?: FileResolver;
|
|
1094
|
-
options?: GenerateTurnOptions;
|
|
1095
|
-
reasoning?: boolean;
|
|
1096
|
-
signal?: AbortSignal;
|
|
1097
|
-
}
|
|
1098
|
-
declare function generateTurn(props: GenerateTurnProps): Promise<ModelResult>;
|
|
1099
|
-
//#endregion
|
|
1100
810
|
//#region src/providers/generate.d.ts
|
|
1101
|
-
interface
|
|
811
|
+
interface GenerateParams extends AxleModelRequestOptions {
|
|
1102
812
|
provider: AIProvider;
|
|
1103
813
|
model: string;
|
|
1104
814
|
messages: Array<AxleMessage>;
|
|
@@ -1110,17 +820,27 @@ interface GenerateOptions {
|
|
|
1110
820
|
maxIterations?: number;
|
|
1111
821
|
tracer?: TracingContext;
|
|
1112
822
|
fileResolver?: FileResolver;
|
|
1113
|
-
options?: GenerateTurnOptions;
|
|
1114
|
-
reasoning?: boolean;
|
|
1115
|
-
signal?: AbortSignal;
|
|
1116
823
|
}
|
|
1117
|
-
interface
|
|
824
|
+
interface GenerateInstructParams<TSchema extends OutputSchema | undefined> extends Omit<GenerateParams, "messages"> {
|
|
1118
825
|
messages?: Array<AxleMessage>;
|
|
1119
826
|
instruct: Instruct<TSchema>;
|
|
1120
827
|
}
|
|
1121
828
|
type GenerateInstructResult<TSchema extends OutputSchema | undefined> = GenerateResult<InstructResponse<TSchema>>;
|
|
1122
|
-
declare function generate<TSchema extends OutputSchema | undefined>(options:
|
|
1123
|
-
declare function generate(options:
|
|
829
|
+
declare function generate<TSchema extends OutputSchema | undefined>(options: GenerateInstructParams<TSchema>): Promise<GenerateInstructResult<TSchema>>;
|
|
830
|
+
declare function generate(options: GenerateParams): Promise<GenerateResult>;
|
|
831
|
+
//#endregion
|
|
832
|
+
//#region src/providers/generateTurn.d.ts
|
|
833
|
+
interface GenerateTurnParams extends AxleModelRequestOptions {
|
|
834
|
+
provider: AIProvider;
|
|
835
|
+
model: string;
|
|
836
|
+
messages: Array<AxleMessage>;
|
|
837
|
+
system?: string;
|
|
838
|
+
tools?: Array<ToolDefinition>;
|
|
839
|
+
providerTools?: Array<ProviderTool>;
|
|
840
|
+
tracer?: TracingContext;
|
|
841
|
+
fileResolver?: FileResolver;
|
|
842
|
+
}
|
|
843
|
+
declare function generateTurn(props: GenerateTurnParams): Promise<ModelResult>;
|
|
1124
844
|
//#endregion
|
|
1125
845
|
//#region src/providers/stream.d.ts
|
|
1126
846
|
type StreamEvent = {
|
|
@@ -1207,7 +927,7 @@ type StreamEvent = {
|
|
|
1207
927
|
error: GenerateError;
|
|
1208
928
|
};
|
|
1209
929
|
type StreamEventCallback = (event: StreamEvent) => void;
|
|
1210
|
-
interface
|
|
930
|
+
interface StreamParams extends AxleModelRequestOptions {
|
|
1211
931
|
provider: AIProvider;
|
|
1212
932
|
model: string;
|
|
1213
933
|
messages: Array<AxleMessage>;
|
|
@@ -1219,16 +939,13 @@ interface StreamOptions {
|
|
|
1219
939
|
maxIterations?: number;
|
|
1220
940
|
tracer?: TracingContext;
|
|
1221
941
|
fileResolver?: FileResolver;
|
|
1222
|
-
options?: GenerateTurnOptions;
|
|
1223
|
-
reasoning?: boolean;
|
|
1224
|
-
signal?: AbortSignal;
|
|
1225
942
|
}
|
|
1226
943
|
interface StreamHandle {
|
|
1227
944
|
on(callback: StreamEventCallback): void;
|
|
1228
945
|
cancel(reason?: unknown): void;
|
|
1229
946
|
readonly final: Promise<StreamResult>;
|
|
1230
947
|
}
|
|
1231
|
-
interface
|
|
948
|
+
interface StreamInstructParams<TSchema extends OutputSchema | undefined> extends Omit<StreamParams, "messages"> {
|
|
1232
949
|
messages?: Array<AxleMessage>;
|
|
1233
950
|
instruct: Instruct<TSchema>;
|
|
1234
951
|
}
|
|
@@ -1236,8 +953,8 @@ type StreamInstructResult<TSchema extends OutputSchema | undefined> = StreamResu
|
|
|
1236
953
|
interface StreamInstructHandle<TSchema extends OutputSchema | undefined> extends Omit<StreamHandle, "final"> {
|
|
1237
954
|
readonly final: Promise<StreamInstructResult<TSchema>>;
|
|
1238
955
|
}
|
|
1239
|
-
declare function stream<TSchema extends OutputSchema | undefined>(options:
|
|
1240
|
-
declare function stream(options:
|
|
956
|
+
declare function stream<TSchema extends OutputSchema | undefined>(options: StreamInstructParams<TSchema>): StreamInstructHandle<TSchema>;
|
|
957
|
+
declare function stream(options: StreamParams): StreamHandle;
|
|
1241
958
|
//#endregion
|
|
1242
959
|
//#region src/providers/openai/provider.d.ts
|
|
1243
960
|
declare function openai(apiKey: string): AIProvider;
|
|
@@ -1385,25 +1102,21 @@ declare const writeFileSchema: z.ZodObject<{
|
|
|
1385
1102
|
}, z.core.$strip>;
|
|
1386
1103
|
declare const writeFileTool: ExecutableTool<typeof writeFileSchema>;
|
|
1387
1104
|
//#endregion
|
|
1388
|
-
//#region src/turns/
|
|
1389
|
-
declare class
|
|
1390
|
-
private
|
|
1105
|
+
//#region src/turns/eventBuilder.d.ts
|
|
1106
|
+
declare class TurnEventBuilder {
|
|
1107
|
+
private currentTurnId;
|
|
1108
|
+
private currentTurnTiming;
|
|
1391
1109
|
private currentTextPart;
|
|
1392
1110
|
private currentThinkingPart;
|
|
1393
1111
|
private toolIdMap;
|
|
1394
1112
|
private accumulatedUsage;
|
|
1395
|
-
createUserTurn(message: AxleUserMessage):
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
events: AgentEvent[];
|
|
1402
|
-
};
|
|
1403
|
-
handleStreamEvent(event: StreamEvent): AgentEvent[];
|
|
1404
|
-
finalizeTurn(outcome?: "complete" | "cancelled" | "error"): AgentEvent[];
|
|
1113
|
+
createUserTurn(message: AxleUserMessage): TurnEvent[];
|
|
1114
|
+
startAgentTurn(): Extract<TurnEvent, {
|
|
1115
|
+
type: "turn:start";
|
|
1116
|
+
}>;
|
|
1117
|
+
handleStreamEvent(event: StreamEvent): TurnEvent[];
|
|
1118
|
+
finalizeTurn(outcome?: "complete" | "cancelled" | "error"): TurnEvent[];
|
|
1405
1119
|
private closeOpenParts;
|
|
1406
|
-
private findActionPart;
|
|
1407
1120
|
}
|
|
1408
1121
|
//#endregion
|
|
1409
1122
|
//#region src/tracer/tracer.d.ts
|
|
@@ -1513,4 +1226,4 @@ declare class LocalFileStore implements FileStore {
|
|
|
1513
1226
|
write(path: string, content: string): Promise<void>;
|
|
1514
1227
|
}
|
|
1515
1228
|
//#endregion
|
|
1516
|
-
export { type AIProvider, type ActionPart, type ActionResult, Agent, type AgentConfig, type
|
|
1229
|
+
export { type AIProvider, type AccumulatableEvent, type ActionPart, type ActionResult, Agent, type AgentConfig, type AgentHandle, type AgentMemory, type AgentResult, type Annotation, type AnnotationEvent, type AnnotationPlacement, type AnnotationStatus, type AnnotationTarget, Anthropic, AxleAbortError, AxleAgentAbortError, type AxleAssistantMessage, AxleError, type AxleMessage, type AxleModelRequestOptions, AxleStopReason, type AxleToolCallMessage, type AxleToolCallResult, AxleToolFatalError, type AxleUserMessage, type ContentPart, type ContentPartFile, type ContentPartProviderTool, type ContentPartText, type ContentPartThinking, type ContentPartToolCall, type ContextUsage, type DeferredFileInfo, type EventLevel, type ExecutableTool, type FileInfo, type FileKind, type FilePart, type FileProviderId, type FileResolveFormat, type FileResolveRequest, type FileResolver, type FileStore, Gemini, type GenerateInstructParams, type GenerateInstructResult, type GenerateParams, type Handle, History, Instruct, type InstructInputs, type InstructOptions, type InstructResponse, InstructVariableError, type InstructVarsMode, LocalFileStore, MCP, type MCPConfig, type MCPHttpConfig, type MCPStdioConfig, type MemoryContext, OpenAI, ProceduralMemory, type ProceduralMemoryConfig, type ProviderOptions, type ProviderTool, type ProviderToolAction, type RecallResult, type ResolvedFileSource, type SendMessageOptions, SimpleWriter, type SimpleWriterOptions, type SpanData, type SpanOptions, type SpanType, type StreamEvent, type StreamEventCallback, type StreamHandle, type StreamInstructHandle, type StreamInstructParams, type StreamInstructResult, type StreamParams, type StreamResult, type SubagentAction, TaskError, type TextPart, type ThinkingPart, type ToolAction, type ToolChoice, type ToolContext, type ToolDefinition, ToolRegistry, type ToolResultPart, type TraceWriter, Tracer, type TracingContext, type Turn, TurnAccumulator, type TurnAccumulatorResult, type TurnAccumulatorState, type TurnEvent, TurnEventBuilder, type TurnEventCallback, type TurnPart, type TurnStatus, anthropic, braveSearchTool, calculatorTool, chatCompletions, createHandle, estimateContextUsage, execTool, gemini, generate, generateTurn, loadFileContent, openai, parseResponse, patchFileTool, readFileTool, stream, writeFileTool };
|