@robota-sdk/agent-tools 3.0.0-beta.60 → 3.0.0-beta.62

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.
@@ -12,6 +12,167 @@ interface TToolResult {
12
12
  startLine?: number;
13
13
  }
14
14
 
15
+ interface ISandboxRunOptions {
16
+ timeoutMs?: number;
17
+ workingDirectory?: string;
18
+ }
19
+ interface ISandboxRunResult {
20
+ stdout: string;
21
+ stderr?: string;
22
+ exitCode: number;
23
+ }
24
+ interface IWorkspaceManifestFileEntry {
25
+ type: 'file';
26
+ content: string;
27
+ encoding?: 'utf8';
28
+ }
29
+ interface IWorkspaceManifestDirectoryEntry {
30
+ type: 'dir';
31
+ }
32
+ interface IWorkspaceManifestLocalFileEntry {
33
+ type: 'localFile';
34
+ src: string;
35
+ }
36
+ interface IWorkspaceManifestLocalDirectoryEntry {
37
+ type: 'localDir';
38
+ src: string;
39
+ }
40
+ interface IWorkspaceManifestGitRepositoryEntry {
41
+ type: 'gitRepo';
42
+ url: string;
43
+ ref?: string;
44
+ shallow?: boolean;
45
+ }
46
+ interface IWorkspaceManifestS3MountEntry {
47
+ type: 's3Mount';
48
+ bucket: string;
49
+ prefix?: string;
50
+ region: string;
51
+ }
52
+ interface IWorkspaceManifestGcsMountEntry {
53
+ type: 'gcsMount';
54
+ bucket: string;
55
+ prefix?: string;
56
+ }
57
+ interface IWorkspaceManifestR2MountEntry {
58
+ type: 'r2Mount';
59
+ bucket: string;
60
+ accountId: string;
61
+ prefix?: string;
62
+ }
63
+ interface IWorkspaceManifestAzureBlobMountEntry {
64
+ type: 'azureBlobMount';
65
+ container: string;
66
+ account: string;
67
+ prefix?: string;
68
+ }
69
+ type TWorkspaceManifestEntry = IWorkspaceManifestFileEntry | IWorkspaceManifestDirectoryEntry | IWorkspaceManifestLocalFileEntry | IWorkspaceManifestLocalDirectoryEntry | IWorkspaceManifestGitRepositoryEntry | IWorkspaceManifestS3MountEntry | IWorkspaceManifestGcsMountEntry | IWorkspaceManifestR2MountEntry | IWorkspaceManifestAzureBlobMountEntry;
70
+ interface IWorkspaceManifestPermissions {
71
+ read?: string[];
72
+ write?: string[];
73
+ }
74
+ interface IWorkspaceManifest {
75
+ entries: Record<string, TWorkspaceManifestEntry>;
76
+ environment?: Record<string, string>;
77
+ permissions?: IWorkspaceManifestPermissions;
78
+ }
79
+ interface IWorkspaceManifestApplyOptions {
80
+ targetRoot?: string;
81
+ hostRoot?: string;
82
+ }
83
+ type TWorkspaceManifestApplyStatus = 'applied' | 'unsupported';
84
+ interface IWorkspaceManifestAppliedEntry {
85
+ path: string;
86
+ type: TWorkspaceManifestEntry['type'];
87
+ status: TWorkspaceManifestApplyStatus;
88
+ message?: string;
89
+ }
90
+ interface IWorkspaceManifestApplyResult {
91
+ entries: IWorkspaceManifestAppliedEntry[];
92
+ }
93
+ interface ISandboxClient {
94
+ run(command: string, options?: ISandboxRunOptions): Promise<ISandboxRunResult>;
95
+ readFile(path: string): Promise<string>;
96
+ writeFile(path: string, content: string): Promise<void>;
97
+ applyManifest?(manifest: IWorkspaceManifest, options?: IWorkspaceManifestApplyOptions): Promise<IWorkspaceManifestApplyResult>;
98
+ /** Return a provider-owned resumable workspace reference. */
99
+ snapshot?(): Promise<string>;
100
+ /** Hydrate this client from a provider-owned workspace reference. */
101
+ restore?(snapshotId: string): Promise<void>;
102
+ }
103
+ interface ISandboxToolOptions {
104
+ sandboxClient?: ISandboxClient;
105
+ }
106
+
107
+ interface IE2BCommandStartOptions {
108
+ timeoutMs?: number;
109
+ cwd?: string;
110
+ background?: false;
111
+ }
112
+ interface IE2BCommandResult {
113
+ stdout?: string;
114
+ stderr?: string;
115
+ exitCode?: number;
116
+ exit_code?: number;
117
+ }
118
+ interface IE2BCommands {
119
+ run(command: string, options?: IE2BCommandStartOptions): Promise<IE2BCommandResult>;
120
+ }
121
+ interface IE2BFiles {
122
+ read(path: string): Promise<string | Uint8Array>;
123
+ write(path: string, content: string): Promise<void>;
124
+ }
125
+ interface IE2BSnapshot {
126
+ snapshotId?: string;
127
+ id?: string;
128
+ }
129
+ interface IE2BSandboxAdapter {
130
+ sandboxId?: string;
131
+ commands: IE2BCommands;
132
+ files: IE2BFiles;
133
+ pause?(): Promise<boolean | string | void>;
134
+ connect?(): Promise<IE2BSandboxAdapter>;
135
+ createSnapshot?(): Promise<IE2BSnapshot>;
136
+ }
137
+ interface IE2BSandboxClientOptions {
138
+ sandbox: IE2BSandboxAdapter;
139
+ connectSandbox?: (sandboxId: string) => Promise<IE2BSandboxAdapter>;
140
+ createSandboxFromSnapshot?: (snapshotId: string) => Promise<IE2BSandboxAdapter>;
141
+ }
142
+ declare class E2BSandboxClient implements ISandboxClient {
143
+ private sandbox;
144
+ private readonly connectSandbox?;
145
+ private readonly createSandboxFromSnapshot?;
146
+ constructor(options: IE2BSandboxClientOptions);
147
+ run(command: string, options?: ISandboxRunOptions): Promise<ISandboxRunResult>;
148
+ readFile(path: string): Promise<string>;
149
+ writeFile(path: string, content: string): Promise<void>;
150
+ snapshot(): Promise<string>;
151
+ restore(snapshotId: string): Promise<void>;
152
+ }
153
+
154
+ type TInMemorySandboxRunHandler = (command: string, options: ISandboxRunOptions | undefined, files: ReadonlyMap<string, string>) => Promise<ISandboxRunResult> | ISandboxRunResult;
155
+ interface IInMemorySandboxClientOptions {
156
+ files?: Record<string, string>;
157
+ runHandler?: TInMemorySandboxRunHandler;
158
+ }
159
+ declare class InMemorySandboxClient implements ISandboxClient {
160
+ private readonly files;
161
+ private readonly snapshots;
162
+ private readonly runHandler?;
163
+ private snapshotSequence;
164
+ constructor(options?: IInMemorySandboxClientOptions);
165
+ run(command: string, options?: ISandboxRunOptions): Promise<ISandboxRunResult>;
166
+ readFile(path: string): Promise<string>;
167
+ writeFile(path: string, content: string): Promise<void>;
168
+ snapshot(): Promise<string>;
169
+ restore(snapshotId: string): Promise<void>;
170
+ getFile(path: string): string | undefined;
171
+ }
172
+
173
+ declare function applyWorkspaceManifest(sandboxClient: ISandboxClient, manifest: IWorkspaceManifest, options?: IWorkspaceManifestApplyOptions): Promise<IWorkspaceManifestApplyResult>;
174
+ declare function validateWorkspaceManifestPath(path: string): string;
175
+
15
176
  /**
16
177
  * Tool registry implementation
17
178
  * Manages tool registration, validation, and retrieval
@@ -266,42 +427,36 @@ declare function createOpenAPITool(config: IOpenAPIToolConfig): OpenAPITool;
266
427
  declare function zodToJsonSchema(schema: IZodSchema, options?: ISchemaConversionOptions): IToolSchema['parameters'];
267
428
 
268
429
  /**
269
- * BashTool — execute shell commands via child_process.spawn
270
- *
271
- * Returns TToolResult JSON string. Non-zero exit is returned as success:true
272
- * with exitCode set, matching Claude Code behaviour (the command ran, it just
273
- * exited non-zero — the LLM can decide what to do with that information).
430
+ * Create a BashTool instance register with Robota agent tools registry.
274
431
  */
432
+ declare function createBashTool(options?: ISandboxToolOptions): FunctionTool;
275
433
  /**
276
434
  * BashTool instance — register with Robota agent tools registry.
277
435
  */
278
436
  declare const bashTool: FunctionTool;
279
437
 
280
438
  /**
281
- * ReadTool — read a file and return its contents with line numbers (cat -n style).
282
- *
283
- * Supports offset/limit for partial reads. Detects binary files and refuses to
284
- * return their raw bytes. Default limit is 2000 lines.
439
+ * Create a ReadTool instance register with Robota agent tools registry.
285
440
  */
441
+ declare function createReadTool(options?: ISandboxToolOptions): FunctionTool;
286
442
  /**
287
443
  * ReadTool instance — register with Robota agent tools registry.
288
444
  */
289
445
  declare const readTool: FunctionTool;
290
446
 
291
447
  /**
292
- * WriteTool — write content to a file, auto-creating parent directories.
448
+ * Create a WriteTool instance register with Robota agent tools registry.
293
449
  */
450
+ declare function createWriteTool(options?: ISandboxToolOptions): FunctionTool;
294
451
  /**
295
452
  * WriteTool instance — register with Robota agent tools registry.
296
453
  */
297
454
  declare const writeTool: FunctionTool;
298
455
 
299
456
  /**
300
- * EditTool — perform string-replace edits on a file.
301
- *
302
- * By default, requires the oldString to appear exactly once in the file
303
- * (ensuring surgical edits). Pass replaceAll:true to replace all occurrences.
457
+ * Create an EditTool instance register with Robota agent tools registry.
304
458
  */
459
+ declare function createEditTool(options?: ISandboxToolOptions): FunctionTool;
305
460
  /**
306
461
  * EditTool instance — register with Robota agent tools registry.
307
462
  */
@@ -346,4 +501,4 @@ declare const webFetchTool: FunctionTool;
346
501
  */
347
502
  declare const webSearchTool: FunctionTool;
348
503
 
349
- export { FunctionTool, type IFunctionToolExecutionMetadata, type IFunctionToolResult, type IFunctionToolValidationOptions, type ISchemaConversionOptions, type IZodParseResult, type IZodSchema, type IZodSchemaDef, OpenAPITool, type TToolResult, ToolRegistry, bashTool, createFunctionTool, createOpenAPITool, createZodFunctionTool, editTool, globTool, grepTool, readTool, webFetchTool, webSearchTool, writeTool, zodToJsonSchema };
504
+ export { E2BSandboxClient, FunctionTool, type IE2BSandboxAdapter, type IE2BSandboxClientOptions, type IFunctionToolExecutionMetadata, type IFunctionToolResult, type IFunctionToolValidationOptions, type IInMemorySandboxClientOptions, type ISandboxClient, type ISandboxRunOptions, type ISandboxRunResult, type ISandboxToolOptions, type ISchemaConversionOptions, type IWorkspaceManifest, type IWorkspaceManifestAppliedEntry, type IWorkspaceManifestApplyOptions, type IWorkspaceManifestApplyResult, type IWorkspaceManifestAzureBlobMountEntry, type IWorkspaceManifestDirectoryEntry, type IWorkspaceManifestFileEntry, type IWorkspaceManifestGcsMountEntry, type IWorkspaceManifestGitRepositoryEntry, type IWorkspaceManifestLocalDirectoryEntry, type IWorkspaceManifestLocalFileEntry, type IWorkspaceManifestPermissions, type IWorkspaceManifestR2MountEntry, type IWorkspaceManifestS3MountEntry, type IZodParseResult, type IZodSchema, type IZodSchemaDef, InMemorySandboxClient, OpenAPITool, type TInMemorySandboxRunHandler, type TToolResult, type TWorkspaceManifestApplyStatus, type TWorkspaceManifestEntry, ToolRegistry, applyWorkspaceManifest, bashTool, createBashTool, createEditTool, createFunctionTool, createOpenAPITool, createReadTool, createWriteTool, createZodFunctionTool, editTool, globTool, grepTool, readTool, validateWorkspaceManifestPath, webFetchTool, webSearchTool, writeTool, zodToJsonSchema };
@@ -12,6 +12,167 @@ interface TToolResult {
12
12
  startLine?: number;
13
13
  }
14
14
 
15
+ interface ISandboxRunOptions {
16
+ timeoutMs?: number;
17
+ workingDirectory?: string;
18
+ }
19
+ interface ISandboxRunResult {
20
+ stdout: string;
21
+ stderr?: string;
22
+ exitCode: number;
23
+ }
24
+ interface IWorkspaceManifestFileEntry {
25
+ type: 'file';
26
+ content: string;
27
+ encoding?: 'utf8';
28
+ }
29
+ interface IWorkspaceManifestDirectoryEntry {
30
+ type: 'dir';
31
+ }
32
+ interface IWorkspaceManifestLocalFileEntry {
33
+ type: 'localFile';
34
+ src: string;
35
+ }
36
+ interface IWorkspaceManifestLocalDirectoryEntry {
37
+ type: 'localDir';
38
+ src: string;
39
+ }
40
+ interface IWorkspaceManifestGitRepositoryEntry {
41
+ type: 'gitRepo';
42
+ url: string;
43
+ ref?: string;
44
+ shallow?: boolean;
45
+ }
46
+ interface IWorkspaceManifestS3MountEntry {
47
+ type: 's3Mount';
48
+ bucket: string;
49
+ prefix?: string;
50
+ region: string;
51
+ }
52
+ interface IWorkspaceManifestGcsMountEntry {
53
+ type: 'gcsMount';
54
+ bucket: string;
55
+ prefix?: string;
56
+ }
57
+ interface IWorkspaceManifestR2MountEntry {
58
+ type: 'r2Mount';
59
+ bucket: string;
60
+ accountId: string;
61
+ prefix?: string;
62
+ }
63
+ interface IWorkspaceManifestAzureBlobMountEntry {
64
+ type: 'azureBlobMount';
65
+ container: string;
66
+ account: string;
67
+ prefix?: string;
68
+ }
69
+ type TWorkspaceManifestEntry = IWorkspaceManifestFileEntry | IWorkspaceManifestDirectoryEntry | IWorkspaceManifestLocalFileEntry | IWorkspaceManifestLocalDirectoryEntry | IWorkspaceManifestGitRepositoryEntry | IWorkspaceManifestS3MountEntry | IWorkspaceManifestGcsMountEntry | IWorkspaceManifestR2MountEntry | IWorkspaceManifestAzureBlobMountEntry;
70
+ interface IWorkspaceManifestPermissions {
71
+ read?: string[];
72
+ write?: string[];
73
+ }
74
+ interface IWorkspaceManifest {
75
+ entries: Record<string, TWorkspaceManifestEntry>;
76
+ environment?: Record<string, string>;
77
+ permissions?: IWorkspaceManifestPermissions;
78
+ }
79
+ interface IWorkspaceManifestApplyOptions {
80
+ targetRoot?: string;
81
+ hostRoot?: string;
82
+ }
83
+ type TWorkspaceManifestApplyStatus = 'applied' | 'unsupported';
84
+ interface IWorkspaceManifestAppliedEntry {
85
+ path: string;
86
+ type: TWorkspaceManifestEntry['type'];
87
+ status: TWorkspaceManifestApplyStatus;
88
+ message?: string;
89
+ }
90
+ interface IWorkspaceManifestApplyResult {
91
+ entries: IWorkspaceManifestAppliedEntry[];
92
+ }
93
+ interface ISandboxClient {
94
+ run(command: string, options?: ISandboxRunOptions): Promise<ISandboxRunResult>;
95
+ readFile(path: string): Promise<string>;
96
+ writeFile(path: string, content: string): Promise<void>;
97
+ applyManifest?(manifest: IWorkspaceManifest, options?: IWorkspaceManifestApplyOptions): Promise<IWorkspaceManifestApplyResult>;
98
+ /** Return a provider-owned resumable workspace reference. */
99
+ snapshot?(): Promise<string>;
100
+ /** Hydrate this client from a provider-owned workspace reference. */
101
+ restore?(snapshotId: string): Promise<void>;
102
+ }
103
+ interface ISandboxToolOptions {
104
+ sandboxClient?: ISandboxClient;
105
+ }
106
+
107
+ interface IE2BCommandStartOptions {
108
+ timeoutMs?: number;
109
+ cwd?: string;
110
+ background?: false;
111
+ }
112
+ interface IE2BCommandResult {
113
+ stdout?: string;
114
+ stderr?: string;
115
+ exitCode?: number;
116
+ exit_code?: number;
117
+ }
118
+ interface IE2BCommands {
119
+ run(command: string, options?: IE2BCommandStartOptions): Promise<IE2BCommandResult>;
120
+ }
121
+ interface IE2BFiles {
122
+ read(path: string): Promise<string | Uint8Array>;
123
+ write(path: string, content: string): Promise<void>;
124
+ }
125
+ interface IE2BSnapshot {
126
+ snapshotId?: string;
127
+ id?: string;
128
+ }
129
+ interface IE2BSandboxAdapter {
130
+ sandboxId?: string;
131
+ commands: IE2BCommands;
132
+ files: IE2BFiles;
133
+ pause?(): Promise<boolean | string | void>;
134
+ connect?(): Promise<IE2BSandboxAdapter>;
135
+ createSnapshot?(): Promise<IE2BSnapshot>;
136
+ }
137
+ interface IE2BSandboxClientOptions {
138
+ sandbox: IE2BSandboxAdapter;
139
+ connectSandbox?: (sandboxId: string) => Promise<IE2BSandboxAdapter>;
140
+ createSandboxFromSnapshot?: (snapshotId: string) => Promise<IE2BSandboxAdapter>;
141
+ }
142
+ declare class E2BSandboxClient implements ISandboxClient {
143
+ private sandbox;
144
+ private readonly connectSandbox?;
145
+ private readonly createSandboxFromSnapshot?;
146
+ constructor(options: IE2BSandboxClientOptions);
147
+ run(command: string, options?: ISandboxRunOptions): Promise<ISandboxRunResult>;
148
+ readFile(path: string): Promise<string>;
149
+ writeFile(path: string, content: string): Promise<void>;
150
+ snapshot(): Promise<string>;
151
+ restore(snapshotId: string): Promise<void>;
152
+ }
153
+
154
+ type TInMemorySandboxRunHandler = (command: string, options: ISandboxRunOptions | undefined, files: ReadonlyMap<string, string>) => Promise<ISandboxRunResult> | ISandboxRunResult;
155
+ interface IInMemorySandboxClientOptions {
156
+ files?: Record<string, string>;
157
+ runHandler?: TInMemorySandboxRunHandler;
158
+ }
159
+ declare class InMemorySandboxClient implements ISandboxClient {
160
+ private readonly files;
161
+ private readonly snapshots;
162
+ private readonly runHandler?;
163
+ private snapshotSequence;
164
+ constructor(options?: IInMemorySandboxClientOptions);
165
+ run(command: string, options?: ISandboxRunOptions): Promise<ISandboxRunResult>;
166
+ readFile(path: string): Promise<string>;
167
+ writeFile(path: string, content: string): Promise<void>;
168
+ snapshot(): Promise<string>;
169
+ restore(snapshotId: string): Promise<void>;
170
+ getFile(path: string): string | undefined;
171
+ }
172
+
173
+ declare function applyWorkspaceManifest(sandboxClient: ISandboxClient, manifest: IWorkspaceManifest, options?: IWorkspaceManifestApplyOptions): Promise<IWorkspaceManifestApplyResult>;
174
+ declare function validateWorkspaceManifestPath(path: string): string;
175
+
15
176
  /**
16
177
  * Tool registry implementation
17
178
  * Manages tool registration, validation, and retrieval
@@ -266,42 +427,36 @@ declare function createOpenAPITool(config: IOpenAPIToolConfig): OpenAPITool;
266
427
  declare function zodToJsonSchema(schema: IZodSchema, options?: ISchemaConversionOptions): IToolSchema['parameters'];
267
428
 
268
429
  /**
269
- * BashTool — execute shell commands via child_process.spawn
270
- *
271
- * Returns TToolResult JSON string. Non-zero exit is returned as success:true
272
- * with exitCode set, matching Claude Code behaviour (the command ran, it just
273
- * exited non-zero — the LLM can decide what to do with that information).
430
+ * Create a BashTool instance register with Robota agent tools registry.
274
431
  */
432
+ declare function createBashTool(options?: ISandboxToolOptions): FunctionTool;
275
433
  /**
276
434
  * BashTool instance — register with Robota agent tools registry.
277
435
  */
278
436
  declare const bashTool: FunctionTool;
279
437
 
280
438
  /**
281
- * ReadTool — read a file and return its contents with line numbers (cat -n style).
282
- *
283
- * Supports offset/limit for partial reads. Detects binary files and refuses to
284
- * return their raw bytes. Default limit is 2000 lines.
439
+ * Create a ReadTool instance register with Robota agent tools registry.
285
440
  */
441
+ declare function createReadTool(options?: ISandboxToolOptions): FunctionTool;
286
442
  /**
287
443
  * ReadTool instance — register with Robota agent tools registry.
288
444
  */
289
445
  declare const readTool: FunctionTool;
290
446
 
291
447
  /**
292
- * WriteTool — write content to a file, auto-creating parent directories.
448
+ * Create a WriteTool instance register with Robota agent tools registry.
293
449
  */
450
+ declare function createWriteTool(options?: ISandboxToolOptions): FunctionTool;
294
451
  /**
295
452
  * WriteTool instance — register with Robota agent tools registry.
296
453
  */
297
454
  declare const writeTool: FunctionTool;
298
455
 
299
456
  /**
300
- * EditTool — perform string-replace edits on a file.
301
- *
302
- * By default, requires the oldString to appear exactly once in the file
303
- * (ensuring surgical edits). Pass replaceAll:true to replace all occurrences.
457
+ * Create an EditTool instance register with Robota agent tools registry.
304
458
  */
459
+ declare function createEditTool(options?: ISandboxToolOptions): FunctionTool;
305
460
  /**
306
461
  * EditTool instance — register with Robota agent tools registry.
307
462
  */
@@ -346,4 +501,4 @@ declare const webFetchTool: FunctionTool;
346
501
  */
347
502
  declare const webSearchTool: FunctionTool;
348
503
 
349
- export { FunctionTool, type IFunctionToolExecutionMetadata, type IFunctionToolResult, type IFunctionToolValidationOptions, type ISchemaConversionOptions, type IZodParseResult, type IZodSchema, type IZodSchemaDef, OpenAPITool, type TToolResult, ToolRegistry, bashTool, createFunctionTool, createOpenAPITool, createZodFunctionTool, editTool, globTool, grepTool, readTool, webFetchTool, webSearchTool, writeTool, zodToJsonSchema };
504
+ export { E2BSandboxClient, FunctionTool, type IE2BSandboxAdapter, type IE2BSandboxClientOptions, type IFunctionToolExecutionMetadata, type IFunctionToolResult, type IFunctionToolValidationOptions, type IInMemorySandboxClientOptions, type ISandboxClient, type ISandboxRunOptions, type ISandboxRunResult, type ISandboxToolOptions, type ISchemaConversionOptions, type IWorkspaceManifest, type IWorkspaceManifestAppliedEntry, type IWorkspaceManifestApplyOptions, type IWorkspaceManifestApplyResult, type IWorkspaceManifestAzureBlobMountEntry, type IWorkspaceManifestDirectoryEntry, type IWorkspaceManifestFileEntry, type IWorkspaceManifestGcsMountEntry, type IWorkspaceManifestGitRepositoryEntry, type IWorkspaceManifestLocalDirectoryEntry, type IWorkspaceManifestLocalFileEntry, type IWorkspaceManifestPermissions, type IWorkspaceManifestR2MountEntry, type IWorkspaceManifestS3MountEntry, type IZodParseResult, type IZodSchema, type IZodSchemaDef, InMemorySandboxClient, OpenAPITool, type TInMemorySandboxRunHandler, type TToolResult, type TWorkspaceManifestApplyStatus, type TWorkspaceManifestEntry, ToolRegistry, applyWorkspaceManifest, bashTool, createBashTool, createEditTool, createFunctionTool, createOpenAPITool, createReadTool, createWriteTool, createZodFunctionTool, editTool, globTool, grepTool, readTool, validateWorkspaceManifestPath, webFetchTool, webSearchTool, writeTool, zodToJsonSchema };