myagent-ai 1.33.1 → 1.47.5

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.
Files changed (71) hide show
  1. package/Dockerfile +35 -1
  2. package/agents/base.py +12 -4
  3. package/agents/main_agent.py +615 -1027
  4. package/agents/memory_agent.py +18 -23
  5. package/aiskills/browser_stealth.py +1381 -104
  6. package/aiskills/chromedev_mcp.py +123 -50
  7. package/aiskills/gui_skill.py +96 -70
  8. package/aiskills/pdf_skill.py +95 -11
  9. package/aiskills/registry.py +9 -8
  10. package/aiskills/search_skill.py +26 -0
  11. package/aiskills/site-douyin/SKILL.md +0 -0
  12. package/aiskills/site-gmail/SKILL.md +0 -0
  13. package/aiskills/site-mail139/SKILL.md +0 -0
  14. package/aiskills/site-operations/SKILL.md +0 -0
  15. package/aiskills/site-wechat-mp/SKILL.md +0 -0
  16. package/aiskills/site-weibo/SKILL.md +0 -0
  17. package/aiskills/site-x-com/SKILL.md +0 -0
  18. package/aiskills/stealth_browser/SKILL.md +0 -0
  19. package/aiskills/task_plan_skill.py +210 -0
  20. package/aiskills/workflow_skill.py +476 -0
  21. package/chatbot/base.py +2 -0
  22. package/communication/channel.py +10 -2
  23. package/communication/crypto.py +0 -1
  24. package/communication/manager.py +13 -21
  25. package/communication/peer.py +9 -10
  26. package/config.py +3 -0
  27. package/core/agent_storage.py +266 -15
  28. package/core/browser_profile.py +0 -0
  29. package/core/context_builder.py +58 -18
  30. package/core/context_manager.py +48 -20
  31. package/core/env_detect.py +229 -0
  32. package/core/llm.py +10 -3
  33. package/core/output_parser.py +32 -73
  34. package/core/site_registry.py +0 -0
  35. package/core/tool_dispatcher.py +229 -5
  36. package/core/utils.py +17 -2
  37. package/core/vnc_manager.py +4489 -550
  38. package/core/web_control.py +1 -1
  39. package/core/workflow_engine.py +6 -4
  40. package/departments/manager.py +20 -0
  41. package/executor/engine.py +6 -4
  42. package/groups/manager.py +115 -96
  43. package/install/setup-termux-vnc.sh +0 -0
  44. package/knowledge/rag.py +11 -3
  45. package/main.py +78 -1
  46. package/memory/manager.py +276 -132
  47. package/package.json +1 -1
  48. package/start.bat +84 -0
  49. package/tray-requirements.txt +3 -0
  50. package/tray_manager.py +600 -0
  51. package/web/api_server.py +2329 -607
  52. package/web/ui/admin/admin-agentchat.js +1 -1
  53. package/web/ui/admin/admin-agents.js +2 -5
  54. package/web/ui/admin/admin-core.js +1 -1
  55. package/web/ui/admin/admin-llm.js +18 -15
  56. package/web/ui/admin/admin-platforms.js +1 -1
  57. package/web/ui/admin/admin-sites.js +13 -18
  58. package/web/ui/admin/admin-system.js +90 -0
  59. package/web/ui/admin/admin-workflows.js +0 -0
  60. package/web/ui/chat/chat.css +60 -5
  61. package/web/ui/chat/chat.js +2 -2
  62. package/web/ui/chat/chat_container.html +8 -28
  63. package/web/ui/chat/chat_main.js +304 -269
  64. package/web/ui/chat/flow_engine.js +489 -1515
  65. package/web/ui/chat/groupchat.js +0 -2
  66. package/worklog.md +58 -29
  67. package/download/README.md +0 -1
  68. package/web/ui/chat/left_sessions.html +0 -54
  69. package/web/ui/chat/middle_chat.html +0 -162
  70. package/web/ui/chat/right_agents.html +0 -70
  71. package/worklog-v1.22.md +0 -12
package/Dockerfile CHANGED
@@ -6,6 +6,7 @@ WORKDIR /app
6
6
 
7
7
  # 安装系统依赖
8
8
  # [v1.16.18] 包含 poppler-utils (PDF提取)、Chrome 共享库 (浏览器自动化)
9
+ # [v1.33.4] 包含 VNC 远程桌面依赖 + Chromium 浏览器 + 中文字体
9
10
  RUN apt-get update && apt-get install -y --no-install-recommends \
10
11
  python3-pip \
11
12
  poppler-utils \
@@ -25,14 +26,47 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
25
26
  libcairo2 \
26
27
  libasound2 \
27
28
  libatspi2.0-0 \
29
+ libxshmfence1 \
30
+ libx11-xcb1 \
31
+ libxcb-dri3-0 \
32
+ fonts-liberation \
33
+ xdg-utils \
28
34
  # Node.js (浏览器自动化 MCP 需要)
29
35
  nodejs \
30
36
  npm \
37
+ # VNC 远程桌面依赖
38
+ xvfb \
39
+ x11vnc \
40
+ fluxbox \
41
+ xterm \
42
+ x11-xserver-utils \
43
+ xdotool \
44
+ xsetroot \
45
+ ffmpeg \
46
+ procps \
47
+ psmisc \
48
+ # Chromium 浏览器 (VNC 桌面可用)
49
+ chromium \
50
+ # 中文字体
51
+ fonts-noto-cjk \
52
+ fonts-wqy-zenhei \
31
53
  && rm -rf /var/lib/apt/lists/*
32
54
 
33
- # 安装 Puppeteer Chrome (自包含,容器环境最可靠)
55
+ # Chromium 创建无沙箱包装脚本(容器/proot 环境必需)
56
+ RUN BROWSER_PATH=$(which chromium || which chromium-browser || true) \
57
+ && if [ -n "$BROWSER_PATH" ]; then \
58
+ REAL_PATH=$(readlink -f "$BROWSER_PATH" 2>/dev/null || echo "$BROWSER_PATH"); \
59
+ mv "$BROWSER_PATH" "${BROWSER_PATH}.real" 2>/dev/null || true; \
60
+ printf '#!/bin/bash\nexec %s --no-sandbox --disable-gpu --disable-dev-shm-usage "$@"\n' "$REAL_PATH" > "$BROWSER_PATH"; \
61
+ chmod +x "$BROWSER_PATH"; \
62
+ fi
63
+
64
+ # 安装 Puppeteer 的 Chrome (自包含,浏览器自动化场景使用)
34
65
  RUN npx -y puppeteer browsers install chrome@stable || true
35
66
 
67
+ # 安装 websockify (VNC WebSocket 代理)
68
+ RUN pip install --no-cache-dir websockify || true
69
+
36
70
  # 安装 Python 依赖
37
71
  COPY requirements.txt .
38
72
  RUN pip install --no-cache-dir -r requirements.txt
package/agents/base.py CHANGED
@@ -111,7 +111,7 @@ class BaseAgent(ABC):
111
111
  logger.error(f"{self.name} LLM 调用失败: {response.error}")
112
112
  return response
113
113
 
114
- async def _call_llm_stream(self, messages, tools=None, stream_response=None, text_delta_callback=None, **kwargs):
114
+ async def _call_llm_stream(self, messages, tools=None, stream_response=None, text_delta_callback=None, reasoning_delta_callback=None, **kwargs):
115
115
  """调用LLM并流式输出token到SSE response
116
116
 
117
117
  当 stream_response 提供时,逐 token 将内容写入 SSE 流。
@@ -121,6 +121,8 @@ class BaseAgent(ABC):
121
121
  text_delta_callback: 可选的回调函数 async (full_text_so_far, delta_text) -> None
122
122
  当提供时,不再自动发送 text_delta SSE 事件,而是调用此回调。
123
123
  回调可以自行决定如何处理文本增量(如过滤 JSON、提取 thought 等)。
124
+ reasoning_delta_callback: 可选的推理增量回调 async (full_reasoning_so_far, delta_text) -> None
125
+ 专门用于处理模型的推理内容(thinking/reasoning tokens)。
124
126
  """
125
127
  if not self.llm:
126
128
  return LLMResponse(success=False, error="LLM 未初始化")
@@ -179,6 +181,9 @@ class BaseAgent(ABC):
179
181
  nonlocal full_reasoning
180
182
  full_reasoning += delta_text
181
183
  await _write_sse({"type": "reasoning_delta", "content": delta_text})
184
+ # 同时调用 reasoning_delta_callback(如果提供)
185
+ if reasoning_delta_callback:
186
+ await reasoning_delta_callback(full_reasoning, delta_text)
182
187
 
183
188
  try:
184
189
  if self.llm.provider in self.llm._OPENAI_COMPATIBLE_PROVIDERS or self.llm.provider == "zhipu":
@@ -350,10 +355,13 @@ class BaseAgent(ABC):
350
355
  final_tool_calls = []
351
356
  for idx in sorted(tool_calls_acc.keys()):
352
357
  tc = tool_calls_acc[idx]
358
+ _raw_args = tc["arguments"] if tc["arguments"] else "{}"
353
359
  try:
354
- args = json.loads(tc["arguments"]) if tc["arguments"] else {}
355
- except json.JSONDecodeError:
356
- args = {}
360
+ args = json.loads(_raw_args) if _raw_args else {}
361
+ except (json.JSONDecodeError, TypeError):
362
+ # [v1.39] JSON解析失败时保留原始字符串,不静默丢弃
363
+ logger.warning(f"streaming tool_call arguments JSON解析失败: {_raw_args[:200]}")
364
+ args = {"raw_input": _raw_args}
357
365
  final_tool_calls.append({
358
366
  "id": tc["id"],
359
367
  "name": tc["name"],