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 blobafe074cb. 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/maine7cb9dc5: 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.
opencode-warp-auth
Warp (the terminal, warp.dev) AI credits as an OpenCode/magpie provider,
through the Warp app's own sign-in. Provider id: warp.
Warp's agent mode speaks its own protocol — a protobuf Request POSTed to
https://app.warp.dev/ai/multi-agent over HTTP/2, answered as SSE whose
data: lines are base64 protobuf ResponseEvents — and this plugin answers
OpenAI-style chat completions on it, in OpenCode and in magpie.
Sign in
- Use the Warp app's sign-in reads the account the Warp terminal is
signed in to, using the stable GUI app's native credential store:
- Windows: DPAPI CurrentUser, from
%LOCALAPPDATA%\warp\Warp\data\dev.warp.Warp-User(with the standard home-directory fallback whenLOCALAPPDATAis unset). PowerShell runs from its System32 absolute path and decrypts encrypted bytes supplied on stdin; file contents are hashed to cache decryption safely across file replacements and clock changes. - macOS: the default Keychain's generic password with service
dev.warp.Warp-Stableand accountUser, read using/usr/bin/security. macOS may ask you to allow access to this item or unlock the keychain; the reader waits up to two minutes for confirmation. Sign in from the Mac desktop session: SSH sessions can be denied access even when the desktop can read the item. Headless sessions can use a refresh token. - Linux: Secret Service attributes
service=dev.warp.Warp,key=User, read usingsecret-tool(usually provided bylibsecret-tools). When unavailable, the plugin reads Warp's AES-256-GCM disk fallback at$XDG_STATE_HOME/warp-terminal/dev.warp.Warp-User, or~/.local/state/warp-terminal/dev.warp.Warp-Userwhen unset. The plugin only reads these stores; it never changes Warp's credentials.
- Windows: DPAPI CurrentUser, from
- Warp refresh token takes a refresh token pasted by hand, for machines
without the app or an accessible system credential store. The field in
Warp's stored account is
id_token.refresh_token. This method works on Windows, macOS and Linux and never follows the local app's account. It uses one prompt and an automatic OAuth callback, so magpie does not ask for an additional API key.
The sign-in is Firebase Auth: the id token lasts an hour, and the plugin
refreshes it itself at securetoken.googleapis.com (magpie's auth.refresh
renews it ahead of expiry too). Refresh tokens may rotate; the plugin saves
the returned refresh token, or keeps the existing one when none is
returned, and never writes back to Warp's store. Chat, usage, models and
the refresh hook share
one refresh operation. App sign-in only adopts newer credentials belonging
to the original account, and re-reads the app once after a refused refresh
to recover a concurrent rotation. Switching the app to another account
does not switch this plugin's account. Sign-ins created by older plugin
versions keep using their saved refresh token; sign in again to opt into
following the app. Preview, development and TUI credential namespaces are
not auto-selected.
When Google's refresh endpoint is unreachable or temporarily fails, the
plugin retries through Warp's official app.warp.dev/proxy/token proxy.
Definitive invalid-token/account-disabled responses are not retried. An
anonymous app account is identified as anonymous; a stored Firebase custom
token is exchanged at Warp's /proxy/customToken endpoint, then the
returned refresh token is used for later renewals. These exchanges do not
create a new anonymous account.
Requests
- Chat completions are turned into one multi-agent conversation whose user query carries the whole transcript so far as JSON records (system prompt, prior turns, tool call IDs/arguments and their results), since Warp's conversation state lives in tasks the client is meant to round-trip whole. Every request therefore starts a fresh conversation. There is no server-side prompt cache between turns; the trade for not rebuilding Warp's client conversation model. JSON preserves record boundaries when content contains role markers. This remains a text transcript, so native model role isolation is not available and untrusted content still requires normal agent safeguards.
- The agent's tools are declared as one MCP server's tools
(
mcp_context.servers[].tools, JSON schema as a protobuf Struct) andsupported_toolsis pinned toCALL_MCP_TOOL, so the only tool calls that come back are calls to those tools — Warp's own shell/file tools are never run and never asked for. - Replies stream as SSE
chat.completion.chunks:AppendToMessageContentwith maskagent_output.textbecomes content deltas,AgentReasoningbecomesreasoning_content, tool calls arrive whole (CallMCPToolargs as a Struct → JSON). - A data-URL image in the last user message rides as one of
InputContext.images(the base64 text itself in the bytes field, as Warp's own client sends it); images of earlier turns are gone with the text. - The turn's end maps by reason:
done→stop(ortool_calls),max_token_limit→length,quota_limit→ an error with status 429,context_window_exceeded→ 400,llm_unavailable→ 503, internal errors or missing completion events → 502. Errors before any output use HTTP status codes; errors after streamed output use an SSE error. Non-streamed partial output never hides an error. Usage reportstotal_input_tokenswhen present; overlapping deprecated per-model totals are not added or misreported as input tokens. Output comes from per-requestTokenUsage.output. Public accounts may receive onlycontext_window_usage, without exact token counts. In that case the plugin derives an approximate input count from that fraction and the model's advertised context window, for client context meters. The response preserves the upstream fraction inusage.context_window_usageand marks the derived count inusage.prompt_tokens_detailswithestimated: trueandsource: "warp_context_window_usage". Exact input counts always take precedence. Derived counts are not billing measurements; output remains zero when Warp omits it. A short conversation can still round to 0%. - OS headers and request context follow the current platform and shell.
Client version uses
MAGPIE_WARP_CLIENT_VERSIONwhen set, then Warp's ownWARP_CLIENT_VERSIONenvironment variable (exported in Warp shells). Outside Warp, without an override, it falls back to the last tested versionv0.2026.09.02.08.27.stable_01; set the override to your installed version if the service retires that fallback. - HTTP/2 pauses reading at 4 MiB or 512 queued chunks and resumes below 2 MiB and 256 chunks, so slow callers can receive long answers without buffering the entire response. An 8 MiB / 1024 chunk safety cap remains for oversized chunks or a source ignoring pause. Individual SSE lines are limited to 8 MiB; malformed responses release the connection.
Models
The config hook declares a handful of ids (auto, auto-efficient,
auto-genius, …) for the pre-sign-in list. Signed in, provider.models
lists the account's own (~120: the auto routers plus every
family-and-effort variant) from the GetWorkspacesMetadataForUser GraphQL,
with each model's context window and vision support; cached 10 minutes. A
reasoning_effort on a family id picks that effort's variant when the
account has it.
Usage
magpie's card shows the request allowance
(GetRequestLimitInfo: used/limit of the period, when it resets —
monthly on the free plan), and any bonus credits left beside it.
Not included
- Server-side conversation continuation (
Task.messagesround-trip): the transcript carries the history instead. - Warp's own tools (shell, file edits, computer use): never exposed.
- Web search; images in tool results (only the last user message's images ride).
- Several accounts. OpenCode keeps one sign-in per provider.
Install
Once the package is published to npm:
magpie plugin add @magpie-community/opencode-warp-auth
magpie plugin login warp
For OpenCode, add @magpie-community/opencode-warp-auth to the plugin
array in opencode.json, then run opencode auth login.
To try a checkout before publication: magpie plugin add <this folder>.
Edits on disk are picked up by toggling the plugin off/on (or restarting
the host).