aiterm-mcp 0.70.15 → 0.70.16

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,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.70.16] - 2026-11-11
11
+
12
+ - `pty_list` no longer starts an idle-clock checker process for every hibernated, closed or dead seat on every call. A seat without a live session retires its clock at once, so each list re-spawned a checker for it (about 30 per call on a BellTeam host with 50 saved seats and 18 live). The sweep now covers only seats with a live terminal session, and confirms all clock owners with one process read instead of one per seat. On that host this load kept the serving process busy 95 % of the time, with stretches up to 7 s, so a terminal relay's answer often arrived after the 4 s budget and the terminal's seats came back `unread`.
13
+ - The terminal relays of `pty_list` seat turns now really start before the local read. `callRemoteTool` spawns its ssh only after an `await`, so every relay used to start after the synchronous local read.
14
+ - A freshly launched Codex seat that has taken no input reads `idle` in seat turns, instead of `null` until its first turn. Codex writes no rollout before the first input. Aiterm now answers idle when it recorded no input for the launch and the pane is a ready composer.
15
+
10
16
  ## [0.70.15] - 2026-11-11
11
17
 
12
18
  - An antigravity-cli turn stopped by the account quota now ends as `rate_limited` with the limit line in `rate_limit` (for example "Individual quota reached. ... Resets in 73h4m30s."), as Claude Code, Codex, Grok and Cursor already did. agy ends such a turn with `terminationReason: ERROR` and names the limit only in its Stop hook `error` (`RESOURCE_EXHAUSTED (code 429)`). Aiterm's hook now keeps that text in the turn's record. Before, the caller saw a generic turn error ("Antigravity execution ended: ERROR") and the reason was on the pane only. Other agy turn errors now carry agy's error text after the reason.
@@ -3255,7 +3261,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3255
3261
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3256
3262
  provenance.
3257
3263
 
3258
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.15...HEAD
3264
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.16...HEAD
3265
+ [0.70.16]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.15...v0.70.16
3259
3266
  [0.70.15]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.14...v0.70.15
3260
3267
  [0.70.14]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.13...v0.70.14
3261
3268
  [0.70.13]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.12...v0.70.13
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.15** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.70.16** · 動作対象は 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.15** · 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.16** · 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
 
@@ -82,19 +82,36 @@ export async function armAgentIdleClock(meta, anchor, wakeAt, replaceToken) {
82
82
  }
83
83
  }
84
84
  export function requestAgentIdleClock(session, launchId) {
85
+ requestAgentIdleClocks([{ session, launchId }]);
86
+ }
87
+ /** Starts a checker for each seat whose clock owner is gone; every owner is confirmed with one process read. */
88
+ export function requestAgentIdleClocks(seats) {
85
89
  if (!AGENT_IDLE_ENABLED)
86
90
  return;
91
+ const wanted = [];
92
+ for (const { session, launchId } of seats) {
93
+ try {
94
+ if (!readAgentResumeNative({ aiterm_session: session, launch_id: launchId }))
95
+ continue;
96
+ wanted.push({ session, launchId, clock: readAgentIdleClock({ aiterm_session: session, launch_id: launchId }) });
97
+ }
98
+ catch {
99
+ process.stderr.write("aiterm: idle_clock_state_unconfirmed\n");
100
+ }
101
+ }
102
+ const owners = wanted.flatMap(seat => seat.clock ? [seat.clock.owner.pid] : []);
103
+ let alive;
87
104
  try {
88
- if (!readAgentResumeNative({ aiterm_session: session, launch_id: launchId }))
89
- return;
90
- const clock = readAgentIdleClock({ aiterm_session: session, launch_id: launchId });
91
- if (clock && readProcessIdentities([clock.owner.pid]).some(row => row.started_identity === clock.owner.started_identity))
92
- return;
105
+ alive = new Set(owners.length ? readProcessIdentities(owners).map(row => `${row.pid}:${row.started_identity}`) : []);
93
106
  }
94
107
  catch {
95
108
  process.stderr.write("aiterm: idle_clock_state_unconfirmed\n");
96
109
  return;
97
110
  }
98
- void detached(idleClockCommand(0, liveNodeExecutable(), [CLI, "--session", session, "--launch", launchId]))
99
- .catch(() => { process.stderr.write("aiterm: idle_clock_start_failed\n"); });
111
+ for (const { session, launchId, clock } of wanted) {
112
+ if (clock && alive.has(`${clock.owner.pid}:${clock.owner.started_identity}`))
113
+ continue;
114
+ void detached(idleClockCommand(0, liveNodeExecutable(), [CLI, "--session", session, "--launch", launchId]))
115
+ .catch(() => { process.stderr.write("aiterm: idle_clock_start_failed\n"); });
116
+ }
100
117
  }
package/dist/core.js CHANGED
@@ -38,7 +38,7 @@ import { withCodexGoal } from "./harnesses/codex-goal.js";
38
38
  import { configureWithPausedGoal } from "./configure-goal.js";
39
39
  import { initializeAgentActivity, recordAgentInput, recordAgentTurnEnd, readAgentActivity } from "./agent-activity.js";
40
40
  import { checkIdleSeat, decideIdleSeat, idleMinutes } from "./agent-idle.js";
41
- import { AGENT_IDLE_ENABLED, armAgentIdleClock, idleClockDeadline, isAgentIdleClockOwner, requestAgentIdleClock } from "./agent-idle-clock.js";
41
+ import { AGENT_IDLE_ENABLED, armAgentIdleClock, idleClockDeadline, isAgentIdleClockOwner, requestAgentIdleClock, requestAgentIdleClocks } from "./agent-idle-clock.js";
42
42
  import { stopProcessTree } from "./process-tree-stop.js";
43
43
  import { writeAgentResumeRecoveryOrigin, confirmedAgentResumeRecoveryOrigin, readAgentResumeResolution, writeAgentResumeResolution, agentResumeRecordDigest, captureAgentResumeTemplate, readAgentResumeTemplate, writeAgentResumeTemplate, finishAgentResumeConfiguration, refreshAgentResumeRecipe, readAgentIdleClock, retireAgentIdleClock, readAgentResumeRecipe, writeAgentResumeRecipe, agentResumeRecipeDigest, readAgentLifecycle, writeAgentLifecycle, cancelAgentStopping, readAgentResumeAttempt, writeAgentResumeAttempt, readAgentResumeNative, writeAgentResumeNative } from "./agent-lifecycle.js";
44
44
  import { createCodexGoalObjective, editCodexGoalObjective, submitCodexGoalCommand } from "./harnesses/codex-goal-editor.js";
@@ -70,7 +70,7 @@ import { codexAuthPlan, codexAuthStatus, codexAuthPane, realCodexHome, readCodex
70
70
  import { claudeAuthPlan, claudeAuthStatus, claudeAuthPane, OPERATION_ID_RE, CLAUDE_RESULT_MAX_BYTES, CLAUDE_EFFORTS, agentClaudeOperationPath, agentClaudeApprovalReceiptPath, agentClaudeDispatchReceiptPath, validateOperationId, readClaudeResultText, assertClaudeAuthenticationReady, claudeModelChoices, claudeConfigDir, claudeProjectSlug, claudeFastIndicatorShown, claudeFastResult, buildClaudeAgentCmd, claudeAgentArgv, claudeResumeArgv, claudeLaunchNote, claudePaneObservation, CLAUDE_INTERRUPT_KEY, claudeUsageLimit, claudeLiveSelectMenu, claudeStartupAction, createClaudeAgentMetadata, writeClaudeCallerFiles, claudeSessionTranscriptPath, claudeApiErrorFromLine, claudeApiErrorAfter, claudeApiErrorEndingTurn, claudeFailureCategory, } from "./harnesses/claude.js";
71
71
  import { cursorAuthPlan, cursorAuthStatus, cursorAuthPane, bindCursorTranscriptSession, cursorTurnBoundary, latestCursorCompletion, cursorTranscript, cursorTranscriptSessionId, observeCursorDone, cursorTranscriptText, assertCursorAuthenticationReady, assertCursorModelAvailable, cursorModelChoices, cursorModelIsFastVariant, cursorFastParameter, cursorHeaderShowsFast, cursorPickerView, cursorEffortSelected, cursorParameterRows, cursorUserConfigPath, CURSOR_DEFAULT_MODEL_KEYS, realCursorHome, buildCursorAgentCmd, cursorAgentArgv, cursorPromptWithLineage, cursorLineagePreface, writeCursorCallerFiles, checkCursorCallerInput, createCursorAgentMetadata, cursorLaunchNote, cursorEffortNavigation, cursorTuiReady, cursorPaneObservation, CURSOR_INTERRUPT_KEY, cursorPromptHooksRunning, cursorUsageLimit, CURSOR_SUBMIT_SEQUENCE, validateCursorModelEffort, } from "./harnesses/cursor.js";
72
72
  import { interimFromNow, interimFromToken, readInterimWords, recordInterimBoundary } from "./interim-words.js";
73
- import { codexSeatTurn, grokSteerAcceptance, observeSteerDone, readSteerEntry, recordSteer } from "./steer-follow.js";
73
+ import { codexSeatAwaitingRollout, codexSeatTurn, grokSteerAcceptance, observeSteerDone, readSteerEntry, recordSteer } from "./steer-follow.js";
74
74
  import { resolveAgentBin, resolveThroughlineBin, runThroughlineHandoffContext, isWindowsNativeExecutable, isUsableAgentExecutableFile, agentBinForPaneShell, resolveWinPaneShell, windowsAgentArgv, windowsAgentLaunchLine, windowsLaunchIndirection } from "./agent-resolver.js";
75
75
  export { AitermError } from "./errors.js";
76
76
  export { tmuxSpawnEnv } from "./tmux-runtime.js";
@@ -2031,16 +2031,32 @@ export async function serviceAgentIdleClock(expectedInput, token) {
2031
2031
  export async function maintainAgentIdleClocks() {
2032
2032
  if (!AGENT_IDLE_ENABLED)
2033
2033
  return;
2034
+ // Only seats with a live terminal session: a hibernated, closed or dead seat retires its clock at once, so requesting
2035
+ // one on every list started a checker process per such seat per call (2026-11-11: ~30 per pty_list on the BellTeam host).
2036
+ let live;
2037
+ try {
2038
+ const listed = tmux("list-sessions", "-F", "#{session_name}");
2039
+ if (listed.code !== 0)
2040
+ return;
2041
+ live = new Set(listed.stdout.split(/\r?\n/).filter(Boolean));
2042
+ }
2043
+ catch {
2044
+ return;
2045
+ } // no usable tmux here: no live seat to time, and the list call itself must not fail
2046
+ const seats = [];
2034
2047
  for (const name of savedAgentSessionNames()) {
2048
+ if (!live.has(name))
2049
+ continue;
2035
2050
  try {
2036
2051
  const meta = loadAgentMetadata(name);
2037
2052
  if (["claude", "codex"].includes(meta.kind))
2038
- requestAgentIdleClock(name, meta.launch_id);
2053
+ seats.push({ session: name, launchId: meta.launch_id });
2039
2054
  }
2040
2055
  catch {
2041
2056
  process.stderr.write("aiterm: idle_clock_sweep_unconfirmed\n");
2042
2057
  }
2043
2058
  }
2059
+ requestAgentIdleClocks(seats);
2044
2060
  }
2045
2061
  /** Private guarded-runtime read. Legacy metadata without an original native
2046
2062
  * creator stamp remains a present but unverified generation, never enrolled
@@ -3762,7 +3778,7 @@ export function readSeatTurns(sessionIds) {
3762
3778
  try {
3763
3779
  const state = agentDormantState(meta);
3764
3780
  turn = state ? (state === "hibernated" && observeSession(name).state === "hibernated" ? { state: "idle" } : null)
3765
- : meta.kind === "codex" ? codexSeatTurn(meta) : readManagedSeatTurn(meta);
3781
+ : meta.kind === "codex" ? codexSeatTurn(meta) ?? freshCodexSeatTurn(meta) : readManagedSeatTurn(meta);
3766
3782
  }
3767
3783
  catch { /* 読めない席は、分からないまま返す */ }
3768
3784
  if (turn === SPAN_HELD) {
@@ -3781,6 +3797,19 @@ export function readSeatTurns(sessionIds) {
3781
3797
  seat.turn = null;
3782
3798
  return { schema: "aiterm.seat-turns.v1", seats, unread };
3783
3799
  }
3800
+ /**
3801
+ * Codex writes no rollout before its first input, so codexSeatTurn has nothing to read for a fresh launch. A launch that
3802
+ * never took input (Aiterm records every input it types) and whose pane is a ready composer has no turn to hide: idle,
3803
+ * the rule the other harnesses got in 0.64.1 / 0.68.1. Any recorded input keeps the rollout as the only source.
3804
+ */
3805
+ export function freshCodexSeatTurn(meta, paneState = () => observeSession(meta.aiterm_session).state) {
3806
+ if (!codexSeatAwaitingRollout(meta))
3807
+ return null;
3808
+ const activity = readAgentActivity(meta);
3809
+ if (!activity.tracked || activity.last_input_at !== null)
3810
+ return null;
3811
+ return paneState() === "idle" ? { state: "idle" } : null;
3812
+ }
3784
3813
  function managedSeatConversation(meta) {
3785
3814
  if (meta.kind === "antigravity") {
3786
3815
  const bound = antigravityBinding(meta);
package/dist/index.js CHANGED
@@ -867,6 +867,8 @@ export function createAitermServer(options = {}) {
867
867
  loopDeadline(4_000, { seats: [], unread: bound }),
868
868
  ]);
869
869
  }));
870
+ // callRemoteTool spawns its ssh only after an await: let the relays start before this process blocks on the local read.
871
+ await new Promise(resolve => setImmediate(resolve));
870
872
  const local = core.readSeatTurns(sessions.filter(session => session.harness !== null).map(session => session.session_id));
871
873
  const remote = await relays;
872
874
  return { _meta: { [SEAT_TURNS_RESULT_META_KEY]: { ...local, seats: [...local.seats, ...remote.flatMap(r => r.seats)], unread: [...local.unread, ...remote.flatMap(r => r.unread)] } } };
@@ -611,6 +611,10 @@ function codexSeatTranscript(meta) {
611
611
  * (実物 2026-10-13: 最初の番の間も、終わった後も、会話のIDは席の登録に入っていなかった)。
612
612
  * harnessが落ちた席は、終わりの印が書かれないので、動いていると読んだままになる(呼び手は、席が閉じた事を待ちのclosedで知る)。
613
613
  */
614
+ /** codexSeatTurn's last look found no rollout for this unbound launch (Codex writes none before the first input). */
615
+ export function codexSeatAwaitingRollout(meta) {
616
+ return meta.kind === "codex" && !meta.vendor_session_id && codexSeatUnresolved.get(meta.aiterm_session)?.key === `${meta.launch_id}:`;
617
+ }
614
618
  export function codexSeatTurn(meta, now = performance.now()) {
615
619
  if (meta.kind !== "codex")
616
620
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.70.15",
3
+ "version": "0.70.16",
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": [