Commit Graph
14 Commits
Author SHA1 Message Date
yetone b840915abc agy-cli 0.1.62: magpie's sign-in installs agy where there is none, and the plugin keeps that copy current (niuniu_8964 on X)
In magpie's Docker image there is no agy, so Sign in failed with "agy CLI
not found". The plugin now declares auth.cli (magpie 0.1.4246's hook,
engines.magpie raised to it): when agy isn't found, magpie's sign-in shows
"Installing Antigravity CLI…" and the plugin installs it the way Google's
install.sh does: the same manifest, the download checked against its
sha512, the antigravity binary taken out of the tarball, tried with
--version, then renamed into place. It goes into the data folder
($XDG_DATA_HOME/magpie-agy-cli/agy, ~/.local/share without it,
%LOCALAPPDATA% on Windows), which in the container is on /config, and is
searched last, so an agy the user installed wins. That copy is kept
current a minute after start and every 6 hours, only while it is the one
in use and not when AGY_CLI_DISABLE_AUTO_UPDATE is set.

Also: findAgy handed out a cached path to an agy removed since, so the
sign-in tried to spawn it (ENOENT) instead of installing it; and a write
loop left an error listener per wait (MaxListenersExceededWarning on the
260MB download).

Account code is unchanged.

Run, on mica: bun scripts/check.mjs ok; agy-cli bun test 34/34 under a
temp HOME (install.test.mjs: 10, against a local server). A6b red on the
old findAgy, green now.

Real use in magpie's Docker image (xiaomi-gpu, linux amd64), with magpie
0.1.4246's tree: `magpie plugin login agy-cli 1` and the browser UI's
POST /api/plugin-signin both installed agy 1.5.9 into
/config/data/magpie-agy-cli and went on to agy's Google link; it survived
a restart; agy.version set back to 1.5.0 was updated a minute after start.

Not tried: finishing the Google sign-in in the container, a real install
on macOS, Windows or musl.
2026-11-15 14:55:10 +08:00
yetone f7fc6641c5 agy-cli 0.1.55: with agy's sign-in in a file (no keyring, Docker), agy stays on its own folder (#1165)
0.1.54 (#1166) started agy acp with --gemini-dir pointing at a folder of
the bridge's own, which keeps the machine's skills out. That assumed agy's
Google sign-in lives in the system keyring. Where there is none (a Docker
container, Linux with no D-Bus session), agy keeps it in
~/.gemini/antigravity-cli/antigravity-oauth-token instead. The bridge's
folder had no sign-in, and every request failed "session/new failed:
Authentication required". shawn8888 reported it on #1165 from
ghcr.io/yetone/magpie with agy 1.5.9.

Now, when that file exists and AGY_BRIDGE_GEMINI_DIR names no folder, no
--gemini-dir is passed, and agy uses its own folder and sign-in.
--include-default-customizations=false is still passed. A folder the user
names is still used.

Run (mica, node --test test/repeat-batch.mjs test/usage-settlement.mjs,
temp HOME): 83 pass, 0 fail. bun scripts/check.mjs agy-cli: ok.
Broken by hand: without the file check, the new "#1165 … stays on that
folder" test fails (1 pass, 1 fail).

Not tried: a real Docker container with agy. The token file's path is
the one the reporter saw.
2026-11-15 09:46:03 +08:00
yetone 3238ab8518 agy-cli 0.1.54: agy runs in the bridge's own --gemini-dir, so the machine's skills stay out (#1166)
0.1.52 passed --include-default-customizations=false, but on Windows
(agy 1.5.9) agy still loaded all 120 of the reporter's skills: a 56,790 B
<skills> block in its gen_metadata, and task, shell and four more client
tools dropped over the 20,000-token budget. The reporter (kanzaki-chiya)
found that --gemini-dir pointed at an empty folder of the bridge's own
leaves the skills and global MCP servers out, with every client tool
listed and shell/task calls working end to end.

So when `agy acp --help` lists --gemini-dir, a turn's agy gets
<XDG_STATE_HOME or ~/.local/state>/magpie-agy-bridge/agy-home, made
before agy starts and kept across restarts so session/resume finds the
conversation. agy's Google sign-in is in the system keyring, not that
folder. Step usage reads the conversation DB from the same folder.
AGY_BRIDGE_GEMINI_DIR names another folder; "default" leaves agy on its
own ~/.gemini. The model probe and `agy models` are unchanged. One
`acp --help` per binary answers both flags.

What happens to old data: a session parked before this update was in
~/.gemini, so its resume fails once and falls back to session/new, as a
resume that fails does today.

Run on mote: node --test test/repeat-batch.mjs test/usage-settlement.mjs
(81 pass), bun test in packages/agy-cli (22 pass), bun scripts/check.mjs
agy-cli ok. test/smoke.mjs prints the same 29 BADs and crash at
origin/main df7d7ae0 as with this change (plugins#1070).
Real agy 1.5.9 on macOS, with the user's account: `agy acp --gemini-dir
<empty folder>` initialised, session/new listed the account's six
models, and the session's .db was written under
<folder>/antigravity-cli/conversations, not ~/.gemini.
Broken by hand: with step usage left on ~/.gemini, the new usage test
reads the machine folder's count (9999 != 1800).
Not tried: a real turn on Windows or Linux with this build; the
Windows result is the reporter's, with their own patch of 0.1.52.
2026-11-15 07:45:56 +08:00
yetone 57d1cc6a9f agy-cli: start agy without the machine's own skills when it can (#1166)
On Windows with agy 1.5.9, a session loaded 120 local skills from
~/.gemini/skills, ~/.gemini/config/skills and ~/.agents/skills although
the bridge agent says inheritCustomizations: false. Skills and the
client's MCP tools share agy's 20,000-token customization budget, so
agy dropped the six largest client tools (task, shell, …) and three
skills.

agy 1.5.9's acp takes --include-default-customizations (default true).
The bridge now passes --include-default-customizations=false when
`agy acp --help` lists the flag. An agy without it exits on an unknown
flag, so it is never passed blind. The answer is kept per binary (path,
mtime, size); a probe that errors or times out is asked again. The bare
`agy acp` model probe is unchanged. 0.1.52.

Run:
- bun test packages/agy-cli on mote (temp HOME): 21 pass, 0 fail;
  bun scripts/check.mjs agy-cli ok.
- the same on Windows (win-run, xiaomi-gpu): 21 pass, 0 fail.
- test/smoke.mjs alone with bun on mote: ALL OK (348 checks).
- real agy 1.5.9 on macOS: `agy acp --help` prints the flag on stderr
  (exit 0); a session started with the flag set to false runs.
Broken by hand: without the args.push in Proc.start, repeat-batch's
"#1166 … asked once" test and smoke's #1166 check go red.
Not tried: the reporter's Windows machine with its 120 skills. On this
Mac the default run sent no user skills to the model either, so it is
not shown here that the flag keeps them out; the reporter is asked to
confirm.
2026-11-15 06:43:07 +08:00
yetone 4a64252bd7 agy-cli 0.1.51: one opening sent to several models at once gets an agy each
swang20201 on X: Test models on an agy-cli account gave a check for the
first model and a cross for the other three. magpie's Test sends the same
"hi" opening to up to four models at once. agy-cli keys its agy process by
user, system and first message, not the model, so all four shared one key.
The first started a turn; the others found it unfinished and got 503
"agy bridge: this conversation still has an unfinished response". Not the
account's limits, and not the model ids.

Two changes:
- A fresh opening that finds the key's process busy with a turn for
  another model gets a process of its own (key + request id). The same
  model sent twice while the first runs is still refused as a resend, so
  smoke's "simultaneous startup allows only one live response" holds.
- acquireProc starts the turn (begin) inside the same locks, so a request
  waiting on them sees the earlier turn and is never handed a process
  about to be busy. The turn records its model.

Run:
- New test in test/repeat-batch.mjs, magpie's exact probe body to four
  models at once: red on origin/main 9126c46f (1 x 200, 3 x 503), green
  after.
- Broken by hand: with begin moved back outside the lock the new test is
  red again.
- packages/agy-cli bun test under a temp HOME on mote: 21/21, smoke
  included.
- Whole repo, HOME=$(mktemp -d) bun test and bun scripts/check.mjs on
  mica at this tree: 8849 pass, 0 fail (8869 tests, 617 files), check.mjs ok.
- Real agy 1.5.9 (agy acp), four models at once through the plugin:
  old code 1 x 200 + 3 x 503; this code 4 x 200 at 3.7, 6.0, 9.1 and
  11.2s, inside magpie's 20s test wait.

Not tried: the reporter's models (Gemini 4 Argon/Hydrogen, Claude 5.5).
The account used offers Gemini 3.8 Flash, Claude 4.6 and GPT-OSS only, so
the model id mapping wasn't checked against a list holding those ids.
2026-11-15 04:31:05 +08:00
yetone a617ecfd42 antigravity 0.1.16, agy-cli 0.1.48, cloak 0.1.9: cloak the system prompts Google refuses since 11-14 evening; agy-cli fails a refused turn at once
Since about 18:43 on 11-14 Google's Antigravity backend answers 429
RESOURCE_EXHAUSTED to requests whose system instruction holds certain
agents' identity lines, though the account has quota and the same
request with another prompt passes. Tried on a real account
(gemini-3-flash), each line alone in the system instruction:

- refused now: "You are Hermes Agent", Hermes' earlier persona
  "…an intelligent AI assistant created by Nous Research" (also as
  "You're …"), "You are OpenCode" / "You are opencode", Codex CLI's
  "You are a coding agent running in the Codex CLI", and pi's "You are
  a coding assistant running inside pi".
- pass as written: Codex GPT-6's prompt, Claude Code, Gemini CLI, Qwen
  Code, Cline, Kilo, goose, Amp, Droid, Kimi, Aider, Cursor.

The cloak in antigravity and agy-cli (and the antigravity-cloak
middleware) now rewords each refused line the smallest way that passes:
"You are" -> "You're" for Hermes, OpenCode and Codex CLI, "created by"
-> "built by" for Hermes' earlier persona, "running inside pi" ->
"running within pi". The hint shown with a refusal names the agent
(new pi, OpenCode and Codex CLI hints; Hermes' hint covers both
personas).

agy-cli (@Lmohn39, pi 1.5.0 via agy 1.5.9, hydrogen): when agy prints
its retry banner for a refused 429, agy-cli waited while agy retried
the same refused prompt without end, so pi hung. The turn now fails at
once with the 429 and the existing "this is not a quota" explanation,
the agy process is stopped and dropped from the pool. A 503 banner
still waits as before.

Run:
- root `bun test` with HOME=$(mktemp -d) on mica (mote was over its 18
  cores): 8820 pass, 20 skip, 0 fail, exit 0.
- real account through the patched loader, gemini-3-flash 5/5 each:
  pi 1.5.0's full default prompt (built from its dist/core/system-prompt.js),
  Hermes current and earlier personas, both OpenCode first lines, Codex
  CLI's prompt, Codex GPT-6's prompt. claude-sonnet-4-6: pi 5/5.

Broken by hand:
- the old agy-cli index.mjs makes the new Lmohn39 test red ("still
  waiting after 5s").
- dropping the pi line from TURNED_AWAY turns 6 cloak tests red.

Not tried: a real agy 1.5.9 turn on hydrogen showing the banner (the
banner's wording is the one agy-cli already matched); pi itself end to
end through agy-cli.
2026-11-14 21:40:22 +08:00
yetone 3db6dcfa85 agy-cli 0.1.47: agy 1.5.9's bare 429 ending fails the turn (#1151)
agy 1.5.9 ends a turn whose every retry got 429 with the upstream status
itself, "⚠ RESOURCE_EXHAUSTED (code 429): Resource has been exhausted
(e.g. check quota).", instead of "⚠ Agent execution terminated due to
error.". That line was not one of AGENT_ERROR_MARKERS, so the bridge sent
it to the client as the model's answer and ended the turn as a success
(jx407's Codex turns showed the error text as the reply).

It is now a marker like the others: held while it could still be one,
dropped when it ends the prompt, and the turn fails through #agentError
-> #formatAgentError as rate_limit_error ("Antigravity quota or rate limit
reached: RESOURCE_EXHAUSTED (code 429): ..."), or as the system-prompt
case when the cloak says the prompt turns away. Text after it, the model
quoting the line, keeps it as text, as for the other markers.

This fixes how the 429 is reported, not why Antigravity answered 429 to
the reporter's Codex requests; that is still open on #1151.

Run (WSL magpie-desktop, Node 22, Bun 1.4.2, HOME=$(mktemp -d)):
- packages/agy-cli `bun test`: 21 pass, 0 fail (agy-cli.test.mjs runs
  repeat-batch.mjs and the rest).
- node --test --test-name-pattern="1151|1136" test/repeat-batch.mjs:
  4/4 ok. With the new marker line deleted from index.mjs: the endings
  test goes red (1 fail), the quoting test stays green.
- bun scripts/check.mjs agy-cli, scripts/bumped.mjs origin/main: ok.
Not tried: a real agy 1.5.9 turn that ends in 429.
2026-11-14 20:56:03 +08:00
yetone 5613a1259a agy-cli 0.1.43: agy 1.5.8's attempt lines are dropped, and its network and credit endings fail the turn (#1136)
agy 1.5.8 writes each failed attempt of a model call into the reply
("\n⚠ API error (attempt N): request failed: … EOF"), then tries again in
the same turn, and when it gives up it ends with "⚠ There was a network
issue connecting to the server, please try again." or "⚠ Your AI credits
balance is too low to continue." instead of "Agent execution terminated
due to error.". The bridge passed all three through as the model's text,
and the endings as a 200 end_turn, so the gateway neither retried nor
switched accounts.

- dropRetryBanner drops an attempt line where it starts a line, with its
  leading and one trailing newline, the way #1124 drops "Model produced
  invalid output."; a line not ended yet is held (openBanner) until its
  newline, a tool call or the end of the turn. A mid-line quote is kept.
- The error markers are a list; the network and credit endings fail the
  turn like the old marker. The credit ending is a rate_limit_error.
- The error's detail falls back to the last attempt line's text, then the
  ending's own words, when agy's log has no executor error.
  lastAgentError also reads "Run: attempt N failed (…), retrying in",
  "CallWithRetry: …" and "inference connection failed…: …" lines.

Fixtures are the reporter's exact strings from their Codex rollout.

Run (mica): node --test test/repeat-batch.mjs 33 pass; agy-cli bun test
21 pass; scripts/check.mjs agy-cli ok. Broken by hand: with main's
index.mjs the attempt-banner and ending tests fail (2 of 3; the third is
the mid-line quote guard, green on both).
Not tried: a real agy 1.5.8 with a dropped connection; the log-line
patterns are from the issue's log excerpt, not a test.
2026-11-14 16:32:54 +08:00
yetone e0f2a4c2e9 agy-cli 0.1.42: agy's "Model produced invalid output." retry banner is dropped (#1124)
When the model's first call returns neither text nor tool calls, agy writes
"\n⚠ Model produced invalid output." into the reply and calls the model
again in the same turn. The bridge passed that banner on as the reply's
text, so Claude Code's prompt_suggestion took it as the suggestion.

Turn.pushText now drops the banner, with its leading newline and one
trailing newline, wherever it starts a line. A banner that ends a chunk is
held, so a newline in the next chunk goes with it, and it is dropped for
good when the text is flushed. The turn goes on: unlike agy's error
marker, it does not fail the prompt. The model quoting it mid-line keeps it.

Run on WSL (Bun, temp HOME):
- packages/agy-cli: bun test, 21 pass / 0 fail (repeat-batch 30 pass).
- bun scripts/check.mjs agy-cli: ok.
- Broken by hand: on the old index.mjs the new #1124 banner test is red.

Not tried: a real agy 1.5.8 empty-output retry; the banner bytes come from
the reporter's gateway log, and both with and without a trailing newline
are covered.
2026-11-14 13:30:22 +08:00
tungloong 592b716ac3 agy-cli 0.1.37: DeepSeek Harness's notes are not the loop's task; a trimmed loop keeps its whole user turn (#1093)
Reviewed at 56248465f. WSL (Bun 1.4.2, temp HOME): bun test in packages/agy-cli 20 pass (repeat-batch.mjs inside agy-cli.test.mjs), scripts/check.mjs agy-cli ok. With main's index.mjs, node --test test/repeat-batch.mjs fails 6 (19, 20, 21, 22, 24, 26). Open question, not blocking: a string-content message holding a runtime snapshot and the user's words reads as meta-only (affects only prompts trimmed past 112 KiB).
2026-11-13 19:49:31 +08:00
yetone 1a08f08817 agy-cli 0.1.30: a new agy session logs why the live one was not reused (#1058)
#1058: in one Claude Code conversation every request started a new agy
conversation, so Gemini 4 Carbon's cache read stayed at 0. The bridge
reuses a live session only when the conversation key, work dir,
instructions and history all match, and nothing said which one failed.

acquireProcLocked now writes one content-free stderr row per new
session ("[agy-bridge] {event: agy_bridge_session, action: session_new,
reason, conv, fresh, resumed, parked, history}"). reason is no_live (no
session under this conversation key), or for a live one that was
dropped: forced, dead, retiring, work_dir, instructions, history or
fresh_after_first. conv is the key's 12-char digest, so a key that
changes per request shows as a new conv each time. The rows have their
own 30/min budget, so they never crowd out the tool-state rows.
magpie writes plugin stderr into its log, so the reporter can send them.

Run (on a separate test Mac, temp HOME): bun scripts/check.mjs agy-cli
ok; packages/agy-cli bun test ./agy-cli.test.mjs 14 pass 0 fail;
test/repeat-batch.mjs 20 pass, test/conversation-key.mjs 31 pass.
Broken by hand: with the logSessionEvent call disabled, the new #1058
test fails.
Not tried: a real agy, or the reporter's Claude Code requests. This
does not fix the cache miss; it finds which check misses.

Reported-by: chrisjian
2026-11-13 02:40:04 +08:00
yetone 4b35c34c34 agy-cli 0.1.27: a replay that fits goes unclipped; Claude Code's notes are not the loop's task (#1055)
clipHistoryMessage ran on every history message before the room check,
so a 20 KiB block in a small replay still went as 4 KiB head and tail.
History is now rendered whole first, and blocks are clipped only when
that is over the room; from there the over-budget path is as before.

The #1053 task finder took the last user message with no tool_result,
so a standalone system reminder, interrupt marker or local-command
caveat could be pinned in place of the real prompt. isUserTask skips a
user message whose text is only such notes; an image or any other text
still counts.

Not changed: the 112 KiB default (the installed agy 1.5.5's strings
don't show a 192,000-byte limit), a lone tool_result after the omission
note (history is text; it carries its id), and the issue's redesign.

Run on a separate test Mac (Bun 1.4.2, temp HOME):
- test/repeat-batch.mjs: 19 pass, 0 fail (2 new; 17 pass 2 fail on 0.1.26).
- bun test packages/agy-cli: 15 pass, 0 fail.
- bun scripts/check.mjs agy-cli: ok.
Broken by hand, each 18 pass 1 fail, then restored: clipping always;
the meta check reduced to an empty test; the local-command strip
removed; the interrupt strip removed; the over-budget clip removed
(the A16 >128 KiB test goes red).
Not tried: a real agy.

Reported-by: hiee3
2026-11-12 22:19:39 +08:00
yetone bb3f68a47a agy-cli 0.1.26: a quoted error marker no longer ends the turn; a trimmed tool loop keeps its prompt (#1052, #1053)
#1052: Turn.pushText failed the turn at the first "⚠ Agent execution
terminated due to error." anywhere in the reply, so a model quoting it
(inline, in a code block) was cut off and reported as an agy error. agy's
own marker ends the prompt, so the marker is now held, and the turn fails
only when the prompt ends with it still held (Turn.endText, before the
agentError check). Text or a tool call after it sends it on as text.

#1053: when a replay went over the prompt budget mid tool loop,
renderInitialPromptParts kept only the opening message and the newest
history, and dropped the user prompt the loop works on. Now, when the
current turn carries tool_results, the latest user message without one is
kept too if it fits, in order, with an omission note per gap.

Not changed: #1052's retry banners (nothing shows them reaching the
client as message chunks) and #1051 (the supersede rule is deliberate,
covered by A15 and the lineage sibling test; evidence asked for).

Run on WSL (Bun 1.4.2, temp HOME):
- bun test packages/agy-cli: 15 pass, 0 fail.
- test/repeat-batch.mjs: 17 pass, 0 fail (3 new).
- bun scripts/check.mjs agy-cli: ok.
Broken by hand, each 16 pass 1 fail, then restored: the task prompt not
pinned; pushText back to the first-indexOf rule; turn.endText() removed.
Not tried: a real agy (no install, no Google endpoints).

Reported-by: hiee3
2026-11-12 21:47:42 +08:00
gitxmandgitxm 0f0c4ec68f agy-cli: Antigravity on the local agy CLI over ACP (#785)
New package `@magpie-community/opencode-agy-cli-auth` (provider `agy-cli`, `packages/agy-cli`). It serves Antigravity models through the user's installed `agy` CLI over ACP (`agy acp`) and uses agy's own Google sign-in. The plugin reads and writes no Google tokens.

The bridge is gitxm's. On top of it, after review:

- **ACP identity.** The client names itself (`opencode-agy-cli-auth` and its package version) instead of `zed`.
- **Catalog.**
  - Only what agy offers this client is listed: Gemini until a session says more, then the session's model option and `availableModels`.
  - Requests are still routed by everything `agy models` lists.
- **Prompt.** agy keeps its own system prompt by default. The minimal agent is opt-in with `AGY_BRIDGE_MINIMAL_AGENT=1`, and the README says what turning it on sends upstream.
- **Version check.** agy older than 1.4.12 is refused at the handshake. 1.4.12 is the oldest version the `nc` MCP bridge was checked on, and the README documents the bridge.
- **Auto-update.**
  - `AGY_CLI_DISABLE_AUTO_UPDATE` defaults to `true` only for the plugin's own agy processes.
  - A value the user set is passed on as written.
- **Docs.** The READMEs and the registry summary say how this differs from antigravity-acp (#87).
- **Tests.** The author's tests came over under `test/` with a fake agy (an ACP stdio server). Each suite runs in its own `bun test`, and a `mock.module` preload stands in for `node:child_process`.
- **Cleanup.** A duplicate, unreachable image branch in validateBody is gone.

Run at ae5eafb0 on mote (macOS) with HOME=$(mktemp -d):

- `bun test packages/agy-cli`: 7 pass. Per suite:
  - platform 14, compat 9, usage 20;
  - catalog 15, usage-settlement 18, repeat-batch 14;
  - smoke ALL OK (301 checks).
- `bun scripts/check.mjs`: all ok.
- Repo-wide `bun test`: 6792 pass, 0 fail (6812 tests, 492 files).

Broken by hand, and each went red:

- clientInfo set back to zed;
- the version check turned off;
- routing limited to the listed models;
- auto-update forced to true;
- the minimal agent on by default.

Not tried: a real agy, since mote has none, or a real Antigravity account.

Co-authored-by: gitxm <21175063+gitxm@users.noreply.github.com>
2026-11-07 20:14:45 +08:00