Files
plugins/packages
yetone 29547d4200 agy-cli 0.1.97: usage finds an agy installed since at once, and a sign-in is named by its Google account
@tmr11235 on X (magpie v0.1.4520):

1. "The model test works, but the account says there is no CLI."
   Usage held its "agy CLI not found" error for the backoff, which grows
   from 10 minutes to 6 hours. A read made before agy was installed kept
   saying "not found" for hours after a sign-in installed agy, while
   chats and model tests already ran through it. Now:
   - no agy found is never held;
   - a held failure belongs to the agy path it was held for, so an agy
     found since is read on the next refresh;
   - the message says how magpie gets agy (sign in again), in noAgy's
     words.

2. "After removing it and signing out, 登录 restored the account with no
   sign-in, shown as API key." magpie's remove/sign-out deletes only
   magpie's record. agy on the computer stays signed in, so 登录 adopts
   that sign-in again with no browser (method 0's "auto"). That part is
   by design. The "API key" label came from a sign-in saved without an
   email: agy's keyring value names its account in id_token_email, and
   when it doesn't (or the read fails), the saved record had no
   metadata.email. pluginLabels then falls back to the record's type,
   "API key". signedInAs now asks Google's userinfo with agy's own
   access token when the stored value names no account, so the account
   is listed under its email. An account saved before this keeps its
   label until its next sign-in (登录 on it), which saves the email.

Their later quota "as of 2026/11/15, couldn't be read just now" is not
this: "not found" isn't a passing error, so magpie shows it rather than
an old reading. The read behind it fails with a timeout, 429 or network
error that magpie stood an old reading in for; magpie now says which
beside the date (magpie, readError).

Run (at origin/main bb849910 + this commit):
- mote, HOME=$(mktemp -d): packages/agy-cli `bun test`: 41 pass, 0 fail (3 files, 132s)
- test/usage.mjs alone: 46 pass, 0 fail. test/signin.mjs alone: 8 pass.
- The two new usage tests on the old usage.mjs (origin/main's), by hand:
  both fail. signedInEmail's test fails there too (no such export).
- Real: agy 1.5.10's stored access token on this Mac, Google's userinfo
  answers 200 with the account's email (masked in the log).
- Real Claude Code 2.1.327 through a sandbox magpie (agy-cli 0.1.96,
  agy 1.5.10, gemini-3.8-flash, file sign-in in a sandbox HOME), for
  the cache report from @niyezaimenglima: first run with a Read call
  48,427 of 78,349 input cached; a --continue run 30,296 of 33,088
  cached; one agy session for the conversation. Not reproduced, so no
  change here for it.

Not tried: the reporter's own keyring value (whether it lacks
id_token_email, or an env sign-in was set); Windows and Linux; the
sign-in flow end to end in the GUI with the userinfo fallback.
2026-11-19 17:06:10 +08:00
..
middleware: param-override, model-map, system-prompt, word-guard and think-tags — gateway middleware that magpie runs on every agent's requests and replies, mostly New API's channel settings with the same JSON (the owner) — magpie can now run a plugin as gateway middleware (onRequest, onEvent, onResponse, in-process on moejs), and these are the first ones: param-override is New API's param_override (both forms, operations with gjson paths and conditions, return_error); model-map is model_mapping (chains, /regex/ keys with $1) and puts the asked-for name back into replies; system-prompt adds a prompt in each API's own place, keeping an agent's own unless override (New API's semantics), by agent or model; word-guard is the sensitive-word filter (reject or mask the user's text, optionally replies); think-tags strips a leading <think>…</think> from replies across stream chunks, or puts Chat reasoning_content into the text (thinking_to_content). Each is one file with no imports, named @magpie-community/middleware-<name>, with magpie.options as the example the app's editor starts from; registry.json lists them with "kind": "middleware" and no providers; check.mjs skips middleware-only packages. scripts/middleware.mjs calls the hooks as the gateway does (events split, [DONE] passed by) and runs each package's cases.json. Tested with a real DeepSeek account and real Claude Code through magpie's gateway: a mapped model named back in message_start, max_tokens capped, a system prompt appended for claude only, a word turned away as a 400 in Anthropic's shape, return_error as a 403 in Chat's, <think> stripped from Chat and Responses streams and an Anthropic whole reply, reasoning_content moved into the text. bun test (61 for these five) and bun scripts/check.mjs pass; packages/devin's two image tests fail on this machine only, as on main. Their first npm version has to be published by hand (trusted publishing can't create a package); until then magpie shows them as Coming soon.
2026-10-05 20:49:42 +08:00