myagent-ai 1.4.0 → 1.4.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.
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.4.0"
14
+ BASE_VERSION = "1.4.2"
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.4.0"
12
+ $PKG_VERSION = "1.4.2"
13
13
 
14
14
  # Allow running scripts for the current process
15
15
  if ($PSVersionTable.PSVersion.Major -ge 5) {
@@ -43,12 +43,12 @@ function Check-Python {
43
43
  $pyVer = (python --version 2>$null)
44
44
  if ($pyVer) {
45
45
  $verNum = [version]($pyVer -replace 'Python\s+(\S+)', '$1')
46
- if ($verNum -ge [version]"3.10") {
46
+ if ($verNum -ge [version]"3.14") {
47
47
  $Script:PythonCmd = "python"
48
48
  Write-Host "[OK] Python $verNum found" -ForegroundColor Green
49
49
  return $true
50
50
  } else {
51
- Write-Host "[!] Python $verNum found, but 3.10+ required" -ForegroundColor Yellow
51
+ Write-Host "[!] Python $verNum found, upgrading to 3.14 ..." -ForegroundColor Yellow
52
52
  return $false
53
53
  }
54
54
  }
@@ -68,7 +68,7 @@ function Check-Python {
68
68
  foreach ($pyPath in $commonPaths) {
69
69
  if (Test-Path $pyPath) {
70
70
  $verNum = (& $pyPath --version 2>$null) -replace 'Python\s+(\S+)', '$1'
71
- if ($verNum -and [version]$verNum -ge [version]"3.10") {
71
+ if ($verNum -and [version]$verNum -ge [version]"3.14") {
72
72
  $Script:PythonCmd = $pyPath
73
73
  Write-Host "[OK] Python $verNum found at $pyPath" -ForegroundColor Green
74
74
  return $true
@@ -142,7 +142,7 @@ function Install-Python {
142
142
  }
143
143
 
144
144
  Write-Host "[x] Failed to install Python." -ForegroundColor Red
145
- Write-Host " Please install Python 3.10+ manually: https://www.python.org/downloads/" -ForegroundColor Gray
145
+ Write-Host " Please install Python 3.14+ manually: https://www.python.org/downloads/" -ForegroundColor Gray
146
146
  exit 1
147
147
  }
148
148
 
@@ -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.4.0"
24
+ PKG_VERSION="1.4.2"
25
25
 
26
26
  for arg in "$@"; do
27
27
  case "$arg" in
@@ -99,12 +99,12 @@ check_python() {
99
99
  local major minor
100
100
  major="$(echo "$ver" | cut -d. -f1)"
101
101
  minor="$(echo "$ver" | cut -d. -f2)"
102
- if [ "$major" -ge 3 ] && [ "$minor" -ge 10 ]; then
102
+ if [ "$major" -ge 3 ] && [ "$minor" -ge 14 ]; then
103
103
  _PYTHON_CMD="$py_cmd"
104
104
  success "Python $ver ($py_cmd)"
105
105
  return 0
106
106
  fi
107
- warn "Python $ver found, but 3.10+ required"
107
+ warn "Python $ver found, upgrading to 3.14 ..."
108
108
  return 1
109
109
  }
110
110
 
@@ -221,7 +221,7 @@ install_python() {
221
221
  fi
222
222
  fi
223
223
 
224
- err "Failed to install Python. Please install Python 3.10+ manually."
224
+ err "Failed to install Python. Please install Python 3.14+ manually."
225
225
  info " macOS: https://www.python.org/downloads/"
226
226
  info " Linux: https://wiki.python.org/moin/BeginnersGuide/Download"
227
227
  exit 1
package/main.py CHANGED
@@ -808,11 +808,11 @@ def create_tray_icon(app: MyAgentApp, web_port: int = 8767):
808
808
  pass
809
809
  icon.stop()
810
810
 
811
- def _get_status_title(icon, item):
812
- """动态生成状态标题"""
811
+ def _get_status_title(item):
812
+ """动态生成状态标题 (pystray text callable: text(menu_item))"""
813
813
  if not app._running:
814
- return "🤖 MyAgent - 已停止"
815
- return "🤖 MyAgent - 运行中"
814
+ return "MyAgent - 已停止"
815
+ return "MyAgent - 运行中"
816
816
 
817
817
  def _autostart_checked(item):
818
818
  """返回当前自启状态的 checked 值"""
@@ -821,37 +821,37 @@ def create_tray_icon(app: MyAgentApp, web_port: int = 8767):
821
821
  def _refresh_menu(icon):
822
822
  """刷新托盘菜单 (重建以更新动态状态)"""
823
823
  try:
824
- icon.menu = _build_menu(icon)
824
+ icon.menu = _build_menu()
825
825
  icon.update_menu()
826
826
  except Exception:
827
827
  pass # 部分平台不支持动态菜单刷新
828
828
 
829
- def _build_menu(icon_ref=None):
830
- """构建菜单"""
829
+ def _build_menu():
830
+ """构建菜单 (Windows Win32 不支持 BMP 外 emoji, 使用纯文本)"""
831
831
  return pystray.Menu(
832
832
  pystray.MenuItem(
833
- lambda icon, item: "🤖 MyAgent - 运行中" if app._running else "🤖 MyAgent - 已停止",
833
+ _get_status_title,
834
834
  None, enabled=False,
835
835
  ),
836
836
  pystray.Menu.SEPARATOR,
837
- pystray.MenuItem("💬 打开聊天界面", open_chat_ui, default=True),
838
- pystray.MenuItem("🖥️ 打开管理后台", open_web_ui),
839
- pystray.MenuItem("📋 显示状态", show_status),
837
+ pystray.MenuItem("打开聊天界面", open_chat_ui, default=True),
838
+ pystray.MenuItem("打开管理后台", open_web_ui),
839
+ pystray.MenuItem("显示状态", show_status),
840
840
  pystray.Menu.SEPARATOR,
841
- pystray.MenuItem("📁 打开工作目录", open_workdir),
842
- pystray.MenuItem("📄 打开日志目录", open_logs),
843
- pystray.MenuItem("⚙️ 打开配置目录", open_config_dir),
841
+ pystray.MenuItem("打开工作目录", open_workdir),
842
+ pystray.MenuItem("打开日志目录", open_logs),
843
+ pystray.MenuItem("打开配置目录", open_config_dir),
844
844
  pystray.Menu.SEPARATOR,
845
- pystray.MenuItem("🔄 开机自启", toggle_autostart, checked=_autostart_checked),
846
- pystray.MenuItem("🔁 重启服务", restart_service),
845
+ pystray.MenuItem("开机自启", toggle_autostart, checked=_autostart_checked),
846
+ pystray.MenuItem("重启服务", restart_service),
847
847
  pystray.Menu.SEPARATOR,
848
- pystray.MenuItem("退出", on_quit),
848
+ pystray.MenuItem("退出", on_quit),
849
849
  )
850
850
 
851
851
  tray_icon = pystray.Icon(
852
852
  "myagent",
853
853
  create_icon_image(),
854
- f"MyAgent v{get_version()} - 运行中",
854
+ f"MyAgent v{get_version()}",
855
855
  _build_menu(),
856
856
  )
857
857
 
@@ -877,13 +877,19 @@ def run_with_tray(app: MyAgentApp, web_port: int = 8767):
877
877
  app.logger.warning("pystray 未安装,跳过系统托盘")
878
878
  return
879
879
 
880
- # 在后台线程运行托盘
881
- tray_thread = threading.Thread(target=tray.run, daemon=True)
880
+ # 在后台线程运行托盘 (daemon=True 保证崩溃不影响主进程)
881
+ def _tray_run():
882
+ try:
883
+ tray.run()
884
+ except Exception as e:
885
+ app.logger.warning(f"系统托盘异常退出 (不影响主服务): {e}")
886
+
887
+ tray_thread = threading.Thread(target=_tray_run, daemon=True)
882
888
  tray_thread.start()
883
889
  app.logger.info(f"系统托盘已启动 (聊天: http://127.0.0.1:{web_port}/ui/chat.html)")
884
890
 
885
891
  # 启动完成通知
886
- _tray_notify(app, "MyAgent 已启动", f"v{get_version()} | 端口: {web_port}")
892
+ _tray_notify(app, "MyAgent 已启动", f"v{get_version()} | 端口: {web_port}")
887
893
 
888
894
 
889
895
  def _tray_notify(app: MyAgentApp, title: str, message: str):
@@ -1100,7 +1106,7 @@ def main():
1100
1106
  api_server = ApiServer(app)
1101
1107
  await api_server.start(port=web_port)
1102
1108
  app.logger.info(f"服务已重启: http://127.0.0.1:{web_port}/ui/")
1103
- _tray_notify(app, "服务已重启", f"端口: {web_port}")
1109
+ _tray_notify(app, "服务已重启", f"端口: {web_port}")
1104
1110
  elif web_port:
1105
1111
  # Web 模式 (无托盘): 后台运行保持服务
1106
1112
  app.logger.info("Web 服务运行中... (Ctrl+C 退出)")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
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.4.0")
12
+ __version__ = _version_vars.get("BASE_VERSION", "1.4.2")
13
13
 
14
14
  setup(
15
15
  name="myagent",