wuying-agentbay-sdk 0.3.0 → 0.3.3
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 +122 -79
- package/dist/index.cjs +5538 -2224
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1980 -643
- package/dist/index.d.ts +1980 -643
- package/dist/index.mjs +5351 -2037
- package/dist/index.mjs.map +1 -1
- package/package.json +85 -55
package/dist/index.d.mts
CHANGED
|
@@ -1,311 +1,53 @@
|
|
|
1
1
|
import * as $dara from '@darabonba/typescript';
|
|
2
|
-
import
|
|
3
|
-
import { $OpenApiUtil } from '@alicloud/openapi-core';
|
|
2
|
+
import OpenApi, { $OpenApiUtil } from '@alicloud/openapi-core';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
|
-
* FileInfo represents information about a file or directory
|
|
7
|
-
*/
|
|
8
|
-
interface FileInfo {
|
|
9
|
-
name: string;
|
|
10
|
-
path: string;
|
|
11
|
-
size: number;
|
|
12
|
-
isDirectory: boolean;
|
|
13
|
-
modTime: string;
|
|
14
|
-
mode: string;
|
|
15
|
-
owner?: string;
|
|
16
|
-
group?: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* DirectoryEntry represents an entry in a directory listing
|
|
20
|
-
*/
|
|
21
|
-
interface DirectoryEntry {
|
|
22
|
-
name: string;
|
|
23
|
-
isDirectory: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Handles file operations in the AgentBay cloud environment.
|
|
27
|
-
*/
|
|
28
|
-
declare class FileSystem {
|
|
29
|
-
private session;
|
|
30
|
-
private client;
|
|
31
|
-
private baseUrl;
|
|
32
|
-
/**
|
|
33
|
-
* Initialize a FileSystem object.
|
|
34
|
-
*
|
|
35
|
-
* @param session - The Session instance that this FileSystem belongs to.
|
|
36
|
-
*/
|
|
37
|
-
constructor(session: Session);
|
|
38
|
-
/**
|
|
39
|
-
* Helper method to call MCP tools and handle common response processing
|
|
40
|
-
*
|
|
41
|
-
* @param toolName - Name of the MCP tool to call
|
|
42
|
-
* @param args - Arguments to pass to the tool
|
|
43
|
-
* @param defaultErrorMsg - Default error message if specific error details are not available
|
|
44
|
-
* @returns A CallMcpToolResult with the response data
|
|
45
|
-
* @throws APIError if the call fails
|
|
46
|
-
*/
|
|
47
|
-
private callMcpTool;
|
|
48
|
-
/**
|
|
49
|
-
* Creates a new directory at the specified path.
|
|
50
|
-
*
|
|
51
|
-
* @param path - Path to the directory to create.
|
|
52
|
-
* @returns The extracted text content from the API response
|
|
53
|
-
* @throws APIError if the operation fails.
|
|
54
|
-
*/
|
|
55
|
-
createDirectory(path: string): Promise<string>;
|
|
56
|
-
/**
|
|
57
|
-
* Edits a file by replacing occurrences of oldText with newText.
|
|
58
|
-
*
|
|
59
|
-
* @param path - Path to the file to edit.
|
|
60
|
-
* @param edits - Array of edit operations, each containing oldText and newText.
|
|
61
|
-
* @param dryRun - Optional: If true, preview changes without applying them.
|
|
62
|
-
* @returns The extracted text content from the API response
|
|
63
|
-
* @throws APIError if the operation fails.
|
|
64
|
-
*/
|
|
65
|
-
editFile(path: string, edits: Array<{
|
|
66
|
-
oldText: string;
|
|
67
|
-
newText: string;
|
|
68
|
-
}>, dryRun?: boolean): Promise<string>;
|
|
69
|
-
/**
|
|
70
|
-
* Gets information about a file or directory.
|
|
71
|
-
*
|
|
72
|
-
* @param path - Path to the file or directory to inspect.
|
|
73
|
-
* @returns The extracted text content from the API response
|
|
74
|
-
* @throws APIError if the operation fails.
|
|
75
|
-
*/
|
|
76
|
-
getFileInfo(path: string): Promise<FileInfo>;
|
|
77
|
-
/**
|
|
78
|
-
* Lists the contents of a directory.
|
|
79
|
-
*
|
|
80
|
-
* @param path - Path to the directory to list.
|
|
81
|
-
* @returns Array of directory entries with properties like name, isDirectory
|
|
82
|
-
* @throws APIError if the operation fails.
|
|
83
|
-
*/
|
|
84
|
-
listDirectory(path: string): Promise<DirectoryEntry[]>;
|
|
85
|
-
/**
|
|
86
|
-
* Moves a file or directory from source to destination.
|
|
87
|
-
*
|
|
88
|
-
* @param source - Path to the source file or directory.
|
|
89
|
-
* @param destination - Path to the destination file or directory.
|
|
90
|
-
* @returns The extracted text content from the API response
|
|
91
|
-
* @throws APIError if the operation fails.
|
|
92
|
-
*/
|
|
93
|
-
moveFile(source: string, destination: string): Promise<string>;
|
|
94
|
-
/**
|
|
95
|
-
* Reads the content of a file.
|
|
96
|
-
*
|
|
97
|
-
* @param path - Path to the file to read.
|
|
98
|
-
* @param offset - Optional: Line offset to start reading from.
|
|
99
|
-
* @param length - Optional: Number of lines to read. If 0, reads the entire file.
|
|
100
|
-
* @returns The extracted text content from the API response
|
|
101
|
-
* @throws APIError if the operation fails.
|
|
102
|
-
*/
|
|
103
|
-
readFile(path: string, offset?: number, length?: number): Promise<string>;
|
|
104
|
-
/**
|
|
105
|
-
* Reads the content of multiple files.
|
|
106
|
-
*
|
|
107
|
-
* @param paths - Array of file paths to read.
|
|
108
|
-
* @returns The extracted text content from the API response
|
|
109
|
-
* @throws APIError if the operation fails.
|
|
110
|
-
*/
|
|
111
|
-
readMultipleFiles(paths: string[]): Promise<Record<string, string>>;
|
|
112
|
-
/**
|
|
113
|
-
* Searches for files in a directory that match a pattern.
|
|
114
|
-
*
|
|
115
|
-
* @param path - Path to the directory to search in.
|
|
116
|
-
* @param pattern - Pattern to search for. Supports glob patterns.
|
|
117
|
-
* @param excludePatterns - Optional: Array of patterns to exclude.
|
|
118
|
-
* @returns Array of search results with properties like path
|
|
119
|
-
* @throws APIError if the operation fails.
|
|
120
|
-
*/
|
|
121
|
-
searchFiles(path: string, pattern: string, excludePatterns?: string[]): Promise<string[]>;
|
|
122
|
-
/**
|
|
123
|
-
* Writes content to a file.
|
|
124
|
-
*
|
|
125
|
-
* @param path - Path to the file to write.
|
|
126
|
-
* @param content - Content to write to the file.
|
|
127
|
-
* @param mode - Optional: Write mode. One of "overwrite", "append", or "create_new". Default is "overwrite".
|
|
128
|
-
* @returns The extracted text content from the API response
|
|
129
|
-
* @throws APIError if the operation fails.
|
|
130
|
-
*/
|
|
131
|
-
writeFile(path: string, content: string, mode?: string): Promise<string>;
|
|
132
|
-
/**
|
|
133
|
-
* Reads a large file in chunks to handle size limitations of the underlying API.
|
|
134
|
-
* It automatically splits the read operation into multiple requests of chunkSize bytes each.
|
|
135
|
-
*
|
|
136
|
-
* @param path - Path to the file to read.
|
|
137
|
-
* @param chunkSize - Optional: Size of each chunk in bytes. Default is 60KB.
|
|
138
|
-
* @returns The complete file content as a string
|
|
139
|
-
* @throws APIError if the operation fails.
|
|
140
|
-
*/
|
|
141
|
-
readLargeFile(path: string, chunkSize?: number): Promise<string>;
|
|
142
|
-
/**
|
|
143
|
-
* Writes a large file in chunks to handle size limitations of the underlying API.
|
|
144
|
-
* It automatically splits the write operation into multiple requests of chunkSize bytes each.
|
|
145
|
-
*
|
|
146
|
-
* @param path - Path to the file to write.
|
|
147
|
-
* @param content - Content to write to the file.
|
|
148
|
-
* @param chunkSize - Optional: Size of each chunk in bytes. Default is 60KB.
|
|
149
|
-
* @returns True if the operation was successful
|
|
150
|
-
* @throws APIError if the operation fails.
|
|
151
|
-
*/
|
|
152
|
-
writeLargeFile(path: string, content: string, chunkSize?: number): Promise<boolean>;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Represents the result of a command execution
|
|
157
|
-
*/
|
|
158
|
-
interface CommandResult {
|
|
159
|
-
output: string;
|
|
160
|
-
exitCode?: number;
|
|
161
|
-
durationMs?: number;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Represents the result of code execution
|
|
165
|
-
*/
|
|
166
|
-
interface CodeExecutionResult {
|
|
167
|
-
output: string;
|
|
168
|
-
durationMs?: number;
|
|
169
|
-
memoryKb?: number;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Handles command execution operations in the AgentBay cloud environment.
|
|
173
5
|
*/
|
|
174
|
-
declare class
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
* @throws APIError if the call fails
|
|
192
|
-
*/
|
|
193
|
-
private callMcpTool;
|
|
194
|
-
/**
|
|
195
|
-
* Helper method to parse JSON string or return a simple object with output
|
|
196
|
-
*/
|
|
197
|
-
private parseCommandResult;
|
|
198
|
-
/**
|
|
199
|
-
* Execute a command in the cloud environment with a specified timeout.
|
|
200
|
-
*
|
|
201
|
-
* @param command - The command to execute.
|
|
202
|
-
* @param timeoutMs - The timeout for the command execution in milliseconds. Default is 1000ms.
|
|
203
|
-
* @returns A string containing the command output
|
|
204
|
-
*/
|
|
205
|
-
executeCommand(command: string, timeoutMs?: number): Promise<string>;
|
|
206
|
-
/**
|
|
207
|
-
* Helper method to parse JSON string or return a simple object with output
|
|
208
|
-
*/
|
|
209
|
-
private parseCodeExecutionResult;
|
|
210
|
-
/**
|
|
211
|
-
* Execute code in the specified language with a timeout.
|
|
212
|
-
*
|
|
213
|
-
* @param code - The code to execute.
|
|
214
|
-
* @param language - The programming language of the code. Must be either 'python' or 'javascript'.
|
|
215
|
-
* @param timeoutS - The timeout for the code execution in seconds. Default is 300s.
|
|
216
|
-
* @returns A string containing the code execution output
|
|
217
|
-
* @throws APIError if the code execution fails or if an unsupported language is specified.
|
|
218
|
-
*/
|
|
219
|
-
runCode(code: string, language: string, timeoutS?: number): Promise<string>;
|
|
6
|
+
declare class ApplyMqttTokenResponseBodyData extends $dara.Model {
|
|
7
|
+
accessKeyId?: string;
|
|
8
|
+
clientId?: string;
|
|
9
|
+
expiration?: string;
|
|
10
|
+
instanceId?: string;
|
|
11
|
+
regionId?: string;
|
|
12
|
+
securityToken?: string;
|
|
13
|
+
static names(): {
|
|
14
|
+
[key: string]: string;
|
|
15
|
+
};
|
|
16
|
+
static types(): {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
19
|
+
validate(): void;
|
|
20
|
+
constructor(map?: {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
});
|
|
220
23
|
}
|
|
221
24
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
* Helper method to call MCP tools and handle common response processing
|
|
237
|
-
*
|
|
238
|
-
* @param toolName - Name of the MCP tool to call
|
|
239
|
-
* @param args - Arguments to pass to the tool
|
|
240
|
-
* @param defaultErrorMsg - Default error message if specific error details are not available
|
|
241
|
-
* @returns A CallMcpToolResult with the response data
|
|
242
|
-
* @throws APIError if the call fails
|
|
243
|
-
*/
|
|
244
|
-
private callMcpTool;
|
|
245
|
-
/**
|
|
246
|
-
* Initialize OSS environment variables with the specified credentials.
|
|
247
|
-
*
|
|
248
|
-
* @param accessKeyId - The Access Key ID for OSS authentication.
|
|
249
|
-
* @param accessKeySecret - The Access Key Secret for OSS authentication.
|
|
250
|
-
* @param securityToken - The security token for OSS authentication.
|
|
251
|
-
* @param endpoint - The OSS service endpoint. If not specified, the default is used.
|
|
252
|
-
* @param region - The OSS region. If not specified, the default is used.
|
|
253
|
-
* @returns The extracted text content from the API response
|
|
254
|
-
*/
|
|
255
|
-
envInit(accessKeyId: string, accessKeySecret: string, securityToken: string, endpoint?: string, region?: string): Promise<string>;
|
|
256
|
-
/**
|
|
257
|
-
* Create an OSS client with the provided credentials.
|
|
258
|
-
*
|
|
259
|
-
* @param accessKeyId - The Access Key ID for OSS authentication.
|
|
260
|
-
* @param accessKeySecret - The Access Key Secret for OSS authentication.
|
|
261
|
-
* @param endpoint - The OSS service endpoint. If not specified, the default is used.
|
|
262
|
-
* @param region - The OSS region. If not specified, the default is used.
|
|
263
|
-
* @returns The extracted text content from the API response
|
|
264
|
-
*/
|
|
265
|
-
createClient(accessKeyId: string, accessKeySecret: string, endpoint?: string, region?: string): Promise<string>;
|
|
266
|
-
/**
|
|
267
|
-
* Upload a local file or directory to OSS.
|
|
268
|
-
*
|
|
269
|
-
* @param bucket - OSS bucket name.
|
|
270
|
-
* @param object - Object key in OSS.
|
|
271
|
-
* @param path - Local file or directory path to upload.
|
|
272
|
-
* @returns The extracted text content from the API response
|
|
273
|
-
*/
|
|
274
|
-
upload(bucket: string, object: string, path: string): Promise<string>;
|
|
275
|
-
/**
|
|
276
|
-
* Upload a local file or directory to OSS using a pre-signed URL.
|
|
277
|
-
*
|
|
278
|
-
* @param url - Pre-signed URL for anonymous upload.
|
|
279
|
-
* @param path - Local file or directory path to upload.
|
|
280
|
-
* @returns The extracted text content from the API response
|
|
281
|
-
*/
|
|
282
|
-
uploadAnonymous(url: string, path: string): Promise<string>;
|
|
283
|
-
/**
|
|
284
|
-
* Download an object from OSS to a local file or directory.
|
|
285
|
-
*
|
|
286
|
-
* @param bucket - OSS bucket name.
|
|
287
|
-
* @param object - Object key in OSS.
|
|
288
|
-
* @param path - Local file or directory path to save the downloaded content.
|
|
289
|
-
* @returns The extracted text content from the API response
|
|
290
|
-
*/
|
|
291
|
-
download(bucket: string, object: string, path: string): Promise<string>;
|
|
292
|
-
/**
|
|
293
|
-
* Download an object from OSS using a pre-signed URL.
|
|
294
|
-
*
|
|
295
|
-
* @param url - Pre-signed URL for anonymous download.
|
|
296
|
-
* @param path - Local file or directory path to save the downloaded content.
|
|
297
|
-
* @returns The extracted text content from the API response
|
|
298
|
-
*/
|
|
299
|
-
downloadAnonymous(url: string, path: string): Promise<string>;
|
|
25
|
+
declare class CreateMcpSessionRequestPersistenceDataList extends $dara.Model {
|
|
26
|
+
contextId?: string;
|
|
27
|
+
path?: string;
|
|
28
|
+
policy?: string;
|
|
29
|
+
static names(): {
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
};
|
|
32
|
+
static types(): {
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
};
|
|
35
|
+
validate(): void;
|
|
36
|
+
constructor(map?: {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
});
|
|
300
39
|
}
|
|
301
40
|
|
|
302
41
|
declare class CreateMcpSessionResponseBodyData extends $dara.Model {
|
|
303
42
|
appInstanceId?: string;
|
|
304
43
|
errMsg?: string;
|
|
44
|
+
httpPort?: string;
|
|
45
|
+
networkInterfaceIp?: string;
|
|
305
46
|
resourceId?: string;
|
|
306
47
|
resourceUrl?: string;
|
|
307
48
|
sessionId?: string;
|
|
308
49
|
success?: boolean;
|
|
50
|
+
vpcResource?: boolean;
|
|
309
51
|
static names(): {
|
|
310
52
|
[key: string]: string;
|
|
311
53
|
};
|
|
@@ -337,6 +79,20 @@ declare class GetContextResponseBodyData extends $dara.Model {
|
|
|
337
79
|
});
|
|
338
80
|
}
|
|
339
81
|
|
|
82
|
+
declare class GetContextInfoResponseBodyData extends $dara.Model {
|
|
83
|
+
contextStatus?: string;
|
|
84
|
+
static names(): {
|
|
85
|
+
[key: string]: string;
|
|
86
|
+
};
|
|
87
|
+
static types(): {
|
|
88
|
+
[key: string]: any;
|
|
89
|
+
};
|
|
90
|
+
validate(): void;
|
|
91
|
+
constructor(map?: {
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
340
96
|
declare class GetLabelResponseBodyData extends $dara.Model {
|
|
341
97
|
labels?: string;
|
|
342
98
|
static names(): {
|
|
@@ -351,12 +107,27 @@ declare class GetLabelResponseBodyData extends $dara.Model {
|
|
|
351
107
|
});
|
|
352
108
|
}
|
|
353
109
|
|
|
110
|
+
declare class GetLinkResponseBodyData extends $dara.Model {
|
|
111
|
+
url?: string;
|
|
112
|
+
static names(): {
|
|
113
|
+
[key: string]: string;
|
|
114
|
+
};
|
|
115
|
+
static types(): {
|
|
116
|
+
[key: string]: any;
|
|
117
|
+
};
|
|
118
|
+
validate(): void;
|
|
119
|
+
constructor(map?: {
|
|
120
|
+
[key: string]: any;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
354
124
|
declare class GetMcpResourceResponseBodyDataDesktopInfo extends $dara.Model {
|
|
355
125
|
appId?: string;
|
|
356
126
|
authCode?: string;
|
|
357
127
|
connectionProperties?: string;
|
|
358
128
|
resourceId?: string;
|
|
359
129
|
resourceType?: string;
|
|
130
|
+
ticket?: string;
|
|
360
131
|
static names(): {
|
|
361
132
|
[key: string]: string;
|
|
362
133
|
};
|
|
@@ -418,15 +189,9 @@ declare class ListSessionResponseBodyData extends $dara.Model {
|
|
|
418
189
|
});
|
|
419
190
|
}
|
|
420
191
|
|
|
421
|
-
declare class
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
externalUserId?: string;
|
|
425
|
-
imageId?: string;
|
|
426
|
-
name?: string;
|
|
427
|
-
server?: string;
|
|
428
|
-
sessionId?: string;
|
|
429
|
-
tool?: string;
|
|
192
|
+
declare class ApplyMqttTokenRequest extends $dara.Model {
|
|
193
|
+
desktopId?: string;
|
|
194
|
+
sessionToken?: string;
|
|
430
195
|
static names(): {
|
|
431
196
|
[key: string]: string;
|
|
432
197
|
};
|
|
@@ -439,9 +204,9 @@ declare class CallMcpToolRequest extends $dara.Model {
|
|
|
439
204
|
});
|
|
440
205
|
}
|
|
441
206
|
|
|
442
|
-
declare class
|
|
207
|
+
declare class ApplyMqttTokenResponseBody extends $dara.Model {
|
|
443
208
|
code?: string;
|
|
444
|
-
data?:
|
|
209
|
+
data?: ApplyMqttTokenResponseBodyData;
|
|
445
210
|
httpStatusCode?: number;
|
|
446
211
|
message?: string;
|
|
447
212
|
requestId?: string;
|
|
@@ -458,12 +223,12 @@ declare class CallMcpToolResponseBody extends $dara.Model {
|
|
|
458
223
|
});
|
|
459
224
|
}
|
|
460
225
|
|
|
461
|
-
declare class
|
|
226
|
+
declare class ApplyMqttTokenResponse extends $dara.Model {
|
|
462
227
|
headers?: {
|
|
463
228
|
[key: string]: string;
|
|
464
229
|
};
|
|
465
230
|
statusCode?: number;
|
|
466
|
-
body?:
|
|
231
|
+
body?: ApplyMqttTokenResponseBody;
|
|
467
232
|
static names(): {
|
|
468
233
|
[key: string]: string;
|
|
469
234
|
};
|
|
@@ -476,13 +241,94 @@ declare class CallMcpToolResponse extends $dara.Model {
|
|
|
476
241
|
});
|
|
477
242
|
}
|
|
478
243
|
|
|
479
|
-
declare class
|
|
244
|
+
declare class CallMcpToolRequest extends $dara.Model {
|
|
245
|
+
args?: string;
|
|
480
246
|
authorization?: string;
|
|
481
|
-
contextId?: string;
|
|
482
247
|
externalUserId?: string;
|
|
483
248
|
imageId?: string;
|
|
484
|
-
|
|
249
|
+
name?: string;
|
|
250
|
+
server?: string;
|
|
485
251
|
sessionId?: string;
|
|
252
|
+
tool?: string;
|
|
253
|
+
static names(): {
|
|
254
|
+
[key: string]: string;
|
|
255
|
+
};
|
|
256
|
+
static types(): {
|
|
257
|
+
[key: string]: any;
|
|
258
|
+
};
|
|
259
|
+
validate(): void;
|
|
260
|
+
constructor(map?: {
|
|
261
|
+
[key: string]: any;
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
declare class CallMcpToolResponseBody extends $dara.Model {
|
|
266
|
+
code?: string;
|
|
267
|
+
data?: any;
|
|
268
|
+
httpStatusCode?: number;
|
|
269
|
+
message?: string;
|
|
270
|
+
requestId?: string;
|
|
271
|
+
success?: boolean;
|
|
272
|
+
static names(): {
|
|
273
|
+
[key: string]: string;
|
|
274
|
+
};
|
|
275
|
+
static types(): {
|
|
276
|
+
[key: string]: any;
|
|
277
|
+
};
|
|
278
|
+
validate(): void;
|
|
279
|
+
constructor(map?: {
|
|
280
|
+
[key: string]: any;
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
declare class CallMcpToolResponse extends $dara.Model {
|
|
285
|
+
headers?: {
|
|
286
|
+
[key: string]: string;
|
|
287
|
+
};
|
|
288
|
+
statusCode?: number;
|
|
289
|
+
body?: CallMcpToolResponseBody;
|
|
290
|
+
static names(): {
|
|
291
|
+
[key: string]: string;
|
|
292
|
+
};
|
|
293
|
+
static types(): {
|
|
294
|
+
[key: string]: any;
|
|
295
|
+
};
|
|
296
|
+
validate(): void;
|
|
297
|
+
constructor(map?: {
|
|
298
|
+
[key: string]: any;
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
declare class CreateMcpSessionRequest extends $dara.Model {
|
|
303
|
+
authorization?: string;
|
|
304
|
+
contextId?: string;
|
|
305
|
+
externalUserId?: string;
|
|
306
|
+
imageId?: string;
|
|
307
|
+
labels?: string;
|
|
308
|
+
persistenceDataList?: CreateMcpSessionRequestPersistenceDataList[];
|
|
309
|
+
sessionId?: string;
|
|
310
|
+
vpcResource?: boolean;
|
|
311
|
+
static names(): {
|
|
312
|
+
[key: string]: string;
|
|
313
|
+
};
|
|
314
|
+
static types(): {
|
|
315
|
+
[key: string]: any;
|
|
316
|
+
};
|
|
317
|
+
validate(): void;
|
|
318
|
+
constructor(map?: {
|
|
319
|
+
[key: string]: any;
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
declare class CreateMcpSessionShrinkRequest extends $dara.Model {
|
|
324
|
+
authorization?: string;
|
|
325
|
+
contextId?: string;
|
|
326
|
+
externalUserId?: string;
|
|
327
|
+
imageId?: string;
|
|
328
|
+
labels?: string;
|
|
329
|
+
persistenceDataListShrink?: string;
|
|
330
|
+
sessionId?: string;
|
|
331
|
+
vpcResource?: boolean;
|
|
486
332
|
static names(): {
|
|
487
333
|
[key: string]: string;
|
|
488
334
|
};
|
|
@@ -636,6 +482,61 @@ declare class GetContextResponse extends $dara.Model {
|
|
|
636
482
|
});
|
|
637
483
|
}
|
|
638
484
|
|
|
485
|
+
declare class GetContextInfoRequest extends $dara.Model {
|
|
486
|
+
authorization?: string;
|
|
487
|
+
contextId?: string;
|
|
488
|
+
path?: string;
|
|
489
|
+
sessionId?: string;
|
|
490
|
+
taskType?: string;
|
|
491
|
+
static names(): {
|
|
492
|
+
[key: string]: string;
|
|
493
|
+
};
|
|
494
|
+
static types(): {
|
|
495
|
+
[key: string]: any;
|
|
496
|
+
};
|
|
497
|
+
validate(): void;
|
|
498
|
+
constructor(map?: {
|
|
499
|
+
[key: string]: any;
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
declare class GetContextInfoResponseBody extends $dara.Model {
|
|
504
|
+
code?: string;
|
|
505
|
+
data?: GetContextInfoResponseBodyData;
|
|
506
|
+
httpStatusCode?: number;
|
|
507
|
+
message?: string;
|
|
508
|
+
requestId?: string;
|
|
509
|
+
success?: boolean;
|
|
510
|
+
static names(): {
|
|
511
|
+
[key: string]: string;
|
|
512
|
+
};
|
|
513
|
+
static types(): {
|
|
514
|
+
[key: string]: any;
|
|
515
|
+
};
|
|
516
|
+
validate(): void;
|
|
517
|
+
constructor(map?: {
|
|
518
|
+
[key: string]: any;
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
declare class GetContextInfoResponse extends $dara.Model {
|
|
523
|
+
headers?: {
|
|
524
|
+
[key: string]: string;
|
|
525
|
+
};
|
|
526
|
+
statusCode?: number;
|
|
527
|
+
body?: GetContextInfoResponseBody;
|
|
528
|
+
static names(): {
|
|
529
|
+
[key: string]: string;
|
|
530
|
+
};
|
|
531
|
+
static types(): {
|
|
532
|
+
[key: string]: any;
|
|
533
|
+
};
|
|
534
|
+
validate(): void;
|
|
535
|
+
constructor(map?: {
|
|
536
|
+
[key: string]: any;
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
|
|
639
540
|
declare class GetLabelRequest extends $dara.Model {
|
|
640
541
|
authorization?: string;
|
|
641
542
|
maxResults?: number;
|
|
@@ -695,6 +596,8 @@ declare class GetLabelResponse extends $dara.Model {
|
|
|
695
596
|
|
|
696
597
|
declare class GetLinkRequest extends $dara.Model {
|
|
697
598
|
authorization?: string;
|
|
599
|
+
port?: number;
|
|
600
|
+
protocolType?: string;
|
|
698
601
|
sessionId?: string;
|
|
699
602
|
static names(): {
|
|
700
603
|
[key: string]: string;
|
|
@@ -710,7 +613,7 @@ declare class GetLinkRequest extends $dara.Model {
|
|
|
710
613
|
|
|
711
614
|
declare class GetLinkResponseBody extends $dara.Model {
|
|
712
615
|
code?: string;
|
|
713
|
-
data?:
|
|
616
|
+
data?: GetLinkResponseBodyData;
|
|
714
617
|
httpStatusCode?: number;
|
|
715
618
|
message?: string;
|
|
716
619
|
requestId?: string;
|
|
@@ -797,6 +700,85 @@ declare class GetMcpResourceResponse extends $dara.Model {
|
|
|
797
700
|
});
|
|
798
701
|
}
|
|
799
702
|
|
|
703
|
+
declare class InitBrowserRequest extends $dara.Model {
|
|
704
|
+
authorization?: string;
|
|
705
|
+
persistentPath?: string;
|
|
706
|
+
sessionId?: string;
|
|
707
|
+
static names(): {
|
|
708
|
+
[key: string]: string;
|
|
709
|
+
};
|
|
710
|
+
static types(): {
|
|
711
|
+
[key: string]: any;
|
|
712
|
+
};
|
|
713
|
+
validate(): void;
|
|
714
|
+
constructor(map?: {
|
|
715
|
+
[key: string]: any;
|
|
716
|
+
});
|
|
717
|
+
static fromMap(m: {
|
|
718
|
+
[key: string]: any;
|
|
719
|
+
}): InitBrowserRequest;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
declare class InitBrowserResponseBodyData extends $dara.Model {
|
|
723
|
+
port?: number;
|
|
724
|
+
static names(): {
|
|
725
|
+
[key: string]: string;
|
|
726
|
+
};
|
|
727
|
+
static types(): {
|
|
728
|
+
[key: string]: any;
|
|
729
|
+
};
|
|
730
|
+
validate(): void;
|
|
731
|
+
constructor(map?: {
|
|
732
|
+
[key: string]: any;
|
|
733
|
+
});
|
|
734
|
+
static fromMap(m: {
|
|
735
|
+
[key: string]: any;
|
|
736
|
+
}): InitBrowserResponseBodyData;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
declare class InitBrowserResponseBody extends $dara.Model {
|
|
740
|
+
code?: string;
|
|
741
|
+
data?: InitBrowserResponseBodyData;
|
|
742
|
+
httpStatusCode?: number;
|
|
743
|
+
message?: string;
|
|
744
|
+
requestId?: string;
|
|
745
|
+
success?: boolean;
|
|
746
|
+
static names(): {
|
|
747
|
+
[key: string]: string;
|
|
748
|
+
};
|
|
749
|
+
static types(): {
|
|
750
|
+
[key: string]: any;
|
|
751
|
+
};
|
|
752
|
+
validate(): void;
|
|
753
|
+
constructor(map?: {
|
|
754
|
+
[key: string]: any;
|
|
755
|
+
});
|
|
756
|
+
static fromMap(m: {
|
|
757
|
+
[key: string]: any;
|
|
758
|
+
}): InitBrowserResponseBody;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
declare class InitBrowserResponse extends $dara.Model {
|
|
762
|
+
headers?: {
|
|
763
|
+
[key: string]: string;
|
|
764
|
+
};
|
|
765
|
+
statusCode?: number;
|
|
766
|
+
body?: InitBrowserResponseBody;
|
|
767
|
+
static names(): {
|
|
768
|
+
[key: string]: string;
|
|
769
|
+
};
|
|
770
|
+
static types(): {
|
|
771
|
+
[key: string]: any;
|
|
772
|
+
};
|
|
773
|
+
validate(): void;
|
|
774
|
+
constructor(map?: {
|
|
775
|
+
[key: string]: any;
|
|
776
|
+
});
|
|
777
|
+
static fromMap(m: {
|
|
778
|
+
[key: string]: any;
|
|
779
|
+
}): InitBrowserResponse;
|
|
780
|
+
}
|
|
781
|
+
|
|
800
782
|
declare class ListContextsRequest extends $dara.Model {
|
|
801
783
|
authorization?: string;
|
|
802
784
|
maxResults?: number;
|
|
@@ -853,6 +835,58 @@ declare class ListContextsResponse extends $dara.Model {
|
|
|
853
835
|
});
|
|
854
836
|
}
|
|
855
837
|
|
|
838
|
+
declare class ListMcpToolsRequest extends $dara.Model {
|
|
839
|
+
authorization?: string;
|
|
840
|
+
imageId?: string;
|
|
841
|
+
static names(): {
|
|
842
|
+
[key: string]: string;
|
|
843
|
+
};
|
|
844
|
+
static types(): {
|
|
845
|
+
[key: string]: any;
|
|
846
|
+
};
|
|
847
|
+
validate(): void;
|
|
848
|
+
constructor(map?: {
|
|
849
|
+
[key: string]: any;
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
declare class ListMcpToolsResponseBody extends $dara.Model {
|
|
854
|
+
code?: string;
|
|
855
|
+
data?: string;
|
|
856
|
+
httpStatusCode?: number;
|
|
857
|
+
message?: string;
|
|
858
|
+
requestId?: string;
|
|
859
|
+
success?: boolean;
|
|
860
|
+
static names(): {
|
|
861
|
+
[key: string]: string;
|
|
862
|
+
};
|
|
863
|
+
static types(): {
|
|
864
|
+
[key: string]: any;
|
|
865
|
+
};
|
|
866
|
+
validate(): void;
|
|
867
|
+
constructor(map?: {
|
|
868
|
+
[key: string]: any;
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
declare class ListMcpToolsResponse extends $dara.Model {
|
|
873
|
+
headers?: {
|
|
874
|
+
[key: string]: string;
|
|
875
|
+
};
|
|
876
|
+
statusCode?: number;
|
|
877
|
+
body?: ListMcpToolsResponseBody;
|
|
878
|
+
static names(): {
|
|
879
|
+
[key: string]: string;
|
|
880
|
+
};
|
|
881
|
+
static types(): {
|
|
882
|
+
[key: string]: any;
|
|
883
|
+
};
|
|
884
|
+
validate(): void;
|
|
885
|
+
constructor(map?: {
|
|
886
|
+
[key: string]: any;
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
|
|
856
890
|
declare class ListSessionRequest extends $dara.Model {
|
|
857
891
|
authorization?: string;
|
|
858
892
|
labels?: string;
|
|
@@ -1065,23 +1099,75 @@ declare class SetLabelResponse extends $dara.Model {
|
|
|
1065
1099
|
});
|
|
1066
1100
|
}
|
|
1067
1101
|
|
|
1068
|
-
declare
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1102
|
+
declare class SyncContextRequest extends $dara.Model {
|
|
1103
|
+
authorization?: string;
|
|
1104
|
+
contextId?: string;
|
|
1105
|
+
mode?: string;
|
|
1106
|
+
path?: string;
|
|
1107
|
+
sessionId?: string;
|
|
1108
|
+
static names(): {
|
|
1073
1109
|
[key: string]: string;
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1110
|
+
};
|
|
1111
|
+
static types(): {
|
|
1112
|
+
[key: string]: any;
|
|
1113
|
+
};
|
|
1114
|
+
validate(): void;
|
|
1115
|
+
constructor(map?: {
|
|
1116
|
+
[key: string]: any;
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
declare class SyncContextResponseBody extends $dara.Model {
|
|
1121
|
+
code?: string;
|
|
1122
|
+
httpStatusCode?: number;
|
|
1123
|
+
message?: string;
|
|
1124
|
+
requestId?: string;
|
|
1125
|
+
success?: boolean;
|
|
1126
|
+
static names(): {
|
|
1127
|
+
[key: string]: string;
|
|
1128
|
+
};
|
|
1129
|
+
static types(): {
|
|
1130
|
+
[key: string]: any;
|
|
1131
|
+
};
|
|
1132
|
+
validate(): void;
|
|
1133
|
+
constructor(map?: {
|
|
1134
|
+
[key: string]: any;
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
declare class SyncContextResponse extends $dara.Model {
|
|
1139
|
+
headers?: {
|
|
1140
|
+
[key: string]: string;
|
|
1141
|
+
};
|
|
1142
|
+
statusCode?: number;
|
|
1143
|
+
body?: SyncContextResponseBody;
|
|
1144
|
+
static names(): {
|
|
1145
|
+
[key: string]: string;
|
|
1146
|
+
};
|
|
1147
|
+
static types(): {
|
|
1148
|
+
[key: string]: any;
|
|
1149
|
+
};
|
|
1150
|
+
validate(): void;
|
|
1151
|
+
constructor(map?: {
|
|
1152
|
+
[key: string]: any;
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
declare class Client extends OpenApi {
|
|
1157
|
+
constructor(config: $OpenApiUtil.Config);
|
|
1158
|
+
getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: {
|
|
1159
|
+
[key: string]: string;
|
|
1160
|
+
}, endpoint: string): string;
|
|
1161
|
+
/**
|
|
1162
|
+
* 调用mcp工具
|
|
1163
|
+
*
|
|
1164
|
+
* @param request - CallMcpToolRequest
|
|
1165
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
1166
|
+
* @returns CallMcpToolResponse
|
|
1167
|
+
*/
|
|
1168
|
+
callMcpToolWithOptions(request: CallMcpToolRequest, runtime: $dara.RuntimeOptions): Promise<CallMcpToolResponse>;
|
|
1169
|
+
/**
|
|
1170
|
+
* 调用mcp工具
|
|
1085
1171
|
*
|
|
1086
1172
|
* @param request - CallMcpToolRequest
|
|
1087
1173
|
* @returns CallMcpToolResponse
|
|
@@ -1090,11 +1176,11 @@ declare class Client extends OpenApi {
|
|
|
1090
1176
|
/**
|
|
1091
1177
|
* 创建 mcp session
|
|
1092
1178
|
*
|
|
1093
|
-
* @param
|
|
1179
|
+
* @param tmpReq - CreateMcpSessionRequest
|
|
1094
1180
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
1095
1181
|
* @returns CreateMcpSessionResponse
|
|
1096
1182
|
*/
|
|
1097
|
-
createMcpSessionWithOptions(
|
|
1183
|
+
createMcpSessionWithOptions(tmpReq: CreateMcpSessionRequest, runtime: $dara.RuntimeOptions): Promise<CreateMcpSessionResponse>;
|
|
1098
1184
|
/**
|
|
1099
1185
|
* 创建 mcp session
|
|
1100
1186
|
*
|
|
@@ -1132,6 +1218,21 @@ declare class Client extends OpenApi {
|
|
|
1132
1218
|
* @returns GetContextResponse
|
|
1133
1219
|
*/
|
|
1134
1220
|
getContext(request: GetContextRequest): Promise<GetContextResponse>;
|
|
1221
|
+
/**
|
|
1222
|
+
* 获取上下文信息
|
|
1223
|
+
*
|
|
1224
|
+
* @param request - GetContextInfoRequest
|
|
1225
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
1226
|
+
* @returns GetContextInfoResponse
|
|
1227
|
+
*/
|
|
1228
|
+
getContextInfoWithOptions(request: GetContextInfoRequest, runtime: $dara.RuntimeOptions): Promise<GetContextInfoResponse>;
|
|
1229
|
+
/**
|
|
1230
|
+
* 获取上下文信息
|
|
1231
|
+
*
|
|
1232
|
+
* @param request - GetContextInfoRequest
|
|
1233
|
+
* @returns GetContextInfoResponse
|
|
1234
|
+
*/
|
|
1235
|
+
getContextInfo(request: GetContextInfoRequest): Promise<GetContextInfoResponse>;
|
|
1135
1236
|
/**
|
|
1136
1237
|
* 获取标签
|
|
1137
1238
|
*
|
|
@@ -1192,6 +1293,21 @@ declare class Client extends OpenApi {
|
|
|
1192
1293
|
* @returns ListContextsResponse
|
|
1193
1294
|
*/
|
|
1194
1295
|
listContexts(request: ListContextsRequest): Promise<ListContextsResponse>;
|
|
1296
|
+
/**
|
|
1297
|
+
* ListMcpTools
|
|
1298
|
+
*
|
|
1299
|
+
* @param request - ListMcpToolsRequest
|
|
1300
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
1301
|
+
* @returns ListMcpToolsResponse
|
|
1302
|
+
*/
|
|
1303
|
+
listMcpToolsWithOptions(request: ListMcpToolsRequest, runtime: $dara.RuntimeOptions): Promise<ListMcpToolsResponse>;
|
|
1304
|
+
/**
|
|
1305
|
+
* ListMcpTools
|
|
1306
|
+
*
|
|
1307
|
+
* @param request - ListMcpToolsRequest
|
|
1308
|
+
* @returns ListMcpToolsResponse
|
|
1309
|
+
*/
|
|
1310
|
+
listMcpTools(request: ListMcpToolsRequest): Promise<ListMcpToolsResponse>;
|
|
1195
1311
|
/**
|
|
1196
1312
|
* 根据Lable查询Session列表
|
|
1197
1313
|
*
|
|
@@ -1252,111 +1368,1157 @@ declare class Client extends OpenApi {
|
|
|
1252
1368
|
* @returns SetLabelResponse
|
|
1253
1369
|
*/
|
|
1254
1370
|
setLabel(request: SetLabelRequest): Promise<SetLabelResponse>;
|
|
1371
|
+
/**
|
|
1372
|
+
* 同步上下文
|
|
1373
|
+
*
|
|
1374
|
+
* @param request - SyncContextRequest
|
|
1375
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
1376
|
+
* @returns SyncContextResponse
|
|
1377
|
+
*/
|
|
1378
|
+
syncContextWithOptions(request: SyncContextRequest, runtime: $dara.RuntimeOptions): Promise<SyncContextResponse>;
|
|
1379
|
+
/**
|
|
1380
|
+
* 同步上下文
|
|
1381
|
+
*
|
|
1382
|
+
* @param request - SyncContextRequest
|
|
1383
|
+
* @returns SyncContextResponse
|
|
1384
|
+
*/
|
|
1385
|
+
syncContext(request: SyncContextRequest): Promise<SyncContextResponse>;
|
|
1386
|
+
/**
|
|
1387
|
+
* 初始化浏览器
|
|
1388
|
+
*
|
|
1389
|
+
* @param tmpReq - InitBrowserRequest
|
|
1390
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
1391
|
+
* @returns InitBrowserResponse
|
|
1392
|
+
*/
|
|
1393
|
+
initBrowserWithOptions(request: InitBrowserRequest, runtime: $dara.RuntimeOptions): Promise<InitBrowserResponse>;
|
|
1394
|
+
/**
|
|
1395
|
+
* 初始化浏览器
|
|
1396
|
+
*
|
|
1397
|
+
* @param request - InitBrowserRequest
|
|
1398
|
+
* @returns InitBrowserResponse
|
|
1399
|
+
*/
|
|
1400
|
+
initBrowser(request: InitBrowserRequest): Promise<InitBrowserResponse>;
|
|
1401
|
+
/**
|
|
1402
|
+
* 初始化浏览器(同步版本)
|
|
1403
|
+
*
|
|
1404
|
+
* @param request - InitBrowserRequest
|
|
1405
|
+
* @returns InitBrowserResponse
|
|
1406
|
+
*/
|
|
1407
|
+
initBrowserSync(request: InitBrowserRequest): InitBrowserResponse;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
interface Config {
|
|
1411
|
+
region_id: string;
|
|
1412
|
+
endpoint: string;
|
|
1413
|
+
timeout_ms: number;
|
|
1255
1414
|
}
|
|
1256
1415
|
|
|
1257
1416
|
/**
|
|
1258
|
-
*
|
|
1417
|
+
* Base interface for API responses
|
|
1259
1418
|
*/
|
|
1260
|
-
interface
|
|
1419
|
+
interface ApiResponse {
|
|
1420
|
+
/** Optional request identifier for tracking API calls */
|
|
1421
|
+
requestId?: string;
|
|
1422
|
+
/** Optional error message if the operation failed */
|
|
1423
|
+
errorMessage?: string;
|
|
1424
|
+
/** Optional status code if the operation failed */
|
|
1425
|
+
success?: boolean;
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Interface for delete operation responses
|
|
1429
|
+
*/
|
|
1430
|
+
interface DeleteResult extends ApiResponse {
|
|
1431
|
+
/** Whether the delete operation was successful */
|
|
1432
|
+
success: boolean;
|
|
1433
|
+
/** Optional error message if the operation failed */
|
|
1434
|
+
errorMessage?: string;
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Interface for session creation operation responses
|
|
1438
|
+
* Corresponds to Python's SessionResult type
|
|
1439
|
+
*/
|
|
1440
|
+
interface SessionResult extends ApiResponse {
|
|
1441
|
+
/** Request identifier for tracking API calls */
|
|
1442
|
+
requestId: string;
|
|
1443
|
+
/** Whether the session creation was successful */
|
|
1444
|
+
success: boolean;
|
|
1445
|
+
/** The created session object (only present if successful) */
|
|
1446
|
+
session?: any;
|
|
1447
|
+
/** Error message if the operation failed */
|
|
1448
|
+
errorMessage?: string;
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Interface for operation results
|
|
1452
|
+
* Corresponds to Python's OperationResult type
|
|
1453
|
+
*/
|
|
1454
|
+
interface OperationResult extends ApiResponse {
|
|
1455
|
+
/** Request identifier for tracking API calls */
|
|
1456
|
+
requestId: string;
|
|
1457
|
+
/** Whether the operation was successful */
|
|
1458
|
+
success: boolean;
|
|
1459
|
+
/** Optional data payload */
|
|
1460
|
+
data?: any;
|
|
1461
|
+
/** Optional error message if the operation failed */
|
|
1462
|
+
errorMessage?: string;
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* Interface for process list operation responses
|
|
1466
|
+
* Corresponds to Python's ProcessListResult type
|
|
1467
|
+
*/
|
|
1468
|
+
interface ProcessListResult extends ApiResponse {
|
|
1469
|
+
/** Request identifier for tracking API calls */
|
|
1470
|
+
requestId: string;
|
|
1471
|
+
/** Whether the operation was successful */
|
|
1472
|
+
success: boolean;
|
|
1473
|
+
/** The list of process objects */
|
|
1474
|
+
data: any[];
|
|
1475
|
+
/** Optional error message if the operation failed */
|
|
1476
|
+
errorMessage?: string;
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Interface for installed app list operation responses
|
|
1480
|
+
* Corresponds to Python's InstalledAppListResult type
|
|
1481
|
+
*/
|
|
1482
|
+
interface InstalledAppListResult extends ApiResponse {
|
|
1483
|
+
/** Request identifier for tracking API calls */
|
|
1484
|
+
requestId: string;
|
|
1485
|
+
/** Whether the operation was successful */
|
|
1486
|
+
success: boolean;
|
|
1487
|
+
/** The list of installed app objects */
|
|
1488
|
+
data: any[];
|
|
1489
|
+
/** Optional error message if the operation failed */
|
|
1490
|
+
errorMessage?: string;
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Interface for application operation responses
|
|
1494
|
+
* Corresponds to Python's AppOperationResult type
|
|
1495
|
+
*/
|
|
1496
|
+
interface AppOperationResult extends ApiResponse {
|
|
1497
|
+
/** Request identifier for tracking API calls */
|
|
1498
|
+
requestId: string;
|
|
1499
|
+
/** Whether the operation was successful */
|
|
1500
|
+
success: boolean;
|
|
1501
|
+
/** Optional error message if the operation failed */
|
|
1502
|
+
errorMessage?: string;
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Interface for command execution operation responses
|
|
1506
|
+
* Corresponds to Python's CommandResult type
|
|
1507
|
+
*/
|
|
1508
|
+
interface CommandResult extends ApiResponse {
|
|
1509
|
+
/** Request identifier for tracking API calls */
|
|
1510
|
+
requestId: string;
|
|
1511
|
+
/** Whether the command execution was successful */
|
|
1512
|
+
success: boolean;
|
|
1513
|
+
/** The command output */
|
|
1514
|
+
output: string;
|
|
1515
|
+
/** Optional error message if the operation failed */
|
|
1516
|
+
errorMessage?: string;
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Interface for code execution operation responses
|
|
1520
|
+
* Corresponds to Python's CodeExecutionResult type
|
|
1521
|
+
*/
|
|
1522
|
+
interface CodeExecutionResult extends ApiResponse {
|
|
1523
|
+
/** Request identifier for tracking API calls */
|
|
1524
|
+
requestId: string;
|
|
1525
|
+
/** Whether the code execution was successful */
|
|
1526
|
+
success: boolean;
|
|
1527
|
+
/** The execution result */
|
|
1528
|
+
result: string;
|
|
1529
|
+
/** Optional error message if the operation failed */
|
|
1530
|
+
errorMessage?: string;
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Interface for boolean operation responses
|
|
1534
|
+
* Corresponds to Python's BoolResult type
|
|
1535
|
+
*/
|
|
1536
|
+
interface BoolResult extends ApiResponse {
|
|
1537
|
+
/** Request identifier for tracking API calls */
|
|
1538
|
+
requestId: string;
|
|
1539
|
+
/** Whether the operation was successful */
|
|
1540
|
+
success: boolean;
|
|
1541
|
+
/** Boolean data result */
|
|
1542
|
+
data?: boolean;
|
|
1543
|
+
/** Optional error message if the operation failed */
|
|
1544
|
+
errorMessage?: string;
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Interface for file info operation responses
|
|
1548
|
+
* Corresponds to Python's FileInfoResult type
|
|
1549
|
+
*/
|
|
1550
|
+
interface FileInfoResult extends ApiResponse {
|
|
1551
|
+
/** Request identifier for tracking API calls */
|
|
1552
|
+
requestId: string;
|
|
1553
|
+
/** Whether the operation was successful */
|
|
1554
|
+
success: boolean;
|
|
1555
|
+
/** File information object */
|
|
1556
|
+
fileInfo?: Record<string, any>;
|
|
1557
|
+
/** Optional error message if the operation failed */
|
|
1558
|
+
errorMessage?: string;
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Interface for directory list operation responses
|
|
1562
|
+
* Corresponds to Python's DirectoryListResult type
|
|
1563
|
+
*/
|
|
1564
|
+
interface DirectoryListResult extends ApiResponse {
|
|
1565
|
+
/** Request identifier for tracking API calls */
|
|
1566
|
+
requestId: string;
|
|
1567
|
+
/** Whether the operation was successful */
|
|
1568
|
+
success: boolean;
|
|
1569
|
+
/** Directory entries */
|
|
1570
|
+
entries: Record<string, any>[];
|
|
1571
|
+
/** Optional error message if the operation failed */
|
|
1572
|
+
errorMessage?: string;
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* Interface for file content operation responses
|
|
1576
|
+
* Corresponds to Python's FileContentResult type
|
|
1577
|
+
*/
|
|
1578
|
+
interface FileContentResult extends ApiResponse {
|
|
1579
|
+
/** Request identifier for tracking API calls */
|
|
1580
|
+
requestId: string;
|
|
1581
|
+
/** Whether the operation was successful */
|
|
1582
|
+
success: boolean;
|
|
1583
|
+
/** File content */
|
|
1584
|
+
content: string;
|
|
1585
|
+
/** Optional error message if the operation failed */
|
|
1586
|
+
errorMessage?: string;
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* Interface for multiple file content operation responses
|
|
1590
|
+
* Corresponds to Python's MultipleFileContentResult type
|
|
1591
|
+
*/
|
|
1592
|
+
interface MultipleFileContentResult extends ApiResponse {
|
|
1593
|
+
/** Request identifier for tracking API calls */
|
|
1594
|
+
requestId: string;
|
|
1595
|
+
/** Whether the operation was successful */
|
|
1596
|
+
success: boolean;
|
|
1597
|
+
/** Multiple file contents */
|
|
1598
|
+
contents: Record<string, string>;
|
|
1599
|
+
/** Optional error message if the operation failed */
|
|
1600
|
+
errorMessage?: string;
|
|
1601
|
+
}
|
|
1602
|
+
/**
|
|
1603
|
+
* Interface for file search operation responses
|
|
1604
|
+
* Corresponds to Python's FileSearchResult type
|
|
1605
|
+
*/
|
|
1606
|
+
interface FileSearchResult extends ApiResponse {
|
|
1607
|
+
/** Request identifier for tracking API calls */
|
|
1608
|
+
requestId: string;
|
|
1609
|
+
/** Whether the operation was successful */
|
|
1610
|
+
success: boolean;
|
|
1611
|
+
/** Matching file paths */
|
|
1612
|
+
matches: string[];
|
|
1613
|
+
/** Optional error message if the operation failed */
|
|
1614
|
+
errorMessage?: string;
|
|
1615
|
+
}
|
|
1616
|
+
/**
|
|
1617
|
+
* Interface for OSS client creation operation responses
|
|
1618
|
+
* Corresponds to Python's OSSClientResult type
|
|
1619
|
+
*/
|
|
1620
|
+
interface OSSClientResult extends ApiResponse {
|
|
1621
|
+
/** Request identifier for tracking API calls */
|
|
1622
|
+
requestId: string;
|
|
1623
|
+
/** Whether the operation was successful */
|
|
1624
|
+
success: boolean;
|
|
1625
|
+
/** OSS client configuration */
|
|
1626
|
+
clientConfig: Record<string, any>;
|
|
1627
|
+
/** Optional error message if the operation failed */
|
|
1628
|
+
errorMessage?: string;
|
|
1629
|
+
}
|
|
1630
|
+
/**
|
|
1631
|
+
* Interface for OSS upload operation responses
|
|
1632
|
+
* Corresponds to Python's OSSUploadResult type
|
|
1633
|
+
*/
|
|
1634
|
+
interface OSSUploadResult extends ApiResponse {
|
|
1635
|
+
/** Request identifier for tracking API calls */
|
|
1636
|
+
requestId: string;
|
|
1637
|
+
/** Whether the operation was successful */
|
|
1638
|
+
success: boolean;
|
|
1639
|
+
/** Result of the upload operation */
|
|
1640
|
+
content: string;
|
|
1641
|
+
/** Optional error message if the operation failed */
|
|
1642
|
+
errorMessage?: string;
|
|
1643
|
+
}
|
|
1644
|
+
/**
|
|
1645
|
+
* Interface for OSS download operation responses
|
|
1646
|
+
* Corresponds to Python's OSSDownloadResult type
|
|
1647
|
+
*/
|
|
1648
|
+
interface OSSDownloadResult extends ApiResponse {
|
|
1649
|
+
/** Request identifier for tracking API calls */
|
|
1650
|
+
requestId: string;
|
|
1651
|
+
/** Whether the operation was successful */
|
|
1652
|
+
success: boolean;
|
|
1653
|
+
/** Result of the download operation */
|
|
1654
|
+
content: string;
|
|
1655
|
+
/** Optional error message if the operation failed */
|
|
1656
|
+
errorMessage?: string;
|
|
1657
|
+
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Interface for UI element list operation responses
|
|
1660
|
+
* Corresponds to Python's UIElementListResult type
|
|
1661
|
+
*/
|
|
1662
|
+
interface UIElementListResult extends ApiResponse {
|
|
1663
|
+
/** Request identifier for tracking API calls */
|
|
1664
|
+
requestId: string;
|
|
1665
|
+
/** Whether the operation was successful */
|
|
1666
|
+
success: boolean;
|
|
1667
|
+
/** UI elements */
|
|
1668
|
+
elements: Record<string, any>[];
|
|
1669
|
+
/** Optional error message if the operation failed */
|
|
1670
|
+
errorMessage?: string;
|
|
1671
|
+
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Interface for window list operation responses
|
|
1674
|
+
* Corresponds to Python's WindowListResult type
|
|
1675
|
+
*/
|
|
1676
|
+
interface WindowListResult extends ApiResponse {
|
|
1677
|
+
/** Request identifier for tracking API calls */
|
|
1678
|
+
requestId: string;
|
|
1679
|
+
/** Whether the operation was successful */
|
|
1680
|
+
success: boolean;
|
|
1681
|
+
/** List of windows */
|
|
1682
|
+
windows: any[];
|
|
1683
|
+
/** Optional error message if the operation failed */
|
|
1684
|
+
errorMessage?: string;
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Interface for window info operation responses
|
|
1688
|
+
* Corresponds to Python's WindowInfoResult type
|
|
1689
|
+
*/
|
|
1690
|
+
interface WindowInfoResult extends ApiResponse {
|
|
1691
|
+
/** Request identifier for tracking API calls */
|
|
1692
|
+
requestId: string;
|
|
1693
|
+
/** Whether the operation was successful */
|
|
1694
|
+
success: boolean;
|
|
1695
|
+
/** Window object */
|
|
1696
|
+
window?: any;
|
|
1697
|
+
/** Optional error message if the operation failed */
|
|
1698
|
+
errorMessage?: string;
|
|
1699
|
+
}
|
|
1700
|
+
/**
|
|
1701
|
+
* Interface for context operation responses
|
|
1702
|
+
* Corresponds to Python's ContextResult type
|
|
1703
|
+
*/
|
|
1704
|
+
interface ContextResult extends ApiResponse {
|
|
1705
|
+
/** Request identifier for tracking API calls */
|
|
1706
|
+
requestId: string;
|
|
1707
|
+
/** Whether the operation was successful */
|
|
1708
|
+
success: boolean;
|
|
1709
|
+
/** The context ID */
|
|
1710
|
+
contextId: string;
|
|
1711
|
+
/** The context object (only present if successful) */
|
|
1712
|
+
context?: any;
|
|
1713
|
+
/** Optional error message if the operation failed */
|
|
1714
|
+
errorMessage?: string;
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* Interface for context list operation responses
|
|
1718
|
+
* Corresponds to Python's ContextListResult type
|
|
1719
|
+
*/
|
|
1720
|
+
interface ContextListResult extends ApiResponse {
|
|
1721
|
+
/** Request identifier for tracking API calls */
|
|
1722
|
+
requestId: string;
|
|
1723
|
+
/** Whether the operation was successful */
|
|
1724
|
+
success: boolean;
|
|
1725
|
+
/** List of contexts */
|
|
1726
|
+
contexts: any[];
|
|
1727
|
+
/** Token for the next page of results */
|
|
1728
|
+
nextToken?: string;
|
|
1729
|
+
/** Maximum number of results per page */
|
|
1730
|
+
maxResults?: number;
|
|
1731
|
+
/** Total number of contexts available */
|
|
1732
|
+
totalCount?: number;
|
|
1733
|
+
/** Optional error message if the operation failed */
|
|
1734
|
+
errorMessage?: string;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
/**
|
|
1738
|
+
* Represents a persistent storage context in the AgentBay cloud environment.
|
|
1739
|
+
*/
|
|
1740
|
+
declare class Context {
|
|
1741
|
+
/**
|
|
1742
|
+
* The unique identifier of the context.
|
|
1743
|
+
*/
|
|
1744
|
+
id: string;
|
|
1745
|
+
/**
|
|
1746
|
+
* The name of the context.
|
|
1747
|
+
*/
|
|
1261
1748
|
name: string;
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1749
|
+
/**
|
|
1750
|
+
* The current state of the context (e.g., "available", "in-use").
|
|
1751
|
+
*/
|
|
1752
|
+
state: string;
|
|
1753
|
+
/**
|
|
1754
|
+
* Date and time when the Context was created.
|
|
1755
|
+
*/
|
|
1756
|
+
createdAt?: string;
|
|
1757
|
+
/**
|
|
1758
|
+
* Date and time when the Context was last used.
|
|
1759
|
+
*/
|
|
1760
|
+
lastUsedAt?: string;
|
|
1761
|
+
/**
|
|
1762
|
+
* The operating system type this context is bound to.
|
|
1763
|
+
*/
|
|
1764
|
+
osType?: string;
|
|
1765
|
+
/**
|
|
1766
|
+
* Initialize a Context object.
|
|
1767
|
+
*
|
|
1768
|
+
* @param id - The unique identifier of the context.
|
|
1769
|
+
* @param name - The name of the context.
|
|
1770
|
+
* @param state - The current state of the context.
|
|
1771
|
+
* @param createdAt - Date and time when the Context was created.
|
|
1772
|
+
* @param lastUsedAt - Date and time when the Context was last used.
|
|
1773
|
+
* @param osType - The operating system type this context is bound to.
|
|
1774
|
+
*/
|
|
1775
|
+
constructor(id: string, name: string, state?: string, createdAt?: string, lastUsedAt?: string, osType?: string);
|
|
1265
1776
|
}
|
|
1266
1777
|
/**
|
|
1267
|
-
*
|
|
1778
|
+
* Parameters for listing contexts with pagination support.
|
|
1268
1779
|
*/
|
|
1269
|
-
interface
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1780
|
+
interface ContextListParams {
|
|
1781
|
+
/**
|
|
1782
|
+
* Maximum number of results per page.
|
|
1783
|
+
* Defaults to 10 if not specified.
|
|
1784
|
+
*/
|
|
1785
|
+
maxResults?: number;
|
|
1786
|
+
/**
|
|
1787
|
+
* Token for the next page of results.
|
|
1788
|
+
*/
|
|
1789
|
+
nextToken?: string;
|
|
1274
1790
|
}
|
|
1275
1791
|
/**
|
|
1276
|
-
*
|
|
1792
|
+
* Provides methods to manage persistent contexts in the AgentBay cloud environment.
|
|
1277
1793
|
*/
|
|
1278
|
-
declare class
|
|
1279
|
-
private
|
|
1794
|
+
declare class ContextService {
|
|
1795
|
+
private agentBay;
|
|
1280
1796
|
/**
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1797
|
+
* Initialize the ContextService.
|
|
1798
|
+
*
|
|
1799
|
+
* @param agentBay - The AgentBay instance.
|
|
1283
1800
|
*/
|
|
1284
|
-
constructor(
|
|
1285
|
-
getAPIKey(): string;
|
|
1286
|
-
getClient(): Client;
|
|
1287
|
-
getSessionId(): string;
|
|
1288
|
-
});
|
|
1801
|
+
constructor(agentBay: AgentBay);
|
|
1289
1802
|
/**
|
|
1290
|
-
*
|
|
1803
|
+
* Lists all available contexts with pagination support.
|
|
1804
|
+
* Corresponds to Python's list() method
|
|
1291
1805
|
*
|
|
1292
|
-
* @param
|
|
1293
|
-
* @
|
|
1294
|
-
* @param defaultErrorMsg - Default error message if specific error details are not available
|
|
1295
|
-
* @returns A CallMcpToolResult with the response data
|
|
1296
|
-
* @throws APIError if the call fails
|
|
1806
|
+
* @param params - Optional parameters for listing contexts.
|
|
1807
|
+
* @returns ContextListResult with contexts list and pagination information
|
|
1297
1808
|
*/
|
|
1298
|
-
|
|
1809
|
+
list(params?: ContextListParams): Promise<ContextListResult>;
|
|
1299
1810
|
/**
|
|
1300
|
-
*
|
|
1811
|
+
* Gets a context by name. Optionally creates it if it doesn't exist.
|
|
1812
|
+
* Corresponds to Python's get() method
|
|
1813
|
+
*
|
|
1814
|
+
* @param name - The name of the context to get.
|
|
1815
|
+
* @param create - Whether to create the context if it doesn't exist.
|
|
1816
|
+
* @returns ContextResult with context data and requestId
|
|
1301
1817
|
*/
|
|
1302
|
-
|
|
1818
|
+
get(name: string, create?: boolean): Promise<ContextResult>;
|
|
1303
1819
|
/**
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
* @param
|
|
1308
|
-
* @returns
|
|
1309
|
-
|
|
1820
|
+
* Creates a new context with the given name.
|
|
1821
|
+
* Corresponds to Python's create() method
|
|
1822
|
+
*
|
|
1823
|
+
* @param name - The name for the new context.
|
|
1824
|
+
* @returns ContextResult with created context data and requestId
|
|
1825
|
+
*/
|
|
1826
|
+
create(name: string): Promise<ContextResult>;
|
|
1827
|
+
/**
|
|
1828
|
+
* Updates the specified context.
|
|
1829
|
+
* Corresponds to Python's update() method
|
|
1830
|
+
*
|
|
1831
|
+
* @param context - The Context object to update.
|
|
1832
|
+
* @returns OperationResult with updated context data and requestId
|
|
1833
|
+
*/
|
|
1834
|
+
update(context: Context): Promise<OperationResult>;
|
|
1835
|
+
/**
|
|
1836
|
+
* Deletes the specified context.
|
|
1837
|
+
* Corresponds to Python's delete() method
|
|
1838
|
+
*
|
|
1839
|
+
* @param context - The Context object to delete.
|
|
1840
|
+
* @returns OperationResult with requestId
|
|
1841
|
+
*/
|
|
1842
|
+
delete(context: Context): Promise<OperationResult>;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
declare enum UploadStrategy {
|
|
1846
|
+
UploadBeforeResourceRelease = "UploadBeforeResourceRelease"
|
|
1847
|
+
}
|
|
1848
|
+
declare enum DownloadStrategy {
|
|
1849
|
+
DownloadAsync = "DownloadAsync"
|
|
1850
|
+
}
|
|
1851
|
+
interface UploadPolicy {
|
|
1852
|
+
autoUpload: boolean;
|
|
1853
|
+
uploadStrategy: UploadStrategy;
|
|
1854
|
+
period?: number;
|
|
1855
|
+
}
|
|
1856
|
+
interface DownloadPolicy {
|
|
1857
|
+
autoDownload: boolean;
|
|
1858
|
+
downloadStrategy: DownloadStrategy;
|
|
1859
|
+
}
|
|
1860
|
+
interface DeletePolicy {
|
|
1861
|
+
syncLocalFile: boolean;
|
|
1862
|
+
}
|
|
1863
|
+
interface WhiteList {
|
|
1864
|
+
path: string;
|
|
1865
|
+
excludePaths?: string[];
|
|
1866
|
+
}
|
|
1867
|
+
interface BWList {
|
|
1868
|
+
whiteLists?: WhiteList[];
|
|
1869
|
+
}
|
|
1870
|
+
interface SyncPolicy {
|
|
1871
|
+
uploadPolicy?: UploadPolicy;
|
|
1872
|
+
downloadPolicy?: DownloadPolicy;
|
|
1873
|
+
deletePolicy?: DeletePolicy;
|
|
1874
|
+
bwList?: BWList;
|
|
1875
|
+
}
|
|
1876
|
+
declare class SyncPolicyImpl implements SyncPolicy {
|
|
1877
|
+
uploadPolicy?: UploadPolicy;
|
|
1878
|
+
downloadPolicy?: DownloadPolicy;
|
|
1879
|
+
deletePolicy?: DeletePolicy;
|
|
1880
|
+
bwList?: BWList;
|
|
1881
|
+
constructor(policy?: Partial<SyncPolicy>);
|
|
1882
|
+
private ensureDefaults;
|
|
1883
|
+
toJSON(): SyncPolicy;
|
|
1884
|
+
}
|
|
1885
|
+
declare class ContextSync {
|
|
1886
|
+
contextId: string;
|
|
1887
|
+
path: string;
|
|
1888
|
+
policy?: SyncPolicy;
|
|
1889
|
+
constructor(contextId: string, path: string, policy?: SyncPolicy);
|
|
1890
|
+
withPolicy(policy: SyncPolicy): ContextSync;
|
|
1891
|
+
}
|
|
1892
|
+
declare function newUploadPolicy(): UploadPolicy;
|
|
1893
|
+
declare function newDownloadPolicy(): DownloadPolicy;
|
|
1894
|
+
declare function newDeletePolicy(): DeletePolicy;
|
|
1895
|
+
declare function newSyncPolicy(): SyncPolicy;
|
|
1896
|
+
declare function newSyncPolicyWithDefaults(policy?: Partial<SyncPolicy>): SyncPolicy;
|
|
1897
|
+
declare function newContextSync(contextId: string, path: string, policy?: SyncPolicy): ContextSync;
|
|
1898
|
+
|
|
1899
|
+
/**
|
|
1900
|
+
* Result of task execution.
|
|
1901
|
+
*/
|
|
1902
|
+
interface ExecutionResult extends ApiResponse {
|
|
1903
|
+
success: boolean;
|
|
1904
|
+
errorMessage: string;
|
|
1905
|
+
taskId: string;
|
|
1906
|
+
taskStatus: string;
|
|
1907
|
+
}
|
|
1908
|
+
/**
|
|
1909
|
+
* Result of query operations.
|
|
1910
|
+
*/
|
|
1911
|
+
interface QueryResult extends ApiResponse {
|
|
1912
|
+
success: boolean;
|
|
1913
|
+
output: string;
|
|
1914
|
+
errorMessage: string;
|
|
1915
|
+
}
|
|
1916
|
+
/**
|
|
1917
|
+
* Result of an MCP tool call.
|
|
1918
|
+
*/
|
|
1919
|
+
interface McpToolResult {
|
|
1920
|
+
success: boolean;
|
|
1921
|
+
data: string;
|
|
1922
|
+
errorMessage: string;
|
|
1923
|
+
requestId: string;
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
* Interface defining the methods needed by Agent from Session.
|
|
1927
|
+
*/
|
|
1928
|
+
interface McpSession {
|
|
1929
|
+
getAPIKey(): string;
|
|
1930
|
+
getSessionId(): string;
|
|
1931
|
+
callMcpTool(toolName: string, args: any): Promise<McpToolResult>;
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1934
|
+
* An Agent to manipulate applications to complete specific tasks.
|
|
1935
|
+
*/
|
|
1936
|
+
declare class Agent {
|
|
1937
|
+
private session;
|
|
1938
|
+
/**
|
|
1939
|
+
* Initialize an Agent object.
|
|
1940
|
+
*
|
|
1941
|
+
* @param session - The Session instance that this Agent belongs to.
|
|
1942
|
+
*/
|
|
1943
|
+
constructor(session: McpSession);
|
|
1944
|
+
/**
|
|
1945
|
+
* Execute a specific task described in human language.
|
|
1946
|
+
*
|
|
1947
|
+
* @param task - Task description in human language.
|
|
1948
|
+
* @param maxTryTimes - Maximum number of retry attempts.
|
|
1949
|
+
* @returns ExecutionResult containing success status, task output, and error message if any.
|
|
1950
|
+
*/
|
|
1951
|
+
executeTask(task: string, maxTryTimes: number): Promise<ExecutionResult>;
|
|
1952
|
+
/**
|
|
1953
|
+
* Get the status of the task with the given task ID.
|
|
1954
|
+
*
|
|
1955
|
+
* @param taskId - Task ID
|
|
1956
|
+
* @returns QueryResult containing the task status
|
|
1957
|
+
*/
|
|
1958
|
+
getTaskStatus(taskId: string): Promise<QueryResult>;
|
|
1959
|
+
/**
|
|
1960
|
+
* Terminate a task with a specified task ID.
|
|
1961
|
+
*
|
|
1962
|
+
* @param taskId - The ID of the running task.
|
|
1963
|
+
* @returns ExecutionResult containing success status, task output, and error message if any.
|
|
1964
|
+
*/
|
|
1965
|
+
terminateTask(taskId: string): Promise<ExecutionResult>;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
/**
|
|
1969
|
+
* Represents an installed application
|
|
1970
|
+
*/
|
|
1971
|
+
interface InstalledApp {
|
|
1972
|
+
name: string;
|
|
1973
|
+
start_cmd: string;
|
|
1974
|
+
stop_cmd?: string;
|
|
1975
|
+
work_directory?: string;
|
|
1976
|
+
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Represents a running process
|
|
1979
|
+
*/
|
|
1980
|
+
interface Process {
|
|
1981
|
+
pname: string;
|
|
1982
|
+
pid: number;
|
|
1983
|
+
cmdline?: string;
|
|
1984
|
+
path?: string;
|
|
1985
|
+
}
|
|
1986
|
+
/**
|
|
1987
|
+
* Handles application operations in the AgentBay cloud environment.
|
|
1988
|
+
*/
|
|
1989
|
+
declare class Application {
|
|
1990
|
+
private session;
|
|
1991
|
+
/**
|
|
1992
|
+
* Initialize an Application object.
|
|
1993
|
+
*
|
|
1994
|
+
* @param session - The Session instance that this Application belongs to.
|
|
1995
|
+
*/
|
|
1996
|
+
constructor(session: {
|
|
1997
|
+
getAPIKey(): string;
|
|
1998
|
+
getClient(): Client;
|
|
1999
|
+
getSessionId(): string;
|
|
2000
|
+
callMcpTool(toolName: string, args: any): Promise<{
|
|
2001
|
+
success: boolean;
|
|
2002
|
+
data: string;
|
|
2003
|
+
errorMessage: string;
|
|
2004
|
+
requestId: string;
|
|
2005
|
+
}>;
|
|
2006
|
+
});
|
|
2007
|
+
/**
|
|
2008
|
+
* Sanitizes error messages to remove sensitive information like API keys.
|
|
2009
|
+
*
|
|
2010
|
+
* @param error - The error to sanitize
|
|
2011
|
+
* @returns The sanitized error
|
|
2012
|
+
*/
|
|
2013
|
+
private sanitizeError;
|
|
2014
|
+
/**
|
|
2015
|
+
* Helper method to parse JSON string into objects
|
|
2016
|
+
*/
|
|
2017
|
+
private parseJSON;
|
|
2018
|
+
/**
|
|
2019
|
+
* Retrieves a list of installed applications.
|
|
2020
|
+
* Corresponds to Python's get_installed_apps() method
|
|
2021
|
+
*
|
|
2022
|
+
* @param startMenu - Whether to include applications from the start menu. Defaults to true.
|
|
2023
|
+
* @param desktop - Whether to include applications from the desktop. Defaults to true.
|
|
2024
|
+
* @param ignoreSystemApps - Whether to ignore system applications. Defaults to true.
|
|
2025
|
+
* @returns InstalledAppListResult with installed apps and requestId
|
|
2026
|
+
* @throws Error if the operation fails.
|
|
2027
|
+
*/
|
|
2028
|
+
getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<InstalledAppListResult>;
|
|
2029
|
+
/**
|
|
2030
|
+
* Starts an application with the given command and optional working directory.
|
|
2031
|
+
* Corresponds to Python's start_app() method
|
|
2032
|
+
*
|
|
2033
|
+
* @param startCmd - The command to start the application.
|
|
2034
|
+
* @param workDirectory - The working directory for the application. Defaults to an empty string.
|
|
2035
|
+
* @param activity - Activity name to launch (e.g. ".SettingsActivity" or "com.package/.Activity"). Defaults to an empty string.
|
|
2036
|
+
* @returns ProcessListResult with started processes and requestId
|
|
2037
|
+
* @throws Error if the operation fails.
|
|
2038
|
+
*/
|
|
2039
|
+
startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<ProcessListResult>;
|
|
2040
|
+
/**
|
|
2041
|
+
* Stops an application by process name.
|
|
2042
|
+
* Corresponds to Python's stop_app_by_pname() method
|
|
2043
|
+
*
|
|
2044
|
+
* @param pname - The process name to stop.
|
|
2045
|
+
* @returns AppOperationResult with operation result and requestId
|
|
2046
|
+
* @throws Error if the operation fails.
|
|
2047
|
+
*/
|
|
2048
|
+
stopAppByPName(pname: string): Promise<AppOperationResult>;
|
|
2049
|
+
/**
|
|
2050
|
+
* Stops an application by process ID.
|
|
2051
|
+
* Corresponds to Python's stop_app_by_pid() method
|
|
2052
|
+
*
|
|
2053
|
+
* @param pid - The process ID to stop.
|
|
2054
|
+
* @returns AppOperationResult with operation result and requestId
|
|
2055
|
+
* @throws Error if the operation fails.
|
|
2056
|
+
*/
|
|
2057
|
+
stopAppByPID(pid: number): Promise<AppOperationResult>;
|
|
2058
|
+
/**
|
|
2059
|
+
* Stops an application by stop command.
|
|
2060
|
+
* Corresponds to Python's stop_app_by_cmd() method
|
|
2061
|
+
*
|
|
2062
|
+
* @param stopCmd - The stop command to execute.
|
|
2063
|
+
* @returns AppOperationResult with operation result and requestId
|
|
2064
|
+
* @throws Error if the operation fails.
|
|
2065
|
+
*/
|
|
2066
|
+
stopAppByCmd(stopCmd: string): Promise<AppOperationResult>;
|
|
2067
|
+
/**
|
|
2068
|
+
* Returns a list of currently visible applications.
|
|
2069
|
+
* Corresponds to Python's list_visible_apps() method
|
|
2070
|
+
*
|
|
2071
|
+
* @returns ProcessListResult with visible apps and requestId
|
|
2072
|
+
* @throws Error if the operation fails.
|
|
2073
|
+
*/
|
|
2074
|
+
listVisibleApps(): Promise<ProcessListResult>;
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
/**
|
|
2078
|
+
* Handles code execution operations in the AgentBay cloud environment.
|
|
2079
|
+
*/
|
|
2080
|
+
declare class Code {
|
|
2081
|
+
private session;
|
|
2082
|
+
/**
|
|
2083
|
+
* Initialize a Code object.
|
|
2084
|
+
*
|
|
2085
|
+
* @param session - The Session instance that this Code belongs to.
|
|
2086
|
+
*/
|
|
2087
|
+
constructor(session: {
|
|
2088
|
+
getAPIKey(): string;
|
|
2089
|
+
getSessionId(): string;
|
|
2090
|
+
callMcpTool(toolName: string, args: any): Promise<{
|
|
2091
|
+
success: boolean;
|
|
2092
|
+
data: string;
|
|
2093
|
+
errorMessage: string;
|
|
2094
|
+
requestId: string;
|
|
2095
|
+
}>;
|
|
2096
|
+
});
|
|
2097
|
+
/**
|
|
2098
|
+
* Execute code in the specified language with a timeout.
|
|
2099
|
+
* Corresponds to Python's run_code() method
|
|
2100
|
+
*
|
|
2101
|
+
* @param code - The code to execute.
|
|
2102
|
+
* @param language - The programming language of the code. Must be either 'python' or 'javascript'.
|
|
2103
|
+
* @param timeoutS - The timeout for the code execution in seconds. Default is 300s.
|
|
2104
|
+
* @returns CodeExecutionResult with code execution output and requestId
|
|
2105
|
+
* @throws Error if an unsupported language is specified.
|
|
2106
|
+
*/
|
|
2107
|
+
runCode(code: string, language: string, timeoutS?: number): Promise<CodeExecutionResult>;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
/**
|
|
2111
|
+
* Handles command execution operations in the AgentBay cloud environment.
|
|
2112
|
+
*/
|
|
2113
|
+
declare class Command {
|
|
2114
|
+
private session;
|
|
2115
|
+
/**
|
|
2116
|
+
* Initialize a Command object.
|
|
2117
|
+
*
|
|
2118
|
+
* @param session - The Session instance that this Command belongs to.
|
|
2119
|
+
*/
|
|
2120
|
+
constructor(session: Session);
|
|
2121
|
+
/**
|
|
2122
|
+
* Sanitizes error messages to remove sensitive information like API keys.
|
|
2123
|
+
*
|
|
2124
|
+
* @param error - The error to sanitize
|
|
2125
|
+
* @returns The sanitized error
|
|
2126
|
+
*/
|
|
2127
|
+
private sanitizeError;
|
|
2128
|
+
/**
|
|
2129
|
+
* Execute a command in the session environment.
|
|
2130
|
+
* Corresponds to Python's execute_command() method
|
|
2131
|
+
*
|
|
2132
|
+
* @param command - The command to execute
|
|
2133
|
+
* @param timeoutMs - The timeout in milliseconds. Default is 1000ms.
|
|
2134
|
+
* @returns CommandResult with command output and requestId
|
|
2135
|
+
* @throws APIError if the operation fails.
|
|
2136
|
+
*/
|
|
2137
|
+
executeCommand(command: string, timeoutMs?: number): Promise<CommandResult>;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
interface ContextStatusData {
|
|
2141
|
+
contextId: string;
|
|
2142
|
+
path: string;
|
|
2143
|
+
errorMessage: string;
|
|
2144
|
+
status: string;
|
|
2145
|
+
startTime: number;
|
|
2146
|
+
finishTime: number;
|
|
2147
|
+
taskType: string;
|
|
2148
|
+
}
|
|
2149
|
+
interface ContextStatusItem {
|
|
2150
|
+
type: string;
|
|
2151
|
+
data: string;
|
|
2152
|
+
}
|
|
2153
|
+
interface ContextInfoResult extends ApiResponse {
|
|
2154
|
+
contextStatusData: ContextStatusData[];
|
|
2155
|
+
}
|
|
2156
|
+
interface ContextSyncResult extends ApiResponse {
|
|
2157
|
+
success: boolean;
|
|
2158
|
+
}
|
|
2159
|
+
interface SessionInterface {
|
|
2160
|
+
getAPIKey(): string;
|
|
2161
|
+
getClient(): Client;
|
|
2162
|
+
getSessionId(): string;
|
|
2163
|
+
}
|
|
2164
|
+
declare class ContextManager {
|
|
2165
|
+
private session;
|
|
2166
|
+
constructor(session: SessionInterface);
|
|
2167
|
+
info(): Promise<ContextInfoResult>;
|
|
2168
|
+
infoWithParams(contextId?: string, path?: string, taskType?: string): Promise<ContextInfoResult>;
|
|
2169
|
+
sync(): Promise<ContextSyncResult>;
|
|
2170
|
+
syncWithParams(contextId?: string, path?: string, mode?: string): Promise<ContextSyncResult>;
|
|
2171
|
+
}
|
|
2172
|
+
declare function newContextManager(session: SessionInterface): ContextManager;
|
|
2173
|
+
|
|
2174
|
+
/**
|
|
2175
|
+
* FileInfo represents information about a file or directory
|
|
2176
|
+
*/
|
|
2177
|
+
interface FileInfo {
|
|
2178
|
+
name: string;
|
|
2179
|
+
path: string;
|
|
2180
|
+
size: number;
|
|
2181
|
+
isDirectory: boolean;
|
|
2182
|
+
modTime: string;
|
|
2183
|
+
mode: string;
|
|
2184
|
+
owner?: string;
|
|
2185
|
+
group?: string;
|
|
2186
|
+
}
|
|
2187
|
+
/**
|
|
2188
|
+
* DirectoryEntry represents an entry in a directory listing
|
|
2189
|
+
*/
|
|
2190
|
+
interface DirectoryEntry {
|
|
2191
|
+
name: string;
|
|
2192
|
+
isDirectory: boolean;
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* Handles file operations in the AgentBay cloud environment.
|
|
2196
|
+
*/
|
|
2197
|
+
declare class FileSystem {
|
|
2198
|
+
private session;
|
|
2199
|
+
/**
|
|
2200
|
+
* Initialize a FileSystem object.
|
|
2201
|
+
*
|
|
2202
|
+
* @param session - The Session instance that this FileSystem belongs to.
|
|
2203
|
+
*/
|
|
2204
|
+
constructor(session: {
|
|
2205
|
+
getAPIKey(): string;
|
|
2206
|
+
getSessionId(): string;
|
|
2207
|
+
callMcpTool(toolName: string, args: any): Promise<{
|
|
2208
|
+
success: boolean;
|
|
2209
|
+
data: string;
|
|
2210
|
+
errorMessage: string;
|
|
2211
|
+
requestId: string;
|
|
2212
|
+
}>;
|
|
2213
|
+
});
|
|
2214
|
+
/**
|
|
2215
|
+
* Creates a new directory at the specified path.
|
|
2216
|
+
* Corresponds to Python's create_directory() method
|
|
2217
|
+
*
|
|
2218
|
+
* @param path - Path to the directory to create.
|
|
2219
|
+
* @returns BoolResult with creation result and requestId
|
|
2220
|
+
*/
|
|
2221
|
+
createDirectory(path: string): Promise<BoolResult>;
|
|
2222
|
+
/**
|
|
2223
|
+
* Edits a file by replacing occurrences of oldText with newText.
|
|
2224
|
+
* Corresponds to Python's edit_file() method
|
|
2225
|
+
*
|
|
2226
|
+
* @param path - Path to the file to edit.
|
|
2227
|
+
* @param edits - Array of edit operations, each containing oldText and newText.
|
|
2228
|
+
* @param dryRun - Optional: If true, preview changes without applying them.
|
|
2229
|
+
* @returns BoolResult with edit result and requestId
|
|
2230
|
+
*/
|
|
2231
|
+
editFile(path: string, edits: Array<{
|
|
2232
|
+
oldText: string;
|
|
2233
|
+
newText: string;
|
|
2234
|
+
}>, dryRun?: boolean): Promise<BoolResult>;
|
|
2235
|
+
/**
|
|
2236
|
+
* Gets information about a file or directory.
|
|
2237
|
+
* Corresponds to Python's get_file_info() method
|
|
2238
|
+
*
|
|
2239
|
+
* @param path - Path to the file or directory to inspect.
|
|
2240
|
+
* @returns FileInfoResult with file info and requestId
|
|
2241
|
+
*/
|
|
2242
|
+
getFileInfo(path: string): Promise<FileInfoResult>;
|
|
2243
|
+
/**
|
|
2244
|
+
* Lists the contents of a directory.
|
|
2245
|
+
* Corresponds to Python's list_directory() method
|
|
2246
|
+
*
|
|
2247
|
+
* @param path - Path to the directory to list.
|
|
2248
|
+
* @returns DirectoryListResult with directory entries and requestId
|
|
2249
|
+
*/
|
|
2250
|
+
listDirectory(path: string): Promise<DirectoryListResult>;
|
|
2251
|
+
/**
|
|
2252
|
+
* Moves a file or directory from source to destination.
|
|
2253
|
+
* Corresponds to Python's move_file() method
|
|
2254
|
+
*
|
|
2255
|
+
* @param source - Path to the source file or directory.
|
|
2256
|
+
* @param destination - Path to the destination file or directory.
|
|
2257
|
+
* @returns BoolResult with move result and requestId
|
|
2258
|
+
*/
|
|
2259
|
+
moveFile(source: string, destination: string): Promise<BoolResult>;
|
|
2260
|
+
/**
|
|
2261
|
+
* Reads the content of a file.
|
|
2262
|
+
* Corresponds to Python's read_file() method
|
|
2263
|
+
*
|
|
2264
|
+
* @param path - Path to the file to read.
|
|
2265
|
+
* @param offset - Optional: Byte offset to start reading from (0-based).
|
|
2266
|
+
* @param length - Optional: Number of bytes to read. If 0, reads the entire file from offset.
|
|
2267
|
+
* @returns FileContentResult with file content and requestId
|
|
2268
|
+
*/
|
|
2269
|
+
readFile(path: string, offset?: number, length?: number): Promise<FileContentResult>;
|
|
2270
|
+
/**
|
|
2271
|
+
* Reads the content of multiple files.
|
|
2272
|
+
* Corresponds to Python's read_multiple_files() method
|
|
2273
|
+
*
|
|
2274
|
+
* @param paths - Array of file paths to read.
|
|
2275
|
+
* @returns MultipleFileContentResult with file contents and requestId
|
|
2276
|
+
*/
|
|
2277
|
+
readMultipleFiles(paths: string[]): Promise<MultipleFileContentResult>;
|
|
2278
|
+
/**
|
|
2279
|
+
* Searches for files in a directory that match a pattern.
|
|
2280
|
+
* Corresponds to Python's search_files() method
|
|
2281
|
+
*
|
|
2282
|
+
* @param path - Path to the directory to search in.
|
|
2283
|
+
* @param pattern - Pattern to search for. Supports glob patterns.
|
|
2284
|
+
* @param excludePatterns - Optional: Array of patterns to exclude.
|
|
2285
|
+
* @returns FileSearchResult with search results and requestId
|
|
2286
|
+
*/
|
|
2287
|
+
searchFiles(path: string, pattern: string, excludePatterns?: string[]): Promise<FileSearchResult>;
|
|
2288
|
+
/**
|
|
2289
|
+
* Writes content to a file.
|
|
2290
|
+
* Corresponds to Python's write_file() method
|
|
2291
|
+
*
|
|
2292
|
+
* @param path - Path to the file to write.
|
|
2293
|
+
* @param content - Content to write to the file.
|
|
2294
|
+
* @param mode - Optional: Write mode. One of "overwrite", "append", or "create_new". Default is "overwrite".
|
|
2295
|
+
* @returns BoolResult with write result and requestId
|
|
2296
|
+
*/
|
|
2297
|
+
writeFile(path: string, content: string, mode?: string): Promise<BoolResult>;
|
|
2298
|
+
/**
|
|
2299
|
+
* Reads a large file in chunks to handle size limitations of the underlying API.
|
|
2300
|
+
* Corresponds to Python's read_large_file() method
|
|
2301
|
+
*
|
|
2302
|
+
* @param path - Path to the file to read.
|
|
2303
|
+
* @param chunkSize - Optional: Size of each chunk in bytes. Default is 60KB.
|
|
2304
|
+
* @returns FileContentResult with complete file content and requestId
|
|
2305
|
+
*/
|
|
2306
|
+
readLargeFile(path: string, chunkSize?: number): Promise<FileContentResult>;
|
|
2307
|
+
/**
|
|
2308
|
+
* Writes a large file in chunks to handle size limitations of the underlying API.
|
|
2309
|
+
* Corresponds to Python's write_large_file() method
|
|
2310
|
+
*
|
|
2311
|
+
* @param path - Path to the file to write.
|
|
2312
|
+
* @param content - Content to write to the file.
|
|
2313
|
+
* @param chunkSize - Optional: Size of each chunk in bytes. Default is 60KB.
|
|
2314
|
+
* @returns BoolResult indicating success or failure with requestId
|
|
2315
|
+
*/
|
|
2316
|
+
writeLargeFile(path: string, content: string, chunkSize?: number): Promise<BoolResult>;
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
/**
|
|
2320
|
+
* Handles OSS operations in the AgentBay cloud environment.
|
|
2321
|
+
*/
|
|
2322
|
+
declare class Oss {
|
|
2323
|
+
private session;
|
|
2324
|
+
/**
|
|
2325
|
+
* Initialize an Oss object.
|
|
2326
|
+
*
|
|
2327
|
+
* @param session - The Session instance that this Oss belongs to.
|
|
2328
|
+
*/
|
|
2329
|
+
constructor(session: Session);
|
|
2330
|
+
/**
|
|
2331
|
+
* Sanitizes error messages to remove sensitive information like API keys.
|
|
2332
|
+
*
|
|
2333
|
+
* @param error - The error to sanitize
|
|
2334
|
+
* @returns The sanitized error
|
|
2335
|
+
*/
|
|
2336
|
+
private sanitizeError;
|
|
2337
|
+
/**
|
|
2338
|
+
* Initialize OSS environment variables with the specified credentials.
|
|
2339
|
+
* Corresponds to Python's env_init() method
|
|
2340
|
+
*
|
|
2341
|
+
* @param accessKeyId - The access key ID
|
|
2342
|
+
* @param accessKeySecret - The access key secret
|
|
2343
|
+
* @param securityToken - The security token (optional)
|
|
2344
|
+
* @param endpoint - The OSS endpoint (optional)
|
|
2345
|
+
* @param region - The OSS region (optional)
|
|
2346
|
+
* @returns OSSClientResult with client configuration and requestId
|
|
2347
|
+
* @throws APIError if the operation fails.
|
|
2348
|
+
*/
|
|
2349
|
+
envInit(accessKeyId: string, accessKeySecret: string, securityToken?: string, endpoint?: string, region?: string): Promise<OSSClientResult>;
|
|
2350
|
+
/**
|
|
2351
|
+
* Upload a file to OSS.
|
|
2352
|
+
* Corresponds to Python's upload() method
|
|
2353
|
+
*
|
|
2354
|
+
* @param bucket - The OSS bucket name
|
|
2355
|
+
* @param object - The OSS object key
|
|
2356
|
+
* @param path - The local file path to upload
|
|
2357
|
+
* @returns OSSUploadResult with upload result and requestId
|
|
2358
|
+
* @throws APIError if the operation fails.
|
|
2359
|
+
*/
|
|
2360
|
+
upload(bucket: string, object: string, path: string): Promise<OSSUploadResult>;
|
|
2361
|
+
/**
|
|
2362
|
+
* Upload a file to OSS using an anonymous URL.
|
|
2363
|
+
* Corresponds to Python's upload_anonymous() method
|
|
2364
|
+
*
|
|
2365
|
+
* @param url - The anonymous upload URL
|
|
2366
|
+
* @param path - The local file path to upload
|
|
2367
|
+
* @returns OSSUploadResult with upload result and requestId
|
|
2368
|
+
* @throws APIError if the operation fails.
|
|
2369
|
+
*/
|
|
2370
|
+
uploadAnonymous(url: string, path: string): Promise<OSSUploadResult>;
|
|
2371
|
+
/**
|
|
2372
|
+
* Download a file from OSS.
|
|
2373
|
+
* Corresponds to Python's download() method
|
|
2374
|
+
*
|
|
2375
|
+
* @param bucket - The OSS bucket name
|
|
2376
|
+
* @param object - The OSS object key
|
|
2377
|
+
* @param path - The local file path to save the downloaded file
|
|
2378
|
+
* @returns OSSDownloadResult with download result and requestId
|
|
2379
|
+
* @throws APIError if the operation fails.
|
|
2380
|
+
*/
|
|
2381
|
+
download(bucket: string, object: string, path: string): Promise<OSSDownloadResult>;
|
|
2382
|
+
/**
|
|
2383
|
+
* Download a file from OSS using an anonymous URL.
|
|
2384
|
+
* Corresponds to Python's download_anonymous() method
|
|
2385
|
+
*
|
|
2386
|
+
* @param url - The anonymous download URL
|
|
2387
|
+
* @param path - The local file path to save the downloaded file
|
|
2388
|
+
* @returns OSSDownloadResult with download result and requestId
|
|
2389
|
+
* @throws APIError if the operation fails.
|
|
2390
|
+
*/
|
|
2391
|
+
downloadAnonymous(url: string, path: string): Promise<OSSDownloadResult>;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
/**
|
|
2395
|
+
* Key codes for UI operations
|
|
2396
|
+
*/
|
|
2397
|
+
declare enum KeyCode {
|
|
2398
|
+
HOME = 3,
|
|
2399
|
+
BACK = 4,
|
|
2400
|
+
VOLUME_UP = 24,
|
|
2401
|
+
VOLUME_DOWN = 25,
|
|
2402
|
+
POWER = 26,
|
|
2403
|
+
MENU = 82
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
* Interface representing a UI element in the UI hierarchy
|
|
2407
|
+
*/
|
|
2408
|
+
interface UIElement {
|
|
2409
|
+
bounds: string;
|
|
2410
|
+
className: string;
|
|
2411
|
+
text: string;
|
|
2412
|
+
type: string;
|
|
2413
|
+
resourceId: string;
|
|
2414
|
+
index: number;
|
|
2415
|
+
isParent: boolean;
|
|
2416
|
+
children?: UIElement[];
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* Handles UI operations in the AgentBay cloud environment.
|
|
2420
|
+
*/
|
|
2421
|
+
declare class UI {
|
|
2422
|
+
private session;
|
|
2423
|
+
/**
|
|
2424
|
+
* Initialize a UI object.
|
|
2425
|
+
*
|
|
2426
|
+
* @param session - The Session instance that this UI belongs to.
|
|
2427
|
+
*/
|
|
2428
|
+
constructor(session: {
|
|
2429
|
+
getAPIKey(): string;
|
|
2430
|
+
getClient(): any;
|
|
2431
|
+
getSessionId(): string;
|
|
2432
|
+
callMcpTool(toolName: string, args: any): Promise<{
|
|
2433
|
+
success: boolean;
|
|
2434
|
+
data: string;
|
|
2435
|
+
errorMessage: string;
|
|
2436
|
+
requestId: string;
|
|
2437
|
+
}>;
|
|
2438
|
+
});
|
|
2439
|
+
/**
|
|
2440
|
+
* Sanitizes error messages to remove sensitive information like API keys.
|
|
2441
|
+
*
|
|
2442
|
+
* @param error - The error to sanitize
|
|
2443
|
+
* @returns The sanitized error
|
|
2444
|
+
*/
|
|
2445
|
+
private sanitizeError;
|
|
2446
|
+
/**
|
|
2447
|
+
* Retrieves all clickable UI elements within the specified timeout.
|
|
2448
|
+
* Corresponds to Python's get_clickable_ui_elements() method
|
|
2449
|
+
*
|
|
2450
|
+
* @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
|
|
2451
|
+
* @returns UIElementListResult with clickable UI elements and requestId
|
|
2452
|
+
* @throws APIError if the operation fails.
|
|
2453
|
+
*/
|
|
2454
|
+
getClickableUIElements(timeoutMs?: number): Promise<UIElementListResult>;
|
|
2455
|
+
/**
|
|
2456
|
+
* Retrieves all UI elements regardless of their clickable status.
|
|
2457
|
+
* Corresponds to Python's get_all_ui_elements() method
|
|
2458
|
+
*
|
|
2459
|
+
* @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
|
|
2460
|
+
* @returns UIElementListResult with all UI elements and requestId
|
|
2461
|
+
* @throws APIError if the operation fails.
|
|
1310
2462
|
*/
|
|
1311
|
-
|
|
2463
|
+
getAllUIElements(timeoutMs?: number): Promise<UIElementListResult>;
|
|
1312
2464
|
/**
|
|
1313
|
-
*
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1316
|
-
* @
|
|
1317
|
-
*
|
|
2465
|
+
* Sends a key press event.
|
|
2466
|
+
* Corresponds to Python's send_key() method
|
|
2467
|
+
*
|
|
2468
|
+
* @param key - The key code to send. Supported key codes are:
|
|
2469
|
+
* - 3 : HOME
|
|
2470
|
+
* - 4 : BACK
|
|
2471
|
+
* - 24 : VOLUME UP
|
|
2472
|
+
* - 25 : VOLUME DOWN
|
|
2473
|
+
* - 26 : POWER
|
|
2474
|
+
* - 82 : MENU
|
|
2475
|
+
* @returns BoolResult with success status and requestId
|
|
2476
|
+
* @throws APIError if the operation fails.
|
|
1318
2477
|
*/
|
|
1319
|
-
|
|
2478
|
+
sendKey(key: number): Promise<BoolResult>;
|
|
1320
2479
|
/**
|
|
1321
|
-
*
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
2480
|
+
* Inputs text into the currently focused UI element.
|
|
2481
|
+
* Corresponds to Python's input_text() method
|
|
2482
|
+
*
|
|
2483
|
+
* @param text - The text to input
|
|
2484
|
+
* @returns BoolResult with success status and requestId
|
|
2485
|
+
* @throws APIError if the operation fails.
|
|
1324
2486
|
*/
|
|
1325
|
-
|
|
2487
|
+
inputText(text: string): Promise<BoolResult>;
|
|
1326
2488
|
/**
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
1329
|
-
*
|
|
2489
|
+
* Performs a swipe gesture on the screen.
|
|
2490
|
+
* Corresponds to Python's swipe() method
|
|
2491
|
+
*
|
|
2492
|
+
* @param startX - The starting X coordinate
|
|
2493
|
+
* @param startY - The starting Y coordinate
|
|
2494
|
+
* @param endX - The ending X coordinate
|
|
2495
|
+
* @param endY - The ending Y coordinate
|
|
2496
|
+
* @param durationMs - The duration of the swipe in milliseconds. Default is 300ms.
|
|
2497
|
+
* @returns BoolResult with success status and requestId
|
|
2498
|
+
* @throws APIError if the operation fails.
|
|
1330
2499
|
*/
|
|
1331
|
-
|
|
2500
|
+
swipe(startX: number, startY: number, endX: number, endY: number, durationMs?: number): Promise<BoolResult>;
|
|
1332
2501
|
/**
|
|
1333
|
-
*
|
|
1334
|
-
*
|
|
1335
|
-
*
|
|
2502
|
+
* Clicks on the screen at the specified coordinates.
|
|
2503
|
+
* Corresponds to Python's click() method
|
|
2504
|
+
*
|
|
2505
|
+
* @param x - The X coordinate
|
|
2506
|
+
* @param y - The Y coordinate
|
|
2507
|
+
* @param button - The mouse button to use. Default is 'left'
|
|
2508
|
+
* @returns BoolResult with success status and requestId
|
|
2509
|
+
* @throws APIError if the operation fails.
|
|
1336
2510
|
*/
|
|
1337
|
-
|
|
2511
|
+
click(x: number, y: number, button?: string): Promise<BoolResult>;
|
|
1338
2512
|
/**
|
|
1339
|
-
*
|
|
1340
|
-
*
|
|
1341
|
-
*
|
|
2513
|
+
* Takes a screenshot of the current screen.
|
|
2514
|
+
* Corresponds to Python's screenshot() method
|
|
2515
|
+
*
|
|
2516
|
+
* @returns OperationResult with success status and requestId
|
|
2517
|
+
* @throws APIError if the operation fails.
|
|
1342
2518
|
*/
|
|
1343
|
-
|
|
2519
|
+
screenshot(): Promise<OperationResult>;
|
|
1344
2520
|
}
|
|
1345
2521
|
|
|
1346
|
-
/**
|
|
1347
|
-
* Represents a window in the system.
|
|
1348
|
-
*/
|
|
1349
|
-
interface Window {
|
|
1350
|
-
window_id: number;
|
|
1351
|
-
title: string;
|
|
1352
|
-
absolute_upper_left_x?: number;
|
|
1353
|
-
absolute_upper_left_y?: number;
|
|
1354
|
-
width?: number;
|
|
1355
|
-
height?: number;
|
|
1356
|
-
pid?: number;
|
|
1357
|
-
pname?: string;
|
|
1358
|
-
child_windows?: Window[];
|
|
1359
|
-
}
|
|
1360
2522
|
/**
|
|
1361
2523
|
* Handles window management operations in the AgentBay cloud environment.
|
|
1362
2524
|
*/
|
|
@@ -1368,19 +2530,14 @@ declare class WindowManager {
|
|
|
1368
2530
|
*/
|
|
1369
2531
|
constructor(session: {
|
|
1370
2532
|
getAPIKey(): string;
|
|
1371
|
-
getClient(): any;
|
|
1372
2533
|
getSessionId(): string;
|
|
2534
|
+
callMcpTool(toolName: string, args: any): Promise<{
|
|
2535
|
+
success: boolean;
|
|
2536
|
+
data: string;
|
|
2537
|
+
errorMessage: string;
|
|
2538
|
+
requestId: string;
|
|
2539
|
+
}>;
|
|
1373
2540
|
});
|
|
1374
|
-
/**
|
|
1375
|
-
* Helper method to call MCP tools and handle common response processing
|
|
1376
|
-
*
|
|
1377
|
-
* @param toolName - Name of the MCP tool to call
|
|
1378
|
-
* @param args - Arguments to pass to the tool
|
|
1379
|
-
* @param defaultErrorMsg - Default error message if specific error details are not available
|
|
1380
|
-
* @returns A CallMcpToolResult with the response data
|
|
1381
|
-
* @throws APIError if the call fails
|
|
1382
|
-
*/
|
|
1383
|
-
private callMcpTool;
|
|
1384
2541
|
/**
|
|
1385
2542
|
* Helper method to parse JSON string into Window objects
|
|
1386
2543
|
* @param jsonStr - JSON string to parse
|
|
@@ -1389,202 +2546,227 @@ declare class WindowManager {
|
|
|
1389
2546
|
private parseWindowsFromJSON;
|
|
1390
2547
|
/**
|
|
1391
2548
|
* Lists all root windows in the system.
|
|
1392
|
-
*
|
|
1393
|
-
*
|
|
2549
|
+
* Corresponds to Python's list_root_windows() method
|
|
2550
|
+
*
|
|
2551
|
+
* @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
|
|
2552
|
+
* @returns WindowListResult with windows array and requestId
|
|
1394
2553
|
*/
|
|
1395
|
-
listRootWindows(): Promise<
|
|
2554
|
+
listRootWindows(timeoutMs?: number): Promise<WindowListResult>;
|
|
1396
2555
|
/**
|
|
1397
2556
|
* Gets the currently active window.
|
|
1398
|
-
*
|
|
1399
|
-
*
|
|
2557
|
+
* Corresponds to Python's get_active_window() method
|
|
2558
|
+
*
|
|
2559
|
+
* @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
|
|
2560
|
+
* @returns WindowInfoResult with active window data and requestId
|
|
1400
2561
|
*/
|
|
1401
|
-
getActiveWindow(): Promise<
|
|
2562
|
+
getActiveWindow(timeoutMs?: number): Promise<WindowInfoResult>;
|
|
1402
2563
|
/**
|
|
1403
2564
|
* Activates a window by ID.
|
|
2565
|
+
* Corresponds to Python's activate_window() method
|
|
2566
|
+
*
|
|
1404
2567
|
* @param windowId The ID of the window to activate.
|
|
1405
|
-
* @
|
|
2568
|
+
* @returns BoolResult with requestId
|
|
1406
2569
|
*/
|
|
1407
|
-
activateWindow(windowId: number): Promise<
|
|
2570
|
+
activateWindow(windowId: number): Promise<BoolResult>;
|
|
1408
2571
|
/**
|
|
1409
2572
|
* Maximizes a window by ID.
|
|
2573
|
+
* Corresponds to Python's maximize_window() method
|
|
2574
|
+
*
|
|
1410
2575
|
* @param windowId The ID of the window to maximize.
|
|
1411
|
-
* @
|
|
2576
|
+
* @returns BoolResult with requestId
|
|
1412
2577
|
*/
|
|
1413
|
-
maximizeWindow(windowId: number): Promise<
|
|
2578
|
+
maximizeWindow(windowId: number): Promise<BoolResult>;
|
|
1414
2579
|
/**
|
|
1415
2580
|
* Minimizes a window by ID.
|
|
2581
|
+
* Corresponds to Python's minimize_window() method
|
|
2582
|
+
*
|
|
1416
2583
|
* @param windowId The ID of the window to minimize.
|
|
1417
|
-
* @
|
|
2584
|
+
* @returns BoolResult with requestId
|
|
1418
2585
|
*/
|
|
1419
|
-
minimizeWindow(windowId: number): Promise<
|
|
2586
|
+
minimizeWindow(windowId: number): Promise<BoolResult>;
|
|
1420
2587
|
/**
|
|
1421
2588
|
* Restores a window by ID.
|
|
2589
|
+
* Corresponds to Python's restore_window() method
|
|
2590
|
+
*
|
|
1422
2591
|
* @param windowId The ID of the window to restore.
|
|
1423
|
-
* @
|
|
2592
|
+
* @returns BoolResult with requestId
|
|
1424
2593
|
*/
|
|
1425
|
-
restoreWindow(windowId: number): Promise<
|
|
2594
|
+
restoreWindow(windowId: number): Promise<BoolResult>;
|
|
1426
2595
|
/**
|
|
1427
2596
|
* Closes a window by ID.
|
|
2597
|
+
* Corresponds to Python's close_window() method
|
|
2598
|
+
*
|
|
1428
2599
|
* @param windowId The ID of the window to close.
|
|
1429
|
-
* @
|
|
2600
|
+
* @returns BoolResult with requestId
|
|
1430
2601
|
*/
|
|
1431
|
-
closeWindow(windowId: number): Promise<
|
|
2602
|
+
closeWindow(windowId: number): Promise<BoolResult>;
|
|
1432
2603
|
/**
|
|
1433
2604
|
* Sets a window to fullscreen by ID.
|
|
2605
|
+
* Corresponds to Python's fullscreen_window() method
|
|
2606
|
+
*
|
|
1434
2607
|
* @param windowId The ID of the window to set to fullscreen.
|
|
1435
|
-
* @
|
|
2608
|
+
* @returns BoolResult with requestId
|
|
1436
2609
|
*/
|
|
1437
|
-
fullscreenWindow(windowId: number): Promise<
|
|
2610
|
+
fullscreenWindow(windowId: number): Promise<BoolResult>;
|
|
1438
2611
|
/**
|
|
1439
2612
|
* Resizes a window by ID.
|
|
2613
|
+
* Corresponds to Python's resize_window() method
|
|
2614
|
+
*
|
|
1440
2615
|
* @param windowId The ID of the window to resize.
|
|
1441
2616
|
* @param width The new width of the window.
|
|
1442
2617
|
* @param height The new height of the window.
|
|
1443
|
-
* @
|
|
2618
|
+
* @returns BoolResult with requestId
|
|
1444
2619
|
*/
|
|
1445
|
-
resizeWindow(windowId: number, width: number, height: number): Promise<
|
|
2620
|
+
resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult>;
|
|
1446
2621
|
/**
|
|
1447
2622
|
* Enables or disables focus mode.
|
|
2623
|
+
* Corresponds to Python's focus_mode() method
|
|
2624
|
+
*
|
|
1448
2625
|
* @param on Whether to enable focus mode.
|
|
1449
|
-
* @
|
|
2626
|
+
* @returns BoolResult with requestId
|
|
1450
2627
|
*/
|
|
1451
|
-
focusMode(on: boolean): Promise<
|
|
2628
|
+
focusMode(on: boolean): Promise<BoolResult>;
|
|
1452
2629
|
}
|
|
1453
2630
|
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
2631
|
+
interface ActOptions {
|
|
2632
|
+
action: string;
|
|
2633
|
+
timeoutMS?: number;
|
|
2634
|
+
iframes?: boolean;
|
|
2635
|
+
domSettleTimeoutMS?: number;
|
|
2636
|
+
}
|
|
2637
|
+
interface ObserveOptions {
|
|
2638
|
+
instruction: string;
|
|
2639
|
+
returnActions?: number;
|
|
2640
|
+
iframes?: boolean;
|
|
2641
|
+
domSettleTimeoutMS?: number;
|
|
2642
|
+
}
|
|
2643
|
+
interface ExtractOptions<T = any> {
|
|
2644
|
+
instruction: string;
|
|
2645
|
+
schema: new (...args: any[]) => T;
|
|
2646
|
+
selector?: string;
|
|
2647
|
+
iframe?: boolean;
|
|
2648
|
+
domSettleTimeoutsMS?: number;
|
|
2649
|
+
}
|
|
2650
|
+
declare class ActResult {
|
|
2651
|
+
success: boolean;
|
|
2652
|
+
message: string;
|
|
2653
|
+
action: string;
|
|
2654
|
+
constructor(success: boolean, message: string, action: string);
|
|
2655
|
+
}
|
|
2656
|
+
declare class ObserveResult {
|
|
2657
|
+
selector: string;
|
|
2658
|
+
description: string;
|
|
2659
|
+
method: string;
|
|
2660
|
+
args: Record<string, any>;
|
|
2661
|
+
constructor(selector: string, description: string, method: string, args: Record<string, any>);
|
|
2662
|
+
}
|
|
2663
|
+
declare class BrowserAgent {
|
|
1482
2664
|
private session;
|
|
2665
|
+
private browser;
|
|
2666
|
+
constructor(session: Session, browser: Browser);
|
|
1483
2667
|
/**
|
|
1484
|
-
*
|
|
1485
|
-
*
|
|
1486
|
-
* @param session - The Session instance that this UI belongs to.
|
|
2668
|
+
* Perform an action on the given Playwright Page object, using ActOptions to configure behavior.
|
|
2669
|
+
* Returns the result of the action.
|
|
1487
2670
|
*/
|
|
1488
|
-
|
|
2671
|
+
act(page: any, options: ActOptions): Promise<ActResult>;
|
|
1489
2672
|
/**
|
|
1490
|
-
*
|
|
1491
|
-
*
|
|
1492
|
-
* @param toolName - Name of the MCP tool to call
|
|
1493
|
-
* @param args - Arguments to pass to the tool
|
|
1494
|
-
* @param defaultErrorMsg - Default error message if specific error details are not available
|
|
1495
|
-
* @returns A CallMcpToolResult with the response data
|
|
1496
|
-
* @throws APIError if the call fails
|
|
2673
|
+
* Async version of act method for performing actions on the given Playwright Page object.
|
|
1497
2674
|
*/
|
|
1498
|
-
|
|
2675
|
+
actAsync(page: any, options: ActOptions): Promise<ActResult>;
|
|
1499
2676
|
/**
|
|
1500
|
-
*
|
|
1501
|
-
*
|
|
1502
|
-
* @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
|
|
1503
|
-
* @returns An array of UIElement objects
|
|
1504
|
-
* @throws Error if the operation fails.
|
|
2677
|
+
* Observe elements or state on the given Playwright Page object.
|
|
2678
|
+
* Returns a tuple containing (success, results).
|
|
1505
2679
|
*/
|
|
1506
|
-
|
|
2680
|
+
observe(page: any, options: ObserveOptions): Promise<[boolean, ObserveResult[]]>;
|
|
1507
2681
|
/**
|
|
1508
|
-
*
|
|
1509
|
-
*
|
|
1510
|
-
* @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
|
|
1511
|
-
* @returns An array of UIElement objects
|
|
1512
|
-
* @throws Error if the operation fails.
|
|
2682
|
+
* Async version of observe method.
|
|
1513
2683
|
*/
|
|
1514
|
-
|
|
2684
|
+
observeAsync(page: any, options: ObserveOptions): Promise<[boolean, ObserveResult[]]>;
|
|
1515
2685
|
/**
|
|
1516
|
-
*
|
|
1517
|
-
*
|
|
1518
|
-
* @param key - The key code to send.
|
|
1519
|
-
* @returns The extracted text content from the API response
|
|
1520
|
-
* @throws Error if the operation fails.
|
|
2686
|
+
* Extract information from the given Playwright Page object.
|
|
1521
2687
|
*/
|
|
1522
|
-
|
|
2688
|
+
extract<T>(page: any, options: ExtractOptions<T>): Promise<[boolean, T[]]>;
|
|
1523
2689
|
/**
|
|
1524
|
-
*
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
2690
|
+
* Async version of extract method.
|
|
2691
|
+
*/
|
|
2692
|
+
extractAsync<T>(page: any, options: ExtractOptions<T>): Promise<[boolean, T[]]>;
|
|
2693
|
+
private _getPageAndContextIndex;
|
|
2694
|
+
private _getPageAndContextIndexAsync;
|
|
2695
|
+
private _callMcpTool;
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
interface BrowserOption {
|
|
2699
|
+
persistentPath?: string;
|
|
2700
|
+
}
|
|
2701
|
+
declare class Browser {
|
|
2702
|
+
private session;
|
|
2703
|
+
private _endpointUrl;
|
|
2704
|
+
private _initialized;
|
|
2705
|
+
private _option;
|
|
2706
|
+
agent: BrowserAgent;
|
|
2707
|
+
constructor(session: Session);
|
|
2708
|
+
/**
|
|
2709
|
+
* Initialize the browser instance with the given options.
|
|
2710
|
+
* Returns true if successful, false otherwise.
|
|
1529
2711
|
*/
|
|
1530
|
-
|
|
2712
|
+
initialize(option: BrowserOption): boolean;
|
|
1531
2713
|
/**
|
|
1532
|
-
*
|
|
1533
|
-
*
|
|
1534
|
-
* @param startX - The starting X coordinate.
|
|
1535
|
-
* @param startY - The starting Y coordinate.
|
|
1536
|
-
* @param endX - The ending X coordinate.
|
|
1537
|
-
* @param endY - The ending Y coordinate.
|
|
1538
|
-
* @param durationMs - The duration of the swipe in milliseconds. Default is 300ms.
|
|
1539
|
-
* @returns The extracted text content from the API response
|
|
1540
|
-
* @throws Error if the operation fails.
|
|
2714
|
+
* Initialize the browser instance with the given options asynchronously.
|
|
2715
|
+
* Returns true if successful, false otherwise.
|
|
1541
2716
|
*/
|
|
1542
|
-
|
|
2717
|
+
initializeAsync(option: BrowserOption): Promise<boolean>;
|
|
1543
2718
|
/**
|
|
1544
|
-
*
|
|
1545
|
-
*
|
|
1546
|
-
* @param x - The X coordinate.
|
|
1547
|
-
* @param y - The Y coordinate.
|
|
1548
|
-
* @param button - The mouse button to click. Default is 'left'.
|
|
1549
|
-
* @returns The extracted text content from the API response
|
|
1550
|
-
* @throws Error if the operation fails.
|
|
2719
|
+
* Returns the endpoint URL if the browser is initialized, otherwise throws an exception.
|
|
2720
|
+
* When initialized, always fetches the latest CDP url from session.getLink().
|
|
1551
2721
|
*/
|
|
1552
|
-
|
|
2722
|
+
getEndpointUrl(): Promise<string>;
|
|
1553
2723
|
/**
|
|
1554
|
-
*
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
2724
|
+
* Returns the current BrowserOption used to initialize the browser, or null if not set.
|
|
2725
|
+
*/
|
|
2726
|
+
getOption(): BrowserOption | null;
|
|
2727
|
+
/**
|
|
2728
|
+
* Returns true if the browser was initialized, false otherwise.
|
|
1558
2729
|
*/
|
|
1559
|
-
|
|
2730
|
+
isInitialized(): boolean;
|
|
1560
2731
|
}
|
|
1561
2732
|
|
|
1562
2733
|
/**
|
|
1563
|
-
*
|
|
2734
|
+
* Represents an MCP tool with complete information.
|
|
1564
2735
|
*/
|
|
1565
|
-
interface
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
2736
|
+
interface McpTool {
|
|
2737
|
+
name: string;
|
|
2738
|
+
description: string;
|
|
2739
|
+
inputSchema: Record<string, any>;
|
|
2740
|
+
server: string;
|
|
2741
|
+
tool: string;
|
|
2742
|
+
}
|
|
2743
|
+
/**
|
|
2744
|
+
* Result containing MCP tools list and request ID.
|
|
2745
|
+
*/
|
|
2746
|
+
interface McpToolsResult extends OperationResult {
|
|
2747
|
+
tools: McpTool[];
|
|
1573
2748
|
}
|
|
1574
2749
|
/**
|
|
1575
2750
|
* Represents a session in the AgentBay cloud environment.
|
|
1576
2751
|
*/
|
|
1577
2752
|
declare class Session {
|
|
1578
2753
|
private agentBay;
|
|
1579
|
-
client: Client;
|
|
1580
2754
|
sessionId: string;
|
|
1581
2755
|
resourceUrl: string;
|
|
1582
|
-
|
|
2756
|
+
isVpc: boolean;
|
|
2757
|
+
networkInterfaceIp: string;
|
|
2758
|
+
httpPort: string;
|
|
2759
|
+
fileSystem: FileSystem;
|
|
1583
2760
|
command: Command;
|
|
2761
|
+
code: Code;
|
|
1584
2762
|
oss: Oss;
|
|
1585
|
-
|
|
2763
|
+
application: Application;
|
|
1586
2764
|
window: WindowManager;
|
|
1587
2765
|
ui: UI;
|
|
2766
|
+
agent: Agent;
|
|
2767
|
+
browser: Browser;
|
|
2768
|
+
context: ContextManager;
|
|
2769
|
+
mcpTools: McpTool[];
|
|
1588
2770
|
/**
|
|
1589
2771
|
* Initialize a Session object.
|
|
1590
2772
|
*
|
|
@@ -1593,151 +2775,259 @@ declare class Session {
|
|
|
1593
2775
|
*/
|
|
1594
2776
|
constructor(agentBay: AgentBay, sessionId: string);
|
|
1595
2777
|
/**
|
|
1596
|
-
*
|
|
1597
|
-
|
|
1598
|
-
|
|
2778
|
+
* Return the API key for this session.
|
|
2779
|
+
*/
|
|
2780
|
+
getAPIKey(): string;
|
|
2781
|
+
/**
|
|
2782
|
+
* Return the HTTP client for this session.
|
|
2783
|
+
*/
|
|
2784
|
+
getClient(): Client;
|
|
2785
|
+
/**
|
|
2786
|
+
* Return the session_id for this session.
|
|
2787
|
+
*/
|
|
2788
|
+
getSessionId(): string;
|
|
2789
|
+
/**
|
|
2790
|
+
* Return whether this session uses VPC resources.
|
|
2791
|
+
*/
|
|
2792
|
+
isVpcEnabled(): boolean;
|
|
2793
|
+
/**
|
|
2794
|
+
* Return the network interface IP for VPC sessions.
|
|
2795
|
+
*/
|
|
2796
|
+
getNetworkInterfaceIp(): string;
|
|
2797
|
+
/**
|
|
2798
|
+
* Return the HTTP port for VPC sessions.
|
|
2799
|
+
*/
|
|
2800
|
+
getHttpPort(): string;
|
|
2801
|
+
/**
|
|
2802
|
+
* Find the server that provides the given tool.
|
|
1599
2803
|
*/
|
|
2804
|
+
findServerForTool(toolName: string): string;
|
|
1600
2805
|
/**
|
|
1601
2806
|
* Delete this session.
|
|
1602
2807
|
*
|
|
1603
|
-
* @
|
|
2808
|
+
* @param syncContext - Whether to sync context data (trigger file uploads) before deleting the session. Defaults to false.
|
|
2809
|
+
* @returns DeleteResult indicating success or failure and request ID
|
|
1604
2810
|
*/
|
|
1605
|
-
delete(): Promise<
|
|
2811
|
+
delete(syncContext?: boolean): Promise<DeleteResult>;
|
|
2812
|
+
/**
|
|
2813
|
+
* Validates labels parameter for label operations.
|
|
2814
|
+
*
|
|
2815
|
+
* @param labels - The labels to validate
|
|
2816
|
+
* @returns null if validation passes, or OperationResult with error if validation fails
|
|
2817
|
+
*/
|
|
2818
|
+
private validateLabels;
|
|
1606
2819
|
/**
|
|
1607
2820
|
* Sets the labels for this session.
|
|
1608
2821
|
*
|
|
1609
2822
|
* @param labels - The labels to set for the session.
|
|
1610
|
-
* @
|
|
2823
|
+
* @returns OperationResult indicating success or failure with request ID
|
|
2824
|
+
* @throws Error if the operation fails (matching Python SessionError)
|
|
1611
2825
|
*/
|
|
1612
|
-
setLabels(labels: Record<string, string>): Promise<
|
|
2826
|
+
setLabels(labels: Record<string, string>): Promise<OperationResult>;
|
|
1613
2827
|
/**
|
|
1614
2828
|
* Gets the labels for this session.
|
|
1615
2829
|
*
|
|
1616
|
-
* @returns
|
|
1617
|
-
* @throws
|
|
2830
|
+
* @returns OperationResult containing the labels as data and request ID
|
|
2831
|
+
* @throws Error if the operation fails (matching Python SessionError)
|
|
1618
2832
|
*/
|
|
1619
|
-
getLabels(): Promise<
|
|
2833
|
+
getLabels(): Promise<OperationResult>;
|
|
1620
2834
|
/**
|
|
1621
|
-
*
|
|
2835
|
+
* Gets information about this session.
|
|
1622
2836
|
*
|
|
1623
|
-
* @returns
|
|
2837
|
+
* @returns OperationResult containing the session information as data and request ID
|
|
2838
|
+
* @throws Error if the operation fails (matching Python SessionError)
|
|
1624
2839
|
*/
|
|
1625
|
-
|
|
2840
|
+
info(): Promise<OperationResult>;
|
|
1626
2841
|
/**
|
|
1627
|
-
* Get the
|
|
2842
|
+
* Get a link associated with the current session.
|
|
1628
2843
|
*
|
|
1629
|
-
* @
|
|
2844
|
+
* @param protocolType - Optional protocol type to use for the link
|
|
2845
|
+
* @param port - Optional port to use for the link
|
|
2846
|
+
* @returns OperationResult containing the link as data and request ID
|
|
2847
|
+
* @throws Error if the operation fails (matching Python SessionError)
|
|
1630
2848
|
*/
|
|
1631
|
-
|
|
2849
|
+
getLink(protocolType?: string, port?: number): Promise<OperationResult>;
|
|
1632
2850
|
/**
|
|
1633
|
-
*
|
|
2851
|
+
* Asynchronously get a link associated with the current session.
|
|
1634
2852
|
*
|
|
1635
|
-
* @
|
|
2853
|
+
* @param protocolType - Optional protocol type to use for the link
|
|
2854
|
+
* @param port - Optional port to use for the link
|
|
2855
|
+
* @returns OperationResult containing the link as data and request ID
|
|
2856
|
+
* @throws Error if the operation fails (matching Python SessionError)
|
|
1636
2857
|
*/
|
|
1637
|
-
|
|
2858
|
+
getLinkAsync(protocolType?: string, port?: number): Promise<OperationResult>;
|
|
1638
2859
|
/**
|
|
1639
|
-
*
|
|
2860
|
+
* List MCP tools available for this session.
|
|
1640
2861
|
*
|
|
1641
|
-
* @
|
|
1642
|
-
* @
|
|
2862
|
+
* @param imageId Optional image ID, defaults to session's imageId or "linux_latest"
|
|
2863
|
+
* @returns McpToolsResult containing tools list and request ID
|
|
1643
2864
|
*/
|
|
1644
|
-
|
|
2865
|
+
listMcpTools(imageId?: string): Promise<McpToolsResult>;
|
|
1645
2866
|
/**
|
|
1646
|
-
*
|
|
2867
|
+
* Call an MCP tool and return the result in a format compatible with Agent.
|
|
1647
2868
|
*
|
|
1648
|
-
* @
|
|
1649
|
-
* @
|
|
2869
|
+
* @param toolName - Name of the MCP tool to call
|
|
2870
|
+
* @param args - Arguments to pass to the tool
|
|
2871
|
+
* @returns McpToolResult containing the response data
|
|
1650
2872
|
*/
|
|
1651
|
-
|
|
2873
|
+
callMcpTool(toolName: string, args: any): Promise<McpToolResult>;
|
|
1652
2874
|
}
|
|
1653
2875
|
|
|
1654
2876
|
/**
|
|
1655
|
-
*
|
|
2877
|
+
* Browser context configuration for session.
|
|
1656
2878
|
*/
|
|
1657
|
-
|
|
2879
|
+
interface BrowserContext {
|
|
2880
|
+
/** ID of the browser context to bind to the session */
|
|
2881
|
+
contextId: string;
|
|
2882
|
+
/** Whether to automatically upload browser data when the session ends */
|
|
2883
|
+
autoUpload: boolean;
|
|
2884
|
+
}
|
|
2885
|
+
/**
|
|
2886
|
+
* Configuration interface for CreateSessionParams
|
|
2887
|
+
*/
|
|
2888
|
+
interface CreateSessionParamsConfig {
|
|
2889
|
+
labels: Record<string, string>;
|
|
1658
2890
|
/**
|
|
1659
|
-
*
|
|
2891
|
+
* @deprecated This field is deprecated and will be removed in a future version.
|
|
2892
|
+
* Please use contextSync instead for more flexible and powerful data persistence.
|
|
1660
2893
|
*/
|
|
1661
|
-
|
|
2894
|
+
contextId?: string;
|
|
2895
|
+
imageId?: string;
|
|
2896
|
+
contextSync: ContextSync[];
|
|
2897
|
+
/** Optional configuration for browser data synchronization */
|
|
2898
|
+
browserContext?: BrowserContext;
|
|
2899
|
+
/** Whether to create a VPC-based session. Defaults to false. */
|
|
2900
|
+
isVpc?: boolean;
|
|
2901
|
+
}
|
|
2902
|
+
/**
|
|
2903
|
+
* CreateSessionParams provides a way to configure the parameters for creating a new session
|
|
2904
|
+
* in the AgentBay cloud environment.
|
|
2905
|
+
*/
|
|
2906
|
+
declare class CreateSessionParams$1 implements CreateSessionParamsConfig {
|
|
2907
|
+
/** Custom labels for the Session. These can be used for organizing and filtering sessions. */
|
|
2908
|
+
labels: Record<string, string>;
|
|
1662
2909
|
/**
|
|
1663
|
-
*
|
|
2910
|
+
* ID of the context to bind to the session.
|
|
2911
|
+
* The context can include various types of persistence like file system (volume) and cookies.
|
|
2912
|
+
*
|
|
2913
|
+
* @deprecated This field is deprecated and will be removed in a future version.
|
|
2914
|
+
* Please use contextSync instead for more flexible and powerful data persistence.
|
|
2915
|
+
*
|
|
2916
|
+
* Important Limitations:
|
|
2917
|
+
* 1. One session at a time: A context can only be used by one session at a time.
|
|
2918
|
+
* If you try to create a session with a context ID that is already in use by another active session,
|
|
2919
|
+
* the session creation will fail.
|
|
2920
|
+
*
|
|
2921
|
+
* 2. OS binding: A context is bound to the operating system of the first session that uses it.
|
|
2922
|
+
* When a context is first used with a session, it becomes bound to that session's OS.
|
|
2923
|
+
* Any attempt to use the context with a session running on a different OS will fail.
|
|
2924
|
+
* For example, if a context is first used with a Linux session, it cannot later be used
|
|
2925
|
+
* with a Windows or Android session.
|
|
1664
2926
|
*/
|
|
1665
|
-
|
|
2927
|
+
contextId?: string;
|
|
2928
|
+
/** Image ID to use for the session. */
|
|
2929
|
+
imageId?: string;
|
|
1666
2930
|
/**
|
|
1667
|
-
*
|
|
2931
|
+
* List of context synchronization configurations.
|
|
2932
|
+
* These configurations define how contexts should be synchronized and mounted.
|
|
1668
2933
|
*/
|
|
1669
|
-
|
|
2934
|
+
contextSync: ContextSync[];
|
|
2935
|
+
/** Optional configuration for browser data synchronization. */
|
|
2936
|
+
browserContext?: BrowserContext;
|
|
2937
|
+
/** Whether to create a VPC-based session. Defaults to false. */
|
|
2938
|
+
isVpc: boolean;
|
|
2939
|
+
constructor();
|
|
1670
2940
|
/**
|
|
1671
|
-
*
|
|
2941
|
+
* WithLabels sets the labels for the session parameters and returns the updated parameters.
|
|
1672
2942
|
*/
|
|
1673
|
-
|
|
2943
|
+
withLabels(labels: Record<string, string>): CreateSessionParams$1;
|
|
1674
2944
|
/**
|
|
1675
|
-
*
|
|
2945
|
+
* WithContextID sets the context ID for the session parameters and returns the updated parameters.
|
|
1676
2946
|
*/
|
|
1677
|
-
|
|
2947
|
+
withContextID(contextId: string): CreateSessionParams$1;
|
|
1678
2948
|
/**
|
|
1679
|
-
*
|
|
2949
|
+
* WithImageId sets the image ID for the session parameters and returns the updated parameters.
|
|
1680
2950
|
*/
|
|
1681
|
-
|
|
2951
|
+
withImageId(imageId: string): CreateSessionParams$1;
|
|
1682
2952
|
/**
|
|
1683
|
-
*
|
|
1684
|
-
*
|
|
1685
|
-
* @param id - The unique identifier of the context.
|
|
1686
|
-
* @param name - The name of the context.
|
|
1687
|
-
* @param state - The current state of the context.
|
|
1688
|
-
* @param createdAt - Date and time when the Context was created.
|
|
1689
|
-
* @param lastUsedAt - Date and time when the Context was last used.
|
|
1690
|
-
* @param osType - The operating system type this context is bound to.
|
|
2953
|
+
* WithBrowserContext sets the browser context for the session parameters and returns the updated parameters.
|
|
1691
2954
|
*/
|
|
1692
|
-
|
|
1693
|
-
}
|
|
1694
|
-
/**
|
|
1695
|
-
* Provides methods to manage persistent contexts in the AgentBay cloud environment.
|
|
1696
|
-
*/
|
|
1697
|
-
declare class ContextService {
|
|
1698
|
-
private agentBay;
|
|
2955
|
+
withBrowserContext(browserContext: BrowserContext): CreateSessionParams$1;
|
|
1699
2956
|
/**
|
|
1700
|
-
*
|
|
1701
|
-
*
|
|
1702
|
-
* @param agentBay - The AgentBay instance.
|
|
2957
|
+
* WithIsVpc sets the VPC flag for the session parameters and returns the updated parameters.
|
|
1703
2958
|
*/
|
|
1704
|
-
|
|
2959
|
+
withIsVpc(isVpc: boolean): CreateSessionParams$1;
|
|
1705
2960
|
/**
|
|
1706
|
-
*
|
|
1707
|
-
*
|
|
1708
|
-
* @returns A list of Context objects.
|
|
2961
|
+
* GetLabelsJSON returns the labels as a JSON string.
|
|
2962
|
+
* Returns an object with success status and result/error message to match Go version behavior.
|
|
1709
2963
|
*/
|
|
1710
|
-
|
|
2964
|
+
getLabelsJSON(): {
|
|
2965
|
+
result: string;
|
|
2966
|
+
error?: string;
|
|
2967
|
+
};
|
|
1711
2968
|
/**
|
|
1712
|
-
*
|
|
1713
|
-
*
|
|
1714
|
-
* @param name - The name of the context to get.
|
|
1715
|
-
* @param create - Whether to create the context if it doesn't exist.
|
|
1716
|
-
* @returns The Context object if found or created, null if not found and create is false.
|
|
2969
|
+
* AddContextSync adds a context sync configuration to the session parameters.
|
|
1717
2970
|
*/
|
|
1718
|
-
|
|
2971
|
+
addContextSync(contextId: string, path: string, policy?: SyncPolicy): CreateSessionParams$1;
|
|
1719
2972
|
/**
|
|
1720
|
-
*
|
|
1721
|
-
*
|
|
1722
|
-
* @param name - The name for the new context.
|
|
1723
|
-
* @returns The created Context object.
|
|
2973
|
+
* AddContextSyncConfig adds a pre-configured context sync to the session parameters.
|
|
1724
2974
|
*/
|
|
1725
|
-
|
|
2975
|
+
addContextSyncConfig(contextSync: ContextSync): CreateSessionParams$1;
|
|
1726
2976
|
/**
|
|
1727
|
-
*
|
|
1728
|
-
*
|
|
1729
|
-
* @param context - The Context object to update.
|
|
1730
|
-
* @returns The updated Context object.
|
|
2977
|
+
* WithContextSync sets the context sync configurations for the session parameters.
|
|
1731
2978
|
*/
|
|
1732
|
-
|
|
2979
|
+
withContextSync(contextSyncs: ContextSync[]): CreateSessionParams$1;
|
|
1733
2980
|
/**
|
|
1734
|
-
*
|
|
1735
|
-
|
|
1736
|
-
|
|
2981
|
+
* Convert to plain object for JSON serialization
|
|
2982
|
+
*/
|
|
2983
|
+
toJSON(): CreateSessionParamsConfig;
|
|
2984
|
+
/**
|
|
2985
|
+
* Create from plain object
|
|
1737
2986
|
*/
|
|
1738
|
-
|
|
2987
|
+
static fromJSON(config: CreateSessionParamsConfig): CreateSessionParams$1;
|
|
2988
|
+
}
|
|
2989
|
+
/**
|
|
2990
|
+
* NewCreateSessionParams creates a new CreateSessionParams with default values.
|
|
2991
|
+
*/
|
|
2992
|
+
declare function newCreateSessionParams(): CreateSessionParams$1;
|
|
2993
|
+
|
|
2994
|
+
/**
|
|
2995
|
+
* Parameters for listing sessions with pagination support
|
|
2996
|
+
*/
|
|
2997
|
+
interface ListSessionParams {
|
|
2998
|
+
/** Number of results per page (default: 10) */
|
|
2999
|
+
maxResults?: number;
|
|
3000
|
+
/** Token for the next page */
|
|
3001
|
+
nextToken?: string;
|
|
3002
|
+
/** Labels to filter by */
|
|
3003
|
+
labels: Record<string, string>;
|
|
3004
|
+
}
|
|
3005
|
+
/**
|
|
3006
|
+
* Result type for session listing with pagination information
|
|
3007
|
+
* Maintain consistency with the existing TypeScript SDK return structure and use the data field
|
|
3008
|
+
*/
|
|
3009
|
+
interface SessionListResult extends ApiResponse {
|
|
3010
|
+
/** Array of sessions */
|
|
3011
|
+
data: Session[];
|
|
3012
|
+
/** Token for the next page (if available) */
|
|
3013
|
+
nextToken?: string;
|
|
3014
|
+
/** Number of results per page */
|
|
3015
|
+
maxResults?: number;
|
|
3016
|
+
/** Total number of results */
|
|
3017
|
+
totalCount?: number;
|
|
1739
3018
|
}
|
|
1740
3019
|
|
|
3020
|
+
/**
|
|
3021
|
+
* Parameters for creating a session.
|
|
3022
|
+
*/
|
|
3023
|
+
interface CreateSessionParams {
|
|
3024
|
+
contextId?: string;
|
|
3025
|
+
labels?: Record<string, string>;
|
|
3026
|
+
imageId?: string;
|
|
3027
|
+
contextSync?: ContextSync[];
|
|
3028
|
+
browserContext?: BrowserContext;
|
|
3029
|
+
isVpc?: boolean;
|
|
3030
|
+
}
|
|
1741
3031
|
/**
|
|
1742
3032
|
* Main class for interacting with the AgentBay cloud runtime environment.
|
|
1743
3033
|
*/
|
|
@@ -1756,23 +3046,19 @@ declare class AgentBay {
|
|
|
1756
3046
|
*
|
|
1757
3047
|
* @param options - Configuration options
|
|
1758
3048
|
* @param options.apiKey - API key for authentication. If not provided, will look for AGENTBAY_API_KEY environment variable.
|
|
3049
|
+
* @param options.config - Custom configuration object. If not provided, will use environment-based configuration.
|
|
1759
3050
|
*/
|
|
1760
3051
|
constructor(options?: {
|
|
1761
3052
|
apiKey?: string;
|
|
3053
|
+
config?: Config;
|
|
1762
3054
|
});
|
|
1763
3055
|
/**
|
|
1764
3056
|
* Create a new session in the AgentBay cloud environment.
|
|
1765
3057
|
*
|
|
1766
|
-
* @param
|
|
1767
|
-
* @
|
|
1768
|
-
* @param options.labels - Custom labels for the session
|
|
1769
|
-
* @returns A new Session object.
|
|
3058
|
+
* @param params - Optional parameters for creating the session
|
|
3059
|
+
* @returns SessionResult containing the created session and request ID
|
|
1770
3060
|
*/
|
|
1771
|
-
create(
|
|
1772
|
-
contextId?: string;
|
|
1773
|
-
labels?: Record<string, string>;
|
|
1774
|
-
imageId?: string;
|
|
1775
|
-
}): Promise<Session>;
|
|
3061
|
+
create(params?: CreateSessionParams): Promise<SessionResult>;
|
|
1776
3062
|
/**
|
|
1777
3063
|
* List all available sessions.
|
|
1778
3064
|
*
|
|
@@ -1780,20 +3066,23 @@ declare class AgentBay {
|
|
|
1780
3066
|
*/
|
|
1781
3067
|
list(): Session[];
|
|
1782
3068
|
/**
|
|
1783
|
-
* List sessions filtered by the provided labels.
|
|
3069
|
+
* List sessions filtered by the provided labels with pagination support.
|
|
1784
3070
|
* It returns sessions that match all the specified labels.
|
|
1785
3071
|
*
|
|
1786
|
-
*
|
|
1787
|
-
*
|
|
3072
|
+
* **Breaking Change**: This method currently only accepts ListSessionParams parameters,
|
|
3073
|
+
*
|
|
3074
|
+
* @param params - Parameters including labels and pagination options (required)
|
|
3075
|
+
* @returns API response with sessions list and pagination info
|
|
1788
3076
|
*/
|
|
1789
|
-
listByLabels(
|
|
3077
|
+
listByLabels(params?: ListSessionParams): Promise<SessionListResult>;
|
|
1790
3078
|
/**
|
|
1791
|
-
* Delete a session by
|
|
3079
|
+
* Delete a session by session object.
|
|
1792
3080
|
*
|
|
1793
|
-
* @param
|
|
1794
|
-
* @
|
|
3081
|
+
* @param session - The session to delete.
|
|
3082
|
+
* @param syncContext - Whether to sync context data (trigger file uploads) before deleting the session. Defaults to false.
|
|
3083
|
+
* @returns DeleteResult indicating success or failure and request ID
|
|
1795
3084
|
*/
|
|
1796
|
-
delete(session: Session): Promise<
|
|
3085
|
+
delete(session: Session, syncContext?: boolean): Promise<DeleteResult>;
|
|
1797
3086
|
/**
|
|
1798
3087
|
*
|
|
1799
3088
|
* @param sessionId - The ID of the session to remove.
|
|
@@ -1804,34 +3093,82 @@ declare class AgentBay {
|
|
|
1804
3093
|
}
|
|
1805
3094
|
|
|
1806
3095
|
/**
|
|
1807
|
-
* Base exception for all AgentBay errors.
|
|
3096
|
+
* Base exception for all AgentBay SDK errors.
|
|
1808
3097
|
*/
|
|
1809
3098
|
declare class AgentBayError extends Error {
|
|
1810
|
-
|
|
3099
|
+
extra: Record<string, any>;
|
|
3100
|
+
constructor(message?: string, extra?: Record<string, any>);
|
|
1811
3101
|
}
|
|
1812
3102
|
/**
|
|
1813
3103
|
* Raised when there is an authentication error.
|
|
1814
3104
|
*/
|
|
1815
3105
|
declare class AuthenticationError extends AgentBayError {
|
|
1816
|
-
constructor(message
|
|
3106
|
+
constructor(message?: string, extra?: Record<string, any>);
|
|
1817
3107
|
}
|
|
1818
3108
|
/**
|
|
1819
3109
|
* Raised when there is an error with the API.
|
|
1820
3110
|
*/
|
|
1821
3111
|
declare class APIError extends AgentBayError {
|
|
1822
|
-
|
|
3112
|
+
statusCode?: number;
|
|
3113
|
+
constructor(message?: string, statusCode?: number, extra?: Record<string, any>);
|
|
1823
3114
|
}
|
|
1824
3115
|
/**
|
|
1825
|
-
* Raised
|
|
3116
|
+
* Raised for errors related to file operations.
|
|
1826
3117
|
*/
|
|
1827
3118
|
declare class FileError extends AgentBayError {
|
|
1828
|
-
constructor(message
|
|
3119
|
+
constructor(message?: string, extra?: Record<string, any>);
|
|
1829
3120
|
}
|
|
1830
3121
|
/**
|
|
1831
|
-
* Raised
|
|
3122
|
+
* Raised for errors related to command execution.
|
|
1832
3123
|
*/
|
|
1833
3124
|
declare class CommandError extends AgentBayError {
|
|
1834
|
-
constructor(message
|
|
3125
|
+
constructor(message?: string, extra?: Record<string, any>);
|
|
3126
|
+
}
|
|
3127
|
+
/**
|
|
3128
|
+
* Raised for errors related to session operations.
|
|
3129
|
+
*/
|
|
3130
|
+
declare class SessionError extends AgentBayError {
|
|
3131
|
+
constructor(message?: string, extra?: Record<string, any>);
|
|
3132
|
+
}
|
|
3133
|
+
/**
|
|
3134
|
+
* Raised for errors related to OSS operations.
|
|
3135
|
+
*/
|
|
3136
|
+
declare class OssError extends AgentBayError {
|
|
3137
|
+
constructor(message?: string, extra?: Record<string, any>);
|
|
1835
3138
|
}
|
|
3139
|
+
/**
|
|
3140
|
+
* Raised for errors related to application operations.
|
|
3141
|
+
*/
|
|
3142
|
+
declare class ApplicationError extends AgentBayError {
|
|
3143
|
+
constructor(message?: string, extra?: Record<string, any>);
|
|
3144
|
+
}
|
|
3145
|
+
/**
|
|
3146
|
+
* Raised for errors related to UI operations.
|
|
3147
|
+
*/
|
|
3148
|
+
declare class UIError extends AgentBayError {
|
|
3149
|
+
constructor(message?: string, extra?: Record<string, any>);
|
|
3150
|
+
}
|
|
3151
|
+
/**
|
|
3152
|
+
* Raised for errors related to browser operations.
|
|
3153
|
+
*/
|
|
3154
|
+
declare class BrowserError extends AgentBayError {
|
|
3155
|
+
constructor(message?: string, extra?: Record<string, any>);
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
/**
|
|
3159
|
+
* Utility functions for logging in a clean format
|
|
3160
|
+
*/
|
|
3161
|
+
/**
|
|
3162
|
+
* Log a message without the log prefix and file location
|
|
3163
|
+
* @param message The message to log
|
|
3164
|
+
* @param args Optional arguments to log
|
|
3165
|
+
*/
|
|
3166
|
+
declare function log(message: string, ...args: any[]): void;
|
|
3167
|
+
/**
|
|
3168
|
+
* Log an error message
|
|
3169
|
+
* @param message The error message to log
|
|
3170
|
+
* @param error Optional error object
|
|
3171
|
+
*/
|
|
3172
|
+
declare function logError(message: string, error?: any): void;
|
|
1836
3173
|
|
|
1837
|
-
export { APIError, AgentBay, AgentBayError, Application, AuthenticationError, CallMcpToolRequest, CallMcpToolResponse, CallMcpToolResponseBody, Client, type
|
|
3174
|
+
export { APIError, type ActOptions, ActResult, Agent, AgentBay, AgentBayError, Application, ApplicationError, ApplyMqttTokenRequest, ApplyMqttTokenResponse, ApplyMqttTokenResponseBody, ApplyMqttTokenResponseBodyData, AuthenticationError, type BWList, Browser, BrowserAgent, type BrowserContext, BrowserError, type BrowserOption, CallMcpToolRequest, CallMcpToolResponse, CallMcpToolResponseBody, Client, Command, CommandError, Context, type ContextInfoResult, ContextManager, ContextService, type ContextStatusData, type ContextStatusItem, ContextSync, type ContextSyncResult, CreateMcpSessionRequest, CreateMcpSessionRequestPersistenceDataList, CreateMcpSessionResponse, CreateMcpSessionResponseBody, CreateMcpSessionResponseBodyData, CreateMcpSessionShrinkRequest, type CreateSessionParams, type CreateSessionParamsConfig, DeleteContextRequest, DeleteContextResponse, DeleteContextResponseBody, type DeletePolicy, type DirectoryEntry, type DownloadPolicy, DownloadStrategy, type ExecutionResult, type ExtractOptions, FileError, type FileInfo, FileSystem, GetContextInfoRequest, GetContextInfoResponse, GetContextInfoResponseBody, GetContextInfoResponseBodyData, GetContextRequest, GetContextResponse, GetContextResponseBody, GetContextResponseBodyData, GetLabelRequest, GetLabelResponse, GetLabelResponseBody, GetLabelResponseBodyData, GetLinkRequest, GetLinkResponse, GetLinkResponseBody, GetLinkResponseBodyData, GetMcpResourceRequest, GetMcpResourceResponse, GetMcpResourceResponseBody, GetMcpResourceResponseBodyData, GetMcpResourceResponseBodyDataDesktopInfo, InitBrowserRequest, InitBrowserResponse, InitBrowserResponseBody, InitBrowserResponseBodyData, type InstalledApp, KeyCode, ListContextsRequest, ListContextsResponse, ListContextsResponseBody, ListContextsResponseBodyData, ListMcpToolsRequest, ListMcpToolsResponse, ListMcpToolsResponseBody, type ListSessionParams, ListSessionRequest, ListSessionResponse, ListSessionResponseBody, ListSessionResponseBodyData, type McpSession, type McpToolResult, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, type ObserveOptions, ObserveResult, Oss, OssError, type Process, type QueryResult, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, Session, SessionError, type SessionInterface, SetLabelRequest, SetLabelResponse, SetLabelResponseBody, SyncContextRequest, SyncContextResponse, SyncContextResponseBody, type SyncPolicy, SyncPolicyImpl, UI, type UIElement, UIError, type UploadPolicy, UploadStrategy, type WhiteList, log, logError, newContextManager, newContextSync, newCreateSessionParams, newDeletePolicy, newDownloadPolicy, newSyncPolicy, newSyncPolicyWithDefaults, newUploadPolicy };
|