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.
@magpie-community/opencode-nous-auth
Signs in to Nous Portal with its OAuth
Device Authorization flow and sends model requests in
magpie and OpenCode. Provider id:
nous-portal. This is separate from magpie's nous API-key preset.
Signing in
Once the package is available from magpie's plugin registry:
magpie plugin add @magpie-community/opencode-nous-auth
magpie plugin login nous-portal
Magpie displays a verification URL and a code. Open the page, sign in and approve the code there; finish any CAPTCHA in your browser. The plugin polls for approval and completes sign-in without a local callback server. Hermes Agent does not need to be installed or running.
In OpenCode, add "@magpie-community/opencode-nous-auth" to the plugin
array in opencode.json, then run opencode auth login.
The flow uses Nous Portal's /api/oauth/device/code and /api/oauth/token
with public client hermes-cli, scope inference:invoke, and no client
secret. Device polling follows RFC 8628,
including the server's interval and slow_down responses. Nous has not
confirmed whether independent clients may use the public hermes-cli
OAuth client ID.
For ChatGPT plan sharing, see Nous Portal's documentation.
Where the sign-in is kept
Magpie keeps the account in its plugin credential store; OpenCode uses its own
sign-in store. The saved OAuth fields are access (inference JWT), expires
(epoch milliseconds) and refresh (versioned JSON containing the refresh
token, scope, token type and inference endpoint). The entire refresh value
is secret, even though it looks like JSON.
Expiry uses the earlier of the token response's lifetime and the JWT's exp.
If both are absent, renewal is scheduled one hour after the exchange, with
the same two-minute lead. This is a local fallback, not a Nous lifetime
guarantee; a 401 can still trigger renewal sooner. Explicitly expired or
malformed lifetimes are not extended.
Nothing is read from or written to ~/.hermes/auth.json. A separate device
sign-in is intentional: Nous refresh tokens are single-use, and copying one
from Hermes could invalidate Hermes's session when either program renews it.
Magpie uses auth.refresh with a two-minute lead and saves the rotated
tokens. OpenCode does not call that hook, so the plugin also checks before
each request and persists renewals through client.auth.set. Concurrent
refreshes within one plugin instance share one exchange. A rotated pair is
kept in memory before a save is attempted, so a failed save does not cause
that instance to reuse the old refresh token.
Do not run multiple hosts against the same saved account. The per-request
save is not an atomic cross-process operation; a crash during an unsaved
rotation may require signing in again. Only explicit invalid_grant,
invalid_token or refresh_token_reused errors mark the grant expired.
Other refresh refusals, including HTML or empty 401/403 responses, keep the
credentials and allow a later retry.
Requests
Models use OpenAI Chat Completions (@ai-sdk/openai-compatible) at
https://inference-api.nousresearch.com/v1. Magpie translates requests from
other agent protocols. Every request uses the current inference JWT as a
Bearer token; the refresh token is sent only to Portal's token endpoint in
x-nous-refresh-token, never to inference.
The plugin accepts only known inference paths (/models, /chat/completions,
/completions, /embeddings) at the production Nous inference or welcome
host. A Portal response cannot redirect Bearer tokens to an arbitrary host;
HTTP redirects are refused. Caller-supplied credentials and magpie-internal
headers are removed before forwarding.
A 401 triggers at most one refresh and retry. Other upstream errors keep
their status, and streaming responses pass through without buffering or
rewriting their content. The upstream content-encoding and content-length
headers are removed because fetch may already have decoded the body.
Models
After sign-in, the account's live /v1/models list replaces the single
bootstrap entry (Hermes-4-70B). Model ids are preserved, including the
vendor prefix such as openai/gpt-6-luna. In magpie an exposed model is
addressed as nous-portal/openai/gpt-6-luna.
Magpie may initially expose only part of the catalog. To choose a model listed for your account and test it:
magpie provider refresh nous-portal
magpie provider models nous-portal +openai/gpt-6-luna
magpie provider test nous-portal openai/gpt-6-luna
The provider test command takes the upstream id (openai/gpt-6-luna), not
the magpie-prefixed id. Model availability and billing depend on the account;
a model appearing in /models does not guarantee access. The plugin does
not guess model prices, context limits or vision/reasoning capabilities when
the catalog does not provide them. A failed catalog read does not become an
empty entitlement list.
Not included
- Nous Portal API keys (
nousremains magpie's separate built-in preset). - Importing Hermes credentials or running Hermes's subscription proxy.
- Direct ChatGPT/Codex OAuth, billing or quota reporting, or daily check-in.
- An arbitrary inference URL override or cross-process token coordination.
Test
Run the offline checks from the repository root with a temporary HOME:
h=$(mktemp -d)
HOME="$h" node --test packages/nous/index.test.mjs
HOME="$h" bun test
rm -rf "$h"
bun scripts/check.mjs
Before publication, try the local package with magpie's isolated test script:
export MAGPIE=/absolute/path/to/magpie
sh scripts/try.sh nous
sh scripts/try.sh nous login nous-portal
sh scripts/try.sh nous provider refresh nous-portal
sh scripts/try.sh nous provider test nous-portal openai/gpt-6-luna
try.sh uses .sandbox/nous rather than your real magpie sign-ins. It clears
ordinary environment variables, including proxy settings; configure a proxy
inside the sandbox if needed. Do not use a portable Windows magpie binary
that ignores HOME isolation. Sign-in and provider test contact Nous Portal;
the latter may consume account credits. Test a model your account can use,
and never share the sandbox's credential files.
Protocol reference: Hermes Agent's device flow, refresh handling and Nous Portal proxy adapter.