@fifthrevision/axle 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ interface Stats {
9
9
  //#endregion
10
10
  //#region src/messages/stream.d.ts
11
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";
12
+ 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";
13
13
  id?: string;
14
14
  data?: any;
15
15
  }
@@ -93,6 +93,16 @@ interface StreamToolCallStartChunk extends StreamChunk {
93
93
  name: string;
94
94
  };
95
95
  }
96
+ interface StreamToolCallArgsDeltaChunk extends StreamChunk {
97
+ type: "tool-call-args-delta";
98
+ data: {
99
+ index: number;
100
+ id: string;
101
+ name: string;
102
+ delta: string;
103
+ accumulated: string;
104
+ };
105
+ }
96
106
  interface StreamToolCallCompleteChunk extends StreamChunk {
97
107
  type: "tool-call-complete";
98
108
  data: {
@@ -103,16 +113,16 @@ interface StreamToolCallCompleteChunk extends StreamChunk {
103
113
  providerMetadata?: Record<string, unknown>;
104
114
  };
105
115
  }
106
- interface StreamInternalToolStartChunk extends StreamChunk {
107
- type: "internal-tool-start";
116
+ interface StreamProviderToolStartChunk extends StreamChunk {
117
+ type: "provider-tool-start";
108
118
  data: {
109
119
  index: number;
110
120
  id: string;
111
121
  name: string;
112
122
  };
113
123
  }
114
- interface StreamInternalToolCompleteChunk extends StreamChunk {
115
- type: "internal-tool-complete";
124
+ interface StreamProviderToolCompleteChunk extends StreamChunk {
125
+ type: "provider-tool-complete";
116
126
  data: {
117
127
  index: number;
118
128
  id: string;
@@ -120,7 +130,7 @@ interface StreamInternalToolCompleteChunk extends StreamChunk {
120
130
  output?: unknown;
121
131
  };
122
132
  }
123
- type AnyStreamChunk = StreamStartChunk | StreamCompleteChunk | StreamErrorChunk | StreamTextStartChunk | StreamTextDeltaChunk | StreamTextCompleteChunk | StreamThinkingStartChunk | StreamThinkingDeltaChunk | StreamThinkingSummaryDeltaChunk | StreamThinkingCompleteChunk | StreamToolCallStartChunk | StreamToolCallCompleteChunk | StreamInternalToolStartChunk | StreamInternalToolCompleteChunk;
133
+ type AnyStreamChunk = StreamStartChunk | StreamCompleteChunk | StreamErrorChunk | StreamTextStartChunk | StreamTextDeltaChunk | StreamTextCompleteChunk | StreamThinkingStartChunk | StreamThinkingDeltaChunk | StreamThinkingSummaryDeltaChunk | StreamThinkingCompleteChunk | StreamToolCallStartChunk | StreamToolCallArgsDeltaChunk | StreamToolCallCompleteChunk | StreamProviderToolStartChunk | StreamProviderToolCompleteChunk;
124
134
  //#endregion
125
135
  //#region src/tracer/types.d.ts
126
136
  type SpanStatus = "ok" | "error";
@@ -199,46 +209,142 @@ interface TracingContext {
199
209
  setResult(result: SpanResult): void;
200
210
  }
201
211
  //#endregion
212
+ //#region src/utils/file.d.ts
213
+ type FileKind = "image" | "document" | "text";
214
+ type TextSource = {
215
+ type: "text";
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;
236
+ 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
+ };
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
+ /**
308
+ * Load a file with the specified encoding or auto-detect based on file extension
309
+ * @param filePath - Path to the file
310
+ * @param encoding - How to load the file: "utf-8" for text, "base64" for binary, or omit for auto-detection
311
+ * @returns FileInfo object with appropriate content based on encoding
312
+ */
313
+ declare function loadFileContent(filePath: string): Promise<FileInfo>;
314
+ declare function loadFileContent(filePath: string, encoding: "utf-8"): Promise<InlineTextFile>;
315
+ declare function loadFileContent(filePath: string, encoding: "base64"): Promise<InlineBinaryFile>;
316
+ //#endregion
202
317
  //#region src/providers/types.d.ts
318
+ interface ProviderRequestContext {
319
+ tracer?: TracingContext;
320
+ fileResolver?: FileResolver;
321
+ }
322
+ interface GenerateTurnOptions {
323
+ temperature?: number;
324
+ top_p?: number;
325
+ max_tokens?: number;
326
+ frequency_penalty?: number;
327
+ presence_penalty?: number;
328
+ stop?: string | string[];
329
+ [key: string]: any;
330
+ }
331
+ interface GenerationRequestParams {
332
+ messages: Array<AxleMessage>;
333
+ system?: string;
334
+ tools?: Array<ToolDefinition>;
335
+ context: ProviderRequestContext;
336
+ options?: GenerateTurnOptions;
337
+ reasoning?: boolean;
338
+ }
339
+ interface StreamingRequestParams extends GenerationRequestParams {
340
+ signal?: AbortSignal;
341
+ }
203
342
  interface AIProvider {
204
343
  get name(): string;
205
344
  /** @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>;
345
+ createGenerationRequest(model: string, params: GenerationRequestParams): Promise<ModelResult>;
223
346
  /** @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>;
347
+ createStreamingRequest(model: string, params: StreamingRequestParams): AsyncGenerator<AnyStreamChunk, void, unknown>;
242
348
  }
243
349
  interface ModelResponse {
244
350
  type: "success";
@@ -270,38 +376,15 @@ declare enum AxleStopReason {
270
376
  Cancelled = "cancelled"
271
377
  }
272
378
  //#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
379
  //#region src/messages/message.d.ts
304
380
  type AxleMessage = AxleUserMessage | AxleAssistantMessage | AxleToolCallMessage;
381
+ type ToolResultPart = {
382
+ type: "text";
383
+ text: string;
384
+ } | {
385
+ type: "file";
386
+ file: ConcreteFileInfo;
387
+ };
305
388
  interface AxleUserMessage {
306
389
  role: "user";
307
390
  id?: string;
@@ -312,7 +395,7 @@ interface AxleAssistantMessage {
312
395
  role: "assistant";
313
396
  id: string;
314
397
  model?: string;
315
- content: Array<ContentPartText | ContentPartThinking | ContentPartToolCall | ContentPartInternalTool>;
398
+ content: Array<ContentPartText | ContentPartThinking | ContentPartToolCall | ContentPartProviderTool>;
316
399
  finishReason?: AxleStopReason;
317
400
  }
318
401
  interface AxleToolCallMessage {
@@ -320,21 +403,13 @@ interface AxleToolCallMessage {
320
403
  id: string;
321
404
  content: Array<AxleToolCallResult>;
322
405
  }
323
- type ToolResultPart = {
324
- type: "text";
325
- text: string;
326
- } | {
327
- type: "image";
328
- data: string;
329
- mimeType: string;
330
- };
331
406
  interface AxleToolCallResult {
332
407
  id: string;
333
408
  name: string;
334
409
  content: string | ToolResultPart[];
335
410
  isError?: boolean;
336
411
  }
337
- type ContentPart = ContentPartText | ContentPartFile | ContentPartToolCall | ContentPartThinking | ContentPartInternalTool;
412
+ type ContentPart = ContentPartText | ContentPartFile | ContentPartToolCall | ContentPartThinking | ContentPartProviderTool;
338
413
  interface ContentPartText {
339
414
  type: "text";
340
415
  text: string;
@@ -359,30 +434,56 @@ interface ContentPartToolCall {
359
434
  parameters: Record<string, unknown>;
360
435
  providerMetadata?: Record<string, unknown>;
361
436
  }
362
- interface ContentPartInternalTool {
363
- type: "internal-tool";
437
+ interface ContentPartProviderTool {
438
+ type: "provider-tool";
364
439
  id: string;
365
440
  name: string;
366
441
  input?: unknown;
367
442
  output?: unknown;
368
443
  }
369
444
  //#endregion
445
+ //#region src/tools/registry.d.ts
446
+ declare class ToolRegistry {
447
+ private executableTools;
448
+ private providerTools;
449
+ constructor(init?: {
450
+ tools?: ExecutableTool[];
451
+ providerTools?: ProviderTool[];
452
+ });
453
+ add(tool: ExecutableTool): void;
454
+ add(tools: ExecutableTool[]): void;
455
+ addProvider(tool: ProviderTool): void;
456
+ addProvider(tools: ProviderTool[]): void;
457
+ remove(name: string): boolean;
458
+ has(name: string): boolean;
459
+ get(name: string): ExecutableTool | undefined;
460
+ getProvider(name: string): ProviderTool | undefined;
461
+ executable(): ExecutableTool[];
462
+ provider(): ProviderTool[];
463
+ get size(): number;
464
+ }
465
+ //#endregion
370
466
  //#region src/tools/types.d.ts
467
+ interface ToolContext {
468
+ registry: ToolRegistry;
469
+ signal: AbortSignal;
470
+ emit: (chunk: string) => void;
471
+ tracer?: TracingContext;
472
+ }
371
473
  interface ExecutableTool<TSchema extends ZodObject<any> = ZodObject<any>> {
372
474
  type?: "function";
373
475
  name: string;
374
476
  description: string;
375
477
  schema: TSchema;
376
- execute(input: z.infer<TSchema>): Promise<string | ToolResultPart[]>;
478
+ execute(input: z.infer<TSchema>, ctx: ToolContext): Promise<string | ToolResultPart[]>;
377
479
  configure?(config: Record<string, any>): void;
378
480
  summarize?(input: z.infer<TSchema>): string;
379
481
  }
380
- interface ServerTool {
381
- type: "server";
482
+ interface ProviderTool {
483
+ type: "provider";
382
484
  name: string;
383
485
  config?: Record<string, unknown>;
384
486
  }
385
- type AxleTool = ExecutableTool | ServerTool;
386
487
  type ToolDefinition = Pick<ExecutableTool, "name" | "description" | "schema">;
387
488
  //#endregion
388
489
  //#region src/mcp/MCP.d.ts
@@ -500,6 +601,7 @@ interface ToolAction extends ActionPartBase {
500
601
  detail: {
501
602
  name: string;
502
603
  parameters: Record<string, unknown>;
604
+ pendingArgs?: string;
503
605
  result?: ActionResult;
504
606
  };
505
607
  }
@@ -512,16 +614,19 @@ interface SubagentAction extends ActionPartBase {
512
614
  result?: ActionResult;
513
615
  };
514
616
  }
515
- interface InternalToolAction extends ActionPartBase {
516
- kind: "internal-tool";
617
+ interface ProviderToolAction extends ActionPartBase {
618
+ kind: "provider-tool";
517
619
  detail: {
518
620
  name: string;
519
621
  input?: unknown;
520
622
  result?: ActionResult;
521
623
  };
522
624
  }
523
- type ActionPart = ToolAction | SubagentAction | InternalToolAction;
625
+ type ActionPart = ToolAction | SubagentAction | ProviderToolAction;
524
626
  type ActionResult = {
627
+ type: "in-progress";
628
+ content: string;
629
+ } | {
525
630
  type: "success";
526
631
  content: unknown;
527
632
  } | {
@@ -568,11 +673,22 @@ type AgentEvent = {
568
673
  turnId: string;
569
674
  partId: string;
570
675
  timing?: TimingInfo;
676
+ } | {
677
+ type: "action:args-delta";
678
+ turnId: string;
679
+ partId: string;
680
+ delta: string;
681
+ accumulated: string;
571
682
  } | {
572
683
  type: "action:running";
573
684
  turnId: string;
574
685
  partId: string;
575
686
  parameters?: Record<string, unknown>;
687
+ } | {
688
+ type: "action:progress";
689
+ turnId: string;
690
+ partId: string;
691
+ chunk: string;
576
692
  } | {
577
693
  type: "action:complete";
578
694
  turnId: string;
@@ -640,12 +756,11 @@ declare function parseResponse<T extends OutputSchema>(rawValue: string, schema?
640
756
  declare class Instruct<TSchema extends OutputSchema | undefined = undefined> {
641
757
  prompt: string;
642
758
  inputs: Record<string, string>;
643
- files: Base64FileInfo[];
759
+ files: FileInfo[];
644
760
  textReferences: Array<{
645
761
  content: string;
646
762
  name?: string;
647
763
  }>;
648
- instructions: string[];
649
764
  schema: TSchema;
650
765
  constructor(prompt: string, schema?: TSchema);
651
766
  setInputs(inputs: Record<string, string>): void;
@@ -653,7 +768,6 @@ declare class Instruct<TSchema extends OutputSchema | undefined = undefined> {
653
768
  addFile(file: FileInfo | string, options?: {
654
769
  name?: string;
655
770
  }): void;
656
- addInstructions(instruction: string): void;
657
771
  hasFiles(): boolean;
658
772
  }
659
773
  //#endregion
@@ -667,10 +781,13 @@ interface AgentConfig {
667
781
  system?: string;
668
782
  name?: string;
669
783
  scope?: Record<string, string>;
670
- tools?: AxleTool[];
784
+ tools?: ExecutableTool[];
785
+ providerTools?: ProviderTool[];
671
786
  mcps?: MCP[];
672
787
  memory?: AgentMemory;
673
788
  tracer?: TracingContext;
789
+ fileResolver?: FileResolver;
790
+ reasoning?: boolean;
674
791
  options?: AgentOptions;
675
792
  }
676
793
  interface AgentResult<T = string> {
@@ -682,6 +799,8 @@ type AgentHandle<T = string> = Handle<AgentResult<T>>;
682
799
  type AgentEventCallback = (event: AgentEvent) => void;
683
800
  interface SendMessageOptions {
684
801
  signal?: AbortSignal;
802
+ fileResolver?: FileResolver;
803
+ reasoning?: boolean;
685
804
  }
686
805
  interface SendInstructOptions extends SendMessageOptions {
687
806
  variables?: Record<string, string>;
@@ -694,18 +813,17 @@ declare class Agent {
694
813
  readonly name?: string;
695
814
  readonly scope?: Record<string, string>;
696
815
  readonly store: FileStore;
816
+ readonly fileResolver?: FileResolver;
817
+ readonly reasoning?: boolean;
818
+ readonly registry: ToolRegistry;
697
819
  system: string | undefined;
698
- tools: Record<string, ExecutableTool>;
699
- serverTools: ServerTool[];
700
820
  private mcps;
701
- private mcpToolsResolved;
821
+ private resolvedMcps;
702
822
  private memory?;
703
823
  private options;
704
824
  private eventCallbacks;
705
825
  private sendQueue;
706
826
  constructor(config: AgentConfig);
707
- addTool(tool: AxleTool): void;
708
- addTools(tools: AxleTool[]): void;
709
827
  addMcp(mcp: MCP): void;
710
828
  addMcps(mcps: MCP[]): void;
711
829
  hasTools(): boolean;
@@ -759,10 +877,14 @@ declare function gemini(apiKey: string): AIProvider;
759
877
  declare const Gemini: {
760
878
  readonly Models: {
761
879
  readonly GEMINI_3_1_PRO_PREVIEW: "gemini-3.1-pro-preview";
880
+ readonly GEMINI_3_1_PRO: "gemini-3.1-pro-preview";
762
881
  readonly GEMINI_3_1_PRO_PREVIEW_CUSTOMTOOLS: "gemini-3.1-pro-preview-customtools";
763
882
  readonly GEMINI_3_1_FLASH_LITE_PREVIEW: "gemini-3.1-flash-lite-preview";
883
+ readonly GEMINI_3_1_FLASH_LITE: "gemini-3.1-flash-lite-preview";
764
884
  readonly GEMINI_3_PRO_PREVIEW: "gemini-3-pro-preview";
885
+ readonly GEMINI_3_PRO: "gemini-3-pro-preview";
765
886
  readonly GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview";
887
+ readonly GEMINI_3_FLASH: "gemini-3-flash-preview";
766
888
  readonly GEMINI_2_5_PRO: "gemini-2.5-pro";
767
889
  readonly GEMINI_2_5_FLASH: "gemini-2.5-flash";
768
890
  readonly GEMINI_2_5_FLASH_LITE: "gemini-2.5-flash-lite";
@@ -773,14 +895,6 @@ declare const Gemini: {
773
895
  readonly GEMINI_FLASH_LATEST: "gemini-flash-latest";
774
896
  readonly GEMINI_FLASH_LITE_LATEST: "gemini-flash-lite-latest";
775
897
  readonly GEMINI_PRO_LATEST: "gemini-pro-latest";
776
- readonly GEMMA_4_31B_IT: "gemma-4-31b-it";
777
- readonly GEMMA_4_E4B_IT: "gemma-4-26b-a4b-it";
778
- readonly GEMMA_3_27B_IT: "gemma-3-27b-it";
779
- readonly GEMMA_3_12B_IT: "gemma-3-12b-it";
780
- readonly GEMMA_3_4B_IT: "gemma-3-4b-it";
781
- readonly GEMMA_3_1B_IT: "gemma-3-1b-it";
782
- readonly GEMMA_3N_E4B_IT: "gemma-3n-e4b-it";
783
- readonly GEMMA_3N_E2B_IT: "gemma-3n-e2b-it";
784
898
  };
785
899
  readonly DefaultModel: "gemini-3.1-flash-lite-preview";
786
900
  };
@@ -798,7 +912,7 @@ type ToolCallResult = {
798
912
  retryable?: boolean;
799
913
  };
800
914
  };
801
- type ToolCallCallback = (name: string, parameters: Record<string, unknown>) => Promise<ToolCallResult | null | undefined>;
915
+ type ToolCallCallback = (name: string, parameters: Record<string, unknown>, ctx: ToolContext) => Promise<ToolCallResult | null | undefined>;
802
916
  type GenerateError = {
803
917
  type: "model";
804
918
  error: ModelError;
@@ -828,15 +942,6 @@ type StreamResult = GenerateResult | {
828
942
  };
829
943
  //#endregion
830
944
  //#region src/providers/generateTurn.d.ts
831
- interface GenerateTurnOptions {
832
- temperature?: number;
833
- top_p?: number;
834
- max_tokens?: number;
835
- frequency_penalty?: number;
836
- presence_penalty?: number;
837
- stop?: string | string[];
838
- [key: string]: any;
839
- }
840
945
  interface GenerateTurnProps {
841
946
  provider: AIProvider;
842
947
  model: string;
@@ -844,7 +949,9 @@ interface GenerateTurnProps {
844
949
  system?: string;
845
950
  tools?: Array<ToolDefinition>;
846
951
  tracer?: TracingContext;
952
+ fileResolver?: FileResolver;
847
953
  options?: GenerateTurnOptions;
954
+ reasoning?: boolean;
848
955
  }
849
956
  declare function generateTurn(props: GenerateTurnProps): Promise<ModelResult>;
850
957
  //#endregion
@@ -854,11 +961,16 @@ interface GenerateOptions {
854
961
  model: string;
855
962
  messages: Array<AxleMessage>;
856
963
  system?: string;
857
- tools?: Array<ToolDefinition>;
964
+ tools?: ExecutableTool[];
965
+ providerTools?: ProviderTool[];
966
+ registry?: ToolRegistry;
858
967
  onToolCall?: ToolCallCallback;
859
968
  maxIterations?: number;
860
969
  tracer?: TracingContext;
970
+ fileResolver?: FileResolver;
861
971
  options?: GenerateTurnOptions;
972
+ reasoning?: boolean;
973
+ signal?: AbortSignal;
862
974
  }
863
975
  declare function generate(options: GenerateOptions): Promise<GenerateResult>;
864
976
  //#endregion
@@ -906,12 +1018,25 @@ type StreamEvent = {
906
1018
  index: number;
907
1019
  id: string;
908
1020
  name: string;
1021
+ } | {
1022
+ type: "tool:args-delta";
1023
+ index: number;
1024
+ id: string;
1025
+ name: string;
1026
+ delta: string;
1027
+ accumulated: string;
909
1028
  } | {
910
1029
  type: "tool:exec-start";
911
1030
  index: number;
912
1031
  id: string;
913
1032
  name: string;
914
1033
  parameters: Record<string, unknown>;
1034
+ } | {
1035
+ type: "tool:exec-delta";
1036
+ index: number;
1037
+ id: string;
1038
+ name: string;
1039
+ chunk: string;
915
1040
  } | {
916
1041
  type: "tool:exec-complete";
917
1042
  index: number;
@@ -919,12 +1044,12 @@ type StreamEvent = {
919
1044
  name: string;
920
1045
  result: ToolCallResult;
921
1046
  } | {
922
- type: "internal-tool:start";
1047
+ type: "provider-tool:start";
923
1048
  index: number;
924
1049
  id: string;
925
1050
  name: string;
926
1051
  } | {
927
- type: "internal-tool:complete";
1052
+ type: "provider-tool:complete";
928
1053
  index: number;
929
1054
  id: string;
930
1055
  name: string;
@@ -939,12 +1064,15 @@ interface StreamOptions {
939
1064
  model: string;
940
1065
  messages: Array<AxleMessage>;
941
1066
  system?: string;
942
- tools?: Array<ToolDefinition>;
943
- serverTools?: Array<ServerTool>;
1067
+ tools?: ExecutableTool[];
1068
+ providerTools?: ProviderTool[];
1069
+ registry?: ToolRegistry;
944
1070
  onToolCall?: ToolCallCallback;
945
1071
  maxIterations?: number;
946
1072
  tracer?: TracingContext;
1073
+ fileResolver?: FileResolver;
947
1074
  options?: GenerateTurnOptions;
1075
+ reasoning?: boolean;
948
1076
  signal?: AbortSignal;
949
1077
  }
950
1078
  interface StreamHandle {
@@ -997,8 +1125,6 @@ declare const OpenAI: {
997
1125
  readonly GPT_4_1_NANO_2025_04_14: "gpt-4.1-nano-2025-04-14";
998
1126
  readonly GPT_4_1_NANO: "gpt-4.1-nano";
999
1127
  readonly GPT_4O_2024_11_20: "gpt-4o-2024-11-20";
1000
- readonly GPT_4O_2024_08_06: "gpt-4o-2024-08-06";
1001
- readonly GPT_4O_2024_05_13: "gpt-4o-2024-05-13";
1002
1128
  readonly GPT_4O: "gpt-4o";
1003
1129
  readonly GPT_4O_MINI_2024_07_18: "gpt-4o-mini-2024-07-18";
1004
1130
  readonly GPT_4O_MINI: "gpt-4o-mini";
@@ -1010,10 +1136,6 @@ declare const OpenAI: {
1010
1136
  readonly O3_PRO: "o3-pro";
1011
1137
  readonly O3_MINI_2025_01_31: "o3-mini-2025-01-31";
1012
1138
  readonly O3_MINI: "o3-mini";
1013
- readonly O1_2024_12_17: "o1-2024-12-17";
1014
- readonly O1: "o1";
1015
- readonly O1_PRO_2025_03_19: "o1-pro-2025-03-19";
1016
- readonly O1_PRO: "o1-pro";
1017
1139
  };
1018
1140
  readonly DefaultModel: "gpt-5.4-mini";
1019
1141
  };
@@ -1024,6 +1146,12 @@ declare const BraveProviderConfigSchema: z.ZodObject<{
1024
1146
  rateLimit: z.ZodOptional<z.ZodNumber>;
1025
1147
  }, z.core.$strip>;
1026
1148
  type BraveProviderConfig = z.infer<typeof BraveProviderConfigSchema>;
1149
+ declare const ExecProviderConfigSchema: z.ZodObject<{
1150
+ timeout: z.ZodOptional<z.ZodNumber>;
1151
+ maxBuffer: z.ZodOptional<z.ZodNumber>;
1152
+ cwd: z.ZodOptional<z.ZodString>;
1153
+ }, z.core.$strip>;
1154
+ type ExecProviderConfig = z.infer<typeof ExecProviderConfigSchema>;
1027
1155
  //#endregion
1028
1156
  //#region src/tools/brave.d.ts
1029
1157
  declare const braveSearchSchema: z$2.ZodObject<{
@@ -1040,7 +1168,7 @@ declare class BraveSearchTool implements ExecutableTool<typeof braveSearchSchema
1040
1168
  lastExecTime: number;
1041
1169
  constructor(config?: BraveProviderConfig);
1042
1170
  configure(config: BraveProviderConfig): void;
1043
- execute(params: z$2.infer<typeof braveSearchSchema>): Promise<string>;
1171
+ execute(params: z$2.infer<typeof braveSearchSchema>, _ctx: ToolContext): Promise<string>;
1044
1172
  }
1045
1173
  declare const braveSearchTool: BraveSearchTool;
1046
1174
  //#endregion
@@ -1057,6 +1185,49 @@ declare const calculatorSchema: z.ZodObject<{
1057
1185
  }, z.core.$strip>;
1058
1186
  declare const calculatorTool: ExecutableTool<typeof calculatorSchema>;
1059
1187
  //#endregion
1188
+ //#region src/tools/exec/index.d.ts
1189
+ declare const execSchema: z$2.ZodObject<{
1190
+ command: z$2.ZodString;
1191
+ }, z$2.core.$strip>;
1192
+ declare class ExecTool implements ExecutableTool<typeof execSchema> {
1193
+ name: string;
1194
+ description: string;
1195
+ schema: z$2.ZodObject<{
1196
+ command: z$2.ZodString;
1197
+ }, z$2.core.$strip>;
1198
+ private timeout;
1199
+ private maxBuffer;
1200
+ private cwd?;
1201
+ constructor(config?: ExecProviderConfig);
1202
+ configure(config: ExecProviderConfig): void;
1203
+ summarize(params: z$2.infer<typeof execSchema>): string;
1204
+ execute(params: z$2.infer<typeof execSchema>, ctx: ToolContext): Promise<string>;
1205
+ }
1206
+ declare const execTool: ExecTool;
1207
+ //#endregion
1208
+ //#region src/tools/patch-file.d.ts
1209
+ declare const patchFileSchema: z.ZodObject<{
1210
+ path: z.ZodString;
1211
+ old_string: z.ZodString;
1212
+ new_string: z.ZodString;
1213
+ start_line: z.ZodNumber;
1214
+ end_line: z.ZodNumber;
1215
+ }, z.core.$strip>;
1216
+ declare const patchFileTool: ExecutableTool<typeof patchFileSchema>;
1217
+ //#endregion
1218
+ //#region src/tools/read-file.d.ts
1219
+ declare const readFileSchema: z.ZodObject<{
1220
+ path: z.ZodString;
1221
+ }, z.core.$strip>;
1222
+ declare const readFileTool: ExecutableTool<typeof readFileSchema>;
1223
+ //#endregion
1224
+ //#region src/tools/write-file.d.ts
1225
+ declare const writeFileSchema: z.ZodObject<{
1226
+ path: z.ZodString;
1227
+ content: z.ZodString;
1228
+ }, z.core.$strip>;
1229
+ declare const writeFileTool: ExecutableTool<typeof writeFileSchema>;
1230
+ //#endregion
1060
1231
  //#region src/turns/builder.d.ts
1061
1232
  declare class TurnBuilder {
1062
1233
  private currentTurn;
@@ -1185,4 +1356,4 @@ declare class LocalFileStore implements FileStore {
1185
1356
  write(path: string, content: string): Promise<void>;
1186
1357
  }
1187
1358
  //#endregion
1188
- 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 };
1359
+ 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 AxleToolCallMessage, type AxleToolCallResult, type AxleUserMessage, type ContentPart, type ContentPartFile, type ContentPartProviderTool, type ContentPartText, type ContentPartThinking, type ContentPartToolCall, type DeferredFileInfo, type EventLevel, type ExecutableTool, type FileInfo, type FileKind, type FilePart, type FileProviderId, type FileResolveFormat, type FileResolveRequest, type FileResolver, type FileStore, Gemini, type Handle, History, Instruct, LocalFileStore, MCP, type MCPConfig, type MCPHttpConfig, type MCPStdioConfig, type MemoryContext, OpenAI, ProceduralMemory, type ProceduralMemoryConfig, type ProviderTool, type ProviderToolAction, type RecallResult, type ResolvedFileSource, type SendInstructOptions, type SendMessageOptions, 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 ToolContext, type ToolDefinition, ToolRegistry, type ToolResultPart, type TraceWriter, Tracer, type TracingContext, type Turn, TurnBuilder, type TurnPart, type TurnStatus, anthropic, braveSearchTool, calculatorTool, chatCompletions, compileInstruct, createHandle, execTool, gemini, generate, generateTurn, loadFileContent, openai, parseResponse, patchFileTool, readFileTool, stream, writeFileTool };