@aiyiran/myclaw 1.1.98 → 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.98",
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
  }
@@ -234,8 +243,8 @@ function patch() {
234
243
  let foundTarget = false;
235
244
 
236
245
  for (const f of distFiles) {
237
- // 兼容新旧版本:gateway-cli-*.js(旧)和 server-*.js(新)
238
- const isTarget = (f.startsWith('gateway-cli-') || f.startsWith('server-')) && f.endsWith('.js');
246
+ // 兼容多版本:gateway-cli-*.js(旧)、server-*.js(中)、control-ui-*.js(新)
247
+ const isTarget = (f.startsWith('gateway-cli-') || f.startsWith('server-') || f.startsWith('control-ui-')) && f.endsWith('.js');
239
248
  if (!isTarget) continue;
240
249
 
241
250
  foundTarget = true;
@@ -376,12 +385,12 @@ function unpatch() {
376
385
  console.log('[myclaw-patch] ✅ Iteration 注入脚本已删除');
377
386
  }
378
387
 
379
- // 恢复 gateway-cli-*.js 的 Permissions-Policy
388
+ // 恢复 gateway-cli-*.js / server-*.js / control-ui-*.js 的 Permissions-Policy + CSP
380
389
  try {
381
390
  const distParent = path.resolve(uiDir, '..');
382
391
  const distFiles = fs.readdirSync(distParent);
383
392
  for (const f of distFiles) {
384
- if (f.startsWith('gateway-cli-') && f.endsWith('.js' + BACKUP_SUFFIX)) {
393
+ if ((f.startsWith('gateway-cli-') || f.startsWith('server-') || f.startsWith('control-ui-')) && f.endsWith('.js' + BACKUP_SUFFIX)) {
385
394
  const originalFile = path.join(distParent, f.replace(BACKUP_SUFFIX, ''));
386
395
  const backupFile = path.join(distParent, f);
387
396
  fs.copyFileSync(backupFile, originalFile);
@@ -1,5 +1,5 @@
1
1
  {
2
- "index_updated_at": "2026-05-14T07:38:14Z",
2
+ "index_updated_at": "2026-05-21T10:04:27Z",
3
3
  "templates": {
4
4
  "696de592": {
5
5
  "id": "696de592",
@@ -458,6 +458,33 @@
458
458
  ],
459
459
  "updated_at": "2026-05-10T09:48:56Z"
460
460
  },
461
+ "c16a3e75": {
462
+ "id": "c16a3e75",
463
+ "系列": "C",
464
+ "编号": "109",
465
+ "名称": "每天一个小习惯·宠物养成",
466
+ "文件夹名": "c109_每天一个小习惯·宠物养成",
467
+ "version": "v3",
468
+ "路径": "templates/c109_每天一个小习惯·宠物养成/v3",
469
+ "入口文件": "templates/c109_每天一个小习惯·宠物养成/v3/index.html",
470
+ "一句话说明": "完成5步创造你的专属宠物,再通过每日习惯让它成长、升级。",
471
+ "主能力标签": "第一能力:构思能力",
472
+ "任务类型标签": "游戏机制",
473
+ "关键词": [
474
+ "c109_每天一个小习惯·宠物养成",
475
+ "完成5步创造你的专属宠物,再通过每日习惯让它成长、升级。",
476
+ "低年级学生",
477
+ "喜欢游戏化任务的学生",
478
+ "抵触作业但愿意养成的学生",
479
+ "游戏化习惯养成",
480
+ "可视化成长反馈",
481
+ "即时奖励机制",
482
+ "每天一个小习惯·宠物养成",
483
+ "第一能力:构思能力",
484
+ "游戏机制"
485
+ ],
486
+ "updated_at": "2026-05-21T10:04:07Z"
487
+ },
461
488
  "c0ae6efc": {
462
489
  "id": "c0ae6efc",
463
490
  "系列": "D",
@@ -173,6 +173,15 @@
173
173
  - 任务类型标签:视听表达
174
174
  - 关键词:c108_我的金币任务板, 先把今天作业告诉 AI,再检查、保存、发布,最后请 AI 帮你看看。, 低年级学生, 刚开始学会和 AI 一起做任务的学生, 表达比较零散、需要帮助整理的学生, 把口头任务整理成清楚文件, 学会检查 AI 有没有漏写、写错、乱加, 知道完成后要保存、发布、再请 AI 检查, 我的金币任务板, 第二能力:表达构建, 视听表达
175
175
 
176
+ ## C109 每天一个小习惯·宠物养成
177
+ - ID:c16a3e75
178
+ - 版本:v3
179
+ - 路径:templates/c109_每天一个小习惯·宠物养成/v3
180
+ - 入口文件:templates/c109_每天一个小习惯·宠物养成/v3/index.html
181
+ - 主能力标签:第一能力:构思能力
182
+ - 任务类型标签:游戏机制
183
+ - 关键词:c109_每天一个小习惯·宠物养成, 完成5步创造你的专属宠物,再通过每日习惯让它成长、升级。, 低年级学生, 喜欢游戏化任务的学生, 抵触作业但愿意养成的学生, 游戏化习惯养成, 可视化成长反馈, 即时奖励机制, 每天一个小习惯·宠物养成, 第一能力:构思能力, 游戏机制
184
+
176
185
  ## D100 每日新闻搜索与整理
177
186
  - ID:c0ae6efc
178
187
  - 版本:v1
@@ -7,10 +7,11 @@
7
7
 
8
8
  ## 行动规则
9
9
 
10
- **不要写任何代码,不要修改任何文件。**
11
-
12
10
  你的角色是引导老师/学生完成任务。
13
11
 
12
+ 0. 先不要写任何代码,也不要修改任何文件。我们只需要先引导学生完成第一步。
14
13
  1. 阅读 `__student__.json`,了解任务步骤和评价目标
15
14
  2. 阅读 `__teacher__.json`,了解训练重点和常见卡点
16
- 3. 直接开始引导我完成步骤1——按 `__student__.json` 里第一步的说明,用对话方式带我做,只输出两个事情:1)我们最终目标是什么。2)更重要的,我第一步我要做什么。
15
+ 3. 直接开始引导我完成步骤1——按 `__student__.json` 里第一步的说明,用对话方式带我做,只输出两个事情:
16
+ 1)我们最终目标是什么。
17
+ 2)更重要的,我第一步我要做什么。