ai-code-agents 0.1.0-beta.1 → 0.2.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
@@ -1,288 +1,8 @@
1
- import { FlexibleSchema, Tool } from '@ai-sdk/provider-utils';
2
- import { ToolCallOptions, Experimental_AgentSettings, Experimental_Agent } from 'ai';
3
- import * as z from 'zod';
4
- import { z as z$1 } from 'zod';
5
-
6
- declare const ReadFileResult: z.ZodObject<{
7
- path: z.ZodString;
8
- content: z.ZodString;
9
- }, z.core.$strip>;
10
- type ReadFileResult = z.infer<typeof ReadFileResult>;
11
- declare const WriteFileResult: z.ZodObject<{
12
- path: z.ZodString;
13
- message: z.ZodString;
14
- }, z.core.$strip>;
15
- type WriteFileResult = z.infer<typeof WriteFileResult>;
16
- declare const DeleteFileResult: z.ZodObject<{
17
- path: z.ZodString;
18
- message: z.ZodString;
19
- }, z.core.$strip>;
20
- type DeleteFileResult = z.infer<typeof DeleteFileResult>;
21
- declare const MoveFileResult: z.ZodObject<{
22
- sourcePath: z.ZodString;
23
- destinationPath: z.ZodString;
24
- message: z.ZodString;
25
- }, z.core.$strip>;
26
- type MoveFileResult = z.infer<typeof MoveFileResult>;
27
- declare const CopyFileResult: z.ZodObject<{
28
- sourcePath: z.ZodString;
29
- destinationPath: z.ZodString;
30
- message: z.ZodString;
31
- }, z.core.$strip>;
32
- type CopyFileResult = z.infer<typeof CopyFileResult>;
33
- declare const RunCommandResult: z.ZodObject<{
34
- command: z.ZodString;
35
- exitCode: z.ZodNumber;
36
- stdout: z.ZodString;
37
- stderr: z.ZodString;
38
- }, z.core.$strip>;
39
- type RunCommandResult = z.infer<typeof RunCommandResult>;
40
- interface FilesystemEnvironmentInterface {
41
- get name(): string;
42
- readFile(path: string): Promise<ReadFileResult>;
43
- writeFile(path: string, content: string): Promise<WriteFileResult>;
44
- deleteFile(path: string): Promise<DeleteFileResult>;
45
- moveFile(sourcePath: string, destinationPath: string): Promise<MoveFileResult>;
46
- copyFile(sourcePath: string, destinationPath: string): Promise<CopyFileResult>;
47
- }
48
- interface CommandLineEnvironmentInterface extends FilesystemEnvironmentInterface {
49
- runCommand(command: string): Promise<RunCommandResult>;
50
- }
51
- type Environment = FilesystemEnvironmentInterface | CommandLineEnvironmentInterface;
52
- type ModelTextResult = {
53
- type: 'text';
54
- value: string;
55
- };
56
- type ModelTextPart = {
57
- type: 'text';
58
- text: string;
59
- };
60
- type ModelMediaPart = {
61
- type: 'media';
62
- data: string;
63
- mediaType: string;
64
- };
65
- type ModelFormattedToolResult = ModelTextResult | {
66
- type: 'content';
67
- value: Array<ModelTextPart | ModelMediaPart>;
68
- };
69
- type ToolExample<ToolInputType, ToolOutputType> = {
70
- input: ToolInputType;
71
- output: ToolOutputType | string;
72
- };
73
- interface ToolInterface<ToolInputType, ToolOutputType> {
74
- get name(): string;
75
- get description(): string;
76
- get inputSchema(): FlexibleSchema<ToolInputType>;
77
- get outputSchema(): FlexibleSchema<ToolOutputType>;
78
- execute(input: ToolInputType, options: ToolCallOptions): Promise<ToolOutputType>;
79
- toModelOutput(output: ToolOutputType): ModelFormattedToolResult;
80
- get examples(): Array<ToolExample<ToolInputType, ToolOutputType>>;
81
- get needsApproval(): boolean;
82
- }
83
- interface EnvironmentToolInterface<ToolInputType, ToolOutputType, EnvironmentType> extends ToolInterface<ToolInputType, ToolOutputType> {
84
- get environment(): EnvironmentType;
85
- }
86
- type ToolConfig = {
87
- name?: string;
88
- description?: string;
89
- needsApproval?: boolean;
90
- };
91
-
92
- /**
93
- * Base class for a filesystem-based execution environment.
94
- */
95
- declare abstract class FilesystemEnvironmentBase<EnvironmentConfig> implements FilesystemEnvironmentInterface {
96
- protected _envConfig: EnvironmentConfig;
97
- /**
98
- * Constructs a new environment instance.
99
- *
100
- * @param config - Environment configuration.
101
- */
102
- constructor(config: EnvironmentConfig);
103
- /**
104
- * Gets the environment name.
105
- *
106
- * @returns The environment name.
107
- */
108
- abstract get name(): string;
109
- /**
110
- * Reads the content of a file at the specified path.
111
- *
112
- * @param path - The path to the file to read, relative to the project directory.
113
- * @returns A promise that resolves to a ReadFileResult.
114
- */
115
- readFile(path: string): Promise<ReadFileResult>;
116
- /**
117
- * Writes content to a file at the specified path.
118
- *
119
- * If a file is already present at the path, it will be overwritten.
120
- *
121
- * @param path - The path to the file to write, relative to the project directory.
122
- * @param content - The content to write to the file.
123
- * @returns A promise that resolves to a WriteFileResult.
124
- */
125
- writeFile(path: string, content: string): Promise<WriteFileResult>;
126
- /**
127
- * Deletes a file at the specified path.
128
- *
129
- * @param path - The path to the file to delete, relative to the project directory.
130
- * @returns A promise that resolves to a DeleteFileResult.
131
- */
132
- deleteFile(path: string): Promise<DeleteFileResult>;
133
- /**
134
- * Moves a file from a source path to a destination path.
135
- *
136
- * If a file is already present at the destination path, it will be overwritten.
137
- *
138
- * @param sourcePath - The path to the file to move.
139
- * @param destinationPath - The path to move the file to.
140
- * @returns A promise that resolves to a MoveFileResult.
141
- */
142
- moveFile(sourcePath: string, destinationPath: string): Promise<MoveFileResult>;
143
- /**
144
- * Copies a file from a source path to a destination path.
145
- *
146
- * If a file is already present at the destination path, it will be overwritten.
147
- *
148
- * @param sourcePath - The path to the file to copy.
149
- * @param destinationPath - The path to copy the file to.
150
- * @returns A promise that resolves to a CopyFileResult.
151
- */
152
- copyFile(sourcePath: string, destinationPath: string): Promise<CopyFileResult>;
153
- /**
154
- * Checks whether a file exists at the specified path relative to the project directory.
155
- *
156
- * @param relativePath - The path to the file to check, relative to the project directory.
157
- * @returns True if the file exists, false otherwise.
158
- */
159
- protected abstract fileExists(relativePath: string): Promise<boolean>;
160
- /**
161
- * Gets the content of a file at the specified path, relative to the project directory.
162
- *
163
- * When this method is called, it is guaranteed that the file exists.
164
- *
165
- * @param relativePath - The path to the file to read, relative to the project directory.
166
- * @returns The content of the file.
167
- */
168
- protected abstract readFileContent(relativePath: string): Promise<string>;
169
- /**
170
- * Writes content to a file at the specified path, relative to the project directory.
171
- *
172
- * This method unconditionally writes the content, even if a file already exists at the path, or if the file is new.
173
- *
174
- * @param relativePath - The path to the file to write, relative to the project directory.
175
- * @param content - The content to write to the file.
176
- */
177
- protected abstract writeFileContent(relativePath: string, content: string): Promise<void>;
178
- /**
179
- * Deletes a file at the specified path, relative to the project directory.
180
- *
181
- * When this method is called, it is guaranteed that the file exists.
182
- *
183
- * @param relativePath - The path to the file to delete, relative to the project directory.
184
- */
185
- protected abstract deleteFileContent(relativePath: string): Promise<void>;
186
- /**
187
- * Moves the content of a file from a source path to a destination path, relative to the project directory.
188
- *
189
- * When this method is called, it is guaranteed that the source file exists.
190
- * This method unconditionally moves the content, even if a file already exists at the destination path.
191
- *
192
- * @param relativeSourcePath - The path to the file to move, relative to the project directory.
193
- * @param relativeDestinationPath - The path to move the file to, relative to the project directory.
194
- */
195
- protected moveFileContent(relativeSourcePath: string, relativeDestinationPath: string): Promise<void>;
196
- /**
197
- * Copies the content of a file from a source path to a destination path, relative to the project directory.
198
- *
199
- * When this method is called, it is guaranteed that the source file exists.
200
- * This method unconditionally copies the content, even if a file already exists at the destination path.
201
- *
202
- * @param relativeSourcePath - The path to the file to copy, relative to the project directory.
203
- * @param relativeDestinationPath - The path to copy the file to, relative to the project directory.
204
- */
205
- protected copyFileContent(relativeSourcePath: string, relativeDestinationPath: string): Promise<void>;
206
- }
207
-
208
- /**
209
- * Base class for a command-line based execution environment.
210
- */
211
- declare abstract class CommandLineEnvironmentBase<EnvironmentConfig> extends FilesystemEnvironmentBase<EnvironmentConfig> implements CommandLineEnvironmentInterface {
212
- /**
213
- * Runs a CLI command in environment.
214
- *
215
- * @param command - The command to run.
216
- * @returns A promise that resolves to a RunCommandResult.
217
- */
218
- runCommand(command: string): Promise<RunCommandResult>;
219
- /**
220
- * Executes a command in the environment and returns the exit code, stdout, and stderr.
221
- *
222
- * @param command - The command to execute.
223
- * @returns A promise that resolves to a tuple containing the exit code, stdout, and stderr.
224
- */
225
- protected abstract executeCommand(command: string): Promise<[number, string, string]>;
226
- }
227
-
228
- /**
229
- * Base class for a Unix-like command line execution environment.
230
- */
231
- declare abstract class UnixEnvironmentBase<EnvironmentConfig> extends CommandLineEnvironmentBase<EnvironmentConfig> {
232
- /**
233
- * Checks whether a file exists at the specified path relative to the project directory.
234
- *
235
- * @param relativePath - The path to the file to check, relative to the project directory.
236
- * @returns True if the file exists, false otherwise.
237
- */
238
- protected fileExists(relativePath: string): Promise<boolean>;
239
- /**
240
- * Gets the content of a file at the specified path, relative to the project directory.
241
- *
242
- * When this method is called, it is guaranteed that the file exists.
243
- *
244
- * @param relativePath - The path to the file to read, relative to the project directory.
245
- * @returns The content of the file.
246
- */
247
- protected readFileContent(relativePath: string): Promise<string>;
248
- /**
249
- * Writes content to a file at the specified path, relative to the project directory.
250
- *
251
- * This method unconditionally writes the content, even if a file already exists at the path, or if the file is new.
252
- *
253
- * @param relativePath - The path to the file to write, relative to the project directory.
254
- * @param content - The content to write to the file.
255
- */
256
- protected writeFileContent(relativePath: string, content: string): Promise<void>;
257
- /**
258
- * Deletes a file at the specified path, relative to the project directory.
259
- *
260
- * When this method is called, it is guaranteed that the file exists.
261
- *
262
- * @param relativePath - The path to the file to delete, relative to the project directory.
263
- */
264
- protected deleteFileContent(relativePath: string): Promise<void>;
265
- /**
266
- * Moves the content of a file from a source path to a destination path, relative to the project directory.
267
- *
268
- * When this method is called, it is guaranteed that the source file exists.
269
- * This method unconditionally moves the content, even if a file already exists at the destination path.
270
- *
271
- * @param relativeSourcePath - The path to the file to move, relative to the project directory.
272
- * @param relativeDestinationPath - The path to move the file to, relative to the project directory.
273
- */
274
- protected moveFileContent(relativeSourcePath: string, relativeDestinationPath: string): Promise<void>;
275
- /**
276
- * Copies the content of a file from a source path to a destination path, relative to the project directory.
277
- *
278
- * When this method is called, it is guaranteed that the source file exists.
279
- * This method unconditionally copies the content, even if a file already exists at the destination path.
280
- *
281
- * @param relativeSourcePath - The path to the file to copy, relative to the project directory.
282
- * @param relativeDestinationPath - The path to copy the file to, relative to the project directory.
283
- */
284
- protected copyFileContent(relativeSourcePath: string, relativeDestinationPath: string): Promise<void>;
285
- }
1
+ import { UnixEnvironmentBase, FilesystemEnvironmentBase, ToolConfig, EnvironmentToolBase, FilesystemEnvironmentInterface, EnvironmentToolMetadata, ModelToolResultToFormat, ModelFormattedToolResult, ToolExample, CommandLineEnvironmentInterface, ToolBase, ToolMetadata, Environment } from '@ai-code-agents/environment-utils';
2
+ export { CommandLineEnvironmentInterface, Environment, EnvironmentToolInterface, FilesystemEnvironmentInterface, ToolInterface } from '@ai-code-agents/environment-utils';
3
+ import { z } from 'zod';
4
+ import { ToolExecutionOptions, ToolLoopAgentSettings, ToolLoopAgent } from 'ai';
5
+ import { Tool } from '@ai-sdk/provider-utils';
286
6
 
287
7
  type DockerEnvironmentConfig = {
288
8
  containerId: string;
@@ -316,7 +36,7 @@ declare class DockerEnvironment extends UnixEnvironmentBase<DockerEnvironmentCon
316
36
  }
317
37
 
318
38
  type MockFilesystemEnvironmentConfig = {
319
- initialFiles?: Map<string, string>;
39
+ initialFiles?: Record<string, string>;
320
40
  directoryPath?: string;
321
41
  };
322
42
  declare const MockFilesystemEnvironmentName = "mock-filesystem";
@@ -477,150 +197,19 @@ declare class UnsafeLocalEnvironment extends UnixEnvironmentBase<UnsafeLocalEnvi
477
197
  protected executeCommand(command: string): Promise<[number, string, string]>;
478
198
  }
479
199
 
480
- type FlexibleInputSchema<T> = ToolInterface<T, unknown>['inputSchema'];
481
- type FlexibleOutputSchema<T> = ToolInterface<unknown, T>['outputSchema'];
482
- type ToolMetadata<ToolInputType, ToolOutputType> = {
483
- name: string;
484
- description: string;
485
- inputSchema: FlexibleInputSchema<ToolInputType>;
486
- outputSchema: FlexibleOutputSchema<ToolOutputType>;
487
- needsApproval: boolean;
488
- };
489
- /**
490
- * Base class for a tool.
491
- */
492
- declare abstract class ToolBase<ToolConfig extends ToolConfig, ToolInputType, ToolOutputType> implements ToolInterface<ToolInputType, ToolOutputType> {
493
- readonly _toolConfig: ToolConfig;
494
- protected readonly _name: string;
495
- protected readonly _description: string;
496
- protected readonly _inputSchema: FlexibleInputSchema<ToolInputType>;
497
- protected readonly _outputSchema: FlexibleOutputSchema<ToolOutputType>;
498
- protected readonly _needsApproval: boolean;
499
- /**
500
- * Constructs a new tool instance.
501
- *
502
- * @param toolConfig - Optional tool config, can be used to override some defaults.
503
- */
504
- constructor(toolConfig?: ToolConfig);
505
- /**
506
- * Gets the tool name.
507
- *
508
- * @returns The tool name.
509
- */
510
- get name(): string;
511
- /**
512
- * Gets the tool description.
513
- *
514
- * @returns The tool description.
515
- */
516
- get description(): string;
517
- /**
518
- * Gets the input schema for the tool.
519
- *
520
- * @returns The input schema.
521
- */
522
- get inputSchema(): FlexibleInputSchema<ToolInputType>;
523
- /**
524
- * Gets the input schema for the tool.
525
- *
526
- * @returns The input schema.
527
- */
528
- get outputSchema(): FlexibleInputSchema<ToolOutputType>;
529
- /**
530
- * Gets whether the tool needs approval before use.
531
- *
532
- * @returns True if the tool needs approval, false otherwise.
533
- */
534
- get needsApproval(): boolean;
535
- /**
536
- * Gets the examples for the tool.
537
- *
538
- * @returns The tool examples.
539
- */
540
- abstract get examples(): Array<ToolExample<ToolInputType, ToolOutputType>>;
541
- /**
542
- * Executes the tool with the given input.
543
- *
544
- * @param input - The input for the tool.
545
- * @param options - Options from the tool call.
546
- * @returns A promise that resolves to the tool execution result.
547
- */
548
- abstract execute(input: ToolInputType, options: ToolCallOptions): Promise<ToolOutputType>;
549
- /**
550
- * Converts the tool output to a format suitable for model consumption.
551
- *
552
- * @param output - The output from the tool execution.
553
- * @returns The formatted tool result.
554
- */
555
- abstract toModelOutput(output: ToolOutputType): ModelFormattedToolResult;
556
- /**
557
- * Returns the metadata for the tool.
558
- *
559
- * The name, description, and needsApproval properties are defaults which can be overridden in the constructor.
560
- *
561
- * @returns The tool metadata.
562
- */
563
- protected abstract getMetadata(): ToolMetadata<ToolInputType, ToolOutputType>;
564
- }
565
-
566
- type EnvironmentToolMetadata<ToolInputType, ToolOutputType> = ToolMetadata<ToolInputType, ToolOutputType>;
567
- /**
568
- * Base class for an execution environment tool.
569
- */
570
- declare abstract class EnvironmentToolBase<ToolConfig extends ToolConfig, ToolInputType, ToolOutputType, EnvironmentType> extends ToolBase<ToolConfig, ToolInputType, ToolOutputType> implements EnvironmentToolInterface<ToolInputType, ToolOutputType, EnvironmentType> {
571
- protected readonly _environment: EnvironmentType;
572
- /**
573
- * Constructs a new `EnvironmentToolBase` instance.
574
- *
575
- * @param environment - The execution environment to apply the tool in.
576
- * @param toolConfig - Optional tool config, can be used to override some defaults.
577
- */
578
- constructor(environment: EnvironmentType, toolConfig?: ToolConfig);
579
- /**
580
- * Gets the current execution environment for the tool.
581
- *
582
- * @returns The current execution environment.
583
- */
584
- get environment(): EnvironmentType;
585
- /**
586
- * Executes the tool with the given input.
587
- *
588
- * @param input - The input for the tool.
589
- * @param _options - Options from the tool call.
590
- * @returns A promise that resolves to the tool execution result.
591
- */
592
- execute(input: ToolInputType, _options: ToolCallOptions): Promise<ToolOutputType>;
593
- /**
594
- * Returns the metadata for the tool.
595
- *
596
- * The name, description, and needsApproval properties are defaults which can be overridden in the constructor.
597
- *
598
- * @returns The tool metadata.
599
- */
600
- protected abstract getMetadata(): EnvironmentToolMetadata<ToolInputType, ToolOutputType>;
601
- /**
602
- * Executes the tool in the given execution environment with the given input.
603
- *
604
- * @param env - The execution environment to use.
605
- * @param input - The input for the tool.
606
- * @returns A promise that resolves to the tool execution result.
607
- */
608
- protected abstract executeForEnvironment(env: EnvironmentType, input: ToolInputType): Promise<ToolOutputType>;
609
- }
610
-
611
200
  declare const CopyFileToolName = "copy_file";
612
201
  type CopyFileToolConfig = ToolConfig;
613
- declare const CopyFileToolInput: z$1.ZodObject<{
614
- sourcePath: z$1.ZodString;
615
- destinationPath: z$1.ZodString;
616
- }, z$1.core.$strip>;
617
- type CopyFileToolInput = z$1.infer<typeof CopyFileToolInput>;
618
- declare const CopyFileToolOutput: z$1.ZodObject<{
619
- sourcePath: z$1.ZodString;
620
- destinationPath: z$1.ZodString;
621
- message: z$1.ZodString;
622
- }, z$1.core.$strip>;
623
- type CopyFileToolOutput = z$1.infer<typeof CopyFileToolOutput>;
202
+ declare const CopyFileToolInput: z.ZodObject<{
203
+ sourcePath: z.ZodString;
204
+ destinationPath: z.ZodString;
205
+ }, z.core.$strip>;
206
+ type CopyFileToolInput = z.infer<typeof CopyFileToolInput>;
207
+ declare const CopyFileToolOutput: z.ZodObject<{
208
+ sourcePath: z.ZodString;
209
+ destinationPath: z.ZodString;
210
+ message: z.ZodString;
211
+ }, z.core.$strip>;
212
+ type CopyFileToolOutput = z.infer<typeof CopyFileToolOutput>;
624
213
  /**
625
214
  * Class for the CopyFile tool.
626
215
  */
@@ -644,10 +233,10 @@ declare class CopyFileTool extends EnvironmentToolBase<CopyFileToolConfig, CopyF
644
233
  /**
645
234
  * Converts the tool output to a format suitable for model consumption.
646
235
  *
647
- * @param output - The output from the tool execution.
236
+ * @param options - The tool result, including the output from the tool execution.
648
237
  * @returns The formatted tool result.
649
238
  */
650
- toModelOutput(output: CopyFileToolOutput): ModelFormattedToolResult;
239
+ toModelOutput(options: ModelToolResultToFormat<CopyFileToolInput, CopyFileToolOutput>): ModelFormattedToolResult;
651
240
  /**
652
241
  * Gets the examples for the tool.
653
242
  *
@@ -658,15 +247,15 @@ declare class CopyFileTool extends EnvironmentToolBase<CopyFileToolConfig, CopyF
658
247
 
659
248
  declare const DeleteFileToolName = "delete_file";
660
249
  type DeleteFileToolConfig = ToolConfig;
661
- declare const DeleteFileToolInput: z$1.ZodObject<{
662
- path: z$1.ZodString;
663
- }, z$1.core.$strip>;
664
- type DeleteFileToolInput = z$1.infer<typeof DeleteFileToolInput>;
665
- declare const DeleteFileToolOutput: z$1.ZodObject<{
666
- path: z$1.ZodString;
667
- message: z$1.ZodString;
668
- }, z$1.core.$strip>;
669
- type DeleteFileToolOutput = z$1.infer<typeof DeleteFileToolOutput>;
250
+ declare const DeleteFileToolInput: z.ZodObject<{
251
+ path: z.ZodString;
252
+ }, z.core.$strip>;
253
+ type DeleteFileToolInput = z.infer<typeof DeleteFileToolInput>;
254
+ declare const DeleteFileToolOutput: z.ZodObject<{
255
+ path: z.ZodString;
256
+ message: z.ZodString;
257
+ }, z.core.$strip>;
258
+ type DeleteFileToolOutput = z.infer<typeof DeleteFileToolOutput>;
670
259
  /**
671
260
  * Class for the DeleteFile tool.
672
261
  */
@@ -690,10 +279,10 @@ declare class DeleteFileTool extends EnvironmentToolBase<DeleteFileToolConfig, D
690
279
  /**
691
280
  * Converts the tool output to a format suitable for model consumption.
692
281
  *
693
- * @param output - The output from the tool execution.
282
+ * @param options - The tool result, including the output from the tool execution.
694
283
  * @returns The formatted tool result.
695
284
  */
696
- toModelOutput(output: DeleteFileToolOutput): ModelFormattedToolResult;
285
+ toModelOutput(options: ModelToolResultToFormat<DeleteFileToolInput, DeleteFileToolOutput>): ModelFormattedToolResult;
697
286
  /**
698
287
  * Gets the examples for the tool.
699
288
  *
@@ -704,21 +293,21 @@ declare class DeleteFileTool extends EnvironmentToolBase<DeleteFileToolConfig, D
704
293
 
705
294
  declare const EditFileToolName = "edit_file";
706
295
  type EditFileToolConfig = ToolConfig;
707
- declare const EditFileToolInput: z$1.ZodObject<{
708
- path: z$1.ZodString;
709
- oldString: z$1.ZodString;
710
- newString: z$1.ZodString;
711
- replaceAll: z$1.ZodOptional<z$1.ZodBoolean>;
712
- }, z$1.core.$strip>;
713
- type EditFileToolInput = z$1.infer<typeof EditFileToolInput>;
714
- declare const EditFileToolOutput: z$1.ZodObject<{
715
- path: z$1.ZodString;
716
- oldString: z$1.ZodString;
717
- newString: z$1.ZodString;
718
- replacements: z$1.ZodNumber;
719
- message: z$1.ZodString;
720
- }, z$1.core.$strip>;
721
- type EditFileToolOutput = z$1.infer<typeof EditFileToolOutput>;
296
+ declare const EditFileToolInput: z.ZodObject<{
297
+ path: z.ZodString;
298
+ oldString: z.ZodString;
299
+ newString: z.ZodString;
300
+ replaceAll: z.ZodOptional<z.ZodBoolean>;
301
+ }, z.core.$strip>;
302
+ type EditFileToolInput = z.infer<typeof EditFileToolInput>;
303
+ declare const EditFileToolOutput: z.ZodObject<{
304
+ path: z.ZodString;
305
+ oldString: z.ZodString;
306
+ newString: z.ZodString;
307
+ replacements: z.ZodNumber;
308
+ message: z.ZodString;
309
+ }, z.core.$strip>;
310
+ type EditFileToolOutput = z.infer<typeof EditFileToolOutput>;
722
311
  /**
723
312
  * Class for the EditFile tool.
724
313
  */
@@ -742,10 +331,10 @@ declare class EditFileTool extends EnvironmentToolBase<EditFileToolConfig, EditF
742
331
  /**
743
332
  * Converts the tool output to a format suitable for model consumption.
744
333
  *
745
- * @param output - The output from the tool execution.
334
+ * @param options - The tool result, including the output from the tool execution.
746
335
  * @returns The formatted tool result.
747
336
  */
748
- toModelOutput(output: EditFileToolOutput): ModelFormattedToolResult;
337
+ toModelOutput(options: ModelToolResultToFormat<EditFileToolInput, EditFileToolOutput>): ModelFormattedToolResult;
749
338
  /**
750
339
  * Gets the examples for the tool.
751
340
  *
@@ -756,16 +345,16 @@ declare class EditFileTool extends EnvironmentToolBase<EditFileToolConfig, EditF
756
345
 
757
346
  declare const GetProjectFileStructureToolName = "get_project_file_structure";
758
347
  type GetProjectFileStructureToolConfig = ToolConfig;
759
- declare const GetProjectFileStructureToolInput: z$1.ZodObject<{
760
- path: z$1.ZodOptional<z$1.ZodString>;
761
- excludeGitIgnored: z$1.ZodOptional<z$1.ZodBoolean>;
762
- }, z$1.core.$strip>;
763
- type GetProjectFileStructureToolInput = z$1.infer<typeof GetProjectFileStructureToolInput>;
764
- declare const GetProjectFileStructureToolOutput: z$1.ZodObject<{
765
- files: z$1.ZodArray<z$1.ZodString>;
766
- excludeGitIgnored: z$1.ZodBoolean;
767
- }, z$1.core.$strip>;
768
- type GetProjectFileStructureToolOutput = z$1.infer<typeof GetProjectFileStructureToolOutput>;
348
+ declare const GetProjectFileStructureToolInput: z.ZodObject<{
349
+ path: z.ZodOptional<z.ZodString>;
350
+ excludeGitIgnored: z.ZodOptional<z.ZodBoolean>;
351
+ }, z.core.$strip>;
352
+ type GetProjectFileStructureToolInput = z.infer<typeof GetProjectFileStructureToolInput>;
353
+ declare const GetProjectFileStructureToolOutput: z.ZodObject<{
354
+ files: z.ZodArray<z.ZodString>;
355
+ excludeGitIgnored: z.ZodBoolean;
356
+ }, z.core.$strip>;
357
+ type GetProjectFileStructureToolOutput = z.infer<typeof GetProjectFileStructureToolOutput>;
769
358
  /**
770
359
  * Class for the GetProjectFileStructure tool.
771
360
  */
@@ -789,10 +378,10 @@ declare class GetProjectFileStructureTool extends EnvironmentToolBase<GetProject
789
378
  /**
790
379
  * Converts the tool output to a format suitable for model consumption.
791
380
  *
792
- * @param output - The output from the tool execution.
381
+ * @param options - The tool result, including the output from the tool execution.
793
382
  * @returns The formatted tool result.
794
383
  */
795
- toModelOutput(output: GetProjectFileStructureToolOutput): ModelFormattedToolResult;
384
+ toModelOutput(options: ModelToolResultToFormat<GetProjectFileStructureToolInput, GetProjectFileStructureToolOutput>): ModelFormattedToolResult;
796
385
  /**
797
386
  * Gets the examples for the tool.
798
387
  *
@@ -803,19 +392,19 @@ declare class GetProjectFileStructureTool extends EnvironmentToolBase<GetProject
803
392
 
804
393
  declare const GlobToolName = "glob";
805
394
  type GlobToolConfig = ToolConfig;
806
- declare const GlobToolInput: z$1.ZodObject<{
807
- searchPattern: z$1.ZodString;
808
- searchPath: z$1.ZodOptional<z$1.ZodString>;
809
- excludeGitIgnored: z$1.ZodOptional<z$1.ZodBoolean>;
810
- }, z$1.core.$strip>;
811
- type GlobToolInput = z$1.infer<typeof GlobToolInput>;
812
- declare const GlobToolOutput: z$1.ZodObject<{
813
- searchPattern: z$1.ZodString;
814
- searchPath: z$1.ZodString;
815
- excludeGitIgnored: z$1.ZodBoolean;
816
- matchingPaths: z$1.ZodArray<z$1.ZodString>;
817
- }, z$1.core.$strip>;
818
- type GlobToolOutput = z$1.infer<typeof GlobToolOutput>;
395
+ declare const GlobToolInput: z.ZodObject<{
396
+ searchPattern: z.ZodString;
397
+ searchPath: z.ZodOptional<z.ZodString>;
398
+ excludeGitIgnored: z.ZodOptional<z.ZodBoolean>;
399
+ }, z.core.$strip>;
400
+ type GlobToolInput = z.infer<typeof GlobToolInput>;
401
+ declare const GlobToolOutput: z.ZodObject<{
402
+ searchPattern: z.ZodString;
403
+ searchPath: z.ZodString;
404
+ excludeGitIgnored: z.ZodBoolean;
405
+ matchingPaths: z.ZodArray<z.ZodString>;
406
+ }, z.core.$strip>;
407
+ type GlobToolOutput = z.infer<typeof GlobToolOutput>;
819
408
  /**
820
409
  * Class for the Glob tool.
821
410
  */
@@ -839,10 +428,10 @@ declare class GlobTool extends EnvironmentToolBase<GlobToolConfig, GlobToolInput
839
428
  /**
840
429
  * Converts the tool output to a format suitable for model consumption.
841
430
  *
842
- * @param output - The output from the tool execution.
431
+ * @param options - The tool result, including the output from the tool execution.
843
432
  * @returns The formatted tool result.
844
433
  */
845
- toModelOutput(output: GlobToolOutput): ModelFormattedToolResult;
434
+ toModelOutput(options: ModelToolResultToFormat<GlobToolInput, GlobToolOutput>): ModelFormattedToolResult;
846
435
  /**
847
436
  * Gets the examples for the tool.
848
437
  *
@@ -851,18 +440,84 @@ declare class GlobTool extends EnvironmentToolBase<GlobToolConfig, GlobToolInput
851
440
  get examples(): Array<ToolExample<GlobToolInput, GlobToolOutput>>;
852
441
  }
853
442
 
443
+ declare const GrepToolName = "grep";
444
+ type GrepToolConfig = ToolConfig;
445
+ declare const GrepToolInput: z.ZodObject<{
446
+ regexpPattern: z.ZodString;
447
+ searchPattern: z.ZodOptional<z.ZodString>;
448
+ searchPath: z.ZodOptional<z.ZodString>;
449
+ contextLines: z.ZodOptional<z.ZodNumber>;
450
+ }, z.core.$strip>;
451
+ type GrepToolInput = z.infer<typeof GrepToolInput>;
452
+ declare const GrepMatch: z.ZodObject<{
453
+ path: z.ZodString;
454
+ lineNumber: z.ZodNumber;
455
+ line: z.ZodString;
456
+ beforeContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
457
+ afterContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
458
+ }, z.core.$strip>;
459
+ type GrepMatch = z.infer<typeof GrepMatch>;
460
+ declare const GrepToolOutput: z.ZodObject<{
461
+ regexpPattern: z.ZodString;
462
+ searchPattern: z.ZodOptional<z.ZodString>;
463
+ searchPath: z.ZodOptional<z.ZodString>;
464
+ contextLines: z.ZodOptional<z.ZodNumber>;
465
+ matches: z.ZodArray<z.ZodObject<{
466
+ path: z.ZodString;
467
+ lineNumber: z.ZodNumber;
468
+ line: z.ZodString;
469
+ beforeContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
470
+ afterContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
471
+ }, z.core.$strip>>;
472
+ }, z.core.$strip>;
473
+ type GrepToolOutput = z.infer<typeof GrepToolOutput>;
474
+ /**
475
+ * Class for the Grep tool.
476
+ */
477
+ declare class GrepTool extends EnvironmentToolBase<GrepToolConfig, GrepToolInput, GrepToolOutput, CommandLineEnvironmentInterface> {
478
+ /**
479
+ * Returns the metadata for the tool.
480
+ *
481
+ * The name, description, and needsApproval properties are defaults which can be overridden in the constructor.
482
+ *
483
+ * @returns The tool metadata.
484
+ */
485
+ protected getMetadata(): EnvironmentToolMetadata<GrepToolInput, GrepToolOutput>;
486
+ /**
487
+ * Executes the tool in the given execution environment with the given input.
488
+ *
489
+ * @param env - The execution environment to use.
490
+ * @param input - The input for the tool.
491
+ * @returns A promise that resolves to the tool execution result.
492
+ */
493
+ protected executeForEnvironment(env: CommandLineEnvironmentInterface, input: GrepToolInput): Promise<GrepToolOutput>;
494
+ /**
495
+ * Converts the tool output to a format suitable for model consumption.
496
+ *
497
+ * @param options - The tool result, including the output from the tool execution.
498
+ * @returns The formatted tool result.
499
+ */
500
+ toModelOutput(options: ModelToolResultToFormat<GrepToolInput, GrepToolOutput>): ModelFormattedToolResult;
501
+ /**
502
+ * Gets the examples for the tool.
503
+ *
504
+ * @returns The tool examples.
505
+ */
506
+ get examples(): Array<ToolExample<GrepToolInput, GrepToolOutput>>;
507
+ }
508
+
854
509
  declare const ListDirectoryToolName = "list_directory";
855
510
  type ListDirectoryToolConfig = ToolConfig;
856
- declare const ListDirectoryToolInput: z$1.ZodObject<{
857
- path: z$1.ZodString;
858
- }, z$1.core.$strip>;
859
- type ListDirectoryToolInput = z$1.infer<typeof ListDirectoryToolInput>;
860
- declare const ListDirectoryToolOutput: z$1.ZodObject<{
861
- path: z$1.ZodString;
862
- files: z$1.ZodArray<z$1.ZodString>;
863
- directories: z$1.ZodArray<z$1.ZodString>;
864
- }, z$1.core.$strip>;
865
- type ListDirectoryToolOutput = z$1.infer<typeof ListDirectoryToolOutput>;
511
+ declare const ListDirectoryToolInput: z.ZodObject<{
512
+ path: z.ZodString;
513
+ }, z.core.$strip>;
514
+ type ListDirectoryToolInput = z.infer<typeof ListDirectoryToolInput>;
515
+ declare const ListDirectoryToolOutput: z.ZodObject<{
516
+ path: z.ZodString;
517
+ files: z.ZodArray<z.ZodString>;
518
+ directories: z.ZodArray<z.ZodString>;
519
+ }, z.core.$strip>;
520
+ type ListDirectoryToolOutput = z.infer<typeof ListDirectoryToolOutput>;
866
521
  /**
867
522
  * Class for the ListDirectory tool.
868
523
  */
@@ -886,10 +541,10 @@ declare class ListDirectoryTool extends EnvironmentToolBase<ListDirectoryToolCon
886
541
  /**
887
542
  * Converts the tool output to a format suitable for model consumption.
888
543
  *
889
- * @param output - The output from the tool execution.
544
+ * @param options - The tool result, including the output from the tool execution.
890
545
  * @returns The formatted tool result.
891
546
  */
892
- toModelOutput(output: ListDirectoryToolOutput): ModelFormattedToolResult;
547
+ toModelOutput(options: ModelToolResultToFormat<ListDirectoryToolInput, ListDirectoryToolOutput>): ModelFormattedToolResult;
893
548
  /**
894
549
  * Gets the examples for the tool.
895
550
  *
@@ -900,17 +555,17 @@ declare class ListDirectoryTool extends EnvironmentToolBase<ListDirectoryToolCon
900
555
 
901
556
  declare const MoveFileToolName = "move_file";
902
557
  type MoveFileToolConfig = ToolConfig;
903
- declare const MoveFileToolInput: z$1.ZodObject<{
904
- sourcePath: z$1.ZodString;
905
- destinationPath: z$1.ZodString;
906
- }, z$1.core.$strip>;
907
- type MoveFileToolInput = z$1.infer<typeof MoveFileToolInput>;
908
- declare const MoveFileToolOutput: z$1.ZodObject<{
909
- sourcePath: z$1.ZodString;
910
- destinationPath: z$1.ZodString;
911
- message: z$1.ZodString;
912
- }, z$1.core.$strip>;
913
- type MoveFileToolOutput = z$1.infer<typeof MoveFileToolOutput>;
558
+ declare const MoveFileToolInput: z.ZodObject<{
559
+ sourcePath: z.ZodString;
560
+ destinationPath: z.ZodString;
561
+ }, z.core.$strip>;
562
+ type MoveFileToolInput = z.infer<typeof MoveFileToolInput>;
563
+ declare const MoveFileToolOutput: z.ZodObject<{
564
+ sourcePath: z.ZodString;
565
+ destinationPath: z.ZodString;
566
+ message: z.ZodString;
567
+ }, z.core.$strip>;
568
+ type MoveFileToolOutput = z.infer<typeof MoveFileToolOutput>;
914
569
  /**
915
570
  * Class for the MoveFile tool.
916
571
  */
@@ -934,10 +589,10 @@ declare class MoveFileTool extends EnvironmentToolBase<MoveFileToolConfig, MoveF
934
589
  /**
935
590
  * Converts the tool output to a format suitable for model consumption.
936
591
  *
937
- * @param output - The output from the tool execution.
592
+ * @param options - The tool result, including the output from the tool execution.
938
593
  * @returns The formatted tool result.
939
594
  */
940
- toModelOutput(output: MoveFileToolOutput): ModelFormattedToolResult;
595
+ toModelOutput(options: ModelToolResultToFormat<MoveFileToolInput, MoveFileToolOutput>): ModelFormattedToolResult;
941
596
  /**
942
597
  * Gets the examples for the tool.
943
598
  *
@@ -948,15 +603,15 @@ declare class MoveFileTool extends EnvironmentToolBase<MoveFileToolConfig, MoveF
948
603
 
949
604
  declare const ReadFileToolName = "read_file";
950
605
  type ReadFileToolConfig = ToolConfig;
951
- declare const ReadFileToolInput: z$1.ZodObject<{
952
- path: z$1.ZodString;
953
- }, z$1.core.$strip>;
954
- type ReadFileToolInput = z$1.infer<typeof ReadFileToolInput>;
955
- declare const ReadFileToolOutput: z$1.ZodObject<{
956
- path: z$1.ZodString;
957
- content: z$1.ZodString;
958
- }, z$1.core.$strip>;
959
- type ReadFileToolOutput = z$1.infer<typeof ReadFileToolOutput>;
606
+ declare const ReadFileToolInput: z.ZodObject<{
607
+ path: z.ZodString;
608
+ }, z.core.$strip>;
609
+ type ReadFileToolInput = z.infer<typeof ReadFileToolInput>;
610
+ declare const ReadFileToolOutput: z.ZodObject<{
611
+ path: z.ZodString;
612
+ content: z.ZodString;
613
+ }, z.core.$strip>;
614
+ type ReadFileToolOutput = z.infer<typeof ReadFileToolOutput>;
960
615
  /**
961
616
  * Class for the ReadFile tool.
962
617
  */
@@ -980,10 +635,10 @@ declare class ReadFileTool extends EnvironmentToolBase<ReadFileToolConfig, ReadF
980
635
  /**
981
636
  * Converts the tool output to a format suitable for model consumption.
982
637
  *
983
- * @param output - The output from the tool execution.
638
+ * @param options - The tool result, including the output from the tool execution.
984
639
  * @returns The formatted tool result.
985
640
  */
986
- toModelOutput(output: ReadFileToolOutput): ModelFormattedToolResult;
641
+ toModelOutput(options: ModelToolResultToFormat<ReadFileToolInput, ReadFileToolOutput>): ModelFormattedToolResult;
987
642
  /**
988
643
  * Gets the examples for the tool.
989
644
  *
@@ -994,15 +649,15 @@ declare class ReadFileTool extends EnvironmentToolBase<ReadFileToolConfig, ReadF
994
649
 
995
650
  declare const ReadManyFilesToolName = "read_many_files";
996
651
  type ReadManyFilesToolConfig = ToolConfig;
997
- declare const ReadManyFilesToolInput: z$1.ZodObject<{
998
- paths: z$1.ZodArray<z$1.ZodString>;
999
- }, z$1.core.$strip>;
1000
- type ReadManyFilesToolInput = z$1.infer<typeof ReadManyFilesToolInput>;
1001
- declare const ReadManyFilesToolOutput: z$1.ZodRecord<z$1.ZodString, z$1.ZodObject<{
1002
- path: z$1.ZodString;
1003
- content: z$1.ZodString;
1004
- }, z$1.core.$strip>>;
1005
- type ReadManyFilesToolOutput = z$1.infer<typeof ReadManyFilesToolOutput>;
652
+ declare const ReadManyFilesToolInput: z.ZodObject<{
653
+ paths: z.ZodArray<z.ZodString>;
654
+ }, z.core.$strip>;
655
+ type ReadManyFilesToolInput = z.infer<typeof ReadManyFilesToolInput>;
656
+ declare const ReadManyFilesToolOutput: z.ZodRecord<z.ZodString, z.ZodObject<{
657
+ path: z.ZodString;
658
+ content: z.ZodString;
659
+ }, z.core.$strip>>;
660
+ type ReadManyFilesToolOutput = z.infer<typeof ReadManyFilesToolOutput>;
1006
661
  /**
1007
662
  * Class for the ReadManyFiles tool.
1008
663
  */
@@ -1026,10 +681,10 @@ declare class ReadManyFilesTool extends EnvironmentToolBase<ReadManyFilesToolCon
1026
681
  /**
1027
682
  * Converts the tool output to a format suitable for model consumption.
1028
683
  *
1029
- * @param output - The output from the tool execution.
684
+ * @param options - The tool result, including the output from the tool execution.
1030
685
  * @returns The formatted tool result.
1031
686
  */
1032
- toModelOutput(output: ReadManyFilesToolOutput): ModelFormattedToolResult;
687
+ toModelOutput(options: ModelToolResultToFormat<ReadManyFilesToolInput, ReadManyFilesToolOutput>): ModelFormattedToolResult;
1033
688
  /**
1034
689
  * Gets the examples for the tool.
1035
690
  *
@@ -1040,17 +695,17 @@ declare class ReadManyFilesTool extends EnvironmentToolBase<ReadManyFilesToolCon
1040
695
 
1041
696
  declare const RunCommandToolName = "run_command";
1042
697
  type RunCommandToolConfig = ToolConfig;
1043
- declare const RunCommandToolInput: z$1.ZodObject<{
1044
- command: z$1.ZodString;
1045
- }, z$1.core.$strip>;
1046
- type RunCommandToolInput = z$1.infer<typeof RunCommandToolInput>;
1047
- declare const RunCommandToolOutput: z$1.ZodObject<{
1048
- command: z$1.ZodString;
1049
- exitCode: z$1.ZodNumber;
1050
- stdout: z$1.ZodString;
1051
- stderr: z$1.ZodString;
1052
- }, z$1.core.$strip>;
1053
- type RunCommandToolOutput = z$1.infer<typeof RunCommandToolOutput>;
698
+ declare const RunCommandToolInput: z.ZodObject<{
699
+ command: z.ZodString;
700
+ }, z.core.$strip>;
701
+ type RunCommandToolInput = z.infer<typeof RunCommandToolInput>;
702
+ declare const RunCommandToolOutput: z.ZodObject<{
703
+ command: z.ZodString;
704
+ exitCode: z.ZodNumber;
705
+ stdout: z.ZodString;
706
+ stderr: z.ZodString;
707
+ }, z.core.$strip>;
708
+ type RunCommandToolOutput = z.infer<typeof RunCommandToolOutput>;
1054
709
  /**
1055
710
  * Class for the RunCommand tool.
1056
711
  *
@@ -1077,10 +732,10 @@ declare class RunCommandTool extends EnvironmentToolBase<RunCommandToolConfig, R
1077
732
  /**
1078
733
  * Converts the tool output to a format suitable for model consumption.
1079
734
  *
1080
- * @param output - The output from the tool execution.
735
+ * @param options - The tool result, including the output from the tool execution.
1081
736
  * @returns The formatted tool result.
1082
737
  */
1083
- toModelOutput(output: RunCommandToolOutput): ModelFormattedToolResult;
738
+ toModelOutput(options: ModelToolResultToFormat<RunCommandToolInput, RunCommandToolOutput>): ModelFormattedToolResult;
1084
739
  /**
1085
740
  * Gets the examples for the tool.
1086
741
  *
@@ -1091,16 +746,16 @@ declare class RunCommandTool extends EnvironmentToolBase<RunCommandToolConfig, R
1091
746
 
1092
747
  declare const WriteFileToolName = "write_file";
1093
748
  type WriteFileToolConfig = ToolConfig;
1094
- declare const WriteFileToolInput: z$1.ZodObject<{
1095
- path: z$1.ZodString;
1096
- content: z$1.ZodString;
1097
- }, z$1.core.$strip>;
1098
- type WriteFileToolInput = z$1.infer<typeof WriteFileToolInput>;
1099
- declare const WriteFileToolOutput: z$1.ZodObject<{
1100
- path: z$1.ZodString;
1101
- message: z$1.ZodString;
1102
- }, z$1.core.$strip>;
1103
- type WriteFileToolOutput = z$1.infer<typeof WriteFileToolOutput>;
749
+ declare const WriteFileToolInput: z.ZodObject<{
750
+ path: z.ZodString;
751
+ content: z.ZodString;
752
+ }, z.core.$strip>;
753
+ type WriteFileToolInput = z.infer<typeof WriteFileToolInput>;
754
+ declare const WriteFileToolOutput: z.ZodObject<{
755
+ path: z.ZodString;
756
+ message: z.ZodString;
757
+ }, z.core.$strip>;
758
+ type WriteFileToolOutput = z.infer<typeof WriteFileToolOutput>;
1104
759
  /**
1105
760
  * Class for the WriteFile tool.
1106
761
  */
@@ -1124,10 +779,10 @@ declare class WriteFileTool extends EnvironmentToolBase<WriteFileToolConfig, Wri
1124
779
  /**
1125
780
  * Converts the tool output to a format suitable for model consumption.
1126
781
  *
1127
- * @param output - The output from the tool execution.
782
+ * @param options - The tool result, including the output from the tool execution.
1128
783
  * @returns The formatted tool result.
1129
784
  */
1130
- toModelOutput(output: WriteFileToolOutput): ModelFormattedToolResult;
785
+ toModelOutput(options: ModelToolResultToFormat<WriteFileToolInput, WriteFileToolOutput>): ModelFormattedToolResult;
1131
786
  /**
1132
787
  * Gets the examples for the tool.
1133
788
  *
@@ -1136,6 +791,47 @@ declare class WriteFileTool extends EnvironmentToolBase<WriteFileToolConfig, Wri
1136
791
  get examples(): Array<ToolExample<WriteFileToolInput, WriteFileToolOutput>>;
1137
792
  }
1138
793
 
794
+ declare const SubmitToolName = "submit";
795
+ type SubmitToolConfig = ToolConfig;
796
+ declare const SubmitToolInput: z.ZodObject<{}, z.core.$strip>;
797
+ type SubmitToolInput = z.infer<typeof SubmitToolInput>;
798
+ declare const SubmitToolOutput: z.ZodObject<{}, z.core.$strip>;
799
+ type SubmitToolOutput = z.infer<typeof SubmitToolOutput>;
800
+ /**
801
+ * Class for the Submit tool.
802
+ */
803
+ declare class SubmitTool extends ToolBase<SubmitToolConfig, SubmitToolInput, SubmitToolOutput> {
804
+ /**
805
+ * Returns the metadata for the tool.
806
+ *
807
+ * The name, description, and needsApproval properties are defaults which can be overridden in the constructor.
808
+ *
809
+ * @returns The tool metadata.
810
+ */
811
+ protected getMetadata(): ToolMetadata<SubmitToolInput, SubmitToolOutput>;
812
+ /**
813
+ * Executes the tool with the given input.
814
+ *
815
+ * @param _ - The input for the tool. Unused.
816
+ * @param __ - Options for the tool execution. Unused.
817
+ * @returns A promise that resolves to the tool execution result.
818
+ */
819
+ execute(_: SubmitToolInput, __: ToolExecutionOptions): Promise<SubmitToolOutput>;
820
+ /**
821
+ * Converts the tool output to a format suitable for model consumption.
822
+ *
823
+ * @param _ - The tool result, including the output from the tool execution. Unused.
824
+ * @returns The formatted tool result.
825
+ */
826
+ toModelOutput(_: ModelToolResultToFormat<SubmitToolInput, SubmitToolOutput>): ModelFormattedToolResult;
827
+ /**
828
+ * Gets the examples for the tool.
829
+ *
830
+ * @returns The tool examples.
831
+ */
832
+ get examples(): Array<ToolExample<SubmitToolInput, SubmitToolOutput>>;
833
+ }
834
+
1139
835
  declare const availableEnvironmentTools: {
1140
836
  read_file: typeof ReadFileTool;
1141
837
  write_file: typeof WriteFileTool;
@@ -1146,6 +842,7 @@ declare const availableEnvironmentTools: {
1146
842
  read_many_files: typeof ReadManyFilesTool;
1147
843
  get_project_file_structure: typeof GetProjectFileStructureTool;
1148
844
  glob: typeof GlobTool;
845
+ grep: typeof GrepTool;
1149
846
  list_directory: typeof ListDirectoryTool;
1150
847
  run_command: typeof RunCommandTool;
1151
848
  };
@@ -1159,6 +856,7 @@ type EnvironmentToolClasses = {
1159
856
  [ReadManyFilesToolName]: ReadManyFilesTool;
1160
857
  [GetProjectFileStructureToolName]: GetProjectFileStructureTool;
1161
858
  [GlobToolName]: GlobTool;
859
+ [GrepToolName]: GrepTool;
1162
860
  [ListDirectoryToolName]: ListDirectoryTool;
1163
861
  [RunCommandToolName]: RunCommandTool;
1164
862
  };
@@ -1213,25 +911,49 @@ declare function createToolsForEnvironment(environment: Environment, toolsDefini
1213
911
  */
1214
912
  declare function createToolsForNamedEnvironment(environmentName: string, environment: Environment, toolsDefinition?: ToolsDefinition): Record<string, ToolWithIO>;
1215
913
 
1216
- type CodeAgentCreatorConfig = Experimental_AgentSettings<Record<string, Tool>> & {
1217
- maxSteps: number;
1218
- allowSubmit?: boolean;
1219
- logStep?: (stepLog: string, stepIndex: number) => void;
1220
- omitAdditionalInstructions?: boolean;
1221
- } & ({
914
+ type FlexibleAgent = ToolLoopAgent<never, Record<string, Tool>>;
915
+ type FlexibleAgentSettings = ToolLoopAgentSettings<never, Record<string, Tool>>;
916
+ type CodeAgentToolsCreatorConfig = {
1222
917
  environment: Environment;
1223
918
  environmentToolsDefinition: ToolsDefinition;
1224
919
  } | {
1225
920
  environments: Record<string, Environment>;
1226
921
  environmentToolsDefinition: Record<string, ToolsDefinition>;
1227
- } | Record<string, never>);
922
+ };
923
+ type CodeAgentCreatorConfig = FlexibleAgentSettings & {
924
+ maxSteps: number;
925
+ allowSubmit?: boolean;
926
+ logStep?: (stepLog: string, stepIndex: number) => void;
927
+ omitAdditionalInstructions?: boolean;
928
+ } & (CodeAgentToolsCreatorConfig | Record<string, never>);
929
+ type FlexibleAgentTools = Exclude<FlexibleAgentSettings['tools'], undefined>;
1228
930
  /**
1229
931
  * Creates an AI code agent configured to operate on one or more specified execution environments with tools.
1230
932
  *
1231
933
  * @param agentConfig - Configuration options for the code agent, including environments, tools definition, and agent settings.
1232
- * @returns An instance of Agent configured with the specified environment tools and settings.
934
+ * @returns An agent instance configured with the specified environment tools and settings.
935
+ */
936
+ declare function createCodeAgent(agentConfig: CodeAgentCreatorConfig): FlexibleAgent;
937
+ /**
938
+ * Creates settings object for an AI code agent configured to operate on one or more specified execution environments with tools.
939
+ *
940
+ * @param agentConfig - Configuration options for the code agent, including environments, tools definition, and agent settings.
941
+ * @returns An agent settings object configured with the specified environment tools and settings.
942
+ */
943
+ declare function createCodeAgentSettings(agentConfig: CodeAgentCreatorConfig): FlexibleAgentSettings;
944
+ /**
945
+ * Creates agent tools based on the provided configuration.
946
+ *
947
+ * This function generates a set of tools for one or more environments, depending on the configuration.
948
+ * If `environments` is provided, it creates tools for each named environment using the corresponding
949
+ * tools definition. If `environment` is provided, it creates tools for a single environment.
950
+ * The generated tools can be merged with optional original tools.
951
+ *
952
+ * @param agentToolsConfig - The configuration object specifying environments and their tools definitions.
953
+ * @param originalTools - Optional existing tools to merge with the newly created environment tools.
954
+ * @returns An object containing the created agent tools, merged with original tools if provided.
1233
955
  */
1234
- declare function createCodeAgent(agentConfig: CodeAgentCreatorConfig): Experimental_Agent<Record<string, Tool>>;
956
+ declare function createCodeAgentTools(agentToolsConfig: CodeAgentToolsCreatorConfig, originalTools?: FlexibleAgentTools): FlexibleAgentTools;
1235
957
 
1236
958
  declare const availableEnvironments: {
1237
959
  "unsafe-local": typeof UnsafeLocalEnvironment;
@@ -1257,4 +979,4 @@ declare const EnvironmentNames: EnvironmentName[];
1257
979
  */
1258
980
  declare function createEnvironment<T extends EnvironmentName>(environmentName: T, config: EnvironmentConfigOf<EnvironmentClasses[T]>): EnvironmentClasses[T];
1259
981
 
1260
- export { type CodeAgentCreatorConfig, type CommandLineEnvironmentInterface, CopyFileResult, CopyFileTool, type CopyFileToolConfig, CopyFileToolInput, CopyFileToolName, CopyFileToolOutput, DeleteFileResult, DeleteFileTool, type DeleteFileToolConfig, DeleteFileToolInput, DeleteFileToolName, DeleteFileToolOutput, DockerEnvironment, type DockerEnvironmentConfig, DockerEnvironmentName, EditFileTool, type EditFileToolConfig, EditFileToolInput, EditFileToolName, EditFileToolOutput, type Environment, type EnvironmentName, EnvironmentNames, type EnvironmentToolInterface, type EnvironmentToolName, EnvironmentToolNames, type EnvironmentToolSafetyLevel, EnvironmentToolSafetyLevels, type FilesystemEnvironmentInterface, GetProjectFileStructureTool, type GetProjectFileStructureToolConfig, GetProjectFileStructureToolInput, GetProjectFileStructureToolName, GetProjectFileStructureToolOutput, GlobTool, type GlobToolConfig, GlobToolInput, GlobToolName, GlobToolOutput, ListDirectoryTool, type ListDirectoryToolConfig, ListDirectoryToolInput, ListDirectoryToolName, ListDirectoryToolOutput, MockFilesystemEnvironment, type MockFilesystemEnvironmentConfig, MockFilesystemEnvironmentName, type ModelFormattedToolResult, MoveFileResult, MoveFileTool, type MoveFileToolConfig, MoveFileToolInput, MoveFileToolName, MoveFileToolOutput, NodeFilesystemEnvironment, type NodeFilesystemEnvironmentConfig, NodeFilesystemEnvironmentName, ReadFileResult, ReadFileTool, type ReadFileToolConfig, ReadFileToolInput, ReadFileToolName, ReadFileToolOutput, ReadManyFilesTool, type ReadManyFilesToolConfig, ReadManyFilesToolInput, ReadManyFilesToolName, ReadManyFilesToolOutput, RunCommandResult, RunCommandTool, type RunCommandToolConfig, RunCommandToolInput, RunCommandToolName, RunCommandToolOutput, type ToolConfig, type ToolExample, type ToolInterface, type ToolsDefinition, UnsafeLocalEnvironment, type UnsafeLocalEnvironmentConfig, UnsafeLocalEnvironmentName, WriteFileResult, WriteFileTool, type WriteFileToolConfig, WriteFileToolInput, WriteFileToolName, WriteFileToolOutput, createCodeAgent, createEnvironment, createEnvironmentTool, createToolsForEnvironment, createToolsForNamedEnvironment };
982
+ export { type CodeAgentCreatorConfig, type CodeAgentToolsCreatorConfig, CopyFileTool, type CopyFileToolConfig, CopyFileToolInput, CopyFileToolName, CopyFileToolOutput, DeleteFileTool, type DeleteFileToolConfig, DeleteFileToolInput, DeleteFileToolName, DeleteFileToolOutput, DockerEnvironment, type DockerEnvironmentConfig, DockerEnvironmentName, EditFileTool, type EditFileToolConfig, EditFileToolInput, EditFileToolName, EditFileToolOutput, type EnvironmentName, EnvironmentNames, type EnvironmentToolName, EnvironmentToolNames, type EnvironmentToolSafetyLevel, EnvironmentToolSafetyLevels, GetProjectFileStructureTool, type GetProjectFileStructureToolConfig, GetProjectFileStructureToolInput, GetProjectFileStructureToolName, GetProjectFileStructureToolOutput, GlobTool, type GlobToolConfig, GlobToolInput, GlobToolName, GlobToolOutput, GrepMatch, GrepTool, type GrepToolConfig, GrepToolInput, GrepToolName, GrepToolOutput, ListDirectoryTool, type ListDirectoryToolConfig, ListDirectoryToolInput, ListDirectoryToolName, ListDirectoryToolOutput, MockFilesystemEnvironment, type MockFilesystemEnvironmentConfig, MockFilesystemEnvironmentName, MoveFileTool, type MoveFileToolConfig, MoveFileToolInput, MoveFileToolName, MoveFileToolOutput, NodeFilesystemEnvironment, type NodeFilesystemEnvironmentConfig, NodeFilesystemEnvironmentName, ReadFileTool, type ReadFileToolConfig, ReadFileToolInput, ReadFileToolName, ReadFileToolOutput, ReadManyFilesTool, type ReadManyFilesToolConfig, ReadManyFilesToolInput, ReadManyFilesToolName, ReadManyFilesToolOutput, RunCommandTool, type RunCommandToolConfig, RunCommandToolInput, RunCommandToolName, RunCommandToolOutput, SubmitTool, type SubmitToolConfig, SubmitToolInput, SubmitToolName, SubmitToolOutput, type ToolsDefinition, UnsafeLocalEnvironment, type UnsafeLocalEnvironmentConfig, UnsafeLocalEnvironmentName, WriteFileTool, type WriteFileToolConfig, WriteFileToolInput, WriteFileToolName, WriteFileToolOutput, createCodeAgent, createCodeAgentSettings, createCodeAgentTools, createEnvironment, createEnvironmentTool, createToolsForEnvironment, createToolsForNamedEnvironment };