myagent-ai 1.3.2 → 1.3.4

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/version.py CHANGED
@@ -11,7 +11,7 @@ import subprocess
11
11
  from pathlib import Path
12
12
 
13
13
  # ── 基线版本(与 setup.py / package.json 保持一致) ──
14
- BASE_VERSION = "1.3.2"
14
+ BASE_VERSION = "1.3.4"
15
15
 
16
16
 
17
17
  def _version_from_git() -> str:
@@ -9,7 +9,7 @@ param(
9
9
 
10
10
  $ErrorActionPreference = "Stop"
11
11
  $PKG_NAME = "myagent-ai"
12
- $PKG_VERSION = "1.3.2"
12
+ $PKG_VERSION = "1.3.4"
13
13
 
14
14
  # Allow running scripts for the current process
15
15
  if ($PSVersionTable.PSVersion.Major -ge 5) {
@@ -57,13 +57,13 @@ function Check-Python {
57
57
  }
58
58
  # 尝试在常见安装路径查找
59
59
  $commonPaths = @(
60
+ "$env:LOCALAPPDATA\Programs\Python\Python314\python.exe",
61
+ "$env:LOCALAPPDATA\Programs\Python\Python313\python.exe",
60
62
  "$env:LOCALAPPDATA\Programs\Python\Python312\python.exe",
61
- "$env:LOCALAPPDATA\Programs\Python\Python311\python.exe",
62
- "$env:LOCALAPPDATA\Programs\Python\Python310\python.exe",
63
- "C:\Python312\python.exe",
64
- "C:\Python311\python.exe",
65
- "C:\Program Files\Python312\python.exe",
66
- "C:\Program Files\Python311\python.exe"
63
+ "C:\Python314\python.exe",
64
+ "C:\Python313\python.exe",
65
+ "C:\Program Files\Python314\python.exe",
66
+ "C:\Program Files\Python313\python.exe"
67
67
  )
68
68
  foreach ($pyPath in $commonPaths) {
69
69
  if (Test-Path $pyPath) {
@@ -79,14 +79,14 @@ function Check-Python {
79
79
  }
80
80
 
81
81
  function Install-Python {
82
- Write-Host "[*] Installing Python 3.12 ..." -ForegroundColor Yellow
82
+ Write-Host "[*] Installing Python 3.14 ..." -ForegroundColor Yellow
83
83
  $installAttempted = $false
84
84
 
85
85
  # Try winget first
86
86
  try {
87
87
  $null = (winget --version 2>$null)
88
88
  Write-Host " Using winget ..." -ForegroundColor Gray
89
- winget install Python.Python.3.12 --accept-package-agreements --accept-source-agreements
89
+ winget install Python.Python.3.14 --accept-package-agreements --accept-source-agreements
90
90
  $installAttempted = $true
91
91
  # 等待安装完成后刷新 PATH(重试多次)
92
92
  for ($i = 1; $i -le 5; $i++) {
@@ -96,9 +96,9 @@ function Install-Python {
96
96
  # winget 已完成安装,即使 Check-Python 失败也不再重复安装
97
97
  Refresh-Path
98
98
  $pyPaths = @(
99
- "$env:LOCALAPPDATA\Programs\Python\Python312\python.exe",
100
- "C:\Python312\python.exe",
101
- "C:\Program Files\Python312\python.exe"
99
+ "$env:LOCALAPPDATA\Programs\Python\Python314\python.exe",
100
+ "C:\Python314\python.exe",
101
+ "C:\Program Files\Python314\python.exe"
102
102
  )
103
103
  foreach ($pyPath in $pyPaths) {
104
104
  if (Test-Path $pyPath) {
@@ -121,11 +121,11 @@ function Install-Python {
121
121
  # 仅在 winget 未尝试时才从 python.org 下载(避免双重安装)
122
122
  if (-not $installAttempted) {
123
123
  # Fallback: download from python.org
124
- $pyUrl = "https://www.python.org/ftp/python/3.12.8/python-3.12.8-amd64.exe"
124
+ $pyUrl = "https://www.python.org/ftp/python/3.14.0/python-3.14.0-amd64.exe"
125
125
  $pyExe = Join-Path $env:TEMP "python-installer.exe"
126
126
 
127
127
  try {
128
- Write-Host " Downloading Python 3.12.8 ..." -ForegroundColor Gray
128
+ Write-Host " Downloading Python 3.14.0 ..." -ForegroundColor Gray
129
129
  Invoke-WebRequest -Uri $pyUrl -OutFile $pyExe -UseBasicParsing
130
130
 
131
131
  Write-Host " Installing (Add to PATH) ..." -ForegroundColor Gray
@@ -21,7 +21,7 @@ NO_DEPS=false
21
21
  DRY_RUN=false
22
22
  SCRIPT_URL="https://raw.githubusercontent.com/ctz168/myagent/main/install/install.sh"
23
23
  PKG_NAME="myagent-ai"
24
- PKG_VERSION="1.3.2"
24
+ PKG_VERSION="1.3.4"
25
25
 
26
26
  for arg in "$@"; do
27
27
  case "$arg" in
@@ -82,7 +82,7 @@ check_python() {
82
82
 
83
83
  # 按优先级尝试多个 Python 命令(包括版本号后缀的)
84
84
  local py_cmd=""
85
- for cmd in python3 python3.12 python3.11 python3.10 python; do
85
+ for cmd in python3 python3.14 python3.13 python3.12 python; do
86
86
  if command -v "$cmd" &>/dev/null; then
87
87
  py_cmd="$cmd"
88
88
  break
@@ -115,7 +115,7 @@ get_python_cmd() {
115
115
  return 0
116
116
  fi
117
117
  hash -r 2>/dev/null || true
118
- for cmd in python3 python3.12 python3.11 python3.10 python; do
118
+ for cmd in python3 python3.14 python3.13 python3.12 python; do
119
119
  if command -v "$cmd" &>/dev/null; then
120
120
  _PYTHON_CMD="$cmd"
121
121
  echo "$cmd"
@@ -127,30 +127,30 @@ get_python_cmd() {
127
127
  }
128
128
 
129
129
  install_python() {
130
- step "Installing Python 3.12 ..."
130
+ step "Installing Python 3.14 ..."
131
131
  local installed=false
132
132
 
133
133
  if [ "$OS" = "macos" ]; then
134
134
  if command -v brew &>/dev/null; then
135
135
  info "Using Homebrew ..."
136
- brew install python@3.12 && installed=true
136
+ brew install python@3.14 && installed=true
137
137
  # brew 安装后更新 PATH 并刷新缓存
138
- export PATH="$(brew --prefix python@3.12)/bin:$PATH"
138
+ export PATH="$(brew --prefix python@3.14)/bin:$PATH"
139
139
  hash -r
140
140
  # 等待文件系统同步(某些情况下 brew 完成后二进制文件不会立即可见)
141
141
  sleep 1
142
142
  if check_python; then return 0; fi
143
143
  # brew 已安装但 python3 软链接可能不存在,尝试手动查找
144
144
  local brew_py
145
- brew_py="$(brew --prefix python@3.12)/bin/python3"
145
+ brew_py="$(brew --prefix python@3.14)/bin/python3"
146
146
  if [ -x "$brew_py" ]; then
147
147
  _PYTHON_CMD="$brew_py"
148
148
  success "Python found at $brew_py"
149
149
  return 0
150
150
  fi
151
151
  # 尝试查找版本化的 python 二进制
152
- for ver in 3.12 3.11 3.10; do
153
- brew_py="$(brew --prefix python@3.12)/bin/python${ver}"
152
+ for ver in 3.14 3.13 3.12; do
153
+ brew_py="$(brew --prefix python@3.14)/bin/python${ver}"
154
154
  if [ -x "$brew_py" ]; then
155
155
  _PYTHON_CMD="$brew_py"
156
156
  success "Python found at $brew_py"
@@ -160,20 +160,20 @@ install_python() {
160
160
  # brew 已成功安装,即使 check_python 失败也不再重复安装
161
161
  if $installed; then
162
162
  warn "Python 已通过 Homebrew 安装,但 python3 命令暂不可用"
163
- info "请重启终端或运行: export PATH=\"$(brew --prefix python@3.12)/bin:\$PATH\""
164
- info "或直接使用: $(brew --prefix python@3.12)/bin/python3"
163
+ info "请重启终端或运行: export PATH=\"$(brew --prefix python@3.14)/bin:\$PATH\""
164
+ info "或直接使用: $(brew --prefix python@3.14)/bin/python3"
165
165
  # 将 brew python 路径设为 _PYTHON_CMD 供后续使用
166
- _PYTHON_CMD="$(brew --prefix python@3.12)/bin/python3"
166
+ _PYTHON_CMD="$(brew --prefix python@3.14)/bin/python3"
167
167
  return 0
168
168
  fi
169
169
  fi
170
170
  # 仅在 brew 未安装时才从 python.org 下载
171
171
  if ! $installed; then
172
- info "Downloading Python 3.12 ..."
173
- curl -fsSL -o /tmp/python.pkg "https://www.python.org/ftp/python/3.12.8/python-3.12.8-macos11.pkg"
172
+ info "Downloading Python 3.14 ..."
173
+ curl -fsSL -o /tmp/python.pkg "https://www.python.org/ftp/python/3.14.0/python-3.14.0-macos11.pkg"
174
174
  sudo installer -pkg /tmp/python.pkg -target /
175
175
  rm -f /tmp/python.pkg
176
- export PATH="/Library/Frameworks/Python.framework/Versions/3.12/bin:$PATH"
176
+ export PATH="/Library/Frameworks/Python.framework/Versions/3.14/bin:$PATH"
177
177
  hash -r
178
178
  if check_python; then return 0; fi
179
179
  fi
@@ -184,12 +184,12 @@ install_python() {
184
184
  if command -v apt-get &>/dev/null; then
185
185
  info "Using apt ..."
186
186
  sudo apt-get update -qq
187
- sudo apt-get install -y python3.12 python3.12-venv python3-pip 2>/dev/null || \
187
+ sudo apt-get install -y python3.14 python3.14-venv python3-pip 2>/dev/null || \
188
188
  sudo apt-get install -y python3 python3-venv python3-pip
189
189
  hash -r
190
190
  if check_python; then return 0; fi
191
191
  # apt 已安装但可能需要版本化命令
192
- for ver in 3.12 3.11 3.10; do
192
+ for ver in 3.14 3.13 3.12; do
193
193
  if command -v "python${ver}" &>/dev/null; then
194
194
  _PYTHON_CMD="python${ver}"
195
195
  success "Python found as python${ver}"
@@ -200,7 +200,7 @@ install_python() {
200
200
  fi
201
201
  if command -v dnf &>/dev/null; then
202
202
  info "Using dnf ..."
203
- sudo dnf install -y python3.12 2>/dev/null || sudo dnf install -y python3
203
+ sudo dnf install -y python3.14 2>/dev/null || sudo dnf install -y python3
204
204
  hash -r
205
205
  if check_python; then return 0; fi
206
206
  return 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
package/requirements.txt CHANGED
@@ -4,76 +4,54 @@
4
4
  # ============================================================
5
5
  # 核心依赖 (必需)
6
6
  # ============================================================
7
- openai>=1.12.0 # OpenAI GPT 系列 + 兼容API
8
- aiohttp>=3.9.0 # 异步 HTTP (聊天平台接入 + Web服务器)
9
- requests>=2.31.0 # HTTP 请求 (LLM备用、更新检查)
10
-
11
- # ============================================================
12
- # Web 管理后台
13
- # ============================================================
14
- # Web 服务器使用 aiohttp,无额外依赖
15
- # aiohttp 已在核心依赖中
16
-
17
- # ============================================================
18
- # 记忆系统
19
- # ============================================================
20
- # SQLite3 为 Python 内置模块,无需额外安装
21
-
22
- # ============================================================
23
- # 执行引擎
24
- # ============================================================
25
- # subprocess, tempfile 为 Python 内置模块
7
+ openai>=1.12.0
8
+ aiohttp>=3.9.0
9
+ requests>=2.31.0
26
10
 
27
11
  # ============================================================
28
12
  # 技能系统 - 搜索
29
13
  # ============================================================
30
- duckduckgo-search>=6.0.0 # 网络搜索 (无需 API Key)
31
- beautifulsoup4>=4.12.0 # HTML 解析
32
- lxml>=5.0.0 # HTML/XML 高性能解析
33
- psutil>=5.9.0 # 系统信息
14
+ duckduckgo-search>=6.0.0
15
+ beautifulsoup4>=4.12.0
16
+ lxml>=5.0.0
17
+ psutil>=5.9.0
34
18
 
35
19
  # ============================================================
36
20
  # 技能系统 - 浏览器自动化 (Playwright)
37
21
  # ============================================================
38
- playwright>=1.41.0 # 浏览器自动化 (内置技能)
22
+ playwright>=1.41.0
39
23
 
40
24
  # ============================================================
41
25
  # 技能系统 - 桌面 GUI 自动化
42
26
  # ============================================================
43
- pynput>=1.7.6 # 鼠标/键盘控制 (跨平台, ~500KB)
44
- pygetwindow>=0.0.9 # 窗口管理 (Windows + macOS)
45
- mss>=9.0.0 # 屏幕截图 (跨平台, ~1MB)
27
+ pynput>=1.7.6
28
+ pygetwindow>=0.0.9
29
+ mss>=9.0.0
46
30
 
47
31
  # ============================================================
48
32
  # 系统托盘 (默认启用)
49
33
  # ============================================================
50
- pystray>=0.19.5 # 系统托盘图标
51
- Pillow>=10.0.0 # 图标生成
34
+ pystray>=0.19.5
35
+ Pillow>=10.0.0
52
36
 
53
37
  # ============================================================
54
38
  # 聊天平台 (按需使用,默认安装)
55
39
  # ============================================================
56
- python-telegram-bot>=21.0 # Telegram Bot
57
- discord.py>=2.3.0 # Discord Bot
58
- # 飞书/QQ/微信 通过 aiohttp 实现,无需额外安装
40
+ python-telegram-bot>=21.0
41
+ discord.py>=2.3.0
59
42
 
60
43
  # ============================================================
61
44
  # 语音合成 (默认启用)
62
45
  # ============================================================
63
- edge-tts>=6.1.0 # 微软 Edge TTS (免费, 中英文)
46
+ edge-tts>=6.1.0
64
47
 
65
48
  # ============================================================
66
49
  # Anthropic Claude (可选)
67
50
  # ============================================================
68
- anthropic>=0.18.0 # Claude 系列
51
+ anthropic>=0.18.0
69
52
 
70
53
  # ============================================================
71
54
  # Agent 间通信 (可选)
72
55
  # ============================================================
73
- cryptography>=41.0.0 # Ed25519, X25519, AES-256-GCM
74
- websockets>=12.0 # 异步 WebSocket (远程通信)
75
-
76
- # ============================================================
77
- # 打包 (可选, 仅开发用)
78
- # ============================================================
79
- # pyinstaller>=6.0.0 # 打包为 exe/app (按需安装)
56
+ cryptography>=41.0.0
57
+ websockets>=12.0
package/setup.py CHANGED
@@ -9,7 +9,7 @@ from pathlib import Path
9
9
  _version_path = Path(__file__).parent / "core" / "version.py"
10
10
  _version_vars = {}
11
11
  exec(_version_path.read_text(), _version_vars)
12
- __version__ = _version_vars.get("BASE_VERSION", "1.3.2")
12
+ __version__ = _version_vars.get("BASE_VERSION", "1.3.4")
13
13
 
14
14
  setup(
15
15
  name="myagent",
package/start.js CHANGED
@@ -62,8 +62,8 @@ function resolvePackageDir() {
62
62
  // ── 查找 Python ────────────────────────────────────────────
63
63
  function findPython() {
64
64
  const candidates = IS_WIN
65
- ? ["python", "python3", "python3.12", "python3.11", "python3.10"]
66
- : ["python3", "python3.12", "python3.11", "python3.10", "python"];
65
+ ? ["python", "python3", "python3.14", "python3.13", "python3.12", "python3.11"]
66
+ : ["python3", "python3.14", "python3.13", "python3.12", "python"];
67
67
 
68
68
  for (const cmd of candidates) {
69
69
  try {
@@ -96,16 +96,16 @@ function findPythonOnWindows() {
96
96
  const programFilesX86 = process.env["ProgramFiles(x86)"] || "";
97
97
 
98
98
  const searchPaths = [
99
+ path.join(localAppData, "Programs", "Python", "Python314", "python.exe"),
100
+ path.join(localAppData, "Programs", "Python", "Python313", "python.exe"),
99
101
  path.join(localAppData, "Programs", "Python", "Python312", "python.exe"),
100
- path.join(localAppData, "Programs", "Python", "Python311", "python.exe"),
101
- path.join(localAppData, "Programs", "Python", "Python310", "python.exe"),
102
+ path.join(programFiles, "Python314", "python.exe"),
103
+ path.join(programFiles, "Python313", "python.exe"),
102
104
  path.join(programFiles, "Python312", "python.exe"),
103
- path.join(programFiles, "Python311", "python.exe"),
104
- path.join(programFiles, "Python310", "python.exe"),
105
- path.join(programFilesX86, "Python312", "python.exe"),
106
- path.join(programFilesX86, "Python311", "python.exe"),
107
- "C:\\Python312\\python.exe",
108
- "C:\\Python311\\python.exe",
105
+ path.join(programFilesX86, "Python314", "python.exe"),
106
+ path.join(programFilesX86, "Python313", "python.exe"),
107
+ "C:\\Python314\\python.exe",
108
+ "C:\\Python313\\python.exe",
109
109
  ];
110
110
 
111
111
  for (const pyPath of searchPaths) {
@@ -151,6 +151,50 @@ function buildArgs(userArgs) {
151
151
  }
152
152
  }
153
153
 
154
+ // ── Windows: pip 安装依赖(带升级和 fallback) ──────────────
155
+ // 核心依赖包名列表(直接安装,不依赖 requirements.txt 解析)
156
+ const CORE_PACKAGES = [
157
+ "openai>=1.12.0",
158
+ "aiohttp>=3.9.0",
159
+ "requests>=2.31.0",
160
+ "duckduckgo-search>=6.0.0",
161
+ "beautifulsoup4>=4.12.0",
162
+ "lxml>=5.0.0",
163
+ "psutil>=5.9.0",
164
+ ];
165
+
166
+ function pipInstall(pythonCmd, packages, cwd) {
167
+ const args = ["-m", "pip", "install", "--quiet", "--disable-pip-version-check", ...packages];
168
+ return execFileSync(pythonCmd, args, {
169
+ encoding: "utf8",
170
+ stdio: "inherit",
171
+ timeout: 180000,
172
+ cwd,
173
+ });
174
+ }
175
+
176
+ function pipInstallReqFile(pythonCmd, reqFile, cwd) {
177
+ return execFileSync(pythonCmd, ["-m", "pip", "install", "-r", reqFile, "--disable-pip-version-check"], {
178
+ encoding: "utf8",
179
+ stdio: "inherit",
180
+ timeout: 300000,
181
+ cwd,
182
+ });
183
+ }
184
+
185
+ function upgradePip(pythonCmd) {
186
+ try {
187
+ console.log(" \x1b[90m[i]\x1b[0m 升级 pip...");
188
+ execFileSync(pythonCmd, ["-m", "pip", "install", "--upgrade", "pip", "--quiet"], {
189
+ encoding: "utf8",
190
+ stdio: ["pipe", "pipe", "pipe"],
191
+ timeout: 120000,
192
+ });
193
+ } catch (_) {
194
+ // 升级失败不阻断,继续尝试安装
195
+ }
196
+ }
197
+
154
198
  // ── Windows 快速依赖检查 ───────────────────────────────────
155
199
  function checkDepsWin(pkgDir) {
156
200
  const required = ["openai", "aiohttp", "requests"];
@@ -174,28 +218,46 @@ function checkDepsWin(pkgDir) {
174
218
  ["-c", `import ${mod}`],
175
219
  { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 5000, cwd: pkgDir }
176
220
  );
177
- console.log(`\x1b[32m[✓]\x1b[0m ${mod}`);
221
+ console.log(` \x1b[32m[✓]\x1b[0m ${mod}`);
178
222
  } catch (_) {
179
- console.log(`\x1b[33m[!]\x1b[0m ${mod} 未安装`);
223
+ console.log(` \x1b[33m[!]\x1b[0m ${mod}`);
180
224
  missing.push(mod);
181
225
  }
182
226
  }
183
227
 
184
228
  if (missing.length > 0) {
229
+ console.log(`\x1b[33m[!]\x1b[0m 正在安装 ${missing.length} 个缺失依赖...`);
185
230
  const reqFile = path.join(pkgDir, "requirements.txt");
231
+
232
+ // 策略1: 先升级 pip(旧版 pip 无法解析 requirements.txt)
233
+ upgradePip(pythonCmd);
234
+
235
+ // 策略2: 尝试 pip install -r requirements.txt
236
+ let installed = false;
186
237
  if (fs.existsSync(reqFile)) {
187
- console.log(`\x1b[33m[!]\x1b[0m 正在安装 ${missing.length} 个缺失依赖...`);
188
238
  try {
189
- execFileSync(pythonCmd, ["-m", "pip", "install", "-r", reqFile], {
190
- encoding: "utf8",
191
- stdio: "inherit",
192
- timeout: 180000,
193
- cwd: pkgDir,
194
- });
195
- console.log(`\x1b[32m[✓]\x1b[0m 依赖安装完成`);
239
+ pipInstallReqFile(pythonCmd, reqFile, pkgDir);
240
+ console.log(` \x1b[32m[✓]\x1b[0m 依赖安装完成`);
241
+ installed = true;
196
242
  } catch (_) {
197
- console.error(`\x1b[33m[!]\x1b[0m 部分依赖安装失败,请手动运行:`);
198
- console.error(` ${pythonCmd} -m pip install -r "${reqFile}"`);
243
+ // requirements.txt 安装失败,进入 fallback
244
+ console.log(` \x1b[33m[!]\x1b[0m requirements.txt 安装失败,尝试直接安装核心依赖...`);
245
+ }
246
+ }
247
+
248
+ // 策略3: 直接按包名安装核心依赖(不依赖 requirements.txt 解析)
249
+ if (!installed) {
250
+ try {
251
+ pipInstall(pythonCmd, CORE_PACKAGES, pkgDir);
252
+ console.log(` \x1b[32m[✓]\x1b[0m 核心依赖安装完成`);
253
+ console.log(` \x1b[90m[i]\x1b[0m 其他依赖将在 MyAgent 启动时自动安装`);
254
+ } catch (_) {
255
+ console.error(` \x1b[31m[✗]\x1b[0m 依赖安装失败,请手动运行:`);
256
+ console.error(` ${pythonCmd} -m pip install -r "${reqFile}"`);
257
+ console.error(` 或逐个安装:`);
258
+ for (const pkg of CORE_PACKAGES) {
259
+ console.error(` ${pythonCmd} -m pip install ${pkg}`);
260
+ }
199
261
  }
200
262
  }
201
263
  }