@aiyiran/myclaw 1.1.102 → 1.1.106

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/index.js CHANGED
@@ -2161,6 +2161,9 @@ function runDelete() {
2161
2161
  } = require('./delete_agents');
2162
2162
 
2163
2163
  const isDeep = args.includes('--deep'); // 加 --deep 则自动执行阶段2,不询问
2164
+ const directId = (args[1] && !args[1].startsWith('--')) ? args[1] : null; // 直接指定 agent 名
2165
+ const prefixIdx = args.indexOf('--prefix');
2166
+ const prefix = prefixIdx !== -1 ? (args[prefixIdx + 1] || null) : null; // 前缀批量删除
2164
2167
 
2165
2168
  const G = colors.green;
2166
2169
  const Y = colors.yellow;
@@ -2232,9 +2235,9 @@ function runDelete() {
2232
2235
  return;
2233
2236
  }
2234
2237
 
2235
- printTable(agents);
2236
-
2237
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
2238
+ const rl = directId
2239
+ ? { close: () => {}, question: (_, cb) => cb('') }
2240
+ : readline.createInterface({ input: process.stdin, output: process.stdout });
2238
2241
 
2239
2242
  function step1() {
2240
2243
  rl.question(
@@ -2380,7 +2383,57 @@ function runDelete() {
2380
2383
  console.log('');
2381
2384
  }
2382
2385
 
2383
- step1();
2386
+ if (directId) {
2387
+ const target = agents.find(a => a.id === directId);
2388
+ if (!target) {
2389
+ console.log('');
2390
+ console.log(R + ' 找不到 Agent: "' + directId + '"' + NC);
2391
+ console.log(D + ' 可用 mc delete 查看完整列表' + NC);
2392
+ console.log('');
2393
+ process.exit(1);
2394
+ return;
2395
+ }
2396
+ console.log('');
2397
+ console.log(BAR);
2398
+ console.log(R + ' ⚠ 直接删除' + (isDeep ? '(含会话历史)' : '') + NC);
2399
+ console.log(BAR);
2400
+ const tag = target.inJson ? '' : ' ' + Y + '[孤立]' + NC;
2401
+ console.log(` • ${R}${target.id}${NC}${tag} ${D}${target.sessionCount} 个会话 最后更新: ${fmtDate(target.lastUpdated)}${NC}`);
2402
+ console.log('');
2403
+ step3([target]);
2404
+ } else if (prefix) {
2405
+ const matched = agents.filter(a => a.id.startsWith(prefix));
2406
+ if (matched.length === 0) {
2407
+ console.log('');
2408
+ console.log(R + ' 没有找到前缀为 "' + prefix + '" 的 Agent' + NC);
2409
+ console.log(D + ' 可用 mc delete 查看完整列表' + NC);
2410
+ console.log('');
2411
+ process.exit(1);
2412
+ return;
2413
+ }
2414
+ console.log('');
2415
+ console.log(BAR);
2416
+ console.log(B + ' 🔍 前缀匹配: "' + prefix + '"' + (isDeep ? ' ' + R + '(含会话历史)' + NC : '') + NC);
2417
+ console.log(BAR);
2418
+ matched.forEach(ag => {
2419
+ const tag = ag.inJson ? '' : ' ' + Y + '[孤立]' + NC;
2420
+ console.log(` • ${R}${ag.id}${NC}${tag} ${D}${ag.sessionCount} 个会话 最后更新: ${fmtDate(ag.lastUpdated)}${NC}`);
2421
+ });
2422
+ console.log('');
2423
+ console.log(' 共 ' + R + matched.length + NC + ' 个伙伴');
2424
+ console.log('');
2425
+ rl.question(' 输入 ' + R + '1' + NC + ' 确认全部删除,其他任意键取消: ', function (ans) {
2426
+ if ((ans || '').trim() !== '1') {
2427
+ console.log(D + '\n 已取消。' + NC + '\n');
2428
+ rl.close();
2429
+ return;
2430
+ }
2431
+ step3(matched);
2432
+ });
2433
+ } else {
2434
+ printTable(agents);
2435
+ step1();
2436
+ }
2384
2437
  }
2385
2438
 
2386
2439
  // ── mc list-agents:输出 Agent 列表(供 API 复用) ──
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.1.102",
3
+ "version": "1.1.106",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/patches/patch.js CHANGED
@@ -52,6 +52,15 @@ function findControlUiDir() {
52
52
  }
53
53
  } catch {}
54
54
 
55
+ // 加上 pnpm global root
56
+ try {
57
+ const { execSync } = require('child_process');
58
+ const pnpmRoot = execSync('pnpm root -g 2>/dev/null', { encoding: 'utf8' }).trim();
59
+ if (pnpmRoot) {
60
+ globalPaths.push(pnpmRoot);
61
+ }
62
+ } catch {}
63
+
55
64
  for (const globalPath of globalPaths) {
56
65
  candidates.push(path.join(globalPath, 'openclaw', 'dist', 'control-ui'));
57
66
  }