Repository navigation
DSCODE 0.7.32
DSCODE 0.7.32
This release makes an OpenCode account login the only way into OpenCode Go and shows the subscription's usage in the footer. /opencode login runs the OpenCode console's device login, and the console API key that 0.7.31 introduced is no longer read.
/opencode [login|cancel|logout](new):loginasks the OpenCode console for a device code, opens the verification page in the browser, and answers at once with the code and the URL. It then keeps polling in the background, because a command settles with one result and cannot print while it waits. It handlesauthorization_pending,slow_down(five seconds more per answer) and transient gateway errors until the code expires, which is ten minutes./opencodereports the stored login (account, organisation, days left), an attempt still waiting (its code and URL again), or how the last attempt ended.cancelstops the polling.logoutremoves the local login and the cached usage, and says plainly that the token stays valid on OpenCode until it expires or is revoked in the console. The strings are translated into all six interface languages.- The OpenCode CLI's login client (design): the console answers the device flow for the public client
opencode-cli, which is OpenCode's own CLI. DSCODE uses that client id, so the consent page names the OpenCode CLI. The command says so before the browser opens. The guide says OpenCode can restrict the client at any time, and that the route stops working if it does. - The account's own endpoint: the access token is refused on the public
zen/go/v1endpoint (HTTP 401, with or without an org header). The console's/api/confignames an inference endpoint foropencode-goper organisation, and that endpoint takes the token as a bearer plusx-opencode-org-id. At login DSCODE reads/api/userand/api/orgs, then takes the first organisation by name whose config carriesopencode-go, and stores its endpoint with the grant. An account without Go in any organisation fails the login with that reason. The OpenRouter adapter's request loop gained aresolveAuthhook that returns the bearer, the base URL and extra headers; OpenRouter's own default is unchanged, and the Go adapter returns the login. - API key route removed (changed): the Go route's credential reference is now the login itself (
OPENCODE_OAUTH). The credential store describes it as read-only, so no key form is ever offered. The provider catalog marks the route with the command that sets it up./provider opencode-gobefore signing in, and/login opencode-go, now showOpenCode Go is not signed in; run /opencode login firstinstead of opening a key field. The picker showssigned inornot signed in · /opencode login. A request made while signed out fails with the same instruction. AnOPENCODE_API_KEYsaved under 0.7.31 stays in~/.dscode/credentials.yamlbut is no longer read, and the route'sapiKeyEnvandbaseURLsettings are gone. - Renewal with rotating refresh tokens: tokens last 30 days, and a request made within five minutes of expiry refreshes first. Every refresh returns a new refresh token and voids the old one; the probe confirmed this, since reusing the old token answers
invalid_grant. So the new pair is written back at once, and one process runs one refresh at a time. When a refresh is refused, the store is read again before giving up, because another DSCODE session sharing the store may have rotated it already. Only when nothing newer is stored does the request fail, asAUTHwith a message asking for/opencode login. DSCODE keeps its own grant and never touches an OpenCode CLI login, which would have its refresh token voided the same way. - Subscription usage in the footer (new): Go caps usage per rolling five hours, per week and per month. The console's own proxy maps the public
/zen/go/v1/usageto/go/v1/usageon the inference service. There, the account token plusx-opencode-org-idanswers all three windows, each with a used percentage,okorrate-limited, and the reset time. Without the org header the endpoint answers 403. The plugin reads it once a minute while signed in, and right after a login. It keeps the last good snapshot through a failed read, and writes the snapshot toDSH_HOMEfor the terminal process, as the Grok window does. On this route the money slot showsGo · 5h 12% · 7d 3% · 30d 1%. An exhausted window is marked!, and the slot addslimited until MM-DD HH:MM, the latest reset among the exhausted windows. An unread snapshot showsGoalone. The endpoint is undocumented, so every field is optional and a changed shape reads as unavailable.
Verification: npm run check passed on macOS. That covers lint, both typechecks, 586 unit tests at 85.08% measured .mjs line coverage, the nine native Harness integration probes, both package tarballs and 51 evaluations. The unit tests drive the device login against a fake console through pending, slow-down and gateway errors, organisation selection and the refusal paths. They cover the grant session's refresh near expiry, one shared refresh for concurrent requests, adopting another process's rotation, and a revoked login. They also cover the command's background sign-in, status, cancel and logout, and requests going to the login's endpoint with its org header. They check that the store describes the login as a read-only credential, and they exercise the usage URL, parsing, caching, file snapshot, sign-out clearing and the footer fact. scripts/verify-login-runtime.mjs checks, in a real Harness Host, that the Go row is a read-only credential and that a signed-out request names /opencode login. It then stores a synthetic login and checks that the row reads as signed in and that the next request goes to the login's endpoint with its bearer and org. Against the real console, DSCODE's login code signed in with a real account. It ran a kimi-k3 tool call and replay, then forced a refresh; both tokens changed and the next request answered. With a later login, the account token read the usage endpoint at /inference/go/v1/usage (200 with the org header, 403 without, 401 on the public endpoint).
What has no automated case: /opencode was not typed into a live terminal; the command was driven through its handler. The footer was checked as a rendered string, not in a running terminal, and the usage refresh loop was not observed against the real endpoint inside the plugin; the endpoint itself was read by a probe. A refresh racing between two real processes was exercised only against the fake console. An account with several organisations holding Go was not available.