wuying-agentbay-sdk 0.12.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-BVWUCG4J.mjs → chunk-P2CXYF4T.mjs} +400 -163
- package/dist/chunk-P2CXYF4T.mjs.map +1 -0
- package/dist/{chunk-SL5GCAQE.cjs → chunk-WVWGLZDT.cjs} +337 -100
- package/dist/chunk-WVWGLZDT.cjs.map +1 -0
- package/dist/index.cjs +6854 -782
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +644 -166
- package/dist/index.d.ts +644 -166
- package/dist/index.mjs +6723 -651
- package/dist/index.mjs.map +1 -1
- package/dist/{model-LGWQJWKQ.mjs → model-BRLR6F3P.mjs} +16 -2
- package/dist/model-KJHN3WYY.cjs +214 -0
- package/dist/{model-CNCGFWJH.cjs.map → model-KJHN3WYY.cjs.map} +1 -1
- package/docs/api/README.md +6 -0
- package/docs/api/browser-use/browser-agent.md +188 -0
- package/docs/api/browser-use/browser.md +1 -1
- package/docs/api/browser-use/fingerprint.md +154 -0
- package/docs/api/codespace/code.md +3 -0
- package/docs/api/common-features/advanced/agent.md +7 -63
- package/docs/api/common-features/advanced/browser-use-agent.md +118 -0
- package/docs/api/common-features/advanced/computer-use-agent.md +85 -0
- package/docs/api/common-features/basics/agentbay.md +3 -2
- package/docs/api/common-features/basics/command.md +35 -18
- package/docs/api/common-features/basics/filesystem.md +36 -0
- package/docs/api/common-features/basics/session-params.md +382 -0
- package/docs/api/common-features/basics/session.md +0 -2
- package/docs/api/computer-use/computer.md +25 -25
- package/docs/api/mobile-use/mobile-simulate.md +135 -0
- package/docs/examples/browser-use/browser/basic-usage.ts +31 -24
- package/docs/examples/browser-use/browser/browser-type-example.ts +3 -4
- package/docs/examples/browser-use/browser/captcha_tongcheng.ts +60 -28
- package/docs/examples/browser-use/browser/run-2048.ts +47 -37
- package/docs/examples/browser-use/browser/run-sudoku.ts +55 -36
- package/docs/examples/browser-use/browser/screenshot-example.ts +6 -6
- package/docs/examples/browser-use/extension-example/extension-example.ts +1 -2
- package/docs/examples/codespace/enhanced_code/index.ts +86 -0
- package/docs/examples/common-features/advanced/agent-module-example.ts +1 -1
- package/docs/examples/common-features/advanced/archive-upload-mode-example/README.md +1 -1
- package/docs/examples/common-features/advanced/archive-upload-mode-example/archive-upload-mode-example.ts +5 -6
- package/docs/examples/common-features/basics/archive-upload-mode-example/README.md +1 -1
- package/docs/examples/common-features/basics/archive-upload-mode-example/main.ts +1 -1
- package/docs/examples/common-features/basics/filesystem-example/filesystem-example.ts +13 -0
- package/docs/examples/common-features/basics/filesystem-example/filesystem-filetransfer-example.ts +6 -7
- package/docs/examples/common-features/basics/filesystem-example/watch-directory-example.ts +1 -1
- package/docs/examples/mobile-use/mobile-get-adb-url/index.ts +1 -1
- package/package.json +4 -4
- package/dist/chunk-BVWUCG4J.mjs.map +0 -1
- package/dist/chunk-SL5GCAQE.cjs.map +0 -1
- package/dist/model-CNCGFWJH.cjs +0 -200
- package/docs/examples/mobile-use/mobile-get-adb-url/package-lock.json +0 -279
- package/docs/examples/mobile-use/mobile-get-adb-url/package.json +0 -18
- /package/dist/{model-LGWQJWKQ.mjs.map → model-BRLR6F3P.mjs.map} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as $dara from '@darabonba/typescript';
|
|
2
2
|
import OpenApi, { $OpenApiUtil } from '@alicloud/openapi-core';
|
|
3
|
+
import { ZodTypeAny, z } from 'zod';
|
|
3
4
|
|
|
4
5
|
interface Config {
|
|
5
6
|
endpoint: string;
|
|
6
7
|
timeout_ms: number;
|
|
8
|
+
region_id?: string;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -123,6 +125,31 @@ interface OperationResult extends ApiResponse {
|
|
|
123
125
|
/** Optional error message if the operation failed */
|
|
124
126
|
errorMessage?: string;
|
|
125
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Interface for process list operation responses
|
|
130
|
+
* Corresponds to Python's ProcessListResult type
|
|
131
|
+
*/
|
|
132
|
+
interface Process$1 {
|
|
133
|
+
pname: string;
|
|
134
|
+
pid: number;
|
|
135
|
+
cmdline?: string;
|
|
136
|
+
}
|
|
137
|
+
interface ProcessListResult extends OperationResult {
|
|
138
|
+
data: Process$1[];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Interface for installed app list operation responses
|
|
142
|
+
* Corresponds to Python's InstalledAppListResult type
|
|
143
|
+
*/
|
|
144
|
+
interface InstalledApp$1 {
|
|
145
|
+
name: string;
|
|
146
|
+
startCmd: string;
|
|
147
|
+
stopCmd?: string;
|
|
148
|
+
workDirectory?: string;
|
|
149
|
+
}
|
|
150
|
+
interface InstalledAppListResult extends OperationResult {
|
|
151
|
+
data: InstalledApp$1[];
|
|
152
|
+
}
|
|
126
153
|
/**
|
|
127
154
|
* Interface for command execution operation responses
|
|
128
155
|
* Corresponds to Python's CommandResult type
|
|
@@ -132,30 +159,74 @@ interface CommandResult extends ApiResponse {
|
|
|
132
159
|
requestId: string;
|
|
133
160
|
/** Whether the command execution was successful */
|
|
134
161
|
success: boolean;
|
|
135
|
-
/** The command output */
|
|
162
|
+
/** The command output (for backward compatibility, equals stdout + stderr) */
|
|
136
163
|
output: string;
|
|
137
164
|
/** Optional error message if the operation failed */
|
|
138
165
|
errorMessage?: string;
|
|
166
|
+
/** The exit code of the command execution. Default is 0. */
|
|
167
|
+
exitCode?: number;
|
|
168
|
+
/** Standard output from the command execution */
|
|
169
|
+
stdout?: string;
|
|
170
|
+
/** Standard error from the command execution */
|
|
171
|
+
stderr?: string;
|
|
172
|
+
/** Trace ID for error tracking. Only present when exit_code != 0. Used for quick problem localization. */
|
|
173
|
+
traceId?: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Interface for single result item in enhanced code execution
|
|
177
|
+
*/
|
|
178
|
+
interface CodeExecutionResultItem {
|
|
179
|
+
text?: string;
|
|
180
|
+
html?: string;
|
|
181
|
+
markdown?: string;
|
|
182
|
+
png?: string;
|
|
183
|
+
jpeg?: string;
|
|
184
|
+
svg?: string;
|
|
185
|
+
latex?: string;
|
|
186
|
+
json?: any;
|
|
187
|
+
chart?: any;
|
|
188
|
+
isMainResult?: boolean;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Interface for code execution logs
|
|
192
|
+
*/
|
|
193
|
+
interface CodeExecutionLogs {
|
|
194
|
+
stdout: string[];
|
|
195
|
+
stderr: string[];
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Interface for code execution error details
|
|
199
|
+
*/
|
|
200
|
+
interface CodeExecutionError {
|
|
201
|
+
name: string;
|
|
202
|
+
value: string;
|
|
203
|
+
traceback: string;
|
|
139
204
|
}
|
|
140
205
|
/**
|
|
141
206
|
* Interface for code execution operation responses
|
|
142
|
-
* Corresponds to Python's
|
|
207
|
+
* Corresponds to Python's EnhancedCodeExecutionResult type
|
|
143
208
|
*/
|
|
144
209
|
interface CodeExecutionResult extends ApiResponse {
|
|
145
210
|
/** Request identifier for tracking API calls */
|
|
146
211
|
requestId: string;
|
|
147
212
|
/** Whether the code execution was successful */
|
|
148
213
|
success: boolean;
|
|
149
|
-
/** The execution result */
|
|
214
|
+
/** The execution result (backward compatible text) */
|
|
150
215
|
result: string;
|
|
151
216
|
/** Optional error message if the operation failed */
|
|
152
217
|
errorMessage?: string;
|
|
218
|
+
/** Enhanced fields */
|
|
219
|
+
logs?: CodeExecutionLogs;
|
|
220
|
+
results?: CodeExecutionResultItem[];
|
|
221
|
+
error?: CodeExecutionError;
|
|
222
|
+
executionTime?: number;
|
|
223
|
+
executionCount?: number;
|
|
153
224
|
}
|
|
154
225
|
/**
|
|
155
226
|
* Interface for boolean operation responses
|
|
156
227
|
* Corresponds to Python's BoolResult type
|
|
157
228
|
*/
|
|
158
|
-
interface BoolResult$
|
|
229
|
+
interface BoolResult$1 extends ApiResponse {
|
|
159
230
|
/** Request identifier for tracking API calls */
|
|
160
231
|
requestId: string;
|
|
161
232
|
/** Whether the operation was successful */
|
|
@@ -277,6 +348,12 @@ interface OSSDownloadResult extends ApiResponse {
|
|
|
277
348
|
/** Optional error message if the operation failed */
|
|
278
349
|
errorMessage?: string;
|
|
279
350
|
}
|
|
351
|
+
interface WindowInfo {
|
|
352
|
+
windowId: number;
|
|
353
|
+
title: string;
|
|
354
|
+
pid: number;
|
|
355
|
+
pname: string;
|
|
356
|
+
}
|
|
280
357
|
/**
|
|
281
358
|
* Interface for window list operation responses
|
|
282
359
|
* Corresponds to Python's WindowListResult type
|
|
@@ -287,10 +364,21 @@ interface WindowListResult extends ApiResponse {
|
|
|
287
364
|
/** Whether the operation was successful */
|
|
288
365
|
success: boolean;
|
|
289
366
|
/** List of windows */
|
|
290
|
-
windows:
|
|
367
|
+
windows: WindowInfo[];
|
|
291
368
|
/** Optional error message if the operation failed */
|
|
292
369
|
errorMessage?: string;
|
|
293
370
|
}
|
|
371
|
+
interface Window {
|
|
372
|
+
windowId: number;
|
|
373
|
+
title: string;
|
|
374
|
+
absoluteUpperLeftX?: number;
|
|
375
|
+
absoluteUpperLeftY?: number;
|
|
376
|
+
width?: number;
|
|
377
|
+
height?: number;
|
|
378
|
+
pid?: number;
|
|
379
|
+
pname?: string;
|
|
380
|
+
childWindows?: Window[];
|
|
381
|
+
}
|
|
294
382
|
/**
|
|
295
383
|
* Interface for window info operation responses
|
|
296
384
|
* Corresponds to Python's WindowInfoResult type
|
|
@@ -301,7 +389,7 @@ interface WindowInfoResult extends ApiResponse {
|
|
|
301
389
|
/** Whether the operation was successful */
|
|
302
390
|
success: boolean;
|
|
303
391
|
/** Window object */
|
|
304
|
-
window?:
|
|
392
|
+
window?: Window[];
|
|
305
393
|
/** Optional error message if the operation failed */
|
|
306
394
|
errorMessage?: string;
|
|
307
395
|
}
|
|
@@ -446,6 +534,32 @@ interface SessionResumeResult extends ApiResponse {
|
|
|
446
534
|
/** Current status of the session. Possible values: "RUNNING", "PAUSED", "RESUMING" */
|
|
447
535
|
status?: string;
|
|
448
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* Represents the screen dimensions and DPI scaling information.
|
|
539
|
+
*
|
|
540
|
+
* @interface ScreenSize
|
|
541
|
+
* @extends OperationResult
|
|
542
|
+
*/
|
|
543
|
+
interface ScreenSize extends OperationResult {
|
|
544
|
+
/** Screen width in pixels */
|
|
545
|
+
width: number;
|
|
546
|
+
/** Screen height in pixels */
|
|
547
|
+
height: number;
|
|
548
|
+
/** DPI scaling factor (e.g., 1.0 for 100%, 1.5 for 150%, 2.0 for 200%) */
|
|
549
|
+
dpiScalingFactor: number;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Represents the current cursor position on screen.
|
|
553
|
+
*
|
|
554
|
+
* @interface CursorPosition
|
|
555
|
+
* @extends OperationResult
|
|
556
|
+
*/
|
|
557
|
+
interface CursorPosition extends OperationResult {
|
|
558
|
+
/** X coordinate in pixels (0 is left edge of screen) */
|
|
559
|
+
x: number;
|
|
560
|
+
/** Y coordinate in pixels (0 is top edge of screen) */
|
|
561
|
+
y: number;
|
|
562
|
+
}
|
|
449
563
|
|
|
450
564
|
/**
|
|
451
565
|
*/
|
|
@@ -840,6 +954,7 @@ declare class ClearContextResponse extends $dara.Model {
|
|
|
840
954
|
declare class CreateMcpSessionRequest extends $dara.Model {
|
|
841
955
|
authorization?: string;
|
|
842
956
|
contextId?: string;
|
|
957
|
+
enableRecord?: boolean;
|
|
843
958
|
externalUserId?: string;
|
|
844
959
|
imageId?: string;
|
|
845
960
|
labels?: string;
|
|
@@ -849,6 +964,7 @@ declare class CreateMcpSessionRequest extends $dara.Model {
|
|
|
849
964
|
vpcResource?: boolean;
|
|
850
965
|
extraConfigs?: string;
|
|
851
966
|
sdkStats?: string;
|
|
967
|
+
loginRegionId?: string;
|
|
852
968
|
static names(): {
|
|
853
969
|
[key: string]: string;
|
|
854
970
|
};
|
|
@@ -873,6 +989,7 @@ declare class CreateMcpSessionShrinkRequest extends $dara.Model {
|
|
|
873
989
|
vpcResource?: boolean;
|
|
874
990
|
extraConfigs?: string;
|
|
875
991
|
sdkStats?: string;
|
|
992
|
+
loginRegionId?: string;
|
|
876
993
|
static names(): {
|
|
877
994
|
[key: string]: string;
|
|
878
995
|
};
|
|
@@ -978,6 +1095,7 @@ declare class GetContextRequest extends $dara.Model {
|
|
|
978
1095
|
authorization?: string;
|
|
979
1096
|
contextId?: string;
|
|
980
1097
|
name?: string;
|
|
1098
|
+
loginRegionId?: string;
|
|
981
1099
|
static names(): {
|
|
982
1100
|
[key: string]: string;
|
|
983
1101
|
};
|
|
@@ -1027,6 +1145,74 @@ declare class GetContextResponse extends $dara.Model {
|
|
|
1027
1145
|
});
|
|
1028
1146
|
}
|
|
1029
1147
|
|
|
1148
|
+
declare class GetAndLoadInternalContextRequest extends $dara.Model {
|
|
1149
|
+
authorization?: string;
|
|
1150
|
+
contextTypes?: string[];
|
|
1151
|
+
sessionId?: string;
|
|
1152
|
+
static names(): {
|
|
1153
|
+
[key: string]: string;
|
|
1154
|
+
};
|
|
1155
|
+
static types(): {
|
|
1156
|
+
[key: string]: any;
|
|
1157
|
+
};
|
|
1158
|
+
validate(): void;
|
|
1159
|
+
constructor(map?: {
|
|
1160
|
+
[key: string]: any;
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
declare class GetAndLoadInternalContextResponseBodyData extends $dara.Model {
|
|
1165
|
+
contextId?: string;
|
|
1166
|
+
contextPath?: string;
|
|
1167
|
+
contextType?: string;
|
|
1168
|
+
static names(): {
|
|
1169
|
+
[key: string]: string;
|
|
1170
|
+
};
|
|
1171
|
+
static types(): {
|
|
1172
|
+
[key: string]: any;
|
|
1173
|
+
};
|
|
1174
|
+
validate(): void;
|
|
1175
|
+
constructor(map?: {
|
|
1176
|
+
[key: string]: any;
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
declare class GetAndLoadInternalContextResponseBody extends $dara.Model {
|
|
1180
|
+
code?: string;
|
|
1181
|
+
data?: GetAndLoadInternalContextResponseBodyData[];
|
|
1182
|
+
httpStatusCode?: number;
|
|
1183
|
+
message?: string;
|
|
1184
|
+
requestId?: string;
|
|
1185
|
+
success?: boolean;
|
|
1186
|
+
static names(): {
|
|
1187
|
+
[key: string]: string;
|
|
1188
|
+
};
|
|
1189
|
+
static types(): {
|
|
1190
|
+
[key: string]: any;
|
|
1191
|
+
};
|
|
1192
|
+
validate(): void;
|
|
1193
|
+
constructor(map?: {
|
|
1194
|
+
[key: string]: any;
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
declare class GetAndLoadInternalContextResponse extends $dara.Model {
|
|
1199
|
+
headers?: {
|
|
1200
|
+
[key: string]: string;
|
|
1201
|
+
};
|
|
1202
|
+
statusCode?: number;
|
|
1203
|
+
body?: GetAndLoadInternalContextResponseBody;
|
|
1204
|
+
static names(): {
|
|
1205
|
+
[key: string]: string;
|
|
1206
|
+
};
|
|
1207
|
+
static types(): {
|
|
1208
|
+
[key: string]: any;
|
|
1209
|
+
};
|
|
1210
|
+
validate(): void;
|
|
1211
|
+
constructor(map?: {
|
|
1212
|
+
[key: string]: any;
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1030
1216
|
declare class GetContextInfoRequest extends $dara.Model {
|
|
1031
1217
|
authorization?: string;
|
|
1032
1218
|
contextId?: string;
|
|
@@ -1515,6 +1701,8 @@ declare class ListContextsRequest extends $dara.Model {
|
|
|
1515
1701
|
authorization?: string;
|
|
1516
1702
|
maxResults?: number;
|
|
1517
1703
|
nextToken?: string;
|
|
1704
|
+
sessionId?: string;
|
|
1705
|
+
type?: string;
|
|
1518
1706
|
static names(): {
|
|
1519
1707
|
[key: string]: string;
|
|
1520
1708
|
};
|
|
@@ -2261,6 +2449,57 @@ declare class ResumeSessionAsyncResponse extends $dara.Model {
|
|
|
2261
2449
|
}): ResumeSessionAsyncResponse;
|
|
2262
2450
|
}
|
|
2263
2451
|
|
|
2452
|
+
declare class DeleteSessionAsyncRequest extends $dara.Model {
|
|
2453
|
+
authorization?: string;
|
|
2454
|
+
sessionId?: string;
|
|
2455
|
+
static names(): {
|
|
2456
|
+
[key: string]: string;
|
|
2457
|
+
};
|
|
2458
|
+
static types(): {
|
|
2459
|
+
[key: string]: any;
|
|
2460
|
+
};
|
|
2461
|
+
validate(): void;
|
|
2462
|
+
constructor(map?: {
|
|
2463
|
+
[key: string]: any;
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
declare class DeleteSessionAsyncResponseBody extends $dara.Model {
|
|
2468
|
+
code?: string;
|
|
2469
|
+
httpStatusCode?: number;
|
|
2470
|
+
message?: string;
|
|
2471
|
+
requestId?: string;
|
|
2472
|
+
success?: boolean;
|
|
2473
|
+
static names(): {
|
|
2474
|
+
[key: string]: string;
|
|
2475
|
+
};
|
|
2476
|
+
static types(): {
|
|
2477
|
+
[key: string]: any;
|
|
2478
|
+
};
|
|
2479
|
+
validate(): void;
|
|
2480
|
+
constructor(map?: {
|
|
2481
|
+
[key: string]: any;
|
|
2482
|
+
});
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
declare class DeleteSessionAsyncResponse extends $dara.Model {
|
|
2486
|
+
headers?: {
|
|
2487
|
+
[key: string]: string;
|
|
2488
|
+
};
|
|
2489
|
+
statusCode?: number;
|
|
2490
|
+
body?: DeleteSessionAsyncResponseBody;
|
|
2491
|
+
static names(): {
|
|
2492
|
+
[key: string]: string;
|
|
2493
|
+
};
|
|
2494
|
+
static types(): {
|
|
2495
|
+
[key: string]: any;
|
|
2496
|
+
};
|
|
2497
|
+
validate(): void;
|
|
2498
|
+
constructor(map?: {
|
|
2499
|
+
[key: string]: any;
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2264
2503
|
declare class Client extends OpenApi {
|
|
2265
2504
|
constructor(config: $OpenApiUtil.Config);
|
|
2266
2505
|
getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: {
|
|
@@ -2311,6 +2550,21 @@ declare class Client extends OpenApi {
|
|
|
2311
2550
|
* @returns CreateMcpSessionResponse
|
|
2312
2551
|
*/
|
|
2313
2552
|
createMcpSession(request: CreateMcpSessionRequest): Promise<CreateMcpSessionResponse>;
|
|
2553
|
+
/**
|
|
2554
|
+
* Delete session
|
|
2555
|
+
*
|
|
2556
|
+
* @param request - DeleteSessionAsyncRequest
|
|
2557
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
2558
|
+
* @returns DeleteSessionAsyncResponse
|
|
2559
|
+
*/
|
|
2560
|
+
deleteSessionAsyncWithOptions(request: DeleteSessionAsyncRequest, runtime: $dara.RuntimeOptions): Promise<DeleteSessionAsyncResponse>;
|
|
2561
|
+
/**
|
|
2562
|
+
* Delete session
|
|
2563
|
+
*
|
|
2564
|
+
* @param request - DeleteSessionAsyncRequest
|
|
2565
|
+
* @returns DeleteSessionAsyncResponse
|
|
2566
|
+
*/
|
|
2567
|
+
deleteSessionAsync(request: DeleteSessionAsyncRequest): Promise<DeleteSessionAsyncResponse>;
|
|
2314
2568
|
/**
|
|
2315
2569
|
* Delete persistent context
|
|
2316
2570
|
*
|
|
@@ -2446,6 +2700,21 @@ declare class Client extends OpenApi {
|
|
|
2446
2700
|
* @returns GetMcpResourceResponse
|
|
2447
2701
|
*/
|
|
2448
2702
|
getMcpResource(request: GetMcpResourceRequest): Promise<GetMcpResourceResponse>;
|
|
2703
|
+
/**
|
|
2704
|
+
* Get internal context request
|
|
2705
|
+
*
|
|
2706
|
+
* @param request - GetAndLoadInternalContextRequest
|
|
2707
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
2708
|
+
* @returns GetAndLoadInternalContextResponse
|
|
2709
|
+
*/
|
|
2710
|
+
getAndLoadInternalContextWithOptions(request: GetAndLoadInternalContextRequest, runtime: $dara.RuntimeOptions): Promise<GetAndLoadInternalContextResponse>;
|
|
2711
|
+
/**
|
|
2712
|
+
* Get internal context request
|
|
2713
|
+
*
|
|
2714
|
+
* @param request - GetAndLoadInternalContextRequest
|
|
2715
|
+
* @returns GetAndLoadInternalContextResponse
|
|
2716
|
+
*/
|
|
2717
|
+
getAndLoadInternalContext(request: GetAndLoadInternalContextRequest): Promise<GetAndLoadInternalContextResponse>;
|
|
2449
2718
|
/**
|
|
2450
2719
|
* Get context list
|
|
2451
2720
|
*
|
|
@@ -2708,6 +2977,10 @@ interface ContextListParams {
|
|
|
2708
2977
|
* Token for the next page of results.
|
|
2709
2978
|
*/
|
|
2710
2979
|
nextToken?: string;
|
|
2980
|
+
/**
|
|
2981
|
+
* Optional session id to filter contexts by session
|
|
2982
|
+
*/
|
|
2983
|
+
sessionId?: string;
|
|
2711
2984
|
}
|
|
2712
2985
|
/**
|
|
2713
2986
|
* Provides methods to manage persistent contexts in the AgentBay cloud environment.
|
|
@@ -3063,6 +3336,29 @@ declare class ContextSync {
|
|
|
3063
3336
|
contextId: string;
|
|
3064
3337
|
path: string;
|
|
3065
3338
|
policy?: SyncPolicy;
|
|
3339
|
+
/**
|
|
3340
|
+
* Defines a full context sync configuration with optional policy overrides.
|
|
3341
|
+
*
|
|
3342
|
+
* @example
|
|
3343
|
+
* ```typescript
|
|
3344
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3345
|
+
* const result = await agentBay.create();
|
|
3346
|
+
* if (result.success) {
|
|
3347
|
+
* const policy = new SyncPolicyImpl({
|
|
3348
|
+
* uploadPolicy: newUploadPolicy(),
|
|
3349
|
+
* downloadPolicy: newDownloadPolicy(),
|
|
3350
|
+
* recyclePolicy: newRecyclePolicy(),
|
|
3351
|
+
* });
|
|
3352
|
+
* const syncResult = await result.session.context.sync(
|
|
3353
|
+
* 'project-data',
|
|
3354
|
+
* '/mnt/shared',
|
|
3355
|
+
* 'upload'
|
|
3356
|
+
* );
|
|
3357
|
+
* console.log('Context sync:', syncResult.success);
|
|
3358
|
+
* await result.session.delete();
|
|
3359
|
+
* }
|
|
3360
|
+
* ```
|
|
3361
|
+
*/
|
|
3066
3362
|
constructor(contextId: string, path: string, policy?: SyncPolicy);
|
|
3067
3363
|
withPolicy(policy: SyncPolicy): ContextSync;
|
|
3068
3364
|
}
|
|
@@ -3080,18 +3376,31 @@ declare function newContextSync(contextId: string, path: string, policy?: SyncPo
|
|
|
3080
3376
|
* Result of task execution.
|
|
3081
3377
|
*/
|
|
3082
3378
|
interface ExecutionResult extends ApiResponse {
|
|
3083
|
-
success: boolean;
|
|
3084
|
-
errorMessage: string;
|
|
3085
3379
|
taskId: string;
|
|
3086
3380
|
taskStatus: string;
|
|
3381
|
+
taskResult: string;
|
|
3087
3382
|
}
|
|
3088
3383
|
/**
|
|
3089
3384
|
* Result of query operations.
|
|
3090
3385
|
*/
|
|
3091
3386
|
interface QueryResult extends ApiResponse {
|
|
3387
|
+
taskStatus: string;
|
|
3388
|
+
taskAction: string;
|
|
3389
|
+
taskProduct: string;
|
|
3390
|
+
}
|
|
3391
|
+
/**
|
|
3392
|
+
* Result of agent initialization.
|
|
3393
|
+
*/
|
|
3394
|
+
interface InitializationResult extends ApiResponse {
|
|
3092
3395
|
success: boolean;
|
|
3093
|
-
|
|
3094
|
-
|
|
3396
|
+
}
|
|
3397
|
+
/**
|
|
3398
|
+
* Options for Agent initialization.
|
|
3399
|
+
|
|
3400
|
+
*/
|
|
3401
|
+
interface AgentOptions {
|
|
3402
|
+
use_vision: boolean;
|
|
3403
|
+
output_schema: '';
|
|
3095
3404
|
}
|
|
3096
3405
|
/**
|
|
3097
3406
|
* Result of an MCP tool call.
|
|
@@ -3111,12 +3420,12 @@ interface McpSession {
|
|
|
3111
3420
|
callMcpTool(toolName: string, args: any): Promise<McpToolResult>;
|
|
3112
3421
|
}
|
|
3113
3422
|
/**
|
|
3114
|
-
* An Agent to
|
|
3423
|
+
* An Agent to perform tasks on the computer.
|
|
3115
3424
|
*/
|
|
3116
|
-
declare class
|
|
3425
|
+
declare class ComputerUseAgent {
|
|
3117
3426
|
private session;
|
|
3118
3427
|
/**
|
|
3119
|
-
* Initialize an Agent object.
|
|
3428
|
+
* Initialize an Computer Agent object.
|
|
3120
3429
|
*
|
|
3121
3430
|
* @param session - The Session instance that this Agent belongs to.
|
|
3122
3431
|
*/
|
|
@@ -3126,14 +3435,18 @@ declare class Agent {
|
|
|
3126
3435
|
*
|
|
3127
3436
|
* @param task - Task description in human language.
|
|
3128
3437
|
* @param maxTryTimes - Maximum number of retry attempts.
|
|
3129
|
-
* @returns ExecutionResult containing success status, task output, and error
|
|
3438
|
+
* @returns ExecutionResult containing success status, task output, and error
|
|
3439
|
+
* message if any.
|
|
3130
3440
|
*
|
|
3131
3441
|
* @example
|
|
3132
3442
|
* ```typescript
|
|
3133
3443
|
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3134
3444
|
* const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
3135
3445
|
* if (result.success) {
|
|
3136
|
-
* const taskResult = await result.session.agent.executeTask(
|
|
3446
|
+
* const taskResult = await result.session.agent.computer.executeTask(
|
|
3447
|
+
* 'Open notepad',
|
|
3448
|
+
* 10
|
|
3449
|
+
* );
|
|
3137
3450
|
* console.log(`Task status: ${taskResult.taskStatus}`);
|
|
3138
3451
|
* await result.session.delete();
|
|
3139
3452
|
* }
|
|
@@ -3151,10 +3464,11 @@ declare class Agent {
|
|
|
3151
3464
|
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3152
3465
|
* const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
3153
3466
|
* if (result.success) {
|
|
3154
|
-
* const taskResult = await result.session.agent.executeTask('Open
|
|
3155
|
-
*
|
|
3156
|
-
*
|
|
3157
|
-
*
|
|
3467
|
+
* const taskResult = await result.session.agent.computer.executeTask('Open
|
|
3468
|
+
* calculator', 10); const statusResult = await
|
|
3469
|
+
* result.session.agent.computer.getTaskStatus(taskResult.taskId);
|
|
3470
|
+
* console.log(`Status:
|
|
3471
|
+
* ${JSON.parse(statusResult.output).status}`); await result.session.delete();
|
|
3158
3472
|
* }
|
|
3159
3473
|
* ```
|
|
3160
3474
|
*/
|
|
@@ -3163,15 +3477,122 @@ declare class Agent {
|
|
|
3163
3477
|
* Terminate a task with a specified task ID.
|
|
3164
3478
|
*
|
|
3165
3479
|
* @param taskId - The ID of the running task.
|
|
3166
|
-
* @returns ExecutionResult containing success status, task output, and
|
|
3480
|
+
* @returns ExecutionResult containing success status, task output, and
|
|
3481
|
+
* error message if any.
|
|
3167
3482
|
*
|
|
3168
3483
|
* @example
|
|
3169
3484
|
* ```typescript
|
|
3170
3485
|
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3171
3486
|
* const result = await agentBay.create({ imageId: 'windows_latest' });
|
|
3172
3487
|
* if (result.success) {
|
|
3173
|
-
* const taskResult = await result.session.agent.executeTask(
|
|
3174
|
-
*
|
|
3488
|
+
* const taskResult = await result.session.agent.computer.executeTask(
|
|
3489
|
+
* 'Open notepad',
|
|
3490
|
+
* 5
|
|
3491
|
+
* );
|
|
3492
|
+
* const terminateResult = await result.session.agent.computer.terminateTask(
|
|
3493
|
+
* taskResult.taskId
|
|
3494
|
+
* );
|
|
3495
|
+
* console.log(`Terminated: ${terminateResult.taskStatus}`);
|
|
3496
|
+
* await result.session.delete();
|
|
3497
|
+
* }
|
|
3498
|
+
* ```
|
|
3499
|
+
*/
|
|
3500
|
+
terminateTask(taskId: string): Promise<ExecutionResult>;
|
|
3501
|
+
}
|
|
3502
|
+
declare class BrowserUseAgent {
|
|
3503
|
+
private session;
|
|
3504
|
+
/**
|
|
3505
|
+
* Initialize an Browser Agent object.
|
|
3506
|
+
* @description Browser Use Agent is in BETA ⚠️ .
|
|
3507
|
+
*
|
|
3508
|
+
* @param session - The Session instance that this Agent belongs to.
|
|
3509
|
+
*/
|
|
3510
|
+
constructor(session: McpSession);
|
|
3511
|
+
/**
|
|
3512
|
+
* Initialize the browser agent with specific options.
|
|
3513
|
+
* @param options - agent initialization options
|
|
3514
|
+
* @returns InitializationResult containing success status, task output,
|
|
3515
|
+
* and error message if any.
|
|
3516
|
+
*
|
|
3517
|
+
* @example
|
|
3518
|
+
* ```typescript
|
|
3519
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3520
|
+
* const result = await agentBay.create({ imageId: 'linux_latest' });
|
|
3521
|
+
* if (result.success) {
|
|
3522
|
+
* options:AgentOptions = new AgentOptions(use_vision=False,
|
|
3523
|
+
* output_schema=""); const initResult = await
|
|
3524
|
+
* result.session.agent.browser.initialize(options); console.log(`Initialize
|
|
3525
|
+
* success: ${initResult.success}`); await result.session.delete();
|
|
3526
|
+
* }
|
|
3527
|
+
* ```
|
|
3528
|
+
*/
|
|
3529
|
+
initialize(options: AgentOptions): Promise<InitializationResult>;
|
|
3530
|
+
/**
|
|
3531
|
+
* Execute a specific task described in human language.
|
|
3532
|
+
*
|
|
3533
|
+
* @param task - Task description in human language.
|
|
3534
|
+
* @param maxTryTimes - Maximum number of retry attempts.
|
|
3535
|
+
* @returns ExecutionResult containing success status, task output, and
|
|
3536
|
+
* error message if any.
|
|
3537
|
+
*
|
|
3538
|
+
* @example
|
|
3539
|
+
* ```typescript
|
|
3540
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3541
|
+
* const result = await agentBay.create({ imageId: 'linux_latest' });
|
|
3542
|
+
* if (result.success) {
|
|
3543
|
+
* const taskResult = await result.session.agent.browser.executeTask(
|
|
3544
|
+
* 'Navigate to baidu and query the weather of Shanghai',
|
|
3545
|
+
* 10
|
|
3546
|
+
* );
|
|
3547
|
+
* console.log(`Task status: ${taskResult.taskStatus}`);
|
|
3548
|
+
* await result.session.delete();
|
|
3549
|
+
* }
|
|
3550
|
+
* ```
|
|
3551
|
+
*/
|
|
3552
|
+
executeTask(task: string, maxTryTimes: number): Promise<ExecutionResult>;
|
|
3553
|
+
/**
|
|
3554
|
+
* Get the status of the task with the given task ID.
|
|
3555
|
+
*
|
|
3556
|
+
* @param taskId - Task ID
|
|
3557
|
+
* @returns QueryResult containing the task status
|
|
3558
|
+
*
|
|
3559
|
+
* @example
|
|
3560
|
+
* ```typescript
|
|
3561
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3562
|
+
* const result = await agentBay.create({ imageId: 'linux_latest' });
|
|
3563
|
+
* if (result.success) {
|
|
3564
|
+
* const taskResult = await result.session.agent.browser.executeTask(
|
|
3565
|
+
* 'Navigate to baidu and query the weather of Shanghai',
|
|
3566
|
+
* 10
|
|
3567
|
+
* );
|
|
3568
|
+
* const statusResult = await result.session.agent.browser.getTaskStatus(
|
|
3569
|
+
* taskResult.taskId
|
|
3570
|
+
* );
|
|
3571
|
+
* console.log(`Status: ${statusResult.taskStatus}`);
|
|
3572
|
+
* await result.session.delete();
|
|
3573
|
+
* }
|
|
3574
|
+
* ```
|
|
3575
|
+
*/
|
|
3576
|
+
getTaskStatus(taskId: string): Promise<QueryResult>;
|
|
3577
|
+
/**
|
|
3578
|
+
* Terminate a task with a specified task ID.
|
|
3579
|
+
*
|
|
3580
|
+
* @param taskId - The ID of the running task.
|
|
3581
|
+
* @returns ExecutionResult containing success status, task output, and
|
|
3582
|
+
* error message if any.
|
|
3583
|
+
*
|
|
3584
|
+
* @example
|
|
3585
|
+
* ```typescript
|
|
3586
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3587
|
+
* const result = await agentBay.create({ imageId: 'linux_latest' });
|
|
3588
|
+
* if (result.success) {
|
|
3589
|
+
* const taskResult = await result.session.agent.browser.executeTask(
|
|
3590
|
+
* 'Navigate to baidu and query the weather of Shanghai',
|
|
3591
|
+
* 10
|
|
3592
|
+
* );
|
|
3593
|
+
* const terminateResult = await result.session.agent.browser.terminateTask(
|
|
3594
|
+
* taskResult.taskId
|
|
3595
|
+
* );
|
|
3175
3596
|
* console.log(`Terminated: ${terminateResult.taskStatus}`);
|
|
3176
3597
|
* await result.session.delete();
|
|
3177
3598
|
* }
|
|
@@ -3179,35 +3600,53 @@ declare class Agent {
|
|
|
3179
3600
|
*/
|
|
3180
3601
|
terminateTask(taskId: string): Promise<ExecutionResult>;
|
|
3181
3602
|
}
|
|
3603
|
+
/**
|
|
3604
|
+
* An Agent to manipulate applications to complete specific tasks.
|
|
3605
|
+
* According to the use scenary, The agent can a browser use agent which is
|
|
3606
|
+
* specialized for browser automation tasks, The agent also can be a computer
|
|
3607
|
+
* use agent which is specialized for multiple applications automation tasks.
|
|
3608
|
+
*/
|
|
3609
|
+
declare class Agent {
|
|
3610
|
+
/**
|
|
3611
|
+
* An instance of Computer Use Agent.
|
|
3612
|
+
*/
|
|
3613
|
+
computer: ComputerUseAgent;
|
|
3614
|
+
/**
|
|
3615
|
+
* An instance of Browser Use Agent.
|
|
3616
|
+
*/
|
|
3617
|
+
browser: BrowserUseAgent;
|
|
3618
|
+
/**
|
|
3619
|
+
* Initialize an Agent object.
|
|
3620
|
+
*
|
|
3621
|
+
* @param session - The Session instance that this Agent belongs to.
|
|
3622
|
+
*/
|
|
3623
|
+
constructor(session: McpSession);
|
|
3624
|
+
}
|
|
3182
3625
|
|
|
3183
3626
|
interface ActOptions {
|
|
3184
3627
|
action: string;
|
|
3185
|
-
|
|
3186
|
-
iframes?: boolean;
|
|
3187
|
-
domSettleTimeoutMS?: number;
|
|
3628
|
+
timeout?: number;
|
|
3188
3629
|
variables?: Record<string, string>;
|
|
3189
3630
|
use_vision?: boolean;
|
|
3190
3631
|
}
|
|
3191
3632
|
interface ObserveOptions {
|
|
3192
3633
|
instruction: string;
|
|
3193
|
-
iframes?: boolean;
|
|
3194
|
-
domSettleTimeoutMS?: number;
|
|
3195
3634
|
use_vision?: boolean;
|
|
3635
|
+
selector?: string;
|
|
3636
|
+
timeout?: number;
|
|
3196
3637
|
}
|
|
3197
|
-
interface ExtractOptions<
|
|
3638
|
+
interface ExtractOptions<TSchema extends ZodTypeAny = ZodTypeAny> {
|
|
3198
3639
|
instruction: string;
|
|
3199
|
-
schema:
|
|
3640
|
+
schema: TSchema;
|
|
3200
3641
|
use_text_extract?: boolean;
|
|
3201
3642
|
selector?: string;
|
|
3202
|
-
iframe?: boolean;
|
|
3203
|
-
domSettleTimeoutMS?: number;
|
|
3204
3643
|
use_vision?: boolean;
|
|
3644
|
+
timeout?: number;
|
|
3205
3645
|
}
|
|
3206
3646
|
declare class ActResult {
|
|
3207
3647
|
success: boolean;
|
|
3208
3648
|
message: string;
|
|
3209
|
-
|
|
3210
|
-
constructor(success: boolean, message: string, action?: string);
|
|
3649
|
+
constructor(success: boolean, message: string);
|
|
3211
3650
|
}
|
|
3212
3651
|
declare class ObserveResult {
|
|
3213
3652
|
selector: string;
|
|
@@ -3220,15 +3659,21 @@ declare class BrowserAgent {
|
|
|
3220
3659
|
private session;
|
|
3221
3660
|
private browser;
|
|
3222
3661
|
constructor(session: Session, browser: Browser);
|
|
3662
|
+
/** ------------------ NAVIGATE ------------------ **/
|
|
3663
|
+
navigate(url: string): Promise<string>;
|
|
3664
|
+
/** ------------------ SCREENSHOT ------------------ **/
|
|
3665
|
+
screenshot(page?: any, full_page?: boolean, quality?: number, clip?: Record<string, number>, timeout?: number): Promise<string>;
|
|
3666
|
+
/** ------------------ CLOSE ------------------ **/
|
|
3667
|
+
close(): Promise<boolean>;
|
|
3223
3668
|
/** ------------------ ACT ------------------ **/
|
|
3224
|
-
act(options: ActOptions, page
|
|
3225
|
-
actAsync(options: ActOptions, page
|
|
3669
|
+
act(options: ActOptions, page?: any): Promise<ActResult>;
|
|
3670
|
+
actAsync(options: ActOptions, page?: any): Promise<ActResult>;
|
|
3226
3671
|
/** ------------------ OBSERVE ------------------ **/
|
|
3227
|
-
observe(options: ObserveOptions, page
|
|
3228
|
-
observeAsync(options: ObserveOptions, page
|
|
3672
|
+
observe(options: ObserveOptions, page?: any): Promise<[boolean, ObserveResult[]]>;
|
|
3673
|
+
observeAsync(options: ObserveOptions, page?: any): Promise<[boolean, ObserveResult[]]>;
|
|
3229
3674
|
/** ------------------ EXTRACT ------------------ **/
|
|
3230
|
-
extract<
|
|
3231
|
-
extractAsync<
|
|
3675
|
+
extract<TSchema extends ZodTypeAny>(options: ExtractOptions<TSchema>, page?: any): Promise<[boolean, z.infer<TSchema> | null]>;
|
|
3676
|
+
extractAsync<TSchema extends ZodTypeAny>(options: ExtractOptions<TSchema>, page?: any): Promise<[boolean, z.infer<TSchema> | null]>;
|
|
3232
3677
|
private _getPageAndContextIndexAsync;
|
|
3233
3678
|
private _callMcpTool;
|
|
3234
3679
|
private _delay;
|
|
@@ -3639,6 +4084,11 @@ declare class Code {
|
|
|
3639
4084
|
requestId: string;
|
|
3640
4085
|
}>;
|
|
3641
4086
|
});
|
|
4087
|
+
/**
|
|
4088
|
+
* Parses the backend JSON response into a structured CodeExecutionResult
|
|
4089
|
+
* @param data Raw JSON string from backend
|
|
4090
|
+
*/
|
|
4091
|
+
private parseBackendResponse;
|
|
3642
4092
|
/**
|
|
3643
4093
|
* Execute code in the specified language with a timeout.
|
|
3644
4094
|
* Corresponds to Python's run_code() method
|
|
@@ -3657,6 +4107,9 @@ declare class Code {
|
|
|
3657
4107
|
* if (result.success) {
|
|
3658
4108
|
* const codeResult = await result.session.code.runCode('print("Hello")', "python");
|
|
3659
4109
|
* console.log(codeResult.result);
|
|
4110
|
+
* if (codeResult.results) {
|
|
4111
|
+
* // Access rich output like images or charts
|
|
4112
|
+
* }
|
|
3660
4113
|
* await result.session.delete();
|
|
3661
4114
|
* }
|
|
3662
4115
|
* ```
|
|
@@ -3683,14 +4136,28 @@ declare class Command {
|
|
|
3683
4136
|
*/
|
|
3684
4137
|
private sanitizeError;
|
|
3685
4138
|
/**
|
|
3686
|
-
*
|
|
4139
|
+
* Execute a shell command with optional working directory and environment variables.
|
|
3687
4140
|
*
|
|
3688
|
-
*
|
|
3689
|
-
*
|
|
4141
|
+
* Executes a shell command in the session environment with configurable timeout,
|
|
4142
|
+
* working directory, and environment variables. The command runs with session
|
|
4143
|
+
* user permissions in a Linux shell environment.
|
|
4144
|
+
*
|
|
4145
|
+
* @param command - The shell command to execute
|
|
4146
|
+
* @param timeoutMs - Timeout in milliseconds (default: 1000ms/1s). Maximum allowed
|
|
4147
|
+
* timeout is 50000ms (50s). If a larger value is provided,
|
|
4148
|
+
* it will be automatically limited to 50000ms
|
|
4149
|
+
* @param cwd - The working directory for command execution. If not specified,
|
|
4150
|
+
* the command runs in the default session directory
|
|
4151
|
+
* @param envs - Environment variables as a dictionary of key-value pairs.
|
|
4152
|
+
* These variables are set for the command execution only
|
|
3690
4153
|
*
|
|
3691
4154
|
* @returns Promise resolving to CommandResult containing:
|
|
3692
|
-
* - success: Whether the command executed successfully
|
|
3693
|
-
* - output:
|
|
4155
|
+
* - success: Whether the command executed successfully (exitCode === 0)
|
|
4156
|
+
* - output: Command output for backward compatibility (stdout + stderr)
|
|
4157
|
+
* - exitCode: The exit code of the command execution (0 for success)
|
|
4158
|
+
* - stdout: Standard output from the command execution
|
|
4159
|
+
* - stderr: Standard error from the command execution
|
|
4160
|
+
* - traceId: Trace ID for error tracking (only present when exitCode !== 0)
|
|
3694
4161
|
* - requestId: Unique identifier for this API request
|
|
3695
4162
|
* - errorMessage: Error description if execution failed
|
|
3696
4163
|
*
|
|
@@ -3699,22 +4166,31 @@ declare class Command {
|
|
|
3699
4166
|
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
3700
4167
|
* const result = await agentBay.create();
|
|
3701
4168
|
* if (result.success) {
|
|
3702
|
-
* const cmdResult = await result.session.command.executeCommand('echo "Hello"',
|
|
4169
|
+
* const cmdResult = await result.session.command.executeCommand('echo "Hello"', 5000);
|
|
3703
4170
|
* console.log('Command output:', cmdResult.output);
|
|
4171
|
+
* console.log('Exit code:', cmdResult.exitCode);
|
|
4172
|
+
* console.log('Stdout:', cmdResult.stdout);
|
|
3704
4173
|
* await result.session.delete();
|
|
3705
4174
|
* }
|
|
3706
4175
|
* ```
|
|
3707
4176
|
*
|
|
3708
|
-
* @
|
|
3709
|
-
*
|
|
3710
|
-
*
|
|
3711
|
-
*
|
|
3712
|
-
*
|
|
3713
|
-
*
|
|
3714
|
-
*
|
|
3715
|
-
*
|
|
4177
|
+
* @example
|
|
4178
|
+
* ```typescript
|
|
4179
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
4180
|
+
* const result = await agentBay.create();
|
|
4181
|
+
* if (result.success) {
|
|
4182
|
+
* const cmdResult = await result.session.command.executeCommand(
|
|
4183
|
+
* 'pwd',
|
|
4184
|
+
* 5000,
|
|
4185
|
+
* '/tmp',
|
|
4186
|
+
* { TEST_VAR: 'test_value' }
|
|
4187
|
+
* );
|
|
4188
|
+
* console.log('Working directory:', cmdResult.stdout);
|
|
4189
|
+
* await result.session.delete();
|
|
4190
|
+
* }
|
|
4191
|
+
* ```
|
|
3716
4192
|
*/
|
|
3717
|
-
executeCommand(command: string, timeoutMs?: number): Promise<CommandResult>;
|
|
4193
|
+
executeCommand(command: string, timeoutMs?: number, cwd?: string, envs?: Record<string, string>): Promise<CommandResult>;
|
|
3718
4194
|
}
|
|
3719
4195
|
|
|
3720
4196
|
/**
|
|
@@ -3800,6 +4276,9 @@ declare function replaceTemplatePlaceholders(template: string, replacements: Rec
|
|
|
3800
4276
|
* Provides mouse, keyboard, and screen operations for desktop environments.
|
|
3801
4277
|
*/
|
|
3802
4278
|
|
|
4279
|
+
interface ScreenshotResult$1 extends OperationResult {
|
|
4280
|
+
data: string;
|
|
4281
|
+
}
|
|
3803
4282
|
declare enum MouseButton {
|
|
3804
4283
|
LEFT = "left",
|
|
3805
4284
|
RIGHT = "right",
|
|
@@ -3812,21 +4291,6 @@ declare enum ScrollDirection {
|
|
|
3812
4291
|
LEFT = "left",
|
|
3813
4292
|
RIGHT = "right"
|
|
3814
4293
|
}
|
|
3815
|
-
interface BoolResult$1 extends OperationResult {
|
|
3816
|
-
data?: boolean;
|
|
3817
|
-
}
|
|
3818
|
-
interface CursorPosition extends OperationResult {
|
|
3819
|
-
x: number;
|
|
3820
|
-
y: number;
|
|
3821
|
-
}
|
|
3822
|
-
interface ScreenSize extends OperationResult {
|
|
3823
|
-
width: number;
|
|
3824
|
-
height: number;
|
|
3825
|
-
dpiScalingFactor: number;
|
|
3826
|
-
}
|
|
3827
|
-
interface ScreenshotResult$1 extends OperationResult {
|
|
3828
|
-
data: string;
|
|
3829
|
-
}
|
|
3830
4294
|
interface ComputerSession {
|
|
3831
4295
|
callMcpTool(toolName: string, args: Record<string, any>): Promise<any>;
|
|
3832
4296
|
sessionId: string;
|
|
@@ -3855,7 +4319,7 @@ declare class Computer {
|
|
|
3855
4319
|
* }
|
|
3856
4320
|
* ```
|
|
3857
4321
|
*/
|
|
3858
|
-
clickMouse(x: number, y: number, button?: MouseButton | string): Promise<
|
|
4322
|
+
clickMouse(x: number, y: number, button?: MouseButton | string): Promise<OperationResult>;
|
|
3859
4323
|
/**
|
|
3860
4324
|
* Move mouse to specified coordinates.
|
|
3861
4325
|
*
|
|
@@ -3875,7 +4339,7 @@ declare class Computer {
|
|
|
3875
4339
|
* }
|
|
3876
4340
|
* ```
|
|
3877
4341
|
*/
|
|
3878
|
-
moveMouse(x: number, y: number): Promise<
|
|
4342
|
+
moveMouse(x: number, y: number): Promise<OperationResult>;
|
|
3879
4343
|
/**
|
|
3880
4344
|
* Drag mouse from one position to another.
|
|
3881
4345
|
*
|
|
@@ -3897,7 +4361,7 @@ declare class Computer {
|
|
|
3897
4361
|
* }
|
|
3898
4362
|
* ```
|
|
3899
4363
|
*/
|
|
3900
|
-
dragMouse(fromX: number, fromY: number, toX: number, toY: number, button?: MouseButton | string): Promise<
|
|
4364
|
+
dragMouse(fromX: number, fromY: number, toX: number, toY: number, button?: MouseButton | string): Promise<OperationResult>;
|
|
3901
4365
|
/**
|
|
3902
4366
|
* Scroll at specified coordinates.
|
|
3903
4367
|
*
|
|
@@ -3917,7 +4381,7 @@ declare class Computer {
|
|
|
3917
4381
|
* }
|
|
3918
4382
|
* ```
|
|
3919
4383
|
*/
|
|
3920
|
-
scroll(x: number, y: number, direction?: ScrollDirection | string, amount?: number): Promise<
|
|
4384
|
+
scroll(x: number, y: number, direction?: ScrollDirection | string, amount?: number): Promise<OperationResult>;
|
|
3921
4385
|
/**
|
|
3922
4386
|
* Input text at the current cursor position.
|
|
3923
4387
|
*
|
|
@@ -3934,7 +4398,7 @@ declare class Computer {
|
|
|
3934
4398
|
* }
|
|
3935
4399
|
* ```
|
|
3936
4400
|
*/
|
|
3937
|
-
inputText(text: string): Promise<
|
|
4401
|
+
inputText(text: string): Promise<OperationResult>;
|
|
3938
4402
|
/**
|
|
3939
4403
|
* Press one or more keys.
|
|
3940
4404
|
*
|
|
@@ -3953,7 +4417,7 @@ declare class Computer {
|
|
|
3953
4417
|
* }
|
|
3954
4418
|
* ```
|
|
3955
4419
|
*/
|
|
3956
|
-
pressKeys(keys: string[], hold?: boolean): Promise<
|
|
4420
|
+
pressKeys(keys: string[], hold?: boolean): Promise<OperationResult>;
|
|
3957
4421
|
/**
|
|
3958
4422
|
* Release previously pressed keys.
|
|
3959
4423
|
*
|
|
@@ -3971,7 +4435,7 @@ declare class Computer {
|
|
|
3971
4435
|
* }
|
|
3972
4436
|
* ```
|
|
3973
4437
|
*/
|
|
3974
|
-
releaseKeys(keys: string[]): Promise<
|
|
4438
|
+
releaseKeys(keys: string[]): Promise<OperationResult>;
|
|
3975
4439
|
/**
|
|
3976
4440
|
* Get cursor position.
|
|
3977
4441
|
*
|
|
@@ -4058,7 +4522,7 @@ declare class Computer {
|
|
|
4058
4522
|
* }
|
|
4059
4523
|
* ```
|
|
4060
4524
|
*/
|
|
4061
|
-
getActiveWindow(
|
|
4525
|
+
getActiveWindow(): Promise<WindowInfoResult>;
|
|
4062
4526
|
/**
|
|
4063
4527
|
* Activates the specified window.
|
|
4064
4528
|
*
|
|
@@ -4076,7 +4540,7 @@ declare class Computer {
|
|
|
4076
4540
|
* }
|
|
4077
4541
|
* ```
|
|
4078
4542
|
*/
|
|
4079
|
-
activateWindow(windowId: number): Promise<BoolResult$
|
|
4543
|
+
activateWindow(windowId: number): Promise<BoolResult$1>;
|
|
4080
4544
|
/**
|
|
4081
4545
|
* Closes the specified window.
|
|
4082
4546
|
*
|
|
@@ -4095,7 +4559,7 @@ declare class Computer {
|
|
|
4095
4559
|
* }
|
|
4096
4560
|
* ```
|
|
4097
4561
|
*/
|
|
4098
|
-
closeWindow(windowId: number): Promise<BoolResult$
|
|
4562
|
+
closeWindow(windowId: number): Promise<BoolResult$1>;
|
|
4099
4563
|
/**
|
|
4100
4564
|
* Maximizes the specified window.
|
|
4101
4565
|
*
|
|
@@ -4114,7 +4578,7 @@ declare class Computer {
|
|
|
4114
4578
|
* }
|
|
4115
4579
|
* ```
|
|
4116
4580
|
*/
|
|
4117
|
-
maximizeWindow(windowId: number): Promise<BoolResult$
|
|
4581
|
+
maximizeWindow(windowId: number): Promise<BoolResult$1>;
|
|
4118
4582
|
/**
|
|
4119
4583
|
* Minimizes the specified window.
|
|
4120
4584
|
*
|
|
@@ -4133,7 +4597,7 @@ declare class Computer {
|
|
|
4133
4597
|
* }
|
|
4134
4598
|
* ```
|
|
4135
4599
|
*/
|
|
4136
|
-
minimizeWindow(windowId: number): Promise<BoolResult$
|
|
4600
|
+
minimizeWindow(windowId: number): Promise<BoolResult$1>;
|
|
4137
4601
|
/**
|
|
4138
4602
|
* Restores the specified window.
|
|
4139
4603
|
*
|
|
@@ -4153,7 +4617,7 @@ declare class Computer {
|
|
|
4153
4617
|
* }
|
|
4154
4618
|
* ```
|
|
4155
4619
|
*/
|
|
4156
|
-
restoreWindow(windowId: number): Promise<BoolResult$
|
|
4620
|
+
restoreWindow(windowId: number): Promise<BoolResult$1>;
|
|
4157
4621
|
/**
|
|
4158
4622
|
* Resizes the specified window.
|
|
4159
4623
|
*
|
|
@@ -4174,7 +4638,7 @@ declare class Computer {
|
|
|
4174
4638
|
* }
|
|
4175
4639
|
* ```
|
|
4176
4640
|
*/
|
|
4177
|
-
resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult$
|
|
4641
|
+
resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult$1>;
|
|
4178
4642
|
/**
|
|
4179
4643
|
* Makes the specified window fullscreen.
|
|
4180
4644
|
*
|
|
@@ -4193,7 +4657,7 @@ declare class Computer {
|
|
|
4193
4657
|
* }
|
|
4194
4658
|
* ```
|
|
4195
4659
|
*/
|
|
4196
|
-
fullscreenWindow(windowId: number): Promise<BoolResult$
|
|
4660
|
+
fullscreenWindow(windowId: number): Promise<BoolResult$1>;
|
|
4197
4661
|
/**
|
|
4198
4662
|
* Toggles focus mode on or off.
|
|
4199
4663
|
*
|
|
@@ -4211,7 +4675,7 @@ declare class Computer {
|
|
|
4211
4675
|
* }
|
|
4212
4676
|
* ```
|
|
4213
4677
|
*/
|
|
4214
|
-
focusMode(on: boolean): Promise<BoolResult$
|
|
4678
|
+
focusMode(on: boolean): Promise<BoolResult$1>;
|
|
4215
4679
|
/**
|
|
4216
4680
|
* Gets the list of installed applications.
|
|
4217
4681
|
*
|
|
@@ -4231,7 +4695,7 @@ declare class Computer {
|
|
|
4231
4695
|
* }
|
|
4232
4696
|
* ```
|
|
4233
4697
|
*/
|
|
4234
|
-
getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<
|
|
4698
|
+
getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<InstalledAppListResult>;
|
|
4235
4699
|
/**
|
|
4236
4700
|
* Starts the specified application.
|
|
4237
4701
|
*
|
|
@@ -4251,7 +4715,7 @@ declare class Computer {
|
|
|
4251
4715
|
* }
|
|
4252
4716
|
* ```
|
|
4253
4717
|
*/
|
|
4254
|
-
startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<
|
|
4718
|
+
startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<ProcessListResult>;
|
|
4255
4719
|
/**
|
|
4256
4720
|
* Stops an application by process name.
|
|
4257
4721
|
*
|
|
@@ -4269,7 +4733,7 @@ declare class Computer {
|
|
|
4269
4733
|
* }
|
|
4270
4734
|
* ```
|
|
4271
4735
|
*/
|
|
4272
|
-
stopAppByPName(pname: string): Promise<
|
|
4736
|
+
stopAppByPName(pname: string): Promise<BoolResult$1>;
|
|
4273
4737
|
/**
|
|
4274
4738
|
* Stops an application by process ID.
|
|
4275
4739
|
*
|
|
@@ -4288,7 +4752,7 @@ declare class Computer {
|
|
|
4288
4752
|
* }
|
|
4289
4753
|
* ```
|
|
4290
4754
|
*/
|
|
4291
|
-
stopAppByPID(pid: number): Promise<
|
|
4755
|
+
stopAppByPID(pid: number): Promise<BoolResult$1>;
|
|
4292
4756
|
/**
|
|
4293
4757
|
* Stops an application by stop command.
|
|
4294
4758
|
*
|
|
@@ -4306,7 +4770,7 @@ declare class Computer {
|
|
|
4306
4770
|
* }
|
|
4307
4771
|
* ```
|
|
4308
4772
|
*/
|
|
4309
|
-
stopAppByCmd(cmd: string): Promise<
|
|
4773
|
+
stopAppByCmd(cmd: string): Promise<BoolResult$1>;
|
|
4310
4774
|
/**
|
|
4311
4775
|
* Lists all visible applications.
|
|
4312
4776
|
*
|
|
@@ -4323,7 +4787,7 @@ declare class Computer {
|
|
|
4323
4787
|
* }
|
|
4324
4788
|
* ```
|
|
4325
4789
|
*/
|
|
4326
|
-
listVisibleApps(): Promise<
|
|
4790
|
+
listVisibleApps(): Promise<ProcessListResult>;
|
|
4327
4791
|
}
|
|
4328
4792
|
|
|
4329
4793
|
interface ContextStatusData {
|
|
@@ -4521,6 +4985,24 @@ declare class FileSystem {
|
|
|
4521
4985
|
* @returns The FileTransfer instance
|
|
4522
4986
|
*/
|
|
4523
4987
|
private _ensureFileTransfer;
|
|
4988
|
+
/**
|
|
4989
|
+
* Get the context path for file transfer operations.
|
|
4990
|
+
*
|
|
4991
|
+
* This method ensures the context ID is loaded and returns the associated
|
|
4992
|
+
* context path that was retrieved from GetAndLoadInternalContext API.
|
|
4993
|
+
*
|
|
4994
|
+
* @returns The context path if available, null otherwise.
|
|
4995
|
+
*
|
|
4996
|
+
* @example
|
|
4997
|
+
* ```typescript
|
|
4998
|
+
* const session = (await agentBay.create(params)).session;
|
|
4999
|
+
* const contextPath = await session.fileSystem.getFileTransferContextPath();
|
|
5000
|
+
* if (contextPath) {
|
|
5001
|
+
* console.log(`Context path: ${contextPath}`);
|
|
5002
|
+
* }
|
|
5003
|
+
* ```
|
|
5004
|
+
*/
|
|
5005
|
+
getFileTransferContextPath(): Promise<string | null>;
|
|
4524
5006
|
/**
|
|
4525
5007
|
* Creates a new directory at the specified path.
|
|
4526
5008
|
* Corresponds to Python's create_directory() method
|
|
@@ -4539,7 +5021,28 @@ declare class FileSystem {
|
|
|
4539
5021
|
* }
|
|
4540
5022
|
* ```
|
|
4541
5023
|
*/
|
|
4542
|
-
createDirectory(path: string): Promise<BoolResult$
|
|
5024
|
+
createDirectory(path: string): Promise<BoolResult$1>;
|
|
5025
|
+
/**
|
|
5026
|
+
* Deletes a file at the specified path.
|
|
5027
|
+
* Corresponds to Python's delete_file() method
|
|
5028
|
+
*
|
|
5029
|
+
* @param path - Path to the file to delete.
|
|
5030
|
+
* @returns BoolResult with deletion result and requestId
|
|
5031
|
+
*
|
|
5032
|
+
* @example
|
|
5033
|
+
* ```typescript
|
|
5034
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
5035
|
+
* const result = await agentBay.create();
|
|
5036
|
+
* if (result.success) {
|
|
5037
|
+
* const session = result.session;
|
|
5038
|
+
* await session.fileSystem.writeFile('/tmp/to_delete.txt', 'hello');
|
|
5039
|
+
* const deleteResult = await session.fileSystem.deleteFile('/tmp/to_delete.txt');
|
|
5040
|
+
* console.log('File deleted:', deleteResult.success);
|
|
5041
|
+
* await session.delete();
|
|
5042
|
+
* }
|
|
5043
|
+
* ```
|
|
5044
|
+
*/
|
|
5045
|
+
deleteFile(path: string): Promise<BoolResult$1>;
|
|
4543
5046
|
/**
|
|
4544
5047
|
* Edits a file by replacing occurrences of oldText with newText.
|
|
4545
5048
|
* Corresponds to Python's edit_file() method
|
|
@@ -4565,7 +5068,7 @@ declare class FileSystem {
|
|
|
4565
5068
|
editFile(path: string, edits: Array<{
|
|
4566
5069
|
oldText: string;
|
|
4567
5070
|
newText: string;
|
|
4568
|
-
}>, dryRun?: boolean): Promise<BoolResult$
|
|
5071
|
+
}>, dryRun?: boolean): Promise<BoolResult$1>;
|
|
4569
5072
|
/**
|
|
4570
5073
|
* Gets information about a file or directory.
|
|
4571
5074
|
* Corresponds to Python's get_file_info() method
|
|
@@ -4646,7 +5149,7 @@ declare class FileSystem {
|
|
|
4646
5149
|
* }
|
|
4647
5150
|
* ```
|
|
4648
5151
|
*/
|
|
4649
|
-
moveFile(source: string, destination: string): Promise<BoolResult$
|
|
5152
|
+
moveFile(source: string, destination: string): Promise<BoolResult$1>;
|
|
4650
5153
|
/**
|
|
4651
5154
|
* Internal method to read a file chunk. Used for chunked file operations.
|
|
4652
5155
|
*
|
|
@@ -4816,7 +5319,7 @@ declare class FileSystem {
|
|
|
4816
5319
|
*
|
|
4817
5320
|
* @see {@link readFile}, {@link listDirectory}
|
|
4818
5321
|
*/
|
|
4819
|
-
writeFile(path: string, content: string, mode?: string): Promise<BoolResult$
|
|
5322
|
+
writeFile(path: string, content: string, mode?: string): Promise<BoolResult$1>;
|
|
4820
5323
|
/**
|
|
4821
5324
|
* Get file change information for the specified directory path
|
|
4822
5325
|
*
|
|
@@ -4941,63 +5444,28 @@ interface AppManagerRule {
|
|
|
4941
5444
|
}
|
|
4942
5445
|
/**
|
|
4943
5446
|
* Mobile simulate mode enum.
|
|
4944
|
-
*
|
|
4945
|
-
* Defines the mode for mobile device simulation.
|
|
4946
5447
|
*/
|
|
4947
5448
|
declare enum MobileSimulateMode {
|
|
4948
|
-
/**
|
|
4949
|
-
* Only simulate device properties (build.prop).
|
|
4950
|
-
*/
|
|
4951
5449
|
PropertiesOnly = "PropertiesOnly",
|
|
4952
|
-
/**
|
|
4953
|
-
* Only simulate sensors information.
|
|
4954
|
-
*/
|
|
4955
5450
|
SensorsOnly = "SensorsOnly",
|
|
4956
|
-
/**
|
|
4957
|
-
* Only simulate installed packages.
|
|
4958
|
-
*/
|
|
4959
5451
|
PackagesOnly = "PackagesOnly",
|
|
4960
|
-
/**
|
|
4961
|
-
* Only simulate system services.
|
|
4962
|
-
*/
|
|
4963
5452
|
ServicesOnly = "ServicesOnly",
|
|
4964
|
-
/**
|
|
4965
|
-
* Simulate all aspects (properties, sensors, packages, and services).
|
|
4966
|
-
*/
|
|
4967
5453
|
All = "All"
|
|
4968
5454
|
}
|
|
4969
5455
|
/**
|
|
4970
|
-
* Mobile simulate configuration
|
|
4971
|
-
*
|
|
4972
|
-
* These settings allow simulation of different mobile devices by applying
|
|
4973
|
-
* device-specific properties and configurations.
|
|
5456
|
+
* Mobile simulate configuration.
|
|
4974
5457
|
*/
|
|
4975
5458
|
interface MobileSimulateConfig {
|
|
4976
|
-
/**
|
|
4977
|
-
* Whether to enable mobile device simulation.
|
|
4978
|
-
*/
|
|
4979
5459
|
simulate: boolean;
|
|
4980
|
-
/**
|
|
4981
|
-
* Path to the mobile device information file.
|
|
4982
|
-
*/
|
|
4983
5460
|
simulatePath?: string;
|
|
4984
|
-
|
|
4985
|
-
* Simulation mode - controls what aspects of the device are simulated.
|
|
4986
|
-
* Defaults to PropertiesOnly if not specified.
|
|
4987
|
-
*/
|
|
4988
|
-
simulateMode?: MobileSimulateMode;
|
|
4989
|
-
/**
|
|
4990
|
-
* Context ID containing the mobile device information to simulate.
|
|
4991
|
-
* This should be obtained from MobileSimulateService.uploadMobileInfo().
|
|
4992
|
-
*/
|
|
5461
|
+
simulateMode: MobileSimulateMode;
|
|
4993
5462
|
simulatedContextId?: string;
|
|
4994
5463
|
}
|
|
4995
5464
|
/**
|
|
4996
5465
|
* Mobile-specific configuration settings for session creation.
|
|
4997
5466
|
*
|
|
4998
5467
|
* These settings allow control over mobile device behavior including
|
|
4999
|
-
* resolution locking, app access management, navigation bar visibility, uninstall protection
|
|
5000
|
-
* and device simulation.
|
|
5468
|
+
* resolution locking, app access management, navigation bar visibility, and uninstall protection.
|
|
5001
5469
|
*/
|
|
5002
5470
|
interface MobileExtraConfig {
|
|
5003
5471
|
/**
|
|
@@ -5024,8 +5492,8 @@ interface MobileExtraConfig {
|
|
|
5024
5492
|
*/
|
|
5025
5493
|
uninstallBlacklist?: string[];
|
|
5026
5494
|
/**
|
|
5027
|
-
*
|
|
5028
|
-
*
|
|
5495
|
+
* Configuration for mobile device simulation.
|
|
5496
|
+
* Used to simulate specific device properties, sensors, etc.
|
|
5029
5497
|
*/
|
|
5030
5498
|
simulateConfig?: MobileSimulateConfig;
|
|
5031
5499
|
}
|
|
@@ -5505,8 +5973,6 @@ interface McpToolsResult extends OperationResult {
|
|
|
5505
5973
|
declare class Session {
|
|
5506
5974
|
private agentBay;
|
|
5507
5975
|
sessionId: string;
|
|
5508
|
-
fileTransferContextId: string | null;
|
|
5509
|
-
recordContextId: string | null;
|
|
5510
5976
|
isVpc: boolean;
|
|
5511
5977
|
networkInterfaceIp: string;
|
|
5512
5978
|
httpPort: string;
|
|
@@ -6370,16 +6836,18 @@ interface CreateSessionParamsConfig {
|
|
|
6370
6836
|
isVpc?: boolean;
|
|
6371
6837
|
/** Policy id to apply when creating the session. */
|
|
6372
6838
|
policyId?: string;
|
|
6373
|
-
/** Whether to enable browser recording for the session. Defaults to
|
|
6839
|
+
/** Whether to enable browser recording for the session. Defaults to true. */
|
|
6374
6840
|
enableBrowserReplay?: boolean;
|
|
6375
6841
|
/** Extra configuration settings for different session types (e.g., mobile) */
|
|
6376
6842
|
extraConfigs?: ExtraConfigs;
|
|
6843
|
+
/** Framework name for SDK statistics tracking */
|
|
6844
|
+
framework?: string;
|
|
6377
6845
|
}
|
|
6378
6846
|
/**
|
|
6379
6847
|
* CreateSessionParams provides a way to configure the parameters for creating a new session
|
|
6380
6848
|
* in the AgentBay cloud environment.
|
|
6381
6849
|
*/
|
|
6382
|
-
declare class CreateSessionParams
|
|
6850
|
+
declare class CreateSessionParams implements CreateSessionParamsConfig {
|
|
6383
6851
|
/** Custom labels for the Session. These can be used for organizing and filtering sessions. */
|
|
6384
6852
|
labels: Record<string, string>;
|
|
6385
6853
|
/** Image ID to use for the session. */
|
|
@@ -6395,43 +6863,49 @@ declare class CreateSessionParams$1 implements CreateSessionParamsConfig {
|
|
|
6395
6863
|
isVpc: boolean;
|
|
6396
6864
|
/** Policy id to apply when creating the session. */
|
|
6397
6865
|
policyId?: string;
|
|
6398
|
-
/** Whether to enable browser recording for the session. Defaults to
|
|
6399
|
-
enableBrowserReplay
|
|
6866
|
+
/** Whether to enable browser recording for the session. Defaults to true. */
|
|
6867
|
+
enableBrowserReplay?: boolean;
|
|
6400
6868
|
/** Extra configuration settings for different session types (e.g., mobile) */
|
|
6401
6869
|
extraConfigs?: ExtraConfigs;
|
|
6870
|
+
/** Framework name for SDK statistics tracking */
|
|
6871
|
+
framework?: string;
|
|
6402
6872
|
constructor();
|
|
6403
6873
|
/**
|
|
6404
6874
|
* WithLabels sets the labels for the session parameters and returns the updated parameters.
|
|
6405
6875
|
*/
|
|
6406
|
-
withLabels(labels: Record<string, string>): CreateSessionParams
|
|
6876
|
+
withLabels(labels: Record<string, string>): CreateSessionParams;
|
|
6407
6877
|
/**
|
|
6408
6878
|
* WithImageId sets the image ID for the session parameters and returns the updated parameters.
|
|
6409
6879
|
*/
|
|
6410
|
-
withImageId(imageId: string): CreateSessionParams
|
|
6880
|
+
withImageId(imageId: string): CreateSessionParams;
|
|
6411
6881
|
/**
|
|
6412
6882
|
* WithBrowserContext sets the browser context for the session parameters and returns the updated parameters.
|
|
6413
6883
|
*/
|
|
6414
|
-
withBrowserContext(browserContext: BrowserContext): CreateSessionParams
|
|
6884
|
+
withBrowserContext(browserContext: BrowserContext): CreateSessionParams;
|
|
6415
6885
|
/**
|
|
6416
6886
|
* WithIsVpc sets the VPC flag for the session parameters and returns the updated parameters.
|
|
6417
6887
|
*/
|
|
6418
|
-
withIsVpc(isVpc: boolean): CreateSessionParams
|
|
6888
|
+
withIsVpc(isVpc: boolean): CreateSessionParams;
|
|
6419
6889
|
/**
|
|
6420
6890
|
* WithPolicyId sets the policy id for the session parameters and returns the updated parameters.
|
|
6421
6891
|
*/
|
|
6422
|
-
withPolicyId(policyId: string): CreateSessionParams
|
|
6892
|
+
withPolicyId(policyId: string): CreateSessionParams;
|
|
6423
6893
|
/**
|
|
6424
6894
|
* WithenableBrowserReplay sets the browser recording flag for the session parameters and returns the updated parameters.
|
|
6425
6895
|
*/
|
|
6426
|
-
withEnableBrowserReplay(enableBrowserReplay: boolean): CreateSessionParams
|
|
6896
|
+
withEnableBrowserReplay(enableBrowserReplay: boolean): CreateSessionParams;
|
|
6427
6897
|
/**
|
|
6428
6898
|
* Alias for withEnableBrowserReplay for backward compatibility.
|
|
6429
6899
|
*/
|
|
6430
|
-
withEnableRecord(enableRecord: boolean): CreateSessionParams
|
|
6900
|
+
withEnableRecord(enableRecord: boolean): CreateSessionParams;
|
|
6431
6901
|
/**
|
|
6432
6902
|
* WithExtraConfigs sets the extra configurations for the session parameters and returns the updated parameters.
|
|
6433
6903
|
*/
|
|
6434
|
-
withExtraConfigs(extraConfigs: ExtraConfigs): CreateSessionParams
|
|
6904
|
+
withExtraConfigs(extraConfigs: ExtraConfigs): CreateSessionParams;
|
|
6905
|
+
/**
|
|
6906
|
+
* WithFramework sets the framework name for the session parameters and returns the updated parameters.
|
|
6907
|
+
*/
|
|
6908
|
+
withFramework(framework: string): CreateSessionParams;
|
|
6435
6909
|
/**
|
|
6436
6910
|
* GetLabelsJSON returns the labels as a JSON string.
|
|
6437
6911
|
* Returns an object with success status and result/error message to match Go version behavior.
|
|
@@ -6445,15 +6919,15 @@ declare class CreateSessionParams$1 implements CreateSessionParamsConfig {
|
|
|
6445
6919
|
/**
|
|
6446
6920
|
* AddContextSync adds a context sync configuration to the session parameters.
|
|
6447
6921
|
*/
|
|
6448
|
-
addContextSync(contextId: string, path: string, policy?: SyncPolicy): CreateSessionParams
|
|
6922
|
+
addContextSync(contextId: string, path: string, policy?: SyncPolicy): CreateSessionParams;
|
|
6449
6923
|
/**
|
|
6450
6924
|
* AddContextSyncConfig adds a pre-configured context sync to the session parameters.
|
|
6451
6925
|
*/
|
|
6452
|
-
addContextSyncConfig(contextSync: ContextSync): CreateSessionParams
|
|
6926
|
+
addContextSyncConfig(contextSync: ContextSync): CreateSessionParams;
|
|
6453
6927
|
/**
|
|
6454
6928
|
* WithContextSync sets the context sync configurations for the session parameters.
|
|
6455
6929
|
*/
|
|
6456
|
-
withContextSync(contextSyncs: ContextSync[]): CreateSessionParams
|
|
6930
|
+
withContextSync(contextSyncs: ContextSync[]): CreateSessionParams;
|
|
6457
6931
|
/**
|
|
6458
6932
|
* Convert to plain object for JSON serialization
|
|
6459
6933
|
*/
|
|
@@ -6461,12 +6935,12 @@ declare class CreateSessionParams$1 implements CreateSessionParamsConfig {
|
|
|
6461
6935
|
/**
|
|
6462
6936
|
* Create from plain object
|
|
6463
6937
|
*/
|
|
6464
|
-
static fromJSON(config: CreateSessionParamsConfig): CreateSessionParams
|
|
6938
|
+
static fromJSON(config: CreateSessionParamsConfig): CreateSessionParams;
|
|
6465
6939
|
}
|
|
6466
6940
|
/**
|
|
6467
6941
|
* NewCreateSessionParams creates a new CreateSessionParams with default values.
|
|
6468
6942
|
*/
|
|
6469
|
-
declare function newCreateSessionParams(): CreateSessionParams
|
|
6943
|
+
declare function newCreateSessionParams(): CreateSessionParams;
|
|
6470
6944
|
|
|
6471
6945
|
/**
|
|
6472
6946
|
* Parameters for listing sessions with pagination support
|
|
@@ -6500,7 +6974,7 @@ declare function createListSessionParams(labels?: Record<string, string>): ListS
|
|
|
6500
6974
|
/**
|
|
6501
6975
|
* Parameters for creating a session.
|
|
6502
6976
|
*/
|
|
6503
|
-
interface
|
|
6977
|
+
interface CreateSeesionWithParams {
|
|
6504
6978
|
labels?: Record<string, string>;
|
|
6505
6979
|
imageId?: string;
|
|
6506
6980
|
contextSync?: ContextSync[];
|
|
@@ -6516,9 +6990,9 @@ interface CreateSessionParams {
|
|
|
6516
6990
|
*/
|
|
6517
6991
|
declare class AgentBay {
|
|
6518
6992
|
private apiKey;
|
|
6519
|
-
|
|
6993
|
+
client: Client;
|
|
6520
6994
|
private endpoint;
|
|
6521
|
-
private
|
|
6995
|
+
private config;
|
|
6522
6996
|
/**
|
|
6523
6997
|
* Context service for managing persistent contexts.
|
|
6524
6998
|
*/
|
|
@@ -6536,6 +7010,11 @@ declare class AgentBay {
|
|
|
6536
7010
|
config?: Config;
|
|
6537
7011
|
envFile?: string;
|
|
6538
7012
|
});
|
|
7013
|
+
/**
|
|
7014
|
+
* Get the region ID.
|
|
7015
|
+
* @returns The region ID or undefined if not set.
|
|
7016
|
+
*/
|
|
7017
|
+
getRegionId(): string | undefined;
|
|
6539
7018
|
/**
|
|
6540
7019
|
* Wait for mobile simulate command to complete.
|
|
6541
7020
|
*
|
|
@@ -6544,13 +7023,6 @@ declare class AgentBay {
|
|
|
6544
7023
|
* @param mobileSimMode - The mode of the mobile simulate. If not provided, will use the default mode.
|
|
6545
7024
|
*/
|
|
6546
7025
|
private _waitForMobileSimulate;
|
|
6547
|
-
/**
|
|
6548
|
-
* Update browser replay context with AppInstanceId from response data.
|
|
6549
|
-
*
|
|
6550
|
-
* @param responseData - Response data containing AppInstanceId
|
|
6551
|
-
* @param recordContextId - The record context ID to update
|
|
6552
|
-
*/
|
|
6553
|
-
private _updateBrowserReplayContext;
|
|
6554
7026
|
/**
|
|
6555
7027
|
* Create a new session in the AgentBay cloud environment.
|
|
6556
7028
|
*
|
|
@@ -6599,7 +7071,7 @@ declare class AgentBay {
|
|
|
6599
7071
|
*
|
|
6600
7072
|
* @see {@link get}, {@link list}, {@link Session.delete}
|
|
6601
7073
|
*/
|
|
6602
|
-
create(params
|
|
7074
|
+
create(params: CreateSessionParams | CreateSeesionWithParams): Promise<SessionResult>;
|
|
6603
7075
|
/**
|
|
6604
7076
|
* Returns paginated list of session IDs filtered by labels.
|
|
6605
7077
|
*
|
|
@@ -6750,6 +7222,12 @@ declare class AgentBay {
|
|
|
6750
7222
|
* @see {@link pauseAsync}, {@link Session.resumeAsync}
|
|
6751
7223
|
*/
|
|
6752
7224
|
resumeAsync(session: Session, timeout?: number, pollInterval?: number): Promise<SessionResumeResult>;
|
|
7225
|
+
/**
|
|
7226
|
+
* Creates a deep copy of CreateSessionParams to avoid modifying the original object.
|
|
7227
|
+
* @param params - The original params object to copy
|
|
7228
|
+
* @returns A deep copy of the params object
|
|
7229
|
+
*/
|
|
7230
|
+
private deepCopyParams;
|
|
6753
7231
|
}
|
|
6754
7232
|
|
|
6755
7233
|
/**
|
|
@@ -7060,4 +7538,4 @@ declare function logWarn(message: string, ...args: any[]): void;
|
|
|
7060
7538
|
*/
|
|
7061
7539
|
declare function logError(message: string, error?: any): void;
|
|
7062
7540
|
|
|
7063
|
-
export { APIError, APP_BLACKLIST_TEMPLATE, APP_WHITELIST_TEMPLATE, type ActOptions, ActResult, Agent, AgentBay, AgentBayError, type ApiResponse, type ApiResponseWithData, type AppManagerRule, ApplyMqttTokenRequest, ApplyMqttTokenResponse, ApplyMqttTokenResponseBody, ApplyMqttTokenResponseBodyData, AuthenticationError, type BWList, type Brand, Browser, BrowserAgent, BrowserContext, BrowserError, type BrowserFingerprint, BrowserFingerprintContext, BrowserFingerprintGenerator, type BrowserOption, BrowserOptionClass, type BrowserProxy, BrowserProxyClass, type BrowserScreen, type BrowserViewport, CallMcpToolRequest, CallMcpToolResponse, CallMcpToolResponseBody, ClearContextRequest, ClearContextResponse, ClearContextResponseBody, Client, Code, Command, Computer, type Config, Context, type ContextInfoResult, ContextManager, ContextService, type ContextStatusData, type ContextStatusItem, ContextSync, type ContextSyncResult, CreateMcpSessionRequest, CreateMcpSessionRequestPersistenceDataList, CreateMcpSessionResponse, CreateMcpSessionResponseBody, CreateMcpSessionResponseBodyData, CreateMcpSessionShrinkRequest,
|
|
7541
|
+
export { APIError, APP_BLACKLIST_TEMPLATE, APP_WHITELIST_TEMPLATE, type ActOptions, ActResult, Agent, AgentBay, AgentBayError, type AgentOptions, type ApiResponse, type ApiResponseWithData, type AppManagerRule, ApplyMqttTokenRequest, ApplyMqttTokenResponse, ApplyMqttTokenResponseBody, ApplyMqttTokenResponseBodyData, AuthenticationError, type BWList, type Brand, Browser, BrowserAgent, BrowserContext, BrowserError, type BrowserFingerprint, BrowserFingerprintContext, BrowserFingerprintGenerator, type BrowserOption, BrowserOptionClass, type BrowserProxy, BrowserProxyClass, type BrowserScreen, BrowserUseAgent, type BrowserViewport, CallMcpToolRequest, CallMcpToolResponse, CallMcpToolResponseBody, ClearContextRequest, ClearContextResponse, ClearContextResponseBody, Client, Code, Command, Computer, ComputerUseAgent, type Config, Context, type ContextInfoResult, ContextManager, ContextService, type ContextStatusData, type ContextStatusItem, ContextSync, type ContextSyncResult, CreateMcpSessionRequest, CreateMcpSessionRequestPersistenceDataList, CreateMcpSessionResponse, CreateMcpSessionResponseBody, CreateMcpSessionResponseBodyData, CreateMcpSessionShrinkRequest, CreateSessionParams, type CreateSessionParamsConfig, DeleteContextFileRequest, DeleteContextFileResponse, DeleteContextFileResponseBody, DeleteContextRequest, DeleteContextResponse, DeleteContextResponseBody, type DeletePolicy, type DeleteResult, DeleteSessionAsyncRequest, DeleteSessionAsyncResponse, DeleteSessionAsyncResponseBody, DescribeContextFilesRequest, DescribeContextFilesResponse, DescribeContextFilesResponseBody, type DirectoryEntry, type DownloadPolicy, DownloadStrategy, type ExecutionResult, Extension, ExtensionOption, ExtensionsService, type ExtraConfigs, type ExtraProperties, type ExtractOptions, type ExtractPolicy, ExtractPolicyClass, type FileChangeEvent, FileChangeEventHelper, type FileChangeResult, FileChangeResultHelper, FileError, type FileInfo, FileSystem, type Fingerprint, FingerprintFormat, GetAdbLinkRequest, GetAdbLinkResponse, GetAdbLinkResponseBody, GetAdbLinkResponseBodyData, GetAndLoadInternalContextRequest, GetAndLoadInternalContextResponse, GetAndLoadInternalContextResponseBody, GetAndLoadInternalContextResponseBodyData, GetCdpLinkRequest, GetCdpLinkResponse, GetCdpLinkResponseBody, GetCdpLinkResponseBodyData, GetContextFileDownloadUrlRequest, GetContextFileDownloadUrlResponse, GetContextFileDownloadUrlResponseBody, GetContextFileUploadUrlRequest, GetContextFileUploadUrlResponse, GetContextFileUploadUrlResponseBody, GetContextInfoRequest, GetContextInfoResponse, GetContextInfoResponseBody, GetContextInfoResponseBodyData, GetContextRequest, GetContextResponse, GetContextResponseBody, GetContextResponseBodyData, GetLabelRequest, GetLabelResponse, GetLabelResponseBody, GetLabelResponseBodyData, GetLinkRequest, GetLinkResponse, GetLinkResponseBody, GetLinkResponseBodyData, GetMcpResourceRequest, GetMcpResourceResponse, GetMcpResourceResponseBody, GetMcpResourceResponseBodyData, GetMcpResourceResponseBodyDataDesktopInfo, GetSessionRequest, GetSessionResponse, GetSessionResponseBody, GetSessionResponseBodyData, HIDE_NAVIGATION_BAR_TEMPLATE, IS_RELEASE, InitBrowserRequest, InitBrowserResponse, InitBrowserResponseBody, InitBrowserResponseBodyData, type InitializationResult, Lifecycle, ListContextsRequest, ListContextsResponse, ListContextsResponseBody, ListContextsResponseBodyData, ListMcpToolsRequest, ListMcpToolsResponse, ListMcpToolsResponseBody, type ListSessionParams, ListSessionRequest, ListSessionResponse, ListSessionResponseBody, ListSessionResponseBodyData, type LogLevel, type LoggerConfig, MOBILE_COMMAND_TEMPLATES, type MappingPolicy, type McpSession, type McpToolResult, Mobile, type MobileExtraConfig, type MobileSimulateConfig, MobileSimulateMode, MobileSimulateService, type MobileSimulateUploadResult, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, type NavigatorFingerprint, type ObserveOptions, ObserveResult, Oss, OssError, PauseSessionAsyncRequest, PauseSessionAsyncResponse, PauseSessionAsyncResponseBody, type QueryResult, RESOLUTION_LOCK_TEMPLATE, type RecyclePolicy, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, ResumeSessionAsyncRequest, ResumeSessionAsyncResponse, ResumeSessionAsyncResponseBody, SHOW_NAVIGATION_BAR_TEMPLATE, type ScreenFingerprint, Session, SessionError, type SessionInterface, type SessionListResult, SetLabelRequest, SetLabelResponse, SetLabelResponseBody, type SyncCallback, SyncContextRequest, SyncContextResponse, SyncContextResponseBody, type SyncPolicy, SyncPolicyImpl, UNINSTALL_BLACKLIST_TEMPLATE, UploadMode, type UploadPolicy, UploadStrategy, type UserAgentData, VERSION, type VideoCard, type WhiteList, WhiteListValidator, createListSessionParams, extraConfigsFromJSON, extraConfigsToJSON, extractRequestId, getLogLevel, getMobileCommandTemplate, hasMobileCommandTemplate, log, logDebug, logError, logInfo, logWarn, newContextManager, newContextSync, newCreateSessionParams, newDeletePolicy, newDownloadPolicy, newExtractPolicy, newMappingPolicy, newRecyclePolicy, newSyncPolicy, newSyncPolicyWithDefaults, newUploadPolicy, replaceTemplatePlaceholders, setLogLevel, setupLogger, validateAppManagerRule, validateExtraConfigs, validateMobileExtraConfig, validateMobileSimulateConfig };
|