Repository navigation
feat(acp): add google-agy-acp provider backed by agy acp - #228
Draft
anthonyhaussman wants to merge 32 commits into
Draft
anthonyhaussman wants to merge 32 commits into
anthonyhaussman wants to merge 32 commits into
Conversation
Gate fails: agy built-ins cannot be disabled while client MCP tools stay exposed. Records MCP timeout, usage shape and hook. Assisted-by: Claude Sonnet 5.5
Restricted agent plus plugin stdio MCP bridge removes mutating built-ins and keeps bridge tools callable via call_mcp_tool. Assisted-by: Claude Sonnet 5.5
Remove the v1 plugin and its tests; the default export is now the v2 plugin definition only. OpenCode >= 2.2.3 is required. BREAKING CHANGE: OpenCode v1 is no longer supported. Assisted-by: Claude Sonnet 5.5
Add ACP constants and agy binary resolution/version probing. Assisted-by: Claude Sonnet 5.5
Assisted-by: Claude Sonnet 5.5
Add AgyAcpProcess (spawn, initialize/authenticate, session setup, prompt, idle kill, exit handling, permission dispatch), buildAgyEnv, and AgyProcessPool with shared in-flight creation. Assisted-by: Claude Sonnet 5.5
Add an authenticated loopback MCP server that exposes OpenCode tools to agy, a PendingTools registry that binds bridge tools/call requests to tool calls seen in the ACP stream, and a node:-only stdio proxy that agy launches to reach the bridge. Assisted-by: Claude Sonnet 5.5
Strip $schema and tolerate uncompilable tool schemas instead of failing start(), and replace the transport on a repeated initialize so a respawned proxy or second client is not locked out. Assisted-by: Claude Sonnet 5.5
Assisted-by: Claude Sonnet 5.5
Add StreamMapper, tool call classification, stop reason and usage mapping. Add @ai-sdk/provider dependency for V3 types. Assisted-by: Claude Sonnet 5.5
Persist OpenCode to agy session records and decide fresh, continue, catch-up or changed per prompt. Assisted-by: Claude Sonnet 5.5
Drive one long-lived agy acp process per OpenCode session, exposing OpenCode tools through the MCP bridge with permission gating, soft-timeout late results and classified agy errors. Assisted-by: Claude Opus 5.5
Wait at most CANCEL_SETTLE_TIMEOUT_MS for a cancelled agy turn, honoring the caller's abort signal, then respawn agy. Serialize steps per OpenCode session so overlapping streams never share one turn queue. Assisted-by: Claude Opus 5.5
Wire the agy ACP backend into OpenCode v2: catalog entries with low/medium/high tier variants, four auth methods (agy Google login, Gemini Enterprise, Gemini API key, Vertex ADC), the aisdk sdk hook that supplies AgyAcpLanguageModel, model.request header stamping and disabled OpenCode retries. The binary probe runs at registration and on credential switch; the agy plugin installs lazily on the first turn. Assisted-by: Claude Opus 5.5
Mark the google-agy provider as deprecated and point its Terms of Service warning at google-agy-acp. Rewrite README and AGENTS.md for the v2-only package with the ACP architecture, auth methods, risk disclosures and the agy bump checks. Add a README disclosure test and an opt-in live smoke test. Assisted-by: Claude Sonnet 5.5
agy sends server/discover before initialize on plugin MCP servers. The uninitialized bridge replies with a JSON-RPC error whose id is null, which agy cannot correlate, so it never connected and turns failed with bridge_unreachable. The proxy now copies the request id into such replies. Bump the agy plugin to 1.0.1 and make the live write_file case depend on a passing bridge round trip. Assisted-by: Claude Sonnet 5.5
A current stamp no longer skips install when the materialized bridge-proxy.mjs is gone, so agy never points at a deleted path. Assisted-by: Claude Opus 5.5
OpenCode already saw the tool call, so a validation failure now marks the pending entry soft-timed-out. Its real result arrives as a late tool-result and never feeds a later claim. Assisted-by: Claude Opus 5.5
Any agy exit now closes the bridge, rejects pending calls and drops the pool slot. Auth resolves once per call and the fingerprint includes a hashed credential identity, never the key. Stream cancel no longer releases the session lock early. Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
Parse the command_result line emitted by agy --output-format stream-json models so the provider can discover models from the installed CLI. Assisted-by: Claude Opus 5.5
Replace the on-disk models cache and static fallback model list with an in-memory ModelRegistry that reloads the catalog only when the model list changes. onModels from session/new now feeds the registry. Assisted-by: Claude Opus 5.5
Run `agy models` in the background after the binary probe and register exactly the models it reports. Re-run discovery on identity switch, feed session/new model lists into the same registry, and reload the catalog only when the list changes. No models are exposed when agy is missing, too old, or discovery fails. Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
agy models discovery now runs with the same auth env as live sessions (API key or agent-platform ADC), so the listed models match the account OpenCode uses. A generation counter makes the newest discovery or session/new report win over an older in-flight discovery. Assisted-by: Claude Opus 5.5
A failed or unrecognized `agy models` run now restores the last list that worked for the current account instead of emptying the picker. Lists from session/new count as working. Missing or too-old agy still clears the list, and a new account with no working list shows none. Assisted-by: Claude Opus 5.5
…catalog reload Model lists that arrive after dispose no longer reload the catalog. Hosts without catalog.reload get one startup warning, since model changes only show after a restart there. Assisted-by: Claude Opus 5.5
agy models and session/new can list the same models in a different order. Treat those as unchanged so the catalog does not reload. Assisted-by: Claude Opus 5.5
The fake context now offers catalog.transform and catalog.reload like the OpenCode v2 host, with the older provider/model transform hooks kept behind an opt-in. Fixed 10ms sleeps are replaced by waits on the catalog reload, so absence checks no longer depend on timing. Assisted-by: Claude Opus 5.5
Released OpenCode 2.3.x exposes reload on ctx.provider and ctx.model instead of ctx.catalog, so discovered models never reached the picker. Use catalog.reload when present, else reload both provider and model, and warn only when no reload hook exists. Assisted-by: Claude Opus 5.5
OpenCode 2.x ships as a compiled bun binary, so process.execPath points at opencode.exe. Running it with the bridge script started OpenCode itself instead of the proxy, and agy reported that it never connected to the OpenCode tool bridge. Under bun, write BUN_BE_BUN=1 into the bridge env so the binary behaves as plain bun. Record the launch env in installed.json so existing installs are rewritten. Assisted-by: Claude Opus 5.5
Set AGY_ACP_DEBUG=1 to append spawn, ACP JSON-RPC traffic, stderr and exit events of each agy child to a 0600 log file (AGY_ACP_DEBUG_FILE or the agy-acp data dir). The bridge token and Gemini API key are redacted. Helps diagnose 429 and hang reports that agy alone does not reproduce. Assisted-by: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
google-agy-acp provider
Add a new
google-agy-acpprovider that drives the officialagy acp(Agent Client Protocol) server instead of calling the Code Assist API with a captured OAuth token.Google now disables accounts that use the Antigravity login from third-party tools, so the plugin no longer touches tokens and lets the user's own
agylogin (or a Gemini API key or Vertex) authenticate.Tool bridge and agy plugin
Run every OpenCode tool through a local MCP bridge on 127.0.0.1, protected by a per-session bearer token, which a stdio relay exposes to agy.
On first use the provider installs a small
opencode-bridgeagy plugin with a restricted agent that keeps onlyread_file, so writes, commands, and browser actions all go through OpenCode's own permission system.Session handling
Map ACP session updates to AI SDK stream parts and keep agy sessions in sync with OpenCode history using per-message hashes, a catch-up checkpoint, and a rebuild when history diverges.
Bound cancelled turns, serialize overlapping requests per session, free sessions on idle exit, and respawn when the credential changes.
OpenCode v1 removal
Drop the OpenCode v1
server()integration and its tests, since the new provider needs v2 hooks (aisdk,model.request,integration).Users on OpenCode v1 must upgrade to OpenCode 2.2.3 or later.
Deprecation and documentation
Mark the direct-API
google-agyprovider as deprecated, with its ToS warning now pointing togoogle-agy-acp.Rewrite the README and AGENTS.md for v2 only, disclosing the ToS risk, the global agy plugin install, and that
read_filecan read outside the workspace.Spike findings
Record the agy ACP and agent-plugin spike results in
docs/acp-spike-findings.md, including the root cause of the bridge connection failure, which was the relay replying toserver/discoverwith a null id.Tier-to-thinking-level mapping, the API key path, and some OpenCode TUI behaviours still need manual verification.