myagent-ai 1.24.2 → 1.24.5

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/README.md CHANGED
@@ -130,7 +130,7 @@ curl -fsSL https://raw.githubusercontent.com/ctz168/myagent/main/install/install
130
130
  myagent-ai update
131
131
  ```
132
132
 
133
- 该命令会自动完成:npm 升级全局包 → 重建虚拟环境重装所有依赖。
133
+ 该命令会自动完成:npm 升级全局包 → 检查新增依赖自动启动。
134
134
 
135
135
  ---
136
136
 
@@ -207,8 +207,11 @@ myagent-ai install
207
207
  # 重装依赖(删除 venv 重建)
208
208
  myagent-ai reinstall
209
209
 
210
- # 卸载
210
+ # 卸载(清除所有数据)
211
211
  myagent-ai uninstall
212
+
213
+ # 卸载但保留数据(配置、记忆等)
214
+ myagent-ai uninstall --keep-data
212
215
  ```
213
216
 
214
217
  > 首次运行会自动安装所有依赖,后续启动秒开。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.24.2",
3
+ "version": "1.24.5",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
package/start.js CHANGED
@@ -624,7 +624,7 @@ function cleanPycache(pkgDir) {
624
624
  function cmdUninstall() {
625
625
  const venvDir = getVenvDir();
626
626
  const dataDir = getDataDir();
627
- const purgeArg = process.argv.includes("--purge") || process.argv.includes("-p");
627
+ const keepData = process.argv.includes("--keep-data");
628
628
 
629
629
  console.log("");
630
630
  console.log(" \x1b[36mMyAgent 卸载\x1b[0m");
@@ -651,15 +651,27 @@ function cmdUninstall() {
651
651
  }
652
652
  } catch (_) {}
653
653
 
654
+ // 卸载 npm 全局包
654
655
  try {
655
656
  execFileSync("npm", ["uninstall", "-g", PKG_NAME], {
656
657
  encoding: "utf8", stdio: "inherit", timeout: 60000,
657
658
  });
658
659
  } catch (_) {}
659
660
 
660
- if (purgeArg && fs.existsSync(dataDir)) {
661
- fs.rmSync(dataDir, { recursive: true, force: true });
662
- console.log(" 数据已清除");
661
+ // 清理数据目录(默认删除,--keep-data 保留)
662
+ if (fs.existsSync(dataDir)) {
663
+ if (keepData) {
664
+ console.log(" 数据已保留: " + dataDir);
665
+ } else {
666
+ try {
667
+ const data_size = execSync(`du -sh "${dataDir}" 2>/dev/null`, { encoding: "utf8" }).trim().split(/\s+/)[0] || "?";
668
+ console.log(" 清除数据目录: " + dataDir + " (" + data_size + ")");
669
+ fs.rmSync(dataDir, { recursive: true, force: true });
670
+ console.log(" \x1b[32m✓\x1b[0m 数据已清除");
671
+ } catch (e) {
672
+ console.log(" \x1b[33m⚠ 数据目录清理失败,可手动删除: " + dataDir + "\x1b[0m");
673
+ }
674
+ }
663
675
  }
664
676
  console.log("");
665
677
  console.log(" \x1b[32m✓ 卸载完成\x1b[0m");
@@ -444,10 +444,23 @@ function renderGroupSidebar(groupData) {
444
444
  list.innerHTML = html;
445
445
  }
446
446
 
447
- // [v1.23.79] 从群聊成员列表点击,直接发起私聊
447
+ // [v1.23.79] 从群聊成员列表/消息头像点击,直接发起私聊
448
448
  function startPrivateChatFromGroup(agentPath) {
449
449
  if (typeof selectAgent === 'function') {
450
- exitGroupChat();
450
+ // 仅做群聊清理(停轮询、清 URL/localStorage),不加载旧 agent 的 sessions
451
+ _stopGroupPolling(currentGroupId);
452
+ currentView = 'chat';
453
+ currentGroupId = null;
454
+ groupMessages = [];
455
+ StatePersistence.remove('currentView');
456
+ StatePersistence.remove('currentGroupId');
457
+ // 清除群聊 URL 中的 ?g= 参数
458
+ var cleanUrl = '/ui/chat/chat_container.html';
459
+ if (typeof state !== 'undefined' && agentPath && agentPath !== 'default') {
460
+ cleanUrl += '?a=' + encodeURIComponent(agentPath);
461
+ }
462
+ window.history.replaceState({}, '', cleanUrl);
463
+ // 让 selectAgent 处理完整的私聊切换
451
464
  selectAgent(agentPath);
452
465
  }
453
466
  }
@@ -500,7 +513,7 @@ function _renderGroupMessagesInner() {
500
513
  var agentColor = msg.agent_color || msg.color || 'var(--accent)';
501
514
  var agentRole = msg.agent_role || msg.role_detail || '';
502
515
  var agentPath = msg.agent || '';
503
- var _clickAvatar = agentPath ? ' onclick="showAgentProfile(\'' + escapeHtml(agentPath) + '\')" style="background:' + agentColor + ';color:#fff;cursor:pointer" title="点击查看简介"' : ' style="background:' + agentColor + ';color:#fff"';
516
+ var _clickAvatar = agentPath ? ' onclick="startPrivateChatFromGroup(\'' + escapeHtml(agentPath) + '\')" style="background:' + agentColor + ';color:#fff;cursor:pointer" title="点击私聊 ' + escapeHtml(agentName) + '"' : ' style="background:' + agentColor + ';color:#fff"';
504
517
  // [v1.23.82] 流式输出时显示闪烁光标
505
518
  var _streamingCursor = msg._streaming ? '<span class="streaming-cursor" style="display:inline-block;width:2px;height:1em;background:var(--accent);margin-left:2px;animation:blink 1s step-end infinite;vertical-align:text-bottom"></span>' : '';
506
519
  html += '<div class="group-msg-row">'
@@ -520,7 +533,7 @@ function _renderGroupMessagesInner() {
520
533
  var rEmoji = r.agent_emoji || r.sender_avatar || r.avatar || '🤖';
521
534
  var rColor = r.agent_color || r.color || 'var(--accent)';
522
535
  var rPath = r.agent_path || '';
523
- var _rClickAvatar = rPath ? ' onclick="showAgentProfile(\'' + escapeHtml(rPath) + '\')" style="background:' + rColor + ';color:#fff;cursor:pointer" title="点击查看简介"' : ' style="background:' + rColor + ';color:#fff"';
536
+ var _rClickAvatar = rPath ? ' onclick="startPrivateChatFromGroup(\'' + escapeHtml(rPath) + '\')" style="background:' + rColor + ';color:#fff;cursor:pointer" title="点击私聊 ' + escapeHtml(rName) + '"' : ' style="background:' + rColor + ';color:#fff"';
524
537
  html += '<div class="group-msg-row">'
525
538
  + '<div class="group-msg-avatar"' + _rClickAvatar + '>' + rEmoji + '</div>'
526
539
  + '<div>'