wuying-agentbay-sdk 0.10.2 → 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 +3588 -3921
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.mts +2088 -687
  8. package/dist/index.d.ts +2088 -687
  9. package/dist/index.mjs +3556 -3889
  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
@@ -817,6 +796,137 @@ declare class GetLinkResponse extends $dara.Model {
817
796
  });
818
797
  }
819
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
+
820
930
  declare class GetMcpResourceRequest extends $dara.Model {
821
931
  authorization?: string;
822
932
  sessionId?: string;
@@ -1929,6 +2039,36 @@ declare class Client extends OpenApi {
1929
2039
  * @returns GetContextFileUploadUrlResponse
1930
2040
  */
1931
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>;
1932
2072
  }
1933
2073
 
1934
2074
  /**
@@ -2028,46 +2168,6 @@ interface OperationResult extends ApiResponse {
2028
2168
  /** Optional error message if the operation failed */
2029
2169
  errorMessage?: string;
2030
2170
  }
2031
- /**
2032
- * Interface for process list operation responses
2033
- * Corresponds to Python's ProcessListResult type
2034
- */
2035
- interface ProcessListResult extends ApiResponse {
2036
- /** Request identifier for tracking API calls */
2037
- requestId: string;
2038
- /** Whether the operation was successful */
2039
- success: boolean;
2040
- /** The list of process objects */
2041
- data: any[];
2042
- /** Optional error message if the operation failed */
2043
- errorMessage?: string;
2044
- }
2045
- /**
2046
- * Interface for installed app list operation responses
2047
- * Corresponds to Python's InstalledAppListResult type
2048
- */
2049
- interface InstalledAppListResult extends ApiResponse {
2050
- /** Request identifier for tracking API calls */
2051
- requestId: string;
2052
- /** Whether the operation was successful */
2053
- success: boolean;
2054
- /** The list of installed app objects */
2055
- data: any[];
2056
- /** Optional error message if the operation failed */
2057
- errorMessage?: string;
2058
- }
2059
- /**
2060
- * Interface for application operation responses
2061
- * Corresponds to Python's AppOperationResult type
2062
- */
2063
- interface AppOperationResult extends ApiResponse {
2064
- /** Request identifier for tracking API calls */
2065
- requestId: string;
2066
- /** Whether the operation was successful */
2067
- success: boolean;
2068
- /** Optional error message if the operation failed */
2069
- errorMessage?: string;
2070
- }
2071
2171
  /**
2072
2172
  * Interface for command execution operation responses
2073
2173
  * Corresponds to Python's CommandResult type
@@ -2222,20 +2322,6 @@ interface OSSDownloadResult extends ApiResponse {
2222
2322
  /** Optional error message if the operation failed */
2223
2323
  errorMessage?: string;
2224
2324
  }
2225
- /**
2226
- * Interface for UI element list operation responses
2227
- * Corresponds to Python's UIElementListResult type
2228
- */
2229
- interface UIElementListResult extends ApiResponse {
2230
- /** Request identifier for tracking API calls */
2231
- requestId: string;
2232
- /** Whether the operation was successful */
2233
- success: boolean;
2234
- /** UI elements */
2235
- elements: Record<string, any>[];
2236
- /** Optional error message if the operation failed */
2237
- errorMessage?: string;
2238
- }
2239
2325
  /**
2240
2326
  * Interface for window list operation responses
2241
2327
  * Corresponds to Python's WindowListResult type
@@ -2380,10 +2466,6 @@ declare class Context {
2380
2466
  * The name of the context.
2381
2467
  */
2382
2468
  name: string;
2383
- /**
2384
- * @deprecated This field is no longer used and will be removed in a future version.
2385
- */
2386
- state: string;
2387
2469
  /**
2388
2470
  * Date and time when the Context was created.
2389
2471
  */
@@ -2392,21 +2474,15 @@ declare class Context {
2392
2474
  * Date and time when the Context was last used.
2393
2475
  */
2394
2476
  lastUsedAt?: string;
2395
- /**
2396
- * @deprecated This field is no longer used and will be removed in a future version.
2397
- */
2398
- osType?: string;
2399
2477
  /**
2400
2478
  * Initialize a Context object.
2401
2479
  *
2402
2480
  * @param id - The unique identifier of the context.
2403
2481
  * @param name - The name of the context.
2404
- * @param state - **Deprecated.** This parameter is no longer used.
2405
2482
  * @param createdAt - Date and time when the Context was created.
2406
2483
  * @param lastUsedAt - Date and time when the Context was last used.
2407
- * @param osType - **Deprecated.** This parameter is no longer used.
2408
2484
  */
2409
- constructor(id: string, name: string, state?: string, createdAt?: string, lastUsedAt?: string, osType?: string);
2485
+ constructor(id: string, name: string, createdAt?: string, lastUsedAt?: string);
2410
2486
  }
2411
2487
  /**
2412
2488
  * Parameters for listing contexts with pagination support.
@@ -2439,15 +2515,37 @@ declare class ContextService {
2439
2515
  *
2440
2516
  * @param params - Optional parameters for listing contexts.
2441
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
+ * ```
2442
2528
  */
2443
2529
  list(params?: ContextListParams): Promise<ContextListResult>;
2444
2530
  /**
2445
- * Gets a context by name. Optionally creates it if it doesn't exist.
2446
- * 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
+ * ```
2447
2547
  *
2448
- * @param name - The name of the context to get.
2449
- * @param create - Whether to create the context if it doesn't exist.
2450
- * @returns ContextResult with context data and requestId
2548
+ * @see {@link update}, {@link list}
2451
2549
  */
2452
2550
  get(name: string, create?: boolean): Promise<ContextResult>;
2453
2551
  /**
@@ -2456,14 +2554,37 @@ declare class ContextService {
2456
2554
  *
2457
2555
  * @param name - The name for the new context.
2458
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
+ * ```
2459
2567
  */
2460
2568
  create(name: string): Promise<ContextResult>;
2461
2569
  /**
2462
- * Updates the specified context.
2463
- * 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
+ * ```
2464
2586
  *
2465
- * @param context - The Context object to update.
2466
- * @returns OperationResult with updated context data and requestId
2587
+ * @see {@link get}, {@link list}
2467
2588
  */
2468
2589
  update(context: Context): Promise<OperationResult>;
2469
2590
  /**
@@ -2472,22 +2593,93 @@ declare class ContextService {
2472
2593
  *
2473
2594
  * @param context - The Context object to delete.
2474
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
+ * ```
2475
2606
  */
2476
2607
  delete(context: Context): Promise<OperationResult>;
2477
2608
  /**
2478
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
+ * ```
2479
2625
  */
2480
2626
  getFileUploadUrl(contextId: string, filePath: string): Promise<FileUrlResult>;
2481
2627
  /**
2482
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
+ * ```
2483
2644
  */
2484
2645
  getFileDownloadUrl(contextId: string, filePath: string): Promise<FileUrlResult>;
2485
2646
  /**
2486
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
+ * ```
2487
2662
  */
2488
2663
  deleteFile(contextId: string, filePath: string): Promise<OperationResult>;
2489
2664
  /**
2490
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
+ * ```
2491
2683
  */
2492
2684
  listFiles(contextId: string, parentFolderPath: string, pageNumber?: number, pageSize?: number): Promise<ContextFileListResult>;
2493
2685
  /**
@@ -2501,6 +2693,17 @@ declare class ContextService {
2501
2693
  * @returns A ClearContextResult object indicating the task has been successfully started,
2502
2694
  * with status field set to "clearing".
2503
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
+ * ```
2504
2707
  */
2505
2708
  clearAsync(contextId: string): Promise<ClearContextResult>;
2506
2709
  /**
@@ -2511,6 +2714,16 @@ declare class ContextService {
2511
2714
  *
2512
2715
  * @param contextId - ID of the context.
2513
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
+ * ```
2514
2727
  */
2515
2728
  getClearStatus(contextId: string): Promise<ClearContextResult>;
2516
2729
  /**
@@ -2529,6 +2742,17 @@ declare class ContextService {
2529
2742
  * @returns A ClearContextResult object containing the final task result.
2530
2743
  * The status field will be "available" on success, or other states if interrupted.
2531
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
+ * ```
2532
2756
  */
2533
2757
  clear(contextId: string, timeout?: number, pollInterval?: number): Promise<ClearContextResult>;
2534
2758
  }
@@ -2601,6 +2825,9 @@ declare class WhiteListValidator {
2601
2825
  interface BWList {
2602
2826
  whiteLists?: WhiteList[];
2603
2827
  }
2828
+ interface MappingPolicy {
2829
+ path: string;
2830
+ }
2604
2831
  interface SyncPolicy {
2605
2832
  uploadPolicy?: UploadPolicy;
2606
2833
  downloadPolicy?: DownloadPolicy;
@@ -2608,6 +2835,7 @@ interface SyncPolicy {
2608
2835
  extractPolicy?: ExtractPolicy;
2609
2836
  recyclePolicy?: RecyclePolicy;
2610
2837
  bwList?: BWList;
2838
+ mappingPolicy?: MappingPolicy;
2611
2839
  }
2612
2840
  declare class SyncPolicyImpl implements SyncPolicy {
2613
2841
  uploadPolicy?: UploadPolicy;
@@ -2632,8 +2860,8 @@ declare function newDownloadPolicy(): DownloadPolicy;
2632
2860
  declare function newDeletePolicy(): DeletePolicy;
2633
2861
  declare function newExtractPolicy(): ExtractPolicy;
2634
2862
  declare function newRecyclePolicy(): RecyclePolicy;
2863
+ declare function newMappingPolicy(): MappingPolicy;
2635
2864
  declare function newSyncPolicy(): SyncPolicy;
2636
- declare function validateSyncPolicy(policy?: SyncPolicy): void;
2637
2865
  declare function newSyncPolicyWithDefaults(policy?: Partial<SyncPolicy>): SyncPolicy;
2638
2866
  declare function newContextSync(contextId: string, path: string, policy?: SyncPolicy): ContextSync;
2639
2867
 
@@ -2688,13 +2916,36 @@ declare class Agent {
2688
2916
  * @param task - Task description in human language.
2689
2917
  * @param maxTryTimes - Maximum number of retry attempts.
2690
2918
  * @returns ExecutionResult containing success status, task output, and error message if any.
2691
- */
2692
- 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>;
2693
2932
  /**
2694
2933
  * Get the status of the task with the given task ID.
2695
2934
  *
2696
2935
  * @param taskId - Task ID
2697
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
+ * ```
2698
2949
  */
2699
2950
  getTaskStatus(taskId: string): Promise<QueryResult>;
2700
2951
  /**
@@ -2702,137 +2953,20 @@ declare class Agent {
2702
2953
  *
2703
2954
  * @param taskId - The ID of the running task.
2704
2955
  * @returns ExecutionResult containing success status, task output, and error message if any.
2705
- */
2706
- terminateTask(taskId: string): Promise<ExecutionResult>;
2707
- }
2708
-
2709
- /**
2710
- * Represents an installed application
2711
- */
2712
- interface InstalledApp$1 {
2713
- name: string;
2714
- start_cmd: string;
2715
- stop_cmd?: string;
2716
- work_directory?: string;
2717
- }
2718
- /**
2719
- * Represents a running process
2720
- */
2721
- interface Process$1 {
2722
- pname: string;
2723
- pid: number;
2724
- cmdline?: string;
2725
- path?: string;
2726
- }
2727
- /**
2728
- * Handles application operations in the AgentBay cloud environment.
2729
- *
2730
- * @deprecated This module is deprecated. Use Computer or Mobile modules instead.
2731
- * - For desktop applications, use session.computer
2732
- * - For mobile applications, use session.mobile
2733
- */
2734
- declare class Application {
2735
- private session;
2736
- /**
2737
- * Initialize an Application object.
2738
- *
2739
- * @param session - The Session instance that this Application belongs to.
2740
- */
2741
- constructor(session: {
2742
- getAPIKey(): string;
2743
- getClient(): Client;
2744
- getSessionId(): string;
2745
- callMcpTool(toolName: string, args: any): Promise<{
2746
- success: boolean;
2747
- data: string;
2748
- errorMessage: string;
2749
- requestId: string;
2750
- }>;
2751
- });
2752
- /**
2753
- * Sanitizes error messages to remove sensitive information like API keys.
2754
- *
2755
- * @param error - The error to sanitize
2756
- * @returns The sanitized error
2757
- */
2758
- private sanitizeError;
2759
- /**
2760
- * Helper method to parse JSON string into objects
2761
- */
2762
- private parseJSON;
2763
- /**
2764
- * Get a list of installed applications.
2765
- *
2766
- * @param startMenu - Whether to include start menu applications.
2767
- * @param desktop - Whether to include desktop applications.
2768
- * @param ignoreSystemApps - Whether to ignore system applications.
2769
- * @returns A promise that resolves to the list of installed applications.
2770
- *
2771
- * @deprecated Use session.computer.getInstalledApps() for desktop or session.mobile.getInstalledApps() for mobile instead.
2772
- */
2773
- getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<InstalledAppListResult>;
2774
- /**
2775
- * Start an application.
2776
- *
2777
- * @param startCmd - The command to start the application.
2778
- * @param workDirectory - The working directory for the application.
2779
- * @param activity - The activity to start (for mobile applications).
2780
- * @returns A promise that resolves to the result of starting the application.
2781
- *
2782
- * @deprecated Use session.computer.startApp() for desktop or session.mobile.startApp() for mobile instead.
2783
- */
2784
- startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<ProcessListResult>;
2785
- /**
2786
- * Stop an application by process name.
2787
- *
2788
- * @param pname - The process name of the application to stop.
2789
- * @returns A promise that resolves to the result of stopping the application.
2790
2956
  *
2791
- * @deprecated Use session.computer.stopAppByPName() for desktop or session.mobile.stopAppByPName() for mobile instead.
2792
- */
2793
- stopAppByPName(pname: string): Promise<AppOperationResult>;
2794
- /**
2795
- * Stops an application by process ID.
2796
- * Corresponds to Python's stop_app_by_pid() method
2797
- *
2798
- * @param pid - The process ID to stop.
2799
- * @returns AppOperationResult with operation result and requestId
2800
- * @throws Error if the operation fails.
2801
- */
2802
- stopAppByPID(pid: number): Promise<AppOperationResult>;
2803
- /**
2804
- * Stop an application by command.
2805
- *
2806
- * @param cmd - The command to stop the application.
2807
- * @returns A promise that resolves to the result of stopping the application.
2808
- *
2809
- * @deprecated Use session.computer.stopAppByCmd() for desktop or session.mobile.stopAppByCmd() for mobile instead.
2810
- */
2811
- stopAppByCmd(cmd: string): Promise<AppOperationResult>;
2812
- /**
2813
- * Returns a list of currently visible applications.
2814
- * Corresponds to Python's list_visible_apps() method
2815
- *
2816
- * @returns ProcessListResult with visible apps and requestId
2817
- * @throws Error if the operation fails.
2818
- */
2819
- listVisibleApps(): Promise<ProcessListResult>;
2820
- /**
2821
- * Get a list of running processes.
2822
- *
2823
- * @returns A promise that resolves to the list of running processes.
2824
- *
2825
- * @deprecated Use session.computer.getRunningProcesses() for desktop or session.mobile.getRunningProcesses() for mobile instead.
2826
- */
2827
- getRunningProcesses(): Promise<ProcessListResult>;
2828
- /**
2829
- * Get a list of visible applications.
2830
- *
2831
- * @returns A promise that resolves to the list of visible applications.
2832
- *
2833
- * @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
+ * ```
2834
2968
  */
2835
- getVisibleApps(): Promise<InstalledAppListResult>;
2969
+ terminateTask(taskId: string): Promise<ExecutionResult>;
2836
2970
  }
2837
2971
 
2838
2972
  interface ActOptions {
@@ -2889,6 +3023,187 @@ declare class BrowserAgent {
2889
3023
  private _delay;
2890
3024
  }
2891
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
+
2892
3207
  interface BrowserViewport {
2893
3208
  width: number;
2894
3209
  height: number;
@@ -2902,6 +3217,21 @@ interface BrowserFingerprint {
2902
3217
  operatingSystems?: Array<'windows' | 'macos' | 'linux' | 'android' | 'ios'>;
2903
3218
  locales?: string[];
2904
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
+ }
2905
3235
  interface BrowserProxy {
2906
3236
  type: 'custom' | 'wuying';
2907
3237
  server?: string;
@@ -2929,6 +3259,10 @@ interface BrowserOption {
2929
3259
  viewport?: BrowserViewport;
2930
3260
  screen?: BrowserScreen;
2931
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;
2932
3266
  solveCaptchas?: boolean;
2933
3267
  proxies?: BrowserProxy[];
2934
3268
  /** Path to the extensions directory. Defaults to "/tmp/extensions/" */
@@ -2947,13 +3281,16 @@ declare class BrowserOptionClass implements BrowserOption {
2947
3281
  viewport?: BrowserViewport;
2948
3282
  screen?: BrowserScreen;
2949
3283
  fingerprint?: BrowserFingerprint;
3284
+ fingerprintFormat?: FingerprintFormat;
3285
+ fingerprintPersistent?: boolean;
3286
+ fingerprintPersistPath?: string;
2950
3287
  solveCaptchas?: boolean;
2951
3288
  proxies?: BrowserProxy[];
2952
3289
  extensionPath?: string;
2953
3290
  cmdArgs?: string[];
2954
3291
  defaultNavigateUrl?: string;
2955
3292
  browserType?: 'chrome' | 'chromium' | undefined;
2956
- 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');
2957
3294
  toMap(): Record<string, any>;
2958
3295
  fromMap(m: Record<string, any> | null | undefined): BrowserOptionClass;
2959
3296
  }
@@ -2972,6 +3309,20 @@ declare class Browser {
2972
3309
  /**
2973
3310
  * Initialize the browser instance with the given options asynchronously.
2974
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
+ * ```
2975
3326
  */
2976
3327
  initializeAsync(option: BrowserOptionClass | BrowserOption): Promise<boolean>;
2977
3328
  /**
@@ -2981,6 +3332,22 @@ declare class Browser {
2981
3332
  /**
2982
3333
  * Returns the endpoint URL if the browser is initialized, otherwise throws an exception.
2983
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
+ * ```
2984
3351
  */
2985
3352
  getEndpointUrl(): Promise<string>;
2986
3353
  /**
@@ -2995,6 +3362,50 @@ declare class Browser {
2995
3362
  * Stop the browser instance, internal use only.
2996
3363
  */
2997
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;
2998
3409
  }
2999
3410
 
3000
3411
  /**
@@ -3027,6 +3438,17 @@ declare class Code {
3027
3438
  * Note: Due to gateway limitations, each request cannot exceed 60 seconds.
3028
3439
  * @returns CodeExecutionResult with code execution output and requestId
3029
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
+ * ```
3030
3452
  */
3031
3453
  runCode(code: string, language: string, timeoutS?: number): Promise<CodeExecutionResult>;
3032
3454
  }
@@ -3050,13 +3472,36 @@ declare class Command {
3050
3472
  */
3051
3473
  private sanitizeError;
3052
3474
  /**
3053
- * Execute a command in the session environment.
3054
- * Corresponds to Python's execute_command() method
3475
+ * Executes a shell command in the session environment.
3055
3476
  *
3056
- * @param command - The command to execute
3057
- * @param timeoutMs - The timeout in milliseconds. Default is 1000ms.
3058
- * @returns CommandResult with command output and requestId
3059
- * @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}
3060
3505
  */
3061
3506
  executeCommand(command: string, timeoutMs?: number): Promise<CommandResult>;
3062
3507
  }
@@ -3108,9 +3553,10 @@ declare const SHOW_NAVIGATION_BAR_TEMPLATE = "setprop persist.wy.hasnavibar true
3108
3553
  /**
3109
3554
  * Uninstall blacklist template
3110
3555
  * Parameters:
3111
- * 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
3112
3558
  */
3113
- 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}";
3114
3560
  /**
3115
3561
  * Mobile command templates mapping for easy access
3116
3562
  */
@@ -3181,106 +3627,490 @@ declare class Computer {
3181
3627
  constructor(session: ComputerSession);
3182
3628
  /**
3183
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
+ * ```
3184
3646
  */
3185
3647
  clickMouse(x: number, y: number, button?: MouseButton | string): Promise<BoolResult$1>;
3186
3648
  /**
3187
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
+ * ```
3188
3666
  */
3189
3667
  moveMouse(x: number, y: number): Promise<BoolResult$1>;
3190
3668
  /**
3191
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
+ * ```
3192
3688
  */
3193
3689
  dragMouse(fromX: number, fromY: number, toX: number, toY: number, button?: MouseButton | string): Promise<BoolResult$1>;
3194
3690
  /**
3195
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
+ * ```
3196
3708
  */
3197
3709
  scroll(x: number, y: number, direction?: ScrollDirection | string, amount?: number): Promise<BoolResult$1>;
3198
3710
  /**
3199
- * 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
+ * ```
3200
3725
  */
3201
3726
  inputText(text: string): Promise<BoolResult$1>;
3202
3727
  /**
3203
- * 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
+ * ```
3204
3744
  */
3205
3745
  pressKeys(keys: string[], hold?: boolean): Promise<BoolResult$1>;
3206
3746
  /**
3207
- * 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
+ * ```
3208
3762
  */
3209
3763
  releaseKeys(keys: string[]): Promise<BoolResult$1>;
3210
3764
  /**
3211
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
+ * ```
3212
3779
  */
3213
3780
  getCursorPosition(): Promise<CursorPosition>;
3214
3781
  /**
3215
3782
  * Get screen size.
3216
- */
3217
- 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>;
3218
3798
  /**
3219
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
+ * ```
3220
3813
  */
3221
3814
  screenshot(): Promise<ScreenshotResult$1>;
3222
3815
  /**
3223
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
+ * ```
3224
3831
  */
3225
3832
  listRootWindows(timeoutMs?: number): Promise<WindowListResult>;
3226
3833
  /**
3227
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
+ * ```
3228
3849
  */
3229
3850
  getActiveWindow(timeoutMs?: number): Promise<WindowInfoResult>;
3230
3851
  /**
3231
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
+ * ```
3232
3867
  */
3233
3868
  activateWindow(windowId: number): Promise<BoolResult$2>;
3234
3869
  /**
3235
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
+ * ```
3236
3886
  */
3237
3887
  closeWindow(windowId: number): Promise<BoolResult$2>;
3238
3888
  /**
3239
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
+ * ```
3240
3905
  */
3241
3906
  maximizeWindow(windowId: number): Promise<BoolResult$2>;
3242
3907
  /**
3243
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
+ * ```
3244
3924
  */
3245
3925
  minimizeWindow(windowId: number): Promise<BoolResult$2>;
3246
3926
  /**
3247
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
+ * ```
3248
3944
  */
3249
3945
  restoreWindow(windowId: number): Promise<BoolResult$2>;
3250
3946
  /**
3251
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
+ * ```
3252
3965
  */
3253
3966
  resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult$2>;
3254
3967
  /**
3255
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
+ * ```
3256
3984
  */
3257
3985
  fullscreenWindow(windowId: number): Promise<BoolResult$2>;
3258
3986
  /**
3259
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
+ * ```
3260
4002
  */
3261
4003
  focusMode(on: boolean): Promise<BoolResult$2>;
3262
4004
  /**
3263
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
+ * ```
3264
4022
  */
3265
- getInstalledApps(): Promise<any>;
4023
+ getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<any>;
3266
4024
  /**
3267
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
+ * ```
3268
4042
  */
3269
- startApp(startCmd: string, workDirectory?: string): Promise<any>;
4043
+ startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<any>;
3270
4044
  /**
3271
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
+ * ```
3272
4060
  */
3273
4061
  stopAppByPName(pname: string): Promise<any>;
3274
4062
  /**
3275
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
+ * ```
3276
4079
  */
3277
4080
  stopAppByPID(pid: number): Promise<any>;
3278
4081
  /**
3279
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
+ * ```
3280
4097
  */
3281
4098
  stopAppByCmd(cmd: string): Promise<any>;
3282
4099
  /**
3283
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
+ * ```
3284
4114
  */
3285
4115
  listVisibleApps(): Promise<any>;
3286
4116
  }
@@ -3316,8 +4146,69 @@ interface SessionInterface {
3316
4146
  declare class ContextManager {
3317
4147
  private session;
3318
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
+ */
3319
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
+ */
3320
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
+ */
3321
4212
  sync(contextId?: string, path?: string, mode?: string, callback?: SyncCallback, maxRetries?: number, retryInterval?: number): Promise<ContextSyncResult>;
3322
4213
  /**
3323
4214
  * Polls the info interface to check if sync is completed and calls callback.
@@ -3410,6 +4301,17 @@ declare class FileSystem {
3410
4301
  *
3411
4302
  * @param path - Path to the directory to create.
3412
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
+ * ```
3413
4315
  */
3414
4316
  createDirectory(path: string): Promise<BoolResult$2>;
3415
4317
  /**
@@ -3420,6 +4322,19 @@ declare class FileSystem {
3420
4322
  * @param edits - Array of edit operations, each containing oldText and newText.
3421
4323
  * @param dryRun - Optional: If true, preview changes without applying them.
3422
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
+ * ```
3423
4338
  */
3424
4339
  editFile(path: string, edits: Array<{
3425
4340
  oldText: string;
@@ -3431,6 +4346,18 @@ declare class FileSystem {
3431
4346
  *
3432
4347
  * @param path - Path to the file or directory to inspect.
3433
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
+ * ```
3434
4361
  */
3435
4362
  getFileInfo(path: string): Promise<FileInfoResult>;
3436
4363
  /**
@@ -3440,6 +4367,38 @@ declare class FileSystem {
3440
4367
  * @param path - Path to the directory to list.
3441
4368
  * @returns DirectoryListResult with directory entries and requestId
3442
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
+ */
3443
4402
  listDirectory(path: string): Promise<DirectoryListResult>;
3444
4403
  /**
3445
4404
  * Moves a file or directory from source to destination.
@@ -3448,6 +4407,18 @@ declare class FileSystem {
3448
4407
  * @param source - Path to the source file or directory.
3449
4408
  * @param destination - Path to the destination file or directory.
3450
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
+ * ```
3451
4422
  */
3452
4423
  moveFile(source: string, destination: string): Promise<BoolResult$2>;
3453
4424
  /**
@@ -3465,16 +4436,43 @@ declare class FileSystem {
3465
4436
  *
3466
4437
  * @param paths - Array of file paths to read.
3467
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
+ * ```
3468
4452
  */
3469
4453
  readMultipleFiles(paths: string[]): Promise<MultipleFileContentResult>;
3470
4454
  /**
3471
- * Searches for files in a directory that match a pattern.
4455
+ * Searches for files in a directory that match a wildcard pattern.
3472
4456
  * Corresponds to Python's search_files() method
3473
4457
  *
3474
4458
  * @param path - Path to the directory to search in.
3475
- * @param pattern - Pattern to search for. Supports glob patterns.
3476
- * @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.
3477
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
+ * ```
3478
4476
  */
3479
4477
  searchFiles(path: string, pattern: string, excludePatterns?: string[]): Promise<FileSearchResult>;
3480
4478
  /**
@@ -3492,6 +4490,49 @@ declare class FileSystem {
3492
4490
  * @param path - Path to the file to read.
3493
4491
  * @returns FileContentResult with complete file content and requestId
3494
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
+ */
3495
4536
  readFile(path: string): Promise<FileContentResult>;
3496
4537
  /**
3497
4538
  * Writes content to a file. Automatically handles large files by chunking.
@@ -3501,9 +4542,72 @@ declare class FileSystem {
3501
4542
  * @param mode - Optional: Write mode. One of "overwrite", "append", or "create_new". Default is "overwrite".
3502
4543
  * @returns BoolResult indicating success or failure with requestId
3503
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
+ */
3504
4593
  writeFile(path: string, content: string, mode?: string): Promise<BoolResult$2>;
3505
4594
  /**
3506
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
+ * ```
3507
4611
  */
3508
4612
  getFileChange(path: string): Promise<FileChangeResult>;
3509
4613
  /**
@@ -3512,6 +4616,26 @@ declare class FileSystem {
3512
4616
  private parseFileChangeData;
3513
4617
  /**
3514
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
+ * ```
3515
4639
  */
3516
4640
  watchDirectory(path: string, callback: (events: FileChangeEvent[]) => void, interval?: number, signal?: AbortSignal): Promise<void>;
3517
4641
  /**
@@ -3522,6 +4646,17 @@ declare class FileSystem {
3522
4646
  * @param remotePath - Remote file path to upload to
3523
4647
  * @param options - Optional parameters
3524
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
+ * ```
3525
4660
  */
3526
4661
  uploadFile(localPath: string, remotePath: string, options?: {
3527
4662
  contentType?: string;
@@ -3538,6 +4673,18 @@ declare class FileSystem {
3538
4673
  * @param localPath - Local file path to download to
3539
4674
  * @param options - Optional parameters
3540
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
+ * ```
3541
4688
  */
3542
4689
  downloadFile(remotePath: string, localPath: string, options?: {
3543
4690
  overwrite?: boolean;
@@ -3662,13 +4809,13 @@ interface UIBounds {
3662
4809
  right: number;
3663
4810
  bottom: number;
3664
4811
  }
3665
- interface UIElement$1 {
4812
+ interface UIElement {
3666
4813
  text: string;
3667
4814
  className: string;
3668
4815
  bounds: UIBounds | string;
3669
4816
  }
3670
4817
  interface UIElementsResult extends OperationResult {
3671
- elements: UIElement$1[];
4818
+ elements: UIElement[];
3672
4819
  }
3673
4820
  interface InstalledApp {
3674
4821
  name: string;
@@ -3696,6 +4843,7 @@ interface MobileSession {
3696
4843
  callMcpTool(toolName: string, args: Record<string, any>): Promise<any>;
3697
4844
  sessionId: string;
3698
4845
  getAPIKey(): string;
4846
+ getAgentBay(): any;
3699
4847
  imageId?: string;
3700
4848
  getLink(protocolType?: string, port?: number, options?: string): Promise<any>;
3701
4849
  }
@@ -3703,19 +4851,80 @@ declare class Mobile {
3703
4851
  private session;
3704
4852
  constructor(session: MobileSession);
3705
4853
  /**
3706
- * 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
+ * ```
3707
4870
  */
3708
4871
  tap(x: number, y: number): Promise<BoolResult>;
3709
4872
  /**
3710
- * 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
+ * ```
3711
4892
  */
3712
4893
  swipe(startX: number, startY: number, endX: number, endY: number, durationMs?: number): Promise<BoolResult>;
3713
4894
  /**
3714
- * 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
+ * ```
3715
4910
  */
3716
4911
  inputText(text: string): Promise<BoolResult>;
3717
4912
  /**
3718
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
+ * ```
3719
4928
  */
3720
4929
  sendKey(key: number): Promise<BoolResult>;
3721
4930
  /**
@@ -3732,14 +4941,58 @@ declare class Mobile {
3732
4941
  getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<InstalledAppsResult>;
3733
4942
  /**
3734
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
+ * ```
3735
4960
  */
3736
4961
  startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<ProcessResult>;
3737
4962
  /**
3738
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
+ * ```
3739
4979
  */
3740
4980
  stopAppByCmd(stopCmd: string): Promise<BoolResult>;
3741
4981
  /**
3742
- * 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
+ * ```
3743
4996
  */
3744
4997
  screenshot(): Promise<ScreenshotResult>;
3745
4998
  /**
@@ -3809,381 +5062,133 @@ declare class Mobile {
3809
5062
  /**
3810
5063
  * Handles OSS operations in the AgentBay cloud environment.
3811
5064
  */
3812
- declare class Oss {
3813
- private session;
3814
- /**
3815
- * Initialize an Oss object.
3816
- *
3817
- * @param session - The Session instance that this Oss belongs to.
3818
- */
3819
- constructor(session: Session);
3820
- /**
3821
- * Sanitizes error messages to remove sensitive information like API keys.
3822
- *
3823
- * @param error - The error to sanitize
3824
- * @returns The sanitized error
3825
- */
3826
- private sanitizeError;
3827
- /**
3828
- * Initialize OSS environment variables with the specified credentials.
3829
- * Corresponds to Python's env_init() method
3830
- *
3831
- * @param accessKeyId - The access key ID
3832
- * @param accessKeySecret - The access key secret
3833
- * @param securityToken - The security token (optional)
3834
- * @param endpoint - The OSS endpoint (optional)
3835
- * @param region - The OSS region (optional)
3836
- * @returns OSSClientResult with client configuration and requestId
3837
- * @throws APIError if the operation fails.
3838
- */
3839
- envInit(accessKeyId: string, accessKeySecret: string, securityToken?: string, endpoint?: string, region?: string): Promise<OSSClientResult>;
3840
- /**
3841
- * Upload a file to OSS.
3842
- * Corresponds to Python's upload() method
3843
- *
3844
- * @param bucket - The OSS bucket name
3845
- * @param object - The OSS object key
3846
- * @param path - The local file path to upload
3847
- * @returns OSSUploadResult with upload result and requestId
3848
- * @throws APIError if the operation fails.
3849
- */
3850
- upload(bucket: string, object: string, path: string): Promise<OSSUploadResult>;
3851
- /**
3852
- * Upload a file to OSS using an anonymous URL.
3853
- * Corresponds to Python's upload_anonymous() method
3854
- *
3855
- * @param url - The anonymous upload URL
3856
- * @param path - The local file path to upload
3857
- * @returns OSSUploadResult with upload result and requestId
3858
- * @throws APIError if the operation fails.
3859
- */
3860
- uploadAnonymous(url: string, path: string): Promise<OSSUploadResult>;
3861
- /**
3862
- * Download a file from OSS.
3863
- * Corresponds to Python's download() method
3864
- *
3865
- * @param bucket - The OSS bucket name
3866
- * @param object - The OSS object key
3867
- * @param path - The local file path to save the downloaded file
3868
- * @returns OSSDownloadResult with download result and requestId
3869
- * @throws APIError if the operation fails.
3870
- */
3871
- download(bucket: string, object: string, path: string): Promise<OSSDownloadResult>;
3872
- /**
3873
- * Download a file from OSS using an anonymous URL.
3874
- * Corresponds to Python's download_anonymous() method
3875
- *
3876
- * @param url - The anonymous download URL
3877
- * @param path - The local file path to save the downloaded file
3878
- * @returns OSSDownloadResult with download result and requestId
3879
- * @throws APIError if the operation fails.
3880
- */
3881
- downloadAnonymous(url: string, path: string): Promise<OSSDownloadResult>;
3882
- }
3883
-
3884
- /**
3885
- * Key codes for UI operations
3886
- */
3887
- declare enum KeyCode {
3888
- HOME = 3,
3889
- BACK = 4,
3890
- VOLUME_UP = 24,
3891
- VOLUME_DOWN = 25,
3892
- POWER = 26,
3893
- MENU = 82
3894
- }
3895
- /**
3896
- * Interface representing a UI element in the UI hierarchy
3897
- */
3898
- interface UIElement {
3899
- bounds: string;
3900
- className: string;
3901
- text: string;
3902
- type: string;
3903
- resourceId: string;
3904
- index: number;
3905
- isParent: boolean;
3906
- children?: UIElement[];
3907
- }
3908
- /**
3909
- * Handles UI operations in the AgentBay cloud environment.
3910
- *
3911
- * @deprecated This module is deprecated. Use Computer or Mobile modules instead.
3912
- * - For desktop UI operations, use session.computer
3913
- * - For mobile UI operations, use session.mobile
3914
- */
3915
- declare class UI {
3916
- private session;
3917
- /**
3918
- * Initialize a UI object.
3919
- *
3920
- * @param session - The Session instance that this UI belongs to.
3921
- */
3922
- constructor(session: {
3923
- getAPIKey(): string;
3924
- getClient(): any;
3925
- getSessionId(): string;
3926
- callMcpTool(toolName: string, args: any): Promise<{
3927
- success: boolean;
3928
- data: string;
3929
- errorMessage: string;
3930
- requestId: string;
3931
- }>;
3932
- });
3933
- /**
3934
- * Sanitizes error messages to remove sensitive information like API keys.
3935
- *
3936
- * @param error - The error to sanitize
3937
- * @returns The sanitized error
3938
- */
3939
- private sanitizeError;
3940
- /**
3941
- * Retrieves all clickable UI elements within the specified timeout.
3942
- * Corresponds to Python's get_clickable_ui_elements() method
3943
- *
3944
- * @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
3945
- * @returns UIElementListResult with clickable elements and requestId
3946
- * @throws Error if the operation fails.
3947
- *
3948
- * @deprecated Use session.computer.getClickableUIElements() for desktop or session.mobile.getClickableUIElements() for mobile instead.
3949
- */
3950
- getClickableUIElements(timeoutMs?: number): Promise<UIElementListResult>;
3951
- /**
3952
- * Retrieves all UI elements regardless of their clickable status.
3953
- * Corresponds to Python's get_all_ui_elements() method
3954
- *
3955
- * @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
3956
- * @returns UIElementListResult with all elements and requestId
3957
- * @throws Error if the operation fails.
3958
- *
3959
- * @deprecated Use session.computer.getAllUIElements() for desktop or session.mobile.getAllUIElements() for mobile instead.
3960
- */
3961
- getAllUIElements(timeoutMs?: number): Promise<UIElementListResult>;
3962
- /**
3963
- * Sends a key press event.
3964
- * Corresponds to Python's send_key() method
3965
- *
3966
- * @param key - The key code to send. Supported key codes are:
3967
- * - 3 : HOME
3968
- * - 4 : BACK
3969
- * - 24 : VOLUME UP
3970
- * - 25 : VOLUME DOWN
3971
- * - 26 : POWER
3972
- * - 82 : MENU
3973
- * @returns BoolResult with success status and requestId
3974
- * @throws Error if the operation fails.
3975
- *
3976
- * @deprecated Use session.computer.pressKeys() for desktop or session.mobile.sendKey() for mobile instead.
3977
- */
3978
- sendKey(key: number): Promise<BoolResult$2>;
3979
- /**
3980
- * Inputs text into the currently focused UI element.
3981
- * Corresponds to Python's input_text() method
3982
- *
3983
- * @param text - The text to input
3984
- * @returns BoolResult with success status and requestId
3985
- * @throws Error if the operation fails.
3986
- *
3987
- * @deprecated Use session.computer.inputText() for desktop or session.mobile.inputText() for mobile instead.
3988
- */
3989
- inputText(text: string): Promise<BoolResult$2>;
3990
- /**
3991
- * Performs a swipe gesture on the screen.
3992
- * Corresponds to Python's swipe() method
3993
- *
3994
- * @param startX - The starting X coordinate
3995
- * @param startY - The starting Y coordinate
3996
- * @param endX - The ending X coordinate
3997
- * @param endY - The ending Y coordinate
3998
- * @param durationMs - The duration of the swipe in milliseconds. Default is 300ms.
3999
- * @returns BoolResult with success status and requestId
4000
- * @throws Error if the operation fails.
4001
- *
4002
- * @deprecated Use session.computer.dragMouse() for desktop or session.mobile.swipe() for mobile instead.
4003
- */
4004
- swipe(startX: number, startY: number, endX: number, endY: number, durationMs?: number): Promise<BoolResult$2>;
4005
- /**
4006
- * Clicks on the screen at the specified coordinates.
4007
- * Corresponds to Python's click() method
4008
- *
4009
- * @param x - The X coordinate
4010
- * @param y - The Y coordinate
4011
- * @param button - The mouse button to use. Default is 'left'
4012
- * @returns BoolResult with success status and requestId
4013
- * @throws Error if the operation fails.
4014
- *
4015
- * @deprecated Use session.computer.clickMouse() for desktop or session.mobile.tap() for mobile instead.
4016
- */
4017
- click(x: number, y: number, button?: string): Promise<BoolResult$2>;
4018
- /**
4019
- * Takes a screenshot of the current screen.
4020
- * Corresponds to Python's screenshot() method
4021
- *
4022
- * @returns OperationResult with success status and requestId
4023
- * @throws Error if the operation fails.
4024
- *
4025
- * @deprecated Use session.computer.screenshot() for desktop or session.mobile.screenshot() for mobile instead.
4026
- */
4027
- screenshot(): Promise<OperationResult>;
4028
- }
4029
-
4030
- /**
4031
- * Handles window management operations in the AgentBay cloud environment.
4032
- *
4033
- * @deprecated This module is deprecated. Use Computer module instead.
4034
- * - For desktop window operations, use session.computer
4035
- * - Window operations are not available for mobile
4036
- */
4037
- declare class WindowManager {
4038
- private session;
4039
- /**
4040
- * Creates a new WindowManager instance.
4041
- * @param session The session object that provides access to the AgentBay API.
4042
- */
4043
- constructor(session: {
4044
- getAPIKey(): string;
4045
- getSessionId(): string;
4046
- callMcpTool(toolName: string, args: any): Promise<{
4047
- success: boolean;
4048
- data: string;
4049
- errorMessage: string;
4050
- requestId: string;
4051
- }>;
4052
- });
4053
- /**
4054
- * Helper method to parse JSON string into Window objects
4055
- * @param jsonStr - JSON string to parse
4056
- * @returns Array of Window objects or single Window object
4057
- */
4058
- private parseWindowsFromJSON;
4059
- /**
4060
- * Lists all root windows in the system.
4061
- * Corresponds to Python's list_root_windows() method
4062
- *
4063
- * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
4064
- * @returns WindowListResult with windows array and requestId
4065
- *
4066
- * @deprecated Use session.computer.listRootWindows() instead.
4067
- */
4068
- listRootWindows(timeoutMs?: number): Promise<WindowListResult>;
4069
- /**
4070
- * Lists all windows in the system.
4071
- * Corresponds to Python's list_all_windows() method
4072
- *
4073
- * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
4074
- * @returns WindowListResult with windows array and requestId
4075
- *
4076
- * @deprecated Use session.computer.listAllWindows() instead.
4077
- */
4078
- listAllWindows(timeoutMs?: number): Promise<WindowListResult>;
4079
- /**
4080
- * Gets information about a specific window.
4081
- * Corresponds to Python's get_window_info() method
4082
- *
4083
- * @param windowId - The ID of the window to get information for.
4084
- * @returns WindowInfoResult with window information and requestId
4085
- *
4086
- * @deprecated Use session.computer.getWindowInfo() instead.
4087
- */
4088
- getWindowInfo(windowId: number): Promise<WindowInfoResult>;
4089
- /**
4090
- * Activates a window by bringing it to the foreground.
4091
- * Corresponds to Python's activate_window() method
4092
- *
4093
- * @param windowId - The ID of the window to activate.
4094
- * @returns BoolResult with success status and requestId
4095
- *
4096
- * @deprecated Use session.computer.activateWindow() instead.
4097
- */
4098
- activateWindow(windowId: number): Promise<BoolResult$2>;
4099
- /**
4100
- * Maximizes a window.
4101
- * Corresponds to Python's maximize_window() method
4102
- *
4103
- * @param windowId - The ID of the window to maximize.
4104
- * @returns BoolResult with success status and requestId
4105
- *
4106
- * @deprecated Use session.computer.maximizeWindow() instead.
4107
- */
4108
- maximizeWindow(windowId: number): Promise<BoolResult$2>;
5065
+ declare class Oss {
5066
+ private session;
4109
5067
  /**
4110
- * Minimizes a window.
4111
- * Corresponds to Python's minimize_window() method
4112
- *
4113
- * @param windowId - The ID of the window to minimize.
4114
- * @returns BoolResult with success status and requestId
5068
+ * Initialize an Oss object.
4115
5069
  *
4116
- * @deprecated Use session.computer.minimizeWindow() instead.
5070
+ * @param session - The Session instance that this Oss belongs to.
4117
5071
  */
4118
- minimizeWindow(windowId: number): Promise<BoolResult$2>;
5072
+ constructor(session: Session);
4119
5073
  /**
4120
- * Restores a window by ID.
4121
- * Corresponds to Python's restore_window() method
5074
+ * Sanitizes error messages to remove sensitive information like API keys.
4122
5075
  *
4123
- * @param windowId The ID of the window to restore.
4124
- * @returns BoolResult with requestId
5076
+ * @param error - The error to sanitize
5077
+ * @returns The sanitized error
4125
5078
  */
4126
- restoreWindow(windowId: number): Promise<BoolResult$2>;
5079
+ private sanitizeError;
4127
5080
  /**
4128
- * Closes a window.
4129
- * Corresponds to Python's close_window() method
4130
- *
4131
- * @param windowId - The ID of the window to close.
4132
- * @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
4133
5083
  *
4134
- * @deprecated Use session.computer.closeWindow() instead.
4135
- */
4136
- closeWindow(windowId: number): Promise<BoolResult$2>;
4137
- /**
4138
- * Sets a window to fullscreen by ID.
4139
- * 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.
4140
5091
  *
4141
- * @param windowId The ID of the window to set to fullscreen.
4142
- * @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
+ * ```
4143
5102
  */
4144
- fullscreenWindow(windowId: number): Promise<BoolResult$2>;
5103
+ envInit(accessKeyId: string, accessKeySecret: string, securityToken: string, endpoint?: string, region?: string): Promise<OSSClientResult>;
4145
5104
  /**
4146
- * Resizes a window to the specified dimensions.
4147
- * Corresponds to Python's resize_window() method
5105
+ * Upload a file to OSS.
5106
+ * Corresponds to Python's upload() method
4148
5107
  *
4149
- * @param windowId - The ID of the window to resize.
4150
- * @param width - The new width of the window.
4151
- * @param height - The new height of the window.
4152
- * @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.
4153
5113
  *
4154
- * @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
+ * ```
4155
5125
  */
4156
- resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult$2>;
5126
+ upload(bucket: string, object: string, path: string): Promise<OSSUploadResult>;
4157
5127
  /**
4158
- * Moves a window to the specified position.
4159
- * 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
4160
5130
  *
4161
- * @param windowId - The ID of the window to move.
4162
- * @param x - The new x coordinate of the window.
4163
- * @param y - The new y coordinate of the window.
4164
- * @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.
4165
5135
  *
4166
- * @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
+ * ```
4167
5146
  */
4168
- moveWindow(windowId: number, x: number, y: number): Promise<BoolResult$2>;
5147
+ uploadAnonymous(url: string, path: string): Promise<OSSUploadResult>;
4169
5148
  /**
4170
- * Enables or disables focus mode.
4171
- * 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.
4172
5157
  *
4173
- * @param on Whether to enable focus mode.
4174
- * @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
+ * ```
4175
5169
  */
4176
- focusMode(on: boolean): Promise<BoolResult$2>;
5170
+ download(bucket: string, object: string, path: string): Promise<OSSDownloadResult>;
4177
5171
  /**
4178
- * Gets the currently active window.
4179
- * 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
4180
5174
  *
4181
- * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
4182
- * @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.
4183
5179
  *
4184
- * @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
+ * ```
4185
5190
  */
4186
- getActiveWindow(timeoutMs?: number): Promise<WindowInfoResult>;
5191
+ downloadAnonymous(url: string, path: string): Promise<OSSDownloadResult>;
4187
5192
  }
4188
5193
 
4189
5194
  /**
@@ -4220,9 +5225,6 @@ declare class Session {
4220
5225
  command: Command;
4221
5226
  code: Code;
4222
5227
  oss: Oss;
4223
- application: Application;
4224
- window: WindowManager;
4225
- ui: UI;
4226
5228
  computer: Computer;
4227
5229
  mobile: Mobile;
4228
5230
  agent: Agent;
@@ -4238,46 +5240,118 @@ declare class Session {
4238
5240
  constructor(agentBay: AgentBay, sessionId: string);
4239
5241
  /**
4240
5242
  * Return the AgentBay instance that created this session.
5243
+ *
5244
+ * @returns The AgentBay client instance
5245
+ * @internal
4241
5246
  */
4242
5247
  getAgentBay(): AgentBay;
4243
5248
  /**
4244
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
4245
5254
  */
4246
5255
  getAPIKey(): string;
4247
5256
  /**
4248
5257
  * Return the HTTP client for this session.
5258
+ *
5259
+ * @returns The Client instance used for API communication
5260
+ * @internal
4249
5261
  */
4250
5262
  getClient(): Client;
4251
5263
  /**
4252
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
4253
5269
  */
4254
5270
  getSessionId(): string;
4255
5271
  /**
4256
5272
  * Return whether this session uses VPC resources.
5273
+ *
5274
+ * @returns boolean indicating if VPC is enabled for this session
5275
+ * @internal
4257
5276
  */
4258
- isVpcEnabled(): boolean;
5277
+ private isVpcEnabled;
4259
5278
  /**
4260
5279
  * Return the network interface IP for VPC sessions.
5280
+ *
5281
+ * @returns The network interface IP string for VPC sessions
5282
+ * @internal
4261
5283
  */
4262
- getNetworkInterfaceIp(): string;
5284
+ private getNetworkInterfaceIp;
4263
5285
  /**
4264
5286
  * Return the HTTP port for VPC sessions.
5287
+ *
5288
+ * @returns The HTTP port string for VPC sessions
5289
+ * @internal
4265
5290
  */
4266
- getHttpPort(): string;
5291
+ private getHttpPort;
4267
5292
  /**
4268
5293
  * Return the token for VPC sessions.
5294
+ *
5295
+ * @returns The token string for VPC sessions
5296
+ * @internal
4269
5297
  */
4270
- getToken(): string;
5298
+ private getToken;
4271
5299
  /**
4272
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
4273
5305
  */
4274
- findServerForTool(toolName: string): string;
5306
+ private findServerForTool;
4275
5307
  /**
4276
5308
  * Delete this session.
4277
5309
  *
4278
5310
  * @param syncContext - Whether to sync context data (trigger file uploads) before deleting the session. Defaults to false.
4279
5311
  * @returns DeleteResult indicating success or failure and request ID
4280
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
+ */
4281
5355
  delete(syncContext?: boolean): Promise<DeleteResult>;
4282
5356
  /**
4283
5357
  * Validates labels parameter for label operations.
@@ -4292,6 +5366,17 @@ declare class Session {
4292
5366
  * @param labels - The labels to set for the session.
4293
5367
  * @returns OperationResult indicating success or failure with request ID
4294
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
+ * ```
4295
5380
  */
4296
5381
  setLabels(labels: Record<string, string>): Promise<OperationResult>;
4297
5382
  /**
@@ -4299,22 +5384,106 @@ declare class Session {
4299
5384
  *
4300
5385
  * @returns OperationResult containing the labels as data and request ID
4301
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
+ * ```
4302
5399
  */
4303
5400
  getLabels(): Promise<OperationResult>;
4304
5401
  /**
4305
- * Gets information about this session.
5402
+ * Retrieves detailed information about the current session.
4306
5403
  *
4307
- * @returns OperationResult containing the session information as data and request ID
4308
- * @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}
4309
5446
  */
4310
5447
  info(): Promise<OperationResult>;
4311
5448
  /**
4312
- * Get a link associated with the current session.
5449
+ * Retrieves an access link for the session.
4313
5450
  *
4314
- * @param protocolType - Optional protocol type to use for the link
4315
- * @param port - Optional port to use for the link (must be in range [30100, 30199])
4316
- * @returns OperationResult containing the link as data and request ID
4317
- * @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}
4318
5487
  */
4319
5488
  getLink(protocolType?: string, port?: number, options?: string): Promise<OperationResult>;
4320
5489
  /**
@@ -4324,6 +5493,17 @@ declare class Session {
4324
5493
  * @param port - Optional port to use for the link (must be in range [30100, 30199])
4325
5494
  * @returns OperationResult containing the link as data and request ID
4326
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
+ * ```
4327
5507
  */
4328
5508
  getLinkAsync(protocolType?: string, port?: number, options?: string): Promise<OperationResult>;
4329
5509
  /**
@@ -4331,6 +5511,17 @@ declare class Session {
4331
5511
  *
4332
5512
  * @param imageId Optional image ID, defaults to session's imageId or "linux_latest"
4333
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
+ * ```
4334
5525
  */
4335
5526
  listMcpTools(imageId?: string): Promise<McpToolsResult>;
4336
5527
  /**
@@ -4340,6 +5531,21 @@ declare class Session {
4340
5531
  * @param args - Arguments to pass to the tool
4341
5532
  * @param autoGenSession - Whether to automatically generate session if not exists (default: false)
4342
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").
4343
5549
  */
4344
5550
  callMcpTool(toolName: string, args: any, autoGenSession?: boolean): Promise<McpToolResult>;
4345
5551
  }
@@ -4498,6 +5704,16 @@ declare class ExtensionsService {
4498
5704
  *
4499
5705
  * @returns Promise that resolves to an array of Extension objects.
4500
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
+ * ```
4501
5717
  */
4502
5718
  list(): Promise<Extension[]>;
4503
5719
  /**
@@ -4508,6 +5724,15 @@ declare class ExtensionsService {
4508
5724
  * @throws {Error} If the local file doesn't exist.
4509
5725
  * @throws {Error} If the file format is not supported (only .zip is supported).
4510
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
+ * ```
4511
5736
  */
4512
5737
  create(localPath: string): Promise<Extension>;
4513
5738
  /**
@@ -4519,6 +5744,16 @@ declare class ExtensionsService {
4519
5744
  * @throws {Error} If the new local file doesn't exist.
4520
5745
  * @throws {Error} If the extension doesn't exist in the context.
4521
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
+ * ```
4522
5757
  */
4523
5758
  update(extensionId: string, newLocalPath: string): Promise<Extension>;
4524
5759
  /**
@@ -4536,6 +5771,15 @@ declare class ExtensionsService {
4536
5771
  * Note:
4537
5772
  * This method only works if the context was auto-created by this service.
4538
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
+ * ```
4539
5783
  */
4540
5784
  cleanup(): Promise<boolean>;
4541
5785
  /**
@@ -4543,6 +5787,16 @@ declare class ExtensionsService {
4543
5787
  *
4544
5788
  * @param extensionId - ID of the extension to delete.
4545
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
+ * ```
4546
5800
  */
4547
5801
  delete(extensionId: string): Promise<boolean>;
4548
5802
  /**
@@ -4587,6 +5841,7 @@ declare class ExtensionsService {
4587
5841
  * Key Features:
4588
5842
  * - Browser context binding for sessions
4589
5843
  * - Automatic browser data upload on session end
5844
+ * - Optional browser fingerprint integration with automatic context sync generation
4590
5845
  * - Optional extension integration with automatic context sync generation
4591
5846
  * - Clean API with ExtensionOption encapsulation
4592
5847
  *
@@ -4598,16 +5853,22 @@ declare class ExtensionsService {
4598
5853
  * ```typescript
4599
5854
  * // With extensions using ExtensionOption
4600
5855
  * import { ExtensionOption } from "./extension";
5856
+ * import { BrowserFingerprintContext } from "./browser";
4601
5857
  *
4602
5858
  * const extOption = new ExtensionOption(
4603
5859
  * "my_extensions",
4604
5860
  * ["ext1", "ext2"]
4605
5861
  * );
4606
5862
  *
5863
+ * const fingerprintContext = new BrowserFingerprintContext(
5864
+ * "my_fingerprint_context"
5865
+ * );
5866
+ *
4607
5867
  * const browserContext = new BrowserContext(
4608
5868
  * "browser_session",
4609
5869
  * true,
4610
- * extOption
5870
+ * extOption,
5871
+ * fingerprintContext
4611
5872
  * );
4612
5873
  *
4613
5874
  * // Without extensions (minimal configuration)
@@ -4615,7 +5876,15 @@ declare class ExtensionsService {
4615
5876
  * "browser_session",
4616
5877
  * true
4617
5878
  * );
4618
- * // 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
+ * );
4619
5888
  * ```
4620
5889
  */
4621
5890
  declare class BrowserContext {
@@ -4623,6 +5892,12 @@ declare class BrowserContext {
4623
5892
  contextId: string;
4624
5893
  /** Whether to automatically upload browser data when the session ends */
4625
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;
4626
5901
  /** Optional extension configuration object containing context_id and extension_ids */
4627
5902
  extensionOption?: ExtensionOption;
4628
5903
  /** ID of the extension context for browser extensions. Set automatically from extension_option. */
@@ -4632,7 +5907,7 @@ declare class BrowserContext {
4632
5907
  /** Auto-generated context syncs for extensions. None if no extension configuration provided. */
4633
5908
  extensionContextSyncs?: ContextSync[];
4634
5909
  /**
4635
- * Initialize BrowserContextImpl with optional extension support.
5910
+ * Initialize BrowserContextImpl with optional extension and fingerprint support.
4636
5911
  *
4637
5912
  * @param contextId - ID of the browser context to bind to the session.
4638
5913
  * This identifies the browser instance for the session.
@@ -4642,17 +5917,28 @@ declare class BrowserContext {
4642
5917
  * contextId and extensionIds. This encapsulates
4643
5918
  * all extension-related configuration.
4644
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.
4645
5924
  *
4646
5925
  * Extension Configuration:
4647
5926
  * - **ExtensionOption**: Use extensionOption parameter with an ExtensionOption object
4648
5927
  * - **No Extensions**: Don't provide extensionOption parameter
4649
5928
  *
5929
+ * Fingerprint Configuration:
5930
+ * - **BrowserFingerprintContext**: Use fingerprintContext parameter with a BrowserFingerprintContext object
5931
+ * - **No Fingerprint**: Don't provide fingerprintContext parameter
5932
+ *
4650
5933
  * Auto-generation:
4651
5934
  * - extensionContextSyncs is automatically generated when extensionOption is provided
4652
5935
  * - extensionContextSyncs will be undefined if no extensionOption is provided
4653
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
4654
5940
  */
4655
- constructor(contextId: string, autoUpload?: boolean, extensionOption?: ExtensionOption);
5941
+ constructor(contextId: string, autoUpload?: boolean, extensionOption?: ExtensionOption, fingerprintContext?: BrowserFingerprintContext);
4656
5942
  /**
4657
5943
  * Create ContextSync configurations for browser extensions.
4658
5944
  *
@@ -4664,11 +5950,28 @@ declare class BrowserContext {
4664
5950
  */
4665
5951
  private _createExtensionContextSyncs;
4666
5952
  /**
4667
- * 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.
4668
5970
  *
4669
- * @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.
4670
5973
  */
4671
- getAllContextSyncs(): ContextSync[];
5974
+ getFingerprintContextSync(): ContextSync | undefined;
4672
5975
  }
4673
5976
  /**
4674
5977
  * Configuration interface for CreateSessionParams
@@ -4749,18 +6052,12 @@ declare class CreateSessionParams$1 implements CreateSessionParamsConfig {
4749
6052
  * GetLabelsJSON returns the labels as a JSON string.
4750
6053
  * Returns an object with success status and result/error message to match Go version behavior.
4751
6054
  */
4752
- getLabelsJSON(): {
4753
- result: string;
4754
- error?: string;
4755
- };
6055
+ private getLabelsJSON;
4756
6056
  /**
4757
6057
  * GetExtraConfigsJSON returns the extra configs as a JSON string.
4758
6058
  * Returns an object with result and optional error message to match Go version behavior.
4759
6059
  */
4760
- getExtraConfigsJSON(): {
4761
- result: string;
4762
- error?: string;
4763
- };
6060
+ private getExtraConfigsJSON;
4764
6061
  /**
4765
6062
  * AddContextSync adds a context sync configuration to the session parameters.
4766
6063
  */
@@ -4869,19 +6166,49 @@ declare class AgentBay {
4869
6166
  * @param params - Optional parameters for creating the session
4870
6167
  * @returns SessionResult containing the created session and request ID
4871
6168
  */
4872
- create(params?: CreateSessionParams): Promise<SessionResult>;
4873
6169
  /**
4874
- * List sessions filtered by the provided labels with pagination support.
4875
- * It returns sessions that match all the specified labels.
6170
+ * Creates a new AgentBay session with specified configuration.
4876
6171
  *
4877
- * @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
4878
6182
  *
4879
- * **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
4880
6188
  *
4881
- * @param params - Parameters including labels and pagination options (required)
4882
- * @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}
4883
6210
  */
4884
- listByLabels(params?: ListSessionParams): Promise<SessionListResult>;
6211
+ create(params?: CreateSessionParams): Promise<SessionResult>;
4885
6212
  /**
4886
6213
  * Returns paginated list of session IDs filtered by labels.
4887
6214
  *
@@ -4893,22 +6220,9 @@ declare class AgentBay {
4893
6220
  * @example
4894
6221
  * ```typescript
4895
6222
  * const agentBay = new AgentBay({ apiKey: "your_api_key" });
4896
- *
4897
- * // List all sessions
4898
- * const result = await agentBay.list();
4899
- *
4900
- * // List sessions with specific labels
4901
- * const result = await agentBay.list({ project: "demo" });
4902
- *
4903
- * // List sessions with pagination
4904
- * const result = await agentBay.list({ "my-label": "my-value" }, 2, 10);
4905
- *
6223
+ * const result = await agentBay.list({ project: "demo" }, 1, 10);
4906
6224
  * if (result.success) {
4907
- * for (const sessionId of result.sessionIds) {
4908
- * console.log(`Session ID: ${sessionId}`);
4909
- * }
4910
- * console.log(`Total count: ${result.totalCount}`);
4911
- * console.log(`Request ID: ${result.requestId}`);
6225
+ * console.log(`Found ${result.sessionIds.length} sessions`);
4912
6226
  * }
4913
6227
  * ```
4914
6228
  */
@@ -4919,11 +6233,34 @@ declare class AgentBay {
4919
6233
  * @param session - The session to delete.
4920
6234
  * @param syncContext - Whether to sync context data (trigger file uploads) before deleting the session. Defaults to false.
4921
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
+ * ```
4922
6245
  */
4923
6246
  delete(session: Session, syncContext?: boolean): Promise<DeleteResult>;
4924
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}.
4925
6262
  *
4926
- * @param sessionId - The ID of the session to remove.
6263
+ * @see {@link delete}, {@link Session.delete}
4927
6264
  */
4928
6265
  removeSession(sessionId: string): void;
4929
6266
  /**
@@ -4944,15 +6281,42 @@ declare class AgentBay {
4944
6281
  *
4945
6282
  * @example
4946
6283
  * ```typescript
4947
- * const result = await agentBay.get("my-session-id");
4948
- * if (result.success) {
4949
- * console.log(result.session.sessionId);
4950
- * 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();
4951
6290
  * }
4952
6291
  * ```
4953
6292
  */
4954
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
+ */
4955
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
+ */
4956
6320
  getAPIKey(): string;
4957
6321
  }
4958
6322
 
@@ -4982,12 +6346,6 @@ declare class APIError extends AgentBayError {
4982
6346
  declare class FileError extends AgentBayError {
4983
6347
  constructor(message?: string, extra?: Record<string, any>);
4984
6348
  }
4985
- /**
4986
- * Raised for errors related to command execution.
4987
- */
4988
- declare class CommandError extends AgentBayError {
4989
- constructor(message?: string, extra?: Record<string, any>);
4990
- }
4991
6349
  /**
4992
6350
  * Raised for errors related to session operations.
4993
6351
  */
@@ -5000,18 +6358,6 @@ declare class SessionError extends AgentBayError {
5000
6358
  declare class OssError extends AgentBayError {
5001
6359
  constructor(message?: string, extra?: Record<string, any>);
5002
6360
  }
5003
- /**
5004
- * Raised for errors related to application operations.
5005
- */
5006
- declare class ApplicationError extends AgentBayError {
5007
- constructor(message?: string, extra?: Record<string, any>);
5008
- }
5009
- /**
5010
- * Raised for errors related to UI operations.
5011
- */
5012
- declare class UIError extends AgentBayError {
5013
- constructor(message?: string, extra?: Record<string, any>);
5014
- }
5015
6361
  /**
5016
6362
  * Raised for errors related to browser operations.
5017
6363
  */
@@ -5029,6 +6375,37 @@ declare class BrowserError extends AgentBayError {
5029
6375
  type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
5030
6376
  /**
5031
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
+ * ```
5032
6409
  */
5033
6410
  interface LoggerConfig {
5034
6411
  level?: LogLevel;
@@ -5036,13 +6413,6 @@ interface LoggerConfig {
5036
6413
  maxFileSize?: string;
5037
6414
  enableConsole?: boolean;
5038
6415
  }
5039
- /**
5040
- * Mask sensitive information in data structures
5041
- * @param data Data to mask (dict, str, list, etc.)
5042
- * @param fields Additional sensitive field names
5043
- * @returns Masked data (deep copy)
5044
- */
5045
- declare function maskSensitiveData(data: any, fields?: string[]): any;
5046
6416
  /**
5047
6417
  * Set the log level
5048
6418
  * @param level The log level to set
@@ -5056,6 +6426,37 @@ declare function getLogLevel(): LogLevel;
5056
6426
  /**
5057
6427
  * Setup logger configuration
5058
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
+ * ```
5059
6460
  */
5060
6461
  declare function setupLogger(config: LoggerConfig): void;
5061
6462
  /**
@@ -5090,4 +6491,4 @@ declare function logWarn(message: string, ...args: any[]): void;
5090
6491
  */
5091
6492
  declare function logError(message: string, error?: any): void;
5092
6493
 
5093
- 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 };