botmux 2.81.0 → 2.82.0

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/dist/worker.js CHANGED
@@ -39,7 +39,7 @@ import { t, setDefaultLocale } from './i18n/index.js';
39
39
  import { TerminalRenderer } from './utils/terminal-renderer.js';
40
40
  import { DEFAULT_RENDER_COLS, DEFAULT_RENDER_ROWS, MAX_RENDER_COLS, MAX_RENDER_ROWS, MIN_RENDER_COLS, MIN_RENDER_ROWS, clamp, resolveRenderDimensions, } from './utils/render-dimensions.js';
41
41
  import { createCliAdapterSync, locateOnPath } from './adapters/cli/registry.js';
42
- import { buildWrappedLaunch, parseWrapperCli } from './setup/cli-selection.js';
42
+ import { buildWrappedLaunch, parseWrapperCli, isTtadkWrapper } from './setup/cli-selection.js';
43
43
  import { findLaunchedCliPid, scheduleWrapperRealCliPid } from './core/session-discovery.js';
44
44
  import { claudeJsonlPathForSession, resolveJsonlFromPid, findOpenClaudeSessionIds, DEFAULT_CLAUDE_DATA_DIR } from './adapters/cli/claude-code.js';
45
45
  import { mtrSessionIdForBotmuxSession } from './adapters/cli/mtr.js';
@@ -3685,6 +3685,9 @@ function spawnCli(cfg) {
3685
3685
  // `lastInitConfig.resume` (= true) and baseline an empty store, swallowing
3686
3686
  // the fresh session's first turn.
3687
3687
  lastSpawnEffectiveResume = effectiveResume;
3688
+ // ttadk 网关:模型走 ttadk 自己的 `-m`(启动期注入到 ttadk 前缀,见下方 wrapperCli
3689
+ // 分支),不能再把 cfg.model 透给底层适配器,否则真实 CLI 会再吃一个 --model 重复。
3690
+ const ttadkGateway = isTtadkWrapper(cfg.wrapperCli);
3688
3691
  const args = cliAdapter.buildArgs({
3689
3692
  sessionId: effectiveAdapterSessionId,
3690
3693
  resume: effectiveResume,
@@ -3694,7 +3697,7 @@ function spawnCli(cfg) {
3694
3697
  botName: cfg.botName,
3695
3698
  botOpenId: cfg.botOpenId,
3696
3699
  locale: cfg.locale,
3697
- model: cfg.model,
3700
+ model: ttadkGateway ? undefined : cfg.model,
3698
3701
  disableCliBypass: cfg.disableCliBypass === true,
3699
3702
  });
3700
3703
  // Extra args from env (CLI_DISABLE_DEFAULT_ARGS is removed — adapters own their defaults)
@@ -3925,11 +3928,21 @@ function spawnCli(cfg) {
3925
3928
  log(`wrapperCli="${cfg.wrapperCli}" ignored: file sandbox enabled and takes precedence (cannot combine launch prefix with bwrap)`);
3926
3929
  }
3927
3930
  else {
3928
- const launch = buildWrappedLaunch(cfg.wrapperCli, spawnArgs, (b) => locateOnPath(b) ?? b);
3931
+ const launch = buildWrappedLaunch(cfg.wrapperCli, spawnArgs, (b) => locateOnPath(b) ?? b, {
3932
+ ttadkModel: cfg.model,
3933
+ });
3929
3934
  if (launch.bin) {
3930
3935
  spawnBin = launch.bin;
3931
3936
  spawnArgs = launch.args;
3932
3937
  log(`Launch prefix: spawning ${spawnBin} ${spawnArgs.slice(0, 2).join(' ')} … (cliId=${cfg.cliId})`);
3938
+ // ttadk runs its launched agent through a gateway that pops an interactive
3939
+ // model-picker unless `-m <model>` is given. buildWrappedLaunch injects
3940
+ // `-m <bot.model || glm-5.1> --skip-check` into the ttadk prefix above
3941
+ // (CoCo excluded — it takes no -m). The model is sourced from the bot's
3942
+ // `model` config (editable in the dashboard), NOT baked into wrapperCli.
3943
+ if (ttadkGateway) {
3944
+ log(`ttadk launcher: model=${(cfg.model ?? '').trim() || 'glm-5.1 (default)'} injected as -m, suppressed on underlying ${cfg.cliId}`);
3945
+ }
3933
3946
  // cjadk runs its launched agent in an INTERACTIVE wrapper by default —
3934
3947
  // a model/session selector at startup plus terminal quirks that fight
3935
3948
  // botmux's automated input (the selector eats the first prompt; the