myagent-ai 1.23.25 → 1.23.26
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/core/tool_dispatcher.py +9 -4
- package/package.json +1 -1
- package/web/api_server.py +51 -43
package/core/tool_dispatcher.py
CHANGED
|
@@ -76,7 +76,9 @@ class ToolDispatcher:
|
|
|
76
76
|
if stream_callback is None:
|
|
77
77
|
return
|
|
78
78
|
import asyncio
|
|
79
|
-
|
|
79
|
+
# [v1.23.25] 用 "data" 键包裹 payload,与 file_send.py 的格式一致
|
|
80
|
+
# 前端 flow_engine.js 通过 evt.data 访问 payload
|
|
81
|
+
event = {"type": event_type, "data": data}
|
|
80
82
|
try:
|
|
81
83
|
if asyncio.iscoroutinefunction(stream_callback):
|
|
82
84
|
await stream_callback(event)
|
|
@@ -117,8 +119,13 @@ class ToolDispatcher:
|
|
|
117
119
|
# ── [v1.23.0] 已迁移为内部服务/CLI 子命令的工具 ──
|
|
118
120
|
elif tool_name == "recall_memory":
|
|
119
121
|
return {"success": False, "error": "'recall_memory' 已迁移,请通过 <recall> 标签或 CLI 调用: command {\"command\": \"myagent-ai memory --keyword xxx\"}"}
|
|
122
|
+
|
|
123
|
+
# ── [v1.23.25] 恢复 playaudio/playvideo/file_send 直接工具调用 ──
|
|
124
|
+
# 原因: CLI 迁移后 LLM 不稳定地使用 command 包裹,导致工具经常失败
|
|
120
125
|
elif tool_name in ("playaudio", "playvideo"):
|
|
121
|
-
return
|
|
126
|
+
return await self._exec_media(tool_name, params, task_id, stream_callback, sent_files)
|
|
127
|
+
elif tool_name == "file_send":
|
|
128
|
+
return await self._exec_file_send(params, task_id, stream_callback, sent_files)
|
|
122
129
|
|
|
123
130
|
# ── [v1.23.0] 已迁移为 CLI 子命令的工具 — 提示使用 command 调用 ──
|
|
124
131
|
elif tool_name in ("image_ocr", "ocr"):
|
|
@@ -127,8 +134,6 @@ class ToolDispatcher:
|
|
|
127
134
|
return {"success": False, "error": f"'{tool_name}' 已迁移为 CLI 命令,请使用: command {{\"command\": \"myagent-ai analyze-image <image_path>\"}}"}
|
|
128
135
|
elif tool_name in ("audio_transcribe", "transcribe"):
|
|
129
136
|
return {"success": False, "error": f"'{tool_name}' 已迁移为 CLI 命令,请使用: command {{\"command\": \"myagent-ai transcribe <audio_path>\"}}"}
|
|
130
|
-
elif tool_name == "file_send":
|
|
131
|
-
return {"success": False, "error": "'file_send' 已迁移为 CLI 命令,请使用: command {\"command\": \"myagent-ai send-file <path>\"}"}
|
|
132
137
|
|
|
133
138
|
# ── 兜底: SkillRegistry ──
|
|
134
139
|
if self.skills:
|
package/package.json
CHANGED
package/web/api_server.py
CHANGED
|
@@ -1033,10 +1033,14 @@ async function loadLocalNoVNC() {{
|
|
|
1033
1033
|
function stripJs(p) {{ return p.endsWith('.js') ? p.slice(0, -3) : p; }}
|
|
1034
1034
|
|
|
1035
1035
|
// 加载并注册单个模块
|
|
1036
|
+
// [v1.23.25] modId 使用完整路径(含 lib/ 前缀)保证 Babel 相对路径解析正确,
|
|
1037
|
+
// fetchPath 剥离 lib/ 前缀用于 URL 请求(basePath 已含 /vnc/lib/)
|
|
1036
1038
|
async function loadModule(filePath) {{
|
|
1037
|
-
const modId = stripJs(filePath);
|
|
1039
|
+
const modId = stripJs(filePath); // e.g. "lib/deflator" or "vendor/pako/lib/zlib/zstream"
|
|
1038
1040
|
if (_modules[modId]) return _modules[modId]; // 已加载
|
|
1039
|
-
|
|
1041
|
+
// strip leading "lib/" for fetch URL since basePath is already "/vnc/lib/"
|
|
1042
|
+
const fetchPath = filePath.startsWith('lib/') ? filePath.slice(4) : filePath;
|
|
1043
|
+
const resp = await fetch(basePath + fetchPath);
|
|
1040
1044
|
if (!resp.ok) throw new Error('Failed to fetch ' + filePath + ': ' + resp.status);
|
|
1041
1045
|
const code = await resp.text();
|
|
1042
1046
|
const modExports = {{}};
|
|
@@ -1054,6 +1058,10 @@ async function loadLocalNoVNC() {{
|
|
|
1054
1058
|
}}
|
|
1055
1059
|
|
|
1056
1060
|
// 按依赖顺序加载所有 noVNC 模块
|
|
1061
|
+
// [v1.23.25] 模块 ID 必须保留完整目录路径(lib/ 前缀),
|
|
1062
|
+
// 因为 Babel 编译的 require() 使用相对于原始 lib/ 目录的相对路径。
|
|
1063
|
+
// 例如 deflator.js 中 require("../lib/vendor/pako/...") 需要模块 ID 为 "lib/deflator"
|
|
1064
|
+
// 才能正确解析为 "vendor/pako/..." 而非 "lib/vendor/pako/..."。
|
|
1057
1065
|
const depFiles = [
|
|
1058
1066
|
// pako vendor (zlib 依赖)
|
|
1059
1067
|
'vendor/pako/lib/utils/common.js',
|
|
@@ -1067,53 +1075,53 @@ async function loadLocalNoVNC() {{
|
|
|
1067
1075
|
'vendor/pako/lib/zlib/deflate.js',
|
|
1068
1076
|
'vendor/pako/lib/zlib/gzheader.js',
|
|
1069
1077
|
'vendor/pako/lib/zlib/zstream.js',
|
|
1070
|
-
// noVNC core
|
|
1071
|
-
'util/logging.js',
|
|
1072
|
-
'util/events.js',
|
|
1073
|
-
'util/eventtarget.js',
|
|
1074
|
-
'util/strings.js',
|
|
1075
|
-
'util/browser.js',
|
|
1076
|
-
'util/int.js',
|
|
1077
|
-
'util/element.js',
|
|
1078
|
-
'util/cursor.js',
|
|
1079
|
-
'base64.js',
|
|
1080
|
-
'websock.js',
|
|
1081
|
-
'display.js',
|
|
1082
|
-
'inflator.js',
|
|
1083
|
-
'deflator.js',
|
|
1084
|
-
'decoders/copyrect.js',
|
|
1085
|
-
'decoders/raw.js',
|
|
1086
|
-
'decoders/rre.js',
|
|
1087
|
-
'decoders/hextile.js',
|
|
1088
|
-
'decoders/tight.js',
|
|
1089
|
-
'decoders/tightpng.js',
|
|
1090
|
-
'decoders/zrle.js',
|
|
1091
|
-
'decoders/jpeg.js',
|
|
1092
|
-
'encodings.js',
|
|
1093
|
-
'input/keysymdef.js',
|
|
1094
|
-
'input/keysym.js',
|
|
1095
|
-
'input/xtscancodes.js',
|
|
1096
|
-
'input/vkeys.js',
|
|
1097
|
-
'input/fixedkeys.js',
|
|
1098
|
-
'input/domkeytable.js',
|
|
1099
|
-
'input/util.js',
|
|
1100
|
-
'input/keyboard.js',
|
|
1101
|
-
'input/gesturehandler.js',
|
|
1078
|
+
// noVNC core — 使用 lib/ 前缀保持目录结构
|
|
1079
|
+
'lib/util/logging.js',
|
|
1080
|
+
'lib/util/events.js',
|
|
1081
|
+
'lib/util/eventtarget.js',
|
|
1082
|
+
'lib/util/strings.js',
|
|
1083
|
+
'lib/util/browser.js',
|
|
1084
|
+
'lib/util/int.js',
|
|
1085
|
+
'lib/util/element.js',
|
|
1086
|
+
'lib/util/cursor.js',
|
|
1087
|
+
'lib/base64.js',
|
|
1088
|
+
'lib/websock.js',
|
|
1089
|
+
'lib/display.js',
|
|
1090
|
+
'lib/inflator.js',
|
|
1091
|
+
'lib/deflator.js',
|
|
1092
|
+
'lib/decoders/copyrect.js',
|
|
1093
|
+
'lib/decoders/raw.js',
|
|
1094
|
+
'lib/decoders/rre.js',
|
|
1095
|
+
'lib/decoders/hextile.js',
|
|
1096
|
+
'lib/decoders/tight.js',
|
|
1097
|
+
'lib/decoders/tightpng.js',
|
|
1098
|
+
'lib/decoders/zrle.js',
|
|
1099
|
+
'lib/decoders/jpeg.js',
|
|
1100
|
+
'lib/encodings.js',
|
|
1101
|
+
'lib/input/keysymdef.js',
|
|
1102
|
+
'lib/input/keysym.js',
|
|
1103
|
+
'lib/input/xtscancodes.js',
|
|
1104
|
+
'lib/input/vkeys.js',
|
|
1105
|
+
'lib/input/fixedkeys.js',
|
|
1106
|
+
'lib/input/domkeytable.js',
|
|
1107
|
+
'lib/input/util.js',
|
|
1108
|
+
'lib/input/keyboard.js',
|
|
1109
|
+
'lib/input/gesturehandler.js',
|
|
1102
1110
|
// crypto (rfb.js → ra2.js → crypto/)
|
|
1103
|
-
'crypto/bigint.js',
|
|
1104
|
-
'crypto/dh.js',
|
|
1105
|
-
'crypto/md5.js',
|
|
1106
|
-
'crypto/des.js',
|
|
1107
|
-
'crypto/aes.js',
|
|
1108
|
-
'crypto/rsa.js',
|
|
1109
|
-
'crypto/crypto.js',
|
|
1110
|
-
'ra2.js',
|
|
1111
|
+
'lib/crypto/bigint.js',
|
|
1112
|
+
'lib/crypto/dh.js',
|
|
1113
|
+
'lib/crypto/md5.js',
|
|
1114
|
+
'lib/crypto/des.js',
|
|
1115
|
+
'lib/crypto/aes.js',
|
|
1116
|
+
'lib/crypto/rsa.js',
|
|
1117
|
+
'lib/crypto/crypto.js',
|
|
1118
|
+
'lib/ra2.js',
|
|
1111
1119
|
];
|
|
1112
1120
|
for (const file of depFiles) {{
|
|
1113
1121
|
await loadModule(file);
|
|
1114
1122
|
}}
|
|
1115
1123
|
// 最后加载 rfb.js
|
|
1116
|
-
const rfbExports = await loadModule('rfb.js');
|
|
1124
|
+
const rfbExports = await loadModule('lib/rfb.js');
|
|
1117
1125
|
return rfbExports.default || rfbExports;
|
|
1118
1126
|
}}
|
|
1119
1127
|
</script>
|