aiterm-mcp 0.32.0 → 0.33.1

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,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.33.1] - 2026-09-09
11
+
12
+ ### Fixed
13
+
14
+ - macOS・Linux上のAitermからSSH先のPowerShellへ`pty_send(mark:true)`するとPOSIXの`printf`を送っていた不具合を修理した。現在のPowerShell promptで方言を判定し、成功・失敗の完了マーカーを生成する。古いpromptや入力途中の行は使わない。
15
+
16
+ ## [0.33.0] - 2026-09-09
17
+
18
+ ### Added
19
+
20
+ - `pty_list`の構造化結果と明示した非秘密環境変数の照会、`pty_observe`によるpane/harnessの生存、native process identity、状態、token hint、画面・CPU活動の観測を追加した。
21
+ - 通常PTYにも`AITERM_SESSION_ID`を注入し、`pty_open`の`env_vars`で帰属情報を継承できる。古いtmuxの環境注入も製品内で扱う。
22
+ - `agent_approval`でCodexのcommand/MCP承認をinspectし、digestへ束縛した単発許可・拒否を送れる。
23
+ - `agent_launch`へ`trust_project`、起動準備の`startup`、初手の`initial_prompt` receiptを追加した。promptなしでも明示したproject信頼に基づく既知の起動準備を完了する。
24
+
25
+ ### Fixed
26
+
27
+ - Grokの通信失敗+Waiting表示、Codexの過去の承認画面を稼働状態と誤認しない。初手は実行表示または相関した完了で開始を確認する。
28
+ - Codexの設定読込失敗でCLIが終了した後、残った起動画面へpromptを送る問題を修理した。送信前にharnessの生存を確認し、未送信の構造化エラーで返す。
29
+ - `mark:true`でheredoc終端へsentinelを連結して構文を壊す問題を修理した。
30
+
10
31
  ## [0.32.0] - 2026-09-09
11
32
 
12
33
  ### Added
@@ -1583,7 +1604,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
1583
1604
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
1584
1605
  provenance.
1585
1606
 
1586
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.32.0...HEAD
1607
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.33.1...HEAD
1608
+ [0.33.1]: https://github.com/kitepon/aiterm-mcp/compare/v0.33.0...v0.33.1
1609
+ [0.33.0]: https://github.com/kitepon/aiterm-mcp/compare/v0.32.0...v0.33.0
1587
1610
  [0.32.0]: https://github.com/kitepon/aiterm-mcp/compare/v0.31.2...v0.32.0
1588
1611
  [0.31.2]: https://github.com/kitepon/aiterm-mcp/compare/v0.31.1...v0.31.2
1589
1612
  [0.31.1]: https://github.com/kitepon/aiterm-mcp/compare/v0.31.0...v0.31.1
package/README.ja.md CHANGED
@@ -112,7 +112,7 @@ diagnostics、recovery、update、releaseを所有します。このREADMEと[
112
112
 
113
113
  **言葉でなく実測で:** 記録済み203テストのベンチマークでは、`pty_read` はコンテキストに載るトークンを生ログの **約 7.1 分の 1** に減らす。しかも pass/fail の判定は畳んでも残る。→ [組み込みシェルツールとの使い分け](#組み込みシェルツールとの使い分け)
114
114
 
115
- 16ツール: 6つのPTYツール、正規のagent起動入口`agent_launch`、実行中のCodex/Grokを誘導する`agent_steer`、移行用の旧4alias、`agent_configure`、`claude_turn`、`claude_approval`、`diagnostics`。backendはPOSIXのtmux/Windows nativeのpsmuxなので、MCPサーバやAIクライアントが再起動してもsessionは生き残る。
115
+ 18ツール: 7つのPTYツール、正規のagent起動入口`agent_launch`、実行中のCodex/Grokを誘導する`agent_steer`、移行用の旧4alias、`agent_configure`、`agent_approval`、`claude_turn`、`claude_approval`、`diagnostics`。backendはPOSIXのtmux/Windows nativeのpsmuxなので、MCPサーバやAIクライアントが再起動してもsessionは生き残る。
116
116
 
117
117
  **v0.28.0では実行基盤harnessとmodelを分離した。** harnessはagent loop・認証・hook・session・transcriptを所有し、modelはその上で選ぶ。Cursor Agent CLIでGPT/Claude/Grokを選んでも完了契約はCursor方式のまま。Composerは別harnessではなく、`harness:"grok-cli", model:"grok-composer-2.5-fast"`で表す。旧4起動ツールは同じ実装へ流れる互換alias。
118
118
 
@@ -171,7 +171,7 @@ runtime-error store は canonical dotagents config の `collection.enabled: true
171
171
  場合だけ収集し、既定OFF、network送信は行いません。tag起点CIのnpm provenance(OIDC Trusted
172
172
  Publishing)で公開し、GitHub Release が Official MCP Registry を再登録します。
173
173
 
174
- **状態:** 開発継続中 · 現行公開版 **v0.32.0** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
174
+ **状態:** 開発継続中 · 現行公開版 **v0.33.1** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
175
175
 
176
176
  ### 更新と巻き戻し
177
177
 
@@ -215,7 +215,7 @@ Grok/Composerの無人起動は公式`--trust`で指定された作業フォ
215
215
 
216
216
  Grok/Composerがread-only sandboxの適用を拒否した場合、prompt送信時に`GROK_SANDBOX_STARTUP_FAILED`とCLIの原因を返す。例えばhookのパスにシンボリックリンクがあるとGrok CLIは起動を拒否する。設定の管理元で原因を修正し、対象sessionを`pty_close`して起動し直す。Aitermはsandboxを解除したりhookをコピーしたりしない。
217
217
 
218
- この判定はGrok専用アダプターが所有し、同じCLIを使うComposerにも適用する。初回prompt付きの`agent_launch`と通常の`pty_send`で、入力受付待ち中に拒否を検出すると未送信のエラーを返す。promptなしの`agent_launch`は起動要求を返すため、その応答だけでは入力受付済みと判断しない。実装の責務分担は[DESIGN](docs/DESIGN.md#failure-and-recovery)を参照。
218
+ この判定はGrok専用アダプターが所有し、同じCLIを使うComposerにも適用する。初回prompt付きの`agent_launch`と通常の`pty_send`で、入力受付待ち中に拒否を検出すると未送信のエラーを返す。promptなし・`trust_project`指定なしの起動応答は入力受付を保証しない。`trust_project:true`では入力受付まで確認し、`startup.status`を返す。Grokのprivacy notice起動設定も同アダプターが所有する。実装の責務分担は[DESIGN](docs/DESIGN.md#failure-and-recovery)を参照。
219
219
 
220
220
  ```text
221
221
  agent_launch({ harness: "codex-cli", session_name: "codex1", cwd: "/repo",
@@ -314,7 +314,7 @@ Throughline自体が不要である。
314
314
  `aiterm-setup --json`が`ready`になったら、利用するMCP clientを再起動して接続を確認する。Claude Codeの場合:
315
315
 
316
316
  ```bash
317
- /mcp # aiterm が connected・16 ツール公開、と出る
317
+ /mcp # aiterm が connected・18 ツール公開、と出る
318
318
  ```
319
319
 
320
320
  最初のセッション——4 回の呼び出しで、1 個の永続端末:
@@ -355,7 +355,7 @@ MCP クライアントが aiterm を stdio 越しにプログラムから駆動
355
355
 
356
356
  ```mermaid
357
357
  flowchart LR
358
- AI["AI / MCP client<br/>(the orchestrator)"] -->|"pty_send · agent_launch · agent_steer · agent_configure · claude_turn · claude_approval<br/>旧launcher alias · diagnostics"| S["aiterm-mcp<br/>stdio MCP · 16 tools"]
358
+ AI["AI / MCP client<br/>(the orchestrator)"] -->|"pty_send · pty_observe · agent_launch · agent_steer · agent_configure · agent_approval · claude_turn · claude_approval<br/>旧launcher alias · diagnostics"| S["aiterm-mcp<br/>stdio MCP · 18 tools"]
359
359
  S -->|"pty_read<br/>token-reduced"| AI
360
360
  S -->|"tmux / psmux<br/>send · capture"| P["persistent PTYs<br/>再起動を跨ぐ"]
361
361
  P -->|"ssh · docker · repl"| R["nested<br/>remote · container · REPL"]
@@ -427,15 +427,48 @@ aiterm は同じ核心の洞察——端末を出会いの場にする——を
427
427
 
428
428
  ## ツール
429
429
 
430
+ ### セッション観測と起動準備
431
+
432
+ `pty_open`の既定shellはPOSIXでbash、WindowsでPowerShell 7。通常PTYとagentの内側では
433
+ `AITERM_SESSION_ID`で自分のsessionを識別できる。`env_vars`はMCP processから継承する名前の配列で、
434
+ `pty_list({ env_keys: ["JOB_OWNER"] })`は指定した非秘密キーだけを`environment`へ返す。未設定値はnull。
435
+ 一覧の`aiterm.pty-list-result.v1`は`observed_at`と`sessions`を持ち、各行に`session_id`、`current_command`、
436
+ `attached`、`width`、`height`、`harness`、`environment`を返す。従来のtextも維持する。
437
+
438
+ `pty_observe({ session_id, cursor? })`は`aiterm.pty-observe-result.v1`で`exists`、`observed_at`、
439
+ `state`(busy/idle/blocked/dead/missing/unknown)、`reason`、`pane_alive`、`harness_alive`を返す。
440
+ `pane_process`と`harness_process`は別のidentityで、`process_identity`はagentならharness、通常PTYなら
441
+ 一意な子process group leader、子がなければpaneを指す。identityは`pid`、`process_group_id`、
442
+ `started_identity`、`argv_digest`を持ち、特定不能はnull。WindowsのPIDはnative PIDで、process groupはnull。
443
+ 開始識別はPOSIXの`LC_ALL=C ps lstart`、WindowsのUTC ISOミリ秒、argv digestはSHA-256のhexである。
444
+
445
+ `activity.cursor`を次の照会へ渡すと、`output_changed`と`cpu_delta_seconds`を返す。初回と再作成後はnull。
446
+ `cpu_seconds`は現在のsubtreeの累積値で、区間中にprocessが消えた場合、増分は観測できた分だけとなり
447
+ `cpu_delta_complete=false`を付ける。`background_cpu_seconds`、`background_cpu_delta_seconds`、
448
+ `background_cpu_delta_complete`はpane開始から60秒以降に生成された子孫だけの同じ観測で、起動時MCPを除外する。
449
+ `token_hint`は画面の直近token表示値またはnull。画面本文や生argvを解析する必要はない。
450
+
451
+ `agent_launch({ harness, cwd, trust_project: true })`はpromptなしでも既知のworkspace・project hooks・MCP初期同意を
452
+ 進め、入力受付とharness生存を確認して`startup.status="ready"`を返す。指定なしのpromptなし起動は`not_checked`。
453
+ 初手の`initial_prompt.status`は`not_requested`/`not_sent`/`submitted_unconfirmed`/`started`を区別する。
454
+ 未送信・未確認の失敗もsession付きstructuredContentを保持する。未確認のpromptを再送せず、返ったcursorで観測する。
455
+
456
+ Codexの実行中承認は`agent_approval({ action: "inspect", session_id })`の`prompt`と`choices`を確認し、
457
+ `respond`へ`observed_prompt_digest`と`approval_choice`(`approve_once`/`deny`)を渡す。
458
+ 未知・変更済みのdialogは`status="blocked"`と`isError:true`で返し、入力しない。恒久許可は扱わない。
459
+ Claudeの相関済み承認は既存の`claude_approval`を使う。
460
+
430
461
  | ツール | 役割 | 主な引数 |
431
462
  | --- | --- | --- |
432
- | `pty_open` | 端末を 1 個握り `session_id` を返す | `name?`, `shell="bash"` |
463
+ | `pty_open` | 端末を1個開き`session_id`を返す | `name?`, `shell?`, `env_vars?` |
433
464
  | `pty_send` | テキストを送る。agent sessionでは非ブロックdispatchとして`event_cursor`を返す | `session_id`, `text`, `enter=true`, `mark`, `force`, `rtk`, `raw` |
434
465
  | `pty_read` | 出力を削減して読む(既定は増分) | `session_id`, `wait`, `until`, `until_regex`, `timeout`, `screen`, `full`, `lines`, `line_range`, `raw`, `rtk`, `agent_transcript`, `operation_id` |
435
466
  | `pty_key` | 制御キーを送る | `session_id`, `key`(`C-c`/`Enter`/`Up`…) |
436
467
  | `pty_close` | 冪等に閉じ、`closed` / `already_closed`を返す | `session_id` |
437
- | `pty_list` | セッション一覧(agent行は正規`harness=<id>`と互換`agent=<kind>`を含む) | (なし) |
438
- | `agent_launch` | harnessとmodelを別軸で選ぶ正規agent起動入口 | `harness`, `prompt?`, `model?`, `reasoning_effort?`, `cwd?`, `write_scope?`, `throughline_source_session?`, `throughline_supplement_file?` |
468
+ | `pty_list` | textと構造化したsession一覧、明示した非秘密環境変数の照会 | `env_keys?` |
469
+ | `pty_observe` | pane/harnessの生存、native process identity、状態と活動 | `session_id`, `cursor?` |
470
+ | `agent_launch` | harnessとmodelを別軸で選ぶ正規agent起動入口 | `harness`, `prompt?`, `model?`, `reasoning_effort?`, `cwd?`, `write_scope?`, `trust_project?`, `env_vars?`, `throughline_source_session?`, `throughline_supplement_file?` |
471
+ | `agent_approval` | Codexの現在の承認を検査し、単発許可・拒否を送る | `action`, `session_id`, `approval_choice?`, `observed_prompt_digest?` |
439
472
  | `agent_steer` | 実行中のCodex/Grok turnへtextを差し込む。idleなら送信せず`idle`を返す | `session_id`, `text` |
440
473
  | `claude_agent` / `codex_agent` / `grok_agent` / `composer_agent` | deprecated互換alias | 旧launcher引数 |
441
474
  | `agent_configure` | 起動中のClaude/Codex/Grok/Composer/Cursorを再起動せずmodel/effort変更 | `session_id`, `model?`, `reasoning_effort?` |
@@ -476,6 +509,8 @@ handoff contextを前置きできる。この任意経路は`throughline >= 0.9.
476
509
 
477
510
  ### 完了検出(5 層)
478
511
 
512
+ SSH先がPowerShellの場合、`mark:true`は現在の標準`PS ...>`プロンプトから方言を判定する。Aiterm自身がmacOS・Linux上でもPowerShell構文を送り、過去の出力に残ったプロンプトは判定に使わない。
513
+
479
514
  `pty_read({ wait: true })`は通常PTYを、process終了/`mark:true` sentinel/`until`一致/shell復帰を伴う出力静止/timeoutの5層で判定する。agent sessionは第6の正確な層を使い、Codexは通常rollout、Grokは通常session event、Claudeはlaunch相関Stop event、Cursorは通常agent transcriptの`turn_ended`を`aiterm-wait --cursor`が観測する。親はブロックもポーリングもしない。
480
515
 
481
516
  ### トークン削減
package/README.md CHANGED
@@ -114,7 +114,7 @@ Aiterm and is not a runtime dependency.
114
114
 
115
115
  **Measured, not claimed:** in the recorded 203-test benchmark, a `pty_read` puts **~7.1× fewer tokens** in your context than the raw log — and the pass/fail verdict survives the fold. → [When to reach for it vs. the built-in shell](#when-to-reach-for-it-vs-the-built-in-shell)
116
116
 
117
- Sixteen tools: six **PTY tools** — `pty_open` / `pty_send` / `pty_read` / `pty_key` / `pty_close` / `pty_list` — to open, drive, and read one persistent terminal; one canonical **agent launcher**, `agent_launch`, which selects `claude-code`, `codex-cli`, `grok-cli`, or `cursor-cli` as the execution harness; `agent_steer` for an active Codex or Grok turn; four deprecated launcher aliases kept for migration; `agent_configure`; `claude_turn`; `claude_approval`; and `diagnostics`. The backend is **tmux on POSIX and psmux on native Windows**, so sessions survive even if the MCP server or the AI client restarts.
117
+ Eighteen tools: seven **PTY tools** — `pty_open` / `pty_send` / `pty_read` / `pty_key` / `pty_close` / `pty_list` / `pty_observe` — to open, drive, read, and observe one persistent terminal; one canonical **agent launcher**, `agent_launch`, which selects `claude-code`, `codex-cli`, `grok-cli`, or `cursor-cli` as the execution harness; `agent_steer` for an active Codex or Grok turn; four deprecated launcher aliases kept for migration; `agent_configure`; `agent_approval`; `claude_turn`; `claude_approval`; and `diagnostics`. The backend is **tmux on POSIX and psmux on native Windows**, so sessions survive even if the MCP server or the AI client restarts.
118
118
 
119
119
  **v0.28.0 separates the execution harness from the model.** The harness owns the agent loop, authentication, hooks, session, and transcript; `model` is what that harness runs. Cursor Agent CLI can therefore select GPT, Claude, or Grok without changing the completion contract from Cursor hooks to another harness's. Grok Composer is a Grok CLI model preset, not another harness: use `harness: "grok-cli", model: "grok-composer-2.5-fast"`. The old four launcher tools are thin compatibility aliases over the same implementation.
120
120
 
@@ -187,7 +187,7 @@ collection is off by default and performs no network I/O. It ships via
187
187
  tag-triggered CI with npm provenance (OIDC Trusted Publishing); the GitHub
188
188
  Release re-registers the Official MCP Registry entry.
189
189
 
190
- **Status:** actively maintained · current public release **v0.32.0** · 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).
190
+ **Status:** actively maintained · current public release **v0.33.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).
191
191
 
192
192
  ### Update and rollback
193
193
 
@@ -237,7 +237,7 @@ Grok/Composerの無人起動は公式`--trust`で指定された作業フォ
237
237
 
238
238
  Grok/Composerがread-only sandboxの適用を拒否した場合、prompt送信時に`GROK_SANDBOX_STARTUP_FAILED`とCLIの原因を返す。hookパスのシンボリックリンクなど、CLIが示した原因を設定の管理元で修正し、対象sessionを`pty_close`して起動し直す。Aitermはsandboxを解除したりhookをコピーしたりしない。
239
239
 
240
- この判定はGrok専用アダプターが所有し、同じCLIを使うComposerにも適用する。初回prompt付きの`agent_launch`と通常の`pty_send`で、入力受付待ち中に拒否を検出すると未送信のエラーを返す。promptなしの`agent_launch`は起動要求を返すため、その応答だけでは入力受付済みと判断しない。実装の責務分担は[DESIGN](docs/DESIGN.md#failure-and-recovery)を参照。
240
+ この判定はGrok専用アダプターが所有し、同じCLIを使うComposerにも適用する。初回prompt付きの`agent_launch`と通常の`pty_send`で、入力受付待ち中に拒否を検出すると未送信のエラーを返す。promptなし・`trust_project`指定なしの起動応答は入力受付を保証しない。`trust_project:true`では入力受付まで確認し、`startup.status`を返す。Grokのprivacy notice起動設定も同アダプターが所有する。実装の責務分担は[DESIGN](docs/DESIGN.md#failure-and-recovery)を参照。
241
241
 
242
242
  For a correlated Claude turn stopped at `Do you want to proceed?`, use `claude_approval(action: "inspect", ...)` to capture the active operation and SHA-256 screen digest, review the displayed command, then call `respond` with that exact digest and either `approve_once` or `deny`. The relay rechecks the operation and screen under the send lock, never exposes arbitrary input or permanent approval, keeps the active marker intact, and records a prompt-free owner-only receipt. `pty_send(force: true)` does not bypass this boundary.
243
243
 
@@ -344,7 +344,7 @@ The only edits to the captures above are the two `⋮` lines (a long head/tail r
344
344
  `aiterm-setup --json`が`ready`になったら、利用するMCP clientを再起動して接続を確認する。Claude Codeの場合:
345
345
 
346
346
  ```bash
347
- /mcp # aiterm should show as connected, exposing 16 tools
347
+ /mcp # aiterm should show as connected, exposing 18 tools
348
348
  ```
349
349
 
350
350
  Your first session — four calls, one persistent terminal:
@@ -385,7 +385,7 @@ The terminal is real and shared, so a human *can* jump in ([A human can watch](#
385
385
 
386
386
  ```mermaid
387
387
  flowchart LR
388
- AI["AI / MCP client<br/>(the orchestrator)"] -->|"pty_send · agent_launch · agent_steer · agent_configure · claude_turn · claude_approval<br/>legacy launcher aliases · diagnostics"| S["aiterm-mcp<br/>stdio MCP · 16 tools"]
388
+ AI["AI / MCP client<br/>(the orchestrator)"] -->|"pty_send · pty_observe · agent_launch · agent_steer · agent_configure · agent_approval · claude_turn · claude_approval<br/>legacy launcher aliases · diagnostics"| S["aiterm-mcp<br/>stdio MCP · 18 tools"]
389
389
  S -->|"pty_read<br/>token-reduced"| AI
390
390
  S -->|"tmux / psmux<br/>send · capture"| P["persistent PTYs<br/>survive restarts"]
391
391
  P -->|"ssh · docker · repl"| R["nested<br/>remote · container · REPL"]
@@ -459,15 +459,50 @@ On top of that sits a productized layer a raw tmux bridge doesn't have: **token-
459
459
 
460
460
  ## Tools
461
461
 
462
+ ### Session observation and startup
463
+
464
+ `pty_open` defaults to bash on POSIX and PowerShell 7 on Windows. Ordinary terminals and agents receive
465
+ `AITERM_SESSION_ID`. Pass environment-variable names in `env_vars` to inherit ownership information from the MCP process.
466
+ `pty_list({ env_keys: ["JOB_OWNER"] })` returns only the requested non-secret values in `environment`; missing values are null.
467
+ Its `aiterm.pty-list-result.v1` receipt contains `observed_at` and `sessions`, whose entries include `session_id`,
468
+ `current_command`, `attached`, `width`, `height`, `harness`, and `environment`. Existing text remains available.
469
+
470
+ `pty_observe({ session_id, cursor? })` returns `aiterm.pty-observe-result.v1` with `exists`, `observed_at`, `state`
471
+ (busy/idle/blocked/dead/missing/unknown), `reason`, `pane_alive`, and `harness_alive`. `pane_process` and `harness_process`
472
+ are separate identities. `process_identity` selects the harness for agents, or the unique child process-group leader
473
+ for an ordinary terminal, using the pane when no child leader exists. An identity contains `pid`, `process_group_id`,
474
+ `started_identity`, and `argv_digest`; unresolved identities are null. Windows PIDs are native and its process-group field
475
+ is null. Start identity uses POSIX `LC_ALL=C ps lstart` or Windows UTC ISO milliseconds; the argv digest is SHA-256 hex.
476
+
477
+ Pass `activity.cursor` into the next observation to obtain `output_changed` and `cpu_delta_seconds`; first observations and
478
+ recreated panes return null differences. `cpu_seconds` is the current subtree's cumulative CPU. If a process disappeared
479
+ between observations, the delta covers only observed increments and `cpu_delta_complete` is false.
480
+ `background_cpu_seconds`, `background_cpu_delta_seconds`, and `background_cpu_delta_complete` apply the same measurement
481
+ only to descendants created at least 60 seconds after the pane, excluding startup MCP processes. `token_hint` is the latest
482
+ displayed token count or null. Callers do not need raw argv or pane-text parsing.
483
+
484
+ `agent_launch({ harness, cwd, trust_project: true })` completes known workspace, project-hook, and project-MCP startup
485
+ consent even without a prompt, then verifies input readiness and harness liveness before returning `startup.status="ready"`.
486
+ A prompt-free launch without this option retains `startup.status="not_checked"`. `initial_prompt.status` distinguishes
487
+ `not_requested`, `not_sent`, `submitted_unconfirmed`, and `started`. Failure responses retain structured session information.
488
+ Do not resend an unconfirmed prompt; observe or wait using its returned cursor.
489
+
490
+ For a live Codex approval, inspect with `agent_approval({ action: "inspect", session_id })`, review `prompt` and `choices`,
491
+ then respond with `observed_prompt_digest` and `approval_choice` (`approve_once` or `deny`). Unknown or changed dialogs return
492
+ `status="blocked"` and `isError:true` without sending input. Permanent approval is not exposed. Correlated Claude approvals
493
+ continue to use `claude_approval`.
494
+
462
495
  | Tool | Role | Key args |
463
496
  | --- | --- | --- |
464
- | `pty_open` | Grab one terminal, return a `session_id` | `name?`, `shell="bash"` |
497
+ | `pty_open` | Open one terminal and return a `session_id` | `name?`, `shell?`, `env_vars?` |
465
498
  | `pty_send` | Send text; on an agent session this is a non-blocking **dispatch** returning an `event_cursor` | `session_id`, `text`, `enter=true`, `mark`, `force`, `rtk`, `raw` |
466
499
  | `pty_read` | Read output, token-reduced (incremental by default) | `session_id`, `wait`, `until`, `until_regex`, `timeout`, `screen`, `full`, `lines`, `line_range`, `raw`, `rtk`, `agent_transcript`, `operation_id` |
467
500
  | `pty_key` | Send a control key | `session_id`, `key` (`C-c`/`Enter`/`Up`…) |
468
501
  | `pty_close` | Close idempotently; return `closed` / `already_closed` | `session_id` |
469
- | `pty_list` | List sessions (agent rows carry canonical `harness=<id>` plus compatibility `agent=<kind>`) | (none) |
470
- | `agent_launch` | Canonical agent launch; harness and model are independent | `harness`, `prompt?`, `model?`, `reasoning_effort?`, `cwd?`, `write_scope?`, `throughline_source_session?`, `throughline_supplement_file?` |
502
+ | `pty_list` | Text and structured session list, with explicitly requested non-secret environment values | `env_keys?` |
503
+ | `pty_observe` | Pane/harness liveness, native process identity, state, and activity | `session_id`, `cursor?` |
504
+ | `agent_launch` | Canonical agent launch; harness and model are independent | `harness`, `prompt?`, `model?`, `reasoning_effort?`, `cwd?`, `write_scope?`, `trust_project?`, `env_vars?`, `throughline_source_session?`, `throughline_supplement_file?` |
505
+ | `agent_approval` | Inspect a Codex approval and submit a one-time approval or denial | `action`, `session_id`, `approval_choice?`, `observed_prompt_digest?` |
471
506
  | `agent_steer` | Inject text into the active Codex or Grok turn; return `idle` without sending when no turn is active | `session_id`, `text` |
472
507
  | `claude_agent` / `codex_agent` / `grok_agent` / `composer_agent` | Deprecated compatibility aliases | legacy launcher arguments |
473
508
  | `agent_configure` | Change model/effort in a running Claude, Codex, Grok, Composer, or Cursor session without restarting it | `session_id`, `model?`, `reasoning_effort?` |
@@ -509,6 +544,8 @@ When an agent's answer is longer than the on-screen tail (pane height ≈ 24 lin
509
544
 
510
545
  ### Completion detection (5 layers)
511
546
 
547
+ For PowerShell over SSH, `mark:true` recognizes the current standard `PS ...>` prompt and emits PowerShell syntax even when Aiterm runs on macOS or Linux. A prompt left in earlier output is not used to select the syntax.
548
+
512
549
  `pty_read({ wait: true })` decides "is the command done?" via five layers: process exit / a `mark:true` sentinel / an `until` match / output quiescence with shell return / timeout. `mark` emits the shell's exit status on POSIX shells and `0` (success) or `1` (failure) on PowerShell; fish/csh/tcsh are rejected before send because they do not share either status syntax. When `mark` or `until` is active, that requested evidence takes precedence and a momentarily quiet shell cannot complete the read as quiescent. Agent sessions add a sixth exact layer: Codex observes normal rollout `task_complete`; Grok/Composer observe normal session `turn_ended`; Claude observes its additive launch-correlated Stop event; Cursor observes `turn_ended(status:"success")` in the launch-bound normal agent transcript. `aiterm-wait --cursor` performs that harness-specific observation without the parent blocking or polling. Pre-send readiness failures are MCP errors, and late completion remains recoverable without resending.
513
550
 
514
551
  ### Completion push for parent agents (`aiterm-wait`)