feat(login): send install context to the browser consent page (v1.56.0) - #195
Merged
Merged
Conversation
…n and install-context tags Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ontext tags Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…nt page Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…RL override Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…e and cancel on the callback Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…n whoami and logout Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…mary Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ackend Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…llback server - One saveCredentials() in lib/config.ts replaces four hand-built config literals (login, init --auth, update-key, fresh setup) that dropped the OpenAI key, memory settings and telemetry opt-out on every re-login, and writes only the requested scope, so a new global key is no longer clobbered by resolveConfig()'s project-first re-read. - The whoami cache records the API base it came from and is withheld when ONE_API_BASE points elsewhere, in both directions. - getApiBase() honours ONE_API_BASE from .onerc as the README already said. - `one config` prefills the stored base, not the env override, and drops the consent-page key name when a pasted key replaces the minted one. - `one whoami` shows the key name only when the config's key is the one that authenticated (not an ONE_SECRET or .onerc key); logout shows the name even without a cached account record; init summaries show it. - Callback: a minted key wins over an error param, error=cancelled is matched exactly and other values surface as a failure with the reason, the key name is stripped of control characters and capped at 120, and EACCES retries like EADDRINUSE for Windows' reserved port ranges. - browserLogin uses the agent-aware note and spinner, printing the auth URL to stderr in agent mode so stdout stays a single JSON document. - "Browse all platforms" follows ONE_APP_URL like the rest of init. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…and drop Cursor's editor marker - No device id is sent, or minted on disk, when telemetry is disabled (DO_NOT_TRACK, ONE_NO_TELEMETRY, CI, or telemetry: off); the terminal disclosure and the docs now list the device id. - CURSOR_TRACE_ID is exported into every Cursor integrated terminal, so it no longer counts as an agent launcher; CURSOR_AGENT still does. - A cliVersion() of "unknown" is omitted instead of sent. - The user assertion tolerates os.userInfo() throwing in containers. - README notes that ONE_APP_URL / ONE_API_BASE are per-process and never persisted, and to pair them with ONE_HOME for a local stack. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…tale name, and scoping the write Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The design spec and implementation plan are working notes for building the feature, not documentation the CLI ships or a contributor needs. The older unified-memory plan goes with them, since docs/ held nothing else. Co-Authored-By: Claude Opus 5 (1M context) <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
Browser login now tells the consent page where this CLI is installed, and learns the key's name (and a cancel) back from it. Together with the backend (withoneai/pica-v2#750) and frontend (withoneai/core-ui#733) changes, the key minted by
one login/one init --auth browseris named (e.g.CLI · Claude Code · acme) and tagged with scope, project path, machine, OS user, CLI version, and the harnesses using it, so the dashboard can show every install.src/lib/install-context.ts(new): collects scope, project path (project scope only), hostname, OS and release, arch, OS user, the stable device id from~/.one/device-id, CLI version, installed harnesses (agent registry plus~/.gemini,~/.openclaw,~/.hermes,~/.devin), and the launching agent from env markers (CLAUDECODE,CODEX_SANDBOX,GEMINI_CLI,CURSOR_AGENT, …). Best-effort: nothing here can fail a login.src/lib/browser.ts: the auth URL carries the context as readable query params;ONE_APP_URLoverrides the dashboard origin.src/commands/login.ts:browserLogin({ scope }); the callback acceptsnameanderror=cancelled(state is still verified first), so a browser Cancel ends the wait instead of the 5-minute timeout. The terminal note lists exactly what the page will record.init,whoami,logoutshow the key name; it is stored asapiKeyNamein config.ONE_API_BASEenv override for the API origin (mirrorsONE_APP_URL) for running against a local backend.one guide,skills/one/SKILL.md, README. Version 1.56.0 (minor).Works against the current page too: the extra params are ignored and the flow behaves as before.
Review fixes (last two commits)
saveCredentials()inlib/config.tsreplaces the four hand-built config literals. They dropped the OpenAI key, memory settings, and telemetry opt-out on every re-login, andone loginthen re-read throughresolveConfig()and wrote the project config's key over the new global one. Writes go to exactly the requested scope.whoamicache records the API base it was fetched from and is withheld whenONE_API_BASEpoints elsewhere, so a local backend's org and project ids never reach the hosted dashboard, or the reverse.DO_NOT_TRACK,ONE_NO_TELEMETRY,CI, ortelemetry: off. The terminal disclosure and the docs now list it.CURSOR_TRACE_IDno longer counts as an agent launcher (Cursor exports it into every integrated terminal);CURSOR_AGENTstill does.errorparam,error=cancelledis matched exactly and other values surface as a failure with the reason, the key name is stripped of control characters and capped at 120, andEACCESretries likeEADDRINUSEfor Windows' reserved port ranges.browserLoginuses the agent-aware note and spinner; in agent mode the auth URL goes to stderr so stdout stays one JSON document.getApiBase()honoursONE_API_BASEfrom.onercas the README already claimed;one configprefills the stored base rather than the env override and drops the minted key's name when a pasted key replaces it;one whoamishows the name only when the config's key is the one that authenticated; logout shows it without a cached account record; init summaries show it; "Browse all platforms" followsONE_APP_URL.Test plan
npm run typecheck,npm run build, and the new suites:src/lib/install-context.test.ts(13),src/lib/browser.test.ts(4),src/commands/login.test.ts(7),src/lib/config-api-base.test.ts(6),src/lib/config-credentials.test.ts(3). Fullnpm test: 528 of 534 pass.ONE_HOME=/tmp/x ONE_APP_URL=http://localhost:4202 ONE_API_BASE=http://localhost:5005 node bin/cli.js init --auth browser --project: the key landed withname = CLI · Claude Code · cliand the full tag set;whoamishows the name; Cancel in the browser ends the command immediately.npm testalso reports six pre-existingresolveConfigfailures on macOS (/varvs/private/varin the test's temp path); they fail onmaintoo and are untouched here.🤖 Generated with Claude Code