paseo-agy-acp 2.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.
Files changed (107) hide show
  1. package/CHANGELOG.md +296 -0
  2. package/LICENSE +201 -0
  3. package/README.md +571 -0
  4. package/README.zh-CN.md +540 -0
  5. package/assets/official-kernel-compat/rc01/paseo_model_compat.py +172 -0
  6. package/dist/ACP Connector/acp/session/paseo-context.d.ts +6 -0
  7. package/dist/ACP Connector/acp/session/paseo-context.js +83 -0
  8. package/dist/ACP Connector/acp/session/paseo-context.js.map +1 -0
  9. package/dist/ACP Connector/acp/session/turn-scheduler.d.ts +90 -0
  10. package/dist/ACP Connector/acp/session/turn-scheduler.js +247 -0
  11. package/dist/ACP Connector/acp/session/turn-scheduler.js.map +1 -0
  12. package/dist/ACP Connector/admission/dispatch-boundary.d.ts +19 -0
  13. package/dist/ACP Connector/admission/dispatch-boundary.js +16 -0
  14. package/dist/ACP Connector/admission/dispatch-boundary.js.map +1 -0
  15. package/dist/ACP Connector/admission/errors.d.ts +18 -0
  16. package/dist/ACP Connector/admission/errors.js +46 -0
  17. package/dist/ACP Connector/admission/errors.js.map +1 -0
  18. package/dist/ACP Connector/admission/owner-instance.d.ts +31 -0
  19. package/dist/ACP Connector/admission/owner-instance.js +105 -0
  20. package/dist/ACP Connector/admission/owner-instance.js.map +1 -0
  21. package/dist/ACP Connector/admission/runtime.d.ts +20 -0
  22. package/dist/ACP Connector/admission/runtime.js +157 -0
  23. package/dist/ACP Connector/admission/runtime.js.map +1 -0
  24. package/dist/ACP Connector/admission/startup-recovery.d.ts +22 -0
  25. package/dist/ACP Connector/admission/startup-recovery.js +129 -0
  26. package/dist/ACP Connector/admission/startup-recovery.js.map +1 -0
  27. package/dist/ACP Connector/admission/turn-coordinator.d.ts +57 -0
  28. package/dist/ACP Connector/admission/turn-coordinator.js +369 -0
  29. package/dist/ACP Connector/admission/turn-coordinator.js.map +1 -0
  30. package/dist/ACP Connector/agent.d.ts +4 -0
  31. package/dist/ACP Connector/agent.js +6 -0
  32. package/dist/ACP Connector/agent.js.map +1 -0
  33. package/dist/ACP Connector/main.d.ts +2 -0
  34. package/dist/ACP Connector/main.js +31 -0
  35. package/dist/ACP Connector/main.js.map +1 -0
  36. package/dist/ACP Connector/official-kernel/admission-fence.d.ts +10 -0
  37. package/dist/ACP Connector/official-kernel/admission-fence.js +52 -0
  38. package/dist/ACP Connector/official-kernel/admission-fence.js.map +1 -0
  39. package/dist/ACP Connector/official-kernel/context.d.ts +3 -0
  40. package/dist/ACP Connector/official-kernel/context.js +52 -0
  41. package/dist/ACP Connector/official-kernel/context.js.map +1 -0
  42. package/dist/ACP Connector/official-kernel/errors.d.ts +5 -0
  43. package/dist/ACP Connector/official-kernel/errors.js +39 -0
  44. package/dist/ACP Connector/official-kernel/errors.js.map +1 -0
  45. package/dist/ACP Connector/official-kernel/identity.d.ts +3 -0
  46. package/dist/ACP Connector/official-kernel/identity.js +17 -0
  47. package/dist/ACP Connector/official-kernel/identity.js.map +1 -0
  48. package/dist/ACP Connector/official-kernel/json-rpc.d.ts +34 -0
  49. package/dist/ACP Connector/official-kernel/json-rpc.js +26 -0
  50. package/dist/ACP Connector/official-kernel/json-rpc.js.map +1 -0
  51. package/dist/ACP Connector/official-kernel/kernel-compat-lifecycle.d.ts +115 -0
  52. package/dist/ACP Connector/official-kernel/kernel-compat-lifecycle.js +1904 -0
  53. package/dist/ACP Connector/official-kernel/kernel-compat-lifecycle.js.map +1 -0
  54. package/dist/ACP Connector/official-kernel/kernel-compat-pins.d.ts +14 -0
  55. package/dist/ACP Connector/official-kernel/kernel-compat-pins.js +29 -0
  56. package/dist/ACP Connector/official-kernel/kernel-compat-pins.js.map +1 -0
  57. package/dist/ACP Connector/official-kernel/kernel-compat-rc01-recipe.d.ts +2 -0
  58. package/dist/ACP Connector/official-kernel/kernel-compat-rc01-recipe.js +32 -0
  59. package/dist/ACP Connector/official-kernel/kernel-compat-rc01-recipe.js.map +1 -0
  60. package/dist/ACP Connector/official-kernel/kernel.d.ts +3 -0
  61. package/dist/ACP Connector/official-kernel/kernel.js +12 -0
  62. package/dist/ACP Connector/official-kernel/kernel.js.map +1 -0
  63. package/dist/ACP Connector/official-kernel/login.d.ts +1 -0
  64. package/dist/ACP Connector/official-kernel/login.js +73 -0
  65. package/dist/ACP Connector/official-kernel/login.js.map +1 -0
  66. package/dist/ACP Connector/official-kernel/mcp-rewrite.d.ts +1 -0
  67. package/dist/ACP Connector/official-kernel/mcp-rewrite.js +39 -0
  68. package/dist/ACP Connector/official-kernel/mcp-rewrite.js.map +1 -0
  69. package/dist/ACP Connector/official-kernel/mode-map.d.ts +5 -0
  70. package/dist/ACP Connector/official-kernel/mode-map.js +35 -0
  71. package/dist/ACP Connector/official-kernel/mode-map.js.map +1 -0
  72. package/dist/ACP Connector/official-kernel/ndjson.d.ts +3 -0
  73. package/dist/ACP Connector/official-kernel/ndjson.js +29 -0
  74. package/dist/ACP Connector/official-kernel/ndjson.js.map +1 -0
  75. package/dist/ACP Connector/official-kernel/proxy.d.ts +14 -0
  76. package/dist/ACP Connector/official-kernel/proxy.js +197 -0
  77. package/dist/ACP Connector/official-kernel/proxy.js.map +1 -0
  78. package/dist/ACP Connector/official-kernel/run.d.ts +8 -0
  79. package/dist/ACP Connector/official-kernel/run.js +22 -0
  80. package/dist/ACP Connector/official-kernel/run.js.map +1 -0
  81. package/dist/ACP Connector/official-kernel/spawn.d.ts +5 -0
  82. package/dist/ACP Connector/official-kernel/spawn.js +33 -0
  83. package/dist/ACP Connector/official-kernel/spawn.js.map +1 -0
  84. package/dist/Admission Controller/controller.d.ts +338 -0
  85. package/dist/Admission Controller/controller.js +2089 -0
  86. package/dist/Admission Controller/controller.js.map +1 -0
  87. package/dist/Admission Controller/key-derivation.d.ts +24 -0
  88. package/dist/Admission Controller/key-derivation.js +141 -0
  89. package/dist/Admission Controller/key-derivation.js.map +1 -0
  90. package/dist/Admission Controller/key-store.d.ts +8 -0
  91. package/dist/Admission Controller/key-store.js +280 -0
  92. package/dist/Admission Controller/key-store.js.map +1 -0
  93. package/dist/Admission Controller/policy-limits.d.ts +6 -0
  94. package/dist/Admission Controller/policy-limits.js +11 -0
  95. package/dist/Admission Controller/policy-limits.js.map +1 -0
  96. package/dist/Admission Controller/process-evidence.d.ts +111 -0
  97. package/dist/Admission Controller/process-evidence.js +549 -0
  98. package/dist/Admission Controller/process-evidence.js.map +1 -0
  99. package/dist/Admission Controller/runtime-config.d.ts +23 -0
  100. package/dist/Admission Controller/runtime-config.js +86 -0
  101. package/dist/Admission Controller/runtime-config.js.map +1 -0
  102. package/dist/Admission Controller/schema.d.ts +12 -0
  103. package/dist/Admission Controller/schema.js +422 -0
  104. package/dist/Admission Controller/schema.js.map +1 -0
  105. package/package.json +72 -0
  106. package/scripts/prepare-admission-state-dir.mjs +62 -0
  107. package/scripts/prepare-official-kernel-compat.mjs +387 -0
package/README.md ADDED
@@ -0,0 +1,571 @@
1
+ <div align="center">
2
+
3
+ # 🔌 paseo-agy-acp
4
+
5
+ **Paseo × Antigravity — official ACP kernel, Paseo-ready product adapter**
6
+
7
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](./LICENSE)
8
+ [![Version](https://img.shields.io/badge/version-2.2.0-blue?style=flat-square)](./package.json)
9
+ [![Node](https://img.shields.io/badge/node-%3E%3D22-brightgreen?style=flat-square)](#)
10
+ [![ACP](https://img.shields.io/badge/ACP-NDJSON%20v1-8A2BE2?style=flat-square)](https://agentclientprotocol.com)
11
+
12
+ </div>
13
+
14
+ <div align="center">
15
+
16
+ [🇺🇸 English](./README.md) | [🇨🇳 中文](./README.zh-CN.md)
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ `paseo-agy-acp` is the Paseo-facing ACP product for Google Antigravity. From
23
+ **2.1.0.0** it runs Google's official Antigravity ACP kernel (`agy_acp_server` /
24
+ Registry id `antigravity-acp`) as a thin NDJSON proxy, then adds the Paseo
25
+ behavior that Generic ACP does not provide on its own: daemon context, session
26
+ mode mapping, MCP rewrite, product identity, and an account-wide Admission
27
+ queue so the Paseo main controller can delegate many Antigravity agents without
28
+ a startup stampede.
29
+
30
+ **2.2.0** (GitHub tag `v2.2.0.0`) still uses the same official ACP kernel. It only adds an explicit
31
+ **local opt-in** compatibility layer: entitled Claude 4.6 and GPT-OSS 120B can
32
+ complete turns on this path. If you do not opt in, the official path supports
33
+ Gemini-family models only by default.
34
+
35
+ > **Not official Paseo support. Not official Google support.**
36
+ > Community-maintained product. Use at your own risk.
37
+
38
+ ## 30-second summary
39
+
40
+ If you use Paseo with Google Antigravity, `paseo-agy-acp` gives Paseo a
41
+ product-ready path to Google's official Antigravity ACP kernel. It keeps the
42
+ model work inside the official kernel and adds the Paseo-side behavior that a
43
+ Generic ACP bridge does not provide:
44
+
45
+ - daemon context injection
46
+ - session mode mapping
47
+ - MCP `http` to official `sse` rewrite
48
+ - stable product identity
49
+ - burst-safe account-wide Admission queue for multi-agent delegation
50
+ - local opt-in for Claude 4.6 and GPT-OSS 120B; without it, Gemini-family only
51
+
52
+ ## Who this is for
53
+
54
+ Use this if:
55
+
56
+ - you run Paseo
57
+ - you have Google Antigravity installed and authenticated locally
58
+ - you want Antigravity available through Generic ACP
59
+ - you delegate multiple agents and want startup bursts paced instead of stampeded
60
+ - you want Claude 4.6 or GPT-OSS 120B through Paseo on the official ACP kernel (local opt-in)
61
+
62
+ This is probably not for you if:
63
+
64
+ - you do not use Paseo
65
+ - you want a standalone Antigravity replacement
66
+ - you expect this package to redistribute Google's proprietary kernel
67
+
68
+ ## Quickstart
69
+
70
+ Prerequisites: **Node.js >= 22** and a locally installed official Antigravity
71
+ ACP kernel. The `--login` step below completes official OAuth (`authenticate` /
72
+ `oauth-personal`). Set `PASEO_AGY_ACP_OFFICIAL_BIN` when your official kernel is
73
+ not at the maintainer host's pinned default path.
74
+
75
+ The npm package is `paseo-agy-acp@2.2.0` (same product as GitHub `v2.2.0.0`;
76
+ npm requires 3-part semver). It does **not** ship Google's `.par`.
77
+
78
+ ```bash
79
+ export PASEO_AGY_ACP_OFFICIAL_BIN="/absolute/path/to/agy_acp_server.par-or-wrapper"
80
+ npx -y paseo-agy-acp@2.2.0 --login
81
+
82
+ export AGY_ACP_STATE_DIR="$HOME/.local/state/paseo-agy-acp/default"
83
+ install -d -m 700 "$AGY_ACP_STATE_DIR"
84
+ npx -y --package=paseo-agy-acp@2.2.0 agy-acp-prepare-state "$AGY_ACP_STATE_DIR"
85
+ export AGY_ACP_ADMISSION_ENABLED=true
86
+
87
+ npx -y paseo-agy-acp@2.2.0
88
+ ```
89
+
90
+ Point Paseo's Generic ACP provider at `npx` (see [Paseo provider config](#paseo-provider-config)).
91
+ Claude / GPT-OSS: see [§1](#1-official-agy-acp-kernel-capabilities) and the
92
+ [runbook](docs/operations/official-kernel-compat-runbook.md). Source checkout
93
+ (`git clone` + `npm ci` + `npm run build`) remains available under
94
+ [Install](#install).
95
+
96
+ ## About
97
+
98
+ This repository is a **product adapter**, not a second Antigravity. The kernel
99
+ does the model work; this repo makes that kernel **safe and complete for Paseo**.
100
+
101
+ | Highlight | Why it matters |
102
+ |---|---|
103
+ | **Official ACP kernel** | Native ACP over NDJSON. Without opt-in the official path supports Gemini only. Local opt-in adds entitled Claude 4.6 and GPT-OSS 120B. |
104
+ | **Paseo-ready out of the box** | Daemon `appendSystemPrompt`, mode ids Paseo already sends, and MCP `http` servers are rewritten so Generic ACP agents can talk to Antigravity without extra glue. |
105
+ | **Burst-safe delegation** | An account-wide durable Admission queue paces `session/prompt` so Paseo's main controller can dispatch many Antigravity agents without every turn hitting the kernel at once. |
106
+ | **Production-tested defaults** | Default **8 shared seats / 8 concurrent starts / 2s interval**, from live Paseo dispatch (including a 10-agent burst) plus isolated stress. Integers **≥ 1** can probe higher; this repo does **not** invent a product ceiling. |
107
+ | **Fail-closed operations** | Bad env, policy splits, and unprovable writes fail closed. Queue timeout, cancel, and kernel errors stay distinguishable. |
108
+ | **Empty-turn guard** | An official `end_turn` with no visible assistant/tool output becomes a JSON-RPC error, so Paseo does not record a silent success. |
109
+ | **Clean license split** | This repo stays **Apache-2.0**. The official kernel is proprietary: we **spawn** the binary you already installed; npm does **not** ship the ~1.5GiB `.par`. |
110
+
111
+ ```text
112
+ Paseo Generic ACP (NDJSON)
113
+ → paseo-agy-acp product proxy
114
+ identity · daemon context · mode map · MCP rewrite · Admission fence
115
+ → official agy_acp_server (NDJSON)
116
+ ```
117
+
118
+ | Layer | License | What we do |
119
+ |---|---|---|
120
+ | **This repository** (proxy, Admission, Paseo context) | **Apache-2.0** | Keep Apache-2.0. We are **not** relicensing. |
121
+ | **Official ACP kernel** (`agy_acp_server.par` / `antigravity-acp`) | **Proprietary** | Spawn the kernel on the local machine. Do not redistribute it. |
122
+ | **ACP protocol / `@agentclientprotocol/sdk`** | Separate Apache-2.0 ecosystem | Not required at runtime for the official NDJSON proxy. |
123
+
124
+ ---
125
+
126
+ ## 1. Official `agy-acp` kernel capabilities
127
+
128
+ The product **does not reimplement** Antigravity. It starts Google's native ACP
129
+ server and forwards Agent Client Protocol NDJSON. The table below is the
130
+ **official kernel** surface, as seen through that protocol.
131
+
132
+ | Area | What the official kernel provides |
133
+ |---|---|
134
+ | Protocol | Native **ACP v1 over NDJSON** |
135
+ | Auth | `authenticate` with `methodId=oauth-personal` (OAuth inside the kernel) |
136
+ | Session lifecycle | `initialize`, `session/new`, `session/prompt`, `session/cancel`, `session/set_mode`, `session/set_config_option` |
137
+ | Streaming | `session/update`: assistant text, thoughts, tool calls / tool updates |
138
+ | Live session modes | `default`, `auto_edit`, `yolo` (official has **no** plan mode) |
139
+ | Tools | File edits, shell/terminal, and other Antigravity tools as Google implements them |
140
+ | MCP | Official MCP client; servers are declared on `session/new` |
141
+ | Models | Without opt-in: Gemini-family only. With local opt-in: entitled Claude 4.6 and GPT-OSS 120B ([§2](#2-paseo-adaptations)). |
142
+ | Turn completion | Official `end_turn` / stop reasons |
143
+
144
+ ### Models
145
+
146
+ Without opt-in, the official ACP path supports **Gemini-family models only**.
147
+ The Antigravity IDE can already list Claude 4.6 and GPT-OSS 120B for entitled
148
+ accounts; on this ACP path those requests are still shaped for Gemini (JSON
149
+ Schema, tool-call ids, GPT generation config), so they are not a default
150
+ working set.
151
+
152
+ Local opt-in (same official kernel) is [§2](#2-paseo-adaptations). Operator
153
+ steps: [runbook](docs/operations/official-kernel-compat-runbook.md).
154
+
155
+ Tool quality, image generation, and provider 503/quota text are owned by the
156
+ official kernel and Google's backend. This product **proxies** that surface.
157
+
158
+ ---
159
+
160
+ ## 2. Paseo adaptations
161
+
162
+ These are the **Paseo-side** layers on top of the official kernel — the reason
163
+ this repository exists.
164
+
165
+ | # | Adaptation | What it does |
166
+ |---|---|---|
167
+ | 1 | Product identity | `initialize` `agentInfo` is overlaid as `agy-acp` / `paseo-agy-acp` so Paseo sees a stable product name. |
168
+ | 2 | Daemon context bridge | When `PASEO_AGENT_ID` is set, Paseo daemon `appendSystemPrompt` is injected into official `session/prompt`, so workspace/agent context reaches Antigravity. |
169
+ | 3 | Session mode mapping | Paseo / legacy ids map onto official live modes: `accept-edits` → `auto_edit`, `dangerously-skip-permissions` → `yolo`, `plan` → `default`. |
170
+ | 4 | MCP `http` → `sse` | Paseo often hands MCP servers as `type: "http"` plus a header map. The official kernel wants `sse` and `{name,value}` header arrays. The proxy rewrites that on `session/new`. |
171
+ | 5 | Admission fence | When Admission is enabled, each official `session/prompt` takes a durable account-wide seat **before** the kernel write; the seat is released when the turn finishes, fails, or is cancelled. |
172
+ | 6 | Blank-turn guard | Official `end_turn` with **no** visible assistant/tool output is returned as a JSON-RPC error (`-32000`) instead of an empty successful turn. |
173
+ | 7 | Isolated Admission ledger | Official-kernel queue state lives under `$AGY_ACP_STATE_DIR/official-kernel`, separate from any historical ledger. |
174
+ | 8 | Single kernel | `PASEO_AGY_ACP_KERNEL=legacy` and `--legacy-kernel` fail closed. Official is the only ACP execution path. |
175
+ | 9 | Local model compatibility (opt-in) | Same official kernel: local unpack + request transforms so entitled Claude 4.6 and GPT-OSS 120B can complete turns. Off until you opt in. |
176
+
177
+ `PASEO_HOME` is optional and falls back to `~/.paseo` when unset or empty.
178
+ Paseo typically provides `PASEO_AGENT_ID` (and `PASEO_AGENT_CWD`) to ACP
179
+ provider processes.
180
+
181
+ ### Local opt-in: Claude 4.6 and GPT-OSS 120B
182
+
183
+ **2.2.0 still uses the same official ACP kernel.** It only adds this layer.
184
+ If you do not opt in, the official path supports Gemini-family models only.
185
+
186
+ Opt-in is **local** and **explicit**:
187
+
188
+ 1. Pin the official RC01 artifacts already on the machine (hash-checked; mismatch fail-closes).
189
+ 2. Unpack them **only on this host**. npm and git do **not** ship Google's `.par` or runfiles.
190
+ 3. Load `paseo_model_compat.py`: keep models that are both in the live CCPA catalog **and** in the local profile; transform tool JSON Schema (`$schema`, `parameters`), pair tool-call ids, apply GPT-OSS generation config. Gemini and unknown ids stay identity (no extra transform).
191
+ 4. `prepare` → `verify` → lifecycle `activate`, then set `PASEO_AGY_ACP_OFFICIAL_BIN` to the **stable** wrapper (`agy-acp-kernel-compat-active` / `status.stableWrapperPath`). Do not point production at the per-release smoke wrapper.
192
+
193
+ Commands: `agy-acp-prepare-official-kernel-compat` (or
194
+ `node ./scripts/prepare-official-kernel-compat.mjs`). Exact flags, JSON keys,
195
+ and rollback: [runbook](docs/operations/official-kernel-compat-runbook.md).
196
+
197
+ Maintainer-host checks with live entitlement: `claude-sonnet-4-6`,
198
+ `claude-opus-4-6-thinking`, `gpt-oss-120b-medium` — text, sequential tools,
199
+ warm resume. Your account must still list those ids in raw CCPA.
200
+
201
+ Please test Claude and GPT-OSS on your machine (one agent and several). If a
202
+ model is missing, a turn fails, or tools misbehave,
203
+ [open an Issue](https://github.com/tiezbro/paseo-agy-acp/issues). We will use
204
+ that to prioritize fixes.
205
+
206
+ ---
207
+
208
+ ## 3. Why the Admission queue exists
209
+
210
+ ### Background
211
+
212
+ Paseo is a **main controller**. It routinely **delegates many Antigravity
213
+ agents at once**. Under that burst, neighboring high concurrency used to
214
+ strand turns: empty assistant bubbles, hangs, or ACP **Internal Error
215
+ `-32603`**. The historical **3+1** fence (3 shared active seats, 1 concurrent
216
+ start, 2s start interval) was a bleed-stop for that failure mode — not a
217
+ measured official ACP maximum.
218
+
219
+ On the official kernel we production-tested **8 shared seats / 8 concurrent
220
+ starts / 2s interval**, including a 10-agent Antigravity dispatch that did not
221
+ reproduce the old hang. Isolated stress on `127.0.0.1:6768` (6 concurrent yolo
222
+ agents) also did not reproduce it. Official ACP is still **not** proven
223
+ unlimited. **8 is a tested default, not a published product ceiling.**
224
+
225
+ ### Principle
226
+
227
+ ```text
228
+ Paseo main controller
229
+ delegates many Antigravity agents
230
+ |
231
+ v
232
+ account-wide durable Admission queue
233
+ |
234
+ shared active seats (default 8)
235
+ paced concurrent starts (default 8, ≥ 2s apart)
236
+ |
237
+ official session/prompt write
238
+ |
239
+ seat released on turn end / failure / cancel
240
+ ```
241
+
242
+ Extra turns **wait in the queue** instead of all hitting `agy_acp_server` at
243
+ once. The queue is oldest-eligible with agent fairness, durable across
244
+ connector processes, and fail-closed on bad env (non-integers, values `< 1`,
245
+ start interval `< 2000ms`). Independent Paseo agents that share one state
246
+ directory share one account pool — they cannot multiply concurrency by
247
+ accident.
248
+
249
+ ### Advantage
250
+
251
+ The point is **not** to permanently cap Paseo at 3 agents. The point is to
252
+ keep **Paseo → Antigravity delegation steadier**:
253
+
254
+ - The main controller can still dispatch a burst.
255
+ - Surplus work queues instead of stampeding the official kernel.
256
+ - Seats are account-wide across connector processes and restarts.
257
+ - Queue timeout, cancel, and kernel errors remain distinguishable from a crash.
258
+ - Operators can raise seat/start integers (**≥ 1**) to probe higher
259
+ concurrency and report what they find.
260
+
261
+ That is why Admission stays in the product after the official-kernel switch.
262
+
263
+ ---
264
+
265
+ ## Admission Controller v2
266
+
267
+ Admission is the operational implementation of the queue above: durable seats,
268
+ paced starts, recovery, and typed terminals. It is **opt-in** via env
269
+ (`AGY_ACP_ADMISSION_ENABLED=true` plus an absolute `AGY_ACP_STATE_DIR` and a
270
+ valid `PASEO_AGENT_ID`). Recommended for any Paseo host that delegates more
271
+ than one Antigravity agent.
272
+
273
+ ### Enabling Admission
274
+
275
+ Create one owner-only state directory per Antigravity account and run the
276
+ packaged preflight:
277
+
278
+ ```bash
279
+ export AGY_ACP_STATE_DIR="$HOME/.local/state/paseo-agy-acp/account-name"
280
+ install -d -m 700 "$AGY_ACP_STATE_DIR"
281
+ agy-acp-prepare-state "$AGY_ACP_STATE_DIR"
282
+ export AGY_ACP_ADMISSION_ENABLED=true
283
+ ```
284
+
285
+ The preflight creates a missing directory with mode `0700` and verifies type,
286
+ owner, and exact mode. It **rejects** an existing permissive directory instead
287
+ of silently chmod-ing it. After you confirm path and ownership, run
288
+ `chmod 700 -- "$AGY_ACP_STATE_DIR"` and rerun the preflight. Admission key and
289
+ SQLite files are created with mode `0600`.
290
+
291
+ Official-kernel queue files are written under
292
+ `$AGY_ACP_STATE_DIR/official-kernel` so they cannot share a ledger with a
293
+ historical install.
294
+
295
+ ### Default and conservative policy
296
+
297
+ | Rule | Default | Override |
298
+ |---|---:|---|
299
+ | Shared active seats | **8** (tested) | `AGY_ACP_ADMISSION_MAX_ACTIVE_TURNS` — integer **≥ 1** |
300
+ | Concurrent starts | **8** (tested) | `AGY_ACP_ADMISSION_MAX_CONCURRENT_STARTS` — integer **≥ 1** |
301
+ | Minimum start interval | **2000 ms** | `AGY_ACP_ADMISSION_MIN_START_INTERVAL_MS` — integer **≥ 2000** |
302
+ | Queue timeout | 30 minutes | `AGY_ACP_ADMISSION_QUEUE_TIMEOUT_MS` — integer `1`–`1800000` |
303
+ | Capacity cooldown | 30 seconds | `AGY_ACP_ADMISSION_CAPACITY_COOLDOWN_MS` — integer **≥ 30000** |
304
+
305
+ Every local connector using the same state directory shares those account
306
+ seats across sessions and models. Requests are selected oldest-eligible with
307
+ agent fairness. A trusted provider-capacity failure pauses only the affected
308
+ provider/model. Queue timeout cancels the request and deletes its encrypted
309
+ prompt in the same transaction.
310
+
311
+ Overrides are fail-closed: non-integers, values `< 1`, and start intervals
312
+ below 2000 ms refuse to start. This repo does **not** publish a product
313
+ maximum; raise the integers to probe, and please report results.
314
+
315
+ Optional tighter fence (historical 3+1), **not** the recommended default:
316
+
317
+ ```bash
318
+ AGY_ACP_ADMISSION_MAX_ACTIVE_TURNS=3
319
+ AGY_ACP_ADMISSION_MAX_CONCURRENT_STARTS=1
320
+ ```
321
+
322
+ Soft drain can reduce seats without killing in-flight work or dropping the
323
+ queue.
324
+
325
+ ### Durability, dispatch, and recovery
326
+
327
+ The local implementation uses `shared-admission-queue` **schema v3**. Durable
328
+ policy (`policy_state` / `policy_fingerprint`), queued owner instances, leases
329
+ with suspect metadata for the runtime reaper, and `schema_migrations` live in
330
+ one SQLite ledger. Unexpected delivery-authority tables still fail closed.
331
+
332
+ Each enabled runtime opener claims or verifies that durable policy before
333
+ startup recovery. A second connector on the same directory with a **different**
334
+ policy fails closed rather than splitting policy per process.
335
+
336
+ Idle sessions consume no seat and keep no resident turn process. An admitted
337
+ turn uses a fenced one-shot `session/prompt` write; unprovable writes become
338
+ `dispatch_ambiguous` or `recovery_required` instead of a silent replay.
339
+ Heartbeat, owner identity, and the runtime reaper release capacity only when
340
+ an owner is proven dead. Closing a session cancels queued work; an already
341
+ running turn follows the connector cancel path (`session/cancel`).
342
+
343
+ Admission does **not** add a second live-output path, outbox, ACK protocol,
344
+ terminal replay, or manual requeue API. Official session history remains an
345
+ ACP Connector / kernel responsibility.
346
+
347
+ ### Design authority and implementation boundary
348
+
349
+ Current authority is the confirmed Scheme plus accepted Stage 2 artifacts
350
+ (see [Authority documents](#authority-documents-v2000-closeout) below). The
351
+ legacy admission design file is historical input only.
352
+
353
+ The repository has exactly two source areas:
354
+
355
+ ```text
356
+ paseo-agy-acp/
357
+ |-- ACP Connector/ ACP NDJSON proxy, official kernel spawn, Paseo context
358
+ `-- Admission Controller/ durable seats, queue, policy, paced starts, recovery
359
+ ```
360
+
361
+ `ACP Connector/` owns protocol, identity, mode/MCP rewrites, kernel spawn, and
362
+ the Admission fence around `session/prompt`. `Admission Controller/` owns only
363
+ the shared seat pool, durable queue, policy ledger, leases, reaper, and
364
+ capacity cooldown. Package entrypoints stay inside `ACP Connector/`.
365
+
366
+ ---
367
+
368
+ ## Requirements
369
+
370
+ - **Node.js >= 22**
371
+ - **Official Antigravity ACP kernel** installed locally. Maintainer-host
372
+ default pin:
373
+
374
+ `~/.local/opt/agy-acp-server-agy_acp_server_20260818_01_RC01/agy-acp-server-canary`
375
+
376
+ Override with `PASEO_AGY_ACP_OFFICIAL_BIN`. If the path is the `.par` itself,
377
+ the process `cd`s into that directory and execs with `--uid=` (required on
378
+ hosts without a usable group, e.g. `nogroup`).
379
+
380
+ - Completed official `authenticate` (`methodId=oauth-personal`). Tokens stay in
381
+ the kernel's own state; this repo never prints them.
382
+
383
+ ## Install
384
+
385
+ Preferred (after this version is on npmjs):
386
+
387
+ ```bash
388
+ npx -y paseo-agy-acp@2.2.0 --login
389
+ ```
390
+
391
+ Bins: `paseo-agy-acp` / `agy-acp` (ACP proxy), `agy-acp-prepare-state`,
392
+ `agy-acp-prepare-official-kernel-compat`. First `npx` may compile
393
+ `better-sqlite3` (needs a local C++ toolchain).
394
+
395
+ Source checkout:
396
+
397
+ ```bash
398
+ git clone https://github.com/tiezbro/paseo-agy-acp.git
399
+ cd paseo-agy-acp
400
+ npm ci
401
+ npm run build
402
+ npm test
403
+ ```
404
+
405
+ ```bash
406
+ # ACP initialize smoke (requires the official binary)
407
+ printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1}}' \
408
+ | npx -y paseo-agy-acp@2.2.0
409
+ ```
410
+
411
+ Login (official kernel OAuth):
412
+
413
+ ```bash
414
+ npx -y paseo-agy-acp@2.2.0 --login
415
+ ```
416
+
417
+ ## Environment
418
+
419
+ | Variable | Purpose |
420
+ |---|---|
421
+ | `PASEO_AGY_ACP_OFFICIAL_BIN` | Official kernel wrapper or `.par` path |
422
+ | `PASEO_AGENT_ID` | Enables daemon context + Admission agent binding |
423
+ | `PASEO_HOME` | Optional Paseo home; falls back to `~/.paseo` |
424
+ | `AGY_ACP_ADMISSION_ENABLED` | `true` / `1` to fence prompts through Admission |
425
+ | `AGY_ACP_STATE_DIR` | Admission state directory (official runtime uses `official-kernel/` under it) |
426
+ | `AGY_ACP_ADMISSION_MAX_ACTIVE_TURNS` | Shared active seats. Integer **≥ 1**. Default **8** (tested). |
427
+ | `AGY_ACP_ADMISSION_MAX_CONCURRENT_STARTS` | Concurrent starts. Integer **≥ 1**. Default **8** (tested). |
428
+ | `AGY_ACP_ADMISSION_MIN_START_INTERVAL_MS` | Minimum start spacing. Default **2000**; values below 2000 fail closed. |
429
+ | `AGY_ACP_ADMISSION_QUEUE_TIMEOUT_MS` | Queue wait budget. Default 30 minutes; max 1800000. |
430
+ | `AGY_ACP_ADMISSION_CAPACITY_COOLDOWN_MS` | Provider/model cooldown after a trusted capacity failure. Default 30000; minimum 30000. |
431
+
432
+ `PASEO_AGY_ACP_KERNEL=legacy` and `--legacy-kernel` fail closed.
433
+
434
+ ## Architecture
435
+
436
+ ```text
437
+ Paseo / Generic ACP client
438
+ └─ paseo-agy-acp (agy-acp)
439
+ ├─ product proxy: identity, daemon context, mode map, MCP rewrite
440
+ ├─ Admission fence on session/prompt (optional, recommended)
441
+ └─ official agy_acp_server (NDJSON)
442
+ └─ Antigravity account, tools, MCP, models
443
+ ```
444
+
445
+ One official kernel child per connector process. Admission coordinates
446
+ **account-wide** seats across those processes through the durable ledger.
447
+
448
+ ## Paseo provider config
449
+
450
+ ```json
451
+ {
452
+ "providers": {
453
+ "antigravity": {
454
+ "type": "acp",
455
+ "command": ["npx", "-y", "paseo-agy-acp@2.2.0"],
456
+ "env": {
457
+ "PASEO_AGY_ACP_OFFICIAL_BIN": "/home/YOU/.local/opt/agy-acp-server-agy_acp_server_20260818_01_RC01/agy-acp-server-canary",
458
+ "AGY_ACP_ADMISSION_ENABLED": "true",
459
+ "AGY_ACP_STATE_DIR": "/home/YOU/.local/state/paseo-agy-acp/account-name"
460
+ }
461
+ }
462
+ }
463
+ }
464
+ ```
465
+
466
+ When `command` is `node`, pass
467
+ `["/path/to/paseo-agy-acp/dist/ACP Connector/main.js"]` as `args`.
468
+ Paseo supplies `PASEO_AGENT_ID` to the provider process.
469
+
470
+ Restart the Paseo daemon after changing the provider so idle Antigravity
471
+ agents pick up the new binary.
472
+
473
+ ## Setup prompt
474
+
475
+ Paste into any Paseo agent to install or repair the Antigravity provider:
476
+
477
+ ~~~
478
+ Configure the Paseo daemon to add an ACP provider for Google Antigravity.
479
+
480
+ 1. Read Paseo config ($PASEO_HOME/config.json or ~/.paseo/config.json).
481
+ 2. Add or update providers.antigravity:
482
+ - type: "acp"
483
+ - command: ["npx", "-y", "paseo-agy-acp@2.2.0"]
484
+ - env.PASEO_AGY_ACP_OFFICIAL_BIN: local official kernel wrapper (agy-acp-server-canary or agy_acp_server.par)
485
+ - env.AGY_ACP_ADMISSION_ENABLED: "true"
486
+ - env.AGY_ACP_STATE_DIR: absolute owner-only directory (mode 0700)
487
+ 3. Prepare Admission state: npx -y --package=paseo-agy-acp@2.2.0 agy-acp-prepare-state "$AGY_ACP_STATE_DIR"
488
+ 4. Login once: npx -y paseo-agy-acp@2.2.0 --login
489
+ 5. Restart the Paseo daemon.
490
+ 6. Verify: create a test agent with provider "antigravity", send a simple prompt.
491
+ ~~~
492
+
493
+ ## Verification
494
+
495
+ ```bash
496
+ # Smoke test (needs the official binary)
497
+ printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1}}' \
498
+ | node 'dist/ACP Connector/main.js'
499
+
500
+ # Full suite
501
+ npm test
502
+ ```
503
+
504
+ Canary checklist: daemon context on a real Paseo agent, multi-turn, MCP server
505
+ declared as `http`, mode `dangerously-skip-permissions` → official `yolo`,
506
+ Admission queue under a small seat cap, blank-turn rejection.
507
+
508
+ `2.1.0.0` isolated canary on `127.0.0.1:6768` proved the product proxy +
509
+ official kernel + daemon context.
510
+
511
+ ## Known issues
512
+
513
+ - Please test Claude 4.6 and GPT-OSS 120B after opt-in and
514
+ [file issues](https://github.com/tiezbro/paseo-agy-acp/issues) if anything is
515
+ unstable. We will use that to prioritize fixes.
516
+ - Official RC01 active cancel was not confirmed in our harness; live 503/quota
517
+ was not induced against real backends.
518
+ - The official kernel binary must already be installed; this package does not
519
+ vendor it.
520
+ - Admission is off until `AGY_ACP_ADMISSION_ENABLED`, `AGY_ACP_STATE_DIR`, and
521
+ `PASEO_AGENT_ID` are all valid. Discovery/`--login` without an agent id does
522
+ not open the ledger.
523
+ - Official ACP has no plan mode; Paseo `plan` maps to `default`.
524
+ - Image generation and live provider 503 text are owned by the official kernel.
525
+ This adapter does not claim those have been re-verified here.
526
+ - Raw-prompt tests can see prepended daemon context when `PASEO_AGENT_ID`
527
+ points at a live Paseo agent:
528
+
529
+ ```bash
530
+ env -u PASEO_AGENT_ID -u PASEO_HOME npm test
531
+ ```
532
+
533
+ ## Upgrade / Rollback
534
+
535
+ ```bash
536
+ # Upgrade
537
+ git pull && npm ci && npm run build && npm test
538
+
539
+ # Rollback
540
+ git checkout <rev> && npm ci && npm run build && npm test
541
+ ```
542
+
543
+ Point the daemon at the desired `agy-acp` binary or
544
+ `dist/ACP Connector/main.js` entrypoint and restart. After an Admission policy
545
+ change (for example 3+1 → 8/8), use a **fresh** `AGY_ACP_STATE_DIR` if the
546
+ durable fingerprint would fail-close the new policy.
547
+
548
+ ## Authority documents (v2.0.0.0 closeout)
549
+
550
+ - [confirmed Scheme](/home/tiezbro/projects/MAACS/docs/maacs-paseo-agy-acp-confirmed-scheme.md)
551
+ - [Stage 2 handoff](docs/design/v2.0.0.0-stage2-handoff.md)
552
+ - [503 feasibility](docs/design/v2.0.0.0-stage2-503-feasibility.md)
553
+ - [ACP source map](docs/design/v2.0.0.0-stage2-acp-source-map.md)
554
+ - [Admission source map](docs/design/v2.0.0.0-stage2-admission-source-map.md)
555
+ - [Architecture](docs/design/v2.0.0.0-stage2-architecture.md)
556
+ - [Domain model](docs/design/v2.0.0.0-stage2-domain-model.md)
557
+ - [Test contracts](docs/design/v2.0.0.0-stage2-test-contracts.md)
558
+ - [Specification](docs/design/v2.0.0.0-stage2-spec.md)
559
+
560
+ → [Local technical notes](./docs/PASEO_LOCAL_CHANGES.md)
561
+
562
+ ## Disclaimer
563
+
564
+ The official kernel is governed by
565
+ [Google Antigravity Terms](https://antigravity.google/terms). This product
566
+ spawns that kernel; it does not reimplement or redistribute it.
567
+
568
+ Third-party tools for Antigravity may violate those terms and risk account
569
+ suspension. Prefer official API keys. Test/secondary accounts only.
570
+
571
+ **AS IS, NO WARRANTY. USE AT YOUR OWN RISK.**