@ljoukov/llm 2.0.0 → 3.0.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.cts CHANGED
@@ -75,7 +75,7 @@ type LlmBlockedEvent = {
75
75
  readonly type: "blocked";
76
76
  };
77
77
  type LlmStreamEvent = LlmTextDeltaEvent | LlmUsageEvent | LlmModelEvent | LlmBlockedEvent;
78
- type LlmProvider = "openai" | "chatgpt" | "gemini";
78
+ type LlmProvider = "openai" | "chatgpt" | "gemini" | "fireworks";
79
79
  type LlmTextResult = {
80
80
  readonly provider: LlmProvider;
81
81
  readonly model: string;
@@ -191,17 +191,37 @@ type LlmGenerateImagesRequest = {
191
191
  readonly imageSize?: LlmImageSize;
192
192
  readonly signal?: AbortSignal;
193
193
  };
194
- type LlmExecutableTool<Schema extends z.ZodType, Output> = {
194
+ type LlmFunctionTool<Schema extends z.ZodType, Output> = {
195
+ readonly type?: "function";
195
196
  readonly description?: string;
196
197
  readonly inputSchema: Schema;
197
198
  readonly execute: (input: z.output<Schema>) => Promise<Output> | Output;
198
199
  };
200
+ type LlmCustomToolInputFormat = {
201
+ readonly type: "text";
202
+ } | {
203
+ readonly type: "grammar";
204
+ readonly syntax: "lark" | "regex";
205
+ readonly definition: string;
206
+ };
207
+ type LlmCustomTool<Output> = {
208
+ readonly type: "custom";
209
+ readonly description?: string;
210
+ readonly format?: LlmCustomToolInputFormat;
211
+ readonly execute: (input: string) => Promise<Output> | Output;
212
+ };
213
+ type LlmExecutableTool<Schema extends z.ZodType, Output> = LlmFunctionTool<Schema, Output> | LlmCustomTool<Output>;
199
214
  type LlmToolSet = Record<string, LlmExecutableTool<z.ZodType, unknown>>;
200
215
  declare function tool<Schema extends z.ZodType, Output>(options: {
201
216
  readonly description?: string;
202
217
  readonly inputSchema: Schema;
203
218
  readonly execute: (input: z.output<Schema>) => Promise<Output> | Output;
204
- }): LlmExecutableTool<Schema, Output>;
219
+ }): LlmFunctionTool<Schema, Output>;
220
+ declare function customTool<Output>(options: {
221
+ readonly description?: string;
222
+ readonly format?: LlmCustomToolInputFormat;
223
+ readonly execute: (input: string) => Promise<Output> | Output;
224
+ }): LlmCustomTool<Output>;
205
225
  type LlmToolCallResult = {
206
226
  readonly toolName: string;
207
227
  readonly input: unknown;
@@ -270,6 +290,232 @@ declare function loadEnvFromFile(filePath: string, { override }?: {
270
290
  override?: boolean;
271
291
  }): void;
272
292
 
293
+ type AgentPathKind = "file" | "directory" | "symlink" | "other";
294
+ type AgentPathInfo = {
295
+ readonly kind: AgentPathKind;
296
+ readonly mtimeMs: number;
297
+ };
298
+ type AgentDirectoryEntry = {
299
+ readonly name: string;
300
+ readonly path: string;
301
+ readonly kind: AgentPathKind;
302
+ readonly mtimeMs: number;
303
+ };
304
+ interface AgentFilesystem {
305
+ readTextFile(filePath: string): Promise<string>;
306
+ writeTextFile(filePath: string, content: string): Promise<void>;
307
+ deleteFile(filePath: string): Promise<void>;
308
+ ensureDir(directoryPath: string): Promise<void>;
309
+ readDir(directoryPath: string): Promise<readonly AgentDirectoryEntry[]>;
310
+ stat(entryPath: string): Promise<AgentPathInfo>;
311
+ }
312
+ declare class InMemoryAgentFilesystem implements AgentFilesystem {
313
+ #private;
314
+ constructor(initialFiles?: Record<string, string>);
315
+ readTextFile(filePath: string): Promise<string>;
316
+ writeTextFile(filePath: string, content: string): Promise<void>;
317
+ deleteFile(filePath: string): Promise<void>;
318
+ ensureDir(directoryPath: string): Promise<void>;
319
+ readDir(directoryPath: string): Promise<readonly AgentDirectoryEntry[]>;
320
+ stat(entryPath: string): Promise<AgentPathInfo>;
321
+ snapshot(): Record<string, string>;
322
+ }
323
+ declare function createNodeAgentFilesystem(): AgentFilesystem;
324
+ declare function createInMemoryAgentFilesystem(initialFiles?: Record<string, string>): InMemoryAgentFilesystem;
325
+
326
+ type AgentFilesystemToolProfile = "auto" | "model-agnostic" | "codex" | "gemini";
327
+ type AgentFilesystemToolName = "apply_patch" | "read_file" | "read_files" | "write_file" | "replace" | "list_dir" | "list_directory" | "grep_files" | "rg_search" | "grep_search" | "glob";
328
+ type AgentFilesystemToolAction = "read" | "write" | "delete" | "move" | "list" | "search";
329
+ type AgentFilesystemToolAccessContext = {
330
+ readonly cwd: string;
331
+ readonly tool: AgentFilesystemToolName;
332
+ readonly action: AgentFilesystemToolAction;
333
+ readonly path: string;
334
+ readonly fromPath?: string;
335
+ readonly toPath?: string;
336
+ readonly pattern?: string;
337
+ readonly include?: string;
338
+ };
339
+ type AgentFilesystemToolAccessHook = (context: AgentFilesystemToolAccessContext) => Promise<void> | void;
340
+ type AgentFilesystemToolsOptions = {
341
+ readonly cwd?: string;
342
+ readonly fs?: AgentFilesystem;
343
+ readonly allowOutsideCwd?: boolean;
344
+ readonly checkAccess?: AgentFilesystemToolAccessHook;
345
+ readonly maxLineLength?: number;
346
+ readonly grepMaxScannedFiles?: number;
347
+ readonly applyPatch?: {
348
+ readonly maxPatchBytes?: number;
349
+ };
350
+ };
351
+ declare const codexReadFileInputSchema: z.ZodObject<{
352
+ file_path: z.ZodString;
353
+ offset: z.ZodOptional<z.ZodNumber>;
354
+ limit: z.ZodOptional<z.ZodNumber>;
355
+ mode: z.ZodOptional<z.ZodEnum<{
356
+ slice: "slice";
357
+ indentation: "indentation";
358
+ }>>;
359
+ indentation: z.ZodOptional<z.ZodObject<{
360
+ anchor_line: z.ZodOptional<z.ZodNumber>;
361
+ max_levels: z.ZodOptional<z.ZodNumber>;
362
+ include_siblings: z.ZodOptional<z.ZodBoolean>;
363
+ include_header: z.ZodOptional<z.ZodBoolean>;
364
+ max_lines: z.ZodOptional<z.ZodNumber>;
365
+ }, z.core.$strip>>;
366
+ }, z.core.$strip>;
367
+ declare const codexListDirInputSchema: z.ZodObject<{
368
+ dir_path: z.ZodString;
369
+ offset: z.ZodOptional<z.ZodNumber>;
370
+ limit: z.ZodOptional<z.ZodNumber>;
371
+ depth: z.ZodOptional<z.ZodNumber>;
372
+ }, z.core.$strip>;
373
+ declare const codexGrepFilesInputSchema: z.ZodObject<{
374
+ pattern: z.ZodString;
375
+ include: z.ZodOptional<z.ZodString>;
376
+ path: z.ZodOptional<z.ZodString>;
377
+ limit: z.ZodOptional<z.ZodNumber>;
378
+ }, z.core.$strip>;
379
+ declare const applyPatchInputSchema: z.ZodObject<{
380
+ input: z.ZodString;
381
+ }, z.core.$strip>;
382
+ declare const geminiReadFileInputSchema: z.ZodObject<{
383
+ file_path: z.ZodString;
384
+ offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
385
+ limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
386
+ }, z.core.$strip>;
387
+ declare const geminiReadFilesInputSchema: z.ZodObject<{
388
+ paths: z.ZodArray<z.ZodString>;
389
+ line_offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
390
+ line_limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
391
+ char_offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
392
+ char_limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
393
+ include_line_numbers: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
394
+ }, z.core.$strip>;
395
+ declare const geminiWriteFileInputSchema: z.ZodObject<{
396
+ file_path: z.ZodString;
397
+ content: z.ZodString;
398
+ }, z.core.$strip>;
399
+ declare const geminiReplaceInputSchema: z.ZodObject<{
400
+ file_path: z.ZodString;
401
+ instruction: z.ZodString;
402
+ old_string: z.ZodString;
403
+ new_string: z.ZodString;
404
+ expected_replacements: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
405
+ }, z.core.$strip>;
406
+ declare const geminiListDirectoryInputSchema: z.ZodObject<{
407
+ dir_path: z.ZodString;
408
+ ignore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
409
+ file_filtering_options: z.ZodOptional<z.ZodNullable<z.ZodObject<{
410
+ respect_git_ignore: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
411
+ respect_gemini_ignore: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
412
+ }, z.core.$strip>>>;
413
+ }, z.core.$strip>;
414
+ declare const geminiRgSearchInputSchema: z.ZodObject<{
415
+ pattern: z.ZodString;
416
+ path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
417
+ glob: z.ZodOptional<z.ZodNullable<z.ZodString>>;
418
+ case_sensitive: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
419
+ exclude_pattern: z.ZodOptional<z.ZodNullable<z.ZodString>>;
420
+ names_only: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
421
+ max_matches_per_file: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
422
+ max_results: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
423
+ }, z.core.$strip>;
424
+ declare const geminiGrepSearchInputSchema: z.ZodObject<{
425
+ pattern: z.ZodString;
426
+ dir_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
427
+ include: z.ZodOptional<z.ZodNullable<z.ZodString>>;
428
+ exclude_pattern: z.ZodOptional<z.ZodNullable<z.ZodString>>;
429
+ names_only: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
430
+ max_matches_per_file: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
431
+ total_max_matches: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
432
+ }, z.core.$strip>;
433
+ declare const geminiGlobInputSchema: z.ZodObject<{
434
+ pattern: z.ZodString;
435
+ dir_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
436
+ case_sensitive: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
437
+ respect_git_ignore: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
438
+ respect_gemini_ignore: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
439
+ }, z.core.$strip>;
440
+ type CodexReadFileToolInput = z.output<typeof codexReadFileInputSchema>;
441
+ type CodexListDirToolInput = z.output<typeof codexListDirInputSchema>;
442
+ type CodexGrepFilesToolInput = z.output<typeof codexGrepFilesInputSchema>;
443
+ type CodexApplyPatchToolInput = z.output<typeof applyPatchInputSchema>;
444
+ type GeminiReadFileToolInput = z.output<typeof geminiReadFileInputSchema>;
445
+ type GeminiReadFilesToolInput = z.output<typeof geminiReadFilesInputSchema>;
446
+ type GeminiWriteFileToolInput = z.output<typeof geminiWriteFileInputSchema>;
447
+ type GeminiReplaceToolInput = z.output<typeof geminiReplaceInputSchema>;
448
+ type GeminiListDirectoryToolInput = z.output<typeof geminiListDirectoryInputSchema>;
449
+ type GeminiGrepSearchToolInput = z.output<typeof geminiGrepSearchInputSchema>;
450
+ type GeminiRgSearchToolInput = z.output<typeof geminiRgSearchInputSchema>;
451
+ type GeminiGlobToolInput = z.output<typeof geminiGlobInputSchema>;
452
+ declare function resolveFilesystemToolProfile(model: string, profile?: AgentFilesystemToolProfile): Exclude<AgentFilesystemToolProfile, "auto">;
453
+ declare function createFilesystemToolSetForModel(model: string, profileOrOptions?: AgentFilesystemToolProfile | AgentFilesystemToolsOptions, maybeOptions?: AgentFilesystemToolsOptions): LlmToolSet;
454
+ declare function createCodexFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
455
+ declare function createGeminiFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
456
+ declare function createModelAgnosticFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
457
+ declare function createCodexApplyPatchTool(options?: AgentFilesystemToolsOptions): LlmCustomTool<string>;
458
+ declare function createCodexReadFileTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof codexReadFileInputSchema, string>;
459
+ declare function createListDirTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof codexListDirInputSchema, string>;
460
+ declare function createGrepFilesTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof codexGrepFilesInputSchema, string>;
461
+ declare function createGeminiReadFileTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiReadFileInputSchema, string>;
462
+ declare function createReadFilesTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiReadFilesInputSchema, string>;
463
+ declare function createWriteFileTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiWriteFileInputSchema, string>;
464
+ declare function createReplaceTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiReplaceInputSchema, string>;
465
+ declare function createListDirectoryTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiListDirectoryInputSchema, string>;
466
+ declare function createGrepSearchTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiGrepSearchInputSchema, string>;
467
+ declare function createRgSearchTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiRgSearchInputSchema, string>;
468
+ declare function createGlobTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiGlobInputSchema, string>;
469
+
470
+ type AgentFilesystemToolConfig = {
471
+ readonly enabled?: boolean;
472
+ readonly profile?: AgentFilesystemToolProfile;
473
+ readonly options?: AgentFilesystemToolsOptions;
474
+ };
475
+ type AgentFilesystemToolSelection = boolean | AgentFilesystemToolProfile | AgentFilesystemToolConfig;
476
+ type RunAgentLoopRequest = Omit<LlmToolLoopRequest, "tools"> & {
477
+ readonly tools?: LlmToolSet;
478
+ readonly filesystemTool?: AgentFilesystemToolSelection;
479
+ readonly filesystem_tool?: AgentFilesystemToolSelection;
480
+ };
481
+ declare function runAgentLoop(request: RunAgentLoopRequest): Promise<LlmToolLoopResult>;
482
+
483
+ declare const CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION = "Use the `apply_patch` tool to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.";
484
+ declare const CODEX_APPLY_PATCH_LARK_GRAMMAR: string;
485
+ declare const CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION: string;
486
+ type ApplyPatchAccessContext = {
487
+ readonly cwd: string;
488
+ readonly kind: "add" | "delete" | "update" | "move";
489
+ readonly path: string;
490
+ readonly fromPath?: string;
491
+ readonly toPath?: string;
492
+ };
493
+ type ApplyPatchAccessHook = (context: ApplyPatchAccessContext) => Promise<void> | void;
494
+ type ApplyPatchRequest = {
495
+ readonly patch: string;
496
+ readonly cwd?: string;
497
+ readonly fs?: AgentFilesystem;
498
+ readonly allowOutsideCwd?: boolean;
499
+ readonly checkAccess?: ApplyPatchAccessHook;
500
+ readonly maxPatchBytes?: number;
501
+ };
502
+ type ApplyPatchResult = {
503
+ readonly success: true;
504
+ readonly summary: string;
505
+ readonly added: readonly string[];
506
+ readonly modified: readonly string[];
507
+ readonly deleted: readonly string[];
508
+ };
509
+ type CreateApplyPatchToolOptions = Omit<ApplyPatchRequest, "patch"> & {
510
+ readonly description?: string;
511
+ };
512
+ declare const applyPatchToolInputSchema: z.ZodObject<{
513
+ input: z.ZodString;
514
+ }, z.core.$strip>;
515
+ type ApplyPatchToolInput = z.output<typeof applyPatchToolInputSchema>;
516
+ declare function createApplyPatchTool(options?: CreateApplyPatchToolOptions): LlmFunctionTool<typeof applyPatchToolInputSchema, ApplyPatchResult>;
517
+ declare function applyPatch(request: ApplyPatchRequest): Promise<ApplyPatchResult>;
518
+
273
519
  type ChatGptAuthProfile = {
274
520
  readonly access: string;
275
521
  readonly refresh: string;
@@ -284,10 +530,13 @@ declare function exchangeChatGptOauthCode({ code, verifier, redirectUri, }: {
284
530
  verifier: string;
285
531
  redirectUri?: string;
286
532
  }): Promise<ChatGptAuthProfile>;
287
- declare function refreshChatGptOauthToken(refreshToken: string): Promise<ChatGptAuthProfile>;
533
+ declare function refreshChatGptOauthToken(refreshToken: string, fallback?: {
534
+ accountId?: string;
535
+ idToken?: string;
536
+ }): Promise<ChatGptAuthProfile>;
288
537
  declare function getChatGptAuthProfile(): Promise<ChatGptAuthProfile>;
289
538
 
290
- declare const GEMINI_MODEL_IDS: readonly ["gemini-3-pro-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest"];
539
+ declare const GEMINI_MODEL_IDS: readonly ["gemini-3-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest"];
291
540
  type GeminiModelId = (typeof GEMINI_MODEL_IDS)[number];
292
541
  declare function isGeminiModelId(value: string): value is GeminiModelId;
293
542
  type GeminiConfiguration = {
@@ -296,4 +545,12 @@ type GeminiConfiguration = {
296
545
  };
297
546
  declare function configureGemini(options?: GeminiConfiguration): void;
298
547
 
299
- export { type ChatGptAuthProfile, type GeminiModelId, type JsonSchema, type LlmBaseRequest, type LlmBlockedEvent, type LlmContent, type LlmContentPart, type LlmExecutableTool, type LlmImageData, type LlmImageSize, type LlmInput, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmModelEvent, type LlmProvider, type LlmStreamEvent, type LlmTextDeltaEvent, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmToolCallContext, type LlmToolCallResult, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopStep, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, appendMarkdownSourcesSection, configureGemini, convertGooglePartsToLlmParts, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isGeminiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, runToolLoop, sanitisePartForLogging, streamJson, streamText, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
548
+ declare const FIREWORKS_MODEL_IDS: readonly ["kimi-k2.5", "glm-5", "minimax-m2.1"];
549
+ type FireworksModelId = (typeof FIREWORKS_MODEL_IDS)[number];
550
+ declare const FIREWORKS_DEFAULT_KIMI_MODEL: FireworksModelId;
551
+ declare const FIREWORKS_DEFAULT_GLM_MODEL: FireworksModelId;
552
+ declare const FIREWORKS_DEFAULT_MINIMAX_MODEL: FireworksModelId;
553
+ declare function isFireworksModelId(value: string): value is FireworksModelId;
554
+ declare function resolveFireworksModelId(model: string): string | undefined;
555
+
556
+ export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentPathInfo, type AgentPathKind, type ApplyPatchAccessContext, type ApplyPatchAccessHook, type ApplyPatchRequest, type ApplyPatchResult, type ApplyPatchToolInput, CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_LARK_GRAMMAR, type ChatGptAuthProfile, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CreateApplyPatchToolOptions, FIREWORKS_DEFAULT_GLM_MODEL, FIREWORKS_DEFAULT_KIMI_MODEL, FIREWORKS_DEFAULT_MINIMAX_MODEL, FIREWORKS_MODEL_IDS, type FireworksModelId, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReadFilesToolInput, type GeminiReplaceToolInput, type GeminiRgSearchToolInput, type GeminiWriteFileToolInput, InMemoryAgentFilesystem, type JsonSchema, type LlmBaseRequest, type LlmBlockedEvent, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFunctionTool, type LlmImageData, type LlmImageSize, type LlmInput, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmModelEvent, type LlmProvider, type LlmStreamEvent, type LlmTextDeltaEvent, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmToolCallContext, type LlmToolCallResult, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopStep, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, type RunAgentLoopRequest, appendMarkdownSourcesSection, applyPatch, configureGemini, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createReadFilesTool, createReplaceTool, createRgSearchTool, createWriteFileTool, customTool, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isFireworksModelId, isGeminiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runToolLoop, sanitisePartForLogging, streamJson, streamText, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
package/dist/index.d.ts CHANGED
@@ -75,7 +75,7 @@ type LlmBlockedEvent = {
75
75
  readonly type: "blocked";
76
76
  };
77
77
  type LlmStreamEvent = LlmTextDeltaEvent | LlmUsageEvent | LlmModelEvent | LlmBlockedEvent;
78
- type LlmProvider = "openai" | "chatgpt" | "gemini";
78
+ type LlmProvider = "openai" | "chatgpt" | "gemini" | "fireworks";
79
79
  type LlmTextResult = {
80
80
  readonly provider: LlmProvider;
81
81
  readonly model: string;
@@ -191,17 +191,37 @@ type LlmGenerateImagesRequest = {
191
191
  readonly imageSize?: LlmImageSize;
192
192
  readonly signal?: AbortSignal;
193
193
  };
194
- type LlmExecutableTool<Schema extends z.ZodType, Output> = {
194
+ type LlmFunctionTool<Schema extends z.ZodType, Output> = {
195
+ readonly type?: "function";
195
196
  readonly description?: string;
196
197
  readonly inputSchema: Schema;
197
198
  readonly execute: (input: z.output<Schema>) => Promise<Output> | Output;
198
199
  };
200
+ type LlmCustomToolInputFormat = {
201
+ readonly type: "text";
202
+ } | {
203
+ readonly type: "grammar";
204
+ readonly syntax: "lark" | "regex";
205
+ readonly definition: string;
206
+ };
207
+ type LlmCustomTool<Output> = {
208
+ readonly type: "custom";
209
+ readonly description?: string;
210
+ readonly format?: LlmCustomToolInputFormat;
211
+ readonly execute: (input: string) => Promise<Output> | Output;
212
+ };
213
+ type LlmExecutableTool<Schema extends z.ZodType, Output> = LlmFunctionTool<Schema, Output> | LlmCustomTool<Output>;
199
214
  type LlmToolSet = Record<string, LlmExecutableTool<z.ZodType, unknown>>;
200
215
  declare function tool<Schema extends z.ZodType, Output>(options: {
201
216
  readonly description?: string;
202
217
  readonly inputSchema: Schema;
203
218
  readonly execute: (input: z.output<Schema>) => Promise<Output> | Output;
204
- }): LlmExecutableTool<Schema, Output>;
219
+ }): LlmFunctionTool<Schema, Output>;
220
+ declare function customTool<Output>(options: {
221
+ readonly description?: string;
222
+ readonly format?: LlmCustomToolInputFormat;
223
+ readonly execute: (input: string) => Promise<Output> | Output;
224
+ }): LlmCustomTool<Output>;
205
225
  type LlmToolCallResult = {
206
226
  readonly toolName: string;
207
227
  readonly input: unknown;
@@ -270,6 +290,232 @@ declare function loadEnvFromFile(filePath: string, { override }?: {
270
290
  override?: boolean;
271
291
  }): void;
272
292
 
293
+ type AgentPathKind = "file" | "directory" | "symlink" | "other";
294
+ type AgentPathInfo = {
295
+ readonly kind: AgentPathKind;
296
+ readonly mtimeMs: number;
297
+ };
298
+ type AgentDirectoryEntry = {
299
+ readonly name: string;
300
+ readonly path: string;
301
+ readonly kind: AgentPathKind;
302
+ readonly mtimeMs: number;
303
+ };
304
+ interface AgentFilesystem {
305
+ readTextFile(filePath: string): Promise<string>;
306
+ writeTextFile(filePath: string, content: string): Promise<void>;
307
+ deleteFile(filePath: string): Promise<void>;
308
+ ensureDir(directoryPath: string): Promise<void>;
309
+ readDir(directoryPath: string): Promise<readonly AgentDirectoryEntry[]>;
310
+ stat(entryPath: string): Promise<AgentPathInfo>;
311
+ }
312
+ declare class InMemoryAgentFilesystem implements AgentFilesystem {
313
+ #private;
314
+ constructor(initialFiles?: Record<string, string>);
315
+ readTextFile(filePath: string): Promise<string>;
316
+ writeTextFile(filePath: string, content: string): Promise<void>;
317
+ deleteFile(filePath: string): Promise<void>;
318
+ ensureDir(directoryPath: string): Promise<void>;
319
+ readDir(directoryPath: string): Promise<readonly AgentDirectoryEntry[]>;
320
+ stat(entryPath: string): Promise<AgentPathInfo>;
321
+ snapshot(): Record<string, string>;
322
+ }
323
+ declare function createNodeAgentFilesystem(): AgentFilesystem;
324
+ declare function createInMemoryAgentFilesystem(initialFiles?: Record<string, string>): InMemoryAgentFilesystem;
325
+
326
+ type AgentFilesystemToolProfile = "auto" | "model-agnostic" | "codex" | "gemini";
327
+ type AgentFilesystemToolName = "apply_patch" | "read_file" | "read_files" | "write_file" | "replace" | "list_dir" | "list_directory" | "grep_files" | "rg_search" | "grep_search" | "glob";
328
+ type AgentFilesystemToolAction = "read" | "write" | "delete" | "move" | "list" | "search";
329
+ type AgentFilesystemToolAccessContext = {
330
+ readonly cwd: string;
331
+ readonly tool: AgentFilesystemToolName;
332
+ readonly action: AgentFilesystemToolAction;
333
+ readonly path: string;
334
+ readonly fromPath?: string;
335
+ readonly toPath?: string;
336
+ readonly pattern?: string;
337
+ readonly include?: string;
338
+ };
339
+ type AgentFilesystemToolAccessHook = (context: AgentFilesystemToolAccessContext) => Promise<void> | void;
340
+ type AgentFilesystemToolsOptions = {
341
+ readonly cwd?: string;
342
+ readonly fs?: AgentFilesystem;
343
+ readonly allowOutsideCwd?: boolean;
344
+ readonly checkAccess?: AgentFilesystemToolAccessHook;
345
+ readonly maxLineLength?: number;
346
+ readonly grepMaxScannedFiles?: number;
347
+ readonly applyPatch?: {
348
+ readonly maxPatchBytes?: number;
349
+ };
350
+ };
351
+ declare const codexReadFileInputSchema: z.ZodObject<{
352
+ file_path: z.ZodString;
353
+ offset: z.ZodOptional<z.ZodNumber>;
354
+ limit: z.ZodOptional<z.ZodNumber>;
355
+ mode: z.ZodOptional<z.ZodEnum<{
356
+ slice: "slice";
357
+ indentation: "indentation";
358
+ }>>;
359
+ indentation: z.ZodOptional<z.ZodObject<{
360
+ anchor_line: z.ZodOptional<z.ZodNumber>;
361
+ max_levels: z.ZodOptional<z.ZodNumber>;
362
+ include_siblings: z.ZodOptional<z.ZodBoolean>;
363
+ include_header: z.ZodOptional<z.ZodBoolean>;
364
+ max_lines: z.ZodOptional<z.ZodNumber>;
365
+ }, z.core.$strip>>;
366
+ }, z.core.$strip>;
367
+ declare const codexListDirInputSchema: z.ZodObject<{
368
+ dir_path: z.ZodString;
369
+ offset: z.ZodOptional<z.ZodNumber>;
370
+ limit: z.ZodOptional<z.ZodNumber>;
371
+ depth: z.ZodOptional<z.ZodNumber>;
372
+ }, z.core.$strip>;
373
+ declare const codexGrepFilesInputSchema: z.ZodObject<{
374
+ pattern: z.ZodString;
375
+ include: z.ZodOptional<z.ZodString>;
376
+ path: z.ZodOptional<z.ZodString>;
377
+ limit: z.ZodOptional<z.ZodNumber>;
378
+ }, z.core.$strip>;
379
+ declare const applyPatchInputSchema: z.ZodObject<{
380
+ input: z.ZodString;
381
+ }, z.core.$strip>;
382
+ declare const geminiReadFileInputSchema: z.ZodObject<{
383
+ file_path: z.ZodString;
384
+ offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
385
+ limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
386
+ }, z.core.$strip>;
387
+ declare const geminiReadFilesInputSchema: z.ZodObject<{
388
+ paths: z.ZodArray<z.ZodString>;
389
+ line_offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
390
+ line_limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
391
+ char_offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
392
+ char_limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
393
+ include_line_numbers: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
394
+ }, z.core.$strip>;
395
+ declare const geminiWriteFileInputSchema: z.ZodObject<{
396
+ file_path: z.ZodString;
397
+ content: z.ZodString;
398
+ }, z.core.$strip>;
399
+ declare const geminiReplaceInputSchema: z.ZodObject<{
400
+ file_path: z.ZodString;
401
+ instruction: z.ZodString;
402
+ old_string: z.ZodString;
403
+ new_string: z.ZodString;
404
+ expected_replacements: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
405
+ }, z.core.$strip>;
406
+ declare const geminiListDirectoryInputSchema: z.ZodObject<{
407
+ dir_path: z.ZodString;
408
+ ignore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
409
+ file_filtering_options: z.ZodOptional<z.ZodNullable<z.ZodObject<{
410
+ respect_git_ignore: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
411
+ respect_gemini_ignore: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
412
+ }, z.core.$strip>>>;
413
+ }, z.core.$strip>;
414
+ declare const geminiRgSearchInputSchema: z.ZodObject<{
415
+ pattern: z.ZodString;
416
+ path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
417
+ glob: z.ZodOptional<z.ZodNullable<z.ZodString>>;
418
+ case_sensitive: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
419
+ exclude_pattern: z.ZodOptional<z.ZodNullable<z.ZodString>>;
420
+ names_only: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
421
+ max_matches_per_file: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
422
+ max_results: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
423
+ }, z.core.$strip>;
424
+ declare const geminiGrepSearchInputSchema: z.ZodObject<{
425
+ pattern: z.ZodString;
426
+ dir_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
427
+ include: z.ZodOptional<z.ZodNullable<z.ZodString>>;
428
+ exclude_pattern: z.ZodOptional<z.ZodNullable<z.ZodString>>;
429
+ names_only: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
430
+ max_matches_per_file: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
431
+ total_max_matches: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
432
+ }, z.core.$strip>;
433
+ declare const geminiGlobInputSchema: z.ZodObject<{
434
+ pattern: z.ZodString;
435
+ dir_path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
436
+ case_sensitive: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
437
+ respect_git_ignore: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
438
+ respect_gemini_ignore: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
439
+ }, z.core.$strip>;
440
+ type CodexReadFileToolInput = z.output<typeof codexReadFileInputSchema>;
441
+ type CodexListDirToolInput = z.output<typeof codexListDirInputSchema>;
442
+ type CodexGrepFilesToolInput = z.output<typeof codexGrepFilesInputSchema>;
443
+ type CodexApplyPatchToolInput = z.output<typeof applyPatchInputSchema>;
444
+ type GeminiReadFileToolInput = z.output<typeof geminiReadFileInputSchema>;
445
+ type GeminiReadFilesToolInput = z.output<typeof geminiReadFilesInputSchema>;
446
+ type GeminiWriteFileToolInput = z.output<typeof geminiWriteFileInputSchema>;
447
+ type GeminiReplaceToolInput = z.output<typeof geminiReplaceInputSchema>;
448
+ type GeminiListDirectoryToolInput = z.output<typeof geminiListDirectoryInputSchema>;
449
+ type GeminiGrepSearchToolInput = z.output<typeof geminiGrepSearchInputSchema>;
450
+ type GeminiRgSearchToolInput = z.output<typeof geminiRgSearchInputSchema>;
451
+ type GeminiGlobToolInput = z.output<typeof geminiGlobInputSchema>;
452
+ declare function resolveFilesystemToolProfile(model: string, profile?: AgentFilesystemToolProfile): Exclude<AgentFilesystemToolProfile, "auto">;
453
+ declare function createFilesystemToolSetForModel(model: string, profileOrOptions?: AgentFilesystemToolProfile | AgentFilesystemToolsOptions, maybeOptions?: AgentFilesystemToolsOptions): LlmToolSet;
454
+ declare function createCodexFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
455
+ declare function createGeminiFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
456
+ declare function createModelAgnosticFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
457
+ declare function createCodexApplyPatchTool(options?: AgentFilesystemToolsOptions): LlmCustomTool<string>;
458
+ declare function createCodexReadFileTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof codexReadFileInputSchema, string>;
459
+ declare function createListDirTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof codexListDirInputSchema, string>;
460
+ declare function createGrepFilesTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof codexGrepFilesInputSchema, string>;
461
+ declare function createGeminiReadFileTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiReadFileInputSchema, string>;
462
+ declare function createReadFilesTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiReadFilesInputSchema, string>;
463
+ declare function createWriteFileTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiWriteFileInputSchema, string>;
464
+ declare function createReplaceTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiReplaceInputSchema, string>;
465
+ declare function createListDirectoryTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiListDirectoryInputSchema, string>;
466
+ declare function createGrepSearchTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiGrepSearchInputSchema, string>;
467
+ declare function createRgSearchTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiRgSearchInputSchema, string>;
468
+ declare function createGlobTool(options?: AgentFilesystemToolsOptions): LlmFunctionTool<typeof geminiGlobInputSchema, string>;
469
+
470
+ type AgentFilesystemToolConfig = {
471
+ readonly enabled?: boolean;
472
+ readonly profile?: AgentFilesystemToolProfile;
473
+ readonly options?: AgentFilesystemToolsOptions;
474
+ };
475
+ type AgentFilesystemToolSelection = boolean | AgentFilesystemToolProfile | AgentFilesystemToolConfig;
476
+ type RunAgentLoopRequest = Omit<LlmToolLoopRequest, "tools"> & {
477
+ readonly tools?: LlmToolSet;
478
+ readonly filesystemTool?: AgentFilesystemToolSelection;
479
+ readonly filesystem_tool?: AgentFilesystemToolSelection;
480
+ };
481
+ declare function runAgentLoop(request: RunAgentLoopRequest): Promise<LlmToolLoopResult>;
482
+
483
+ declare const CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION = "Use the `apply_patch` tool to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.";
484
+ declare const CODEX_APPLY_PATCH_LARK_GRAMMAR: string;
485
+ declare const CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION: string;
486
+ type ApplyPatchAccessContext = {
487
+ readonly cwd: string;
488
+ readonly kind: "add" | "delete" | "update" | "move";
489
+ readonly path: string;
490
+ readonly fromPath?: string;
491
+ readonly toPath?: string;
492
+ };
493
+ type ApplyPatchAccessHook = (context: ApplyPatchAccessContext) => Promise<void> | void;
494
+ type ApplyPatchRequest = {
495
+ readonly patch: string;
496
+ readonly cwd?: string;
497
+ readonly fs?: AgentFilesystem;
498
+ readonly allowOutsideCwd?: boolean;
499
+ readonly checkAccess?: ApplyPatchAccessHook;
500
+ readonly maxPatchBytes?: number;
501
+ };
502
+ type ApplyPatchResult = {
503
+ readonly success: true;
504
+ readonly summary: string;
505
+ readonly added: readonly string[];
506
+ readonly modified: readonly string[];
507
+ readonly deleted: readonly string[];
508
+ };
509
+ type CreateApplyPatchToolOptions = Omit<ApplyPatchRequest, "patch"> & {
510
+ readonly description?: string;
511
+ };
512
+ declare const applyPatchToolInputSchema: z.ZodObject<{
513
+ input: z.ZodString;
514
+ }, z.core.$strip>;
515
+ type ApplyPatchToolInput = z.output<typeof applyPatchToolInputSchema>;
516
+ declare function createApplyPatchTool(options?: CreateApplyPatchToolOptions): LlmFunctionTool<typeof applyPatchToolInputSchema, ApplyPatchResult>;
517
+ declare function applyPatch(request: ApplyPatchRequest): Promise<ApplyPatchResult>;
518
+
273
519
  type ChatGptAuthProfile = {
274
520
  readonly access: string;
275
521
  readonly refresh: string;
@@ -284,10 +530,13 @@ declare function exchangeChatGptOauthCode({ code, verifier, redirectUri, }: {
284
530
  verifier: string;
285
531
  redirectUri?: string;
286
532
  }): Promise<ChatGptAuthProfile>;
287
- declare function refreshChatGptOauthToken(refreshToken: string): Promise<ChatGptAuthProfile>;
533
+ declare function refreshChatGptOauthToken(refreshToken: string, fallback?: {
534
+ accountId?: string;
535
+ idToken?: string;
536
+ }): Promise<ChatGptAuthProfile>;
288
537
  declare function getChatGptAuthProfile(): Promise<ChatGptAuthProfile>;
289
538
 
290
- declare const GEMINI_MODEL_IDS: readonly ["gemini-3-pro-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest"];
539
+ declare const GEMINI_MODEL_IDS: readonly ["gemini-3-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", "gemini-flash-latest", "gemini-flash-lite-latest"];
291
540
  type GeminiModelId = (typeof GEMINI_MODEL_IDS)[number];
292
541
  declare function isGeminiModelId(value: string): value is GeminiModelId;
293
542
  type GeminiConfiguration = {
@@ -296,4 +545,12 @@ type GeminiConfiguration = {
296
545
  };
297
546
  declare function configureGemini(options?: GeminiConfiguration): void;
298
547
 
299
- export { type ChatGptAuthProfile, type GeminiModelId, type JsonSchema, type LlmBaseRequest, type LlmBlockedEvent, type LlmContent, type LlmContentPart, type LlmExecutableTool, type LlmImageData, type LlmImageSize, type LlmInput, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmModelEvent, type LlmProvider, type LlmStreamEvent, type LlmTextDeltaEvent, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmToolCallContext, type LlmToolCallResult, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopStep, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, appendMarkdownSourcesSection, configureGemini, convertGooglePartsToLlmParts, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isGeminiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, runToolLoop, sanitisePartForLogging, streamJson, streamText, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
548
+ declare const FIREWORKS_MODEL_IDS: readonly ["kimi-k2.5", "glm-5", "minimax-m2.1"];
549
+ type FireworksModelId = (typeof FIREWORKS_MODEL_IDS)[number];
550
+ declare const FIREWORKS_DEFAULT_KIMI_MODEL: FireworksModelId;
551
+ declare const FIREWORKS_DEFAULT_GLM_MODEL: FireworksModelId;
552
+ declare const FIREWORKS_DEFAULT_MINIMAX_MODEL: FireworksModelId;
553
+ declare function isFireworksModelId(value: string): value is FireworksModelId;
554
+ declare function resolveFireworksModelId(model: string): string | undefined;
555
+
556
+ export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentPathInfo, type AgentPathKind, type ApplyPatchAccessContext, type ApplyPatchAccessHook, type ApplyPatchRequest, type ApplyPatchResult, type ApplyPatchToolInput, CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_LARK_GRAMMAR, type ChatGptAuthProfile, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CreateApplyPatchToolOptions, FIREWORKS_DEFAULT_GLM_MODEL, FIREWORKS_DEFAULT_KIMI_MODEL, FIREWORKS_DEFAULT_MINIMAX_MODEL, FIREWORKS_MODEL_IDS, type FireworksModelId, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReadFilesToolInput, type GeminiReplaceToolInput, type GeminiRgSearchToolInput, type GeminiWriteFileToolInput, InMemoryAgentFilesystem, type JsonSchema, type LlmBaseRequest, type LlmBlockedEvent, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFunctionTool, type LlmImageData, type LlmImageSize, type LlmInput, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmModelEvent, type LlmProvider, type LlmStreamEvent, type LlmTextDeltaEvent, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmToolCallContext, type LlmToolCallResult, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopStep, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, type RunAgentLoopRequest, appendMarkdownSourcesSection, applyPatch, configureGemini, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createReadFilesTool, createReplaceTool, createRgSearchTool, createWriteFileTool, customTool, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isFireworksModelId, isGeminiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runToolLoop, sanitisePartForLogging, streamJson, streamText, stripCodexCitationMarkers, toGeminiJsonSchema, tool };