test-wuying-agentbay-sdk 0.13.0-beta.20251212160413 → 0.13.0-beta.20251215095254

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.cjs CHANGED
@@ -96,7 +96,11 @@
96
96
 
97
97
 
98
98
 
99
- var _chunkW4B6JMPAcjs = require('./chunk-W4B6JMPA.cjs');
99
+
100
+
101
+
102
+
103
+ var _chunkQYUGADDCcjs = require('./chunk-QYUGADDC.cjs');
100
104
 
101
105
 
102
106
 
@@ -664,7 +668,7 @@ var _Client = class _Client extends _openapicore2.default {
664
668
  });
665
669
  return $dara.cast(
666
670
  await this.callApi(params, req, runtime),
667
- new (0, _chunkW4B6JMPAcjs.CallMcpToolResponse)({})
671
+ new (0, _chunkQYUGADDCcjs.CallMcpToolResponse)({})
668
672
  );
669
673
  }
670
674
  /**
@@ -679,7 +683,7 @@ var _Client = class _Client extends _openapicore2.default {
679
683
  }
680
684
  /**
681
685
  * Delete Persistent Context
682
- *
686
+ *
683
687
  * @param request - ClearContextRequest
684
688
  * @param runtime - runtime options for this request RuntimeOptions
685
689
  * @returns ClearContextResponse
@@ -707,11 +711,11 @@ var _Client = class _Client extends _openapicore2.default {
707
711
  reqBodyType: "formData",
708
712
  bodyType: "json"
709
713
  });
710
- return $dara.cast(await this.doRPCRequest(params.action, params.version, params.protocol, params.method, params.authType, params.bodyType, req, runtime), new (0, _chunkW4B6JMPAcjs.ClearContextResponse)({}));
714
+ return $dara.cast(await this.doRPCRequest(params.action, params.version, params.protocol, params.method, params.authType, params.bodyType, req, runtime), new (0, _chunkQYUGADDCcjs.ClearContextResponse)({}));
711
715
  }
712
716
  /**
713
717
  * Delete Persistent Context
714
- *
718
+ *
715
719
  * @param request - ClearContextRequest
716
720
  * @returns ClearContextResponse
717
721
  */
@@ -728,7 +732,7 @@ var _Client = class _Client extends _openapicore2.default {
728
732
  */
729
733
  async createMcpSessionWithOptions(tmpReq, runtime) {
730
734
  tmpReq.validate();
731
- const request = new (0, _chunkW4B6JMPAcjs.CreateMcpSessionShrinkRequest)({});
735
+ const request = new (0, _chunkQYUGADDCcjs.CreateMcpSessionShrinkRequest)({});
732
736
  _openapicore.OpenApiUtil.convert(tmpReq, request);
733
737
  if (!$dara.isNull(tmpReq.persistenceDataList)) {
734
738
  request.persistenceDataListShrink = _openapicore.OpenApiUtil.arrayToStringWithSpecifiedStyle(
@@ -790,7 +794,7 @@ var _Client = class _Client extends _openapicore2.default {
790
794
  });
791
795
  return $dara.cast(
792
796
  await this.callApi(params, req, runtime),
793
- new (0, _chunkW4B6JMPAcjs.CreateMcpSessionResponse)({})
797
+ new (0, _chunkQYUGADDCcjs.CreateMcpSessionResponse)({})
794
798
  );
795
799
  }
796
800
  /**
@@ -835,7 +839,7 @@ var _Client = class _Client extends _openapicore2.default {
835
839
  });
836
840
  return $dara.cast(
837
841
  await this.callApi(params, req, runtime),
838
- new (0, _chunkW4B6JMPAcjs.DeleteContextResponse)({})
842
+ new (0, _chunkQYUGADDCcjs.DeleteContextResponse)({})
839
843
  );
840
844
  }
841
845
  /**
@@ -889,7 +893,7 @@ var _Client = class _Client extends _openapicore2.default {
889
893
  });
890
894
  return $dara.cast(
891
895
  await this.callApi(params, req, runtime),
892
- new (0, _chunkW4B6JMPAcjs.GetContextResponse)({})
896
+ new (0, _chunkQYUGADDCcjs.GetContextResponse)({})
893
897
  );
894
898
  }
895
899
  /**
@@ -943,7 +947,7 @@ var _Client = class _Client extends _openapicore2.default {
943
947
  });
944
948
  return $dara.cast(
945
949
  await this.callApi(params, req, runtime),
946
- new (0, _chunkW4B6JMPAcjs.GetContextInfoResponse)({})
950
+ new (0, _chunkQYUGADDCcjs.GetContextInfoResponse)({})
947
951
  );
948
952
  }
949
953
  /**
@@ -994,7 +998,7 @@ var _Client = class _Client extends _openapicore2.default {
994
998
  });
995
999
  return $dara.cast(
996
1000
  await this.callApi(params, req, runtime),
997
- new (0, _chunkW4B6JMPAcjs.GetLabelResponse)({})
1001
+ new (0, _chunkQYUGADDCcjs.GetLabelResponse)({})
998
1002
  );
999
1003
  }
1000
1004
  /**
@@ -1039,7 +1043,7 @@ var _Client = class _Client extends _openapicore2.default {
1039
1043
  });
1040
1044
  return $dara.cast(
1041
1045
  await this.callApi(params, req, runtime),
1042
- new (0, _chunkW4B6JMPAcjs.GetSessionResponse)({})
1046
+ new (0, _chunkQYUGADDCcjs.GetSessionResponse)({})
1043
1047
  );
1044
1048
  }
1045
1049
  /**
@@ -1084,7 +1088,7 @@ var _Client = class _Client extends _openapicore2.default {
1084
1088
  });
1085
1089
  return $dara.cast(
1086
1090
  await this.callApi(params, req, runtime),
1087
- new (0, _chunkW4B6JMPAcjs.PauseSessionAsyncResponse)({})
1091
+ new (0, _chunkQYUGADDCcjs.PauseSessionAsyncResponse)({})
1088
1092
  );
1089
1093
  }
1090
1094
  /**
@@ -1129,7 +1133,7 @@ var _Client = class _Client extends _openapicore2.default {
1129
1133
  });
1130
1134
  return $dara.cast(
1131
1135
  await this.callApi(params, req, runtime),
1132
- new (0, _chunkW4B6JMPAcjs.ResumeSessionAsyncResponse)({})
1136
+ new (0, _chunkQYUGADDCcjs.ResumeSessionAsyncResponse)({})
1133
1137
  );
1134
1138
  }
1135
1139
  /**
@@ -1183,7 +1187,7 @@ var _Client = class _Client extends _openapicore2.default {
1183
1187
  });
1184
1188
  return $dara.cast(
1185
1189
  await this.callApi(params, req, runtime),
1186
- new (0, _chunkW4B6JMPAcjs.GetLinkResponse)({})
1190
+ new (0, _chunkQYUGADDCcjs.GetLinkResponse)({})
1187
1191
  );
1188
1192
  }
1189
1193
  /**
@@ -1228,7 +1232,7 @@ var _Client = class _Client extends _openapicore2.default {
1228
1232
  });
1229
1233
  return $dara.cast(
1230
1234
  await this.callApi(params, req, runtime),
1231
- new (0, _chunkW4B6JMPAcjs.GetMcpResourceResponse)({})
1235
+ new (0, _chunkQYUGADDCcjs.GetMcpResourceResponse)({})
1232
1236
  );
1233
1237
  }
1234
1238
  /**
@@ -1241,6 +1245,42 @@ var _Client = class _Client extends _openapicore2.default {
1241
1245
  const runtime = new $dara.RuntimeOptions({});
1242
1246
  return await this.getMcpResourceWithOptions(request, runtime);
1243
1247
  }
1248
+ /**
1249
+ * Get internal context request
1250
+ *
1251
+ * @param request - GetAndLoadInternalContextRequest
1252
+ * @param runtime - runtime options for this request RuntimeOptions
1253
+ * @returns GetAndLoadInternalContextResponse
1254
+ */
1255
+ async getAndLoadInternalContextWithOptions(request, runtime) {
1256
+ request.validate();
1257
+ let query = _openapicore.OpenApiUtil.query(request.toMap());
1258
+ let req = new _openapicore.$OpenApiUtil.OpenApiRequest({
1259
+ query: _openapicore.OpenApiUtil.query(query)
1260
+ });
1261
+ let params = new _openapicore.$OpenApiUtil.Params({
1262
+ action: "GetAndLoadInternalContext",
1263
+ version: "2025-05-06",
1264
+ protocol: "HTTPS",
1265
+ pathname: "/",
1266
+ method: "GET",
1267
+ authType: "Anonymous",
1268
+ style: "RPC",
1269
+ reqBodyType: "formData",
1270
+ bodyType: "json"
1271
+ });
1272
+ return $dara.cast(await this.doRPCRequest(params.action, params.version, params.protocol, params.method, params.authType, params.bodyType, req, runtime), new (0, _chunkQYUGADDCcjs.GetAndLoadInternalContextResponse)({}));
1273
+ }
1274
+ /**
1275
+ * Get internal context request
1276
+ *
1277
+ * @param request - GetAndLoadInternalContextRequest
1278
+ * @returns GetAndLoadInternalContextResponse
1279
+ */
1280
+ async getAndLoadInternalContext(request) {
1281
+ let runtime = new $dara.RuntimeOptions({});
1282
+ return await this.getAndLoadInternalContextWithOptions(request, runtime);
1283
+ }
1244
1284
  /**
1245
1285
  * Get context list
1246
1286
  *
@@ -1260,6 +1300,12 @@ var _Client = class _Client extends _openapicore2.default {
1260
1300
  if (!$dara.isNull(request.nextToken)) {
1261
1301
  body["NextToken"] = request.nextToken;
1262
1302
  }
1303
+ if (!$dara.isNull(request.sessionId)) {
1304
+ body["SessionId"] = request.sessionId;
1305
+ }
1306
+ if (!$dara.isNull(request.type)) {
1307
+ body["ContextType"] = request.type;
1308
+ }
1263
1309
  const req = new _openapicore.$OpenApiUtil.OpenApiRequest({
1264
1310
  body: _openapicore.OpenApiUtil.parseToMap(body)
1265
1311
  });
@@ -1276,7 +1322,7 @@ var _Client = class _Client extends _openapicore2.default {
1276
1322
  });
1277
1323
  return $dara.cast(
1278
1324
  await this.callApi(params, req, runtime),
1279
- new (0, _chunkW4B6JMPAcjs.ListContextsResponse)({})
1325
+ new (0, _chunkQYUGADDCcjs.ListContextsResponse)({})
1280
1326
  );
1281
1327
  }
1282
1328
  /**
@@ -1321,7 +1367,7 @@ var _Client = class _Client extends _openapicore2.default {
1321
1367
  });
1322
1368
  return $dara.cast(
1323
1369
  await this.callApi(params, req, runtime),
1324
- new (0, _chunkW4B6JMPAcjs.ListMcpToolsResponse)({})
1370
+ new (0, _chunkQYUGADDCcjs.ListMcpToolsResponse)({})
1325
1371
  );
1326
1372
  }
1327
1373
  /**
@@ -1372,7 +1418,7 @@ var _Client = class _Client extends _openapicore2.default {
1372
1418
  });
1373
1419
  return $dara.cast(
1374
1420
  await this.callApi(params, req, runtime),
1375
- new (0, _chunkW4B6JMPAcjs.ListSessionResponse)({})
1421
+ new (0, _chunkQYUGADDCcjs.ListSessionResponse)({})
1376
1422
  );
1377
1423
  }
1378
1424
  /**
@@ -1420,7 +1466,7 @@ var _Client = class _Client extends _openapicore2.default {
1420
1466
  });
1421
1467
  return $dara.cast(
1422
1468
  await this.callApi(params, req, runtime),
1423
- new (0, _chunkW4B6JMPAcjs.ModifyContextResponse)({})
1469
+ new (0, _chunkQYUGADDCcjs.ModifyContextResponse)({})
1424
1470
  );
1425
1471
  }
1426
1472
  /**
@@ -1465,7 +1511,7 @@ var _Client = class _Client extends _openapicore2.default {
1465
1511
  });
1466
1512
  return $dara.cast(
1467
1513
  await this.callApi(params, req, runtime),
1468
- new (0, _chunkW4B6JMPAcjs.ReleaseMcpSessionResponse)({})
1514
+ new (0, _chunkQYUGADDCcjs.ReleaseMcpSessionResponse)({})
1469
1515
  );
1470
1516
  }
1471
1517
  /**
@@ -1513,7 +1559,7 @@ var _Client = class _Client extends _openapicore2.default {
1513
1559
  });
1514
1560
  return $dara.cast(
1515
1561
  await this.callApi(params, req, runtime),
1516
- new (0, _chunkW4B6JMPAcjs.SetLabelResponse)({})
1562
+ new (0, _chunkQYUGADDCcjs.SetLabelResponse)({})
1517
1563
  );
1518
1564
  }
1519
1565
  /**
@@ -1569,7 +1615,7 @@ var _Client = class _Client extends _openapicore2.default {
1569
1615
  });
1570
1616
  return $dara.cast(
1571
1617
  await this.callApi(params, req, runtime),
1572
- new (0, _chunkW4B6JMPAcjs.SyncContextResponse)({})
1618
+ new (0, _chunkQYUGADDCcjs.SyncContextResponse)({})
1573
1619
  );
1574
1620
  }
1575
1621
  /**
@@ -1620,7 +1666,7 @@ var _Client = class _Client extends _openapicore2.default {
1620
1666
  });
1621
1667
  return $dara.cast(
1622
1668
  await this.callApi(params, req, runtime),
1623
- new (0, _chunkW4B6JMPAcjs.InitBrowserResponse)({})
1669
+ new (0, _chunkQYUGADDCcjs.InitBrowserResponse)({})
1624
1670
  );
1625
1671
  }
1626
1672
  /**
@@ -1671,7 +1717,7 @@ var _Client = class _Client extends _openapicore2.default {
1671
1717
  });
1672
1718
  return $dara.cast(
1673
1719
  this.callApi(params, req, runtime),
1674
- new (0, _chunkW4B6JMPAcjs.InitBrowserResponse)({})
1720
+ new (0, _chunkQYUGADDCcjs.InitBrowserResponse)({})
1675
1721
  );
1676
1722
  }
1677
1723
  /**
@@ -1709,7 +1755,7 @@ var _Client = class _Client extends _openapicore2.default {
1709
1755
  });
1710
1756
  return $dara.cast(
1711
1757
  await this.callApi(params, req, runtime),
1712
- new (0, _chunkW4B6JMPAcjs.DeleteContextFileResponse)({})
1758
+ new (0, _chunkQYUGADDCcjs.DeleteContextFileResponse)({})
1713
1759
  );
1714
1760
  }
1715
1761
  /**
@@ -1763,7 +1809,7 @@ var _Client = class _Client extends _openapicore2.default {
1763
1809
  });
1764
1810
  return $dara.cast(
1765
1811
  await this.callApi(params, req, runtime),
1766
- new (0, _chunkW4B6JMPAcjs.DescribeContextFilesResponse)({})
1812
+ new (0, _chunkQYUGADDCcjs.DescribeContextFilesResponse)({})
1767
1813
  );
1768
1814
  }
1769
1815
  /**
@@ -1811,7 +1857,7 @@ var _Client = class _Client extends _openapicore2.default {
1811
1857
  });
1812
1858
  return $dara.cast(
1813
1859
  await this.callApi(params, req, runtime),
1814
- new (0, _chunkW4B6JMPAcjs.GetContextFileDownloadUrlResponse)({})
1860
+ new (0, _chunkQYUGADDCcjs.GetContextFileDownloadUrlResponse)({})
1815
1861
  );
1816
1862
  }
1817
1863
  /**
@@ -1859,7 +1905,7 @@ var _Client = class _Client extends _openapicore2.default {
1859
1905
  });
1860
1906
  return $dara.cast(
1861
1907
  await this.callApi(params, req, runtime),
1862
- new (0, _chunkW4B6JMPAcjs.GetContextFileUploadUrlResponse)({})
1908
+ new (0, _chunkQYUGADDCcjs.GetContextFileUploadUrlResponse)({})
1863
1909
  );
1864
1910
  }
1865
1911
  /**
@@ -1913,7 +1959,7 @@ var _Client = class _Client extends _openapicore2.default {
1913
1959
  req,
1914
1960
  runtime
1915
1961
  ),
1916
- new (0, _chunkW4B6JMPAcjs.GetCdpLinkResponse)({})
1962
+ new (0, _chunkQYUGADDCcjs.GetCdpLinkResponse)({})
1917
1963
  );
1918
1964
  }
1919
1965
  /**
@@ -1970,7 +2016,7 @@ var _Client = class _Client extends _openapicore2.default {
1970
2016
  req,
1971
2017
  runtime
1972
2018
  ),
1973
- new (0, _chunkW4B6JMPAcjs.GetAdbLinkResponse)({})
2019
+ new (0, _chunkQYUGADDCcjs.GetAdbLinkResponse)({})
1974
2020
  );
1975
2021
  }
1976
2022
  /**
@@ -1992,7 +2038,6 @@ _chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
1992
2038
  var dotenv = _chunk4IPTHWLMcjs.__toESM.call(void 0, require_main());
1993
2039
 
1994
2040
 
1995
- var BROWSER_RECORD_PATH = "/home/wuying/record";
1996
2041
  function defaultConfig() {
1997
2042
  return {
1998
2043
  endpoint: "wuyingai.cn-shanghai.aliyuncs.com",
@@ -2684,16 +2729,17 @@ var _ContextService = class _ContextService {
2684
2729
  async list(params) {
2685
2730
  try {
2686
2731
  const maxResults = _optionalChain([params, 'optionalAccess', _6 => _6.maxResults]) !== void 0 ? params.maxResults : 10;
2687
- const request = new (0, _chunkW4B6JMPAcjs.ListContextsRequest)({
2732
+ const request = new (0, _chunkQYUGADDCcjs.ListContextsRequest)({
2688
2733
  authorization: `Bearer ${this.agentBay.getAPIKey()}`,
2689
2734
  maxResults,
2690
- nextToken: _optionalChain([params, 'optionalAccess', _7 => _7.nextToken])
2735
+ nextToken: _optionalChain([params, 'optionalAccess', _7 => _7.nextToken]),
2736
+ sessionId: _optionalChain([params, 'optionalAccess', _8 => _8.sessionId])
2691
2737
  });
2692
2738
  logAPICall("ListContexts");
2693
- logDebug(`Request: MaxResults=${maxResults}`, _optionalChain([params, 'optionalAccess', _8 => _8.nextToken]) ? `, NextToken=${params.nextToken}` : "");
2739
+ logDebug(`Request: MaxResults=${maxResults}`, _optionalChain([params, 'optionalAccess', _9 => _9.nextToken]) ? `, NextToken=${params.nextToken}` : "");
2694
2740
  const response = await this.agentBay.getClient().listContexts(request);
2695
2741
  const requestId = extractRequestId(response) || "";
2696
- if (_optionalChain([response, 'access', _9 => _9.body, 'optionalAccess', _10 => _10.success]) === false && _optionalChain([response, 'access', _11 => _11.body, 'optionalAccess', _12 => _12.code])) {
2742
+ if (_optionalChain([response, 'access', _10 => _10.body, 'optionalAccess', _11 => _11.success]) === false && _optionalChain([response, 'access', _12 => _12.body, 'optionalAccess', _13 => _13.code])) {
2697
2743
  const errorMessage = `[${response.body.code}] ${response.body.message || "Unknown error"}`;
2698
2744
  const fullResponse2 = response.body ? JSON.stringify(response.body, null, 2) : "";
2699
2745
  logAPIResponseWithDetails("ListContexts", requestId, false, void 0, fullResponse2);
@@ -2705,7 +2751,7 @@ var _ContextService = class _ContextService {
2705
2751
  };
2706
2752
  }
2707
2753
  const contexts = [];
2708
- if (_optionalChain([response, 'access', _13 => _13.body, 'optionalAccess', _14 => _14.data])) {
2754
+ if (_optionalChain([response, 'access', _14 => _14.body, 'optionalAccess', _15 => _15.data])) {
2709
2755
  for (const contextData of response.body.data) {
2710
2756
  contexts.push(
2711
2757
  new Context(
@@ -2721,7 +2767,7 @@ var _ContextService = class _ContextService {
2721
2767
  context_count: contexts.length,
2722
2768
  max_results: maxResults
2723
2769
  };
2724
- if (_optionalChain([response, 'access', _15 => _15.body, 'optionalAccess', _16 => _16.totalCount]) !== void 0) {
2770
+ if (_optionalChain([response, 'access', _16 => _16.body, 'optionalAccess', _17 => _17.totalCount]) !== void 0) {
2725
2771
  keyFields.total_count = response.body.totalCount;
2726
2772
  }
2727
2773
  const fullResponse = response.body ? JSON.stringify(response.body, null, 2) : "";
@@ -2730,9 +2776,9 @@ var _ContextService = class _ContextService {
2730
2776
  requestId,
2731
2777
  success: true,
2732
2778
  contexts,
2733
- nextToken: _optionalChain([response, 'access', _17 => _17.body, 'optionalAccess', _18 => _18.nextToken]),
2734
- maxResults: _optionalChain([response, 'access', _19 => _19.body, 'optionalAccess', _20 => _20.maxResults]) || maxResults,
2735
- totalCount: _optionalChain([response, 'access', _21 => _21.body, 'optionalAccess', _22 => _22.totalCount])
2779
+ nextToken: _optionalChain([response, 'access', _18 => _18.body, 'optionalAccess', _19 => _19.nextToken]),
2780
+ maxResults: _optionalChain([response, 'access', _20 => _20.body, 'optionalAccess', _21 => _21.maxResults]) || maxResults,
2781
+ totalCount: _optionalChain([response, 'access', _22 => _22.body, 'optionalAccess', _23 => _23.totalCount])
2736
2782
  };
2737
2783
  } catch (error) {
2738
2784
  logError("Error calling ListContexts:", error);
@@ -2766,7 +2812,7 @@ var _ContextService = class _ContextService {
2766
2812
  */
2767
2813
  async get(name, create = false) {
2768
2814
  try {
2769
- const request = new (0, _chunkW4B6JMPAcjs.GetContextRequest)({
2815
+ const request = new (0, _chunkQYUGADDCcjs.GetContextRequest)({
2770
2816
  name,
2771
2817
  allowCreate: create ? "true" : "false",
2772
2818
  authorization: `Bearer ${this.agentBay.getAPIKey()}`
@@ -2778,7 +2824,7 @@ var _ContextService = class _ContextService {
2778
2824
  logDebug(`Request: Name=${name}, AllowCreate=${create}`);
2779
2825
  const response = await this.agentBay.getClient().getContext(request);
2780
2826
  const requestId = extractRequestId(response) || "";
2781
- if (_optionalChain([response, 'access', _23 => _23.body, 'optionalAccess', _24 => _24.success]) === false && _optionalChain([response, 'access', _25 => _25.body, 'optionalAccess', _26 => _26.code])) {
2827
+ if (_optionalChain([response, 'access', _24 => _24.body, 'optionalAccess', _25 => _25.success]) === false && _optionalChain([response, 'access', _26 => _26.body, 'optionalAccess', _27 => _27.code])) {
2782
2828
  const errorMessage = `[${response.body.code}] ${response.body.message || "Unknown error"}`;
2783
2829
  const fullResponse2 = response.body ? JSON.stringify(response.body, null, 2) : "";
2784
2830
  logAPIResponseWithDetails("GetContext", requestId, false, void 0, fullResponse2);
@@ -2790,7 +2836,7 @@ var _ContextService = class _ContextService {
2790
2836
  errorMessage
2791
2837
  };
2792
2838
  }
2793
- const contextId = _optionalChain([response, 'access', _27 => _27.body, 'optionalAccess', _28 => _28.data, 'optionalAccess', _29 => _29.id]) || "";
2839
+ const contextId = _optionalChain([response, 'access', _28 => _28.body, 'optionalAccess', _29 => _29.data, 'optionalAccess', _30 => _30.id]) || "";
2794
2840
  if (!contextId) {
2795
2841
  logAPIResponseWithDetails("GetContext", requestId, false, void 0, "Context ID not found in response");
2796
2842
  return {
@@ -2888,7 +2934,7 @@ var _ContextService = class _ContextService {
2888
2934
  */
2889
2935
  async update(context) {
2890
2936
  try {
2891
- const request = new (0, _chunkW4B6JMPAcjs.ModifyContextRequest)({
2937
+ const request = new (0, _chunkQYUGADDCcjs.ModifyContextRequest)({
2892
2938
  id: context.id,
2893
2939
  name: context.name,
2894
2940
  authorization: `Bearer ${this.agentBay.getAPIKey()}`
@@ -2897,8 +2943,8 @@ var _ContextService = class _ContextService {
2897
2943
  logDebug(`Request: Id=${context.id}, Name=${context.name}`);
2898
2944
  const response = await this.agentBay.getClient().modifyContext(request);
2899
2945
  const requestId = extractRequestId(response) || "";
2900
- const success = _optionalChain([response, 'access', _30 => _30.body, 'optionalAccess', _31 => _31.success]) !== false;
2901
- const errorMessage = success ? "" : `[${_optionalChain([response, 'access', _32 => _32.body, 'optionalAccess', _33 => _33.code]) || "Unknown"}] ${_optionalChain([response, 'access', _34 => _34.body, 'optionalAccess', _35 => _35.message]) || "Unknown error"}`;
2946
+ const success = _optionalChain([response, 'access', _31 => _31.body, 'optionalAccess', _32 => _32.success]) !== false;
2947
+ const errorMessage = success ? "" : `[${_optionalChain([response, 'access', _33 => _33.body, 'optionalAccess', _34 => _34.code]) || "Unknown"}] ${_optionalChain([response, 'access', _35 => _35.body, 'optionalAccess', _36 => _36.message]) || "Unknown error"}`;
2902
2948
  const keyFields = {
2903
2949
  context_id: context.id,
2904
2950
  context_name: context.name
@@ -2939,7 +2985,7 @@ var _ContextService = class _ContextService {
2939
2985
  */
2940
2986
  async delete(context) {
2941
2987
  try {
2942
- const request = new (0, _chunkW4B6JMPAcjs.DeleteContextRequest)({
2988
+ const request = new (0, _chunkQYUGADDCcjs.DeleteContextRequest)({
2943
2989
  id: context.id,
2944
2990
  authorization: `Bearer ${this.agentBay.getAPIKey()}`
2945
2991
  });
@@ -2947,8 +2993,8 @@ var _ContextService = class _ContextService {
2947
2993
  logDebug(`Request: Id=${context.id}`);
2948
2994
  const response = await this.agentBay.getClient().deleteContext(request);
2949
2995
  const requestId = extractRequestId(response) || "";
2950
- const success = _optionalChain([response, 'access', _36 => _36.body, 'optionalAccess', _37 => _37.success]) !== false;
2951
- const errorMessage = success ? "" : `[${_optionalChain([response, 'access', _38 => _38.body, 'optionalAccess', _39 => _39.code]) || "Unknown"}] ${_optionalChain([response, 'access', _40 => _40.body, 'optionalAccess', _41 => _41.message]) || "Unknown error"}`;
2996
+ const success = _optionalChain([response, 'access', _37 => _37.body, 'optionalAccess', _38 => _38.success]) !== false;
2997
+ const errorMessage = success ? "" : `[${_optionalChain([response, 'access', _39 => _39.body, 'optionalAccess', _40 => _40.code]) || "Unknown"}] ${_optionalChain([response, 'access', _41 => _41.body, 'optionalAccess', _42 => _42.message]) || "Unknown error"}`;
2952
2998
  const keyFields = {
2953
2999
  context_id: context.id
2954
3000
  };
@@ -2990,7 +3036,7 @@ var _ContextService = class _ContextService {
2990
3036
  async getFileUploadUrl(contextId, filePath) {
2991
3037
  logAPICall("GetContextFileUploadUrl");
2992
3038
  logDebug(`Request: ContextId=${contextId}, FilePath=${filePath}`);
2993
- const req = new (0, _chunkW4B6JMPAcjs.GetContextFileUploadUrlRequest)({
3039
+ const req = new (0, _chunkQYUGADDCcjs.GetContextFileUploadUrlRequest)({
2994
3040
  authorization: `Bearer ${this.agentBay.getAPIKey()}`,
2995
3041
  contextId,
2996
3042
  filePath
@@ -2998,7 +3044,7 @@ var _ContextService = class _ContextService {
2998
3044
  const resp = await this.agentBay.getClient().getContextFileUploadUrl(req);
2999
3045
  const requestId = extractRequestId(resp) || "";
3000
3046
  const body = resp.body;
3001
- if (_optionalChain([body, 'optionalAccess', _42 => _42.success]) === false && body.code) {
3047
+ if (_optionalChain([body, 'optionalAccess', _43 => _43.success]) === false && body.code) {
3002
3048
  const errorMessage = `[${body.code}] ${body.message || "Unknown error"}`;
3003
3049
  const fullResponse2 = body ? JSON.stringify(body, null, 2) : "";
3004
3050
  logAPIResponseWithDetails("GetContextFileUploadUrl", requestId, false, void 0, fullResponse2);
@@ -3010,13 +3056,13 @@ var _ContextService = class _ContextService {
3010
3056
  errorMessage
3011
3057
  };
3012
3058
  }
3013
- const data = _optionalChain([body, 'optionalAccess', _43 => _43.data]);
3059
+ const data = _optionalChain([body, 'optionalAccess', _44 => _44.data]);
3014
3060
  const success = !!(body && body.success);
3015
3061
  const keyFields = {
3016
3062
  context_id: contextId,
3017
3063
  file_path: filePath
3018
3064
  };
3019
- if (_optionalChain([data, 'optionalAccess', _44 => _44.expireTime])) {
3065
+ if (_optionalChain([data, 'optionalAccess', _45 => _45.expireTime])) {
3020
3066
  keyFields.expire_time = data.expireTime;
3021
3067
  }
3022
3068
  const fullResponse = body ? JSON.stringify(body, null, 2) : "";
@@ -3024,8 +3070,8 @@ var _ContextService = class _ContextService {
3024
3070
  return {
3025
3071
  requestId,
3026
3072
  success,
3027
- url: _optionalChain([data, 'optionalAccess', _45 => _45.url]) || "",
3028
- expireTime: _optionalChain([data, 'optionalAccess', _46 => _46.expireTime]),
3073
+ url: _optionalChain([data, 'optionalAccess', _46 => _46.url]) || "",
3074
+ expireTime: _optionalChain([data, 'optionalAccess', _47 => _47.expireTime]),
3029
3075
  errorMessage: void 0
3030
3076
  };
3031
3077
  }
@@ -3050,7 +3096,7 @@ var _ContextService = class _ContextService {
3050
3096
  async getFileDownloadUrl(contextId, filePath) {
3051
3097
  logAPICall("GetContextFileDownloadUrl");
3052
3098
  logDebug(`Request: ContextId=${contextId}, FilePath=${filePath}`);
3053
- const req = new (0, _chunkW4B6JMPAcjs.GetContextFileDownloadUrlRequest)({
3099
+ const req = new (0, _chunkQYUGADDCcjs.GetContextFileDownloadUrlRequest)({
3054
3100
  authorization: `Bearer ${this.agentBay.getAPIKey()}`,
3055
3101
  contextId,
3056
3102
  filePath
@@ -3058,7 +3104,7 @@ var _ContextService = class _ContextService {
3058
3104
  const resp = await this.agentBay.getClient().getContextFileDownloadUrl(req);
3059
3105
  const requestId = extractRequestId(resp) || "";
3060
3106
  const body = resp.body;
3061
- if (_optionalChain([body, 'optionalAccess', _47 => _47.success]) === false && body.code) {
3107
+ if (_optionalChain([body, 'optionalAccess', _48 => _48.success]) === false && body.code) {
3062
3108
  const errorMessage = `[${body.code}] ${body.message || "Unknown error"}`;
3063
3109
  const fullResponse2 = body ? JSON.stringify(body, null, 2) : "";
3064
3110
  logAPIResponseWithDetails("GetContextFileDownloadUrl", requestId, false, void 0, fullResponse2);
@@ -3070,13 +3116,13 @@ var _ContextService = class _ContextService {
3070
3116
  errorMessage
3071
3117
  };
3072
3118
  }
3073
- const data = _optionalChain([body, 'optionalAccess', _48 => _48.data]);
3119
+ const data = _optionalChain([body, 'optionalAccess', _49 => _49.data]);
3074
3120
  const success = !!(body && body.success);
3075
3121
  const keyFields = {
3076
3122
  context_id: contextId,
3077
3123
  file_path: filePath
3078
3124
  };
3079
- if (_optionalChain([data, 'optionalAccess', _49 => _49.expireTime])) {
3125
+ if (_optionalChain([data, 'optionalAccess', _50 => _50.expireTime])) {
3080
3126
  keyFields.expire_time = data.expireTime;
3081
3127
  }
3082
3128
  const fullResponse = body ? JSON.stringify(body, null, 2) : "";
@@ -3084,8 +3130,8 @@ var _ContextService = class _ContextService {
3084
3130
  return {
3085
3131
  requestId,
3086
3132
  success,
3087
- url: _optionalChain([data, 'optionalAccess', _50 => _50.url]) || "",
3088
- expireTime: _optionalChain([data, 'optionalAccess', _51 => _51.expireTime]),
3133
+ url: _optionalChain([data, 'optionalAccess', _51 => _51.url]) || "",
3134
+ expireTime: _optionalChain([data, 'optionalAccess', _52 => _52.expireTime]),
3089
3135
  errorMessage: void 0
3090
3136
  };
3091
3137
  }
@@ -3109,7 +3155,7 @@ var _ContextService = class _ContextService {
3109
3155
  async deleteFile(contextId, filePath) {
3110
3156
  logAPICall("DeleteContextFile");
3111
3157
  logDebug(`Request: ContextId=${contextId}, FilePath=${filePath}`);
3112
- const req = new (0, _chunkW4B6JMPAcjs.DeleteContextFileRequest)({
3158
+ const req = new (0, _chunkQYUGADDCcjs.DeleteContextFileRequest)({
3113
3159
  authorization: `Bearer ${this.agentBay.getAPIKey()}`,
3114
3160
  contextId,
3115
3161
  filePath
@@ -3118,7 +3164,7 @@ var _ContextService = class _ContextService {
3118
3164
  const requestId = extractRequestId(resp) || "";
3119
3165
  const body = resp.body;
3120
3166
  const success = !!(body && body.success);
3121
- const errorMessage = success ? "" : `[${_optionalChain([body, 'optionalAccess', _52 => _52.code]) || "Unknown"}] ${_optionalChain([body, 'optionalAccess', _53 => _53.message]) || "Failed to delete file"}`;
3167
+ const errorMessage = success ? "" : `[${_optionalChain([body, 'optionalAccess', _53 => _53.code]) || "Unknown"}] ${_optionalChain([body, 'optionalAccess', _54 => _54.message]) || "Failed to delete file"}`;
3122
3168
  const keyFields = {
3123
3169
  context_id: contextId,
3124
3170
  file_path: filePath
@@ -3157,7 +3203,7 @@ var _ContextService = class _ContextService {
3157
3203
  logDebug(
3158
3204
  `Request: ContextId=${contextId}, ParentFolderPath=${parentFolderPath}, PageNumber=${pageNumber}, PageSize=${pageSize}`
3159
3205
  );
3160
- const req = new (0, _chunkW4B6JMPAcjs.DescribeContextFilesRequest)({
3206
+ const req = new (0, _chunkQYUGADDCcjs.DescribeContextFilesRequest)({
3161
3207
  authorization: `Bearer ${this.agentBay.getAPIKey()}`,
3162
3208
  pageNumber,
3163
3209
  pageSize,
@@ -3167,7 +3213,7 @@ var _ContextService = class _ContextService {
3167
3213
  const resp = await this.agentBay.getClient().describeContextFiles(req);
3168
3214
  const requestId = extractRequestId(resp) || "";
3169
3215
  const body = resp.body;
3170
- if (_optionalChain([body, 'optionalAccess', _54 => _54.success]) === false && body.code) {
3216
+ if (_optionalChain([body, 'optionalAccess', _55 => _55.success]) === false && body.code) {
3171
3217
  const errorMessage = `[${body.code}] ${body.message || "Unknown error"}`;
3172
3218
  const fullResponse2 = body ? JSON.stringify(body, null, 2) : "";
3173
3219
  logAPIResponseWithDetails("DescribeContextFiles", requestId, false, void 0, fullResponse2);
@@ -3179,7 +3225,7 @@ var _ContextService = class _ContextService {
3179
3225
  errorMessage
3180
3226
  };
3181
3227
  }
3182
- const rawList = _optionalChain([body, 'optionalAccess', _55 => _55.data]) || [];
3228
+ const rawList = _optionalChain([body, 'optionalAccess', _56 => _56.data]) || [];
3183
3229
  const entries = rawList.map((it) => ({
3184
3230
  fileId: it.fileId,
3185
3231
  fileName: it.fileName,
@@ -3198,7 +3244,7 @@ var _ContextService = class _ContextService {
3198
3244
  page_number: pageNumber,
3199
3245
  page_size: pageSize
3200
3246
  };
3201
- if (_optionalChain([body, 'optionalAccess', _56 => _56.count]) !== void 0) {
3247
+ if (_optionalChain([body, 'optionalAccess', _57 => _57.count]) !== void 0) {
3202
3248
  keyFields.count = body.count;
3203
3249
  }
3204
3250
  const fullResponse = body ? JSON.stringify(body, null, 2) : "";
@@ -3207,7 +3253,7 @@ var _ContextService = class _ContextService {
3207
3253
  requestId,
3208
3254
  success,
3209
3255
  entries,
3210
- count: _optionalChain([body, 'optionalAccess', _57 => _57.count]),
3256
+ count: _optionalChain([body, 'optionalAccess', _58 => _58.count]),
3211
3257
  errorMessage: void 0
3212
3258
  };
3213
3259
  }
@@ -3238,7 +3284,7 @@ var _ContextService = class _ContextService {
3238
3284
  try {
3239
3285
  logAPICall("ClearContext");
3240
3286
  logDebug(`Request: ContextId=${contextId}`);
3241
- const request = new (0, _chunkW4B6JMPAcjs.ClearContextRequest)({
3287
+ const request = new (0, _chunkQYUGADDCcjs.ClearContextRequest)({
3242
3288
  authorization: `Bearer ${this.agentBay.getAPIKey()}`,
3243
3289
  id: contextId
3244
3290
  });
@@ -3305,7 +3351,7 @@ var _ContextService = class _ContextService {
3305
3351
  try {
3306
3352
  logAPICall("GetContext");
3307
3353
  logDebug(`Request: ContextId=${contextId} (for clear status)`);
3308
- const request = new (0, _chunkW4B6JMPAcjs.GetContextRequest)({
3354
+ const request = new (0, _chunkQYUGADDCcjs.GetContextRequest)({
3309
3355
  authorization: `Bearer ${this.agentBay.getAPIKey()}`,
3310
3356
  contextId,
3311
3357
  allowCreate: "false"
@@ -3680,19 +3726,19 @@ function isValidUploadMode(uploadMode) {
3680
3726
  }
3681
3727
  _chunk4IPTHWLMcjs.__name.call(void 0, isValidUploadMode, "isValidUploadMode");
3682
3728
  function validateSyncPolicy(policy) {
3683
- if (_optionalChain([policy, 'optionalAccess', _58 => _58.bwList, 'optionalAccess', _59 => _59.whiteLists])) {
3729
+ if (_optionalChain([policy, 'optionalAccess', _59 => _59.bwList, 'optionalAccess', _60 => _60.whiteLists])) {
3684
3730
  for (const whitelist of policy.bwList.whiteLists) {
3685
3731
  WhiteListValidator.validate(whitelist);
3686
3732
  }
3687
3733
  }
3688
- if (_optionalChain([policy, 'optionalAccess', _60 => _60.uploadPolicy, 'optionalAccess', _61 => _61.uploadMode])) {
3734
+ if (_optionalChain([policy, 'optionalAccess', _61 => _61.uploadPolicy, 'optionalAccess', _62 => _62.uploadMode])) {
3689
3735
  if (!isValidUploadMode(policy.uploadPolicy.uploadMode)) {
3690
3736
  throw new Error(
3691
3737
  `Invalid uploadMode value: ${policy.uploadPolicy.uploadMode}. Valid values are: ${"File" /* File */}, ${"Archive" /* Archive */}`
3692
3738
  );
3693
3739
  }
3694
3740
  }
3695
- if (_optionalChain([policy, 'optionalAccess', _62 => _62.recyclePolicy])) {
3741
+ if (_optionalChain([policy, 'optionalAccess', _63 => _63.recyclePolicy])) {
3696
3742
  if (!isValidLifecycle(policy.recyclePolicy.lifecycle)) {
3697
3743
  const validValues = Object.values(Lifecycle).join(", ");
3698
3744
  throw new Error(
@@ -4354,7 +4400,7 @@ _chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
4354
4400
  // node_modules/zod-to-json-schema/dist/esm/errorMessages.js
4355
4401
  _chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
4356
4402
  function addErrorMessage(res, key, errorMessage, refs) {
4357
- if (!_optionalChain([refs, 'optionalAccess', _63 => _63.errorMessages]))
4403
+ if (!_optionalChain([refs, 'optionalAccess', _64 => _64.errorMessages]))
4358
4404
  return;
4359
4405
  if (errorMessage) {
4360
4406
  res.errorMessage = {
@@ -4894,7 +4940,7 @@ _chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
4894
4940
  var errorUtil;
4895
4941
  (function(errorUtil2) {
4896
4942
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
4897
- errorUtil2.toString = (message) => typeof message === "string" ? message : _optionalChain([message, 'optionalAccess', _64 => _64.message]);
4943
+ errorUtil2.toString = (message) => typeof message === "string" ? message : _optionalChain([message, 'optionalAccess', _65 => _65.message]);
4898
4944
  })(errorUtil || (errorUtil = {}));
4899
4945
 
4900
4946
  // node_modules/zod/v3/types.js
@@ -5013,10 +5059,10 @@ var _ZodType = class _ZodType {
5013
5059
  const ctx = {
5014
5060
  common: {
5015
5061
  issues: [],
5016
- async: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _65 => _65.async]), () => ( false)),
5017
- contextualErrorMap: _optionalChain([params, 'optionalAccess', _66 => _66.errorMap])
5062
+ async: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _66 => _66.async]), () => ( false)),
5063
+ contextualErrorMap: _optionalChain([params, 'optionalAccess', _67 => _67.errorMap])
5018
5064
  },
5019
- path: _optionalChain([params, 'optionalAccess', _67 => _67.path]) || [],
5065
+ path: _optionalChain([params, 'optionalAccess', _68 => _68.path]) || [],
5020
5066
  schemaErrorMap: this._def.errorMap,
5021
5067
  parent: null,
5022
5068
  data,
@@ -5046,7 +5092,7 @@ var _ZodType = class _ZodType {
5046
5092
  issues: ctx.common.issues
5047
5093
  };
5048
5094
  } catch (err) {
5049
- if (_optionalChain([err, 'optionalAccess', _68 => _68.message, 'optionalAccess', _69 => _69.toLowerCase, 'call', _70 => _70(), 'optionalAccess', _71 => _71.includes, 'call', _72 => _72("encountered")])) {
5095
+ if (_optionalChain([err, 'optionalAccess', _69 => _69.message, 'optionalAccess', _70 => _70.toLowerCase, 'call', _71 => _71(), 'optionalAccess', _72 => _72.includes, 'call', _73 => _73("encountered")])) {
5050
5096
  this["~standard"].async = true;
5051
5097
  }
5052
5098
  ctx.common = {
@@ -5071,10 +5117,10 @@ var _ZodType = class _ZodType {
5071
5117
  const ctx = {
5072
5118
  common: {
5073
5119
  issues: [],
5074
- contextualErrorMap: _optionalChain([params, 'optionalAccess', _73 => _73.errorMap]),
5120
+ contextualErrorMap: _optionalChain([params, 'optionalAccess', _74 => _74.errorMap]),
5075
5121
  async: true
5076
5122
  },
5077
- path: _optionalChain([params, 'optionalAccess', _74 => _74.path]) || [],
5123
+ path: _optionalChain([params, 'optionalAccess', _75 => _75.path]) || [],
5078
5124
  schemaErrorMap: this._def.errorMap,
5079
5125
  parent: null,
5080
5126
  data,
@@ -5311,7 +5357,7 @@ function isValidJWT(jwt, alg) {
5311
5357
  const decoded = JSON.parse(atob(base64));
5312
5358
  if (typeof decoded !== "object" || decoded === null)
5313
5359
  return false;
5314
- if ("typ" in decoded && _optionalChain([decoded, 'optionalAccess', _75 => _75.typ]) !== "JWT")
5360
+ if ("typ" in decoded && _optionalChain([decoded, 'optionalAccess', _76 => _76.typ]) !== "JWT")
5315
5361
  return false;
5316
5362
  if (!decoded.alg)
5317
5363
  return false;
@@ -5702,10 +5748,10 @@ var _ZodString = class _ZodString extends ZodType {
5702
5748
  }
5703
5749
  return this._addCheck({
5704
5750
  kind: "datetime",
5705
- precision: typeof _optionalChain([options, 'optionalAccess', _76 => _76.precision]) === "undefined" ? null : _optionalChain([options, 'optionalAccess', _77 => _77.precision]),
5706
- offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _78 => _78.offset]), () => ( false)),
5707
- local: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _79 => _79.local]), () => ( false)),
5708
- ...errorUtil.errToObj(_optionalChain([options, 'optionalAccess', _80 => _80.message]))
5751
+ precision: typeof _optionalChain([options, 'optionalAccess', _77 => _77.precision]) === "undefined" ? null : _optionalChain([options, 'optionalAccess', _78 => _78.precision]),
5752
+ offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _79 => _79.offset]), () => ( false)),
5753
+ local: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _80 => _80.local]), () => ( false)),
5754
+ ...errorUtil.errToObj(_optionalChain([options, 'optionalAccess', _81 => _81.message]))
5709
5755
  });
5710
5756
  }
5711
5757
  date(message) {
@@ -5721,8 +5767,8 @@ var _ZodString = class _ZodString extends ZodType {
5721
5767
  }
5722
5768
  return this._addCheck({
5723
5769
  kind: "time",
5724
- precision: typeof _optionalChain([options, 'optionalAccess', _81 => _81.precision]) === "undefined" ? null : _optionalChain([options, 'optionalAccess', _82 => _82.precision]),
5725
- ...errorUtil.errToObj(_optionalChain([options, 'optionalAccess', _83 => _83.message]))
5770
+ precision: typeof _optionalChain([options, 'optionalAccess', _82 => _82.precision]) === "undefined" ? null : _optionalChain([options, 'optionalAccess', _83 => _83.precision]),
5771
+ ...errorUtil.errToObj(_optionalChain([options, 'optionalAccess', _84 => _84.message]))
5726
5772
  });
5727
5773
  }
5728
5774
  duration(message) {
@@ -5739,8 +5785,8 @@ var _ZodString = class _ZodString extends ZodType {
5739
5785
  return this._addCheck({
5740
5786
  kind: "includes",
5741
5787
  value,
5742
- position: _optionalChain([options, 'optionalAccess', _84 => _84.position]),
5743
- ...errorUtil.errToObj(_optionalChain([options, 'optionalAccess', _85 => _85.message]))
5788
+ position: _optionalChain([options, 'optionalAccess', _85 => _85.position]),
5789
+ ...errorUtil.errToObj(_optionalChain([options, 'optionalAccess', _86 => _86.message]))
5744
5790
  });
5745
5791
  }
5746
5792
  startsWith(value, message) {
@@ -5877,7 +5923,7 @@ ZodString.create = (params) => {
5877
5923
  return new ZodString({
5878
5924
  checks: [],
5879
5925
  typeName: ZodFirstPartyTypeKind.ZodString,
5880
- coerce: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _86 => _86.coerce]), () => ( false)),
5926
+ coerce: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _87 => _87.coerce]), () => ( false)),
5881
5927
  ...processCreateParams(params)
5882
5928
  });
5883
5929
  };
@@ -6120,7 +6166,7 @@ ZodNumber.create = (params) => {
6120
6166
  return new ZodNumber({
6121
6167
  checks: [],
6122
6168
  typeName: ZodFirstPartyTypeKind.ZodNumber,
6123
- coerce: _optionalChain([params, 'optionalAccess', _87 => _87.coerce]) || false,
6169
+ coerce: _optionalChain([params, 'optionalAccess', _88 => _88.coerce]) || false,
6124
6170
  ...processCreateParams(params)
6125
6171
  });
6126
6172
  };
@@ -6294,7 +6340,7 @@ ZodBigInt.create = (params) => {
6294
6340
  return new ZodBigInt({
6295
6341
  checks: [],
6296
6342
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
6297
- coerce: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _88 => _88.coerce]), () => ( false)),
6343
+ coerce: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _89 => _89.coerce]), () => ( false)),
6298
6344
  ...processCreateParams(params)
6299
6345
  });
6300
6346
  };
@@ -6321,7 +6367,7 @@ var ZodBoolean = _ZodBoolean;
6321
6367
  ZodBoolean.create = (params) => {
6322
6368
  return new ZodBoolean({
6323
6369
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
6324
- coerce: _optionalChain([params, 'optionalAccess', _89 => _89.coerce]) || false,
6370
+ coerce: _optionalChain([params, 'optionalAccess', _90 => _90.coerce]) || false,
6325
6371
  ...processCreateParams(params)
6326
6372
  });
6327
6373
  };
@@ -6431,7 +6477,7 @@ var ZodDate = _ZodDate;
6431
6477
  ZodDate.create = (params) => {
6432
6478
  return new ZodDate({
6433
6479
  checks: [],
6434
- coerce: _optionalChain([params, 'optionalAccess', _90 => _90.coerce]) || false,
6480
+ coerce: _optionalChain([params, 'optionalAccess', _91 => _91.coerce]) || false,
6435
6481
  typeName: ZodFirstPartyTypeKind.ZodDate,
6436
6482
  ...processCreateParams(params)
6437
6483
  });
@@ -6822,7 +6868,7 @@ var _ZodObject = class _ZodObject extends ZodType {
6822
6868
  unknownKeys: "strict",
6823
6869
  ...message !== void 0 ? {
6824
6870
  errorMap: /* @__PURE__ */ _chunk4IPTHWLMcjs.__name.call(void 0, (issue, ctx) => {
6825
- const defaultError = _nullishCoalesce(_optionalChain([this, 'access', _91 => _91._def, 'access', _92 => _92.errorMap, 'optionalCall', _93 => _93(issue, ctx), 'access', _94 => _94.message]), () => ( ctx.defaultError));
6871
+ const defaultError = _nullishCoalesce(_optionalChain([this, 'access', _92 => _92._def, 'access', _93 => _93.errorMap, 'optionalCall', _94 => _94(issue, ctx), 'access', _95 => _95.message]), () => ( ctx.defaultError));
6826
6872
  if (issue.code === "unrecognized_keys")
6827
6873
  return {
6828
6874
  message: _nullishCoalesce(errorUtil.errToObj(message).message, () => ( defaultError))
@@ -8405,7 +8451,7 @@ function parseArrayDef(def, refs) {
8405
8451
  const res = {
8406
8452
  type: "array"
8407
8453
  };
8408
- if (_optionalChain([def, 'access', _95 => _95.type, 'optionalAccess', _96 => _96._def, 'optionalAccess', _97 => _97.typeName]) !== ZodFirstPartyTypeKind.ZodAny) {
8454
+ if (_optionalChain([def, 'access', _96 => _96.type, 'optionalAccess', _97 => _97._def, 'optionalAccess', _98 => _98.typeName]) !== ZodFirstPartyTypeKind.ZodAny) {
8409
8455
  res.items = parseDef(def.type._def, {
8410
8456
  ...refs,
8411
8457
  currentPath: [...refs.currentPath, "items"]
@@ -8763,7 +8809,7 @@ function parseStringDef(def, refs) {
8763
8809
  _chunk4IPTHWLMcjs.__name.call(void 0, parseStringDef, "parseStringDef");
8764
8810
  var escapeNonAlphaNumeric = /* @__PURE__ */ _chunk4IPTHWLMcjs.__name.call(void 0, (value) => Array.from(value).map((c) => /[a-zA-Z0-9]/.test(c) ? c : `\\${c}`).join(""), "escapeNonAlphaNumeric");
8765
8811
  var addFormat = /* @__PURE__ */ _chunk4IPTHWLMcjs.__name.call(void 0, (schema, value, message, refs) => {
8766
- if (schema.format || _optionalChain([schema, 'access', _98 => _98.anyOf, 'optionalAccess', _99 => _99.some, 'call', _100 => _100((x) => x.format)])) {
8812
+ if (schema.format || _optionalChain([schema, 'access', _99 => _99.anyOf, 'optionalAccess', _100 => _100.some, 'call', _101 => _101((x) => x.format)])) {
8767
8813
  if (!schema.anyOf) {
8768
8814
  schema.anyOf = [];
8769
8815
  }
@@ -8791,7 +8837,7 @@ var addFormat = /* @__PURE__ */ _chunk4IPTHWLMcjs.__name.call(void 0, (schema, v
8791
8837
  }
8792
8838
  }, "addFormat");
8793
8839
  var addPattern = /* @__PURE__ */ _chunk4IPTHWLMcjs.__name.call(void 0, (schema, value, message, refs) => {
8794
- if (schema.pattern || _optionalChain([schema, 'access', _101 => _101.allOf, 'optionalAccess', _102 => _102.some, 'call', _103 => _103((x) => x.pattern)])) {
8840
+ if (schema.pattern || _optionalChain([schema, 'access', _102 => _102.allOf, 'optionalAccess', _103 => _103.some, 'call', _104 => _104((x) => x.pattern)])) {
8795
8841
  if (!schema.allOf) {
8796
8842
  schema.allOf = [];
8797
8843
  }
@@ -8821,7 +8867,7 @@ var addPattern = /* @__PURE__ */ _chunk4IPTHWLMcjs.__name.call(void 0, (schema,
8821
8867
 
8822
8868
  // node_modules/zod-to-json-schema/dist/esm/parsers/record.js
8823
8869
  function parseRecordDef(def, refs) {
8824
- if (refs.target === "openApi3" && _optionalChain([def, 'access', _104 => _104.keyType, 'optionalAccess', _105 => _105._def, 'access', _106 => _106.typeName]) === ZodFirstPartyTypeKind.ZodEnum) {
8870
+ if (refs.target === "openApi3" && _optionalChain([def, 'access', _105 => _105.keyType, 'optionalAccess', _106 => _106._def, 'access', _107 => _107.typeName]) === ZodFirstPartyTypeKind.ZodEnum) {
8825
8871
  return {
8826
8872
  type: "object",
8827
8873
  required: def.keyType._def.values,
@@ -8845,13 +8891,13 @@ function parseRecordDef(def, refs) {
8845
8891
  if (refs.target === "openApi3") {
8846
8892
  return schema;
8847
8893
  }
8848
- if (_optionalChain([def, 'access', _107 => _107.keyType, 'optionalAccess', _108 => _108._def, 'access', _109 => _109.typeName]) === ZodFirstPartyTypeKind.ZodString && _optionalChain([def, 'access', _110 => _110.keyType, 'access', _111 => _111._def, 'access', _112 => _112.checks, 'optionalAccess', _113 => _113.length])) {
8894
+ if (_optionalChain([def, 'access', _108 => _108.keyType, 'optionalAccess', _109 => _109._def, 'access', _110 => _110.typeName]) === ZodFirstPartyTypeKind.ZodString && _optionalChain([def, 'access', _111 => _111.keyType, 'access', _112 => _112._def, 'access', _113 => _113.checks, 'optionalAccess', _114 => _114.length])) {
8849
8895
  const keyType = Object.entries(parseStringDef(def.keyType._def, refs)).reduce((acc, [key, value]) => key === "type" ? acc : { ...acc, [key]: value }, {});
8850
8896
  return {
8851
8897
  ...schema,
8852
8898
  propertyNames: keyType
8853
8899
  };
8854
- } else if (_optionalChain([def, 'access', _114 => _114.keyType, 'optionalAccess', _115 => _115._def, 'access', _116 => _116.typeName]) === ZodFirstPartyTypeKind.ZodEnum) {
8900
+ } else if (_optionalChain([def, 'access', _115 => _115.keyType, 'optionalAccess', _116 => _116._def, 'access', _117 => _117.typeName]) === ZodFirstPartyTypeKind.ZodEnum) {
8855
8901
  return {
8856
8902
  ...schema,
8857
8903
  propertyNames: {
@@ -9117,7 +9163,7 @@ _chunk4IPTHWLMcjs.__name.call(void 0, parseObjectDef, "parseObjectDef");
9117
9163
  // node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
9118
9164
  _chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
9119
9165
  var parseOptionalDef = /* @__PURE__ */ _chunk4IPTHWLMcjs.__name.call(void 0, (def, refs) => {
9120
- if (refs.currentPath.toString() === _optionalChain([refs, 'access', _117 => _117.propertyPath, 'optionalAccess', _118 => _118.toString, 'call', _119 => _119()])) {
9166
+ if (refs.currentPath.toString() === _optionalChain([refs, 'access', _118 => _118.propertyPath, 'optionalAccess', _119 => _119.toString, 'call', _120 => _120()])) {
9121
9167
  return parseDef(def.innerType._def, refs);
9122
9168
  }
9123
9169
  const innerSchema = parseDef(def.innerType._def, {
@@ -9395,7 +9441,7 @@ var zodToJsonSchema = /* @__PURE__ */ _chunk4IPTHWLMcjs.__name.call(void 0, (sch
9395
9441
  currentPath: [...refs.basePath, refs.definitionPath, name2]
9396
9442
  }, true), () => ( {}))
9397
9443
  }), {}) : void 0;
9398
- const name = typeof options === "string" ? options : _optionalChain([options, 'optionalAccess', _120 => _120.name]);
9444
+ const name = typeof options === "string" ? options : _optionalChain([options, 'optionalAccess', _121 => _121.name]);
9399
9445
  const main = _nullishCoalesce(parseDef(schema._def, name === void 0 ? refs : {
9400
9446
  ...refs,
9401
9447
  currentPath: [...refs.basePath, refs.definitionPath, name]
@@ -10716,7 +10762,7 @@ var _Browser = class _Browser {
10716
10762
  }
10717
10763
  try {
10718
10764
  logDebug(`Initializing browser with option: ${JSON.stringify(option)}`);
10719
- const request = new (0, _chunkW4B6JMPAcjs.InitBrowserRequest)();
10765
+ const request = new (0, _chunkQYUGADDCcjs.InitBrowserRequest)();
10720
10766
  request.authorization = `Bearer ${this.session.getAPIKey()}`;
10721
10767
  request.persistentPath = BROWSER_DATA_PATH;
10722
10768
  request.sessionId = this.session.getSessionId();
@@ -10735,8 +10781,8 @@ var _Browser = class _Browser {
10735
10781
  request.browserOption = browserOptionMap;
10736
10782
  }
10737
10783
  const response = this.session.getClient().initBrowserSync(request);
10738
- logDebug(`Response from init_browser data:`, _optionalChain([response, 'access', _121 => _121.body, 'optionalAccess', _122 => _122.data]));
10739
- const success = _optionalChain([response, 'access', _123 => _123.body, 'optionalAccess', _124 => _124.data, 'optionalAccess', _125 => _125.port]) !== null && _optionalChain([response, 'access', _126 => _126.body, 'optionalAccess', _127 => _127.data, 'optionalAccess', _128 => _128.port]) !== void 0;
10784
+ logDebug(`Response from init_browser data:`, _optionalChain([response, 'access', _122 => _122.body, 'optionalAccess', _123 => _123.data]));
10785
+ const success = _optionalChain([response, 'access', _124 => _124.body, 'optionalAccess', _125 => _125.data, 'optionalAccess', _126 => _126.port]) !== null && _optionalChain([response, 'access', _127 => _127.body, 'optionalAccess', _128 => _128.data, 'optionalAccess', _129 => _129.port]) !== void 0;
10740
10786
  if (success) {
10741
10787
  this._initialized = true;
10742
10788
  this._option = browserOption;
@@ -10775,7 +10821,7 @@ var _Browser = class _Browser {
10775
10821
  }
10776
10822
  try {
10777
10823
  logDebug(`Initializing browser asynchronously with option: ${JSON.stringify(option)}`);
10778
- const request = new (0, _chunkW4B6JMPAcjs.InitBrowserRequest)();
10824
+ const request = new (0, _chunkQYUGADDCcjs.InitBrowserRequest)();
10779
10825
  request.authorization = `Bearer ${this.session.getAPIKey()}`;
10780
10826
  request.persistentPath = BROWSER_DATA_PATH;
10781
10827
  request.sessionId = this.session.getSessionId();
@@ -10794,17 +10840,17 @@ var _Browser = class _Browser {
10794
10840
  request.browserOption = browserOptionMap;
10795
10841
  }
10796
10842
  const response = await this.session.getClient().initBrowser(request);
10797
- const requestId = _optionalChain([response, 'access', _129 => _129.body, 'optionalAccess', _130 => _130.requestId]) || "";
10843
+ const requestId = _optionalChain([response, 'access', _130 => _130.body, 'optionalAccess', _131 => _131.requestId]) || "";
10798
10844
  setRequestId(requestId);
10799
- const success = _optionalChain([response, 'access', _131 => _131.body, 'optionalAccess', _132 => _132.data, 'optionalAccess', _133 => _133.port]) !== null && _optionalChain([response, 'access', _134 => _134.body, 'optionalAccess', _135 => _135.data, 'optionalAccess', _136 => _136.port]) !== void 0;
10845
+ const success = _optionalChain([response, 'access', _132 => _132.body, 'optionalAccess', _133 => _133.data, 'optionalAccess', _134 => _134.port]) !== null && _optionalChain([response, 'access', _135 => _135.body, 'optionalAccess', _136 => _136.data, 'optionalAccess', _137 => _137.port]) !== void 0;
10800
10846
  if (success) {
10801
10847
  logAPIResponseWithDetails(
10802
10848
  "InitBrowser",
10803
10849
  requestId,
10804
10850
  true,
10805
10851
  {
10806
- port: _optionalChain([response, 'access', _137 => _137.body, 'optionalAccess', _138 => _138.data, 'optionalAccess', _139 => _139.port]),
10807
- endpoint: _optionalChain([response, 'access', _140 => _140.body, 'optionalAccess', _141 => _141.data, 'optionalAccess', _142 => _142.endpoint])
10852
+ port: _optionalChain([response, 'access', _138 => _138.body, 'optionalAccess', _139 => _139.data, 'optionalAccess', _140 => _140.port]),
10853
+ endpoint: _optionalChain([response, 'access', _141 => _141.body, 'optionalAccess', _142 => _142.data, 'optionalAccess', _143 => _143.endpoint])
10808
10854
  }
10809
10855
  );
10810
10856
  this._initialized = true;
@@ -10866,7 +10912,7 @@ var _Browser = class _Browser {
10866
10912
  logDebug(`VPC mode, endpoint_router_port: ${this.session.httpPort}`);
10867
10913
  this._endpointUrl = `ws://${this.session.networkInterfaceIp}:${this.session.httpPort}`;
10868
10914
  } else {
10869
- const { GetCdpLinkRequest: GetCdpLinkRequest2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./model-EYDBEIKS.cjs")));
10915
+ const { GetCdpLinkRequest: GetCdpLinkRequest2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./model-TL7UT6WY.cjs")));
10870
10916
  const request = new GetCdpLinkRequest2({
10871
10917
  authorization: `Bearer ${this.session.getAPIKey()}`,
10872
10918
  sessionId: this.session.sessionId
@@ -10875,7 +10921,7 @@ var _Browser = class _Browser {
10875
10921
  if (response.body && response.body.success && response.body.data) {
10876
10922
  this._endpointUrl = response.body.data.url || null;
10877
10923
  } else {
10878
- const errorMsg = _optionalChain([response, 'access', _143 => _143.body, 'optionalAccess', _144 => _144.message]) || "Unknown error";
10924
+ const errorMsg = _optionalChain([response, 'access', _144 => _144.body, 'optionalAccess', _145 => _145.message]) || "Unknown error";
10879
10925
  throw new BrowserError(`Failed to get CDP link: ${errorMsg}`);
10880
10926
  }
10881
10927
  }
@@ -11897,7 +11943,7 @@ var _Computer = class _Computer {
11897
11943
  data: ""
11898
11944
  };
11899
11945
  }
11900
- const screenshotUrl = _optionalChain([result, 'access', _145 => _145.content, 'optionalAccess', _146 => _146[0], 'optionalAccess', _147 => _147.text]) || "";
11946
+ const screenshotUrl = _optionalChain([result, 'access', _146 => _146.content, 'optionalAccess', _147 => _147[0], 'optionalAccess', _148 => _148.text]) || "";
11901
11947
  return {
11902
11948
  success: true,
11903
11949
  requestId: result.requestId || "",
@@ -12583,7 +12629,7 @@ var _ContextManager = class _ContextManager {
12583
12629
  * ```
12584
12630
  */
12585
12631
  async infoWithParams(contextId, path6, taskType) {
12586
- const request = new (0, _chunkW4B6JMPAcjs.GetContextInfoRequest)({
12632
+ const request = new (0, _chunkQYUGADDCcjs.GetContextInfoRequest)({
12587
12633
  authorization: `Bearer ${this.session.getAPIKey()}`,
12588
12634
  sessionId: this.session.getSessionId()
12589
12635
  });
@@ -12611,7 +12657,7 @@ var _ContextManager = class _ContextManager {
12611
12657
  try {
12612
12658
  const response = await this.session.getClient().getContextInfo(request);
12613
12659
  const requestId = extractRequestId(response) || "";
12614
- if (_optionalChain([response, 'optionalAccess', _148 => _148.body, 'optionalAccess', _149 => _149.success]) === false && response.body.code) {
12660
+ if (_optionalChain([response, 'optionalAccess', _149 => _149.body, 'optionalAccess', _150 => _150.success]) === false && response.body.code) {
12615
12661
  const errorMsg = `[${response.body.code}] ${response.body.message || "Unknown error"}`;
12616
12662
  const fullResponse2 = response.body ? JSON.stringify(response.body, null, 2) : "";
12617
12663
  logAPIResponseWithDetails("GetContextInfo", requestId, false, void 0, fullResponse2);
@@ -12623,7 +12669,7 @@ var _ContextManager = class _ContextManager {
12623
12669
  };
12624
12670
  }
12625
12671
  const contextStatusData = [];
12626
- if (_optionalChain([response, 'optionalAccess', _150 => _150.body, 'optionalAccess', _151 => _151.data, 'optionalAccess', _152 => _152.contextStatus])) {
12672
+ if (_optionalChain([response, 'optionalAccess', _151 => _151.body, 'optionalAccess', _152 => _152.data, 'optionalAccess', _153 => _153.contextStatus])) {
12627
12673
  try {
12628
12674
  const contextStatusStr = response.body.data.contextStatus;
12629
12675
  const statusItems = JSON.parse(contextStatusStr);
@@ -12710,7 +12756,7 @@ var _ContextManager = class _ContextManager {
12710
12756
  "contextId and path must be provided together or both omitted. If you want to sync a specific context, both contextId and path are required. If you want to sync all contexts, omit both parameters."
12711
12757
  );
12712
12758
  }
12713
- const request = new (0, _chunkW4B6JMPAcjs.SyncContextRequest)({
12759
+ const request = new (0, _chunkQYUGADDCcjs.SyncContextRequest)({
12714
12760
  authorization: `Bearer ${this.session.getAPIKey()}`,
12715
12761
  sessionId: this.session.getSessionId()
12716
12762
  });
@@ -12738,7 +12784,7 @@ var _ContextManager = class _ContextManager {
12738
12784
  try {
12739
12785
  const response = await this.session.getClient().syncContext(request);
12740
12786
  const requestId = extractRequestId(response) || "";
12741
- if (_optionalChain([response, 'optionalAccess', _153 => _153.body, 'optionalAccess', _154 => _154.success]) === false && response.body.code) {
12787
+ if (_optionalChain([response, 'optionalAccess', _154 => _154.body, 'optionalAccess', _155 => _155.success]) === false && response.body.code) {
12742
12788
  const errorMsg = `[${response.body.code}] ${response.body.message || "Unknown error"}`;
12743
12789
  const fullResponse2 = response.body ? JSON.stringify(response.body, null, 2) : "";
12744
12790
  logAPIResponseWithDetails("SyncContext", requestId, false, void 0, fullResponse2);
@@ -12749,7 +12795,7 @@ var _ContextManager = class _ContextManager {
12749
12795
  };
12750
12796
  }
12751
12797
  let success = false;
12752
- if (_optionalChain([response, 'optionalAccess', _155 => _155.body, 'optionalAccess', _156 => _156.success]) !== void 0) {
12798
+ if (_optionalChain([response, 'optionalAccess', _156 => _156.body, 'optionalAccess', _157 => _157.success]) !== void 0) {
12753
12799
  success = response.body.success;
12754
12800
  }
12755
12801
  const keyFields = {
@@ -12918,13 +12964,14 @@ var _nodefetch = require('node-fetch'); var _nodefetch2 = _interopRequireDefault
12918
12964
  var _FileTransfer = class _FileTransfer {
12919
12965
  /**
12920
12966
  * Initialize FileTransfer with AgentBay client and session.
12921
- *
12967
+ *
12922
12968
  * @param agentBay - AgentBay instance for context service access
12923
12969
  * @param session - Created session object for context operations
12924
12970
  * @param httpTimeout - HTTP request timeout in seconds (default: 60.0)
12925
12971
  * @param followRedirects - Whether to follow HTTP redirects (default: true)
12926
12972
  */
12927
12973
  constructor(agentBay, session, httpTimeout = 60, followRedirects = true) {
12974
+ this.contextPath = null;
12928
12975
  // Task completion states (for compatibility)
12929
12976
  this.finishedStates = /* @__PURE__ */ new Set(["success", "successful", "ok", "finished", "done", "completed", "complete"]);
12930
12977
  this.agentBay = agentBay;
@@ -12932,7 +12979,60 @@ var _FileTransfer = class _FileTransfer {
12932
12979
  this.session = session;
12933
12980
  this.httpTimeout = httpTimeout;
12934
12981
  this.followRedirects = followRedirects;
12935
- this.contextId = session.fileTransferContextId || "";
12982
+ this.contextId = "";
12983
+ }
12984
+ /**
12985
+ * Get the current context ID.
12986
+ * @returns The context ID, or empty string if not yet loaded
12987
+ */
12988
+ getContextId() {
12989
+ return this.contextId;
12990
+ }
12991
+ /**
12992
+ * Ensure the file transfer context id is set by calling GetAndLoadInternalContext with SessionId and ContextTypes=["file_transfer"].
12993
+ * Returns [success: boolean, errorMessage: string] tuple.
12994
+ */
12995
+ async ensureContextId() {
12996
+ if (this.contextId) {
12997
+ return [true, ""];
12998
+ }
12999
+ try {
13000
+ const sid = this.session.getSessionId();
13001
+ if (!sid) return [false, "No session ID"];
13002
+ const client = this.agentBay.getClient();
13003
+ let response;
13004
+ try {
13005
+ const req = {
13006
+ authorization: `Bearer ${this.agentBay.getAPIKey()}`,
13007
+ sessionId: sid,
13008
+ contextTypes: ["file_transfer"]
13009
+ };
13010
+ response = await client.getAndLoadInternalContext(req);
13011
+ } catch (e) {
13012
+ return [false, _optionalChain([e, 'optionalAccess', _158 => _158.message]) || String(e)];
13013
+ }
13014
+ const body = response && response.body ? response.body : {};
13015
+ if (body.Success === false && body.Code) {
13016
+ return [false, body.Message || "Unknown error"];
13017
+ }
13018
+ const data = body.Data || body.data;
13019
+ if (Array.isArray(data) && data.length > 0) {
13020
+ for (const item of data) {
13021
+ if (item && typeof item === "object") {
13022
+ const context_id = item.ContextId || item.contextId;
13023
+ const context_path = item.ContextPath || item.contextPath;
13024
+ if (context_id && context_path) {
13025
+ this.contextId = context_id;
13026
+ this.contextPath = context_path;
13027
+ return [true, ""];
13028
+ }
13029
+ }
13030
+ }
13031
+ }
13032
+ return [false, "Response contains no data"];
13033
+ } catch (e) {
13034
+ return [false, _optionalChain([e, 'optionalAccess', _159 => _159.message]) || String(e)];
13035
+ }
12936
13036
  }
12937
13037
  /**
12938
13038
  * Upload workflow:
@@ -12961,12 +13061,15 @@ var _FileTransfer = class _FileTransfer {
12961
13061
  };
12962
13062
  }
12963
13063
  if (!this.contextId) {
12964
- return {
12965
- success: false,
12966
- bytesSent: 0,
12967
- path: remotePath,
12968
- error: "No context ID"
12969
- };
13064
+ const [success, errorMsg] = await this.ensureContextId();
13065
+ if (!success) {
13066
+ return {
13067
+ success: false,
13068
+ bytesSent: 0,
13069
+ path: remotePath,
13070
+ error: errorMsg || "No context ID"
13071
+ };
13072
+ }
12970
13073
  }
12971
13074
  const urlRes = await this.contextSvc.getFileUploadUrl(this.contextId, remotePath);
12972
13075
  if (!urlRes.success || !urlRes.url) {
@@ -13076,7 +13179,7 @@ var _FileTransfer = class _FileTransfer {
13076
13179
  * 1) Trigger session.context.sync(mode="upload") to sync cloud disk data to OSS
13077
13180
  * 2) Get pre-signed download URL via context.getFileDownloadUrl
13078
13181
  * 3) Download the file and save to local localPath
13079
- * 4) If wait=true, wait for download task to reach completion after step 1
13182
+ * 4) If wait=true, wait for download task to reach completion after step 1
13080
13183
  * (ensuring backend has prepared the download object)
13081
13184
  *
13082
13185
  * Returns DownloadResult containing sync and download request_ids, HTTP status, byte count, etc.
@@ -13091,13 +13194,16 @@ var _FileTransfer = class _FileTransfer {
13091
13194
  } = options || {};
13092
13195
  try {
13093
13196
  if (!this.contextId) {
13094
- return {
13095
- success: false,
13096
- bytesReceived: 0,
13097
- path: remotePath,
13098
- localPath,
13099
- error: "No context ID"
13100
- };
13197
+ const [success, errorMsg] = await this.ensureContextId();
13198
+ if (!success) {
13199
+ return {
13200
+ success: false,
13201
+ bytesReceived: 0,
13202
+ path: remotePath,
13203
+ localPath,
13204
+ error: errorMsg || "No context ID"
13205
+ };
13206
+ }
13101
13207
  }
13102
13208
  let reqIdSync;
13103
13209
  try {
@@ -13456,7 +13562,7 @@ var _FileSystem = class _FileSystem {
13456
13562
  }
13457
13563
  /**
13458
13564
  * Ensure FileTransfer is initialized with the current session.
13459
- *
13565
+ *
13460
13566
  * @returns The FileTransfer instance
13461
13567
  */
13462
13568
  _ensureFileTransfer() {
@@ -13469,6 +13575,30 @@ var _FileSystem = class _FileSystem {
13469
13575
  }
13470
13576
  return this._fileTransfer;
13471
13577
  }
13578
+ /**
13579
+ * Get the context path for file transfer operations.
13580
+ *
13581
+ * This method ensures the context ID is loaded and returns the associated
13582
+ * context path that was retrieved from GetAndLoadInternalContext API.
13583
+ *
13584
+ * @returns The context path if available, null otherwise.
13585
+ *
13586
+ * @example
13587
+ * ```typescript
13588
+ * const session = (await agentBay.create(params)).session;
13589
+ * const contextPath = await session.fileSystem.getFileTransferContextPath();
13590
+ * if (contextPath) {
13591
+ * console.log(`Context path: ${contextPath}`);
13592
+ * }
13593
+ * ```
13594
+ */
13595
+ async getFileTransferContextPath() {
13596
+ const fileTransfer = this._ensureFileTransfer();
13597
+ if (!fileTransfer.getContextId()) {
13598
+ await fileTransfer.ensureContextId();
13599
+ }
13600
+ return fileTransfer.contextPath || null;
13601
+ }
13472
13602
  /**
13473
13603
  * Creates a new directory at the specified path.
13474
13604
  * Corresponds to Python's create_directory() method
@@ -14298,7 +14428,7 @@ var _FileSystem = class _FileSystem {
14298
14428
  console.log(`Starting directory monitoring for: ${path6}`);
14299
14429
  console.log(`Polling interval: ${interval} ms`);
14300
14430
  const monitor = /* @__PURE__ */ _chunk4IPTHWLMcjs.__name.call(void 0, async () => {
14301
- while (!_optionalChain([signal, 'optionalAccess', _157 => _157.aborted])) {
14431
+ while (!_optionalChain([signal, 'optionalAccess', _160 => _160.aborted])) {
14302
14432
  try {
14303
14433
  if (this.session._isExpired && this.session._isExpired()) {
14304
14434
  console.log(`Session expired, stopping directory monitoring for: ${path6}`);
@@ -14325,7 +14455,7 @@ var _FileSystem = class _FileSystem {
14325
14455
  }
14326
14456
  await new Promise((resolve2) => {
14327
14457
  const timeoutId = setTimeout(resolve2, interval);
14328
- _optionalChain([signal, 'optionalAccess', _158 => _158.addEventListener, 'call', _159 => _159("abort", () => {
14458
+ _optionalChain([signal, 'optionalAccess', _161 => _161.addEventListener, 'call', _162 => _162("abort", () => {
14329
14459
  clearTimeout(timeoutId);
14330
14460
  resolve2(void 0);
14331
14461
  })]);
@@ -14368,8 +14498,8 @@ var _FileSystem = class _FileSystem {
14368
14498
  try {
14369
14499
  const fileTransfer = this._ensureFileTransfer();
14370
14500
  const result = await fileTransfer.upload(localPath, remotePath, options);
14371
- if (result.success && this.session.fileTransferContextId) {
14372
- const contextId = this.session.fileTransferContextId;
14501
+ if (result.success) {
14502
+ const contextId = fileTransfer.contextId;
14373
14503
  if (contextId) {
14374
14504
  try {
14375
14505
  const deleteResult = await this.session.agentBay.context.deleteFile(contextId, remotePath);
@@ -14416,8 +14546,8 @@ var _FileSystem = class _FileSystem {
14416
14546
  try {
14417
14547
  const fileTransfer = this._ensureFileTransfer();
14418
14548
  const result = await fileTransfer.download(remotePath, localPath, options);
14419
- if (result.success && this.session.fileTransferContextId) {
14420
- const contextId = this.session.fileTransferContextId;
14549
+ if (result.success) {
14550
+ const contextId = fileTransfer.contextId;
14421
14551
  if (contextId) {
14422
14552
  try {
14423
14553
  const deleteResult = await this.session.agentBay.context.deleteFile(contextId, remotePath);
@@ -14928,7 +15058,7 @@ var _Mobile = class _Mobile {
14928
15058
  async getAdbUrl(adbkeyPub) {
14929
15059
  try {
14930
15060
  const optionsJson = JSON.stringify({ adbkey_pub: adbkeyPub });
14931
- const { GetAdbLinkRequest: GetAdbLinkRequest2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./model-EYDBEIKS.cjs")));
15061
+ const { GetAdbLinkRequest: GetAdbLinkRequest2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./model-TL7UT6WY.cjs")));
14932
15062
  const request = new GetAdbLinkRequest2({
14933
15063
  authorization: `Bearer ${this.session.getAPIKey()}`,
14934
15064
  sessionId: this.session.sessionId,
@@ -14947,8 +15077,8 @@ var _Mobile = class _Mobile {
14947
15077
  url: adbUrl
14948
15078
  };
14949
15079
  } else {
14950
- const errorMsg = _optionalChain([response, 'access', _160 => _160.body, 'optionalAccess', _161 => _161.message]) || "Unknown error";
14951
- const requestId = _optionalChain([response, 'access', _162 => _162.body, 'optionalAccess', _163 => _163.requestId]) || "";
15080
+ const errorMsg = _optionalChain([response, 'access', _163 => _163.body, 'optionalAccess', _164 => _164.message]) || "Unknown error";
15081
+ const requestId = _optionalChain([response, 'access', _165 => _165.body, 'optionalAccess', _166 => _166.requestId]) || "";
14952
15082
  logError(`\u274C Failed to get ADB URL: ${errorMsg}`);
14953
15083
  return {
14954
15084
  success: false,
@@ -15220,11 +15350,11 @@ var _Mobile = class _Mobile {
15220
15350
  errorMessage: ""
15221
15351
  };
15222
15352
  } else {
15223
- const errorMessage = _optionalChain([result, 'optionalAccess', _164 => _164.errorMessage]) || `Failed to execute ${description}`;
15353
+ const errorMessage = _optionalChain([result, 'optionalAccess', _167 => _167.errorMessage]) || `Failed to execute ${description}`;
15224
15354
  logError(`Failed to execute ${description}: ${errorMessage}`);
15225
15355
  return {
15226
15356
  success: false,
15227
- requestId: _optionalChain([result, 'optionalAccess', _165 => _165.requestId]) || "",
15357
+ requestId: _optionalChain([result, 'optionalAccess', _168 => _168.requestId]) || "",
15228
15358
  errorMessage
15229
15359
  };
15230
15360
  }
@@ -15537,10 +15667,6 @@ var _Session = class _Session {
15537
15667
  * @param sessionId - The ID of this session.
15538
15668
  */
15539
15669
  constructor(agentBay, sessionId) {
15540
- // File transfer context ID
15541
- this.fileTransferContextId = null;
15542
- // Browser recording context ID
15543
- this.recordContextId = null;
15544
15670
  // VPC-related information
15545
15671
  this.isVpc = false;
15546
15672
  // Whether this session uses VPC resources
@@ -15707,32 +15833,15 @@ var _Session = class _Session {
15707
15833
  */
15708
15834
  async delete(syncContext = false) {
15709
15835
  try {
15710
- let shouldSync = false;
15711
- let syncContextId = null;
15712
15836
  if (syncContext) {
15713
- shouldSync = true;
15714
- logInfo("\u{1F504} User requested context synchronization");
15715
- } else if (this.enableBrowserReplay && this.recordContextId) {
15716
- shouldSync = true;
15717
- syncContextId = this.recordContextId;
15718
- logInfo(
15719
- `\u{1F3A5} Browser replay enabled - syncing recording context: ${syncContextId}`
15720
- );
15721
- }
15722
- if (shouldSync) {
15723
15837
  logDebug(
15724
15838
  "Triggering context synchronization before session deletion..."
15725
15839
  );
15726
15840
  const syncStartTime = Date.now();
15727
15841
  try {
15728
15842
  let syncResult;
15729
- if (syncContextId) {
15730
- syncResult = await this.context.sync(syncContextId, BROWSER_RECORD_PATH);
15731
- logInfo(`\u{1F3A5} Synced browser recording context: ${syncContextId}`);
15732
- } else {
15733
- syncResult = await this.context.sync();
15734
- logInfo("\u{1F504} Synced all contexts");
15735
- }
15843
+ syncResult = await this.context.sync();
15844
+ logInfo("\u{1F504} Synced all contexts");
15736
15845
  const syncDuration = Date.now() - syncStartTime;
15737
15846
  if (syncResult.success) {
15738
15847
  logInfo(`Context sync completed in ${syncDuration}ms`);
@@ -15749,7 +15858,7 @@ var _Session = class _Session {
15749
15858
  );
15750
15859
  }
15751
15860
  }
15752
- const request = new (0, _chunkW4B6JMPAcjs.ReleaseMcpSessionRequest)({
15861
+ const request = new (0, _chunkQYUGADDCcjs.ReleaseMcpSessionRequest)({
15753
15862
  authorization: `Bearer ${this.getAPIKey()}`,
15754
15863
  sessionId: this.sessionId
15755
15864
  });
@@ -15759,9 +15868,9 @@ var _Session = class _Session {
15759
15868
  );
15760
15869
  const requestId = extractRequestId(response) || "";
15761
15870
  const responseBody = response.body;
15762
- const success = _optionalChain([responseBody, 'optionalAccess', _166 => _166.success]) !== false;
15871
+ const success = _optionalChain([responseBody, 'optionalAccess', _169 => _169.success]) !== false;
15763
15872
  if (!success) {
15764
- const errorMessage = `[${_optionalChain([responseBody, 'optionalAccess', _167 => _167.code]) || "Unknown"}] ${_optionalChain([responseBody, 'optionalAccess', _168 => _168.message]) || "Failed to delete session"}`;
15873
+ const errorMessage = `[${_optionalChain([responseBody, 'optionalAccess', _170 => _170.code]) || "Unknown"}] ${_optionalChain([responseBody, 'optionalAccess', _171 => _171.message]) || "Failed to delete session"}`;
15765
15874
  return {
15766
15875
  requestId,
15767
15876
  success: false,
@@ -15859,7 +15968,7 @@ var _Session = class _Session {
15859
15968
  return validationResult;
15860
15969
  }
15861
15970
  const labelsJSON = JSON.stringify(labels);
15862
- const request = new (0, _chunkW4B6JMPAcjs.SetLabelRequest)({
15971
+ const request = new (0, _chunkQYUGADDCcjs.SetLabelRequest)({
15863
15972
  authorization: `Bearer ${this.getAPIKey()}`,
15864
15973
  sessionId: this.sessionId,
15865
15974
  labels: labelsJSON
@@ -15897,15 +16006,15 @@ var _Session = class _Session {
15897
16006
  */
15898
16007
  async getLabels() {
15899
16008
  try {
15900
- const request = new (0, _chunkW4B6JMPAcjs.GetLabelRequest)({
16009
+ const request = new (0, _chunkQYUGADDCcjs.GetLabelRequest)({
15901
16010
  authorization: `Bearer ${this.getAPIKey()}`,
15902
16011
  sessionId: this.sessionId
15903
16012
  });
15904
16013
  const response = await this.getClient().getLabel(request);
15905
16014
  const requestId = extractRequestId(response) || "";
15906
- const responseBody = _optionalChain([response, 'optionalAccess', _169 => _169.body]);
15907
- const data = _optionalChain([responseBody, 'optionalAccess', _170 => _170.data]);
15908
- const labelsJSON = _optionalChain([data, 'optionalAccess', _171 => _171.labels]);
16015
+ const responseBody = _optionalChain([response, 'optionalAccess', _172 => _172.body]);
16016
+ const data = _optionalChain([responseBody, 'optionalAccess', _173 => _173.data]);
16017
+ const labelsJSON = _optionalChain([data, 'optionalAccess', _174 => _174.labels]);
15909
16018
  let labels = {};
15910
16019
  if (labelsJSON) {
15911
16020
  labels = JSON.parse(labelsJSON);
@@ -15970,7 +16079,7 @@ var _Session = class _Session {
15970
16079
  */
15971
16080
  async info() {
15972
16081
  try {
15973
- const request = new (0, _chunkW4B6JMPAcjs.GetMcpResourceRequest)({
16082
+ const request = new (0, _chunkQYUGADDCcjs.GetMcpResourceRequest)({
15974
16083
  authorization: `Bearer ${this.getAPIKey()}`,
15975
16084
  sessionId: this.sessionId
15976
16085
  });
@@ -15978,7 +16087,7 @@ var _Session = class _Session {
15978
16087
  logDebug(`Request: SessionId=${this.sessionId}`);
15979
16088
  const response = await this.getClient().getMcpResource(request);
15980
16089
  const requestId = extractRequestId(response) || "";
15981
- if (_optionalChain([response, 'optionalAccess', _172 => _172.body, 'optionalAccess', _173 => _173.success]) === false && _optionalChain([response, 'access', _174 => _174.body, 'optionalAccess', _175 => _175.code])) {
16090
+ if (_optionalChain([response, 'optionalAccess', _175 => _175.body, 'optionalAccess', _176 => _176.success]) === false && _optionalChain([response, 'access', _177 => _177.body, 'optionalAccess', _178 => _178.code])) {
15982
16091
  const errorMessage = `[${response.body.code}] ${response.body.message || "Unknown error"}`;
15983
16092
  const fullResponse2 = response.body ? JSON.stringify(response.body, null, 2) : "";
15984
16093
  logAPIResponseWithDetails(
@@ -15995,15 +16104,15 @@ var _Session = class _Session {
15995
16104
  };
15996
16105
  }
15997
16106
  const responseBody = response.body;
15998
- const data = _optionalChain([responseBody, 'optionalAccess', _176 => _176.data]);
16107
+ const data = _optionalChain([responseBody, 'optionalAccess', _179 => _179.data]);
15999
16108
  const sessionInfo = new SessionInfoClass();
16000
- if (_optionalChain([data, 'optionalAccess', _177 => _177.sessionId])) {
16109
+ if (_optionalChain([data, 'optionalAccess', _180 => _180.sessionId])) {
16001
16110
  sessionInfo.sessionId = data.sessionId;
16002
16111
  }
16003
- if (_optionalChain([data, 'optionalAccess', _178 => _178.resourceUrl])) {
16112
+ if (_optionalChain([data, 'optionalAccess', _181 => _181.resourceUrl])) {
16004
16113
  sessionInfo.resourceUrl = data.resourceUrl;
16005
16114
  }
16006
- if (_optionalChain([data, 'optionalAccess', _179 => _179.desktopInfo])) {
16115
+ if (_optionalChain([data, 'optionalAccess', _182 => _182.desktopInfo])) {
16007
16116
  const desktopInfo = data.desktopInfo;
16008
16117
  if (desktopInfo.appId) {
16009
16118
  sessionInfo.appId = desktopInfo.appId;
@@ -16048,7 +16157,7 @@ var _Session = class _Session {
16048
16157
  };
16049
16158
  } catch (error) {
16050
16159
  const errorStr = String(error);
16051
- const errorCode = _optionalChain([error, 'optionalAccess', _180 => _180.data, 'optionalAccess', _181 => _181.Code]) || _optionalChain([error, 'optionalAccess', _182 => _182.code]) || "";
16160
+ const errorCode = _optionalChain([error, 'optionalAccess', _183 => _183.data, 'optionalAccess', _184 => _184.Code]) || _optionalChain([error, 'optionalAccess', _185 => _185.code]) || "";
16052
16161
  if (errorCode === "InvalidMcpSession.NotFound" || errorStr.includes("NotFound")) {
16053
16162
  logInfoWithColor(`Session not found: ${this.sessionId}`);
16054
16163
  logDebug(`GetMcpResource error details: ${errorStr}`);
@@ -16122,7 +16231,7 @@ var _Session = class _Session {
16122
16231
  requestParams += ", Options=provided";
16123
16232
  }
16124
16233
  logAPICall("GetLink", requestParams);
16125
- const request = new (0, _chunkW4B6JMPAcjs.GetLinkRequest)({
16234
+ const request = new (0, _chunkQYUGADDCcjs.GetLinkRequest)({
16126
16235
  authorization: `Bearer ${this.getAPIKey()}`,
16127
16236
  sessionId: this.getSessionId(),
16128
16237
  protocolType,
@@ -16197,7 +16306,7 @@ var _Session = class _Session {
16197
16306
  requestParams += ", Options=provided";
16198
16307
  }
16199
16308
  logAPICall("GetLink", requestParams);
16200
- const request = new (0, _chunkW4B6JMPAcjs.GetLinkRequest)({
16309
+ const request = new (0, _chunkQYUGADDCcjs.GetLinkRequest)({
16201
16310
  authorization: `Bearer ${this.getAPIKey()}`,
16202
16311
  sessionId: this.getSessionId(),
16203
16312
  protocolType,
@@ -16206,13 +16315,13 @@ var _Session = class _Session {
16206
16315
  });
16207
16316
  const response = await this.agentBay.getClient().getLink(request);
16208
16317
  const requestId = extractRequestId(response) || "";
16209
- const responseBody = _optionalChain([response, 'optionalAccess', _183 => _183.body]);
16318
+ const responseBody = _optionalChain([response, 'optionalAccess', _186 => _186.body]);
16210
16319
  if (typeof responseBody !== "object") {
16211
16320
  throw new Error(
16212
16321
  "Invalid response format: expected a dictionary from response body"
16213
16322
  );
16214
16323
  }
16215
- let data = _optionalChain([responseBody, 'optionalAccess', _184 => _184.data]) || {};
16324
+ let data = _optionalChain([responseBody, 'optionalAccess', _187 => _187.data]) || {};
16216
16325
  logDebug(`Data: ${JSON.stringify(data)}`);
16217
16326
  if (typeof data !== "object") {
16218
16327
  try {
@@ -16260,7 +16369,7 @@ var _Session = class _Session {
16260
16369
  if (!imageId) {
16261
16370
  imageId = this.imageId || "linux_latest";
16262
16371
  }
16263
- const request = new (0, _chunkW4B6JMPAcjs.ListMcpToolsRequest)({
16372
+ const request = new (0, _chunkQYUGADDCcjs.ListMcpToolsRequest)({
16264
16373
  authorization: `Bearer ${this.getAPIKey()}`,
16265
16374
  imageId
16266
16375
  });
@@ -16268,7 +16377,7 @@ var _Session = class _Session {
16268
16377
  logDebug(`Request: ImageId=${imageId}`);
16269
16378
  const response = await this.getClient().listMcpTools(request);
16270
16379
  const requestId = extractRequestId(response) || "";
16271
- if (_optionalChain([response, 'optionalAccess', _185 => _185.body, 'optionalAccess', _186 => _186.success]) === false && _optionalChain([response, 'access', _187 => _187.body, 'optionalAccess', _188 => _188.code])) {
16380
+ if (_optionalChain([response, 'optionalAccess', _188 => _188.body, 'optionalAccess', _189 => _189.success]) === false && _optionalChain([response, 'access', _190 => _190.body, 'optionalAccess', _191 => _191.code])) {
16272
16381
  const errorMessage = `[${response.body.code}] ${response.body.message || "Unknown error"}`;
16273
16382
  const fullResponse2 = response.body ? JSON.stringify(response.body, null, 2) : "";
16274
16383
  logAPIResponseWithDetails(
@@ -16431,7 +16540,7 @@ var _Session = class _Session {
16431
16540
  requestId: ""
16432
16541
  };
16433
16542
  } else {
16434
- const callToolRequest = new (0, _chunkW4B6JMPAcjs.CallMcpToolRequest)({
16543
+ const callToolRequest = new (0, _chunkQYUGADDCcjs.CallMcpToolRequest)({
16435
16544
  authorization: `Bearer ${this.getAPIKey()}`,
16436
16545
  sessionId: this.getSessionId(),
16437
16546
  name: toolName,
@@ -16439,7 +16548,7 @@ var _Session = class _Session {
16439
16548
  autoGenSession
16440
16549
  });
16441
16550
  const response = await this.getClient().callMcpTool(callToolRequest);
16442
- if (!_optionalChain([response, 'access', _189 => _189.body, 'optionalAccess', _190 => _190.data])) {
16551
+ if (!_optionalChain([response, 'access', _192 => _192.body, 'optionalAccess', _193 => _193.data])) {
16443
16552
  return {
16444
16553
  success: false,
16445
16554
  data: "",
@@ -16552,7 +16661,7 @@ var _Session = class _Session {
16552
16661
  */
16553
16662
  async pauseAsync(timeout = 600, pollInterval = 2) {
16554
16663
  try {
16555
- const request = new (0, _chunkW4B6JMPAcjs.PauseSessionAsyncRequest)({
16664
+ const request = new (0, _chunkQYUGADDCcjs.PauseSessionAsyncRequest)({
16556
16665
  authorization: `Bearer ${this.getAPIKey()}`,
16557
16666
  sessionId: this.sessionId
16558
16667
  });
@@ -16699,7 +16808,7 @@ var _Session = class _Session {
16699
16808
  */
16700
16809
  async resumeAsync(timeout = 600, pollInterval = 2) {
16701
16810
  try {
16702
- const request = new (0, _chunkW4B6JMPAcjs.ResumeSessionAsyncRequest)({
16811
+ const request = new (0, _chunkQYUGADDCcjs.ResumeSessionAsyncRequest)({
16703
16812
  authorization: `Bearer ${this.getAPIKey()}`,
16704
16813
  sessionId: this.sessionId
16705
16814
  });
@@ -16805,16 +16914,6 @@ var Session = _Session;
16805
16914
 
16806
16915
  // src/agent-bay.ts
16807
16916
  var BROWSER_DATA_PATH2 = "/tmp/agentbay_browser";
16808
- function generateRandomContextName(length = 8, includeTimestamp = true) {
16809
- const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-T:.Z]/g, "").slice(0, 14);
16810
- const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
16811
- let randomPart = "";
16812
- for (let i = 0; i < length; i++) {
16813
- randomPart += characters.charAt(Math.floor(Math.random() * characters.length));
16814
- }
16815
- return includeTimestamp ? `${timestamp}_${randomPart}` : randomPart;
16816
- }
16817
- _chunk4IPTHWLMcjs.__name.call(void 0, generateRandomContextName, "generateRandomContextName");
16818
16917
  var _AgentBay = class _AgentBay {
16819
16918
  /**
16820
16919
  * Initialize the AgentBay client.
@@ -16825,7 +16924,6 @@ var _AgentBay = class _AgentBay {
16825
16924
  * @param options.envFile - Custom path to .env file. If not provided, will search upward from current directory.
16826
16925
  */
16827
16926
  constructor(options = {}) {
16828
- this.fileTransferContext = null;
16829
16927
  loadDotEnvWithFallback(options.envFile);
16830
16928
  this.apiKey = options.apiKey || process.env.AGENTBAY_API_KEY || "";
16831
16929
  if (!this.apiKey) {
@@ -16859,7 +16957,7 @@ var _AgentBay = class _AgentBay {
16859
16957
  }
16860
16958
  /**
16861
16959
  * Wait for mobile simulate command to complete.
16862
- *
16960
+ *
16863
16961
  * @param session - The session to wait for mobile simulate
16864
16962
  * @param mobileSimPath - The dev info path to the mobile simulate
16865
16963
  * @param mobileSimMode - The mode of the mobile simulate. If not provided, will use the default mode.
@@ -16910,35 +17008,6 @@ var _AgentBay = class _AgentBay {
16910
17008
  logInfo(`Error executing mobile simulate command: ${error}`);
16911
17009
  }
16912
17010
  }
16913
- /**
16914
- * Update browser replay context with AppInstanceId from response data.
16915
- *
16916
- * @param responseData - Response data containing AppInstanceId
16917
- * @param recordContextId - The record context ID to update
16918
- */
16919
- async _updateBrowserReplayContext(responseData, recordContextId) {
16920
- if (!recordContextId) {
16921
- return;
16922
- }
16923
- try {
16924
- const appInstanceId = _optionalChain([responseData, 'optionalAccess', _191 => _191.appInstanceId]);
16925
- if (!appInstanceId) {
16926
- logError("AppInstanceId not found in response data, skipping browser replay context update");
16927
- return;
16928
- }
16929
- const contextName = `browserreplay-${appInstanceId}`;
16930
- const contextObj = new Context(recordContextId, contextName);
16931
- logDebug(`Updating browser replay context: ${contextName} -> ${recordContextId}`);
16932
- const updateResult = await this.context.update(contextObj);
16933
- if (updateResult.success) {
16934
- logInfo(`\u2705 Successfully updated browser replay context: ${contextName}`);
16935
- } else {
16936
- logError(`\u26A0\uFE0F Failed to update browser replay context: ${updateResult.errorMessage}`);
16937
- }
16938
- } catch (error) {
16939
- logError(`\u274C Error updating browser replay context: ${error}`);
16940
- }
16941
- }
16942
17011
  /**
16943
17012
  * Create a new session in the AgentBay cloud environment.
16944
17013
  *
@@ -16989,8 +17058,8 @@ var _AgentBay = class _AgentBay {
16989
17058
  */
16990
17059
  async create(params) {
16991
17060
  try {
16992
- logDebug(`default context syncs length: ${_optionalChain([params, 'access', _192 => _192.contextSync, 'optionalAccess', _193 => _193.length])}`);
16993
- if (_optionalChain([params, 'access', _194 => _194.extraConfigs, 'optionalAccess', _195 => _195.mobile, 'optionalAccess', _196 => _196.simulateConfig])) {
17061
+ logDebug(`default context syncs length: ${_optionalChain([params, 'access', _194 => _194.contextSync, 'optionalAccess', _195 => _195.length])}`);
17062
+ if (_optionalChain([params, 'access', _196 => _196.extraConfigs, 'optionalAccess', _197 => _197.mobile, 'optionalAccess', _198 => _198.simulateConfig])) {
16994
17063
  const mobileSimContextId = params.extraConfigs.mobile.simulateConfig.simulatedContextId;
16995
17064
  if (mobileSimContextId) {
16996
17065
  const mobileSimContextSync = new ContextSync(
@@ -17004,24 +17073,10 @@ var _AgentBay = class _AgentBay {
17004
17073
  params.contextSync.push(mobileSimContextSync);
17005
17074
  }
17006
17075
  }
17007
- const contextName = `file-transfer-context-${Date.now()}`;
17008
- const contextResult = await this.context.get(contextName, true);
17009
- if (contextResult.success && contextResult.context) {
17010
- this.fileTransferContext = contextResult.context;
17011
- const fileTransferContextSync = new ContextSync(
17012
- contextResult.context.id,
17013
- "/tmp/file-transfer"
17014
- );
17015
- if (!params.contextSync) {
17016
- params.contextSync = [];
17017
- }
17018
- logDebug(`Adding context sync for file transfer operations: ${fileTransferContextSync}`);
17019
- params.contextSync.push(fileTransferContextSync);
17020
- }
17021
- const request = new (0, _chunkW4B6JMPAcjs.CreateMcpSessionRequest)({
17076
+ const request = new (0, _chunkQYUGADDCcjs.CreateMcpSessionRequest)({
17022
17077
  authorization: "Bearer " + this.apiKey
17023
17078
  });
17024
- const framework = _optionalChain([params, 'optionalAccess', _197 => _197.framework]) || "";
17079
+ const framework = _optionalChain([params, 'optionalAccess', _199 => _199.framework]) || "";
17025
17080
  const sdkStatsJson = `{"source":"sdk","sdk_language":"typescript","sdk_version":"${VERSION}","is_release":${IS_RELEASE},"framework":"${framework}"}`;
17026
17081
  request.sdkStats = sdkStatsJson;
17027
17082
  if (this.config.region_id) {
@@ -17044,7 +17099,7 @@ var _AgentBay = class _AgentBay {
17044
17099
  if (params.contextSync && params.contextSync.length > 0) {
17045
17100
  const persistenceDataList = [];
17046
17101
  for (const contextSync of params.contextSync) {
17047
- const persistenceItem = new (0, _chunkW4B6JMPAcjs.CreateMcpSessionRequestPersistenceDataList)({
17102
+ const persistenceItem = new (0, _chunkQYUGADDCcjs.CreateMcpSessionRequestPersistenceDataList)({
17048
17103
  contextId: contextSync.contextId,
17049
17104
  path: contextSync.path
17050
17105
  });
@@ -17064,7 +17119,7 @@ var _AgentBay = class _AgentBay {
17064
17119
  bwList: null,
17065
17120
  recyclePolicy: null
17066
17121
  };
17067
- const browserContextSync = new (0, _chunkW4B6JMPAcjs.CreateMcpSessionRequestPersistenceDataList)({
17122
+ const browserContextSync = new (0, _chunkQYUGADDCcjs.CreateMcpSessionRequestPersistenceDataList)({
17068
17123
  contextId: params.browserContext.contextId,
17069
17124
  path: BROWSER_DATA_PATH2,
17070
17125
  // Using a constant path for browser data
@@ -17076,24 +17131,9 @@ var _AgentBay = class _AgentBay {
17076
17131
  request.persistenceDataList.push(browserContextSync);
17077
17132
  needsContextSync = true;
17078
17133
  }
17079
- let recordContextId = "";
17080
- if (params.enableBrowserReplay) {
17081
- const recordPath = BROWSER_RECORD_PATH;
17082
- const recordContextName = generateRandomContextName();
17083
- const result = await this.context.get(recordContextName, true);
17084
- recordContextId = result.success ? result.contextId : "";
17085
- const recordPersistence = new (0, _chunkW4B6JMPAcjs.CreateMcpSessionRequestPersistenceDataList)({
17086
- contextId: recordContextId,
17087
- path: recordPath
17088
- });
17089
- if (!request.persistenceDataList) {
17090
- request.persistenceDataList = [];
17091
- }
17092
- request.persistenceDataList.push(recordPersistence);
17093
- }
17094
17134
  if (params.extraConfigs) {
17095
17135
  request.extraConfigs = JSON.stringify(params.extraConfigs);
17096
- if (_optionalChain([params, 'access', _198 => _198.extraConfigs, 'access', _199 => _199.mobile, 'optionalAccess', _200 => _200.simulateConfig, 'optionalAccess', _201 => _201.simulate])) {
17136
+ if (_optionalChain([params, 'access', _200 => _200.extraConfigs, 'access', _201 => _201.mobile, 'optionalAccess', _202 => _202.simulateConfig, 'optionalAccess', _203 => _203.simulate])) {
17097
17137
  mobileSimPath = params.extraConfigs.mobile.simulateConfig.simulatePath;
17098
17138
  if (!mobileSimPath) {
17099
17139
  logInfo("mobile_sim_path is not set now, skip mobile simulate operation");
@@ -17216,8 +17256,6 @@ var _AgentBay = class _AgentBay {
17216
17256
  }
17217
17257
  session.resourceUrl = resourceUrl;
17218
17258
  session.enableBrowserReplay = params.enableBrowserReplay || false;
17219
- session.fileTransferContextId = this.fileTransferContext ? this.fileTransferContext.id : null;
17220
- session.recordContextId = recordContextId || null;
17221
17259
  session.imageId = params.imageId;
17222
17260
  if (params.extraConfigs && params.extraConfigs.mobile) {
17223
17261
  log("Applying mobile configuration...");
@@ -17232,9 +17270,6 @@ var _AgentBay = class _AgentBay {
17232
17270
  logError(`Warning: Failed to apply mobile configuration: ${error}`);
17233
17271
  }
17234
17272
  }
17235
- if (params.enableBrowserReplay) {
17236
- await this._updateBrowserReplayContext(data, recordContextId);
17237
- }
17238
17273
  if (params.isVpc) {
17239
17274
  logDebug("VPC session detected, automatically fetching MCP tools...");
17240
17275
  try {
@@ -17331,7 +17366,7 @@ var _AgentBay = class _AgentBay {
17331
17366
  if (page !== void 0 && page > 1) {
17332
17367
  let currentPage = 1;
17333
17368
  while (currentPage < page) {
17334
- const request2 = new (0, _chunkW4B6JMPAcjs.ListSessionRequest)({
17369
+ const request2 = new (0, _chunkQYUGADDCcjs.ListSessionRequest)({
17335
17370
  authorization: `Bearer ${this.apiKey}`,
17336
17371
  labels: JSON.stringify(labels),
17337
17372
  maxResults: limit
@@ -17341,9 +17376,9 @@ var _AgentBay = class _AgentBay {
17341
17376
  }
17342
17377
  const response2 = await this.client.listSession(request2);
17343
17378
  const requestId2 = extractRequestId(response2) || "";
17344
- if (!_optionalChain([response2, 'access', _202 => _202.body, 'optionalAccess', _203 => _203.success])) {
17345
- const code = _optionalChain([response2, 'access', _204 => _204.body, 'optionalAccess', _205 => _205.code]) || "Unknown";
17346
- const message = _optionalChain([response2, 'access', _206 => _206.body, 'optionalAccess', _207 => _207.message]) || "Unknown error";
17379
+ if (!_optionalChain([response2, 'access', _204 => _204.body, 'optionalAccess', _205 => _205.success])) {
17380
+ const code = _optionalChain([response2, 'access', _206 => _206.body, 'optionalAccess', _207 => _207.code]) || "Unknown";
17381
+ const message = _optionalChain([response2, 'access', _208 => _208.body, 'optionalAccess', _209 => _209.message]) || "Unknown error";
17347
17382
  return {
17348
17383
  requestId: requestId2,
17349
17384
  success: false,
@@ -17369,7 +17404,7 @@ var _AgentBay = class _AgentBay {
17369
17404
  currentPage += 1;
17370
17405
  }
17371
17406
  }
17372
- const request = new (0, _chunkW4B6JMPAcjs.ListSessionRequest)({
17407
+ const request = new (0, _chunkQYUGADDCcjs.ListSessionRequest)({
17373
17408
  authorization: `Bearer ${this.apiKey}`,
17374
17409
  labels: JSON.stringify(labels),
17375
17410
  maxResults: limit
@@ -17385,9 +17420,9 @@ var _AgentBay = class _AgentBay {
17385
17420
  const response = await this.client.listSession(request);
17386
17421
  const requestId = extractRequestId(response) || "";
17387
17422
  setRequestId(requestId);
17388
- if (!_optionalChain([response, 'access', _208 => _208.body, 'optionalAccess', _209 => _209.success])) {
17389
- const code = _optionalChain([response, 'access', _210 => _210.body, 'optionalAccess', _211 => _211.code]) || "Unknown";
17390
- const message = _optionalChain([response, 'access', _212 => _212.body, 'optionalAccess', _213 => _213.message]) || "Unknown error";
17423
+ if (!_optionalChain([response, 'access', _210 => _210.body, 'optionalAccess', _211 => _211.success])) {
17424
+ const code = _optionalChain([response, 'access', _212 => _212.body, 'optionalAccess', _213 => _213.code]) || "Unknown";
17425
+ const message = _optionalChain([response, 'access', _214 => _214.body, 'optionalAccess', _215 => _215.message]) || "Unknown error";
17391
17426
  logAPIResponseWithDetails(
17392
17427
  "ListSession",
17393
17428
  requestId,
@@ -17487,7 +17522,7 @@ var _AgentBay = class _AgentBay {
17487
17522
  async getSession(sessionId) {
17488
17523
  try {
17489
17524
  logAPICall("GetSession", { sessionId });
17490
- const request = new (0, _chunkW4B6JMPAcjs.GetSessionRequest)({
17525
+ const request = new (0, _chunkQYUGADDCcjs.GetSessionRequest)({
17491
17526
  authorization: `Bearer ${this.apiKey}`,
17492
17527
  sessionId
17493
17528
  });
@@ -17495,7 +17530,7 @@ var _AgentBay = class _AgentBay {
17495
17530
  const requestId = extractRequestId(response) || "";
17496
17531
  const body = response.body;
17497
17532
  setRequestId(requestId);
17498
- if (_optionalChain([body, 'optionalAccess', _214 => _214.success]) === false && body.code) {
17533
+ if (_optionalChain([body, 'optionalAccess', _216 => _216.success]) === false && body.code) {
17499
17534
  logAPIResponseWithDetails(
17500
17535
  "GetSession",
17501
17536
  requestId,
@@ -17514,12 +17549,12 @@ var _AgentBay = class _AgentBay {
17514
17549
  }
17515
17550
  const result = {
17516
17551
  requestId,
17517
- httpStatusCode: _optionalChain([body, 'optionalAccess', _215 => _215.httpStatusCode]) || 0,
17518
- code: _optionalChain([body, 'optionalAccess', _216 => _216.code]) || "",
17519
- success: _optionalChain([body, 'optionalAccess', _217 => _217.success]) || false,
17552
+ httpStatusCode: _optionalChain([body, 'optionalAccess', _217 => _217.httpStatusCode]) || 0,
17553
+ code: _optionalChain([body, 'optionalAccess', _218 => _218.code]) || "",
17554
+ success: _optionalChain([body, 'optionalAccess', _219 => _219.success]) || false,
17520
17555
  errorMessage: ""
17521
17556
  };
17522
- if (_optionalChain([body, 'optionalAccess', _218 => _218.data])) {
17557
+ if (_optionalChain([body, 'optionalAccess', _220 => _220.data])) {
17523
17558
  const contextsList = body.data.contexts || [];
17524
17559
  const contexts = [];
17525
17560
  if (Array.isArray(contextsList)) {
@@ -17559,7 +17594,7 @@ var _AgentBay = class _AgentBay {
17559
17594
  return result;
17560
17595
  } catch (error) {
17561
17596
  const errorStr = String(error);
17562
- const errorCode = _optionalChain([error, 'optionalAccess', _219 => _219.data, 'optionalAccess', _220 => _220.Code]) || _optionalChain([error, 'optionalAccess', _221 => _221.code]) || "";
17597
+ const errorCode = _optionalChain([error, 'optionalAccess', _221 => _221.data, 'optionalAccess', _222 => _222.Code]) || _optionalChain([error, 'optionalAccess', _223 => _223.code]) || "";
17563
17598
  if (errorCode === "InvalidMcpSession.NotFound" || errorStr.includes("NotFound")) {
17564
17599
  logInfoWithColor(`Session not found: ${sessionId}`);
17565
17600
  logDebug(`GetSession error details: ${errorStr}`);
@@ -17627,41 +17662,6 @@ var _AgentBay = class _AgentBay {
17627
17662
  session.token = getResult.data.token;
17628
17663
  session.resourceUrl = getResult.data.resourceUrl;
17629
17664
  }
17630
- if (getResult.data && getResult.data.contexts && getResult.data.contexts.length > 0) {
17631
- const contexts = getResult.data.contexts;
17632
- const fileTransferContexts = contexts.filter(
17633
- (ctx) => ctx.name && ctx.name.startsWith("file-transfer-context-")
17634
- );
17635
- if (fileTransferContexts.length === 0) {
17636
- const availableContexts = contexts.map((ctx) => ctx.name || "unknown");
17637
- logWarn(
17638
- `\u26A0\uFE0F No file-transfer-context- found in contexts list for session ${sessionId}. Available contexts: ${availableContexts.join(", ")}`
17639
- );
17640
- session.fileTransferContextId = null;
17641
- } else if (fileTransferContexts.length === 1) {
17642
- const contextId = fileTransferContexts[0].id;
17643
- if (contextId) {
17644
- session.fileTransferContextId = contextId;
17645
- logInfo(`\u{1F4C1} Found file transfer context for recovered session: ${contextId}`);
17646
- } else {
17647
- logWarn(
17648
- `\u26A0\uFE0F File transfer context found but missing 'id' field: ${JSON.stringify(fileTransferContexts[0])}`
17649
- );
17650
- session.fileTransferContextId = null;
17651
- }
17652
- } else {
17653
- const contextNames = fileTransferContexts.map((ctx) => ctx.name || "unknown");
17654
- logWarn(
17655
- `\u26A0\uFE0F Multiple file-transfer-context- found in contexts list for session ${sessionId}. Found ${fileTransferContexts.length} contexts: ${contextNames.join(", ")}. Not setting fileTransferContextId.`
17656
- );
17657
- session.fileTransferContextId = null;
17658
- }
17659
- } else {
17660
- logWarn(
17661
- `\u26A0\uFE0F No contexts list found in GetSession response for session ${sessionId}. fileTransferContextId will remain null.`
17662
- );
17663
- session.fileTransferContextId = null;
17664
- }
17665
17665
  return {
17666
17666
  requestId: getResult.requestId,
17667
17667
  success: true,
@@ -18529,7 +18529,7 @@ var _MobileSimulateService = class _MobileSimulateService {
18529
18529
  if (!contextSync) {
18530
18530
  throw new Error("contextSync is required for external context");
18531
18531
  }
18532
- if (_optionalChain([contextSync, 'access', _222 => _222.policy, 'optionalAccess', _223 => _223.bwList, 'optionalAccess', _224 => _224.whiteLists])) {
18532
+ if (_optionalChain([contextSync, 'access', _224 => _224.policy, 'optionalAccess', _225 => _225.bwList, 'optionalAccess', _226 => _226.whiteLists])) {
18533
18533
  const exists = contextSync.policy.bwList.whiteLists.some(
18534
18534
  (whiteList) => whiteList.path === MOBILE_INFO_SUB_PATH
18535
18535
  );
@@ -19145,5 +19145,9 @@ _chunk4IPTHWLMcjs.__name.call(void 0, newCreateSessionParams, "newCreateSessionP
19145
19145
 
19146
19146
 
19147
19147
 
19148
- exports.APIError = APIError; exports.APP_BLACKLIST_TEMPLATE = APP_BLACKLIST_TEMPLATE; exports.APP_WHITELIST_TEMPLATE = APP_WHITELIST_TEMPLATE; exports.Agent = Agent; exports.AgentBay = AgentBay; exports.AgentBayError = AgentBayError; exports.ApplyMqttTokenRequest = _chunkW4B6JMPAcjs.ApplyMqttTokenRequest; exports.ApplyMqttTokenResponse = _chunkW4B6JMPAcjs.ApplyMqttTokenResponse; exports.ApplyMqttTokenResponseBody = _chunkW4B6JMPAcjs.ApplyMqttTokenResponseBody; exports.ApplyMqttTokenResponseBodyData = _chunkW4B6JMPAcjs.ApplyMqttTokenResponseBodyData; exports.AuthenticationError = AuthenticationError; exports.Browser = Browser; exports.BrowserAgent = BrowserAgent; exports.BrowserContext = BrowserContext; exports.BrowserError = BrowserError; exports.BrowserFingerprintContext = BrowserFingerprintContext; exports.BrowserFingerprintGenerator = BrowserFingerprintGenerator; exports.BrowserOptionClass = BrowserOptionClass; exports.BrowserProxyClass = BrowserProxyClass; exports.BrowserUseAgent = BrowserUseAgent; exports.CallMcpToolRequest = _chunkW4B6JMPAcjs.CallMcpToolRequest; exports.CallMcpToolResponse = _chunkW4B6JMPAcjs.CallMcpToolResponse; exports.CallMcpToolResponseBody = _chunkW4B6JMPAcjs.CallMcpToolResponseBody; exports.ClearContextRequest = _chunkW4B6JMPAcjs.ClearContextRequest; exports.ClearContextResponse = _chunkW4B6JMPAcjs.ClearContextResponse; exports.ClearContextResponseBody = _chunkW4B6JMPAcjs.ClearContextResponseBody; exports.Client = Client; exports.Code = Code; exports.Command = Command; exports.Computer = Computer; exports.ComputerUseAgent = ComputerUseAgent; exports.Context = Context; exports.ContextManager = ContextManager; exports.ContextService = ContextService; exports.ContextSync = ContextSync; exports.CreateMcpSessionRequest = _chunkW4B6JMPAcjs.CreateMcpSessionRequest; exports.CreateMcpSessionRequestPersistenceDataList = _chunkW4B6JMPAcjs.CreateMcpSessionRequestPersistenceDataList; exports.CreateMcpSessionResponse = _chunkW4B6JMPAcjs.CreateMcpSessionResponse; exports.CreateMcpSessionResponseBody = _chunkW4B6JMPAcjs.CreateMcpSessionResponseBody; exports.CreateMcpSessionResponseBodyData = _chunkW4B6JMPAcjs.CreateMcpSessionResponseBodyData; exports.CreateMcpSessionShrinkRequest = _chunkW4B6JMPAcjs.CreateMcpSessionShrinkRequest; exports.CreateSessionParams = CreateSessionParams; exports.DeleteContextFileRequest = _chunkW4B6JMPAcjs.DeleteContextFileRequest; exports.DeleteContextFileResponse = _chunkW4B6JMPAcjs.DeleteContextFileResponse; exports.DeleteContextFileResponseBody = _chunkW4B6JMPAcjs.DeleteContextFileResponseBody; exports.DeleteContextRequest = _chunkW4B6JMPAcjs.DeleteContextRequest; exports.DeleteContextResponse = _chunkW4B6JMPAcjs.DeleteContextResponse; exports.DeleteContextResponseBody = _chunkW4B6JMPAcjs.DeleteContextResponseBody; exports.DescribeContextFilesRequest = _chunkW4B6JMPAcjs.DescribeContextFilesRequest; exports.DescribeContextFilesResponse = _chunkW4B6JMPAcjs.DescribeContextFilesResponse; exports.DescribeContextFilesResponseBody = _chunkW4B6JMPAcjs.DescribeContextFilesResponseBody; exports.DownloadStrategy = DownloadStrategy; exports.Extension = Extension; exports.ExtensionOption = ExtensionOption; exports.ExtensionsService = ExtensionsService; exports.ExtractPolicyClass = ExtractPolicyClass; exports.FileChangeEventHelper = FileChangeEventHelper; exports.FileChangeResultHelper = FileChangeResultHelper; exports.FileError = FileError; exports.FileSystem = FileSystem; exports.FingerprintFormat = FingerprintFormat; exports.GetAdbLinkRequest = _chunkW4B6JMPAcjs.GetAdbLinkRequest; exports.GetAdbLinkResponse = _chunkW4B6JMPAcjs.GetAdbLinkResponse; exports.GetAdbLinkResponseBody = _chunkW4B6JMPAcjs.GetAdbLinkResponseBody; exports.GetAdbLinkResponseBodyData = _chunkW4B6JMPAcjs.GetAdbLinkResponseBodyData; exports.GetCdpLinkRequest = _chunkW4B6JMPAcjs.GetCdpLinkRequest; exports.GetCdpLinkResponse = _chunkW4B6JMPAcjs.GetCdpLinkResponse; exports.GetCdpLinkResponseBody = _chunkW4B6JMPAcjs.GetCdpLinkResponseBody; exports.GetCdpLinkResponseBodyData = _chunkW4B6JMPAcjs.GetCdpLinkResponseBodyData; exports.GetContextFileDownloadUrlRequest = _chunkW4B6JMPAcjs.GetContextFileDownloadUrlRequest; exports.GetContextFileDownloadUrlResponse = _chunkW4B6JMPAcjs.GetContextFileDownloadUrlResponse; exports.GetContextFileDownloadUrlResponseBody = _chunkW4B6JMPAcjs.GetContextFileDownloadUrlResponseBody; exports.GetContextFileUploadUrlRequest = _chunkW4B6JMPAcjs.GetContextFileUploadUrlRequest; exports.GetContextFileUploadUrlResponse = _chunkW4B6JMPAcjs.GetContextFileUploadUrlResponse; exports.GetContextFileUploadUrlResponseBody = _chunkW4B6JMPAcjs.GetContextFileUploadUrlResponseBody; exports.GetContextInfoRequest = _chunkW4B6JMPAcjs.GetContextInfoRequest; exports.GetContextInfoResponse = _chunkW4B6JMPAcjs.GetContextInfoResponse; exports.GetContextInfoResponseBody = _chunkW4B6JMPAcjs.GetContextInfoResponseBody; exports.GetContextInfoResponseBodyData = _chunkW4B6JMPAcjs.GetContextInfoResponseBodyData; exports.GetContextRequest = _chunkW4B6JMPAcjs.GetContextRequest; exports.GetContextResponse = _chunkW4B6JMPAcjs.GetContextResponse; exports.GetContextResponseBody = _chunkW4B6JMPAcjs.GetContextResponseBody; exports.GetContextResponseBodyData = _chunkW4B6JMPAcjs.GetContextResponseBodyData; exports.GetLabelRequest = _chunkW4B6JMPAcjs.GetLabelRequest; exports.GetLabelResponse = _chunkW4B6JMPAcjs.GetLabelResponse; exports.GetLabelResponseBody = _chunkW4B6JMPAcjs.GetLabelResponseBody; exports.GetLabelResponseBodyData = _chunkW4B6JMPAcjs.GetLabelResponseBodyData; exports.GetLinkRequest = _chunkW4B6JMPAcjs.GetLinkRequest; exports.GetLinkResponse = _chunkW4B6JMPAcjs.GetLinkResponse; exports.GetLinkResponseBody = _chunkW4B6JMPAcjs.GetLinkResponseBody; exports.GetLinkResponseBodyData = _chunkW4B6JMPAcjs.GetLinkResponseBodyData; exports.GetMcpResourceRequest = _chunkW4B6JMPAcjs.GetMcpResourceRequest; exports.GetMcpResourceResponse = _chunkW4B6JMPAcjs.GetMcpResourceResponse; exports.GetMcpResourceResponseBody = _chunkW4B6JMPAcjs.GetMcpResourceResponseBody; exports.GetMcpResourceResponseBodyData = _chunkW4B6JMPAcjs.GetMcpResourceResponseBodyData; exports.GetMcpResourceResponseBodyDataDesktopInfo = _chunkW4B6JMPAcjs.GetMcpResourceResponseBodyDataDesktopInfo; exports.GetSessionRequest = _chunkW4B6JMPAcjs.GetSessionRequest; exports.GetSessionResponse = _chunkW4B6JMPAcjs.GetSessionResponse; exports.GetSessionResponseBody = _chunkW4B6JMPAcjs.GetSessionResponseBody; exports.GetSessionResponseBodyData = _chunkW4B6JMPAcjs.GetSessionResponseBodyData; exports.HIDE_NAVIGATION_BAR_TEMPLATE = HIDE_NAVIGATION_BAR_TEMPLATE; exports.IS_RELEASE = IS_RELEASE; exports.InitBrowserRequest = _chunkW4B6JMPAcjs.InitBrowserRequest; exports.InitBrowserResponse = _chunkW4B6JMPAcjs.InitBrowserResponse; exports.InitBrowserResponseBody = _chunkW4B6JMPAcjs.InitBrowserResponseBody; exports.InitBrowserResponseBodyData = _chunkW4B6JMPAcjs.InitBrowserResponseBodyData; exports.Lifecycle = Lifecycle; exports.ListContextsRequest = _chunkW4B6JMPAcjs.ListContextsRequest; exports.ListContextsResponse = _chunkW4B6JMPAcjs.ListContextsResponse; exports.ListContextsResponseBody = _chunkW4B6JMPAcjs.ListContextsResponseBody; exports.ListContextsResponseBodyData = _chunkW4B6JMPAcjs.ListContextsResponseBodyData; exports.ListMcpToolsRequest = _chunkW4B6JMPAcjs.ListMcpToolsRequest; exports.ListMcpToolsResponse = _chunkW4B6JMPAcjs.ListMcpToolsResponse; exports.ListMcpToolsResponseBody = _chunkW4B6JMPAcjs.ListMcpToolsResponseBody; exports.ListSessionRequest = _chunkW4B6JMPAcjs.ListSessionRequest; exports.ListSessionResponse = _chunkW4B6JMPAcjs.ListSessionResponse; exports.ListSessionResponseBody = _chunkW4B6JMPAcjs.ListSessionResponseBody; exports.ListSessionResponseBodyData = _chunkW4B6JMPAcjs.ListSessionResponseBodyData; exports.MOBILE_COMMAND_TEMPLATES = MOBILE_COMMAND_TEMPLATES; exports.Mobile = Mobile; exports.MobileSimulateMode = MobileSimulateMode; exports.MobileSimulateService = MobileSimulateService; exports.ModifyContextRequest = _chunkW4B6JMPAcjs.ModifyContextRequest; exports.ModifyContextResponse = _chunkW4B6JMPAcjs.ModifyContextResponse; exports.ModifyContextResponseBody = _chunkW4B6JMPAcjs.ModifyContextResponseBody; exports.Oss = Oss; exports.OssError = OssError; exports.PauseSessionAsyncRequest = _chunkW4B6JMPAcjs.PauseSessionAsyncRequest; exports.PauseSessionAsyncResponse = _chunkW4B6JMPAcjs.PauseSessionAsyncResponse; exports.PauseSessionAsyncResponseBody = _chunkW4B6JMPAcjs.PauseSessionAsyncResponseBody; exports.RESOLUTION_LOCK_TEMPLATE = RESOLUTION_LOCK_TEMPLATE; exports.ReleaseMcpSessionRequest = _chunkW4B6JMPAcjs.ReleaseMcpSessionRequest; exports.ReleaseMcpSessionResponse = _chunkW4B6JMPAcjs.ReleaseMcpSessionResponse; exports.ReleaseMcpSessionResponseBody = _chunkW4B6JMPAcjs.ReleaseMcpSessionResponseBody; exports.ResumeSessionAsyncRequest = _chunkW4B6JMPAcjs.ResumeSessionAsyncRequest; exports.ResumeSessionAsyncResponse = _chunkW4B6JMPAcjs.ResumeSessionAsyncResponse; exports.ResumeSessionAsyncResponseBody = _chunkW4B6JMPAcjs.ResumeSessionAsyncResponseBody; exports.SHOW_NAVIGATION_BAR_TEMPLATE = SHOW_NAVIGATION_BAR_TEMPLATE; exports.Session = Session; exports.SessionError = SessionError; exports.SetLabelRequest = _chunkW4B6JMPAcjs.SetLabelRequest; exports.SetLabelResponse = _chunkW4B6JMPAcjs.SetLabelResponse; exports.SetLabelResponseBody = _chunkW4B6JMPAcjs.SetLabelResponseBody; exports.SyncContextRequest = _chunkW4B6JMPAcjs.SyncContextRequest; exports.SyncContextResponse = _chunkW4B6JMPAcjs.SyncContextResponse; exports.SyncContextResponseBody = _chunkW4B6JMPAcjs.SyncContextResponseBody; exports.SyncPolicyImpl = SyncPolicyImpl; exports.UNINSTALL_BLACKLIST_TEMPLATE = UNINSTALL_BLACKLIST_TEMPLATE; exports.UploadMode = UploadMode; exports.UploadStrategy = UploadStrategy; exports.VERSION = VERSION; exports.WhiteListValidator = WhiteListValidator; exports.createListSessionParams = createListSessionParams; exports.extraConfigsFromJSON = extraConfigsFromJSON; exports.extraConfigsToJSON = extraConfigsToJSON; exports.extractRequestId = extractRequestId; exports.getLogLevel = getLogLevel; exports.getMobileCommandTemplate = getMobileCommandTemplate; exports.hasMobileCommandTemplate = hasMobileCommandTemplate; exports.log = log; exports.logDebug = logDebug; exports.logError = logError; exports.logInfo = logInfo; exports.logWarn = logWarn; exports.newContextManager = newContextManager; exports.newContextSync = newContextSync; exports.newCreateSessionParams = newCreateSessionParams; exports.newDeletePolicy = newDeletePolicy; exports.newDownloadPolicy = newDownloadPolicy; exports.newExtractPolicy = newExtractPolicy; exports.newMappingPolicy = newMappingPolicy; exports.newRecyclePolicy = newRecyclePolicy; exports.newSyncPolicy = newSyncPolicy; exports.newSyncPolicyWithDefaults = newSyncPolicyWithDefaults; exports.newUploadPolicy = newUploadPolicy; exports.replaceTemplatePlaceholders = replaceTemplatePlaceholders; exports.setLogLevel = setLogLevel; exports.setupLogger = setupLogger; exports.validateAppManagerRule = validateAppManagerRule; exports.validateExtraConfigs = validateExtraConfigs; exports.validateMobileExtraConfig = validateMobileExtraConfig; exports.validateMobileSimulateConfig = validateMobileSimulateConfig;
19148
+
19149
+
19150
+
19151
+
19152
+ exports.APIError = APIError; exports.APP_BLACKLIST_TEMPLATE = APP_BLACKLIST_TEMPLATE; exports.APP_WHITELIST_TEMPLATE = APP_WHITELIST_TEMPLATE; exports.Agent = Agent; exports.AgentBay = AgentBay; exports.AgentBayError = AgentBayError; exports.ApplyMqttTokenRequest = _chunkQYUGADDCcjs.ApplyMqttTokenRequest; exports.ApplyMqttTokenResponse = _chunkQYUGADDCcjs.ApplyMqttTokenResponse; exports.ApplyMqttTokenResponseBody = _chunkQYUGADDCcjs.ApplyMqttTokenResponseBody; exports.ApplyMqttTokenResponseBodyData = _chunkQYUGADDCcjs.ApplyMqttTokenResponseBodyData; exports.AuthenticationError = AuthenticationError; exports.Browser = Browser; exports.BrowserAgent = BrowserAgent; exports.BrowserContext = BrowserContext; exports.BrowserError = BrowserError; exports.BrowserFingerprintContext = BrowserFingerprintContext; exports.BrowserFingerprintGenerator = BrowserFingerprintGenerator; exports.BrowserOptionClass = BrowserOptionClass; exports.BrowserProxyClass = BrowserProxyClass; exports.BrowserUseAgent = BrowserUseAgent; exports.CallMcpToolRequest = _chunkQYUGADDCcjs.CallMcpToolRequest; exports.CallMcpToolResponse = _chunkQYUGADDCcjs.CallMcpToolResponse; exports.CallMcpToolResponseBody = _chunkQYUGADDCcjs.CallMcpToolResponseBody; exports.ClearContextRequest = _chunkQYUGADDCcjs.ClearContextRequest; exports.ClearContextResponse = _chunkQYUGADDCcjs.ClearContextResponse; exports.ClearContextResponseBody = _chunkQYUGADDCcjs.ClearContextResponseBody; exports.Client = Client; exports.Code = Code; exports.Command = Command; exports.Computer = Computer; exports.ComputerUseAgent = ComputerUseAgent; exports.Context = Context; exports.ContextManager = ContextManager; exports.ContextService = ContextService; exports.ContextSync = ContextSync; exports.CreateMcpSessionRequest = _chunkQYUGADDCcjs.CreateMcpSessionRequest; exports.CreateMcpSessionRequestPersistenceDataList = _chunkQYUGADDCcjs.CreateMcpSessionRequestPersistenceDataList; exports.CreateMcpSessionResponse = _chunkQYUGADDCcjs.CreateMcpSessionResponse; exports.CreateMcpSessionResponseBody = _chunkQYUGADDCcjs.CreateMcpSessionResponseBody; exports.CreateMcpSessionResponseBodyData = _chunkQYUGADDCcjs.CreateMcpSessionResponseBodyData; exports.CreateMcpSessionShrinkRequest = _chunkQYUGADDCcjs.CreateMcpSessionShrinkRequest; exports.CreateSessionParams = CreateSessionParams; exports.DeleteContextFileRequest = _chunkQYUGADDCcjs.DeleteContextFileRequest; exports.DeleteContextFileResponse = _chunkQYUGADDCcjs.DeleteContextFileResponse; exports.DeleteContextFileResponseBody = _chunkQYUGADDCcjs.DeleteContextFileResponseBody; exports.DeleteContextRequest = _chunkQYUGADDCcjs.DeleteContextRequest; exports.DeleteContextResponse = _chunkQYUGADDCcjs.DeleteContextResponse; exports.DeleteContextResponseBody = _chunkQYUGADDCcjs.DeleteContextResponseBody; exports.DescribeContextFilesRequest = _chunkQYUGADDCcjs.DescribeContextFilesRequest; exports.DescribeContextFilesResponse = _chunkQYUGADDCcjs.DescribeContextFilesResponse; exports.DescribeContextFilesResponseBody = _chunkQYUGADDCcjs.DescribeContextFilesResponseBody; exports.DownloadStrategy = DownloadStrategy; exports.Extension = Extension; exports.ExtensionOption = ExtensionOption; exports.ExtensionsService = ExtensionsService; exports.ExtractPolicyClass = ExtractPolicyClass; exports.FileChangeEventHelper = FileChangeEventHelper; exports.FileChangeResultHelper = FileChangeResultHelper; exports.FileError = FileError; exports.FileSystem = FileSystem; exports.FingerprintFormat = FingerprintFormat; exports.GetAdbLinkRequest = _chunkQYUGADDCcjs.GetAdbLinkRequest; exports.GetAdbLinkResponse = _chunkQYUGADDCcjs.GetAdbLinkResponse; exports.GetAdbLinkResponseBody = _chunkQYUGADDCcjs.GetAdbLinkResponseBody; exports.GetAdbLinkResponseBodyData = _chunkQYUGADDCcjs.GetAdbLinkResponseBodyData; exports.GetAndLoadInternalContextRequest = _chunkQYUGADDCcjs.GetAndLoadInternalContextRequest; exports.GetAndLoadInternalContextResponse = _chunkQYUGADDCcjs.GetAndLoadInternalContextResponse; exports.GetAndLoadInternalContextResponseBody = _chunkQYUGADDCcjs.GetAndLoadInternalContextResponseBody; exports.GetAndLoadInternalContextResponseBodyData = _chunkQYUGADDCcjs.GetAndLoadInternalContextResponseBodyData; exports.GetCdpLinkRequest = _chunkQYUGADDCcjs.GetCdpLinkRequest; exports.GetCdpLinkResponse = _chunkQYUGADDCcjs.GetCdpLinkResponse; exports.GetCdpLinkResponseBody = _chunkQYUGADDCcjs.GetCdpLinkResponseBody; exports.GetCdpLinkResponseBodyData = _chunkQYUGADDCcjs.GetCdpLinkResponseBodyData; exports.GetContextFileDownloadUrlRequest = _chunkQYUGADDCcjs.GetContextFileDownloadUrlRequest; exports.GetContextFileDownloadUrlResponse = _chunkQYUGADDCcjs.GetContextFileDownloadUrlResponse; exports.GetContextFileDownloadUrlResponseBody = _chunkQYUGADDCcjs.GetContextFileDownloadUrlResponseBody; exports.GetContextFileUploadUrlRequest = _chunkQYUGADDCcjs.GetContextFileUploadUrlRequest; exports.GetContextFileUploadUrlResponse = _chunkQYUGADDCcjs.GetContextFileUploadUrlResponse; exports.GetContextFileUploadUrlResponseBody = _chunkQYUGADDCcjs.GetContextFileUploadUrlResponseBody; exports.GetContextInfoRequest = _chunkQYUGADDCcjs.GetContextInfoRequest; exports.GetContextInfoResponse = _chunkQYUGADDCcjs.GetContextInfoResponse; exports.GetContextInfoResponseBody = _chunkQYUGADDCcjs.GetContextInfoResponseBody; exports.GetContextInfoResponseBodyData = _chunkQYUGADDCcjs.GetContextInfoResponseBodyData; exports.GetContextRequest = _chunkQYUGADDCcjs.GetContextRequest; exports.GetContextResponse = _chunkQYUGADDCcjs.GetContextResponse; exports.GetContextResponseBody = _chunkQYUGADDCcjs.GetContextResponseBody; exports.GetContextResponseBodyData = _chunkQYUGADDCcjs.GetContextResponseBodyData; exports.GetLabelRequest = _chunkQYUGADDCcjs.GetLabelRequest; exports.GetLabelResponse = _chunkQYUGADDCcjs.GetLabelResponse; exports.GetLabelResponseBody = _chunkQYUGADDCcjs.GetLabelResponseBody; exports.GetLabelResponseBodyData = _chunkQYUGADDCcjs.GetLabelResponseBodyData; exports.GetLinkRequest = _chunkQYUGADDCcjs.GetLinkRequest; exports.GetLinkResponse = _chunkQYUGADDCcjs.GetLinkResponse; exports.GetLinkResponseBody = _chunkQYUGADDCcjs.GetLinkResponseBody; exports.GetLinkResponseBodyData = _chunkQYUGADDCcjs.GetLinkResponseBodyData; exports.GetMcpResourceRequest = _chunkQYUGADDCcjs.GetMcpResourceRequest; exports.GetMcpResourceResponse = _chunkQYUGADDCcjs.GetMcpResourceResponse; exports.GetMcpResourceResponseBody = _chunkQYUGADDCcjs.GetMcpResourceResponseBody; exports.GetMcpResourceResponseBodyData = _chunkQYUGADDCcjs.GetMcpResourceResponseBodyData; exports.GetMcpResourceResponseBodyDataDesktopInfo = _chunkQYUGADDCcjs.GetMcpResourceResponseBodyDataDesktopInfo; exports.GetSessionRequest = _chunkQYUGADDCcjs.GetSessionRequest; exports.GetSessionResponse = _chunkQYUGADDCcjs.GetSessionResponse; exports.GetSessionResponseBody = _chunkQYUGADDCcjs.GetSessionResponseBody; exports.GetSessionResponseBodyData = _chunkQYUGADDCcjs.GetSessionResponseBodyData; exports.HIDE_NAVIGATION_BAR_TEMPLATE = HIDE_NAVIGATION_BAR_TEMPLATE; exports.IS_RELEASE = IS_RELEASE; exports.InitBrowserRequest = _chunkQYUGADDCcjs.InitBrowserRequest; exports.InitBrowserResponse = _chunkQYUGADDCcjs.InitBrowserResponse; exports.InitBrowserResponseBody = _chunkQYUGADDCcjs.InitBrowserResponseBody; exports.InitBrowserResponseBodyData = _chunkQYUGADDCcjs.InitBrowserResponseBodyData; exports.Lifecycle = Lifecycle; exports.ListContextsRequest = _chunkQYUGADDCcjs.ListContextsRequest; exports.ListContextsResponse = _chunkQYUGADDCcjs.ListContextsResponse; exports.ListContextsResponseBody = _chunkQYUGADDCcjs.ListContextsResponseBody; exports.ListContextsResponseBodyData = _chunkQYUGADDCcjs.ListContextsResponseBodyData; exports.ListMcpToolsRequest = _chunkQYUGADDCcjs.ListMcpToolsRequest; exports.ListMcpToolsResponse = _chunkQYUGADDCcjs.ListMcpToolsResponse; exports.ListMcpToolsResponseBody = _chunkQYUGADDCcjs.ListMcpToolsResponseBody; exports.ListSessionRequest = _chunkQYUGADDCcjs.ListSessionRequest; exports.ListSessionResponse = _chunkQYUGADDCcjs.ListSessionResponse; exports.ListSessionResponseBody = _chunkQYUGADDCcjs.ListSessionResponseBody; exports.ListSessionResponseBodyData = _chunkQYUGADDCcjs.ListSessionResponseBodyData; exports.MOBILE_COMMAND_TEMPLATES = MOBILE_COMMAND_TEMPLATES; exports.Mobile = Mobile; exports.MobileSimulateMode = MobileSimulateMode; exports.MobileSimulateService = MobileSimulateService; exports.ModifyContextRequest = _chunkQYUGADDCcjs.ModifyContextRequest; exports.ModifyContextResponse = _chunkQYUGADDCcjs.ModifyContextResponse; exports.ModifyContextResponseBody = _chunkQYUGADDCcjs.ModifyContextResponseBody; exports.Oss = Oss; exports.OssError = OssError; exports.PauseSessionAsyncRequest = _chunkQYUGADDCcjs.PauseSessionAsyncRequest; exports.PauseSessionAsyncResponse = _chunkQYUGADDCcjs.PauseSessionAsyncResponse; exports.PauseSessionAsyncResponseBody = _chunkQYUGADDCcjs.PauseSessionAsyncResponseBody; exports.RESOLUTION_LOCK_TEMPLATE = RESOLUTION_LOCK_TEMPLATE; exports.ReleaseMcpSessionRequest = _chunkQYUGADDCcjs.ReleaseMcpSessionRequest; exports.ReleaseMcpSessionResponse = _chunkQYUGADDCcjs.ReleaseMcpSessionResponse; exports.ReleaseMcpSessionResponseBody = _chunkQYUGADDCcjs.ReleaseMcpSessionResponseBody; exports.ResumeSessionAsyncRequest = _chunkQYUGADDCcjs.ResumeSessionAsyncRequest; exports.ResumeSessionAsyncResponse = _chunkQYUGADDCcjs.ResumeSessionAsyncResponse; exports.ResumeSessionAsyncResponseBody = _chunkQYUGADDCcjs.ResumeSessionAsyncResponseBody; exports.SHOW_NAVIGATION_BAR_TEMPLATE = SHOW_NAVIGATION_BAR_TEMPLATE; exports.Session = Session; exports.SessionError = SessionError; exports.SetLabelRequest = _chunkQYUGADDCcjs.SetLabelRequest; exports.SetLabelResponse = _chunkQYUGADDCcjs.SetLabelResponse; exports.SetLabelResponseBody = _chunkQYUGADDCcjs.SetLabelResponseBody; exports.SyncContextRequest = _chunkQYUGADDCcjs.SyncContextRequest; exports.SyncContextResponse = _chunkQYUGADDCcjs.SyncContextResponse; exports.SyncContextResponseBody = _chunkQYUGADDCcjs.SyncContextResponseBody; exports.SyncPolicyImpl = SyncPolicyImpl; exports.UNINSTALL_BLACKLIST_TEMPLATE = UNINSTALL_BLACKLIST_TEMPLATE; exports.UploadMode = UploadMode; exports.UploadStrategy = UploadStrategy; exports.VERSION = VERSION; exports.WhiteListValidator = WhiteListValidator; exports.createListSessionParams = createListSessionParams; exports.extraConfigsFromJSON = extraConfigsFromJSON; exports.extraConfigsToJSON = extraConfigsToJSON; exports.extractRequestId = extractRequestId; exports.getLogLevel = getLogLevel; exports.getMobileCommandTemplate = getMobileCommandTemplate; exports.hasMobileCommandTemplate = hasMobileCommandTemplate; exports.log = log; exports.logDebug = logDebug; exports.logError = logError; exports.logInfo = logInfo; exports.logWarn = logWarn; exports.newContextManager = newContextManager; exports.newContextSync = newContextSync; exports.newCreateSessionParams = newCreateSessionParams; exports.newDeletePolicy = newDeletePolicy; exports.newDownloadPolicy = newDownloadPolicy; exports.newExtractPolicy = newExtractPolicy; exports.newMappingPolicy = newMappingPolicy; exports.newRecyclePolicy = newRecyclePolicy; exports.newSyncPolicy = newSyncPolicy; exports.newSyncPolicyWithDefaults = newSyncPolicyWithDefaults; exports.newUploadPolicy = newUploadPolicy; exports.replaceTemplatePlaceholders = replaceTemplatePlaceholders; exports.setLogLevel = setLogLevel; exports.setupLogger = setupLogger; exports.validateAppManagerRule = validateAppManagerRule; exports.validateExtraConfigs = validateExtraConfigs; exports.validateMobileExtraConfig = validateMobileExtraConfig; exports.validateMobileSimulateConfig = validateMobileSimulateConfig;
19149
19153
  //# sourceMappingURL=index.cjs.map