19 Commits
Author SHA1 Message Date
zhou.han 9e86a2c7b7 proc: a Linux zombie no longer holds a lock (#1198)
yetihan (#1198): a lock whose owner is a Linux zombie was held for
good. process.kill(pid, 0) succeeds on a zombie, so 15 packages' lock
and liveness checks counted an exited, unreaped owner as alive.

- scripts/proc.mjs: processStatus(pid) is dead on ESRCH, and on Linux
  also when /proc/<pid>/stat says Z or X; EPERM is "permission", any
  other error "unknown". processAlive / processExists keep each
  caller's old EPERM and unknown-error meaning.
- scripts/sync-proc.mjs copies it into each package (--check in the
  tests); every package's own check keeps its old semantics, now with
  zombies dead. agent-console's daemon bundle and window-warmup's dist
  are rebuilt.
- 15 packages bumped.

Review run at 28ef6622 (mote, HOME=$(mktemp -d)):
- node scripts/sync-proc.mjs --check: ok.
- bun test (whole repo): 8934 pass, 0 fail.
- bun scripts/check.mjs: every package ok.
- window-warmup's build reproduces its dist/plugin.js byte for byte.
  agent-console's bundle diff read line by line: the proc module plus
  esbuild's renumbered imports, nothing else (esbuild isn't installed
  on mote, so it wasn't rebuilt there).
- Real zombie on Linux (WSL, magpie-desktop): a bash child left
  unreaped by an exec'd sleep, /proc stat "Z": the old kill(0) check
  says alive, processStatus says dead; the running process says alive.

Not tried: each package's lock contention end to end.
2026-11-16 12:19:09 +08:00
yetone 0135b7b0ea agy-cli 0.1.32: the first model list after warming has agy's Claude and GPT models (#1064)
On a signed-in agy, `agy models` takes about 4.4s and `agy acp`'s
session/new about 3s. provider.models() needed three calls before
claude-opus-5-5, claude-sonnet-5-5 and gpt-oss-120b showed up, and
OpenCode 2.x calls it once.

What changed:
- packages/agy-cli/index.mjs:
  - The offered-model probe now starts in listAgyModels' .then, as soon as
    a non-empty list arrives and a caller asked for probeOffered. It no
    longer waits for the next models() call. A hung or failed `agy models`
    still never spawns the probe.
  - probeSignedIn reuses the `agy models` stdout it already has. The same
    parser (parseAgyModels, split out of listAgyModels) fills
    cachedModelCatalog, and the probe starts. Sign-in waits for the probe
    for at most 3s.
  - The offer (acpOfferedModels, acpOfferedKey, offeredProbeAt and any
    in-flight probe) is forgotten when agyPath changes and after a new
    sign-in finishes. A generation counter drops the answer of a probe
    that started before the reset.
  - provider.warming() returns a promise while a list or probe is still
    running, and null when nothing is.
- scripts/opencode2.mjs, copied byte for byte to every
  packages/*/opencode2.mjs: after the first background refresh, the
  adapter awaits hooks.provider.warming() once, for at most 60s, and then
  refreshes once more. It does not loop. Plugins without warming() behave
  as before.
- Not done: the issue's on-disk catalog cache (point 3), skipped as asked.

Known gap: agy-cli has no `config` hook, so under OpenCode 2.x the adapter
lists no provider for it. refresh() returns before it calls
provider.models(), so the follow-up refresh can't add agy's models on 2.x
until agy-cli gets a config hook.

Tests: test/testkit.mjs's fake agy takes a sessionNewDelayMs. The new
tests in test/catalog.mjs set 1.5s on both `agy models` and session/new
and wait for state through warming(), with no fixed sleeps:
- On a slow cold start, the first models() after warming lists Claude and
  GPT, from one probe spawn.
- authorize() on a signed-in agy fills the catalog, and the next models()
  runs no second `agy models`.
- The sign-in wait is bounded: with a 6s session/new, sign-in returns in
  about 4.5s.
- Changing agyPath probes again.
The hang test now awaits warming() before it counts acp spawns.
scripts/opencode2.test.mjs: the warming list is read a second time when
warming ends, and only once when nothing is warming.

Run on Linux (a separate test Mac was over its load limit):
- packages/agy-cli bun test: 17 pass, 0 fail.
- bun scripts/check.mjs agy-cli: ok.
- bun scripts/check.mjs (all packages): ok.
- Root bun test in a temp HOME: 8530 pass, 19 skip, 0 fail.

Broken by hand on Linux, each red, then restored green:
- No probe in the .then: the slow cold-start test.
- probeSignedIn drops the list: the authorize and bounded-wait tests.
- agyPath change keeps the old offer: the agyPath test.
- Unbounded sign-in wait: the bounded-wait test (7514ms).
- Probe also on a failed listing: the hang test.
- origin/main's index.mjs with the new tests: all four #1064 tests.
- Adapter reads the list once: the warming adapter test, and the
  copy-identity check.

Not tried: a real agy (no Google sign-in, no network). The reset after
login.finish has no unit test of its own.

Reported-by: hiee3
2026-11-13 10:59:13 +08:00
yetone d7adec8f74 gcp-ai: the fake gcloud in the ADC consent test exits only after its ADC write lands
The "ADC setup reads gcloud's complete consent URL ..." test's
writesThenFails fake started the ADC write on one 5ms timer (void, not
awaited) and exited on another 40ms timer. beginAdcLogin stats the ADC
file on a non-zero exit to tell "saved, then the quota probe failed"
from a failed consent, so when the write took more than ~35ms on a busy
machine the exit was read before the file existed and the test saw
"gcloud could not set up ADC". Real gcloud has written the file before
it exits, so the plugin is right and the race was the test's: the fake
now emits exit only once its write has resolved.

Run on mote (Bun 1.4.2, TMPDIR and HOME inside the run dir):
- reproduced: the write's timer moved 5ms -> 60ms on the old test: red
  ("gcloud could not set up ADC") every run.
- fixed, with a 100ms sleep injected into fixture.setAdc: green.
- broken by hand (the fake's exit no longer awaits the write), same
  100ms injection: red. Injection removed afterwards.
- bun test packages/gcp-ai: 95 pass, 14 skip, 0 fail.
- bun scripts/check.mjs gcp-ai: ok.
- repo-root bun test: 6867 pass, 0 fail (499 files).

Only a test changed, so no version bump.

Fixes #835
2026-11-08 05:39:42 +08:00
我是一条没有名字的区 087c36123d inkstone 0.1.3: image-caps preflight, a zero-prompt browser sign-in, key calls on the session cookie (#832)
inkstone 0.1.3 (#832, yunwang2442-creator):

- Image requests are prechecked before they leave: 8 images, 10MB each, 40MB in all.
  - A request over a cap gets a local 400 shape refusal, so magpie asks the next account and rests none.
  - The plan's invalid_media / media_fetch_failed / unsupported_media_type errors become the same kind of refusal.
- The body rewrite strips the reasoning fields and sets image detail to auto.
- A zero-prompt browser sign-in comes first, and a second browser method reuses a pasted key.
  - Neither browser method is offered when no Chromium-family browser is found (#825).
- The /keys calls ride the session cookie, without the pagination query. Key creation retries the console's -15100 "refresh page and retry".
- The #826 metadata token read is kept, and its test is back.
- The fake browser is built once per user and source hash (#824), and the title wait reads only on Windows.
- maxConcurrency is 4.
- The doubled comment line is dropped from every opencode2.mjs copy, agy-cli's included.

Reviewed at 88e66bde, on mote (macOS, Bun 1.4.2) with a temp HOME:
- full bun test: 6853 pass / 0 fail; both checks exit 0
- bun scripts/check.mjs and bun scripts/check.mjs inkstone: exit 0
- 21 hand breaks: 20 red, 1 not caught (the /keys pagination test calls protocol.listKeys directly; follow-up filed)

Not tried: a real InkStone account or sign-in, Windows and Linux runs.
2026-11-07 22:24:56 +08:00
我是一条没有名字的区 e7004d9354 inkstone 0.1.0: Intern InkStone (书生·端砚) Token Plan, browser sign-in, credit card and ink-* key chat (#775)
New package @magpie-community/opencode-inkstone-auth 0.1.0 for Intern
InkStone (书生·端砚, Shanghai AI Lab) Token Plan, provider id
`intern-inkstone`. Community package by yunwang2442-creator.

What it does:
- Browser sign-in (Edge/Chrome, its own profile under
  $XDG_CONFIG_HOME or ~/.config/magpie/inkstone-browser, or
  %LOCALAPPDATA%\magpie\inkstone-browser). The login window has no
  debugging port. A headless CDP read takes the uaa-token cookie, and the
  same read renews it silently later.
- Usage card: ink-credit balance, 5-hour and 7-day windows, credit packs.
- Chat: a pasted ink-* API key, or one the sign-in creates, named
  ink-<host4>-<acct4>-<rand4> (18 of the console's 20 characters). An
  idempotency clash (-15109) retries with a fresh name, up to three times.
  Pruning is on by default. It only touches this machine's and account's
  prefix, keeps the newest two and the key this sign-in created, and never
  deletes manual keys or keys of unknown age.
- Closing on Unix: SIGTERM, then SIGKILL only after a 15s grace. Leftover
  browsers are matched by --user-data-dir=<escaped profile>, and Windows
  uses .Contains().
- The login wait comes from an injected waitForLogin in tests. No env
  hook is left in production code.
- Hosts: discovery.intern-ai.org.cn, discovery-api.intern-ai.org.cn,
  127.0.0.1 (CDP).

Outside the package: scripts/opencode2.mjs lets a prompt with
`required: false` stay optional (`p.required !== false`). Every package's
copy is synced byte for byte, so all 39 copies in the merged tree are blob
afe074cb. No other package sets `required: false` on a prompt, so this
changes nothing for them. Also a root README row and a registry entry.

Review at 36412a15, on mote, HOME=$(mktemp -d), Bun 1.4.2:
- bun test packages/inkstone: 68 pass, 0 fail in Asia/Shanghai, UTC,
  America/Los_Angeles and Pacific/Kiritimati.
- bun scripts/check.mjs inkstone and bun scripts/check.mjs: ok.
- bun test (repo), on 36412a15 merged with origin/main e7cb9dc5:
  6743 pass, 20 skip, 0 fail. main has since moved by cline 0.1.14 and
  zcode 0.1.55 only, and none of the adapter copies changed.
- Broken by hand, each red: no protectName protection; prune_keys default
  off; no post-sign-in prune; no SIGTERM on close; the -15109 retry keeping
  its name.

Not tried: a real InkStone account sign-in on macOS, Linux or Windows (no
account here); a live chat request; magpie end to end with the plugin.
2026-11-07 15:07:06 +08:00
yetoneandCursor Agent cfa41e5956 gcp-ai 0.2.2: retry a 401 without buffering every body (#739)
Reuse an in-memory body on a 401 instead of cloning every request up front,
and return a 401 on a stream that cannot be sent twice. Concurrent 401s share
one token refresh. Keep the token cache in a WeakMap keyed by the fetch
function, and replace Promise.withResolvers in tests so the suite runs on Node 20.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-11-06 19:51:18 +08:00
yetone 5112465ca1 gcp-ai 0.2.1: Gemini's history rules before Vertex, no 400 "Requests ending with a model turn" (#734)
The loader's fetch now hardens a generateContent/streamGenerateContent
body the way magpie's gateway builds Gemini contents (codeassist.go):
- contents ending with the model's turn get a user turn after it
  ("Continue.", or the summary ask when the system prompt is an agent's
  compaction prompt);
- contents opening with the model's turn get Gemini CLI's
  "[Continuing from previous AI thoughts...]" user turn before it;
- a user turn holding a functionResponse beside the user's text is split,
  the responses (and their images) first, the text in a turn of its own.
A body that needs none of it goes byte for byte; countTokens and the
model list are not read. lib/history.mjs, test/history.test.mjs.

Note: magpie's gateway already builds a plugin's @ai-sdk/google request
through buildCodeAssistSent, so those rules reach this plugin from magpie
too (yetone/magpie test TestPluginGeminiNeverAskedEndingWithModel, red
with the gateway's guard removed). This covers a body that reaches the
plugin without them: OpenCode's own @ai-sdk/google, or a magpie path that
skips the build. The reporter's exact request body is not in the issue,
so the tests use #734's conversation shape (Codex compaction after the
model's reply) and #1533's (tool output + compaction prompt in one turn).

Run on mote (mote-run): node --test test/history.test.mjs 5/5; the
package's npm run check + node --test test/*.test.mjs 105 tests, 91 pass,
0 fail (14 skipped, Windows-only); bun scripts/check.mjs exit 0.
Broken by hand: the fetch without hardenRequest fails the end-to-end
test (Vertex fake answers 400 "ending with a model turn").
Not tried: a real Vertex account (none in a sandbox here).
2026-11-05 01:45:46 +08:00
Yaka 4c7f1c15e7 gcp-ai 0.2.0: cache access tokens per account, probe the endpoint in the background (Yaka88, #725)
gcp-ai caches an authorized_user ADC's access token per account until 60 s before it expires (refreshed at Google's OAuth token endpoint, one in-flight refresh shared; gcloud mode still asks gcloud every time), retries a model call once with a fresh token on a 401, and probes the endpoint in the background: only a 401 that stands after one refresh holds later requests, for 60 s. README: the install name, token caching, and a source line. Version 0.2.0.

Reviewed three rounds (e78a89a4, e1f83cad, 3959a795). Run at 3959a795 on mote (macOS, Node 22.22.0, Bun 1.4.2, sandbox HOME):
- packages/gcp-ai `node --test test/*.test.mjs`: 100 tests, 86 pass, 0 fail, 14 skipped (no Chrome there; Windows/Linux only). `bun test packages/gcp-ai`: 86 pass, 14 skip, 0 fail. `bun scripts/check.mjs gcp-ai`: ok.
- Broken by hand at this head: dropping the probe's invalidate and second read turns 6 tests red (the stale-token test among them); dropping only the invalidate turns the stale-token test red. Earlier rounds broke the 401 retry, the cache invalidation, the expires_in rule, the account in the token key, the 401-only probe verdict and the in-flight sharing; each went red.
- The direct refresh (refresh token to https://oauth2.googleapis.com/token only) was cleared by the maintainer on the PR.

Not tried: a real Google account (none on the test machines). #713 rebases onto this.
2026-11-04 23:14:22 +08:00
yetone aaacefdea8 gcp-ai 0.1.6: release #723
Ships a4fbe854 (#723): a userinfo reply with no email stops sign-in with
the clear "could not be confirmed" error, and a 0.1.1 adc-pending-XXXXXX
staging dir is not read as an account.

Run: the version bump only. a4fbe854's tree was run before its merge
(Linux full bun test 5483 pass, 0 fail on Bun 1.4.4; gcp-ai on macOS
70 pass with Bun and Node; both fixes broken by hand go red).
2026-11-04 18:44:07 +08:00
拾瑜 a4fbe854be gcp-ai: a sign-in without an email stops with a clear error, and a 0.1.1 staging dir is not an account (NGshiyu, #723)
Follow-up to #606's post-merge notes (c78f965):

- startLogin: a userinfo reply with a sub but no (or an invalid) email, or
  an empty one, now stops with "The Google account email and subject could
  not be confirmed after consent; no new account was recorded" instead of a
  TypeError from googleIdentity?.account.toLowerCase().
- knownAccounts skips a leftover 0.1.1 staging dir (adc-pending- plus
  mkdtemp's six alphanumerics, no "-"), so it is never read as an account;
  an address starting with pending- (adc-pending-user-example-com) is still
  found for the same-sub check.
- README: staging is .adc-pending-*, and only googleSubject and accountId
  are saved at sign-in; consoleAccount, consoleSubject and
  credentialAccount are read when an older record has them.

Not done: the six PNGs under test/evidence stay. The PR description says
they were removed, but the commit doesn't delete them; removing them at the
tip wouldn't shrink a clone, since history keeps them.

Run at the reviewed head fa173ba (main f9b7a1a plus this PR, Bun 1.4.4
38afee6c8, CI's version):
- Linux (WSL magpie-desktop), fresh HOME: bun test 5483 pass, 18 skip,
  0 fail across 406 files; bun scripts/check.mjs ok; no bun/node process
  left behind.
- macOS (mote): bun test packages/gcp-ai 70 pass, 14 skip, 0 fail; node
  --test packages/gcp-ai/test/*.test.mjs 70 pass, 0 fail.
- Broken by hand: without the LEGACY_PENDING_ADC skip, the pending- test
  goes red; with .account.toLowerCase() back, the missing-email test goes
  red (Bun and Node both).
- Bun 1.4.4's and Node's mkdtemp(".../adc-pending-") names all match
  /^adc-pending-[0-9A-Za-z]{6}$/ (200 each).

Not tried: a real Google sign-in.
2026-11-04 18:43:51 +08:00
yetone add66fc954 gcp-ai: the usage-options test asks no gcloud before the options are read (#667)
48a5f21's "the usage hook takes the billing, currency and profile maps"
test signed in with an accountId, so each of its usage calls first asked
gcloud for a token. On the publish run's ubuntu runner that took past
bun's 5s per-test limit, the test job went red, and gcp-ai 0.1.5 was
not published. The test now has no account, so nothing is asked before
the options are read and refused; it checks the same errors.

Run at this head on mote: `HOME=$(mktemp -d) bun test` (as publish.yml
runs it): 5195 pass, 0 fail, the test in 1.14ms. node --test
packages/gcp-ai/test/*.test.mjs: 84 tests, 81 pass, 3 skipped, 0 fail.
bun scripts/check.mjs: ok.

Not tried: the ubuntu runner itself; the first publish run on it will
show it.
2026-11-03 18:20:55 +08:00
yetone 48a5f21835 gcp-ai 0.1.5: credits read per Chrome profile, per project's billing account and in yen, and a translated Console says so (kidchen94, #667)
kidchen94 reported four ways the credits refresh failed on one machine:
Chrome's last-used profile decided whose session a read used, a page
Chrome translated could not be parsed, a JPY billing account timed out
on the wait for a "$" row, and an ambiguous billing account could only be
fixed with the machine-wide VERTEX_BILLING_ACCOUNT.

- Chrome profile: profileDirectories (Google account -> profile
  directory), profileDirectory and VERTEX_CHROME_PROFILE_DIRECTORY pass
  --profile-directory to every Chrome the plugin opens: reads, the
  kept browser and the sign-in window. The name is checked (no path
  separators, no "."/"..", no leading "-"), and a kept browser is never
  handed to a read pinned to another directory.
- Billing account: billingAccounts maps a project to its billing
  account, ahead of the row's billingAccount and the environment. The
  discovery error names the project, the accounts the Console showed and
  the option to set.
- Currency: billingCurrencies names a billing account's currency (USD,
  JPY). Yen is read with no minor unit and shown as "¥8500 JPY". A ¥ is
  never taken for yen on its own, since the Console writes yuan the same
  way: a ¥ table read as USD names the setting at once. Amounts need
  strict comma grouping. The row wait is any cell with a digit, not "$".
- Translation: a page Chrome marked translated (translated-ltr/rtl on
  <html>) and a table with non-English column names each give an error
  that says so and how to turn translation off, not a timeout or
  "session may be expired".
- Cache: the profile directory and the currency map join the cache key
  only when set, so existing caches are kept.
- fetch_credits.mjs takes --profile-directory and --currency.

Run at this head on mote (macOS, Node 22, Chrome for Testing 1234):
node --test test/*.test.mjs: 84 tests, 81 pass, 3 skipped (the
Linux/Windows-only ones, as on origin/main's 76), 0 fail.
bun scripts/check.mjs: ok.

Broken by hand: the new tests against origin/main's lib/ and index.mjs.
The JPY and translated browser tests fail with the reporter's symptom
(21s and 41s, "Credits table was not found or is empty; the session may
be expired"), the billing test with "set VERTEX_BILLING_ACCOUNT
explicitly", the profile test with "Chrome used Default, not Profile 1",
and plugin.test.mjs fails to load (billingCurrenciesOf is new).

Not tried: a real Console (a JPY billing account, a page Chrome
translated, a real multi-profile Chrome); the fixtures are tables
served from the test. Not run on Windows or Linux. Chrome's own
translate preference is not written; translation is detected, not
prevented. Currencies other than USD and JPY are refused, not
converted.
2026-11-03 18:09:59 +08:00
yetone 4586f8623b gcp-ai 0.1.4: a sign-in waiting on a lock its holder just let go takes it, instead of failing with ENOENT (#650)
take() opened the lock with "wx", got EEXIST, then stat'ed it in abandoned().
When the holder released between the two, stat threw ENOENT and the second
concurrent sign-in failed with it (TestConcurrentSignIns on CI). abandoned()
now returns null for a lock that is gone, and take() opens again without
removing anything, since the path may already be a new holder's.

Run on mote (bun 1.4.2, node 22), HOME=$(mktemp -d):
- packages/gcp-ai node --test: 66 pass, 0 fail; under bun test 66 pass, 10 skip.
- Broken by hand (ENOENT catch removed): the new lock test goes red.
- The concurrent sign-ins test 30 times: 30 green.
- Full bun test 5164 pass, 15 skip, 0 fail; scripts/check.mjs ok.
Not tried: the original race itself is timing-bound and was not reproduced
on demand; the unit test covers the gone-lock path directly.
2026-11-03 15:48:42 +08:00
yetone 17e5ef7457 all: load on OpenCode 2.x through a default {id, setup} (#657)
nbczw8750 (#657): trae 0.2.26 on OpenCode 2.2.5 fails with "Plugin
must export a default definition with an id and an effect or setup
function. (cause: SchemaError(Missing key at ["default"]))". 2.x
imports a package's exports["."] (a plugin dir and an npm install
alike) and has no V1 path at all, so every package here that serves
models failed the same way, not only trae.

Every one of the 32 model packages now has:
- opencode2.mjs, exports["."]: a copy of scripts/opencode2.mjs, an
  adapter that runs the package's V1 plugins inside 2.x's promise
  API. Config providers become 2.x providers (package pinned so the
  aisdk sdk hook runs), V1 auth methods become integration methods
  (oauth auto/code with forms; api without authorize as a key method),
  V1 credentials are kept in metadata.v1, the loader's baseURL,
  apiKey, headers and fetch are applied through the sdk hook, an
  auth.set renewal is stored per credential, and credential.switched
  /updated reload the account's own model list.
- opencode.mjs, main: re-exports the V1 plugin functions only.
  OpenCode 1.x and magpie's host.js take main. On 1.x, trae 0.2.26's
  main exported a non-plugin (_internal) and 1.19.5 refused it ("Plugin
  export is not a function"); the new main fixes that too.
- both files in "files"; patch version bumped. devin already had 2.x
  and is unchanged.

scripts/check.mjs fails a model package whose 2.x entry has no default
{id, setup}, whose opencode2.mjs differs from the canonical one, whose
entry is missing from files, or whose main exports a non-plugin.

Run at this head (mote):
- HOME=$(mktemp -d) bun test, as CI runs it: 4900 pass, 0 fail
  (4914 tests, 374 files). A first run set globalThis.fetch for the
  whole process from opencode2.test and failed 528 tests in other
  packages; the block is now set and put back around that file's tests.
- bun scripts/check.mjs: every package passes. With the network
  blocked cloudflare-workers-ai fails on its fetched catalog, the same
  on origin/main.
- Real OpenCode 2.2.5 (npm opencode-ai), sandbox HOME, packed trae
  0.2.27: loads with no error; /api/integration lists trae-cn "Trae CN"
  and trae-global "Trae Global" with their browser sign-ins; `auth
  login` starts the trae.cn authorization and waits (cancelled there);
  with a fake credential POSTed to /api/credential, `opencode models`
  lists trae-cn's six models.
- Real 2.2.5 with a fake V1 key plugin through the same adapter
  against a local fake server: `auth login` with a key, `models`,
  `opencode run` reached /real/v1/chat/completions with the loader's
  "Bearer loader-sk-fake" and header, and printed the fake's reply;
  with @ai-sdk/anthropic it reached /real/v1/messages with x-api-key
  from the loader. This run found the key method missing after 2.x's
  second integration transform (a once-only flag outside the
  transform); fixed, and opencode2.test checks a rebuild.
- Real OpenCode 1.19.5, sandbox HOME, trae 0.2.27: `opencode models`
  lists trae-cn and trae-global models; 0.2.26 failed there.

Broken by hand (scratch copy, bun test scripts/ and check.mjs):
- trae's exports back to "./index.mjs": the trae 2.x test fails
  (default.id undefined), check fails trae with "OpenCode 2.x:
  ./index.mjs has no default {id, setup} (plugins#657)".
- zed's opencode2.mjs changed: the copies test fails, check fails zed
  "differs from scripts/opencode2.mjs".
- the key flag back outside the transform: the 1.x plugin test fails
  on the rebuilt sign-ins (key missing).

Not tried: a real sign-in with a real account on 2.x; Windows (the
reporter's OS); chat.headers, chat.params, usage and tool hooks, which
the adapter doesn't carry to 2.x; the tools/pages packages (calc,
goanyapi, layerfs, search1api, aelios, agent-console, chat,
fingerprint, nowledge-mem, kimi-desktop), which still load only on 1.x.
2026-11-03 13:54:26 +08:00
拾瑜 c78f965f8d gcp-ai 0.1.2: accounts follow the Google subject, so a renamed email keeps its sign-in (#606)
An account is now identified by its Google subject (OIDC `sub`), not its email. When the email on a Google account changes, its saved ADC and Console credit cache stay matched to that account, and usage shows the current email. A sign-in for another subject that uses the same email gets a key of its own (email#hash). A new sign-in is staged in a `.adc-pending-` dir, and a lock across every managed ADC checks the subject is not registered already. Console identity is read from the page's own JSON (`extractConsoleIdentity`). No new host: userinfo was already called before.

By NGshiyu (#606), reviewed at b344aa1.

Run on the Mac mini with Bun 1.4.2, node 22 and HOME=$(mktemp -d), on b344aa1 merged with main 1a05a77:
- `node --test test/*.test.mjs` in packages/gcp-ai (with VERTEX_CHROME_PATH set to Playwright's Chromium): 75 tests. 72 pass, 0 fail, 3 skipped (Linux/Windows only).
- Whole repo `bun test` (with #599 and #596 merged in too): 4592 pass, 11 skip, 0 fail. `bun scripts/check.mjs`: exit 0.
- Broken by hand: turning off the subject branch in confirmAccount turns "Console subject matching accepts renamed emails" red (71/1).

Not tried: a real Google account whose email changed.
2026-11-02 03:36:05 +08:00
tianyuanwang989-prog 60a2d6e2e2 gcp-ai 0.1.1: a Windows sign-in reaches gcloud by its own path, and an expiring credit is spendable (#409)
gcp-ai 0.1.1: on Windows, gcloud.cmd is started by its own path (CLOUDSDK_ROOT_DIR, then PATH, quoted entries included), so the batch file's %~dp0 is its own directory and gcloud finds its library. A credit whose status reads "Expiring in N days" counts as spendable until its end date.

Run at 66279e97 (macOS): node --test packages/gcp-ai/test: 44 pass, 3 skipped (Windows-only); origin/main 40 pass. bun scripts/check.mjs gcp-ai ok. The earlier review reproduced the %~dp0 cause and fix on Windows 11 with a fake gcloud.cmd.
Not tried: the new Windows-only tests on Windows at this head (the box was unreachable); the author ran them on Windows 11 with real gcloud 589.0.0.
2026-10-26 18:05:06 +08:00
yetone 017f05cbb9 gcp-ai tests: the network guard lets another package's loopback fetch through
gcp-ai's test/network.mjs (from #307) replaced globalThis.fetch with one
that refuses every call. bun test runs every package in one process, so
the guard outlived gcp-ai's files: with #384 merged on top, all eight
Search1API tests that fetch their own 127.0.0.1 fixture failed with
"Unexpected network fetch in test: http://127.0.0.1:…/search" in the
repo-wide run, and passed alone. fetch now refuses only a non-loopback
host, as the socket, http and dns hooks beside it already did. The real
fetch stays inside the module, never on globalThis.

Run (sandbox HOME under TMPDIR, HTTPS_PROXY at a dead port):
- bun test packages/gcp-ai: 40 pass, 1 skip, 0 fail.
- A script importing the guard: a Bun.serve loopback fetch answers "ok";
  https://example.com is refused and the process exits 1.
- bun test (whole repo) with this file over #384's merge: 2647 pass,
  1 skip, 0 fail. Without it: 2638 pass, 9 fail (8 Search1API, plus one
  gcp-ai Chrome test that lost its CDP connection, which passed in the
  next run).
- bun scripts/check.mjs: every package ok.
2026-10-25 17:52:37 +08:00
yetone 9a52d96cec gcp-ai: the tests' fake gcloud runs on the test's own runtime, not PATH's node
publish.yml has been red since e801e43 (#307): 20 gcp-ai tests fail with
"gcloud could not read Google Cloud credentials or configuration". CI runs
every package in one bun process from the repo root. grok's nocli.mjs
sets PATH to /usr/bin:/bin for the rest of that process, and setup-node's
node is not there, so the fake gcloud's `#!/usr/bin/env node` could not
start. Run alone, gcp-ai passed, which is how the merge was verified.

The fake's shebang now names process.execPath. The fake stays pinned by
path in each test and CLOUDSDK_CONFIG stays under the test's own HOME.

Run: `bun test packages/grok packages/gcp-ai` from the repo root, with
HOME a sandbox dir and the network pointed at 127.0.0.1:9: 20 fail before
(the CI list, plus "closing a login waits..." at its 30s bar), 122 pass
0 fail after. Full root run `HOME=<sandbox> bun test` and
`bun scripts/check.mjs` at the pushed head: see below. Linux: the 5
browser tests pass in oven/bun:1.4.2 with apt chromium (--no-sandbox
wrapper through VERTEX_CHROME_PATH), the passive sign-in one in 11s.
2026-10-25 14:54:25 +08:00
Yaka e801e434f3 gcp-ai: Vertex models and Google Cloud credits with your own gcloud ADC (#307)
New package gcp-ai (Yaka88): Vertex models and Google Cloud credits through the user's own gcloud ADC, with multiple accounts, a signed-in model list, and a pipe-only Chrome for the credits read.

Reviewed at 8989b58 against the 10-24 review at 4586c99. I read the whole incremental diff (index.mjs, lib/browser, lib/credentials, lib/lock, test/*). Earlier rounds had already reviewed the rest.
- Tests reaching the network: fixed. test/network.mjs replaces fetch and blocks non-local net/tls/http/dns. `bun test` (40 pass, 1 skip [Linux-only lock test], 0 fail, 106s) ran in a sandbox HOME/TMPDIR behind a dead HTTPS_PROXY, with a preload that logged non-local fetch and connect calls: 0 lines logged. Broken by hand: with the fetch stub removed from "already filed", the guard prints "Unexpected network fetch … userinfo" and bun exits 1. Restored, it exits 0.
- Chrome background traffic: lsof on the test Chrome processes (56 samples during browser.test.mjs, 5 pass) found no inet sockets at all.
- Leftover work after a test: close() now awaits settled, and every sign-in test closes in finally before restoring fetch.
- Smaller points: the lock's age ceiling now comes after the Linux /proc check; settings() is auth > options > env for every field; resolveAdcDirectory and authorizeAdc are removed.
- `bun scripts/check.mjs gcp-ai`: ok. The merge onto main 98985a2 is clean. Loaded into magpie's plugin host (origin/main 4dfd88206) with scripts/try.sh in a sandbox HOME: gcp-ai, 12 models, not signed in.

Not tried: a real Google account or gcloud sign-in, Windows, Linux (the lock test is skipped on macOS). The headless Console credits scrape still runs for every signed-in account, cached on failure, as noted in the earlier review.
2026-10-25 14:33:15 +08:00