aiterm-mcp 0.70.68 → 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 +12 -1
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/claude-plan-spec-hook.js +30 -24
- package/dist/core.js +25 -2
- package/dist/harnesses/claude-configure.js +13 -1
- package/dist/harnesses/claude.js +10 -7
- package/dist/user-config.js +14 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ 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
|
+
|
|
15
|
+
## [0.70.69] - 2026-11-15
|
|
16
|
+
|
|
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の前に仕様を書かせる").
|
|
18
|
+
|
|
10
19
|
## [0.70.68] - 2026-11-15
|
|
11
20
|
|
|
12
21
|
- `agent_configure` now changes the model or the effort (low to max) of a Claude seat whose turn is running, without ending the turn (b8, Kiro's request, Owner's order). Typing `/model` into a busy Claude seat only queues it as a user message (2.1.325), so the picker is opened with Alt+P (tmux/psmux key `M-p`, ESC and p in one write; a lone ESC would stop the turn) and the usual row match, `s` (this session only, never Enter), "Yes, switch" and refusal logic (`configureRefusal`, `aiterm/configure_error`) follow. The same turn's next request runs on the new model. Differences from an idle seat: no Esc is sent except to close the picker or the switch question while one is on screen, the result line is read without the `❯ /model` line above it, and no composer is waited for. Idle seats still use `/model`. `fast`, `opusplan`, `ultracode`, an effort outside low-max and a running Claude goal keep the refusal "入力待ちではありません" (nothing typed). A seat already in a running turn needs no relaunch; the change is on the seat's own session only (model-configuration.md).
|
|
@@ -3522,7 +3531,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
|
|
|
3522
3531
|
`ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
|
|
3523
3532
|
provenance.
|
|
3524
3533
|
|
|
3525
|
-
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.
|
|
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
|
|
3536
|
+
[0.70.69]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.68...v0.70.69
|
|
3526
3537
|
[0.70.68]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.67...v0.70.68
|
|
3527
3538
|
[0.70.67]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.66...v0.70.67
|
|
3528
3539
|
[0.70.66]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.65...v0.70.66
|
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.
|
|
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.
|
|
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
|
|
|
@@ -9,12 +9,13 @@ import { currentUid, runtimeStateBase } from "./state-root.js";
|
|
|
9
9
|
const MAX_STDIN_BYTES = 8 * 1024 * 1024;
|
|
10
10
|
const TAIL_BYTES = 512 * 1024;
|
|
11
11
|
const POLL_MS = 50;
|
|
12
|
-
const WAIT_MS =
|
|
12
|
+
const WAIT_MS = 600; // rows that are readable at all show up within ~110 ms (measured); waiting longer never helped
|
|
13
13
|
// shortcut: a length floor, because the spec is the AI's own words and a tool cannot judge it; raise it if seats pass one-line stubs.
|
|
14
14
|
const SPEC_MIN_CHARS = 80;
|
|
15
15
|
const AITERM_ENV = ["AITERM_AGENT_KIND", "AITERM_SESSION_ID", "AITERM_AGENT_SESSION_ID", "AITERM_AGENT_LAUNCH_ID"];
|
|
16
16
|
const GUIDANCE = "プランモードに入る前に、プランを練りたい内容の詳細な仕様を、あなた自身の言葉で書いてください。"
|
|
17
|
-
+ "何を作る・直す・調べるのか、範囲、守る条件、終わりの形を書いたうえで、もう一度 EnterPlanMode を呼んでください。"
|
|
17
|
+
+ "何を作る・直す・調べるのか、範囲、守る条件、終わりの形を書いたうえで、もう一度 EnterPlanMode を呼んでください。"
|
|
18
|
+
+ "(この呼びの直前に書き終えている場合は、書き直さずにもう一度 EnterPlanMode を呼ぶだけで入れます。)";
|
|
18
19
|
async function readStdin() {
|
|
19
20
|
const chunks = [];
|
|
20
21
|
let total = 0;
|
|
@@ -51,10 +52,13 @@ function blocksOf(row) {
|
|
|
51
52
|
return Array.isArray(row.message?.content) ? row.message.content : [];
|
|
52
53
|
}
|
|
53
54
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
55
|
+
* What the transcript says about the spec of this EnterPlanMode call: the characters of assistant text written since the last
|
|
56
|
+
* real user prompt up to the call (earlier messages of the same prompt count; text in the call's own message counts up to the
|
|
57
|
+
* tool_use), and whether the call's tool_use row is in the file yet. In the interactive CLI (2.1.325) the rows of the message
|
|
58
|
+
* that holds the call are often not in the file while the hook runs, however long it waits (measured 2026-11-15, up to 2.6 s),
|
|
59
|
+
* so `visible: false` means "not readable", not "nothing written".
|
|
56
60
|
*/
|
|
57
|
-
export function
|
|
61
|
+
export function specEvidence(transcript, toolUseId) {
|
|
58
62
|
const rows = [];
|
|
59
63
|
for (const line of transcript.split("\n")) {
|
|
60
64
|
try {
|
|
@@ -62,23 +66,25 @@ export function specChars(transcript, toolUseId) {
|
|
|
62
66
|
}
|
|
63
67
|
catch { /* a half-written or foreign line */ }
|
|
64
68
|
}
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
const isCall = (block) => block?.type === "tool_use" && block.id === toolUseId;
|
|
70
|
+
const at = rows.findIndex(row => blocksOf(row).some(isCall));
|
|
71
|
+
const end = at < 0 ? rows.length : at + 1;
|
|
72
|
+
// A real prompt is a user row that holds text (a tool_result-only user row is the answer to a tool call).
|
|
73
|
+
let prompt = end - 1;
|
|
74
|
+
while (prompt >= 0 && !(rows[prompt].type === "user"
|
|
75
|
+
&& (typeof rows[prompt].message?.content === "string" || blocksOf(rows[prompt]).some(block => block?.type === "text"))))
|
|
76
|
+
prompt -= 1;
|
|
77
|
+
let chars = 0;
|
|
78
|
+
for (let i = prompt + 1; i < end; i += 1) {
|
|
79
|
+
if (rows[i].type !== "assistant")
|
|
80
|
+
continue;
|
|
81
|
+
const blocks = blocksOf(rows[i]);
|
|
82
|
+
for (const block of i === at ? blocks.slice(0, blocks.findIndex(isCall)) : blocks) {
|
|
83
|
+
if (block?.type === "text" && typeof block.text === "string")
|
|
84
|
+
chars += block.text.trim().length;
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
|
-
|
|
81
|
-
return texts.reduce((sum, block) => sum + block.text.trim().length, 0);
|
|
87
|
+
return { visible: at >= 0, chars };
|
|
82
88
|
}
|
|
83
89
|
function stateFile(env) {
|
|
84
90
|
const seat = env.AITERM_SESSION_ID;
|
|
@@ -103,17 +109,17 @@ export async function planSpecDecision(payload, env = process.env, timing = { wa
|
|
|
103
109
|
return null;
|
|
104
110
|
}
|
|
105
111
|
catch { /* nothing recorded yet */ }
|
|
106
|
-
let
|
|
112
|
+
let evidence = { visible: false, chars: 0 };
|
|
107
113
|
for (let waited = 0;; waited += timing.pollMs) {
|
|
108
114
|
const tail = readTail(input.transcript_path);
|
|
109
115
|
if (tail === null)
|
|
110
116
|
return null;
|
|
111
|
-
|
|
112
|
-
if (chars
|
|
117
|
+
evidence = specEvidence(tail, input.tool_use_id);
|
|
118
|
+
if (evidence.chars >= SPEC_MIN_CHARS || evidence.visible || waited >= timing.waitMs)
|
|
113
119
|
break;
|
|
114
120
|
await sleep(timing.pollMs);
|
|
115
121
|
}
|
|
116
|
-
if (chars
|
|
122
|
+
if (evidence.chars >= SPEC_MIN_CHARS)
|
|
117
123
|
return null;
|
|
118
124
|
// Record the turn-back first: if it cannot be recorded the second call could not be let through, so allow instead.
|
|
119
125
|
try {
|
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
|
-
|
|
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
|
-
|
|
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) {
|
package/dist/harnesses/claude.js
CHANGED
|
@@ -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
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
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
|
-
|
|
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) {
|
package/dist/user-config.js
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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.
|
|
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": [
|