fb7bbebdc2bd2efd3db6888b76c6d832807b8500
13
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b40a853c20 |
agy-cli 0.1.34: agy isn't run in the background without a sign-in, so it stops opening the browser (JZGiVvkSOA75376 on X)
On Windows 11, a signed-out agy opened Google's sign-in page 235 times in one day. The usage refresh ran `agy` about every 3 minutes, and agy opens the browser through ShellExecuteW, so the BROWSER=open.cmd guard can't stop it. New signin.mjs reads agy's stored sign-in without running agy. agy keeps it through go-keyring, service "gemini" and user "antigravity": - macOS: `security find-generic-password`; - Windows: CredReadW from PowerShell, on the credential "gemini:antigravity". It reads only whether a sign-in is stored, whether it has a refresh token, and when the access token ends. The token itself never leaves the function; a hash tells one sign-in from the next. Setting GEMINI_API_KEY, GOOGLE_API_KEY, AGY_ADC_AUTH or GOOGLE_GENAI_USE_VERTEXAI means agy signs in some other way, so nothing is concluded from the keyring. AGY_BRIDGE_STORED_SIGNIN=skip turns the read off. An access token that has ended is not "needs sign-in". The owner's working agy has one that ended 11 hours ago and is renewed from its refresh token. agy counts as unable to sign in when: - no sign-in is stored; - the access token has ended and there is no refresh token; - or agy already failed on this stored sign-in: it said it needs a sign-in, or it hung with an ended token and printed nothing or sign-in talk, the way an agy waiting on its browser does. This holds until another sign-in is stored. What changes: - Usage: in those cases agy isn't run. The read says signIn "expired", and magpie shows the account's sign-in as expired. After the next good read it says "renewed", and magpie clears that. - Other usage failures wait 10 minutes before the next run, doubling up to 6 hours. Before, they ran again on every refresh. - The model listing (`agy models`) isn't run in the background in those cases either. The catalog it has stays. - Signing in from magpie skips the `agy models` probe and goes straight to magpie's own sign-in link. A finished sign-in clears what was marked dead. - A request answers 401 with X-Magpie-Sign-In: expired when no sign-in is stored. This uses the last read, so a request never waits for PowerShell. - `agy --version` hanging is never read as a sign-in wait. Run: - mote, rebased on |
||
|
|
753a61f85c |
agy-cli 0.1.31: wait for MCP commit before cancelling steered tool turns (#1061)
When a client steers a live tool turn, agy-cli now waits for agy to commit the MCP responses (a tool_call_update, the next generation, or the prompt ending; AGY_BRIDGE_MCP_COMMIT_WAIT_MS, default 5s) before sending session/cancel. Before, the cancel could beat the response, and agy recorded "Tool execution was canceled". A clean steer keeps SQLite step usage trusted, and an unpolled LONGTOOL result stays in the steered prompt. A steer in progress is not evicted or reclaimed, and a second steer gets 503. Reviewed at 01de2cc. Run on a separate test Mac (Bun 1.4.2, temp HOME): bun scripts/check.mjs agy-cli ok; bun test ./packages/agy-cli 17 pass. Broken by hand: with no commit wait, the smoke steer case, six steer-in-session groups and usage-settlement go red. Not tried by the reviewer: a real agy (the author's live run on agy 1.5.6 is in the PR). Co-authored-by: tungloong <tungloong@users.noreply.github.com> |
||
|
|
a2e601dc21 |
agy-cli 0.1.28: tool schemas with $ref/allOf/oneOf reach the model with their fields (#1042)
Tool schemas that use $ref, allOf or oneOf now reach the model with all their fields (expandToolSchema).
Nullable unions are lowered to type:[X,"null"]. Inlining is capped by depth (counted only along $ref and allOf), by 8192 nodes and by 256 KiB. A tool with no schema gets a plain object. The ToolSearch fallback was dropped.
Run at 80d19737 merged with main
|
||
|
|
80d3a00ee3 |
agy-cli 0.1.24: no console window or leftover conhost on Windows (#1047)
agy dials --ide-mcp-port by running `nc` from PATH, and on Windows the
bridge's nc was nc.cmd: cmd.exe running mcp-server.mjs, two console
programs. When agy starts a console program with a console of its own
(CREATE_NEW_CONSOLE, or CREATE_NO_WINDOW), each dial gets a window or a
conhost.exe. Each session also made its own bin dir, and a host that
exited left its parked agy's cmd/bun children and its workspace dirs
behind.
- Under Bun (magpie's runtime), nc is now a GUI-subsystem nc.exe that
Bun builds from mcp-server.mjs on the user's own machine (`bun build
--compile --windows-hide-console`, ~0.3s on the test box). A GUI exe
gets no console under any creation flags, and it still talks over the
stdio pipes agy hands it. Nothing prebuilt ships. It lives in
%TEMP%\magpie-agy-bridge-nc-<hash of runtime, Bun version and server
source>, so every session and every later host reuses one build. A dir
no host has used for a week, or a half-done build dir older than an
hour, is swept. If the build fails, or the runtime isn't Bun (e.g.
opencode.exe), nc.cmd is used as before.
- At exit on Windows one `taskkill /T /F` ends every live agy with its
tree (cmd, nc). The workspace rm retries while the just-killed
processes let go of their cwd. Only a shim dir this host made is
removed; the shared nc.exe dir stays.
Run on Windows 11 (build 26200, xiaomi-gpu), Bun 1.4.2. A fake agy (Go)
answers ACP and dials `nc 127.0.0.1 <port>` 3 times per session, with
CreationFlags none, CREATE_NO_WINDOW or CREATE_NEW_CONSOLE. 4 sessions
per run, all 12 dials answered in every run below. conhost counts are
those under the host after 4 sessions, while agy is parked:
old, none: 5 conhost; agy 4, cmd 4, bun 4; 4 workspace dirs leaked
old, nowindow: 9 conhost (+2 per session); same leak
old, newconsole: 9 conhost (+2 per session); same leak
new, none / nowindow / newconsole: 5 conhost (the parked agy's own);
agy 4, nc.exe 4, no cmd, no bun; one magpie-agy-bridge-nc-<hash>
dir, nothing else left in TEMP after exit
new, idle eviction (3s): back to 1 conhost, no agy/nc left
new, host hard-killed: no agy/nc left; the 4 workspace dirs stay (no
code runs after a hard kill; the same on old, which also leaks its
bin dir)
old, DETACHED_PROCESS: the dial never answers (agy start times out),
so that isn't what the reported agy does.
The system-wide conhost count was 1 before and after every run.
Tests: test/windows-nc.mjs (6 tests, on any OS through the kit's
platform, execPath and versions overrides): the build command, the
shared dir built once and reused by a later host, no nc.cmd, the
nc.cmd fallback, the one-run tree kill at exit and which dirs it
removes.
Run at this tree on mica (Bun 1.4.2, temp HOME): bun test
packages/agy-cli 15 pass 0 fail; bun scripts/check.mjs exit 0.
On the Windows box: 14 pass, 1 fail. The red is smoke.mjs's "no call to
the loaded tool reaches agy's validator in the old prompt". It fails the
same way at origin/main
|
||
|
|
01eaa6dda4 |
agy-cli 0.1.20: each step's usage from agy's own store, and 1.5.1+ inputTokens read as uncached (#983)
agy 1.5.1+ reports ACP `inputTokens` as uncached prompt tokens only; `promptUsage()` tells the exclusive shape from the inclusive one by `totalTokens`, so cache reads are no longer clipped and the learned cache ratio no longer pins to 1.0. Each HTTP step of a multi-step tool loop is settled from agy's own per-call rows in `conversations/<id>.db` (`gen_metadata` on 1.5.1+, `steps` type 15 on 1.4.x-1.5.0) when they reconcile with ACP's total; same-generation tool continuations settle at 0, a cancelled or fallen-back turn stops trusting the store, and a clipped cold-start replay bounds its fallback estimate. The reader (`step-usage.mjs`) never opens a store read-write. Under Bun it opens with `SQLITE_OPEN_READONLY | SQLITE_OPEN_URI` (Bun's SQLite on Linux and Windows parses `file:` URIs only with that flag), finalizes statements and waits on no busy timeout. A checkpointed WAL store with no `-wal`/`-shm` is read through `?immutable=1` and gains no side files; if `-wal` appears during that read it is read again live. Store paths are resolved to absolute first, and Windows `\\?\` and UNC paths get their own `file:` form. On an uncheckpointed store the only file a reader touches is SQLite's `-shm` WAL index. Reviewed head 9054f47295d51d6f83f8585dd550312ebff8448a (base dba24067; merges cleanly onto main |
||
|
|
445f4143de |
Revert "agy-cli 0.1.19: tools with large schemas are shortened so agy keeps them in the model's function list (#989, klarkxy on X)"
This reverts commit
|
||
|
|
8e6c75b1e3 |
agy-cli 0.1.19: tools with large schemas are shortened so agy keeps them in the model's function list (#989, klarkxy on X)
agy lazy-loads MCP tools (McpToolConfig.EnableLazyLoad and a call_mcp_tool tool are in the 1.5.5 binary): a tool with a large declaration never reaches the model's function list and nothing says so. The reporter saw tools of about 691 tokens and up missing (bash, grep), 561 and below present. The exact cut-off is not in the binary. tool-budget.mjs fits each tool under 2000 characters (about 500 tokens; env AGY_BRIDGE_TOOL_BUDGET, 0 = off). Order of loss: default/examples/title, nested descriptions to 90 chars, the tool's description, nested descriptions, and last the largest optional parameters (never required ones). Each changed tool is logged on stderr as agy_bridge_tool_shrunk, with what was lost and stillOver when it cannot fit. Run (mica, HOME=$(mktemp -d)): bun test packages/agy-cli 14 pass, scripts/check.mjs ok. Broken by hand: without the fitTools call in the request path the smoke check goes red (5201 chars). Not tried: a real agy 1.5.x with Gemini 4 Carbon, so the 2000-character budget rests on the reporter's numbers. |
||
|
|
c00c4b9f6c |
agy-cli: usage timeout tests wait on the children, not a duration (#950)
Cause: "simulated Windows timeouts kill the whole tree" ran fetchUsage
with a 600ms timeout that covers both children. On a loaded machine the
fake agy's start (bun startup plus its browser-guard spawnSync) can use
most of it, so the timeout fired before the report child had logged, or
before it was even spawned, and logs[1] was undefined
("undefined is not an object (evaluating 'logs[1].pid')"). The same
budget made its sibling "version/report hangs time out" read a log the
killed version child never wrote (ENOENT). After the kill, a fixed 20ms
(and 50ms in both descendant tests) stood in for the kernel and event
loop reaping a SIGKILLed child.
Fix, test-only:
- timedOut() records each spawned child's pid itself and doubles the
timeout (600ms up to 38.4s) until the timeout lands while the child
under test runs; the taskkill assertions use the spawned report pid.
- The "gone" checks poll: waitForPidExit with a 15s bound over the
spawned pids and every pid the fixture logged (the agy under cmd.exe
on Windows); waitForNotRunning polls ps for the two descendant tests.
- agy-cli.test.mjs runs each suite with bun's --timeout 120000: bun's
5s per-test default was the next fixed wait these tests hit under the
injected delay.
- The fake agy takes TEST_START_DELAY_MS to reproduce a slow start.
Injected: TEST_START_DELAY_MS=400 on the old test (WSL magpie-desktop)
-> the #950 test red with the logs[1].pid TypeError; =900 -> it and the
hang test red with ENOENT. With this change: 20/20 at 0, 400 and 900 on
WSL, 20/20 at 0 and 900 on mote (macOS), 17/17 (3 skipped) at 0 and 900
on xiaomi-gpu (Windows).
Ran: wsl-run 'export HOME=$(mktemp -d); bun test packages/agy-cli;
bun scripts/check.mjs' -> 13 pass, 0 fail; check.mjs all ok.
Not tried: the reaping race by itself (a SIGKILLed child still listed
after 20ms) wasn't injected; it is covered by polling, not reproduced.
No source change, so no version bump.
|
||
|
|
92e0417739 |
agy-cli 0.1.16: keep conversationKey stable across volatile openings (#947)
conversationKey stays stable when only agent-injected opening fields change (Claude Code's billing header, known clock lines in the system prompt or a <system-reminder>), so a continued chat keeps its agy session and its prompt cache. It hashes the whole stripped first message. A flattened, growing first message reuses the live session only when it continues the whole previous opening plus that session's reply on a line boundary, and then sends agy only the new tail. Closes #945. Reviewed head 56c845720026819781e198bada948cce9b926806 (one commit on main 9204c07; main |
||
|
|
dbd082f6d1 |
agy-cli 0.1.15: an array tool schema whose items live only on a sibling gets an items schema Gemini accepts (klarkxy #963)
Gemini refuses an array schema with no `items`. array-items.mjs infers the items from the schema around it, or adds a permissive items schema 8 levels deep, without narrowing what the client allowed; tuple `items` lists are left as they are, with a hint. Closes #962. Reviewed head c7d3e7b8 (on |
||
|
|
738fd501d7 |
agy-cli 0.1.14: tool schema patterns are turned into RE2 or dropped, so an ECMA-262 pattern no longer aborts the turn (klarkxy #946)
Tool input schemas' `pattern` and `patternProperties` keys are translated to RE2 (re2-pattern.mjs) before they reach agy; a pattern RE2 can't hold is dropped with a hint, and `additionalProperties: false` is lifted when every patternProperties key was dropped. Closes #944. Reviewed head 99093088 (on |
||
|
|
a5a63a109f |
agy-cli 0.1.3: an assistant prefill tail is continued, not refused (#904)
A request ending in a text-only assistant turn (SillyTavern prefill, "continue"/"impersonate", bot frameworks) was refused with a 400. That trailing run now stays in the tail, after the session ledger's newest entry, so the agy session is reused across prefill turns, and it is rendered as a continuation of the model's own reply. A prefill beside a live tool_result, or with no user turn before it, is still a 400. AGY_BRIDGE_PREFILL=0 brings the old refusal back. Reviewed at f7b249cec9e827b7ef49197a207180f3f7085cfe, run on mote: bun test ./agy-cli.test.mjs 8 pass / 0 fail; bun scripts/check.mjs ok. Broken by hand: with main's index.mjs and these tests, test/prefill.mjs and the smoke test fail (6 pass / 2 fail). Checked: renderTurnMessagesParts only gets the current turn's tail, never history, so a finished reply is never taken for a prefill. Not tried: a real agy account. |
||
|
|
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> |