botmux 2.74.0 → 2.75.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.
Files changed (112) hide show
  1. package/dist/adapters/cli/claude-code.d.ts.map +1 -1
  2. package/dist/adapters/cli/claude-code.js +23 -19
  3. package/dist/adapters/cli/claude-code.js.map +1 -1
  4. package/dist/adapters/cli/types.d.ts +6 -0
  5. package/dist/adapters/cli/types.d.ts.map +1 -1
  6. package/dist/adapters/hook-installer.d.ts +4 -0
  7. package/dist/adapters/hook-installer.d.ts.map +1 -1
  8. package/dist/adapters/hook-installer.js +32 -2
  9. package/dist/adapters/hook-installer.js.map +1 -1
  10. package/dist/bot-registry.d.ts +10 -0
  11. package/dist/bot-registry.d.ts.map +1 -1
  12. package/dist/bot-registry.js +22 -5
  13. package/dist/bot-registry.js.map +1 -1
  14. package/dist/cli/pm2-command.d.ts +6 -0
  15. package/dist/cli/pm2-command.d.ts.map +1 -0
  16. package/dist/cli/pm2-command.js +7 -0
  17. package/dist/cli/pm2-command.js.map +1 -0
  18. package/dist/cli/stdin-encoding.d.ts +3 -0
  19. package/dist/cli/stdin-encoding.d.ts.map +1 -0
  20. package/dist/cli/stdin-encoding.js +19 -0
  21. package/dist/cli/stdin-encoding.js.map +1 -0
  22. package/dist/cli.d.ts.map +1 -1
  23. package/dist/cli.js +48 -13
  24. package/dist/cli.js.map +1 -1
  25. package/dist/core/command-handler.d.ts.map +1 -1
  26. package/dist/core/command-handler.js +3 -1
  27. package/dist/core/command-handler.js.map +1 -1
  28. package/dist/core/maintenance.d.ts +18 -0
  29. package/dist/core/maintenance.d.ts.map +1 -1
  30. package/dist/core/maintenance.js +56 -4
  31. package/dist/core/maintenance.js.map +1 -1
  32. package/dist/core/worker-pool.d.ts.map +1 -1
  33. package/dist/core/worker-pool.js +1 -0
  34. package/dist/core/worker-pool.js.map +1 -1
  35. package/dist/dashboard/auth.d.ts.map +1 -1
  36. package/dist/dashboard/auth.js +2 -1
  37. package/dist/dashboard/auth.js.map +1 -1
  38. package/dist/dashboard/bot-onboarding.d.ts +2 -0
  39. package/dist/dashboard/bot-onboarding.d.ts.map +1 -1
  40. package/dist/dashboard/bot-onboarding.js +2 -0
  41. package/dist/dashboard/bot-onboarding.js.map +1 -1
  42. package/dist/dashboard/hd2d-assets.d.ts +20 -0
  43. package/dist/dashboard/hd2d-assets.d.ts.map +1 -0
  44. package/dist/dashboard/hd2d-assets.js +216 -0
  45. package/dist/dashboard/hd2d-assets.js.map +1 -0
  46. package/dist/dashboard/web/app.d.ts.map +1 -1
  47. package/dist/dashboard/web/app.js +3 -0
  48. package/dist/dashboard/web/app.js.map +1 -1
  49. package/dist/dashboard/web/office.d.ts +2 -0
  50. package/dist/dashboard/web/office.d.ts.map +1 -0
  51. package/dist/dashboard/web/office.js +140 -0
  52. package/dist/dashboard/web/office.js.map +1 -0
  53. package/dist/dashboard-web/app.js +327 -299
  54. package/dist/dashboard-web/game/index.apple-touch-icon.png +0 -0
  55. package/dist/dashboard-web/game/index.audio.position.worklet.js +66 -0
  56. package/dist/dashboard-web/game/index.audio.worklet.js +213 -0
  57. package/dist/dashboard-web/game/index.html +224 -0
  58. package/dist/dashboard-web/game/index.icon.png +0 -0
  59. package/dist/dashboard-web/game/index.js +909 -0
  60. package/dist/dashboard-web/game/index.png +0 -0
  61. package/dist/dashboard-web/index.html +1 -0
  62. package/dist/dashboard.js +87 -13
  63. package/dist/dashboard.js.map +1 -1
  64. package/dist/global-config.d.ts +5 -0
  65. package/dist/global-config.d.ts.map +1 -1
  66. package/dist/global-config.js +2 -0
  67. package/dist/global-config.js.map +1 -1
  68. package/dist/i18n/en.js +2 -2
  69. package/dist/i18n/en.js.map +1 -1
  70. package/dist/i18n/zh.js +2 -2
  71. package/dist/i18n/zh.js.map +1 -1
  72. package/dist/im/lark/card-handler.d.ts.map +1 -1
  73. package/dist/im/lark/card-handler.js +3 -1
  74. package/dist/im/lark/card-handler.js.map +1 -1
  75. package/dist/im/lark/event-dispatcher.d.ts.map +1 -1
  76. package/dist/im/lark/event-dispatcher.js +66 -6
  77. package/dist/im/lark/event-dispatcher.js.map +1 -1
  78. package/dist/im/lark/reply-mode-command.d.ts.map +1 -1
  79. package/dist/im/lark/reply-mode-command.js +4 -1
  80. package/dist/im/lark/reply-mode-command.js.map +1 -1
  81. package/dist/services/bridge-rotation-policy.d.ts +40 -0
  82. package/dist/services/bridge-rotation-policy.d.ts.map +1 -1
  83. package/dist/services/bridge-rotation-policy.js +38 -0
  84. package/dist/services/bridge-rotation-policy.js.map +1 -1
  85. package/dist/services/chat-reply-mode-store.d.ts +1 -1
  86. package/dist/services/chat-reply-mode-store.d.ts.map +1 -1
  87. package/dist/services/chat-reply-mode-store.js +8 -9
  88. package/dist/services/chat-reply-mode-store.js.map +1 -1
  89. package/dist/setup/bot-config-editor.d.ts +9 -0
  90. package/dist/setup/bot-config-editor.d.ts.map +1 -1
  91. package/dist/setup/bot-config-editor.js +11 -0
  92. package/dist/setup/bot-config-editor.js.map +1 -1
  93. package/dist/setup/cli-selection.d.ts +65 -0
  94. package/dist/setup/cli-selection.d.ts.map +1 -0
  95. package/dist/setup/cli-selection.js +112 -0
  96. package/dist/setup/cli-selection.js.map +1 -0
  97. package/dist/setup/interactive-select.d.ts +30 -0
  98. package/dist/setup/interactive-select.d.ts.map +1 -0
  99. package/dist/setup/interactive-select.js +177 -0
  100. package/dist/setup/interactive-select.js.map +1 -0
  101. package/dist/skills/definitions.d.ts.map +1 -1
  102. package/dist/skills/definitions.js +17 -3
  103. package/dist/skills/definitions.js.map +1 -1
  104. package/dist/types.d.ts +1 -0
  105. package/dist/types.d.ts.map +1 -1
  106. package/dist/utils/ready-gate.d.ts +6 -0
  107. package/dist/utils/ready-gate.d.ts.map +1 -1
  108. package/dist/utils/ready-gate.js +6 -0
  109. package/dist/utils/ready-gate.js.map +1 -1
  110. package/dist/worker.js +105 -7
  111. package/dist/worker.js.map +1 -1
  112. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -34,11 +34,15 @@ import { enableAutostart, disableAutostart, autostartStatus, refreshAutostart }
34
34
  import { tmuxEnv } from './setup/ensure-tmux.js';
35
35
  import { writeBotsJsonAtomic as writeBotsAtomic } from './setup/bots-store.js';
36
36
  import { applyBotConfigEdits, assertUniqueBotProcessNames, botProcessName, normalizeBotConfig, parseBotConfigsJson, parseBotSelection, removeBotConfig, resolveCliId, assertOwnerWhenChatGroups, findInvalidAllowedUserEntries, hasOwnerEntry, } from './setup/bot-config-editor.js';
37
+ import { resolveCliSelection, selectionKeyForBot } from './setup/cli-selection.js';
38
+ import { pickCliSelection } from './setup/interactive-select.js';
37
39
  import { buildPreset, serializePreset, presetFilename } from './setup/agent-preset.js';
38
40
  import { logger } from './utils/logger.js';
39
41
  import { invalidWorkingDirs } from './utils/working-dir.js';
40
42
  import { firstPositional } from './cli/arg-utils.js';
41
43
  import { dispatchPrimaryMessage, findStdinAliasAttachment, sendFileAttachments } from './cli/send-dispatch.js';
44
+ import { buildPm2SpawnCommand } from './cli/pm2-command.js';
45
+ import { rejectLikelyWindowsStdinMojibake } from './cli/stdin-encoding.js';
42
46
  import { formatBotInfoEntriesForCli, formatChatBotsForCli, } from './cli/bots-list-output.js';
43
47
  import { buildFooterAddressing, hasKnownBotMention, knownBotOpenIdsFromCrossRef, orderedFooterRecipients, } from './utils/bot-routing.js';
44
48
  import { isLocale, localeForBot, setDefaultLocale, SUPPORTED_LOCALES, t } from './i18n/index.js';
@@ -560,11 +564,15 @@ async function promptBotConfig(rl) {
560
564
  return null;
561
565
  }
562
566
  console.log('✅ 凭证有效(tenant_access_token 已成功获取)\n');
563
- console.log('支持的 CLI: 1) claude-code 2) aiden 3) coco(别名 traecli) 4) codex 5) cursor 6) gemini 7) opencode 8) antigravity 9) mtr 10) hermes 11) codex-app 12) mira 13) seed 14) traex 15) pi 16) copilot 17) oh-my-pi');
564
- const cliChoice = await ask(rl, 'CLI 适配器 [1]: ');
567
+ // CLI 适配器:可搜索的级联选择器(选 Aiden 可进 × Claude / × Codex,aiden 网关)。
568
+ // 非交互终端自动回退为序号 / ID 文本输入。
569
+ const selKey = await pickCliSelection(rl, { title: '选择 CLI 适配器' });
565
570
  let cliId;
571
+ let wrapperCli;
566
572
  try {
567
- cliId = resolveCliId(cliChoice) ?? 'claude-code';
573
+ const sel = resolveCliSelection(selKey ?? 'claude-code');
574
+ cliId = sel.cliId;
575
+ wrapperCli = sel.wrapperCli;
568
576
  }
569
577
  catch (err) {
570
578
  console.log(`\n❌ ${err?.message ?? String(err)}`);
@@ -576,6 +584,8 @@ async function promptBotConfig(rl) {
576
584
  larkAppId: creds.appId,
577
585
  larkAppSecret: creds.appSecret,
578
586
  cliId,
587
+ // aiden × claude/codex 等启动前缀;普通 CLI 不写此字段。
588
+ ...(wrapperCli ? { wrapperCli } : {}),
579
589
  // 总是写 workingDir, 留空用 '~'. 用户手动编辑 bots.json 时一眼能看到字段
580
590
  // 在哪儿, 不用去 README 查字段名.
581
591
  workingDir: workingDir.trim() || '~',
@@ -649,16 +659,28 @@ async function promptEditBotConfig(rl, bot) {
649
659
  '留空保留当前值。',
650
660
  ]);
651
661
  input.larkAppSecret = await ask(rl, `LARK_APP_SECRET [保留当前值]: `);
652
- console.log('\n支持的 CLI: 1) claude-code 2) aiden 3) coco(别名 traecli) 4) codex 5) cursor 6) gemini 7) opencode 8) antigravity 9) mtr 10) hermes 11) codex-app 12) mira 13) seed 14) traex 15) pi 16) copilot 17) oh-my-pi');
662
+ // CLI 适配器:可搜索的级联选择器(选 Aiden 可进 × Claude / × Codex,aiden 网关)。
653
663
  printInputHelp('CLI 适配器', [
654
- '选择 botmux 需要套用哪一种 CLI 参数协议和会话恢复方式。',
655
- 'coco 的别名 traecli 走同一适配器;二进制名是 traecli 也选 coco 即可。',
656
- '留空保留当前值;可以输入序号,也可以直接输入适配器 ID',
664
+ '可搜索的交互式选择:输入关键字过滤、↑/↓ 选择、⏎ 确认、Esc 保留当前值。',
665
+ ' Aiden 进二级菜单:× Claude / × Codex(aiden 网关,无需 wrapper 脚本)。',
666
+ '非交互终端下回退为「输入序号 / 适配器 ID」。',
657
667
  ]);
658
- input.cliChoice = await ask(rl, `CLI 适配器 [${bot.cliId ?? 'claude-code'}]: `);
668
+ const currentKey = selectionKeyForBot(bot.cliId ?? 'claude-code', bot.wrapperCli);
669
+ const selKey = await pickCliSelection(rl, { title: 'CLI 适配器', currentKey });
670
+ if (selKey) {
671
+ try {
672
+ const sel = resolveCliSelection(selKey);
673
+ input.cliChoice = sel.cliId;
674
+ input.wrapperCli = sel.wrapperCli ?? null; // 选普通 CLI 时清掉旧的 aiden×* 前缀
675
+ }
676
+ catch (err) {
677
+ console.log(`\n❌ ${err?.message ?? String(err)}(保留当前 CLI)`);
678
+ }
679
+ }
680
+ // selKey 为 null(Esc / 空)→ input.cliChoice 不设 → 保留当前 CLI。
659
681
  printInputHelp('CLI 可执行文件路径覆盖', [
660
682
  '可选。CLI 入口的绝对路径,用于在原 CLI 外面套一层 wrapper / router。',
661
- '典型场景:ccr (Claude Code Router) / claude-w / aiden-x-claude 等自定义入口。',
683
+ '典型场景:ccr / claude-w 等自定义入口(aiden × claude/codex 选上面那项即可,无需此项)。',
662
684
  '留空保留当前值;输入 - 清空覆盖,回到 PATH 查 cliId 对应的默认二进制。',
663
685
  ]);
664
686
  input.cliPathOverride = await ask(rl, `CLI 可执行文件路径覆盖 [${formatOptionalValue(bot.cliPathOverride)}]: `);
@@ -1099,11 +1121,18 @@ function deleteAllBotmuxProcesses(home = PM2_HOME) {
1099
1121
  timeout: 10_000,
1100
1122
  });
1101
1123
  }
1102
- catch { /* */ }
1124
+ catch (e) {
1125
+ // Don't swallow silently — a failed delete here used to leave the
1126
+ // restart half-done with no trace. Surface it (the auto-restart
1127
+ // driver captures stderr to ~/.botmux/logs/maintenance-restart.log).
1128
+ console.error(`[restart] pm2 delete ${app.name} failed: ${e instanceof Error ? e.message : e}`);
1129
+ }
1103
1130
  }
1104
1131
  }
1105
1132
  }
1106
- catch { /* pm2 not running or no apps */ }
1133
+ catch (e) {
1134
+ console.error(`[restart] pm2 jlist failed (pm2 not running or no apps?): ${e instanceof Error ? e.message : e}`);
1135
+ }
1107
1136
  }
1108
1137
  function killPm2GodDaemon(home = PM2_HOME) {
1109
1138
  try {
@@ -1313,8 +1342,10 @@ function cmdLogs() {
1313
1342
  // Show all botmux logs via pm2 regex match
1314
1343
  target = `/^${PM2_NAME}/`;
1315
1344
  }
1316
- // Use spawn for streaming output
1317
- const child = spawn(pm2Bin(), ['logs', target, '--lines', lines], {
1345
+ // Use spawn for streaming output. Windows cannot spawn a .js CLI script
1346
+ // directly, so run the bundled pm2 script through the current node.exe.
1347
+ const pm2 = buildPm2SpawnCommand(pm2Bin(), ['logs', target, '--lines', lines]);
1348
+ const child = spawn(pm2.command, pm2.args, {
1318
1349
  stdio: 'inherit',
1319
1350
  env: pm2Env(),
1320
1351
  });
@@ -3117,6 +3148,8 @@ async function cmdSend(rest) {
3117
3148
  content = await readStdin();
3118
3149
  }
3119
3150
  }
3151
+ if (!contentFile)
3152
+ rejectLikelyWindowsStdinMojibake(content);
3120
3153
  if (!content.trim() && images.length === 0 && files.length === 0) {
3121
3154
  console.error('没有内容可发送。用法:\n echo "消息" | botmux send\n botmux send "消息"\n botmux send --content-file /tmp/msg.md --images /tmp/chart.png');
3122
3155
  process.exit(1);
@@ -3978,6 +4011,8 @@ async function cmdReport(rest) {
3978
4011
  const pos = positionals(rest);
3979
4012
  content = pos.length ? pos.join(' ') : await readStdin();
3980
4013
  }
4014
+ if (!contentFile)
4015
+ rejectLikelyWindowsStdinMojibake(content);
3981
4016
  if (!content.trim()) {
3982
4017
  console.error('没有回报内容。用法: botmux report "子项目X 完成 + 产出位置"');
3983
4018
  process.exit(1);