@agentproto/adapter-antigravity 0.2.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/ANTIGRAVITY.md ADDED
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: antigravity
3
+ id: antigravity
4
+ description: Google Antigravity's headless CLI (`agy`) as an AIP-45 print/headless agent.
5
+ version: 0.1.0
6
+ bin: agy
7
+ install:
8
+ - method: curl
9
+ url: https://antigravity.google/cli/install.sh
10
+ version_check:
11
+ cmd: agy --version
12
+ parse: '(\d+\.\d+\.\d+)'
13
+ range: ">=0.1.0"
14
+ timeout_ms: 15000
15
+ auth:
16
+ ref: ./SECRETS.md
17
+ sandbox: ./SANDBOX.md
18
+ protocol: print
19
+ tags: ["antigravity", "agy", "google", "print", "agent-runtime", "coding"]
20
+ ---
21
+
22
+ # Google Antigravity adapter
23
+
24
+ Wraps Google Antigravity's headless CLI, `agy`, as an AIP-45 agent CLI using
25
+ its documented headless command surface:
26
+
27
+ ```sh
28
+ agy -p "Fix the bug" --output-format stream-json
29
+ ```
30
+
31
+ Antigravity has **no ACP mode** (open feature request
32
+ `google-antigravity/antigravity-cli#31`), so this adapter is intentionally a
33
+ `protocol: print` (headless) arm rather than ACP — the same posture as the
34
+ `mastracode` adapter.
35
+
36
+ ## The event schema is NOT Claude's
37
+
38
+ `agy`'s headless *flags* look just like Claude Code's (`-p`,
39
+ `--output-format stream-json`, `--continue`), which is a trap. Its *wire
40
+ events* are a different taxonomy — verified against the sample outputs at
41
+ [antigravity.google/docs/cli/headless](https://antigravity.google/docs/cli/headless):
42
+
43
+ ```jsonc
44
+ {"event":"init","conversation_id":"…","init":{"cwd":"…","tools":[…],"permission_mode":"request-review"}}
45
+ {"event":"step_update","step_update":{"conversation_id":"…","step_index":3,"state":"DONE","step_type":"agent_response","text_delta":"…","usage":{…}}}
46
+ {"event":"result","result":{"conversation_id":"…","status":"SUCCESS","response":"…","usage":{…}}}
47
+ ```
48
+
49
+ Each line is discriminated by an `event` field (not Claude's `type`), the
50
+ payload is nested under a matching key, the session id is a nested
51
+ `conversation_id`, and assistant text streams as incremental
52
+ `step_update.text_delta` fragments. Because none of that matches
53
+ `claude-stream-json`, the print arm carries a dedicated
54
+ `event_schema: "antigravity-stream-json"` mapper
55
+ (`packages/driver/agent-cli/src/protocol/print-arm.ts`).
56
+
57
+ ## Auth
58
+
59
+ Keyring + Google Sign-In only — see [SECRETS.md](./SECRETS.md). You must run
60
+ `agy` interactively once to cache credentials before any headless run.
61
+
62
+ ## Models
63
+
64
+ No fixed `models.allowed` is declared. `agy models` lists the current slugs
65
+ (Gemini 3.x, Claude, GPT-OSS); pass any of them through the adapter's `model`
66
+ option, which forwards to `agy --model <slug>`.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,54 @@
1
+ import { AgentCliHandle, AgentCliRuntime } from '@agentproto/driver-agent-cli';
2
+ export { AgentCliHandle, AgentCliRuntime } from '@agentproto/driver-agent-cli';
3
+ import { CapabilityStrategy } from '@agentproto/provider-kit';
4
+
5
+ /**
6
+ * @agentproto/adapter-antigravity — AIP-45 adapter for Google Antigravity.
7
+ *
8
+ * Antigravity ships a headless CLI, `agy`, but NO ACP mode (open feature
9
+ * request google-antigravity/antigravity-cli#31). So — exactly like the
10
+ * `mastracode` adapter — this is a `protocol: "print"` (headless) arm, not
11
+ * an ACP one. We spawn `agy -p "<prompt>" --output-format stream-json` per
12
+ * turn and map its NDJSON events.
13
+ *
14
+ * import { antigravity, antigravityRuntime } from "@agentproto/adapter-antigravity"
15
+ * const session = await antigravityRuntime().start()
16
+ * for await (const evt of session.send({ role: "user", content: "..." })) {
17
+ * console.log(evt)
18
+ * }
19
+ * await session.close()
20
+ *
21
+ * ## Why a bespoke event schema (`antigravity-stream-json`)
22
+ *
23
+ * `agy`'s headless FLAG surface visibly mirrors Claude Code's (`-p`,
24
+ * `--output-format stream-json`, `--continue`), which is a trap: the WIRE
25
+ * events do NOT match Claude's `{ type: "system" | "assistant" | "result",
26
+ * session_id }` taxonomy. Verified against the sample outputs at
27
+ * antigravity.google/docs/cli/headless, every `agy` stream-json line is:
28
+ *
29
+ * {"event":"init","conversation_id":"…","init":{…}}
30
+ * {"event":"step_update","step_update":{conversation_id,step_index,state,
31
+ * step_type,text_delta?,tool_name?,tool_info?,…}}
32
+ * {"event":"result","result":{conversation_id,status,response,error?,usage}}
33
+ *
34
+ * i.e. discriminated by `event` (not `type`), payload nested under a matching
35
+ * key, session id a nested `conversation_id`, text as incremental
36
+ * `text_delta` fragments. That is a genuinely different taxonomy, so the
37
+ * print arm carries a dedicated `event_schema: "antigravity-stream-json"`
38
+ * mapper (packages/driver/agent-cli/src/protocol/print-arm.ts) rather than
39
+ * reusing the Claude one.
40
+ */
41
+
42
+ declare const antigravity: AgentCliHandle;
43
+ declare function antigravityRuntime(): AgentCliRuntime;
44
+ /**
45
+ * Antigravity exposes no per-provider api-key store to discover (auth is a
46
+ * keyring-backed Google login), so there are no providers to enrich — the
47
+ * capability report stays the manifest projection. The one honest override is
48
+ * the print arm's application contract: model/posture are baked into the spawn
49
+ * argv (`--model`, options), applied per fresh subprocess, so a live switch is
50
+ * `arg`-based and uncoupled — same as the `mastracode` print arm.
51
+ */
52
+ declare const antigravityCapabilities: CapabilityStrategy;
53
+
54
+ export { antigravity, antigravityCapabilities, antigravityRuntime };
package/dist/index.mjs ADDED
@@ -0,0 +1,157 @@
1
+ import { defineAgentCli, createAgentCliRuntime } from '@agentproto/driver-agent-cli';
2
+ import { deriveDeclaredCapabilities } from '@agentproto/provider-kit';
3
+
4
+ /**
5
+ * @agentproto/adapter-antigravity v0.1.0-alpha
6
+ * AIP-45 adapter for Google Antigravity (`agy`) via its headless CLI mode.
7
+ */
8
+
9
+ var antigravity = defineAgentCli({
10
+ name: "antigravity",
11
+ id: "antigravity",
12
+ description: "Google Antigravity's headless CLI (`agy`) \u2014 a multi-model coding agent (Gemini 3.x, Claude, GPT-OSS) run non-interactively via `agy -p --output-format stream-json`. No ACP mode yet (feature request google-antigravity/antigravity-cli#31), so this is a print/headless arm.",
13
+ version: "0.1.0",
14
+ bin: "agy",
15
+ // Not on npm — the only documented install is the official curl installer,
16
+ // which drops `agy` into ~/.local/bin (antigravity.google/docs/cli/headless).
17
+ install: [
18
+ { method: "curl", url: "https://antigravity.google/cli/install.sh" }
19
+ ],
20
+ // `agy --version` is the conventional probe; the exact stdout is UNVERIFIED
21
+ // (the headless flag table doesn't document a --version flag), so the range
22
+ // is deliberately permissive. Tighten once a real version string is known.
23
+ version_check: {
24
+ cmd: "agy --version",
25
+ parse: "(\\d+\\.\\d+\\.\\d+)",
26
+ range: ">=0.1.0",
27
+ timeout_ms: 15e3
28
+ },
29
+ // Antigravity authenticates through the OS keyring + a Google Sign-In
30
+ // browser flow ONLY — there is no documented API-key environment variable.
31
+ // Headless runs reuse the cached credentials, so the user must have run
32
+ // `agy` interactively once on this machine; a non-interactive run with no
33
+ // cached login exits with an "authentication required" error. Nothing to
34
+ // inject or scrub here — see ./SECRETS.md.
35
+ auth: {
36
+ ref: "./SECRETS.md"
37
+ },
38
+ sandbox: "./SANDBOX.md",
39
+ protocol: "print",
40
+ print: {
41
+ // `agy -p "<prompt>"` runs a single prompt non-interactively.
42
+ prompt_flag: "-p",
43
+ output_format: ["--output-format", "stream-json"],
44
+ // No Claude-style `--no-interactive`; `-p` already selects headless.
45
+ pre_prompt: [],
46
+ // `--conversation <id>` resumes a specific prior run by its
47
+ // `conversation_id`. (`--continue`/`-c` resumes the *most recent*, but a
48
+ // value-carrying flag is what the print arm wires from the captured id.)
49
+ resume: { flag: "--conversation", kind: "value" },
50
+ // See the file header + print-arm.ts: agy's events are `{event: …}`
51
+ // envelopes, NOT Claude's `{type: …}` — hence its own mapper.
52
+ event_schema: "antigravity-stream-json"
53
+ },
54
+ session: {
55
+ // The print arm spawns a fresh `agy` per turn; continuity comes from
56
+ // `--conversation <id>`, not a long-lived process.
57
+ mode: "ephemeral",
58
+ idle_timeout_ms: 18e5,
59
+ context_carryover: false
60
+ },
61
+ // No `models` block by design. The docs' `agy models` output shows real
62
+ // slugs (e.g. `gemini-3.5-flash-medium`, `claude-sonnet-4-6`), but the list
63
+ // is version-dependent and only partially documented, and every model is
64
+ // served through Antigravity's own backend under ONE Google identity — not
65
+ // a per-provider api-key route the catalog could bill. Declaring a fixed
66
+ // `models.allowed`/`provider` here would assert routing facts we haven't
67
+ // verified; the honest surface is the free-form `model` option below, which
68
+ // forwards any slug from `agy models` straight to `--model`.
69
+ capabilities: {
70
+ streaming: true,
71
+ tool_calls: true,
72
+ // agy runs subagents (`agy agents`, background tasks); step_updates carry
73
+ // `subagent_info`. We don't surface each subagent as its own StreamEvent,
74
+ // but the capability is real.
75
+ sub_agents: true,
76
+ file_io: true,
77
+ // Unverified — declared false rather than overclaiming.
78
+ multimodal: false,
79
+ // `agy --conversation <id>` genuinely resumes a prior conversation
80
+ // (docs: "Resume prior context with --continue … or --conversation with
81
+ // an ID from a previous run's conversation_id"). `print.resume` drives it.
82
+ resumable: true,
83
+ bidirectional: false
84
+ },
85
+ options: [
86
+ {
87
+ id: "model",
88
+ type: "string",
89
+ description: "Model slug for this run (see `agy models`), e.g. `gemini-3.5-flash-medium` or `claude-sonnet-4-6`. Forwarded to `--model`. Headless mode fails loudly on an unknown slug rather than silently falling back.",
90
+ bin_args_template: ["--model", "{value}"]
91
+ },
92
+ {
93
+ id: "effort",
94
+ type: "enum",
95
+ enum: ["low", "medium", "high"],
96
+ description: "Reasoning effort passed to `agy --effort`.",
97
+ bin_args_template: ["--effort", "{value}"]
98
+ },
99
+ {
100
+ id: "agent",
101
+ type: "string",
102
+ description: "Agent to run this prompt as (see `agy agents`). Forwarded to `--agent`.",
103
+ bin_args_template: ["--agent", "{value}"]
104
+ },
105
+ {
106
+ id: "print_timeout",
107
+ type: "string",
108
+ description: "Maximum time `agy` waits for a response, as a duration string (e.g. `15m`). Forwarded to `--print-timeout` (default 5m).",
109
+ bin_args_template: ["--print-timeout", "{value}"]
110
+ },
111
+ {
112
+ id: "dangerously_skip_permissions",
113
+ type: "boolean",
114
+ description: "Auto-approve EVERY tool call (file writes, command execution) for this run via `--dangerously-skip-permissions`. Off by default; prefer scoped `permissions.allow` rules in agy's settings.json.",
115
+ bin_args_append_when_true: ["--dangerously-skip-permissions"]
116
+ },
117
+ {
118
+ id: "terminal_sandbox",
119
+ type: "boolean",
120
+ description: "Run agy with its terminal sandbox restrictions enabled (`--sandbox`).",
121
+ bin_args_append_when_true: ["--sandbox"]
122
+ }
123
+ ],
124
+ continuation: {
125
+ default: "none",
126
+ supported: ["none", "transcript", "native-resume"]
127
+ },
128
+ metadata: {
129
+ acp: {
130
+ checked: "2026-08-06",
131
+ result: "Antigravity has no ACP mode. Tracked upstream as feature request google-antigravity/antigravity-cli#31; until it ships this adapter stays a print/headless arm."
132
+ },
133
+ models: {
134
+ checked: "2026-08-06",
135
+ result: "`agy models` (per antigravity.google/docs/models + the headless docs) lists slugs like gemini-3.6-flash-high, gemini-3.6-flash-medium, gemini-3.5-flash-medium, gemini-3.1-pro-high, claude-sonnet-4-6 \u2014 plus GPT-OSS variants. The full list is version-dependent and only partially documented, so no fixed `models.allowed` is declared; pass any slug through the `model` option."
136
+ },
137
+ auth: {
138
+ checked: "2026-08-06",
139
+ result: "OS keyring + Google Sign-In browser flow only; no documented API-key env var. Run `agy` interactively once to cache credentials before any headless run."
140
+ }
141
+ },
142
+ tags: ["antigravity", "agy", "google", "print", "agent-runtime", "coding"]
143
+ });
144
+ function antigravityRuntime() {
145
+ return createAgentCliRuntime(antigravity);
146
+ }
147
+ var antigravityCapabilities = async (def) => {
148
+ const base = deriveDeclaredCapabilities(def);
149
+ return {
150
+ ...base,
151
+ application: { modelApply: "arg", postureApply: "arg", coupled: false }
152
+ };
153
+ };
154
+
155
+ export { antigravity, antigravityCapabilities, antigravityRuntime };
156
+ //# sourceMappingURL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A,MACF,yBAAA,EAA2B,CAAC,WAAW;AAAA;AACzC,GACF;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,OAAA,EAAS,MAAA;AAAA,IACT,SAAA,EAAW,CAAC,MAAA,EAAQ,YAAA,EAAc,eAAe;AAAA,GACnD;AAAA,EACA,QAAA,EAAU;AAAA,IACR,GAAA,EAAK;AAAA,MACH,OAAA,EAAS,YAAA;AAAA,MACT,MAAA,EACE;AAAA,KAGJ;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,OAAA,EAAS,YAAA;AAAA,MACT,MAAA,EACE;AAAA,KAMJ;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,OAAA,EAAS,YAAA;AAAA,MACT,MAAA,EACE;AAAA;AAGJ,GACF;AAAA,EACA,MAAM,CAAC,aAAA,EAAe,OAAO,QAAA,EAAU,OAAA,EAAS,iBAAiB,QAAQ;AAC3E,CAAC;AAEM,SAAS,kBAAA,GAAsC;AACpD,EAAA,OAAO,sBAAsB,WAAW,CAAA;AAC1C;AAUO,IAAM,uBAAA,GAA8C,OAAO,GAAA,KAAQ;AACxE,EAAA,MAAM,IAAA,GAAO,2BAA2B,GAAG,CAAA;AAC3C,EAAA,OAAO;AAAA,IACL,GAAG,IAAA;AAAA,IACH,aAAa,EAAE,UAAA,EAAY,OAAO,YAAA,EAAc,KAAA,EAAO,SAAS,KAAA;AAAM,GACxE;AACF","file":"index.mjs","sourcesContent":["/**\n * @agentproto/adapter-antigravity — AIP-45 adapter for Google Antigravity.\n *\n * Antigravity ships a headless CLI, `agy`, but NO ACP mode (open feature\n * request google-antigravity/antigravity-cli#31). So — exactly like the\n * `mastracode` adapter — this is a `protocol: \"print\"` (headless) arm, not\n * an ACP one. We spawn `agy -p \"<prompt>\" --output-format stream-json` per\n * turn and map its NDJSON events.\n *\n * import { antigravity, antigravityRuntime } from \"@agentproto/adapter-antigravity\"\n * const session = await antigravityRuntime().start()\n * for await (const evt of session.send({ role: \"user\", content: \"...\" })) {\n * console.log(evt)\n * }\n * await session.close()\n *\n * ## Why a bespoke event schema (`antigravity-stream-json`)\n *\n * `agy`'s headless FLAG surface visibly mirrors Claude Code's (`-p`,\n * `--output-format stream-json`, `--continue`), which is a trap: the WIRE\n * events do NOT match Claude's `{ type: \"system\" | \"assistant\" | \"result\",\n * session_id }` taxonomy. Verified against the sample outputs at\n * antigravity.google/docs/cli/headless, every `agy` stream-json line is:\n *\n * {\"event\":\"init\",\"conversation_id\":\"…\",\"init\":{…}}\n * {\"event\":\"step_update\",\"step_update\":{conversation_id,step_index,state,\n * step_type,text_delta?,tool_name?,tool_info?,…}}\n * {\"event\":\"result\",\"result\":{conversation_id,status,response,error?,usage}}\n *\n * i.e. discriminated by `event` (not `type`), payload nested under a matching\n * key, session id a nested `conversation_id`, text as incremental\n * `text_delta` fragments. That is a genuinely different taxonomy, so the\n * print arm carries a dedicated `event_schema: \"antigravity-stream-json\"`\n * mapper (packages/driver/agent-cli/src/protocol/print-arm.ts) rather than\n * reusing the Claude one.\n */\n\nimport {\n createAgentCliRuntime,\n defineAgentCli,\n type AgentCliHandle,\n type AgentCliRuntime,\n} from \"@agentproto/driver-agent-cli\"\nimport {\n deriveDeclaredCapabilities,\n type CapabilityStrategy,\n} from \"@agentproto/provider-kit\"\n\nexport const antigravity: AgentCliHandle = defineAgentCli({\n name: \"antigravity\",\n id: \"antigravity\",\n description:\n \"Google Antigravity's headless CLI (`agy`) — a multi-model coding agent \" +\n \"(Gemini 3.x, Claude, GPT-OSS) run non-interactively via `agy -p \" +\n \"--output-format stream-json`. No ACP mode yet (feature request \" +\n \"google-antigravity/antigravity-cli#31), so this is a print/headless arm.\",\n version: \"0.1.0\",\n bin: \"agy\",\n // Not on npm — the only documented install is the official curl installer,\n // which drops `agy` into ~/.local/bin (antigravity.google/docs/cli/headless).\n install: [\n { method: \"curl\", url: \"https://antigravity.google/cli/install.sh\" },\n ],\n // `agy --version` is the conventional probe; the exact stdout is UNVERIFIED\n // (the headless flag table doesn't document a --version flag), so the range\n // is deliberately permissive. Tighten once a real version string is known.\n version_check: {\n cmd: \"agy --version\",\n parse: \"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\",\n range: \">=0.1.0\",\n timeout_ms: 15_000,\n },\n // Antigravity authenticates through the OS keyring + a Google Sign-In\n // browser flow ONLY — there is no documented API-key environment variable.\n // Headless runs reuse the cached credentials, so the user must have run\n // `agy` interactively once on this machine; a non-interactive run with no\n // cached login exits with an \"authentication required\" error. Nothing to\n // inject or scrub here — see ./SECRETS.md.\n auth: {\n ref: \"./SECRETS.md\",\n },\n sandbox: \"./SANDBOX.md\",\n protocol: \"print\",\n print: {\n // `agy -p \"<prompt>\"` runs a single prompt non-interactively.\n prompt_flag: \"-p\",\n output_format: [\"--output-format\", \"stream-json\"],\n // No Claude-style `--no-interactive`; `-p` already selects headless.\n pre_prompt: [],\n // `--conversation <id>` resumes a specific prior run by its\n // `conversation_id`. (`--continue`/`-c` resumes the *most recent*, but a\n // value-carrying flag is what the print arm wires from the captured id.)\n resume: { flag: \"--conversation\", kind: \"value\" },\n // See the file header + print-arm.ts: agy's events are `{event: …}`\n // envelopes, NOT Claude's `{type: …}` — hence its own mapper.\n event_schema: \"antigravity-stream-json\",\n },\n session: {\n // The print arm spawns a fresh `agy` per turn; continuity comes from\n // `--conversation <id>`, not a long-lived process.\n mode: \"ephemeral\",\n idle_timeout_ms: 1_800_000,\n context_carryover: false,\n },\n // No `models` block by design. The docs' `agy models` output shows real\n // slugs (e.g. `gemini-3.5-flash-medium`, `claude-sonnet-4-6`), but the list\n // is version-dependent and only partially documented, and every model is\n // served through Antigravity's own backend under ONE Google identity — not\n // a per-provider api-key route the catalog could bill. Declaring a fixed\n // `models.allowed`/`provider` here would assert routing facts we haven't\n // verified; the honest surface is the free-form `model` option below, which\n // forwards any slug from `agy models` straight to `--model`.\n capabilities: {\n streaming: true,\n tool_calls: true,\n // agy runs subagents (`agy agents`, background tasks); step_updates carry\n // `subagent_info`. We don't surface each subagent as its own StreamEvent,\n // but the capability is real.\n sub_agents: true,\n file_io: true,\n // Unverified — declared false rather than overclaiming.\n multimodal: false,\n // `agy --conversation <id>` genuinely resumes a prior conversation\n // (docs: \"Resume prior context with --continue … or --conversation with\n // an ID from a previous run's conversation_id\"). `print.resume` drives it.\n resumable: true,\n bidirectional: false,\n },\n options: [\n {\n id: \"model\",\n type: \"string\",\n description:\n \"Model slug for this run (see `agy models`), e.g. \" +\n \"`gemini-3.5-flash-medium` or `claude-sonnet-4-6`. Forwarded to \" +\n \"`--model`. Headless mode fails loudly on an unknown slug rather than \" +\n \"silently falling back.\",\n bin_args_template: [\"--model\", \"{value}\"],\n },\n {\n id: \"effort\",\n type: \"enum\",\n enum: [\"low\", \"medium\", \"high\"],\n description: \"Reasoning effort passed to `agy --effort`.\",\n bin_args_template: [\"--effort\", \"{value}\"],\n },\n {\n id: \"agent\",\n type: \"string\",\n description:\n \"Agent to run this prompt as (see `agy agents`). Forwarded to `--agent`.\",\n bin_args_template: [\"--agent\", \"{value}\"],\n },\n {\n id: \"print_timeout\",\n type: \"string\",\n description:\n \"Maximum time `agy` waits for a response, as a duration string \" +\n \"(e.g. `15m`). Forwarded to `--print-timeout` (default 5m).\",\n bin_args_template: [\"--print-timeout\", \"{value}\"],\n },\n {\n id: \"dangerously_skip_permissions\",\n type: \"boolean\",\n description:\n \"Auto-approve EVERY tool call (file writes, command execution) for \" +\n \"this run via `--dangerously-skip-permissions`. Off by default; \" +\n \"prefer scoped `permissions.allow` rules in agy's settings.json.\",\n bin_args_append_when_true: [\"--dangerously-skip-permissions\"],\n },\n {\n id: \"terminal_sandbox\",\n type: \"boolean\",\n description:\n \"Run agy with its terminal sandbox restrictions enabled (`--sandbox`).\",\n bin_args_append_when_true: [\"--sandbox\"],\n },\n ],\n continuation: {\n default: \"none\",\n supported: [\"none\", \"transcript\", \"native-resume\"],\n },\n metadata: {\n acp: {\n checked: \"2026-08-06\",\n result:\n \"Antigravity has no ACP mode. Tracked upstream as feature request \" +\n \"google-antigravity/antigravity-cli#31; until it ships this adapter \" +\n \"stays a print/headless arm.\",\n },\n models: {\n checked: \"2026-08-06\",\n result:\n \"`agy models` (per antigravity.google/docs/models + the headless docs) \" +\n \"lists slugs like gemini-3.6-flash-high, gemini-3.6-flash-medium, \" +\n \"gemini-3.5-flash-medium, gemini-3.1-pro-high, claude-sonnet-4-6 — \" +\n \"plus GPT-OSS variants. The full list is version-dependent and only \" +\n \"partially documented, so no fixed `models.allowed` is declared; pass \" +\n \"any slug through the `model` option.\",\n },\n auth: {\n checked: \"2026-08-06\",\n result:\n \"OS keyring + Google Sign-In browser flow only; no documented API-key \" +\n \"env var. Run `agy` interactively once to cache credentials before any \" +\n \"headless run.\",\n },\n },\n tags: [\"antigravity\", \"agy\", \"google\", \"print\", \"agent-runtime\", \"coding\"],\n})\n\nexport function antigravityRuntime(): AgentCliRuntime {\n return createAgentCliRuntime(antigravity)\n}\n\n/**\n * Antigravity exposes no per-provider api-key store to discover (auth is a\n * keyring-backed Google login), so there are no providers to enrich — the\n * capability report stays the manifest projection. The one honest override is\n * the print arm's application contract: model/posture are baked into the spawn\n * argv (`--model`, options), applied per fresh subprocess, so a live switch is\n * `arg`-based and uncoupled — same as the `mastracode` print arm.\n */\nexport const antigravityCapabilities: CapabilityStrategy = async (def) => {\n const base = deriveDeclaredCapabilities(def)\n return {\n ...base,\n application: { modelApply: \"arg\", postureApply: \"arg\", coupled: false },\n }\n}\n\nexport type { AgentCliHandle, AgentCliRuntime }\n"]}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@agentproto/adapter-antigravity",
3
+ "version": "0.2.0",
4
+ "description": "@agentproto/adapter-antigravity — AIP-45 AGENT-CLI adapter for Google Antigravity's headless CLI (`agy`). Spawns `agy -p --output-format stream-json`; Antigravity has no ACP mode yet (feature request google-antigravity/antigravity-cli#31).",
5
+ "keywords": [
6
+ "agentproto",
7
+ "aip-45",
8
+ "antigravity",
9
+ "agy",
10
+ "google",
11
+ "print",
12
+ "agent-cli",
13
+ "adapter"
14
+ ],
15
+ "homepage": "https://agentproto.sh/docs/aip-45",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/agentproto/ts",
19
+ "directory": "adapters/antigravity"
20
+ },
21
+ "license": "Apache-2.0",
22
+ "type": "module",
23
+ "main": "dist/index.mjs",
24
+ "module": "dist/index.mjs",
25
+ "types": "dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.mjs",
30
+ "default": "./dist/index.mjs"
31
+ },
32
+ "./ANTIGRAVITY.md": "./ANTIGRAVITY.md",
33
+ "./package.json": "./package.json"
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "ANTIGRAVITY.md",
38
+ "README.md",
39
+ "LICENSE"
40
+ ],
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "dependencies": {
45
+ "@agentproto/driver-agent-cli": "2.2.0",
46
+ "@agentproto/provider-kit": "0.4.1"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^25.6.2",
50
+ "tsup": "^8.5.1",
51
+ "typescript": "^5.9.3",
52
+ "vitest": "^3.2.4",
53
+ "@agentproto/tooling": "0.1.0-alpha.0"
54
+ },
55
+ "scripts": {
56
+ "dev": "tsup --watch",
57
+ "build": "tsup",
58
+ "clean": "rm -rf dist",
59
+ "check-types": "tsc --noEmit",
60
+ "test": "vitest run --passWithNoTests",
61
+ "test:watch": "vitest"
62
+ }
63
+ }