aiterm-mcp 0.70.49 → 0.70.51

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,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.70.51] - 2026-11-13
11
+
12
+ - A hibernated terminal seat stays bound to its terminal. `pty_close {hibernate:true}` unbound it like a real close, so the body read the seat as missing and `pty_close` of it ran locally (already_closed) while the seat stayed hibernated on the terminal.
13
+ - A hibernated seat whose project folder path goes through a symlink resumes again. Claude saves its cwd as a realpath, but the resume check compared the caller's path unresolved, so every resume failed with AGENT_RESUME_CONFLICT (macOS `/tmp`, a cloud-synced folder). Both sides are now compared by realpath.
14
+
15
+ ## [0.70.50] - 2026-11-13
16
+
17
+ - seat-turns no longer returns one unknown (null) turn at every turn end for Claude, Grok, Cursor and Antigravity seats. The first ready frame only started the 250 ms settle clock, so a caller polling every ~10 s saw running → unknown → idle; the read now looks once more past the settle time itself.
18
+ - An Antigravity spinner over an `esc to cancel` footer (`Running command...`, `Loading...`) reads as the running turn (it read unknown).
19
+
10
20
  ## [0.70.49] - 2026-11-13
11
21
 
12
22
  - An Antigravity seat no longer reads unknown for a moment when a background task ends: agy reruns the model with a `Loading...` spinner over an `esc to cancel` footer, which now reads as the running turn.
@@ -3422,7 +3432,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3422
3432
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3423
3433
  provenance.
3424
3434
 
3425
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.49...HEAD
3435
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.51...HEAD
3436
+ [0.70.51]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.50...v0.70.51
3437
+ [0.70.50]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.49...v0.70.50
3426
3438
  [0.70.49]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.48...v0.70.49
3427
3439
  [0.70.48]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.47...v0.70.48
3428
3440
  [0.70.47]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.46...v0.70.47
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.49** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.70.51** · 動作対象は 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.49** · 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.51** · 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
 
@@ -338,6 +338,9 @@ export function parentPaneEvidence(kind, screen) {
338
338
  start = marker - 1;
339
339
  while (start > 0 && (!lines[start].trim() || /^[╭─\s]+$/u.test(lines[start])))
340
340
  start--;
341
+ // agy prints a "└ Tip: …" line under its spinner: the spinner is the current block's first line.
342
+ if (kind === "antigravity" && start > 0 && /^\s*└ Tip:/u.test(lines[start]))
343
+ start--;
341
344
  }
342
345
  const current = lines.slice(Math.max(0, start)).join("\n");
343
346
  // Antigravity keeps the turn open while a background task runs: it reruns the model when the task ends, then sends Stop.
@@ -367,11 +370,11 @@ export function parentPaneEvidence(kind, screen) {
367
370
  if (kind === "grok" && observed.state === "busy"
368
371
  && !/^\s*(?:[│┃]\s*)?(?:Waiting for response|Responding(?:…|\.\.\.)).*$/mu.test(current))
369
372
  return "unknown";
370
- // agy reruns the model after a background task ends with a "Loading..." spinner over an "esc to cancel" footer (a41-agy).
373
+ // Other agy spinners ("Running command...", "Loading..." while it reruns the model after a background task) over an
374
+ // "esc to cancel" footer (a41-agy).
371
375
  if (kind === "antigravity" && observed.state === "busy"
372
376
  && !/^\s*(?:[^\p{L}\p{N}\s]{1,3}\s+)?(?:Generating|Working)(?:…|\.\.\.).*$/mu.test(current)
373
- // The spinner may sit one line above a "└ Tip: …" line.
374
- && !(/^\s*[^\p{L}\p{N}\s]{1,3}\s+Loading(?:…|\.\.\.)\s*$/mu.test(lines.slice(Math.max(0, start - 1), marker).join("\n"))
377
+ && !(/^\s*[^\p{L}\p{N}\s]{1,3}\s+\p{L}[^\n]*?(?:…|\.\.\.)\s*$/mu.test(lines.slice(start, marker).join("\n"))
375
378
  && /^\s*esc to cancel\b/imu.test(lines.slice(marker + 1).join("\n")))
376
379
  && !/^\s*esc to interrupt\s*$/imu.test(lines.slice(marker + 1).join("\n")))
377
380
  return "unknown";
package/dist/core.js CHANGED
@@ -11,7 +11,7 @@ import { inspectIdleSettings, inspectCodexResumeSettings, codexRecoveryComposer
11
11
  import { AGENT_TUI_READY_TIMEOUT_MS, AGENT_TUI_FIRST_DRAW_TIMEOUT_MS, AGENT_TUI_READY_POLL_MS, isAgentTuiReady, isAgentTuiBusy, isAgentTuiIdleReady, agentPaneObservation, parentPaneEvidence, waitAgentTuiReadyImpl, detectAgentSubmitResidueImpl, waitCursorPromptVisibleImpl, settleAgentDoneScreenImpl } from "./agent-screen-observation.js";
12
12
  export { launchEchoIsLastOnScreen, __testSetAgentTuiReadyStableSamples } from "./agent-screen-observation.js";
13
13
  import { parseClaudeOperationMarker } from "./claude-operation-marker.js";
14
- import { withManagedSpan, observeManagedSpan, closeManagedSpan, SPAN_HELD } from "./managed-seat-turn.js";
14
+ import { withManagedSpan, observeManagedSpan, closeManagedSpan, managedSpanSettling, MANAGED_SPAN_SETTLE_MS, SPAN_HELD } from "./managed-seat-turn.js";
15
15
  /**
16
16
  * core — CLI/MCP が共有する端末操作とharness進行(Node/TS 版)。
17
17
  *
@@ -102,6 +102,17 @@ const PTY_PASTE_CHUNK_PAUSE_MS = 10;
102
102
  // 同期処理の中の短い間(paste chunkの間、server片付け中の一覧の読み直し)。eventループを進めずに待つ。
103
103
  const SYNC_PAUSE_BUFFER = new Int32Array(new SharedArrayBuffer(4));
104
104
  function pauseSync(ms) { Atomics.wait(SYNC_PAUSE_BUFFER, 0, 0, ms); }
105
+ // A Claude seat saves its cwd as a realpath, so a caller's path through a symlink (macOS /tmp, a cloud-synced folder) is the same project.
106
+ function sameProjectFolder(given, saved) {
107
+ if (path.resolve(given) === saved)
108
+ return true;
109
+ try {
110
+ return fs.realpathSync(given) === fs.realpathSync(saved);
111
+ }
112
+ catch {
113
+ return false;
114
+ }
115
+ }
105
116
  const SESSION_SEND_LOCK_WAIT_MS = isWin ? 130_000 : 10_000;
106
117
  const SESSION_SEND_LOCK_POLL_MS = 25;
107
118
  // 同じagent sessionへの送信が重なった時に、前の1通を待つ上限(ADR 0088)。
@@ -4178,27 +4189,36 @@ function readManagedSeatTurn(meta) {
4178
4189
  if (live.pane_alive !== true || live.harness_alive !== true || !live.pane_process || !live.harness_process
4179
4190
  || before.native?.agent?.stopped === true || live.launch_id !== meta.launch_id)
4180
4191
  return null;
4181
- const captured = tmux("capture-pane", "-p", "-J", "-t", proof ? nativePaneTarget(proof) : meta.aiterm_session);
4182
- if (captured.code !== 0)
4183
- return null;
4184
- const evidence = parentPaneEvidence(meta.kind, captured.stdout);
4185
- const terminal = managedSeatTerminal(meta);
4186
- const observedAfter = observeSessionNative(meta.aiterm_session), after = observedAfter.result;
4187
- if (proof)
4188
- verifyAgentResumeNative(meta, proof);
4189
- if (after.pane_alive !== true || after.harness_alive !== true || observedAfter.native?.agent?.stopped === true
4190
- || !isDeepStrictEqual(after.pane_process, live.pane_process) || !isDeepStrictEqual(after.harness_process, live.harness_process)
4191
- || !isDeepStrictEqual(loadAgentMetadata(meta.aiterm_session), meta)
4192
- || managedSeatConversation(meta) !== conversation || agentDormantState(meta) !== null
4193
- || performance.now() - started >= 15_000)
4194
- return null;
4195
- const binding = JSON.stringify([meta.aiterm_session, meta.launch_id, meta.kind, conversation, proof, live.pane_process, live.harness_process]);
4196
- // Claude holds a limit-ended turn with no Stop and a busy-looking footer; its transcript says the turn ended.
4197
- const limited = meta.kind === "claude" ? claudeSeatLimitEnd(meta) : null;
4198
- if (limited && !limited.continued) {
4199
- return closeManagedSpan(file, binding, `limit:${limited.at}`, () => managedSpanStart(meta));
4200
- }
4201
- return observeManagedSpan(file, binding, evidence, terminal, new Date().toISOString(), () => managedSpanStart(meta));
4192
+ const look = () => {
4193
+ const captured = tmux("capture-pane", "-p", "-J", "-t", proof ? nativePaneTarget(proof) : meta.aiterm_session);
4194
+ if (captured.code !== 0)
4195
+ return null;
4196
+ const evidence = parentPaneEvidence(meta.kind, captured.stdout);
4197
+ const terminal = managedSeatTerminal(meta);
4198
+ const observedAfter = observeSessionNative(meta.aiterm_session), after = observedAfter.result;
4199
+ if (proof)
4200
+ verifyAgentResumeNative(meta, proof);
4201
+ if (after.pane_alive !== true || after.harness_alive !== true || observedAfter.native?.agent?.stopped === true
4202
+ || !isDeepStrictEqual(after.pane_process, live.pane_process) || !isDeepStrictEqual(after.harness_process, live.harness_process)
4203
+ || !isDeepStrictEqual(loadAgentMetadata(meta.aiterm_session), meta)
4204
+ || managedSeatConversation(meta) !== conversation || agentDormantState(meta) !== null
4205
+ || performance.now() - started >= 15_000)
4206
+ return null;
4207
+ const binding = JSON.stringify([meta.aiterm_session, meta.launch_id, meta.kind, conversation, proof, live.pane_process, live.harness_process]);
4208
+ // Claude holds a limit-ended turn with no Stop and a busy-looking footer; its transcript says the turn ended.
4209
+ const limited = meta.kind === "claude" ? claudeSeatLimitEnd(meta) : null;
4210
+ if (limited && !limited.continued) {
4211
+ return closeManagedSpan(file, binding, `limit:${limited.at}`, () => managedSpanStart(meta));
4212
+ }
4213
+ return observeManagedSpan(file, binding, evidence, terminal, new Date().toISOString(), () => managedSpanStart(meta));
4214
+ };
4215
+ const first = look();
4216
+ // A first ready sighting only starts the settle clock (observeManagedSpan): look again past it in this same read, so a
4217
+ // caller polling every ~10 s does not see one unknown read at every turn end (Kiro/Trony a41, 0.70.49).
4218
+ if (first !== null || !managedSpanSettling(file))
4219
+ return first;
4220
+ pauseSync(MANAGED_SPAN_SETTLE_MS + 50);
4221
+ return look();
4202
4222
  });
4203
4223
  return performance.now() - started < 15_000 ? result : null;
4204
4224
  }
@@ -8648,7 +8668,7 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
8648
8668
  || (opts.model != null && opts.model.trim() !== recipe.model)
8649
8669
  || (opts.reasoning_effort != null && opts.reasoning_effort.trim() !== recipe.reasoning_effort)
8650
8670
  || (opts.fast != null && opts.fast !== recipe.fast)
8651
- || (opts.cwd != null && path.resolve(opts.cwd) !== recipe.cwd)
8671
+ || (opts.cwd != null && !sameProjectFolder(opts.cwd, recipe.cwd))
8652
8672
  || (opts.write_scope !== undefined && opts.write_scope !== previous.write_scope)
8653
8673
  || (opts.env_vars !== undefined && !isDeepStrictEqual(resumeEnvNames(kind, opts.env_vars), resumeEnvNames(kind, [...Object.keys(recipe.environment), ...recipeSecretNames(recipe)]))))
8654
8674
  throw opts.require_existing_resume ? new AgentResumeUnavailableError(name) : new AitermError("AGENT_RESUME_CONFLICT: 同名の休止席は保存したharness・設定・project・明示envで再開します。変更は再開後に行ってください。", 2);
@@ -142,6 +142,10 @@ export function antigravityPaneObservation(screen) {
142
142
  return { state: "blocked", reason: "vendor_action_required" };
143
143
  if (/(?:Generating|Working)(?:\.{3}|…)|esc to interrupt/i.test(screen))
144
144
  return { state: "busy", reason: "vendor_generating" };
145
+ // Any other spinner line ("⣾ Running command...", "⣻ Loading..." while the model reruns after a background task)
146
+ // with "esc to cancel" in the footer is a turn in progress (1.5.8).
147
+ if (/^\s*[^\p{L}\p{N}\s]{1,3}\s+\p{L}[^\n]*?(?:\.{3}|…)\s*$/mu.test(screen) && /^\s*esc to cancel\b/imu.test(screen))
148
+ return { state: "busy", reason: "vendor_generating" };
145
149
  if (antigravityEmptyComposer(screen))
146
150
  return { state: "idle", reason: "composer_ready" };
147
151
  return { state: "unknown", reason: "vendor_state_unknown" };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { loadAgentMetadata } from "./agent-metadata-reader.js";
3
3
  import { remoteInputDescription, remoteInputSchema, terminalArgumentDescription, terminalArgumentSchema } from "./remote-contract.js";
4
- import { boundTerminalTarget, bindTerminalSession, terminalSeatGroups, ensureSeatForward, extractMcpHeaders, maintainSeatForwards, REMOTE_MINIMUM_VERSION, REMOTE_CLI_OPS_VERSION, seatIngressPort, checkTerminalPlatform, rewriteSeatMcpConfig, terminalRemoteTarget, unbindTerminalSession, versionAtLeast } from "./remote-terminal.js";
4
+ import { boundTerminalTarget, bindTerminalSession, terminalSeatGroups, ensureSeatForward, extractMcpHeaders, maintainSeatForwards, REMOTE_MINIMUM_VERSION, REMOTE_CLI_OPS_VERSION, seatIngressPort, checkTerminalPlatform, closeEndsTerminalSeat, rewriteSeatMcpConfig, terminalRemoteTarget, unbindTerminalSession, versionAtLeast } from "./remote-terminal.js";
5
5
  import { terminalCwdFits } from "./remote-path.js";
6
6
  import { launchEnvValue } from "./private-env.js";
7
7
  import { AuthResponseError, authUiSchema, authBindingSchema, authResponseSchema } from "./agent-auth-ui.js";
@@ -354,7 +354,7 @@ export function createAitermServer(options = {}) {
354
354
  if (!target)
355
355
  return handler(args, extra);
356
356
  const result = await remoteHandler(target, args, extra);
357
- if (name === "pty_close" && !remote && !result?.isError)
357
+ if (name === "pty_close" && !remote && closeEndsTerminalSeat(args, result))
358
358
  unbindTerminalSession(args.session_id);
359
359
  return remote ? result : withErrorCode(result);
360
360
  }
@@ -64,6 +64,18 @@ export function withManagedSpan(meta, capture) {
64
64
  fs.rmSync(candidate, { recursive: true, force: true });
65
65
  }
66
66
  }
67
+ /** How long a ready frame must hold (same terminal) before the span settles idle. */
68
+ export const MANAGED_SPAN_SETTLE_MS = 250;
69
+ /** The last observation saw ready and started the settle clock: a second look after MANAGED_SPAN_SETTLE_MS can settle it. */
70
+ export function managedSpanSettling(file) {
71
+ try {
72
+ const record = recordSchema.parse(JSON.parse(fs.readFileSync(file, "utf8")));
73
+ return record.ready !== null && Date.now() - Date.parse(record.ready.since) < MANAGED_SPAN_SETTLE_MS;
74
+ }
75
+ catch {
76
+ return false;
77
+ }
78
+ }
67
79
  /** Persistence keeps identity only; evidence must come from a new validated native read. */
68
80
  export function observeManagedSpan(file, binding, evidence, terminal, at, position = () => null) {
69
81
  stamp.parse(at);
@@ -107,7 +119,7 @@ export function observeManagedSpan(file, binding, evidence, terminal, at, positi
107
119
  writeJson0600(file, record);
108
120
  return null;
109
121
  }
110
- if (Date.parse(at) - Date.parse(record.ready.since) < 250)
122
+ if (Date.parse(at) - Date.parse(record.ready.since) < MANAGED_SPAN_SETTLE_MS)
111
123
  return null;
112
124
  const settled = position();
113
125
  if (record.span || (record.settled_from ?? null) !== settled) {
@@ -740,6 +740,13 @@ function readSeats() {
740
740
  }
741
741
  function writeSeats(seats) { writeJson0600(seatsFile(), { schema: "aiterm.terminal-seats.v1", seats }); }
742
742
  export function bindTerminalSession(session, ref) { writeSeats({ ...readSeats(), [session]: ref }); }
743
+ /** Whether a terminal seat's pty_close ended it: a hibernated seat keeps its binding, so its resume and reads still reach the terminal. */
744
+ export function closeEndsTerminalSeat(args, result) {
745
+ if (!result || result.isError)
746
+ return false;
747
+ const outcome = result.structuredContent?.outcome;
748
+ return typeof outcome === "string" ? outcome !== "hibernated" : args.hibernate !== true;
749
+ }
743
750
  export function unbindTerminalSession(session) {
744
751
  const seats = readSeats();
745
752
  if (!(session in seats))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.70.49",
3
+ "version": "0.70.51",
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": [