@ljoukov/llm 2.0.0 → 2.1.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
@@ -270,6 +270,207 @@ declare function loadEnvFromFile(filePath: string, { override }?: {
270
270
  override?: boolean;
271
271
  }): void;
272
272
 
273
+ type AgentPathKind = "file" | "directory" | "symlink" | "other";
274
+ type AgentPathInfo = {
275
+ readonly kind: AgentPathKind;
276
+ readonly mtimeMs: number;
277
+ };
278
+ type AgentDirectoryEntry = {
279
+ readonly name: string;
280
+ readonly path: string;
281
+ readonly kind: AgentPathKind;
282
+ readonly mtimeMs: number;
283
+ };
284
+ interface AgentFilesystem {
285
+ readTextFile(filePath: string): Promise<string>;
286
+ writeTextFile(filePath: string, content: string): Promise<void>;
287
+ deleteFile(filePath: string): Promise<void>;
288
+ ensureDir(directoryPath: string): Promise<void>;
289
+ readDir(directoryPath: string): Promise<readonly AgentDirectoryEntry[]>;
290
+ stat(entryPath: string): Promise<AgentPathInfo>;
291
+ }
292
+ declare class InMemoryAgentFilesystem implements AgentFilesystem {
293
+ #private;
294
+ constructor(initialFiles?: Record<string, string>);
295
+ readTextFile(filePath: string): Promise<string>;
296
+ writeTextFile(filePath: string, content: string): Promise<void>;
297
+ deleteFile(filePath: string): Promise<void>;
298
+ ensureDir(directoryPath: string): Promise<void>;
299
+ readDir(directoryPath: string): Promise<readonly AgentDirectoryEntry[]>;
300
+ stat(entryPath: string): Promise<AgentPathInfo>;
301
+ snapshot(): Record<string, string>;
302
+ }
303
+ declare function createNodeAgentFilesystem(): AgentFilesystem;
304
+ declare function createInMemoryAgentFilesystem(initialFiles?: Record<string, string>): InMemoryAgentFilesystem;
305
+
306
+ type AgentFilesystemToolProfile = "auto" | "model-agnostic" | "codex" | "gemini";
307
+ type AgentFilesystemToolName = "apply_patch" | "read_file" | "write_file" | "replace" | "list_dir" | "list_directory" | "grep_files" | "grep_search" | "glob";
308
+ type AgentFilesystemToolAction = "read" | "write" | "delete" | "move" | "list" | "search";
309
+ type AgentFilesystemToolAccessContext = {
310
+ readonly cwd: string;
311
+ readonly tool: AgentFilesystemToolName;
312
+ readonly action: AgentFilesystemToolAction;
313
+ readonly path: string;
314
+ readonly fromPath?: string;
315
+ readonly toPath?: string;
316
+ readonly pattern?: string;
317
+ readonly include?: string;
318
+ };
319
+ type AgentFilesystemToolAccessHook = (context: AgentFilesystemToolAccessContext) => Promise<void> | void;
320
+ type AgentFilesystemToolsOptions = {
321
+ readonly cwd?: string;
322
+ readonly fs?: AgentFilesystem;
323
+ readonly allowOutsideCwd?: boolean;
324
+ readonly checkAccess?: AgentFilesystemToolAccessHook;
325
+ readonly maxLineLength?: number;
326
+ readonly grepMaxScannedFiles?: number;
327
+ readonly applyPatch?: {
328
+ readonly maxPatchBytes?: number;
329
+ };
330
+ };
331
+ declare const codexReadFileInputSchema: z.ZodObject<{
332
+ file_path: z.ZodString;
333
+ offset: z.ZodOptional<z.ZodNumber>;
334
+ limit: z.ZodOptional<z.ZodNumber>;
335
+ mode: z.ZodOptional<z.ZodEnum<{
336
+ slice: "slice";
337
+ indentation: "indentation";
338
+ }>>;
339
+ indentation: z.ZodOptional<z.ZodObject<{
340
+ anchor_line: z.ZodOptional<z.ZodNumber>;
341
+ max_levels: z.ZodOptional<z.ZodNumber>;
342
+ include_siblings: z.ZodOptional<z.ZodBoolean>;
343
+ include_header: z.ZodOptional<z.ZodBoolean>;
344
+ max_lines: z.ZodOptional<z.ZodNumber>;
345
+ }, z.core.$strip>>;
346
+ }, z.core.$strip>;
347
+ declare const codexListDirInputSchema: z.ZodObject<{
348
+ dir_path: z.ZodString;
349
+ offset: z.ZodOptional<z.ZodNumber>;
350
+ limit: z.ZodOptional<z.ZodNumber>;
351
+ depth: z.ZodOptional<z.ZodNumber>;
352
+ }, z.core.$strip>;
353
+ declare const codexGrepFilesInputSchema: z.ZodObject<{
354
+ pattern: z.ZodString;
355
+ include: z.ZodOptional<z.ZodString>;
356
+ path: z.ZodOptional<z.ZodString>;
357
+ limit: z.ZodOptional<z.ZodNumber>;
358
+ }, z.core.$strip>;
359
+ declare const applyPatchInputSchema: z.ZodObject<{
360
+ input: z.ZodString;
361
+ }, z.core.$strip>;
362
+ declare const geminiReadFileInputSchema: z.ZodObject<{
363
+ file_path: z.ZodString;
364
+ offset: z.ZodOptional<z.ZodNumber>;
365
+ limit: z.ZodOptional<z.ZodNumber>;
366
+ }, z.core.$strip>;
367
+ declare const geminiWriteFileInputSchema: z.ZodObject<{
368
+ file_path: z.ZodString;
369
+ content: z.ZodString;
370
+ }, z.core.$strip>;
371
+ declare const geminiReplaceInputSchema: z.ZodObject<{
372
+ file_path: z.ZodString;
373
+ instruction: z.ZodString;
374
+ old_string: z.ZodString;
375
+ new_string: z.ZodString;
376
+ expected_replacements: z.ZodOptional<z.ZodNumber>;
377
+ }, z.core.$strip>;
378
+ declare const geminiListDirectoryInputSchema: z.ZodObject<{
379
+ dir_path: z.ZodString;
380
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
381
+ file_filtering_options: z.ZodOptional<z.ZodObject<{
382
+ respect_git_ignore: z.ZodOptional<z.ZodBoolean>;
383
+ respect_gemini_ignore: z.ZodOptional<z.ZodBoolean>;
384
+ }, z.core.$strip>>;
385
+ }, z.core.$strip>;
386
+ declare const geminiGrepSearchInputSchema: z.ZodObject<{
387
+ pattern: z.ZodString;
388
+ dir_path: z.ZodOptional<z.ZodString>;
389
+ include: z.ZodOptional<z.ZodString>;
390
+ exclude_pattern: z.ZodOptional<z.ZodString>;
391
+ names_only: z.ZodOptional<z.ZodBoolean>;
392
+ max_matches_per_file: z.ZodOptional<z.ZodNumber>;
393
+ total_max_matches: z.ZodOptional<z.ZodNumber>;
394
+ }, z.core.$strip>;
395
+ declare const geminiGlobInputSchema: z.ZodObject<{
396
+ pattern: z.ZodString;
397
+ dir_path: z.ZodOptional<z.ZodString>;
398
+ case_sensitive: z.ZodOptional<z.ZodBoolean>;
399
+ respect_git_ignore: z.ZodOptional<z.ZodBoolean>;
400
+ respect_gemini_ignore: z.ZodOptional<z.ZodBoolean>;
401
+ }, z.core.$strip>;
402
+ type CodexReadFileToolInput = z.output<typeof codexReadFileInputSchema>;
403
+ type CodexListDirToolInput = z.output<typeof codexListDirInputSchema>;
404
+ type CodexGrepFilesToolInput = z.output<typeof codexGrepFilesInputSchema>;
405
+ type CodexApplyPatchToolInput = z.output<typeof applyPatchInputSchema>;
406
+ type GeminiReadFileToolInput = z.output<typeof geminiReadFileInputSchema>;
407
+ type GeminiWriteFileToolInput = z.output<typeof geminiWriteFileInputSchema>;
408
+ type GeminiReplaceToolInput = z.output<typeof geminiReplaceInputSchema>;
409
+ type GeminiListDirectoryToolInput = z.output<typeof geminiListDirectoryInputSchema>;
410
+ type GeminiGrepSearchToolInput = z.output<typeof geminiGrepSearchInputSchema>;
411
+ type GeminiGlobToolInput = z.output<typeof geminiGlobInputSchema>;
412
+ declare function resolveFilesystemToolProfile(model: string, profile?: AgentFilesystemToolProfile): Exclude<AgentFilesystemToolProfile, "auto">;
413
+ declare function createFilesystemToolSetForModel(model: string, profileOrOptions?: AgentFilesystemToolProfile | AgentFilesystemToolsOptions, maybeOptions?: AgentFilesystemToolsOptions): LlmToolSet;
414
+ declare function createCodexFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
415
+ declare function createGeminiFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
416
+ declare function createModelAgnosticFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
417
+ declare function createCodexApplyPatchTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof applyPatchInputSchema, string>;
418
+ declare function createCodexReadFileTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof codexReadFileInputSchema, string>;
419
+ declare function createListDirTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof codexListDirInputSchema, string>;
420
+ declare function createGrepFilesTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof codexGrepFilesInputSchema, string>;
421
+ declare function createReadFileTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiReadFileInputSchema, string>;
422
+ declare function createWriteFileTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiWriteFileInputSchema, string>;
423
+ declare function createReplaceTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiReplaceInputSchema, string>;
424
+ declare function createListDirectoryTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiListDirectoryInputSchema, string>;
425
+ declare function createGrepSearchTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiGrepSearchInputSchema, string>;
426
+ declare function createGlobTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiGlobInputSchema, string>;
427
+
428
+ type AgentFilesystemToolConfig = {
429
+ readonly enabled?: boolean;
430
+ readonly profile?: AgentFilesystemToolProfile;
431
+ readonly options?: AgentFilesystemToolsOptions;
432
+ };
433
+ type AgentFilesystemToolSelection = boolean | AgentFilesystemToolProfile | AgentFilesystemToolConfig;
434
+ type RunAgentLoopRequest = Omit<LlmToolLoopRequest, "tools"> & {
435
+ readonly tools?: LlmToolSet;
436
+ readonly filesystemTool?: AgentFilesystemToolSelection;
437
+ readonly filesystem_tool?: AgentFilesystemToolSelection;
438
+ };
439
+ declare function runAgentLoop(request: RunAgentLoopRequest): Promise<LlmToolLoopResult>;
440
+
441
+ type ApplyPatchAccessContext = {
442
+ readonly cwd: string;
443
+ readonly kind: "add" | "delete" | "update" | "move";
444
+ readonly path: string;
445
+ readonly fromPath?: string;
446
+ readonly toPath?: string;
447
+ };
448
+ type ApplyPatchAccessHook = (context: ApplyPatchAccessContext) => Promise<void> | void;
449
+ type ApplyPatchRequest = {
450
+ readonly patch: string;
451
+ readonly cwd?: string;
452
+ readonly fs?: AgentFilesystem;
453
+ readonly allowOutsideCwd?: boolean;
454
+ readonly checkAccess?: ApplyPatchAccessHook;
455
+ readonly maxPatchBytes?: number;
456
+ };
457
+ type ApplyPatchResult = {
458
+ readonly success: true;
459
+ readonly summary: string;
460
+ readonly added: readonly string[];
461
+ readonly modified: readonly string[];
462
+ readonly deleted: readonly string[];
463
+ };
464
+ type CreateApplyPatchToolOptions = Omit<ApplyPatchRequest, "patch"> & {
465
+ readonly description?: string;
466
+ };
467
+ declare const applyPatchToolInputSchema: z.ZodObject<{
468
+ input: z.ZodString;
469
+ }, z.core.$strip>;
470
+ type ApplyPatchToolInput = z.output<typeof applyPatchToolInputSchema>;
471
+ declare function createApplyPatchTool(options?: CreateApplyPatchToolOptions): LlmExecutableTool<typeof applyPatchToolInputSchema, ApplyPatchResult>;
472
+ declare function applyPatch(request: ApplyPatchRequest): Promise<ApplyPatchResult>;
473
+
273
474
  type ChatGptAuthProfile = {
274
475
  readonly access: string;
275
476
  readonly refresh: string;
@@ -296,4 +497,4 @@ type GeminiConfiguration = {
296
497
  };
297
498
  declare function configureGemini(options?: GeminiConfiguration): void;
298
499
 
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 };
500
+ 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, type ChatGptAuthProfile, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CreateApplyPatchToolOptions, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReplaceToolInput, type GeminiWriteFileToolInput, InMemoryAgentFilesystem, 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, type RunAgentLoopRequest, appendMarkdownSourcesSection, applyPatch, configureGemini, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createReadFileTool, createReplaceTool, createWriteFileTool, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isGeminiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resolveFilesystemToolProfile, runAgentLoop, runToolLoop, sanitisePartForLogging, streamJson, streamText, stripCodexCitationMarkers, toGeminiJsonSchema, tool };
package/dist/index.d.ts CHANGED
@@ -270,6 +270,207 @@ declare function loadEnvFromFile(filePath: string, { override }?: {
270
270
  override?: boolean;
271
271
  }): void;
272
272
 
273
+ type AgentPathKind = "file" | "directory" | "symlink" | "other";
274
+ type AgentPathInfo = {
275
+ readonly kind: AgentPathKind;
276
+ readonly mtimeMs: number;
277
+ };
278
+ type AgentDirectoryEntry = {
279
+ readonly name: string;
280
+ readonly path: string;
281
+ readonly kind: AgentPathKind;
282
+ readonly mtimeMs: number;
283
+ };
284
+ interface AgentFilesystem {
285
+ readTextFile(filePath: string): Promise<string>;
286
+ writeTextFile(filePath: string, content: string): Promise<void>;
287
+ deleteFile(filePath: string): Promise<void>;
288
+ ensureDir(directoryPath: string): Promise<void>;
289
+ readDir(directoryPath: string): Promise<readonly AgentDirectoryEntry[]>;
290
+ stat(entryPath: string): Promise<AgentPathInfo>;
291
+ }
292
+ declare class InMemoryAgentFilesystem implements AgentFilesystem {
293
+ #private;
294
+ constructor(initialFiles?: Record<string, string>);
295
+ readTextFile(filePath: string): Promise<string>;
296
+ writeTextFile(filePath: string, content: string): Promise<void>;
297
+ deleteFile(filePath: string): Promise<void>;
298
+ ensureDir(directoryPath: string): Promise<void>;
299
+ readDir(directoryPath: string): Promise<readonly AgentDirectoryEntry[]>;
300
+ stat(entryPath: string): Promise<AgentPathInfo>;
301
+ snapshot(): Record<string, string>;
302
+ }
303
+ declare function createNodeAgentFilesystem(): AgentFilesystem;
304
+ declare function createInMemoryAgentFilesystem(initialFiles?: Record<string, string>): InMemoryAgentFilesystem;
305
+
306
+ type AgentFilesystemToolProfile = "auto" | "model-agnostic" | "codex" | "gemini";
307
+ type AgentFilesystemToolName = "apply_patch" | "read_file" | "write_file" | "replace" | "list_dir" | "list_directory" | "grep_files" | "grep_search" | "glob";
308
+ type AgentFilesystemToolAction = "read" | "write" | "delete" | "move" | "list" | "search";
309
+ type AgentFilesystemToolAccessContext = {
310
+ readonly cwd: string;
311
+ readonly tool: AgentFilesystemToolName;
312
+ readonly action: AgentFilesystemToolAction;
313
+ readonly path: string;
314
+ readonly fromPath?: string;
315
+ readonly toPath?: string;
316
+ readonly pattern?: string;
317
+ readonly include?: string;
318
+ };
319
+ type AgentFilesystemToolAccessHook = (context: AgentFilesystemToolAccessContext) => Promise<void> | void;
320
+ type AgentFilesystemToolsOptions = {
321
+ readonly cwd?: string;
322
+ readonly fs?: AgentFilesystem;
323
+ readonly allowOutsideCwd?: boolean;
324
+ readonly checkAccess?: AgentFilesystemToolAccessHook;
325
+ readonly maxLineLength?: number;
326
+ readonly grepMaxScannedFiles?: number;
327
+ readonly applyPatch?: {
328
+ readonly maxPatchBytes?: number;
329
+ };
330
+ };
331
+ declare const codexReadFileInputSchema: z.ZodObject<{
332
+ file_path: z.ZodString;
333
+ offset: z.ZodOptional<z.ZodNumber>;
334
+ limit: z.ZodOptional<z.ZodNumber>;
335
+ mode: z.ZodOptional<z.ZodEnum<{
336
+ slice: "slice";
337
+ indentation: "indentation";
338
+ }>>;
339
+ indentation: z.ZodOptional<z.ZodObject<{
340
+ anchor_line: z.ZodOptional<z.ZodNumber>;
341
+ max_levels: z.ZodOptional<z.ZodNumber>;
342
+ include_siblings: z.ZodOptional<z.ZodBoolean>;
343
+ include_header: z.ZodOptional<z.ZodBoolean>;
344
+ max_lines: z.ZodOptional<z.ZodNumber>;
345
+ }, z.core.$strip>>;
346
+ }, z.core.$strip>;
347
+ declare const codexListDirInputSchema: z.ZodObject<{
348
+ dir_path: z.ZodString;
349
+ offset: z.ZodOptional<z.ZodNumber>;
350
+ limit: z.ZodOptional<z.ZodNumber>;
351
+ depth: z.ZodOptional<z.ZodNumber>;
352
+ }, z.core.$strip>;
353
+ declare const codexGrepFilesInputSchema: z.ZodObject<{
354
+ pattern: z.ZodString;
355
+ include: z.ZodOptional<z.ZodString>;
356
+ path: z.ZodOptional<z.ZodString>;
357
+ limit: z.ZodOptional<z.ZodNumber>;
358
+ }, z.core.$strip>;
359
+ declare const applyPatchInputSchema: z.ZodObject<{
360
+ input: z.ZodString;
361
+ }, z.core.$strip>;
362
+ declare const geminiReadFileInputSchema: z.ZodObject<{
363
+ file_path: z.ZodString;
364
+ offset: z.ZodOptional<z.ZodNumber>;
365
+ limit: z.ZodOptional<z.ZodNumber>;
366
+ }, z.core.$strip>;
367
+ declare const geminiWriteFileInputSchema: z.ZodObject<{
368
+ file_path: z.ZodString;
369
+ content: z.ZodString;
370
+ }, z.core.$strip>;
371
+ declare const geminiReplaceInputSchema: z.ZodObject<{
372
+ file_path: z.ZodString;
373
+ instruction: z.ZodString;
374
+ old_string: z.ZodString;
375
+ new_string: z.ZodString;
376
+ expected_replacements: z.ZodOptional<z.ZodNumber>;
377
+ }, z.core.$strip>;
378
+ declare const geminiListDirectoryInputSchema: z.ZodObject<{
379
+ dir_path: z.ZodString;
380
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
381
+ file_filtering_options: z.ZodOptional<z.ZodObject<{
382
+ respect_git_ignore: z.ZodOptional<z.ZodBoolean>;
383
+ respect_gemini_ignore: z.ZodOptional<z.ZodBoolean>;
384
+ }, z.core.$strip>>;
385
+ }, z.core.$strip>;
386
+ declare const geminiGrepSearchInputSchema: z.ZodObject<{
387
+ pattern: z.ZodString;
388
+ dir_path: z.ZodOptional<z.ZodString>;
389
+ include: z.ZodOptional<z.ZodString>;
390
+ exclude_pattern: z.ZodOptional<z.ZodString>;
391
+ names_only: z.ZodOptional<z.ZodBoolean>;
392
+ max_matches_per_file: z.ZodOptional<z.ZodNumber>;
393
+ total_max_matches: z.ZodOptional<z.ZodNumber>;
394
+ }, z.core.$strip>;
395
+ declare const geminiGlobInputSchema: z.ZodObject<{
396
+ pattern: z.ZodString;
397
+ dir_path: z.ZodOptional<z.ZodString>;
398
+ case_sensitive: z.ZodOptional<z.ZodBoolean>;
399
+ respect_git_ignore: z.ZodOptional<z.ZodBoolean>;
400
+ respect_gemini_ignore: z.ZodOptional<z.ZodBoolean>;
401
+ }, z.core.$strip>;
402
+ type CodexReadFileToolInput = z.output<typeof codexReadFileInputSchema>;
403
+ type CodexListDirToolInput = z.output<typeof codexListDirInputSchema>;
404
+ type CodexGrepFilesToolInput = z.output<typeof codexGrepFilesInputSchema>;
405
+ type CodexApplyPatchToolInput = z.output<typeof applyPatchInputSchema>;
406
+ type GeminiReadFileToolInput = z.output<typeof geminiReadFileInputSchema>;
407
+ type GeminiWriteFileToolInput = z.output<typeof geminiWriteFileInputSchema>;
408
+ type GeminiReplaceToolInput = z.output<typeof geminiReplaceInputSchema>;
409
+ type GeminiListDirectoryToolInput = z.output<typeof geminiListDirectoryInputSchema>;
410
+ type GeminiGrepSearchToolInput = z.output<typeof geminiGrepSearchInputSchema>;
411
+ type GeminiGlobToolInput = z.output<typeof geminiGlobInputSchema>;
412
+ declare function resolveFilesystemToolProfile(model: string, profile?: AgentFilesystemToolProfile): Exclude<AgentFilesystemToolProfile, "auto">;
413
+ declare function createFilesystemToolSetForModel(model: string, profileOrOptions?: AgentFilesystemToolProfile | AgentFilesystemToolsOptions, maybeOptions?: AgentFilesystemToolsOptions): LlmToolSet;
414
+ declare function createCodexFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
415
+ declare function createGeminiFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
416
+ declare function createModelAgnosticFilesystemToolSet(options?: AgentFilesystemToolsOptions): LlmToolSet;
417
+ declare function createCodexApplyPatchTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof applyPatchInputSchema, string>;
418
+ declare function createCodexReadFileTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof codexReadFileInputSchema, string>;
419
+ declare function createListDirTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof codexListDirInputSchema, string>;
420
+ declare function createGrepFilesTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof codexGrepFilesInputSchema, string>;
421
+ declare function createReadFileTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiReadFileInputSchema, string>;
422
+ declare function createWriteFileTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiWriteFileInputSchema, string>;
423
+ declare function createReplaceTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiReplaceInputSchema, string>;
424
+ declare function createListDirectoryTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiListDirectoryInputSchema, string>;
425
+ declare function createGrepSearchTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiGrepSearchInputSchema, string>;
426
+ declare function createGlobTool(options?: AgentFilesystemToolsOptions): LlmExecutableTool<typeof geminiGlobInputSchema, string>;
427
+
428
+ type AgentFilesystemToolConfig = {
429
+ readonly enabled?: boolean;
430
+ readonly profile?: AgentFilesystemToolProfile;
431
+ readonly options?: AgentFilesystemToolsOptions;
432
+ };
433
+ type AgentFilesystemToolSelection = boolean | AgentFilesystemToolProfile | AgentFilesystemToolConfig;
434
+ type RunAgentLoopRequest = Omit<LlmToolLoopRequest, "tools"> & {
435
+ readonly tools?: LlmToolSet;
436
+ readonly filesystemTool?: AgentFilesystemToolSelection;
437
+ readonly filesystem_tool?: AgentFilesystemToolSelection;
438
+ };
439
+ declare function runAgentLoop(request: RunAgentLoopRequest): Promise<LlmToolLoopResult>;
440
+
441
+ type ApplyPatchAccessContext = {
442
+ readonly cwd: string;
443
+ readonly kind: "add" | "delete" | "update" | "move";
444
+ readonly path: string;
445
+ readonly fromPath?: string;
446
+ readonly toPath?: string;
447
+ };
448
+ type ApplyPatchAccessHook = (context: ApplyPatchAccessContext) => Promise<void> | void;
449
+ type ApplyPatchRequest = {
450
+ readonly patch: string;
451
+ readonly cwd?: string;
452
+ readonly fs?: AgentFilesystem;
453
+ readonly allowOutsideCwd?: boolean;
454
+ readonly checkAccess?: ApplyPatchAccessHook;
455
+ readonly maxPatchBytes?: number;
456
+ };
457
+ type ApplyPatchResult = {
458
+ readonly success: true;
459
+ readonly summary: string;
460
+ readonly added: readonly string[];
461
+ readonly modified: readonly string[];
462
+ readonly deleted: readonly string[];
463
+ };
464
+ type CreateApplyPatchToolOptions = Omit<ApplyPatchRequest, "patch"> & {
465
+ readonly description?: string;
466
+ };
467
+ declare const applyPatchToolInputSchema: z.ZodObject<{
468
+ input: z.ZodString;
469
+ }, z.core.$strip>;
470
+ type ApplyPatchToolInput = z.output<typeof applyPatchToolInputSchema>;
471
+ declare function createApplyPatchTool(options?: CreateApplyPatchToolOptions): LlmExecutableTool<typeof applyPatchToolInputSchema, ApplyPatchResult>;
472
+ declare function applyPatch(request: ApplyPatchRequest): Promise<ApplyPatchResult>;
473
+
273
474
  type ChatGptAuthProfile = {
274
475
  readonly access: string;
275
476
  readonly refresh: string;
@@ -296,4 +497,4 @@ type GeminiConfiguration = {
296
497
  };
297
498
  declare function configureGemini(options?: GeminiConfiguration): void;
298
499
 
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 };
500
+ 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, type ChatGptAuthProfile, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CreateApplyPatchToolOptions, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReplaceToolInput, type GeminiWriteFileToolInput, InMemoryAgentFilesystem, 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, type RunAgentLoopRequest, appendMarkdownSourcesSection, applyPatch, configureGemini, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createReadFileTool, createReplaceTool, createWriteFileTool, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isGeminiModelId, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resolveFilesystemToolProfile, runAgentLoop, runToolLoop, sanitisePartForLogging, streamJson, streamText, stripCodexCitationMarkers, toGeminiJsonSchema, tool };