wuying-agentbay-sdk 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/chunk-E7QC5S76.mjs +3143 -0
  2. package/dist/chunk-E7QC5S76.mjs.map +1 -0
  3. package/dist/chunk-ZUB35HKV.cjs +3134 -0
  4. package/dist/chunk-ZUB35HKV.cjs.map +1 -0
  5. package/dist/index.cjs +3598 -3924
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.mts +2092 -689
  8. package/dist/index.d.ts +2092 -689
  9. package/dist/index.mjs +3562 -3888
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/key-normalizer-AF7APGQZ.cjs +136 -0
  12. package/dist/key-normalizer-AF7APGQZ.cjs.map +1 -0
  13. package/dist/key-normalizer-QDBRLFHF.mjs +145 -0
  14. package/dist/key-normalizer-QDBRLFHF.mjs.map +1 -0
  15. package/dist/model-2G37RFQQ.cjs +188 -0
  16. package/dist/model-2G37RFQQ.cjs.map +1 -0
  17. package/dist/model-ZFTLKEMC.mjs +197 -0
  18. package/docs/api/README.md +26 -0
  19. package/docs/api/browser-use/browser.md +177 -0
  20. package/docs/api/browser-use/extension.md +284 -0
  21. package/docs/api/codespace/code.md +77 -0
  22. package/docs/api/common-features/advanced/agent.md +84 -0
  23. package/docs/api/common-features/advanced/oss.md +221 -0
  24. package/docs/api/common-features/basics/agentbay.md +181 -0
  25. package/docs/api/common-features/basics/command.md +83 -0
  26. package/docs/api/common-features/basics/context-manager.md +130 -0
  27. package/docs/api/common-features/basics/context-sync.md +51 -0
  28. package/docs/api/common-features/basics/context.md +348 -0
  29. package/docs/api/common-features/basics/filesystem.md +499 -0
  30. package/docs/api/common-features/basics/logging.md +77 -0
  31. package/docs/api/common-features/basics/session.md +412 -0
  32. package/docs/api/computer-use/computer.md +786 -0
  33. package/docs/api/mobile-use/mobile.md +395 -0
  34. package/docs/examples/README.md +332 -0
  35. package/docs/examples/basic-usage.ts +86 -0
  36. package/docs/examples/browser-use/browser/README.md +356 -0
  37. package/docs/examples/browser-use/browser/basic-usage.ts +136 -0
  38. package/docs/examples/browser-use/browser/browser-command-args.ts +117 -0
  39. package/docs/examples/browser-use/browser/browser-context-cookie-persistence.ts +348 -0
  40. package/docs/examples/browser-use/browser/browser-fingerprint-basic-usage.ts +121 -0
  41. package/docs/examples/browser-use/browser/browser-fingerprint-construct.ts +114 -0
  42. package/docs/examples/browser-use/browser/browser-fingerprint-local-sync.ts +98 -0
  43. package/docs/examples/browser-use/browser/browser-fingerprint-persistence.ts +242 -0
  44. package/docs/examples/browser-use/browser/browser-proxies.ts +149 -0
  45. package/docs/examples/browser-use/browser/browser-type-example.ts +266 -0
  46. package/docs/examples/browser-use/browser/browser-viewport.ts +129 -0
  47. package/docs/examples/browser-use/browser/call_for_user_jd.ts +184 -0
  48. package/docs/examples/browser-use/browser/captcha_tongcheng.ts +151 -0
  49. package/docs/examples/browser-use/browser/run-2048.ts +209 -0
  50. package/docs/examples/browser-use/browser/run-sudoku.ts +150 -0
  51. package/docs/examples/browser-use/browser/screenshot-example.ts +132 -0
  52. package/docs/examples/browser-use/extension-example/README.md +252 -0
  53. package/docs/examples/browser-use/extension-example/extension-example.ts +380 -0
  54. package/docs/examples/codespace/automation/automation-example.ts +322 -0
  55. package/docs/examples/common-features/advanced/agent-module-example/README.md +40 -0
  56. package/docs/examples/common-features/advanced/agent-module-example.ts +66 -0
  57. package/docs/examples/common-features/advanced/archive-upload-mode-example/README.md +212 -0
  58. package/docs/examples/common-features/advanced/archive-upload-mode-example/archive-upload-mode-example.ts +213 -0
  59. package/docs/examples/common-features/advanced/vpc-session-example/README.md +47 -0
  60. package/docs/examples/common-features/advanced/vpc-session-example.ts +106 -0
  61. package/docs/examples/common-features/basics/archive-upload-mode-example/README.md +236 -0
  62. package/docs/examples/common-features/basics/archive-upload-mode-example/main.ts +236 -0
  63. package/docs/examples/common-features/basics/command-example/README.md +47 -0
  64. package/docs/examples/common-features/basics/command-example/command-example.ts +153 -0
  65. package/docs/examples/common-features/basics/context-management/README.md +55 -0
  66. package/docs/examples/common-features/basics/context-management/context-management.ts +140 -0
  67. package/docs/examples/common-features/basics/data-persistence/README.md +129 -0
  68. package/docs/examples/common-features/basics/data-persistence/context-sync-demo.md +144 -0
  69. package/docs/examples/common-features/basics/data-persistence/context-sync-demo.ts +275 -0
  70. package/docs/examples/common-features/basics/data-persistence/data-persistence.ts +259 -0
  71. package/docs/examples/common-features/basics/data-persistence/recycle-policy-example.ts +294 -0
  72. package/docs/examples/common-features/basics/filesystem-example/README.md +57 -0
  73. package/docs/examples/common-features/basics/filesystem-example/filesystem-example.ts +164 -0
  74. package/docs/examples/common-features/basics/filesystem-example/filesystem-filetransfer-example.ts +153 -0
  75. package/docs/examples/common-features/basics/filesystem-example/watch-directory-example.ts +168 -0
  76. package/docs/examples/common-features/basics/get/README.md +136 -0
  77. package/docs/examples/common-features/basics/get/main.ts +79 -0
  78. package/docs/examples/common-features/basics/list_sessions/README.md +54 -0
  79. package/docs/examples/common-features/basics/list_sessions/main.ts +258 -0
  80. package/docs/examples/common-features/basics/mcp_tool_direct_call/README.md +142 -0
  81. package/docs/examples/common-features/basics/mcp_tool_direct_call/main.ts +135 -0
  82. package/docs/examples/common-features/basics/session-creation/README.md +28 -0
  83. package/docs/examples/common-features/basics/session-creation/session-creation.ts +295 -0
  84. package/docs/examples/mobile-use/mobile-get-adb-url/README.md +92 -0
  85. package/docs/examples/mobile-use/mobile-get-adb-url/index.ts +80 -0
  86. package/docs/examples/mobile-use/mobile-get-adb-url/package-lock.json +279 -0
  87. package/docs/examples/mobile-use/mobile-get-adb-url/package.json +18 -0
  88. package/package.json +18 -11
  89. package/dist/application-KZWXH46T.mjs +0 -17
  90. package/dist/application-LMA7KSRH.cjs +0 -8
  91. package/dist/application-LMA7KSRH.cjs.map +0 -1
  92. package/dist/chunk-BQNGKBQF.mjs +0 -386
  93. package/dist/chunk-BQNGKBQF.mjs.map +0 -1
  94. package/dist/chunk-IOVGAAJL.cjs +0 -558
  95. package/dist/chunk-IOVGAAJL.cjs.map +0 -1
  96. package/dist/chunk-UF2TC2R4.mjs +0 -567
  97. package/dist/chunk-UF2TC2R4.mjs.map +0 -1
  98. package/dist/chunk-X6MS7Z5L.cjs +0 -377
  99. package/dist/chunk-X6MS7Z5L.cjs.map +0 -1
  100. package/dist/window-DH37ZDD5.mjs +0 -17
  101. package/dist/window-DH37ZDD5.mjs.map +0 -1
  102. package/dist/window-U7N3H735.cjs +0 -8
  103. package/dist/window-U7N3H735.cjs.map +0 -1
  104. /package/dist/{application-KZWXH46T.mjs.map → model-ZFTLKEMC.mjs.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -5,27 +5,6 @@ interface Config {
5
5
  endpoint: string;
6
6
  timeout_ms: number;
7
7
  }
8
- /**
9
- * Load .env file into process.env if it exists
10
- * This function should be called early to ensure .env variables are available
11
- * @deprecated Use loadDotEnvWithFallback instead
12
- */
13
- declare function loadDotEnv(): void;
14
- /**
15
- * The SDK uses the following precedence order for configuration (highest to lowest):
16
- * 1. Explicitly passed configuration in code.
17
- * 2. Environment variables.
18
- * 3. .env file.
19
- * 4. Default configuration.
20
- */
21
- /**
22
- * Load configuration with improved .env file search.
23
- *
24
- * @param customConfig Configuration object (if provided, skips env loading)
25
- * @param customEnvPath Custom path to .env file (optional)
26
- * @returns Configuration object
27
- */
28
- declare function loadConfig(customConfig?: Config, customEnvPath?: string): Config;
29
8
 
30
9
  /**
31
10
  * Version information for the AgentBay SDK
@@ -301,6 +280,7 @@ declare class ApplyMqttTokenResponse extends $dara.Model {
301
280
  declare class CallMcpToolRequest extends $dara.Model {
302
281
  args?: string;
303
282
  authorization?: string;
283
+ autoGenSession?: boolean;
304
284
  externalUserId?: string;
305
285
  imageId?: string;
306
286
  name?: string;
@@ -816,6 +796,137 @@ declare class GetLinkResponse extends $dara.Model {
816
796
  });
817
797
  }
818
798
 
799
+ declare class GetCdpLinkRequest extends $dara.Model {
800
+ authorization?: string;
801
+ sessionId?: string;
802
+ static names(): {
803
+ [key: string]: string;
804
+ };
805
+ static types(): {
806
+ [key: string]: any;
807
+ };
808
+ validate(): void;
809
+ constructor(map?: {
810
+ [key: string]: any;
811
+ });
812
+ }
813
+
814
+ declare class GetCdpLinkResponseBodyData extends $dara.Model {
815
+ url?: string;
816
+ static names(): {
817
+ [key: string]: string;
818
+ };
819
+ static types(): {
820
+ [key: string]: any;
821
+ };
822
+ validate(): void;
823
+ constructor(map?: {
824
+ [key: string]: any;
825
+ });
826
+ }
827
+ declare class GetCdpLinkResponseBody extends $dara.Model {
828
+ code?: string;
829
+ data?: GetCdpLinkResponseBodyData;
830
+ httpStatusCode?: number;
831
+ message?: string;
832
+ requestId?: string;
833
+ success?: boolean;
834
+ static names(): {
835
+ [key: string]: string;
836
+ };
837
+ static types(): {
838
+ [key: string]: any;
839
+ };
840
+ validate(): void;
841
+ constructor(map?: {
842
+ [key: string]: any;
843
+ });
844
+ }
845
+
846
+ declare class GetCdpLinkResponse extends $dara.Model {
847
+ headers?: {
848
+ [key: string]: string;
849
+ };
850
+ statusCode?: number;
851
+ body?: GetCdpLinkResponseBody;
852
+ static names(): {
853
+ [key: string]: string;
854
+ };
855
+ static types(): {
856
+ [key: string]: any;
857
+ };
858
+ validate(): void;
859
+ constructor(map?: {
860
+ [key: string]: any;
861
+ });
862
+ }
863
+
864
+ declare class GetAdbLinkRequest extends $dara.Model {
865
+ authorization?: string;
866
+ option?: string;
867
+ sessionId?: string;
868
+ static names(): {
869
+ [key: string]: string;
870
+ };
871
+ static types(): {
872
+ [key: string]: any;
873
+ };
874
+ validate(): void;
875
+ constructor(map?: {
876
+ [key: string]: any;
877
+ });
878
+ }
879
+
880
+ declare class GetAdbLinkResponseBodyData extends $dara.Model {
881
+ url?: string;
882
+ static names(): {
883
+ [key: string]: string;
884
+ };
885
+ static types(): {
886
+ [key: string]: any;
887
+ };
888
+ validate(): void;
889
+ constructor(map?: {
890
+ [key: string]: any;
891
+ });
892
+ }
893
+ declare class GetAdbLinkResponseBody extends $dara.Model {
894
+ code?: string;
895
+ data?: GetAdbLinkResponseBodyData;
896
+ httpStatusCode?: number;
897
+ message?: string;
898
+ requestId?: string;
899
+ success?: boolean;
900
+ static names(): {
901
+ [key: string]: string;
902
+ };
903
+ static types(): {
904
+ [key: string]: any;
905
+ };
906
+ validate(): void;
907
+ constructor(map?: {
908
+ [key: string]: any;
909
+ });
910
+ }
911
+
912
+ declare class GetAdbLinkResponse extends $dara.Model {
913
+ headers?: {
914
+ [key: string]: string;
915
+ };
916
+ statusCode?: number;
917
+ body?: GetAdbLinkResponseBody;
918
+ static names(): {
919
+ [key: string]: string;
920
+ };
921
+ static types(): {
922
+ [key: string]: any;
923
+ };
924
+ validate(): void;
925
+ constructor(map?: {
926
+ [key: string]: any;
927
+ });
928
+ }
929
+
819
930
  declare class GetMcpResourceRequest extends $dara.Model {
820
931
  authorization?: string;
821
932
  sessionId?: string;
@@ -1928,6 +2039,36 @@ declare class Client extends OpenApi {
1928
2039
  * @returns GetContextFileUploadUrlResponse
1929
2040
  */
1930
2041
  getContextFileUploadUrl(request: GetContextFileUploadUrlRequest): Promise<GetContextFileUploadUrlResponse>;
2042
+ /**
2043
+ * Get CDP link
2044
+ *
2045
+ * @param request - GetCdpLinkRequest
2046
+ * @param runtime - runtime options for this request RuntimeOptions
2047
+ * @returns GetCdpLinkResponse
2048
+ */
2049
+ getCdpLinkWithOptions(request: GetCdpLinkRequest, runtime: $dara.RuntimeOptions): Promise<GetCdpLinkResponse>;
2050
+ /**
2051
+ * Get CDP link
2052
+ *
2053
+ * @param request - GetCdpLinkRequest
2054
+ * @returns GetCdpLinkResponse
2055
+ */
2056
+ getCdpLink(request: GetCdpLinkRequest): Promise<GetCdpLinkResponse>;
2057
+ /**
2058
+ * Get ADB link
2059
+ *
2060
+ * @param request - GetAdbLinkRequest
2061
+ * @param runtime - runtime options for this request RuntimeOptions
2062
+ * @returns GetAdbLinkResponse
2063
+ */
2064
+ getAdbLinkWithOptions(request: GetAdbLinkRequest, runtime: $dara.RuntimeOptions): Promise<GetAdbLinkResponse>;
2065
+ /**
2066
+ * Get ADB link
2067
+ *
2068
+ * @param request - GetAdbLinkRequest
2069
+ * @returns GetAdbLinkResponse
2070
+ */
2071
+ getAdbLink(request: GetAdbLinkRequest): Promise<GetAdbLinkResponse>;
1931
2072
  }
1932
2073
 
1933
2074
  /**
@@ -2027,46 +2168,6 @@ interface OperationResult extends ApiResponse {
2027
2168
  /** Optional error message if the operation failed */
2028
2169
  errorMessage?: string;
2029
2170
  }
2030
- /**
2031
- * Interface for process list operation responses
2032
- * Corresponds to Python's ProcessListResult type
2033
- */
2034
- interface ProcessListResult extends ApiResponse {
2035
- /** Request identifier for tracking API calls */
2036
- requestId: string;
2037
- /** Whether the operation was successful */
2038
- success: boolean;
2039
- /** The list of process objects */
2040
- data: any[];
2041
- /** Optional error message if the operation failed */
2042
- errorMessage?: string;
2043
- }
2044
- /**
2045
- * Interface for installed app list operation responses
2046
- * Corresponds to Python's InstalledAppListResult type
2047
- */
2048
- interface InstalledAppListResult extends ApiResponse {
2049
- /** Request identifier for tracking API calls */
2050
- requestId: string;
2051
- /** Whether the operation was successful */
2052
- success: boolean;
2053
- /** The list of installed app objects */
2054
- data: any[];
2055
- /** Optional error message if the operation failed */
2056
- errorMessage?: string;
2057
- }
2058
- /**
2059
- * Interface for application operation responses
2060
- * Corresponds to Python's AppOperationResult type
2061
- */
2062
- interface AppOperationResult extends ApiResponse {
2063
- /** Request identifier for tracking API calls */
2064
- requestId: string;
2065
- /** Whether the operation was successful */
2066
- success: boolean;
2067
- /** Optional error message if the operation failed */
2068
- errorMessage?: string;
2069
- }
2070
2171
  /**
2071
2172
  * Interface for command execution operation responses
2072
2173
  * Corresponds to Python's CommandResult type
@@ -2221,20 +2322,6 @@ interface OSSDownloadResult extends ApiResponse {
2221
2322
  /** Optional error message if the operation failed */
2222
2323
  errorMessage?: string;
2223
2324
  }
2224
- /**
2225
- * Interface for UI element list operation responses
2226
- * Corresponds to Python's UIElementListResult type
2227
- */
2228
- interface UIElementListResult extends ApiResponse {
2229
- /** Request identifier for tracking API calls */
2230
- requestId: string;
2231
- /** Whether the operation was successful */
2232
- success: boolean;
2233
- /** UI elements */
2234
- elements: Record<string, any>[];
2235
- /** Optional error message if the operation failed */
2236
- errorMessage?: string;
2237
- }
2238
2325
  /**
2239
2326
  * Interface for window list operation responses
2240
2327
  * Corresponds to Python's WindowListResult type
@@ -2379,10 +2466,6 @@ declare class Context {
2379
2466
  * The name of the context.
2380
2467
  */
2381
2468
  name: string;
2382
- /**
2383
- * @deprecated This field is no longer used and will be removed in a future version.
2384
- */
2385
- state: string;
2386
2469
  /**
2387
2470
  * Date and time when the Context was created.
2388
2471
  */
@@ -2391,21 +2474,15 @@ declare class Context {
2391
2474
  * Date and time when the Context was last used.
2392
2475
  */
2393
2476
  lastUsedAt?: string;
2394
- /**
2395
- * @deprecated This field is no longer used and will be removed in a future version.
2396
- */
2397
- osType?: string;
2398
2477
  /**
2399
2478
  * Initialize a Context object.
2400
2479
  *
2401
2480
  * @param id - The unique identifier of the context.
2402
2481
  * @param name - The name of the context.
2403
- * @param state - **Deprecated.** This parameter is no longer used.
2404
2482
  * @param createdAt - Date and time when the Context was created.
2405
2483
  * @param lastUsedAt - Date and time when the Context was last used.
2406
- * @param osType - **Deprecated.** This parameter is no longer used.
2407
2484
  */
2408
- constructor(id: string, name: string, state?: string, createdAt?: string, lastUsedAt?: string, osType?: string);
2485
+ constructor(id: string, name: string, createdAt?: string, lastUsedAt?: string);
2409
2486
  }
2410
2487
  /**
2411
2488
  * Parameters for listing contexts with pagination support.
@@ -2438,15 +2515,37 @@ declare class ContextService {
2438
2515
  *
2439
2516
  * @param params - Optional parameters for listing contexts.
2440
2517
  * @returns ContextListResult with contexts list and pagination information
2518
+ *
2519
+ * @example
2520
+ * ```typescript
2521
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2522
+ * const result = await agentBay.context.list({ maxResults: 10 });
2523
+ * if (result.success) {
2524
+ * console.log(`Total contexts: ${result.totalCount}`);
2525
+ * console.log(`Page has ${result.contexts.length} contexts`);
2526
+ * }
2527
+ * ```
2441
2528
  */
2442
2529
  list(params?: ContextListParams): Promise<ContextListResult>;
2443
2530
  /**
2444
- * Gets a context by name. Optionally creates it if it doesn't exist.
2445
- * Corresponds to Python's get() method
2531
+ * Retrieves an existing context or creates a new one.
2532
+ *
2533
+ * @param name - The name of the context to retrieve or create.
2534
+ * @param create - If true, creates the context if it doesn't exist. Defaults to false.
2535
+ *
2536
+ * @returns Promise resolving to ContextResult containing the Context object.
2537
+ *
2538
+ * @example
2539
+ * ```typescript
2540
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2541
+ * const result = await agentBay.context.get('my-context', true);
2542
+ * if (result.success) {
2543
+ * console.log(`Context ID: ${result.context.id}`);
2544
+ * console.log(`Context Name: ${result.context.name}`);
2545
+ * }
2546
+ * ```
2446
2547
  *
2447
- * @param name - The name of the context to get.
2448
- * @param create - Whether to create the context if it doesn't exist.
2449
- * @returns ContextResult with context data and requestId
2548
+ * @see {@link update}, {@link list}
2450
2549
  */
2451
2550
  get(name: string, create?: boolean): Promise<ContextResult>;
2452
2551
  /**
@@ -2455,14 +2554,37 @@ declare class ContextService {
2455
2554
  *
2456
2555
  * @param name - The name for the new context.
2457
2556
  * @returns ContextResult with created context data and requestId
2557
+ *
2558
+ * @example
2559
+ * ```typescript
2560
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2561
+ * const result = await agentBay.context.create('my-new-context');
2562
+ * if (result.success) {
2563
+ * console.log(`Context ID: ${result.context.id}`);
2564
+ * console.log(`Context Name: ${result.context.name}`);
2565
+ * }
2566
+ * ```
2458
2567
  */
2459
2568
  create(name: string): Promise<ContextResult>;
2460
2569
  /**
2461
- * Updates the specified context.
2462
- * Corresponds to Python's update() method
2570
+ * Updates a context's name.
2571
+ *
2572
+ * @param context - The Context object with updated name.
2573
+ *
2574
+ * @returns Promise resolving to OperationResult with success status.
2575
+ *
2576
+ * @example
2577
+ * ```typescript
2578
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2579
+ * const getResult = await agentBay.context.get('old-name');
2580
+ * if (getResult.success && getResult.context) {
2581
+ * getResult.context.name = 'new-name';
2582
+ * const updateResult = await agentBay.context.update(getResult.context);
2583
+ * console.log('Context updated:', updateResult.success);
2584
+ * }
2585
+ * ```
2463
2586
  *
2464
- * @param context - The Context object to update.
2465
- * @returns OperationResult with updated context data and requestId
2587
+ * @see {@link get}, {@link list}
2466
2588
  */
2467
2589
  update(context: Context): Promise<OperationResult>;
2468
2590
  /**
@@ -2471,22 +2593,93 @@ declare class ContextService {
2471
2593
  *
2472
2594
  * @param context - The Context object to delete.
2473
2595
  * @returns OperationResult with requestId
2596
+ *
2597
+ * @example
2598
+ * ```typescript
2599
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2600
+ * const getResult = await agentBay.context.get('my-context');
2601
+ * if (getResult.success && getResult.context) {
2602
+ * const deleteResult = await agentBay.context.delete(getResult.context);
2603
+ * console.log('Context deleted:', deleteResult.success);
2604
+ * }
2605
+ * ```
2474
2606
  */
2475
2607
  delete(context: Context): Promise<OperationResult>;
2476
2608
  /**
2477
2609
  * Get a presigned upload URL for a file in a context.
2610
+ *
2611
+ * @param contextId - The ID of the context.
2612
+ * @param filePath - The path to the file in the context.
2613
+ * @returns FileUrlResult with the presigned URL and expiration time.
2614
+ *
2615
+ * @example
2616
+ * ```typescript
2617
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2618
+ * const contextResult = await agentBay.context.get('my-context', true);
2619
+ * if (contextResult.success) {
2620
+ * const urlResult = await agentBay.context.getFileUploadUrl(contextResult.context.id, '/data/file.txt');
2621
+ * console.log('Upload URL:', urlResult.url);
2622
+ * console.log('Expires at:', urlResult.expireTime);
2623
+ * }
2624
+ * ```
2478
2625
  */
2479
2626
  getFileUploadUrl(contextId: string, filePath: string): Promise<FileUrlResult>;
2480
2627
  /**
2481
2628
  * Get a presigned download URL for a file in a context.
2629
+ *
2630
+ * @param contextId - The ID of the context.
2631
+ * @param filePath - The path to the file in the context.
2632
+ * @returns FileUrlResult with the presigned URL and expiration time.
2633
+ *
2634
+ * @example
2635
+ * ```typescript
2636
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2637
+ * const contextResult = await agentBay.context.get('my-context');
2638
+ * if (contextResult.success) {
2639
+ * const urlResult = await agentBay.context.getFileDownloadUrl(contextResult.context.id, '/data/file.txt');
2640
+ * console.log('Download URL:', urlResult.url);
2641
+ * console.log('Expires at:', urlResult.expireTime);
2642
+ * }
2643
+ * ```
2482
2644
  */
2483
2645
  getFileDownloadUrl(contextId: string, filePath: string): Promise<FileUrlResult>;
2484
2646
  /**
2485
2647
  * Delete a file in a context.
2648
+ *
2649
+ * @param contextId - The ID of the context.
2650
+ * @param filePath - The path to the file to delete.
2651
+ * @returns OperationResult indicating success or failure.
2652
+ *
2653
+ * @example
2654
+ * ```typescript
2655
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2656
+ * const contextResult = await agentBay.context.get('my-context');
2657
+ * if (contextResult.success) {
2658
+ * const deleteResult = await agentBay.context.deleteFile(contextResult.context.id, '/data/file.txt');
2659
+ * console.log('File deleted:', deleteResult.success);
2660
+ * }
2661
+ * ```
2486
2662
  */
2487
2663
  deleteFile(contextId: string, filePath: string): Promise<OperationResult>;
2488
2664
  /**
2489
2665
  * List files under a specific folder path in a context.
2666
+ *
2667
+ * @param contextId - The ID of the context.
2668
+ * @param parentFolderPath - The parent folder path to list files from.
2669
+ * @param pageNumber - Page number for pagination (default: 1).
2670
+ * @param pageSize - Number of files per page (default: 50).
2671
+ * @returns ContextFileListResult with file entries and total count.
2672
+ *
2673
+ * @example
2674
+ * ```typescript
2675
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2676
+ * const contextResult = await agentBay.context.get('my-context');
2677
+ * if (contextResult.success) {
2678
+ * const listResult = await agentBay.context.listFiles(contextResult.context.id, '/data');
2679
+ * console.log(`Found ${listResult.entries.length} files`);
2680
+ * console.log(`Total count: ${listResult.count}`);
2681
+ * }
2682
+ * ```
2490
2683
  */
2491
2684
  listFiles(contextId: string, parentFolderPath: string, pageNumber?: number, pageSize?: number): Promise<ContextFileListResult>;
2492
2685
  /**
@@ -2500,6 +2693,17 @@ declare class ContextService {
2500
2693
  * @returns A ClearContextResult object indicating the task has been successfully started,
2501
2694
  * with status field set to "clearing".
2502
2695
  * @throws APIError - If the backend API rejects the clearing request (e.g., invalid ID).
2696
+ *
2697
+ * @example
2698
+ * ```typescript
2699
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2700
+ * const getResult = await agentBay.context.get('my-context');
2701
+ * if (getResult.success) {
2702
+ * const clearResult = await agentBay.context.clearAsync(getResult.context.id);
2703
+ * console.log('Clear task started:', clearResult.success);
2704
+ * console.log('Status:', clearResult.status);
2705
+ * }
2706
+ * ```
2503
2707
  */
2504
2708
  clearAsync(contextId: string): Promise<ClearContextResult>;
2505
2709
  /**
@@ -2510,6 +2714,16 @@ declare class ContextService {
2510
2714
  *
2511
2715
  * @param contextId - ID of the context.
2512
2716
  * @returns ClearContextResult object containing the current task status.
2717
+ *
2718
+ * @example
2719
+ * ```typescript
2720
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2721
+ * const getResult = await agentBay.context.get('my-context');
2722
+ * if (getResult.success) {
2723
+ * const statusResult = await agentBay.context.getClearStatus(getResult.context.id);
2724
+ * console.log('Current status:', statusResult.status);
2725
+ * }
2726
+ * ```
2513
2727
  */
2514
2728
  getClearStatus(contextId: string): Promise<ClearContextResult>;
2515
2729
  /**
@@ -2528,6 +2742,17 @@ declare class ContextService {
2528
2742
  * @returns A ClearContextResult object containing the final task result.
2529
2743
  * The status field will be "available" on success, or other states if interrupted.
2530
2744
  * @throws APIError - If the task fails to complete within the specified timeout.
2745
+ *
2746
+ * @example
2747
+ * ```typescript
2748
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2749
+ * const getResult = await agentBay.context.get('my-context');
2750
+ * if (getResult.success) {
2751
+ * const clearResult = await agentBay.context.clear(getResult.context.id);
2752
+ * console.log('Context cleared:', clearResult.success);
2753
+ * console.log('Final status:', clearResult.status);
2754
+ * }
2755
+ * ```
2531
2756
  */
2532
2757
  clear(contextId: string, timeout?: number, pollInterval?: number): Promise<ClearContextResult>;
2533
2758
  }
@@ -2600,6 +2825,9 @@ declare class WhiteListValidator {
2600
2825
  interface BWList {
2601
2826
  whiteLists?: WhiteList[];
2602
2827
  }
2828
+ interface MappingPolicy {
2829
+ path: string;
2830
+ }
2603
2831
  interface SyncPolicy {
2604
2832
  uploadPolicy?: UploadPolicy;
2605
2833
  downloadPolicy?: DownloadPolicy;
@@ -2607,6 +2835,7 @@ interface SyncPolicy {
2607
2835
  extractPolicy?: ExtractPolicy;
2608
2836
  recyclePolicy?: RecyclePolicy;
2609
2837
  bwList?: BWList;
2838
+ mappingPolicy?: MappingPolicy;
2610
2839
  }
2611
2840
  declare class SyncPolicyImpl implements SyncPolicy {
2612
2841
  uploadPolicy?: UploadPolicy;
@@ -2631,8 +2860,8 @@ declare function newDownloadPolicy(): DownloadPolicy;
2631
2860
  declare function newDeletePolicy(): DeletePolicy;
2632
2861
  declare function newExtractPolicy(): ExtractPolicy;
2633
2862
  declare function newRecyclePolicy(): RecyclePolicy;
2863
+ declare function newMappingPolicy(): MappingPolicy;
2634
2864
  declare function newSyncPolicy(): SyncPolicy;
2635
- declare function validateSyncPolicy(policy?: SyncPolicy): void;
2636
2865
  declare function newSyncPolicyWithDefaults(policy?: Partial<SyncPolicy>): SyncPolicy;
2637
2866
  declare function newContextSync(contextId: string, path: string, policy?: SyncPolicy): ContextSync;
2638
2867
 
@@ -2687,13 +2916,36 @@ declare class Agent {
2687
2916
  * @param task - Task description in human language.
2688
2917
  * @param maxTryTimes - Maximum number of retry attempts.
2689
2918
  * @returns ExecutionResult containing success status, task output, and error message if any.
2690
- */
2691
- executeTask(task: string, maxTryTimes: number): Promise<ExecutionResult>;
2919
+ *
2920
+ * @example
2921
+ * ```typescript
2922
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2923
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
2924
+ * if (result.success) {
2925
+ * const taskResult = await result.session.agent.executeTask('Open notepad', 10);
2926
+ * console.log(`Task status: ${taskResult.taskStatus}`);
2927
+ * await result.session.delete();
2928
+ * }
2929
+ * ```
2930
+ */
2931
+ executeTask(task: string, maxTryTimes: number): Promise<ExecutionResult>;
2692
2932
  /**
2693
2933
  * Get the status of the task with the given task ID.
2694
2934
  *
2695
2935
  * @param taskId - Task ID
2696
2936
  * @returns QueryResult containing the task status
2937
+ *
2938
+ * @example
2939
+ * ```typescript
2940
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2941
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
2942
+ * if (result.success) {
2943
+ * const taskResult = await result.session.agent.executeTask('Open calculator', 10);
2944
+ * const statusResult = await result.session.agent.getTaskStatus(taskResult.taskId);
2945
+ * console.log(`Status: ${JSON.parse(statusResult.output).status}`);
2946
+ * await result.session.delete();
2947
+ * }
2948
+ * ```
2697
2949
  */
2698
2950
  getTaskStatus(taskId: string): Promise<QueryResult>;
2699
2951
  /**
@@ -2701,137 +2953,20 @@ declare class Agent {
2701
2953
  *
2702
2954
  * @param taskId - The ID of the running task.
2703
2955
  * @returns ExecutionResult containing success status, task output, and error message if any.
2704
- */
2705
- terminateTask(taskId: string): Promise<ExecutionResult>;
2706
- }
2707
-
2708
- /**
2709
- * Represents an installed application
2710
- */
2711
- interface InstalledApp$1 {
2712
- name: string;
2713
- start_cmd: string;
2714
- stop_cmd?: string;
2715
- work_directory?: string;
2716
- }
2717
- /**
2718
- * Represents a running process
2719
- */
2720
- interface Process$1 {
2721
- pname: string;
2722
- pid: number;
2723
- cmdline?: string;
2724
- path?: string;
2725
- }
2726
- /**
2727
- * Handles application operations in the AgentBay cloud environment.
2728
- *
2729
- * @deprecated This module is deprecated. Use Computer or Mobile modules instead.
2730
- * - For desktop applications, use session.computer
2731
- * - For mobile applications, use session.mobile
2732
- */
2733
- declare class Application {
2734
- private session;
2735
- /**
2736
- * Initialize an Application object.
2737
- *
2738
- * @param session - The Session instance that this Application belongs to.
2739
- */
2740
- constructor(session: {
2741
- getAPIKey(): string;
2742
- getClient(): Client;
2743
- getSessionId(): string;
2744
- callMcpTool(toolName: string, args: any): Promise<{
2745
- success: boolean;
2746
- data: string;
2747
- errorMessage: string;
2748
- requestId: string;
2749
- }>;
2750
- });
2751
- /**
2752
- * Sanitizes error messages to remove sensitive information like API keys.
2753
- *
2754
- * @param error - The error to sanitize
2755
- * @returns The sanitized error
2756
- */
2757
- private sanitizeError;
2758
- /**
2759
- * Helper method to parse JSON string into objects
2760
- */
2761
- private parseJSON;
2762
- /**
2763
- * Get a list of installed applications.
2764
- *
2765
- * @param startMenu - Whether to include start menu applications.
2766
- * @param desktop - Whether to include desktop applications.
2767
- * @param ignoreSystemApps - Whether to ignore system applications.
2768
- * @returns A promise that resolves to the list of installed applications.
2769
- *
2770
- * @deprecated Use session.computer.getInstalledApps() for desktop or session.mobile.getInstalledApps() for mobile instead.
2771
- */
2772
- getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<InstalledAppListResult>;
2773
- /**
2774
- * Start an application.
2775
- *
2776
- * @param startCmd - The command to start the application.
2777
- * @param workDirectory - The working directory for the application.
2778
- * @param activity - The activity to start (for mobile applications).
2779
- * @returns A promise that resolves to the result of starting the application.
2780
- *
2781
- * @deprecated Use session.computer.startApp() for desktop or session.mobile.startApp() for mobile instead.
2782
- */
2783
- startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<ProcessListResult>;
2784
- /**
2785
- * Stop an application by process name.
2786
- *
2787
- * @param pname - The process name of the application to stop.
2788
- * @returns A promise that resolves to the result of stopping the application.
2789
2956
  *
2790
- * @deprecated Use session.computer.stopAppByPName() for desktop or session.mobile.stopAppByPName() for mobile instead.
2791
- */
2792
- stopAppByPName(pname: string): Promise<AppOperationResult>;
2793
- /**
2794
- * Stops an application by process ID.
2795
- * Corresponds to Python's stop_app_by_pid() method
2796
- *
2797
- * @param pid - The process ID to stop.
2798
- * @returns AppOperationResult with operation result and requestId
2799
- * @throws Error if the operation fails.
2800
- */
2801
- stopAppByPID(pid: number): Promise<AppOperationResult>;
2802
- /**
2803
- * Stop an application by command.
2804
- *
2805
- * @param cmd - The command to stop the application.
2806
- * @returns A promise that resolves to the result of stopping the application.
2807
- *
2808
- * @deprecated Use session.computer.stopAppByCmd() for desktop or session.mobile.stopAppByCmd() for mobile instead.
2809
- */
2810
- stopAppByCmd(cmd: string): Promise<AppOperationResult>;
2811
- /**
2812
- * Returns a list of currently visible applications.
2813
- * Corresponds to Python's list_visible_apps() method
2814
- *
2815
- * @returns ProcessListResult with visible apps and requestId
2816
- * @throws Error if the operation fails.
2817
- */
2818
- listVisibleApps(): Promise<ProcessListResult>;
2819
- /**
2820
- * Get a list of running processes.
2821
- *
2822
- * @returns A promise that resolves to the list of running processes.
2823
- *
2824
- * @deprecated Use session.computer.getRunningProcesses() for desktop or session.mobile.getRunningProcesses() for mobile instead.
2825
- */
2826
- getRunningProcesses(): Promise<ProcessListResult>;
2827
- /**
2828
- * Get a list of visible applications.
2829
- *
2830
- * @returns A promise that resolves to the list of visible applications.
2831
- *
2832
- * @deprecated Use session.computer.getVisibleApps() for desktop instead. This API is not available for mobile.
2957
+ * @example
2958
+ * ```typescript
2959
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
2960
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
2961
+ * if (result.success) {
2962
+ * const taskResult = await result.session.agent.executeTask('Open notepad', 5);
2963
+ * const terminateResult = await result.session.agent.terminateTask(taskResult.taskId);
2964
+ * console.log(`Terminated: ${terminateResult.taskStatus}`);
2965
+ * await result.session.delete();
2966
+ * }
2967
+ * ```
2833
2968
  */
2834
- getVisibleApps(): Promise<InstalledAppListResult>;
2969
+ terminateTask(taskId: string): Promise<ExecutionResult>;
2835
2970
  }
2836
2971
 
2837
2972
  interface ActOptions {
@@ -2888,6 +3023,187 @@ declare class BrowserAgent {
2888
3023
  private _delay;
2889
3024
  }
2890
3025
 
3026
+ /**
3027
+ * Screen fingerprint data structure.
3028
+ */
3029
+ interface ScreenFingerprint {
3030
+ availHeight: number;
3031
+ availWidth: number;
3032
+ availTop: number;
3033
+ availLeft: number;
3034
+ colorDepth: number;
3035
+ height: number;
3036
+ pixelDepth: number;
3037
+ width: number;
3038
+ devicePixelRatio: number;
3039
+ pageXOffset: number;
3040
+ pageYOffset: number;
3041
+ innerHeight: number;
3042
+ outerHeight: number;
3043
+ outerWidth: number;
3044
+ innerWidth: number;
3045
+ screenX: number;
3046
+ clientWidth: number;
3047
+ clientHeight: number;
3048
+ hasHDR: boolean;
3049
+ }
3050
+ /**
3051
+ * Brand information data structure.
3052
+ */
3053
+ interface Brand {
3054
+ brand: string;
3055
+ version: string;
3056
+ }
3057
+ /**
3058
+ * User agent data structure.
3059
+ */
3060
+ interface UserAgentData {
3061
+ brands: Brand[];
3062
+ mobile: boolean;
3063
+ platform: string;
3064
+ architecture: string;
3065
+ bitness: string;
3066
+ fullVersionList: Brand[];
3067
+ model: string;
3068
+ platformVersion: string;
3069
+ uaFullVersion: string;
3070
+ }
3071
+ /**
3072
+ * Navigator extra properties data structure.
3073
+ */
3074
+ interface ExtraProperties {
3075
+ vendorFlavors: string[];
3076
+ isBluetoothSupported: boolean;
3077
+ globalPrivacyControl?: any;
3078
+ pdfViewerEnabled: boolean;
3079
+ installedApps: any[];
3080
+ }
3081
+ /**
3082
+ * Navigator fingerprint data structure.
3083
+ */
3084
+ interface NavigatorFingerprint {
3085
+ userAgent: string;
3086
+ userAgentData: UserAgentData;
3087
+ doNotTrack: string;
3088
+ appCodeName: string;
3089
+ appName: string;
3090
+ appVersion: string;
3091
+ oscpu: string;
3092
+ webdriver: string;
3093
+ language: string;
3094
+ languages: string[];
3095
+ platform: string;
3096
+ deviceMemory?: number;
3097
+ hardwareConcurrency: number;
3098
+ product: string;
3099
+ productSub: string;
3100
+ vendor: string;
3101
+ vendorSub: string;
3102
+ maxTouchPoints?: number;
3103
+ extraProperties: ExtraProperties;
3104
+ }
3105
+ /**
3106
+ * Video card information data structure.
3107
+ */
3108
+ interface VideoCard {
3109
+ renderer: string;
3110
+ vendor: string;
3111
+ }
3112
+ /**
3113
+ * Main fingerprint data structure.
3114
+ */
3115
+ interface Fingerprint {
3116
+ screen: ScreenFingerprint;
3117
+ navigator: NavigatorFingerprint;
3118
+ videoCodecs: Record<string, string>;
3119
+ audioCodecs: Record<string, string>;
3120
+ pluginsData: Record<string, string>;
3121
+ battery?: Record<string, string>;
3122
+ videoCard: VideoCard;
3123
+ multimediaDevices: string[];
3124
+ fonts: string[];
3125
+ mockWebRTC: boolean;
3126
+ slim?: boolean;
3127
+ }
3128
+ /**
3129
+ * Complete fingerprint format including fingerprint data and headers.
3130
+ */
3131
+ declare class FingerprintFormat {
3132
+ fingerprint: Fingerprint;
3133
+ headers: Record<string, string>;
3134
+ constructor(fingerprint: Fingerprint, headers: Record<string, string>);
3135
+ /**
3136
+ * Load fingerprint format from dict or JSON string.
3137
+ *
3138
+ * @param data - Dictionary or JSON string containing fingerprint data
3139
+ * @returns FingerprintFormat instance
3140
+ *
3141
+ * @example
3142
+ * ```typescript
3143
+ * // From dict
3144
+ * const fp = FingerprintFormat.load({fingerprint: {...}, headers: {...}});
3145
+ * // From JSON file
3146
+ * const data = fs.readFileSync('fingerprint.json', 'utf8');
3147
+ * const fp2 = FingerprintFormat.load(data);
3148
+ * ```
3149
+ */
3150
+ static load(data: string | Record<string, any>): FingerprintFormat;
3151
+ /**
3152
+ * Convert to dictionary format.
3153
+ * Note: Used internally by SDK modules.
3154
+ */
3155
+ toDict(): Record<string, any>;
3156
+ /**
3157
+ * Convert to JSON string format.
3158
+ * Note: Used internally by SDK modules.
3159
+ */
3160
+ toJson(indent?: number): string;
3161
+ /**
3162
+ * Create FingerprintFormat from dictionary data.
3163
+ * Note: Used internally by SDK modules.
3164
+ */
3165
+ static fromDict(data: Record<string, any>): FingerprintFormat;
3166
+ /**
3167
+ * Create FingerprintFormat from JSON string.
3168
+ */
3169
+ static fromJson(jsonStr: string): FingerprintFormat;
3170
+ /**
3171
+ * Create FingerprintFormat directly using component interfaces.
3172
+ */
3173
+ static create(screen: ScreenFingerprint, navigator: NavigatorFingerprint, videoCard: VideoCard, headers: Record<string, string>, videoCodecs?: Record<string, string>, audioCodecs?: Record<string, string>, pluginsData?: Record<string, string>, battery?: Record<string, string>, multimediaDevices?: string[], fonts?: string[], mockWebRTC?: boolean, slim?: boolean): FingerprintFormat;
3174
+ }
3175
+ /**
3176
+ * Browser fingerprint generator class.
3177
+ */
3178
+ declare class BrowserFingerprintGenerator {
3179
+ private headless;
3180
+ private useChromeChannel;
3181
+ constructor(options?: {
3182
+ headless?: boolean;
3183
+ useChromeChannel?: boolean;
3184
+ });
3185
+ /**
3186
+ * Extract comprehensive browser fingerprint using Playwright.
3187
+ */
3188
+ generateFingerprint(): Promise<FingerprintFormat | null>;
3189
+ /**
3190
+ * Extract comprehensive browser fingerprint and save to file.
3191
+ */
3192
+ generateFingerprintToFile(outputFilename?: string): Promise<boolean>;
3193
+ /**
3194
+ * Extract fingerprint data from the page.
3195
+ */
3196
+ private extractFingerprintData;
3197
+ /**
3198
+ * Extract headers data from httpbin.
3199
+ */
3200
+ private extractHeadersData;
3201
+ /**
3202
+ * Save JSON string data to a file.
3203
+ */
3204
+ private saveToFile;
3205
+ }
3206
+
2891
3207
  interface BrowserViewport {
2892
3208
  width: number;
2893
3209
  height: number;
@@ -2901,6 +3217,21 @@ interface BrowserFingerprint {
2901
3217
  operatingSystems?: Array<'windows' | 'macos' | 'linux' | 'android' | 'ios'>;
2902
3218
  locales?: string[];
2903
3219
  }
3220
+ /**
3221
+ * Browser fingerprint context configuration.
3222
+ */
3223
+ declare class BrowserFingerprintContext {
3224
+ /** ID of the fingerprint context for browser fingerprint */
3225
+ fingerprintContextId: string;
3226
+ /**
3227
+ * Initialize BrowserFingerprintContext with context id.
3228
+ *
3229
+ * @param fingerprintContextId - ID of the fingerprint context for browser fingerprint.
3230
+ *
3231
+ * @throws {Error} If fingerprintContextId is empty.
3232
+ */
3233
+ constructor(fingerprintContextId: string);
3234
+ }
2904
3235
  interface BrowserProxy {
2905
3236
  type: 'custom' | 'wuying';
2906
3237
  server?: string;
@@ -2928,6 +3259,10 @@ interface BrowserOption {
2928
3259
  viewport?: BrowserViewport;
2929
3260
  screen?: BrowserScreen;
2930
3261
  fingerprint?: BrowserFingerprint;
3262
+ /** Browser fingerprint format data for detailed fingerprint configuration */
3263
+ fingerprintFormat?: FingerprintFormat;
3264
+ /** Whether to enable fingerprint persistence across sessions */
3265
+ fingerprintPersistent?: boolean;
2931
3266
  solveCaptchas?: boolean;
2932
3267
  proxies?: BrowserProxy[];
2933
3268
  /** Path to the extensions directory. Defaults to "/tmp/extensions/" */
@@ -2946,13 +3281,16 @@ declare class BrowserOptionClass implements BrowserOption {
2946
3281
  viewport?: BrowserViewport;
2947
3282
  screen?: BrowserScreen;
2948
3283
  fingerprint?: BrowserFingerprint;
3284
+ fingerprintFormat?: FingerprintFormat;
3285
+ fingerprintPersistent?: boolean;
3286
+ fingerprintPersistPath?: string;
2949
3287
  solveCaptchas?: boolean;
2950
3288
  proxies?: BrowserProxy[];
2951
3289
  extensionPath?: string;
2952
3290
  cmdArgs?: string[];
2953
3291
  defaultNavigateUrl?: string;
2954
3292
  browserType?: 'chrome' | 'chromium' | undefined;
2955
- constructor(useStealth?: boolean, userAgent?: string, viewport?: BrowserViewport, screen?: BrowserScreen, fingerprint?: BrowserFingerprint, solveCaptchas?: boolean, proxies?: BrowserProxy[], cmdArgs?: string[], defaultNavigateUrl?: string, browserType?: 'chrome' | 'chromium');
3293
+ constructor(useStealth?: boolean, userAgent?: string, viewport?: BrowserViewport, screen?: BrowserScreen, fingerprint?: BrowserFingerprint, fingerprintFormat?: FingerprintFormat, fingerprintPersistent?: boolean, solveCaptchas?: boolean, proxies?: BrowserProxy[], cmdArgs?: string[], defaultNavigateUrl?: string, browserType?: 'chrome' | 'chromium');
2956
3294
  toMap(): Record<string, any>;
2957
3295
  fromMap(m: Record<string, any> | null | undefined): BrowserOptionClass;
2958
3296
  }
@@ -2971,6 +3309,20 @@ declare class Browser {
2971
3309
  /**
2972
3310
  * Initialize the browser instance with the given options asynchronously.
2973
3311
  * Returns true if successful, false otherwise.
3312
+ *
3313
+ * @param option - Browser configuration options
3314
+ * @returns Promise resolving to true if successful, false otherwise
3315
+ *
3316
+ * @example
3317
+ * ```typescript
3318
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3319
+ * const result = await agentBay.create({ imageId: 'browser_latest' });
3320
+ * if (result.success) {
3321
+ * const success = await result.session.browser.initializeAsync(new BrowserOptionClass());
3322
+ * console.log('Browser initialized:', success);
3323
+ * await result.session.delete();
3324
+ * }
3325
+ * ```
2974
3326
  */
2975
3327
  initializeAsync(option: BrowserOptionClass | BrowserOption): Promise<boolean>;
2976
3328
  /**
@@ -2980,6 +3332,22 @@ declare class Browser {
2980
3332
  /**
2981
3333
  * Returns the endpoint URL if the browser is initialized, otherwise throws an exception.
2982
3334
  * When initialized, always fetches the latest CDP url from session.getLink().
3335
+ *
3336
+ * @returns Promise resolving to the CDP endpoint URL
3337
+ * @throws {BrowserError} If browser is not initialized
3338
+ *
3339
+ * @example
3340
+ * ```typescript
3341
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3342
+ * const result = await agentBay.create({ imageId: 'browser_latest' });
3343
+ * if (result.success) {
3344
+ * await result.session.browser.initializeAsync(new BrowserOptionClass());
3345
+ * const endpointUrl = await result.session.browser.getEndpointUrl();
3346
+ * const browser = await chromium.connectOverCDP(endpointUrl);
3347
+ * await browser.close();
3348
+ * await result.session.delete();
3349
+ * }
3350
+ * ```
2983
3351
  */
2984
3352
  getEndpointUrl(): Promise<string>;
2985
3353
  /**
@@ -2994,6 +3362,50 @@ declare class Browser {
2994
3362
  * Stop the browser instance, internal use only.
2995
3363
  */
2996
3364
  private _stopBrowser;
3365
+ /**
3366
+ * Takes a screenshot of the specified page with enhanced options and error handling.
3367
+ * This method requires the caller to connect to the browser via Playwright or similar
3368
+ * and pass the page object to this method.
3369
+ *
3370
+ * Note: This is a placeholder method that indicates where screenshot functionality
3371
+ * should be implemented. In a complete implementation, this would use Playwright's
3372
+ * page.screenshot() method or similar browser automation API.
3373
+ *
3374
+ * @param page The Playwright Page object to take a screenshot of. This is a required parameter.
3375
+ * @param fullPage Whether to capture the full scrollable page. Defaults to false.
3376
+ * @param options Additional screenshot options that will override defaults.
3377
+ * Common options include:
3378
+ * - type: Image type, either 'png' or 'jpeg' (default: 'png')
3379
+ * - quality: Quality of the image, between 0-100 (jpeg only)
3380
+ * - timeout: Maximum time in milliseconds (default: 60000)
3381
+ * - animations: How to handle animations (default: 'disabled')
3382
+ * - caret: How to handle the caret (default: 'hide')
3383
+ * - scale: Scale setting (default: 'css')
3384
+ * @returns Screenshot data as Uint8Array.
3385
+ * @throws BrowserError If browser is not initialized.
3386
+ * @throws Error If screenshot capture fails.
3387
+ *
3388
+ * @example
3389
+ * ```typescript
3390
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3391
+ * const result = await agentBay.create({ imageId: 'browser_latest' });
3392
+ * if (result.success) {
3393
+ * await result.session.browser.initializeAsync(new BrowserOptionClass());
3394
+ * const browser = await chromium.connectOverCDP(await result.session.browser.getEndpointUrl());
3395
+ * const page = await browser.contexts()[0].newPage();
3396
+ * await page.goto('https://example.com');
3397
+ * const screenshot = await result.session.browser.screenshot(page);
3398
+ * await writeFile('screenshot.png', Buffer.from(screenshot));
3399
+ * await browser.close();
3400
+ * await result.session.delete();
3401
+ * }
3402
+ * ```
3403
+ */
3404
+ screenshot(page: any, fullPage?: boolean, options?: Record<string, any>): Promise<Uint8Array>;
3405
+ /**
3406
+ * Scrolls the page to load all content (especially for lazy-loaded elements)
3407
+ */
3408
+ private _scrollToLoadAllContent;
2997
3409
  }
2998
3410
 
2999
3411
  /**
@@ -3026,6 +3438,17 @@ declare class Code {
3026
3438
  * Note: Due to gateway limitations, each request cannot exceed 60 seconds.
3027
3439
  * @returns CodeExecutionResult with code execution output and requestId
3028
3440
  * @throws Error if an unsupported language is specified.
3441
+ *
3442
+ * @example
3443
+ * ```typescript
3444
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
3445
+ * const result = await agentBay.create({ imageId: "code_latest" });
3446
+ * if (result.success) {
3447
+ * const codeResult = await result.session.code.runCode('print("Hello")', "python");
3448
+ * console.log(codeResult.result);
3449
+ * await result.session.delete();
3450
+ * }
3451
+ * ```
3029
3452
  */
3030
3453
  runCode(code: string, language: string, timeoutS?: number): Promise<CodeExecutionResult>;
3031
3454
  }
@@ -3049,13 +3472,36 @@ declare class Command {
3049
3472
  */
3050
3473
  private sanitizeError;
3051
3474
  /**
3052
- * Execute a command in the session environment.
3053
- * Corresponds to Python's execute_command() method
3475
+ * Executes a shell command in the session environment.
3054
3476
  *
3055
- * @param command - The command to execute
3056
- * @param timeoutMs - The timeout in milliseconds. Default is 1000ms.
3057
- * @returns CommandResult with command output and requestId
3058
- * @throws APIError if the operation fails.
3477
+ * @param command - The shell command to execute.
3478
+ * @param timeoutMs - Timeout in milliseconds. Defaults to 1000ms.
3479
+ *
3480
+ * @returns Promise resolving to CommandResult containing:
3481
+ * - success: Whether the command executed successfully
3482
+ * - output: Combined stdout and stderr output
3483
+ * - requestId: Unique identifier for this API request
3484
+ * - errorMessage: Error description if execution failed
3485
+ *
3486
+ * @example
3487
+ * ```typescript
3488
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
3489
+ * const result = await agentBay.create();
3490
+ * if (result.success) {
3491
+ * const cmdResult = await result.session.command.executeCommand('echo "Hello"', 3000);
3492
+ * console.log('Command output:', cmdResult.output);
3493
+ * await result.session.delete();
3494
+ * }
3495
+ * ```
3496
+ *
3497
+ * @remarks
3498
+ * **Behavior:**
3499
+ * - Executes in a Linux shell environment
3500
+ * - Combines stdout and stderr in the output
3501
+ * - Default timeout is 1000ms (1 second)
3502
+ * - Command runs with session user permissions
3503
+ *
3504
+ * @see {@link FileSystem.readFile}, {@link FileSystem.writeFile}
3059
3505
  */
3060
3506
  executeCommand(command: string, timeoutMs?: number): Promise<CommandResult>;
3061
3507
  }
@@ -3107,9 +3553,10 @@ declare const SHOW_NAVIGATION_BAR_TEMPLATE = "setprop persist.wy.hasnavibar true
3107
3553
  /**
3108
3554
  * Uninstall blacklist template
3109
3555
  * Parameters:
3110
- * package_list (string): Semicolon-separated list of package names
3556
+ * package_list (string): Newline-separated list of package names
3557
+ * timestamp (string): Current timestamp for trigger property
3111
3558
  */
3112
- declare const UNINSTALL_BLACKLIST_TEMPLATE = "setprop persist.wy.pm_lock \"{package_list}\"";
3559
+ declare const UNINSTALL_BLACKLIST_TEMPLATE = "cat > /data/system/pm_lock.conf << 'EOF'\n{package_list}\nEOF\nchmod 644 /data/system/pm_lock.conf\nsetprop persist.wy.pm_lock.trigger {timestamp}";
3113
3560
  /**
3114
3561
  * Mobile command templates mapping for easy access
3115
3562
  */
@@ -3180,106 +3627,490 @@ declare class Computer {
3180
3627
  constructor(session: ComputerSession);
3181
3628
  /**
3182
3629
  * Click mouse at specified coordinates.
3630
+ *
3631
+ * @param x - X coordinate for the click
3632
+ * @param y - Y coordinate for the click
3633
+ * @param button - Mouse button to click (default: 'left'). Valid values: 'left', 'right', 'middle', 'double_left'
3634
+ * @returns Promise resolving to result with success status
3635
+ *
3636
+ * @example
3637
+ * ```typescript
3638
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
3639
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3640
+ * if (result.success) {
3641
+ * const clickResult = await result.session.computer.clickMouse(100, 100, 'left');
3642
+ * console.log('Clicked:', clickResult.success);
3643
+ * await result.session.delete();
3644
+ * }
3645
+ * ```
3183
3646
  */
3184
3647
  clickMouse(x: number, y: number, button?: MouseButton | string): Promise<BoolResult$1>;
3185
3648
  /**
3186
3649
  * Move mouse to specified coordinates.
3650
+ *
3651
+ * @param x - X coordinate to move to
3652
+ * @param y - Y coordinate to move to
3653
+ * @returns Promise resolving to result with success status
3654
+ *
3655
+ * @example
3656
+ * ```typescript
3657
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3658
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3659
+ * if (result.success) {
3660
+ * await result.session.computer.moveMouse(300, 400);
3661
+ * const pos = await result.session.computer.getCursorPosition();
3662
+ * console.log(`Position: (${pos.x}, ${pos.y})`);
3663
+ * await result.session.delete();
3664
+ * }
3665
+ * ```
3187
3666
  */
3188
3667
  moveMouse(x: number, y: number): Promise<BoolResult$1>;
3189
3668
  /**
3190
3669
  * Drag mouse from one position to another.
3670
+ *
3671
+ * @param fromX - Starting X coordinate
3672
+ * @param fromY - Starting Y coordinate
3673
+ * @param toX - Ending X coordinate
3674
+ * @param toY - Ending Y coordinate
3675
+ * @param button - Mouse button to use for drag (default: 'left'). Valid values: 'left', 'right', 'middle'
3676
+ * @returns Promise resolving to result with success status
3677
+ *
3678
+ * @example
3679
+ * ```typescript
3680
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3681
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3682
+ * if (result.success) {
3683
+ * const dragResult = await result.session.computer.dragMouse(100, 100, 300, 300, 'left');
3684
+ * console.log('Dragged:', dragResult.success);
3685
+ * await result.session.delete();
3686
+ * }
3687
+ * ```
3191
3688
  */
3192
3689
  dragMouse(fromX: number, fromY: number, toX: number, toY: number, button?: MouseButton | string): Promise<BoolResult$1>;
3193
3690
  /**
3194
3691
  * Scroll at specified coordinates.
3692
+ *
3693
+ * @param x - X coordinate to scroll at
3694
+ * @param y - Y coordinate to scroll at
3695
+ * @param direction - Scroll direction (default: 'up'). Valid values: 'up', 'down', 'left', 'right'
3696
+ * @param amount - Scroll amount (default: 1)
3697
+ * @returns Promise resolving to result with success status
3698
+ *
3699
+ * @example
3700
+ * ```typescript
3701
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3702
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3703
+ * if (result.success) {
3704
+ * await result.session.computer.scroll(400, 300, 'up', 3);
3705
+ * await result.session.delete();
3706
+ * }
3707
+ * ```
3195
3708
  */
3196
3709
  scroll(x: number, y: number, direction?: ScrollDirection | string, amount?: number): Promise<BoolResult$1>;
3197
3710
  /**
3198
- * Input text.
3711
+ * Input text at the current cursor position.
3712
+ *
3713
+ * @param text - Text to input
3714
+ * @returns Promise resolving to result with success status
3715
+ *
3716
+ * @example
3717
+ * ```typescript
3718
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3719
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3720
+ * if (result.success) {
3721
+ * await result.session.computer.inputText('Hello AgentBay!');
3722
+ * await result.session.delete();
3723
+ * }
3724
+ * ```
3199
3725
  */
3200
3726
  inputText(text: string): Promise<BoolResult$1>;
3201
3727
  /**
3202
- * Press keys.
3728
+ * Press one or more keys.
3729
+ *
3730
+ * @param keys - Array of key names to press
3731
+ * @param hold - Whether to hold the keys down (default: false)
3732
+ * @returns Promise resolving to result with success status
3733
+ *
3734
+ * @example
3735
+ * ```typescript
3736
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3737
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3738
+ * if (result.success) {
3739
+ * await result.session.computer.pressKeys(['Ctrl', 'c'], true);
3740
+ * await result.session.computer.releaseKeys(['Ctrl', 'c']);
3741
+ * await result.session.delete();
3742
+ * }
3743
+ * ```
3203
3744
  */
3204
3745
  pressKeys(keys: string[], hold?: boolean): Promise<BoolResult$1>;
3205
3746
  /**
3206
- * Release keys.
3747
+ * Release previously pressed keys.
3748
+ *
3749
+ * @param keys - Array of key names to release
3750
+ * @returns Promise resolving to result with success status
3751
+ *
3752
+ * @example
3753
+ * ```typescript
3754
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3755
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3756
+ * if (result.success) {
3757
+ * await result.session.computer.pressKeys(['Ctrl'], true);
3758
+ * await result.session.computer.releaseKeys(['Ctrl']);
3759
+ * await result.session.delete();
3760
+ * }
3761
+ * ```
3207
3762
  */
3208
3763
  releaseKeys(keys: string[]): Promise<BoolResult$1>;
3209
3764
  /**
3210
3765
  * Get cursor position.
3766
+ *
3767
+ * @returns Promise resolving to result containing cursor coordinates
3768
+ *
3769
+ * @example
3770
+ * ```typescript
3771
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3772
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3773
+ * if (result.success) {
3774
+ * const pos = await result.session.computer.getCursorPosition();
3775
+ * console.log(`Cursor: (${pos.x}, ${pos.y})`);
3776
+ * await result.session.delete();
3777
+ * }
3778
+ * ```
3211
3779
  */
3212
3780
  getCursorPosition(): Promise<CursorPosition>;
3213
3781
  /**
3214
3782
  * Get screen size.
3215
- */
3216
- getScreenSize(): Promise<ScreenSize>;
3783
+ *
3784
+ * @returns Promise resolving to result containing screen dimensions and DPI scaling
3785
+ *
3786
+ * @example
3787
+ * ```typescript
3788
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3789
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3790
+ * if (result.success) {
3791
+ * const size = await result.session.computer.getScreenSize();
3792
+ * console.log(`Screen: ${size.width}x${size.height}`);
3793
+ * await result.session.delete();
3794
+ * }
3795
+ * ```
3796
+ */
3797
+ getScreenSize(): Promise<ScreenSize>;
3217
3798
  /**
3218
3799
  * Take a screenshot.
3800
+ *
3801
+ * @returns Promise resolving to result containing screenshot URL
3802
+ *
3803
+ * @example
3804
+ * ```typescript
3805
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3806
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3807
+ * if (result.success) {
3808
+ * const screenshot = await result.session.computer.screenshot();
3809
+ * console.log('Screenshot URL:', screenshot.data);
3810
+ * await result.session.delete();
3811
+ * }
3812
+ * ```
3219
3813
  */
3220
3814
  screenshot(): Promise<ScreenshotResult$1>;
3221
3815
  /**
3222
3816
  * Lists all root windows.
3817
+ *
3818
+ * @param timeoutMs - Timeout in milliseconds (default: 3000)
3819
+ * @returns Promise resolving to result containing array of root windows
3820
+ *
3821
+ * @example
3822
+ * ```typescript
3823
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3824
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3825
+ * if (result.success) {
3826
+ * const windows = await result.session.computer.listRootWindows();
3827
+ * console.log(`Found ${windows.windows.length} windows`);
3828
+ * await result.session.delete();
3829
+ * }
3830
+ * ```
3223
3831
  */
3224
3832
  listRootWindows(timeoutMs?: number): Promise<WindowListResult>;
3225
3833
  /**
3226
3834
  * Gets the currently active window.
3835
+ *
3836
+ * @param timeoutMs - Timeout in milliseconds (default: 3000)
3837
+ * @returns Promise resolving to result containing active window information
3838
+ *
3839
+ * @example
3840
+ * ```typescript
3841
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3842
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3843
+ * if (result.success) {
3844
+ * const activeWindow = await result.session.computer.getActiveWindow();
3845
+ * console.log(`Active: ${activeWindow.window?.title}`);
3846
+ * await result.session.delete();
3847
+ * }
3848
+ * ```
3227
3849
  */
3228
3850
  getActiveWindow(timeoutMs?: number): Promise<WindowInfoResult>;
3229
3851
  /**
3230
3852
  * Activates the specified window.
3853
+ *
3854
+ * @param windowId - ID of the window to activate
3855
+ * @returns Promise resolving to result with success status
3856
+ *
3857
+ * @example
3858
+ * ```typescript
3859
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
3860
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3861
+ * if (result.success) {
3862
+ * const windows = await result.session.computer.listRootWindows();
3863
+ * await result.session.computer.activateWindow(windows.windows[0].id);
3864
+ * await result.session.delete();
3865
+ * }
3866
+ * ```
3231
3867
  */
3232
3868
  activateWindow(windowId: number): Promise<BoolResult$2>;
3233
3869
  /**
3234
3870
  * Closes the specified window.
3871
+ *
3872
+ * @param windowId - ID of the window to close
3873
+ * @returns Promise resolving to result with success status
3874
+ *
3875
+ * @example
3876
+ * ```typescript
3877
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3878
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3879
+ * if (result.success) {
3880
+ * await result.session.computer.startApp('notepad.exe');
3881
+ * const win = await result.session.computer.getActiveWindow();
3882
+ * await result.session.computer.closeWindow(win.window!.id);
3883
+ * await result.session.delete();
3884
+ * }
3885
+ * ```
3235
3886
  */
3236
3887
  closeWindow(windowId: number): Promise<BoolResult$2>;
3237
3888
  /**
3238
3889
  * Maximizes the specified window.
3890
+ *
3891
+ * @param windowId - ID of the window to maximize
3892
+ * @returns Promise resolving to result with success status
3893
+ *
3894
+ * @example
3895
+ * ```typescript
3896
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3897
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3898
+ * if (result.success) {
3899
+ * await result.session.computer.startApp('notepad.exe');
3900
+ * const win = await result.session.computer.getActiveWindow();
3901
+ * await result.session.computer.maximizeWindow(win.window!.id);
3902
+ * await result.session.delete();
3903
+ * }
3904
+ * ```
3239
3905
  */
3240
3906
  maximizeWindow(windowId: number): Promise<BoolResult$2>;
3241
3907
  /**
3242
3908
  * Minimizes the specified window.
3909
+ *
3910
+ * @param windowId - ID of the window to minimize
3911
+ * @returns Promise resolving to result with success status
3912
+ *
3913
+ * @example
3914
+ * ```typescript
3915
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3916
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3917
+ * if (result.success) {
3918
+ * await result.session.computer.startApp('notepad.exe');
3919
+ * const win = await result.session.computer.getActiveWindow();
3920
+ * await result.session.computer.minimizeWindow(win.window!.id);
3921
+ * await result.session.delete();
3922
+ * }
3923
+ * ```
3243
3924
  */
3244
3925
  minimizeWindow(windowId: number): Promise<BoolResult$2>;
3245
3926
  /**
3246
3927
  * Restores the specified window.
3928
+ *
3929
+ * @param windowId - ID of the window to restore
3930
+ * @returns Promise resolving to result with success status
3931
+ *
3932
+ * @example
3933
+ * ```typescript
3934
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3935
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3936
+ * if (result.success) {
3937
+ * await result.session.computer.startApp('notepad.exe');
3938
+ * const win = await result.session.computer.getActiveWindow();
3939
+ * await result.session.computer.minimizeWindow(win.window!.id);
3940
+ * await result.session.computer.restoreWindow(win.window!.id);
3941
+ * await result.session.delete();
3942
+ * }
3943
+ * ```
3247
3944
  */
3248
3945
  restoreWindow(windowId: number): Promise<BoolResult$2>;
3249
3946
  /**
3250
3947
  * Resizes the specified window.
3948
+ *
3949
+ * @param windowId - ID of the window to resize
3950
+ * @param width - New width of the window
3951
+ * @param height - New height of the window
3952
+ * @returns Promise resolving to result with success status
3953
+ *
3954
+ * @example
3955
+ * ```typescript
3956
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3957
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3958
+ * if (result.success) {
3959
+ * await result.session.computer.startApp('notepad.exe');
3960
+ * const win = await result.session.computer.getActiveWindow();
3961
+ * await result.session.computer.resizeWindow(win.window!.id, 800, 600);
3962
+ * await result.session.delete();
3963
+ * }
3964
+ * ```
3251
3965
  */
3252
3966
  resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult$2>;
3253
3967
  /**
3254
3968
  * Makes the specified window fullscreen.
3969
+ *
3970
+ * @param windowId - ID of the window to make fullscreen
3971
+ * @returns Promise resolving to result with success status
3972
+ *
3973
+ * @example
3974
+ * ```typescript
3975
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3976
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3977
+ * if (result.success) {
3978
+ * await result.session.computer.startApp('notepad.exe');
3979
+ * const win = await result.session.computer.getActiveWindow();
3980
+ * await result.session.computer.fullscreenWindow(win.window!.id);
3981
+ * await result.session.delete();
3982
+ * }
3983
+ * ```
3255
3984
  */
3256
3985
  fullscreenWindow(windowId: number): Promise<BoolResult$2>;
3257
3986
  /**
3258
3987
  * Toggles focus mode on or off.
3988
+ *
3989
+ * @param on - Whether to enable (true) or disable (false) focus mode
3990
+ * @returns Promise resolving to result with success status
3991
+ *
3992
+ * @example
3993
+ * ```typescript
3994
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
3995
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
3996
+ * if (result.success) {
3997
+ * await result.session.computer.focusMode(true);
3998
+ * await result.session.computer.focusMode(false);
3999
+ * await result.session.delete();
4000
+ * }
4001
+ * ```
3259
4002
  */
3260
4003
  focusMode(on: boolean): Promise<BoolResult$2>;
3261
4004
  /**
3262
4005
  * Gets the list of installed applications.
4006
+ *
4007
+ * @param startMenu - Whether to include applications from start menu (default: true)
4008
+ * @param desktop - Whether to include applications from desktop (default: false)
4009
+ * @param ignoreSystemApps - Whether to exclude system applications (default: true)
4010
+ * @returns Promise resolving to result containing array of installed applications
4011
+ *
4012
+ * @example
4013
+ * ```typescript
4014
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4015
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
4016
+ * if (result.success) {
4017
+ * const apps = await result.session.computer.getInstalledApps();
4018
+ * console.log(`Found ${apps.data.length} apps`);
4019
+ * await result.session.delete();
4020
+ * }
4021
+ * ```
3263
4022
  */
3264
- getInstalledApps(): Promise<any>;
4023
+ getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<any>;
3265
4024
  /**
3266
4025
  * Starts the specified application.
4026
+ *
4027
+ * @param startCmd - The command to start the application (e.g., 'notepad.exe', 'calculator:')
4028
+ * @param workDirectory - The working directory for the application (optional)
4029
+ * @param activity - The activity parameter (optional, primarily for mobile use)
4030
+ * @returns Promise resolving to result containing array of started processes
4031
+ *
4032
+ * @example
4033
+ * ```typescript
4034
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4035
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
4036
+ * if (result.success) {
4037
+ * const startResult = await result.session.computer.startApp('notepad.exe');
4038
+ * console.log(`Started ${startResult.data.length} process(es)`);
4039
+ * await result.session.delete();
4040
+ * }
4041
+ * ```
3267
4042
  */
3268
- startApp(startCmd: string, workDirectory?: string): Promise<any>;
4043
+ startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<any>;
3269
4044
  /**
3270
4045
  * Stops an application by process name.
4046
+ *
4047
+ * @param pname - The process name to stop (e.g., 'notepad.exe', 'chrome.exe')
4048
+ * @returns Promise resolving to result with success status
4049
+ *
4050
+ * @example
4051
+ * ```typescript
4052
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4053
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
4054
+ * if (result.success) {
4055
+ * await result.session.computer.startApp('notepad.exe');
4056
+ * await result.session.computer.stopAppByPName('notepad.exe');
4057
+ * await result.session.delete();
4058
+ * }
4059
+ * ```
3271
4060
  */
3272
4061
  stopAppByPName(pname: string): Promise<any>;
3273
4062
  /**
3274
4063
  * Stops an application by process ID.
4064
+ *
4065
+ * @param pid - The process ID to stop
4066
+ * @returns Promise resolving to result with success status
4067
+ *
4068
+ * @example
4069
+ * ```typescript
4070
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4071
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
4072
+ * if (result.success) {
4073
+ * const startResult = await result.session.computer.startApp('notepad.exe');
4074
+ * const pid = startResult.data[0].pid;
4075
+ * await result.session.computer.stopAppByPID(pid);
4076
+ * await result.session.delete();
4077
+ * }
4078
+ * ```
3275
4079
  */
3276
4080
  stopAppByPID(pid: number): Promise<any>;
3277
4081
  /**
3278
4082
  * Stops an application by stop command.
4083
+ *
4084
+ * @param cmd - The command to stop the application
4085
+ * @returns Promise resolving to result with success status
4086
+ *
4087
+ * @example
4088
+ * ```typescript
4089
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4090
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
4091
+ * if (result.success) {
4092
+ * await result.session.computer.startApp('notepad.exe');
4093
+ * await result.session.computer.stopAppByCmd('taskkill /IM notepad.exe /F');
4094
+ * await result.session.delete();
4095
+ * }
4096
+ * ```
3279
4097
  */
3280
4098
  stopAppByCmd(cmd: string): Promise<any>;
3281
4099
  /**
3282
4100
  * Lists all visible applications.
4101
+ *
4102
+ * @returns Promise resolving to result containing array of visible application processes
4103
+ *
4104
+ * @example
4105
+ * ```typescript
4106
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4107
+ * const result = await agentBay.create({ imageId: 'windows_latest' });
4108
+ * if (result.success) {
4109
+ * const apps = await result.session.computer.listVisibleApps();
4110
+ * console.log(`Found ${apps.data.length} visible apps`);
4111
+ * await result.session.delete();
4112
+ * }
4113
+ * ```
3283
4114
  */
3284
4115
  listVisibleApps(): Promise<any>;
3285
4116
  }
@@ -3315,8 +4146,69 @@ interface SessionInterface {
3315
4146
  declare class ContextManager {
3316
4147
  private session;
3317
4148
  constructor(session: SessionInterface);
4149
+ /**
4150
+ * Gets information about context synchronization status for the current session.
4151
+ *
4152
+ * @returns Promise resolving to ContextInfoResult containing context status data and request ID
4153
+ * @throws Error if the API call fails
4154
+ *
4155
+ * @example
4156
+ * ```typescript
4157
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4158
+ * const result = await agentBay.create();
4159
+ * if (result.success) {
4160
+ * const info = await result.session.context.info();
4161
+ * console.log(`Context count: ${info.contextStatusData.length}`);
4162
+ * await result.session.delete();
4163
+ * }
4164
+ * ```
4165
+ */
3318
4166
  info(): Promise<ContextInfoResult>;
4167
+ /**
4168
+ * Gets information about context synchronization status with optional filter parameters.
4169
+ *
4170
+ * @param contextId - Optional context ID to filter results
4171
+ * @param path - Optional path to filter results
4172
+ * @param taskType - Optional task type to filter results (e.g., "upload", "download")
4173
+ * @returns Promise resolving to ContextInfoResult containing filtered context status data and request ID
4174
+ * @throws Error if the API call fails
4175
+ *
4176
+ * @example
4177
+ * ```typescript
4178
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4179
+ * const result = await agentBay.create();
4180
+ * if (result.success) {
4181
+ * const info = await result.session.context.infoWithParams('SdkCtx-xxx', '/mnt/persistent');
4182
+ * console.log(`Context status: ${info.contextStatusData[0]?.status}`);
4183
+ * await result.session.delete();
4184
+ * }
4185
+ * ```
4186
+ */
3319
4187
  infoWithParams(contextId?: string, path?: string, taskType?: string): Promise<ContextInfoResult>;
4188
+ /**
4189
+ * Synchronizes a context with the session. Supports both async and callback modes.
4190
+ *
4191
+ * @param contextId - Optional context ID to synchronize
4192
+ * @param path - Optional path where the context should be mounted
4193
+ * @param mode - Optional synchronization mode (e.g., "upload", "download")
4194
+ * @param callback - Optional callback function. If provided, runs in background and calls callback when complete
4195
+ * @param maxRetries - Maximum number of retries for polling completion status (default: 150)
4196
+ * @param retryInterval - Milliseconds to wait between retries (default: 1500)
4197
+ * @returns Promise resolving to ContextSyncResult with success status and request ID
4198
+ * @throws Error if the API call fails
4199
+ *
4200
+ * @example
4201
+ * ```typescript
4202
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4203
+ * const result = await agentBay.create();
4204
+ * if (result.success) {
4205
+ * const ctxResult = await agentBay.context.get('my-context', true);
4206
+ * const syncResult = await result.session.context.sync(ctxResult.context!.id, '/mnt/persistent', 'upload');
4207
+ * console.log(`Sync: ${syncResult.success}`);
4208
+ * await result.session.delete();
4209
+ * }
4210
+ * ```
4211
+ */
3320
4212
  sync(contextId?: string, path?: string, mode?: string, callback?: SyncCallback, maxRetries?: number, retryInterval?: number): Promise<ContextSyncResult>;
3321
4213
  /**
3322
4214
  * Polls the info interface to check if sync is completed and calls callback.
@@ -3409,6 +4301,17 @@ declare class FileSystem {
3409
4301
  *
3410
4302
  * @param path - Path to the directory to create.
3411
4303
  * @returns BoolResult with creation result and requestId
4304
+ *
4305
+ * @example
4306
+ * ```typescript
4307
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4308
+ * const result = await agentBay.create();
4309
+ * if (result.success) {
4310
+ * const createResult = await result.session.fileSystem.createDirectory('/tmp/mydir');
4311
+ * console.log('Directory created:', createResult.success);
4312
+ * await result.session.delete();
4313
+ * }
4314
+ * ```
3412
4315
  */
3413
4316
  createDirectory(path: string): Promise<BoolResult$2>;
3414
4317
  /**
@@ -3419,6 +4322,19 @@ declare class FileSystem {
3419
4322
  * @param edits - Array of edit operations, each containing oldText and newText.
3420
4323
  * @param dryRun - Optional: If true, preview changes without applying them.
3421
4324
  * @returns BoolResult with edit result and requestId
4325
+ *
4326
+ * @example
4327
+ * ```typescript
4328
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4329
+ * const result = await agentBay.create();
4330
+ * if (result.success) {
4331
+ * await result.session.fileSystem.writeFile('/tmp/config.txt', 'DEBUG=false');
4332
+ * const edits = [{ oldText: 'DEBUG=false', newText: 'DEBUG=true' }];
4333
+ * const editResult = await result.session.fileSystem.editFile('/tmp/config.txt', edits);
4334
+ * console.log('File edited:', editResult.success);
4335
+ * await result.session.delete();
4336
+ * }
4337
+ * ```
3422
4338
  */
3423
4339
  editFile(path: string, edits: Array<{
3424
4340
  oldText: string;
@@ -3430,6 +4346,18 @@ declare class FileSystem {
3430
4346
  *
3431
4347
  * @param path - Path to the file or directory to inspect.
3432
4348
  * @returns FileInfoResult with file info and requestId
4349
+ *
4350
+ * @example
4351
+ * ```typescript
4352
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4353
+ * const result = await agentBay.create();
4354
+ * if (result.success) {
4355
+ * await result.session.fileSystem.writeFile('/tmp/test.txt', 'Sample content');
4356
+ * const infoResult = await result.session.fileSystem.getFileInfo('/tmp/test.txt');
4357
+ * console.log(`Size: ${infoResult.fileInfo.size} bytes`);
4358
+ * await result.session.delete();
4359
+ * }
4360
+ * ```
3433
4361
  */
3434
4362
  getFileInfo(path: string): Promise<FileInfoResult>;
3435
4363
  /**
@@ -3439,6 +4367,38 @@ declare class FileSystem {
3439
4367
  * @param path - Path to the directory to list.
3440
4368
  * @returns DirectoryListResult with directory entries and requestId
3441
4369
  */
4370
+ /**
4371
+ * Lists the contents of a directory.
4372
+ *
4373
+ * @param path - Absolute path to the directory to list.
4374
+ *
4375
+ * @returns Promise resolving to DirectoryListResult containing array of entries.
4376
+ *
4377
+ * @example
4378
+ * ```typescript
4379
+ * import { AgentBay } from 'wuying-agentbay-sdk';
4380
+ *
4381
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4382
+ * const result = await agentBay.create();
4383
+ *
4384
+ * if (result.success) {
4385
+ * const session = result.session;
4386
+ *
4387
+ * // List directory contents
4388
+ * const listResult = await session.fileSystem.listDirectory('/tmp');
4389
+ * if (listResult.success) {
4390
+ * console.log(`Found ${listResult.entries.length} entries`);
4391
+ * for (const entry of listResult.entries) {
4392
+ * console.log(`${entry.name} (${entry.isDirectory ? 'dir' : 'file'})`);
4393
+ * }
4394
+ * }
4395
+ *
4396
+ * await session.delete();
4397
+ * }
4398
+ * ```
4399
+ *
4400
+ * @see {@link readFile}, {@link writeFile}
4401
+ */
3442
4402
  listDirectory(path: string): Promise<DirectoryListResult>;
3443
4403
  /**
3444
4404
  * Moves a file or directory from source to destination.
@@ -3447,6 +4407,18 @@ declare class FileSystem {
3447
4407
  * @param source - Path to the source file or directory.
3448
4408
  * @param destination - Path to the destination file or directory.
3449
4409
  * @returns BoolResult with move result and requestId
4410
+ *
4411
+ * @example
4412
+ * ```typescript
4413
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4414
+ * const result = await agentBay.create();
4415
+ * if (result.success) {
4416
+ * await result.session.fileSystem.writeFile('/tmp/original.txt', 'Test content');
4417
+ * const moveResult = await result.session.fileSystem.moveFile('/tmp/original.txt', '/tmp/moved.txt');
4418
+ * console.log('File moved:', moveResult.success);
4419
+ * await result.session.delete();
4420
+ * }
4421
+ * ```
3450
4422
  */
3451
4423
  moveFile(source: string, destination: string): Promise<BoolResult$2>;
3452
4424
  /**
@@ -3464,16 +4436,43 @@ declare class FileSystem {
3464
4436
  *
3465
4437
  * @param paths - Array of file paths to read.
3466
4438
  * @returns MultipleFileContentResult with file contents and requestId
4439
+ *
4440
+ * @example
4441
+ * ```typescript
4442
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4443
+ * const result = await agentBay.create();
4444
+ * if (result.success) {
4445
+ * await result.session.fileSystem.writeFile('/tmp/file1.txt', 'Content 1');
4446
+ * await result.session.fileSystem.writeFile('/tmp/file2.txt', 'Content 2');
4447
+ * const readResult = await result.session.fileSystem.readMultipleFiles(['/tmp/file1.txt', '/tmp/file2.txt']);
4448
+ * console.log(`Read ${Object.keys(readResult.contents).length} files`);
4449
+ * await result.session.delete();
4450
+ * }
4451
+ * ```
3467
4452
  */
3468
4453
  readMultipleFiles(paths: string[]): Promise<MultipleFileContentResult>;
3469
4454
  /**
3470
- * Searches for files in a directory that match a pattern.
4455
+ * Searches for files in a directory that match a wildcard pattern.
3471
4456
  * Corresponds to Python's search_files() method
3472
4457
  *
3473
4458
  * @param path - Path to the directory to search in.
3474
- * @param pattern - Pattern to search for. Supports glob patterns.
3475
- * @param excludePatterns - Optional: Array of patterns to exclude.
4459
+ * @param pattern - Wildcard pattern to match against file names. Supports * (any characters)
4460
+ * and ? (single character). Examples: "*.py", "test_*", "*config*".
4461
+ * @param excludePatterns - Optional: Array of wildcard patterns to exclude.
3476
4462
  * @returns FileSearchResult with search results and requestId
4463
+ *
4464
+ * @example
4465
+ * ```typescript
4466
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4467
+ * const result = await agentBay.create();
4468
+ * if (result.success) {
4469
+ * await result.session.fileSystem.createDirectory('/tmp/test');
4470
+ * await result.session.fileSystem.writeFile('/tmp/test/file1.py', "print('hello')");
4471
+ * const searchResult = await result.session.fileSystem.searchFiles('/tmp/test', '*.py');
4472
+ * console.log(`Found ${searchResult.matches.length} Python files`);
4473
+ * await result.session.delete();
4474
+ * }
4475
+ * ```
3477
4476
  */
3478
4477
  searchFiles(path: string, pattern: string, excludePatterns?: string[]): Promise<FileSearchResult>;
3479
4478
  /**
@@ -3491,6 +4490,49 @@ declare class FileSystem {
3491
4490
  * @param path - Path to the file to read.
3492
4491
  * @returns FileContentResult with complete file content and requestId
3493
4492
  */
4493
+ /**
4494
+ * Reads the entire content of a file.
4495
+ *
4496
+ * @param path - Absolute path to the file to read.
4497
+ *
4498
+ * @returns Promise resolving to FileContentResult containing:
4499
+ * - success: Whether the read operation succeeded
4500
+ * - content: String content of the file
4501
+ * - requestId: Unique identifier for this API request
4502
+ * - errorMessage: Error description if read failed
4503
+ *
4504
+ * @throws Error if the API call fails.
4505
+ *
4506
+ * @example
4507
+ * ```typescript
4508
+ * import { AgentBay } from 'wuying-agentbay-sdk';
4509
+ *
4510
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4511
+ * const result = await agentBay.create();
4512
+ *
4513
+ * if (result.success) {
4514
+ * const session = result.session;
4515
+ *
4516
+ * // Read a text file
4517
+ * const fileResult = await session.fileSystem.readFile('/etc/hostname');
4518
+ * if (fileResult.success) {
4519
+ * console.log(`Content: ${fileResult.content}`);
4520
+ * // Output: Content: agentbay-session-xyz
4521
+ * }
4522
+ *
4523
+ * await session.delete();
4524
+ * }
4525
+ * ```
4526
+ *
4527
+ * @remarks
4528
+ * **Behavior:**
4529
+ * - Automatically handles large files by reading in 60KB chunks
4530
+ * - Returns empty string for empty files
4531
+ * - Fails if path is a directory or doesn't exist
4532
+ * - Content is returned as UTF-8 string
4533
+ *
4534
+ * @see {@link writeFile}, {@link listDirectory}
4535
+ */
3494
4536
  readFile(path: string): Promise<FileContentResult>;
3495
4537
  /**
3496
4538
  * Writes content to a file. Automatically handles large files by chunking.
@@ -3500,9 +4542,72 @@ declare class FileSystem {
3500
4542
  * @param mode - Optional: Write mode. One of "overwrite", "append", or "create_new". Default is "overwrite".
3501
4543
  * @returns BoolResult indicating success or failure with requestId
3502
4544
  */
4545
+ /**
4546
+ * Writes content to a file.
4547
+ *
4548
+ * @param path - Absolute path to the file to write.
4549
+ * @param content - String content to write to the file.
4550
+ * @param mode - Write mode: "overwrite" (default) or "append".
4551
+ *
4552
+ * @returns Promise resolving to BoolResult with success status.
4553
+ *
4554
+ * @example
4555
+ * ```typescript
4556
+ * import { AgentBay } from 'wuying-agentbay-sdk';
4557
+ *
4558
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4559
+ * const result = await agentBay.create();
4560
+ *
4561
+ * if (result.success) {
4562
+ * const session = result.session;
4563
+ *
4564
+ * // Write to a file (overwrite mode)
4565
+ * const writeResult = await session.fileSystem.writeFile(
4566
+ * '/tmp/test.txt',
4567
+ * 'Hello, AgentBay!'
4568
+ * );
4569
+ * if (writeResult.success) {
4570
+ * console.log('File written successfully');
4571
+ * }
4572
+ *
4573
+ * // Append to a file
4574
+ * const appendResult = await session.fileSystem.writeFile(
4575
+ * '/tmp/test.txt',
4576
+ * '\nNew line',
4577
+ * 'append'
4578
+ * );
4579
+ *
4580
+ * await session.delete();
4581
+ * }
4582
+ * ```
4583
+ *
4584
+ * @remarks
4585
+ * **Behavior:**
4586
+ * - Automatically handles large files by writing in 60KB chunks
4587
+ * - Creates parent directories if they don't exist
4588
+ * - "overwrite" mode replaces existing file content
4589
+ * - "append" mode adds content to the end of the file
4590
+ *
4591
+ * @see {@link readFile}, {@link listDirectory}
4592
+ */
3503
4593
  writeFile(path: string, content: string, mode?: string): Promise<BoolResult$2>;
3504
4594
  /**
3505
4595
  * Get file change information for the specified directory path
4596
+ *
4597
+ * @param path - Directory path to monitor
4598
+ * @returns Promise resolving to result containing detected file changes
4599
+ *
4600
+ * @example
4601
+ * ```typescript
4602
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4603
+ * const result = await agentBay.create();
4604
+ * if (result.success) {
4605
+ * await result.session.fileSystem.createDirectory('/tmp/watch_dir');
4606
+ * const changeResult = await result.session.fileSystem.getFileChange('/tmp/watch_dir');
4607
+ * console.log(`Detected ${changeResult.events.length} changes`);
4608
+ * await result.session.delete();
4609
+ * }
4610
+ * ```
3506
4611
  */
3507
4612
  getFileChange(path: string): Promise<FileChangeResult>;
3508
4613
  /**
@@ -3511,6 +4616,26 @@ declare class FileSystem {
3511
4616
  private parseFileChangeData;
3512
4617
  /**
3513
4618
  * Watch a directory for file changes and call the callback function when changes occur
4619
+ *
4620
+ * @param path - Directory path to monitor
4621
+ * @param callback - Function called when changes are detected
4622
+ * @param interval - Polling interval in milliseconds (default: 500, minimum: 100)
4623
+ * @param signal - Signal to abort the monitoring
4624
+ * @returns Promise that resolves when monitoring stops
4625
+ *
4626
+ * @example
4627
+ * ```typescript
4628
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4629
+ * const result = await agentBay.create();
4630
+ * if (result.success) {
4631
+ * const testDir = '/tmp/watch_test';
4632
+ * await result.session.fileSystem.createDirectory(testDir);
4633
+ * const controller = new AbortController();
4634
+ * const callback = (events) => console.log(`Detected ${events.length} changes`);
4635
+ * await result.session.fileSystem.watchDirectory(testDir, callback, 1000, controller.signal);
4636
+ * await result.session.delete();
4637
+ * }
4638
+ * ```
3514
4639
  */
3515
4640
  watchDirectory(path: string, callback: (events: FileChangeEvent[]) => void, interval?: number, signal?: AbortSignal): Promise<void>;
3516
4641
  /**
@@ -3521,6 +4646,17 @@ declare class FileSystem {
3521
4646
  * @param remotePath - Remote file path to upload to
3522
4647
  * @param options - Optional parameters
3523
4648
  * @returns UploadResult with upload result and requestId
4649
+ *
4650
+ * @example
4651
+ * ```typescript
4652
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4653
+ * const result = await agentBay.create({ imageId: 'code_latest' });
4654
+ * if (result.success) {
4655
+ * const uploadResult = await result.session.fileSystem.uploadFile('/tmp/local.txt', '/workspace/remote.txt');
4656
+ * console.log('Upload success:', uploadResult.success);
4657
+ * await result.session.delete();
4658
+ * }
4659
+ * ```
3524
4660
  */
3525
4661
  uploadFile(localPath: string, remotePath: string, options?: {
3526
4662
  contentType?: string;
@@ -3537,6 +4673,18 @@ declare class FileSystem {
3537
4673
  * @param localPath - Local file path to download to
3538
4674
  * @param options - Optional parameters
3539
4675
  * @returns DownloadResult with download result and requestId
4676
+ *
4677
+ * @example
4678
+ * ```typescript
4679
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
4680
+ * const result = await agentBay.create({ imageId: 'code_latest' });
4681
+ * if (result.success) {
4682
+ * await result.session.fileSystem.writeFile('/workspace/remote.txt', 'Content to download');
4683
+ * const downloadResult = await result.session.fileSystem.downloadFile('/workspace/remote.txt', '/tmp/local.txt');
4684
+ * console.log('Download success:', downloadResult.success);
4685
+ * await result.session.delete();
4686
+ * }
4687
+ * ```
3540
4688
  */
3541
4689
  downloadFile(remotePath: string, localPath: string, options?: {
3542
4690
  overwrite?: boolean;
@@ -3661,13 +4809,13 @@ interface UIBounds {
3661
4809
  right: number;
3662
4810
  bottom: number;
3663
4811
  }
3664
- interface UIElement$1 {
4812
+ interface UIElement {
3665
4813
  text: string;
3666
4814
  className: string;
3667
4815
  bounds: UIBounds | string;
3668
4816
  }
3669
4817
  interface UIElementsResult extends OperationResult {
3670
- elements: UIElement$1[];
4818
+ elements: UIElement[];
3671
4819
  }
3672
4820
  interface InstalledApp {
3673
4821
  name: string;
@@ -3695,6 +4843,7 @@ interface MobileSession {
3695
4843
  callMcpTool(toolName: string, args: Record<string, any>): Promise<any>;
3696
4844
  sessionId: string;
3697
4845
  getAPIKey(): string;
4846
+ getAgentBay(): any;
3698
4847
  imageId?: string;
3699
4848
  getLink(protocolType?: string, port?: number, options?: string): Promise<any>;
3700
4849
  }
@@ -3702,19 +4851,80 @@ declare class Mobile {
3702
4851
  private session;
3703
4852
  constructor(session: MobileSession);
3704
4853
  /**
3705
- * Tap at specified coordinates.
4854
+ * Tap at specified coordinates on the mobile screen.
4855
+ *
4856
+ * @param x - X coordinate for the tap
4857
+ * @param y - Y coordinate for the tap
4858
+ * @returns Promise resolving to BoolResult with success status
4859
+ *
4860
+ * @example
4861
+ * ```typescript
4862
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
4863
+ * const result = await agentBay.create({ imageId: 'mobile_latest' });
4864
+ * if (result.success) {
4865
+ * const tapResult = await result.session.mobile.tap(100, 100);
4866
+ * console.log('Tap success:', tapResult.success);
4867
+ * await result.session.delete();
4868
+ * }
4869
+ * ```
3706
4870
  */
3707
4871
  tap(x: number, y: number): Promise<BoolResult>;
3708
4872
  /**
3709
- * Swipe from one position to another.
4873
+ * Swipe from one position to another on the mobile screen.
4874
+ *
4875
+ * @param startX - Starting X coordinate
4876
+ * @param startY - Starting Y coordinate
4877
+ * @param endX - Ending X coordinate
4878
+ * @param endY - Ending Y coordinate
4879
+ * @param durationMs - Swipe duration in milliseconds. Default is 300
4880
+ * @returns Promise resolving to BoolResult with success status
4881
+ *
4882
+ * @example
4883
+ * ```typescript
4884
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
4885
+ * const result = await agentBay.create({ imageId: 'mobile_latest' });
4886
+ * if (result.success) {
4887
+ * const swipeResult = await result.session.mobile.swipe(200, 400, 200, 100, 300);
4888
+ * console.log('Swipe success:', swipeResult.success);
4889
+ * await result.session.delete();
4890
+ * }
4891
+ * ```
3710
4892
  */
3711
4893
  swipe(startX: number, startY: number, endX: number, endY: number, durationMs?: number): Promise<BoolResult>;
3712
4894
  /**
3713
- * Input text.
4895
+ * Input text at the current focus position.
4896
+ *
4897
+ * @param text - Text to input
4898
+ * @returns Promise resolving to BoolResult with success status
4899
+ *
4900
+ * @example
4901
+ * ```typescript
4902
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
4903
+ * const result = await agentBay.create({ imageId: 'mobile_latest' });
4904
+ * if (result.success) {
4905
+ * const inputResult = await result.session.mobile.inputText('Hello Mobile');
4906
+ * console.log('Text input successfully:', inputResult.success);
4907
+ * await result.session.delete();
4908
+ * }
4909
+ * ```
3714
4910
  */
3715
4911
  inputText(text: string): Promise<BoolResult>;
3716
4912
  /**
3717
4913
  * Send Android key code.
4914
+ *
4915
+ * @param key - Android key code (e.g., 4 for BACK, 3 for HOME, 24 for VOLUME_UP)
4916
+ * @returns Promise resolving to BoolResult with success status
4917
+ *
4918
+ * @example
4919
+ * ```typescript
4920
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
4921
+ * const result = await agentBay.create({ imageId: 'mobile_latest' });
4922
+ * if (result.success) {
4923
+ * const keyResult = await result.session.mobile.sendKey(4);
4924
+ * console.log('BACK key sent:', keyResult.success);
4925
+ * await result.session.delete();
4926
+ * }
4927
+ * ```
3718
4928
  */
3719
4929
  sendKey(key: number): Promise<BoolResult>;
3720
4930
  /**
@@ -3731,14 +4941,58 @@ declare class Mobile {
3731
4941
  getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<InstalledAppsResult>;
3732
4942
  /**
3733
4943
  * Start an app.
4944
+ *
4945
+ * @param startCmd - Start command using "monkey -p" format (e.g., 'monkey -p com.android.settings')
4946
+ * @param workDirectory - Optional working directory for the app
4947
+ * @param activity - Optional activity name to launch
4948
+ * @returns Promise resolving to ProcessResult containing launched process information
4949
+ *
4950
+ * @example
4951
+ * ```typescript
4952
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
4953
+ * const result = await agentBay.create({ imageId: 'mobile_latest' });
4954
+ * if (result.success) {
4955
+ * const startResult = await result.session.mobile.startApp('monkey -p com.android.settings');
4956
+ * console.log('App started:', startResult.success);
4957
+ * await result.session.delete();
4958
+ * }
4959
+ * ```
3734
4960
  */
3735
4961
  startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<ProcessResult>;
3736
4962
  /**
3737
- * Stop app by package name.
4963
+ * Stop app by command.
4964
+ *
4965
+ * @param stopCmd - Package name of the app to stop (e.g., 'com.android.settings')
4966
+ * @returns Promise resolving to BoolResult with success status
4967
+ *
4968
+ * @example
4969
+ * ```typescript
4970
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
4971
+ * const result = await agentBay.create({ imageId: 'mobile_latest' });
4972
+ * if (result.success) {
4973
+ * await result.session.mobile.startApp('monkey -p com.android.settings');
4974
+ * const stopResult = await result.session.mobile.stopAppByCmd('com.android.settings');
4975
+ * console.log('App stopped:', stopResult.success);
4976
+ * await result.session.delete();
4977
+ * }
4978
+ * ```
3738
4979
  */
3739
- stopAppByPName(pname: string): Promise<BoolResult>;
4980
+ stopAppByCmd(stopCmd: string): Promise<BoolResult>;
3740
4981
  /**
3741
- * Take a screenshot.
4982
+ * Take a screenshot of the current mobile screen.
4983
+ *
4984
+ * @returns Promise resolving to ScreenshotResult containing screenshot URL
4985
+ *
4986
+ * @example
4987
+ * ```typescript
4988
+ * const agentBay = new AgentBay({ apiKey: process.env.AGENTBAY_API_KEY });
4989
+ * const result = await agentBay.create({ imageId: 'mobile_latest' });
4990
+ * if (result.success) {
4991
+ * const screenshotResult = await result.session.mobile.screenshot();
4992
+ * console.log('Screenshot URL:', screenshotResult.data);
4993
+ * await result.session.delete();
4994
+ * }
4995
+ * ```
3742
4996
  */
3743
4997
  screenshot(): Promise<ScreenshotResult>;
3744
4998
  /**
@@ -3809,380 +5063,132 @@ declare class Mobile {
3809
5063
  * Handles OSS operations in the AgentBay cloud environment.
3810
5064
  */
3811
5065
  declare class Oss {
3812
- private session;
3813
- /**
3814
- * Initialize an Oss object.
3815
- *
3816
- * @param session - The Session instance that this Oss belongs to.
3817
- */
3818
- constructor(session: Session);
3819
- /**
3820
- * Sanitizes error messages to remove sensitive information like API keys.
3821
- *
3822
- * @param error - The error to sanitize
3823
- * @returns The sanitized error
3824
- */
3825
- private sanitizeError;
3826
- /**
3827
- * Initialize OSS environment variables with the specified credentials.
3828
- * Corresponds to Python's env_init() method
3829
- *
3830
- * @param accessKeyId - The access key ID
3831
- * @param accessKeySecret - The access key secret
3832
- * @param securityToken - The security token (optional)
3833
- * @param endpoint - The OSS endpoint (optional)
3834
- * @param region - The OSS region (optional)
3835
- * @returns OSSClientResult with client configuration and requestId
3836
- * @throws APIError if the operation fails.
3837
- */
3838
- envInit(accessKeyId: string, accessKeySecret: string, securityToken?: string, endpoint?: string, region?: string): Promise<OSSClientResult>;
3839
- /**
3840
- * Upload a file to OSS.
3841
- * Corresponds to Python's upload() method
3842
- *
3843
- * @param bucket - The OSS bucket name
3844
- * @param object - The OSS object key
3845
- * @param path - The local file path to upload
3846
- * @returns OSSUploadResult with upload result and requestId
3847
- * @throws APIError if the operation fails.
3848
- */
3849
- upload(bucket: string, object: string, path: string): Promise<OSSUploadResult>;
3850
- /**
3851
- * Upload a file to OSS using an anonymous URL.
3852
- * Corresponds to Python's upload_anonymous() method
3853
- *
3854
- * @param url - The anonymous upload URL
3855
- * @param path - The local file path to upload
3856
- * @returns OSSUploadResult with upload result and requestId
3857
- * @throws APIError if the operation fails.
3858
- */
3859
- uploadAnonymous(url: string, path: string): Promise<OSSUploadResult>;
3860
- /**
3861
- * Download a file from OSS.
3862
- * Corresponds to Python's download() method
3863
- *
3864
- * @param bucket - The OSS bucket name
3865
- * @param object - The OSS object key
3866
- * @param path - The local file path to save the downloaded file
3867
- * @returns OSSDownloadResult with download result and requestId
3868
- * @throws APIError if the operation fails.
3869
- */
3870
- download(bucket: string, object: string, path: string): Promise<OSSDownloadResult>;
3871
- /**
3872
- * Download a file from OSS using an anonymous URL.
3873
- * Corresponds to Python's download_anonymous() method
3874
- *
3875
- * @param url - The anonymous download URL
3876
- * @param path - The local file path to save the downloaded file
3877
- * @returns OSSDownloadResult with download result and requestId
3878
- * @throws APIError if the operation fails.
3879
- */
3880
- downloadAnonymous(url: string, path: string): Promise<OSSDownloadResult>;
3881
- }
3882
-
3883
- /**
3884
- * Key codes for UI operations
3885
- */
3886
- declare enum KeyCode {
3887
- HOME = 3,
3888
- BACK = 4,
3889
- VOLUME_UP = 24,
3890
- VOLUME_DOWN = 25,
3891
- POWER = 26,
3892
- MENU = 82
3893
- }
3894
- /**
3895
- * Interface representing a UI element in the UI hierarchy
3896
- */
3897
- interface UIElement {
3898
- bounds: string;
3899
- className: string;
3900
- text: string;
3901
- type: string;
3902
- resourceId: string;
3903
- index: number;
3904
- isParent: boolean;
3905
- children?: UIElement[];
3906
- }
3907
- /**
3908
- * Handles UI operations in the AgentBay cloud environment.
3909
- *
3910
- * @deprecated This module is deprecated. Use Computer or Mobile modules instead.
3911
- * - For desktop UI operations, use session.computer
3912
- * - For mobile UI operations, use session.mobile
3913
- */
3914
- declare class UI {
3915
- private session;
3916
- /**
3917
- * Initialize a UI object.
3918
- *
3919
- * @param session - The Session instance that this UI belongs to.
3920
- */
3921
- constructor(session: {
3922
- getAPIKey(): string;
3923
- getClient(): any;
3924
- getSessionId(): string;
3925
- callMcpTool(toolName: string, args: any): Promise<{
3926
- success: boolean;
3927
- data: string;
3928
- errorMessage: string;
3929
- requestId: string;
3930
- }>;
3931
- });
3932
- /**
3933
- * Sanitizes error messages to remove sensitive information like API keys.
3934
- *
3935
- * @param error - The error to sanitize
3936
- * @returns The sanitized error
3937
- */
3938
- private sanitizeError;
3939
- /**
3940
- * Retrieves all clickable UI elements within the specified timeout.
3941
- * Corresponds to Python's get_clickable_ui_elements() method
3942
- *
3943
- * @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
3944
- * @returns UIElementListResult with clickable elements and requestId
3945
- * @throws Error if the operation fails.
3946
- *
3947
- * @deprecated Use session.computer.getClickableUIElements() for desktop or session.mobile.getClickableUIElements() for mobile instead.
3948
- */
3949
- getClickableUIElements(timeoutMs?: number): Promise<UIElementListResult>;
3950
- /**
3951
- * Retrieves all UI elements regardless of their clickable status.
3952
- * Corresponds to Python's get_all_ui_elements() method
3953
- *
3954
- * @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
3955
- * @returns UIElementListResult with all elements and requestId
3956
- * @throws Error if the operation fails.
3957
- *
3958
- * @deprecated Use session.computer.getAllUIElements() for desktop or session.mobile.getAllUIElements() for mobile instead.
3959
- */
3960
- getAllUIElements(timeoutMs?: number): Promise<UIElementListResult>;
3961
- /**
3962
- * Sends a key press event.
3963
- * Corresponds to Python's send_key() method
3964
- *
3965
- * @param key - The key code to send. Supported key codes are:
3966
- * - 3 : HOME
3967
- * - 4 : BACK
3968
- * - 24 : VOLUME UP
3969
- * - 25 : VOLUME DOWN
3970
- * - 26 : POWER
3971
- * - 82 : MENU
3972
- * @returns BoolResult with success status and requestId
3973
- * @throws Error if the operation fails.
3974
- *
3975
- * @deprecated Use session.computer.pressKeys() for desktop or session.mobile.sendKey() for mobile instead.
3976
- */
3977
- sendKey(key: number): Promise<BoolResult$2>;
3978
- /**
3979
- * Inputs text into the currently focused UI element.
3980
- * Corresponds to Python's input_text() method
3981
- *
3982
- * @param text - The text to input
3983
- * @returns BoolResult with success status and requestId
3984
- * @throws Error if the operation fails.
3985
- *
3986
- * @deprecated Use session.computer.inputText() for desktop or session.mobile.inputText() for mobile instead.
3987
- */
3988
- inputText(text: string): Promise<BoolResult$2>;
3989
- /**
3990
- * Performs a swipe gesture on the screen.
3991
- * Corresponds to Python's swipe() method
3992
- *
3993
- * @param startX - The starting X coordinate
3994
- * @param startY - The starting Y coordinate
3995
- * @param endX - The ending X coordinate
3996
- * @param endY - The ending Y coordinate
3997
- * @param durationMs - The duration of the swipe in milliseconds. Default is 300ms.
3998
- * @returns BoolResult with success status and requestId
3999
- * @throws Error if the operation fails.
4000
- *
4001
- * @deprecated Use session.computer.dragMouse() for desktop or session.mobile.swipe() for mobile instead.
4002
- */
4003
- swipe(startX: number, startY: number, endX: number, endY: number, durationMs?: number): Promise<BoolResult$2>;
4004
- /**
4005
- * Clicks on the screen at the specified coordinates.
4006
- * Corresponds to Python's click() method
4007
- *
4008
- * @param x - The X coordinate
4009
- * @param y - The Y coordinate
4010
- * @param button - The mouse button to use. Default is 'left'
4011
- * @returns BoolResult with success status and requestId
4012
- * @throws Error if the operation fails.
4013
- *
4014
- * @deprecated Use session.computer.clickMouse() for desktop or session.mobile.tap() for mobile instead.
4015
- */
4016
- click(x: number, y: number, button?: string): Promise<BoolResult$2>;
4017
- /**
4018
- * Takes a screenshot of the current screen.
4019
- * Corresponds to Python's screenshot() method
4020
- *
4021
- * @returns OperationResult with success status and requestId
4022
- * @throws Error if the operation fails.
4023
- *
4024
- * @deprecated Use session.computer.screenshot() for desktop or session.mobile.screenshot() for mobile instead.
4025
- */
4026
- screenshot(): Promise<OperationResult>;
4027
- }
4028
-
4029
- /**
4030
- * Handles window management operations in the AgentBay cloud environment.
4031
- *
4032
- * @deprecated This module is deprecated. Use Computer module instead.
4033
- * - For desktop window operations, use session.computer
4034
- * - Window operations are not available for mobile
4035
- */
4036
- declare class WindowManager {
4037
- private session;
4038
- /**
4039
- * Creates a new WindowManager instance.
4040
- * @param session The session object that provides access to the AgentBay API.
4041
- */
4042
- constructor(session: {
4043
- getAPIKey(): string;
4044
- getSessionId(): string;
4045
- callMcpTool(toolName: string, args: any): Promise<{
4046
- success: boolean;
4047
- data: string;
4048
- errorMessage: string;
4049
- requestId: string;
4050
- }>;
4051
- });
4052
- /**
4053
- * Helper method to parse JSON string into Window objects
4054
- * @param jsonStr - JSON string to parse
4055
- * @returns Array of Window objects or single Window object
4056
- */
4057
- private parseWindowsFromJSON;
4058
- /**
4059
- * Lists all root windows in the system.
4060
- * Corresponds to Python's list_root_windows() method
4061
- *
4062
- * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
4063
- * @returns WindowListResult with windows array and requestId
4064
- *
4065
- * @deprecated Use session.computer.listRootWindows() instead.
4066
- */
4067
- listRootWindows(timeoutMs?: number): Promise<WindowListResult>;
4068
- /**
4069
- * Lists all windows in the system.
4070
- * Corresponds to Python's list_all_windows() method
4071
- *
4072
- * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
4073
- * @returns WindowListResult with windows array and requestId
4074
- *
4075
- * @deprecated Use session.computer.listAllWindows() instead.
4076
- */
4077
- listAllWindows(timeoutMs?: number): Promise<WindowListResult>;
4078
- /**
4079
- * Gets information about a specific window.
4080
- * Corresponds to Python's get_window_info() method
4081
- *
4082
- * @param windowId - The ID of the window to get information for.
4083
- * @returns WindowInfoResult with window information and requestId
4084
- *
4085
- * @deprecated Use session.computer.getWindowInfo() instead.
4086
- */
4087
- getWindowInfo(windowId: number): Promise<WindowInfoResult>;
4088
- /**
4089
- * Activates a window by bringing it to the foreground.
4090
- * Corresponds to Python's activate_window() method
4091
- *
4092
- * @param windowId - The ID of the window to activate.
4093
- * @returns BoolResult with success status and requestId
4094
- *
4095
- * @deprecated Use session.computer.activateWindow() instead.
4096
- */
4097
- activateWindow(windowId: number): Promise<BoolResult$2>;
4098
- /**
4099
- * Maximizes a window.
4100
- * Corresponds to Python's maximize_window() method
4101
- *
4102
- * @param windowId - The ID of the window to maximize.
4103
- * @returns BoolResult with success status and requestId
4104
- *
4105
- * @deprecated Use session.computer.maximizeWindow() instead.
4106
- */
4107
- maximizeWindow(windowId: number): Promise<BoolResult$2>;
5066
+ private session;
4108
5067
  /**
4109
- * Minimizes a window.
4110
- * Corresponds to Python's minimize_window() method
4111
- *
4112
- * @param windowId - The ID of the window to minimize.
4113
- * @returns BoolResult with success status and requestId
5068
+ * Initialize an Oss object.
4114
5069
  *
4115
- * @deprecated Use session.computer.minimizeWindow() instead.
5070
+ * @param session - The Session instance that this Oss belongs to.
4116
5071
  */
4117
- minimizeWindow(windowId: number): Promise<BoolResult$2>;
5072
+ constructor(session: Session);
4118
5073
  /**
4119
- * Restores a window by ID.
4120
- * Corresponds to Python's restore_window() method
5074
+ * Sanitizes error messages to remove sensitive information like API keys.
4121
5075
  *
4122
- * @param windowId The ID of the window to restore.
4123
- * @returns BoolResult with requestId
5076
+ * @param error - The error to sanitize
5077
+ * @returns The sanitized error
4124
5078
  */
4125
- restoreWindow(windowId: number): Promise<BoolResult$2>;
5079
+ private sanitizeError;
4126
5080
  /**
4127
- * Closes a window.
4128
- * Corresponds to Python's close_window() method
4129
- *
4130
- * @param windowId - The ID of the window to close.
4131
- * @returns BoolResult with success status and requestId
5081
+ * Initialize OSS environment variables with the specified STS temporary credentials.
5082
+ * Corresponds to Python's env_init() method
4132
5083
  *
4133
- * @deprecated Use session.computer.closeWindow() instead.
4134
- */
4135
- closeWindow(windowId: number): Promise<BoolResult$2>;
4136
- /**
4137
- * Sets a window to fullscreen by ID.
4138
- * Corresponds to Python's fullscreen_window() method
5084
+ * @param accessKeyId - The access key ID from STS temporary credentials
5085
+ * @param accessKeySecret - The access key secret from STS temporary credentials
5086
+ * @param securityToken - The security token from STS temporary credentials (required)
5087
+ * @param endpoint - The OSS endpoint (optional)
5088
+ * @param region - The OSS region (optional)
5089
+ * @returns OSSClientResult with client configuration and requestId
5090
+ * @throws APIError if the operation fails.
4139
5091
  *
4140
- * @param windowId The ID of the window to set to fullscreen.
4141
- * @returns BoolResult with requestId
5092
+ * @example
5093
+ * ```typescript
5094
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5095
+ * const createResult = await agentBay.create();
5096
+ * if (createResult.success) {
5097
+ * const result = await createResult.session.oss.envInit('sts_key_id', 'sts_key_secret', 'sts_token', 'oss-cn-hangzhou.aliyuncs.com', 'cn-hangzhou');
5098
+ * console.log('OSS initialized:', result.success);
5099
+ * await createResult.session.delete();
5100
+ * }
5101
+ * ```
4142
5102
  */
4143
- fullscreenWindow(windowId: number): Promise<BoolResult$2>;
5103
+ envInit(accessKeyId: string, accessKeySecret: string, securityToken: string, endpoint?: string, region?: string): Promise<OSSClientResult>;
4144
5104
  /**
4145
- * Resizes a window to the specified dimensions.
4146
- * Corresponds to Python's resize_window() method
5105
+ * Upload a file to OSS.
5106
+ * Corresponds to Python's upload() method
4147
5107
  *
4148
- * @param windowId - The ID of the window to resize.
4149
- * @param width - The new width of the window.
4150
- * @param height - The new height of the window.
4151
- * @returns BoolResult with success status and requestId
5108
+ * @param bucket - The OSS bucket name
5109
+ * @param object - The OSS object key
5110
+ * @param path - The local file path to upload
5111
+ * @returns OSSUploadResult with upload result and requestId
5112
+ * @throws APIError if the operation fails.
4152
5113
  *
4153
- * @deprecated Use session.computer.resizeWindow() instead.
5114
+ * @example
5115
+ * ```typescript
5116
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5117
+ * const createResult = await agentBay.create();
5118
+ * if (createResult.success) {
5119
+ * await createResult.session.oss.envInit('key_id', 'key_secret', 'token', 'oss-cn-hangzhou.aliyuncs.com', 'cn-hangzhou');
5120
+ * const result = await createResult.session.oss.upload('my-bucket', 'my-folder/file.txt', '/path/to/local/file.txt');
5121
+ * console.log('Upload success:', result.success);
5122
+ * await createResult.session.delete();
5123
+ * }
5124
+ * ```
4154
5125
  */
4155
- resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult$2>;
5126
+ upload(bucket: string, object: string, path: string): Promise<OSSUploadResult>;
4156
5127
  /**
4157
- * Moves a window to the specified position.
4158
- * Corresponds to Python's move_window() method
5128
+ * Upload a file to OSS using an anonymous URL.
5129
+ * Corresponds to Python's upload_anonymous() method
4159
5130
  *
4160
- * @param windowId - The ID of the window to move.
4161
- * @param x - The new x coordinate of the window.
4162
- * @param y - The new y coordinate of the window.
4163
- * @returns BoolResult with success status and requestId
5131
+ * @param url - The anonymous upload URL
5132
+ * @param path - The local file path to upload
5133
+ * @returns OSSUploadResult with upload result and requestId
5134
+ * @throws APIError if the operation fails.
4164
5135
  *
4165
- * @deprecated Use session.computer.moveWindow() instead.
5136
+ * @example
5137
+ * ```typescript
5138
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5139
+ * const createResult = await agentBay.create();
5140
+ * if (createResult.success) {
5141
+ * const result = await createResult.session.oss.uploadAnonymous('https://example.com/upload', '/path/to/local/file.txt');
5142
+ * console.log('Anonymous upload success:', result.success);
5143
+ * await createResult.session.delete();
5144
+ * }
5145
+ * ```
4166
5146
  */
4167
- moveWindow(windowId: number, x: number, y: number): Promise<BoolResult$2>;
5147
+ uploadAnonymous(url: string, path: string): Promise<OSSUploadResult>;
4168
5148
  /**
4169
- * Enables or disables focus mode.
4170
- * Corresponds to Python's focus_mode() method
5149
+ * Download a file from OSS.
5150
+ * Corresponds to Python's download() method
5151
+ *
5152
+ * @param bucket - The OSS bucket name
5153
+ * @param object - The OSS object key
5154
+ * @param path - The local file path to save the downloaded file
5155
+ * @returns OSSDownloadResult with download result and requestId
5156
+ * @throws APIError if the operation fails.
4171
5157
  *
4172
- * @param on Whether to enable focus mode.
4173
- * @returns BoolResult with requestId
5158
+ * @example
5159
+ * ```typescript
5160
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5161
+ * const createResult = await agentBay.create();
5162
+ * if (createResult.success) {
5163
+ * await createResult.session.oss.envInit('key_id', 'key_secret', 'token', 'oss-cn-hangzhou.aliyuncs.com', 'cn-hangzhou');
5164
+ * const result = await createResult.session.oss.download('my-bucket', 'my-folder/file.txt', '/path/to/save/file.txt');
5165
+ * console.log('Download success:', result.success);
5166
+ * await createResult.session.delete();
5167
+ * }
5168
+ * ```
4174
5169
  */
4175
- focusMode(on: boolean): Promise<BoolResult$2>;
5170
+ download(bucket: string, object: string, path: string): Promise<OSSDownloadResult>;
4176
5171
  /**
4177
- * Gets the currently active window.
4178
- * Corresponds to Python's get_active_window() method
5172
+ * Download a file from OSS using an anonymous URL.
5173
+ * Corresponds to Python's download_anonymous() method
4179
5174
  *
4180
- * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
4181
- * @returns WindowInfoResult with active window information and requestId
5175
+ * @param url - The anonymous download URL
5176
+ * @param path - The local file path to save the downloaded file
5177
+ * @returns OSSDownloadResult with download result and requestId
5178
+ * @throws APIError if the operation fails.
4182
5179
  *
4183
- * @deprecated Use session.computer.getActiveWindow() instead.
5180
+ * @example
5181
+ * ```typescript
5182
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5183
+ * const createResult = await agentBay.create();
5184
+ * if (createResult.success) {
5185
+ * const result = await createResult.session.oss.downloadAnonymous('https://example.com/file.txt', '/path/to/save/file.txt');
5186
+ * console.log('Anonymous download success:', result.success);
5187
+ * await createResult.session.delete();
5188
+ * }
5189
+ * ```
4184
5190
  */
4185
- getActiveWindow(timeoutMs?: number): Promise<WindowInfoResult>;
5191
+ downloadAnonymous(url: string, path: string): Promise<OSSDownloadResult>;
4186
5192
  }
4187
5193
 
4188
5194
  /**
@@ -4219,9 +5225,6 @@ declare class Session {
4219
5225
  command: Command;
4220
5226
  code: Code;
4221
5227
  oss: Oss;
4222
- application: Application;
4223
- window: WindowManager;
4224
- ui: UI;
4225
5228
  computer: Computer;
4226
5229
  mobile: Mobile;
4227
5230
  agent: Agent;
@@ -4237,46 +5240,118 @@ declare class Session {
4237
5240
  constructor(agentBay: AgentBay, sessionId: string);
4238
5241
  /**
4239
5242
  * Return the AgentBay instance that created this session.
5243
+ *
5244
+ * @returns The AgentBay client instance
5245
+ * @internal
4240
5246
  */
4241
5247
  getAgentBay(): AgentBay;
4242
5248
  /**
4243
5249
  * Return the API key for this session.
5250
+ * Note: This method is used internally by SDK modules (Code, Computer, Mobile, Agent).
5251
+ *
5252
+ * @returns The API key string
5253
+ * @internal
4244
5254
  */
4245
5255
  getAPIKey(): string;
4246
5256
  /**
4247
5257
  * Return the HTTP client for this session.
5258
+ *
5259
+ * @returns The Client instance used for API communication
5260
+ * @internal
4248
5261
  */
4249
5262
  getClient(): Client;
4250
5263
  /**
4251
5264
  * Return the session_id for this session.
5265
+ * Note: This method is used internally by SDK modules. Users should prefer using the `sessionId` property.
5266
+ *
5267
+ * @returns The session ID string
5268
+ * @internal
4252
5269
  */
4253
5270
  getSessionId(): string;
4254
5271
  /**
4255
5272
  * Return whether this session uses VPC resources.
5273
+ *
5274
+ * @returns boolean indicating if VPC is enabled for this session
5275
+ * @internal
4256
5276
  */
4257
- isVpcEnabled(): boolean;
5277
+ private isVpcEnabled;
4258
5278
  /**
4259
5279
  * Return the network interface IP for VPC sessions.
5280
+ *
5281
+ * @returns The network interface IP string for VPC sessions
5282
+ * @internal
4260
5283
  */
4261
- getNetworkInterfaceIp(): string;
5284
+ private getNetworkInterfaceIp;
4262
5285
  /**
4263
5286
  * Return the HTTP port for VPC sessions.
5287
+ *
5288
+ * @returns The HTTP port string for VPC sessions
5289
+ * @internal
4264
5290
  */
4265
- getHttpPort(): string;
5291
+ private getHttpPort;
4266
5292
  /**
4267
5293
  * Return the token for VPC sessions.
5294
+ *
5295
+ * @returns The token string for VPC sessions
5296
+ * @internal
4268
5297
  */
4269
- getToken(): string;
5298
+ private getToken;
4270
5299
  /**
4271
5300
  * Find the server that provides the given tool.
5301
+ *
5302
+ * @param toolName - Name of the tool to find
5303
+ * @returns The server name that provides the tool, or empty string if not found
5304
+ * @internal
4272
5305
  */
4273
- findServerForTool(toolName: string): string;
5306
+ private findServerForTool;
4274
5307
  /**
4275
5308
  * Delete this session.
4276
5309
  *
4277
5310
  * @param syncContext - Whether to sync context data (trigger file uploads) before deleting the session. Defaults to false.
4278
5311
  * @returns DeleteResult indicating success or failure and request ID
4279
5312
  */
5313
+ /**
5314
+ * Deletes the session and releases all associated resources.
5315
+ *
5316
+ * @param syncContext - Whether to synchronize context data before deletion.
5317
+ * If true, uploads all context data to OSS.
5318
+ * If false but browser replay is enabled, syncs only the recording context.
5319
+ * Defaults to false.
5320
+ *
5321
+ * @returns Promise resolving to DeleteResult containing:
5322
+ * - success: Whether deletion succeeded
5323
+ * - requestId: Unique identifier for this API request
5324
+ * - errorMessage: Error description if deletion failed
5325
+ *
5326
+ * @throws Error if the API call fails or network issues occur.
5327
+ *
5328
+ * @example
5329
+ * ```typescript
5330
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5331
+ * const result = await agentBay.create();
5332
+ * if (result.success) {
5333
+ * await result.session.fileSystem.writeFile('/tmp/data.txt', 'data');
5334
+ * const deleteResult = await result.session.delete(true);
5335
+ * console.log('Session deleted:', deleteResult.success);
5336
+ * }
5337
+ * ```
5338
+ *
5339
+ * @remarks
5340
+ * **Behavior:**
5341
+ * - If `syncContext=true`: Uploads all context data to OSS before deletion
5342
+ * - If `syncContext=false` but browser replay enabled: Syncs only recording context
5343
+ * - If `syncContext=false` and no browser replay: Deletes immediately without sync
5344
+ * - Continues with deletion even if context sync fails
5345
+ * - Releases all associated resources (browser, computer, mobile, etc.)
5346
+ *
5347
+ * **Best Practices:**
5348
+ * - Use `syncContext=true` when you need to preserve context data for later retrieval
5349
+ * - For temporary sessions, use `syncContext=false` for faster cleanup
5350
+ * - Always call `delete()` when done to avoid resource leaks
5351
+ * - Handle deletion errors gracefully in production code
5352
+ *
5353
+ * @see {@link info}, {@link ContextManager.sync}
5354
+ */
4280
5355
  delete(syncContext?: boolean): Promise<DeleteResult>;
4281
5356
  /**
4282
5357
  * Validates labels parameter for label operations.
@@ -4291,6 +5366,17 @@ declare class Session {
4291
5366
  * @param labels - The labels to set for the session.
4292
5367
  * @returns OperationResult indicating success or failure with request ID
4293
5368
  * @throws Error if the operation fails (matching Python SessionError)
5369
+ *
5370
+ * @example
5371
+ * ```typescript
5372
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5373
+ * const result = await agentBay.create();
5374
+ * if (result.success) {
5375
+ * const setResult = await result.session.setLabels({ project: 'demo', env: 'test' });
5376
+ * console.log('Labels set:', setResult.success);
5377
+ * await result.session.delete();
5378
+ * }
5379
+ * ```
4294
5380
  */
4295
5381
  setLabels(labels: Record<string, string>): Promise<OperationResult>;
4296
5382
  /**
@@ -4298,22 +5384,106 @@ declare class Session {
4298
5384
  *
4299
5385
  * @returns OperationResult containing the labels as data and request ID
4300
5386
  * @throws Error if the operation fails (matching Python SessionError)
5387
+ *
5388
+ * @example
5389
+ * ```typescript
5390
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5391
+ * const result = await agentBay.create();
5392
+ * if (result.success) {
5393
+ * await result.session.setLabels({ project: 'demo', env: 'test' });
5394
+ * const getResult = await result.session.getLabels();
5395
+ * console.log('Labels:', JSON.stringify(getResult.data));
5396
+ * await result.session.delete();
5397
+ * }
5398
+ * ```
4301
5399
  */
4302
5400
  getLabels(): Promise<OperationResult>;
4303
5401
  /**
4304
- * Gets information about this session.
5402
+ * Retrieves detailed information about the current session.
4305
5403
  *
4306
- * @returns OperationResult containing the session information as data and request ID
4307
- * @throws Error if the operation fails (matching Python SessionError)
5404
+ * @returns Promise resolving to OperationResult containing:
5405
+ * - success: Whether the operation succeeded (always true if no exception)
5406
+ * - data: SessionInfo object with the following fields:
5407
+ * - sessionId (string): The session identifier
5408
+ * - resourceUrl (string): URL for accessing the session
5409
+ * - appId (string): Application ID (for desktop sessions)
5410
+ * - authCode (string): Authentication code
5411
+ * - connectionProperties (string): Connection configuration
5412
+ * - resourceId (string): Resource identifier
5413
+ * - resourceType (string): Type of resource (e.g., "Desktop")
5414
+ * - ticket (string): Access ticket
5415
+ * - requestId: Unique identifier for this API request
5416
+ * - errorMessage: Error description if operation failed
5417
+ *
5418
+ * @throws Error if the API request fails or response is invalid.
5419
+ *
5420
+ * @example
5421
+ * ```typescript
5422
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5423
+ * const result = await agentBay.create();
5424
+ * if (result.success) {
5425
+ * const infoResult = await result.session.info();
5426
+ * console.log(`Session ID: ${infoResult.data.sessionId}`);
5427
+ * console.log(`Resource URL: ${infoResult.data.resourceUrl}`);
5428
+ * await result.session.delete();
5429
+ * }
5430
+ * ```
5431
+ *
5432
+ * @remarks
5433
+ * **Behavior:**
5434
+ * - This method calls the GetMcpResource API to retrieve session metadata
5435
+ * - The returned SessionInfo contains:
5436
+ * - sessionId: The session identifier
5437
+ * - resourceUrl: URL for accessing the session
5438
+ * - Desktop-specific fields (appId, authCode, connectionProperties, etc.)
5439
+ * are populated from the DesktopInfo section of the API response
5440
+ * - Session info is retrieved from the AgentBay API in real-time
5441
+ * - The resourceUrl can be used for browser-based access
5442
+ * - Desktop-specific fields (appId, authCode) are only populated for desktop sessions
5443
+ * - This method does not modify the session state
5444
+ *
5445
+ * @see {@link delete}, {@link getLink}
4308
5446
  */
4309
5447
  info(): Promise<OperationResult>;
4310
5448
  /**
4311
- * Get a link associated with the current session.
5449
+ * Retrieves an access link for the session.
4312
5450
  *
4313
- * @param protocolType - Optional protocol type to use for the link
4314
- * @param port - Optional port to use for the link (must be in range [30100, 30199])
4315
- * @returns OperationResult containing the link as data and request ID
4316
- * @throws Error if the operation fails (matching Python SessionError)
5451
+ * @param protocolType - Protocol type for the link (optional, reserved for future use)
5452
+ * @param port - Specific port number to access (must be in range [30100, 30199]).
5453
+ * If not specified, returns the default session link.
5454
+ *
5455
+ * @returns Promise resolving to OperationResult containing:
5456
+ * - success: Whether the operation succeeded
5457
+ * - data: String URL for accessing the session
5458
+ * - requestId: Unique identifier for this API request
5459
+ * - errorMessage: Error description if operation failed
5460
+ *
5461
+ * @throws Error if the API call fails or port is out of valid range.
5462
+ *
5463
+ * @example
5464
+ * ```typescript
5465
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5466
+ * const result = await agentBay.create();
5467
+ * if (result.success) {
5468
+ * const linkResult = await result.session.getLink();
5469
+ * console.log(`Session link: ${linkResult.data}`);
5470
+ * await result.session.delete();
5471
+ * }
5472
+ * ```
5473
+ *
5474
+ * @remarks
5475
+ * **Behavior:**
5476
+ * - Without port: Returns the default session access URL
5477
+ * - With port: Returns URL for accessing specific port-mapped service
5478
+ * - Port must be in range [30100, 30199] for port forwarding
5479
+ * - For ADB connections, use `session.mobile.getAdbUrl()` with appropriate ADB public key
5480
+ *
5481
+ * **Best Practices:**
5482
+ * - Use default link for general session access
5483
+ * - Use port-specific links when you've started services on specific ports
5484
+ * - Validate port range before calling to avoid errors
5485
+ *
5486
+ * @see {@link info}
4317
5487
  */
4318
5488
  getLink(protocolType?: string, port?: number, options?: string): Promise<OperationResult>;
4319
5489
  /**
@@ -4323,6 +5493,17 @@ declare class Session {
4323
5493
  * @param port - Optional port to use for the link (must be in range [30100, 30199])
4324
5494
  * @returns OperationResult containing the link as data and request ID
4325
5495
  * @throws Error if the operation fails (matching Python SessionError)
5496
+ *
5497
+ * @example
5498
+ * ```typescript
5499
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5500
+ * const result = await agentBay.create();
5501
+ * if (result.success) {
5502
+ * const linkResult = await result.session.getLinkAsync(undefined, 30150);
5503
+ * console.log(`Port link: ${linkResult.data}`);
5504
+ * await result.session.delete();
5505
+ * }
5506
+ * ```
4326
5507
  */
4327
5508
  getLinkAsync(protocolType?: string, port?: number, options?: string): Promise<OperationResult>;
4328
5509
  /**
@@ -4330,6 +5511,17 @@ declare class Session {
4330
5511
  *
4331
5512
  * @param imageId Optional image ID, defaults to session's imageId or "linux_latest"
4332
5513
  * @returns McpToolsResult containing tools list and request ID
5514
+ *
5515
+ * @example
5516
+ * ```typescript
5517
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5518
+ * const result = await agentBay.create();
5519
+ * if (result.success) {
5520
+ * const toolsResult = await result.session.listMcpTools();
5521
+ * console.log(`Found ${toolsResult.tools.length} MCP tools`);
5522
+ * await result.session.delete();
5523
+ * }
5524
+ * ```
4333
5525
  */
4334
5526
  listMcpTools(imageId?: string): Promise<McpToolsResult>;
4335
5527
  /**
@@ -4337,9 +5529,25 @@ declare class Session {
4337
5529
  *
4338
5530
  * @param toolName - Name of the MCP tool to call
4339
5531
  * @param args - Arguments to pass to the tool
5532
+ * @param autoGenSession - Whether to automatically generate session if not exists (default: false)
4340
5533
  * @returns McpToolResult containing the response data
5534
+ *
5535
+ * @example
5536
+ * ```typescript
5537
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5538
+ * const result = await agentBay.create();
5539
+ * if (result.success) {
5540
+ * const shellResult = await result.session.callMcpTool('shell', { command: "echo 'Hello'" });
5541
+ * console.log(`Output: ${shellResult.data}`);
5542
+ * await result.session.delete();
5543
+ * }
5544
+ * ```
5545
+ *
5546
+ * @remarks
5547
+ * For press_keys tool, key names are automatically normalized to correct case format.
5548
+ * This improves case compatibility (e.g., "CTRL" -> "Ctrl", "tab" -> "Tab").
4341
5549
  */
4342
- callMcpTool(toolName: string, args: any): Promise<McpToolResult>;
5550
+ callMcpTool(toolName: string, args: any, autoGenSession?: boolean): Promise<McpToolResult>;
4343
5551
  }
4344
5552
 
4345
5553
  /**
@@ -4496,6 +5704,16 @@ declare class ExtensionsService {
4496
5704
  *
4497
5705
  * @returns Promise that resolves to an array of Extension objects.
4498
5706
  * @throws {AgentBayError} If listing extensions fails.
5707
+ *
5708
+ * @example
5709
+ * ```typescript
5710
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5711
+ * const service = new ExtensionsService(agentBay, 'my_extensions');
5712
+ * await service.create('/path/to/ext1.zip');
5713
+ * const extensions = await service.list();
5714
+ * console.log(`Found ${extensions.length} extensions`);
5715
+ * await service.cleanup();
5716
+ * ```
4499
5717
  */
4500
5718
  list(): Promise<Extension[]>;
4501
5719
  /**
@@ -4506,6 +5724,15 @@ declare class ExtensionsService {
4506
5724
  * @throws {Error} If the local file doesn't exist.
4507
5725
  * @throws {Error} If the file format is not supported (only .zip is supported).
4508
5726
  * @throws {AgentBayError} If upload fails.
5727
+ *
5728
+ * @example
5729
+ * ```typescript
5730
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5731
+ * const service = new ExtensionsService(agentBay);
5732
+ * const extension = await service.create('/path/to/my-extension.zip');
5733
+ * console.log(`Extension ID: ${extension.id}`);
5734
+ * await service.cleanup();
5735
+ * ```
4509
5736
  */
4510
5737
  create(localPath: string): Promise<Extension>;
4511
5738
  /**
@@ -4517,6 +5744,16 @@ declare class ExtensionsService {
4517
5744
  * @throws {Error} If the new local file doesn't exist.
4518
5745
  * @throws {Error} If the extension doesn't exist in the context.
4519
5746
  * @throws {AgentBayError} If update fails.
5747
+ *
5748
+ * @example
5749
+ * ```typescript
5750
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5751
+ * const service = new ExtensionsService(agentBay, 'my_extensions');
5752
+ * const ext = await service.create('/path/to/ext-v1.zip');
5753
+ * const updated = await service.update(ext.id, '/path/to/ext-v2.zip');
5754
+ * console.log('Extension updated:', updated.name);
5755
+ * await service.cleanup();
5756
+ * ```
4520
5757
  */
4521
5758
  update(extensionId: string, newLocalPath: string): Promise<Extension>;
4522
5759
  /**
@@ -4534,6 +5771,15 @@ declare class ExtensionsService {
4534
5771
  * Note:
4535
5772
  * This method only works if the context was auto-created by this service.
4536
5773
  * For existing contexts, no cleanup is performed.
5774
+ *
5775
+ * @example
5776
+ * ```typescript
5777
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5778
+ * const service = new ExtensionsService(agentBay);
5779
+ * await service.create('/path/to/my-extension.zip');
5780
+ * const success = await service.cleanup();
5781
+ * console.log('Cleanup success:', success);
5782
+ * ```
4537
5783
  */
4538
5784
  cleanup(): Promise<boolean>;
4539
5785
  /**
@@ -4541,6 +5787,16 @@ declare class ExtensionsService {
4541
5787
  *
4542
5788
  * @param extensionId - ID of the extension to delete.
4543
5789
  * @returns Promise that resolves to true if deletion was successful, false otherwise.
5790
+ *
5791
+ * @example
5792
+ * ```typescript
5793
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5794
+ * const service = new ExtensionsService(agentBay, 'my_extensions');
5795
+ * const ext = await service.create('/path/to/my-extension.zip');
5796
+ * const success = await service.delete(ext.id);
5797
+ * console.log('Delete success:', success);
5798
+ * await service.cleanup();
5799
+ * ```
4544
5800
  */
4545
5801
  delete(extensionId: string): Promise<boolean>;
4546
5802
  /**
@@ -4585,6 +5841,7 @@ declare class ExtensionsService {
4585
5841
  * Key Features:
4586
5842
  * - Browser context binding for sessions
4587
5843
  * - Automatic browser data upload on session end
5844
+ * - Optional browser fingerprint integration with automatic context sync generation
4588
5845
  * - Optional extension integration with automatic context sync generation
4589
5846
  * - Clean API with ExtensionOption encapsulation
4590
5847
  *
@@ -4596,16 +5853,22 @@ declare class ExtensionsService {
4596
5853
  * ```typescript
4597
5854
  * // With extensions using ExtensionOption
4598
5855
  * import { ExtensionOption } from "./extension";
5856
+ * import { BrowserFingerprintContext } from "./browser";
4599
5857
  *
4600
5858
  * const extOption = new ExtensionOption(
4601
5859
  * "my_extensions",
4602
5860
  * ["ext1", "ext2"]
4603
5861
  * );
4604
5862
  *
5863
+ * const fingerprintContext = new BrowserFingerprintContext(
5864
+ * "my_fingerprint_context"
5865
+ * );
5866
+ *
4605
5867
  * const browserContext = new BrowserContext(
4606
5868
  * "browser_session",
4607
5869
  * true,
4608
- * extOption
5870
+ * extOption,
5871
+ * fingerprintContext
4609
5872
  * );
4610
5873
  *
4611
5874
  * // Without extensions (minimal configuration)
@@ -4613,7 +5876,15 @@ declare class ExtensionsService {
4613
5876
  * "browser_session",
4614
5877
  * true
4615
5878
  * );
4616
- * // extensionContextSyncs will be undefined
5879
+ * // extensionContextSyncs and fingerprintContextSync will be undefined
5880
+ *
5881
+ * // With fingerprint only
5882
+ * const browserContextWithFingerprint = new BrowserContext(
5883
+ * "browser_session",
5884
+ * true,
5885
+ * undefined,
5886
+ * fingerprintContext
5887
+ * );
4617
5888
  * ```
4618
5889
  */
4619
5890
  declare class BrowserContext {
@@ -4621,6 +5892,12 @@ declare class BrowserContext {
4621
5892
  contextId: string;
4622
5893
  /** Whether to automatically upload browser data when the session ends */
4623
5894
  autoUpload: boolean;
5895
+ /** Optional browser fingerprint context configuration object containing fingerprintContextId */
5896
+ fingerprintContext?: BrowserFingerprintContext;
5897
+ /** ID of the fingerprint context for browser fingerprint. Set automatically from fingerprint_context. */
5898
+ fingerprintContextId?: string;
5899
+ /** Auto-generated context sync for fingerprint. None if no fingerprint configuration provided. */
5900
+ fingerprintContextSync?: ContextSync;
4624
5901
  /** Optional extension configuration object containing context_id and extension_ids */
4625
5902
  extensionOption?: ExtensionOption;
4626
5903
  /** ID of the extension context for browser extensions. Set automatically from extension_option. */
@@ -4630,7 +5907,7 @@ declare class BrowserContext {
4630
5907
  /** Auto-generated context syncs for extensions. None if no extension configuration provided. */
4631
5908
  extensionContextSyncs?: ContextSync[];
4632
5909
  /**
4633
- * Initialize BrowserContextImpl with optional extension support.
5910
+ * Initialize BrowserContextImpl with optional extension and fingerprint support.
4634
5911
  *
4635
5912
  * @param contextId - ID of the browser context to bind to the session.
4636
5913
  * This identifies the browser instance for the session.
@@ -4640,17 +5917,28 @@ declare class BrowserContext {
4640
5917
  * contextId and extensionIds. This encapsulates
4641
5918
  * all extension-related configuration.
4642
5919
  * Defaults to undefined.
5920
+ * @param fingerprintContext - Browser fingerprint context configuration object containing
5921
+ * fingerprintContextId. This encapsulates
5922
+ * all fingerprint-related configuration.
5923
+ * Defaults to undefined.
4643
5924
  *
4644
5925
  * Extension Configuration:
4645
5926
  * - **ExtensionOption**: Use extensionOption parameter with an ExtensionOption object
4646
5927
  * - **No Extensions**: Don't provide extensionOption parameter
4647
5928
  *
5929
+ * Fingerprint Configuration:
5930
+ * - **BrowserFingerprintContext**: Use fingerprintContext parameter with a BrowserFingerprintContext object
5931
+ * - **No Fingerprint**: Don't provide fingerprintContext parameter
5932
+ *
4648
5933
  * Auto-generation:
4649
5934
  * - extensionContextSyncs is automatically generated when extensionOption is provided
4650
5935
  * - extensionContextSyncs will be undefined if no extensionOption is provided
4651
5936
  * - extensionContextSyncs will be a ContextSync[] if extensionOption is valid
5937
+ * - fingerprintContextSync is automatically generated when fingerprintContext is provided
5938
+ * - fingerprintContextSync will be undefined if no fingerprintContext is provided
5939
+ * - fingerprintContextSync will be a ContextSync if fingerprintContext is valid
4652
5940
  */
4653
- constructor(contextId: string, autoUpload?: boolean, extensionOption?: ExtensionOption);
5941
+ constructor(contextId: string, autoUpload?: boolean, extensionOption?: ExtensionOption, fingerprintContext?: BrowserFingerprintContext);
4654
5942
  /**
4655
5943
  * Create ContextSync configurations for browser extensions.
4656
5944
  *
@@ -4662,11 +5950,28 @@ declare class BrowserContext {
4662
5950
  */
4663
5951
  private _createExtensionContextSyncs;
4664
5952
  /**
4665
- * Get all context syncs including extension syncs.
5953
+ * Create ContextSync configuration for browser fingerprint.
5954
+ *
5955
+ * This method is called only when fingerprintContext is provided and contains
5956
+ * valid fingerprint configuration (fingerprintContextId).
5957
+ *
5958
+ * @returns ContextSync - Context sync configuration for fingerprint.
5959
+ * Returns undefined if fingerprint configuration is invalid.
5960
+ */
5961
+ private _createFingerprintContextSync;
5962
+ /**
5963
+ * Get context syncs for extensions.
5964
+ *
5965
+ * @returns ContextSync[] - Context sync configurations for extensions. Returns empty list if no extensions configured.
5966
+ */
5967
+ getExtensionContextSyncs(): ContextSync[];
5968
+ /**
5969
+ * Get context sync for fingerprint.
4666
5970
  *
4667
- * @returns ContextSync[] - All context sync configurations. Returns empty list if no extensions configured.
5971
+ * @returns ContextSync - Context sync configuration for fingerprint.
5972
+ * Returns undefined if fingerprint configuration is invalid.
4668
5973
  */
4669
- getAllContextSyncs(): ContextSync[];
5974
+ getFingerprintContextSync(): ContextSync | undefined;
4670
5975
  }
4671
5976
  /**
4672
5977
  * Configuration interface for CreateSessionParams
@@ -4747,18 +6052,12 @@ declare class CreateSessionParams$1 implements CreateSessionParamsConfig {
4747
6052
  * GetLabelsJSON returns the labels as a JSON string.
4748
6053
  * Returns an object with success status and result/error message to match Go version behavior.
4749
6054
  */
4750
- getLabelsJSON(): {
4751
- result: string;
4752
- error?: string;
4753
- };
6055
+ private getLabelsJSON;
4754
6056
  /**
4755
6057
  * GetExtraConfigsJSON returns the extra configs as a JSON string.
4756
6058
  * Returns an object with result and optional error message to match Go version behavior.
4757
6059
  */
4758
- getExtraConfigsJSON(): {
4759
- result: string;
4760
- error?: string;
4761
- };
6060
+ private getExtraConfigsJSON;
4762
6061
  /**
4763
6062
  * AddContextSync adds a context sync configuration to the session parameters.
4764
6063
  */
@@ -4867,19 +6166,49 @@ declare class AgentBay {
4867
6166
  * @param params - Optional parameters for creating the session
4868
6167
  * @returns SessionResult containing the created session and request ID
4869
6168
  */
4870
- create(params?: CreateSessionParams): Promise<SessionResult>;
4871
6169
  /**
4872
- * List sessions filtered by the provided labels with pagination support.
4873
- * It returns sessions that match all the specified labels.
6170
+ * Creates a new AgentBay session with specified configuration.
4874
6171
  *
4875
- * @deprecated This method is deprecated and will be removed in a future version. Use list() instead.
6172
+ * @param params - Configuration parameters for the session:
6173
+ * - labels: Key-value pairs for session metadata
6174
+ * - imageId: Custom image ID for the session environment
6175
+ * - contextSync: Array of context synchronization configurations
6176
+ * - browserContext: Browser-specific context configuration
6177
+ * - isVpc: Whether to create a VPC session
6178
+ * - policyId: Security policy ID
6179
+ * - enableBrowserReplay: Enable browser session recording
6180
+ * - extraConfigs: Additional configuration options
6181
+ * - framework: Framework identifier for tracking
4876
6182
  *
4877
- * **Breaking Change**: This method currently only accepts ListSessionParams parameters,
6183
+ * @returns Promise resolving to SessionResult containing:
6184
+ * - success: Whether session creation succeeded
6185
+ * - session: Session object for interacting with the environment
6186
+ * - requestId: Unique identifier for this API request
6187
+ * - errorMessage: Error description if creation failed
4878
6188
  *
4879
- * @param params - Parameters including labels and pagination options (required)
4880
- * @returns API response with sessions list and pagination info
6189
+ * @throws Error if API call fails or authentication is invalid.
6190
+ *
6191
+ * @example
6192
+ * ```typescript
6193
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
6194
+ * const result = await agentBay.create({ labels: { project: 'demo' } });
6195
+ * if (result.success) {
6196
+ * await result.session.filesystem.readFile('/etc/hostname');
6197
+ * await result.session.delete();
6198
+ * }
6199
+ * ```
6200
+ *
6201
+ * @remarks
6202
+ * **Behavior:**
6203
+ * - Creates a new isolated cloud runtime environment
6204
+ * - Automatically creates file transfer context if not provided
6205
+ * - Waits for context synchronization if contextSync is specified
6206
+ * - For VPC sessions, includes VPC-specific configuration
6207
+ * - Browser replay creates a separate recording context
6208
+ *
6209
+ * @see {@link get}, {@link list}, {@link Session.delete}
4881
6210
  */
4882
- listByLabels(params?: ListSessionParams): Promise<SessionListResult>;
6211
+ create(params?: CreateSessionParams): Promise<SessionResult>;
4883
6212
  /**
4884
6213
  * Returns paginated list of session IDs filtered by labels.
4885
6214
  *
@@ -4891,22 +6220,9 @@ declare class AgentBay {
4891
6220
  * @example
4892
6221
  * ```typescript
4893
6222
  * const agentBay = new AgentBay({ apiKey: "your_api_key" });
4894
- *
4895
- * // List all sessions
4896
- * const result = await agentBay.list();
4897
- *
4898
- * // List sessions with specific labels
4899
- * const result = await agentBay.list({ project: "demo" });
4900
- *
4901
- * // List sessions with pagination
4902
- * const result = await agentBay.list({ "my-label": "my-value" }, 2, 10);
4903
- *
6223
+ * const result = await agentBay.list({ project: "demo" }, 1, 10);
4904
6224
  * if (result.success) {
4905
- * for (const sessionId of result.sessionIds) {
4906
- * console.log(`Session ID: ${sessionId}`);
4907
- * }
4908
- * console.log(`Total count: ${result.totalCount}`);
4909
- * console.log(`Request ID: ${result.requestId}`);
6225
+ * console.log(`Found ${result.sessionIds.length} sessions`);
4910
6226
  * }
4911
6227
  * ```
4912
6228
  */
@@ -4917,11 +6233,34 @@ declare class AgentBay {
4917
6233
  * @param session - The session to delete.
4918
6234
  * @param syncContext - Whether to sync context data (trigger file uploads) before deleting the session. Defaults to false.
4919
6235
  * @returns DeleteResult indicating success or failure and request ID
6236
+ *
6237
+ * @example
6238
+ * ```typescript
6239
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
6240
+ * const result = await agentBay.create();
6241
+ * if (result.success) {
6242
+ * await agentBay.delete(result.session);
6243
+ * }
6244
+ * ```
4920
6245
  */
4921
6246
  delete(session: Session, syncContext?: boolean): Promise<DeleteResult>;
4922
6247
  /**
6248
+ * Remove a session from the internal session cache.
6249
+ *
6250
+ * This is an internal utility method that removes a session reference from the AgentBay client's
6251
+ * session cache without actually deleting the session from the cloud. Use this when you need to
6252
+ * clean up local references to a session that was deleted externally or no longer needed.
6253
+ *
6254
+ * @param sessionId - The ID of the session to remove from the cache.
6255
+ *
6256
+ * @internal
6257
+ *
6258
+ * @remarks
6259
+ * **Note:** This method only removes the session from the local cache. It does not delete the
6260
+ * session from the cloud. To delete a session from the cloud, use {@link delete} or
6261
+ * {@link Session.delete}.
4923
6262
  *
4924
- * @param sessionId - The ID of the session to remove.
6263
+ * @see {@link delete}, {@link Session.delete}
4925
6264
  */
4926
6265
  removeSession(sessionId: string): void;
4927
6266
  /**
@@ -4942,15 +6281,42 @@ declare class AgentBay {
4942
6281
  *
4943
6282
  * @example
4944
6283
  * ```typescript
4945
- * const result = await agentBay.get("my-session-id");
4946
- * if (result.success) {
4947
- * console.log(result.session.sessionId);
4948
- * console.log(result.requestId);
6284
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
6285
+ * const createResult = await agentBay.create();
6286
+ * if (createResult.success) {
6287
+ * const result = await agentBay.get(createResult.session.sessionId);
6288
+ * await result.session?.filesystem.readFile('/etc/hostname');
6289
+ * await result.session?.delete();
4949
6290
  * }
4950
6291
  * ```
4951
6292
  */
4952
6293
  get(sessionId: string): Promise<SessionResult>;
6294
+ /**
6295
+ * Get the internal HTTP client instance.
6296
+ *
6297
+ * This is primarily for internal use and advanced scenarios where you need direct access
6298
+ * to the underlying API client.
6299
+ *
6300
+ * @returns The Client instance used for API communication
6301
+ *
6302
+ * @internal
6303
+ *
6304
+ * @remarks
6305
+ * **Note:** This method is primarily for internal use. Most users should interact
6306
+ * with the SDK through higher-level methods like `create()`, `get()`, and `list()`.
6307
+ */
4953
6308
  getClient(): Client;
6309
+ /**
6310
+ * Get the API key used for authentication.
6311
+ *
6312
+ * @returns The API key string
6313
+ *
6314
+ * @internal
6315
+ *
6316
+ * @remarks
6317
+ * **Security Note:** Be careful when logging or exposing API keys. Always keep them secure
6318
+ * and never commit them to version control.
6319
+ */
4954
6320
  getAPIKey(): string;
4955
6321
  }
4956
6322
 
@@ -4980,12 +6346,6 @@ declare class APIError extends AgentBayError {
4980
6346
  declare class FileError extends AgentBayError {
4981
6347
  constructor(message?: string, extra?: Record<string, any>);
4982
6348
  }
4983
- /**
4984
- * Raised for errors related to command execution.
4985
- */
4986
- declare class CommandError extends AgentBayError {
4987
- constructor(message?: string, extra?: Record<string, any>);
4988
- }
4989
6349
  /**
4990
6350
  * Raised for errors related to session operations.
4991
6351
  */
@@ -4998,18 +6358,6 @@ declare class SessionError extends AgentBayError {
4998
6358
  declare class OssError extends AgentBayError {
4999
6359
  constructor(message?: string, extra?: Record<string, any>);
5000
6360
  }
5001
- /**
5002
- * Raised for errors related to application operations.
5003
- */
5004
- declare class ApplicationError extends AgentBayError {
5005
- constructor(message?: string, extra?: Record<string, any>);
5006
- }
5007
- /**
5008
- * Raised for errors related to UI operations.
5009
- */
5010
- declare class UIError extends AgentBayError {
5011
- constructor(message?: string, extra?: Record<string, any>);
5012
- }
5013
6361
  /**
5014
6362
  * Raised for errors related to browser operations.
5015
6363
  */
@@ -5027,6 +6375,37 @@ declare class BrowserError extends AgentBayError {
5027
6375
  type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
5028
6376
  /**
5029
6377
  * Logger configuration options
6378
+ *
6379
+ * @example
6380
+ * ```typescript
6381
+ * import { AgentBay, setupLogger } from 'wuying-agentbay-sdk';
6382
+ *
6383
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
6384
+ *
6385
+ * async function demonstrateLogging() {
6386
+ * try {
6387
+ * // Configure logging with file output
6388
+ * setupLogger({
6389
+ * level: 'DEBUG',
6390
+ * logFile: '/var/log/agentbay.log',
6391
+ * maxFileSize: '100 MB',
6392
+ * enableConsole: true
6393
+ * });
6394
+ *
6395
+ * // Create a session - logs will be written to both console and file
6396
+ * const result = await agentBay.create();
6397
+ * if (result.success) {
6398
+ * const session = result.session;
6399
+ * console.log(`Session created: ${session.sessionId}`);
6400
+ * await session.delete();
6401
+ * }
6402
+ * } catch (error) {
6403
+ * console.error('Error:', error);
6404
+ * }
6405
+ * }
6406
+ *
6407
+ * demonstrateLogging().catch(console.error);
6408
+ * ```
5030
6409
  */
5031
6410
  interface LoggerConfig {
5032
6411
  level?: LogLevel;
@@ -5034,13 +6413,6 @@ interface LoggerConfig {
5034
6413
  maxFileSize?: string;
5035
6414
  enableConsole?: boolean;
5036
6415
  }
5037
- /**
5038
- * Mask sensitive information in data structures
5039
- * @param data Data to mask (dict, str, list, etc.)
5040
- * @param fields Additional sensitive field names
5041
- * @returns Masked data (deep copy)
5042
- */
5043
- declare function maskSensitiveData(data: any, fields?: string[]): any;
5044
6416
  /**
5045
6417
  * Set the log level
5046
6418
  * @param level The log level to set
@@ -5054,6 +6426,37 @@ declare function getLogLevel(): LogLevel;
5054
6426
  /**
5055
6427
  * Setup logger configuration
5056
6428
  * @param config Logger configuration options
6429
+ *
6430
+ * @example
6431
+ * ```typescript
6432
+ * import { AgentBay, setupLogger } from 'wuying-agentbay-sdk';
6433
+ *
6434
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
6435
+ *
6436
+ * async function demonstrateLogging() {
6437
+ * try {
6438
+ * // Configure logging to file only
6439
+ * setupLogger({
6440
+ * level: 'DEBUG',
6441
+ * logFile: '/var/log/myapp.log',
6442
+ * maxFileSize: '100 MB',
6443
+ * enableConsole: false
6444
+ * });
6445
+ *
6446
+ * // Create a session - logs will only be written to file
6447
+ * const result = await agentBay.create({ imageId: 'browser_latest' });
6448
+ * if (result.success) {
6449
+ * const session = result.session;
6450
+ * // All operations will be logged to file
6451
+ * await session.delete();
6452
+ * }
6453
+ * } catch (error) {
6454
+ * console.error('Error:', error);
6455
+ * }
6456
+ * }
6457
+ *
6458
+ * demonstrateLogging().catch(console.error);
6459
+ * ```
5057
6460
  */
5058
6461
  declare function setupLogger(config: LoggerConfig): void;
5059
6462
  /**
@@ -5088,4 +6491,4 @@ declare function logWarn(message: string, ...args: any[]): void;
5088
6491
  */
5089
6492
  declare function logError(message: string, error?: any): void;
5090
6493
 
5091
- export { APIError, APP_BLACKLIST_TEMPLATE, APP_WHITELIST_TEMPLATE, type ActOptions, ActResult, Agent, AgentBay, AgentBayError, type ApiResponse, type ApiResponseWithData, type AppManagerRule, Application, ApplicationError, ApplyMqttTokenRequest, ApplyMqttTokenResponse, ApplyMqttTokenResponseBody, ApplyMqttTokenResponseBodyData, AuthenticationError, type BWList, Browser, BrowserAgent, BrowserContext, BrowserError, type BrowserFingerprint, type BrowserOption, BrowserOptionClass, type BrowserProxy, BrowserProxyClass, type BrowserScreen, type BrowserViewport, CallMcpToolRequest, CallMcpToolResponse, CallMcpToolResponseBody, ClearContextRequest, ClearContextResponse, ClearContextResponseBody, Client, Command, CommandError, type Config, Context, type ContextInfoResult, ContextManager, ContextService, type ContextStatusData, type ContextStatusItem, ContextSync, type ContextSyncResult, CreateMcpSessionRequest, CreateMcpSessionRequestPersistenceDataList, CreateMcpSessionResponse, CreateMcpSessionResponseBody, CreateMcpSessionResponseBodyData, CreateMcpSessionShrinkRequest, type CreateSessionParams, type CreateSessionParamsConfig, DeleteContextFileRequest, DeleteContextFileResponse, DeleteContextFileResponseBody, DeleteContextRequest, DeleteContextResponse, DeleteContextResponseBody, type DeletePolicy, type DeleteResult, DescribeContextFilesRequest, DescribeContextFilesResponse, DescribeContextFilesResponseBody, type DirectoryEntry, type DownloadPolicy, DownloadStrategy, type ExecutionResult, Extension, ExtensionOption, ExtensionsService, type ExtraConfigs, type ExtractOptions, type ExtractPolicy, ExtractPolicyClass, type FileChangeEvent, FileChangeEventHelper, type FileChangeResult, FileChangeResultHelper, FileError, type FileInfo, FileSystem, 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 InstalledApp$1 as InstalledApp, KeyCode, Lifecycle, ListContextsRequest, ListContextsResponse, ListContextsResponseBody, ListContextsResponseBodyData, ListMcpToolsRequest, ListMcpToolsResponse, ListMcpToolsResponseBody, type ListSessionParams, ListSessionRequest, ListSessionResponse, ListSessionResponseBody, ListSessionResponseBodyData, type LogLevel, type LoggerConfig, MOBILE_COMMAND_TEMPLATES, type McpSession, type McpToolResult, type MobileExtraConfig, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, type ObserveOptions, ObserveResult, Oss, OssError, type Process$1 as Process, type QueryResult, RESOLUTION_LOCK_TEMPLATE, type RecyclePolicy, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, SHOW_NAVIGATION_BAR_TEMPLATE, Session, SessionError, type SessionInterface, type SessionListResult, SetLabelRequest, SetLabelResponse, SetLabelResponseBody, type SyncCallback, SyncContextRequest, SyncContextResponse, SyncContextResponseBody, type SyncPolicy, SyncPolicyImpl, UI, type UIElement, UIError, UNINSTALL_BLACKLIST_TEMPLATE, UploadMode, type UploadPolicy, UploadStrategy, VERSION, type WhiteList, WhiteListValidator, createListSessionParams, extraConfigsFromJSON, extraConfigsToJSON, extractRequestId, getLogLevel, getMobileCommandTemplate, hasMobileCommandTemplate, loadConfig, loadDotEnv, log, logDebug, logError, logInfo, logWarn, maskSensitiveData, newContextManager, newContextSync, newCreateSessionParams, newDeletePolicy, newDownloadPolicy, newExtractPolicy, newRecyclePolicy, newSyncPolicy, newSyncPolicyWithDefaults, newUploadPolicy, replaceTemplatePlaceholders, setLogLevel, setupLogger, validateAppManagerRule, validateExtraConfigs, validateMobileExtraConfig, validateSyncPolicy };
6494
+ 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, type CreateSessionParams, type CreateSessionParamsConfig, DeleteContextFileRequest, DeleteContextFileResponse, DeleteContextFileResponseBody, DeleteContextRequest, DeleteContextResponse, DeleteContextResponseBody, type DeletePolicy, type DeleteResult, 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, 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, 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, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, type NavigatorFingerprint, type ObserveOptions, ObserveResult, Oss, OssError, type QueryResult, RESOLUTION_LOCK_TEMPLATE, type RecyclePolicy, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, 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 };