@simonepri/refined-antigravity-acp 0.1.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.md ADDED
@@ -0,0 +1,292 @@
1
+ <p align="center">
2
+ <a href="https://github.com/simonepri/refined-antigravity-acp">
3
+ <img src="assets/logo.svg" alt="Refined Antigravity ACP Logo" width="320">
4
+ </a>
5
+ </p>
6
+
7
+ <h1 align="center">Refined Antigravity ACP</h1>
8
+
9
+ <p align="center">
10
+ <!-- Implementation -->
11
+ <a href="https://www.typescriptlang.org/">
12
+ <img src="https://img.shields.io/badge/language-TypeScript-3178C6?logo=typescript&amp;logoColor=white" alt="Written in TypeScript">
13
+ </a>
14
+ <a href="https://nodejs.org/">
15
+ <img src="https://img.shields.io/badge/runtime-Node.js_>=22-339933?logo=node.js&amp;logoColor=white" alt="Node.js 22+">
16
+ </a>
17
+ <a href="https://pnpm.io/">
18
+ <img src="https://img.shields.io/badge/package_manager-pnpm-F69220?logo=pnpm&amp;logoColor=white" alt="pnpm">
19
+ </a>
20
+ <a href="https://oxc.rs/">
21
+ <img src="https://img.shields.io/badge/linter-oxlint-orange?logo=rust&amp;logoColor=white" alt="oxlint">
22
+ </a>
23
+ <br>
24
+ <!-- Verification -->
25
+ <a href="https://github.com/simonepri/refined-antigravity-acp/actions/workflows/ci.yml">
26
+ <img src="https://img.shields.io/github/actions/workflow/status/simonepri/refined-antigravity-acp/ci.yml?branch=main&amp;label=CI&amp;logo=githubactions&amp;logoColor=white" alt="CI status">
27
+ </a>
28
+ <a href="https://vitest.dev/">
29
+ <img src="https://img.shields.io/badge/tests-vitest-729B1B?logo=vitest&amp;logoColor=white" alt="Vitest unit tests">
30
+ </a>
31
+ <br>
32
+ <!-- Distribution -->
33
+ <a href="https://github.com/googleapis/release-please">
34
+ <img src="https://img.shields.io/badge/released_with-Release_Please-4285F4?logo=google&amp;logoColor=white" alt="Released with Release Please">
35
+ </a>
36
+ <a href="https://github.com/getpaseo/paseo">
37
+ <img src="https://img.shields.io/badge/ecosystem-Paseo_Plugin-20744A?logo=buffer&amp;logoColor=white" alt="Paseo Plugin">
38
+ </a>
39
+ <a href="license">
40
+ <img src="https://img.shields.io/github/license/simonepri/refined-antigravity-acp" alt="MIT license">
41
+ </a>
42
+ </p>
43
+
44
+ <p align="center">
45
+ <strong>A hardened wrapper around Google's official Antigravity ACP binary.</strong>
46
+ </p>
47
+
48
+ ---
49
+
50
+ ## What is Refined Antigravity ACP?
51
+
52
+ **Refined Antigravity ACP** is an **proxy wrapper** around Google's official Antigravity ACP binary ([`agy_acp_server.par`](https://dl.google.com/agy-extensions/releases/)).
53
+
54
+ Google's binary powers the core model execution, agent loop, and tool calling. This project intercepts the ACP stream between your editor and the server to transparently fix upstream bugs (such as turn completion and subagent hangs), absorb malformed MCP traffic, and provide first-class integration for **Paseo**, **Zed**, and any standard ACP client.
55
+
56
+ ```mermaid
57
+ flowchart LR
58
+ subgraph Editors["Supported ACP Clients"]
59
+ PaseoUI["Paseo<br>(Native Plugin)"]
60
+ ZedUI["Zed Editor<br>(Stdio Agent)"]
61
+ OtherUI["Neovim / JetBrains / Custom<br>(Standard ACP)"]
62
+ end
63
+
64
+ subgraph Wrapper["Refined Antigravity ACP"]
65
+ Connector["Stream Connector<br>(server/connector.ts)"]
66
+ HangDetector["Hang & Turn-Complete Detector<br>(Grace Timers + Synthetic end_turn)"]
67
+ McpProxy["Loopback MCP Proxy<br>(Header Normalization & 4xx Absorption)"]
68
+ Steering["Mid-Flight Steering<br>(server/steering.ts)"]
69
+ SkillsEngine["Slash Skills Autocomplete<br>(server/skills.ts)"]
70
+ Sanitizer["Stream Sanitizer<br>(Markup & Internal Tag Stripping)"]
71
+ AgyPatch["Binary Patch Engine<br>(Zero-Offset Byte Preservation)"]
72
+
73
+ Connector --- HangDetector
74
+ Connector --- McpProxy
75
+ Connector --- Steering
76
+ Connector --- SkillsEngine
77
+ Connector --- Sanitizer
78
+ Connector --- AgyPatch
79
+ end
80
+
81
+ subgraph Upstream["Google Official Backend"]
82
+ Kernel["agy_acp_server.par<br>(Google Subprocess)"]
83
+ GeminiCloud["Google DeepMind / Gemini Cloud"]
84
+ Kernel <-->|"gRPC / HTTPS"| GeminiCloud
85
+ end
86
+
87
+ PaseoUI <-->|"In-Process Provider Plugin"| Wrapper
88
+ ZedUI <-->|"Stdio NDJSON (CLI)"| Wrapper
89
+ OtherUI <-->|"Stdio NDJSON (CLI)"| Wrapper
90
+ Wrapper <-->|"Standard ACP (NDJSON)"| Kernel
91
+
92
+ classDef editor fill:#20744A,stroke:#10B981,color:#fff,stroke-width:2px;
93
+ classDef wrapper fill:#0F172A,stroke:#3B82F6,color:#fff,stroke-width:2px;
94
+ classDef google fill:#1E293B,stroke:#64748B,color:#fff,stroke-width:2px;
95
+
96
+ class PaseoUI,ZedUI,OtherUI editor;
97
+ class Connector,HangDetector,McpProxy,Steering,SkillsEngine,Sanitizer,AgyPatch wrapper;
98
+ class Kernel,GeminiCloud google;
99
+ ```
100
+
101
+ ---
102
+
103
+ ## What Does This ACP Give You?
104
+
105
+ ### Upstream Bugfixes & Hardening
106
+
107
+ | Area | Upstream Issue | Mitigation in Refined ACP |
108
+ | :----------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------- |
109
+ | 🛡️ **Subagent & Task Hangs** | Upstream binary permanently wedges in `STATE_WAITING_FOR_TASKS` when launching subagents or background tasks. | 3-layer defense: automated non-destructive binary patch, stderr telemetry hang detection, and transparent process recycling. |
110
+ | ⏳ **Turn Completion & Infinite Spinners** | Upstream omits the final JSON-RPC prompt response after completing user turns, leaving editors spinning forever. | Stream-detects `TARGET_USER` `STATE_DONE` telemetry, runs a 5s grace timer, and fires synthetic `end_turn` completions. |
111
+ | 🔌 **MCP Header & 4xx Fatal Crashes** | Upstream Go SDK harnesses crash fatally on notification 4xx HTTP responses or missing `Accept` headers. | In-process loopback MCP proxy normalizes headers and absorbs notification 4xx errors with HTTP `202 Accepted`. |
112
+ | 🧼 **Internal Markup Leaks** | Raw harness internal markers (`<system_message>`, `<context>`, `<messaging>`) leak into user output. | Live stream sanitizer strips internal tags and converts raw HTML elements into clean Markdown. |
113
+
114
+ ### Enhanced Capabilities
115
+
116
+ | Feature | Description |
117
+ | :---------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------- |
118
+ | 🎯 **Mid-Turn Steering (`prompt.steer`)** | Steer running agent turns in flight without interrupting execution or losing context. Cleanly strips steering markers from saved history. |
119
+ | 🔄 **Session History Recovery** | Automatically discovers and restores previous conversation history directly from the local Antigravity SQLite database on session reload. |
120
+ | ⚡ **Workspace Slash Skills Discovery** | Discovers skill definitions in `.gemini/skills`, `.agents/skills`, `.codex/skills`, and global paths, exposing them as autocomplete commands. |
121
+ | 🧠 **Workspace Context Injection** | Seamlessly injects project profile instructions and system prompts during session initialization without duplicate re-injections across turns. |
122
+ | 🔐 **Zero-Touch Authentication** | Reuses existing Google CLI credentials from macOS Keychain or `acp_token.json` without requiring browser re-login. |
123
+
124
+ ---
125
+
126
+ ## Editor Support & Setup
127
+
128
+ ### 1. Paseo (Native Provider Plugin)
129
+
130
+ Refined Antigravity ACP runs natively as an in-process Paseo provider plugin.
131
+
132
+ #### Installation
133
+
134
+ **Option A: Native Plugin via Paseo CLI (Recommended)**
135
+
136
+ ```bash
137
+ paseo plugin add @simonepri/refined-antigravity-acp
138
+ ```
139
+
140
+ **Option B: Manual Provider Configuration (`~/.paseo/config.json`)**
141
+
142
+ You can also register it directly as an ACP agent provider in your `~/.paseo/config.json` under `agents.providers`:
143
+
144
+ ```json
145
+ {
146
+ "agents": {
147
+ "providers": {
148
+ "antigravity": {
149
+ "extends": "acp",
150
+ "label": "Antigravity",
151
+ "command": ["npx", "-y", "@simonepri/refined-antigravity-acp"],
152
+ "enabled": true
153
+ }
154
+ }
155
+ }
156
+ }
157
+ ```
158
+
159
+ _(Alternatively, install globally via `npm install -g @simonepri/refined-antigravity-acp` or `pnpm add -g @simonepri/refined-antigravity-acp` and configure `["refined-antigravity-acp"]` or the absolute path from `which refined-antigravity-acp`)._
160
+
161
+ ---
162
+
163
+ ### 2. Zed Editor (ACP Agent)
164
+
165
+ Zed supports external agents via the Agent Client Protocol over stdio.
166
+
167
+ #### Configuration
168
+
169
+ Add `refined-antigravity-acp` to your Zed `settings.json` (accessible via `Cmd+,` or `~/.config/zed/settings.json`) under `agent.profiles`.
170
+
171
+ You can configure it using `npx` (zero-install) or by pointing directly to your local binary path:
172
+
173
+ **Via npx (Zero-install):**
174
+
175
+ ```json
176
+ {
177
+ "agent": {
178
+ "profiles": {
179
+ "antigravity": {
180
+ "type": "acp",
181
+ "command": "npx",
182
+ "args": ["-y", "@simonepri/refined-antigravity-acp"]
183
+ }
184
+ }
185
+ }
186
+ }
187
+ ```
188
+
189
+ **Via Local / Global Binary Path:**
190
+
191
+ If you installed the package globally (`npm install -g @simonepri/refined-antigravity-acp`) or cloned it locally, find the binary path via `which refined-antigravity-acp` and provide the absolute path to `command`:
192
+
193
+ ```json
194
+ {
195
+ "agent": {
196
+ "profiles": {
197
+ "antigravity": {
198
+ "type": "acp",
199
+ "command": "/usr/local/bin/refined-antigravity-acp",
200
+ "args": []
201
+ }
202
+ }
203
+ }
204
+ }
205
+ ```
206
+
207
+ ---
208
+
209
+ ### 3. Standalone CLI / Other ACP Editors (Neovim, JetBrains)
210
+
211
+ Any editor or tool speaking standard ACP over stdio can launch Refined Antigravity ACP directly:
212
+
213
+ ```bash
214
+ npx @simonepri/refined-antigravity-acp
215
+ ```
216
+
217
+ Or install globally:
218
+
219
+ ```bash
220
+ npm install -g @simonepri/refined-antigravity-acp
221
+ refined-antigravity-acp
222
+ ```
223
+
224
+ _(Short aliases `ragy-acp` and `agy-acp` are also available)._
225
+
226
+ > [!TIP]
227
+ > The wrapper automatically resolves or downloads the official Google [`agy_acp_server.par`](https://dl.google.com/agy-extensions/releases/) binary if it is not already present on your machine.
228
+
229
+ ---
230
+
231
+ ## Authentication
232
+
233
+ If you already use Google Antigravity on your machine, you are already authenticated! The wrapper reads your existing credentials from macOS Keychain or `~/.gemini/antigravity-acp/acp_token.json`.
234
+
235
+ If starting fresh on a new machine, authenticate once via the Google CLI:
236
+
237
+ ```bash
238
+ agy
239
+ ```
240
+
241
+ ---
242
+
243
+ ## Behavioral Notes
244
+
245
+ > [!NOTE]
246
+ > **Tool execution priority**: Google Antigravity models prioritize immediate tool execution over conversational chat. When starting a prompt or responding after an interruption, the agent will typically call required tools immediately rather than outputting a preliminary text acknowledgment.
247
+ >
248
+ > If you prefer the agent to verbally state its intentions before calling tools, you can configure your Paseo agent or profile system prompt (e.g., in `.paseo/profile.json` or agent instructions) to include:
249
+ >
250
+ > ```text
251
+ > Before calling any tools, always output a concise 1-2 sentence acknowledgment outlining what you are about to do.
252
+ > ```
253
+
254
+ ---
255
+
256
+ ## Configuration & Environment Variables
257
+
258
+ | Variable | Default | Description |
259
+ | :----------------------------- | :------------ | :----------------------------------------------------------------------------------------- |
260
+ | `PASEO_AGY_ACP_BIN` | Auto-detected | Custom path to an `agy_acp_server.par` binary. |
261
+ | `PASEO_AGY_NO_PATCH` | `0` | Set to `1` to disable binary auto-patching and force the unmodified binary. |
262
+ | `PASEO_AGY_HANG_GRACE_MS` | `5000` | Grace period in milliseconds after `STATE_WAITING_FOR_TASKS` before declaring a turn hung. |
263
+ | `PASEO_AGY_HANG_INACTIVITY_MS` | `30000` | Inactivity backstop timer (30 seconds) before declaring a turn hung. |
264
+ | `PASEO_AGY_RECYCLE_TIMEOUT_MS` | `30000` | Maximum time allowed to spawn and initialize a recycled replacement process. |
265
+ | `PASEO_AGY_TRACE` | `0` | Set to `1` to trace all inbound and outbound ACP JSON-RPC messages to stderr. |
266
+ | `PASEO_AGY_MCP_PROXY_PORT` | `0` | Fixed port for the loopback MCP proxy (defaults to an ephemeral open port). |
267
+ | `ANTIGRAVITY_HARNESS_PATH` | Auto-detected | Explicit path to the Antigravity Python harness. |
268
+
269
+ ---
270
+
271
+ ## Development
272
+
273
+ ```bash
274
+ pnpm install
275
+ pnpm run format:check
276
+ pnpm run lint
277
+ pnpm run dead-code
278
+ pnpm run typecheck
279
+ pnpm run test
280
+ ```
281
+
282
+ ---
283
+
284
+ ## Disclaimer
285
+
286
+ This is an independent open-source project and is not affiliated with, authorized, or endorsed by Google LLC. "Antigravity", "Gemini", and Google are trademarks of Google LLC.
287
+
288
+ ---
289
+
290
+ ## License
291
+
292
+ MIT © [Simone Primarosa](https://github.com/simonepri)
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3
+ "release-type": "node",
4
+ "bump-minor-pre-major": true,
5
+ "bump-patch-for-minor-pre-major": true,
6
+ "skip-changelog": true,
7
+ "packages": {
8
+ ".": {
9
+ "initial-version": "0.1.0",
10
+ "component": "refined-antigravity-acp"
11
+ }
12
+ }
13
+ }