myagent-ai 1.26.2 → 1.26.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.
@@ -118,7 +118,7 @@ GUI桌面 (仅Windows/macOS):
118
118
 
119
119
  记忆/通信/媒体:
120
120
  - 搜索记忆: myagent-ai memory [--keyword 关键词]
121
- - Agent间通信: myagent-ai chat --agent <路径> -m "消息" [-f "文件"]
121
+ - Agent间通信: myagent-ai chat --agent <Agent_ID或名称> -m "消息" [-f "文件"]
122
122
  - 发送文件给用户: myagent-ai send-file 文件路径 描述
123
123
  - 播放音频/视频: myagent-ai playaudio/playvideo --url URL [--title 标题]
124
124
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.26.2",
3
+ "version": "1.26.4",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
package/scripts/cli.py CHANGED
@@ -1079,7 +1079,7 @@ async def cmd_chat(args):
1079
1079
  """Agent间通信 — 向群内其他Agent发送消息或文件"""
1080
1080
  import argparse
1081
1081
  p = argparse.ArgumentParser(prog="myagent-ai chat", description="向群内其他Agent发送消息或文件,消息会出现在群聊记录中")
1082
- p.add_argument("--agent", "-a", required=True, help="目标Agent ID(群成员列表中显示的唯一ID)")
1082
+ p.add_argument("--agent", "-a", required=True, help="目标AgentID或名称(群成员列表中显示)")
1083
1083
  p.add_argument("--message", "-m", default="", help="要发送的消息内容")
1084
1084
  p.add_argument("--file", "-f", default="", help="要发送的文件路径(可多次使用: -f file1 -f file2)")
1085
1085
  p.add_argument("--group", "-g", help="群ID(可选,默认使用最近活跃的群)")
@@ -1108,24 +1108,30 @@ async def cmd_chat(args):
1108
1108
  resolved_path = None
1109
1109
  found_ids = []
1110
1110
 
1111
- # 优先从数据库查询
1111
+ # 优先从数据库查询(支持 ID 或 名称匹配)
1112
1112
  if _db_path.exists():
1113
1113
  try:
1114
1114
  import sqlite3
1115
1115
  conn = sqlite3.connect(str(_db_path))
1116
1116
  conn.row_factory = sqlite3.Row
1117
- rows = conn.execute("SELECT path, id FROM agents WHERE id != ''").fetchall()
1117
+ rows = conn.execute("SELECT path, id, name FROM agents WHERE id != ''").fetchall()
1118
1118
  conn.close()
1119
1119
  for row in rows:
1120
1120
  aid = row["id"]
1121
+ aname = row["name"] or ""
1121
1122
  found_ids.append(aid)
1123
+ # 按 ID 精确匹配
1122
1124
  if aid == a.agent:
1123
1125
  resolved_path = row["path"]
1124
1126
  break
1127
+ # 按名称精确匹配(兜底)
1128
+ if not resolved_path and aname == a.agent:
1129
+ resolved_path = row["path"]
1130
+ break
1125
1131
  except Exception:
1126
1132
  pass
1127
1133
 
1128
- # 数据库查不到,回退到文件系统(兼容旧版本)
1134
+ # 数据库查不到,回退到文件系统(兼容旧版本,支持 ID 或 名称匹配)
1129
1135
  if not resolved_path:
1130
1136
  agents_data_dir = _base_dir / "data" / "agents"
1131
1137
  if agents_data_dir.exists():
@@ -1133,11 +1139,15 @@ async def cmd_chat(args):
1133
1139
  try:
1134
1140
  ag_cfg = json.loads(cfg_path.read_text(encoding="utf-8"))
1135
1141
  aid = ag_cfg.get("id", "")
1142
+ aname = ag_cfg.get("name", "")
1136
1143
  if aid and aid not in found_ids:
1137
1144
  found_ids.append(aid)
1138
1145
  if aid == a.agent:
1139
1146
  resolved_path = cfg_path.parent.relative_to(agents_data_dir).as_posix()
1140
1147
  break
1148
+ if not resolved_path and aname and aname == a.agent:
1149
+ resolved_path = cfg_path.parent.relative_to(agents_data_dir).as_posix()
1150
+ break
1141
1151
  except Exception:
1142
1152
  pass
1143
1153
 
@@ -1151,7 +1161,7 @@ async def cmd_chat(args):
1151
1161
  if cfg_count > 0:
1152
1162
  sample = found_ids[:5]
1153
1163
  err_parts.append(f"已有 ID: {', '.join(sample)}")
1154
- err_parts.append(f"(请使用Agent的ID,从群成员列表中获取)")
1164
+ err_parts.append(f"(请使用Agent的ID或名称,从群成员列表中获取)")
1155
1165
  print(" | ".join(err_parts), file=sys.stderr)
1156
1166
  sys.exit(1)
1157
1167
 
@@ -1359,9 +1369,9 @@ GUI (仅 Windows/macOS):
1359
1369
  myagent-ai memory [--keyword 关键词] [--limit N] 搜索历史记忆
1360
1370
 
1361
1371
  通信:
1362
- myagent-ai chat --agent <路径> --message "消息" 向其他Agent发送消息
1363
- myagent-ai chat --agent <路径> --file <文件路径> 向其他Agent发送文件
1364
- myagent-ai chat --agent <路径> -m "消息" -f <文件> 同时发送消息和文件
1372
+ myagent-ai chat --agent <ID或名称> --message "消息" 向其他Agent发送消息
1373
+ myagent-ai chat --agent <ID或名称> --file <文件路径> 向其他Agent发送文件
1374
+ myagent-ai chat --agent <ID或名称> -m "消息" -f <文件> 同时发送消息和文件
1365
1375
 
1366
1376
  压缩解压:
1367
1377
  myagent-ai zip <路径1> [路径2] ... [-o 输出.zip] 压缩文件或文件夹
package/start.js CHANGED
@@ -855,8 +855,9 @@ function main() {
855
855
  }
856
856
 
857
857
  // [v1.26.1] 未知命令 → 透传 shell 执行(避免 myagent-ai ls -la 被误传给 main.py)
858
- // 仅当无参数或以 -- 开头时才启动 myagent 服务
859
- if (cmd && !cmd.startsWith("-")) {
858
+ // 仅当无参数、以 -- 开头、或服务模式(web/cli/tray/server/setup)时才启动 myagent 服务
859
+ const SERVICE_MODES = ["web", "cli", "tray", "server", "setup"];
860
+ if (cmd && !cmd.startsWith("-") && !SERVICE_MODES.includes(cmd)) {
860
861
  const cmdStr = args.join(" ");
861
862
  const result = spawnSync(
862
863
  process.platform === "win32" ? "cmd.exe" : "bash",