wuying-agentbay-sdk 0.7.0 → 0.9.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.
package/dist/index.d.ts CHANGED
@@ -47,6 +47,7 @@ declare class CreateMcpSessionResponseBodyData extends $dara.Model {
47
47
  resourceUrl?: string;
48
48
  sessionId?: string;
49
49
  success?: boolean;
50
+ token?: string;
50
51
  vpcResource?: boolean;
51
52
  static names(): {
52
53
  [key: string]: string;
@@ -107,6 +108,28 @@ declare class GetLabelResponseBodyData extends $dara.Model {
107
108
  });
108
109
  }
109
110
 
111
+ declare class GetSessionResponseBodyData extends $dara.Model {
112
+ appInstanceId?: string;
113
+ resourceId?: string;
114
+ sessionId?: string;
115
+ success?: boolean;
116
+ httpPort?: string;
117
+ networkInterfaceIp?: string;
118
+ token?: string;
119
+ vpcResource?: boolean;
120
+ resourceUrl?: string;
121
+ static names(): {
122
+ [key: string]: string;
123
+ };
124
+ static types(): {
125
+ [key: string]: any;
126
+ };
127
+ validate(): void;
128
+ constructor(map?: {
129
+ [key: string]: any;
130
+ });
131
+ }
132
+
110
133
  declare class GetLinkResponseBodyData extends $dara.Model {
111
134
  url?: string;
112
135
  static names(): {
@@ -177,6 +200,7 @@ declare class ListContextsResponseBodyData extends $dara.Model {
177
200
 
178
201
  declare class ListSessionResponseBodyData extends $dara.Model {
179
202
  sessionId?: string;
203
+ sessionStatus?: string;
180
204
  static names(): {
181
205
  [key: string]: string;
182
206
  };
@@ -596,6 +620,58 @@ declare class GetLabelResponse extends $dara.Model {
596
620
  });
597
621
  }
598
622
 
623
+ declare class GetSessionRequest extends $dara.Model {
624
+ authorization?: string;
625
+ sessionId?: string;
626
+ static names(): {
627
+ [key: string]: string;
628
+ };
629
+ static types(): {
630
+ [key: string]: any;
631
+ };
632
+ validate(): void;
633
+ constructor(map?: {
634
+ [key: string]: any;
635
+ });
636
+ }
637
+
638
+ declare class GetSessionResponseBody extends $dara.Model {
639
+ code?: string;
640
+ data?: GetSessionResponseBodyData;
641
+ httpStatusCode?: number;
642
+ message?: string;
643
+ requestId?: string;
644
+ success?: boolean;
645
+ static names(): {
646
+ [key: string]: string;
647
+ };
648
+ static types(): {
649
+ [key: string]: any;
650
+ };
651
+ validate(): void;
652
+ constructor(map?: {
653
+ [key: string]: any;
654
+ });
655
+ }
656
+
657
+ declare class GetSessionResponse extends $dara.Model {
658
+ headers?: {
659
+ [key: string]: string;
660
+ };
661
+ statusCode?: number;
662
+ body?: GetSessionResponseBody;
663
+ static names(): {
664
+ [key: string]: string;
665
+ };
666
+ static types(): {
667
+ [key: string]: any;
668
+ };
669
+ validate(): void;
670
+ constructor(map?: {
671
+ [key: string]: any;
672
+ });
673
+ }
674
+
599
675
  declare class GetLinkRequest extends $dara.Model {
600
676
  authorization?: string;
601
677
  port?: number;
@@ -1426,7 +1502,7 @@ declare class Client extends OpenApi {
1426
1502
  [key: string]: string;
1427
1503
  }, endpoint: string): string;
1428
1504
  /**
1429
- * 调用mcp工具
1505
+ * Call MCP tool
1430
1506
  *
1431
1507
  * @param request - CallMcpToolRequest
1432
1508
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1434,14 +1510,14 @@ declare class Client extends OpenApi {
1434
1510
  */
1435
1511
  callMcpToolWithOptions(request: CallMcpToolRequest, runtime: $dara.RuntimeOptions): Promise<CallMcpToolResponse>;
1436
1512
  /**
1437
- * 调用mcp工具
1513
+ * Call MCP tool
1438
1514
  *
1439
1515
  * @param request - CallMcpToolRequest
1440
1516
  * @returns CallMcpToolResponse
1441
1517
  */
1442
1518
  callMcpTool(request: CallMcpToolRequest): Promise<CallMcpToolResponse>;
1443
1519
  /**
1444
- * 创建 mcp session
1520
+ * Create MCP session
1445
1521
  *
1446
1522
  * @param tmpReq - CreateMcpSessionRequest
1447
1523
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1449,14 +1525,14 @@ declare class Client extends OpenApi {
1449
1525
  */
1450
1526
  createMcpSessionWithOptions(tmpReq: CreateMcpSessionRequest, runtime: $dara.RuntimeOptions): Promise<CreateMcpSessionResponse>;
1451
1527
  /**
1452
- * 创建 mcp session
1528
+ * Create MCP session
1453
1529
  *
1454
1530
  * @param request - CreateMcpSessionRequest
1455
1531
  * @returns CreateMcpSessionResponse
1456
1532
  */
1457
1533
  createMcpSession(request: CreateMcpSessionRequest): Promise<CreateMcpSessionResponse>;
1458
1534
  /**
1459
- * 删除持久化上下文
1535
+ * Delete persistent context
1460
1536
  *
1461
1537
  * @param request - DeleteContextRequest
1462
1538
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1464,14 +1540,14 @@ declare class Client extends OpenApi {
1464
1540
  */
1465
1541
  deleteContextWithOptions(request: DeleteContextRequest, runtime: $dara.RuntimeOptions): Promise<DeleteContextResponse>;
1466
1542
  /**
1467
- * 删除持久化上下文
1543
+ * Delete persistent context
1468
1544
  *
1469
1545
  * @param request - DeleteContextRequest
1470
1546
  * @returns DeleteContextResponse
1471
1547
  */
1472
1548
  deleteContext(request: DeleteContextRequest): Promise<DeleteContextResponse>;
1473
1549
  /**
1474
- * 获取上下文
1550
+ * Get context
1475
1551
  *
1476
1552
  * @param request - GetContextRequest
1477
1553
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1479,14 +1555,14 @@ declare class Client extends OpenApi {
1479
1555
  */
1480
1556
  getContextWithOptions(request: GetContextRequest, runtime: $dara.RuntimeOptions): Promise<GetContextResponse>;
1481
1557
  /**
1482
- * 获取上下文
1558
+ * Get context
1483
1559
  *
1484
1560
  * @param request - GetContextRequest
1485
1561
  * @returns GetContextResponse
1486
1562
  */
1487
1563
  getContext(request: GetContextRequest): Promise<GetContextResponse>;
1488
1564
  /**
1489
- * 获取上下文信息
1565
+ * Get context information
1490
1566
  *
1491
1567
  * @param request - GetContextInfoRequest
1492
1568
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1494,14 +1570,14 @@ declare class Client extends OpenApi {
1494
1570
  */
1495
1571
  getContextInfoWithOptions(request: GetContextInfoRequest, runtime: $dara.RuntimeOptions): Promise<GetContextInfoResponse>;
1496
1572
  /**
1497
- * 获取上下文信息
1573
+ * Get context information
1498
1574
  *
1499
1575
  * @param request - GetContextInfoRequest
1500
1576
  * @returns GetContextInfoResponse
1501
1577
  */
1502
1578
  getContextInfo(request: GetContextInfoRequest): Promise<GetContextInfoResponse>;
1503
1579
  /**
1504
- * 获取标签
1580
+ * Get labels
1505
1581
  *
1506
1582
  * @param request - GetLabelRequest
1507
1583
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1509,14 +1585,29 @@ declare class Client extends OpenApi {
1509
1585
  */
1510
1586
  getLabelWithOptions(request: GetLabelRequest, runtime: $dara.RuntimeOptions): Promise<GetLabelResponse>;
1511
1587
  /**
1512
- * 获取标签
1588
+ * Get labels
1513
1589
  *
1514
1590
  * @param request - GetLabelRequest
1515
1591
  * @returns GetLabelResponse
1516
1592
  */
1517
1593
  getLabel(request: GetLabelRequest): Promise<GetLabelResponse>;
1518
1594
  /**
1519
- * 获取特定端口的转发链接
1595
+ * Get session information
1596
+ *
1597
+ * @param request - GetSessionRequest
1598
+ * @param runtime - runtime options for this request RuntimeOptions
1599
+ * @returns GetSessionResponse
1600
+ */
1601
+ getSessionWithOptions(request: GetSessionRequest, runtime: $dara.RuntimeOptions): Promise<GetSessionResponse>;
1602
+ /**
1603
+ * Get session information
1604
+ *
1605
+ * @param request - GetSessionRequest
1606
+ * @returns GetSessionResponse
1607
+ */
1608
+ getSession(request: GetSessionRequest): Promise<GetSessionResponse>;
1609
+ /**
1610
+ * Get forwarding link for specific port
1520
1611
  *
1521
1612
  * @param request - GetLinkRequest
1522
1613
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1524,14 +1615,14 @@ declare class Client extends OpenApi {
1524
1615
  */
1525
1616
  getLinkWithOptions(request: GetLinkRequest, runtime: $dara.RuntimeOptions): Promise<GetLinkResponse>;
1526
1617
  /**
1527
- * 获取特定端口的转发链接
1618
+ * Get forwarding link for specific port
1528
1619
  *
1529
1620
  * @param request - GetLinkRequest
1530
1621
  * @returns GetLinkResponse
1531
1622
  */
1532
1623
  getLink(request: GetLinkRequest): Promise<GetLinkResponse>;
1533
1624
  /**
1534
- * 获取mcp资源信息
1625
+ * Get MCP resource information
1535
1626
  *
1536
1627
  * @param request - GetMcpResourceRequest
1537
1628
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1539,14 +1630,14 @@ declare class Client extends OpenApi {
1539
1630
  */
1540
1631
  getMcpResourceWithOptions(request: GetMcpResourceRequest, runtime: $dara.RuntimeOptions): Promise<GetMcpResourceResponse>;
1541
1632
  /**
1542
- * 获取mcp资源信息
1633
+ * Get MCP resource information
1543
1634
  *
1544
1635
  * @param request - GetMcpResourceRequest
1545
1636
  * @returns GetMcpResourceResponse
1546
1637
  */
1547
1638
  getMcpResource(request: GetMcpResourceRequest): Promise<GetMcpResourceResponse>;
1548
1639
  /**
1549
- * 获取上下文列表
1640
+ * Get context list
1550
1641
  *
1551
1642
  * @param request - ListContextsRequest
1552
1643
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1554,7 +1645,7 @@ declare class Client extends OpenApi {
1554
1645
  */
1555
1646
  listContextsWithOptions(request: ListContextsRequest, runtime: $dara.RuntimeOptions): Promise<ListContextsResponse>;
1556
1647
  /**
1557
- * 获取上下文列表
1648
+ * Get context list
1558
1649
  *
1559
1650
  * @param request - ListContextsRequest
1560
1651
  * @returns ListContextsResponse
@@ -1576,7 +1667,7 @@ declare class Client extends OpenApi {
1576
1667
  */
1577
1668
  listMcpTools(request: ListMcpToolsRequest): Promise<ListMcpToolsResponse>;
1578
1669
  /**
1579
- * 根据Lable查询Session列表
1670
+ * Query session list by label
1580
1671
  *
1581
1672
  * @param request - ListSessionRequest
1582
1673
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1584,14 +1675,14 @@ declare class Client extends OpenApi {
1584
1675
  */
1585
1676
  listSessionWithOptions(request: ListSessionRequest, runtime: $dara.RuntimeOptions): Promise<ListSessionResponse>;
1586
1677
  /**
1587
- * 根据Lable查询Session列表
1678
+ * Query session list by label
1588
1679
  *
1589
1680
  * @param request - ListSessionRequest
1590
1681
  * @returns ListSessionResponse
1591
1682
  */
1592
1683
  listSession(request: ListSessionRequest): Promise<ListSessionResponse>;
1593
1684
  /**
1594
- * 修改上下文
1685
+ * Modify context
1595
1686
  *
1596
1687
  * @param request - ModifyContextRequest
1597
1688
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1599,14 +1690,14 @@ declare class Client extends OpenApi {
1599
1690
  */
1600
1691
  modifyContextWithOptions(request: ModifyContextRequest, runtime: $dara.RuntimeOptions): Promise<ModifyContextResponse>;
1601
1692
  /**
1602
- * 修改上下文
1693
+ * Modify context
1603
1694
  *
1604
1695
  * @param request - ModifyContextRequest
1605
1696
  * @returns ModifyContextResponse
1606
1697
  */
1607
1698
  modifyContext(request: ModifyContextRequest): Promise<ModifyContextResponse>;
1608
1699
  /**
1609
- * 释放 mcp session
1700
+ * Release MCP session
1610
1701
  *
1611
1702
  * @param request - ReleaseMcpSessionRequest
1612
1703
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1614,14 +1705,14 @@ declare class Client extends OpenApi {
1614
1705
  */
1615
1706
  releaseMcpSessionWithOptions(request: ReleaseMcpSessionRequest, runtime: $dara.RuntimeOptions): Promise<ReleaseMcpSessionResponse>;
1616
1707
  /**
1617
- * 释放 mcp session
1708
+ * Release MCP session
1618
1709
  *
1619
1710
  * @param request - ReleaseMcpSessionRequest
1620
1711
  * @returns ReleaseMcpSessionResponse
1621
1712
  */
1622
1713
  releaseMcpSession(request: ReleaseMcpSessionRequest): Promise<ReleaseMcpSessionResponse>;
1623
1714
  /**
1624
- * 设置标签
1715
+ * Set labels
1625
1716
  *
1626
1717
  * @param request - SetLabelRequest
1627
1718
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1629,14 +1720,14 @@ declare class Client extends OpenApi {
1629
1720
  */
1630
1721
  setLabelWithOptions(request: SetLabelRequest, runtime: $dara.RuntimeOptions): Promise<SetLabelResponse>;
1631
1722
  /**
1632
- * 设置标签
1723
+ * Set labels
1633
1724
  *
1634
1725
  * @param request - SetLabelRequest
1635
1726
  * @returns SetLabelResponse
1636
1727
  */
1637
1728
  setLabel(request: SetLabelRequest): Promise<SetLabelResponse>;
1638
1729
  /**
1639
- * 同步上下文
1730
+ * Sync context
1640
1731
  *
1641
1732
  * @param request - SyncContextRequest
1642
1733
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1644,14 +1735,14 @@ declare class Client extends OpenApi {
1644
1735
  */
1645
1736
  syncContextWithOptions(request: SyncContextRequest, runtime: $dara.RuntimeOptions): Promise<SyncContextResponse>;
1646
1737
  /**
1647
- * 同步上下文
1738
+ * Sync context
1648
1739
  *
1649
1740
  * @param request - SyncContextRequest
1650
1741
  * @returns SyncContextResponse
1651
1742
  */
1652
1743
  syncContext(request: SyncContextRequest): Promise<SyncContextResponse>;
1653
1744
  /**
1654
- * 初始化浏览器
1745
+ * Initialize browser
1655
1746
  *
1656
1747
  * @param tmpReq - InitBrowserRequest
1657
1748
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1659,21 +1750,21 @@ declare class Client extends OpenApi {
1659
1750
  */
1660
1751
  initBrowserWithOptions(request: InitBrowserRequest, runtime: $dara.RuntimeOptions): Promise<InitBrowserResponse>;
1661
1752
  /**
1662
- * 初始化浏览器
1753
+ * Initialize browser
1663
1754
  *
1664
1755
  * @param request - InitBrowserRequest
1665
1756
  * @returns InitBrowserResponse
1666
1757
  */
1667
1758
  initBrowser(request: InitBrowserRequest): Promise<InitBrowserResponse>;
1668
1759
  /**
1669
- * 初始化浏览器(同步版本)
1760
+ * Initialize browser (sync version)
1670
1761
  *
1671
1762
  * @param request - InitBrowserRequest
1672
1763
  * @returns InitBrowserResponse
1673
1764
  */
1674
1765
  initBrowserSync(request: InitBrowserRequest): InitBrowserResponse;
1675
1766
  /**
1676
- * 获取上传context文件url
1767
+ * Get context file upload URL
1677
1768
  *
1678
1769
  * @param request - DeleteContextFileRequest
1679
1770
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1681,14 +1772,14 @@ declare class Client extends OpenApi {
1681
1772
  */
1682
1773
  deleteContextFileWithOptions(request: DeleteContextFileRequest, runtime: $dara.RuntimeOptions): Promise<DeleteContextFileResponse>;
1683
1774
  /**
1684
- * 获取上传context文件url
1775
+ * Get context file upload URL
1685
1776
  *
1686
1777
  * @param request - DeleteContextFileRequest
1687
1778
  * @returns DeleteContextFileResponse
1688
1779
  */
1689
1780
  deleteContextFile(request: DeleteContextFileRequest): Promise<DeleteContextFileResponse>;
1690
1781
  /**
1691
- * 查询context特定目录文件
1782
+ * Query context specific directory files
1692
1783
  *
1693
1784
  * @param request - DescribeContextFilesRequest
1694
1785
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1696,14 +1787,14 @@ declare class Client extends OpenApi {
1696
1787
  */
1697
1788
  describeContextFilesWithOptions(request: DescribeContextFilesRequest, runtime: $dara.RuntimeOptions): Promise<DescribeContextFilesResponse>;
1698
1789
  /**
1699
- * 查询context特定目录文件
1790
+ * Query context specific directory files
1700
1791
  *
1701
1792
  * @param request - DescribeContextFilesRequest
1702
1793
  * @returns DescribeContextFilesResponse
1703
1794
  */
1704
1795
  describeContextFiles(request: DescribeContextFilesRequest): Promise<DescribeContextFilesResponse>;
1705
1796
  /**
1706
- * 获取上传context文件url
1797
+ * Get context file upload URL
1707
1798
  *
1708
1799
  * @param request - GetContextFileDownloadUrlRequest
1709
1800
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1711,14 +1802,14 @@ declare class Client extends OpenApi {
1711
1802
  */
1712
1803
  getContextFileDownloadUrlWithOptions(request: GetContextFileDownloadUrlRequest, runtime: $dara.RuntimeOptions): Promise<GetContextFileDownloadUrlResponse>;
1713
1804
  /**
1714
- * 获取上传context文件url
1805
+ * Get context file upload URL
1715
1806
  *
1716
1807
  * @param request - GetContextFileDownloadUrlRequest
1717
1808
  * @returns GetContextFileDownloadUrlResponse
1718
1809
  */
1719
1810
  getContextFileDownloadUrl(request: GetContextFileDownloadUrlRequest): Promise<GetContextFileDownloadUrlResponse>;
1720
1811
  /**
1721
- * 获取上传context文件url
1812
+ * Get context file upload URL
1722
1813
  *
1723
1814
  * @param request - GetContextFileUploadUrlRequest
1724
1815
  * @param runtime - runtime options for this request RuntimeOptions
@@ -1726,7 +1817,7 @@ declare class Client extends OpenApi {
1726
1817
  */
1727
1818
  getContextFileUploadUrlWithOptions(request: GetContextFileUploadUrlRequest, runtime: $dara.RuntimeOptions): Promise<GetContextFileUploadUrlResponse>;
1728
1819
  /**
1729
- * 获取上传context文件url
1820
+ * Get context file upload URL
1730
1821
  *
1731
1822
  * @param request - GetContextFileUploadUrlRequest
1732
1823
  * @returns GetContextFileUploadUrlResponse
@@ -1735,13 +1826,13 @@ declare class Client extends OpenApi {
1735
1826
  }
1736
1827
 
1737
1828
  interface Config {
1738
- region_id: string;
1739
1829
  endpoint: string;
1740
1830
  timeout_ms: number;
1741
1831
  }
1742
1832
  /**
1743
1833
  * Load .env file into process.env if it exists
1744
1834
  * This function should be called early to ensure .env variables are available
1835
+ * @deprecated Use loadDotEnvWithFallback instead
1745
1836
  */
1746
1837
  declare function loadDotEnv(): void;
1747
1838
  /**
@@ -1751,7 +1842,14 @@ declare function loadDotEnv(): void;
1751
1842
  * 3. .env file.
1752
1843
  * 4. Default configuration.
1753
1844
  */
1754
- declare function loadConfig(customConfig?: Config): Config;
1845
+ /**
1846
+ * Load configuration with improved .env file search.
1847
+ *
1848
+ * @param customConfig Configuration object (if provided, skips env loading)
1849
+ * @param customEnvPath Custom path to .env file (optional)
1850
+ * @returns Configuration object
1851
+ */
1852
+ declare function loadConfig(customConfig?: Config, customEnvPath?: string): Config;
1755
1853
 
1756
1854
  /**
1757
1855
  * Base interface for API responses
@@ -1773,6 +1871,46 @@ interface DeleteResult extends ApiResponse {
1773
1871
  /** Optional error message if the operation failed */
1774
1872
  errorMessage?: string;
1775
1873
  }
1874
+ /**
1875
+ * Interface for GetSession data
1876
+ */
1877
+ interface GetSessionData {
1878
+ /** Application instance ID */
1879
+ appInstanceId: string;
1880
+ /** Resource ID */
1881
+ resourceId: string;
1882
+ /** Session ID */
1883
+ sessionId: string;
1884
+ /** Success status */
1885
+ success: boolean;
1886
+ /** HTTP port for VPC sessions */
1887
+ httpPort: string;
1888
+ /** Network interface IP for VPC sessions */
1889
+ networkInterfaceIp: string;
1890
+ /** Token for VPC sessions */
1891
+ token: string;
1892
+ /** Whether this session uses VPC resources */
1893
+ vpcResource: boolean;
1894
+ /** Resource URL for accessing the session */
1895
+ resourceUrl: string;
1896
+ }
1897
+ /**
1898
+ * Interface for GetSession operation responses
1899
+ */
1900
+ interface GetSessionResult extends ApiResponse {
1901
+ /** Request identifier for tracking API calls */
1902
+ requestId: string;
1903
+ /** HTTP status code */
1904
+ httpStatusCode: number;
1905
+ /** Response code */
1906
+ code: string;
1907
+ /** Whether the operation was successful */
1908
+ success: boolean;
1909
+ /** Session data */
1910
+ data?: GetSessionData;
1911
+ /** Optional error message if the operation failed */
1912
+ errorMessage?: string;
1913
+ }
1776
1914
  /**
1777
1915
  * Interface for session creation operation responses
1778
1916
  * Corresponds to Python's SessionResult type
@@ -1873,7 +2011,7 @@ interface CodeExecutionResult extends ApiResponse {
1873
2011
  * Interface for boolean operation responses
1874
2012
  * Corresponds to Python's BoolResult type
1875
2013
  */
1876
- interface BoolResult extends ApiResponse {
2014
+ interface BoolResult$2 extends ApiResponse {
1877
2015
  /** Request identifier for tracking API calls */
1878
2016
  requestId: string;
1879
2017
  /** Whether the operation was successful */
@@ -2130,7 +2268,7 @@ declare class Context {
2130
2268
  */
2131
2269
  name: string;
2132
2270
  /**
2133
- * The current state of the context (e.g., "available", "in-use").
2271
+ * @deprecated This field is no longer used and will be removed in a future version.
2134
2272
  */
2135
2273
  state: string;
2136
2274
  /**
@@ -2142,7 +2280,7 @@ declare class Context {
2142
2280
  */
2143
2281
  lastUsedAt?: string;
2144
2282
  /**
2145
- * The operating system type this context is bound to.
2283
+ * @deprecated This field is no longer used and will be removed in a future version.
2146
2284
  */
2147
2285
  osType?: string;
2148
2286
  /**
@@ -2150,10 +2288,10 @@ declare class Context {
2150
2288
  *
2151
2289
  * @param id - The unique identifier of the context.
2152
2290
  * @param name - The name of the context.
2153
- * @param state - The current state of the context.
2291
+ * @param state - **Deprecated.** This parameter is no longer used.
2154
2292
  * @param createdAt - Date and time when the Context was created.
2155
2293
  * @param lastUsedAt - Date and time when the Context was last used.
2156
- * @param osType - The operating system type this context is bound to.
2294
+ * @param osType - **Deprecated.** This parameter is no longer used.
2157
2295
  */
2158
2296
  constructor(id: string, name: string, state?: string, createdAt?: string, lastUsedAt?: string, osType?: string);
2159
2297
  }
@@ -2247,10 +2385,21 @@ declare enum UploadStrategy {
2247
2385
  declare enum DownloadStrategy {
2248
2386
  DownloadAsync = "DownloadAsync"
2249
2387
  }
2388
+ declare enum Lifecycle {
2389
+ Lifecycle_1Day = "Lifecycle_1Day",
2390
+ Lifecycle_3Days = "Lifecycle_3Days",
2391
+ Lifecycle_5Days = "Lifecycle_5Days",
2392
+ Lifecycle_10Days = "Lifecycle_10Days",
2393
+ Lifecycle_15Days = "Lifecycle_15Days",
2394
+ Lifecycle_30Days = "Lifecycle_30Days",
2395
+ Lifecycle_90Days = "Lifecycle_90Days",
2396
+ Lifecycle_180Days = "Lifecycle_180Days",
2397
+ Lifecycle_360Days = "Lifecycle_360Days",
2398
+ Lifecycle_Forever = "Lifecycle_Forever"
2399
+ }
2250
2400
  interface UploadPolicy {
2251
2401
  autoUpload: boolean;
2252
2402
  uploadStrategy: UploadStrategy;
2253
- period?: number;
2254
2403
  }
2255
2404
  interface DownloadPolicy {
2256
2405
  autoDownload: boolean;
@@ -2264,6 +2413,10 @@ interface ExtractPolicy {
2264
2413
  deleteSrcFile: boolean;
2265
2414
  extractToCurrentFolder: boolean;
2266
2415
  }
2416
+ interface RecyclePolicy {
2417
+ lifecycle: Lifecycle;
2418
+ paths: string[];
2419
+ }
2267
2420
  declare class ExtractPolicyClass implements ExtractPolicy {
2268
2421
  extract: boolean;
2269
2422
  deleteSrcFile: boolean;
@@ -2282,6 +2435,10 @@ interface WhiteList {
2282
2435
  path: string;
2283
2436
  excludePaths?: string[];
2284
2437
  }
2438
+ declare class WhiteListValidator {
2439
+ private static containsWildcard;
2440
+ static validate(whitelist: WhiteList): void;
2441
+ }
2285
2442
  interface BWList {
2286
2443
  whiteLists?: WhiteList[];
2287
2444
  }
@@ -2290,6 +2447,7 @@ interface SyncPolicy {
2290
2447
  downloadPolicy?: DownloadPolicy;
2291
2448
  deletePolicy?: DeletePolicy;
2292
2449
  extractPolicy?: ExtractPolicy;
2450
+ recyclePolicy?: RecyclePolicy;
2293
2451
  bwList?: BWList;
2294
2452
  }
2295
2453
  declare class SyncPolicyImpl implements SyncPolicy {
@@ -2297,6 +2455,7 @@ declare class SyncPolicyImpl implements SyncPolicy {
2297
2455
  downloadPolicy?: DownloadPolicy;
2298
2456
  deletePolicy?: DeletePolicy;
2299
2457
  extractPolicy?: ExtractPolicy;
2458
+ recyclePolicy?: RecyclePolicy;
2300
2459
  bwList?: BWList;
2301
2460
  constructor(policy?: Partial<SyncPolicy>);
2302
2461
  private ensureDefaults;
@@ -2313,7 +2472,9 @@ declare function newUploadPolicy(): UploadPolicy;
2313
2472
  declare function newDownloadPolicy(): DownloadPolicy;
2314
2473
  declare function newDeletePolicy(): DeletePolicy;
2315
2474
  declare function newExtractPolicy(): ExtractPolicy;
2475
+ declare function newRecyclePolicy(): RecyclePolicy;
2316
2476
  declare function newSyncPolicy(): SyncPolicy;
2477
+ declare function validateSyncPolicy(policy?: SyncPolicy): void;
2317
2478
  declare function newSyncPolicyWithDefaults(policy?: Partial<SyncPolicy>): SyncPolicy;
2318
2479
  declare function newContextSync(contextId: string, path: string, policy?: SyncPolicy): ContextSync;
2319
2480
 
@@ -2389,7 +2550,7 @@ declare class Agent {
2389
2550
  /**
2390
2551
  * Represents an installed application
2391
2552
  */
2392
- interface InstalledApp {
2553
+ interface InstalledApp$1 {
2393
2554
  name: string;
2394
2555
  start_cmd: string;
2395
2556
  stop_cmd?: string;
@@ -2398,7 +2559,7 @@ interface InstalledApp {
2398
2559
  /**
2399
2560
  * Represents a running process
2400
2561
  */
2401
- interface Process {
2562
+ interface Process$1 {
2402
2563
  pname: string;
2403
2564
  pid: number;
2404
2565
  cmdline?: string;
@@ -2406,6 +2567,10 @@ interface Process {
2406
2567
  }
2407
2568
  /**
2408
2569
  * Handles application operations in the AgentBay cloud environment.
2570
+ *
2571
+ * @deprecated This module is deprecated. Use Computer or Mobile modules instead.
2572
+ * - For desktop applications, use session.computer
2573
+ * - For mobile applications, use session.mobile
2409
2574
  */
2410
2575
  declare class Application {
2411
2576
  private session;
@@ -2437,34 +2602,34 @@ declare class Application {
2437
2602
  */
2438
2603
  private parseJSON;
2439
2604
  /**
2440
- * Retrieves a list of installed applications.
2441
- * Corresponds to Python's get_installed_apps() method
2605
+ * Get a list of installed applications.
2442
2606
  *
2443
- * @param startMenu - Whether to include applications from the start menu. Defaults to true.
2444
- * @param desktop - Whether to include applications from the desktop. Defaults to true.
2445
- * @param ignoreSystemApps - Whether to ignore system applications. Defaults to true.
2446
- * @returns InstalledAppListResult with installed apps and requestId
2447
- * @throws Error if the operation fails.
2607
+ * @param startMenu - Whether to include start menu applications.
2608
+ * @param desktop - Whether to include desktop applications.
2609
+ * @param ignoreSystemApps - Whether to ignore system applications.
2610
+ * @returns A promise that resolves to the list of installed applications.
2611
+ *
2612
+ * @deprecated Use session.computer.getInstalledApps() for desktop or session.mobile.getInstalledApps() for mobile instead.
2448
2613
  */
2449
2614
  getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<InstalledAppListResult>;
2450
2615
  /**
2451
- * Starts an application with the given command and optional working directory.
2452
- * Corresponds to Python's start_app() method
2616
+ * Start an application.
2453
2617
  *
2454
2618
  * @param startCmd - The command to start the application.
2455
- * @param workDirectory - The working directory for the application. Defaults to an empty string.
2456
- * @param activity - Activity name to launch (e.g. ".SettingsActivity" or "com.package/.Activity"). Defaults to an empty string.
2457
- * @returns ProcessListResult with started processes and requestId
2458
- * @throws Error if the operation fails.
2619
+ * @param workDirectory - The working directory for the application.
2620
+ * @param activity - The activity to start (for mobile applications).
2621
+ * @returns A promise that resolves to the result of starting the application.
2622
+ *
2623
+ * @deprecated Use session.computer.startApp() for desktop or session.mobile.startApp() for mobile instead.
2459
2624
  */
2460
2625
  startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<ProcessListResult>;
2461
2626
  /**
2462
- * Stops an application by process name.
2463
- * Corresponds to Python's stop_app_by_pname() method
2627
+ * Stop an application by process name.
2464
2628
  *
2465
- * @param pname - The process name to stop.
2466
- * @returns AppOperationResult with operation result and requestId
2467
- * @throws Error if the operation fails.
2629
+ * @param pname - The process name of the application to stop.
2630
+ * @returns A promise that resolves to the result of stopping the application.
2631
+ *
2632
+ * @deprecated Use session.computer.stopAppByPName() for desktop or session.mobile.stopAppByPName() for mobile instead.
2468
2633
  */
2469
2634
  stopAppByPName(pname: string): Promise<AppOperationResult>;
2470
2635
  /**
@@ -2477,14 +2642,14 @@ declare class Application {
2477
2642
  */
2478
2643
  stopAppByPID(pid: number): Promise<AppOperationResult>;
2479
2644
  /**
2480
- * Stops an application by stop command.
2481
- * Corresponds to Python's stop_app_by_cmd() method
2645
+ * Stop an application by command.
2482
2646
  *
2483
- * @param stopCmd - The stop command to execute.
2484
- * @returns AppOperationResult with operation result and requestId
2485
- * @throws Error if the operation fails.
2647
+ * @param cmd - The command to stop the application.
2648
+ * @returns A promise that resolves to the result of stopping the application.
2649
+ *
2650
+ * @deprecated Use session.computer.stopAppByCmd() for desktop or session.mobile.stopAppByCmd() for mobile instead.
2486
2651
  */
2487
- stopAppByCmd(stopCmd: string): Promise<AppOperationResult>;
2652
+ stopAppByCmd(cmd: string): Promise<AppOperationResult>;
2488
2653
  /**
2489
2654
  * Returns a list of currently visible applications.
2490
2655
  * Corresponds to Python's list_visible_apps() method
@@ -2493,6 +2658,171 @@ declare class Application {
2493
2658
  * @throws Error if the operation fails.
2494
2659
  */
2495
2660
  listVisibleApps(): Promise<ProcessListResult>;
2661
+ /**
2662
+ * Get a list of running processes.
2663
+ *
2664
+ * @returns A promise that resolves to the list of running processes.
2665
+ *
2666
+ * @deprecated Use session.computer.getRunningProcesses() for desktop or session.mobile.getRunningProcesses() for mobile instead.
2667
+ */
2668
+ getRunningProcesses(): Promise<ProcessListResult>;
2669
+ /**
2670
+ * Get a list of visible applications.
2671
+ *
2672
+ * @returns A promise that resolves to the list of visible applications.
2673
+ *
2674
+ * @deprecated Use session.computer.getVisibleApps() for desktop instead. This API is not available for mobile.
2675
+ */
2676
+ getVisibleApps(): Promise<InstalledAppListResult>;
2677
+ }
2678
+
2679
+ interface ActOptions {
2680
+ action: string;
2681
+ timeoutMS?: number;
2682
+ iframes?: boolean;
2683
+ domSettleTimeoutMS?: number;
2684
+ variables?: Record<string, string>;
2685
+ use_vision?: boolean;
2686
+ }
2687
+ interface ObserveOptions {
2688
+ instruction: string;
2689
+ iframes?: boolean;
2690
+ domSettleTimeoutMS?: number;
2691
+ use_vision?: boolean;
2692
+ }
2693
+ interface ExtractOptions<T = any> {
2694
+ instruction: string;
2695
+ schema: new (...args: any[]) => T;
2696
+ use_text_extract?: boolean;
2697
+ selector?: string;
2698
+ iframe?: boolean;
2699
+ domSettleTimeoutMS?: number;
2700
+ use_vision?: boolean;
2701
+ }
2702
+ declare class ActResult {
2703
+ success: boolean;
2704
+ message: string;
2705
+ action?: string;
2706
+ constructor(success: boolean, message: string, action?: string);
2707
+ }
2708
+ declare class ObserveResult {
2709
+ selector: string;
2710
+ description: string;
2711
+ method: string;
2712
+ args: Record<string, any>;
2713
+ constructor(selector: string, description: string, method: string, args: Record<string, any>);
2714
+ }
2715
+ declare class BrowserAgent {
2716
+ private session;
2717
+ private browser;
2718
+ constructor(session: Session, browser: Browser);
2719
+ /** ------------------ ACT ------------------ **/
2720
+ act(options: ActOptions, page: any): Promise<ActResult>;
2721
+ actAsync(options: ActOptions, page: any): Promise<ActResult>;
2722
+ /** ------------------ OBSERVE ------------------ **/
2723
+ observe(options: ObserveOptions, page: any): Promise<[boolean, ObserveResult[]]>;
2724
+ observeAsync(options: ObserveOptions, page: any): Promise<[boolean, ObserveResult[]]>;
2725
+ /** ------------------ EXTRACT ------------------ **/
2726
+ extract<T>(options: ExtractOptions<T>, page: any): Promise<[boolean, T | null]>;
2727
+ extractAsync<T>(options: ExtractOptions<T>, page: any): Promise<[boolean, T | null]>;
2728
+ private _getPageAndContextIndexAsync;
2729
+ private _callMcpTool;
2730
+ private _delay;
2731
+ }
2732
+
2733
+ interface BrowserViewport {
2734
+ width: number;
2735
+ height: number;
2736
+ }
2737
+ interface BrowserScreen {
2738
+ width: number;
2739
+ height: number;
2740
+ }
2741
+ interface BrowserFingerprint {
2742
+ devices?: Array<'desktop' | 'mobile'>;
2743
+ operatingSystems?: Array<'windows' | 'macos' | 'linux' | 'android' | 'ios'>;
2744
+ locales?: string[];
2745
+ }
2746
+ interface BrowserProxy {
2747
+ type: 'custom' | 'wuying';
2748
+ server?: string;
2749
+ username?: string;
2750
+ password?: string;
2751
+ strategy?: 'restricted' | 'polling';
2752
+ pollsize?: number;
2753
+ toMap(): Record<string, any>;
2754
+ }
2755
+ declare class BrowserProxyClass implements BrowserProxy {
2756
+ type: 'custom' | 'wuying';
2757
+ server?: string;
2758
+ username?: string;
2759
+ password?: string;
2760
+ strategy?: 'restricted' | 'polling';
2761
+ pollsize?: number;
2762
+ constructor(proxyType: 'custom' | 'wuying', server?: string, username?: string, password?: string, strategy?: 'restricted' | 'polling', pollsize?: number);
2763
+ toMap(): Record<string, any>;
2764
+ static fromMap(m: Record<string, any> | null | undefined): BrowserProxyClass | null;
2765
+ }
2766
+ interface BrowserOption {
2767
+ persistentPath?: string;
2768
+ useStealth?: boolean;
2769
+ userAgent?: string;
2770
+ viewport?: BrowserViewport;
2771
+ screen?: BrowserScreen;
2772
+ fingerprint?: BrowserFingerprint;
2773
+ solveCaptchas?: boolean;
2774
+ proxies?: BrowserProxy[];
2775
+ /** Path to the extensions directory. Defaults to "/tmp/extensions/" */
2776
+ extensionPath?: string;
2777
+ }
2778
+ declare class BrowserOptionClass implements BrowserOption {
2779
+ persistentPath?: string;
2780
+ useStealth?: boolean;
2781
+ userAgent?: string;
2782
+ viewport?: BrowserViewport;
2783
+ screen?: BrowserScreen;
2784
+ fingerprint?: BrowserFingerprint;
2785
+ solveCaptchas?: boolean;
2786
+ proxies?: BrowserProxy[];
2787
+ extensionPath?: string;
2788
+ constructor(useStealth?: boolean, userAgent?: string, viewport?: BrowserViewport, screen?: BrowserScreen, fingerprint?: BrowserFingerprint, solveCaptchas?: boolean, proxies?: BrowserProxy[]);
2789
+ toMap(): Record<string, any>;
2790
+ fromMap(m: Record<string, any> | null | undefined): BrowserOptionClass;
2791
+ }
2792
+ declare class Browser {
2793
+ private session;
2794
+ private _endpointUrl;
2795
+ private _initialized;
2796
+ private _option;
2797
+ agent: BrowserAgent;
2798
+ constructor(session: Session);
2799
+ /**
2800
+ * Initialize the browser instance with the given options.
2801
+ * Returns true if successful, false otherwise.
2802
+ */
2803
+ initialize(option: BrowserOptionClass | BrowserOption): boolean;
2804
+ /**
2805
+ * Initialize the browser instance with the given options asynchronously.
2806
+ * Returns true if successful, false otherwise.
2807
+ */
2808
+ initializeAsync(option: BrowserOptionClass | BrowserOption): Promise<boolean>;
2809
+ /**
2810
+ * Returns the endpoint URL if the browser is initialized, otherwise throws an exception.
2811
+ * When initialized, always fetches the latest CDP url from session.getLink().
2812
+ */
2813
+ getEndpointUrl(): Promise<string>;
2814
+ /**
2815
+ * Returns the current BrowserOption used to initialize the browser, or null if not set.
2816
+ */
2817
+ getOption(): BrowserOptionClass | null;
2818
+ /**
2819
+ * Returns true if the browser was initialized, false otherwise.
2820
+ */
2821
+ isInitialized(): boolean;
2822
+ /**
2823
+ * Stop the browser instance, internal use only.
2824
+ */
2825
+ private _stopBrowser;
2496
2826
  }
2497
2827
 
2498
2828
  /**
@@ -2521,7 +2851,8 @@ declare class Code {
2521
2851
  *
2522
2852
  * @param code - The code to execute.
2523
2853
  * @param language - The programming language of the code. Must be either 'python' or 'javascript'.
2524
- * @param timeoutS - The timeout for the code execution in seconds. Default is 300s.
2854
+ * @param timeoutS - The timeout for the code execution in seconds. Default is 60s.
2855
+ * Note: Due to gateway limitations, each request cannot exceed 60 seconds.
2525
2856
  * @returns CodeExecutionResult with code execution output and requestId
2526
2857
  * @throws Error if an unsupported language is specified.
2527
2858
  */
@@ -2558,25 +2889,152 @@ declare class Command {
2558
2889
  executeCommand(command: string, timeoutMs?: number): Promise<CommandResult>;
2559
2890
  }
2560
2891
 
2561
- interface ContextStatusData {
2562
- contextId: string;
2563
- path: string;
2564
- errorMessage: string;
2565
- status: string;
2566
- startTime: number;
2567
- finishTime: number;
2568
- taskType: string;
2569
- }
2892
+ /**
2893
+ * Computer module for desktop UI automation.
2894
+ * Provides mouse, keyboard, and screen operations for desktop environments.
2895
+ */
2896
+
2897
+ declare enum MouseButton {
2898
+ LEFT = "left",
2899
+ RIGHT = "right",
2900
+ MIDDLE = "middle",
2901
+ DOUBLE_LEFT = "double_left"
2902
+ }
2903
+ declare enum ScrollDirection {
2904
+ UP = "up",
2905
+ DOWN = "down",
2906
+ LEFT = "left",
2907
+ RIGHT = "right"
2908
+ }
2909
+ interface BoolResult$1 extends OperationResult {
2910
+ data?: boolean;
2911
+ }
2912
+ interface CursorPosition extends OperationResult {
2913
+ x: number;
2914
+ y: number;
2915
+ }
2916
+ interface ScreenSize extends OperationResult {
2917
+ width: number;
2918
+ height: number;
2919
+ dpiScalingFactor: number;
2920
+ }
2921
+ interface ScreenshotResult$1 extends OperationResult {
2922
+ data: string;
2923
+ }
2924
+ interface ComputerSession {
2925
+ callMcpTool(toolName: string, args: Record<string, any>): Promise<any>;
2926
+ sessionId: string;
2927
+ getAPIKey(): string;
2928
+ getSessionId(): string;
2929
+ }
2930
+ declare class Computer {
2931
+ private session;
2932
+ constructor(session: ComputerSession);
2933
+ /**
2934
+ * Click mouse at specified coordinates.
2935
+ */
2936
+ clickMouse(x: number, y: number, button?: MouseButton | string): Promise<BoolResult$1>;
2937
+ /**
2938
+ * Move mouse to specified coordinates.
2939
+ */
2940
+ moveMouse(x: number, y: number): Promise<BoolResult$1>;
2941
+ /**
2942
+ * Drag mouse from one position to another.
2943
+ */
2944
+ dragMouse(fromX: number, fromY: number, toX: number, toY: number, button?: MouseButton | string): Promise<BoolResult$1>;
2945
+ /**
2946
+ * Scroll at specified coordinates.
2947
+ */
2948
+ scroll(x: number, y: number, direction?: ScrollDirection | string, amount?: number): Promise<BoolResult$1>;
2949
+ /**
2950
+ * Input text.
2951
+ */
2952
+ inputText(text: string): Promise<BoolResult$1>;
2953
+ /**
2954
+ * Press keys.
2955
+ */
2956
+ pressKeys(keys: string[], hold?: boolean): Promise<BoolResult$1>;
2957
+ /**
2958
+ * Release keys.
2959
+ */
2960
+ releaseKeys(keys: string[]): Promise<BoolResult$1>;
2961
+ /**
2962
+ * Get cursor position.
2963
+ */
2964
+ getCursorPosition(): Promise<CursorPosition>;
2965
+ /**
2966
+ * Get screen size.
2967
+ */
2968
+ getScreenSize(): Promise<ScreenSize>;
2969
+ /**
2970
+ * Take a screenshot.
2971
+ */
2972
+ screenshot(): Promise<ScreenshotResult$1>;
2973
+ /**
2974
+ * Lists all root windows.
2975
+ */
2976
+ listRootWindows(timeoutMs?: number): Promise<WindowListResult>;
2977
+ /**
2978
+ * Gets the currently active window.
2979
+ */
2980
+ getActiveWindow(timeoutMs?: number): Promise<WindowInfoResult>;
2981
+ /**
2982
+ * Activates the specified window.
2983
+ */
2984
+ activateWindow(windowId: number): Promise<BoolResult$2>;
2985
+ /**
2986
+ * Closes the specified window.
2987
+ */
2988
+ closeWindow(windowId: number): Promise<BoolResult$2>;
2989
+ /**
2990
+ * Maximizes the specified window.
2991
+ */
2992
+ maximizeWindow(windowId: number): Promise<BoolResult$2>;
2993
+ /**
2994
+ * Minimizes the specified window.
2995
+ */
2996
+ minimizeWindow(windowId: number): Promise<BoolResult$2>;
2997
+ /**
2998
+ * Restores the specified window.
2999
+ */
3000
+ restoreWindow(windowId: number): Promise<BoolResult$2>;
3001
+ /**
3002
+ * Resizes the specified window.
3003
+ */
3004
+ resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult$2>;
3005
+ /**
3006
+ * Makes the specified window fullscreen.
3007
+ */
3008
+ fullscreenWindow(windowId: number): Promise<BoolResult$2>;
3009
+ /**
3010
+ * Toggles focus mode on or off.
3011
+ */
3012
+ focusMode(on: boolean): Promise<BoolResult$2>;
3013
+ }
3014
+
3015
+ interface ContextStatusData {
3016
+ contextId: string;
3017
+ path: string;
3018
+ errorMessage: string;
3019
+ status: string;
3020
+ startTime: number;
3021
+ finishTime: number;
3022
+ taskType: string;
3023
+ }
2570
3024
  interface ContextStatusItem {
2571
3025
  type: string;
2572
3026
  data: string;
2573
3027
  }
2574
3028
  interface ContextInfoResult extends ApiResponse {
3029
+ success?: boolean;
2575
3030
  contextStatusData: ContextStatusData[];
3031
+ errorMessage?: string;
2576
3032
  }
2577
3033
  interface ContextSyncResult extends ApiResponse {
2578
3034
  success: boolean;
3035
+ errorMessage?: string;
2579
3036
  }
3037
+ type SyncCallback = (success: boolean) => void;
2580
3038
  interface SessionInterface {
2581
3039
  getAPIKey(): string;
2582
3040
  getClient(): Client;
@@ -2587,11 +3045,54 @@ declare class ContextManager {
2587
3045
  constructor(session: SessionInterface);
2588
3046
  info(): Promise<ContextInfoResult>;
2589
3047
  infoWithParams(contextId?: string, path?: string, taskType?: string): Promise<ContextInfoResult>;
2590
- sync(): Promise<ContextSyncResult>;
2591
- syncWithParams(contextId?: string, path?: string, mode?: string): Promise<ContextSyncResult>;
3048
+ sync(contextId?: string, path?: string, mode?: string, callback?: SyncCallback, maxRetries?: number, retryInterval?: number): Promise<ContextSyncResult>;
3049
+ /**
3050
+ * Polls the info interface to check if sync is completed and calls callback.
3051
+ */
3052
+ private pollForCompletion;
3053
+ /**
3054
+ * Async version of polling for sync completion.
3055
+ */
3056
+ private pollForCompletionAsync;
3057
+ /**
3058
+ * Sleep utility function for TypeScript
3059
+ */
3060
+ private sleep;
2592
3061
  }
2593
3062
  declare function newContextManager(session: SessionInterface): ContextManager;
2594
3063
 
3064
+ /**
3065
+ * Represents a single file change event
3066
+ */
3067
+ interface FileChangeEvent {
3068
+ eventType: string;
3069
+ path: string;
3070
+ pathType: string;
3071
+ }
3072
+ /**
3073
+ * Result of file change detection operations
3074
+ */
3075
+ interface FileChangeResult extends ApiResponse {
3076
+ events: FileChangeEvent[];
3077
+ rawData: string;
3078
+ }
3079
+ /**
3080
+ * Helper functions for FileChangeEvent
3081
+ */
3082
+ declare class FileChangeEventHelper {
3083
+ static toString(event: FileChangeEvent): string;
3084
+ static toDict(event: FileChangeEvent): Record<string, string>;
3085
+ static fromDict(data: Record<string, any>): FileChangeEvent;
3086
+ }
3087
+ /**
3088
+ * Helper functions for FileChangeResult
3089
+ */
3090
+ declare class FileChangeResultHelper {
3091
+ static hasChanges(result: FileChangeResult): boolean;
3092
+ static getModifiedFiles(result: FileChangeResult): string[];
3093
+ static getCreatedFiles(result: FileChangeResult): string[];
3094
+ static getDeletedFiles(result: FileChangeResult): string[];
3095
+ }
2595
3096
  /**
2596
3097
  * FileInfo represents information about a file or directory
2597
3098
  */
@@ -2617,21 +3118,19 @@ interface DirectoryEntry {
2617
3118
  */
2618
3119
  declare class FileSystem {
2619
3120
  private session;
3121
+ private _fileTransfer;
2620
3122
  /**
2621
3123
  * Initialize a FileSystem object.
2622
3124
  *
2623
3125
  * @param session - The Session instance that this FileSystem belongs to.
2624
3126
  */
2625
- constructor(session: {
2626
- getAPIKey(): string;
2627
- getSessionId(): string;
2628
- callMcpTool(toolName: string, args: any): Promise<{
2629
- success: boolean;
2630
- data: string;
2631
- errorMessage: string;
2632
- requestId: string;
2633
- }>;
2634
- });
3127
+ constructor(session: Session);
3128
+ /**
3129
+ * Ensure FileTransfer is initialized with the current session.
3130
+ *
3131
+ * @returns The FileTransfer instance
3132
+ */
3133
+ private _ensureFileTransfer;
2635
3134
  /**
2636
3135
  * Creates a new directory at the specified path.
2637
3136
  * Corresponds to Python's create_directory() method
@@ -2639,7 +3138,7 @@ declare class FileSystem {
2639
3138
  * @param path - Path to the directory to create.
2640
3139
  * @returns BoolResult with creation result and requestId
2641
3140
  */
2642
- createDirectory(path: string): Promise<BoolResult>;
3141
+ createDirectory(path: string): Promise<BoolResult$2>;
2643
3142
  /**
2644
3143
  * Edits a file by replacing occurrences of oldText with newText.
2645
3144
  * Corresponds to Python's edit_file() method
@@ -2652,7 +3151,7 @@ declare class FileSystem {
2652
3151
  editFile(path: string, edits: Array<{
2653
3152
  oldText: string;
2654
3153
  newText: string;
2655
- }>, dryRun?: boolean): Promise<BoolResult>;
3154
+ }>, dryRun?: boolean): Promise<BoolResult$2>;
2656
3155
  /**
2657
3156
  * Gets information about a file or directory.
2658
3157
  * Corresponds to Python's get_file_info() method
@@ -2677,7 +3176,7 @@ declare class FileSystem {
2677
3176
  * @param destination - Path to the destination file or directory.
2678
3177
  * @returns BoolResult with move result and requestId
2679
3178
  */
2680
- moveFile(source: string, destination: string): Promise<BoolResult>;
3179
+ moveFile(source: string, destination: string): Promise<BoolResult$2>;
2681
3180
  /**
2682
3181
  * Internal method to read a file chunk. Used for chunked file operations.
2683
3182
  *
@@ -2729,7 +3228,140 @@ declare class FileSystem {
2729
3228
  * @param mode - Optional: Write mode. One of "overwrite", "append", or "create_new". Default is "overwrite".
2730
3229
  * @returns BoolResult indicating success or failure with requestId
2731
3230
  */
2732
- writeFile(path: string, content: string, mode?: string): Promise<BoolResult>;
3231
+ writeFile(path: string, content: string, mode?: string): Promise<BoolResult$2>;
3232
+ /**
3233
+ * Get file change information for the specified directory path
3234
+ */
3235
+ getFileChange(path: string): Promise<FileChangeResult>;
3236
+ /**
3237
+ * Parse raw JSON data into FileChangeEvent array
3238
+ */
3239
+ private parseFileChangeData;
3240
+ /**
3241
+ * Watch a directory for file changes and call the callback function when changes occur
3242
+ */
3243
+ watchDirectory(path: string, callback: (events: FileChangeEvent[]) => void, interval?: number, signal?: AbortSignal): Promise<void>;
3244
+ /**
3245
+ * Upload a file from local to remote path using pre-signed URLs.
3246
+ * This is a synchronous wrapper around the FileTransfer.upload method.
3247
+ *
3248
+ * @param localPath - Local file path to upload
3249
+ * @param remotePath - Remote file path to upload to
3250
+ * @param options - Optional parameters
3251
+ * @returns UploadResult with upload result and requestId
3252
+ */
3253
+ uploadFile(localPath: string, remotePath: string, options?: {
3254
+ contentType?: string;
3255
+ wait?: boolean;
3256
+ waitTimeout?: number;
3257
+ pollInterval?: number;
3258
+ progressCb?: (bytesTransferred: number) => void;
3259
+ }): Promise<any>;
3260
+ /**
3261
+ * Download a file from remote path to local path using pre-signed URLs.
3262
+ * This is a synchronous wrapper around the FileTransfer.download method.
3263
+ *
3264
+ * @param remotePath - Remote file path to download from
3265
+ * @param localPath - Local file path to download to
3266
+ * @param options - Optional parameters
3267
+ * @returns DownloadResult with download result and requestId
3268
+ */
3269
+ downloadFile(remotePath: string, localPath: string, options?: {
3270
+ overwrite?: boolean;
3271
+ wait?: boolean;
3272
+ waitTimeout?: number;
3273
+ pollInterval?: number;
3274
+ progressCb?: (bytesReceived: number) => void;
3275
+ }): Promise<any>;
3276
+ }
3277
+
3278
+ /**
3279
+ * Mobile module for mobile UI automation.
3280
+ * Provides touch, input, and app management operations for mobile environments.
3281
+ */
3282
+
3283
+ interface BoolResult extends OperationResult {
3284
+ data?: boolean;
3285
+ }
3286
+ interface UIElement$1 {
3287
+ text: string;
3288
+ className: string;
3289
+ bounds: {
3290
+ left: number;
3291
+ top: number;
3292
+ right: number;
3293
+ bottom: number;
3294
+ };
3295
+ }
3296
+ interface UIElementsResult extends OperationResult {
3297
+ elements: UIElement$1[];
3298
+ }
3299
+ interface InstalledApp {
3300
+ name: string;
3301
+ startCmd: string;
3302
+ workDirectory: string;
3303
+ }
3304
+ interface InstalledAppsResult extends OperationResult {
3305
+ apps: InstalledApp[];
3306
+ }
3307
+ interface Process {
3308
+ pid: number;
3309
+ pname: string;
3310
+ }
3311
+ interface ProcessResult extends OperationResult {
3312
+ processes: Process[];
3313
+ }
3314
+ interface ScreenshotResult extends OperationResult {
3315
+ data: string;
3316
+ }
3317
+ interface MobileSession {
3318
+ callMcpTool(toolName: string, args: Record<string, any>): Promise<any>;
3319
+ sessionId: string;
3320
+ getAPIKey(): string;
3321
+ }
3322
+ declare class Mobile {
3323
+ private session;
3324
+ constructor(session: MobileSession);
3325
+ /**
3326
+ * Tap at specified coordinates.
3327
+ */
3328
+ tap(x: number, y: number): Promise<BoolResult>;
3329
+ /**
3330
+ * Swipe from one position to another.
3331
+ */
3332
+ swipe(startX: number, startY: number, endX: number, endY: number, durationMs?: number): Promise<BoolResult>;
3333
+ /**
3334
+ * Input text.
3335
+ */
3336
+ inputText(text: string): Promise<BoolResult>;
3337
+ /**
3338
+ * Send Android key code.
3339
+ */
3340
+ sendKey(key: number): Promise<BoolResult>;
3341
+ /**
3342
+ * Get clickable UI elements.
3343
+ */
3344
+ getClickableUIElements(timeoutMs?: number): Promise<UIElementsResult>;
3345
+ /**
3346
+ * Get all UI elements.
3347
+ */
3348
+ getAllUIElements(timeoutMs?: number): Promise<UIElementsResult>;
3349
+ /**
3350
+ * Get installed apps.
3351
+ */
3352
+ getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<InstalledAppsResult>;
3353
+ /**
3354
+ * Start an app.
3355
+ */
3356
+ startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<ProcessResult>;
3357
+ /**
3358
+ * Stop app by package name.
3359
+ */
3360
+ stopAppByPName(pname: string): Promise<BoolResult>;
3361
+ /**
3362
+ * Take a screenshot.
3363
+ */
3364
+ screenshot(): Promise<ScreenshotResult>;
2733
3365
  }
2734
3366
 
2735
3367
  /**
@@ -2833,6 +3465,10 @@ interface UIElement {
2833
3465
  }
2834
3466
  /**
2835
3467
  * Handles UI operations in the AgentBay cloud environment.
3468
+ *
3469
+ * @deprecated This module is deprecated. Use Computer or Mobile modules instead.
3470
+ * - For desktop UI operations, use session.computer
3471
+ * - For mobile UI operations, use session.mobile
2836
3472
  */
2837
3473
  declare class UI {
2838
3474
  private session;
@@ -2864,8 +3500,10 @@ declare class UI {
2864
3500
  * Corresponds to Python's get_clickable_ui_elements() method
2865
3501
  *
2866
3502
  * @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
2867
- * @returns UIElementListResult with clickable UI elements and requestId
2868
- * @throws APIError if the operation fails.
3503
+ * @returns UIElementListResult with clickable elements and requestId
3504
+ * @throws Error if the operation fails.
3505
+ *
3506
+ * @deprecated Use session.computer.getClickableUIElements() for desktop or session.mobile.getClickableUIElements() for mobile instead.
2869
3507
  */
2870
3508
  getClickableUIElements(timeoutMs?: number): Promise<UIElementListResult>;
2871
3509
  /**
@@ -2873,8 +3511,10 @@ declare class UI {
2873
3511
  * Corresponds to Python's get_all_ui_elements() method
2874
3512
  *
2875
3513
  * @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
2876
- * @returns UIElementListResult with all UI elements and requestId
2877
- * @throws APIError if the operation fails.
3514
+ * @returns UIElementListResult with all elements and requestId
3515
+ * @throws Error if the operation fails.
3516
+ *
3517
+ * @deprecated Use session.computer.getAllUIElements() for desktop or session.mobile.getAllUIElements() for mobile instead.
2878
3518
  */
2879
3519
  getAllUIElements(timeoutMs?: number): Promise<UIElementListResult>;
2880
3520
  /**
@@ -2889,18 +3529,22 @@ declare class UI {
2889
3529
  * - 26 : POWER
2890
3530
  * - 82 : MENU
2891
3531
  * @returns BoolResult with success status and requestId
2892
- * @throws APIError if the operation fails.
3532
+ * @throws Error if the operation fails.
3533
+ *
3534
+ * @deprecated Use session.computer.pressKeys() for desktop or session.mobile.sendKey() for mobile instead.
2893
3535
  */
2894
- sendKey(key: number): Promise<BoolResult>;
3536
+ sendKey(key: number): Promise<BoolResult$2>;
2895
3537
  /**
2896
3538
  * Inputs text into the currently focused UI element.
2897
3539
  * Corresponds to Python's input_text() method
2898
3540
  *
2899
3541
  * @param text - The text to input
2900
3542
  * @returns BoolResult with success status and requestId
2901
- * @throws APIError if the operation fails.
3543
+ * @throws Error if the operation fails.
3544
+ *
3545
+ * @deprecated Use session.computer.inputText() for desktop or session.mobile.inputText() for mobile instead.
2902
3546
  */
2903
- inputText(text: string): Promise<BoolResult>;
3547
+ inputText(text: string): Promise<BoolResult$2>;
2904
3548
  /**
2905
3549
  * Performs a swipe gesture on the screen.
2906
3550
  * Corresponds to Python's swipe() method
@@ -2911,9 +3555,11 @@ declare class UI {
2911
3555
  * @param endY - The ending Y coordinate
2912
3556
  * @param durationMs - The duration of the swipe in milliseconds. Default is 300ms.
2913
3557
  * @returns BoolResult with success status and requestId
2914
- * @throws APIError if the operation fails.
3558
+ * @throws Error if the operation fails.
3559
+ *
3560
+ * @deprecated Use session.computer.dragMouse() for desktop or session.mobile.swipe() for mobile instead.
2915
3561
  */
2916
- swipe(startX: number, startY: number, endX: number, endY: number, durationMs?: number): Promise<BoolResult>;
3562
+ swipe(startX: number, startY: number, endX: number, endY: number, durationMs?: number): Promise<BoolResult$2>;
2917
3563
  /**
2918
3564
  * Clicks on the screen at the specified coordinates.
2919
3565
  * Corresponds to Python's click() method
@@ -2922,21 +3568,29 @@ declare class UI {
2922
3568
  * @param y - The Y coordinate
2923
3569
  * @param button - The mouse button to use. Default is 'left'
2924
3570
  * @returns BoolResult with success status and requestId
2925
- * @throws APIError if the operation fails.
3571
+ * @throws Error if the operation fails.
3572
+ *
3573
+ * @deprecated Use session.computer.clickMouse() for desktop or session.mobile.tap() for mobile instead.
2926
3574
  */
2927
- click(x: number, y: number, button?: string): Promise<BoolResult>;
3575
+ click(x: number, y: number, button?: string): Promise<BoolResult$2>;
2928
3576
  /**
2929
3577
  * Takes a screenshot of the current screen.
2930
3578
  * Corresponds to Python's screenshot() method
2931
3579
  *
2932
3580
  * @returns OperationResult with success status and requestId
2933
- * @throws APIError if the operation fails.
3581
+ * @throws Error if the operation fails.
3582
+ *
3583
+ * @deprecated Use session.computer.screenshot() for desktop or session.mobile.screenshot() for mobile instead.
2934
3584
  */
2935
3585
  screenshot(): Promise<OperationResult>;
2936
3586
  }
2937
3587
 
2938
3588
  /**
2939
3589
  * Handles window management operations in the AgentBay cloud environment.
3590
+ *
3591
+ * @deprecated This module is deprecated. Use Computer module instead.
3592
+ * - For desktop window operations, use session.computer
3593
+ * - Window operations are not available for mobile
2940
3594
  */
2941
3595
  declare class WindowManager {
2942
3596
  private session;
@@ -2966,40 +3620,60 @@ declare class WindowManager {
2966
3620
  *
2967
3621
  * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
2968
3622
  * @returns WindowListResult with windows array and requestId
3623
+ *
3624
+ * @deprecated Use session.computer.listRootWindows() instead.
2969
3625
  */
2970
3626
  listRootWindows(timeoutMs?: number): Promise<WindowListResult>;
2971
3627
  /**
2972
- * Gets the currently active window.
2973
- * Corresponds to Python's get_active_window() method
3628
+ * Lists all windows in the system.
3629
+ * Corresponds to Python's list_all_windows() method
2974
3630
  *
2975
3631
  * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
2976
- * @returns WindowInfoResult with active window data and requestId
3632
+ * @returns WindowListResult with windows array and requestId
3633
+ *
3634
+ * @deprecated Use session.computer.listAllWindows() instead.
2977
3635
  */
2978
- getActiveWindow(timeoutMs?: number): Promise<WindowInfoResult>;
3636
+ listAllWindows(timeoutMs?: number): Promise<WindowListResult>;
3637
+ /**
3638
+ * Gets information about a specific window.
3639
+ * Corresponds to Python's get_window_info() method
3640
+ *
3641
+ * @param windowId - The ID of the window to get information for.
3642
+ * @returns WindowInfoResult with window information and requestId
3643
+ *
3644
+ * @deprecated Use session.computer.getWindowInfo() instead.
3645
+ */
3646
+ getWindowInfo(windowId: number): Promise<WindowInfoResult>;
2979
3647
  /**
2980
- * Activates a window by ID.
3648
+ * Activates a window by bringing it to the foreground.
2981
3649
  * Corresponds to Python's activate_window() method
2982
3650
  *
2983
- * @param windowId The ID of the window to activate.
2984
- * @returns BoolResult with requestId
3651
+ * @param windowId - The ID of the window to activate.
3652
+ * @returns BoolResult with success status and requestId
3653
+ *
3654
+ * @deprecated Use session.computer.activateWindow() instead.
2985
3655
  */
2986
- activateWindow(windowId: number): Promise<BoolResult>;
3656
+ activateWindow(windowId: number): Promise<BoolResult$2>;
2987
3657
  /**
2988
- * Maximizes a window by ID.
3658
+ * Maximizes a window.
2989
3659
  * Corresponds to Python's maximize_window() method
2990
3660
  *
2991
- * @param windowId The ID of the window to maximize.
2992
- * @returns BoolResult with requestId
3661
+ * @param windowId - The ID of the window to maximize.
3662
+ * @returns BoolResult with success status and requestId
3663
+ *
3664
+ * @deprecated Use session.computer.maximizeWindow() instead.
2993
3665
  */
2994
- maximizeWindow(windowId: number): Promise<BoolResult>;
3666
+ maximizeWindow(windowId: number): Promise<BoolResult$2>;
2995
3667
  /**
2996
- * Minimizes a window by ID.
3668
+ * Minimizes a window.
2997
3669
  * Corresponds to Python's minimize_window() method
2998
3670
  *
2999
- * @param windowId The ID of the window to minimize.
3000
- * @returns BoolResult with requestId
3671
+ * @param windowId - The ID of the window to minimize.
3672
+ * @returns BoolResult with success status and requestId
3673
+ *
3674
+ * @deprecated Use session.computer.minimizeWindow() instead.
3001
3675
  */
3002
- minimizeWindow(windowId: number): Promise<BoolResult>;
3676
+ minimizeWindow(windowId: number): Promise<BoolResult$2>;
3003
3677
  /**
3004
3678
  * Restores a window by ID.
3005
3679
  * Corresponds to Python's restore_window() method
@@ -3007,15 +3681,17 @@ declare class WindowManager {
3007
3681
  * @param windowId The ID of the window to restore.
3008
3682
  * @returns BoolResult with requestId
3009
3683
  */
3010
- restoreWindow(windowId: number): Promise<BoolResult>;
3684
+ restoreWindow(windowId: number): Promise<BoolResult$2>;
3011
3685
  /**
3012
- * Closes a window by ID.
3686
+ * Closes a window.
3013
3687
  * Corresponds to Python's close_window() method
3014
3688
  *
3015
- * @param windowId The ID of the window to close.
3016
- * @returns BoolResult with requestId
3689
+ * @param windowId - The ID of the window to close.
3690
+ * @returns BoolResult with success status and requestId
3691
+ *
3692
+ * @deprecated Use session.computer.closeWindow() instead.
3017
3693
  */
3018
- closeWindow(windowId: number): Promise<BoolResult>;
3694
+ closeWindow(windowId: number): Promise<BoolResult$2>;
3019
3695
  /**
3020
3696
  * Sets a window to fullscreen by ID.
3021
3697
  * Corresponds to Python's fullscreen_window() method
@@ -3023,17 +3699,31 @@ declare class WindowManager {
3023
3699
  * @param windowId The ID of the window to set to fullscreen.
3024
3700
  * @returns BoolResult with requestId
3025
3701
  */
3026
- fullscreenWindow(windowId: number): Promise<BoolResult>;
3702
+ fullscreenWindow(windowId: number): Promise<BoolResult$2>;
3027
3703
  /**
3028
- * Resizes a window by ID.
3704
+ * Resizes a window to the specified dimensions.
3029
3705
  * Corresponds to Python's resize_window() method
3030
3706
  *
3031
- * @param windowId The ID of the window to resize.
3032
- * @param width The new width of the window.
3033
- * @param height The new height of the window.
3034
- * @returns BoolResult with requestId
3707
+ * @param windowId - The ID of the window to resize.
3708
+ * @param width - The new width of the window.
3709
+ * @param height - The new height of the window.
3710
+ * @returns BoolResult with success status and requestId
3711
+ *
3712
+ * @deprecated Use session.computer.resizeWindow() instead.
3035
3713
  */
3036
- resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult>;
3714
+ resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult$2>;
3715
+ /**
3716
+ * Moves a window to the specified position.
3717
+ * Corresponds to Python's move_window() method
3718
+ *
3719
+ * @param windowId - The ID of the window to move.
3720
+ * @param x - The new x coordinate of the window.
3721
+ * @param y - The new y coordinate of the window.
3722
+ * @returns BoolResult with success status and requestId
3723
+ *
3724
+ * @deprecated Use session.computer.moveWindow() instead.
3725
+ */
3726
+ moveWindow(windowId: number, x: number, y: number): Promise<BoolResult$2>;
3037
3727
  /**
3038
3728
  * Enables or disables focus mode.
3039
3729
  * Corresponds to Python's focus_mode() method
@@ -3041,168 +3731,17 @@ declare class WindowManager {
3041
3731
  * @param on Whether to enable focus mode.
3042
3732
  * @returns BoolResult with requestId
3043
3733
  */
3044
- focusMode(on: boolean): Promise<BoolResult>;
3045
- }
3046
-
3047
- interface ActOptions {
3048
- action: string;
3049
- timeoutMS?: number;
3050
- iframes?: boolean;
3051
- domSettleTimeoutMS?: number;
3052
- }
3053
- interface ObserveOptions {
3054
- instruction: string;
3055
- returnActions?: number;
3056
- iframes?: boolean;
3057
- domSettleTimeoutMS?: number;
3058
- }
3059
- interface ExtractOptions<T = any> {
3060
- instruction: string;
3061
- schema: new (...args: any[]) => T;
3062
- use_text_extract: boolean;
3063
- selector?: string;
3064
- iframe?: boolean;
3065
- domSettleTimeoutsMS?: number;
3066
- }
3067
- declare class ActResult {
3068
- success: boolean;
3069
- message: string;
3070
- action: string;
3071
- constructor(success: boolean, message: string, action: string);
3072
- }
3073
- declare class ObserveResult {
3074
- selector: string;
3075
- description: string;
3076
- method: string;
3077
- args: Record<string, any>;
3078
- constructor(selector: string, description: string, method: string, args: Record<string, any>);
3079
- }
3080
- declare class BrowserAgent {
3081
- private session;
3082
- private browser;
3083
- constructor(session: Session, browser: Browser);
3084
- /**
3085
- * Perform an action on the given Playwright Page object, using ActOptions to configure behavior.
3086
- * Returns the result of the action.
3087
- */
3088
- act(page: any, options: ActOptions): Promise<ActResult>;
3089
- /**
3090
- * Async version of act method for performing actions on the given Playwright Page object.
3091
- */
3092
- actAsync(page: any, options: ActOptions): Promise<ActResult>;
3093
- /**
3094
- * Observe elements or state on the given Playwright Page object.
3095
- * Returns a tuple containing (success, results).
3096
- */
3097
- observe(page: any, options: ObserveOptions): Promise<[boolean, ObserveResult[]]>;
3098
- /**
3099
- * Async version of observe method.
3100
- */
3101
- observeAsync(page: any, options: ObserveOptions): Promise<[boolean, ObserveResult[]]>;
3102
- /**
3103
- * Extract information from the given Playwright Page object.
3104
- */
3105
- extract<T>(page: any, options: ExtractOptions<T>): Promise<[boolean, T[]]>;
3106
- /**
3107
- * Async version of extract method.
3108
- */
3109
- extractAsync<T>(page: any, options: ExtractOptions<T>): Promise<[boolean, T[]]>;
3110
- private _getPageAndContextIndex;
3111
- private _getPageAndContextIndexAsync;
3112
- private _callMcpTool;
3113
- }
3114
-
3115
- interface BrowserViewport {
3116
- width: number;
3117
- height: number;
3118
- }
3119
- interface BrowserScreen {
3120
- width: number;
3121
- height: number;
3122
- }
3123
- interface BrowserFingerprint {
3124
- devices?: Array<'desktop' | 'mobile'>;
3125
- operatingSystems?: Array<'windows' | 'macos' | 'linux' | 'android' | 'ios'>;
3126
- locales?: string[];
3127
- }
3128
- interface BrowserProxy {
3129
- type: 'custom' | 'wuying';
3130
- server?: string;
3131
- username?: string;
3132
- password?: string;
3133
- strategy?: 'restricted' | 'polling';
3134
- pollsize?: number;
3135
- toMap(): Record<string, any>;
3136
- }
3137
- declare class BrowserProxyClass implements BrowserProxy {
3138
- type: 'custom' | 'wuying';
3139
- server?: string;
3140
- username?: string;
3141
- password?: string;
3142
- strategy?: 'restricted' | 'polling';
3143
- pollsize?: number;
3144
- constructor(proxyType: 'custom' | 'wuying', server?: string, username?: string, password?: string, strategy?: 'restricted' | 'polling', pollsize?: number);
3145
- toMap(): Record<string, any>;
3146
- static fromMap(m: Record<string, any> | null | undefined): BrowserProxyClass | null;
3147
- }
3148
- interface BrowserOption {
3149
- persistentPath?: string;
3150
- useStealth?: boolean;
3151
- userAgent?: string;
3152
- viewport?: BrowserViewport;
3153
- screen?: BrowserScreen;
3154
- fingerprint?: BrowserFingerprint;
3155
- proxies?: BrowserProxy[];
3156
- /** Path to the extensions directory. Defaults to "/tmp/extensions/" */
3157
- extensionPath?: string;
3158
- }
3159
- declare class BrowserOptionClass implements BrowserOption {
3160
- persistentPath?: string;
3161
- useStealth?: boolean;
3162
- userAgent?: string;
3163
- viewport?: BrowserViewport;
3164
- screen?: BrowserScreen;
3165
- fingerprint?: BrowserFingerprint;
3166
- proxies?: BrowserProxy[];
3167
- extensionPath?: string;
3168
- constructor(useStealth?: boolean, userAgent?: string, viewport?: BrowserViewport, screen?: BrowserScreen, fingerprint?: BrowserFingerprint, proxies?: BrowserProxy[]);
3169
- toMap(): Record<string, any>;
3170
- fromMap(m: Record<string, any> | null | undefined): BrowserOptionClass;
3171
- }
3172
- declare class Browser {
3173
- private session;
3174
- private _endpointUrl;
3175
- private _initialized;
3176
- private _option;
3177
- agent: BrowserAgent;
3178
- constructor(session: Session);
3179
- /**
3180
- * Initialize the browser instance with the given options.
3181
- * Returns true if successful, false otherwise.
3182
- */
3183
- initialize(option: BrowserOptionClass | BrowserOption): boolean;
3184
- /**
3185
- * Initialize the browser instance with the given options asynchronously.
3186
- * Returns true if successful, false otherwise.
3187
- */
3188
- initializeAsync(option: BrowserOptionClass | BrowserOption): Promise<boolean>;
3189
- /**
3190
- * Returns the endpoint URL if the browser is initialized, otherwise throws an exception.
3191
- * When initialized, always fetches the latest CDP url from session.getLink().
3192
- */
3193
- getEndpointUrl(): Promise<string>;
3194
- /**
3195
- * Returns the current BrowserOption used to initialize the browser, or null if not set.
3196
- */
3197
- getOption(): BrowserOptionClass | null;
3198
- /**
3199
- * Returns true if the browser was initialized, false otherwise.
3200
- */
3201
- isInitialized(): boolean;
3734
+ focusMode(on: boolean): Promise<BoolResult$2>;
3202
3735
  /**
3203
- * Stop the browser instance, internal use only.
3736
+ * Gets the currently active window.
3737
+ * Corresponds to Python's get_active_window() method
3738
+ *
3739
+ * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
3740
+ * @returns WindowInfoResult with active window information and requestId
3741
+ *
3742
+ * @deprecated Use session.computer.getActiveWindow() instead.
3204
3743
  */
3205
- private _stopBrowser;
3744
+ getActiveWindow(timeoutMs?: number): Promise<WindowInfoResult>;
3206
3745
  }
3207
3746
 
3208
3747
  /**
@@ -3227,9 +3766,13 @@ interface McpToolsResult extends OperationResult {
3227
3766
  declare class Session {
3228
3767
  private agentBay;
3229
3768
  sessionId: string;
3769
+ fileTransferContextId: string | null;
3230
3770
  isVpc: boolean;
3231
3771
  networkInterfaceIp: string;
3232
3772
  httpPort: string;
3773
+ token: string;
3774
+ resourceUrl: string;
3775
+ enableBrowserReplay: boolean;
3233
3776
  fileSystem: FileSystem;
3234
3777
  command: Command;
3235
3778
  code: Code;
@@ -3237,6 +3780,8 @@ declare class Session {
3237
3780
  application: Application;
3238
3781
  window: WindowManager;
3239
3782
  ui: UI;
3783
+ computer: Computer;
3784
+ mobile: Mobile;
3240
3785
  agent: Agent;
3241
3786
  browser: Browser;
3242
3787
  context: ContextManager;
@@ -3248,6 +3793,10 @@ declare class Session {
3248
3793
  * @param sessionId - The ID of this session.
3249
3794
  */
3250
3795
  constructor(agentBay: AgentBay, sessionId: string);
3796
+ /**
3797
+ * Return the AgentBay instance that created this session.
3798
+ */
3799
+ getAgentBay(): AgentBay;
3251
3800
  /**
3252
3801
  * Return the API key for this session.
3253
3802
  */
@@ -3272,6 +3821,10 @@ declare class Session {
3272
3821
  * Return the HTTP port for VPC sessions.
3273
3822
  */
3274
3823
  getHttpPort(): string;
3824
+ /**
3825
+ * Return the token for VPC sessions.
3826
+ */
3827
+ getToken(): string;
3275
3828
  /**
3276
3829
  * Find the server that provides the given tool.
3277
3830
  */
@@ -3316,7 +3869,7 @@ declare class Session {
3316
3869
  * Get a link associated with the current session.
3317
3870
  *
3318
3871
  * @param protocolType - Optional protocol type to use for the link
3319
- * @param port - Optional port to use for the link
3872
+ * @param port - Optional port to use for the link (must be in range [30100, 30199])
3320
3873
  * @returns OperationResult containing the link as data and request ID
3321
3874
  * @throws Error if the operation fails (matching Python SessionError)
3322
3875
  */
@@ -3325,7 +3878,7 @@ declare class Session {
3325
3878
  * Asynchronously get a link associated with the current session.
3326
3879
  *
3327
3880
  * @param protocolType - Optional protocol type to use for the link
3328
- * @param port - Optional port to use for the link
3881
+ * @param port - Optional port to use for the link (must be in range [30100, 30199])
3329
3882
  * @returns OperationResult containing the link as data and request ID
3330
3883
  * @throws Error if the operation fails (matching Python SessionError)
3331
3884
  */
@@ -3684,8 +4237,10 @@ interface CreateSessionParamsConfig {
3684
4237
  browserContext?: BrowserContext;
3685
4238
  /** Whether to create a VPC-based session. Defaults to false. */
3686
4239
  isVpc?: boolean;
3687
- /** MCP policy id to apply when creating the session. */
3688
- mcpPolicyId?: string;
4240
+ /** Policy id to apply when creating the session. */
4241
+ policyId?: string;
4242
+ /** Whether to enable browser recording for the session. Defaults to false. */
4243
+ enableBrowserReplay?: boolean;
3689
4244
  }
3690
4245
  /**
3691
4246
  * CreateSessionParams provides a way to configure the parameters for creating a new session
@@ -3705,8 +4260,10 @@ declare class CreateSessionParams$1 implements CreateSessionParamsConfig {
3705
4260
  browserContext?: BrowserContext;
3706
4261
  /** Whether to create a VPC-based session. Defaults to false. */
3707
4262
  isVpc: boolean;
3708
- /** MCP policy id to apply when creating the session. */
3709
- mcpPolicyId?: string;
4263
+ /** Policy id to apply when creating the session. */
4264
+ policyId?: string;
4265
+ /** Whether to enable browser recording for the session. Defaults to false. */
4266
+ enableBrowserReplay: boolean;
3710
4267
  constructor();
3711
4268
  /**
3712
4269
  * WithLabels sets the labels for the session parameters and returns the updated parameters.
@@ -3725,9 +4282,17 @@ declare class CreateSessionParams$1 implements CreateSessionParamsConfig {
3725
4282
  */
3726
4283
  withIsVpc(isVpc: boolean): CreateSessionParams$1;
3727
4284
  /**
3728
- * WithMcpPolicyId sets the MCP policy id for the session parameters and returns the updated parameters.
4285
+ * WithPolicyId sets the policy id for the session parameters and returns the updated parameters.
3729
4286
  */
3730
- withMcpPolicyId(mcpPolicyId: string): CreateSessionParams$1;
4287
+ withPolicyId(policyId: string): CreateSessionParams$1;
4288
+ /**
4289
+ * WithenableBrowserReplay sets the browser recording flag for the session parameters and returns the updated parameters.
4290
+ */
4291
+ withEnableBrowserReplay(enableBrowserReplay: boolean): CreateSessionParams$1;
4292
+ /**
4293
+ * Alias for withEnableBrowserReplay for backward compatibility.
4294
+ */
4295
+ withEnableRecord(enableRecord: boolean): CreateSessionParams$1;
3731
4296
  /**
3732
4297
  * GetLabelsJSON returns the labels as a JSON string.
3733
4298
  * Returns an object with success status and result/error message to match Go version behavior.
@@ -3775,11 +4340,10 @@ interface ListSessionParams {
3775
4340
  }
3776
4341
  /**
3777
4342
  * Result type for session listing with pagination information
3778
- * Maintain consistency with the existing TypeScript SDK return structure and use the data field
3779
4343
  */
3780
4344
  interface SessionListResult extends ApiResponse {
3781
- /** Array of sessions */
3782
- data: Session[];
4345
+ /** Array of session IDs */
4346
+ sessionIds: string[];
3783
4347
  /** Token for the next page (if available) */
3784
4348
  nextToken?: string;
3785
4349
  /** Number of results per page */
@@ -3797,7 +4361,8 @@ interface CreateSessionParams {
3797
4361
  contextSync?: ContextSync[];
3798
4362
  browserContext?: BrowserContext;
3799
4363
  isVpc?: boolean;
3800
- mcpPolicyId?: string;
4364
+ policyId?: string;
4365
+ enableBrowserReplay?: boolean;
3801
4366
  }
3802
4367
  /**
3803
4368
  * Main class for interacting with the AgentBay cloud runtime environment.
@@ -3805,9 +4370,9 @@ interface CreateSessionParams {
3805
4370
  declare class AgentBay {
3806
4371
  private apiKey;
3807
4372
  private client;
3808
- private regionId;
3809
4373
  private endpoint;
3810
4374
  private sessions;
4375
+ private fileTransferContext;
3811
4376
  /**
3812
4377
  * Context service for managing persistent contexts.
3813
4378
  */
@@ -3818,11 +4383,20 @@ declare class AgentBay {
3818
4383
  * @param options - Configuration options
3819
4384
  * @param options.apiKey - API key for authentication. If not provided, will look for AGENTBAY_API_KEY environment variable.
3820
4385
  * @param options.config - Custom configuration object. If not provided, will use environment-based configuration.
4386
+ * @param options.envFile - Custom path to .env file. If not provided, will search upward from current directory.
3821
4387
  */
3822
4388
  constructor(options?: {
3823
4389
  apiKey?: string;
3824
4390
  config?: Config;
4391
+ envFile?: string;
3825
4392
  });
4393
+ /**
4394
+ * Update browser replay context with AppInstanceId from response data.
4395
+ *
4396
+ * @param responseData - Response data containing AppInstanceId
4397
+ * @param recordContextId - The record context ID to update
4398
+ */
4399
+ private _updateBrowserReplayContext;
3826
4400
  /**
3827
4401
  * Create a new session in the AgentBay cloud environment.
3828
4402
  *
@@ -3830,22 +4404,49 @@ declare class AgentBay {
3830
4404
  * @returns SessionResult containing the created session and request ID
3831
4405
  */
3832
4406
  create(params?: CreateSessionParams): Promise<SessionResult>;
3833
- /**
3834
- * List all available sessions.
3835
- *
3836
- * @returns A list of session objects.
3837
- */
3838
- list(): Session[];
3839
4407
  /**
3840
4408
  * List sessions filtered by the provided labels with pagination support.
3841
4409
  * It returns sessions that match all the specified labels.
3842
4410
  *
4411
+ * @deprecated This method is deprecated and will be removed in a future version. Use list() instead.
4412
+ *
3843
4413
  * **Breaking Change**: This method currently only accepts ListSessionParams parameters,
3844
4414
  *
3845
4415
  * @param params - Parameters including labels and pagination options (required)
3846
4416
  * @returns API response with sessions list and pagination info
3847
4417
  */
3848
4418
  listByLabels(params?: ListSessionParams): Promise<SessionListResult>;
4419
+ /**
4420
+ * Returns paginated list of session IDs filtered by labels.
4421
+ *
4422
+ * @param labels - Optional labels to filter sessions (defaults to empty object)
4423
+ * @param page - Optional page number for pagination (starting from 1, defaults to 1)
4424
+ * @param limit - Optional maximum number of items per page (defaults to 10)
4425
+ * @returns SessionListResult - Paginated list of session IDs that match the labels
4426
+ *
4427
+ * @example
4428
+ * ```typescript
4429
+ * const agentBay = new AgentBay({ apiKey: "your_api_key" });
4430
+ *
4431
+ * // List all sessions
4432
+ * const result = await agentBay.list();
4433
+ *
4434
+ * // List sessions with specific labels
4435
+ * const result = await agentBay.list({ project: "demo" });
4436
+ *
4437
+ * // List sessions with pagination
4438
+ * const result = await agentBay.list({ "my-label": "my-value" }, 2, 10);
4439
+ *
4440
+ * if (result.success) {
4441
+ * for (const sessionId of result.sessionIds) {
4442
+ * console.log(`Session ID: ${sessionId}`);
4443
+ * }
4444
+ * console.log(`Total count: ${result.totalCount}`);
4445
+ * console.log(`Request ID: ${result.requestId}`);
4446
+ * }
4447
+ * ```
4448
+ */
4449
+ list(labels?: Record<string, string>, page?: number, limit?: number): Promise<SessionListResult>;
3849
4450
  /**
3850
4451
  * Delete a session by session object.
3851
4452
  *
@@ -3859,6 +4460,32 @@ declare class AgentBay {
3859
4460
  * @param sessionId - The ID of the session to remove.
3860
4461
  */
3861
4462
  removeSession(sessionId: string): void;
4463
+ /**
4464
+ * Get session information by session ID.
4465
+ *
4466
+ * @param sessionId - The ID of the session to retrieve.
4467
+ * @returns GetSessionResult containing session information
4468
+ */
4469
+ getSession(sessionId: string): Promise<GetSessionResult>;
4470
+ /**
4471
+ * Get a session by its ID.
4472
+ *
4473
+ * This method retrieves a session by calling the GetSession API
4474
+ * and returns a SessionResult containing the Session object and request ID.
4475
+ *
4476
+ * @param sessionId - The ID of the session to retrieve
4477
+ * @returns Promise resolving to SessionResult with the Session instance, request ID, and success status
4478
+ *
4479
+ * @example
4480
+ * ```typescript
4481
+ * const result = await agentBay.get("my-session-id");
4482
+ * if (result.success) {
4483
+ * console.log(result.session.sessionId);
4484
+ * console.log(result.requestId);
4485
+ * }
4486
+ * ```
4487
+ */
4488
+ get(sessionId: string): Promise<SessionResult>;
3862
4489
  getClient(): Client;
3863
4490
  getAPIKey(): string;
3864
4491
  }
@@ -3942,4 +4569,4 @@ declare function log(message: string, ...args: any[]): void;
3942
4569
  */
3943
4570
  declare function logError(message: string, error?: any): void;
3944
4571
 
3945
- export { APIError, type ActOptions, ActResult, Agent, AgentBay, AgentBayError, 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, 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, DescribeContextFilesRequest, DescribeContextFilesResponse, DescribeContextFilesResponseBody, type DirectoryEntry, type DownloadPolicy, DownloadStrategy, type ExecutionResult, Extension, ExtensionOption, ExtensionsService, type ExtractOptions, type ExtractPolicy, ExtractPolicyClass, 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, InitBrowserRequest, InitBrowserResponse, InitBrowserResponseBody, InitBrowserResponseBodyData, type InstalledApp, KeyCode, ListContextsRequest, ListContextsResponse, ListContextsResponseBody, ListContextsResponseBodyData, ListMcpToolsRequest, ListMcpToolsResponse, ListMcpToolsResponseBody, type ListSessionParams, ListSessionRequest, ListSessionResponse, ListSessionResponseBody, ListSessionResponseBodyData, type McpSession, type McpToolResult, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, type ObserveOptions, ObserveResult, Oss, OssError, type Process, type QueryResult, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, Session, SessionError, type SessionInterface, SetLabelRequest, SetLabelResponse, SetLabelResponseBody, SyncContextRequest, SyncContextResponse, SyncContextResponseBody, type SyncPolicy, SyncPolicyImpl, UI, type UIElement, UIError, type UploadPolicy, UploadStrategy, type WhiteList, loadConfig, loadDotEnv, log, logError, newContextManager, newContextSync, newCreateSessionParams, newDeletePolicy, newDownloadPolicy, newExtractPolicy, newSyncPolicy, newSyncPolicyWithDefaults, newUploadPolicy };
4572
+ export { APIError, type ActOptions, ActResult, Agent, AgentBay, AgentBayError, 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, 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, DescribeContextFilesRequest, DescribeContextFilesResponse, DescribeContextFilesResponseBody, type DirectoryEntry, type DownloadPolicy, DownloadStrategy, type ExecutionResult, Extension, ExtensionOption, ExtensionsService, 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, 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 McpSession, type McpToolResult, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, type ObserveOptions, ObserveResult, Oss, OssError, type Process$1 as Process, type QueryResult, type RecyclePolicy, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, Session, SessionError, type SessionInterface, SetLabelRequest, SetLabelResponse, SetLabelResponseBody, type SyncCallback, SyncContextRequest, SyncContextResponse, SyncContextResponseBody, type SyncPolicy, SyncPolicyImpl, UI, type UIElement, UIError, type UploadPolicy, UploadStrategy, type WhiteList, WhiteListValidator, loadConfig, loadDotEnv, log, logError, newContextManager, newContextSync, newCreateSessionParams, newDeletePolicy, newDownloadPolicy, newExtractPolicy, newRecyclePolicy, newSyncPolicy, newSyncPolicyWithDefaults, newUploadPolicy, validateSyncPolicy };