@robota-sdk/agent-tools 3.0.0-beta.6 → 3.0.0-beta.61
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/README.md +93 -19
- package/dist/node/index.cjs +725 -309
- package/dist/node/index.d.cts +173 -39
- package/dist/node/index.d.ts +173 -39
- package/dist/node/index.js +716 -308
- package/package.json +15 -3
package/dist/node/index.d.cts
CHANGED
|
@@ -8,8 +8,171 @@ interface TToolResult {
|
|
|
8
8
|
output: string;
|
|
9
9
|
error?: string;
|
|
10
10
|
exitCode?: number;
|
|
11
|
+
/** Start line number of the edit in the original file (Edit tool only) */
|
|
12
|
+
startLine?: number;
|
|
11
13
|
}
|
|
12
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
|
+
|
|
13
176
|
/**
|
|
14
177
|
* Tool registry implementation
|
|
15
178
|
* Manages tool registration, validation, and retrieval
|
|
@@ -95,6 +258,7 @@ interface IZodSchemaDef {
|
|
|
95
258
|
type?: IZodSchema;
|
|
96
259
|
values?: TUniversalValue[];
|
|
97
260
|
description?: string;
|
|
261
|
+
unknownKeys?: 'passthrough' | 'strip' | 'strict';
|
|
98
262
|
}
|
|
99
263
|
interface IZodSchema {
|
|
100
264
|
parse(value: TToolParameters): TToolParameters;
|
|
@@ -172,14 +336,6 @@ declare class FunctionTool implements IFunctionTool {
|
|
|
172
336
|
* Get tool description
|
|
173
337
|
*/
|
|
174
338
|
getDescription(): string;
|
|
175
|
-
/**
|
|
176
|
-
* Get detailed validation errors
|
|
177
|
-
*/
|
|
178
|
-
private getValidationErrors;
|
|
179
|
-
/**
|
|
180
|
-
* Validate individual parameter type
|
|
181
|
-
*/
|
|
182
|
-
private validateParameterType;
|
|
183
339
|
/**
|
|
184
340
|
* Validate constructor inputs
|
|
185
341
|
*/
|
|
@@ -238,10 +394,6 @@ declare class OpenAPITool implements ITool {
|
|
|
238
394
|
* @private
|
|
239
395
|
*/
|
|
240
396
|
private executeAPICall;
|
|
241
|
-
/**
|
|
242
|
-
* Find the operation in the OpenAPI specification
|
|
243
|
-
*/
|
|
244
|
-
private findOperation;
|
|
245
397
|
/**
|
|
246
398
|
* Build HTTP request configuration from OpenAPI operation and parameters
|
|
247
399
|
*/
|
|
@@ -250,18 +402,6 @@ declare class OpenAPITool implements ITool {
|
|
|
250
402
|
* Create tool schema from OpenAPI operation specification
|
|
251
403
|
*/
|
|
252
404
|
private createSchemaFromOpenAPI;
|
|
253
|
-
/**
|
|
254
|
-
* Convert OpenAPI parameter to tool parameter schema
|
|
255
|
-
*/
|
|
256
|
-
private convertOpenAPIParamToSchema;
|
|
257
|
-
/**
|
|
258
|
-
* Convert OpenAPI schema to parameter schema
|
|
259
|
-
*/
|
|
260
|
-
private convertOpenAPISchemaToParameterSchema;
|
|
261
|
-
/**
|
|
262
|
-
* Map OpenAPI type to JSON schema type
|
|
263
|
-
*/
|
|
264
|
-
private mapOpenAPIType;
|
|
265
405
|
}
|
|
266
406
|
/**
|
|
267
407
|
* Factory function to create OpenAPI tools from specification
|
|
@@ -287,42 +427,36 @@ declare function createOpenAPITool(config: IOpenAPIToolConfig): OpenAPITool;
|
|
|
287
427
|
declare function zodToJsonSchema(schema: IZodSchema, options?: ISchemaConversionOptions): IToolSchema['parameters'];
|
|
288
428
|
|
|
289
429
|
/**
|
|
290
|
-
* BashTool —
|
|
291
|
-
*
|
|
292
|
-
* Returns TToolResult JSON string. Non-zero exit is returned as success:true
|
|
293
|
-
* with exitCode set, matching Claude Code behaviour (the command ran, it just
|
|
294
|
-
* exited non-zero — the LLM can decide what to do with that information).
|
|
430
|
+
* Create a BashTool instance — register with Robota agent tools registry.
|
|
295
431
|
*/
|
|
432
|
+
declare function createBashTool(options?: ISandboxToolOptions): FunctionTool;
|
|
296
433
|
/**
|
|
297
434
|
* BashTool instance — register with Robota agent tools registry.
|
|
298
435
|
*/
|
|
299
436
|
declare const bashTool: FunctionTool;
|
|
300
437
|
|
|
301
438
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
* Supports offset/limit for partial reads. Detects binary files and refuses to
|
|
305
|
-
* return their raw bytes. Default limit is 2000 lines.
|
|
439
|
+
* Create a ReadTool instance — register with Robota agent tools registry.
|
|
306
440
|
*/
|
|
441
|
+
declare function createReadTool(options?: ISandboxToolOptions): FunctionTool;
|
|
307
442
|
/**
|
|
308
443
|
* ReadTool instance — register with Robota agent tools registry.
|
|
309
444
|
*/
|
|
310
445
|
declare const readTool: FunctionTool;
|
|
311
446
|
|
|
312
447
|
/**
|
|
313
|
-
* WriteTool —
|
|
448
|
+
* Create a WriteTool instance — register with Robota agent tools registry.
|
|
314
449
|
*/
|
|
450
|
+
declare function createWriteTool(options?: ISandboxToolOptions): FunctionTool;
|
|
315
451
|
/**
|
|
316
452
|
* WriteTool instance — register with Robota agent tools registry.
|
|
317
453
|
*/
|
|
318
454
|
declare const writeTool: FunctionTool;
|
|
319
455
|
|
|
320
456
|
/**
|
|
321
|
-
* EditTool —
|
|
322
|
-
*
|
|
323
|
-
* By default, requires the oldString to appear exactly once in the file
|
|
324
|
-
* (ensuring surgical edits). Pass replaceAll:true to replace all occurrences.
|
|
457
|
+
* Create an EditTool instance — register with Robota agent tools registry.
|
|
325
458
|
*/
|
|
459
|
+
declare function createEditTool(options?: ISandboxToolOptions): FunctionTool;
|
|
326
460
|
/**
|
|
327
461
|
* EditTool instance — register with Robota agent tools registry.
|
|
328
462
|
*/
|
|
@@ -367,4 +501,4 @@ declare const webFetchTool: FunctionTool;
|
|
|
367
501
|
*/
|
|
368
502
|
declare const webSearchTool: FunctionTool;
|
|
369
503
|
|
|
370
|
-
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 };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -8,8 +8,171 @@ interface TToolResult {
|
|
|
8
8
|
output: string;
|
|
9
9
|
error?: string;
|
|
10
10
|
exitCode?: number;
|
|
11
|
+
/** Start line number of the edit in the original file (Edit tool only) */
|
|
12
|
+
startLine?: number;
|
|
11
13
|
}
|
|
12
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
|
+
|
|
13
176
|
/**
|
|
14
177
|
* Tool registry implementation
|
|
15
178
|
* Manages tool registration, validation, and retrieval
|
|
@@ -95,6 +258,7 @@ interface IZodSchemaDef {
|
|
|
95
258
|
type?: IZodSchema;
|
|
96
259
|
values?: TUniversalValue[];
|
|
97
260
|
description?: string;
|
|
261
|
+
unknownKeys?: 'passthrough' | 'strip' | 'strict';
|
|
98
262
|
}
|
|
99
263
|
interface IZodSchema {
|
|
100
264
|
parse(value: TToolParameters): TToolParameters;
|
|
@@ -172,14 +336,6 @@ declare class FunctionTool implements IFunctionTool {
|
|
|
172
336
|
* Get tool description
|
|
173
337
|
*/
|
|
174
338
|
getDescription(): string;
|
|
175
|
-
/**
|
|
176
|
-
* Get detailed validation errors
|
|
177
|
-
*/
|
|
178
|
-
private getValidationErrors;
|
|
179
|
-
/**
|
|
180
|
-
* Validate individual parameter type
|
|
181
|
-
*/
|
|
182
|
-
private validateParameterType;
|
|
183
339
|
/**
|
|
184
340
|
* Validate constructor inputs
|
|
185
341
|
*/
|
|
@@ -238,10 +394,6 @@ declare class OpenAPITool implements ITool {
|
|
|
238
394
|
* @private
|
|
239
395
|
*/
|
|
240
396
|
private executeAPICall;
|
|
241
|
-
/**
|
|
242
|
-
* Find the operation in the OpenAPI specification
|
|
243
|
-
*/
|
|
244
|
-
private findOperation;
|
|
245
397
|
/**
|
|
246
398
|
* Build HTTP request configuration from OpenAPI operation and parameters
|
|
247
399
|
*/
|
|
@@ -250,18 +402,6 @@ declare class OpenAPITool implements ITool {
|
|
|
250
402
|
* Create tool schema from OpenAPI operation specification
|
|
251
403
|
*/
|
|
252
404
|
private createSchemaFromOpenAPI;
|
|
253
|
-
/**
|
|
254
|
-
* Convert OpenAPI parameter to tool parameter schema
|
|
255
|
-
*/
|
|
256
|
-
private convertOpenAPIParamToSchema;
|
|
257
|
-
/**
|
|
258
|
-
* Convert OpenAPI schema to parameter schema
|
|
259
|
-
*/
|
|
260
|
-
private convertOpenAPISchemaToParameterSchema;
|
|
261
|
-
/**
|
|
262
|
-
* Map OpenAPI type to JSON schema type
|
|
263
|
-
*/
|
|
264
|
-
private mapOpenAPIType;
|
|
265
405
|
}
|
|
266
406
|
/**
|
|
267
407
|
* Factory function to create OpenAPI tools from specification
|
|
@@ -287,42 +427,36 @@ declare function createOpenAPITool(config: IOpenAPIToolConfig): OpenAPITool;
|
|
|
287
427
|
declare function zodToJsonSchema(schema: IZodSchema, options?: ISchemaConversionOptions): IToolSchema['parameters'];
|
|
288
428
|
|
|
289
429
|
/**
|
|
290
|
-
* BashTool —
|
|
291
|
-
*
|
|
292
|
-
* Returns TToolResult JSON string. Non-zero exit is returned as success:true
|
|
293
|
-
* with exitCode set, matching Claude Code behaviour (the command ran, it just
|
|
294
|
-
* exited non-zero — the LLM can decide what to do with that information).
|
|
430
|
+
* Create a BashTool instance — register with Robota agent tools registry.
|
|
295
431
|
*/
|
|
432
|
+
declare function createBashTool(options?: ISandboxToolOptions): FunctionTool;
|
|
296
433
|
/**
|
|
297
434
|
* BashTool instance — register with Robota agent tools registry.
|
|
298
435
|
*/
|
|
299
436
|
declare const bashTool: FunctionTool;
|
|
300
437
|
|
|
301
438
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
* Supports offset/limit for partial reads. Detects binary files and refuses to
|
|
305
|
-
* return their raw bytes. Default limit is 2000 lines.
|
|
439
|
+
* Create a ReadTool instance — register with Robota agent tools registry.
|
|
306
440
|
*/
|
|
441
|
+
declare function createReadTool(options?: ISandboxToolOptions): FunctionTool;
|
|
307
442
|
/**
|
|
308
443
|
* ReadTool instance — register with Robota agent tools registry.
|
|
309
444
|
*/
|
|
310
445
|
declare const readTool: FunctionTool;
|
|
311
446
|
|
|
312
447
|
/**
|
|
313
|
-
* WriteTool —
|
|
448
|
+
* Create a WriteTool instance — register with Robota agent tools registry.
|
|
314
449
|
*/
|
|
450
|
+
declare function createWriteTool(options?: ISandboxToolOptions): FunctionTool;
|
|
315
451
|
/**
|
|
316
452
|
* WriteTool instance — register with Robota agent tools registry.
|
|
317
453
|
*/
|
|
318
454
|
declare const writeTool: FunctionTool;
|
|
319
455
|
|
|
320
456
|
/**
|
|
321
|
-
* EditTool —
|
|
322
|
-
*
|
|
323
|
-
* By default, requires the oldString to appear exactly once in the file
|
|
324
|
-
* (ensuring surgical edits). Pass replaceAll:true to replace all occurrences.
|
|
457
|
+
* Create an EditTool instance — register with Robota agent tools registry.
|
|
325
458
|
*/
|
|
459
|
+
declare function createEditTool(options?: ISandboxToolOptions): FunctionTool;
|
|
326
460
|
/**
|
|
327
461
|
* EditTool instance — register with Robota agent tools registry.
|
|
328
462
|
*/
|
|
@@ -367,4 +501,4 @@ declare const webFetchTool: FunctionTool;
|
|
|
367
501
|
*/
|
|
368
502
|
declare const webSearchTool: FunctionTool;
|
|
369
503
|
|
|
370
|
-
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 };
|