myagent-ai 1.2.3 → 1.3.2

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.
@@ -9,7 +9,7 @@ param(
9
9
 
10
10
  $ErrorActionPreference = "Stop"
11
11
  $PKG_NAME = "myagent-ai"
12
- $PKG_VERSION = "1.1.0"
12
+ $PKG_VERSION = "1.3.2"
13
13
 
14
14
  # Allow running scripts for the current process
15
15
  if ($PSVersionTable.PSVersion.Major -ge 5) {
@@ -28,56 +28,117 @@ if ($PSVersionTable.PSVersion.Major -lt 5) {
28
28
  Write-Host "[OK] Windows detected" -ForegroundColor Green
29
29
 
30
30
  # ── Python ───────────────────────────────────────────────
31
+ # 记录已找到的 Python 路径
32
+ $Script:PythonCmd = ""
33
+
34
+ function Refresh-Path {
35
+ # 刷新 PATH(安装后需要刷新才能找到新安装的程序)
36
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
37
+ }
38
+
31
39
  function Check-Python {
40
+ # 刷新 PATH(安装后可能需要刷新)
41
+ Refresh-Path
32
42
  try {
33
43
  $pyVer = (python --version 2>$null)
34
44
  if ($pyVer) {
35
45
  $verNum = [version]($pyVer -replace 'Python\s+(\S+)', '$1')
36
46
  if ($verNum -ge [version]"3.10") {
37
- Write-Host "[OK] Python $($verVer.ToString(3)) found" -ForegroundColor Green
47
+ $Script:PythonCmd = "python"
48
+ Write-Host "[OK] Python $verNum found" -ForegroundColor Green
38
49
  return $true
39
50
  } else {
40
- Write-Host "[!] Python $($verNum.ToString(3)) found, but 3.10+ required" -ForegroundColor Yellow
51
+ Write-Host "[!] Python $verNum found, but 3.10+ required" -ForegroundColor Yellow
41
52
  return $false
42
53
  }
43
54
  }
44
55
  } catch {
45
56
  Write-Host "[!] Python not found" -ForegroundColor Yellow
46
57
  }
58
+ # 尝试在常见安装路径查找
59
+ $commonPaths = @(
60
+ "$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"
67
+ )
68
+ foreach ($pyPath in $commonPaths) {
69
+ if (Test-Path $pyPath) {
70
+ $verNum = (& $pyPath --version 2>$null) -replace 'Python\s+(\S+)', '$1'
71
+ if ($verNum -and [version]$verNum -ge [version]"3.10") {
72
+ $Script:PythonCmd = $pyPath
73
+ Write-Host "[OK] Python $verNum found at $pyPath" -ForegroundColor Green
74
+ return $true
75
+ }
76
+ }
77
+ }
47
78
  return $false
48
79
  }
49
80
 
50
81
  function Install-Python {
51
82
  Write-Host "[*] Installing Python 3.12 ..." -ForegroundColor Yellow
83
+ $installAttempted = $false
52
84
 
53
85
  # Try winget first
54
86
  try {
55
87
  $null = (winget --version 2>$null)
56
88
  Write-Host " Using winget ..." -ForegroundColor Gray
57
89
  winget install Python.Python.3.12 --accept-package-agreements --accept-source-agreements
58
- $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
59
- if (Check-Python) { return }
90
+ $installAttempted = $true
91
+ # 等待安装完成后刷新 PATH(重试多次)
92
+ for ($i = 1; $i -le 5; $i++) {
93
+ Start-Sleep -Seconds 2
94
+ if (Check-Python) { return }
95
+ }
96
+ # winget 已完成安装,即使 Check-Python 失败也不再重复安装
97
+ Refresh-Path
98
+ $pyPaths = @(
99
+ "$env:LOCALAPPDATA\Programs\Python\Python312\python.exe",
100
+ "C:\Python312\python.exe",
101
+ "C:\Program Files\Python312\python.exe"
102
+ )
103
+ foreach ($pyPath in $pyPaths) {
104
+ if (Test-Path $pyPath) {
105
+ $verNum = (& $pyPath --version 2>$null) -replace 'Python\s+(\S+)', '$1'
106
+ if ($verNum) {
107
+ $Script:PythonCmd = $pyPath
108
+ Write-Host "[OK] Python $verNum installed via winget at $pyPath" -ForegroundColor Green
109
+ Write-Host "[i] PATH will be updated after restart. Using direct path for now." -ForegroundColor Gray
110
+ return
111
+ }
112
+ }
113
+ }
114
+ Write-Host "[i] Python was installed via winget but PATH not yet updated." -ForegroundColor Yellow
115
+ Write-Host " Please restart your terminal and run: myagent-ai" -ForegroundColor Yellow
116
+ exit 0
60
117
  } catch {
61
118
  Write-Host " winget not available, downloading ..." -ForegroundColor Gray
62
119
  }
63
120
 
64
- # Fallback: download from python.org
65
- $pyUrl = "https://www.python.org/ftp/python/3.12.8/python-3.12.8-amd64.exe"
66
- $pyExe = Join-Path $env:TEMP "python-installer.exe"
67
-
68
- try {
69
- Write-Host " Downloading Python 3.12.8 ..." -ForegroundColor Gray
70
- Invoke-WebRequest -Uri $pyUrl -OutFile $pyExe -UseBasicParsing
121
+ # 仅在 winget 未尝试时才从 python.org 下载(避免双重安装)
122
+ if (-not $installAttempted) {
123
+ # Fallback: download from python.org
124
+ $pyUrl = "https://www.python.org/ftp/python/3.12.8/python-3.12.8-amd64.exe"
125
+ $pyExe = Join-Path $env:TEMP "python-installer.exe"
71
126
 
72
- Write-Host " Installing (Add to PATH) ..." -ForegroundColor Gray
73
- Start-Process -FilePath $pyExe -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1" -Wait
127
+ try {
128
+ Write-Host " Downloading Python 3.12.8 ..." -ForegroundColor Gray
129
+ Invoke-WebRequest -Uri $pyUrl -OutFile $pyExe -UseBasicParsing
74
130
 
75
- # Refresh PATH
76
- $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
131
+ Write-Host " Installing (Add to PATH) ..." -ForegroundColor Gray
132
+ Start-Process -FilePath $pyExe -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1" -Wait
77
133
 
78
- if (Check-Python) { return }
79
- } finally {
80
- if (Test-Path $pyExe) { Remove-Item -Force $pyExe -ErrorAction SilentlyContinue }
134
+ # 刷新 PATH 并验证(重试多次)
135
+ for ($i = 1; $i -le 5; $i++) {
136
+ Start-Sleep -Seconds 2
137
+ if (Check-Python) { return }
138
+ }
139
+ } finally {
140
+ if (Test-Path $pyExe) { Remove-Item -Force $pyExe -ErrorAction SilentlyContinue }
141
+ }
81
142
  }
82
143
 
83
144
  Write-Host "[x] Failed to install Python." -ForegroundColor Red
@@ -87,6 +148,8 @@ function Install-Python {
87
148
 
88
149
  # ── Node.js ──────────────────────────────────────────────
89
150
  function Check-Node {
151
+ # 刷新 PATH
152
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
90
153
  try {
91
154
  $nodeVer = (node -v 2>$null)
92
155
  if ($nodeVer) {
@@ -112,7 +175,6 @@ function Install-Node {
112
175
  $null = (winget --version 2>$null)
113
176
  Write-Host " Using winget ..." -ForegroundColor Gray
114
177
  winget install OpenJS.NodeJS.LTS --accept-package-agreements --accept-source-agreements
115
- $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
116
178
  if (Check-Node) { return }
117
179
  } catch {
118
180
  Write-Host " winget not available, downloading ..." -ForegroundColor Gray
@@ -129,8 +191,6 @@ function Install-Node {
129
191
  Write-Host " Installing ..." -ForegroundColor Gray
130
192
  Start-Process -FilePath msiexec.exe -ArgumentList "/i `"$nodeMsi`" /quiet /norestart" -Wait
131
193
 
132
- $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
133
-
134
194
  if (Check-Node) { return }
135
195
  } finally {
136
196
  if (Test-Path $nodeMsi) { Remove-Item -Force $nodeMsi -ErrorAction SilentlyContinue }
@@ -158,6 +218,9 @@ function Install-MyAgent {
158
218
 
159
219
  # ── Install Python dependencies ─────────────────────────
160
220
  function Install-PythonDeps {
221
+ # 获取 Python 命令(使用已检测到的路径或默认)
222
+ $pyCmd = if ($Script:PythonCmd) { $Script:PythonCmd } else { "python" }
223
+
161
224
  $npmRoot = (npm root -g 2>$null)
162
225
  $pkgDir = Join-Path $npmRoot $PKG_NAME
163
226
  $reqFile = Join-Path $pkgDir "requirements.txt"
@@ -172,9 +235,10 @@ function Install-PythonDeps {
172
235
  }
173
236
 
174
237
  Write-Host "[*] Installing Python dependencies ..." -ForegroundColor Yellow
175
- pip install -r $reqFile
238
+ Write-Host " Using: $pyCmd" -ForegroundColor Gray
239
+ & $pyCmd -m pip install -r $reqFile
176
240
  if ($LASTEXITCODE -ne 0) {
177
- Write-Host "[!] Some deps failed (non-critical). Try: pip install -r $reqFile" -ForegroundColor Yellow
241
+ Write-Host "[!] Some deps failed (non-critical). Try: $pyCmd -m pip install -r $reqFile" -ForegroundColor Yellow
178
242
  } else {
179
243
  Write-Host "[OK] Python dependencies installed" -ForegroundColor Green
180
244
  }
@@ -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.2.1"
24
+ PKG_VERSION="1.3.2"
25
25
 
26
26
  for arg in "$@"; do
27
27
  case "$arg" in
@@ -73,43 +73,111 @@ if $DRY_RUN; then
73
73
  fi
74
74
 
75
75
  # ── Python ────────────────────────────────────────────────
76
+ # 记录已找到的 Python 命令,供后续步骤使用
77
+ _PYTHON_CMD=""
78
+
76
79
  check_python() {
77
- if ! command -v python3 &>/dev/null && ! command -v python &>/dev/null; then
80
+ # 刷新命令缓存(关键:安装新软件后 bash 会缓存旧的查找结果)
81
+ hash -r 2>/dev/null || true
82
+
83
+ # 按优先级尝试多个 Python 命令(包括版本号后缀的)
84
+ local py_cmd=""
85
+ for cmd in python3 python3.12 python3.11 python3.10 python; do
86
+ if command -v "$cmd" &>/dev/null; then
87
+ py_cmd="$cmd"
88
+ break
89
+ fi
90
+ done
91
+
92
+ if [ -z "$py_cmd" ]; then
78
93
  return 1
79
94
  fi
80
- local py_cmd="python3"
81
- if ! command -v python3 &>/dev/null; then
82
- py_cmd="python"
83
- fi
95
+
96
+ # 检查版本
84
97
  local ver
85
- ver="$($py_cmd -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')"
98
+ ver="$($py_cmd -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")' 2>/dev/null)" || return 1
86
99
  local major minor
87
100
  major="$(echo "$ver" | cut -d. -f1)"
88
101
  minor="$(echo "$ver" | cut -d. -f2)"
89
102
  if [ "$major" -ge 3 ] && [ "$minor" -ge 10 ]; then
90
- success "Python $ver"
103
+ _PYTHON_CMD="$py_cmd"
104
+ success "Python $ver ($py_cmd)"
91
105
  return 0
92
106
  fi
93
107
  warn "Python $ver found, but 3.10+ required"
94
108
  return 1
95
109
  }
96
110
 
111
+ # 获取可用的 Python 命令(安装后也会重新查找)
112
+ get_python_cmd() {
113
+ if [ -n "$_PYTHON_CMD" ] && command -v "$_PYTHON_CMD" &>/dev/null; then
114
+ echo "$_PYTHON_CMD"
115
+ return 0
116
+ fi
117
+ hash -r 2>/dev/null || true
118
+ for cmd in python3 python3.12 python3.11 python3.10 python; do
119
+ if command -v "$cmd" &>/dev/null; then
120
+ _PYTHON_CMD="$cmd"
121
+ echo "$cmd"
122
+ return 0
123
+ fi
124
+ done
125
+ echo ""
126
+ return 1
127
+ }
128
+
97
129
  install_python() {
98
130
  step "Installing Python 3.12 ..."
131
+ local installed=false
99
132
 
100
133
  if [ "$OS" = "macos" ]; then
101
134
  if command -v brew &>/dev/null; then
102
135
  info "Using Homebrew ..."
103
- brew install python@3.12
136
+ brew install python@3.12 && installed=true
137
+ # brew 安装后更新 PATH 并刷新缓存
104
138
  export PATH="$(brew --prefix python@3.12)/bin:$PATH"
139
+ hash -r
140
+ # 等待文件系统同步(某些情况下 brew 完成后二进制文件不会立即可见)
141
+ sleep 1
142
+ if check_python; then return 0; fi
143
+ # brew 已安装但 python3 软链接可能不存在,尝试手动查找
144
+ local brew_py
145
+ brew_py="$(brew --prefix python@3.12)/bin/python3"
146
+ if [ -x "$brew_py" ]; then
147
+ _PYTHON_CMD="$brew_py"
148
+ success "Python found at $brew_py"
149
+ return 0
150
+ fi
151
+ # 尝试查找版本化的 python 二进制
152
+ for ver in 3.12 3.11 3.10; do
153
+ brew_py="$(brew --prefix python@3.12)/bin/python${ver}"
154
+ if [ -x "$brew_py" ]; then
155
+ _PYTHON_CMD="$brew_py"
156
+ success "Python found at $brew_py"
157
+ return 0
158
+ fi
159
+ done
160
+ # brew 已成功安装,即使 check_python 失败也不再重复安装
161
+ if $installed; then
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"
165
+ # 将 brew python 路径设为 _PYTHON_CMD 供后续使用
166
+ _PYTHON_CMD="$(brew --prefix python@3.12)/bin/python3"
167
+ return 0
168
+ fi
169
+ fi
170
+ # 仅在 brew 未安装时才从 python.org 下载
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"
174
+ sudo installer -pkg /tmp/python.pkg -target /
175
+ rm -f /tmp/python.pkg
176
+ export PATH="/Library/Frameworks/Python.framework/Versions/3.12/bin:$PATH"
177
+ hash -r
105
178
  if check_python; then return 0; fi
106
179
  fi
107
- info "Downloading Python 3.12 ..."
108
- curl -fsSL -o /tmp/python.pkg "https://www.python.org/ftp/python/3.12.8/python-3.12.8-macos11.pkg"
109
- sudo installer -pkg /tmp/python.pkg -target /
110
- rm -f /tmp/python.pkg
111
- export PATH="/Library/Frameworks/Python.framework/Versions/3.12/bin:$PATH"
112
- if check_python; then return 0; fi
180
+ return 1
113
181
  fi
114
182
 
115
183
  if [ "$OS" = "linux" ]; then
@@ -118,22 +186,38 @@ install_python() {
118
186
  sudo apt-get update -qq
119
187
  sudo apt-get install -y python3.12 python3.12-venv python3-pip 2>/dev/null || \
120
188
  sudo apt-get install -y python3 python3-venv python3-pip
189
+ hash -r
121
190
  if check_python; then return 0; fi
191
+ # apt 已安装但可能需要版本化命令
192
+ for ver in 3.12 3.11 3.10; do
193
+ if command -v "python${ver}" &>/dev/null; then
194
+ _PYTHON_CMD="python${ver}"
195
+ success "Python found as python${ver}"
196
+ return 0
197
+ fi
198
+ done
199
+ return 1
122
200
  fi
123
201
  if command -v dnf &>/dev/null; then
124
202
  info "Using dnf ..."
125
203
  sudo dnf install -y python3.12 2>/dev/null || sudo dnf install -y python3
204
+ hash -r
126
205
  if check_python; then return 0; fi
206
+ return 1
127
207
  fi
128
208
  if command -v pacman &>/dev/null; then
129
209
  info "Using pacman ..."
130
210
  sudo pacman -S --noconfirm python python-pip
211
+ hash -r
131
212
  if check_python; then return 0; fi
213
+ return 1
132
214
  fi
133
215
  if command -v apk &>/dev/null; then
134
216
  info "Using apk ..."
135
217
  sudo apk add python3 py3-pip
218
+ hash -r
136
219
  if check_python; then return 0; fi
220
+ return 1
137
221
  fi
138
222
  fi
139
223
 
@@ -145,6 +229,7 @@ install_python() {
145
229
 
146
230
  # ── Node.js ───────────────────────────────────────────────
147
231
  check_node() {
232
+ hash -r 2>/dev/null || true
148
233
  if ! command -v node &>/dev/null; then return 1; fi
149
234
  local major
150
235
  major="$(node -v | sed 's/v\([0-9]\+\).*/\1/')"
@@ -164,6 +249,7 @@ install_node() {
164
249
  info "Using Homebrew ..."
165
250
  brew install node@20 || brew install node
166
251
  export PATH="$(brew --prefix node)/bin:$PATH"
252
+ hash -r
167
253
  if check_node; then return 0; fi
168
254
  fi
169
255
  fi
@@ -173,6 +259,7 @@ install_node() {
173
259
  info "Using fnm ..."
174
260
  fnm install 20
175
261
  eval "$(fnm env)"
262
+ hash -r
176
263
  if check_node; then return 0; fi
177
264
  fi
178
265
 
@@ -181,6 +268,7 @@ install_node() {
181
268
  info "Using nvm ..."
182
269
  . "$HOME/.nvm/nvm.sh"
183
270
  nvm install 20
271
+ hash -r
184
272
  if check_node; then return 0; fi
185
273
  fi
186
274
 
@@ -190,12 +278,16 @@ install_node() {
190
278
  info "Using NodeSource ..."
191
279
  curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
192
280
  sudo apt-get install -y nodejs
281
+ hash -r
193
282
  if check_node; then return 0; fi
283
+ return 1
194
284
  fi
195
285
  if command -v dnf &>/dev/null; then
196
286
  info "Using dnf ..."
197
287
  sudo dnf install -y nodejs npm
288
+ hash -r
198
289
  if check_node; then return 0; fi
290
+ return 1
199
291
  fi
200
292
  fi
201
293
 
@@ -207,6 +299,7 @@ install_node() {
207
299
  eval "$(fnm env)"
208
300
  fi
209
301
  fnm install 20
302
+ hash -r
210
303
  if check_node; then return 0; fi
211
304
 
212
305
  err "Failed to install Node.js. Please install Node.js 18+ manually."
@@ -268,8 +361,33 @@ install_python_deps() {
268
361
  fi
269
362
  fi
270
363
 
364
+ # 获取已安装的 Python 命令
365
+ local py_cmd
366
+ py_cmd="$(get_python_cmd)"
367
+ if [ -z "$py_cmd" ]; then
368
+ err "Python not found, cannot install dependencies"
369
+ return 1
370
+ fi
371
+
271
372
  step "Installing Python dependencies ..."
272
- pip_install "$req_file"
373
+ # 使用已检测到的 Python 命令安装依赖
374
+ "$py_cmd" -m pip install -r "$req_file" --break-system-packages 2>/dev/null || \
375
+ "$py_cmd" -m pip install -r "$req_file" 2>/dev/null || \
376
+ {
377
+ warn "pip install 失败 (可能受 PEP668 限制)"
378
+ info "尝试使用 venv 安装..."
379
+ local venv_dir="$HOME/.myagent/venv"
380
+ "$py_cmd" -m venv "$venv_dir" 2>/dev/null
381
+ if [ -f "$venv_dir/bin/pip" ]; then
382
+ "$venv_dir/bin/pip" install -r "$req_file"
383
+ success "已安装到虚拟环境 $venv_dir"
384
+ info "启动时请使用: $venv_dir/bin/python main.py --web"
385
+ return 0
386
+ fi
387
+ err "所有安装方式均失败"
388
+ info "请手动安装: $py_cmd -m pip install -r $req_file --break-system-packages"
389
+ return 1
390
+ }
273
391
  success "Python dependencies installed"
274
392
  }
275
393
 
File without changes
package/knowledge/rag.py CHANGED
File without changes
package/main.py CHANGED
@@ -39,6 +39,7 @@ from core.config_broadcast import ConfigBroadcaster, ReloadType
39
39
  from core.update_manager import UpdateManager, UpdateType
40
40
  from core.version import get_version
41
41
  from core.permissions import PermissionManager
42
+ from core.deps_checker import check_and_install_deps
42
43
 
43
44
 
44
45
  # ==============================================================================
@@ -113,6 +114,22 @@ class MyAgentApp:
113
114
  self.logger.info(f"数据目录: {self.config_mgr.data_dir}")
114
115
  self.logger.info("=" * 60)
115
116
 
117
+ # 1.5 自动检测并安装缺失依赖(开箱即用)
118
+ self.logger.info("检查依赖...")
119
+ deps_result = check_and_install_deps(auto_fix=True, silent=False)
120
+ if deps_result["installed"] > 0:
121
+ self.logger.info(
122
+ f"自动安装了 {deps_result['installed']} 个依赖"
123
+ )
124
+ if deps_result["failed"] > 0:
125
+ self.logger.warning(
126
+ f"{deps_result['failed']} 个依赖安装失败,相关功能可能不可用"
127
+ )
128
+ if deps_result["playwright_browser"] in ("installed", "ready"):
129
+ self.logger.info("Chromium 浏览器已就绪")
130
+ elif deps_result["playwright_browser"] == "failed":
131
+ self.logger.warning("Chromium 浏览器安装失败,浏览器自动化技能可能不可用")
132
+
116
133
  # 2. LLM 客户端
117
134
  llm_cfg = self.config.llm
118
135
  self.llm = LLMClient(
@@ -294,6 +311,11 @@ class MyAgentApp:
294
311
  )
295
312
  from skills.browser_skill import (
296
313
  BrowserOpenSkill, BrowserClickSkill, BrowserFillSkill,
314
+ BrowserScreenshotSkill, BrowserEvalSkill, BrowserNavigateSkill, BrowserCloseSkill,
315
+ )
316
+ from skills.gui_skill import (
317
+ ScreenShotSkill, MouseClickSkill, MouseDragSkill,
318
+ TypeTextSkill, HotkeySkill, WindowListSkill, WindowFocusSkill, ScreenElementSkill,
297
319
  )
298
320
 
299
321
  # 文件技能
@@ -314,8 +336,18 @@ class MyAgentApp:
314
336
  ]:
315
337
  self.skill_registry.register(skill_cls())
316
338
 
317
- # 浏览器技能
318
- for skill_cls in [BrowserOpenSkill, BrowserClickSkill, BrowserFillSkill]:
339
+ # 浏览器自动化技能 (Playwright)
340
+ for skill_cls in [
341
+ BrowserOpenSkill, BrowserClickSkill, BrowserFillSkill,
342
+ BrowserScreenshotSkill, BrowserEvalSkill, BrowserNavigateSkill, BrowserCloseSkill,
343
+ ]:
344
+ self.skill_registry.register(skill_cls())
345
+
346
+ # 桌面 GUI 自动化技能
347
+ for skill_cls in [
348
+ ScreenShotSkill, MouseClickSkill, MouseDragSkill,
349
+ TypeTextSkill, HotkeySkill, WindowListSkill, WindowFocusSkill, ScreenElementSkill,
350
+ ]:
319
351
  self.skill_registry.register(skill_cls())
320
352
 
321
353
  async def process_message(
File without changes
File without changes
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.2.3",
3
+ "version": "1.3.2",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
7
- "myagent-ai": "start.sh"
7
+ "myagent-ai": "start.js"
8
8
  },
9
9
  "scripts": {
10
10
  "start": "python main.py",
@@ -48,6 +48,7 @@
48
48
  "config.py",
49
49
  "setup.py",
50
50
  "requirements.txt",
51
+ "start.js",
51
52
  "start.sh",
52
53
  "install/",
53
54
  "docs/",
package/requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  # MyAgent - 本地桌面端执行型AI助手
2
- # 依赖清单
2
+ # 依赖清单 (开箱即用:所有依赖均默认安装)
3
3
 
4
4
  # ============================================================
5
5
  # 核心依赖 (必需)
@@ -25,7 +25,7 @@ requests>=2.31.0 # HTTP 请求 (LLM备用、更新检查)
25
25
  # subprocess, tempfile 为 Python 内置模块
26
26
 
27
27
  # ============================================================
28
- # 技能系统
28
+ # 技能系统 - 搜索
29
29
  # ============================================================
30
30
  duckduckgo-search>=6.0.0 # 网络搜索 (无需 API Key)
31
31
  beautifulsoup4>=4.12.0 # HTML 解析
@@ -33,40 +33,47 @@ lxml>=5.0.0 # HTML/XML 高性能解析
33
33
  psutil>=5.9.0 # 系统信息
34
34
 
35
35
  # ============================================================
36
- # 系统托盘 (可选, --tray 模式)
36
+ # 技能系统 - 浏览器自动化 (Playwright)
37
+ # ============================================================
38
+ playwright>=1.41.0 # 浏览器自动化 (内置技能)
39
+
40
+ # ============================================================
41
+ # 技能系统 - 桌面 GUI 自动化
42
+ # ============================================================
43
+ pynput>=1.7.6 # 鼠标/键盘控制 (跨平台, ~500KB)
44
+ pygetwindow>=0.0.9 # 窗口管理 (Windows + macOS)
45
+ mss>=9.0.0 # 屏幕截图 (跨平台, ~1MB)
46
+
47
+ # ============================================================
48
+ # 系统托盘 (默认启用)
37
49
  # ============================================================
38
50
  pystray>=0.19.5 # 系统托盘图标
39
51
  Pillow>=10.0.0 # 图标生成
40
52
 
41
53
  # ============================================================
42
- # 聊天平台 (按需安装)
54
+ # 聊天平台 (按需使用,默认安装)
43
55
  # ============================================================
44
56
  python-telegram-bot>=21.0 # Telegram Bot
45
57
  discord.py>=2.3.0 # Discord Bot
46
58
  # 飞书/QQ/微信 通过 aiohttp 实现,无需额外安装
47
59
 
48
60
  # ============================================================
49
- # 语音合成 (可选, TTS)
61
+ # 语音合成 (默认启用)
50
62
  # ============================================================
51
63
  edge-tts>=6.1.0 # 微软 Edge TTS (免费, 中英文)
52
64
 
53
- # ============================================================
54
- # 浏览器自动化 (可选)
55
- # ============================================================
56
- playwright>=1.41.0 # 浏览器自动化
57
-
58
65
  # ============================================================
59
66
  # Anthropic Claude (可选)
60
67
  # ============================================================
61
68
  anthropic>=0.18.0 # Claude 系列
62
69
 
63
- # ============================================================
64
- # 打包 (可选, 仅开发用)
65
- # ============================================================
66
- pyinstaller>=6.0.0 # 打包为 exe/app
67
-
68
70
  # ============================================================
69
71
  # Agent 间通信 (可选)
70
72
  # ============================================================
71
73
  cryptography>=41.0.0 # Ed25519, X25519, AES-256-GCM
72
74
  websockets>=12.0 # 异步 WebSocket (远程通信)
75
+
76
+ # ============================================================
77
+ # 打包 (可选, 仅开发用)
78
+ # ============================================================
79
+ # pyinstaller>=6.0.0 # 打包为 exe/app (按需安装)
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.1.0")
12
+ __version__ = _version_vars.get("BASE_VERSION", "1.3.2")
13
13
 
14
14
  setup(
15
15
  name="myagent",
@@ -20,27 +20,38 @@ setup(
20
20
  python_requires=">=3.10",
21
21
  packages=find_packages(exclude=["logs", "data", "*.pyc", "tests", "docs", "download"]),
22
22
  install_requires=[
23
+ # 核心
23
24
  "openai>=1.12.0",
24
25
  "aiohttp>=3.9.0",
25
26
  "requests>=2.31.0",
27
+ # 搜索
26
28
  "duckduckgo-search>=6.0.0",
27
29
  "beautifulsoup4>=4.12.0",
28
30
  "lxml>=5.0.0",
29
31
  "psutil>=5.9.0",
32
+ # 系统托盘
30
33
  "pystray>=0.19.5",
31
34
  "Pillow>=10.0.0",
35
+ # 语音合成
32
36
  "edge-tts>=6.1.0",
37
+ # 浏览器自动化 (内置技能)
38
+ "playwright>=1.41.0",
39
+ # 桌面 GUI 自动化 (内置技能)
40
+ "pynput>=1.7.6",
41
+ "pygetwindow>=0.0.9",
42
+ "mss>=9.0.0",
33
43
  ],
34
44
  extras_require={
35
45
  "telegram": ["python-telegram-bot>=21.0"],
36
46
  "discord": ["discord.py>=2.3.0"],
37
- "browser": ["playwright>=1.41.0"],
38
47
  "anthropic": ["anthropic>=0.18.0"],
48
+ "communication": ["cryptography>=41.0.0", "websockets>=12.0"],
39
49
  "all": [
40
50
  "python-telegram-bot>=21.0",
41
51
  "discord.py>=2.3.0",
42
- "playwright>=1.41.0",
43
52
  "anthropic>=0.18.0",
53
+ "cryptography>=41.0.0",
54
+ "websockets>=12.0",
44
55
  ],
45
56
  },
46
57
  entry_points={