Repository navigation
feat(agents): sign Pi in from Setup with provider keys and a status check - #79
Merged
Merged
Conversation
…heck Pi was install-only on the Agents page: a "Pi" text tile, no sign-in status and no sign-in controls, only a line telling you to run t3-login pi in a terminal. - Icon: Pi's mark from T3 Code's own Pi provider definition, in currentColor so it follows the theme. - Status: the harness probe runs `pi --list-models` offline. Pi lists only providers it holds credentials for, so this covers saved keys, /login subscriptions, environment keys, models.json and extensions, and matches how T3 Code decides Pi can start a turn. Pi's credential variables now count as present credentials. - Sign in: a sheet with a provider picker saves an API key to Pi's auth.json. Pi has no command for this, so Setup writes the file under the same proper-lockfile lock Pi uses, replaces it in one step (through a link if auth.json is one), honours PI_CODING_AGENT_DIR and keeps other providers and extra key settings. A key never replaces a subscription without confirmation, and keys Pi would run (!) or expand ($) are refused. - The sheet lists what Pi is signed in to (provider and kind, never a secret), including keys from the environment, removes one provider's sign-in, and gives the t3-login pi then /login steps for subscriptions, which only Pi itself can do. Tests cover the credential file, lock interplay, links, the probe and the HTTP routes. scripts/pi-auth-smoke.mjs checks the writes against a real Pi (passes on 0.80.5 and 1.4.0) and the image smoke test signs Pi in and out through the Setup API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenCode and Pi take a key per provider, and their sheet also lists and removes saved keys. The row's button read "Add key" even with keys saved; it now reads "Manage keys" once OpenCode or Pi's auth.json holds one, and "Add key" until then. Keys in Pi's environment don't count: the sheet cannot change them. The README picture shows OpenCode's row, so it is regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pi landed as install-only on the Agents page (#76). It had a "Pi" text tile, a status line telling you to run
t3-login pi, and no sign-in status or controls. This PR gives it the same treatment as the other agents.Icon. Pi's own mark, from T3 Code's Pi provider definition (
packages/provider-pi/src/client.ts). It is one colour, so it follows the theme.Sign-in status. The probe runs
pi --list-modelswithPI_OFFLINE=1. Pi lists only providers it holds credentials for, so this covers saved keys,/loginsubscriptions, environment keys,models.jsonand extensions. T3 Code uses the same signal to decide Pi can start a turn. A probe that cannot answer still shows "Couldn't check its sign-in", never "Not signed in".Sign in. The row's Sign in button opens a sheet that:
auth.json;t3-login pi, then/login. Only Pi itself can do that sign-in, and it has no command Setup could run.The row menu also has Sign in with a subscription…, which opens the sheet on those steps.
Manage keys. OpenCode and Pi take a key per provider, and their sheet also lists and removes saved keys. Their button now reads Add key until a key is saved and Manage keys after. Keys in Pi's environment don't count, since the sheet can't change them. The README picture shows OpenCode's row, so it is regenerated.
How keys are written
Pi has no command that saves a key, so Setup writes
auth.jsonitself:proper-lockfilelock (auth.json.lock) that Pi takes for its own writes and token refreshes, with Pi's 30 second staleness rule;auth.jsonis one (a link to a missing file is refused);PI_CODING_AGENT_DIRwhen that is set, keeping every other provider and any extra settings saved with an earlier key;/loginsubscription without confirmation, because Pi keeps one sign-in per provider;!or contains$, because Pi would run it as a command or expand it as a variable.Screenshots
The same fixture data on
mainand on this branch.Agents, desktop
Agents, phone (dark)
Sign-in sheet
Testing
node --test tests/*.test.mjs: 1081 of 1082 pass. The one failure, "saved API token works through the CLI and connection test" incredentials-api.test.mjs, is flaky under parallel load. It passes 3 of 3 times alone, on this branch and onmain, and touches nothing here.tests/pi-auth.test.mjs(12 tests): saving beside subscriptions, replacement only on request, refused keys and ids, removal, unreadable files left untouched, links, waiting for and clearing Pi's lock,PI_CODING_AGENT_DIR, environment keys, model-list parsing, the probe, and the HTTP routes against the real setup server (no secret in any response).scripts/pi-auth-smoke.mjsagainst real Pi 0.80.5 (the supported floor) and 1.4.0: passes on both.scripts/opencode-auth-ui-audit.mjs(the key sheet is shared with OpenCode): every layout passes, now opening the sheet from Manage keys once accounts are loaded.scripts/harness-ui-audit.js: 29 of 29. shellcheck onsmoke-test.sh: clean.Not in this PR
/loginfrom the console. Pi has no CLI or RPC command for it.pi auth checkper provider (Pi 0.84.1 and newer). The model list already covers every credential source and also works on older versions.🤖 Generated with Claude Code