aiterm-mcp 0.63.1 → 0.63.2

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,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.63.2] - 2026-11-02
11
+
12
+ ### Fixed
13
+ - Accept a resumed Codex turn that is already running only when the saved conversation, a new native turn boundary and the live launch identity agree. Keep uncertain resumes blocked without resending input.
14
+ - Return typed `aiterm.agent-resume-error.v1` failures with the current request's input status, so consumers do not classify resume failures by parsing error text.
15
+ - Preserve safe OS failure details for native process reads, distinguishing timeouts, buffer limits and child exit failures without exposing command arguments or raw output.
16
+
10
17
  ## [0.63.1] - 2026-11-02
11
18
 
12
19
  ### Added
@@ -2998,7 +3005,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
2998
3005
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
2999
3006
  provenance.
3000
3007
 
3001
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.1...HEAD
3008
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.2...HEAD
3009
+ [0.63.2]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.1...v0.63.2
3002
3010
  [0.63.1]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.0...v0.63.1
3003
3011
  [0.63.0]: https://github.com/kitepon/aiterm-mcp/compare/v0.62.6...v0.63.0
3004
3012
  [0.62.6]: https://github.com/kitepon/aiterm-mcp/compare/v0.62.5...v0.62.6
package/README.ja.md CHANGED
@@ -209,7 +209,7 @@ runtime-error store は canonical dotagents config の `collection.enabled: true
209
209
  場合だけ収集し、既定OFF、network送信は行いません。tag起点CIのnpm provenance(OIDC Trusted
210
210
  Publishing)で公開し、GitHub Release が Official MCP Registry を再登録します。
211
211
 
212
- **状態:** 開発継続中 · 現行公開版 **v0.63.1** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
212
+ **状態:** 開発継続中 · 現行公開版 **v0.63.2** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
213
213
 
214
214
  ### 更新と巻き戻し
215
215
 
@@ -540,6 +540,7 @@ Windowsで新しく起動するClaude・Codex・Grok・Antigravityは、本人pr
540
540
  一意な子process group leader、子がなければpaneを指す。identityは`pid`、`process_group_id`、
541
541
  `started_identity`、`argv_digest`を持ち、特定不能はnull。WindowsのPIDはnative PIDで、process groupはnull。
542
542
  開始識別はPOSIXの`LC_ALL=C ps lstart`、WindowsのUTC ISOミリ秒、argv digestはSHA-256のhexである。
543
+ native process照会の失敗には、照会種別、OS error code、子processの終了code/信号、出力byte数を添える。生出力・引数・資格は含めず、既存の拒否と終了codeは維持する。
543
544
 
544
545
  `activity.cursor`を次の照会へ渡すと、`output_changed`と`cpu_delta_seconds`を返す。初回と再作成後はnull。
545
546
  `cpu_seconds`は現在のsubtreeの累積値で、区間中にprocessが消えた場合、増分は観測できた分だけとなり
@@ -549,6 +550,8 @@ Windowsで新しく起動するClaude・Codex・Grok・Antigravityは、本人pr
549
550
 
550
551
  休止を確定した会話席は、同じsession ID・harness・会話ID・明示登録envを`pty_list`に残す。`pty_observe`は`state=hibernated`、`reason=idle_timeout`、`exists=true`を返す。pane/harnessの生存はfalse、process本人性3項目とtoken_hintはnull。未配送数と起動後process数は0、CPU累積は0、cursorと活動差分はnull。停止途中・復帰途中・失敗・native世代の不一致はunknownとする。休止席のcloseはCLIを起こさず論理席を消す。同名を明示した`agent_launch`は保存した会話と設定で再開し、harness・設定・project・明示env名の矛盾は入力前に`AGENT_RESUME_CONFLICT`で断る。`pty_open`で休止会話席を上書きしない。通常の`pty_read`・制御キー・承認操作は、休止中や世代未確定では`AGENT_RESUME_UNCONFIRMED`で断る。履歴は既存のtranscriptオプションで読める。停止ボタンは確定休止席を起こさず閉じずidleで返し、途中や不整合は拒否する。全対応OSのmanaged Claude/Codex初回起動も実端末の作成本人性を保持し、証拠欠測では休止しない。自動採番は論理席の名前も避ける。休止直前には実CLIの現在設定も確認し、不一致や確認不能なら席を保持する。Linux・macOS・Windowsのmanaged Claude/Codex会話席は最後の番の終了から30分で休止し、次の送信で同じ会話へ戻る。正の有限値の`AITERM_IDLE_MINUTES`で分数を変更できる。応答中・承認待ち・attach中・未配送・作業中の子孫・作成証拠欠測・設定未確認の席は保持する。他のharness、通常PTY、mounted execution graphは対象外。`aiterm-idle-check --session <name> --launch <32hex>`で同じ保護付き判定を一度実行できる。
551
552
 
553
+ Codexは復帰中にnativeの待機入力で番を始める場合がある。通常速度では、保存会話のproof、休止cursor後の新しい`task_started`、同じ生存native起動を確認したbusyだけを復帰完了とする。busy画面だけでは受理しない。この経路では利用者の作業を起動時processへ分類せず、post-startup数は未知、この起動の自動休止は無効のまま保つ。fastの復元には引き続きidleの入力欄が必要。失敗attemptは自動解除しない。復帰失敗は`isError: true`と、schema `aiterm.agent-resume-error.v1`、code `AGENT_RESUME_UNCONFIRMED`又は`AGENT_RESUME_FAILED`、`session_id`、`launch_id`、`input: "not_sent"`、`recovery: "inspect_session"`の`structuredContent`を返す。未送信は今回の本文だけを指し、CLI未起動や他のnative入力の未処理を意味しない。席を確認し、自動再送や再起動をしない。
554
+
552
555
  agent sessionを閉じると失うものは、次の2項目で分かる。`activity.post_startup_process_count`は、`agent_launch`の起動準備が
553
556
  完了した時点(初手を送る前)に居なかったprocessの数。起動直後の1分に始めた裏の作業も数える。数えないものは2つ。Codex自身の
554
557
  補助process(`codex-code-mode-host`)と、中継`mcp-lazy`の直接の子(初めて使う時に起こすMCPの本体と、先行起動の判定)。
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.63.1** · 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.63.2** · 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
 
@@ -574,6 +574,7 @@ for an ordinary terminal, using the pane when no child leader exists. An identit
574
574
  is null. Start identity uses POSIX `LC_ALL=C ps lstart` or Windows UTC ISO milliseconds; the argv digest is SHA-256 hex.
575
575
  New managed Windows launches of Claude, Codex, Grok, and Antigravity keep missing native processes unknown until their launch shell records that the same CLI invocation returned. Pending input uses the existing readiness deadline; it is still checked before paste and Enter. Older launch metadata keeps its previous behavior.
576
576
  Input admission uses fresh native ownership and its dedicated readiness screen; an unrelated activity-capture failure does not block it. Public `pty_observe` still requires the full activity observation.
577
+ Native process-read errors include the probe kind, OS error code, child exit status/signal and output byte counts. Raw output, arguments and credentials are excluded; the existing refusal and exit code remain unchanged.
577
578
 
578
579
  Pass `activity.cursor` into the next observation to obtain `output_changed` and `cpu_delta_seconds`; first observations and
579
580
  recreated panes return null differences. `cpu_seconds` is the current subtree's cumulative CPU. If a process disappeared
@@ -584,6 +585,8 @@ displayed token count or null. Callers do not need raw argv or pane-text parsing
584
585
 
585
586
  A confirmed hibernation keeps the same logical session in `pty_list`, with the saved harness, conversation ID, and explicitly registered environment values. `pty_observe` returns `state: "hibernated"`, `reason: "idle_timeout"`, and `exists: true`, while both liveness fields are false and process identities and token hint are null. Pending child deliveries and post-startup process count are zero; CPU totals are zero and activity cursors and differences are null. Stopping, resuming, failed, or conflicting native generations remain unknown. Closing a hibernated seat removes it without restarting the CLI. An explicit same-name `agent_launch` resumes the saved conversation and settings; conflicting harness, settings, project, or registered environment names return `AGENT_RESUME_CONFLICT` before input. `pty_open` cannot replace a dormant agent seat. Native `pty_read`, control keys and approval actions refuse dormant or uncertain generations with `AGENT_RESUME_UNCONFIRMED`; transcript reads remain available through the existing transcript option. The stop button returns idle for a confirmed hibernated seat without waking or closing it, and refuses uncertain or conflicting generations. Initial managed Claude/Codex launches on all supported operating systems also retain the actual terminal creation identity; a missing proof prevents automatic hibernation, and automatic naming preserves logical seat names. Idle shutdown also requires confirmation of the running CLI’s settings; mismatched or unknown settings keep the seat alive. Managed Claude and Codex conversations on Linux, macOS and Windows hibernate after 30 minutes from their last completed turn and resume the same conversation on the next send. Set `AITERM_IDLE_MINUTES` to a positive finite duration to change the threshold. Busy or blocked turns, attached terminals, pending child deliveries, active descendants, missing native creation evidence and uncertain settings remain alive. Other harnesses, ordinary PTYs and mounted execution graphs are excluded. `aiterm-idle-check --session <name> --launch <32hex>` runs the same guarded check once.
586
587
 
588
+ Codex can start a native queued turn during resume. At standard speed, Aiterm accepts that busy state only with the saved conversation proof, a new `task_started` after the hibernation cursor and the same live native launch. A busy screen alone is insufficient. This path does not capture user work as startup scaffolding: its post-startup process count remains unknown and automatic hibernation stays disabled for that launch. Fast restoration still requires an idle composer. Failed attempts remain blocked. Resume failures return `isError: true` and `structuredContent` with schema `aiterm.agent-resume-error.v1`, code `AGENT_RESUME_UNCONFIRMED` or `AGENT_RESUME_FAILED`, `session_id`, `launch_id`, `input: "not_sent"` and `recovery: "inspect_session"`. The input status describes only this request's body; it does not prove that the CLI was never started or that other native input was not processed. Inspect the seat; do not automatically resend or restart it.
589
+
587
590
  Two fields tell a caller what closing an agent session would lose. `activity.post_startup_process_count` is the number of
588
591
  processes in the session that did not exist when `agent_launch` finished startup (before the first prompt), so background work
589
592
  started in the first minute is counted too. Two kinds of process are not counted: Codex's own `codex-code-mode-host` helper, and
package/dist/core.js CHANGED
@@ -43,7 +43,7 @@ import { paneTokenHint } from "./harnesses/pane-tokens.js";
43
43
  import { unfinishedDeliveriesOwnedBy } from "./parent-delivery-owners.js";
44
44
  import { readLinuxProcessRegistrationIdentity, readRuntimeProcesses, readProcessIdentities, processSubtree, parentProcess, processIdentity, signalRuntimeProcess, backgroundProcesses, lazyRelayProcess, aitermProcessProbe, windowsConsoleHost, macKeepAwakeProcess, processElapsedSeconds } from "./process-runtime.js";
45
45
  import { liveNodeExecutable } from "./live-node.js";
46
- import { AitermError, telemetryOwnedFailure, ownTelemetryFailure } from "./errors.js";
46
+ import { AitermError, AgentResumeError, telemetryOwnedFailure, ownTelemetryFailure } from "./errors.js";
47
47
  import { isWin, SOCKDIR, SOCK, tmuxCommand, tmuxCommandWithInput, sendPsmuxPayload, loadPtyBufferChunk, pasteBufferBaseArgs, tmuxNewSession, withNativeSessionCreation, withNativeSessionTarget, hasVerifiedNativeSessionTarget, registeredSessionEnvironment, registerSessionEnvironment, attachCommand, normalizePaneCommand, atomicShellMultiline, appendMarkSentinel, paneShellForSubmission, adaptShellSubmission, settlePaneLog, paneCwdArgument, sessionEnvironmentLaunch, paneCommandArgs, } from "./tmux-runtime.js";
48
48
  import { AGENT_DEFAULT_PREFACE, sleep, currentUid, runtimeStateBase, safeStatSize, readFileRange, writeJson0600, createEmpty0600, shq, LAUNCH_ID_RE, AGENT_DONE_POLL_MS, AGENT_RATE_LIMIT_POLL_MS, pollGate, AGENT_EVENT_MAX_BYTES, assertSessionName, agentsDir, readAgentGeneration, selectAgentMetadataFile, publishAgentGeneration, agentEventPath, agentMetadataPath, writeAgentMetadata, AGENT_EVENT_TAIL_BYTES, agentLabel, agentHarness, subagentInstruction, agentLineageFields, } from "./agent-shared.js";
49
49
  import { AuthResponseError, authUi, authPromptDigest, authBindingSchema, authResponseSchema } from "./agent-auth-ui.js";
@@ -4677,11 +4677,15 @@ async function waitStartupSelection(name, selected) {
4677
4677
  }
4678
4678
  return false;
4679
4679
  }
4680
- async function prepareAgentInput(name, meta, options) {
4680
+ async function prepareAgentInput(name, meta, options, acceptRunningCodex = false) {
4681
4681
  await ensureAgentOwnsPaneInput(name, meta.kind);
4682
- let ready = await waitAgentTuiReady(name, meta, options.ready_timeout ?? AGENT_TUI_READY_TIMEOUT_MS);
4682
+ // A resumed Codex can consume its native queue before the composer becomes idle.
4683
+ const running = (screen) => acceptRunningCodex && meta.kind === "codex" && !!meta.resumed_from
4684
+ && codexPaneObservation(screen).state === "busy" && codexRunningTurn(meta) !== null;
4685
+ const wait = () => waitAgentTuiReady(name, meta, options.ready_timeout ?? AGENT_TUI_READY_TIMEOUT_MS, { selectSteer: running });
4686
+ let ready = await wait();
4683
4687
  const handled = new Set();
4684
- while (!ready.ready) {
4688
+ while (!ready.ready && !ready.steer) {
4685
4689
  const action = meta.kind === "codex" ? codexStartupAction(ready.lastScreen, options.trust_project === true)
4686
4690
  : meta.kind === "claude" ? claudeStartupAction(ready.lastScreen, options.trust_project === true)
4687
4691
  : meta.kind === "grok" ? grokStartupAction(ready.lastScreen, options.trust_project === true)
@@ -4709,15 +4713,17 @@ async function prepareAgentInput(name, meta, options) {
4709
4713
  await withExecutionNativeAdmission(name, () => sendKey(name, action.keys.at(-1), { preserveAgentOperation: true }));
4710
4714
  await sleep(AGENT_SUBMIT_DELAY_MS);
4711
4715
  }
4712
- ready = await waitAgentTuiReady(name, meta, options.ready_timeout ?? AGENT_TUI_READY_TIMEOUT_MS);
4716
+ ready = await wait();
4713
4717
  }
4714
- if (!ready.ready)
4718
+ if (!ready.ready && !ready.steer)
4715
4719
  return { status: "blocked", reason: agentPaneObservation(meta.kind, ready.lastScreen).reason };
4716
4720
  const live = observeNativeSession(name);
4717
- if (live.harness_alive !== true || live.harness_process === null || live.state !== "idle")
4721
+ if (live.harness_alive !== true || live.harness_process === null
4722
+ || (live.state !== "idle" && !(ready.steer && live.state === "busy" && codexRunningTurn(meta) !== null)))
4718
4723
  return { status: "blocked", reason: live.reason };
4719
4724
  // ここまでに居るprocessは起動時の足場(harness・MCP・起動時hook)。初手を送る前に控える。
4720
- if (live.activity.cursor !== null) {
4725
+ // shortcut: a native queued turn can already own children, so leave its startup baseline unknown until a future lifecycle can distinguish them.
4726
+ if (live.activity.cursor !== null && !ready.steer) {
4721
4727
  meta.startup_processes = Object.keys(decodeActivityCursor(live.activity.cursor, name).processes);
4722
4728
  meta.startup_process_shapes = startupProcessShapes(meta.startup_processes, readRuntimeProcesses());
4723
4729
  writeAgentMetadata(meta);
@@ -6859,7 +6865,7 @@ function confirmedAgentResumeRecipe(meta, lifecycle) {
6859
6865
  }
6860
6866
  async function resumeAgentInLock(name, readyTimeout = AGENT_TUI_READY_TIMEOUT_MS) {
6861
6867
  const previous = loadAgentMetadata(name), lifecycle = readAgentLifecycle(previous);
6862
- const uncertain = () => new AitermError("AGENT_RESUME_UNCONFIRMED: 前の復帰処理を確認できません。本文は送信していません。再送せず席の状態を確認してください。", 2);
6868
+ const uncertain = () => new AgentResumeError("AGENT_RESUME_UNCONFIRMED", "前の復帰処理を確認できません。本文は送信していません。再送せず席の状態を確認してください。", name, previous.launch_id);
6863
6869
  const ownAttempt = readAgentResumeAttempt(previous);
6864
6870
  if (!lifecycle) {
6865
6871
  if (previous.resumed_from) {
@@ -6966,7 +6972,7 @@ async function resumeAgentInLock(name, readyTimeout = AGENT_TUI_READY_TIMEOUT_MS
6966
6972
  published = true;
6967
6973
  });
6968
6974
  const resumed = next;
6969
- const ready = await prepareAgentInput(name, resumed, { ready_timeout: readyTimeout });
6975
+ const ready = await prepareAgentInput(name, resumed, { ready_timeout: readyTimeout }, !recipe.fast);
6970
6976
  if (ready.status !== "ready")
6971
6977
  throw uncertain();
6972
6978
  // Launch argv pins standard speed; restore fast only after the native composer is ready.
@@ -6991,7 +6997,7 @@ async function resumeAgentInLock(name, readyTimeout = AGENT_TUI_READY_TIMEOUT_MS
6991
6997
  writeAgentResumeAttempt(previous, { ...issued, state: "failed", at: new Date().toISOString() });
6992
6998
  }
6993
6999
  catch { /* resuming also blocks replay */ }
6994
- throw new AitermError(`AGENT_RESUME_FAILED: 同じ会話への復帰を確認できません。本文は送信していません。再送せず席の状態を確認してください。${error instanceof ExecutionError ? ` ${error.code}` : ""}`, 2);
7000
+ throw new AgentResumeError("AGENT_RESUME_FAILED", `同じ会話への復帰を確認できません。本文は送信していません。再送せず席の状態を確認してください。${error instanceof ExecutionError ? ` ${error.code}` : ""}`, name, next?.launch_id ?? previous.launch_id);
6995
7001
  }
6996
7002
  });
6997
7003
  }
package/dist/errors.js CHANGED
@@ -19,6 +19,15 @@ export class AgentAuthenticationPreflightError extends AitermError {
19
19
  this.name = "AgentAuthenticationPreflightError";
20
20
  }
21
21
  }
22
+ /** Resume failures occur before the caller's body reaches the input path. */
23
+ export class AgentResumeError extends AitermError {
24
+ resumeFailure;
25
+ constructor(code, message, sessionId, launchId) {
26
+ super(`${code}: ${message}`, 2);
27
+ this.resumeFailure = { schema: "aiterm.agent-resume-error.v1", code,
28
+ session_id: sessionId, launch_id: launchId, input: "not_sent", recovery: "inspect_session" };
29
+ }
30
+ }
22
31
  export class TelemetryOwnedError extends AitermError {
23
32
  telemetryCode;
24
33
  constructor(message, code, telemetryCode, cause) {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { AuthResponseError, authUiSchema, authBindingSchema, authResponseSchema } from "./agent-auth-ui.js";
3
- import { AitermError, AgentAuthenticationPreflightError } from "./errors.js";
3
+ import { AitermError, AgentAuthenticationPreflightError, AgentResumeError } from "./errors.js";
4
4
  /**
5
5
  * aiterm-mcp — AI が握るローカル永続端末を stdio MCP サーバとして公開する(Node/TS 版)。
6
6
  *
@@ -176,6 +176,9 @@ export function createAitermServer(options = {}) {
176
176
  }
177
177
  function fail(e) {
178
178
  const msg = e instanceof Error ? e.message : String(e);
179
+ if (e instanceof AgentResumeError)
180
+ return { content: [{ type: "text", text: "aiterm: " + msg }], isError: true,
181
+ structuredContent: { ...e.resumeFailure } };
179
182
  const sendFailure = e instanceof AitermError ? e.sendFailure : undefined;
180
183
  if (sendFailure)
181
184
  return { content: [{ type: "text", text: "aiterm: " + msg }], isError: true,
@@ -91,13 +91,22 @@ export function windowsConsoleHost(row) {
91
91
  const name = (row.executable || first?.[1] || first?.[2] || "").replace(/\\/g, "/");
92
92
  return path.posix.basename(name).toLowerCase() === "conhost.exe";
93
93
  }
94
+ function processReadError(probe, result) {
95
+ const code = result.error?.code;
96
+ // Native error messages and stderr can contain argv and credentials.
97
+ const detail = { probe, code: result.error
98
+ ? (code && ["ETIMEDOUT", "ENOBUFS", "EAGAIN", "ENOENT", "EACCES", "ENOMEM", "EMFILE", "ENFILE", "E2BIG", "EPERM"].includes(code) ? code : "UNKNOWN") : null,
99
+ status: result.status ?? null, signal: result.signal ?? null,
100
+ stdout_bytes: Buffer.byteLength(result.stdout ?? ""), stderr_bytes: Buffer.byteLength(result.stderr ?? "") };
101
+ return new AitermError(`${isWin ? "Windowsのnative process" : "OSのprocess"}一覧を取得できません ${JSON.stringify(detail)}`, 2);
102
+ }
94
103
  export function readRuntimeProcesses(includeSession = false) {
95
104
  if (!isWin) {
96
105
  const result = spawnSync(POSIX_PS, includeSession ? POSIX_SESSION_TABLE_ARGS : POSIX_TABLE_ARGS, {
97
106
  encoding: "utf8", env: { ...process.env, LC_ALL: "C" }, timeout: 10000, maxBuffer: 16 * 1024 * 1024,
98
107
  });
99
108
  if (result.error || result.status !== 0)
100
- throw new AitermError("OSのprocess一覧を取得できません", 2);
109
+ throw processReadError(includeSession ? "session_table" : "table", result);
101
110
  return parsePosixProcessTable(result.stdout, includeSession);
102
111
  }
103
112
  const script = [
@@ -110,7 +119,7 @@ export function readRuntimeProcesses(includeSession = false) {
110
119
  encoding: "utf8", timeout: 15000, maxBuffer: 16 * 1024 * 1024, windowsHide: true,
111
120
  });
112
121
  if (result.error || result.status !== 0)
113
- throw new AitermError("Windowsのnative process一覧を取得できません", 2);
122
+ throw processReadError(includeSession ? "session_table" : "table", result);
114
123
  let rows;
115
124
  try {
116
125
  rows = JSON.parse(result.stdout);
@@ -194,7 +203,7 @@ export function readProcessIdentities(pids) {
194
203
  });
195
204
  // 該当するprocessが一つも無い時、psは何も出さずstatus 1で終わる。
196
205
  if (result.error || (result.status !== 0 && !(result.status === 1 && !result.stdout.trim()))) {
197
- throw new AitermError("OSのprocess一覧を取得できません", 2);
206
+ throw processReadError("identity", result);
198
207
  }
199
208
  return result.stdout.split("\n").filter(line => line.trim()).map(line => {
200
209
  const match = /^\s*(\d+)\s+(\S+\s+\S+\s+\d+\s+\S+\s+\d+)\s*$/.exec(line);
@@ -230,7 +239,7 @@ export function readProcessIdentities(pids) {
230
239
  encoding: "utf8", timeout: 15000, windowsHide: true,
231
240
  });
232
241
  if (result.error || result.status !== 0)
233
- throw new AitermError("Windowsのnative process一覧を取得できません", 2);
242
+ throw processReadError("identity", result);
234
243
  let rows;
235
244
  try {
236
245
  rows = JSON.parse(result.stdout);
@@ -306,7 +315,7 @@ export function processElapsedSeconds(pid) {
306
315
  const text = (result.stdout ?? "").trim();
307
316
  // 該当するprocessが無い時、psは何も出さずstatus 1で終わる。
308
317
  if (result.error || (result.status !== 0 && !(result.status === 1 && !text)))
309
- throw new AitermError("OSのprocess一覧を取得できません", 2);
318
+ throw processReadError("elapsed", result);
310
319
  if (!text)
311
320
  return null;
312
321
  const elapsed = parsePosixElapsed(text);
package/docs/DESIGN.md CHANGED
@@ -190,6 +190,8 @@ Codex v1のactive goalは設定替えの間だけ一時停止する。`configure
190
190
 
191
191
  休止判定の部品はagent-idle.ts、木の停止はprocess-tree-stop.tsに置く。前者はruntimeが供給する既存の席admissionで世代/入力/保護条件を再確認し、未確定を成功にしない。後者は本人性を照合したpane木へTERM→5秒→KILLと退出確認を行い、POSIXの別sessionを除外する。OSごとのsignalはprocess-runtime.tsが所有する。本体adapterは既存送信queue/file lockで期待launchと元のnative ID/pane本人性を固定する。最新native完了の保存とprivate resume recipeの一致を確認し、durable stoppingの後も最初のsignal前は保護条件全体を再確認する。効果前だけ準備を取消し、効果後の不明はstoppingに残す。木の退出後に元native IDを閉じ、同世代だけをhibernatedへ進める。時計はper-launchのdetached shell/sleep(WindowsはPowerShell 7)で待ち、起床時だけNodeで同じC判定を行う。owner/tokenを同じ送信排他で記録し、busy等は60秒後の後続確認を持つ。list/launch/Stop/waiterから起動口を通し、元のnative作成proofが無い旧席には時計を登録しない。新規起動templateと設定替えの更新は接続し、既定値欠測や途中設定失敗は休止を許可しない。各世代のmetadataは保持し、active-launch.jsonの原子的切替で現在のlaunchを選ぶ。Codexの停止前には一意な起動marker付きroot/完了境界を検証し、file本人性・prefix hash・旧cursor/turn IDのproofをlifecycleへ束縛する。resumed_fromを持つ読取りは旧metadata/lifecycle/recipe/proofを照合し、保存cursor以前と最後の旧turnの遅れた記録を除外する。通常waiter・番境界・差し込み・合間の言葉と次回停止が同じ相関を使い、復帰後の/newは新markerだけで認める。物理再開候補は同じ送信排他で旧stateを残し、新世代の公式resume→ready/fast確認→本文投入を進める。private resume-attemptの失敗は追加CLIと本文を止め、Claudeの設定rootもper-launchで保持する。通常POSIXのmanaged Claude/Codex初回起動も、実create receiptをその場で取得し、送信/休止と同じfile lockを取ってから旧記録を掃除する。同名置換・休止競合ではCLIを入れず古い記録を残し、自動採番も論理席名を避ける。実create receipt由来のnative IDとserver/paneの開始本人性をprivateに保存し、同じ送信排他でCLI/ready/fast/本文と後続操作を固定する。tmux受信側のnative format条件も同じqueueで確かめ、server再起動によるID再利用を拒否する。既存effect guardを迂回せず、正規resume transitionの無いmounted graphは停止・再開対象外にする。Windowsはqualified paneと固定server認証・native本人性を用いる。既存psmux registry保護を開始本人性取得の前へ置き、server/paneの開始時刻は保存精度を保って一括取得する。Windows closeは元server終了の確認後に記録を片付ける。受信側命令の引用はpsmuxのparserに合わせる。Windowsのnative clockはconsoleを継がないProcessStartInfoとnull標準handleで起こし、一時receiptのPID/開始時刻を保存して起動helperを終了する。同名agent_launchも保存設定を照合して同会話へ戻し、既存の初手/tupleを使う。公開list/observe/seat_turns/closeは論理席を扱い、内部の物理観測と分離する。native読取り/キー/承認は休止・復帰途中・失敗を拒否し、復帰先の実receiptへ固定する。中断は確定休止ならidleで返し、途中や不整合を拒否する。キーと承認応答は送信file lockを共有し、停止ボタンの即時性と既存のキー制限は維持する。登録env名も再現し、復帰中から公開一覧の本人性を保つ。native手動設定とClaude/Codex各3OSの実会話復帰、公開論理席とconsumerを受入済み。元作成証拠を持たない旧席・未受入harnessは対象へ登録しない(ADR 0138)。
192
192
 
193
+ Codexの通常速度の復帰は、保存会話proofのcursor後の新しいtask_startedと固定nativeの生存が揃うbusyも受理する。既存のsteer判定へ戻し、idle待ちのtimeoutで正常なnative番をfailedへ固定しない。利用者の子をstartup baselineへ分類せず、この場合のbaselineと自動休止可否は未知のまま保持する。fast復元はidleで行い、failed attemptは自動解除しない。復帰失敗は型付きaiterm.agent-resume-error.v1で今回本文の未送信と席確認の必要を返し、他の入力やnative起動の結果と混同しない(ADR 0138)。
194
+
193
195
  agent turnは常に非ブロックdispatchであり、receiptの`event_cursor`がturn境界になる。
194
196
  Codex親にはAitermのMCP processが完了を観測し、選択設定に応じて公式Steerまたはqueueへ本文を自動配送する。
195
197
  Claude Code親は公式の非同期hookで本文を受け取り、待機中も新しいturnへ進める。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.63.1",
3
+ "version": "0.63.2",
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": [