wuying-agentbay-sdk 0.6.1 → 0.8.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/README.md +9 -10
- package/dist/index.cjs +837 -164
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +459 -64
- package/dist/index.d.ts +459 -64
- package/dist/index.mjs +815 -142
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1426,7 +1426,7 @@ declare class Client extends OpenApi {
|
|
|
1426
1426
|
[key: string]: string;
|
|
1427
1427
|
}, endpoint: string): string;
|
|
1428
1428
|
/**
|
|
1429
|
-
*
|
|
1429
|
+
* Call MCP tool
|
|
1430
1430
|
*
|
|
1431
1431
|
* @param request - CallMcpToolRequest
|
|
1432
1432
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1434,14 +1434,14 @@ declare class Client extends OpenApi {
|
|
|
1434
1434
|
*/
|
|
1435
1435
|
callMcpToolWithOptions(request: CallMcpToolRequest, runtime: $dara.RuntimeOptions): Promise<CallMcpToolResponse>;
|
|
1436
1436
|
/**
|
|
1437
|
-
*
|
|
1437
|
+
* Call MCP tool
|
|
1438
1438
|
*
|
|
1439
1439
|
* @param request - CallMcpToolRequest
|
|
1440
1440
|
* @returns CallMcpToolResponse
|
|
1441
1441
|
*/
|
|
1442
1442
|
callMcpTool(request: CallMcpToolRequest): Promise<CallMcpToolResponse>;
|
|
1443
1443
|
/**
|
|
1444
|
-
*
|
|
1444
|
+
* Create MCP session
|
|
1445
1445
|
*
|
|
1446
1446
|
* @param tmpReq - CreateMcpSessionRequest
|
|
1447
1447
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1449,14 +1449,14 @@ declare class Client extends OpenApi {
|
|
|
1449
1449
|
*/
|
|
1450
1450
|
createMcpSessionWithOptions(tmpReq: CreateMcpSessionRequest, runtime: $dara.RuntimeOptions): Promise<CreateMcpSessionResponse>;
|
|
1451
1451
|
/**
|
|
1452
|
-
*
|
|
1452
|
+
* Create MCP session
|
|
1453
1453
|
*
|
|
1454
1454
|
* @param request - CreateMcpSessionRequest
|
|
1455
1455
|
* @returns CreateMcpSessionResponse
|
|
1456
1456
|
*/
|
|
1457
1457
|
createMcpSession(request: CreateMcpSessionRequest): Promise<CreateMcpSessionResponse>;
|
|
1458
1458
|
/**
|
|
1459
|
-
*
|
|
1459
|
+
* Delete persistent context
|
|
1460
1460
|
*
|
|
1461
1461
|
* @param request - DeleteContextRequest
|
|
1462
1462
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1464,14 +1464,14 @@ declare class Client extends OpenApi {
|
|
|
1464
1464
|
*/
|
|
1465
1465
|
deleteContextWithOptions(request: DeleteContextRequest, runtime: $dara.RuntimeOptions): Promise<DeleteContextResponse>;
|
|
1466
1466
|
/**
|
|
1467
|
-
*
|
|
1467
|
+
* Delete persistent context
|
|
1468
1468
|
*
|
|
1469
1469
|
* @param request - DeleteContextRequest
|
|
1470
1470
|
* @returns DeleteContextResponse
|
|
1471
1471
|
*/
|
|
1472
1472
|
deleteContext(request: DeleteContextRequest): Promise<DeleteContextResponse>;
|
|
1473
1473
|
/**
|
|
1474
|
-
*
|
|
1474
|
+
* Get context
|
|
1475
1475
|
*
|
|
1476
1476
|
* @param request - GetContextRequest
|
|
1477
1477
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1479,14 +1479,14 @@ declare class Client extends OpenApi {
|
|
|
1479
1479
|
*/
|
|
1480
1480
|
getContextWithOptions(request: GetContextRequest, runtime: $dara.RuntimeOptions): Promise<GetContextResponse>;
|
|
1481
1481
|
/**
|
|
1482
|
-
*
|
|
1482
|
+
* Get context
|
|
1483
1483
|
*
|
|
1484
1484
|
* @param request - GetContextRequest
|
|
1485
1485
|
* @returns GetContextResponse
|
|
1486
1486
|
*/
|
|
1487
1487
|
getContext(request: GetContextRequest): Promise<GetContextResponse>;
|
|
1488
1488
|
/**
|
|
1489
|
-
*
|
|
1489
|
+
* Get context information
|
|
1490
1490
|
*
|
|
1491
1491
|
* @param request - GetContextInfoRequest
|
|
1492
1492
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1494,14 +1494,14 @@ declare class Client extends OpenApi {
|
|
|
1494
1494
|
*/
|
|
1495
1495
|
getContextInfoWithOptions(request: GetContextInfoRequest, runtime: $dara.RuntimeOptions): Promise<GetContextInfoResponse>;
|
|
1496
1496
|
/**
|
|
1497
|
-
*
|
|
1497
|
+
* Get context information
|
|
1498
1498
|
*
|
|
1499
1499
|
* @param request - GetContextInfoRequest
|
|
1500
1500
|
* @returns GetContextInfoResponse
|
|
1501
1501
|
*/
|
|
1502
1502
|
getContextInfo(request: GetContextInfoRequest): Promise<GetContextInfoResponse>;
|
|
1503
1503
|
/**
|
|
1504
|
-
*
|
|
1504
|
+
* Get labels
|
|
1505
1505
|
*
|
|
1506
1506
|
* @param request - GetLabelRequest
|
|
1507
1507
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1509,14 +1509,14 @@ declare class Client extends OpenApi {
|
|
|
1509
1509
|
*/
|
|
1510
1510
|
getLabelWithOptions(request: GetLabelRequest, runtime: $dara.RuntimeOptions): Promise<GetLabelResponse>;
|
|
1511
1511
|
/**
|
|
1512
|
-
*
|
|
1512
|
+
* Get labels
|
|
1513
1513
|
*
|
|
1514
1514
|
* @param request - GetLabelRequest
|
|
1515
1515
|
* @returns GetLabelResponse
|
|
1516
1516
|
*/
|
|
1517
1517
|
getLabel(request: GetLabelRequest): Promise<GetLabelResponse>;
|
|
1518
1518
|
/**
|
|
1519
|
-
*
|
|
1519
|
+
* Get forwarding link for specific port
|
|
1520
1520
|
*
|
|
1521
1521
|
* @param request - GetLinkRequest
|
|
1522
1522
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1524,14 +1524,14 @@ declare class Client extends OpenApi {
|
|
|
1524
1524
|
*/
|
|
1525
1525
|
getLinkWithOptions(request: GetLinkRequest, runtime: $dara.RuntimeOptions): Promise<GetLinkResponse>;
|
|
1526
1526
|
/**
|
|
1527
|
-
*
|
|
1527
|
+
* Get forwarding link for specific port
|
|
1528
1528
|
*
|
|
1529
1529
|
* @param request - GetLinkRequest
|
|
1530
1530
|
* @returns GetLinkResponse
|
|
1531
1531
|
*/
|
|
1532
1532
|
getLink(request: GetLinkRequest): Promise<GetLinkResponse>;
|
|
1533
1533
|
/**
|
|
1534
|
-
*
|
|
1534
|
+
* Get MCP resource information
|
|
1535
1535
|
*
|
|
1536
1536
|
* @param request - GetMcpResourceRequest
|
|
1537
1537
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1539,14 +1539,14 @@ declare class Client extends OpenApi {
|
|
|
1539
1539
|
*/
|
|
1540
1540
|
getMcpResourceWithOptions(request: GetMcpResourceRequest, runtime: $dara.RuntimeOptions): Promise<GetMcpResourceResponse>;
|
|
1541
1541
|
/**
|
|
1542
|
-
*
|
|
1542
|
+
* Get MCP resource information
|
|
1543
1543
|
*
|
|
1544
1544
|
* @param request - GetMcpResourceRequest
|
|
1545
1545
|
* @returns GetMcpResourceResponse
|
|
1546
1546
|
*/
|
|
1547
1547
|
getMcpResource(request: GetMcpResourceRequest): Promise<GetMcpResourceResponse>;
|
|
1548
1548
|
/**
|
|
1549
|
-
*
|
|
1549
|
+
* Get context list
|
|
1550
1550
|
*
|
|
1551
1551
|
* @param request - ListContextsRequest
|
|
1552
1552
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1554,7 +1554,7 @@ declare class Client extends OpenApi {
|
|
|
1554
1554
|
*/
|
|
1555
1555
|
listContextsWithOptions(request: ListContextsRequest, runtime: $dara.RuntimeOptions): Promise<ListContextsResponse>;
|
|
1556
1556
|
/**
|
|
1557
|
-
*
|
|
1557
|
+
* Get context list
|
|
1558
1558
|
*
|
|
1559
1559
|
* @param request - ListContextsRequest
|
|
1560
1560
|
* @returns ListContextsResponse
|
|
@@ -1576,7 +1576,7 @@ declare class Client extends OpenApi {
|
|
|
1576
1576
|
*/
|
|
1577
1577
|
listMcpTools(request: ListMcpToolsRequest): Promise<ListMcpToolsResponse>;
|
|
1578
1578
|
/**
|
|
1579
|
-
*
|
|
1579
|
+
* Query session list by label
|
|
1580
1580
|
*
|
|
1581
1581
|
* @param request - ListSessionRequest
|
|
1582
1582
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1584,14 +1584,14 @@ declare class Client extends OpenApi {
|
|
|
1584
1584
|
*/
|
|
1585
1585
|
listSessionWithOptions(request: ListSessionRequest, runtime: $dara.RuntimeOptions): Promise<ListSessionResponse>;
|
|
1586
1586
|
/**
|
|
1587
|
-
*
|
|
1587
|
+
* Query session list by label
|
|
1588
1588
|
*
|
|
1589
1589
|
* @param request - ListSessionRequest
|
|
1590
1590
|
* @returns ListSessionResponse
|
|
1591
1591
|
*/
|
|
1592
1592
|
listSession(request: ListSessionRequest): Promise<ListSessionResponse>;
|
|
1593
1593
|
/**
|
|
1594
|
-
*
|
|
1594
|
+
* Modify context
|
|
1595
1595
|
*
|
|
1596
1596
|
* @param request - ModifyContextRequest
|
|
1597
1597
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1599,14 +1599,14 @@ declare class Client extends OpenApi {
|
|
|
1599
1599
|
*/
|
|
1600
1600
|
modifyContextWithOptions(request: ModifyContextRequest, runtime: $dara.RuntimeOptions): Promise<ModifyContextResponse>;
|
|
1601
1601
|
/**
|
|
1602
|
-
*
|
|
1602
|
+
* Modify context
|
|
1603
1603
|
*
|
|
1604
1604
|
* @param request - ModifyContextRequest
|
|
1605
1605
|
* @returns ModifyContextResponse
|
|
1606
1606
|
*/
|
|
1607
1607
|
modifyContext(request: ModifyContextRequest): Promise<ModifyContextResponse>;
|
|
1608
1608
|
/**
|
|
1609
|
-
*
|
|
1609
|
+
* Release MCP session
|
|
1610
1610
|
*
|
|
1611
1611
|
* @param request - ReleaseMcpSessionRequest
|
|
1612
1612
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1614,14 +1614,14 @@ declare class Client extends OpenApi {
|
|
|
1614
1614
|
*/
|
|
1615
1615
|
releaseMcpSessionWithOptions(request: ReleaseMcpSessionRequest, runtime: $dara.RuntimeOptions): Promise<ReleaseMcpSessionResponse>;
|
|
1616
1616
|
/**
|
|
1617
|
-
*
|
|
1617
|
+
* Release MCP session
|
|
1618
1618
|
*
|
|
1619
1619
|
* @param request - ReleaseMcpSessionRequest
|
|
1620
1620
|
* @returns ReleaseMcpSessionResponse
|
|
1621
1621
|
*/
|
|
1622
1622
|
releaseMcpSession(request: ReleaseMcpSessionRequest): Promise<ReleaseMcpSessionResponse>;
|
|
1623
1623
|
/**
|
|
1624
|
-
*
|
|
1624
|
+
* Set labels
|
|
1625
1625
|
*
|
|
1626
1626
|
* @param request - SetLabelRequest
|
|
1627
1627
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1629,14 +1629,14 @@ declare class Client extends OpenApi {
|
|
|
1629
1629
|
*/
|
|
1630
1630
|
setLabelWithOptions(request: SetLabelRequest, runtime: $dara.RuntimeOptions): Promise<SetLabelResponse>;
|
|
1631
1631
|
/**
|
|
1632
|
-
*
|
|
1632
|
+
* Set labels
|
|
1633
1633
|
*
|
|
1634
1634
|
* @param request - SetLabelRequest
|
|
1635
1635
|
* @returns SetLabelResponse
|
|
1636
1636
|
*/
|
|
1637
1637
|
setLabel(request: SetLabelRequest): Promise<SetLabelResponse>;
|
|
1638
1638
|
/**
|
|
1639
|
-
*
|
|
1639
|
+
* Sync context
|
|
1640
1640
|
*
|
|
1641
1641
|
* @param request - SyncContextRequest
|
|
1642
1642
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1644,14 +1644,14 @@ declare class Client extends OpenApi {
|
|
|
1644
1644
|
*/
|
|
1645
1645
|
syncContextWithOptions(request: SyncContextRequest, runtime: $dara.RuntimeOptions): Promise<SyncContextResponse>;
|
|
1646
1646
|
/**
|
|
1647
|
-
*
|
|
1647
|
+
* Sync context
|
|
1648
1648
|
*
|
|
1649
1649
|
* @param request - SyncContextRequest
|
|
1650
1650
|
* @returns SyncContextResponse
|
|
1651
1651
|
*/
|
|
1652
1652
|
syncContext(request: SyncContextRequest): Promise<SyncContextResponse>;
|
|
1653
1653
|
/**
|
|
1654
|
-
*
|
|
1654
|
+
* Initialize browser
|
|
1655
1655
|
*
|
|
1656
1656
|
* @param tmpReq - InitBrowserRequest
|
|
1657
1657
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1659,21 +1659,21 @@ declare class Client extends OpenApi {
|
|
|
1659
1659
|
*/
|
|
1660
1660
|
initBrowserWithOptions(request: InitBrowserRequest, runtime: $dara.RuntimeOptions): Promise<InitBrowserResponse>;
|
|
1661
1661
|
/**
|
|
1662
|
-
*
|
|
1662
|
+
* Initialize browser
|
|
1663
1663
|
*
|
|
1664
1664
|
* @param request - InitBrowserRequest
|
|
1665
1665
|
* @returns InitBrowserResponse
|
|
1666
1666
|
*/
|
|
1667
1667
|
initBrowser(request: InitBrowserRequest): Promise<InitBrowserResponse>;
|
|
1668
1668
|
/**
|
|
1669
|
-
*
|
|
1669
|
+
* Initialize browser (sync version)
|
|
1670
1670
|
*
|
|
1671
1671
|
* @param request - InitBrowserRequest
|
|
1672
1672
|
* @returns InitBrowserResponse
|
|
1673
1673
|
*/
|
|
1674
1674
|
initBrowserSync(request: InitBrowserRequest): InitBrowserResponse;
|
|
1675
1675
|
/**
|
|
1676
|
-
*
|
|
1676
|
+
* Get context file upload URL
|
|
1677
1677
|
*
|
|
1678
1678
|
* @param request - DeleteContextFileRequest
|
|
1679
1679
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1681,14 +1681,14 @@ declare class Client extends OpenApi {
|
|
|
1681
1681
|
*/
|
|
1682
1682
|
deleteContextFileWithOptions(request: DeleteContextFileRequest, runtime: $dara.RuntimeOptions): Promise<DeleteContextFileResponse>;
|
|
1683
1683
|
/**
|
|
1684
|
-
*
|
|
1684
|
+
* Get context file upload URL
|
|
1685
1685
|
*
|
|
1686
1686
|
* @param request - DeleteContextFileRequest
|
|
1687
1687
|
* @returns DeleteContextFileResponse
|
|
1688
1688
|
*/
|
|
1689
1689
|
deleteContextFile(request: DeleteContextFileRequest): Promise<DeleteContextFileResponse>;
|
|
1690
1690
|
/**
|
|
1691
|
-
*
|
|
1691
|
+
* Query context specific directory files
|
|
1692
1692
|
*
|
|
1693
1693
|
* @param request - DescribeContextFilesRequest
|
|
1694
1694
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1696,14 +1696,14 @@ declare class Client extends OpenApi {
|
|
|
1696
1696
|
*/
|
|
1697
1697
|
describeContextFilesWithOptions(request: DescribeContextFilesRequest, runtime: $dara.RuntimeOptions): Promise<DescribeContextFilesResponse>;
|
|
1698
1698
|
/**
|
|
1699
|
-
*
|
|
1699
|
+
* Query context specific directory files
|
|
1700
1700
|
*
|
|
1701
1701
|
* @param request - DescribeContextFilesRequest
|
|
1702
1702
|
* @returns DescribeContextFilesResponse
|
|
1703
1703
|
*/
|
|
1704
1704
|
describeContextFiles(request: DescribeContextFilesRequest): Promise<DescribeContextFilesResponse>;
|
|
1705
1705
|
/**
|
|
1706
|
-
*
|
|
1706
|
+
* Get context file upload URL
|
|
1707
1707
|
*
|
|
1708
1708
|
* @param request - GetContextFileDownloadUrlRequest
|
|
1709
1709
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1711,14 +1711,14 @@ declare class Client extends OpenApi {
|
|
|
1711
1711
|
*/
|
|
1712
1712
|
getContextFileDownloadUrlWithOptions(request: GetContextFileDownloadUrlRequest, runtime: $dara.RuntimeOptions): Promise<GetContextFileDownloadUrlResponse>;
|
|
1713
1713
|
/**
|
|
1714
|
-
*
|
|
1714
|
+
* Get context file upload URL
|
|
1715
1715
|
*
|
|
1716
1716
|
* @param request - GetContextFileDownloadUrlRequest
|
|
1717
1717
|
* @returns GetContextFileDownloadUrlResponse
|
|
1718
1718
|
*/
|
|
1719
1719
|
getContextFileDownloadUrl(request: GetContextFileDownloadUrlRequest): Promise<GetContextFileDownloadUrlResponse>;
|
|
1720
1720
|
/**
|
|
1721
|
-
*
|
|
1721
|
+
* Get context file upload URL
|
|
1722
1722
|
*
|
|
1723
1723
|
* @param request - GetContextFileUploadUrlRequest
|
|
1724
1724
|
* @param runtime - runtime options for this request RuntimeOptions
|
|
@@ -1726,7 +1726,7 @@ declare class Client extends OpenApi {
|
|
|
1726
1726
|
*/
|
|
1727
1727
|
getContextFileUploadUrlWithOptions(request: GetContextFileUploadUrlRequest, runtime: $dara.RuntimeOptions): Promise<GetContextFileUploadUrlResponse>;
|
|
1728
1728
|
/**
|
|
1729
|
-
*
|
|
1729
|
+
* Get context file upload URL
|
|
1730
1730
|
*
|
|
1731
1731
|
* @param request - GetContextFileUploadUrlRequest
|
|
1732
1732
|
* @returns GetContextFileUploadUrlResponse
|
|
@@ -1739,6 +1739,19 @@ interface Config {
|
|
|
1739
1739
|
endpoint: string;
|
|
1740
1740
|
timeout_ms: number;
|
|
1741
1741
|
}
|
|
1742
|
+
/**
|
|
1743
|
+
* Load .env file into process.env if it exists
|
|
1744
|
+
* This function should be called early to ensure .env variables are available
|
|
1745
|
+
*/
|
|
1746
|
+
declare function loadDotEnv(): void;
|
|
1747
|
+
/**
|
|
1748
|
+
* The SDK uses the following precedence order for configuration (highest to lowest):
|
|
1749
|
+
* 1. Explicitly passed configuration in code.
|
|
1750
|
+
* 2. Environment variables.
|
|
1751
|
+
* 3. .env file.
|
|
1752
|
+
* 4. Default configuration.
|
|
1753
|
+
*/
|
|
1754
|
+
declare function loadConfig(customConfig?: Config): Config;
|
|
1742
1755
|
|
|
1743
1756
|
/**
|
|
1744
1757
|
* Base interface for API responses
|
|
@@ -2246,6 +2259,25 @@ interface DownloadPolicy {
|
|
|
2246
2259
|
interface DeletePolicy {
|
|
2247
2260
|
syncLocalFile: boolean;
|
|
2248
2261
|
}
|
|
2262
|
+
interface ExtractPolicy {
|
|
2263
|
+
extract: boolean;
|
|
2264
|
+
deleteSrcFile: boolean;
|
|
2265
|
+
extractToCurrentFolder: boolean;
|
|
2266
|
+
}
|
|
2267
|
+
declare class ExtractPolicyClass implements ExtractPolicy {
|
|
2268
|
+
extract: boolean;
|
|
2269
|
+
deleteSrcFile: boolean;
|
|
2270
|
+
extractToCurrentFolder: boolean;
|
|
2271
|
+
constructor(extract?: boolean, deleteSrcFile?: boolean, extractToCurrentFolder?: boolean);
|
|
2272
|
+
/**
|
|
2273
|
+
* Creates a new extract policy with default values
|
|
2274
|
+
*/
|
|
2275
|
+
static default(): ExtractPolicyClass;
|
|
2276
|
+
/**
|
|
2277
|
+
* Converts to plain object for JSON serialization
|
|
2278
|
+
*/
|
|
2279
|
+
toDict(): Record<string, any>;
|
|
2280
|
+
}
|
|
2249
2281
|
interface WhiteList {
|
|
2250
2282
|
path: string;
|
|
2251
2283
|
excludePaths?: string[];
|
|
@@ -2257,12 +2289,14 @@ interface SyncPolicy {
|
|
|
2257
2289
|
uploadPolicy?: UploadPolicy;
|
|
2258
2290
|
downloadPolicy?: DownloadPolicy;
|
|
2259
2291
|
deletePolicy?: DeletePolicy;
|
|
2292
|
+
extractPolicy?: ExtractPolicy;
|
|
2260
2293
|
bwList?: BWList;
|
|
2261
2294
|
}
|
|
2262
2295
|
declare class SyncPolicyImpl implements SyncPolicy {
|
|
2263
2296
|
uploadPolicy?: UploadPolicy;
|
|
2264
2297
|
downloadPolicy?: DownloadPolicy;
|
|
2265
2298
|
deletePolicy?: DeletePolicy;
|
|
2299
|
+
extractPolicy?: ExtractPolicy;
|
|
2266
2300
|
bwList?: BWList;
|
|
2267
2301
|
constructor(policy?: Partial<SyncPolicy>);
|
|
2268
2302
|
private ensureDefaults;
|
|
@@ -2278,6 +2312,7 @@ declare class ContextSync {
|
|
|
2278
2312
|
declare function newUploadPolicy(): UploadPolicy;
|
|
2279
2313
|
declare function newDownloadPolicy(): DownloadPolicy;
|
|
2280
2314
|
declare function newDeletePolicy(): DeletePolicy;
|
|
2315
|
+
declare function newExtractPolicy(): ExtractPolicy;
|
|
2281
2316
|
declare function newSyncPolicy(): SyncPolicy;
|
|
2282
2317
|
declare function newSyncPolicyWithDefaults(policy?: Partial<SyncPolicy>): SyncPolicy;
|
|
2283
2318
|
declare function newContextSync(contextId: string, path: string, policy?: SyncPolicy): ContextSync;
|
|
@@ -2557,6 +2592,38 @@ declare class ContextManager {
|
|
|
2557
2592
|
}
|
|
2558
2593
|
declare function newContextManager(session: SessionInterface): ContextManager;
|
|
2559
2594
|
|
|
2595
|
+
/**
|
|
2596
|
+
* Represents a single file change event
|
|
2597
|
+
*/
|
|
2598
|
+
interface FileChangeEvent {
|
|
2599
|
+
eventType: string;
|
|
2600
|
+
path: string;
|
|
2601
|
+
pathType: string;
|
|
2602
|
+
}
|
|
2603
|
+
/**
|
|
2604
|
+
* Result of file change detection operations
|
|
2605
|
+
*/
|
|
2606
|
+
interface FileChangeResult extends ApiResponse {
|
|
2607
|
+
events: FileChangeEvent[];
|
|
2608
|
+
rawData: string;
|
|
2609
|
+
}
|
|
2610
|
+
/**
|
|
2611
|
+
* Helper functions for FileChangeEvent
|
|
2612
|
+
*/
|
|
2613
|
+
declare class FileChangeEventHelper {
|
|
2614
|
+
static toString(event: FileChangeEvent): string;
|
|
2615
|
+
static toDict(event: FileChangeEvent): Record<string, string>;
|
|
2616
|
+
static fromDict(data: Record<string, any>): FileChangeEvent;
|
|
2617
|
+
}
|
|
2618
|
+
/**
|
|
2619
|
+
* Helper functions for FileChangeResult
|
|
2620
|
+
*/
|
|
2621
|
+
declare class FileChangeResultHelper {
|
|
2622
|
+
static hasChanges(result: FileChangeResult): boolean;
|
|
2623
|
+
static getModifiedFiles(result: FileChangeResult): string[];
|
|
2624
|
+
static getCreatedFiles(result: FileChangeResult): string[];
|
|
2625
|
+
static getDeletedFiles(result: FileChangeResult): string[];
|
|
2626
|
+
}
|
|
2560
2627
|
/**
|
|
2561
2628
|
* FileInfo represents information about a file or directory
|
|
2562
2629
|
*/
|
|
@@ -2644,15 +2711,14 @@ declare class FileSystem {
|
|
|
2644
2711
|
*/
|
|
2645
2712
|
moveFile(source: string, destination: string): Promise<BoolResult>;
|
|
2646
2713
|
/**
|
|
2647
|
-
*
|
|
2648
|
-
* Corresponds to Python's read_file() method
|
|
2714
|
+
* Internal method to read a file chunk. Used for chunked file operations.
|
|
2649
2715
|
*
|
|
2650
2716
|
* @param path - Path to the file to read.
|
|
2651
2717
|
* @param offset - Optional: Byte offset to start reading from (0-based).
|
|
2652
2718
|
* @param length - Optional: Number of bytes to read. If 0, reads the entire file from offset.
|
|
2653
2719
|
* @returns FileContentResult with file content and requestId
|
|
2654
2720
|
*/
|
|
2655
|
-
|
|
2721
|
+
private readFileChunk;
|
|
2656
2722
|
/**
|
|
2657
2723
|
* Reads the content of multiple files.
|
|
2658
2724
|
* Corresponds to Python's read_multiple_files() method
|
|
@@ -2672,34 +2738,42 @@ declare class FileSystem {
|
|
|
2672
2738
|
*/
|
|
2673
2739
|
searchFiles(path: string, pattern: string, excludePatterns?: string[]): Promise<FileSearchResult>;
|
|
2674
2740
|
/**
|
|
2675
|
-
*
|
|
2676
|
-
* Corresponds to Python's write_file() method
|
|
2741
|
+
* Internal method to write a file chunk. Used for chunked file operations.
|
|
2677
2742
|
*
|
|
2678
2743
|
* @param path - Path to the file to write.
|
|
2679
2744
|
* @param content - Content to write to the file.
|
|
2680
2745
|
* @param mode - Optional: Write mode. One of "overwrite", "append", or "create_new". Default is "overwrite".
|
|
2681
2746
|
* @returns BoolResult with write result and requestId
|
|
2682
2747
|
*/
|
|
2683
|
-
|
|
2748
|
+
private writeFileChunk;
|
|
2684
2749
|
/**
|
|
2685
|
-
* Reads
|
|
2686
|
-
* Corresponds to Python's read_large_file() method
|
|
2750
|
+
* Reads the contents of a file. Automatically handles large files by chunking.
|
|
2687
2751
|
*
|
|
2688
2752
|
* @param path - Path to the file to read.
|
|
2689
|
-
* @param chunkSize - Optional: Size of each chunk in bytes. Default is 60KB.
|
|
2690
2753
|
* @returns FileContentResult with complete file content and requestId
|
|
2691
2754
|
*/
|
|
2692
|
-
|
|
2755
|
+
readFile(path: string): Promise<FileContentResult>;
|
|
2693
2756
|
/**
|
|
2694
|
-
* Writes a
|
|
2695
|
-
* Corresponds to Python's write_large_file() method
|
|
2757
|
+
* Writes content to a file. Automatically handles large files by chunking.
|
|
2696
2758
|
*
|
|
2697
2759
|
* @param path - Path to the file to write.
|
|
2698
2760
|
* @param content - Content to write to the file.
|
|
2699
|
-
* @param
|
|
2761
|
+
* @param mode - Optional: Write mode. One of "overwrite", "append", or "create_new". Default is "overwrite".
|
|
2700
2762
|
* @returns BoolResult indicating success or failure with requestId
|
|
2701
2763
|
*/
|
|
2702
|
-
|
|
2764
|
+
writeFile(path: string, content: string, mode?: string): Promise<BoolResult>;
|
|
2765
|
+
/**
|
|
2766
|
+
* Get file change information for the specified directory path
|
|
2767
|
+
*/
|
|
2768
|
+
getFileChange(path: string): Promise<FileChangeResult>;
|
|
2769
|
+
/**
|
|
2770
|
+
* Parse raw JSON data into FileChangeEvent array
|
|
2771
|
+
*/
|
|
2772
|
+
private parseFileChangeData;
|
|
2773
|
+
/**
|
|
2774
|
+
* Watch a directory for file changes and call the callback function when changes occur
|
|
2775
|
+
*/
|
|
2776
|
+
watchDirectory(path: string, callback: (events: FileChangeEvent[]) => void, interval?: number, signal?: AbortSignal): Promise<void>;
|
|
2703
2777
|
}
|
|
2704
2778
|
|
|
2705
2779
|
/**
|
|
@@ -3055,28 +3129,28 @@ declare class BrowserAgent {
|
|
|
3055
3129
|
* Perform an action on the given Playwright Page object, using ActOptions to configure behavior.
|
|
3056
3130
|
* Returns the result of the action.
|
|
3057
3131
|
*/
|
|
3058
|
-
act(
|
|
3132
|
+
act(options: ActOptions, page: any): Promise<ActResult>;
|
|
3059
3133
|
/**
|
|
3060
3134
|
* Async version of act method for performing actions on the given Playwright Page object.
|
|
3061
3135
|
*/
|
|
3062
|
-
actAsync(
|
|
3136
|
+
actAsync(options: ActOptions, page: any): Promise<ActResult>;
|
|
3063
3137
|
/**
|
|
3064
3138
|
* Observe elements or state on the given Playwright Page object.
|
|
3065
3139
|
* Returns a tuple containing (success, results).
|
|
3066
3140
|
*/
|
|
3067
|
-
observe(
|
|
3141
|
+
observe(options: ObserveOptions, page: any): Promise<[boolean, ObserveResult[]]>;
|
|
3068
3142
|
/**
|
|
3069
3143
|
* Async version of observe method.
|
|
3070
3144
|
*/
|
|
3071
|
-
observeAsync(
|
|
3145
|
+
observeAsync(options: ObserveOptions, page: any): Promise<[boolean, ObserveResult[]]>;
|
|
3072
3146
|
/**
|
|
3073
3147
|
* Extract information from the given Playwright Page object.
|
|
3074
3148
|
*/
|
|
3075
|
-
extract<T>(
|
|
3149
|
+
extract<T>(options: ExtractOptions<T>, page: any): Promise<[boolean, T[]]>;
|
|
3076
3150
|
/**
|
|
3077
3151
|
* Async version of extract method.
|
|
3078
3152
|
*/
|
|
3079
|
-
extractAsync<T>(
|
|
3153
|
+
extractAsync<T>(options: ExtractOptions<T>, page: any): Promise<[boolean, T[]]>;
|
|
3080
3154
|
private _getPageAndContextIndex;
|
|
3081
3155
|
private _getPageAndContextIndexAsync;
|
|
3082
3156
|
private _callMcpTool;
|
|
@@ -3122,7 +3196,10 @@ interface BrowserOption {
|
|
|
3122
3196
|
viewport?: BrowserViewport;
|
|
3123
3197
|
screen?: BrowserScreen;
|
|
3124
3198
|
fingerprint?: BrowserFingerprint;
|
|
3199
|
+
solveCaptchas?: boolean;
|
|
3125
3200
|
proxies?: BrowserProxy[];
|
|
3201
|
+
/** Path to the extensions directory. Defaults to "/tmp/extensions/" */
|
|
3202
|
+
extensionPath?: string;
|
|
3126
3203
|
}
|
|
3127
3204
|
declare class BrowserOptionClass implements BrowserOption {
|
|
3128
3205
|
persistentPath?: string;
|
|
@@ -3131,8 +3208,10 @@ declare class BrowserOptionClass implements BrowserOption {
|
|
|
3131
3208
|
viewport?: BrowserViewport;
|
|
3132
3209
|
screen?: BrowserScreen;
|
|
3133
3210
|
fingerprint?: BrowserFingerprint;
|
|
3211
|
+
solveCaptchas?: boolean;
|
|
3134
3212
|
proxies?: BrowserProxy[];
|
|
3135
|
-
|
|
3213
|
+
extensionPath?: string;
|
|
3214
|
+
constructor(useStealth?: boolean, userAgent?: string, viewport?: BrowserViewport, screen?: BrowserScreen, fingerprint?: BrowserFingerprint, solveCaptchas?: boolean, proxies?: BrowserProxy[]);
|
|
3136
3215
|
toMap(): Record<string, any>;
|
|
3137
3216
|
fromMap(m: Record<string, any> | null | undefined): BrowserOptionClass;
|
|
3138
3217
|
}
|
|
@@ -3194,7 +3273,6 @@ interface McpToolsResult extends OperationResult {
|
|
|
3194
3273
|
declare class Session {
|
|
3195
3274
|
private agentBay;
|
|
3196
3275
|
sessionId: string;
|
|
3197
|
-
resourceUrl: string;
|
|
3198
3276
|
isVpc: boolean;
|
|
3199
3277
|
networkInterfaceIp: string;
|
|
3200
3278
|
httpPort: string;
|
|
@@ -3316,13 +3394,330 @@ declare class Session {
|
|
|
3316
3394
|
}
|
|
3317
3395
|
|
|
3318
3396
|
/**
|
|
3319
|
-
*
|
|
3397
|
+
* Represents a browser extension as a cloud resource.
|
|
3398
|
+
*/
|
|
3399
|
+
declare class Extension {
|
|
3400
|
+
/**
|
|
3401
|
+
* The unique identifier of the extension.
|
|
3402
|
+
*/
|
|
3403
|
+
id: string;
|
|
3404
|
+
/**
|
|
3405
|
+
* The name of the extension.
|
|
3406
|
+
*/
|
|
3407
|
+
name: string;
|
|
3408
|
+
/**
|
|
3409
|
+
* Date and time when the extension was created.
|
|
3410
|
+
*/
|
|
3411
|
+
createdAt?: string;
|
|
3412
|
+
/**
|
|
3413
|
+
* Initialize an Extension object.
|
|
3414
|
+
*
|
|
3415
|
+
* @param id - The unique identifier of the extension.
|
|
3416
|
+
* @param name - The name of the extension.
|
|
3417
|
+
* @param createdAt - Date and time when the extension was created.
|
|
3418
|
+
*/
|
|
3419
|
+
constructor(id: string, name: string, createdAt?: string);
|
|
3420
|
+
}
|
|
3421
|
+
/**
|
|
3422
|
+
* Configuration options for browser extension integration.
|
|
3423
|
+
*
|
|
3424
|
+
* This class encapsulates the necessary parameters for setting up
|
|
3425
|
+
* browser extension synchronization and context management.
|
|
3320
3426
|
*/
|
|
3321
|
-
|
|
3427
|
+
declare class ExtensionOption {
|
|
3428
|
+
/**
|
|
3429
|
+
* ID of the extension context for browser extensions.
|
|
3430
|
+
*/
|
|
3431
|
+
contextId: string;
|
|
3432
|
+
/**
|
|
3433
|
+
* List of extension IDs to be loaded/synchronized.
|
|
3434
|
+
*/
|
|
3435
|
+
extensionIds: string[];
|
|
3436
|
+
/**
|
|
3437
|
+
* Initialize ExtensionOption with context and extension configuration.
|
|
3438
|
+
*
|
|
3439
|
+
* @param contextId - ID of the extension context for browser extensions.
|
|
3440
|
+
* This should match the context where extensions are stored.
|
|
3441
|
+
* @param extensionIds - List of extension IDs to be loaded in the browser session.
|
|
3442
|
+
* Each ID should correspond to a valid extension in the context.
|
|
3443
|
+
*
|
|
3444
|
+
* @throws {Error} If contextId is empty or extensionIds is empty.
|
|
3445
|
+
*/
|
|
3446
|
+
constructor(contextId: string, extensionIds: string[]);
|
|
3447
|
+
/**
|
|
3448
|
+
* String representation of ExtensionOption.
|
|
3449
|
+
*/
|
|
3450
|
+
toString(): string;
|
|
3451
|
+
/**
|
|
3452
|
+
* Human-readable string representation.
|
|
3453
|
+
*/
|
|
3454
|
+
toDisplayString(): string;
|
|
3455
|
+
/**
|
|
3456
|
+
* Validate the extension option configuration.
|
|
3457
|
+
*
|
|
3458
|
+
* @returns True if configuration is valid, false otherwise.
|
|
3459
|
+
*/
|
|
3460
|
+
validate(): boolean;
|
|
3461
|
+
}
|
|
3462
|
+
/**
|
|
3463
|
+
* Provides methods to manage user browser extensions.
|
|
3464
|
+
* This service integrates with the existing context functionality for file operations.
|
|
3465
|
+
*
|
|
3466
|
+
* **Usage** (Simplified - Auto-detection):
|
|
3467
|
+
* ```typescript
|
|
3468
|
+
* // Service automatically detects if context exists and creates if needed
|
|
3469
|
+
* const extensionsService = new ExtensionsService(agentBay, "browser_extensions");
|
|
3470
|
+
*
|
|
3471
|
+
* // Or use with empty contextId to auto-generate context name
|
|
3472
|
+
* const extensionsService = new ExtensionsService(agentBay); // Uses default generated name
|
|
3473
|
+
*
|
|
3474
|
+
* // Use the service immediately - initialization happens automatically
|
|
3475
|
+
* const extension = await extensionsService.create("/path/to/plugin.zip");
|
|
3476
|
+
* ```
|
|
3477
|
+
*
|
|
3478
|
+
* **Integration with ExtensionOption (Simplified)**:
|
|
3479
|
+
* ```typescript
|
|
3480
|
+
* // Create extensions and configure for browser sessions
|
|
3481
|
+
* const extensionsService = new ExtensionsService(agentBay, "my_extensions");
|
|
3482
|
+
* const ext1 = await extensionsService.create("/path/to/ext1.zip");
|
|
3483
|
+
* const ext2 = await extensionsService.create("/path/to/ext2.zip");
|
|
3484
|
+
*
|
|
3485
|
+
* // Create extension option for browser integration (no contextId needed!)
|
|
3486
|
+
* const extOption = extensionsService.createExtensionOption([ext1.id, ext2.id]);
|
|
3487
|
+
*
|
|
3488
|
+
* // Use with BrowserContext for session creation
|
|
3489
|
+
* const browserContext = new BrowserContext({
|
|
3490
|
+
* contextId: "browser_session",
|
|
3491
|
+
* autoUpload: true,
|
|
3492
|
+
* extensionOption: extOption // All extension config encapsulated
|
|
3493
|
+
* });
|
|
3494
|
+
* ```
|
|
3495
|
+
*
|
|
3496
|
+
* **Context Management**:
|
|
3497
|
+
* - If contextId provided and exists: Uses the existing context
|
|
3498
|
+
* - If contextId provided but doesn't exist: Creates context with provided name
|
|
3499
|
+
* - If contextId empty or not provided: Generates default name and creates context
|
|
3500
|
+
* - No need to manually manage context creation or call initialize()
|
|
3501
|
+
* - Context initialization happens automatically on first method call
|
|
3502
|
+
*/
|
|
3503
|
+
declare class ExtensionsService {
|
|
3504
|
+
private agentBay;
|
|
3505
|
+
private contextService;
|
|
3506
|
+
private extensionContext;
|
|
3507
|
+
private contextId;
|
|
3508
|
+
private contextName;
|
|
3509
|
+
private autoCreated;
|
|
3510
|
+
private _initializationPromise;
|
|
3511
|
+
/**
|
|
3512
|
+
* Initializes the ExtensionsService with a context.
|
|
3513
|
+
*
|
|
3514
|
+
* @param agentBay - The AgentBay client instance.
|
|
3515
|
+
* @param contextId - The context ID or name. If empty or not provided,
|
|
3516
|
+
* a default context name will be generated automatically.
|
|
3517
|
+
* If the context doesn't exist, it will be automatically created.
|
|
3518
|
+
*
|
|
3519
|
+
* Note:
|
|
3520
|
+
* The service automatically detects if the context exists. If not,
|
|
3521
|
+
* it creates a new context with the provided name or a generated default name.
|
|
3522
|
+
* Context initialization is handled lazily on first use.
|
|
3523
|
+
*/
|
|
3524
|
+
constructor(agentBay: AgentBay, contextId?: string);
|
|
3525
|
+
/**
|
|
3526
|
+
* Internal method to initialize the context.
|
|
3527
|
+
* This ensures the context is ready before any operations.
|
|
3528
|
+
*/
|
|
3529
|
+
private _initializeContext;
|
|
3530
|
+
/**
|
|
3531
|
+
* Ensures the service is initialized before performing operations.
|
|
3532
|
+
*/
|
|
3533
|
+
private _ensureInitialized;
|
|
3534
|
+
/**
|
|
3535
|
+
* An internal helper method that encapsulates the flow of "get upload URL for a specific path and upload".
|
|
3536
|
+
* Uses the existing context service for file operations.
|
|
3537
|
+
*
|
|
3538
|
+
* @param localPath - The path to the local file.
|
|
3539
|
+
* @param remotePath - The path of the file in context storage.
|
|
3540
|
+
*
|
|
3541
|
+
* @throws {AgentBayError} If getting the credential or uploading fails.
|
|
3542
|
+
*/
|
|
3543
|
+
private _uploadToCloud;
|
|
3544
|
+
/**
|
|
3545
|
+
* Lists all available browser extensions within this context from the cloud.
|
|
3546
|
+
* Uses the context service to list files under the extensions directory.
|
|
3547
|
+
*
|
|
3548
|
+
* @returns Promise that resolves to an array of Extension objects.
|
|
3549
|
+
* @throws {AgentBayError} If listing extensions fails.
|
|
3550
|
+
*/
|
|
3551
|
+
list(): Promise<Extension[]>;
|
|
3552
|
+
/**
|
|
3553
|
+
* Uploads a new browser extension from a local path into the current context.
|
|
3554
|
+
*
|
|
3555
|
+
* @param localPath - Path to the local extension file (must be a .zip file).
|
|
3556
|
+
* @returns Promise that resolves to an Extension object.
|
|
3557
|
+
* @throws {Error} If the local file doesn't exist.
|
|
3558
|
+
* @throws {Error} If the file format is not supported (only .zip is supported).
|
|
3559
|
+
* @throws {AgentBayError} If upload fails.
|
|
3560
|
+
*/
|
|
3561
|
+
create(localPath: string): Promise<Extension>;
|
|
3562
|
+
/**
|
|
3563
|
+
* Updates an existing browser extension in the current context with a new file.
|
|
3564
|
+
*
|
|
3565
|
+
* @param extensionId - ID of the extension to update.
|
|
3566
|
+
* @param newLocalPath - Path to the new local extension file.
|
|
3567
|
+
* @returns Promise that resolves to an Extension object.
|
|
3568
|
+
* @throws {Error} If the new local file doesn't exist.
|
|
3569
|
+
* @throws {Error} If the extension doesn't exist in the context.
|
|
3570
|
+
* @throws {AgentBayError} If update fails.
|
|
3571
|
+
*/
|
|
3572
|
+
update(extensionId: string, newLocalPath: string): Promise<Extension>;
|
|
3573
|
+
/**
|
|
3574
|
+
* Gets detailed information about a specific browser extension.
|
|
3575
|
+
*
|
|
3576
|
+
* @param extensionId - The ID of the extension to get info for.
|
|
3577
|
+
* @returns Promise that resolves to an Extension object if found, undefined otherwise.
|
|
3578
|
+
*/
|
|
3579
|
+
private _getExtensionInfo;
|
|
3580
|
+
/**
|
|
3581
|
+
* Cleans up the auto-created context if it was created by this service.
|
|
3582
|
+
*
|
|
3583
|
+
* @returns Promise that resolves to true if cleanup was successful or not needed, false if cleanup failed.
|
|
3584
|
+
*
|
|
3585
|
+
* Note:
|
|
3586
|
+
* This method only works if the context was auto-created by this service.
|
|
3587
|
+
* For existing contexts, no cleanup is performed.
|
|
3588
|
+
*/
|
|
3589
|
+
cleanup(): Promise<boolean>;
|
|
3590
|
+
/**
|
|
3591
|
+
* Deletes a browser extension from the current context.
|
|
3592
|
+
*
|
|
3593
|
+
* @param extensionId - ID of the extension to delete.
|
|
3594
|
+
* @returns Promise that resolves to true if deletion was successful, false otherwise.
|
|
3595
|
+
*/
|
|
3596
|
+
delete(extensionId: string): Promise<boolean>;
|
|
3597
|
+
/**
|
|
3598
|
+
* Create an ExtensionOption for the current context with specified extension IDs.
|
|
3599
|
+
*
|
|
3600
|
+
* This is a convenience method that creates an ExtensionOption using the current
|
|
3601
|
+
* service's contextId and the provided extension IDs. This option can then be
|
|
3602
|
+
* used with BrowserContext for browser session creation.
|
|
3603
|
+
*
|
|
3604
|
+
* @param extensionIds - List of extension IDs to include in the option.
|
|
3605
|
+
* These should be extensions that exist in the current context.
|
|
3606
|
+
* @returns ExtensionOption configuration object for browser extension integration.
|
|
3607
|
+
* @throws {Error} If extensionIds is empty or invalid.
|
|
3608
|
+
*
|
|
3609
|
+
* @example
|
|
3610
|
+
* ```typescript
|
|
3611
|
+
* // Create extensions
|
|
3612
|
+
* const ext1 = await extensionsService.create("/path/to/ext1.zip");
|
|
3613
|
+
* const ext2 = await extensionsService.create("/path/to/ext2.zip");
|
|
3614
|
+
*
|
|
3615
|
+
* // Create extension option for browser integration
|
|
3616
|
+
* const extOption = extensionsService.createExtensionOption([ext1.id, ext2.id]);
|
|
3617
|
+
*
|
|
3618
|
+
* // Use with BrowserContext
|
|
3619
|
+
* const browserContext = new BrowserContext({
|
|
3620
|
+
* contextId: "browser_session",
|
|
3621
|
+
* autoUpload: true,
|
|
3622
|
+
* extensionContextId: extOption.contextId,
|
|
3623
|
+
* extensionIds: extOption.extensionIds
|
|
3624
|
+
* });
|
|
3625
|
+
* ```
|
|
3626
|
+
*/
|
|
3627
|
+
createExtensionOption(extensionIds: string[]): ExtensionOption;
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
/**
|
|
3631
|
+
* Browser context configuration for session with optional extension support.
|
|
3632
|
+
*
|
|
3633
|
+
* This class provides browser context configuration for cloud sessions and supports
|
|
3634
|
+
* automatic extension synchronization when ExtensionOption is provided.
|
|
3635
|
+
*
|
|
3636
|
+
* Key Features:
|
|
3637
|
+
* - Browser context binding for sessions
|
|
3638
|
+
* - Automatic browser data upload on session end
|
|
3639
|
+
* - Optional extension integration with automatic context sync generation
|
|
3640
|
+
* - Clean API with ExtensionOption encapsulation
|
|
3641
|
+
*
|
|
3642
|
+
* Extension Configuration:
|
|
3643
|
+
* - **ExtensionOption**: Pass an ExtensionOption object with contextId and extensionIds
|
|
3644
|
+
* - **No Extensions**: Don't provide extensionOption parameter (extensionContextSyncs will be undefined)
|
|
3645
|
+
*
|
|
3646
|
+
* Usage Examples:
|
|
3647
|
+
* ```typescript
|
|
3648
|
+
* // With extensions using ExtensionOption
|
|
3649
|
+
* import { ExtensionOption } from "./extension";
|
|
3650
|
+
*
|
|
3651
|
+
* const extOption = new ExtensionOption(
|
|
3652
|
+
* "my_extensions",
|
|
3653
|
+
* ["ext1", "ext2"]
|
|
3654
|
+
* );
|
|
3655
|
+
*
|
|
3656
|
+
* const browserContext = new BrowserContext(
|
|
3657
|
+
* "browser_session",
|
|
3658
|
+
* true,
|
|
3659
|
+
* extOption
|
|
3660
|
+
* );
|
|
3661
|
+
*
|
|
3662
|
+
* // Without extensions (minimal configuration)
|
|
3663
|
+
* const browserContext = new BrowserContext(
|
|
3664
|
+
* "browser_session",
|
|
3665
|
+
* true
|
|
3666
|
+
* );
|
|
3667
|
+
* // extensionContextSyncs will be undefined
|
|
3668
|
+
* ```
|
|
3669
|
+
*/
|
|
3670
|
+
declare class BrowserContext {
|
|
3322
3671
|
/** ID of the browser context to bind to the session */
|
|
3323
3672
|
contextId: string;
|
|
3324
3673
|
/** Whether to automatically upload browser data when the session ends */
|
|
3325
3674
|
autoUpload: boolean;
|
|
3675
|
+
/** Optional extension configuration object containing context_id and extension_ids */
|
|
3676
|
+
extensionOption?: ExtensionOption;
|
|
3677
|
+
/** ID of the extension context for browser extensions. Set automatically from extension_option. */
|
|
3678
|
+
extensionContextId?: string;
|
|
3679
|
+
/** List of extension IDs to synchronize. Set automatically from extension_option. */
|
|
3680
|
+
extensionIds?: string[];
|
|
3681
|
+
/** Auto-generated context syncs for extensions. None if no extension configuration provided. */
|
|
3682
|
+
extensionContextSyncs?: ContextSync[];
|
|
3683
|
+
/**
|
|
3684
|
+
* Initialize BrowserContextImpl with optional extension support.
|
|
3685
|
+
*
|
|
3686
|
+
* @param contextId - ID of the browser context to bind to the session.
|
|
3687
|
+
* This identifies the browser instance for the session.
|
|
3688
|
+
* @param autoUpload - Whether to automatically upload browser data
|
|
3689
|
+
* when the session ends. Defaults to true.
|
|
3690
|
+
* @param extensionOption - Extension configuration object containing
|
|
3691
|
+
* contextId and extensionIds. This encapsulates
|
|
3692
|
+
* all extension-related configuration.
|
|
3693
|
+
* Defaults to undefined.
|
|
3694
|
+
*
|
|
3695
|
+
* Extension Configuration:
|
|
3696
|
+
* - **ExtensionOption**: Use extensionOption parameter with an ExtensionOption object
|
|
3697
|
+
* - **No Extensions**: Don't provide extensionOption parameter
|
|
3698
|
+
*
|
|
3699
|
+
* Auto-generation:
|
|
3700
|
+
* - extensionContextSyncs is automatically generated when extensionOption is provided
|
|
3701
|
+
* - extensionContextSyncs will be undefined if no extensionOption is provided
|
|
3702
|
+
* - extensionContextSyncs will be a ContextSync[] if extensionOption is valid
|
|
3703
|
+
*/
|
|
3704
|
+
constructor(contextId: string, autoUpload?: boolean, extensionOption?: ExtensionOption);
|
|
3705
|
+
/**
|
|
3706
|
+
* Create ContextSync configurations for browser extensions.
|
|
3707
|
+
*
|
|
3708
|
+
* This method is called only when extensionOption is provided and contains
|
|
3709
|
+
* valid extension configuration (contextId and extensionIds).
|
|
3710
|
+
*
|
|
3711
|
+
* @returns ContextSync[] - List of context sync configurations for extensions.
|
|
3712
|
+
* Returns empty list if extension configuration is invalid.
|
|
3713
|
+
*/
|
|
3714
|
+
private _createExtensionContextSyncs;
|
|
3715
|
+
/**
|
|
3716
|
+
* Get all context syncs including extension syncs.
|
|
3717
|
+
*
|
|
3718
|
+
* @returns ContextSync[] - All context sync configurations. Returns empty list if no extensions configured.
|
|
3719
|
+
*/
|
|
3720
|
+
getAllContextSyncs(): ContextSync[];
|
|
3326
3721
|
}
|
|
3327
3722
|
/**
|
|
3328
3723
|
* Configuration interface for CreateSessionParams
|
|
@@ -3593,4 +3988,4 @@ declare function log(message: string, ...args: any[]): void;
|
|
|
3593
3988
|
*/
|
|
3594
3989
|
declare function logError(message: string, error?: any): void;
|
|
3595
3990
|
|
|
3596
|
-
export { APIError, type ActOptions, ActResult, Agent, AgentBay, AgentBayError, Application, ApplicationError, ApplyMqttTokenRequest, ApplyMqttTokenResponse, ApplyMqttTokenResponseBody, ApplyMqttTokenResponseBodyData, AuthenticationError, type BWList, Browser, BrowserAgent,
|
|
3991
|
+
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, 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 };
|