aiterm-mcp 0.70.34 → 0.70.36

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,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.36] - 2026-11-12
11
+
12
+ - A fresh `agent_launch` whose seat is not ready before any prompt byte no longer leaves that seat behind. When the startup check ends blocked (a first-run or onboarding screen such as Claude's "Security notes", an unknown dialog, a dialog Aiterm does not answer, a harness that exited), the launch closes the seat it created and refuses with `AGENT_STARTUP_BLOCKED: … reason=<observation reason>` and `_meta["aiterm/launch_error"]` `{code: "AGENT_STARTUP_BLOCKED", phase: "input", effect: "not_started", session_created: false, action}`. `action` says what the account holder does (for Claude's first run: start `claude` once on that computer and finish its steps). This covers the `trust_project` launch without a prompt and every launch with a prompt, on all five harnesses. If the close itself fails, the previous refusal that leaves the seat is returned. A resume and a launch without a prompt, `trust_project` or fast (startup `not_checked`) are unchanged.
13
+ - Claude's Bypass Permissions warning (2.1.322 draws "No, exit" / "Yes, I accept" without numbers) is no longer read as an idle composer when "Yes, I accept" is selected. That misread could report a launch `startup.ready` on the warning screen, and the prompt was never typed (Centi, BellTeam lab 2026-11-12).
14
+
15
+ ## [0.70.35] - 2026-11-12
16
+
17
+ - Writes that one Aiterm process forwards to the same terminal seat now leave it one at a time: `pty_send`, `agent_configure` and `agent_goal` other than `inspect`, keyed by terminal and session. The next one starts when the previous forward has returned, success or failure. A local seat already had this inside one process (`withAgentSendLock`); a terminal seat did not, because each forward runs its own `aiterm-mcp` on the terminal. Reads are not queued, other seats are not queued, and a `pty_send` holds the order only for its forward, not for the steer `wait_process` relay that may follow. Two Aiterm processes forwarding to one seat are still not ordered by Aiterm (0.63.12).
18
+
10
19
  ## [0.70.34] - 2026-11-12
11
20
 
12
21
  - `agent_goal` `inspect` on a Claude Code seat no longer types anything into the seat. It used to paste `/goal` into the composer, press Enter, read the dialog and press Escape, so a plain read depended on an empty composer, the turn state, the TTY owner, the screen layout of one Claude Code version and on being the only writer to that composer. Every goal-read failure of 2026-11-12 came from one of those conditions; the last one left `/goal/goal` in a Mac seat's composer when two SSH-forwarded reads (one `aiterm-mcp` process each) pasted at the same time, and every later read was refused. The read now takes the last `goal_status` row of the seat's own session transcript, which is the record Claude Code itself restores the goal from on resume and carries across compaction (2.1.322). It takes no send lock, works while a turn runs or the composer holds a draft, reads a seat that has not had its first turn as "no goal", and does not check the Claude Code version. Result schema and reasons are unchanged, except that the dialog-only reasons (`native_goal_fresh_dialog_unavailable`, `native_goal_dialog_changed`, `goal_input_not_empty_or_ready` on inspect) no longer occur and an unknown row shape reports `native_status_format_unavailable`. Measured on a live seat mid-turn: 64 ms instead of 0.7 s (17 s on Windows).
@@ -3349,7 +3358,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3349
3358
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3350
3359
  provenance.
3351
3360
 
3352
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.34...HEAD
3361
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.36...HEAD
3362
+ [0.70.36]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.35...v0.70.36
3363
+ [0.70.35]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.34...v0.70.35
3353
3364
  [0.70.34]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.33...v0.70.34
3354
3365
  [0.70.33]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.32...v0.70.33
3355
3366
  [0.70.32]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.31...v0.70.32
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.34** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.70.36** · 動作対象は 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.34** · 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.36** · 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
@@ -55,7 +55,7 @@ import { readLinuxProcessRegistrationIdentity, readClaudeRegistrationIdentity, r
55
55
  import { liveNodeExecutable } from "./live-node.js";
56
56
  import { resolveClaudeConfigurationRoot, withClaudeConfigRoot, withClaudeSlotLogin } from "./claude-config-root.js";
57
57
  import { probeWriteBan, writeBanPrefix, windowsWriteBanArgv } from "./write-ban.js";
58
- import { AitermError, launchAuthRequired, launchInputRefusal, AgentResumeUnavailableError, AgentResumeError, telemetryOwnedFailure, ownTelemetryFailure } from "./errors.js";
58
+ import { AitermError, launchAuthRequired, launchInputRefusal, launchStartupBlocked, AgentResumeUnavailableError, AgentResumeError, telemetryOwnedFailure, ownTelemetryFailure } from "./errors.js";
59
59
  import { isWin, SOCKDIR, SOCK, tmuxCommand, readOnlyTmuxList, PtyDiagnosticError, tmuxCommandWithInput, sendPsmuxPayload, loadPtyBufferChunk, pasteBufferBaseArgs, tmuxNewSession, withNativeSessionCreation, withNativeSessionTarget, hasVerifiedNativeSessionTarget, withNativeSessionSetupRollback, hasNativeSessionSetupRollback, registeredSessionEnvironment, registerSessionEnvironment, attachCommand, normalizePaneCommand, atomicShellMultiline, appendMarkSentinel, paneShellForSubmission, adaptShellSubmission, settlePaneLog, paneCwdArgument, sessionEnvironmentLaunch, paneCommandArgs, rememberPaneShell, } from "./tmux-runtime.js";
60
60
  import { AGENT_DEFAULT_PREFACE, sleep, currentUid, runtimeStateBase, safeStatSize, readFileRange, writeJson0600, writeText0600, createEmpty0600, shq, LAUNCH_ID_RE, AGENT_LINEAGE_RE, AGENT_DONE_POLL_MS, AGENT_RATE_LIMIT_POLL_MS, pollGate, AGENT_EVENT_MAX_BYTES, assertSessionName, agentsDir, readAgentGeneration, selectAgentMetadataFile, publishAgentGeneration, agentMetadataPath, writeAgentMetadata, AGENT_EVENT_TAIL_BYTES, agentLabel, agentHarness, } from "./agent-shared.js";
61
61
  import { AuthResponseError, authUi, authPromptDigest, authBindingSchema, authResponseSchema } from "./agent-auth-ui.js";
@@ -4724,12 +4724,24 @@ async function sendAgentPromptText(name, text, kind, inputMeta) {
4724
4724
  // 利用者が端末で済ませるしかない起動前の状態。reasonだけでは直し方が分からないので案内を添える。
4725
4725
  function startupBlockedHint(reason) {
4726
4726
  if (reason === "vendor_onboarding_required") {
4727
- return "\nClaude Codeの初回案内(テーマ・ログイン方法の選択)か、利用規約の更新への回答が済んでいません。`claude auth status` がログイン済みでも、" +
4727
+ return "\nClaude Codeの初回案内(テーマ・ログイン方法の選択・セキュリティの注意)か、利用規約の更新への回答が済んでいません。`claude auth status` がログイン済みでも、" +
4728
4728
  "済むまでは起動のたびにこの画面で止まります。規約への回答はアカウントの持ち主が選ぶもので、Aitermは答えません。" +
4729
4729
  "対象端末で一度 `claude` を起動し、画面の案内を最後まで進めてください。";
4730
4730
  }
4731
4731
  return "";
4732
4732
  }
4733
+ /** A fresh launch blocked before any prompt byte closes the seat it created and refuses (launch-identity-input.md).
4734
+ * If the close fails, null: the caller keeps its refusal that leaves the seat. */
4735
+ function startupBlockedRefusal(name, kind, reason) {
4736
+ try {
4737
+ closeSessionInternal(name, true);
4738
+ }
4739
+ catch {
4740
+ return null;
4741
+ }
4742
+ return launchStartupBlocked(agentHarness(kind), reason, startupBlockedHint(reason).trim()
4743
+ || `起動の途中の画面(${reason})で止まりました。端末でそのAIを一度起動して画面を進めてから、起こし直してください。`);
4744
+ }
4733
4745
  function setInitialDelivery(meta, value, cursor) {
4734
4746
  meta.initial_prompt_delivery = value;
4735
4747
  meta.initial_prompt_cursor = cursor;
@@ -4821,9 +4833,9 @@ async function sendInitialAgentPromptInLock(name, text, o) {
4821
4833
  const startup = await prepareAgentInput(name, meta, o);
4822
4834
  if (startup.status !== "ready") {
4823
4835
  setInitialDelivery(meta, { status: "not_sent", reason: startup.reason, turn_started: false }, null);
4824
- throw new AitermError(`initial_prompt=not_sent vendor=${meta.kind} ready=false harness=${agentHarness(meta.kind)}\n` +
4836
+ throw Object.assign(new AitermError(`initial_prompt=not_sent vendor=${meta.kind} ready=false harness=${agentHarness(meta.kind)}\n` +
4825
4837
  `agent session '${name}' の起動準備が完了していないため、promptは送信していません。reason=${startup.reason}` +
4826
- startupBlockedHint(startup.reason), 2);
4838
+ startupBlockedHint(startup.reason), 2), { startupBlocked: startup.reason });
4827
4839
  }
4828
4840
  await o.after_ready?.(name, meta);
4829
4841
  const promptText = meta.kind === "cursor" ? cursorPromptWithLineage(meta, text) : meta.kind === "antigravity" ? antigravityPromptWithCaller(meta, text) : text;
@@ -8535,7 +8547,7 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
8535
8547
  throw new AgentLaunchPromptError(`session_id: ${sid}\n起動準備中に失敗しました。${error instanceof Error ? error.message : String(error)}`, error instanceof AitermError ? error.code : 1, sid, delivery, null, { status: "blocked", reason: "startup_failed" });
8536
8548
  }
8537
8549
  if (startup.status !== "ready")
8538
- throw new AgentLaunchPromptError(`session_id: ${sid}\n起動準備を完了できませんでした。reason=${startup.reason}${startupBlockedHint(startup.reason)}`, 2, sid, delivery, null, startup);
8550
+ throw startupBlockedRefusal(sid, kind, startup.reason) ?? new AgentLaunchPromptError(`session_id: ${sid}\n起動準備を完了できませんでした。reason=${startup.reason}${startupBlockedHint(startup.reason)}`, 2, sid, delivery, null, startup);
8539
8551
  await switchAfterReady(sid, loadAgentMetadata(sid));
8540
8552
  }
8541
8553
  return [sid, hint, null, null, delivery, startup, fastResult];
@@ -8555,6 +8567,13 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
8555
8567
  const code = e instanceof AitermError ? e.code : 1;
8556
8568
  const message = e instanceof Error ? e.message : String(e);
8557
8569
  const meta = loadAgentMetadata(sid);
8570
+ // Blocked before any prompt byte: nothing of the caller's reached the seat, so the seat is closed and the launch refused.
8571
+ const blocked = e.startupBlocked;
8572
+ if (blocked && meta.initial_prompt_delivery?.status === "not_sent") {
8573
+ const refusal = startupBlockedRefusal(sid, kind, blocked);
8574
+ if (refusal)
8575
+ throw refusal;
8576
+ }
8558
8577
  throw new AgentLaunchPromptError(`session_id: ${sid}\n` +
8559
8578
  `起動後の初回 prompt 処理で失敗しました。session は調査/復旧用に残しています。\n${message}`, code, sid, meta.initial_prompt_delivery ?? { status: "not_sent", reason: "startup_failed", turn_started: false }, meta.initial_prompt_cursor ?? null, { status: meta.initial_prompt_delivery?.status === "submitted_unconfirmed" ? "ready" : "blocked",
8560
8579
  reason: meta.initial_prompt_delivery?.reason ?? "startup_failed" });
package/dist/errors.js CHANGED
@@ -21,6 +21,12 @@ export function launchInputRefusal(harness, reason) {
21
21
  error.launchNotStarted = { harness, phase: "input" };
22
22
  return error;
23
23
  }
24
+ /** The launch stopped on a startup screen Aiterm does not answer and closed the seat it created (R18, AGENT_STARTUP_BLOCKED). */
25
+ export function launchStartupBlocked(harness, reason, action) {
26
+ const error = new AitermError(`AGENT_STARTUP_BLOCKED: 起動の途中の画面で止まったため、作った席を閉じました。席は残っていません。reason=${reason}\n${action}`, 2);
27
+ error.launchNotStarted = { harness, phase: "input", code: "AGENT_STARTUP_BLOCKED", action };
28
+ return error;
29
+ }
24
30
  /** The harness CLI is not logged in; the launch is refused before any session exists (remote-terminal.md R18, code AGENT_AUTH_REQUIRED). */
25
31
  export function launchAuthRequired(harness, reason) {
26
32
  const error = new AitermError(`AGENT_LAUNCH_NOT_STARTED: AGENT_AUTH_REQUIRED: ${reason}`, 2);
@@ -395,7 +395,8 @@ export function claudeTuiReady(screen) {
395
395
  // Claude Code 2.1.251 のworkspace trust UIも選択カーソルに❯を使う。
396
396
  // 最後のmarker行だけを見ることで、古いtrust表示がscrollbackに残っていても
397
397
  // その下に描画された現在のcomposerを優先する。
398
- return !/^❯\s*(?:\d+\.|\[|Enable selected\b|No,\s*exit\b|Yes,\s*I trust this folder\b)/iu.test(lastMarker);
398
+ // A dialog draws its choices with the same ❯ (the Bypass Permissions warning's "❯ Yes, I accept" has no index).
399
+ return !/^❯\s*(?:\d+\.|\[|Enable selected\b|No,\s*exit\b|Yes,\s*I trust this folder\b|Yes,\s*I accept\b)/iu.test(lastMarker);
399
400
  }
400
401
  // Claude Codeは動いている間、入力欄の上へ進行行を出し続ける(2.1.291の実画面 2026-10-06)。
401
402
  // ✻ Swirling… (running UserPromptSubmit hook · 0s)
package/dist/index.js CHANGED
@@ -257,7 +257,7 @@ export function createAitermServer(options = {}) {
257
257
  };
258
258
  if (e instanceof AitermError && e.launchNotStarted)
259
259
  return { content: [{ type: "text", text: "aiterm: " + msg }], isError: true,
260
- _meta: launchNotStartedMeta(e.launchNotStarted.harness, e.launchNotStarted.phase, e.launchNotStarted.code) };
260
+ _meta: launchNotStartedMeta(e.launchNotStarted.harness, e.launchNotStarted.phase, e.launchNotStarted.code, e.launchNotStarted.action) };
261
261
  return { content: [{ type: "text", text: "aiterm: " + msg }], isError: true };
262
262
  }
263
263
  /**
@@ -326,6 +326,18 @@ export function createAitermServer(options = {}) {
326
326
  ...(result._meta ? { _meta: result._meta } : {}),
327
327
  };
328
328
  }
329
+ // Writes forwarded to one terminal seat leave this process one at a time, as local seats do under withAgentSendLock.
330
+ // Process-local only: other processes forwarding to the same seat are the caller's to order (0.63.12).
331
+ const remoteSeatOrder = new Map();
332
+ function inRemoteSeatOrder(target, session, run) {
333
+ const key = `${remoteLabel(target)}\0${String(session)}`;
334
+ const mine = (remoteSeatOrder.get(key) ?? Promise.resolve()).then(run);
335
+ const tail = mine.then(() => { }, () => { });
336
+ remoteSeatOrder.set(key, tail);
337
+ void tail.then(() => { if (remoteSeatOrder.get(key) === tail)
338
+ remoteSeatOrder.delete(key); });
339
+ return mine;
340
+ }
329
341
  async function forwardRemote(target, name, args, extra) {
330
342
  return remoteResult(target, await callRemoteTool(target, name, args, undefined, undefined, extra?._meta));
331
343
  }
@@ -353,7 +365,7 @@ export function createAitermServer(options = {}) {
353
365
  // Older remote servers strip unknown input fields and could apply without tracking.
354
366
  if (args.request || args.action === "reconcile")
355
367
  throw new Error("REMOTE_UNSUPPORTED: tracked configuration requires the exact local connection; not issued");
356
- return forwardRemote(target, name, args, extra);
368
+ return inRemoteSeatOrder(target, args.session_id, () => forwardRemote(target, name, args, extra));
357
369
  };
358
370
  case "pty_send": return sendRemote;
359
371
  case "pty_close": return async (target, args, extra) => {
@@ -385,7 +397,7 @@ export function createAitermServer(options = {}) {
385
397
  // 終わった依頼の回答は送る前に保存する。実行中の依頼は残る。現地が差し込みを選べばその依頼が回答を受け取る。
386
398
  if (delivery)
387
399
  await remoteParentDelivery.beforeChange(key);
388
- const result = await callRemoteTool(target, "pty_send", args, undefined, undefined, extra?._meta);
400
+ const result = await inRemoteSeatOrder(target, args.session_id, () => callRemoteTool(target, "pty_send", args, undefined, undefined, extra?._meta));
389
401
  const structured = result.structuredContent;
390
402
  if (structured?.wait_process && (structured.mode === "agent_steer" || result.isError))
391
403
  return relaySteerWait(target, result);
@@ -1136,7 +1148,9 @@ export function createAitermServer(options = {}) {
1136
1148
  const terminal = boundTerminalTarget(args.session_id);
1137
1149
  if (terminal) {
1138
1150
  try {
1139
- const remote = await callRemoteTool(terminal, "agent_goal", args, undefined, origin === "user" ? { [GOAL_ORIGIN_PRIVATE_ENV]: "user" } : undefined, extra?._meta);
1151
+ const call = () => callRemoteTool(terminal, "agent_goal", args, undefined, origin === "user" ? { [GOAL_ORIGIN_PRIVATE_ENV]: "user" } : undefined, extra?._meta);
1152
+ // A read writes nothing and is not queued behind writes.
1153
+ const remote = await (args.action === "inspect" ? call() : inRemoteSeatOrder(terminal, args.session_id, call));
1140
1154
  return withErrorCode(remoteResult(terminal, remote));
1141
1155
  }
1142
1156
  catch (e) {
@@ -27,6 +27,7 @@ const ACTIONS = {
27
27
  REMOTE_AITERM_TOO_OLD: "端末のAitermが古いため起こせません。端末のAitermを更新してください。",
28
28
  SEAT_FORWARD_UNAVAILABLE: "端末からBellTeamへ戻る通り道がまだ用意できていません。少し待ってから起こし直してください。",
29
29
  CWD_UNAVAILABLE: "端末に作業フォルダがありません。メンバーの作業フォルダを選び直すか、そのフォルダを作ってください。",
30
+ AGENT_STARTUP_BLOCKED: "AIの起動の途中の画面(初回の案内や確認)で止まったため、席を閉じました。端末でそのAIを一度起動して画面を最後まで進めてから、起こし直してください。",
30
31
  AGENT_LAUNCH_NOT_STARTED: "席を作る途中で失敗しました。席は残っていません。もう一度起こし直します。",
31
32
  CLAUDE_AUTH_STATUS_UNCONFIRMED: "端末のClaude Codeのログイン状態を確かめられませんでした。少し待ってから起こし直してください。",
32
33
  CLAUDE_AUTH_STATUS_TIMEOUT: "端末のClaude Codeのログイン状態を時間内に確かめられませんでした。少し待ってから起こし直してください。",
@@ -41,9 +42,9 @@ export function terminalLaunchAction(code) {
41
42
  export const LAUNCH_ERROR_META = "aiterm/launch_error";
42
43
  export const ERROR_CODE_META = "aiterm/error_code";
43
44
  /** R18 for a local launch: the fresh native creation left no seat (core.freshLaunchFailure). */
44
- export function launchNotStartedMeta(harness, phase = "native_create", code = "AGENT_LAUNCH_NOT_STARTED") {
45
+ export function launchNotStartedMeta(harness, phase = "native_create", code = "AGENT_LAUNCH_NOT_STARTED", action) {
45
46
  return { [LAUNCH_ERROR_META]: { schema: "aiterm.agent-launch-error.v1", harness, code, phase,
46
- effect: "not_started", session_created: false, action: code === "AGENT_AUTH_REQUIRED" || phase !== "input" ? ACTIONS[code] : INPUT_ACTION } };
47
+ effect: "not_started", session_created: false, action: action ?? (code !== "AGENT_LAUNCH_NOT_STARTED" || phase !== "input" ? ACTIONS[code] : INPUT_ACTION) } };
47
48
  }
48
49
  // phase "input": refused from the arguments alone; nothing was started, so launching again unchanged fails the same way.
49
50
  const INPUT_ACTION = "起動の指定(追加の指示かMCPの設定)をこのAIでは使えません。席は作られていません。指定を見直してください。";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.70.34",
3
+ "version": "0.70.36",
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": [