aiterm-mcp 0.70.24 → 0.70.25

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,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.70.25] - 2026-11-11
11
+
12
+ - `pty_list` with seat turns is faster on a host with many seats. Checking whether one seat exists listed every seat with its agent metadata, and each metadata read scanned the whole agents folder, so one call grew with the number of seats squared (10-27 s for about 140 members). The check now reads only the session names, with the same tmux call, retry and failures. On the production state, reading the turns of 48 seats went from 4.6 s to 2.3 s. What `pty_list` returns is unchanged.
13
+
10
14
  ## [0.70.24] - 2026-11-11
11
15
 
12
16
  - Closing a seat now also ends its idle-clock worker. `pty_close`, killing all sessions, and a fresh launch under the same name removed the clock record but left the waiting `sh`/`sleep` (PowerShell on Windows) running until its wake time, so a deleted member's `agent-idle-cli --session <name>` stayed visible on the host. Before the record is removed, the worker is ended when its PID and start time still match the record: on Linux and macOS its own process group (the shell, its sleep, and a checker that is just waking), on Windows its PowerShell. A process never ends its own clock. If the worker cannot be ended, it still exits at wake on the missing token, as before. Live seats are unchanged.
@@ -3301,7 +3305,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3301
3305
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3302
3306
  provenance.
3303
3307
 
3304
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.24...HEAD
3308
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.25...HEAD
3309
+ [0.70.25]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.24...v0.70.25
3305
3310
  [0.70.24]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.23...v0.70.24
3306
3311
  [0.70.23]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.22...v0.70.23
3307
3312
  [0.70.22]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.21...v0.70.22
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.24** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.70.25** · 動作対象は 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.24** · 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.25** · 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
@@ -1647,7 +1647,7 @@ export function observeSession(name, cursor) {
1647
1647
  result.state = "unknown";
1648
1648
  result.reason = `agent_${state}`;
1649
1649
  result.pane_alive = null;
1650
- const native = listNativeSessionsResult().sessions.some(row => row.session_id === name);
1650
+ const native = nativeSessionExists(name);
1651
1651
  if (state !== "hibernated" || native) {
1652
1652
  if (native && state === "hibernated")
1653
1653
  result.reason = "resume_native_conflict";
@@ -1662,7 +1662,7 @@ export function observeSession(name, cursor) {
1662
1662
  }
1663
1663
  // Discard the old pane's cursor; hibernation proves absence, not an activity delta.
1664
1664
  if (!isDeepStrictEqual(loadAgentMetadata(name), meta) || agentDormantState(meta) !== "hibernated"
1665
- || listNativeSessionsResult().sessions.some(row => row.session_id === name))
1665
+ || nativeSessionExists(name))
1666
1666
  return result;
1667
1667
  result.state = "hibernated";
1668
1668
  result.reason = "idle_timeout";
@@ -1689,10 +1689,10 @@ export function absentHarnessAlive(meta, platform = process.platform) {
1689
1689
  // Input admission needs the same native ownership proof, without activity capture or child-delivery scans.
1690
1690
  function observeSessionNative(name) {
1691
1691
  assertSessionName(name);
1692
- const listed = listNativeSessionsResult().sessions.find(session => session.session_id === name);
1692
+ const listed = nativeSessionExists(name);
1693
1693
  const result = {
1694
1694
  schema: "aiterm.pty-observe-result.v1", session_id: name, observed_at: new Date().toISOString(),
1695
- exists: !!listed, harness: null, launch_id: null, state: "missing", reason: "session_missing",
1695
+ exists: listed, harness: null, launch_id: null, state: "missing", reason: "session_missing",
1696
1696
  pane_alive: false, harness_alive: null, pane_process: null, harness_process: null, process_identity: null,
1697
1697
  token_hint: null, pending_child_deliveries: null,
1698
1698
  activity: { cursor: null, output_changed: null, cpu_seconds: null, cpu_delta_seconds: null, cpu_delta_complete: null,
@@ -2150,7 +2150,7 @@ function observeEmptyCreatedLaunch(target, alive) {
2150
2150
  export function observeExecutionParentProcess(name) {
2151
2151
  assertSessionName(name);
2152
2152
  return readExecutionParentProcess(name, {
2153
- present: () => listNativeSessionsResult().sessions.some(session => session.session_id === name),
2153
+ present: () => nativeSessionExists(name),
2154
2154
  metadata: () => tryLoadAgentMetadata(name),
2155
2155
  pane: () => tmux("display-message", "-p", "-t", name, "#{pane_pid}\t#{pane_dead}"),
2156
2156
  processes: readRuntimeProcesses,
@@ -2163,45 +2163,56 @@ export function observeExecutionParentProcess(name) {
2163
2163
  const SESSION_LIST_EXITING_RETRY_MS = 500;
2164
2164
  const SESSION_LIST_EXITING_POLL_MS = 20;
2165
2165
  const SESSION_LIST_SERVER_EXITING_RE = /server exited unexpectedly/i;
2166
- function listNativeSessionsResult(envKeys = [], runTmux = tmux) {
2167
- for (const key of envKeys) {
2168
- if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key))
2169
- throw new AitermError("env_keysの環境変数名が不正です", 2);
2170
- }
2166
+ /** The native session rows, unenriched. Each row is [name, command, attached, width, height]. */
2167
+ function listNativeSessionRows(runTmux = tmux) {
2171
2168
  const list = () => runTmux("list-sessions", "-F", "#{session_name}\t#{pane_current_command}\t#{session_attached}\t#{window_width}\t#{window_height}");
2172
2169
  let r = list();
2173
2170
  for (const deadline = performance.now() + SESSION_LIST_EXITING_RETRY_MS; r.code !== 0 && SESSION_LIST_SERVER_EXITING_RE.test(r.stderr) && performance.now() < deadline;) {
2174
2171
  pauseSync(SESSION_LIST_EXITING_POLL_MS);
2175
2172
  r = list();
2176
2173
  }
2177
- const sessions = [];
2178
2174
  if (r.code !== 0 && !/no server running|No such file or directory/i.test(r.stderr))
2179
2175
  throw new AitermError("セッション一覧を取得できません: " + r.stderr.trim(), 2);
2180
- if (r.code === 0)
2181
- for (const line of r.stdout.trim().split("\n").filter(Boolean)) {
2182
- const [name, command, attached, width, height] = line.split("\t");
2183
- assertSessionName(name);
2184
- const environment = {};
2185
- const registered = envKeys.length ? registeredSessionEnvironment(name) : null;
2186
- for (const key of envKeys) {
2187
- // sessionの表には開いたprocessの環境も入っている。返すのは名指しで登録した値だけ。
2188
- if (registered && !registered.includes(key)) {
2189
- environment[key] = null;
2190
- continue;
2191
- }
2192
- const value = tmux("show-environment", "-t", name, key);
2193
- if (value.code !== 0 && !/unknown variable|not found|not set/i.test(value.stderr))
2194
- throw new AitermError("session環境変数を照会できません", 2);
2195
- // psmuxは指定以外の内部キーも出すため、要求されたキーと完全一致した行だけを返す。
2196
- const selected = value.stdout.split(/\r?\n/).find(entry => entry.startsWith(`${key}=`));
2197
- environment[key] = selected === undefined ? null : selected.slice(key.length + 1);
2176
+ if (r.code !== 0)
2177
+ return [];
2178
+ const rows = r.stdout.trim().split("\n").filter(Boolean).map(line => line.split("\t"));
2179
+ for (const [name] of rows)
2180
+ assertSessionName(name);
2181
+ return rows;
2182
+ }
2183
+ /** Same listing and failure as pty_list, without loading every seat's metadata: one seat's existence check stays one
2184
+ * tmux call (2026-11-11: per-seat full lists made a CurrentWork pty_list take 10-27 s for ~140 members). */
2185
+ function nativeSessionExists(name) {
2186
+ return listNativeSessionRows().some(([listed]) => listed === name);
2187
+ }
2188
+ function listNativeSessionsResult(envKeys = [], runTmux = tmux) {
2189
+ for (const key of envKeys) {
2190
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key))
2191
+ throw new AitermError("env_keysの環境変数名が不正です", 2);
2192
+ }
2193
+ const sessions = [];
2194
+ for (const [name, command, attached, width, height] of listNativeSessionRows(runTmux)) {
2195
+ const environment = {};
2196
+ const registered = envKeys.length ? registeredSessionEnvironment(name) : null;
2197
+ for (const key of envKeys) {
2198
+ // sessionの表には開いたprocessの環境も入っている。返すのは名指しで登録した値だけ。
2199
+ if (registered && !registered.includes(key)) {
2200
+ environment[key] = null;
2201
+ continue;
2198
2202
  }
2199
- const meta = tryLoadAgentMetadata(name);
2200
- sessions.push({ session_id: name, current_command: normalizePaneCommand(command), attached: Number(attached) > 0,
2201
- width: Number(width), height: Number(height), harness: meta ? agentHarness(meta.kind) : null,
2202
- launch_id: meta?.launch_id ?? null,
2203
- vendor_session_id: meta?.vendor_session_id ?? null, environment });
2203
+ const value = tmux("show-environment", "-t", name, key);
2204
+ if (value.code !== 0 && !/unknown variable|not found|not set/i.test(value.stderr))
2205
+ throw new AitermError("session環境変数を照会できません", 2);
2206
+ // psmuxは指定以外の内部キーも出すため、要求されたキーと完全一致した行だけを返す。
2207
+ const selected = value.stdout.split(/\r?\n/).find(entry => entry.startsWith(`${key}=`));
2208
+ environment[key] = selected === undefined ? null : selected.slice(key.length + 1);
2204
2209
  }
2210
+ const meta = tryLoadAgentMetadata(name);
2211
+ sessions.push({ session_id: name, current_command: normalizePaneCommand(command), attached: Number(attached) > 0,
2212
+ width: Number(width), height: Number(height), harness: meta ? agentHarness(meta.kind) : null,
2213
+ launch_id: meta?.launch_id ?? null,
2214
+ vendor_session_id: meta?.vendor_session_id ?? null, environment });
2215
+ }
2205
2216
  return { schema: "aiterm.pty-list-result.v1", observed_at: new Date().toISOString(), sessions };
2206
2217
  }
2207
2218
  export function listSessionsResult(envKeys = [], runTmux = tmux) {
@@ -4961,7 +4972,7 @@ function readExecutionAuthMetadata(name) {
4961
4972
  }
4962
4973
  /** 一覧の取得失敗を端末の消失へ丸めず、正規PTY一覧で存在を確認する。 */
4963
4974
  function authSessionExists(name) {
4964
- return listNativeSessionsResult().sessions.some(session => session.session_id === name);
4975
+ return nativeSessionExists(name);
4965
4976
  }
4966
4977
  function authSessionEnvironment(name, keys) {
4967
4978
  const env = { ...process.env };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.70.24",
3
+ "version": "0.70.25",
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": [