test-wuying-agentbay-sdk 0.15.0-beta.20260113141358 → 0.15.0-beta.20260114082807
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +146 -117
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -15
- package/dist/index.d.ts +7 -15
- package/dist/index.mjs +146 -117
- package/dist/index.mjs.map +1 -1
- package/docs/api/common-features/basics/session.md +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9702,6 +9702,15 @@ var _BaseTaskAgent = class _BaseTaskAgent {
|
|
|
9702
9702
|
}
|
|
9703
9703
|
return baseName;
|
|
9704
9704
|
}
|
|
9705
|
+
getServerName() {
|
|
9706
|
+
if (this.toolPrefix === "flux") {
|
|
9707
|
+
return "flux";
|
|
9708
|
+
}
|
|
9709
|
+
if (this.toolPrefix === "browser_use") {
|
|
9710
|
+
return "wuying_browseruse";
|
|
9711
|
+
}
|
|
9712
|
+
return "wuying_mobile_agent";
|
|
9713
|
+
}
|
|
9705
9714
|
/**
|
|
9706
9715
|
* Execute a specific task described in human language.
|
|
9707
9716
|
*/
|
|
@@ -9710,7 +9719,9 @@ var _BaseTaskAgent = class _BaseTaskAgent {
|
|
|
9710
9719
|
const args = { task };
|
|
9711
9720
|
const result = await this.session.callMcpTool(
|
|
9712
9721
|
this.getToolName("execute"),
|
|
9713
|
-
args
|
|
9722
|
+
args,
|
|
9723
|
+
false,
|
|
9724
|
+
this.getServerName()
|
|
9714
9725
|
);
|
|
9715
9726
|
if (!result.success) {
|
|
9716
9727
|
return {
|
|
@@ -9880,7 +9891,9 @@ var _BaseTaskAgent = class _BaseTaskAgent {
|
|
|
9880
9891
|
const args = { task_id: taskId };
|
|
9881
9892
|
const result = await this.session.callMcpTool(
|
|
9882
9893
|
this.getToolName("get_status"),
|
|
9883
|
-
args
|
|
9894
|
+
args,
|
|
9895
|
+
false,
|
|
9896
|
+
this.getServerName()
|
|
9884
9897
|
);
|
|
9885
9898
|
if (!result.success) {
|
|
9886
9899
|
return {
|
|
@@ -9937,7 +9950,9 @@ var _BaseTaskAgent = class _BaseTaskAgent {
|
|
|
9937
9950
|
const args = { task_id: taskId };
|
|
9938
9951
|
const result = await this.session.callMcpTool(
|
|
9939
9952
|
this.getToolName("terminate"),
|
|
9940
|
-
args
|
|
9953
|
+
args,
|
|
9954
|
+
false,
|
|
9955
|
+
this.getServerName()
|
|
9941
9956
|
);
|
|
9942
9957
|
let content;
|
|
9943
9958
|
try {
|
|
@@ -11080,7 +11095,7 @@ var _BrowserAgent = class _BrowserAgent {
|
|
|
11080
11095
|
return [null, 0];
|
|
11081
11096
|
}
|
|
11082
11097
|
async _callMcpTool(toolName, args) {
|
|
11083
|
-
return this.session.callMcpTool(toolName, args);
|
|
11098
|
+
return this.session.callMcpTool(toolName, args, false, "pageuse-mcp-server");
|
|
11084
11099
|
}
|
|
11085
11100
|
_delay(ms) {
|
|
11086
11101
|
return new Promise((res) => setTimeout(res, ms));
|
|
@@ -12425,7 +12440,12 @@ var _Code = class _Code {
|
|
|
12425
12440
|
language: canonicalLanguage,
|
|
12426
12441
|
timeout_s: timeoutS
|
|
12427
12442
|
};
|
|
12428
|
-
const response = await this.session.callMcpTool(
|
|
12443
|
+
const response = await this.session.callMcpTool(
|
|
12444
|
+
"run_code",
|
|
12445
|
+
args,
|
|
12446
|
+
false,
|
|
12447
|
+
"wuying_codespace"
|
|
12448
|
+
);
|
|
12429
12449
|
let codeResult;
|
|
12430
12450
|
if (response.success) {
|
|
12431
12451
|
codeResult = this.parseBackendResponse(response.data);
|
|
@@ -12589,7 +12609,12 @@ var _Command = class _Command {
|
|
|
12589
12609
|
if (envs !== void 0) {
|
|
12590
12610
|
args.envs = envs;
|
|
12591
12611
|
}
|
|
12592
|
-
const result = await this.session.callMcpTool(
|
|
12612
|
+
const result = await this.session.callMcpTool(
|
|
12613
|
+
"shell",
|
|
12614
|
+
args,
|
|
12615
|
+
false,
|
|
12616
|
+
"wuying_shell"
|
|
12617
|
+
);
|
|
12593
12618
|
if (result.success) {
|
|
12594
12619
|
try {
|
|
12595
12620
|
let dataJson;
|
|
@@ -12807,7 +12832,7 @@ var _Computer = class _Computer {
|
|
|
12807
12832
|
}
|
|
12808
12833
|
const args = { x, y, button: buttonStr };
|
|
12809
12834
|
try {
|
|
12810
|
-
const result = await this.session.callMcpTool("click_mouse", args);
|
|
12835
|
+
const result = await this.session.callMcpTool("click_mouse", args, false, "wuying_ui");
|
|
12811
12836
|
return {
|
|
12812
12837
|
success: result.success || false,
|
|
12813
12838
|
requestId: result.requestId || "",
|
|
@@ -12845,7 +12870,7 @@ var _Computer = class _Computer {
|
|
|
12845
12870
|
async moveMouse(x, y) {
|
|
12846
12871
|
const args = { x, y };
|
|
12847
12872
|
try {
|
|
12848
|
-
const result = await this.session.callMcpTool("move_mouse", args);
|
|
12873
|
+
const result = await this.session.callMcpTool("move_mouse", args, false, "wuying_ui");
|
|
12849
12874
|
return {
|
|
12850
12875
|
success: result.success || false,
|
|
12851
12876
|
requestId: result.requestId || "",
|
|
@@ -12890,7 +12915,7 @@ var _Computer = class _Computer {
|
|
|
12890
12915
|
}
|
|
12891
12916
|
const args = { from_x: fromX, from_y: fromY, to_x: toX, to_y: toY, button: buttonStr };
|
|
12892
12917
|
try {
|
|
12893
|
-
const result = await this.session.callMcpTool("drag_mouse", args);
|
|
12918
|
+
const result = await this.session.callMcpTool("drag_mouse", args, false, "wuying_ui");
|
|
12894
12919
|
return {
|
|
12895
12920
|
success: result.success || false,
|
|
12896
12921
|
requestId: result.requestId || "",
|
|
@@ -12933,7 +12958,7 @@ var _Computer = class _Computer {
|
|
|
12933
12958
|
}
|
|
12934
12959
|
const args = { x, y, direction: directionStr, amount };
|
|
12935
12960
|
try {
|
|
12936
|
-
const result = await this.session.callMcpTool("scroll", args);
|
|
12961
|
+
const result = await this.session.callMcpTool("scroll", args, false, "wuying_ui");
|
|
12937
12962
|
return {
|
|
12938
12963
|
success: result.success || false,
|
|
12939
12964
|
requestId: result.requestId || "",
|
|
@@ -12968,7 +12993,7 @@ var _Computer = class _Computer {
|
|
|
12968
12993
|
async inputText(text) {
|
|
12969
12994
|
const args = { text };
|
|
12970
12995
|
try {
|
|
12971
|
-
const result = await this.session.callMcpTool("input_text", args);
|
|
12996
|
+
const result = await this.session.callMcpTool("input_text", args, false, "wuying_ui");
|
|
12972
12997
|
return {
|
|
12973
12998
|
success: result.success || false,
|
|
12974
12999
|
requestId: result.requestId || "",
|
|
@@ -13005,7 +13030,7 @@ var _Computer = class _Computer {
|
|
|
13005
13030
|
async pressKeys(keys, hold = false) {
|
|
13006
13031
|
const args = { keys, hold };
|
|
13007
13032
|
try {
|
|
13008
|
-
const result = await this.session.callMcpTool("press_keys", args);
|
|
13033
|
+
const result = await this.session.callMcpTool("press_keys", args, false, "wuying_ui");
|
|
13009
13034
|
return {
|
|
13010
13035
|
success: result.success || false,
|
|
13011
13036
|
requestId: result.requestId || "",
|
|
@@ -13041,7 +13066,7 @@ var _Computer = class _Computer {
|
|
|
13041
13066
|
async releaseKeys(keys) {
|
|
13042
13067
|
const args = { keys };
|
|
13043
13068
|
try {
|
|
13044
|
-
const result = await this.session.callMcpTool("release_keys", args);
|
|
13069
|
+
const result = await this.session.callMcpTool("release_keys", args, false, "wuying_ui");
|
|
13045
13070
|
return {
|
|
13046
13071
|
success: result.success || false,
|
|
13047
13072
|
requestId: result.requestId || "",
|
|
@@ -13075,7 +13100,7 @@ var _Computer = class _Computer {
|
|
|
13075
13100
|
*/
|
|
13076
13101
|
async getCursorPosition() {
|
|
13077
13102
|
try {
|
|
13078
|
-
const result = await this.session.callMcpTool("get_cursor_position", {});
|
|
13103
|
+
const result = await this.session.callMcpTool("get_cursor_position", {}, false, "wuying_ui");
|
|
13079
13104
|
if (!result.success) {
|
|
13080
13105
|
return {
|
|
13081
13106
|
success: false,
|
|
@@ -13141,7 +13166,7 @@ var _Computer = class _Computer {
|
|
|
13141
13166
|
*/
|
|
13142
13167
|
async getScreenSize() {
|
|
13143
13168
|
try {
|
|
13144
|
-
const result = await this.session.callMcpTool("get_screen_size", {});
|
|
13169
|
+
const result = await this.session.callMcpTool("get_screen_size", {}, false, "wuying_ui");
|
|
13145
13170
|
if (!result.success) {
|
|
13146
13171
|
return {
|
|
13147
13172
|
success: false,
|
|
@@ -13212,7 +13237,7 @@ var _Computer = class _Computer {
|
|
|
13212
13237
|
*/
|
|
13213
13238
|
async screenshot() {
|
|
13214
13239
|
try {
|
|
13215
|
-
const result = await this.session.callMcpTool("system_screenshot", {});
|
|
13240
|
+
const result = await this.session.callMcpTool("system_screenshot", {}, false, "mcp-server");
|
|
13216
13241
|
if (!result.success) {
|
|
13217
13242
|
return {
|
|
13218
13243
|
success: false,
|
|
@@ -13265,7 +13290,7 @@ var _Computer = class _Computer {
|
|
|
13265
13290
|
async listRootWindows(timeoutMs = 3e3) {
|
|
13266
13291
|
try {
|
|
13267
13292
|
const args = { timeout_ms: timeoutMs };
|
|
13268
|
-
const response = await this.session.callMcpTool("list_root_windows", args);
|
|
13293
|
+
const response = await this.session.callMcpTool("list_root_windows", args, false, "wuying_ui");
|
|
13269
13294
|
if (!response.success) {
|
|
13270
13295
|
return {
|
|
13271
13296
|
requestId: response.requestId,
|
|
@@ -13310,7 +13335,7 @@ var _Computer = class _Computer {
|
|
|
13310
13335
|
async getActiveWindow() {
|
|
13311
13336
|
try {
|
|
13312
13337
|
const args = {};
|
|
13313
|
-
const response = await this.session.callMcpTool("get_active_window", args);
|
|
13338
|
+
const response = await this.session.callMcpTool("get_active_window", args, false, "wuying_ui");
|
|
13314
13339
|
if (!response.success) {
|
|
13315
13340
|
return {
|
|
13316
13341
|
requestId: response.requestId,
|
|
@@ -13355,7 +13380,7 @@ var _Computer = class _Computer {
|
|
|
13355
13380
|
async activateWindow(windowId) {
|
|
13356
13381
|
try {
|
|
13357
13382
|
const args = { window_id: windowId };
|
|
13358
|
-
const response = await this.session.callMcpTool("activate_window", args);
|
|
13383
|
+
const response = await this.session.callMcpTool("activate_window", args, false, "wuying_ui");
|
|
13359
13384
|
return {
|
|
13360
13385
|
requestId: response.requestId,
|
|
13361
13386
|
success: response.success,
|
|
@@ -13390,7 +13415,7 @@ var _Computer = class _Computer {
|
|
|
13390
13415
|
async closeWindow(windowId) {
|
|
13391
13416
|
try {
|
|
13392
13417
|
const args = { window_id: windowId };
|
|
13393
|
-
const response = await this.session.callMcpTool("close_window", args);
|
|
13418
|
+
const response = await this.session.callMcpTool("close_window", args, false, "wuying_ui");
|
|
13394
13419
|
return {
|
|
13395
13420
|
requestId: response.requestId,
|
|
13396
13421
|
success: response.success,
|
|
@@ -13425,7 +13450,7 @@ var _Computer = class _Computer {
|
|
|
13425
13450
|
async maximizeWindow(windowId) {
|
|
13426
13451
|
try {
|
|
13427
13452
|
const args = { window_id: windowId };
|
|
13428
|
-
const response = await this.session.callMcpTool("maximize_window", args);
|
|
13453
|
+
const response = await this.session.callMcpTool("maximize_window", args, false, "wuying_ui");
|
|
13429
13454
|
return {
|
|
13430
13455
|
requestId: response.requestId,
|
|
13431
13456
|
success: response.success,
|
|
@@ -13460,7 +13485,7 @@ var _Computer = class _Computer {
|
|
|
13460
13485
|
async minimizeWindow(windowId) {
|
|
13461
13486
|
try {
|
|
13462
13487
|
const args = { window_id: windowId };
|
|
13463
|
-
const response = await this.session.callMcpTool("minimize_window", args);
|
|
13488
|
+
const response = await this.session.callMcpTool("minimize_window", args, false, "wuying_ui");
|
|
13464
13489
|
return {
|
|
13465
13490
|
requestId: response.requestId,
|
|
13466
13491
|
success: response.success,
|
|
@@ -13496,7 +13521,7 @@ var _Computer = class _Computer {
|
|
|
13496
13521
|
async restoreWindow(windowId) {
|
|
13497
13522
|
try {
|
|
13498
13523
|
const args = { window_id: windowId };
|
|
13499
|
-
const response = await this.session.callMcpTool("restore_window", args);
|
|
13524
|
+
const response = await this.session.callMcpTool("restore_window", args, false, "wuying_ui");
|
|
13500
13525
|
return {
|
|
13501
13526
|
requestId: response.requestId,
|
|
13502
13527
|
success: response.success,
|
|
@@ -13533,7 +13558,7 @@ var _Computer = class _Computer {
|
|
|
13533
13558
|
async resizeWindow(windowId, width, height) {
|
|
13534
13559
|
try {
|
|
13535
13560
|
const args = { window_id: windowId, width, height };
|
|
13536
|
-
const response = await this.session.callMcpTool("resize_window", args);
|
|
13561
|
+
const response = await this.session.callMcpTool("resize_window", args, false, "wuying_ui");
|
|
13537
13562
|
return {
|
|
13538
13563
|
requestId: response.requestId,
|
|
13539
13564
|
success: response.success,
|
|
@@ -13568,7 +13593,7 @@ var _Computer = class _Computer {
|
|
|
13568
13593
|
async fullscreenWindow(windowId) {
|
|
13569
13594
|
try {
|
|
13570
13595
|
const args = { window_id: windowId };
|
|
13571
|
-
const response = await this.session.callMcpTool("fullscreen_window", args);
|
|
13596
|
+
const response = await this.session.callMcpTool("fullscreen_window", args, false, "wuying_ui");
|
|
13572
13597
|
return {
|
|
13573
13598
|
requestId: response.requestId,
|
|
13574
13599
|
success: response.success,
|
|
@@ -13602,7 +13627,7 @@ var _Computer = class _Computer {
|
|
|
13602
13627
|
async focusMode(on) {
|
|
13603
13628
|
try {
|
|
13604
13629
|
const args = { on };
|
|
13605
|
-
const response = await this.session.callMcpTool("focus_mode", args);
|
|
13630
|
+
const response = await this.session.callMcpTool("focus_mode", args, false, "wuying_ui");
|
|
13606
13631
|
return {
|
|
13607
13632
|
requestId: response.requestId,
|
|
13608
13633
|
success: response.success,
|
|
@@ -13643,7 +13668,7 @@ var _Computer = class _Computer {
|
|
|
13643
13668
|
desktop,
|
|
13644
13669
|
ignore_system_apps: ignoreSystemApps
|
|
13645
13670
|
};
|
|
13646
|
-
const response = await this.session.callMcpTool("get_installed_apps", args);
|
|
13671
|
+
const response = await this.session.callMcpTool("get_installed_apps", args, false, "wuying_app");
|
|
13647
13672
|
if (!response.success) {
|
|
13648
13673
|
return {
|
|
13649
13674
|
requestId: response.requestId,
|
|
@@ -13692,7 +13717,7 @@ var _Computer = class _Computer {
|
|
|
13692
13717
|
const args = { start_cmd: startCmd };
|
|
13693
13718
|
if (workDirectory) args.work_directory = workDirectory;
|
|
13694
13719
|
if (activity) args.activity = activity;
|
|
13695
|
-
const response = await this.session.callMcpTool("start_app", args);
|
|
13720
|
+
const response = await this.session.callMcpTool("start_app", args, false, "wuying_app");
|
|
13696
13721
|
if (!response.success) {
|
|
13697
13722
|
return {
|
|
13698
13723
|
requestId: response.requestId,
|
|
@@ -13737,7 +13762,7 @@ var _Computer = class _Computer {
|
|
|
13737
13762
|
async stopAppByPName(pname) {
|
|
13738
13763
|
try {
|
|
13739
13764
|
const args = { pname };
|
|
13740
|
-
const response = await this.session.callMcpTool("stop_app_by_pname", args);
|
|
13765
|
+
const response = await this.session.callMcpTool("stop_app_by_pname", args, false, "wuying_app");
|
|
13741
13766
|
return {
|
|
13742
13767
|
requestId: response.requestId,
|
|
13743
13768
|
success: response.success,
|
|
@@ -13772,7 +13797,7 @@ var _Computer = class _Computer {
|
|
|
13772
13797
|
async stopAppByPID(pid) {
|
|
13773
13798
|
try {
|
|
13774
13799
|
const args = { pid };
|
|
13775
|
-
const response = await this.session.callMcpTool("stop_app_by_pid", args);
|
|
13800
|
+
const response = await this.session.callMcpTool("stop_app_by_pid", args, false, "wuying_app");
|
|
13776
13801
|
return {
|
|
13777
13802
|
requestId: response.requestId,
|
|
13778
13803
|
success: response.success,
|
|
@@ -13806,7 +13831,7 @@ var _Computer = class _Computer {
|
|
|
13806
13831
|
async stopAppByCmd(cmd) {
|
|
13807
13832
|
try {
|
|
13808
13833
|
const args = { stop_cmd: cmd };
|
|
13809
|
-
const response = await this.session.callMcpTool("stop_app_by_cmd", args);
|
|
13834
|
+
const response = await this.session.callMcpTool("stop_app_by_cmd", args, false, "wuying_app");
|
|
13810
13835
|
return {
|
|
13811
13836
|
requestId: response.requestId,
|
|
13812
13837
|
success: response.success,
|
|
@@ -13838,7 +13863,7 @@ var _Computer = class _Computer {
|
|
|
13838
13863
|
*/
|
|
13839
13864
|
async listVisibleApps() {
|
|
13840
13865
|
try {
|
|
13841
|
-
const response = await this.session.callMcpTool("list_visible_apps", {});
|
|
13866
|
+
const response = await this.session.callMcpTool("list_visible_apps", {}, false, "wuying_app");
|
|
13842
13867
|
if (!response.success) {
|
|
13843
13868
|
return {
|
|
13844
13869
|
requestId: response.requestId,
|
|
@@ -14910,7 +14935,9 @@ var _FileSystem = class _FileSystem {
|
|
|
14910
14935
|
};
|
|
14911
14936
|
const result = await this.session.callMcpTool(
|
|
14912
14937
|
"create_directory",
|
|
14913
|
-
args
|
|
14938
|
+
args,
|
|
14939
|
+
false,
|
|
14940
|
+
"wuying_filesystem"
|
|
14914
14941
|
);
|
|
14915
14942
|
if (!result.success) {
|
|
14916
14943
|
return {
|
|
@@ -14955,7 +14982,12 @@ var _FileSystem = class _FileSystem {
|
|
|
14955
14982
|
async deleteFile(path6) {
|
|
14956
14983
|
try {
|
|
14957
14984
|
const args = { path: path6 };
|
|
14958
|
-
const result = await this.session.callMcpTool(
|
|
14985
|
+
const result = await this.session.callMcpTool(
|
|
14986
|
+
"delete_file",
|
|
14987
|
+
args,
|
|
14988
|
+
false,
|
|
14989
|
+
"wuying_filesystem"
|
|
14990
|
+
);
|
|
14959
14991
|
if (!result.success) {
|
|
14960
14992
|
return {
|
|
14961
14993
|
requestId: result.requestId,
|
|
@@ -15049,7 +15081,9 @@ var _FileSystem = class _FileSystem {
|
|
|
15049
15081
|
};
|
|
15050
15082
|
const result = await this.session.callMcpTool(
|
|
15051
15083
|
"edit_file",
|
|
15052
|
-
args
|
|
15084
|
+
args,
|
|
15085
|
+
false,
|
|
15086
|
+
"wuying_filesystem"
|
|
15053
15087
|
);
|
|
15054
15088
|
if (!result.success) {
|
|
15055
15089
|
return {
|
|
@@ -15097,7 +15131,9 @@ var _FileSystem = class _FileSystem {
|
|
|
15097
15131
|
};
|
|
15098
15132
|
const result = await this.session.callMcpTool(
|
|
15099
15133
|
"get_file_info",
|
|
15100
|
-
args
|
|
15134
|
+
args,
|
|
15135
|
+
false,
|
|
15136
|
+
"wuying_filesystem"
|
|
15101
15137
|
);
|
|
15102
15138
|
if (!result.success) {
|
|
15103
15139
|
return {
|
|
@@ -15175,7 +15211,9 @@ var _FileSystem = class _FileSystem {
|
|
|
15175
15211
|
};
|
|
15176
15212
|
const result = await this.session.callMcpTool(
|
|
15177
15213
|
"list_directory",
|
|
15178
|
-
args
|
|
15214
|
+
args,
|
|
15215
|
+
false,
|
|
15216
|
+
"wuying_filesystem"
|
|
15179
15217
|
);
|
|
15180
15218
|
if (!result.success) {
|
|
15181
15219
|
return {
|
|
@@ -15228,7 +15266,9 @@ var _FileSystem = class _FileSystem {
|
|
|
15228
15266
|
};
|
|
15229
15267
|
const result = await this.session.callMcpTool(
|
|
15230
15268
|
"move_file",
|
|
15231
|
-
args
|
|
15269
|
+
args,
|
|
15270
|
+
false,
|
|
15271
|
+
"wuying_filesystem"
|
|
15232
15272
|
);
|
|
15233
15273
|
if (!result.success) {
|
|
15234
15274
|
return {
|
|
@@ -15275,7 +15315,9 @@ var _FileSystem = class _FileSystem {
|
|
|
15275
15315
|
}
|
|
15276
15316
|
const result = await this.session.callMcpTool(
|
|
15277
15317
|
"read_file",
|
|
15278
|
-
args
|
|
15318
|
+
args,
|
|
15319
|
+
false,
|
|
15320
|
+
"wuying_filesystem"
|
|
15279
15321
|
);
|
|
15280
15322
|
if (!result.success) {
|
|
15281
15323
|
if (formatType === "binary") {
|
|
@@ -15386,7 +15428,9 @@ var _FileSystem = class _FileSystem {
|
|
|
15386
15428
|
};
|
|
15387
15429
|
const result = await this.session.callMcpTool(
|
|
15388
15430
|
"read_multiple_files",
|
|
15389
|
-
args
|
|
15431
|
+
args,
|
|
15432
|
+
false,
|
|
15433
|
+
"wuying_filesystem"
|
|
15390
15434
|
);
|
|
15391
15435
|
if (!result.success) {
|
|
15392
15436
|
return {
|
|
@@ -15477,7 +15521,9 @@ var _FileSystem = class _FileSystem {
|
|
|
15477
15521
|
}
|
|
15478
15522
|
const result = await this.session.callMcpTool(
|
|
15479
15523
|
"search_files",
|
|
15480
|
-
args
|
|
15524
|
+
args,
|
|
15525
|
+
false,
|
|
15526
|
+
"wuying_filesystem"
|
|
15481
15527
|
);
|
|
15482
15528
|
if (!result.success) {
|
|
15483
15529
|
return {
|
|
@@ -15532,7 +15578,9 @@ var _FileSystem = class _FileSystem {
|
|
|
15532
15578
|
};
|
|
15533
15579
|
const result = await this.session.callMcpTool(
|
|
15534
15580
|
"write_file",
|
|
15535
|
-
args
|
|
15581
|
+
args,
|
|
15582
|
+
false,
|
|
15583
|
+
"wuying_filesystem"
|
|
15536
15584
|
);
|
|
15537
15585
|
if (!result.success) {
|
|
15538
15586
|
return {
|
|
@@ -15848,7 +15896,12 @@ var _FileSystem = class _FileSystem {
|
|
|
15848
15896
|
async getFileChange(path6) {
|
|
15849
15897
|
try {
|
|
15850
15898
|
const args = { path: path6 };
|
|
15851
|
-
const result = await this.session.callMcpTool(
|
|
15899
|
+
const result = await this.session.callMcpTool(
|
|
15900
|
+
"get_file_change",
|
|
15901
|
+
args,
|
|
15902
|
+
false,
|
|
15903
|
+
"wuying_filesystem"
|
|
15904
|
+
);
|
|
15852
15905
|
if (!result.success) {
|
|
15853
15906
|
return {
|
|
15854
15907
|
requestId: result.requestId,
|
|
@@ -16257,7 +16310,7 @@ var _Mobile = class _Mobile {
|
|
|
16257
16310
|
async tap(x, y) {
|
|
16258
16311
|
const args = { x, y };
|
|
16259
16312
|
try {
|
|
16260
|
-
const result = await this.session.callMcpTool("tap", args);
|
|
16313
|
+
const result = await this.session.callMcpTool("tap", args, false, "wuying_ui");
|
|
16261
16314
|
return {
|
|
16262
16315
|
success: result.success || false,
|
|
16263
16316
|
requestId: result.requestId || "",
|
|
@@ -16297,7 +16350,7 @@ var _Mobile = class _Mobile {
|
|
|
16297
16350
|
async swipe(startX, startY, endX, endY, durationMs = 300) {
|
|
16298
16351
|
const args = { start_x: startX, start_y: startY, end_x: endX, end_y: endY, duration_ms: durationMs };
|
|
16299
16352
|
try {
|
|
16300
|
-
const result = await this.session.callMcpTool("swipe", args);
|
|
16353
|
+
const result = await this.session.callMcpTool("swipe", args, false, "wuying_ui");
|
|
16301
16354
|
return {
|
|
16302
16355
|
success: result.success || false,
|
|
16303
16356
|
requestId: result.requestId || "",
|
|
@@ -16333,7 +16386,7 @@ var _Mobile = class _Mobile {
|
|
|
16333
16386
|
async inputText(text) {
|
|
16334
16387
|
const args = { text };
|
|
16335
16388
|
try {
|
|
16336
|
-
const result = await this.session.callMcpTool("input_text", args);
|
|
16389
|
+
const result = await this.session.callMcpTool("input_text", args, false, "wuying_ui");
|
|
16337
16390
|
return {
|
|
16338
16391
|
success: result.success || false,
|
|
16339
16392
|
requestId: result.requestId || "",
|
|
@@ -16369,7 +16422,7 @@ var _Mobile = class _Mobile {
|
|
|
16369
16422
|
async sendKey(key) {
|
|
16370
16423
|
const args = { key };
|
|
16371
16424
|
try {
|
|
16372
|
-
const result = await this.session.callMcpTool("send_key", args);
|
|
16425
|
+
const result = await this.session.callMcpTool("send_key", args, false, "wuying_ui");
|
|
16373
16426
|
return {
|
|
16374
16427
|
success: result.success || false,
|
|
16375
16428
|
requestId: result.requestId || "",
|
|
@@ -16391,7 +16444,7 @@ var _Mobile = class _Mobile {
|
|
|
16391
16444
|
async getClickableUIElements(timeoutMs = 5e3) {
|
|
16392
16445
|
const args = { timeout_ms: timeoutMs };
|
|
16393
16446
|
try {
|
|
16394
|
-
const result = await this.session.callMcpTool("get_clickable_ui_elements", args);
|
|
16447
|
+
const result = await this.session.callMcpTool("get_clickable_ui_elements", args, false, "wuying_ui");
|
|
16395
16448
|
if (!result.success) {
|
|
16396
16449
|
return {
|
|
16397
16450
|
success: false,
|
|
@@ -16451,7 +16504,7 @@ var _Mobile = class _Mobile {
|
|
|
16451
16504
|
const formatNorm = (format || "json").trim().toLowerCase() || "json";
|
|
16452
16505
|
const args = { timeout_ms: timeoutMs, format: formatNorm };
|
|
16453
16506
|
try {
|
|
16454
|
-
const result = await this.session.callMcpTool("get_all_ui_elements", args);
|
|
16507
|
+
const result = await this.session.callMcpTool("get_all_ui_elements", args, false, "wuying_ui");
|
|
16455
16508
|
if (!result.success) {
|
|
16456
16509
|
return {
|
|
16457
16510
|
success: false,
|
|
@@ -16530,7 +16583,7 @@ var _Mobile = class _Mobile {
|
|
|
16530
16583
|
async getInstalledApps(startMenu = false, desktop = true, ignoreSystemApps = true) {
|
|
16531
16584
|
const args = { start_menu: startMenu, desktop, ignore_system_apps: ignoreSystemApps };
|
|
16532
16585
|
try {
|
|
16533
|
-
const result = await this.session.callMcpTool("get_installed_apps", args);
|
|
16586
|
+
const result = await this.session.callMcpTool("get_installed_apps", args, false, "wuying_app");
|
|
16534
16587
|
if (!result.success) {
|
|
16535
16588
|
return {
|
|
16536
16589
|
success: false,
|
|
@@ -16594,7 +16647,7 @@ var _Mobile = class _Mobile {
|
|
|
16594
16647
|
async startApp(startCmd, workDirectory = "", activity = "") {
|
|
16595
16648
|
const args = { start_cmd: startCmd, work_directory: workDirectory, activity };
|
|
16596
16649
|
try {
|
|
16597
|
-
const result = await this.session.callMcpTool("start_app", args);
|
|
16650
|
+
const result = await this.session.callMcpTool("start_app", args, false, "wuying_app");
|
|
16598
16651
|
if (!result.success) {
|
|
16599
16652
|
return {
|
|
16600
16653
|
success: false,
|
|
@@ -16657,7 +16710,7 @@ var _Mobile = class _Mobile {
|
|
|
16657
16710
|
async stopAppByCmd(stopCmd) {
|
|
16658
16711
|
const args = { stop_cmd: stopCmd };
|
|
16659
16712
|
try {
|
|
16660
|
-
const result = await this.session.callMcpTool("stop_app_by_cmd", args);
|
|
16713
|
+
const result = await this.session.callMcpTool("stop_app_by_cmd", args, false, "wuying_app");
|
|
16661
16714
|
return {
|
|
16662
16715
|
success: result.success || false,
|
|
16663
16716
|
requestId: result.requestId || "",
|
|
@@ -16691,7 +16744,7 @@ var _Mobile = class _Mobile {
|
|
|
16691
16744
|
*/
|
|
16692
16745
|
async screenshot() {
|
|
16693
16746
|
try {
|
|
16694
|
-
const result = await this.session.callMcpTool("system_screenshot", {});
|
|
16747
|
+
const result = await this.session.callMcpTool("system_screenshot", {}, false, "mcp-server");
|
|
16695
16748
|
if (!result.success) {
|
|
16696
16749
|
return {
|
|
16697
16750
|
success: false,
|
|
@@ -16722,7 +16775,7 @@ var _Mobile = class _Mobile {
|
|
|
16722
16775
|
*/
|
|
16723
16776
|
async betaTakeScreenshot() {
|
|
16724
16777
|
try {
|
|
16725
|
-
const result = await this.session.callMcpTool("screenshot", { format: "png" });
|
|
16778
|
+
const result = await this.session.callMcpTool("screenshot", { format: "png" }, false, "wuying_capture");
|
|
16726
16779
|
const requestId = result.requestId || "";
|
|
16727
16780
|
if (!result.success) {
|
|
16728
16781
|
return {
|
|
@@ -16797,7 +16850,7 @@ var _Mobile = class _Mobile {
|
|
|
16797
16850
|
if (quality !== void 0) {
|
|
16798
16851
|
args.quality = quality;
|
|
16799
16852
|
}
|
|
16800
|
-
const result = await this.session.callMcpTool("long_screenshot", args);
|
|
16853
|
+
const result = await this.session.callMcpTool("long_screenshot", args, false, "wuying_capture");
|
|
16801
16854
|
const requestId = result.requestId || "";
|
|
16802
16855
|
if (!result.success) {
|
|
16803
16856
|
return {
|
|
@@ -17211,7 +17264,12 @@ var _Oss = class _Oss {
|
|
|
17211
17264
|
endpoint: endpoint || "",
|
|
17212
17265
|
region: region || ""
|
|
17213
17266
|
};
|
|
17214
|
-
const result = await this.session.callMcpTool(
|
|
17267
|
+
const result = await this.session.callMcpTool(
|
|
17268
|
+
"oss_env_init",
|
|
17269
|
+
args,
|
|
17270
|
+
false,
|
|
17271
|
+
"wuying_oss"
|
|
17272
|
+
);
|
|
17215
17273
|
if (result.success) {
|
|
17216
17274
|
if (result.data) {
|
|
17217
17275
|
const clientConfigRaw = result.data;
|
|
@@ -17283,7 +17341,12 @@ var _Oss = class _Oss {
|
|
|
17283
17341
|
object,
|
|
17284
17342
|
path: path6
|
|
17285
17343
|
};
|
|
17286
|
-
const result = await this.session.callMcpTool(
|
|
17344
|
+
const result = await this.session.callMcpTool(
|
|
17345
|
+
"oss_upload",
|
|
17346
|
+
args,
|
|
17347
|
+
false,
|
|
17348
|
+
"wuying_oss"
|
|
17349
|
+
);
|
|
17287
17350
|
return {
|
|
17288
17351
|
requestId: result.requestId,
|
|
17289
17352
|
success: result.success,
|
|
@@ -17325,7 +17388,12 @@ var _Oss = class _Oss {
|
|
|
17325
17388
|
url,
|
|
17326
17389
|
path: path6
|
|
17327
17390
|
};
|
|
17328
|
-
const result = await this.session.callMcpTool(
|
|
17391
|
+
const result = await this.session.callMcpTool(
|
|
17392
|
+
"oss_upload_annon",
|
|
17393
|
+
args,
|
|
17394
|
+
false,
|
|
17395
|
+
"wuying_oss"
|
|
17396
|
+
);
|
|
17329
17397
|
return {
|
|
17330
17398
|
requestId: result.requestId,
|
|
17331
17399
|
success: result.success,
|
|
@@ -17370,7 +17438,12 @@ var _Oss = class _Oss {
|
|
|
17370
17438
|
object,
|
|
17371
17439
|
path: path6
|
|
17372
17440
|
};
|
|
17373
|
-
const result = await this.session.callMcpTool(
|
|
17441
|
+
const result = await this.session.callMcpTool(
|
|
17442
|
+
"oss_download",
|
|
17443
|
+
args,
|
|
17444
|
+
false,
|
|
17445
|
+
"wuying_oss"
|
|
17446
|
+
);
|
|
17374
17447
|
return {
|
|
17375
17448
|
requestId: result.requestId,
|
|
17376
17449
|
success: result.success,
|
|
@@ -17412,7 +17485,12 @@ var _Oss = class _Oss {
|
|
|
17412
17485
|
url,
|
|
17413
17486
|
path: path6
|
|
17414
17487
|
};
|
|
17415
|
-
const result = await this.session.callMcpTool(
|
|
17488
|
+
const result = await this.session.callMcpTool(
|
|
17489
|
+
"oss_download_annon",
|
|
17490
|
+
args,
|
|
17491
|
+
false,
|
|
17492
|
+
"wuying_oss"
|
|
17493
|
+
);
|
|
17416
17494
|
return {
|
|
17417
17495
|
requestId: result.requestId,
|
|
17418
17496
|
success: result.success,
|
|
@@ -17448,6 +17526,7 @@ var _SessionInfoClass = class _SessionInfoClass {
|
|
|
17448
17526
|
_chunkJB6CNGN4cjs.__name.call(void 0, _SessionInfoClass, "SessionInfoClass");
|
|
17449
17527
|
var SessionInfoClass = _SessionInfoClass;
|
|
17450
17528
|
var _Session = class _Session {
|
|
17529
|
+
// MCP tools list is intentionally not stored in Session.
|
|
17451
17530
|
/**
|
|
17452
17531
|
* Initialize a Session object.
|
|
17453
17532
|
*
|
|
@@ -17470,8 +17549,6 @@ var _Session = class _Session {
|
|
|
17470
17549
|
this.resourceUrl = "";
|
|
17471
17550
|
// Recording functionality
|
|
17472
17551
|
this.enableBrowserReplay = false;
|
|
17473
|
-
// MCP tools available for this session
|
|
17474
|
-
this.mcpTools = [];
|
|
17475
17552
|
this.agentBay = agentBay;
|
|
17476
17553
|
this.sessionId = sessionId;
|
|
17477
17554
|
this.fileSystem = new FileSystem(this);
|
|
@@ -17654,21 +17731,6 @@ var _Session = class _Session {
|
|
|
17654
17731
|
getLinkUrl() {
|
|
17655
17732
|
return this.linkUrl;
|
|
17656
17733
|
}
|
|
17657
|
-
/**
|
|
17658
|
-
* Find the server that provides the given tool.
|
|
17659
|
-
*
|
|
17660
|
-
* @param toolName - Name of the tool to find
|
|
17661
|
-
* @returns The server name that provides the tool, or empty string if not found
|
|
17662
|
-
* @internal
|
|
17663
|
-
*/
|
|
17664
|
-
findServerForTool(toolName) {
|
|
17665
|
-
for (const tool of this.mcpTools) {
|
|
17666
|
-
if (tool.name === toolName) {
|
|
17667
|
-
return tool.server;
|
|
17668
|
-
}
|
|
17669
|
-
}
|
|
17670
|
-
return "";
|
|
17671
|
-
}
|
|
17672
17734
|
/**
|
|
17673
17735
|
* Delete this session.
|
|
17674
17736
|
*
|
|
@@ -18347,7 +18409,6 @@ var _Session = class _Session {
|
|
|
18347
18409
|
logError(`Error unmarshaling tools data: ${error}`);
|
|
18348
18410
|
}
|
|
18349
18411
|
}
|
|
18350
|
-
this.mcpTools = tools;
|
|
18351
18412
|
const keyFields = {
|
|
18352
18413
|
image_id: imageId,
|
|
18353
18414
|
tool_count: tools.length
|
|
@@ -18389,7 +18450,7 @@ var _Session = class _Session {
|
|
|
18389
18450
|
* For press_keys tool, key names are automatically normalized to correct case format.
|
|
18390
18451
|
* This improves case compatibility (e.g., "CTRL" -> "Ctrl", "tab" -> "Tab").
|
|
18391
18452
|
*/
|
|
18392
|
-
async callMcpTool(toolName, args, autoGenSession = false) {
|
|
18453
|
+
async callMcpTool(toolName, args, autoGenSession = false, serverName) {
|
|
18393
18454
|
try {
|
|
18394
18455
|
if (toolName === "press_keys" && args && Array.isArray(args.keys)) {
|
|
18395
18456
|
const { normalizeKeys } = await Promise.resolve().then(() => _interopRequireWildcard(require("./key-normalizer-GGJR2Y35.cjs")));
|
|
@@ -18399,10 +18460,10 @@ var _Session = class _Session {
|
|
|
18399
18460
|
}
|
|
18400
18461
|
const argsJSON = JSON.stringify(args);
|
|
18401
18462
|
if (this.getLinkUrl() && this.getToken()) {
|
|
18402
|
-
return await this.callMcpToolLinkUrl(toolName, args);
|
|
18463
|
+
return await this.callMcpToolLinkUrl(toolName, args, serverName);
|
|
18403
18464
|
}
|
|
18404
18465
|
if (this.isVpcEnabled()) {
|
|
18405
|
-
const server =
|
|
18466
|
+
const server = serverName || "";
|
|
18406
18467
|
if (!server) {
|
|
18407
18468
|
return {
|
|
18408
18469
|
success: false,
|
|
@@ -18565,8 +18626,8 @@ var _Session = class _Session {
|
|
|
18565
18626
|
};
|
|
18566
18627
|
}
|
|
18567
18628
|
}
|
|
18568
|
-
async callMcpToolLinkUrl(toolName, args) {
|
|
18569
|
-
const server =
|
|
18629
|
+
async callMcpToolLinkUrl(toolName, args, serverName) {
|
|
18630
|
+
const server = serverName || "";
|
|
18570
18631
|
if (!server) {
|
|
18571
18632
|
return {
|
|
18572
18633
|
success: false,
|
|
@@ -18713,7 +18774,7 @@ var _Session = class _Session {
|
|
|
18713
18774
|
* ```
|
|
18714
18775
|
*/
|
|
18715
18776
|
async getMetrics() {
|
|
18716
|
-
const toolResult = await this.callMcpTool("get_metrics", {});
|
|
18777
|
+
const toolResult = await this.callMcpTool("get_metrics", {}, false, "wuying_system");
|
|
18717
18778
|
const requestId = toolResult.requestId || "";
|
|
18718
18779
|
if (!toolResult.success) {
|
|
18719
18780
|
return {
|
|
@@ -19596,38 +19657,6 @@ var _AgentBay = class _AgentBay {
|
|
|
19596
19657
|
logError(`Warning: Failed to apply mobile configuration: ${error}`);
|
|
19597
19658
|
}
|
|
19598
19659
|
}
|
|
19599
|
-
const toolListStr = data.toolList;
|
|
19600
|
-
if (toolListStr) {
|
|
19601
|
-
try {
|
|
19602
|
-
const toolsData = JSON.parse(toolListStr);
|
|
19603
|
-
const tools = [];
|
|
19604
|
-
if (Array.isArray(toolsData)) {
|
|
19605
|
-
for (const toolData of toolsData) {
|
|
19606
|
-
tools.push({
|
|
19607
|
-
name: toolData["name"] || "",
|
|
19608
|
-
description: toolData["description"] || "",
|
|
19609
|
-
inputSchema: toolData["inputSchema"] || {},
|
|
19610
|
-
server: toolData["server"] || "",
|
|
19611
|
-
tool: toolData["tool"] || ""
|
|
19612
|
-
});
|
|
19613
|
-
}
|
|
19614
|
-
}
|
|
19615
|
-
session.mcpTools = tools;
|
|
19616
|
-
} catch (error) {
|
|
19617
|
-
logError(`Warning: Failed to parse toolList from CreateMcpSession: ${error}`);
|
|
19618
|
-
}
|
|
19619
|
-
}
|
|
19620
|
-
if (paramsCopy.isVpc && session.mcpTools.length === 0) {
|
|
19621
|
-
logDebug("VPC session detected, automatically fetching MCP tools...");
|
|
19622
|
-
try {
|
|
19623
|
-
const toolsResult = await session.listMcpTools();
|
|
19624
|
-
logDebug(
|
|
19625
|
-
`Successfully fetched ${toolsResult.tools.length} MCP tools for VPC session (RequestID: ${toolsResult.requestId})`
|
|
19626
|
-
);
|
|
19627
|
-
} catch (error) {
|
|
19628
|
-
logError(`Warning: Failed to fetch MCP tools for VPC session: ${error}`);
|
|
19629
|
-
}
|
|
19630
|
-
}
|
|
19631
19660
|
if (needsContextSync) {
|
|
19632
19661
|
logDebug("Waiting for context synchronization to complete...");
|
|
19633
19662
|
const maxRetries = 150;
|
|
@@ -21806,7 +21835,7 @@ var _LocalSession = class _LocalSession extends Session {
|
|
|
21806
21835
|
/**
|
|
21807
21836
|
* Call MCP tool asynchronously
|
|
21808
21837
|
*/
|
|
21809
|
-
async callMcpTool(toolName, args, autoGenSession = false) {
|
|
21838
|
+
async callMcpTool(toolName, args, autoGenSession = false, serverName) {
|
|
21810
21839
|
const localAgent = this.browser.agent;
|
|
21811
21840
|
const result = await localAgent._callMcpToolAsync(toolName, args);
|
|
21812
21841
|
return {
|