aiterm-mcp 0.70.69 → 0.70.70

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/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.70.70] - 2026-11-15
11
+
12
+ - The in-turn model/effort change of a Claude seat (0.70.68) now works on a real running turn (Kiro's Z43 lab, b8 failed with `CLAUDE_MODEL_PICKER_NOT_SHOWN`). Cause, reproduced with Aiterm's own code on a seat running one long Bash call: the running turn's spinner and tool block plus the model picker are taller than the default 24-row pane, so the picker's foot ("Esc to cancel") was cut and unreadable. The in-turn path now makes the pane 50 rows tall for the switch and restores its size afterwards; reads the result of an in-turn switch, which Claude Code prints as a plain indented line (`Model set to sonnet (claude-sonnet-5-5) for this session only`, no `⎿`); and, when the picker is open but unreadable, closes it with Esc only while its heading is on screen (a picker left open would take the owner's next message as keys, which is the likely cause of the Z43 seat that stopped and of `"model": "opus"` appearing in `~/.claude/settings.json` through Enter). Verified on a real 2.1.325 seat: the same turn's next request ran on the new model (transcript).
13
+ - The restore of the user's default after a typed `/model opusplan` (or fast) no longer replaces a symlinked `settings.json` with a copy: BellTeam's account roots link `settings.json` to a shared file, the restore wrote a copy beside the link and the real file kept `"model"`. The lock beside the settings file is taken on the real file, and a dangling lock link no longer makes the wait spin forever (a busy loop that froze the Aiterm process) (model-configuration.md).
14
+
10
15
  ## [0.70.69] - 2026-11-15
11
16
 
12
17
  - The EnterPlanMode spec hook (0.70.67) no longer relies on the call's own transcript rows (Kiro's Z41 lab: a seat that wrote a 300-character spec in the same message was turned back at its first call, 3 of 3 runs). In the interactive Claude Code 2.1.325 the rows of the message that holds the call are often not in the transcript while the hook runs, however long the hook waits (measured up to 2.6 s; they appear after the hook returns), so the hook now counts the assistant text since the last real user prompt up to the call: an earlier message of the same prompt with 80+ characters lets the first call through. When the call's own message is not readable and nothing earlier was written, the first call of a prompt is turned back once (the instruction now says that a seat that has just written its spec only needs to call EnterPlanMode again), the second call always enters. The wait for the call's row is 600 ms instead of 1500 ms (harness-contracts.md "EnterPlanModeの前に仕様を書かせる").
@@ -3526,7 +3531,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3526
3531
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3527
3532
  provenance.
3528
3533
 
3529
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.69...HEAD
3534
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.70...HEAD
3535
+ [0.70.70]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.69...v0.70.70
3530
3536
  [0.70.69]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.68...v0.70.69
3531
3537
  [0.70.68]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.67...v0.70.68
3532
3538
  [0.70.67]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.66...v0.70.67
package/README.ja.md CHANGED
@@ -215,7 +215,7 @@ runtime-error store は canonical dotagents config の `collection.enabled: true
215
215
  場合だけ収集し、既定OFF、network送信は行いません。tag起点CIのnpm provenance(OIDC Trusted
216
216
  Publishing)で公開し、GitHub Release が Official MCP Registry を再登録します。
217
217
 
218
- **状態:** 開発継続中 · 現行公開版 **v0.70.69** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.70.70** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
219
219
 
220
220
  ### 更新と巻き戻し
221
221
 
package/README.md CHANGED
@@ -227,7 +227,7 @@ collection is off by default and performs no network I/O. It ships via
227
227
  tag-triggered CI with npm provenance (OIDC Trusted Publishing); the GitHub
228
228
  Release re-registers the Official MCP Registry entry.
229
229
 
230
- **Status:** actively maintained · current public release **v0.70.69** · runs on Linux · WSL2 · macOS · native Windows (tmux on POSIX, the tmux-CLI-compatible [psmux](https://github.com/psmux/psmux) on native Windows — no WSL required) · MIT · see the [CHANGELOG](CHANGELOG.md).
230
+ **Status:** actively maintained · current public release **v0.70.70** · runs on Linux · WSL2 · macOS · native Windows (tmux on POSIX, the tmux-CLI-compatible [psmux](https://github.com/psmux/psmux) on native Windows — no WSL required) · MIT · see the [CHANGELOG](CHANGELOG.md).
231
231
 
232
232
  ### Update and rollback
233
233
 
package/dist/core.js CHANGED
@@ -6723,6 +6723,22 @@ function claudeSeatCatalogEnv(name, meta) {
6723
6723
  env[key] = value;
6724
6724
  return env;
6725
6725
  }
6726
+ const IN_TURN_PANE_ROWS = 50;
6727
+ /**
6728
+ * The lines of a running turn (spinner, a tool's block) plus the model picker are taller than the default 24-row pane: the picker's
6729
+ * foot ("Esc to cancel") is cut and the picker cannot be read (Z43 lab, reproduced on 2.1.325). The pane is made taller for the
6730
+ * switch; returns the undo (the original size), or null when nothing was changed.
6731
+ */
6732
+ async function tallenPaneForPicker(name) {
6733
+ const size = tmux("display-message", "-p", "-t", `=${name}:`, "#{window_width} #{window_height}");
6734
+ const [width, height] = size.stdout.trim().split(/\s+/u).map(Number);
6735
+ if (size.code !== 0 || !(width > 0) || !(height > 0) || height >= IN_TURN_PANE_ROWS)
6736
+ return null;
6737
+ if (tmux("resize-window", "-t", name, "-x", String(width), "-y", String(IN_TURN_PANE_ROWS)).code !== 0)
6738
+ return null;
6739
+ await sleep(400); // Claude Code redraws to the new height
6740
+ return () => { tmux("resize-window", "-t", name, "-x", String(width), "-y", String(height)); };
6741
+ }
6726
6742
  /** Whether a Claude goal is running on the seat (inside the send lock). Unreadable counts as no goal: the picker path is harmless either way. */
6727
6743
  async function claudeGoalActive(name, meta) {
6728
6744
  try {
@@ -6851,8 +6867,15 @@ async function configureAgentInLock(name, model, effort, fast, beforeChange) {
6851
6867
  }
6852
6868
  if (model?.toLowerCase() === "opusplan")
6853
6869
  await switchClaudeOpusPlan(name, meta, beforeChange);
6854
- if (model || level)
6855
- await configureClaudeForSessionOnly(name, meta, model, level, beforeChange, { ...agentModelUi(name), ready: () => waitAgentTuiReady(name, meta, AGENT_TUI_READY_TIMEOUT_MS) }, claudeSeatEnv() ?? process.env, inTurn);
6870
+ if (model || level) {
6871
+ const restoreSize = inTurn ? await tallenPaneForPicker(name) : null;
6872
+ try {
6873
+ await configureClaudeForSessionOnly(name, meta, model, level, beforeChange, { ...agentModelUi(name), ready: () => waitAgentTuiReady(name, meta, AGENT_TUI_READY_TIMEOUT_MS) }, claudeSeatEnv() ?? process.env, inTurn);
6874
+ }
6875
+ finally {
6876
+ restoreSize?.();
6877
+ }
6878
+ }
6856
6879
  if (effort && !level) {
6857
6880
  beforeChange();
6858
6881
  await sendAgentPromptText(name, `/effort ${effort}`);
@@ -59,6 +59,17 @@ inTurn = false) {
59
59
  if (!now) {
60
60
  // 読めない形の画面が開いたままだと、席が次の文を受け取れない。入力待ちでも動作中でもない時だけ、Escを1度打って閉じる。
61
61
  let state = claudePaneObservation(screen());
62
+ // In a running turn the picker may be open but not readable; Esc closes it only while its heading is on screen
63
+ // (anywhere else an Esc stops the turn), and a picker left open would take the next typed message as keys (Z43).
64
+ const headingShown = () => /^\s*(?:Select model|Choose a model)\s*$/mu.test(screen());
65
+ let closedPicker = false;
66
+ if (inTurn) {
67
+ for (let i = 0; i < 3 && headingShown(); i++) {
68
+ ui.key("Escape");
69
+ await sleep(300);
70
+ }
71
+ closedPicker = !headingShown();
72
+ }
62
73
  if (!inTurn && state.state === "unknown") {
63
74
  ui.key("Escape");
64
75
  await sleep(500);
@@ -67,7 +78,8 @@ inTurn = false) {
67
78
  const error = new AitermError(`CLAUDE_MODEL_PICKER_NOT_SHOWN vendor=claude session=${name} state=${state.state}/${state.reason}\n` +
68
79
  "Claude Codeの /model の選ぶ画面を読めません(Claude Codeの版で画面の形が変わった見込み)。modelとreasoning_effortは変えていません。", 2);
69
80
  // 読めない画面が何を受けたかは分からないので、選ばれていないとは記録しない。
70
- error.configureRefusal = { code: "CLAUDE_MODEL_PICKER_NOT_SHOWN", relaunch: false, selection_excluded: false };
81
+ // In a running turn only the opening key and the closing Esc were sent, so nothing was selected once the picker is gone.
82
+ error.configureRefusal = { code: "CLAUDE_MODEL_PICKER_NOT_SHOWN", relaunch: false, selection_excluded: closedPicker };
71
83
  throw error;
72
84
  }
73
85
  if (!now.session_only) {
@@ -637,11 +637,13 @@ export function claudeModelSwitchConfirm(screen) {
637
637
  }
638
638
  function switchResultAt(lines, start) {
639
639
  const parts = [lines[start].replace(/^\s*⎿\s+/u, "").trim()];
640
- for (const line of lines.slice(start + 1)) {
641
- if (!/^\s{3,}\S/u.test(line) || /^\s*⎿/u.test(line))
642
- break;
643
- parts.push(line.trim());
644
- }
640
+ // Only a ⎿ row can continue on the lines below; the plain notification of an in-turn switch is one line.
641
+ if (/^\s*⎿/u.test(lines[start]))
642
+ for (const line of lines.slice(start + 1)) {
643
+ if (!/^\s{3,}\S/u.test(line) || /^\s*⎿/u.test(line))
644
+ break;
645
+ parts.push(line.trim());
646
+ }
645
647
  const line = parts.join(" ");
646
648
  if (/\bblocked by a PreModelSwitch hook\b/u.test(line))
647
649
  return { scope: "blocked", line };
@@ -663,11 +665,12 @@ export function claudeModelSwitchResult(screen) {
663
665
  }
664
666
  /**
665
667
  * Every switch result line on the screen, oldest first. A switch made with Alt+P in a running turn prints its result with no
666
- * `❯ /model` line above it (2.1.325), so the caller compares against the lines present before the picker was opened.
668
+ * `❯ /model` line above it and without the ⎿ mark (2.1.325), so the caller compares against the lines present before the picker was opened.
667
669
  */
668
670
  export function claudeModelSwitchResults(screen) {
669
671
  const lines = screen.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").split(/\r?\n/u);
670
- return lines.flatMap((text, i) => /^\s*⎿\s+\S/u.test(text) ? [switchResultAt(lines, i)] : []).filter(row => row !== null);
672
+ // A switch made with Alt+P in a running turn shows its result as a plain, indented notification line: no ⎿ (2.1.325 lab).
673
+ return lines.flatMap((text, i) => /^\s*(?:⎿\s+\S|(?:Model set to|Set model to|Kept model as)\b)/u.test(text) ? [switchResultAt(lines, i)] : []).filter(row => row !== null);
671
674
  }
672
675
  // Claude Code 2.1.282 は選択肢へ「1.」などの番号を付ける。番号の有無のどちらも受ける。
673
676
  export function claudeLoginMethodMenu(screen) {
@@ -16,7 +16,7 @@ const LOCK_POLL_MS = 120;
16
16
  * 設定fileの置き場が無い・書けない時は、harnessも書けないので鍵なしで通す。
17
17
  */
18
18
  export async function withUserConfigLock(configPath, action) {
19
- const lock = `${configPath}.aiterm-lock`;
19
+ const lock = `${realPathOrSelf(configPath)}.aiterm-lock`;
20
20
  if (!fs.existsSync(path.dirname(configPath)))
21
21
  return action();
22
22
  const deadline = Date.now() + LOCK_WAIT_MS;
@@ -32,9 +32,10 @@ export async function withUserConfigLock(configPath, action) {
32
32
  }
33
33
  let age = 0;
34
34
  try {
35
- age = Date.now() - fs.statSync(lock).mtimeMs;
35
+ age = Date.now() - fs.lstatSync(lock).mtimeMs;
36
36
  }
37
37
  catch {
38
+ await sleep(LOCK_POLL_MS);
38
39
  continue;
39
40
  }
40
41
  if (age > LOCK_STALE_MS) {
@@ -72,7 +73,17 @@ export function readFileOrNull(file) {
72
73
  return null;
73
74
  }
74
75
  }
75
- function writeInPlace(file, body) {
76
+ /** A root's settings.json can be a symlink to a shared file (BellTeam 2nd-account roots): lock and write the real file, never replace the link. */
77
+ function realPathOrSelf(file) {
78
+ try {
79
+ return fs.realpathSync(file);
80
+ }
81
+ catch {
82
+ return file;
83
+ }
84
+ }
85
+ function writeInPlace(link, body) {
86
+ const file = realPathOrSelf(link);
76
87
  let mode = 0o600;
77
88
  try {
78
89
  mode = fs.statSync(file).mode & 0o777;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.70.69",
3
+ "version": "0.70.70",
4
4
  "mcpName": "io.github.kitepon/aiterm-mcp",
5
5
  "description": "Persistent terminal MCP with one harness-based launcher for Claude Code, Codex CLI, Grok CLI, Cursor Agent CLI, and Antigravity CLI, plus durable PTYs for SSH, containers, and REPLs.",
6
6
  "keywords": [