aiterm-mcp 0.21.4 → 0.22.0
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/README.ja.md +18 -13
- package/README.md +32 -28
- package/dist/core.js +402 -326
- package/dist/index.js +18 -10
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -94,21 +94,24 @@ host統合は、kitepon.devの製品開発を支える内部基盤
|
|
|
94
94
|
|
|
95
95
|
**言葉でなく実測で:** 記録済み203テストのベンチマークでは、`pty_read` はコンテキストに載るトークンを生ログの **約 7.1 分の 1** に減らす。しかも pass/fail の判定は畳んでも残る。→ [組み込みシェルツールとの使い分け](#組み込みシェルツールとの使い分け)
|
|
96
96
|
|
|
97
|
-
13 ツール: 6 つの **PTY ツール**(`pty_open` / `pty_send` / `pty_read` / `pty_key` / `pty_close` / `pty_list`)で 1 本の永続端末を開き・操作し・読む。加えて 4 つの **エージェント起動ツール**(`claude_agent` / `codex_agent` / `grok_agent` / `composer_agent`)が別のコーディングエージェントの TUI を新しい端末の中に起動し、`claude_turn`がdurable caller向けの構造化issue/recoveryを、`claude_approval
|
|
97
|
+
13 ツール: 6 つの **PTY ツール**(`pty_open` / `pty_send` / `pty_read` / `pty_key` / `pty_close` / `pty_list`)で 1 本の永続端末を開き・操作し・読む。加えて 4 つの **エージェント起動ツール**(`claude_agent` / `codex_agent` / `grok_agent` / `composer_agent`)が別のコーディングエージェントの TUI を新しい端末の中に起動し、`claude_turn`がdurable caller向けの構造化issue/recoveryを、`claude_approval`が相関済みClaude承認UI中継を、`diagnostics`が安全なfactory readinessを返す。バックエンドは **tmux** なので、MCP サーバや AI クライアントが再起動してもセッションは生き残る。
|
|
98
98
|
|
|
99
|
-
**v0.
|
|
100
|
-
project
|
|
101
|
-
|
|
99
|
+
**v0.22.0では4 launcherを完全なプロジェクト共同作業員へ戻した。** 直接CLIを起動した時と同じ
|
|
100
|
+
`HOME`、作業tree、vendor home、project/user/local設定、MCP、plugin、skill、permission、trust、memory、
|
|
101
|
+
session historyをそのまま使う。aitermがlaunchごとに分離するのは完了相関stateだけ。子には
|
|
102
|
+
`role=subagent`、親session、delegation depth、lineage、`delegation_allowed=true`を注入する。
|
|
103
|
+
孫以降への再委譲は禁止せず、孫はdepth 2と伸びたlineageを受け取る。既存receiptの
|
|
104
|
+
`managed_completion`は後方互換fieldとして残るが、意味は「完了相関あり」であり環境隔離ではない。
|
|
102
105
|
|
|
103
106
|
**v0.21.3ではCodexの完了経路からStop hookを撤去。** Codexの完了通知と最終回答の帰属は、
|
|
104
107
|
root rollout transcriptへ永続化される`task_complete.turn_id`をdispatch byte境界以後から観測する。
|
|
105
108
|
hookの実行ファイルが壊れたり消えたりしても`aiterm-wait`は座礁しない。v0.21.0では外部agent launcherへ
|
|
106
109
|
明示的な`write_scope`能力宣言を追加し、v0.21.3で指定したscopeと実効性がstructured launch receiptへ
|
|
107
|
-
確実に残るよう修正した。v0.20.3
|
|
110
|
+
確実に残るよう修正した。v0.20.3では、壊れた認証から複数の相関付きClaude/Fable
|
|
108
111
|
sessionが同時にloginへ流れる問題を修理し、新規Claude起動はPTY作成前にvendor所有の共有認証を検証する。
|
|
109
112
|
v0.20では、待たずに一度だけ観測する
|
|
110
113
|
`aiterm-wait --timeout 0` の未完了を、実際に待って終わらなかった`timeout`と区別し、
|
|
111
|
-
`running`(exit 5)で返すようにしました。v0.19系では相関済み
|
|
114
|
+
`running`(exit 5)で返すようにしました。v0.19系では相関済みClaude approval中継を追加し、
|
|
112
115
|
複数行shell配送を維持し、native Windowsのfactory diagnosticsを拡張しました。
|
|
113
116
|
v0.16/0.17以来、親エージェントはaiterm上で一切ブロックしません:
|
|
114
117
|
agent session への send は常に非ブロック dispatch になり、完了待ちは `aiterm-wait` 一本
|
|
@@ -142,7 +145,9 @@ pty_read(id, { wait: true }) → 削減済みの出力を読む(完了
|
|
|
142
145
|
|
|
143
146
|
### 2. その端末の中に他のコーディングエージェントを起動する — オーケストレーションの旗艦
|
|
144
147
|
|
|
145
|
-
同じ primitive が別エージェントの TUI を宿す。4 つの起動ツールが、Claude/Codex/Grok/Composer の対話 TUI を新しい永続端末の中に起動し、`session_id`
|
|
148
|
+
同じ primitive が別エージェントの TUI を宿す。4 つの起動ツールが、Claude/Codex/Grok/Composer の対話 TUI を新しい永続端末の中に起動し、`session_id` を返す。起動processは直接CLIと同じproject/user環境を使い、通常config、MCP、plugin、skill、permission、trust、memory、historyをcopy・filter・置換しない。aitermが加えるのは完了相関と、`role=subagent`、親session、delegation depth、lineage、`delegation_allowed=true`を持つ非user instructionだけ。孫以降の委譲も許可され、固定depth capはない。
|
|
149
|
+
|
|
150
|
+
既存の人間向けtextに加えて`aiterm.agent-launch-result.v1` structured receiptも返すため、durable callerは表示文字列を解析せずsession handleを取得できる。Codexは通常rollout transcriptの`task_complete`、Grok/Composerは通常session event、Claudeは通常settingsへ加算したlaunch固有Stop hookを完了正本に使う。agent sessionへの`pty_send`は非ブロックの **dispatch** になり`event_cursor`入りreceiptを即返す。完了通知は`aiterm-wait --session <id> --cursor <event_cursor>`を親のターンを塞がない別processで受ける。durable machine callerは`claude_turn`を使い、recoveryは再送せず、検証済み完了だけがexact `raw_output`を持つ。
|
|
146
151
|
|
|
147
152
|
`codex_agent`・`grok_agent`・`composer_agent`は任意の`write_scope`(`"read-only"`または書込み許可パスの説明)も受ける。指定値はlaunch receipt・session metadata・`pty_list`へ保存する。Codexの`write_scope:"read-only"`だけは実効能力壁であり、aitermがCLIの`--sandbox read-only`を付ける。Grok/Composerには対応する対話起動sandboxがなく、Codexにもパス説明をallowlistへ変換するフラグがないため、それらは強制済みと偽らず`write_scope_enforcement:"declaration_only_unsupported"`を返す。`write_scope`を省略した起動は従来どおりである。
|
|
148
153
|
|
|
@@ -167,7 +172,7 @@ $ aiterm-wait --session codex1 --cursor <event_cursor> # exit 0=done / 3=timeo
|
|
|
167
172
|
| `grok_agent` | Grok Build(xAI、既定`grok-4.5`、`model?`で上書き) | `prompt?`, `model?`, `reasoning_effort?`は非対応(指定時は明示エラー), `cwd?`, `session_name?`, `write_scope?` |
|
|
168
173
|
| `composer_agent` | Grok Build(xAI、既定`grok-composer-2.5-fast`、`model?`で上書き) | `prompt?`, `model?`, `reasoning_effort?`は非対応(指定時は明示エラー), `cwd?`, `session_name?`, `write_scope?` |
|
|
169
174
|
|
|
170
|
-
各ベンダーの
|
|
175
|
+
各ベンダーのCLIが導入・認証済みであること。CLI不在・不正なmodel/effort・実在しない`cwd`はsession作成前に失敗し、残骸を残さない。ClaudeはさらにPTY作成前に同じCLIの`auth status --json`が`loggedIn:true`を返すことを要求する。4 launcherは通常のvendor credential/config storeをその場で使い、fake `HOME`、private `CODEX_HOME`/`GROK_HOME`、project/user config snapshotを作らない。Claudeだけは完了相関用Stop hook settingsを通常の`user,project,local` settingsへ加算する。Grok/Composerは画面入力欄だけでなく通常sessionの`mcp_init_completed` eventも確認してから送信し、共有MCP初期化中の早送信を防ぐ。相関付きClaudeのactive turn中はC-c以外の`pty_key`と素送信を拒否し、承認UIは`claude_approval`で単発Yes/Noだけを相関付きで中継する。
|
|
171
176
|
|
|
172
177
|
エージェント間の隠れたプロトコルは無い。起動したClaude/Codex/Grok/Composerは利用者がattachできるもう1本の永続sessionであり、MCPクライアントが通常のPTY操作で駆動する。
|
|
173
178
|
|
|
@@ -346,8 +351,8 @@ aiterm は同じ核心の洞察——端末を出会いの場にする——を
|
|
|
346
351
|
| `pty_key` | 制御キーを送る | `session_id`, `key`(`C-c`/`Enter`/`Up`…) |
|
|
347
352
|
| `pty_close` | 冪等に閉じ、`closed` / `already_closed`を返す | `session_id` |
|
|
348
353
|
| `pty_list` | セッション一覧 | (なし) |
|
|
349
|
-
| `claude_turn` | 相関済み
|
|
350
|
-
| `claude_approval` | 現在表示中の相関済み
|
|
354
|
+
| `claude_turn` | 相関済みClaude operationをdispatch(issue)または回収(recover) | `action`, `session_id`, `operation_id`, `text?` |
|
|
355
|
+
| `claude_approval` | 現在表示中の相関済みClaude承認UIを検査または応答 | `action`, `session_id`, `operation_id?`, `approval_choice?`, `observed_prompt_digest?` |
|
|
351
356
|
| `diagnostics` | 機械可読 JSON による read-only factory readiness | (なし) |
|
|
352
357
|
|
|
353
358
|
`diagnostics` は PTY やエージェントを起動しない。パッケージ版、MCP 呼出 readiness、read-only な PTY 一覧要約、bounded runtime-error-store status、任意 vendor launcher の可用性だけを返す。path・環境値・認証情報・コマンド本文・PTY 出力・raw log は意図的に返さない。通常未設定の任意依存は `not_applicable`、安全に確定できない状態は `unverified` と表す。
|
|
@@ -369,13 +374,13 @@ consumer は `aiterm-runtime-errors snapshot` を読み、durable ingestion 後
|
|
|
369
374
|
| `grok_agent` | Grok Build(xAI、既定`grok-4.5`、`model?`で上書き) | `prompt?`, `model?`, `reasoning_effort?`は非対応(指定時は明示エラー), `cwd?`, `session_name?`, `write_scope?` |
|
|
370
375
|
| `composer_agent` | Grok Build(xAI、既定`grok-composer-2.5-fast`、`model?`で上書き) | `prompt?`, `model?`, `reasoning_effort?`は非対応(指定時は明示エラー), `cwd?`, `session_name?`, `write_scope?` |
|
|
371
376
|
|
|
372
|
-
対応するCLI(`claude` / `codex` / `grok
|
|
377
|
+
対応するCLI(`claude` / `codex` / `grok`)の導入・認証が必要。前提違反はsession作成前に明示失敗する。4 launcherすべてが通常project/user環境と同じ非ブロックdispatch契約を使う。Claude/Codex/Grok/Composerのdepth 1 live smokeと、Claude親→Claude孫のdepth 2 nested delegation smokeはgreenであり、fixtureによる検証とは区別して記録する。
|
|
373
378
|
|
|
374
|
-
エージェントの回答が画面 tailより長ければ、対話callerは`pty_read({ agent_transcript:true })`で再promptなしに全文回収する。Claudeは
|
|
379
|
+
エージェントの回答が画面 tailより長ければ、対話callerは`pty_read({ agent_transcript:true })`で再promptなしに全文回収する。Claudeはlaunch相関付きStop hookのowner-only resultを検証し、private transcriptを読まない。Codexは通常rollout transcript、Grok/Composerは通常session historyから同じturnを回収する。不在・非agent・抽出不能は明示エラー。
|
|
375
380
|
|
|
376
381
|
### 完了検出(5 層)
|
|
377
382
|
|
|
378
|
-
`pty_read({ wait: true })
|
|
383
|
+
`pty_read({ wait: true })`は通常PTYを5層で判定し、agent sessionは第6の正確な層を使う。Codexは通常rolloutの`task_complete`、Grok/Composerは通常sessionの`turn_ended`、Claudeは通常settingsへ加算したlaunch相関Stop eventを`aiterm-wait --cursor`が観測する。親はブロックもポーリングもしない。Grok/Composerは`mcp_init_completed`確認前に入力欄が見えても送信しない。
|
|
379
384
|
|
|
380
385
|
### トークン削減
|
|
381
386
|
|
package/README.md
CHANGED
|
@@ -94,13 +94,16 @@ toolchain behind kitepon.dev's products.
|
|
|
94
94
|
|
|
95
95
|
**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)
|
|
96
96
|
|
|
97
|
-
Thirteen tools: six **PTY tools** — `pty_open` / `pty_send` / `pty_read` / `pty_key` / `pty_close` / `pty_list` — to open, drive, and read one persistent terminal, four **agent launchers** — `claude_agent` / `codex_agent` / `grok_agent` / `composer_agent` — that each start another coding agent's TUI inside a fresh one, `claude_turn` for durable structured issue/recovery, `claude_approval` for correlated
|
|
97
|
+
Thirteen tools: six **PTY tools** — `pty_open` / `pty_send` / `pty_read` / `pty_key` / `pty_close` / `pty_list` — to open, drive, and read one persistent terminal, four **agent launchers** — `claude_agent` / `codex_agent` / `grok_agent` / `composer_agent` — that each start another coding agent's TUI inside a fresh one, `claude_turn` for durable structured issue/recovery, `claude_approval` for correlated Claude approval prompts, and `diagnostics` for safe factory readiness. The backend is **tmux**, so sessions survive even if the MCP server or the AI client restarts.
|
|
98
98
|
|
|
99
|
-
**v0.
|
|
100
|
-
normal
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
**v0.22.0 makes launched agents full project collaborators.** All four launchers now use the
|
|
100
|
+
same normal `HOME`, working tree, vendor home, project/user/local configuration, MCP servers,
|
|
101
|
+
plugins, skills, permissions, trust, memory, and session history as a direct CLI launch. Aiterm
|
|
102
|
+
isolates only its own per-launch completion correlation state. Every child is told that it is a
|
|
103
|
+
sub-agent and receives its parent session, delegation depth, lineage, and
|
|
104
|
+
`delegation_allowed=true`; a child may delegate further, while the lineage makes reflexive
|
|
105
|
+
self-copy loops visible and avoidable. The historical `managed_completion` receipt field remains
|
|
106
|
+
for API compatibility and means “completion correlation enabled,” not environment isolation.
|
|
104
107
|
|
|
105
108
|
**v0.21.3 removes Codex Stop hooks from the completion path.** Codex completion and
|
|
106
109
|
final-message attribution now come from the root rollout transcript's durable
|
|
@@ -109,12 +112,12 @@ hook executable can no longer strand `aiterm-wait`. v0.21.0 added explicit
|
|
|
109
112
|
`write_scope` declarations for external-agent launchers; v0.21.3 also fixes their
|
|
110
113
|
structured launch receipts so a supplied scope and its enforcement status are retained.
|
|
111
114
|
v0.20.3 prevents concurrent
|
|
112
|
-
|
|
115
|
+
correlated Claude/Fable sessions from turning one broken login into many competing login
|
|
113
116
|
flows. Every new Claude launch verifies the
|
|
114
117
|
vendor-owned shared credential store before creating a PTY, while healthy credentials
|
|
115
118
|
remain reusable across concurrent and repeated sessions. The v0.20 line also distinguishes
|
|
116
119
|
a non-blocking `aiterm-wait --timeout 0` observation (`running`, exit 5) from a real timed-out
|
|
117
|
-
wait. The v0.19 line added the correlated
|
|
120
|
+
wait. The v0.19 line added the correlated Claude approval relay,
|
|
118
121
|
preserved multiline shell delivery, and extended factory diagnostics on native
|
|
119
122
|
Windows. As of v0.16/0.17 a parent agent never blocks on aiterm:
|
|
120
123
|
every send to an agent session is a non-blocking dispatch, completion is one
|
|
@@ -128,7 +131,7 @@ collection is off by default and performs no network I/O. It ships via
|
|
|
128
131
|
tag-triggered CI with npm provenance (OIDC Trusted Publishing); the GitHub
|
|
129
132
|
Release re-registers the Official MCP Registry entry.
|
|
130
133
|
|
|
131
|
-
**Status:** actively maintained · the newcomer here, betting on a different shape (see [vs. the alternatives](#vs-the-alternatives)) · runs on Linux · WSL2 · macOS · native Windows for the core PTY tools (
|
|
134
|
+
**Status:** actively maintained · the newcomer here, betting on a different shape (see [vs. the alternatives](#vs-the-alternatives)) · runs on Linux · WSL2 · macOS · native Windows for the core PTY tools (correlated agent completion is POSIX/WSL/macOS only for now) · MIT · see the [CHANGELOG](CHANGELOG.md).
|
|
132
135
|
|
|
133
136
|
## Why now
|
|
134
137
|
|
|
@@ -157,11 +160,13 @@ pty_read(id, { wait: true }) → read the token-reduced output, completion
|
|
|
157
160
|
|
|
158
161
|
### 2. Launch other coding agents into that terminal — the orchestration flagship
|
|
159
162
|
|
|
160
|
-
The same primitive hosts another agent's TUI. Four launchers each start one vendor's interactive coding-agent TUI inside a fresh persistent terminal and return a `session_id`.
|
|
163
|
+
The same primitive hosts another agent's TUI. Four launchers each start one vendor's interactive coding-agent TUI inside a fresh persistent terminal and return a `session_id`. The launched process sees the same project and user environment as a direct CLI invocation: normal configuration, MCPs, plugins, skills, permissions, trust decisions, memory, and history are not copied, filtered, or replaced. Aiterm adds only completion correlation and a non-user sub-agent context containing `role=subagent`, the parent session, delegation depth, lineage, and `delegation_allowed=true`. Nested delegation is supported: a grandchild receives depth 2 and the extended lineage rather than being forbidden from launching another agent.
|
|
164
|
+
|
|
165
|
+
The human-readable launch text is accompanied by an `aiterm.agent-launch-result.v1` structured receipt, so durable callers never parse display text for the session handle; when the launch carries an initial `prompt`, the receipt also includes the `event_cursor`, a ready-made `wait_command` for the completion waiter, and a `submit_residue` observation (`true` = the prompt is likely still sitting unsubmitted in the composer — the hint explains recovery; `false` = no residue observed, not a proof of submission; `null` = not applicable). From there you drive it with the same `pty_read` / `pty_send` you'd use on any shell. Codex completion comes from its normal durable rollout transcript's `task_complete`; Grok/Composer use their normal session events; Claude receives a launch-specific Stop hook settings addition while still loading normal user/project/local settings. Sending to an agent session is a non-blocking **dispatch** — the call returns immediately with an `event_cursor`, and completion arrives via [`aiterm-wait`](#completion-push-for-parent-agents-aiterm-wait). Durable machine callers use `claude_turn({ action: "issue" | "recover", session_id, operation_id, ... })`: it returns fixed `accepted` / `pending` / `completed` / `unknown` states without parsing human-facing errors, never resends during recovery, and includes exact `raw_output` only for a verified completion. An initial `prompt` on `claude_agent`/`codex_agent` is submitted through the same ready gate and the launcher returns without waiting; on Grok/Composer it is passed on the CLI's argv. This needs the vendor's own CLI installed and authenticated — see [Requirements](#requirements).
|
|
161
166
|
|
|
162
167
|
`codex_agent`, `grok_agent`, and `composer_agent` also accept an optional `write_scope`: either `"read-only"` or a human-readable description of writable paths. A supplied value is retained in the launch receipt, session metadata, and `pty_list`. For Codex, `write_scope: "read-only"` is an effective boundary: aiterm adds the CLI's `--sandbox read-only` flag. Grok/Composer have no corresponding interactive-launch sandbox, and Codex has no path-description allowlist flag; those cases return `write_scope_enforcement: "declaration_only_unsupported"` rather than claiming enforcement. Omitting `write_scope` preserves prior behavior.
|
|
163
168
|
|
|
164
|
-
For a
|
|
169
|
+
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.
|
|
165
170
|
|
|
166
171
|
```text
|
|
167
172
|
codex_agent({ session_name: "codex1", cwd: "/repo",
|
|
@@ -185,9 +190,9 @@ One call per model, so the tool name itself tells you which model you get:
|
|
|
185
190
|
| `grok_agent` | Grok Build, model `grok-4.5` by default (`model?` overrides) (xAI) | `prompt?`, `model?`, `reasoning_effort?` unsupported (an explicit value is an error; Grok CLI `--effort` is headless-only), `cwd?`, `session_name?`, `write_scope?` |
|
|
186
191
|
| `composer_agent` | Grok Build, model `grok-composer-2.5-fast` by default (`model?` overrides) (xAI) | `prompt?`, `model?`, `reasoning_effort?` unsupported (an explicit value is an error), `cwd?`, `session_name?`, `write_scope?` |
|
|
187
192
|
|
|
188
|
-
The vendor CLI must be installed and authenticated (`claude` for `claude_agent`; `codex` for `codex_agent`; `grok` for both Grok tools). aiterm resolves the binary via `CLAUDE_BIN` / `CODEX_BIN` / `GROK_BIN`, then
|
|
193
|
+
The vendor CLI must be installed and authenticated (`claude` for `claude_agent`; `codex` for `codex_agent`; `grok` for both Grok tools). aiterm resolves the binary via `CLAUDE_BIN` / `CODEX_BIN` / `GROK_BIN`, then each documented default location, then `PATH`. Prerequisites are checked **before** a session exists: empty `model` values and unsupported effort values are rejected up front; a missing CLI binary or a nonexistent `cwd` fails for all four. Before creating a Claude session, aiterm also requires a successful structured `claude auth status --json` result with `loggedIn: true`; unavailable, malformed, or failed authentication leaves **zero leftover session**. All launchers use the normal vendor-owned credential and configuration stores in place. No launcher creates a fake `HOME`, a private `CODEX_HOME`/`GROK_HOME`, or a snapshot of project/user configuration.
|
|
189
194
|
|
|
190
|
-
|
|
195
|
+
Claude and Codex launchers forward `model` and `reasoning_effort` through public CLI flags; Grok/Composer reject `reasoning_effort` because it is headless-only. Pass an absolute path for `cwd` — `~` is not expanded. Durable callers can make a promptless Claude launch exactly replayable by passing an explicit `session_name` and `launch_operation_id`. Claude adds a launch-local settings file only for the correlated Stop hook and loads it together with normal `user,project,local` setting sources; it does not replace normal hooks, MCPs, plugins, permissions, or trust state. The hook event contains no answer body, and the bounded owner-only result is returned by `pty_read({ agent_transcript:true })` without reading Claude's private transcript. While a correlated Claude turn is active, raw sends and non-interrupt keys are rejected. Exact `/login` and `/logout` dispatches are rejected so shared authentication is repaired once in a normal terminal. Codex reads its normal rollout store; Grok/Composer read their normal session event/history files. Before dispatch, Codex waits for an idle TUI, while Grok/Composer additionally require the vendor's structured `mcp_init_completed` event so a visible input box cannot accept a prompt too early. Correlated completion requires POSIX filesystem semantics (Linux, WSL2, macOS).
|
|
191
196
|
|
|
192
197
|
There is no hidden protocol between agents: a launched Claude, Codex, Grok, or Composer is another user-visible persistent terminal session. The MCP client drives that TUI with ordinary PTY operations, and a human can attach to watch or take over.
|
|
193
198
|
|
|
@@ -368,8 +373,8 @@ On top of that sits a productized layer a raw tmux bridge doesn't have: **token-
|
|
|
368
373
|
| `pty_key` | Send a control key | `session_id`, `key` (`C-c`/`Enter`/`Up`…) |
|
|
369
374
|
| `pty_close` | Close idempotently; return `closed` / `already_closed` | `session_id` |
|
|
370
375
|
| `pty_list` | List sessions (agent rows carry `agent=<kind>` metadata) | (none) |
|
|
371
|
-
| `claude_turn` | Issue (dispatch-only) or recover one correlated
|
|
372
|
-
| `claude_approval` | Inspect or answer the current correlated
|
|
376
|
+
| `claude_turn` | Issue (dispatch-only) or recover one correlated Claude operation | `action`, `session_id`, `operation_id`, `text?` |
|
|
377
|
+
| `claude_approval` | Inspect or answer the current correlated Claude approval prompt | `action`, `session_id`, `operation_id?`, `approval_choice?`, `observed_prompt_digest?` |
|
|
373
378
|
| `diagnostics` | Read-only factory readiness as machine-readable JSON | (none) |
|
|
374
379
|
|
|
375
380
|
`diagnostics` never starts a PTY or agent. It reports package version, MCP call readiness, a read-only PTY-list summary, bounded runtime-error-store status, and optional vendor-launcher availability. It deliberately excludes paths, environment values, credentials, command text, PTY output, and raw logs; normal unset optional dependencies are `not_applicable`, while an indeterminate probe is `unverified`.
|
|
@@ -391,20 +396,20 @@ Each launcher starts a specific vendor's interactive coding-agent TUI inside a f
|
|
|
391
396
|
| `grok_agent` | Grok Build, model `grok-4.5` by default (`model?` overrides) (xAI) | `prompt?`, `model?`, `reasoning_effort?` unsupported (an explicit value is an error; Grok CLI `--effort` is headless-only), `cwd?`, `session_name?`, `write_scope?` |
|
|
392
397
|
| `composer_agent` | Grok Build, model `grok-composer-2.5-fast` by default (`model?` overrides) (xAI) | `prompt?`, `model?`, `reasoning_effort?` unsupported (an explicit value is an error), `cwd?`, `session_name?`, `write_scope?` |
|
|
393
398
|
|
|
394
|
-
The vendor CLI must be installed and authenticated (`claude` for `claude_agent`; `codex` for `codex_agent`; `grok` for both Grok tools). Binary resolution uses `CLAUDE_BIN` / `CODEX_BIN` / `GROK_BIN`, then each documented default location, then `PATH`. Missing binaries, invalid model/effort values, and nonexistent `cwd` fail before a session is created. Claude additionally requires a structured healthy authentication status before any PTY exists, and
|
|
399
|
+
The vendor CLI must be installed and authenticated (`claude` for `claude_agent`; `codex` for `codex_agent`; `grok` for both Grok tools). Binary resolution uses `CLAUDE_BIN` / `CODEX_BIN` / `GROK_BIN`, then each documented default location, then `PATH`. Missing binaries, invalid model/effort values, and nonexistent `cwd` fail before a session is created. Claude additionally requires a structured healthy authentication status before any PTY exists, and correlated Claude sessions reject `/login` and `/logout`; repair authentication once in a normal terminal. All four launchers share the normal project/user environment and the same non-blocking dispatch contract. Claude, Codex, Grok, and Composer depth-1 live smokes and a Claude depth-2 nested-delegation smoke are green; fixture coverage remains a separate claim. Native Windows can launch agents but correlated completion is not supported yet.
|
|
395
400
|
|
|
396
|
-
When an agent's answer is longer than the on-screen tail (pane height ≈ 24 lines), callers recover it in full with `pty_read({ agent_transcript: true })`. It returns the most recently completed turn's final assistant message in plain text with no re-prompting. Claude reads the bounded owner-only result captured by the
|
|
401
|
+
When an agent's answer is longer than the on-screen tail (pane height ≈ 24 lines), callers recover it in full with `pty_read({ agent_transcript: true })`. It returns the most recently completed turn's final assistant message in plain text with no re-prompting. Claude reads the bounded owner-only result captured by the launch-correlated Stop hook and verifies its digest/byte count; it never reads Claude's private transcript. Durable machine callers should use `claude_turn`: `issue` sends once, `recover` never sends, `pending` is distinct from unsafe or malformed state, and only `completed` carries the exact verified `raw_output`. Codex uses the normal rollout transcript's `task_complete.turn_id`; Grok/Composer use their normal session history after the last real user row. Missing or ambiguous attribution remains an explicit error.
|
|
397
402
|
|
|
398
403
|
### Completion detection (5 layers)
|
|
399
404
|
|
|
400
|
-
`pty_read({ wait: true })` decides "is the command done?" via five layers: process exit / a `mark:true` sentinel
|
|
405
|
+
`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. 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. `aiterm-wait --cursor` performs that vendor-specific observation without the parent blocking or polling. Pre-send readiness failures are MCP errors, and late completion remains recoverable without resending.
|
|
401
406
|
|
|
402
407
|
### Completion push for parent agents (`aiterm-wait`)
|
|
403
408
|
|
|
404
409
|
As of v0.16 a parent agent **never blocks** on aiterm — there is no wait parameter anywhere (v0.17 makes the waiter's exit codes mirror its outcome). The whole flow is dispatch + one universal waiter:
|
|
405
410
|
|
|
406
|
-
1. Launch the child (`claude_agent` / `codex_agent` / ...; every launch
|
|
407
|
-
2. Run `aiterm-wait --session <id> --cursor <event_cursor> [--operation sha256:<64hex>] [--timeout <sec>]
|
|
411
|
+
1. Launch the child (`claude_agent` / `codex_agent` / ...; every launch shares the normal project/user environment and adds only completion correlation plus lineage). Send a turn with plain `pty_send` (or `claude_turn issue` for durable Claude operations). The call passes the TUI ready gate, submits, and returns immediately with an `event_cursor` in its structured receipt.
|
|
412
|
+
2. Run `aiterm-wait --session <id> --cursor <event_cursor> [--operation sha256:<64hex>] [--timeout <sec>]`. It observes the vendor-native completion source, plus Claude's additive launch hook, as a **pure reader** and exits with a one-line `aiterm.agent-wait-result.v1` receipt. **Exit ≠ done**: the receipt's `outcome` is authoritative (`0` = `done`, `3` = `timeout`, `4` = `closed`, `1` = error).
|
|
408
413
|
3. **The parent never runs the waiter in its own foreground.** Waiting is correct — but the waiter is a separate process, not the parent's turn. A harness that re-invokes its agent when a background task exits (Claude Code) runs the waiter **in the background** and gets woken with zero polling. So that this is not left to interpretation, aiterm reads `clientInfo.name` from the MCP `initialize` handshake and its receipts name the concrete invocation for the detected host — for Claude Code, literally `Bash(command: "aiterm-wait …", run_in_background: true)`. Unknown or undeclared hosts get the generic "start it as a process that does not block the parent's turn" wording; nothing else about the contract changes. Every receipt leads with the same rule: dispatch and let go, then go do something else or end the turn.
|
|
409
414
|
4. Collect the result exactly as before: `pty_read(agent_transcript: true)`, or `claude_turn recover` for durable Claude operations. The waiter carries the signal, never the payload.
|
|
410
415
|
|
|
@@ -472,17 +477,16 @@ If aiterm let your AI hand a task to another agent — or saved you a round-trip
|
|
|
472
477
|
- **npm:** https://www.npmjs.com/package/aiterm-mcp
|
|
473
478
|
- **Issues / bug reports:** https://github.com/kitepon-rgb/aiterm-mcp/issues
|
|
474
479
|
|
|
475
|
-
##
|
|
476
|
-
|
|
477
|
-
> Grok OAuthのauth/lock共有は0.9.1当時の契約で、2026-07-14に廃止した。現行はmanaged隔離を維持し、検証済み通常auth正本を`GROK_AUTH_PATH`でvendorへ渡す。aitermはlock・atomic replace・copy-backを所有しない。
|
|
480
|
+
## Shared agent environment
|
|
478
481
|
|
|
479
|
-
|
|
482
|
+
All four launchers use the caller's normal project and user environment. Aiterm does not copy,
|
|
483
|
+
symlink, filter, or replace vendor configuration, authentication, MCP, plugin, skill, permission,
|
|
484
|
+
trust, memory, or history stores. Cleanup removes only aiterm-owned launch metadata and completion
|
|
485
|
+
correlation files.
|
|
480
486
|
|
|
481
|
-
##
|
|
487
|
+
## License
|
|
482
488
|
|
|
483
|
-
|
|
484
|
-
The child receives `GROK_AUTH_PATH` pointing at the validated normal auth
|
|
485
|
-
canonical file; managed homes never contain auth or lock symlinks/copies.
|
|
489
|
+
MIT
|
|
486
490
|
aiterm does not create locks or copy credentials back. An inherited
|
|
487
491
|
`GROK_AUTH_PATH` must be absolute and safe; only an absent default auth file is
|
|
488
492
|
allowed when `XAI_API_KEY` is set.
|