myagent-ai 1.4.0 → 1.4.1

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.1"
15
15
 
16
16
 
17
17
  def _version_from_git() -> str:
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.1",
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.1")
13
13
 
14
14
  setup(
15
15
  name="myagent",