aiterm-mcp 0.61.23 → 0.62.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/CHANGELOG.md +17 -1
- package/README.ja.md +12 -7
- package/README.md +9 -4
- package/dist/agent-goal.js +1 -1
- package/dist/agent-resolver.js +6 -1
- package/dist/agent-screen-observation.js +9 -0
- package/dist/agent-shared.js +4 -0
- package/dist/antigravity-hook.js +62 -0
- package/dist/core.js +141 -22
- package/dist/execution-parent-source.js +1 -1
- package/dist/harnesses/antigravity.js +257 -0
- package/dist/harnesses/codex.js +7 -1
- package/dist/index.js +28 -22
- package/dist/interim-words.js +3 -3
- package/dist/parent-delivery.js +2 -2
- package/dist/setup-integrations.js +9 -3
- package/dist/setup-platform.js +2 -5
- package/dist/tmux-runtime.js +7 -2
- package/dist/windows-powershell.js +5 -0
- package/docs/DESIGN.md +8 -2
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.62.0] - 2026-10-30
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Add Google Antigravity CLI as the fifth native harness (`antigravity-cli`), with live model catalog, official authentication UI, same-conversation configuration, correlated TUI completion, and standard PTY lifecycle. Preserve existing harness IDs and tools.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- Start the requested POSIX pane shell independently of a service account's non-login default shell, preserving caller environment isolation.
|
|
17
|
+
- Accept an empty MCP configuration file as a new registration while continuing to reject malformed nonempty JSON without overwriting it.
|
|
18
|
+
|
|
19
|
+
## [0.61.24] - 2026-10-28
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- Preserve Codex’s actual reasoning effort when changing only the model; reject unreadable or unsupported current effort and require a matching model/effort notice.
|
|
23
|
+
|
|
10
24
|
## [0.61.23] - 2026-10-28
|
|
11
25
|
|
|
12
26
|
- Recognize native Codex model display names containing spaces in long-lived status footers, keeping input readiness after the launch header scrolls away while preserving busy, modal, and unknown-screen boundaries.
|
|
@@ -2917,7 +2931,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
|
|
|
2917
2931
|
`ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
|
|
2918
2932
|
provenance.
|
|
2919
2933
|
|
|
2920
|
-
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.
|
|
2934
|
+
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.62.0...HEAD
|
|
2935
|
+
[0.62.0]: https://github.com/kitepon/aiterm-mcp/compare/v0.61.24...v0.62.0
|
|
2936
|
+
[0.61.24]: https://github.com/kitepon/aiterm-mcp/compare/v0.61.23...v0.61.24
|
|
2921
2937
|
[0.61.23]: https://github.com/kitepon/aiterm-mcp/compare/v0.61.22...v0.61.23
|
|
2922
2938
|
[0.61.22]: https://github.com/kitepon/aiterm-mcp/compare/v0.61.21...v0.61.22
|
|
2923
2939
|
[0.61.21]: https://github.com/kitepon/aiterm-mcp/compare/v0.61.20...v0.61.21
|
package/README.ja.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
> **任意のMCPクライアントから、Claude Code・Codex CLI・Grok CLI・Cursor Agent CLIを単一のharness APIで永続対話TUIへ起動する。**
|
|
1
|
+
> **任意のMCPクライアントから、Claude Code・Codex CLI・Grok CLI・Cursor Agent CLI・Antigravity CLIを単一のharness APIで永続対話TUIへ起動する。**
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<img src="https://raw.githubusercontent.com/kitepon/aiterm-mcp/main/.github/og.png" alt="Aiterm — 異なる知性が一つの持続する実行現場を共有する森の観測拠点" width="100%">
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
## MCPクライアントへ導入
|
|
30
30
|
|
|
31
|
-
検出したClaude Code・Codex・Grok・Cursorのユーザー設定へ登録する標準入口:
|
|
31
|
+
検出したClaude Code・Codex・Grok・Cursor・Antigravityのユーザー設定へ登録する標準入口:
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
npm install -g aiterm-mcp@latest
|
|
@@ -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.
|
|
212
|
+
**状態:** 開発継続中 · 現行公開版 **v0.62.0** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
|
|
213
213
|
|
|
214
214
|
### 更新と巻き戻し
|
|
215
215
|
|
|
@@ -312,6 +312,9 @@ $ aiterm-wait --session codex1 --cursor <event_cursor> # exit 0=done / 3=timeo
|
|
|
312
312
|
| `codex-cli` | Codex CLI | OpenAI model/effort |
|
|
313
313
|
| `grok-cli` | Grok Build CLI | Grok model、live catalog照合 |
|
|
314
314
|
| `cursor-cli` | Cursor Agent CLI | Cursor catalog上のGPT/Claude/Grok等 |
|
|
315
|
+
| `antigravity-cli` | Google Antigravity CLI (`agy`) | `agy models`の完成ID、TUIと公式hookの完了相関 |
|
|
316
|
+
|
|
317
|
+
Antigravity CLI 1.4.10は通常ユーザーの認証とproject設定を使う。公式の`agy`を導入・認証してから起動する。modelはeffortを含むcatalogの完成IDを渡す。起動中の設定変更は同じ会話を保ち、端末の既定modelは変更前へ戻す。グローバルMCP設定は`~/.gemini/config/mcp_config.json`、Aitermの完了hookは`~/.gemini/config/hooks.json`の名前付き項目へ加算する。実行中の送信には、その席だけの`queuedMessages: "send-immediately"`設定を使う。Antigravityが親の時は返りの`wait_process`と`pty_read(agent_transcript:true)`で回収する。`/boost`は多エージェント実行であり`fast`切替ではない。`agent_goal`は現在`native_goal_adapter_not_implemented`を返す(CLIの`/goal`自体が無いという意味ではない)。強制再認証は、公式`/logout`が共有資格とcacheを消すため、入力せず拒否する。
|
|
315
318
|
|
|
316
319
|
Cursorの`model`は`gpt-5.6-luna`のようなbase model、`reasoning_effort`は`high`のように別指定する。adapterは現行`model-effort` IDを`cursor-agent models`へ照合し、起動中変更はCursor標準model pickerのparameter editorを使う。不在時は別modelへfallbackしない。
|
|
317
320
|
|
|
@@ -599,7 +602,7 @@ Claudeの相関済み承認は既存の`claude_approval`を使う。
|
|
|
599
602
|
| `agent_models` | harnessが今選べるmodelとreasoning effortを、そのharness自身の一覧からpromptを送らずに取得 | `harness`, `cwd?`, `include_hidden?` |
|
|
600
603
|
| `agent_approval` | Codexの現在の承認を検査し、単発許可・拒否を送る | `action`, `session_id`, `approval_choice?`, `observed_prompt_digest?` |
|
|
601
604
|
| `claude_agent` / `codex_agent` / `grok_agent` | deprecated互換alias(`composer_agent`は0.41.0で削除。Composerは`agent_launch`の`cursor-cli`で使う) | 旧launcher引数 |
|
|
602
|
-
| `agent_configure` | 起動中のClaude/Codex/Grok/Cursorを再起動せずmodel/effort/fast変更 | `session_id`, `model?`, `reasoning_effort?`, `fast?` |
|
|
605
|
+
| `agent_configure` | 起動中のClaude/Codex/Grok/Cursor/Antigravityを再起動せずmodel/effort/fast変更 | `session_id`, `model?`, `reasoning_effort?`, `fast?` |
|
|
603
606
|
| `claude_turn` | 相関済みClaude operationをdispatch(issue)または回収(recover) | `action`, `session_id`, `operation_id`, `text?` |
|
|
604
607
|
| `claude_approval` | 現在表示中の相関済みClaude承認UIを検査または応答 | `action`, `session_id`, `operation_id?`, `approval_choice?`, `observed_prompt_digest?` |
|
|
605
608
|
| `diagnostics` | 機械可読 JSON による read-only factory readiness | (なし) |
|
|
@@ -629,7 +632,9 @@ Aitermは、既定では実行時エラーをどこへも送らない。送る
|
|
|
629
632
|
|
|
630
633
|
`agent_launch`は選んだharnessの対話TUIを新しい永続PTYに起動し、`session_id`を返す。harnessはagent loop・認証・hook・session・transcriptを所有し、modelは独立。以後は他sessionと同じ`pty_read`/`pty_send`で操作する。
|
|
631
634
|
|
|
632
|
-
`agent_configure({ session_id, model?, reasoning_effort?, fast? })`はharness標準操作で起動中のClaude/Codex/Grok/Cursorを変更し、PTYと会話contextを維持する。
|
|
635
|
+
`agent_configure({ session_id, model?, reasoning_effort?, fast? })`はharness標準操作で起動中のClaude/Codex/Grok/Cursor/Antigravityを変更し、PTYと会話contextを維持する。
|
|
636
|
+
|
|
637
|
+
Codexでmodelだけを変更する場合は、標準の選択画面から現在のeffortを読み、同じ値を明示的に選びます。現在値を読めない場合や変更先で選べない場合は、別の値へ置き換えず失敗します。
|
|
633
638
|
|
|
634
639
|
長寿命Codexでは状態footerの空白入りモデル表示名も認識し、起動headerが画面外へ流れた後も入力欄の受付を維持する。
|
|
635
640
|
|
|
@@ -767,7 +772,7 @@ BellTeamのmodel・effort・fast変更も、既存session世代に結合したna
|
|
|
767
772
|
|
|
768
773
|
通常の配送と親への返答は、実行追跡用の共有lockを取得も待機もしない。旧native入口も通常配送と末端優先の`agent_stop`を提供し、`agent_execution`登録を要求しない。この入口を使う本体もExecutionBridgeの先行登録を外す。記録の失敗で配送を止めない。
|
|
769
774
|
|
|
770
|
-
セッションは共有tmux socket(Windows nativeはpsmux namespace)上にある。`pty_open`/`agent_launch`の戻り値に表示されるattachコマンドで、人間がClaude/Codex/Grok/Cursor harnessの同じ端末へ入り、途中でキーボードを引き取れる。
|
|
775
|
+
セッションは共有tmux socket(Windows nativeはpsmux namespace)上にある。`pty_open`/`agent_launch`の戻り値に表示されるattachコマンドで、人間がClaude/Codex/Grok/Cursor/Antigravity harnessの同じ端末へ入り、途中でキーボードを引き取れる。
|
|
771
776
|
POSIXでは、tmuxのソケットがまだ無くても最初の`agent_launch`でserverを起動できる。Aitermは作成したsessionとserverを実際のreceiptから照合して受付を確定し、不明な結果を入力の再送で補わない。
|
|
772
777
|
|
|
773
778
|
## 要件
|
|
@@ -783,7 +788,7 @@ POSIXでは、tmuxのソケットがまだ無くても最初の`agent_launch`で
|
|
|
783
788
|
|
|
784
789
|
- **ネスト中(ssh / docker / REPL / 起動したエージェント TUI)は quiescence が原理的に効かない。** 前面コマンドがシェル集合(bash/sh/zsh/fish/dash)の外になるため。ネスト中で `until` も `mark` も無いときは、待っても完了を確定できる信号が無いので、`pty_read({ wait: true })` はフル `timeout` を空費せず出力静止時点で `is_complete=False via nested` と早期に返し、`until`(既定リテラル部分一致・`until_regex: true` で正規表現)か `mark: true`(終了コード付き sentinel・自動検出)の指定を促す。全画面のエージェント TUI なら、出力が落ち着いた時点で `{ screen: true }` を読む。
|
|
785
790
|
- **`is_complete=False` は失敗ではない。** 「timeout 内に完了を観測できなかった」という意味。長時間コマンドでは `timeout` を伸ばすか `until`/`mark` を使う。
|
|
786
|
-
- **agent harnessは実物TUIを起動し、model APIを代理しない。** model・認証・挙動は選んだharnessのもの。隠れたagent間protocolはなく、MCPクライアントがClaude/Codex/Grok/Cursor TUIへ入力を送り出力を読む。
|
|
791
|
+
- **agent harnessは実物TUIを起動し、model APIを代理しない。** model・認証・挙動は選んだharnessのもの。隠れたagent間protocolはなく、MCPクライアントがClaude/Codex/Grok/Cursor/Antigravity TUIへ入力を送り出力を読む。
|
|
787
792
|
- **`pty_send({ rtk: true })` は単行コマンドのみ+外部 `rtk` バイナリが必要**(無ければ素通し)。一方 `pty_read({ rtk: true })` の reducer は自前実装で rtk 非依存。
|
|
788
793
|
- **`pytest` reducer は件数・`FAILURES` ブロック整形が rtk 0.50.0 と byte 一致**(回帰テストで固定)。ただし `-ra`/`-rf` 時の `FAILED` 要約行の理由は**全文を保持する**(rtk 0.50.0 は最初の `" - "` 区切りで切るが、本実装は可読性優先で情報を残すため、この行は意図的に rtk と完全一致させない)。rtk が大出力時に付ける `[full output: …]`(recall ポインタ)行は read 側では再現しない。
|
|
789
794
|
- **`grep` reducer は rtk 0.50.0 と一致**する。上限に収まる間は出力をそのまま返し、上限を超えた時のまとめ方は recall の案内を除いて `rtk grep` と byte 一致する。`git log` は件数(`-n`)か範囲(`A..B`)を指定すると全コミットを残し、指定が無ければ 10 件にして `[+N more commits]` で終える。rtk の `never_worse` と同じく、縮めた結果が元より多くのトークンを使う reducer は適用しない。
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
> **From any MCP client, launch Claude Code, Codex CLI, Grok CLI,
|
|
1
|
+
> **From any MCP client, launch Claude Code, Codex CLI, Grok CLI, Cursor Agent CLI, or Antigravity CLI through one harness API inside a persistent interactive TUI.**
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<img src="https://raw.githubusercontent.com/kitepon/aiterm-mcp/main/.github/og.png" alt="Aiterm — a shared forest observatory where different intelligences work in one persistent execution space" width="100%">
|
|
@@ -28,7 +28,7 @@ Built and maintained by [Quo at kitepon.dev](https://kitepon.dev/en).
|
|
|
28
28
|
|
|
29
29
|
## Install in your MCP client
|
|
30
30
|
|
|
31
|
-
検出したClaude Code・Codex・Grok・Cursorのユーザー設定へ登録する標準入口:
|
|
31
|
+
検出したClaude Code・Codex・Grok・Cursor・Antigravityのユーザー設定へ登録する標準入口:
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
npm install -g aiterm-mcp@latest
|
|
@@ -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.
|
|
230
|
+
**Status:** actively maintained · current public release **v0.62.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).
|
|
231
231
|
|
|
232
232
|
### Update and rollback
|
|
233
233
|
|
|
@@ -341,6 +341,9 @@ The canonical harness choices are:
|
|
|
341
341
|
| `codex-cli` | Codex CLI | OpenAI model and effort controls; durable rollout completion |
|
|
342
342
|
| `grok-cli` | Grok Build CLI | Grok model selected with `model`; live catalog check |
|
|
343
343
|
| `cursor-cli` | Cursor Agent CLI | GPT, Claude, Grok, or another Cursor catalog model; normal transcript completion |
|
|
344
|
+
| `antigravity-cli` | Google Antigravity CLI (`agy`) | Exact IDs from `agy models`; correlated native TUI hooks |
|
|
345
|
+
|
|
346
|
+
Antigravity CLI 1.4.10 uses its normal user authentication and project configuration. Install and sign in with the official `agy` CLI before launching. Model IDs include their effort; pass the exact catalog ID. Configuration changes keep the same conversation and restore the user default model. Its global MCP file is `~/.gemini/config/mcp_config.json`; Aiterm adds its named completion hooks in `~/.gemini/config/hooks.json`. A session-only `queuedMessages: "send-immediately"` override gives running-turn sends the native immediate-send behavior. An Antigravity parent uses the returned `wait_process` and `pty_read(agent_transcript:true)`. Native `/boost` is a separate multi-agent workflow, not the `fast` speed switch. `agent_goal` currently returns `native_goal_adapter_not_implemented`; this does not mean the CLI lacks `/goal`. Forced relogin is refused without issuing input because official `/logout` purges shared credentials and cache.
|
|
344
347
|
|
|
345
348
|
A new terminal gets the environment of the MCP process that opened it (since 0.50.0, ADR 0081).
|
|
346
349
|
Values from another caller that happened to start the tmux server first no longer appear in it.
|
|
@@ -674,11 +677,13 @@ enables collection on that host.
|
|
|
674
677
|
|
|
675
678
|
`agent_configure({ session_id, model?, reasoning_effort?, fast? })` changes a running Claude, Codex, Grok, or Cursor TUI through the harness's standard controls, preserving the PTY and conversation context.
|
|
676
679
|
|
|
680
|
+
Codex model-only changes explicitly preserve the current reasoning effort read from the native picker. Unreadable or unsupported current effort fails without selecting another value.
|
|
681
|
+
|
|
677
682
|
Long-lived Codex sessions recognize native model display names containing spaces in the status footer, so a ready composer remains available after the launch header scrolls away.
|
|
678
683
|
|
|
679
684
|
Model IDs come from each harness's native catalog. Claude aliases and differing Codex picker labels use that catalog's display name; Cursor matches complete native IDs or their exact supported effort variants. No model allowlist or alternate-model fallback is added. Codex success requires a fresh native change notice matching the requested ID and effort.
|
|
680
685
|
|
|
681
|
-
Configuration failures keep `isError: true` and the original error text, with `structuredContent: { schema: "aiterm.agent-configure-error.v1", session_id, outcome, effect }` for all
|
|
686
|
+
Configuration failures keep `isError: true` and the original error text, with `structuredContent: { schema: "aiterm.agent-configure-error.v1", session_id, outcome, effect }` for all five harnesses. `not_applied` / `not_started` means this request failed before a model, effort, or fast change could be issued. `outcome_unknown` / `possible` means a change may have been issued, including partial application before a later failure; do not replay it automatically. This receipt does not certify the session's previous configuration or clear unrelated uncertainty. Older servers without this receipt must be treated as unconfirmed on failure. Successful results retain `aiterm.agent-configure-result.v1`.
|
|
682
687
|
|
|
683
688
|
**ファスト(`fast`)。** 各harnessの、費用や利用量を多く払って応答を速くする切り替え(Claude Codeの`/fast`、Codexの速度の段、GrokとCursorのfast版のmodel)を、席ごとに切り替える(ADR 0114)。
|
|
684
689
|
|
package/dist/agent-goal.js
CHANGED
|
@@ -39,7 +39,7 @@ const goalFieldCapabilitiesSchema = z.object({
|
|
|
39
39
|
export const agentGoalResultSchema = z.object({
|
|
40
40
|
schema: z.literal("aiterm.agent-goal-result.v1"),
|
|
41
41
|
session_id: z.string(), launch_id: z.string(),
|
|
42
|
-
harness: z.enum(["claude-code", "codex-cli", "grok-cli", "cursor-cli"]).nullable(),
|
|
42
|
+
harness: z.enum(["claude-code", "codex-cli", "grok-cli", "cursor-cli", "antigravity-cli"]).nullable(),
|
|
43
43
|
binding: z.object({ ...executionLaunchSchema.shape, thread_id: z.string().min(1) }).nullable(),
|
|
44
44
|
availability: z.enum(["available", "unsupported", "unavailable"]),
|
|
45
45
|
capabilities: z.object({ inspect: z.boolean(), create: z.boolean(), edit: z.boolean(), pause: z.boolean(), resume: z.boolean(), clear: z.boolean() }),
|
package/dist/agent-resolver.js
CHANGED
|
@@ -189,7 +189,9 @@ export function resolveAgentBin(kind) {
|
|
|
189
189
|
? ["CODEX_BIN", [".local", "bin", "codex"], "codex"]
|
|
190
190
|
: kind === "cursor"
|
|
191
191
|
? ["CURSOR_AGENT_BIN", [".local", "bin", "cursor-agent"], "cursor-agent"]
|
|
192
|
-
:
|
|
192
|
+
: kind === "antigravity"
|
|
193
|
+
? ["ANTIGRAVITY_BIN", [".local", "bin", "agy"], "agy"]
|
|
194
|
+
: ["GROK_BIN", [".grok", "bin", isWin ? "grok.exe" : "grok"], "grok"];
|
|
193
195
|
const fromEnv = process.env[envVar];
|
|
194
196
|
if (fromEnv) {
|
|
195
197
|
// 明示指定 env は実在を検証する。存在しないパスを黙って返すと、session を作って
|
|
@@ -200,6 +202,9 @@ export function resolveAgentBin(kind) {
|
|
|
200
202
|
throw new AitermError(`${envVar} に指定された ${name} が存在しません: ${fromEnv}`, 2);
|
|
201
203
|
}
|
|
202
204
|
const defaultCandidates = [path.join(home, ...rel)];
|
|
205
|
+
if (kind === "antigravity" && isWin && process.env.LOCALAPPDATA) {
|
|
206
|
+
defaultCandidates.unshift(path.join(process.env.LOCALAPPDATA, "agy", "bin", "agy.exe"));
|
|
207
|
+
}
|
|
203
208
|
if (kind === "cursor" && isWin && process.env.LOCALAPPDATA) {
|
|
204
209
|
// Cursor公式Windows installerは %LOCALAPPDATA%\cursor-agent をPATHへ追加し、
|
|
205
210
|
// cursor-agent.exe/cmdを置く。GUI hostの古いPATHでも公式配置を直接解決する。
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { antigravityPaneObservation } from "./harnesses/antigravity.js";
|
|
1
2
|
import { AitermError } from "./errors.js";
|
|
2
3
|
import { grokTuiReady, grokTuiBusy, grokPaneObservation, grokLaunchBlockingDialog, assertGrokSandboxNotRejected, GROK_COMPOSER_MARKER_RE } from "./harnesses/grok.js";
|
|
3
4
|
import { codexTuiReady, codexTuiBusy, codexPaneObservation, codexRateLimitModelSwitchDialog, CODEX_COMPOSER_MARKER_RE } from "./harnesses/codex.js";
|
|
@@ -34,6 +35,8 @@ let agentTuiReadyStableSamplesTestOverride = null;
|
|
|
34
35
|
* どのharnessの関数を呼ぶかを自分で選ばない。読みの中身(入力欄・動作中・承認待ちの印)は各harness moduleが所有する。
|
|
35
36
|
*/
|
|
36
37
|
export function agentPaneObservation(kind, screen) {
|
|
38
|
+
if (kind === "antigravity")
|
|
39
|
+
return antigravityPaneObservation(screen);
|
|
37
40
|
if (kind === "claude")
|
|
38
41
|
return claudePaneObservation(screen);
|
|
39
42
|
if (kind === "codex")
|
|
@@ -43,6 +46,8 @@ export function agentPaneObservation(kind, screen) {
|
|
|
43
46
|
return grokPaneObservation(screen);
|
|
44
47
|
}
|
|
45
48
|
export function isAgentTuiReady(kind, screen) {
|
|
49
|
+
if (kind === "antigravity")
|
|
50
|
+
return ["idle", "busy"].includes(antigravityPaneObservation(screen).state);
|
|
46
51
|
if (kind === "claude")
|
|
47
52
|
return claudeTuiReady(screen);
|
|
48
53
|
if (kind === "codex")
|
|
@@ -55,6 +60,8 @@ export function isAgentTuiReady(kind, screen) {
|
|
|
55
60
|
// 別の正規表現があった。Claudeは会話欄に残った「esc to interrupt」を動作中と読み、止まった席の設定替え(agent_configure)
|
|
56
61
|
// が入力待ちを待ち続けていた。同じ画面を2つの読みで判断しない。
|
|
57
62
|
export function isAgentTuiBusy(kind, screen) {
|
|
63
|
+
if (kind === "antigravity")
|
|
64
|
+
return antigravityPaneObservation(screen).state === "busy";
|
|
58
65
|
if (kind === "claude")
|
|
59
66
|
return claudeTuiBusy(screen);
|
|
60
67
|
if (kind === "codex")
|
|
@@ -71,6 +78,8 @@ export function isAgentTuiIdleReady(kind, screen) {
|
|
|
71
78
|
// 起動側が明示応答すべき既知UI。ここで自動承認せず、ready timeoutを待たずに
|
|
72
79
|
// `initial_prompt=not_sent`を返してsessionを生かしたままcallerへ制御を戻す。
|
|
73
80
|
function isAgentTuiActionRequired(kind, screen) {
|
|
81
|
+
if (kind === "antigravity")
|
|
82
|
+
return antigravityPaneObservation(screen).state === "blocked";
|
|
74
83
|
if (kind === "grok")
|
|
75
84
|
return grokLaunchBlockingDialog(screen) !== null;
|
|
76
85
|
if (kind === "codex") {
|
package/dist/agent-shared.js
CHANGED
|
@@ -263,6 +263,8 @@ export function writeAgentMetadata(meta) {
|
|
|
263
263
|
writeJson0600(agentMetadataPath(meta.aiterm_session, meta.launch_id), meta);
|
|
264
264
|
}
|
|
265
265
|
export function agentLabel(kind) {
|
|
266
|
+
if (kind === "antigravity")
|
|
267
|
+
return "Antigravity CLI";
|
|
266
268
|
return kind === "claude"
|
|
267
269
|
? "Claude Code"
|
|
268
270
|
: kind === "grok"
|
|
@@ -272,6 +274,8 @@ export function agentLabel(kind) {
|
|
|
272
274
|
: "Codex";
|
|
273
275
|
}
|
|
274
276
|
export function agentHarness(kind) {
|
|
277
|
+
if (kind === "antigravity")
|
|
278
|
+
return "antigravity-cli";
|
|
275
279
|
return kind === "claude"
|
|
276
280
|
? "claude-code"
|
|
277
281
|
: kind === "codex"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { agentMetadataPath, subagentInstruction, writeJson0600 } from "./agent-shared.js";
|
|
7
|
+
import { antigravityBinding, antigravityBindingFile, antigravityTurn, antigravityResultPath } from "./harnesses/antigravity.js";
|
|
8
|
+
const payloadSchema = z.object({ conversationId: z.uuid(), workspacePaths: z.array(z.string()), transcriptPath: z.string().min(1),
|
|
9
|
+
executionNum: z.number().int().nonnegative().optional(), fullyIdle: z.boolean().optional(), terminationReason: z.string().optional(), error: z.string().optional() }).loose();
|
|
10
|
+
async function main() {
|
|
11
|
+
if (process.env.AITERM_AGENT_KIND !== "antigravity")
|
|
12
|
+
return {};
|
|
13
|
+
const name = process.env.AITERM_SESSION_ID ?? "", launch = process.env.AITERM_AGENT_LAUNCH_ID ?? "";
|
|
14
|
+
const file = agentMetadataPath(name, launch);
|
|
15
|
+
if (!fs.existsSync(file))
|
|
16
|
+
return {};
|
|
17
|
+
const meta = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
18
|
+
if (meta.kind !== "antigravity" || meta.aiterm_session !== name || meta.launch_id !== launch)
|
|
19
|
+
return {};
|
|
20
|
+
let input = "";
|
|
21
|
+
for await (const chunk of process.stdin) {
|
|
22
|
+
input += chunk.toString();
|
|
23
|
+
if (Buffer.byteLength(input) > 1024 * 1024)
|
|
24
|
+
throw new Error("payload exceeds limit");
|
|
25
|
+
}
|
|
26
|
+
const payload = payloadSchema.parse(JSON.parse(input));
|
|
27
|
+
if (!meta.cwd || !payload.workspacePaths.some(p => path.resolve(p) === path.resolve(meta.cwd)))
|
|
28
|
+
return {};
|
|
29
|
+
const event = process.argv[2];
|
|
30
|
+
if (event === "SessionStart") {
|
|
31
|
+
const binding = antigravityBinding(meta);
|
|
32
|
+
if (binding && binding.conversation_id !== payload.conversationId)
|
|
33
|
+
return {};
|
|
34
|
+
const expectedRoot = path.join(meta.antigravity_home, "brain", payload.conversationId);
|
|
35
|
+
if (!path.isAbsolute(payload.transcriptPath) || !path.relative(expectedRoot, payload.transcriptPath).startsWith(".system_generated" + path.sep))
|
|
36
|
+
return {};
|
|
37
|
+
writeJson0600(antigravityBindingFile(meta), { conversation_id: payload.conversationId, transcript: payload.transcriptPath });
|
|
38
|
+
return { injectSteps: [{ systemMessage: { systemMessage: subagentInstruction(meta) } }] };
|
|
39
|
+
}
|
|
40
|
+
const binding = antigravityBinding(meta);
|
|
41
|
+
if (event !== "Stop" || !binding || binding.conversation_id !== payload.conversationId || binding.transcript !== payload.transcriptPath || payload.fullyIdle !== true)
|
|
42
|
+
return {};
|
|
43
|
+
if (payload.executionNum === undefined || !payload.terminationReason)
|
|
44
|
+
throw new Error("Stop has no execution identity");
|
|
45
|
+
const success = payload.terminationReason === "NO_TOOL_CALL" && !payload.error;
|
|
46
|
+
// executionNum restarts at zero on each user turn (agy 1.4.10).
|
|
47
|
+
const { user_step, text } = antigravityTurn(binding.transcript, success);
|
|
48
|
+
const turn = `${user_step}-${payload.executionNum}`, resultFile = antigravityResultPath(meta, turn);
|
|
49
|
+
if (fs.existsSync(resultFile))
|
|
50
|
+
return {};
|
|
51
|
+
writeJson0600(resultFile, { text, conversation_id: payload.conversationId, user_step, execution: payload.executionNum });
|
|
52
|
+
const record = { type: "agent_done", vendor: "antigravity", aiterm_session: name, launch_id: launch,
|
|
53
|
+
vendor_session_id: payload.conversationId, turn_id: turn, operation_id: null,
|
|
54
|
+
reason: payload.terminationReason, done_status: success ? "turn_done" : "turn_error",
|
|
55
|
+
result_digest: createHash("sha256").update(text).digest("hex"), result_bytes: Buffer.byteLength(text), at: new Date().toISOString() };
|
|
56
|
+
fs.appendFileSync(meta.event_file, JSON.stringify(record) + "\n", { mode: 0o600 });
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
main().then(output => process.stdout.write(JSON.stringify(output))).catch(() => {
|
|
60
|
+
process.stderr.write("aiterm: Antigravity hook correlation could not be confirmed\n");
|
|
61
|
+
process.stdout.write("{}");
|
|
62
|
+
});
|