wuying-agentbay-sdk 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-E7QC5S76.mjs → chunk-BVWUCG4J.mjs} +264 -5
- package/dist/chunk-BVWUCG4J.mjs.map +1 -0
- package/dist/{chunk-ZUB35HKV.cjs → chunk-SL5GCAQE.cjs} +265 -6
- package/dist/chunk-SL5GCAQE.cjs.map +1 -0
- package/dist/index.cjs +1295 -317
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1694 -1125
- package/dist/index.d.ts +1694 -1125
- package/dist/index.mjs +1228 -250
- package/dist/index.mjs.map +1 -1
- package/dist/model-CNCGFWJH.cjs +200 -0
- package/dist/{model-2G37RFQQ.cjs.map → model-CNCGFWJH.cjs.map} +1 -1
- package/dist/{model-ZFTLKEMC.mjs → model-LGWQJWKQ.mjs} +14 -2
- package/docs/api/common-features/basics/agentbay.md +96 -0
- package/docs/api/common-features/basics/context-manager.md +21 -2
- package/docs/api/common-features/basics/session.md +130 -0
- package/docs/examples/browser-use/extension-example/extension-example.ts +2 -1
- package/docs/examples/common-features/basics/session-pause-resume/README.md +53 -0
- package/docs/examples/common-features/basics/session-pause-resume/session-pause-resume.ts +237 -0
- package/docs/examples/mobile-use/mobile-simulate-basic-usage.ts +202 -0
- package/docs/examples/mobile-use/mobile-simulate-with-ctx.ts +170 -0
- package/package.json +2 -2
- package/dist/chunk-E7QC5S76.mjs.map +0 -1
- package/dist/chunk-ZUB35HKV.cjs.map +0 -1
- package/dist/model-2G37RFQQ.cjs +0 -188
- /package/dist/{model-ZFTLKEMC.mjs.map → model-LGWQJWKQ.mjs.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -90,7 +90,13 @@
|
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
var _chunkSL5GCAQEcjs = require('./chunk-SL5GCAQE.cjs');
|
|
94
100
|
|
|
95
101
|
|
|
96
102
|
|
|
@@ -172,14 +178,14 @@ var require_main = _chunk4IPTHWLMcjs.__commonJS.call(void 0, {
|
|
|
172
178
|
"node_modules/dotenv/lib/main.js"(exports, module) {
|
|
173
179
|
"use strict";
|
|
174
180
|
_chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
175
|
-
var
|
|
176
|
-
var
|
|
181
|
+
var fs7 = _chunk4IPTHWLMcjs.__require.call(void 0, "fs");
|
|
182
|
+
var path7 = _chunk4IPTHWLMcjs.__require.call(void 0, "path");
|
|
177
183
|
var os = _chunk4IPTHWLMcjs.__require.call(void 0, "os");
|
|
178
184
|
var crypto2 = _chunk4IPTHWLMcjs.__require.call(void 0, "crypto");
|
|
179
185
|
var packageJson = require_package();
|
|
180
186
|
var version = packageJson.version;
|
|
181
187
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
182
|
-
function
|
|
188
|
+
function parse3(src) {
|
|
183
189
|
const obj = {};
|
|
184
190
|
let lines = src.toString();
|
|
185
191
|
lines = lines.replace(/\r\n?/mg, "\n");
|
|
@@ -198,7 +204,7 @@ var require_main = _chunk4IPTHWLMcjs.__commonJS.call(void 0, {
|
|
|
198
204
|
}
|
|
199
205
|
return obj;
|
|
200
206
|
}
|
|
201
|
-
_chunk4IPTHWLMcjs.__name.call(void 0,
|
|
207
|
+
_chunk4IPTHWLMcjs.__name.call(void 0, parse3, "parse");
|
|
202
208
|
function _parseVault(options) {
|
|
203
209
|
options = options || {};
|
|
204
210
|
const vaultPath = _vaultPath(options);
|
|
@@ -288,7 +294,7 @@ var require_main = _chunk4IPTHWLMcjs.__commonJS.call(void 0, {
|
|
|
288
294
|
if (options && options.path && options.path.length > 0) {
|
|
289
295
|
if (Array.isArray(options.path)) {
|
|
290
296
|
for (const filepath of options.path) {
|
|
291
|
-
if (
|
|
297
|
+
if (fs7.existsSync(filepath)) {
|
|
292
298
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
293
299
|
}
|
|
294
300
|
}
|
|
@@ -296,16 +302,16 @@ var require_main = _chunk4IPTHWLMcjs.__commonJS.call(void 0, {
|
|
|
296
302
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
297
303
|
}
|
|
298
304
|
} else {
|
|
299
|
-
possibleVaultPath =
|
|
305
|
+
possibleVaultPath = path7.resolve(process.cwd(), ".env.vault");
|
|
300
306
|
}
|
|
301
|
-
if (
|
|
307
|
+
if (fs7.existsSync(possibleVaultPath)) {
|
|
302
308
|
return possibleVaultPath;
|
|
303
309
|
}
|
|
304
310
|
return null;
|
|
305
311
|
}
|
|
306
312
|
_chunk4IPTHWLMcjs.__name.call(void 0, _vaultPath, "_vaultPath");
|
|
307
313
|
function _resolveHome(envPath) {
|
|
308
|
-
return envPath[0] === "~" ?
|
|
314
|
+
return envPath[0] === "~" ? path7.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
309
315
|
}
|
|
310
316
|
_chunk4IPTHWLMcjs.__name.call(void 0, _resolveHome, "_resolveHome");
|
|
311
317
|
function _configVault(options) {
|
|
@@ -324,7 +330,7 @@ var require_main = _chunk4IPTHWLMcjs.__commonJS.call(void 0, {
|
|
|
324
330
|
}
|
|
325
331
|
_chunk4IPTHWLMcjs.__name.call(void 0, _configVault, "_configVault");
|
|
326
332
|
function configDotenv(options) {
|
|
327
|
-
const dotenvPath =
|
|
333
|
+
const dotenvPath = path7.resolve(process.cwd(), ".env");
|
|
328
334
|
let encoding = "utf8";
|
|
329
335
|
const debug = Boolean(options && options.debug);
|
|
330
336
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -348,13 +354,13 @@ var require_main = _chunk4IPTHWLMcjs.__commonJS.call(void 0, {
|
|
|
348
354
|
}
|
|
349
355
|
let lastError;
|
|
350
356
|
const parsedAll = {};
|
|
351
|
-
for (const
|
|
357
|
+
for (const path8 of optionPaths) {
|
|
352
358
|
try {
|
|
353
|
-
const parsed = DotenvModule.parse(
|
|
359
|
+
const parsed = DotenvModule.parse(fs7.readFileSync(path8, { encoding }));
|
|
354
360
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
355
361
|
} catch (e) {
|
|
356
362
|
if (debug) {
|
|
357
|
-
_debug(`Failed to load ${
|
|
363
|
+
_debug(`Failed to load ${path8} ${e.message}`);
|
|
358
364
|
}
|
|
359
365
|
lastError = e;
|
|
360
366
|
}
|
|
@@ -369,7 +375,7 @@ var require_main = _chunk4IPTHWLMcjs.__commonJS.call(void 0, {
|
|
|
369
375
|
const shortPaths = [];
|
|
370
376
|
for (const filePath of optionPaths) {
|
|
371
377
|
try {
|
|
372
|
-
const relative =
|
|
378
|
+
const relative = path7.relative(process.cwd(), filePath);
|
|
373
379
|
shortPaths.push(relative);
|
|
374
380
|
} catch (e) {
|
|
375
381
|
if (debug) {
|
|
@@ -459,7 +465,7 @@ var require_main = _chunk4IPTHWLMcjs.__commonJS.call(void 0, {
|
|
|
459
465
|
_parseVault,
|
|
460
466
|
config,
|
|
461
467
|
decrypt,
|
|
462
|
-
parse:
|
|
468
|
+
parse: parse3,
|
|
463
469
|
populate
|
|
464
470
|
};
|
|
465
471
|
module.exports.configDotenv = DotenvModule.configDotenv;
|
|
@@ -528,8 +534,8 @@ _chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
|
528
534
|
|
|
529
535
|
// src/version.ts
|
|
530
536
|
_chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
531
|
-
var _fs = require('fs'); var fs = _interopRequireWildcard(_fs); var
|
|
532
|
-
var _path = require('path'); var path = _interopRequireWildcard(_path); var
|
|
537
|
+
var _fs = require('fs'); var fs = _interopRequireWildcard(_fs); var fs5 = _interopRequireWildcard(_fs); var fs2 = _interopRequireWildcard(_fs); var fs3 = _interopRequireWildcard(_fs); var fs4 = _interopRequireWildcard(_fs); var fs6 = _interopRequireWildcard(_fs);
|
|
538
|
+
var _path = require('path'); var path = _interopRequireWildcard(_path); var path5 = _interopRequireWildcard(_path); var path2 = _interopRequireWildcard(_path); var path3 = _interopRequireWildcard(_path); var path4 = _interopRequireWildcard(_path); var path6 = _interopRequireWildcard(_path);
|
|
533
539
|
function getVersionFromPackageJson() {
|
|
534
540
|
try {
|
|
535
541
|
const packageJsonPath = path.join(__dirname, "..", "package.json");
|
|
@@ -539,7 +545,7 @@ function getVersionFromPackageJson() {
|
|
|
539
545
|
}
|
|
540
546
|
} catch (error) {
|
|
541
547
|
}
|
|
542
|
-
return "0.
|
|
548
|
+
return "0.12.0";
|
|
543
549
|
}
|
|
544
550
|
_chunk4IPTHWLMcjs.__name.call(void 0, getVersionFromPackageJson, "getVersionFromPackageJson");
|
|
545
551
|
function isReleaseBuild() {
|
|
@@ -567,7 +573,7 @@ _chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
|
567
573
|
})();
|
|
568
574
|
|
|
569
575
|
// src/agent-bay.ts
|
|
570
|
-
var
|
|
576
|
+
var dotenv2 = _chunk4IPTHWLMcjs.__toESM.call(void 0, require_main());
|
|
571
577
|
|
|
572
578
|
|
|
573
579
|
|
|
@@ -663,7 +669,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
663
669
|
});
|
|
664
670
|
return $dara.cast(
|
|
665
671
|
await this.callApi(params, req, runtime),
|
|
666
|
-
new (0,
|
|
672
|
+
new (0, _chunkSL5GCAQEcjs.CallMcpToolResponse)({})
|
|
667
673
|
);
|
|
668
674
|
}
|
|
669
675
|
/**
|
|
@@ -706,7 +712,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
706
712
|
reqBodyType: "formData",
|
|
707
713
|
bodyType: "json"
|
|
708
714
|
});
|
|
709
|
-
return $dara.cast(await this.doRPCRequest(params.action, params.version, params.protocol, params.method, params.authType, params.bodyType, req, runtime), new (0,
|
|
715
|
+
return $dara.cast(await this.doRPCRequest(params.action, params.version, params.protocol, params.method, params.authType, params.bodyType, req, runtime), new (0, _chunkSL5GCAQEcjs.ClearContextResponse)({}));
|
|
710
716
|
}
|
|
711
717
|
/**
|
|
712
718
|
* Delete Persistent Context
|
|
@@ -727,7 +733,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
727
733
|
*/
|
|
728
734
|
async createMcpSessionWithOptions(tmpReq, runtime) {
|
|
729
735
|
tmpReq.validate();
|
|
730
|
-
const request = new (0,
|
|
736
|
+
const request = new (0, _chunkSL5GCAQEcjs.CreateMcpSessionShrinkRequest)({});
|
|
731
737
|
_openapicore.OpenApiUtil.convert(tmpReq, request);
|
|
732
738
|
if (!$dara.isNull(tmpReq.persistenceDataList)) {
|
|
733
739
|
request.persistenceDataListShrink = _openapicore.OpenApiUtil.arrayToStringWithSpecifiedStyle(
|
|
@@ -786,7 +792,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
786
792
|
});
|
|
787
793
|
return $dara.cast(
|
|
788
794
|
await this.callApi(params, req, runtime),
|
|
789
|
-
new (0,
|
|
795
|
+
new (0, _chunkSL5GCAQEcjs.CreateMcpSessionResponse)({})
|
|
790
796
|
);
|
|
791
797
|
}
|
|
792
798
|
/**
|
|
@@ -831,7 +837,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
831
837
|
});
|
|
832
838
|
return $dara.cast(
|
|
833
839
|
await this.callApi(params, req, runtime),
|
|
834
|
-
new (0,
|
|
840
|
+
new (0, _chunkSL5GCAQEcjs.DeleteContextResponse)({})
|
|
835
841
|
);
|
|
836
842
|
}
|
|
837
843
|
/**
|
|
@@ -882,7 +888,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
882
888
|
});
|
|
883
889
|
return $dara.cast(
|
|
884
890
|
await this.callApi(params, req, runtime),
|
|
885
|
-
new (0,
|
|
891
|
+
new (0, _chunkSL5GCAQEcjs.GetContextResponse)({})
|
|
886
892
|
);
|
|
887
893
|
}
|
|
888
894
|
/**
|
|
@@ -936,7 +942,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
936
942
|
});
|
|
937
943
|
return $dara.cast(
|
|
938
944
|
await this.callApi(params, req, runtime),
|
|
939
|
-
new (0,
|
|
945
|
+
new (0, _chunkSL5GCAQEcjs.GetContextInfoResponse)({})
|
|
940
946
|
);
|
|
941
947
|
}
|
|
942
948
|
/**
|
|
@@ -987,7 +993,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
987
993
|
});
|
|
988
994
|
return $dara.cast(
|
|
989
995
|
await this.callApi(params, req, runtime),
|
|
990
|
-
new (0,
|
|
996
|
+
new (0, _chunkSL5GCAQEcjs.GetLabelResponse)({})
|
|
991
997
|
);
|
|
992
998
|
}
|
|
993
999
|
/**
|
|
@@ -1032,7 +1038,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1032
1038
|
});
|
|
1033
1039
|
return $dara.cast(
|
|
1034
1040
|
await this.callApi(params, req, runtime),
|
|
1035
|
-
new (0,
|
|
1041
|
+
new (0, _chunkSL5GCAQEcjs.GetSessionResponse)({})
|
|
1036
1042
|
);
|
|
1037
1043
|
}
|
|
1038
1044
|
/**
|
|
@@ -1045,6 +1051,96 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1045
1051
|
const runtime = new $dara.RuntimeOptions({});
|
|
1046
1052
|
return await this.getSessionWithOptions(request, runtime);
|
|
1047
1053
|
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Pause session async
|
|
1056
|
+
*
|
|
1057
|
+
* @param request - PauseSessionAsyncRequest
|
|
1058
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
1059
|
+
* @returns PauseSessionAsyncResponse
|
|
1060
|
+
*/
|
|
1061
|
+
async pauseSessionAsyncWithOptions(request, runtime) {
|
|
1062
|
+
request.validate();
|
|
1063
|
+
const body = {};
|
|
1064
|
+
if (!$dara.isNull(request.authorization)) {
|
|
1065
|
+
body["Authorization"] = request.authorization;
|
|
1066
|
+
}
|
|
1067
|
+
if (!$dara.isNull(request.sessionId)) {
|
|
1068
|
+
body["SessionId"] = request.sessionId;
|
|
1069
|
+
}
|
|
1070
|
+
const req = new _openapicore.$OpenApiUtil.OpenApiRequest({
|
|
1071
|
+
body: _openapicore.OpenApiUtil.parseToMap(body)
|
|
1072
|
+
});
|
|
1073
|
+
const params = new _openapicore.$OpenApiUtil.Params({
|
|
1074
|
+
action: "PauseSessionAsync",
|
|
1075
|
+
version: "2025-05-06",
|
|
1076
|
+
protocol: "HTTPS",
|
|
1077
|
+
pathname: "/",
|
|
1078
|
+
method: "POST",
|
|
1079
|
+
authType: "Anonymous",
|
|
1080
|
+
style: "RPC",
|
|
1081
|
+
reqBodyType: "formData",
|
|
1082
|
+
bodyType: "json"
|
|
1083
|
+
});
|
|
1084
|
+
return $dara.cast(
|
|
1085
|
+
await this.callApi(params, req, runtime),
|
|
1086
|
+
new (0, _chunkSL5GCAQEcjs.PauseSessionAsyncResponse)({})
|
|
1087
|
+
);
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Pause session async
|
|
1091
|
+
*
|
|
1092
|
+
* @param request - PauseSessionAsyncRequest
|
|
1093
|
+
* @returns PauseSessionAsyncResponse
|
|
1094
|
+
*/
|
|
1095
|
+
async pauseSessionAsync(request) {
|
|
1096
|
+
const runtime = new $dara.RuntimeOptions({});
|
|
1097
|
+
return await this.pauseSessionAsyncWithOptions(request, runtime);
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Resume session async
|
|
1101
|
+
*
|
|
1102
|
+
* @param request - ResumeSessionAsyncRequest
|
|
1103
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
1104
|
+
* @returns ResumeSessionAsyncResponse
|
|
1105
|
+
*/
|
|
1106
|
+
async resumeSessionAsyncWithOptions(request, runtime) {
|
|
1107
|
+
request.validate();
|
|
1108
|
+
const body = {};
|
|
1109
|
+
if (!$dara.isNull(request.authorization)) {
|
|
1110
|
+
body["Authorization"] = request.authorization;
|
|
1111
|
+
}
|
|
1112
|
+
if (!$dara.isNull(request.sessionId)) {
|
|
1113
|
+
body["SessionId"] = request.sessionId;
|
|
1114
|
+
}
|
|
1115
|
+
const req = new _openapicore.$OpenApiUtil.OpenApiRequest({
|
|
1116
|
+
body: _openapicore.OpenApiUtil.parseToMap(body)
|
|
1117
|
+
});
|
|
1118
|
+
const params = new _openapicore.$OpenApiUtil.Params({
|
|
1119
|
+
action: "ResumeSessionAsync",
|
|
1120
|
+
version: "2025-05-06",
|
|
1121
|
+
protocol: "HTTPS",
|
|
1122
|
+
pathname: "/",
|
|
1123
|
+
method: "POST",
|
|
1124
|
+
authType: "Anonymous",
|
|
1125
|
+
style: "RPC",
|
|
1126
|
+
reqBodyType: "formData",
|
|
1127
|
+
bodyType: "json"
|
|
1128
|
+
});
|
|
1129
|
+
return $dara.cast(
|
|
1130
|
+
await this.callApi(params, req, runtime),
|
|
1131
|
+
new (0, _chunkSL5GCAQEcjs.ResumeSessionAsyncResponse)({})
|
|
1132
|
+
);
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Resume session async
|
|
1136
|
+
*
|
|
1137
|
+
* @param request - ResumeSessionAsyncRequest
|
|
1138
|
+
* @returns ResumeSessionAsyncResponse
|
|
1139
|
+
*/
|
|
1140
|
+
async resumeSessionAsync(request) {
|
|
1141
|
+
const runtime = new $dara.RuntimeOptions({});
|
|
1142
|
+
return await this.resumeSessionAsyncWithOptions(request, runtime);
|
|
1143
|
+
}
|
|
1048
1144
|
/**
|
|
1049
1145
|
* Get forwarding link for specific port
|
|
1050
1146
|
*
|
|
@@ -1086,7 +1182,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1086
1182
|
});
|
|
1087
1183
|
return $dara.cast(
|
|
1088
1184
|
await this.callApi(params, req, runtime),
|
|
1089
|
-
new (0,
|
|
1185
|
+
new (0, _chunkSL5GCAQEcjs.GetLinkResponse)({})
|
|
1090
1186
|
);
|
|
1091
1187
|
}
|
|
1092
1188
|
/**
|
|
@@ -1131,7 +1227,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1131
1227
|
});
|
|
1132
1228
|
return $dara.cast(
|
|
1133
1229
|
await this.callApi(params, req, runtime),
|
|
1134
|
-
new (0,
|
|
1230
|
+
new (0, _chunkSL5GCAQEcjs.GetMcpResourceResponse)({})
|
|
1135
1231
|
);
|
|
1136
1232
|
}
|
|
1137
1233
|
/**
|
|
@@ -1179,7 +1275,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1179
1275
|
});
|
|
1180
1276
|
return $dara.cast(
|
|
1181
1277
|
await this.callApi(params, req, runtime),
|
|
1182
|
-
new (0,
|
|
1278
|
+
new (0, _chunkSL5GCAQEcjs.ListContextsResponse)({})
|
|
1183
1279
|
);
|
|
1184
1280
|
}
|
|
1185
1281
|
/**
|
|
@@ -1224,7 +1320,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1224
1320
|
});
|
|
1225
1321
|
return $dara.cast(
|
|
1226
1322
|
await this.callApi(params, req, runtime),
|
|
1227
|
-
new (0,
|
|
1323
|
+
new (0, _chunkSL5GCAQEcjs.ListMcpToolsResponse)({})
|
|
1228
1324
|
);
|
|
1229
1325
|
}
|
|
1230
1326
|
/**
|
|
@@ -1275,7 +1371,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1275
1371
|
});
|
|
1276
1372
|
return $dara.cast(
|
|
1277
1373
|
await this.callApi(params, req, runtime),
|
|
1278
|
-
new (0,
|
|
1374
|
+
new (0, _chunkSL5GCAQEcjs.ListSessionResponse)({})
|
|
1279
1375
|
);
|
|
1280
1376
|
}
|
|
1281
1377
|
/**
|
|
@@ -1323,7 +1419,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1323
1419
|
});
|
|
1324
1420
|
return $dara.cast(
|
|
1325
1421
|
await this.callApi(params, req, runtime),
|
|
1326
|
-
new (0,
|
|
1422
|
+
new (0, _chunkSL5GCAQEcjs.ModifyContextResponse)({})
|
|
1327
1423
|
);
|
|
1328
1424
|
}
|
|
1329
1425
|
/**
|
|
@@ -1368,7 +1464,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1368
1464
|
});
|
|
1369
1465
|
return $dara.cast(
|
|
1370
1466
|
await this.callApi(params, req, runtime),
|
|
1371
|
-
new (0,
|
|
1467
|
+
new (0, _chunkSL5GCAQEcjs.ReleaseMcpSessionResponse)({})
|
|
1372
1468
|
);
|
|
1373
1469
|
}
|
|
1374
1470
|
/**
|
|
@@ -1416,7 +1512,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1416
1512
|
});
|
|
1417
1513
|
return $dara.cast(
|
|
1418
1514
|
await this.callApi(params, req, runtime),
|
|
1419
|
-
new (0,
|
|
1515
|
+
new (0, _chunkSL5GCAQEcjs.SetLabelResponse)({})
|
|
1420
1516
|
);
|
|
1421
1517
|
}
|
|
1422
1518
|
/**
|
|
@@ -1472,7 +1568,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1472
1568
|
});
|
|
1473
1569
|
return $dara.cast(
|
|
1474
1570
|
await this.callApi(params, req, runtime),
|
|
1475
|
-
new (0,
|
|
1571
|
+
new (0, _chunkSL5GCAQEcjs.SyncContextResponse)({})
|
|
1476
1572
|
);
|
|
1477
1573
|
}
|
|
1478
1574
|
/**
|
|
@@ -1523,7 +1619,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1523
1619
|
});
|
|
1524
1620
|
return $dara.cast(
|
|
1525
1621
|
await this.callApi(params, req, runtime),
|
|
1526
|
-
new (0,
|
|
1622
|
+
new (0, _chunkSL5GCAQEcjs.InitBrowserResponse)({})
|
|
1527
1623
|
);
|
|
1528
1624
|
}
|
|
1529
1625
|
/**
|
|
@@ -1574,7 +1670,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1574
1670
|
});
|
|
1575
1671
|
return $dara.cast(
|
|
1576
1672
|
this.callApi(params, req, runtime),
|
|
1577
|
-
new (0,
|
|
1673
|
+
new (0, _chunkSL5GCAQEcjs.InitBrowserResponse)({})
|
|
1578
1674
|
);
|
|
1579
1675
|
}
|
|
1580
1676
|
/**
|
|
@@ -1612,7 +1708,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1612
1708
|
});
|
|
1613
1709
|
return $dara.cast(
|
|
1614
1710
|
await this.callApi(params, req, runtime),
|
|
1615
|
-
new (0,
|
|
1711
|
+
new (0, _chunkSL5GCAQEcjs.DeleteContextFileResponse)({})
|
|
1616
1712
|
);
|
|
1617
1713
|
}
|
|
1618
1714
|
/**
|
|
@@ -1666,7 +1762,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1666
1762
|
});
|
|
1667
1763
|
return $dara.cast(
|
|
1668
1764
|
await this.callApi(params, req, runtime),
|
|
1669
|
-
new (0,
|
|
1765
|
+
new (0, _chunkSL5GCAQEcjs.DescribeContextFilesResponse)({})
|
|
1670
1766
|
);
|
|
1671
1767
|
}
|
|
1672
1768
|
/**
|
|
@@ -1714,7 +1810,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1714
1810
|
});
|
|
1715
1811
|
return $dara.cast(
|
|
1716
1812
|
await this.callApi(params, req, runtime),
|
|
1717
|
-
new (0,
|
|
1813
|
+
new (0, _chunkSL5GCAQEcjs.GetContextFileDownloadUrlResponse)({})
|
|
1718
1814
|
);
|
|
1719
1815
|
}
|
|
1720
1816
|
/**
|
|
@@ -1762,7 +1858,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1762
1858
|
});
|
|
1763
1859
|
return $dara.cast(
|
|
1764
1860
|
await this.callApi(params, req, runtime),
|
|
1765
|
-
new (0,
|
|
1861
|
+
new (0, _chunkSL5GCAQEcjs.GetContextFileUploadUrlResponse)({})
|
|
1766
1862
|
);
|
|
1767
1863
|
}
|
|
1768
1864
|
/**
|
|
@@ -1816,7 +1912,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1816
1912
|
req,
|
|
1817
1913
|
runtime
|
|
1818
1914
|
),
|
|
1819
|
-
new (0,
|
|
1915
|
+
new (0, _chunkSL5GCAQEcjs.GetCdpLinkResponse)({})
|
|
1820
1916
|
);
|
|
1821
1917
|
}
|
|
1822
1918
|
/**
|
|
@@ -1873,7 +1969,7 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1873
1969
|
req,
|
|
1874
1970
|
runtime
|
|
1875
1971
|
),
|
|
1876
|
-
new (0,
|
|
1972
|
+
new (0, _chunkSL5GCAQEcjs.GetAdbLinkResponse)({})
|
|
1877
1973
|
);
|
|
1878
1974
|
}
|
|
1879
1975
|
/**
|
|
@@ -1890,6 +1986,70 @@ var _Client = class _Client extends _openapicore2.default {
|
|
|
1890
1986
|
_chunk4IPTHWLMcjs.__name.call(void 0, _Client, "Client");
|
|
1891
1987
|
var Client = _Client;
|
|
1892
1988
|
|
|
1989
|
+
// src/config.ts
|
|
1990
|
+
_chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
1991
|
+
var dotenv = _chunk4IPTHWLMcjs.__toESM.call(void 0, require_main());
|
|
1992
|
+
|
|
1993
|
+
|
|
1994
|
+
var BROWSER_RECORD_PATH = "/home/guest/record";
|
|
1995
|
+
function findDotEnvFile(startPath) {
|
|
1996
|
+
const currentPath = startPath ? path2.resolve(startPath) : process.cwd();
|
|
1997
|
+
let searchPath = currentPath;
|
|
1998
|
+
while (searchPath !== path2.dirname(searchPath)) {
|
|
1999
|
+
const envFile = path2.join(searchPath, ".env");
|
|
2000
|
+
if (fs2.existsSync(envFile)) {
|
|
2001
|
+
return envFile;
|
|
2002
|
+
}
|
|
2003
|
+
const gitDir = path2.join(searchPath, ".git");
|
|
2004
|
+
if (fs2.existsSync(gitDir)) {
|
|
2005
|
+
}
|
|
2006
|
+
searchPath = path2.dirname(searchPath);
|
|
2007
|
+
}
|
|
2008
|
+
const rootEnv = path2.join(searchPath, ".env");
|
|
2009
|
+
if (fs2.existsSync(rootEnv)) {
|
|
2010
|
+
return rootEnv;
|
|
2011
|
+
}
|
|
2012
|
+
return null;
|
|
2013
|
+
}
|
|
2014
|
+
_chunk4IPTHWLMcjs.__name.call(void 0, findDotEnvFile, "findDotEnvFile");
|
|
2015
|
+
function loadDotEnvWithFallback(customEnvPath) {
|
|
2016
|
+
if (customEnvPath) {
|
|
2017
|
+
if (fs2.existsSync(customEnvPath)) {
|
|
2018
|
+
try {
|
|
2019
|
+
const envConfig = dotenv.parse(fs2.readFileSync(customEnvPath));
|
|
2020
|
+
for (const k in envConfig) {
|
|
2021
|
+
if (!process.env.hasOwnProperty(k)) {
|
|
2022
|
+
process.env[k] = envConfig[k];
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
return;
|
|
2026
|
+
} catch (error) {
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
const envFile = findDotEnvFile();
|
|
2031
|
+
if (envFile) {
|
|
2032
|
+
try {
|
|
2033
|
+
const envConfig = dotenv.parse(fs2.readFileSync(envFile));
|
|
2034
|
+
for (const k in envConfig) {
|
|
2035
|
+
if (!process.env.hasOwnProperty(k)) {
|
|
2036
|
+
process.env[k] = envConfig[k];
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
} catch (error) {
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
_chunk4IPTHWLMcjs.__name.call(void 0, loadDotEnvWithFallback, "loadDotEnvWithFallback");
|
|
2044
|
+
var dotEnvLoaded = false;
|
|
2045
|
+
if (!dotEnvLoaded) {
|
|
2046
|
+
try {
|
|
2047
|
+
loadDotEnvWithFallback();
|
|
2048
|
+
dotEnvLoaded = true;
|
|
2049
|
+
} catch (error) {
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
|
|
1893
2053
|
// src/context.ts
|
|
1894
2054
|
_chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
1895
2055
|
|
|
@@ -2144,17 +2304,17 @@ function writeToFile(message) {
|
|
|
2144
2304
|
return;
|
|
2145
2305
|
}
|
|
2146
2306
|
try {
|
|
2147
|
-
if (
|
|
2148
|
-
const stats =
|
|
2307
|
+
if (fs3.existsSync(logFilePath)) {
|
|
2308
|
+
const stats = fs3.statSync(logFilePath);
|
|
2149
2309
|
if (stats.size >= logFileMaxSize) {
|
|
2150
2310
|
const rotatedPath = `${logFilePath}.1`;
|
|
2151
|
-
if (
|
|
2152
|
-
|
|
2311
|
+
if (fs3.existsSync(rotatedPath)) {
|
|
2312
|
+
fs3.unlinkSync(rotatedPath);
|
|
2153
2313
|
}
|
|
2154
|
-
|
|
2314
|
+
fs3.renameSync(logFilePath, rotatedPath);
|
|
2155
2315
|
}
|
|
2156
2316
|
}
|
|
2157
|
-
|
|
2317
|
+
fs3.appendFileSync(logFilePath, message + "\n", "utf8");
|
|
2158
2318
|
} catch (error) {
|
|
2159
2319
|
if (consoleLoggingEnabled) {
|
|
2160
2320
|
process.stderr.write(`Failed to write to log file: ${error}
|
|
@@ -2171,9 +2331,9 @@ function setupLogger(config) {
|
|
|
2171
2331
|
if (config.logFile) {
|
|
2172
2332
|
logFilePath = config.logFile;
|
|
2173
2333
|
fileLoggingEnabled = true;
|
|
2174
|
-
const dir =
|
|
2175
|
-
if (!
|
|
2176
|
-
|
|
2334
|
+
const dir = path3.dirname(logFilePath);
|
|
2335
|
+
if (!fs3.existsSync(dir)) {
|
|
2336
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
2177
2337
|
}
|
|
2178
2338
|
if (config.maxFileSize) {
|
|
2179
2339
|
logFileMaxSize = parseFileSize(config.maxFileSize);
|
|
@@ -2491,7 +2651,7 @@ var _ContextService = class _ContextService {
|
|
|
2491
2651
|
async list(params) {
|
|
2492
2652
|
try {
|
|
2493
2653
|
const maxResults = _optionalChain([params, 'optionalAccess', _5 => _5.maxResults]) !== void 0 ? params.maxResults : 10;
|
|
2494
|
-
const request = new (0,
|
|
2654
|
+
const request = new (0, _chunkSL5GCAQEcjs.ListContextsRequest)({
|
|
2495
2655
|
authorization: `Bearer ${this.agentBay.getAPIKey()}`,
|
|
2496
2656
|
maxResults,
|
|
2497
2657
|
nextToken: _optionalChain([params, 'optionalAccess', _6 => _6.nextToken])
|
|
@@ -2573,7 +2733,7 @@ var _ContextService = class _ContextService {
|
|
|
2573
2733
|
*/
|
|
2574
2734
|
async get(name, create = false) {
|
|
2575
2735
|
try {
|
|
2576
|
-
const request = new (0,
|
|
2736
|
+
const request = new (0, _chunkSL5GCAQEcjs.GetContextRequest)({
|
|
2577
2737
|
name,
|
|
2578
2738
|
allowCreate: create ? "true" : "false",
|
|
2579
2739
|
authorization: `Bearer ${this.agentBay.getAPIKey()}`
|
|
@@ -2692,7 +2852,7 @@ var _ContextService = class _ContextService {
|
|
|
2692
2852
|
*/
|
|
2693
2853
|
async update(context) {
|
|
2694
2854
|
try {
|
|
2695
|
-
const request = new (0,
|
|
2855
|
+
const request = new (0, _chunkSL5GCAQEcjs.ModifyContextRequest)({
|
|
2696
2856
|
id: context.id,
|
|
2697
2857
|
name: context.name,
|
|
2698
2858
|
authorization: `Bearer ${this.agentBay.getAPIKey()}`
|
|
@@ -2743,7 +2903,7 @@ var _ContextService = class _ContextService {
|
|
|
2743
2903
|
*/
|
|
2744
2904
|
async delete(context) {
|
|
2745
2905
|
try {
|
|
2746
|
-
const request = new (0,
|
|
2906
|
+
const request = new (0, _chunkSL5GCAQEcjs.DeleteContextRequest)({
|
|
2747
2907
|
id: context.id,
|
|
2748
2908
|
authorization: `Bearer ${this.agentBay.getAPIKey()}`
|
|
2749
2909
|
});
|
|
@@ -2794,7 +2954,7 @@ var _ContextService = class _ContextService {
|
|
|
2794
2954
|
async getFileUploadUrl(contextId, filePath) {
|
|
2795
2955
|
logAPICall("GetContextFileUploadUrl");
|
|
2796
2956
|
logDebug(`Request: ContextId=${contextId}, FilePath=${filePath}`);
|
|
2797
|
-
const req = new (0,
|
|
2957
|
+
const req = new (0, _chunkSL5GCAQEcjs.GetContextFileUploadUrlRequest)({
|
|
2798
2958
|
authorization: `Bearer ${this.agentBay.getAPIKey()}`,
|
|
2799
2959
|
contextId,
|
|
2800
2960
|
filePath
|
|
@@ -2854,7 +3014,7 @@ var _ContextService = class _ContextService {
|
|
|
2854
3014
|
async getFileDownloadUrl(contextId, filePath) {
|
|
2855
3015
|
logAPICall("GetContextFileDownloadUrl");
|
|
2856
3016
|
logDebug(`Request: ContextId=${contextId}, FilePath=${filePath}`);
|
|
2857
|
-
const req = new (0,
|
|
3017
|
+
const req = new (0, _chunkSL5GCAQEcjs.GetContextFileDownloadUrlRequest)({
|
|
2858
3018
|
authorization: `Bearer ${this.agentBay.getAPIKey()}`,
|
|
2859
3019
|
contextId,
|
|
2860
3020
|
filePath
|
|
@@ -2913,7 +3073,7 @@ var _ContextService = class _ContextService {
|
|
|
2913
3073
|
async deleteFile(contextId, filePath) {
|
|
2914
3074
|
logAPICall("DeleteContextFile");
|
|
2915
3075
|
logDebug(`Request: ContextId=${contextId}, FilePath=${filePath}`);
|
|
2916
|
-
const req = new (0,
|
|
3076
|
+
const req = new (0, _chunkSL5GCAQEcjs.DeleteContextFileRequest)({
|
|
2917
3077
|
authorization: `Bearer ${this.agentBay.getAPIKey()}`,
|
|
2918
3078
|
contextId,
|
|
2919
3079
|
filePath
|
|
@@ -2961,7 +3121,7 @@ var _ContextService = class _ContextService {
|
|
|
2961
3121
|
logDebug(
|
|
2962
3122
|
`Request: ContextId=${contextId}, ParentFolderPath=${parentFolderPath}, PageNumber=${pageNumber}, PageSize=${pageSize}`
|
|
2963
3123
|
);
|
|
2964
|
-
const req = new (0,
|
|
3124
|
+
const req = new (0, _chunkSL5GCAQEcjs.DescribeContextFilesRequest)({
|
|
2965
3125
|
authorization: `Bearer ${this.agentBay.getAPIKey()}`,
|
|
2966
3126
|
pageNumber,
|
|
2967
3127
|
pageSize,
|
|
@@ -3042,7 +3202,7 @@ var _ContextService = class _ContextService {
|
|
|
3042
3202
|
try {
|
|
3043
3203
|
logAPICall("ClearContext");
|
|
3044
3204
|
logDebug(`Request: ContextId=${contextId}`);
|
|
3045
|
-
const request = new (0,
|
|
3205
|
+
const request = new (0, _chunkSL5GCAQEcjs.ClearContextRequest)({
|
|
3046
3206
|
authorization: `Bearer ${this.agentBay.getAPIKey()}`,
|
|
3047
3207
|
id: contextId
|
|
3048
3208
|
});
|
|
@@ -3109,7 +3269,7 @@ var _ContextService = class _ContextService {
|
|
|
3109
3269
|
try {
|
|
3110
3270
|
logAPICall("GetContext");
|
|
3111
3271
|
logDebug(`Request: ContextId=${contextId} (for clear status)`);
|
|
3112
|
-
const request = new (0,
|
|
3272
|
+
const request = new (0, _chunkSL5GCAQEcjs.GetContextRequest)({
|
|
3113
3273
|
authorization: `Bearer ${this.agentBay.getAPIKey()}`,
|
|
3114
3274
|
contextId,
|
|
3115
3275
|
allowCreate: "false"
|
|
@@ -3209,7 +3369,7 @@ var _ContextService = class _ContextService {
|
|
|
3209
3369
|
const maxAttempts = Math.floor(timeout / pollInterval);
|
|
3210
3370
|
let attempt = 0;
|
|
3211
3371
|
while (attempt < maxAttempts) {
|
|
3212
|
-
await new Promise((
|
|
3372
|
+
await new Promise((resolve3) => setTimeout(resolve3, pollInterval * 1e3));
|
|
3213
3373
|
attempt++;
|
|
3214
3374
|
const statusResult = await this.getClearStatus(contextId);
|
|
3215
3375
|
if (!statusResult.success) {
|
|
@@ -3299,8 +3459,8 @@ var _ExtractPolicyClass = class _ExtractPolicyClass {
|
|
|
3299
3459
|
_chunk4IPTHWLMcjs.__name.call(void 0, _ExtractPolicyClass, "ExtractPolicyClass");
|
|
3300
3460
|
var ExtractPolicyClass = _ExtractPolicyClass;
|
|
3301
3461
|
var _WhiteListValidator = class _WhiteListValidator {
|
|
3302
|
-
static containsWildcard(
|
|
3303
|
-
return /[*?\[\]]/.test(
|
|
3462
|
+
static containsWildcard(path7) {
|
|
3463
|
+
return /[*?\[\]]/.test(path7);
|
|
3304
3464
|
}
|
|
3305
3465
|
static validate(whitelist) {
|
|
3306
3466
|
if (this.containsWildcard(whitelist.path)) {
|
|
@@ -3375,12 +3535,12 @@ var _SyncPolicyImpl = class _SyncPolicyImpl {
|
|
|
3375
3535
|
_chunk4IPTHWLMcjs.__name.call(void 0, _SyncPolicyImpl, "SyncPolicyImpl");
|
|
3376
3536
|
var SyncPolicyImpl = _SyncPolicyImpl;
|
|
3377
3537
|
var _ContextSync = class _ContextSync {
|
|
3378
|
-
constructor(contextId,
|
|
3538
|
+
constructor(contextId, path7, policy) {
|
|
3379
3539
|
if (policy) {
|
|
3380
3540
|
validateSyncPolicy(policy);
|
|
3381
3541
|
}
|
|
3382
3542
|
this.contextId = contextId;
|
|
3383
|
-
this.path =
|
|
3543
|
+
this.path = path7;
|
|
3384
3544
|
this.policy = policy;
|
|
3385
3545
|
}
|
|
3386
3546
|
// WithPolicy sets the policy and returns the context sync for chaining
|
|
@@ -3481,9 +3641,9 @@ function validateSyncPolicy(policy) {
|
|
|
3481
3641
|
);
|
|
3482
3642
|
}
|
|
3483
3643
|
if (policy.recyclePolicy.paths) {
|
|
3484
|
-
for (const
|
|
3485
|
-
if (
|
|
3486
|
-
const tempWhiteList = { path:
|
|
3644
|
+
for (const path7 of policy.recyclePolicy.paths) {
|
|
3645
|
+
if (path7 && path7.trim() !== "") {
|
|
3646
|
+
const tempWhiteList = { path: path7 };
|
|
3487
3647
|
WhiteListValidator.validate(tempWhiteList);
|
|
3488
3648
|
}
|
|
3489
3649
|
}
|
|
@@ -3495,11 +3655,11 @@ function newSyncPolicyWithDefaults(policy) {
|
|
|
3495
3655
|
return new SyncPolicyImpl(policy).toJSON();
|
|
3496
3656
|
}
|
|
3497
3657
|
_chunk4IPTHWLMcjs.__name.call(void 0, newSyncPolicyWithDefaults, "newSyncPolicyWithDefaults");
|
|
3498
|
-
function newContextSync(contextId,
|
|
3658
|
+
function newContextSync(contextId, path7, policy) {
|
|
3499
3659
|
if (policy) {
|
|
3500
3660
|
validateSyncPolicy(policy);
|
|
3501
3661
|
}
|
|
3502
|
-
return new ContextSync(contextId,
|
|
3662
|
+
return new ContextSync(contextId, path7, policy);
|
|
3503
3663
|
}
|
|
3504
3664
|
_chunk4IPTHWLMcjs.__name.call(void 0, newContextSync, "newContextSync");
|
|
3505
3665
|
|
|
@@ -3631,7 +3791,7 @@ var _Agent = class _Agent {
|
|
|
3631
3791
|
};
|
|
3632
3792
|
}
|
|
3633
3793
|
logDebug(`Task ${taskId} is still running, please wait for a while.`);
|
|
3634
|
-
await new Promise((
|
|
3794
|
+
await new Promise((resolve3) => setTimeout(resolve3, 3e3));
|
|
3635
3795
|
triedTime++;
|
|
3636
3796
|
}
|
|
3637
3797
|
return {
|
|
@@ -4568,8 +4728,8 @@ var _BrowserFingerprintGenerator = class _BrowserFingerprintGenerator {
|
|
|
4568
4728
|
async saveToFile(jsonData, filename) {
|
|
4569
4729
|
try {
|
|
4570
4730
|
if (typeof _chunk4IPTHWLMcjs.__require !== "undefined") {
|
|
4571
|
-
const
|
|
4572
|
-
|
|
4731
|
+
const fs7 = _chunk4IPTHWLMcjs.__require.call(void 0, "fs");
|
|
4732
|
+
fs7.writeFileSync(filename, jsonData, "utf8");
|
|
4573
4733
|
console.log(`Fingerprint data saved to ${filename}`);
|
|
4574
4734
|
return true;
|
|
4575
4735
|
} else {
|
|
@@ -4868,7 +5028,7 @@ var _Browser = class _Browser {
|
|
|
4868
5028
|
}
|
|
4869
5029
|
try {
|
|
4870
5030
|
logDebug(`Initializing browser with option: ${JSON.stringify(option)}`);
|
|
4871
|
-
const request = new (0,
|
|
5031
|
+
const request = new (0, _chunkSL5GCAQEcjs.InitBrowserRequest)();
|
|
4872
5032
|
request.authorization = `Bearer ${this.session.getAPIKey()}`;
|
|
4873
5033
|
request.persistentPath = BROWSER_DATA_PATH;
|
|
4874
5034
|
request.sessionId = this.session.getSessionId();
|
|
@@ -4927,7 +5087,7 @@ var _Browser = class _Browser {
|
|
|
4927
5087
|
}
|
|
4928
5088
|
try {
|
|
4929
5089
|
logDebug(`Initializing browser asynchronously with option: ${JSON.stringify(option)}`);
|
|
4930
|
-
const request = new (0,
|
|
5090
|
+
const request = new (0, _chunkSL5GCAQEcjs.InitBrowserRequest)();
|
|
4931
5091
|
request.authorization = `Bearer ${this.session.getAPIKey()}`;
|
|
4932
5092
|
request.persistentPath = BROWSER_DATA_PATH;
|
|
4933
5093
|
request.sessionId = this.session.getSessionId();
|
|
@@ -5018,7 +5178,7 @@ var _Browser = class _Browser {
|
|
|
5018
5178
|
logDebug(`VPC mode, endpoint_router_port: ${this.session.httpPort}`);
|
|
5019
5179
|
this._endpointUrl = `ws://${this.session.networkInterfaceIp}:${this.session.httpPort}`;
|
|
5020
5180
|
} else {
|
|
5021
|
-
const { GetCdpLinkRequest: GetCdpLinkRequest2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./model-
|
|
5181
|
+
const { GetCdpLinkRequest: GetCdpLinkRequest2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./model-CNCGFWJH.cjs")));
|
|
5022
5182
|
const request = new GetCdpLinkRequest2({
|
|
5023
5183
|
authorization: `Bearer ${this.session.getAPIKey()}`,
|
|
5024
5184
|
sessionId: this.session.sessionId
|
|
@@ -6530,16 +6690,16 @@ var _ContextManager = class _ContextManager {
|
|
|
6530
6690
|
* }
|
|
6531
6691
|
* ```
|
|
6532
6692
|
*/
|
|
6533
|
-
async infoWithParams(contextId,
|
|
6534
|
-
const request = new (0,
|
|
6693
|
+
async infoWithParams(contextId, path7, taskType) {
|
|
6694
|
+
const request = new (0, _chunkSL5GCAQEcjs.GetContextInfoRequest)({
|
|
6535
6695
|
authorization: `Bearer ${this.session.getAPIKey()}`,
|
|
6536
6696
|
sessionId: this.session.getSessionId()
|
|
6537
6697
|
});
|
|
6538
6698
|
if (contextId) {
|
|
6539
6699
|
request.contextId = contextId;
|
|
6540
6700
|
}
|
|
6541
|
-
if (
|
|
6542
|
-
request.path =
|
|
6701
|
+
if (path7) {
|
|
6702
|
+
request.path = path7;
|
|
6543
6703
|
}
|
|
6544
6704
|
if (taskType) {
|
|
6545
6705
|
request.taskType = taskType;
|
|
@@ -6614,16 +6774,31 @@ var _ContextManager = class _ContextManager {
|
|
|
6614
6774
|
/**
|
|
6615
6775
|
* Synchronizes a context with the session. Supports both async and callback modes.
|
|
6616
6776
|
*
|
|
6617
|
-
* @param contextId - Optional context ID to synchronize
|
|
6618
|
-
* @param path - Optional path where the context should be mounted
|
|
6777
|
+
* @param contextId - Optional context ID to synchronize. If provided, `path` must also be provided.
|
|
6778
|
+
* @param path - Optional path where the context should be mounted. If provided, `contextId` must also be provided.
|
|
6619
6779
|
* @param mode - Optional synchronization mode (e.g., "upload", "download")
|
|
6620
6780
|
* @param callback - Optional callback function. If provided, runs in background and calls callback when complete
|
|
6621
6781
|
* @param maxRetries - Maximum number of retries for polling completion status (default: 150)
|
|
6622
6782
|
* @param retryInterval - Milliseconds to wait between retries (default: 1500)
|
|
6623
6783
|
* @returns Promise resolving to ContextSyncResult with success status and request ID
|
|
6624
6784
|
* @throws Error if the API call fails
|
|
6785
|
+
* @throws Error if `contextId` or `path` is provided without the other parameter.
|
|
6786
|
+
* Both must be provided together, or both must be omitted.
|
|
6787
|
+
*
|
|
6788
|
+
* @example
|
|
6789
|
+
* Sync all contexts (no parameters):
|
|
6790
|
+
* ```typescript
|
|
6791
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
6792
|
+
* const result = await agentBay.create();
|
|
6793
|
+
* if (result.success) {
|
|
6794
|
+
* const syncResult = await result.session.context.sync();
|
|
6795
|
+
* console.log(`Sync: ${syncResult.success}`);
|
|
6796
|
+
* await result.session.delete();
|
|
6797
|
+
* }
|
|
6798
|
+
* ```
|
|
6625
6799
|
*
|
|
6626
6800
|
* @example
|
|
6801
|
+
* Sync specific context with path:
|
|
6627
6802
|
* ```typescript
|
|
6628
6803
|
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
6629
6804
|
* const result = await agentBay.create();
|
|
@@ -6635,16 +6810,23 @@ var _ContextManager = class _ContextManager {
|
|
|
6635
6810
|
* }
|
|
6636
6811
|
* ```
|
|
6637
6812
|
*/
|
|
6638
|
-
async sync(contextId,
|
|
6639
|
-
const
|
|
6813
|
+
async sync(contextId, path7, mode, callback, maxRetries = 150, retryInterval = 1500) {
|
|
6814
|
+
const hasContextId = contextId !== void 0 && contextId.trim() !== "";
|
|
6815
|
+
const hasPath = path7 !== void 0 && path7.trim() !== "";
|
|
6816
|
+
if (hasContextId !== hasPath) {
|
|
6817
|
+
throw new Error(
|
|
6818
|
+
"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."
|
|
6819
|
+
);
|
|
6820
|
+
}
|
|
6821
|
+
const request = new (0, _chunkSL5GCAQEcjs.SyncContextRequest)({
|
|
6640
6822
|
authorization: `Bearer ${this.session.getAPIKey()}`,
|
|
6641
6823
|
sessionId: this.session.getSessionId()
|
|
6642
6824
|
});
|
|
6643
6825
|
if (contextId) {
|
|
6644
6826
|
request.contextId = contextId;
|
|
6645
6827
|
}
|
|
6646
|
-
if (
|
|
6647
|
-
request.path =
|
|
6828
|
+
if (path7) {
|
|
6829
|
+
request.path = path7;
|
|
6648
6830
|
}
|
|
6649
6831
|
if (mode) {
|
|
6650
6832
|
request.mode = mode;
|
|
@@ -6694,7 +6876,7 @@ var _ContextManager = class _ContextManager {
|
|
|
6694
6876
|
const fullResponse = response.body ? JSON.stringify(response.body, null, 2) : "";
|
|
6695
6877
|
logAPIResponseWithDetails("SyncContext", requestId, success, keyFields, fullResponse);
|
|
6696
6878
|
if (callback && success) {
|
|
6697
|
-
this.pollForCompletion(callback, contextId,
|
|
6879
|
+
this.pollForCompletion(callback, contextId, path7, maxRetries, retryInterval).catch((error) => {
|
|
6698
6880
|
logError("Error in background polling:", error);
|
|
6699
6881
|
callback(false);
|
|
6700
6882
|
});
|
|
@@ -6706,7 +6888,7 @@ var _ContextManager = class _ContextManager {
|
|
|
6706
6888
|
if (success) {
|
|
6707
6889
|
const finalSuccess = await this.pollForCompletionAsync(
|
|
6708
6890
|
contextId,
|
|
6709
|
-
|
|
6891
|
+
path7,
|
|
6710
6892
|
maxRetries,
|
|
6711
6893
|
retryInterval
|
|
6712
6894
|
);
|
|
@@ -6727,10 +6909,10 @@ var _ContextManager = class _ContextManager {
|
|
|
6727
6909
|
/**
|
|
6728
6910
|
* Polls the info interface to check if sync is completed and calls callback.
|
|
6729
6911
|
*/
|
|
6730
|
-
async pollForCompletion(callback, contextId,
|
|
6912
|
+
async pollForCompletion(callback, contextId, path7, maxRetries = 150, retryInterval = 1500) {
|
|
6731
6913
|
for (let retry = 0; retry < maxRetries; retry++) {
|
|
6732
6914
|
try {
|
|
6733
|
-
const infoResult = await this.infoWithParams(contextId,
|
|
6915
|
+
const infoResult = await this.infoWithParams(contextId, path7);
|
|
6734
6916
|
let allCompleted = true;
|
|
6735
6917
|
let hasFailure = false;
|
|
6736
6918
|
let hasSyncTasks = false;
|
|
@@ -6775,10 +6957,10 @@ var _ContextManager = class _ContextManager {
|
|
|
6775
6957
|
/**
|
|
6776
6958
|
* Async version of polling for sync completion.
|
|
6777
6959
|
*/
|
|
6778
|
-
async pollForCompletionAsync(contextId,
|
|
6960
|
+
async pollForCompletionAsync(contextId, path7, maxRetries = 150, retryInterval = 1500) {
|
|
6779
6961
|
for (let retry = 0; retry < maxRetries; retry++) {
|
|
6780
6962
|
try {
|
|
6781
|
-
const infoResult = await this.infoWithParams(contextId,
|
|
6963
|
+
const infoResult = await this.infoWithParams(contextId, path7);
|
|
6782
6964
|
let allCompleted = true;
|
|
6783
6965
|
let hasFailure = false;
|
|
6784
6966
|
let hasSyncTasks = false;
|
|
@@ -6823,7 +7005,7 @@ var _ContextManager = class _ContextManager {
|
|
|
6823
7005
|
* Sleep utility function for TypeScript
|
|
6824
7006
|
*/
|
|
6825
7007
|
sleep(ms) {
|
|
6826
|
-
return new Promise((
|
|
7008
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
6827
7009
|
}
|
|
6828
7010
|
};
|
|
6829
7011
|
_chunk4IPTHWLMcjs.__name.call(void 0, _ContextManager, "ContextManager");
|
|
@@ -6878,7 +7060,7 @@ var _FileTransfer = class _FileTransfer {
|
|
|
6878
7060
|
progressCb = void 0
|
|
6879
7061
|
} = options || {};
|
|
6880
7062
|
try {
|
|
6881
|
-
if (!
|
|
7063
|
+
if (!fs4.existsSync(localPath)) {
|
|
6882
7064
|
return {
|
|
6883
7065
|
success: false,
|
|
6884
7066
|
bytesSent: 0,
|
|
@@ -6948,7 +7130,7 @@ var _FileTransfer = class _FileTransfer {
|
|
|
6948
7130
|
// Assuming previous step succeeded
|
|
6949
7131
|
etag: "",
|
|
6950
7132
|
// Assuming previous step succeeded
|
|
6951
|
-
bytesSent:
|
|
7133
|
+
bytesSent: fs4.statSync(localPath).size,
|
|
6952
7134
|
// Assuming previous step succeeded
|
|
6953
7135
|
path: remotePath,
|
|
6954
7136
|
error: `session.context.sync(upload) failed: ${e.message || e}`
|
|
@@ -6972,7 +7154,7 @@ var _FileTransfer = class _FileTransfer {
|
|
|
6972
7154
|
// Assuming previous step succeeded
|
|
6973
7155
|
etag: "",
|
|
6974
7156
|
// Assuming previous step succeeded
|
|
6975
|
-
bytesSent:
|
|
7157
|
+
bytesSent: fs4.statSync(localPath).size,
|
|
6976
7158
|
// Assuming previous step succeeded
|
|
6977
7159
|
path: remotePath,
|
|
6978
7160
|
error: `Upload sync not finished: ${error || "timeout or unknown"}`
|
|
@@ -6985,7 +7167,7 @@ var _FileTransfer = class _FileTransfer {
|
|
|
6985
7167
|
requestIdSync: reqIdSync,
|
|
6986
7168
|
httpStatus: 200,
|
|
6987
7169
|
etag: "",
|
|
6988
|
-
bytesSent:
|
|
7170
|
+
bytesSent: fs4.statSync(localPath).size,
|
|
6989
7171
|
path: remotePath
|
|
6990
7172
|
};
|
|
6991
7173
|
} catch (e) {
|
|
@@ -7072,11 +7254,11 @@ var _FileTransfer = class _FileTransfer {
|
|
|
7072
7254
|
const downloadUrl = urlRes.url;
|
|
7073
7255
|
const reqIdDownload = urlRes.requestId;
|
|
7074
7256
|
try {
|
|
7075
|
-
const dir =
|
|
7076
|
-
if (!
|
|
7077
|
-
|
|
7257
|
+
const dir = path4.dirname(localPath);
|
|
7258
|
+
if (!fs4.existsSync(dir)) {
|
|
7259
|
+
fs4.mkdirSync(dir, { recursive: true });
|
|
7078
7260
|
}
|
|
7079
|
-
if (
|
|
7261
|
+
if (fs4.existsSync(localPath) && !overwrite) {
|
|
7080
7262
|
return {
|
|
7081
7263
|
success: false,
|
|
7082
7264
|
requestIdDownloadUrl: reqIdDownload,
|
|
@@ -7092,13 +7274,13 @@ var _FileTransfer = class _FileTransfer {
|
|
|
7092
7274
|
localPath,
|
|
7093
7275
|
progressCb
|
|
7094
7276
|
);
|
|
7095
|
-
if (
|
|
7277
|
+
if (fs4.existsSync(localPath)) {
|
|
7096
7278
|
return {
|
|
7097
7279
|
success: true,
|
|
7098
7280
|
requestIdDownloadUrl: reqIdDownload,
|
|
7099
7281
|
requestIdSync: reqIdSync,
|
|
7100
7282
|
httpStatus: 200,
|
|
7101
|
-
bytesReceived:
|
|
7283
|
+
bytesReceived: fs4.statSync(localPath).size,
|
|
7102
7284
|
path: remotePath,
|
|
7103
7285
|
localPath
|
|
7104
7286
|
};
|
|
@@ -7197,11 +7379,11 @@ var _FileTransfer = class _FileTransfer {
|
|
|
7197
7379
|
const statusList = res.contextStatusData || [];
|
|
7198
7380
|
for (const item of statusList) {
|
|
7199
7381
|
const cid = item.contextId;
|
|
7200
|
-
const
|
|
7382
|
+
const path7 = item.path;
|
|
7201
7383
|
const ttype = item.taskType;
|
|
7202
7384
|
const status = item.status;
|
|
7203
7385
|
const err = item.errorMessage;
|
|
7204
|
-
if (cid === contextId &&
|
|
7386
|
+
if (cid === contextId && path7 === remotePath && (taskType === void 0 || ttype === taskType)) {
|
|
7205
7387
|
if (err) {
|
|
7206
7388
|
return { success: false, error: `Task error: ${err}` };
|
|
7207
7389
|
}
|
|
@@ -7214,7 +7396,7 @@ var _FileTransfer = class _FileTransfer {
|
|
|
7214
7396
|
} catch (e) {
|
|
7215
7397
|
lastErr = `info error: ${e.message || e}`;
|
|
7216
7398
|
}
|
|
7217
|
-
await new Promise((
|
|
7399
|
+
await new Promise((resolve3) => setTimeout(resolve3, interval * 1e3));
|
|
7218
7400
|
}
|
|
7219
7401
|
return { success: false, error: lastErr || "timeout" };
|
|
7220
7402
|
}
|
|
@@ -7227,7 +7409,7 @@ var _FileTransfer = class _FileTransfer {
|
|
|
7227
7409
|
if (contentType) {
|
|
7228
7410
|
headers["Content-Type"] = contentType;
|
|
7229
7411
|
}
|
|
7230
|
-
const fileBuffer =
|
|
7412
|
+
const fileBuffer = fs4.readFileSync(filePath);
|
|
7231
7413
|
const response = await _nodefetch2.default.call(void 0, url, {
|
|
7232
7414
|
method: "PUT",
|
|
7233
7415
|
body: fileBuffer,
|
|
@@ -7254,7 +7436,7 @@ var _FileTransfer = class _FileTransfer {
|
|
|
7254
7436
|
}
|
|
7255
7437
|
const buffer = await response.buffer();
|
|
7256
7438
|
bytesReceived = buffer.length;
|
|
7257
|
-
|
|
7439
|
+
fs4.writeFileSync(destPath, buffer);
|
|
7258
7440
|
if (progressCb) {
|
|
7259
7441
|
progressCb(bytesReceived);
|
|
7260
7442
|
}
|
|
@@ -7413,10 +7595,10 @@ var _FileSystem = class _FileSystem {
|
|
|
7413
7595
|
* }
|
|
7414
7596
|
* ```
|
|
7415
7597
|
*/
|
|
7416
|
-
async createDirectory(
|
|
7598
|
+
async createDirectory(path7) {
|
|
7417
7599
|
try {
|
|
7418
7600
|
const args = {
|
|
7419
|
-
path:
|
|
7601
|
+
path: path7
|
|
7420
7602
|
};
|
|
7421
7603
|
const result = await this.session.callMcpTool(
|
|
7422
7604
|
"create_directory",
|
|
@@ -7464,10 +7646,10 @@ var _FileSystem = class _FileSystem {
|
|
|
7464
7646
|
* }
|
|
7465
7647
|
* ```
|
|
7466
7648
|
*/
|
|
7467
|
-
async editFile(
|
|
7649
|
+
async editFile(path7, edits, dryRun = false) {
|
|
7468
7650
|
try {
|
|
7469
7651
|
const args = {
|
|
7470
|
-
path:
|
|
7652
|
+
path: path7,
|
|
7471
7653
|
edits,
|
|
7472
7654
|
dryRun
|
|
7473
7655
|
};
|
|
@@ -7514,10 +7696,10 @@ var _FileSystem = class _FileSystem {
|
|
|
7514
7696
|
* }
|
|
7515
7697
|
* ```
|
|
7516
7698
|
*/
|
|
7517
|
-
async getFileInfo(
|
|
7699
|
+
async getFileInfo(path7) {
|
|
7518
7700
|
try {
|
|
7519
7701
|
const args = {
|
|
7520
|
-
path:
|
|
7702
|
+
path: path7
|
|
7521
7703
|
};
|
|
7522
7704
|
const result = await this.session.callMcpTool(
|
|
7523
7705
|
"get_file_info",
|
|
@@ -7592,10 +7774,10 @@ var _FileSystem = class _FileSystem {
|
|
|
7592
7774
|
*
|
|
7593
7775
|
* @see {@link readFile}, {@link writeFile}
|
|
7594
7776
|
*/
|
|
7595
|
-
async listDirectory(
|
|
7777
|
+
async listDirectory(path7) {
|
|
7596
7778
|
try {
|
|
7597
7779
|
const args = {
|
|
7598
|
-
path:
|
|
7780
|
+
path: path7
|
|
7599
7781
|
};
|
|
7600
7782
|
const result = await this.session.callMcpTool(
|
|
7601
7783
|
"list_directory",
|
|
@@ -7682,10 +7864,10 @@ var _FileSystem = class _FileSystem {
|
|
|
7682
7864
|
* @param length - Optional: Number of bytes to read. If 0, reads the entire file from offset.
|
|
7683
7865
|
* @returns FileContentResult with file content and requestId
|
|
7684
7866
|
*/
|
|
7685
|
-
async readFileChunk(
|
|
7867
|
+
async readFileChunk(path7, offset = 0, length = 0) {
|
|
7686
7868
|
try {
|
|
7687
7869
|
const args = {
|
|
7688
|
-
path:
|
|
7870
|
+
path: path7
|
|
7689
7871
|
};
|
|
7690
7872
|
if (offset > 0) {
|
|
7691
7873
|
args.offset = offset;
|
|
@@ -7764,8 +7946,8 @@ var _FileSystem = class _FileSystem {
|
|
|
7764
7946
|
for (const line of lines) {
|
|
7765
7947
|
const colonIndex = line.indexOf(":");
|
|
7766
7948
|
if (colonIndex > 0 && currentPath === "" && !line.substring(0, colonIndex).includes(" ")) {
|
|
7767
|
-
const
|
|
7768
|
-
currentPath =
|
|
7949
|
+
const path7 = line.substring(0, colonIndex).trim();
|
|
7950
|
+
currentPath = path7;
|
|
7769
7951
|
if (line.length > colonIndex + 1) {
|
|
7770
7952
|
const contentStart = line.substring(colonIndex + 1).trim();
|
|
7771
7953
|
if (contentStart) {
|
|
@@ -7785,8 +7967,8 @@ var _FileSystem = class _FileSystem {
|
|
|
7785
7967
|
if (currentPath) {
|
|
7786
7968
|
fileContents[currentPath] = currentContent.join("\n");
|
|
7787
7969
|
}
|
|
7788
|
-
for (const
|
|
7789
|
-
fileContents[
|
|
7970
|
+
for (const path7 in fileContents) {
|
|
7971
|
+
fileContents[path7] = fileContents[path7].replace(/\n+$/, "");
|
|
7790
7972
|
}
|
|
7791
7973
|
}
|
|
7792
7974
|
return {
|
|
@@ -7826,10 +8008,10 @@ var _FileSystem = class _FileSystem {
|
|
|
7826
8008
|
* }
|
|
7827
8009
|
* ```
|
|
7828
8010
|
*/
|
|
7829
|
-
async searchFiles(
|
|
8011
|
+
async searchFiles(path7, pattern, excludePatterns = []) {
|
|
7830
8012
|
try {
|
|
7831
8013
|
const args = {
|
|
7832
|
-
path:
|
|
8014
|
+
path: path7,
|
|
7833
8015
|
pattern
|
|
7834
8016
|
};
|
|
7835
8017
|
if (excludePatterns.length > 0) {
|
|
@@ -7873,7 +8055,7 @@ var _FileSystem = class _FileSystem {
|
|
|
7873
8055
|
* @param mode - Optional: Write mode. One of "overwrite", "append", or "create_new". Default is "overwrite".
|
|
7874
8056
|
* @returns BoolResult with write result and requestId
|
|
7875
8057
|
*/
|
|
7876
|
-
async writeFileChunk(
|
|
8058
|
+
async writeFileChunk(path7, content, mode = "overwrite") {
|
|
7877
8059
|
try {
|
|
7878
8060
|
const validModes = ["overwrite", "append", "create_new"];
|
|
7879
8061
|
if (!validModes.includes(mode)) {
|
|
@@ -7886,7 +8068,7 @@ var _FileSystem = class _FileSystem {
|
|
|
7886
8068
|
};
|
|
7887
8069
|
}
|
|
7888
8070
|
const args = {
|
|
7889
|
-
path:
|
|
8071
|
+
path: path7,
|
|
7890
8072
|
content,
|
|
7891
8073
|
mode
|
|
7892
8074
|
};
|
|
@@ -7963,10 +8145,10 @@ var _FileSystem = class _FileSystem {
|
|
|
7963
8145
|
*
|
|
7964
8146
|
* @see {@link writeFile}, {@link listDirectory}
|
|
7965
8147
|
*/
|
|
7966
|
-
async readFile(
|
|
8148
|
+
async readFile(path7) {
|
|
7967
8149
|
const chunkSize = DEFAULT_CHUNK_SIZE;
|
|
7968
8150
|
try {
|
|
7969
|
-
const fileInfoResult = await this.getFileInfo(
|
|
8151
|
+
const fileInfoResult = await this.getFileInfo(path7);
|
|
7970
8152
|
if (!fileInfoResult.success) {
|
|
7971
8153
|
return {
|
|
7972
8154
|
requestId: fileInfoResult.requestId,
|
|
@@ -7980,7 +8162,7 @@ var _FileSystem = class _FileSystem {
|
|
|
7980
8162
|
requestId: fileInfoResult.requestId,
|
|
7981
8163
|
success: false,
|
|
7982
8164
|
content: "",
|
|
7983
|
-
errorMessage: `Path does not exist or is a directory: ${
|
|
8165
|
+
errorMessage: `Path does not exist or is a directory: ${path7}`
|
|
7984
8166
|
};
|
|
7985
8167
|
}
|
|
7986
8168
|
const fileSize = fileInfoResult.fileInfo.size || 0;
|
|
@@ -8000,7 +8182,7 @@ var _FileSystem = class _FileSystem {
|
|
|
8000
8182
|
length = fileSize - offset;
|
|
8001
8183
|
}
|
|
8002
8184
|
try {
|
|
8003
|
-
const chunkResult = await this.readFileChunk(
|
|
8185
|
+
const chunkResult = await this.readFileChunk(path7, offset, length);
|
|
8004
8186
|
if (!chunkResult.success) {
|
|
8005
8187
|
return chunkResult;
|
|
8006
8188
|
}
|
|
@@ -8086,16 +8268,16 @@ var _FileSystem = class _FileSystem {
|
|
|
8086
8268
|
*
|
|
8087
8269
|
* @see {@link readFile}, {@link listDirectory}
|
|
8088
8270
|
*/
|
|
8089
|
-
async writeFile(
|
|
8271
|
+
async writeFile(path7, content, mode = "overwrite") {
|
|
8090
8272
|
const chunkSize = DEFAULT_CHUNK_SIZE;
|
|
8091
8273
|
try {
|
|
8092
8274
|
const contentLen = content.length;
|
|
8093
8275
|
if (contentLen <= chunkSize) {
|
|
8094
|
-
return await this.writeFileChunk(
|
|
8276
|
+
return await this.writeFileChunk(path7, content, mode);
|
|
8095
8277
|
}
|
|
8096
8278
|
const firstChunkEnd = Math.min(chunkSize, contentLen);
|
|
8097
8279
|
const firstResult = await this.writeFileChunk(
|
|
8098
|
-
|
|
8280
|
+
path7,
|
|
8099
8281
|
content.substring(0, firstChunkEnd),
|
|
8100
8282
|
mode
|
|
8101
8283
|
);
|
|
@@ -8106,7 +8288,7 @@ var _FileSystem = class _FileSystem {
|
|
|
8106
8288
|
for (let offset = firstChunkEnd; offset < contentLen; ) {
|
|
8107
8289
|
const end = Math.min(offset + chunkSize, contentLen);
|
|
8108
8290
|
const chunkResult = await this.writeFileChunk(
|
|
8109
|
-
|
|
8291
|
+
path7,
|
|
8110
8292
|
content.substring(offset, end),
|
|
8111
8293
|
"append"
|
|
8112
8294
|
);
|
|
@@ -8147,9 +8329,9 @@ var _FileSystem = class _FileSystem {
|
|
|
8147
8329
|
* }
|
|
8148
8330
|
* ```
|
|
8149
8331
|
*/
|
|
8150
|
-
async getFileChange(
|
|
8332
|
+
async getFileChange(path7) {
|
|
8151
8333
|
try {
|
|
8152
|
-
const args = { path:
|
|
8334
|
+
const args = { path: path7 };
|
|
8153
8335
|
const result = await this.session.callMcpTool("get_file_change", args);
|
|
8154
8336
|
if (!result.success) {
|
|
8155
8337
|
return {
|
|
@@ -8220,17 +8402,17 @@ var _FileSystem = class _FileSystem {
|
|
|
8220
8402
|
* }
|
|
8221
8403
|
* ```
|
|
8222
8404
|
*/
|
|
8223
|
-
async watchDirectory(
|
|
8224
|
-
console.log(`Starting directory monitoring for: ${
|
|
8405
|
+
async watchDirectory(path7, callback, interval = 500, signal) {
|
|
8406
|
+
console.log(`Starting directory monitoring for: ${path7}`);
|
|
8225
8407
|
console.log(`Polling interval: ${interval} ms`);
|
|
8226
8408
|
const monitor = /* @__PURE__ */ _chunk4IPTHWLMcjs.__name.call(void 0, async () => {
|
|
8227
8409
|
while (!_optionalChain([signal, 'optionalAccess', _98 => _98.aborted])) {
|
|
8228
8410
|
try {
|
|
8229
8411
|
if (this.session._isExpired && this.session._isExpired()) {
|
|
8230
|
-
console.log(`Session expired, stopping directory monitoring for: ${
|
|
8412
|
+
console.log(`Session expired, stopping directory monitoring for: ${path7}`);
|
|
8231
8413
|
break;
|
|
8232
8414
|
}
|
|
8233
|
-
const result = await this.getFileChange(
|
|
8415
|
+
const result = await this.getFileChange(path7);
|
|
8234
8416
|
if (result.success && result.events.length > 0) {
|
|
8235
8417
|
console.log(`Detected ${result.events.length} file changes:`);
|
|
8236
8418
|
for (const event of result.events) {
|
|
@@ -8244,29 +8426,29 @@ var _FileSystem = class _FileSystem {
|
|
|
8244
8426
|
} else if (!result.success) {
|
|
8245
8427
|
const errorMsg = (result.errorMessage || "").toLowerCase();
|
|
8246
8428
|
if (errorMsg.includes("session") && (errorMsg.includes("expired") || errorMsg.includes("invalid"))) {
|
|
8247
|
-
console.log(`Session expired, stopping directory monitoring for: ${
|
|
8429
|
+
console.log(`Session expired, stopping directory monitoring for: ${path7}`);
|
|
8248
8430
|
break;
|
|
8249
8431
|
}
|
|
8250
8432
|
console.error(`Error monitoring directory: ${result.errorMessage}`);
|
|
8251
8433
|
}
|
|
8252
|
-
await new Promise((
|
|
8253
|
-
const timeoutId = setTimeout(
|
|
8434
|
+
await new Promise((resolve3) => {
|
|
8435
|
+
const timeoutId = setTimeout(resolve3, interval);
|
|
8254
8436
|
_optionalChain([signal, 'optionalAccess', _99 => _99.addEventListener, 'call', _100 => _100("abort", () => {
|
|
8255
8437
|
clearTimeout(timeoutId);
|
|
8256
|
-
|
|
8438
|
+
resolve3(void 0);
|
|
8257
8439
|
})]);
|
|
8258
8440
|
});
|
|
8259
8441
|
} catch (error) {
|
|
8260
8442
|
console.error(`Unexpected error in directory monitoring: ${error}`);
|
|
8261
8443
|
const errorStr = String(error).toLowerCase();
|
|
8262
8444
|
if (errorStr.includes("session") && (errorStr.includes("expired") || errorStr.includes("invalid"))) {
|
|
8263
|
-
console.log(`Session expired, stopping directory monitoring for: ${
|
|
8445
|
+
console.log(`Session expired, stopping directory monitoring for: ${path7}`);
|
|
8264
8446
|
break;
|
|
8265
8447
|
}
|
|
8266
|
-
await new Promise((
|
|
8448
|
+
await new Promise((resolve3) => setTimeout(resolve3, interval));
|
|
8267
8449
|
}
|
|
8268
8450
|
}
|
|
8269
|
-
console.log(`Stopped monitoring directory: ${
|
|
8451
|
+
console.log(`Stopped monitoring directory: ${path7}`);
|
|
8270
8452
|
}, "monitor");
|
|
8271
8453
|
return monitor();
|
|
8272
8454
|
}
|
|
@@ -8854,7 +9036,7 @@ var _Mobile = class _Mobile {
|
|
|
8854
9036
|
async getAdbUrl(adbkeyPub) {
|
|
8855
9037
|
try {
|
|
8856
9038
|
const optionsJson = JSON.stringify({ adbkey_pub: adbkeyPub });
|
|
8857
|
-
const { GetAdbLinkRequest: GetAdbLinkRequest2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./model-
|
|
9039
|
+
const { GetAdbLinkRequest: GetAdbLinkRequest2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./model-CNCGFWJH.cjs")));
|
|
8858
9040
|
const request = new GetAdbLinkRequest2({
|
|
8859
9041
|
authorization: `Bearer ${this.session.getAPIKey()}`,
|
|
8860
9042
|
sessionId: this.session.sessionId,
|
|
@@ -9284,12 +9466,12 @@ var _Oss = class _Oss {
|
|
|
9284
9466
|
* }
|
|
9285
9467
|
* ```
|
|
9286
9468
|
*/
|
|
9287
|
-
async upload(bucket, object,
|
|
9469
|
+
async upload(bucket, object, path7) {
|
|
9288
9470
|
try {
|
|
9289
9471
|
const args = {
|
|
9290
9472
|
bucket,
|
|
9291
9473
|
object,
|
|
9292
|
-
path:
|
|
9474
|
+
path: path7
|
|
9293
9475
|
};
|
|
9294
9476
|
const result = await this.session.callMcpTool("oss_upload", args);
|
|
9295
9477
|
return {
|
|
@@ -9327,11 +9509,11 @@ var _Oss = class _Oss {
|
|
|
9327
9509
|
* }
|
|
9328
9510
|
* ```
|
|
9329
9511
|
*/
|
|
9330
|
-
async uploadAnonymous(url,
|
|
9512
|
+
async uploadAnonymous(url, path7) {
|
|
9331
9513
|
try {
|
|
9332
9514
|
const args = {
|
|
9333
9515
|
url,
|
|
9334
|
-
path:
|
|
9516
|
+
path: path7
|
|
9335
9517
|
};
|
|
9336
9518
|
const result = await this.session.callMcpTool("oss_upload_annon", args);
|
|
9337
9519
|
return {
|
|
@@ -9371,12 +9553,12 @@ var _Oss = class _Oss {
|
|
|
9371
9553
|
* }
|
|
9372
9554
|
* ```
|
|
9373
9555
|
*/
|
|
9374
|
-
async download(bucket, object,
|
|
9556
|
+
async download(bucket, object, path7) {
|
|
9375
9557
|
try {
|
|
9376
9558
|
const args = {
|
|
9377
9559
|
bucket,
|
|
9378
9560
|
object,
|
|
9379
|
-
path:
|
|
9561
|
+
path: path7
|
|
9380
9562
|
};
|
|
9381
9563
|
const result = await this.session.callMcpTool("oss_download", args);
|
|
9382
9564
|
return {
|
|
@@ -9414,11 +9596,11 @@ var _Oss = class _Oss {
|
|
|
9414
9596
|
* }
|
|
9415
9597
|
* ```
|
|
9416
9598
|
*/
|
|
9417
|
-
async downloadAnonymous(url,
|
|
9599
|
+
async downloadAnonymous(url, path7) {
|
|
9418
9600
|
try {
|
|
9419
9601
|
const args = {
|
|
9420
9602
|
url,
|
|
9421
|
-
path:
|
|
9603
|
+
path: path7
|
|
9422
9604
|
};
|
|
9423
9605
|
const result = await this.session.callMcpTool("oss_download_annon", args);
|
|
9424
9606
|
return {
|
|
@@ -9653,7 +9835,7 @@ var _Session = class _Session {
|
|
|
9653
9835
|
try {
|
|
9654
9836
|
let syncResult;
|
|
9655
9837
|
if (syncContextId) {
|
|
9656
|
-
syncResult = await this.context.sync(syncContextId);
|
|
9838
|
+
syncResult = await this.context.sync(syncContextId, BROWSER_RECORD_PATH);
|
|
9657
9839
|
logInfo(`\u{1F3A5} Synced browser recording context: ${syncContextId}`);
|
|
9658
9840
|
} else {
|
|
9659
9841
|
syncResult = await this.context.sync();
|
|
@@ -9675,7 +9857,7 @@ var _Session = class _Session {
|
|
|
9675
9857
|
);
|
|
9676
9858
|
}
|
|
9677
9859
|
}
|
|
9678
|
-
const request = new (0,
|
|
9860
|
+
const request = new (0, _chunkSL5GCAQEcjs.ReleaseMcpSessionRequest)({
|
|
9679
9861
|
authorization: `Bearer ${this.getAPIKey()}`,
|
|
9680
9862
|
sessionId: this.sessionId
|
|
9681
9863
|
});
|
|
@@ -9785,7 +9967,7 @@ var _Session = class _Session {
|
|
|
9785
9967
|
return validationResult;
|
|
9786
9968
|
}
|
|
9787
9969
|
const labelsJSON = JSON.stringify(labels);
|
|
9788
|
-
const request = new (0,
|
|
9970
|
+
const request = new (0, _chunkSL5GCAQEcjs.SetLabelRequest)({
|
|
9789
9971
|
authorization: `Bearer ${this.getAPIKey()}`,
|
|
9790
9972
|
sessionId: this.sessionId,
|
|
9791
9973
|
labels: labelsJSON
|
|
@@ -9823,7 +10005,7 @@ var _Session = class _Session {
|
|
|
9823
10005
|
*/
|
|
9824
10006
|
async getLabels() {
|
|
9825
10007
|
try {
|
|
9826
|
-
const request = new (0,
|
|
10008
|
+
const request = new (0, _chunkSL5GCAQEcjs.GetLabelRequest)({
|
|
9827
10009
|
authorization: `Bearer ${this.getAPIKey()}`,
|
|
9828
10010
|
sessionId: this.sessionId
|
|
9829
10011
|
});
|
|
@@ -9896,7 +10078,7 @@ var _Session = class _Session {
|
|
|
9896
10078
|
*/
|
|
9897
10079
|
async info() {
|
|
9898
10080
|
try {
|
|
9899
|
-
const request = new (0,
|
|
10081
|
+
const request = new (0, _chunkSL5GCAQEcjs.GetMcpResourceRequest)({
|
|
9900
10082
|
authorization: `Bearer ${this.getAPIKey()}`,
|
|
9901
10083
|
sessionId: this.sessionId
|
|
9902
10084
|
});
|
|
@@ -10048,7 +10230,7 @@ var _Session = class _Session {
|
|
|
10048
10230
|
requestParams += ", Options=provided";
|
|
10049
10231
|
}
|
|
10050
10232
|
logAPICall("GetLink", requestParams);
|
|
10051
|
-
const request = new (0,
|
|
10233
|
+
const request = new (0, _chunkSL5GCAQEcjs.GetLinkRequest)({
|
|
10052
10234
|
authorization: `Bearer ${this.getAPIKey()}`,
|
|
10053
10235
|
sessionId: this.getSessionId(),
|
|
10054
10236
|
protocolType,
|
|
@@ -10123,7 +10305,7 @@ var _Session = class _Session {
|
|
|
10123
10305
|
requestParams += ", Options=provided";
|
|
10124
10306
|
}
|
|
10125
10307
|
logAPICall("GetLink", requestParams);
|
|
10126
|
-
const request = new (0,
|
|
10308
|
+
const request = new (0, _chunkSL5GCAQEcjs.GetLinkRequest)({
|
|
10127
10309
|
authorization: `Bearer ${this.getAPIKey()}`,
|
|
10128
10310
|
sessionId: this.getSessionId(),
|
|
10129
10311
|
protocolType,
|
|
@@ -10186,7 +10368,7 @@ var _Session = class _Session {
|
|
|
10186
10368
|
if (!imageId) {
|
|
10187
10369
|
imageId = this.imageId || "linux_latest";
|
|
10188
10370
|
}
|
|
10189
|
-
const request = new (0,
|
|
10371
|
+
const request = new (0, _chunkSL5GCAQEcjs.ListMcpToolsRequest)({
|
|
10190
10372
|
authorization: `Bearer ${this.getAPIKey()}`,
|
|
10191
10373
|
imageId
|
|
10192
10374
|
});
|
|
@@ -10351,7 +10533,7 @@ var _Session = class _Session {
|
|
|
10351
10533
|
requestId: ""
|
|
10352
10534
|
};
|
|
10353
10535
|
} else {
|
|
10354
|
-
const callToolRequest = new (0,
|
|
10536
|
+
const callToolRequest = new (0, _chunkSL5GCAQEcjs.CallMcpToolRequest)({
|
|
10355
10537
|
authorization: `Bearer ${this.getAPIKey()}`,
|
|
10356
10538
|
sessionId: this.getSessionId(),
|
|
10357
10539
|
name: toolName,
|
|
@@ -10413,86 +10595,380 @@ var _Session = class _Session {
|
|
|
10413
10595
|
};
|
|
10414
10596
|
}
|
|
10415
10597
|
}
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10598
|
+
/**
|
|
10599
|
+
* Asynchronously pause this session, putting it into a dormant state.
|
|
10600
|
+
*
|
|
10601
|
+
* This method calls the PauseSessionAsync API to initiate the pause operation and then polls
|
|
10602
|
+
* the GetSession API to check the session status until it becomes PAUSED or until timeout is reached.
|
|
10603
|
+
* During the paused state, resource usage and costs are reduced while session state is preserved.
|
|
10604
|
+
*
|
|
10605
|
+
* @param timeout - Timeout in seconds to wait for the session to pause. Defaults to 600 seconds.
|
|
10606
|
+
* @param pollInterval - Interval in seconds between status polls. Defaults to 2.0 seconds.
|
|
10607
|
+
*
|
|
10608
|
+
* @returns Promise resolving to SessionPauseResult containing:
|
|
10609
|
+
* - success: Whether the pause operation succeeded
|
|
10610
|
+
* - requestId: Unique identifier for this API request
|
|
10611
|
+
* - status: Final session status (should be "PAUSED" if successful)
|
|
10612
|
+
* - errorMessage: Error description if pause failed
|
|
10613
|
+
*
|
|
10614
|
+
* @throws Error if the API call fails or network issues occur.
|
|
10615
|
+
*
|
|
10616
|
+
* @example
|
|
10617
|
+
* ```typescript
|
|
10618
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
10619
|
+
* const result = await agentBay.create();
|
|
10620
|
+
* if (result.success) {
|
|
10621
|
+
* const pauseResult = await result.session.pauseAsync();
|
|
10622
|
+
* if (pauseResult.success) {
|
|
10623
|
+
* console.log('Session paused successfully');
|
|
10624
|
+
* }
|
|
10625
|
+
* }
|
|
10626
|
+
* ```
|
|
10627
|
+
*
|
|
10628
|
+
* @remarks
|
|
10629
|
+
* **Behavior:**
|
|
10630
|
+
* - Initiates pause operation through PauseSessionAsync API
|
|
10631
|
+
* - Polls session status until PAUSED state or timeout
|
|
10632
|
+
* - Session state transitions: RUNNING -> PAUSING -> PAUSED
|
|
10633
|
+
* - All session state is preserved during pause
|
|
10634
|
+
*
|
|
10635
|
+
* **Important Notes:**
|
|
10636
|
+
* - Paused sessions cannot perform operations (deletion, task execution, etc.)
|
|
10637
|
+
* - Use {@link resumeAsync} to restore the session to RUNNING state
|
|
10638
|
+
* - During pause, both resource usage and costs are lower
|
|
10639
|
+
* - If timeout is exceeded, returns with success=false
|
|
10640
|
+
*
|
|
10641
|
+
* @see {@link resumeAsync}
|
|
10642
|
+
*/
|
|
10643
|
+
async pauseAsync(timeout = 600, pollInterval = 2) {
|
|
10644
|
+
try {
|
|
10645
|
+
const request = new (0, _chunkSL5GCAQEcjs.PauseSessionAsyncRequest)({
|
|
10646
|
+
authorization: `Bearer ${this.getAPIKey()}`,
|
|
10647
|
+
sessionId: this.sessionId
|
|
10648
|
+
});
|
|
10649
|
+
logAPICall("PauseSessionAsync", `SessionId=${this.sessionId}`);
|
|
10650
|
+
const response = await this.getClient().pauseSessionAsync(request);
|
|
10651
|
+
const requestId = extractRequestId(response) || "";
|
|
10652
|
+
setRequestId(requestId);
|
|
10653
|
+
const responseMap = response.to_map ? response.to_map() : response;
|
|
10654
|
+
if (!responseMap) {
|
|
10655
|
+
return {
|
|
10656
|
+
requestId: requestId || "",
|
|
10657
|
+
success: false,
|
|
10658
|
+
errorMessage: "Invalid response format"
|
|
10659
|
+
};
|
|
10660
|
+
}
|
|
10661
|
+
const body = responseMap.body;
|
|
10662
|
+
if (!body) {
|
|
10663
|
+
return {
|
|
10664
|
+
requestId: requestId || "",
|
|
10665
|
+
success: false,
|
|
10666
|
+
errorMessage: "Invalid response body"
|
|
10667
|
+
};
|
|
10668
|
+
}
|
|
10669
|
+
const success = body.success !== false;
|
|
10670
|
+
const code = body.code || "";
|
|
10671
|
+
const message = body.message || "";
|
|
10672
|
+
const httpStatusCode = body.httpStatusCode || 0;
|
|
10673
|
+
if (!success) {
|
|
10674
|
+
const errorMessage = `[${code}] ${message}` || "Unknown error";
|
|
10675
|
+
logError("PauseSessionAsync", errorMessage);
|
|
10676
|
+
return {
|
|
10677
|
+
requestId: requestId || "",
|
|
10678
|
+
success: false,
|
|
10679
|
+
errorMessage,
|
|
10680
|
+
code,
|
|
10681
|
+
message,
|
|
10682
|
+
httpStatusCode
|
|
10683
|
+
};
|
|
10684
|
+
}
|
|
10685
|
+
logInfo(`PauseSessionAsync`, `Session ${this.sessionId} pause initiated successfully`);
|
|
10686
|
+
const startTime = Date.now();
|
|
10687
|
+
const maxAttempts = Math.floor(timeout / pollInterval);
|
|
10688
|
+
let attempt = 0;
|
|
10689
|
+
while (attempt < maxAttempts) {
|
|
10690
|
+
const getResult = await this.agentBay.getSession(this.sessionId);
|
|
10691
|
+
if (!getResult.success) {
|
|
10692
|
+
logError(`Failed to get session status: ${getResult.errorMessage}`);
|
|
10693
|
+
return {
|
|
10694
|
+
requestId: getResult.requestId || "",
|
|
10695
|
+
success: false,
|
|
10696
|
+
errorMessage: `Failed to get session status: ${getResult.errorMessage}`
|
|
10697
|
+
};
|
|
10698
|
+
}
|
|
10699
|
+
if (getResult.data) {
|
|
10700
|
+
const status = getResult.data.status || "UNKNOWN";
|
|
10701
|
+
logDebug(`Session status: ${status} (attempt ${attempt + 1}/${maxAttempts})`);
|
|
10702
|
+
if (status === "PAUSED") {
|
|
10703
|
+
const elapsed2 = Date.now() - startTime;
|
|
10704
|
+
logInfo(`Session paused successfully in ${elapsed2}ms`);
|
|
10705
|
+
return {
|
|
10706
|
+
requestId: getResult.requestId || "",
|
|
10707
|
+
success: true,
|
|
10708
|
+
status
|
|
10709
|
+
};
|
|
10710
|
+
} else if (status === "PAUSING") {
|
|
10711
|
+
} else {
|
|
10712
|
+
const elapsed2 = Date.now() - startTime;
|
|
10713
|
+
const errorMessage = `Session pause failed: unexpected state '${status}' after ${elapsed2}ms`;
|
|
10714
|
+
logError(errorMessage);
|
|
10715
|
+
return {
|
|
10716
|
+
requestId: getResult.requestId || "",
|
|
10717
|
+
success: false,
|
|
10718
|
+
errorMessage,
|
|
10719
|
+
status
|
|
10720
|
+
};
|
|
10457
10721
|
}
|
|
10458
10722
|
}
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
}
|
|
10463
|
-
}
|
|
10464
|
-
const envFile = findDotEnvFile();
|
|
10465
|
-
if (envFile) {
|
|
10466
|
-
try {
|
|
10467
|
-
const envConfig = dotenv.parse(fs4.readFileSync(envFile));
|
|
10468
|
-
for (const k in envConfig) {
|
|
10469
|
-
if (!process.env.hasOwnProperty(k)) {
|
|
10470
|
-
process.env[k] = envConfig[k];
|
|
10723
|
+
attempt++;
|
|
10724
|
+
if (attempt < maxAttempts) {
|
|
10725
|
+
await new Promise((resolve3) => setTimeout(resolve3, pollInterval * 1e3));
|
|
10471
10726
|
}
|
|
10472
10727
|
}
|
|
10728
|
+
const elapsed = Date.now() - startTime;
|
|
10729
|
+
const errorMsg = `Session pause timed out after ${elapsed}ms`;
|
|
10730
|
+
logError(errorMsg);
|
|
10731
|
+
return {
|
|
10732
|
+
requestId: "",
|
|
10733
|
+
success: false,
|
|
10734
|
+
errorMessage: errorMsg
|
|
10735
|
+
};
|
|
10473
10736
|
} catch (error) {
|
|
10737
|
+
logError("PauseSessionAsync", error);
|
|
10738
|
+
return {
|
|
10739
|
+
requestId: "",
|
|
10740
|
+
success: false,
|
|
10741
|
+
errorMessage: `Unexpected error pausing session: ${error}`
|
|
10742
|
+
};
|
|
10743
|
+
}
|
|
10744
|
+
}
|
|
10745
|
+
/**
|
|
10746
|
+
* Asynchronously resume this session from a paused state.
|
|
10747
|
+
*
|
|
10748
|
+
* This method calls the ResumeSessionAsync API to initiate the resume operation and then polls
|
|
10749
|
+
* the GetSession API to check the session status until it becomes RUNNING or until timeout is reached.
|
|
10750
|
+
* After resuming, the session restores full functionality and can perform all operations normally.
|
|
10751
|
+
*
|
|
10752
|
+
* @param timeout - Timeout in seconds to wait for the session to resume. Defaults to 600 seconds.
|
|
10753
|
+
* @param pollInterval - Interval in seconds between status polls. Defaults to 2.0 seconds.
|
|
10754
|
+
*
|
|
10755
|
+
* @returns Promise resolving to SessionResumeResult containing:
|
|
10756
|
+
* - success: Whether the resume operation succeeded
|
|
10757
|
+
* - requestId: Unique identifier for this API request
|
|
10758
|
+
* - status: Final session status (should be "RUNNING" if successful)
|
|
10759
|
+
* - errorMessage: Error description if resume failed
|
|
10760
|
+
*
|
|
10761
|
+
* @throws Error if the API call fails or network issues occur.
|
|
10762
|
+
*
|
|
10763
|
+
* @example
|
|
10764
|
+
* ```typescript
|
|
10765
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
10766
|
+
* const result = await agentBay.get('paused_session_id');
|
|
10767
|
+
* if (result.success) {
|
|
10768
|
+
* const resumeResult = await result.session.resumeAsync();
|
|
10769
|
+
* if (resumeResult.success) {
|
|
10770
|
+
* console.log('Session resumed successfully');
|
|
10771
|
+
* }
|
|
10772
|
+
* }
|
|
10773
|
+
* ```
|
|
10774
|
+
*
|
|
10775
|
+
* @remarks
|
|
10776
|
+
* **Behavior:**
|
|
10777
|
+
* - Initiates resume operation through ResumeSessionAsync API
|
|
10778
|
+
* - Polls session status until RUNNING state or timeout
|
|
10779
|
+
* - Session state transitions: PAUSED -> RESUMING -> RUNNING
|
|
10780
|
+
* - All previous session state is restored during resume
|
|
10781
|
+
*
|
|
10782
|
+
* **Important Notes:**
|
|
10783
|
+
* - Only sessions in PAUSED state can be resumed
|
|
10784
|
+
* - After resume, the session can perform all operations normally
|
|
10785
|
+
* - Use {@link pauseAsync} to put a session into PAUSED state
|
|
10786
|
+
* - If timeout is exceeded, returns with success=false
|
|
10787
|
+
*
|
|
10788
|
+
* @see {@link pauseAsync}
|
|
10789
|
+
*/
|
|
10790
|
+
async resumeAsync(timeout = 600, pollInterval = 2) {
|
|
10791
|
+
try {
|
|
10792
|
+
const request = new (0, _chunkSL5GCAQEcjs.ResumeSessionAsyncRequest)({
|
|
10793
|
+
authorization: `Bearer ${this.getAPIKey()}`,
|
|
10794
|
+
sessionId: this.sessionId
|
|
10795
|
+
});
|
|
10796
|
+
logAPICall("ResumeSessionAsync", `SessionId=${this.sessionId}`);
|
|
10797
|
+
const response = await this.getClient().resumeSessionAsync(request);
|
|
10798
|
+
const requestId = extractRequestId(response) || "";
|
|
10799
|
+
setRequestId(requestId);
|
|
10800
|
+
const responseMap = response.to_map ? response.to_map() : response;
|
|
10801
|
+
if (!responseMap) {
|
|
10802
|
+
return {
|
|
10803
|
+
requestId: requestId || "",
|
|
10804
|
+
success: false,
|
|
10805
|
+
errorMessage: "Invalid response format"
|
|
10806
|
+
};
|
|
10807
|
+
}
|
|
10808
|
+
const body = responseMap.body;
|
|
10809
|
+
if (!body) {
|
|
10810
|
+
return {
|
|
10811
|
+
requestId: requestId || "",
|
|
10812
|
+
success: false,
|
|
10813
|
+
errorMessage: "Invalid response body"
|
|
10814
|
+
};
|
|
10815
|
+
}
|
|
10816
|
+
const success = body.success !== false;
|
|
10817
|
+
const code = body.code || "";
|
|
10818
|
+
const message = body.message || "";
|
|
10819
|
+
const httpStatusCode = body.httpStatusCode || 0;
|
|
10820
|
+
if (!success) {
|
|
10821
|
+
const errorMessage = `[${code}] ${message}` || "Unknown error";
|
|
10822
|
+
logError("ResumeSessionAsync", errorMessage);
|
|
10823
|
+
return {
|
|
10824
|
+
requestId: requestId || "",
|
|
10825
|
+
success: false,
|
|
10826
|
+
errorMessage,
|
|
10827
|
+
code,
|
|
10828
|
+
message,
|
|
10829
|
+
httpStatusCode
|
|
10830
|
+
};
|
|
10831
|
+
}
|
|
10832
|
+
logInfo(`ResumeSessionAsync`, `Session ${this.sessionId} resume initiated successfully`);
|
|
10833
|
+
const startTime = Date.now();
|
|
10834
|
+
const maxAttempts = Math.floor(timeout / pollInterval);
|
|
10835
|
+
let attempt = 0;
|
|
10836
|
+
while (attempt < maxAttempts) {
|
|
10837
|
+
const getResult = await this.agentBay.getSession(this.sessionId);
|
|
10838
|
+
if (!getResult.success) {
|
|
10839
|
+
logError(`Failed to get session status: ${getResult.errorMessage}`);
|
|
10840
|
+
return {
|
|
10841
|
+
requestId: getResult.requestId || "",
|
|
10842
|
+
success: false,
|
|
10843
|
+
errorMessage: `Failed to get session status: ${getResult.errorMessage}`
|
|
10844
|
+
};
|
|
10845
|
+
}
|
|
10846
|
+
if (getResult.data) {
|
|
10847
|
+
const status = getResult.data.status || "UNKNOWN";
|
|
10848
|
+
logDebug(`Session status: ${status} (attempt ${attempt + 1}/${maxAttempts})`);
|
|
10849
|
+
if (status === "RUNNING") {
|
|
10850
|
+
const elapsed2 = Date.now() - startTime;
|
|
10851
|
+
logInfo(`Session resumed successfully in ${elapsed2}ms`);
|
|
10852
|
+
return {
|
|
10853
|
+
requestId: getResult.requestId || "",
|
|
10854
|
+
success: true,
|
|
10855
|
+
status
|
|
10856
|
+
};
|
|
10857
|
+
} else if (status === "RESUMING") {
|
|
10858
|
+
} else {
|
|
10859
|
+
const elapsed2 = Date.now() - startTime;
|
|
10860
|
+
const errorMessage = `Session resume failed: unexpected state '${status}' after ${elapsed2}ms`;
|
|
10861
|
+
logError(errorMessage);
|
|
10862
|
+
return {
|
|
10863
|
+
requestId: getResult.requestId || "",
|
|
10864
|
+
success: false,
|
|
10865
|
+
errorMessage,
|
|
10866
|
+
status
|
|
10867
|
+
};
|
|
10868
|
+
}
|
|
10869
|
+
}
|
|
10870
|
+
attempt++;
|
|
10871
|
+
if (attempt < maxAttempts) {
|
|
10872
|
+
await new Promise((resolve3) => setTimeout(resolve3, pollInterval * 1e3));
|
|
10873
|
+
}
|
|
10874
|
+
}
|
|
10875
|
+
const elapsed = Date.now() - startTime;
|
|
10876
|
+
const errorMsg = `Session resume timed out after ${elapsed}ms`;
|
|
10877
|
+
logError(errorMsg);
|
|
10878
|
+
return {
|
|
10879
|
+
requestId: "",
|
|
10880
|
+
success: false,
|
|
10881
|
+
errorMessage: errorMsg
|
|
10882
|
+
};
|
|
10883
|
+
} catch (error) {
|
|
10884
|
+
logError("ResumeSessionAsync", error);
|
|
10885
|
+
return {
|
|
10886
|
+
requestId: "",
|
|
10887
|
+
success: false,
|
|
10888
|
+
errorMessage: `Unexpected error resuming session: ${error}`
|
|
10889
|
+
};
|
|
10890
|
+
}
|
|
10891
|
+
}
|
|
10892
|
+
};
|
|
10893
|
+
_chunk4IPTHWLMcjs.__name.call(void 0, _Session, "Session");
|
|
10894
|
+
var Session = _Session;
|
|
10895
|
+
|
|
10896
|
+
// src/agent-bay.ts
|
|
10897
|
+
var BROWSER_DATA_PATH2 = "/tmp/agentbay_browser";
|
|
10898
|
+
function defaultConfig() {
|
|
10899
|
+
return {
|
|
10900
|
+
endpoint: "wuyingai.cn-shanghai.aliyuncs.com",
|
|
10901
|
+
timeout_ms: 6e4
|
|
10902
|
+
};
|
|
10903
|
+
}
|
|
10904
|
+
_chunk4IPTHWLMcjs.__name.call(void 0, defaultConfig, "defaultConfig");
|
|
10905
|
+
function findDotEnvFile2(startPath) {
|
|
10906
|
+
const currentPath = startPath ? path5.resolve(startPath) : process.cwd();
|
|
10907
|
+
let searchPath = currentPath;
|
|
10908
|
+
while (searchPath !== path5.dirname(searchPath)) {
|
|
10909
|
+
const envFile = path5.join(searchPath, ".env");
|
|
10910
|
+
if (fs5.existsSync(envFile)) {
|
|
10911
|
+
return envFile;
|
|
10912
|
+
}
|
|
10913
|
+
const gitDir = path5.join(searchPath, ".git");
|
|
10914
|
+
if (fs5.existsSync(gitDir)) {
|
|
10915
|
+
}
|
|
10916
|
+
searchPath = path5.dirname(searchPath);
|
|
10917
|
+
}
|
|
10918
|
+
const rootEnv = path5.join(searchPath, ".env");
|
|
10919
|
+
if (fs5.existsSync(rootEnv)) {
|
|
10920
|
+
return rootEnv;
|
|
10921
|
+
}
|
|
10922
|
+
return null;
|
|
10923
|
+
}
|
|
10924
|
+
_chunk4IPTHWLMcjs.__name.call(void 0, findDotEnvFile2, "findDotEnvFile");
|
|
10925
|
+
function loadDotEnvWithFallback2(customEnvPath) {
|
|
10926
|
+
if (customEnvPath) {
|
|
10927
|
+
if (fs5.existsSync(customEnvPath)) {
|
|
10928
|
+
try {
|
|
10929
|
+
const envConfig = dotenv2.parse(fs5.readFileSync(customEnvPath));
|
|
10930
|
+
for (const k in envConfig) {
|
|
10931
|
+
if (!process.env.hasOwnProperty(k)) {
|
|
10932
|
+
process.env[k] = envConfig[k];
|
|
10933
|
+
}
|
|
10934
|
+
}
|
|
10935
|
+
return;
|
|
10936
|
+
} catch (error) {
|
|
10937
|
+
}
|
|
10938
|
+
}
|
|
10939
|
+
}
|
|
10940
|
+
const envFile = findDotEnvFile2();
|
|
10941
|
+
if (envFile) {
|
|
10942
|
+
try {
|
|
10943
|
+
const envConfig = dotenv2.parse(fs5.readFileSync(envFile));
|
|
10944
|
+
for (const k in envConfig) {
|
|
10945
|
+
if (!process.env.hasOwnProperty(k)) {
|
|
10946
|
+
process.env[k] = envConfig[k];
|
|
10947
|
+
}
|
|
10948
|
+
}
|
|
10949
|
+
} catch (error) {
|
|
10950
|
+
}
|
|
10951
|
+
}
|
|
10952
|
+
}
|
|
10953
|
+
_chunk4IPTHWLMcjs.__name.call(void 0, loadDotEnvWithFallback2, "loadDotEnvWithFallback");
|
|
10954
|
+
function loadConfig(customConfig, customEnvPath) {
|
|
10955
|
+
if (customConfig) {
|
|
10956
|
+
return customConfig;
|
|
10957
|
+
}
|
|
10958
|
+
const config = defaultConfig();
|
|
10959
|
+
try {
|
|
10960
|
+
loadDotEnvWithFallback2(customEnvPath);
|
|
10961
|
+
} catch (error) {
|
|
10962
|
+
}
|
|
10963
|
+
if (process.env.AGENTBAY_ENDPOINT) {
|
|
10964
|
+
config.endpoint = process.env.AGENTBAY_ENDPOINT;
|
|
10965
|
+
}
|
|
10966
|
+
if (process.env.AGENTBAY_TIMEOUT_MS) {
|
|
10967
|
+
const timeout = parseInt(process.env.AGENTBAY_TIMEOUT_MS, 10);
|
|
10968
|
+
if (!isNaN(timeout) && timeout > 0) {
|
|
10969
|
+
config.timeout_ms = timeout;
|
|
10474
10970
|
}
|
|
10475
10971
|
}
|
|
10476
|
-
}
|
|
10477
|
-
_chunk4IPTHWLMcjs.__name.call(void 0, loadDotEnvWithFallback, "loadDotEnvWithFallback");
|
|
10478
|
-
function loadConfig(customConfig, customEnvPath) {
|
|
10479
|
-
if (customConfig) {
|
|
10480
|
-
return customConfig;
|
|
10481
|
-
}
|
|
10482
|
-
const config = defaultConfig();
|
|
10483
|
-
try {
|
|
10484
|
-
loadDotEnvWithFallback(customEnvPath);
|
|
10485
|
-
} catch (error) {
|
|
10486
|
-
}
|
|
10487
|
-
if (process.env.AGENTBAY_ENDPOINT) {
|
|
10488
|
-
config.endpoint = process.env.AGENTBAY_ENDPOINT;
|
|
10489
|
-
}
|
|
10490
|
-
if (process.env.AGENTBAY_TIMEOUT_MS) {
|
|
10491
|
-
const timeout = parseInt(process.env.AGENTBAY_TIMEOUT_MS, 10);
|
|
10492
|
-
if (!isNaN(timeout) && timeout > 0) {
|
|
10493
|
-
config.timeout_ms = timeout;
|
|
10494
|
-
}
|
|
10495
|
-
}
|
|
10496
10972
|
return config;
|
|
10497
10973
|
}
|
|
10498
10974
|
_chunk4IPTHWLMcjs.__name.call(void 0, loadConfig, "loadConfig");
|
|
@@ -10516,9 +10992,8 @@ var _AgentBay = class _AgentBay {
|
|
|
10516
10992
|
* @param options.envFile - Custom path to .env file. If not provided, will search upward from current directory.
|
|
10517
10993
|
*/
|
|
10518
10994
|
constructor(options = {}) {
|
|
10519
|
-
this.sessions = /* @__PURE__ */ new Map();
|
|
10520
10995
|
this.fileTransferContext = null;
|
|
10521
|
-
|
|
10996
|
+
loadDotEnvWithFallback2(options.envFile);
|
|
10522
10997
|
this.apiKey = options.apiKey || process.env.AGENTBAY_API_KEY || "";
|
|
10523
10998
|
if (!this.apiKey) {
|
|
10524
10999
|
throw new AuthenticationError(
|
|
@@ -10541,6 +11016,59 @@ var _AgentBay = class _AgentBay {
|
|
|
10541
11016
|
throw new AuthenticationError(`Failed to constructor: ${error}`);
|
|
10542
11017
|
}
|
|
10543
11018
|
}
|
|
11019
|
+
/**
|
|
11020
|
+
* Wait for mobile simulate command to complete.
|
|
11021
|
+
*
|
|
11022
|
+
* @param session - The session to wait for mobile simulate
|
|
11023
|
+
* @param mobileSimPath - The dev info path to the mobile simulate
|
|
11024
|
+
* @param mobileSimMode - The mode of the mobile simulate. If not provided, will use the default mode.
|
|
11025
|
+
*/
|
|
11026
|
+
async _waitForMobileSimulate(session, mobileSimPath, mobileSimMode) {
|
|
11027
|
+
log("\u23F3 Mobile simulate: Waiting for completion");
|
|
11028
|
+
if (!session.mobile) {
|
|
11029
|
+
logInfo("Mobile module not found in session, skipping mobile simulate");
|
|
11030
|
+
return;
|
|
11031
|
+
}
|
|
11032
|
+
if (!session.command) {
|
|
11033
|
+
logInfo("Command module not found in session, skipping mobile simulate");
|
|
11034
|
+
return;
|
|
11035
|
+
}
|
|
11036
|
+
if (!mobileSimPath) {
|
|
11037
|
+
logInfo("Mobile simulate path is empty, skipping mobile simulate");
|
|
11038
|
+
return;
|
|
11039
|
+
}
|
|
11040
|
+
try {
|
|
11041
|
+
const startTime = Date.now();
|
|
11042
|
+
const devInfoFilePath = `${mobileSimPath}/dev_info.json`;
|
|
11043
|
+
let wyaApplyOption = "";
|
|
11044
|
+
if (!mobileSimMode || mobileSimMode === "PropertiesOnly") {
|
|
11045
|
+
wyaApplyOption = "";
|
|
11046
|
+
} else if (mobileSimMode === "SensorsOnly") {
|
|
11047
|
+
wyaApplyOption = "-sensors";
|
|
11048
|
+
} else if (mobileSimMode === "PackagesOnly") {
|
|
11049
|
+
wyaApplyOption = "-packages";
|
|
11050
|
+
} else if (mobileSimMode === "ServicesOnly") {
|
|
11051
|
+
wyaApplyOption = "-services";
|
|
11052
|
+
} else if (mobileSimMode === "All") {
|
|
11053
|
+
wyaApplyOption = "-all";
|
|
11054
|
+
}
|
|
11055
|
+
const command = `chmod -R a+rwx ${mobileSimPath}; wya apply ${wyaApplyOption} ${devInfoFilePath}`.trim();
|
|
11056
|
+
logInfo(`\u2139\uFE0F \u23F3 Waiting for mobile simulate completion, command: ${command}`);
|
|
11057
|
+
const cmdResult = await session.command.executeCommand(command);
|
|
11058
|
+
if (cmdResult.success) {
|
|
11059
|
+
const endTime = Date.now();
|
|
11060
|
+
const consumeTime = (endTime - startTime) / 1e3;
|
|
11061
|
+
log(`\u2705 Mobile simulate completed with mode: ${mobileSimMode || "PropertiesOnly"}, duration: ${consumeTime.toFixed(2)} seconds`);
|
|
11062
|
+
if (cmdResult.output) {
|
|
11063
|
+
log(` Output: ${cmdResult.output.trim()}`);
|
|
11064
|
+
}
|
|
11065
|
+
} else {
|
|
11066
|
+
logInfo(`Failed to execute mobile simulate command: ${cmdResult.errorMessage}`);
|
|
11067
|
+
}
|
|
11068
|
+
} catch (error) {
|
|
11069
|
+
logInfo(`Error executing mobile simulate command: ${error}`);
|
|
11070
|
+
}
|
|
11071
|
+
}
|
|
10544
11072
|
/**
|
|
10545
11073
|
* Update browser replay context with AppInstanceId from response data.
|
|
10546
11074
|
*
|
|
@@ -10621,13 +11149,28 @@ var _AgentBay = class _AgentBay {
|
|
|
10621
11149
|
async create(params = {}) {
|
|
10622
11150
|
try {
|
|
10623
11151
|
logDebug(`default context syncs length: ${_optionalChain([params, 'access', _133 => _133.contextSync, 'optionalAccess', _134 => _134.length])}`);
|
|
11152
|
+
if (_optionalChain([params, 'access', _135 => _135.extraConfigs, 'optionalAccess', _136 => _136.mobile, 'optionalAccess', _137 => _137.simulateConfig])) {
|
|
11153
|
+
const mobileSimContextId = params.extraConfigs.mobile.simulateConfig.simulatedContextId;
|
|
11154
|
+
if (mobileSimContextId) {
|
|
11155
|
+
const mobileSimContextSync = new ContextSync(
|
|
11156
|
+
mobileSimContextId,
|
|
11157
|
+
"/data/agentbay_mobile_info"
|
|
11158
|
+
);
|
|
11159
|
+
if (!params.contextSync) {
|
|
11160
|
+
params.contextSync = [];
|
|
11161
|
+
}
|
|
11162
|
+
logInfo(`Adding context sync for mobile simulate: ${JSON.stringify(mobileSimContextSync)}`);
|
|
11163
|
+
params.contextSync.push(mobileSimContextSync);
|
|
11164
|
+
}
|
|
11165
|
+
}
|
|
11166
|
+
logDebug(`Origin context syncs length: ${_optionalChain([params, 'access', _138 => _138.contextSync, 'optionalAccess', _139 => _139.length])}`);
|
|
10624
11167
|
const contextName = `file-transfer-context-${Date.now()}`;
|
|
10625
11168
|
const contextResult = await this.context.get(contextName, true);
|
|
10626
11169
|
if (contextResult.success && contextResult.context) {
|
|
10627
11170
|
this.fileTransferContext = contextResult.context;
|
|
10628
11171
|
const fileTransferContextSync = new ContextSync(
|
|
10629
11172
|
contextResult.context.id,
|
|
10630
|
-
"/
|
|
11173
|
+
"/tmp/file-transfer"
|
|
10631
11174
|
);
|
|
10632
11175
|
if (!params.contextSync) {
|
|
10633
11176
|
params.contextSync = [];
|
|
@@ -10635,10 +11178,10 @@ var _AgentBay = class _AgentBay {
|
|
|
10635
11178
|
logDebug(`Adding context sync for file transfer operations: ${fileTransferContextSync}`);
|
|
10636
11179
|
params.contextSync.push(fileTransferContextSync);
|
|
10637
11180
|
}
|
|
10638
|
-
const request = new (0,
|
|
11181
|
+
const request = new (0, _chunkSL5GCAQEcjs.CreateMcpSessionRequest)({
|
|
10639
11182
|
authorization: "Bearer " + this.apiKey
|
|
10640
11183
|
});
|
|
10641
|
-
const framework = _optionalChain([params, 'optionalAccess',
|
|
11184
|
+
const framework = _optionalChain([params, 'optionalAccess', _140 => _140.framework]) || "";
|
|
10642
11185
|
const sdkStatsJson = `{"source":"sdk","sdk_language":"typescript","sdk_version":"${VERSION}","is_release":${IS_RELEASE},"framework":"${framework}"}`;
|
|
10643
11186
|
request.sdkStats = sdkStatsJson;
|
|
10644
11187
|
if (params.labels) {
|
|
@@ -10652,10 +11195,13 @@ var _AgentBay = class _AgentBay {
|
|
|
10652
11195
|
}
|
|
10653
11196
|
request.vpcResource = params.isVpc || false;
|
|
10654
11197
|
let needsContextSync = false;
|
|
11198
|
+
let needsMobileSim = false;
|
|
11199
|
+
let mobileSimMode = void 0;
|
|
11200
|
+
let mobileSimPath = void 0;
|
|
10655
11201
|
if (params.contextSync && params.contextSync.length > 0) {
|
|
10656
11202
|
const persistenceDataList = [];
|
|
10657
11203
|
for (const contextSync of params.contextSync) {
|
|
10658
|
-
const persistenceItem = new (0,
|
|
11204
|
+
const persistenceItem = new (0, _chunkSL5GCAQEcjs.CreateMcpSessionRequestPersistenceDataList)({
|
|
10659
11205
|
contextId: contextSync.contextId,
|
|
10660
11206
|
path: contextSync.path
|
|
10661
11207
|
});
|
|
@@ -10675,7 +11221,7 @@ var _AgentBay = class _AgentBay {
|
|
|
10675
11221
|
bwList: null,
|
|
10676
11222
|
recyclePolicy: null
|
|
10677
11223
|
};
|
|
10678
|
-
const browserContextSync = new (0,
|
|
11224
|
+
const browserContextSync = new (0, _chunkSL5GCAQEcjs.CreateMcpSessionRequestPersistenceDataList)({
|
|
10679
11225
|
contextId: params.browserContext.contextId,
|
|
10680
11226
|
path: BROWSER_DATA_PATH2,
|
|
10681
11227
|
// Using a constant path for browser data
|
|
@@ -10689,11 +11235,11 @@ var _AgentBay = class _AgentBay {
|
|
|
10689
11235
|
}
|
|
10690
11236
|
let recordContextId = "";
|
|
10691
11237
|
if (params.enableBrowserReplay) {
|
|
10692
|
-
const recordPath =
|
|
11238
|
+
const recordPath = BROWSER_RECORD_PATH;
|
|
10693
11239
|
const recordContextName = generateRandomContextName();
|
|
10694
11240
|
const result = await this.context.get(recordContextName, true);
|
|
10695
11241
|
recordContextId = result.success ? result.contextId : "";
|
|
10696
|
-
const recordPersistence = new (0,
|
|
11242
|
+
const recordPersistence = new (0, _chunkSL5GCAQEcjs.CreateMcpSessionRequestPersistenceDataList)({
|
|
10697
11243
|
contextId: recordContextId,
|
|
10698
11244
|
path: recordPath
|
|
10699
11245
|
});
|
|
@@ -10704,6 +11250,15 @@ var _AgentBay = class _AgentBay {
|
|
|
10704
11250
|
}
|
|
10705
11251
|
if (params.extraConfigs) {
|
|
10706
11252
|
request.extraConfigs = JSON.stringify(params.extraConfigs);
|
|
11253
|
+
if (_optionalChain([params, 'access', _141 => _141.extraConfigs, 'access', _142 => _142.mobile, 'optionalAccess', _143 => _143.simulateConfig, 'optionalAccess', _144 => _144.simulate])) {
|
|
11254
|
+
mobileSimPath = params.extraConfigs.mobile.simulateConfig.simulatePath;
|
|
11255
|
+
if (!mobileSimPath) {
|
|
11256
|
+
logInfo("mobile_sim_path is not set now, skip mobile simulate operation");
|
|
11257
|
+
} else {
|
|
11258
|
+
needsMobileSim = true;
|
|
11259
|
+
mobileSimMode = params.extraConfigs.mobile.simulateConfig.simulateMode;
|
|
11260
|
+
}
|
|
11261
|
+
}
|
|
10707
11262
|
}
|
|
10708
11263
|
logAPICall("CreateMcpSession", {
|
|
10709
11264
|
labels: params.labels,
|
|
@@ -10821,7 +11376,6 @@ var _AgentBay = class _AgentBay {
|
|
|
10821
11376
|
session.fileTransferContextId = this.fileTransferContext ? this.fileTransferContext.id : null;
|
|
10822
11377
|
session.recordContextId = recordContextId || null;
|
|
10823
11378
|
session.imageId = params.imageId;
|
|
10824
|
-
this.sessions.set(session.sessionId, session);
|
|
10825
11379
|
if (params.extraConfigs && params.extraConfigs.mobile) {
|
|
10826
11380
|
log("Applying mobile configuration...");
|
|
10827
11381
|
try {
|
|
@@ -10876,13 +11430,16 @@ var _AgentBay = class _AgentBay {
|
|
|
10876
11430
|
break;
|
|
10877
11431
|
}
|
|
10878
11432
|
logDebug(`Waiting for context synchronization, attempt ${retry + 1}/${maxRetries}`);
|
|
10879
|
-
await new Promise((
|
|
11433
|
+
await new Promise((resolve3) => setTimeout(resolve3, retryInterval));
|
|
10880
11434
|
} catch (error) {
|
|
10881
11435
|
logError(`Error checking context status on attempt ${retry + 1}: ${error}`);
|
|
10882
|
-
await new Promise((
|
|
11436
|
+
await new Promise((resolve3) => setTimeout(resolve3, retryInterval));
|
|
10883
11437
|
}
|
|
10884
11438
|
}
|
|
10885
11439
|
}
|
|
11440
|
+
if (needsMobileSim && mobileSimPath) {
|
|
11441
|
+
await this._waitForMobileSimulate(session, mobileSimPath, mobileSimMode);
|
|
11442
|
+
}
|
|
10886
11443
|
return {
|
|
10887
11444
|
requestId,
|
|
10888
11445
|
success: true,
|
|
@@ -10931,7 +11488,7 @@ var _AgentBay = class _AgentBay {
|
|
|
10931
11488
|
if (page !== void 0 && page > 1) {
|
|
10932
11489
|
let currentPage = 1;
|
|
10933
11490
|
while (currentPage < page) {
|
|
10934
|
-
const request2 = new (0,
|
|
11491
|
+
const request2 = new (0, _chunkSL5GCAQEcjs.ListSessionRequest)({
|
|
10935
11492
|
authorization: `Bearer ${this.apiKey}`,
|
|
10936
11493
|
labels: JSON.stringify(labels),
|
|
10937
11494
|
maxResults: limit
|
|
@@ -10941,9 +11498,9 @@ var _AgentBay = class _AgentBay {
|
|
|
10941
11498
|
}
|
|
10942
11499
|
const response2 = await this.client.listSession(request2);
|
|
10943
11500
|
const requestId2 = extractRequestId(response2) || "";
|
|
10944
|
-
if (!_optionalChain([response2, 'access',
|
|
10945
|
-
const code = _optionalChain([response2, 'access',
|
|
10946
|
-
const message = _optionalChain([response2, 'access',
|
|
11501
|
+
if (!_optionalChain([response2, 'access', _145 => _145.body, 'optionalAccess', _146 => _146.success])) {
|
|
11502
|
+
const code = _optionalChain([response2, 'access', _147 => _147.body, 'optionalAccess', _148 => _148.code]) || "Unknown";
|
|
11503
|
+
const message = _optionalChain([response2, 'access', _149 => _149.body, 'optionalAccess', _150 => _150.message]) || "Unknown error";
|
|
10947
11504
|
return {
|
|
10948
11505
|
requestId: requestId2,
|
|
10949
11506
|
success: false,
|
|
@@ -10969,7 +11526,7 @@ var _AgentBay = class _AgentBay {
|
|
|
10969
11526
|
currentPage += 1;
|
|
10970
11527
|
}
|
|
10971
11528
|
}
|
|
10972
|
-
const request = new (0,
|
|
11529
|
+
const request = new (0, _chunkSL5GCAQEcjs.ListSessionRequest)({
|
|
10973
11530
|
authorization: `Bearer ${this.apiKey}`,
|
|
10974
11531
|
labels: JSON.stringify(labels),
|
|
10975
11532
|
maxResults: limit
|
|
@@ -10985,9 +11542,9 @@ var _AgentBay = class _AgentBay {
|
|
|
10985
11542
|
const response = await this.client.listSession(request);
|
|
10986
11543
|
const requestId = extractRequestId(response) || "";
|
|
10987
11544
|
setRequestId(requestId);
|
|
10988
|
-
if (!_optionalChain([response, 'access',
|
|
10989
|
-
const code = _optionalChain([response, 'access',
|
|
10990
|
-
const message = _optionalChain([response, 'access',
|
|
11545
|
+
if (!_optionalChain([response, 'access', _151 => _151.body, 'optionalAccess', _152 => _152.success])) {
|
|
11546
|
+
const code = _optionalChain([response, 'access', _153 => _153.body, 'optionalAccess', _154 => _154.code]) || "Unknown";
|
|
11547
|
+
const message = _optionalChain([response, 'access', _155 => _155.body, 'optionalAccess', _156 => _156.message]) || "Unknown error";
|
|
10991
11548
|
logAPIResponseWithDetails(
|
|
10992
11549
|
"ListSession",
|
|
10993
11550
|
requestId,
|
|
@@ -11068,7 +11625,6 @@ var _AgentBay = class _AgentBay {
|
|
|
11068
11625
|
deleteResult.success,
|
|
11069
11626
|
{ sessionId: session.sessionId }
|
|
11070
11627
|
);
|
|
11071
|
-
this.sessions.delete(session.sessionId);
|
|
11072
11628
|
return deleteResult;
|
|
11073
11629
|
} catch (error) {
|
|
11074
11630
|
logError("Error deleting session:", error);
|
|
@@ -11079,27 +11635,6 @@ var _AgentBay = class _AgentBay {
|
|
|
11079
11635
|
};
|
|
11080
11636
|
}
|
|
11081
11637
|
}
|
|
11082
|
-
/**
|
|
11083
|
-
* Remove a session from the internal session cache.
|
|
11084
|
-
*
|
|
11085
|
-
* This is an internal utility method that removes a session reference from the AgentBay client's
|
|
11086
|
-
* session cache without actually deleting the session from the cloud. Use this when you need to
|
|
11087
|
-
* clean up local references to a session that was deleted externally or no longer needed.
|
|
11088
|
-
*
|
|
11089
|
-
* @param sessionId - The ID of the session to remove from the cache.
|
|
11090
|
-
*
|
|
11091
|
-
* @internal
|
|
11092
|
-
*
|
|
11093
|
-
* @remarks
|
|
11094
|
-
* **Note:** This method only removes the session from the local cache. It does not delete the
|
|
11095
|
-
* session from the cloud. To delete a session from the cloud, use {@link delete} or
|
|
11096
|
-
* {@link Session.delete}.
|
|
11097
|
-
*
|
|
11098
|
-
* @see {@link delete}, {@link Session.delete}
|
|
11099
|
-
*/
|
|
11100
|
-
removeSession(sessionId) {
|
|
11101
|
-
this.sessions.delete(sessionId);
|
|
11102
|
-
}
|
|
11103
11638
|
/**
|
|
11104
11639
|
* Get session information by session ID.
|
|
11105
11640
|
*
|
|
@@ -11109,7 +11644,7 @@ var _AgentBay = class _AgentBay {
|
|
|
11109
11644
|
async getSession(sessionId) {
|
|
11110
11645
|
try {
|
|
11111
11646
|
logAPICall("GetSession", { sessionId });
|
|
11112
|
-
const request = new (0,
|
|
11647
|
+
const request = new (0, _chunkSL5GCAQEcjs.GetSessionRequest)({
|
|
11113
11648
|
authorization: `Bearer ${this.apiKey}`,
|
|
11114
11649
|
sessionId
|
|
11115
11650
|
});
|
|
@@ -11117,7 +11652,7 @@ var _AgentBay = class _AgentBay {
|
|
|
11117
11652
|
const requestId = extractRequestId(response) || "";
|
|
11118
11653
|
const body = response.body;
|
|
11119
11654
|
setRequestId(requestId);
|
|
11120
|
-
if (_optionalChain([body, 'optionalAccess',
|
|
11655
|
+
if (_optionalChain([body, 'optionalAccess', _157 => _157.success]) === false && body.code) {
|
|
11121
11656
|
logAPIResponseWithDetails(
|
|
11122
11657
|
"GetSession",
|
|
11123
11658
|
requestId,
|
|
@@ -11136,12 +11671,24 @@ var _AgentBay = class _AgentBay {
|
|
|
11136
11671
|
}
|
|
11137
11672
|
const result = {
|
|
11138
11673
|
requestId,
|
|
11139
|
-
httpStatusCode: _optionalChain([body, 'optionalAccess',
|
|
11140
|
-
code: _optionalChain([body, 'optionalAccess',
|
|
11141
|
-
success: _optionalChain([body, 'optionalAccess',
|
|
11674
|
+
httpStatusCode: _optionalChain([body, 'optionalAccess', _158 => _158.httpStatusCode]) || 0,
|
|
11675
|
+
code: _optionalChain([body, 'optionalAccess', _159 => _159.code]) || "",
|
|
11676
|
+
success: _optionalChain([body, 'optionalAccess', _160 => _160.success]) || false,
|
|
11142
11677
|
errorMessage: ""
|
|
11143
11678
|
};
|
|
11144
|
-
if (_optionalChain([body, 'optionalAccess',
|
|
11679
|
+
if (_optionalChain([body, 'optionalAccess', _161 => _161.data])) {
|
|
11680
|
+
const contextsList = body.data.contexts || [];
|
|
11681
|
+
const contexts = [];
|
|
11682
|
+
if (Array.isArray(contextsList)) {
|
|
11683
|
+
for (const ctx of contextsList) {
|
|
11684
|
+
if (ctx && typeof ctx === "object" && ctx.name && ctx.id) {
|
|
11685
|
+
contexts.push({
|
|
11686
|
+
name: ctx.name,
|
|
11687
|
+
id: ctx.id
|
|
11688
|
+
});
|
|
11689
|
+
}
|
|
11690
|
+
}
|
|
11691
|
+
}
|
|
11145
11692
|
result.data = {
|
|
11146
11693
|
appInstanceId: body.data.appInstanceId || "",
|
|
11147
11694
|
resourceId: body.data.resourceId || "",
|
|
@@ -11151,7 +11698,9 @@ var _AgentBay = class _AgentBay {
|
|
|
11151
11698
|
networkInterfaceIp: body.data.networkInterfaceIp || "",
|
|
11152
11699
|
token: body.data.token || "",
|
|
11153
11700
|
vpcResource: body.data.vpcResource || false,
|
|
11154
|
-
resourceUrl: body.data.resourceUrl || ""
|
|
11701
|
+
resourceUrl: body.data.resourceUrl || "",
|
|
11702
|
+
status: body.data.status || "",
|
|
11703
|
+
contexts: contexts.length > 0 ? contexts : void 0
|
|
11155
11704
|
};
|
|
11156
11705
|
logAPIResponseWithDetails(
|
|
11157
11706
|
"GetSession",
|
|
@@ -11167,7 +11716,7 @@ var _AgentBay = class _AgentBay {
|
|
|
11167
11716
|
return result;
|
|
11168
11717
|
} catch (error) {
|
|
11169
11718
|
const errorStr = String(error);
|
|
11170
|
-
const errorCode = _optionalChain([error, 'optionalAccess',
|
|
11719
|
+
const errorCode = _optionalChain([error, 'optionalAccess', _162 => _162.data, 'optionalAccess', _163 => _163.Code]) || _optionalChain([error, 'optionalAccess', _164 => _164.code]) || "";
|
|
11171
11720
|
if (errorCode === "InvalidMcpSession.NotFound" || errorStr.includes("NotFound")) {
|
|
11172
11721
|
logInfoWithColor(`Session not found: ${sessionId}`);
|
|
11173
11722
|
logDebug(`GetSession error details: ${errorStr}`);
|
|
@@ -11235,13 +11784,40 @@ var _AgentBay = class _AgentBay {
|
|
|
11235
11784
|
session.token = getResult.data.token;
|
|
11236
11785
|
session.resourceUrl = getResult.data.resourceUrl;
|
|
11237
11786
|
}
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11242
|
-
|
|
11787
|
+
if (getResult.data && getResult.data.contexts && getResult.data.contexts.length > 0) {
|
|
11788
|
+
const contexts = getResult.data.contexts;
|
|
11789
|
+
const fileTransferContexts = contexts.filter(
|
|
11790
|
+
(ctx) => ctx.name && ctx.name.startsWith("file-transfer-context-")
|
|
11791
|
+
);
|
|
11792
|
+
if (fileTransferContexts.length === 0) {
|
|
11793
|
+
const availableContexts = contexts.map((ctx) => ctx.name || "unknown");
|
|
11794
|
+
logWarn(
|
|
11795
|
+
`\u26A0\uFE0F No file-transfer-context- found in contexts list for session ${sessionId}. Available contexts: ${availableContexts.join(", ")}`
|
|
11796
|
+
);
|
|
11797
|
+
session.fileTransferContextId = null;
|
|
11798
|
+
} else if (fileTransferContexts.length === 1) {
|
|
11799
|
+
const contextId = fileTransferContexts[0].id;
|
|
11800
|
+
if (contextId) {
|
|
11801
|
+
session.fileTransferContextId = contextId;
|
|
11802
|
+
logInfo(`\u{1F4C1} Found file transfer context for recovered session: ${contextId}`);
|
|
11803
|
+
} else {
|
|
11804
|
+
logWarn(
|
|
11805
|
+
`\u26A0\uFE0F File transfer context found but missing 'id' field: ${JSON.stringify(fileTransferContexts[0])}`
|
|
11806
|
+
);
|
|
11807
|
+
session.fileTransferContextId = null;
|
|
11808
|
+
}
|
|
11809
|
+
} else {
|
|
11810
|
+
const contextNames = fileTransferContexts.map((ctx) => ctx.name || "unknown");
|
|
11811
|
+
logWarn(
|
|
11812
|
+
`\u26A0\uFE0F Multiple file-transfer-context- found in contexts list for session ${sessionId}. Found ${fileTransferContexts.length} contexts: ${contextNames.join(", ")}. Not setting fileTransferContextId.`
|
|
11813
|
+
);
|
|
11814
|
+
session.fileTransferContextId = null;
|
|
11815
|
+
}
|
|
11243
11816
|
} else {
|
|
11244
|
-
|
|
11817
|
+
logWarn(
|
|
11818
|
+
`\u26A0\uFE0F No contexts list found in GetSession response for session ${sessionId}. fileTransferContextId will remain null.`
|
|
11819
|
+
);
|
|
11820
|
+
session.fileTransferContextId = null;
|
|
11245
11821
|
}
|
|
11246
11822
|
return {
|
|
11247
11823
|
requestId: getResult.requestId,
|
|
@@ -11280,6 +11856,88 @@ var _AgentBay = class _AgentBay {
|
|
|
11280
11856
|
getAPIKey() {
|
|
11281
11857
|
return this.apiKey;
|
|
11282
11858
|
}
|
|
11859
|
+
/**
|
|
11860
|
+
* Asynchronously pause a session, putting it into a dormant state.
|
|
11861
|
+
*
|
|
11862
|
+
* This method directly calls the PauseSessionAsync API without waiting for the session
|
|
11863
|
+
* to reach the PAUSED state.
|
|
11864
|
+
*
|
|
11865
|
+
* @param session - The session to pause.
|
|
11866
|
+
* @param timeout - Timeout in seconds to wait for the session to pause. Defaults to 600 seconds.
|
|
11867
|
+
* @param pollInterval - Interval in seconds between status polls. Defaults to 2.0 seconds.
|
|
11868
|
+
* @returns SessionPauseResult indicating success or failure and request ID
|
|
11869
|
+
*
|
|
11870
|
+
* @example
|
|
11871
|
+
* ```typescript
|
|
11872
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
11873
|
+
* const session = (await agentBay.create()).session;
|
|
11874
|
+
* const pauseResult = await agentBay.pauseAsync(session);
|
|
11875
|
+
* await agentBay.resumeAsync(session);
|
|
11876
|
+
* await session.delete();
|
|
11877
|
+
* ```
|
|
11878
|
+
*
|
|
11879
|
+
* @remarks
|
|
11880
|
+
* **Behavior:**
|
|
11881
|
+
* - This method does not wait for the session to reach the PAUSED state
|
|
11882
|
+
* - It only submits the pause request to the API
|
|
11883
|
+
* - The session state transitions from RUNNING -> PAUSING -> PAUSED
|
|
11884
|
+
* - Paused sessions consume fewer resources but maintain their state
|
|
11885
|
+
*
|
|
11886
|
+
* @see {@link resumeAsync}, {@link Session.pauseAsync}
|
|
11887
|
+
*/
|
|
11888
|
+
async pauseAsync(session, timeout = 600, pollInterval = 2) {
|
|
11889
|
+
try {
|
|
11890
|
+
return await session.pauseAsync(timeout, pollInterval);
|
|
11891
|
+
} catch (error) {
|
|
11892
|
+
logError("Error calling pause session async:", error);
|
|
11893
|
+
return {
|
|
11894
|
+
requestId: "",
|
|
11895
|
+
success: false,
|
|
11896
|
+
errorMessage: `Failed to pause session ${session.sessionId}: ${error}`
|
|
11897
|
+
};
|
|
11898
|
+
}
|
|
11899
|
+
}
|
|
11900
|
+
/**
|
|
11901
|
+
* Asynchronously resume a session from a paused state.
|
|
11902
|
+
*
|
|
11903
|
+
* This method directly calls the ResumeSessionAsync API without waiting for the session
|
|
11904
|
+
* to reach the RUNNING state.
|
|
11905
|
+
*
|
|
11906
|
+
* @param session - The session to resume.
|
|
11907
|
+
* @param timeout - Timeout in seconds to wait for the session to resume. Defaults to 600 seconds.
|
|
11908
|
+
* @param pollInterval - Interval in seconds between status polls. Defaults to 2.0 seconds.
|
|
11909
|
+
* @returns SessionResumeResult indicating success or failure and request ID
|
|
11910
|
+
*
|
|
11911
|
+
* @example
|
|
11912
|
+
* ```typescript
|
|
11913
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
11914
|
+
* const session = (await agentBay.create()).session;
|
|
11915
|
+
* await agentBay.pauseAsync(session);
|
|
11916
|
+
* const resumeResult = await agentBay.resumeAsync(session);
|
|
11917
|
+
* await session.delete();
|
|
11918
|
+
* ```
|
|
11919
|
+
*
|
|
11920
|
+
* @remarks
|
|
11921
|
+
* **Behavior:**
|
|
11922
|
+
* - This method does not wait for the session to reach the RUNNING state
|
|
11923
|
+
* - It only submits the resume request to the API
|
|
11924
|
+
* - The session state transitions from PAUSED -> RESUMING -> RUNNING
|
|
11925
|
+
* - Only sessions in PAUSED state can be resumed
|
|
11926
|
+
*
|
|
11927
|
+
* @see {@link pauseAsync}, {@link Session.resumeAsync}
|
|
11928
|
+
*/
|
|
11929
|
+
async resumeAsync(session, timeout = 600, pollInterval = 2) {
|
|
11930
|
+
try {
|
|
11931
|
+
return await session.resumeAsync(timeout, pollInterval);
|
|
11932
|
+
} catch (error) {
|
|
11933
|
+
logError("Error calling resume session async:", error);
|
|
11934
|
+
return {
|
|
11935
|
+
requestId: "",
|
|
11936
|
+
success: false,
|
|
11937
|
+
errorMessage: `Failed to resume session ${session.sessionId}: ${error}`
|
|
11938
|
+
};
|
|
11939
|
+
}
|
|
11940
|
+
}
|
|
11283
11941
|
};
|
|
11284
11942
|
_chunk4IPTHWLMcjs.__name.call(void 0, _AgentBay, "AgentBay");
|
|
11285
11943
|
var AgentBay = _AgentBay;
|
|
@@ -11442,7 +12100,7 @@ var _ExtensionsService = class _ExtensionsService {
|
|
|
11442
12100
|
throw new AgentBayError(`Failed to get upload URL: ${urlResult.url || "No URL returned"}`);
|
|
11443
12101
|
}
|
|
11444
12102
|
const preSignedUrl = urlResult.url;
|
|
11445
|
-
const fileBuffer =
|
|
12103
|
+
const fileBuffer = fs6.readFileSync(localPath);
|
|
11446
12104
|
const response = await _nodefetch2.default.call(void 0, preSignedUrl, {
|
|
11447
12105
|
method: "PUT",
|
|
11448
12106
|
body: fileBuffer
|
|
@@ -11525,15 +12183,15 @@ var _ExtensionsService = class _ExtensionsService {
|
|
|
11525
12183
|
*/
|
|
11526
12184
|
async create(localPath) {
|
|
11527
12185
|
await this._ensureInitialized();
|
|
11528
|
-
if (!
|
|
12186
|
+
if (!fs6.existsSync(localPath)) {
|
|
11529
12187
|
throw new Error(`The specified local file was not found: ${localPath}`);
|
|
11530
12188
|
}
|
|
11531
|
-
const fileExtension =
|
|
12189
|
+
const fileExtension = path6.extname(localPath).toLowerCase();
|
|
11532
12190
|
if (fileExtension !== ".zip") {
|
|
11533
12191
|
throw new Error(`Unsupported plugin format '${fileExtension}'. Only ZIP format (.zip) is supported.`);
|
|
11534
12192
|
}
|
|
11535
12193
|
const extensionId = `ext_${crypto.randomBytes(16).toString("hex")}${fileExtension}`;
|
|
11536
|
-
const extensionName =
|
|
12194
|
+
const extensionName = path6.basename(localPath);
|
|
11537
12195
|
const remotePath = `${EXTENSIONS_BASE_PATH}/${extensionId}`;
|
|
11538
12196
|
await this._uploadToCloud(localPath, remotePath);
|
|
11539
12197
|
return new Extension(extensionId, extensionName);
|
|
@@ -11560,7 +12218,7 @@ var _ExtensionsService = class _ExtensionsService {
|
|
|
11560
12218
|
*/
|
|
11561
12219
|
async update(extensionId, newLocalPath) {
|
|
11562
12220
|
await this._ensureInitialized();
|
|
11563
|
-
if (!
|
|
12221
|
+
if (!fs6.existsSync(newLocalPath)) {
|
|
11564
12222
|
throw new Error(`The specified new local file was not found: ${newLocalPath}`);
|
|
11565
12223
|
}
|
|
11566
12224
|
const existingExtensions = await this.list();
|
|
@@ -11570,7 +12228,7 @@ var _ExtensionsService = class _ExtensionsService {
|
|
|
11570
12228
|
}
|
|
11571
12229
|
const remotePath = `${EXTENSIONS_BASE_PATH}/${extensionId}`;
|
|
11572
12230
|
await this._uploadToCloud(newLocalPath, remotePath);
|
|
11573
|
-
return new Extension(extensionId,
|
|
12231
|
+
return new Extension(extensionId, path6.basename(newLocalPath));
|
|
11574
12232
|
}
|
|
11575
12233
|
/**
|
|
11576
12234
|
* Gets detailed information about a specific browser extension.
|
|
@@ -11695,21 +12353,20 @@ var _ExtensionsService = class _ExtensionsService {
|
|
|
11695
12353
|
_chunk4IPTHWLMcjs.__name.call(void 0, _ExtensionsService, "ExtensionsService");
|
|
11696
12354
|
var ExtensionsService = _ExtensionsService;
|
|
11697
12355
|
|
|
11698
|
-
// src/
|
|
12356
|
+
// src/mobile-simulate.ts
|
|
11699
12357
|
_chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
11700
12358
|
|
|
11701
|
-
// src/types/list-session-params.ts
|
|
11702
|
-
_chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
11703
|
-
function createListSessionParams(labels = {}) {
|
|
11704
|
-
return {
|
|
11705
|
-
maxResults: 10,
|
|
11706
|
-
labels
|
|
11707
|
-
};
|
|
11708
|
-
}
|
|
11709
|
-
_chunk4IPTHWLMcjs.__name.call(void 0, createListSessionParams, "createListSessionParams");
|
|
11710
12359
|
|
|
11711
12360
|
// src/types/extra-configs.ts
|
|
11712
12361
|
_chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
12362
|
+
var MobileSimulateMode = /* @__PURE__ */ ((MobileSimulateMode2) => {
|
|
12363
|
+
MobileSimulateMode2["PropertiesOnly"] = "PropertiesOnly";
|
|
12364
|
+
MobileSimulateMode2["SensorsOnly"] = "SensorsOnly";
|
|
12365
|
+
MobileSimulateMode2["PackagesOnly"] = "PackagesOnly";
|
|
12366
|
+
MobileSimulateMode2["ServicesOnly"] = "ServicesOnly";
|
|
12367
|
+
MobileSimulateMode2["All"] = "All";
|
|
12368
|
+
return MobileSimulateMode2;
|
|
12369
|
+
})(MobileSimulateMode || {});
|
|
11713
12370
|
function extraConfigsToJSON(extraConfigs) {
|
|
11714
12371
|
if (!extraConfigs) {
|
|
11715
12372
|
return "";
|
|
@@ -11745,6 +12402,21 @@ function validateAppManagerRule(rule) {
|
|
|
11745
12402
|
}
|
|
11746
12403
|
}
|
|
11747
12404
|
_chunk4IPTHWLMcjs.__name.call(void 0, validateAppManagerRule, "validateAppManagerRule");
|
|
12405
|
+
function validateMobileSimulateConfig(config) {
|
|
12406
|
+
if (typeof config.simulate !== "boolean") {
|
|
12407
|
+
throw new Error("MobileSimulateConfig simulate must be a boolean");
|
|
12408
|
+
}
|
|
12409
|
+
if (config.simulateMode !== void 0) {
|
|
12410
|
+
const validModes = Object.values(MobileSimulateMode);
|
|
12411
|
+
if (!validModes.includes(config.simulateMode)) {
|
|
12412
|
+
throw new Error(`Invalid simulateMode: ${config.simulateMode}. Must be one of: ${validModes.join(", ")}`);
|
|
12413
|
+
}
|
|
12414
|
+
}
|
|
12415
|
+
if (config.simulatedContextId !== void 0 && typeof config.simulatedContextId !== "string") {
|
|
12416
|
+
throw new Error("MobileSimulateConfig simulatedContextId must be a string");
|
|
12417
|
+
}
|
|
12418
|
+
}
|
|
12419
|
+
_chunk4IPTHWLMcjs.__name.call(void 0, validateMobileSimulateConfig, "validateMobileSimulateConfig");
|
|
11748
12420
|
function validateMobileExtraConfig(config) {
|
|
11749
12421
|
if (typeof config.lockResolution !== "boolean") {
|
|
11750
12422
|
throw new Error("MobileExtraConfig lockResolution must be a boolean");
|
|
@@ -11765,6 +12437,9 @@ function validateMobileExtraConfig(config) {
|
|
|
11765
12437
|
}
|
|
11766
12438
|
}
|
|
11767
12439
|
}
|
|
12440
|
+
if (config.simulateConfig) {
|
|
12441
|
+
validateMobileSimulateConfig(config.simulateConfig);
|
|
12442
|
+
}
|
|
11768
12443
|
}
|
|
11769
12444
|
_chunk4IPTHWLMcjs.__name.call(void 0, validateMobileExtraConfig, "validateMobileExtraConfig");
|
|
11770
12445
|
function validateExtraConfigs(extraConfigs) {
|
|
@@ -11774,6 +12449,300 @@ function validateExtraConfigs(extraConfigs) {
|
|
|
11774
12449
|
}
|
|
11775
12450
|
_chunk4IPTHWLMcjs.__name.call(void 0, validateExtraConfigs, "validateExtraConfigs");
|
|
11776
12451
|
|
|
12452
|
+
// src/mobile-simulate.ts
|
|
12453
|
+
var MOBILE_INFO_DEFAULT_PATH = "/data/agentbay_mobile_info";
|
|
12454
|
+
var MOBILE_INFO_SUB_PATH = "/agentbay_mobile_info";
|
|
12455
|
+
var MOBILE_INFO_FILE_NAME = "dev_info.json";
|
|
12456
|
+
var _MobileSimulateService = class _MobileSimulateService {
|
|
12457
|
+
/**
|
|
12458
|
+
* Initialize the MobileSimulateService.
|
|
12459
|
+
*
|
|
12460
|
+
* @param agentBay - The AgentBay instance.
|
|
12461
|
+
*/
|
|
12462
|
+
constructor(agentBay) {
|
|
12463
|
+
this.simulateEnable = false;
|
|
12464
|
+
this.simulateMode = "PropertiesOnly" /* PropertiesOnly */;
|
|
12465
|
+
this.useInternalContext = true;
|
|
12466
|
+
if (!agentBay) {
|
|
12467
|
+
throw new Error("agentBay is required");
|
|
12468
|
+
}
|
|
12469
|
+
if (!agentBay.context) {
|
|
12470
|
+
throw new Error("agentBay.context is required");
|
|
12471
|
+
}
|
|
12472
|
+
this.agentBay = agentBay;
|
|
12473
|
+
this.contextService = agentBay.context;
|
|
12474
|
+
}
|
|
12475
|
+
/**
|
|
12476
|
+
* Set the simulate enable flag.
|
|
12477
|
+
*
|
|
12478
|
+
* @param enable - The simulate feature enable flag.
|
|
12479
|
+
*/
|
|
12480
|
+
setSimulateEnable(enable) {
|
|
12481
|
+
this.simulateEnable = enable;
|
|
12482
|
+
}
|
|
12483
|
+
/**
|
|
12484
|
+
* Get the simulate enable flag.
|
|
12485
|
+
*
|
|
12486
|
+
* @returns The simulate feature enable flag.
|
|
12487
|
+
*/
|
|
12488
|
+
getSimulateEnable() {
|
|
12489
|
+
return this.simulateEnable;
|
|
12490
|
+
}
|
|
12491
|
+
/**
|
|
12492
|
+
* Set the simulate mode.
|
|
12493
|
+
*
|
|
12494
|
+
* @param mode - The simulate mode.
|
|
12495
|
+
* - PropertiesOnly: Simulate only device properties.
|
|
12496
|
+
* - SensorsOnly: Simulate only device sensors.
|
|
12497
|
+
* - PackagesOnly: Simulate only installed packages.
|
|
12498
|
+
* - ServicesOnly: Simulate only system services.
|
|
12499
|
+
* - All: Simulate all aspects of the device.
|
|
12500
|
+
*/
|
|
12501
|
+
setSimulateMode(mode) {
|
|
12502
|
+
this.simulateMode = mode;
|
|
12503
|
+
}
|
|
12504
|
+
/**
|
|
12505
|
+
* Get the simulate mode.
|
|
12506
|
+
*
|
|
12507
|
+
* @returns The simulate mode.
|
|
12508
|
+
*/
|
|
12509
|
+
getSimulateMode() {
|
|
12510
|
+
return this.simulateMode;
|
|
12511
|
+
}
|
|
12512
|
+
/**
|
|
12513
|
+
* Set a previously saved simulate context id. Please make sure the context id is provided by MobileSimulateService
|
|
12514
|
+
* but not user side created context.
|
|
12515
|
+
*
|
|
12516
|
+
* @param contextId - The context ID of the previously saved mobile simulate context.
|
|
12517
|
+
*/
|
|
12518
|
+
setSimulateContextId(contextId) {
|
|
12519
|
+
this.contextId = contextId;
|
|
12520
|
+
logInfo(`set simulate context id = ${contextId}`);
|
|
12521
|
+
this.updateContext(true, contextId, void 0);
|
|
12522
|
+
}
|
|
12523
|
+
/**
|
|
12524
|
+
* Get the simulate context id.
|
|
12525
|
+
*
|
|
12526
|
+
* @returns The context ID of the mobile simulate context.
|
|
12527
|
+
*/
|
|
12528
|
+
getSimulateContextId() {
|
|
12529
|
+
return this.contextId;
|
|
12530
|
+
}
|
|
12531
|
+
/**
|
|
12532
|
+
* Get the simulate config.
|
|
12533
|
+
*
|
|
12534
|
+
* @returns The simulate config.
|
|
12535
|
+
* - simulate: The simulate feature enable flag.
|
|
12536
|
+
* - simulatePath: The path of the mobile dev info file.
|
|
12537
|
+
* - simulateMode: The simulate mode.
|
|
12538
|
+
* - simulatedContextId: The context ID of the mobile info.
|
|
12539
|
+
*/
|
|
12540
|
+
getSimulateConfig() {
|
|
12541
|
+
const simulatedContextId = this.useInternalContext ? this.contextId : void 0;
|
|
12542
|
+
return {
|
|
12543
|
+
simulate: this.simulateEnable,
|
|
12544
|
+
simulatePath: this.mobileDevInfoPath,
|
|
12545
|
+
simulateMode: this.simulateMode,
|
|
12546
|
+
simulatedContextId
|
|
12547
|
+
};
|
|
12548
|
+
}
|
|
12549
|
+
/**
|
|
12550
|
+
* Check if the mobile dev info file exists in one context sync. (Only for user provided context sync)
|
|
12551
|
+
*
|
|
12552
|
+
* @param contextSync - The context sync to check.
|
|
12553
|
+
* @returns True if the mobile dev info file exists, False otherwise.
|
|
12554
|
+
* @throws Error if context_sync is not provided or context_sync.context_id or context_sync.path is not provided.
|
|
12555
|
+
*
|
|
12556
|
+
* @remarks
|
|
12557
|
+
* This method can only be used when mobile simulate context sync is managed by user side. For internal mobile simulate
|
|
12558
|
+
* context sync, this method will not work.
|
|
12559
|
+
*/
|
|
12560
|
+
async hasMobileInfo(contextSync) {
|
|
12561
|
+
if (!contextSync) {
|
|
12562
|
+
throw new Error("contextSync is required");
|
|
12563
|
+
}
|
|
12564
|
+
if (!contextSync.contextId) {
|
|
12565
|
+
throw new Error("contextSync.contextId is required");
|
|
12566
|
+
}
|
|
12567
|
+
if (!contextSync.path) {
|
|
12568
|
+
throw new Error("contextSync.path is required");
|
|
12569
|
+
}
|
|
12570
|
+
const mobileDevInfoPath = contextSync.path + MOBILE_INFO_SUB_PATH + "/";
|
|
12571
|
+
logDebug(`hasMobileInfo: context_id = ${contextSync.contextId}, mobile_dev_info_path = ${mobileDevInfoPath}`);
|
|
12572
|
+
const res = await this.contextService.listFiles(contextSync.contextId, mobileDevInfoPath, 1, 50);
|
|
12573
|
+
let foundDevInfo = false;
|
|
12574
|
+
if (res.success) {
|
|
12575
|
+
for (const entry of res.entries) {
|
|
12576
|
+
if (entry.fileName === MOBILE_INFO_FILE_NAME) {
|
|
12577
|
+
foundDevInfo = true;
|
|
12578
|
+
break;
|
|
12579
|
+
}
|
|
12580
|
+
}
|
|
12581
|
+
} else {
|
|
12582
|
+
logError(`failed to list files: ${res.errorMessage}`);
|
|
12583
|
+
return false;
|
|
12584
|
+
}
|
|
12585
|
+
if (foundDevInfo) {
|
|
12586
|
+
logInfo("mobile dev info already exists");
|
|
12587
|
+
this.updateContext(false, contextSync.contextId, contextSync);
|
|
12588
|
+
return true;
|
|
12589
|
+
} else {
|
|
12590
|
+
logInfo("mobile dev info does not exist");
|
|
12591
|
+
return false;
|
|
12592
|
+
}
|
|
12593
|
+
}
|
|
12594
|
+
/**
|
|
12595
|
+
* Upload the mobile simulate dev info.
|
|
12596
|
+
*
|
|
12597
|
+
* @param mobileDevInfoContent - The mobile simulate dev info content to upload.
|
|
12598
|
+
* @param contextSync - Optional
|
|
12599
|
+
* - If not provided, a new context sync will be created for the mobile simulate service and this context id will
|
|
12600
|
+
* be returned by the MobileSimulateUploadResult. User can use this context id to do persistent mobile simulate across sessions.
|
|
12601
|
+
* - If provided, the mobile simulate dev info will be uploaded to the context sync in a specific path.
|
|
12602
|
+
*
|
|
12603
|
+
* @returns The result of the upload operation.
|
|
12604
|
+
*
|
|
12605
|
+
* @throws Error if mobile_dev_info_content is not provided or not a valid JSON string.
|
|
12606
|
+
* @throws Error if context_sync is provided but context_sync.context_id is not provided.
|
|
12607
|
+
*
|
|
12608
|
+
* @remarks
|
|
12609
|
+
* If context_sync is not provided, a new context sync will be created for the mobile simulate.
|
|
12610
|
+
* If context_sync is provided, the mobile simulate dev info will be uploaded to the context sync.
|
|
12611
|
+
* If the mobile simulate dev info already exists in the context sync, the context sync will be updated.
|
|
12612
|
+
* If the mobile simulate dev info does not exist in the context sync, the context sync will be created.
|
|
12613
|
+
* If the upload operation fails, the error message will be returned.
|
|
12614
|
+
*/
|
|
12615
|
+
async uploadMobileInfo(mobileDevInfoContent, contextSync) {
|
|
12616
|
+
if (!mobileDevInfoContent) {
|
|
12617
|
+
throw new Error("mobileDevInfoContent is required");
|
|
12618
|
+
}
|
|
12619
|
+
try {
|
|
12620
|
+
JSON.parse(mobileDevInfoContent);
|
|
12621
|
+
} catch (error) {
|
|
12622
|
+
throw new Error("mobileDevInfoContent is not a valid JSON string");
|
|
12623
|
+
}
|
|
12624
|
+
if (!contextSync) {
|
|
12625
|
+
const createdContext = await this.createContextForSimulate();
|
|
12626
|
+
if (!createdContext) {
|
|
12627
|
+
logError("Failed to create context for simulate");
|
|
12628
|
+
return {
|
|
12629
|
+
success: false,
|
|
12630
|
+
errorMessage: "Failed to create context for simulate"
|
|
12631
|
+
};
|
|
12632
|
+
}
|
|
12633
|
+
this.updateContext(true, createdContext.id, void 0);
|
|
12634
|
+
} else {
|
|
12635
|
+
if (!contextSync.contextId) {
|
|
12636
|
+
throw new Error("contextSync.contextId is required");
|
|
12637
|
+
}
|
|
12638
|
+
this.updateContext(false, contextSync.contextId, contextSync);
|
|
12639
|
+
}
|
|
12640
|
+
const uploadPath = `${this.mobileDevInfoPath}/${MOBILE_INFO_FILE_NAME}`;
|
|
12641
|
+
const uploadUrlResult = await this.contextService.getFileUploadUrl(this.contextId, uploadPath);
|
|
12642
|
+
if (!uploadUrlResult.success) {
|
|
12643
|
+
logError(`Failed to get file upload URL: ${uploadUrlResult.errorMessage}`);
|
|
12644
|
+
return {
|
|
12645
|
+
success: false,
|
|
12646
|
+
errorMessage: uploadUrlResult.errorMessage
|
|
12647
|
+
};
|
|
12648
|
+
}
|
|
12649
|
+
logDebug(`upload_url = ${uploadUrlResult.url}`);
|
|
12650
|
+
try {
|
|
12651
|
+
const encoder = new TextEncoder();
|
|
12652
|
+
const uint8Array = encoder.encode(mobileDevInfoContent);
|
|
12653
|
+
const response = await _nodefetch2.default.call(void 0, uploadUrlResult.url, {
|
|
12654
|
+
method: "PUT",
|
|
12655
|
+
body: uint8Array
|
|
12656
|
+
});
|
|
12657
|
+
if (!response.ok) {
|
|
12658
|
+
throw new Error(`Upload failed with status ${response.status}: ${response.statusText}`);
|
|
12659
|
+
}
|
|
12660
|
+
} catch (error) {
|
|
12661
|
+
const errorMsg = `An error occurred while uploading the file: ${error instanceof Error ? error.message : String(error)}`;
|
|
12662
|
+
logError(errorMsg);
|
|
12663
|
+
return {
|
|
12664
|
+
success: false,
|
|
12665
|
+
errorMessage: errorMsg
|
|
12666
|
+
};
|
|
12667
|
+
}
|
|
12668
|
+
logInfo("mobile dev info uploaded successfully");
|
|
12669
|
+
return {
|
|
12670
|
+
success: true,
|
|
12671
|
+
mobileSimulateContextId: this.contextId
|
|
12672
|
+
};
|
|
12673
|
+
}
|
|
12674
|
+
/**
|
|
12675
|
+
* Update the context information.
|
|
12676
|
+
*
|
|
12677
|
+
* @param isInternal - Whether this is an internal context.
|
|
12678
|
+
* @param contextId - The context ID.
|
|
12679
|
+
* @param contextSync - The context sync (required for external context).
|
|
12680
|
+
*/
|
|
12681
|
+
updateContext(isInternal, contextId, contextSync) {
|
|
12682
|
+
if (!isInternal) {
|
|
12683
|
+
if (!contextSync) {
|
|
12684
|
+
throw new Error("contextSync is required for external context");
|
|
12685
|
+
}
|
|
12686
|
+
if (_optionalChain([contextSync, 'access', _165 => _165.policy, 'optionalAccess', _166 => _166.bwList, 'optionalAccess', _167 => _167.whiteLists])) {
|
|
12687
|
+
const exists = contextSync.policy.bwList.whiteLists.some(
|
|
12688
|
+
(whiteList) => whiteList.path === MOBILE_INFO_SUB_PATH
|
|
12689
|
+
);
|
|
12690
|
+
if (!exists) {
|
|
12691
|
+
contextSync.policy.bwList.whiteLists.push({
|
|
12692
|
+
path: MOBILE_INFO_SUB_PATH,
|
|
12693
|
+
excludePaths: []
|
|
12694
|
+
});
|
|
12695
|
+
logInfo(`added mobile_dev_info_path to context_sync.policy.bw_list.white_lists: ${MOBILE_INFO_SUB_PATH}`);
|
|
12696
|
+
}
|
|
12697
|
+
}
|
|
12698
|
+
}
|
|
12699
|
+
this.useInternalContext = isInternal;
|
|
12700
|
+
this.contextId = contextId;
|
|
12701
|
+
this.contextSync = contextSync;
|
|
12702
|
+
if (isInternal) {
|
|
12703
|
+
this.mobileDevInfoPath = MOBILE_INFO_DEFAULT_PATH;
|
|
12704
|
+
} else {
|
|
12705
|
+
this.mobileDevInfoPath = contextSync.path + MOBILE_INFO_SUB_PATH;
|
|
12706
|
+
}
|
|
12707
|
+
logInfo(`updated context, is_internal = ${isInternal}, context_id = ${this.contextId}, mobile_dev_info_path = ${this.mobileDevInfoPath}`);
|
|
12708
|
+
}
|
|
12709
|
+
/**
|
|
12710
|
+
* Create a context for simulate.
|
|
12711
|
+
*
|
|
12712
|
+
* @returns The created context or null if failed.
|
|
12713
|
+
*/
|
|
12714
|
+
async createContextForSimulate() {
|
|
12715
|
+
const randomHex = Array.from(
|
|
12716
|
+
{ length: 16 },
|
|
12717
|
+
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
12718
|
+
).join("");
|
|
12719
|
+
const contextName = `mobile_sim_${randomHex}_${Math.floor(Date.now() / 1e3)}`;
|
|
12720
|
+
const contextResult = await this.contextService.get(contextName, true);
|
|
12721
|
+
if (!contextResult.success || !contextResult.context) {
|
|
12722
|
+
logError(`Failed to create mobile simulate context: ${contextResult.errorMessage}`);
|
|
12723
|
+
return null;
|
|
12724
|
+
}
|
|
12725
|
+
const context = contextResult.context;
|
|
12726
|
+
logInfo(`created mobile simulate context, context_id = ${context.id}, context_name = ${context.name}`);
|
|
12727
|
+
return context;
|
|
12728
|
+
}
|
|
12729
|
+
};
|
|
12730
|
+
_chunk4IPTHWLMcjs.__name.call(void 0, _MobileSimulateService, "MobileSimulateService");
|
|
12731
|
+
var MobileSimulateService = _MobileSimulateService;
|
|
12732
|
+
|
|
12733
|
+
// src/types/index.ts
|
|
12734
|
+
_chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
12735
|
+
|
|
12736
|
+
// src/types/list-session-params.ts
|
|
12737
|
+
_chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
12738
|
+
function createListSessionParams(labels = {}) {
|
|
12739
|
+
return {
|
|
12740
|
+
maxResults: 10,
|
|
12741
|
+
labels
|
|
12742
|
+
};
|
|
12743
|
+
}
|
|
12744
|
+
_chunk4IPTHWLMcjs.__name.call(void 0, createListSessionParams, "createListSessionParams");
|
|
12745
|
+
|
|
11777
12746
|
// src/session-params.ts
|
|
11778
12747
|
_chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
|
|
11779
12748
|
var BROWSER_FINGERPRINT_PERSIST_PATH2 = "/tmp/browser_fingerprint";
|
|
@@ -12047,8 +13016,8 @@ var _CreateSessionParams = class _CreateSessionParams {
|
|
|
12047
13016
|
/**
|
|
12048
13017
|
* AddContextSync adds a context sync configuration to the session parameters.
|
|
12049
13018
|
*/
|
|
12050
|
-
addContextSync(contextId,
|
|
12051
|
-
const contextSync = new ContextSync(contextId,
|
|
13019
|
+
addContextSync(contextId, path7, policy) {
|
|
13020
|
+
const contextSync = new ContextSync(contextId, path7, policy);
|
|
12052
13021
|
this.contextSync.push(contextSync);
|
|
12053
13022
|
return this;
|
|
12054
13023
|
}
|
|
@@ -12312,5 +13281,14 @@ _chunk4IPTHWLMcjs.__name.call(void 0, newCreateSessionParams, "newCreateSessionP
|
|
|
12312
13281
|
|
|
12313
13282
|
|
|
12314
13283
|
|
|
12315
|
-
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 = _chunkZUB35HKVcjs.ApplyMqttTokenRequest; exports.ApplyMqttTokenResponse = _chunkZUB35HKVcjs.ApplyMqttTokenResponse; exports.ApplyMqttTokenResponseBody = _chunkZUB35HKVcjs.ApplyMqttTokenResponseBody; exports.ApplyMqttTokenResponseBodyData = _chunkZUB35HKVcjs.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.CallMcpToolRequest = _chunkZUB35HKVcjs.CallMcpToolRequest; exports.CallMcpToolResponse = _chunkZUB35HKVcjs.CallMcpToolResponse; exports.CallMcpToolResponseBody = _chunkZUB35HKVcjs.CallMcpToolResponseBody; exports.ClearContextRequest = _chunkZUB35HKVcjs.ClearContextRequest; exports.ClearContextResponse = _chunkZUB35HKVcjs.ClearContextResponse; exports.ClearContextResponseBody = _chunkZUB35HKVcjs.ClearContextResponseBody; exports.Client = Client; exports.Code = Code; exports.Command = Command; exports.Computer = Computer; exports.Context = Context; exports.ContextManager = ContextManager; exports.ContextService = ContextService; exports.ContextSync = ContextSync; exports.CreateMcpSessionRequest = _chunkZUB35HKVcjs.CreateMcpSessionRequest; exports.CreateMcpSessionRequestPersistenceDataList = _chunkZUB35HKVcjs.CreateMcpSessionRequestPersistenceDataList; exports.CreateMcpSessionResponse = _chunkZUB35HKVcjs.CreateMcpSessionResponse; exports.CreateMcpSessionResponseBody = _chunkZUB35HKVcjs.CreateMcpSessionResponseBody; exports.CreateMcpSessionResponseBodyData = _chunkZUB35HKVcjs.CreateMcpSessionResponseBodyData; exports.CreateMcpSessionShrinkRequest = _chunkZUB35HKVcjs.CreateMcpSessionShrinkRequest; exports.CreateSessionParams = CreateSessionParams; exports.DeleteContextFileRequest = _chunkZUB35HKVcjs.DeleteContextFileRequest; exports.DeleteContextFileResponse = _chunkZUB35HKVcjs.DeleteContextFileResponse; exports.DeleteContextFileResponseBody = _chunkZUB35HKVcjs.DeleteContextFileResponseBody; exports.DeleteContextRequest = _chunkZUB35HKVcjs.DeleteContextRequest; exports.DeleteContextResponse = _chunkZUB35HKVcjs.DeleteContextResponse; exports.DeleteContextResponseBody = _chunkZUB35HKVcjs.DeleteContextResponseBody; exports.DescribeContextFilesRequest = _chunkZUB35HKVcjs.DescribeContextFilesRequest; exports.DescribeContextFilesResponse = _chunkZUB35HKVcjs.DescribeContextFilesResponse; exports.DescribeContextFilesResponseBody = _chunkZUB35HKVcjs.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 = _chunkZUB35HKVcjs.GetAdbLinkRequest; exports.GetAdbLinkResponse = _chunkZUB35HKVcjs.GetAdbLinkResponse; exports.GetAdbLinkResponseBody = _chunkZUB35HKVcjs.GetAdbLinkResponseBody; exports.GetAdbLinkResponseBodyData = _chunkZUB35HKVcjs.GetAdbLinkResponseBodyData; exports.GetCdpLinkRequest = _chunkZUB35HKVcjs.GetCdpLinkRequest; exports.GetCdpLinkResponse = _chunkZUB35HKVcjs.GetCdpLinkResponse; exports.GetCdpLinkResponseBody = _chunkZUB35HKVcjs.GetCdpLinkResponseBody; exports.GetCdpLinkResponseBodyData = _chunkZUB35HKVcjs.GetCdpLinkResponseBodyData; exports.GetContextFileDownloadUrlRequest = _chunkZUB35HKVcjs.GetContextFileDownloadUrlRequest; exports.GetContextFileDownloadUrlResponse = _chunkZUB35HKVcjs.GetContextFileDownloadUrlResponse; exports.GetContextFileDownloadUrlResponseBody = _chunkZUB35HKVcjs.GetContextFileDownloadUrlResponseBody; exports.GetContextFileUploadUrlRequest = _chunkZUB35HKVcjs.GetContextFileUploadUrlRequest; exports.GetContextFileUploadUrlResponse = _chunkZUB35HKVcjs.GetContextFileUploadUrlResponse; exports.GetContextFileUploadUrlResponseBody = _chunkZUB35HKVcjs.GetContextFileUploadUrlResponseBody; exports.GetContextInfoRequest = _chunkZUB35HKVcjs.GetContextInfoRequest; exports.GetContextInfoResponse = _chunkZUB35HKVcjs.GetContextInfoResponse; exports.GetContextInfoResponseBody = _chunkZUB35HKVcjs.GetContextInfoResponseBody; exports.GetContextInfoResponseBodyData = _chunkZUB35HKVcjs.GetContextInfoResponseBodyData; exports.GetContextRequest = _chunkZUB35HKVcjs.GetContextRequest; exports.GetContextResponse = _chunkZUB35HKVcjs.GetContextResponse; exports.GetContextResponseBody = _chunkZUB35HKVcjs.GetContextResponseBody; exports.GetContextResponseBodyData = _chunkZUB35HKVcjs.GetContextResponseBodyData; exports.GetLabelRequest = _chunkZUB35HKVcjs.GetLabelRequest; exports.GetLabelResponse = _chunkZUB35HKVcjs.GetLabelResponse; exports.GetLabelResponseBody = _chunkZUB35HKVcjs.GetLabelResponseBody; exports.GetLabelResponseBodyData = _chunkZUB35HKVcjs.GetLabelResponseBodyData; exports.GetLinkRequest = _chunkZUB35HKVcjs.GetLinkRequest; exports.GetLinkResponse = _chunkZUB35HKVcjs.GetLinkResponse; exports.GetLinkResponseBody = _chunkZUB35HKVcjs.GetLinkResponseBody; exports.GetLinkResponseBodyData = _chunkZUB35HKVcjs.GetLinkResponseBodyData; exports.GetMcpResourceRequest = _chunkZUB35HKVcjs.GetMcpResourceRequest; exports.GetMcpResourceResponse = _chunkZUB35HKVcjs.GetMcpResourceResponse; exports.GetMcpResourceResponseBody = _chunkZUB35HKVcjs.GetMcpResourceResponseBody; exports.GetMcpResourceResponseBodyData = _chunkZUB35HKVcjs.GetMcpResourceResponseBodyData; exports.GetMcpResourceResponseBodyDataDesktopInfo = _chunkZUB35HKVcjs.GetMcpResourceResponseBodyDataDesktopInfo; exports.GetSessionRequest = _chunkZUB35HKVcjs.GetSessionRequest; exports.GetSessionResponse = _chunkZUB35HKVcjs.GetSessionResponse; exports.GetSessionResponseBody = _chunkZUB35HKVcjs.GetSessionResponseBody; exports.GetSessionResponseBodyData = _chunkZUB35HKVcjs.GetSessionResponseBodyData; exports.HIDE_NAVIGATION_BAR_TEMPLATE = HIDE_NAVIGATION_BAR_TEMPLATE; exports.IS_RELEASE = IS_RELEASE; exports.InitBrowserRequest = _chunkZUB35HKVcjs.InitBrowserRequest; exports.InitBrowserResponse = _chunkZUB35HKVcjs.InitBrowserResponse; exports.InitBrowserResponseBody = _chunkZUB35HKVcjs.InitBrowserResponseBody; exports.InitBrowserResponseBodyData = _chunkZUB35HKVcjs.InitBrowserResponseBodyData; exports.Lifecycle = Lifecycle; exports.ListContextsRequest = _chunkZUB35HKVcjs.ListContextsRequest; exports.ListContextsResponse = _chunkZUB35HKVcjs.ListContextsResponse; exports.ListContextsResponseBody = _chunkZUB35HKVcjs.ListContextsResponseBody; exports.ListContextsResponseBodyData = _chunkZUB35HKVcjs.ListContextsResponseBodyData; exports.ListMcpToolsRequest = _chunkZUB35HKVcjs.ListMcpToolsRequest; exports.ListMcpToolsResponse = _chunkZUB35HKVcjs.ListMcpToolsResponse; exports.ListMcpToolsResponseBody = _chunkZUB35HKVcjs.ListMcpToolsResponseBody; exports.ListSessionRequest = _chunkZUB35HKVcjs.ListSessionRequest; exports.ListSessionResponse = _chunkZUB35HKVcjs.ListSessionResponse; exports.ListSessionResponseBody = _chunkZUB35HKVcjs.ListSessionResponseBody; exports.ListSessionResponseBodyData = _chunkZUB35HKVcjs.ListSessionResponseBodyData; exports.MOBILE_COMMAND_TEMPLATES = MOBILE_COMMAND_TEMPLATES; exports.Mobile = Mobile; exports.ModifyContextRequest = _chunkZUB35HKVcjs.ModifyContextRequest; exports.ModifyContextResponse = _chunkZUB35HKVcjs.ModifyContextResponse; exports.ModifyContextResponseBody = _chunkZUB35HKVcjs.ModifyContextResponseBody; exports.Oss = Oss; exports.OssError = OssError; exports.RESOLUTION_LOCK_TEMPLATE = RESOLUTION_LOCK_TEMPLATE; exports.ReleaseMcpSessionRequest = _chunkZUB35HKVcjs.ReleaseMcpSessionRequest; exports.ReleaseMcpSessionResponse = _chunkZUB35HKVcjs.ReleaseMcpSessionResponse; exports.ReleaseMcpSessionResponseBody = _chunkZUB35HKVcjs.ReleaseMcpSessionResponseBody; exports.SHOW_NAVIGATION_BAR_TEMPLATE = SHOW_NAVIGATION_BAR_TEMPLATE; exports.Session = Session; exports.SessionError = SessionError; exports.SetLabelRequest = _chunkZUB35HKVcjs.SetLabelRequest; exports.SetLabelResponse = _chunkZUB35HKVcjs.SetLabelResponse; exports.SetLabelResponseBody = _chunkZUB35HKVcjs.SetLabelResponseBody; exports.SyncContextRequest = _chunkZUB35HKVcjs.SyncContextRequest; exports.SyncContextResponse = _chunkZUB35HKVcjs.SyncContextResponse; exports.SyncContextResponseBody = _chunkZUB35HKVcjs.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;
|
|
13284
|
+
|
|
13285
|
+
|
|
13286
|
+
|
|
13287
|
+
|
|
13288
|
+
|
|
13289
|
+
|
|
13290
|
+
|
|
13291
|
+
|
|
13292
|
+
|
|
13293
|
+
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 = _chunkSL5GCAQEcjs.ApplyMqttTokenRequest; exports.ApplyMqttTokenResponse = _chunkSL5GCAQEcjs.ApplyMqttTokenResponse; exports.ApplyMqttTokenResponseBody = _chunkSL5GCAQEcjs.ApplyMqttTokenResponseBody; exports.ApplyMqttTokenResponseBodyData = _chunkSL5GCAQEcjs.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.CallMcpToolRequest = _chunkSL5GCAQEcjs.CallMcpToolRequest; exports.CallMcpToolResponse = _chunkSL5GCAQEcjs.CallMcpToolResponse; exports.CallMcpToolResponseBody = _chunkSL5GCAQEcjs.CallMcpToolResponseBody; exports.ClearContextRequest = _chunkSL5GCAQEcjs.ClearContextRequest; exports.ClearContextResponse = _chunkSL5GCAQEcjs.ClearContextResponse; exports.ClearContextResponseBody = _chunkSL5GCAQEcjs.ClearContextResponseBody; exports.Client = Client; exports.Code = Code; exports.Command = Command; exports.Computer = Computer; exports.Context = Context; exports.ContextManager = ContextManager; exports.ContextService = ContextService; exports.ContextSync = ContextSync; exports.CreateMcpSessionRequest = _chunkSL5GCAQEcjs.CreateMcpSessionRequest; exports.CreateMcpSessionRequestPersistenceDataList = _chunkSL5GCAQEcjs.CreateMcpSessionRequestPersistenceDataList; exports.CreateMcpSessionResponse = _chunkSL5GCAQEcjs.CreateMcpSessionResponse; exports.CreateMcpSessionResponseBody = _chunkSL5GCAQEcjs.CreateMcpSessionResponseBody; exports.CreateMcpSessionResponseBodyData = _chunkSL5GCAQEcjs.CreateMcpSessionResponseBodyData; exports.CreateMcpSessionShrinkRequest = _chunkSL5GCAQEcjs.CreateMcpSessionShrinkRequest; exports.CreateSessionParams = CreateSessionParams; exports.DeleteContextFileRequest = _chunkSL5GCAQEcjs.DeleteContextFileRequest; exports.DeleteContextFileResponse = _chunkSL5GCAQEcjs.DeleteContextFileResponse; exports.DeleteContextFileResponseBody = _chunkSL5GCAQEcjs.DeleteContextFileResponseBody; exports.DeleteContextRequest = _chunkSL5GCAQEcjs.DeleteContextRequest; exports.DeleteContextResponse = _chunkSL5GCAQEcjs.DeleteContextResponse; exports.DeleteContextResponseBody = _chunkSL5GCAQEcjs.DeleteContextResponseBody; exports.DescribeContextFilesRequest = _chunkSL5GCAQEcjs.DescribeContextFilesRequest; exports.DescribeContextFilesResponse = _chunkSL5GCAQEcjs.DescribeContextFilesResponse; exports.DescribeContextFilesResponseBody = _chunkSL5GCAQEcjs.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 = _chunkSL5GCAQEcjs.GetAdbLinkRequest; exports.GetAdbLinkResponse = _chunkSL5GCAQEcjs.GetAdbLinkResponse; exports.GetAdbLinkResponseBody = _chunkSL5GCAQEcjs.GetAdbLinkResponseBody; exports.GetAdbLinkResponseBodyData = _chunkSL5GCAQEcjs.GetAdbLinkResponseBodyData; exports.GetCdpLinkRequest = _chunkSL5GCAQEcjs.GetCdpLinkRequest; exports.GetCdpLinkResponse = _chunkSL5GCAQEcjs.GetCdpLinkResponse; exports.GetCdpLinkResponseBody = _chunkSL5GCAQEcjs.GetCdpLinkResponseBody; exports.GetCdpLinkResponseBodyData = _chunkSL5GCAQEcjs.GetCdpLinkResponseBodyData; exports.GetContextFileDownloadUrlRequest = _chunkSL5GCAQEcjs.GetContextFileDownloadUrlRequest; exports.GetContextFileDownloadUrlResponse = _chunkSL5GCAQEcjs.GetContextFileDownloadUrlResponse; exports.GetContextFileDownloadUrlResponseBody = _chunkSL5GCAQEcjs.GetContextFileDownloadUrlResponseBody; exports.GetContextFileUploadUrlRequest = _chunkSL5GCAQEcjs.GetContextFileUploadUrlRequest; exports.GetContextFileUploadUrlResponse = _chunkSL5GCAQEcjs.GetContextFileUploadUrlResponse; exports.GetContextFileUploadUrlResponseBody = _chunkSL5GCAQEcjs.GetContextFileUploadUrlResponseBody; exports.GetContextInfoRequest = _chunkSL5GCAQEcjs.GetContextInfoRequest; exports.GetContextInfoResponse = _chunkSL5GCAQEcjs.GetContextInfoResponse; exports.GetContextInfoResponseBody = _chunkSL5GCAQEcjs.GetContextInfoResponseBody; exports.GetContextInfoResponseBodyData = _chunkSL5GCAQEcjs.GetContextInfoResponseBodyData; exports.GetContextRequest = _chunkSL5GCAQEcjs.GetContextRequest; exports.GetContextResponse = _chunkSL5GCAQEcjs.GetContextResponse; exports.GetContextResponseBody = _chunkSL5GCAQEcjs.GetContextResponseBody; exports.GetContextResponseBodyData = _chunkSL5GCAQEcjs.GetContextResponseBodyData; exports.GetLabelRequest = _chunkSL5GCAQEcjs.GetLabelRequest; exports.GetLabelResponse = _chunkSL5GCAQEcjs.GetLabelResponse; exports.GetLabelResponseBody = _chunkSL5GCAQEcjs.GetLabelResponseBody; exports.GetLabelResponseBodyData = _chunkSL5GCAQEcjs.GetLabelResponseBodyData; exports.GetLinkRequest = _chunkSL5GCAQEcjs.GetLinkRequest; exports.GetLinkResponse = _chunkSL5GCAQEcjs.GetLinkResponse; exports.GetLinkResponseBody = _chunkSL5GCAQEcjs.GetLinkResponseBody; exports.GetLinkResponseBodyData = _chunkSL5GCAQEcjs.GetLinkResponseBodyData; exports.GetMcpResourceRequest = _chunkSL5GCAQEcjs.GetMcpResourceRequest; exports.GetMcpResourceResponse = _chunkSL5GCAQEcjs.GetMcpResourceResponse; exports.GetMcpResourceResponseBody = _chunkSL5GCAQEcjs.GetMcpResourceResponseBody; exports.GetMcpResourceResponseBodyData = _chunkSL5GCAQEcjs.GetMcpResourceResponseBodyData; exports.GetMcpResourceResponseBodyDataDesktopInfo = _chunkSL5GCAQEcjs.GetMcpResourceResponseBodyDataDesktopInfo; exports.GetSessionRequest = _chunkSL5GCAQEcjs.GetSessionRequest; exports.GetSessionResponse = _chunkSL5GCAQEcjs.GetSessionResponse; exports.GetSessionResponseBody = _chunkSL5GCAQEcjs.GetSessionResponseBody; exports.GetSessionResponseBodyData = _chunkSL5GCAQEcjs.GetSessionResponseBodyData; exports.HIDE_NAVIGATION_BAR_TEMPLATE = HIDE_NAVIGATION_BAR_TEMPLATE; exports.IS_RELEASE = IS_RELEASE; exports.InitBrowserRequest = _chunkSL5GCAQEcjs.InitBrowserRequest; exports.InitBrowserResponse = _chunkSL5GCAQEcjs.InitBrowserResponse; exports.InitBrowserResponseBody = _chunkSL5GCAQEcjs.InitBrowserResponseBody; exports.InitBrowserResponseBodyData = _chunkSL5GCAQEcjs.InitBrowserResponseBodyData; exports.Lifecycle = Lifecycle; exports.ListContextsRequest = _chunkSL5GCAQEcjs.ListContextsRequest; exports.ListContextsResponse = _chunkSL5GCAQEcjs.ListContextsResponse; exports.ListContextsResponseBody = _chunkSL5GCAQEcjs.ListContextsResponseBody; exports.ListContextsResponseBodyData = _chunkSL5GCAQEcjs.ListContextsResponseBodyData; exports.ListMcpToolsRequest = _chunkSL5GCAQEcjs.ListMcpToolsRequest; exports.ListMcpToolsResponse = _chunkSL5GCAQEcjs.ListMcpToolsResponse; exports.ListMcpToolsResponseBody = _chunkSL5GCAQEcjs.ListMcpToolsResponseBody; exports.ListSessionRequest = _chunkSL5GCAQEcjs.ListSessionRequest; exports.ListSessionResponse = _chunkSL5GCAQEcjs.ListSessionResponse; exports.ListSessionResponseBody = _chunkSL5GCAQEcjs.ListSessionResponseBody; exports.ListSessionResponseBodyData = _chunkSL5GCAQEcjs.ListSessionResponseBodyData; exports.MOBILE_COMMAND_TEMPLATES = MOBILE_COMMAND_TEMPLATES; exports.Mobile = Mobile; exports.MobileSimulateMode = MobileSimulateMode; exports.MobileSimulateService = MobileSimulateService; exports.ModifyContextRequest = _chunkSL5GCAQEcjs.ModifyContextRequest; exports.ModifyContextResponse = _chunkSL5GCAQEcjs.ModifyContextResponse; exports.ModifyContextResponseBody = _chunkSL5GCAQEcjs.ModifyContextResponseBody; exports.Oss = Oss; exports.OssError = OssError; exports.PauseSessionAsyncRequest = _chunkSL5GCAQEcjs.PauseSessionAsyncRequest; exports.PauseSessionAsyncResponse = _chunkSL5GCAQEcjs.PauseSessionAsyncResponse; exports.PauseSessionAsyncResponseBody = _chunkSL5GCAQEcjs.PauseSessionAsyncResponseBody; exports.RESOLUTION_LOCK_TEMPLATE = RESOLUTION_LOCK_TEMPLATE; exports.ReleaseMcpSessionRequest = _chunkSL5GCAQEcjs.ReleaseMcpSessionRequest; exports.ReleaseMcpSessionResponse = _chunkSL5GCAQEcjs.ReleaseMcpSessionResponse; exports.ReleaseMcpSessionResponseBody = _chunkSL5GCAQEcjs.ReleaseMcpSessionResponseBody; exports.ResumeSessionAsyncRequest = _chunkSL5GCAQEcjs.ResumeSessionAsyncRequest; exports.ResumeSessionAsyncResponse = _chunkSL5GCAQEcjs.ResumeSessionAsyncResponse; exports.ResumeSessionAsyncResponseBody = _chunkSL5GCAQEcjs.ResumeSessionAsyncResponseBody; exports.SHOW_NAVIGATION_BAR_TEMPLATE = SHOW_NAVIGATION_BAR_TEMPLATE; exports.Session = Session; exports.SessionError = SessionError; exports.SetLabelRequest = _chunkSL5GCAQEcjs.SetLabelRequest; exports.SetLabelResponse = _chunkSL5GCAQEcjs.SetLabelResponse; exports.SetLabelResponseBody = _chunkSL5GCAQEcjs.SetLabelResponseBody; exports.SyncContextRequest = _chunkSL5GCAQEcjs.SyncContextRequest; exports.SyncContextResponse = _chunkSL5GCAQEcjs.SyncContextResponse; exports.SyncContextResponseBody = _chunkSL5GCAQEcjs.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;
|
|
12316
13294
|
//# sourceMappingURL=index.cjs.map
|