ADR 0012doc/{zh,en}/adr/0012-unified-login.md

ADR 0012: Unified Login and Per-Person Credentials

Status: accepted, 2026-11-19 (P87; the owner's decisions in the unified login research, section 8). Slice S1 of the design; decisions 8 (slice S3) and 9 (slice S2) amended it on th

Status: accepted, 2026-11-19 (P87; the owner's decisions in the unified login research, section 8). Slice S1 of the design; decisions 8 (slice S3) and 9 (slice S2) amended it on the same day, and decision 10 (slice S4, built the same day) replaces decision 1. Decision 11 (slice S5, 2026-11-20) replaces what decisions 1, 6, 9 and 10 keep per person. Decision 12 (slice S6, 2026-11-20) replaces Orquelo's own browser and its live view (decision 9) with the agent-browser CLI.

Context

People ask the agent to log in to third-party CLIs and sites on their behalf, mostly from Feishu on a phone. Later runs then act as them. The Host has no way to keep a login's state across the wait or to keep a person's credentials apart from everyone else's. It also cannot take a code or a token from the person without it reaching the chat, the session and the model. The steps differ for every service, but the owner decided that no Host or plugin code may know a service (decision 7).

Decision

  1. Login skills. SkillCard.Credential (plugin.CredentialSpec) comes from a credential block in a skill's front matter: service, title (a message key of the skill's plugin), home_env, env (variable → secret name), browser_profile and expires_after. The Host validates the block and runs nothing from it. A service defined by two visible skills makes both invalid, and they are left out of the skill list. home_env and env may not name the Host's own variables (plugin.ReservedEnv).
  2. Login state (internal/host/login). The Host keeps two tables. logins has a 30-minute deadline, and a person has at most 3 open logins; a new open for the same person and service cancels the earlier one. credentials holds one row per person and service, with the state active, expired or logged_out. Each person's files for a service are kept in state/credentials/<person>/<service>/. Secrets go into the encrypted secret store. A person is the Host's user, so linked accounts share credentials.
  3. Login tools. The Host adds credential_open, sign_in_show, sign_in_ask and credential_close to a runtime's tool list only when a valid login skill is visible to it. Like ask_user, each one acts for the run's trusted principal. In a group conversation each refuses with login.direct_only and records nothing. A tool plugin's nested calls never see them.
  4. The sign_in question. plugin.QuestionSignIn carries a plugin.SignInView in Question.SignIn and QuestionView.SignIn. It is either a live view, which each sign_in_show updates in place with a new version and the login's end settles as completed, failed, expired or closed, or a secret entry. Only the requester may answer it: a delegated approver and an admin may not. An answer never comes from chat text. It comes from a channel's own secret input (a card's password field, a masked prompt) through TransportHost.Answer. The interaction records [secret], and the value is kept encrypted under the login. The model receives only the reference secret:<login>/<n>. A login accepts at most 5 answers.
  5. Secret references. A tool resolves a reference at call time through the optional plugin.SecretResolver (host/resolve_secret for process plugins), for example localenv's bash with secret_env. A reference is valid only while its login is open, and only for the same person and run. Every value resolved in a run is replaced by [secret] in that run's later tool results, before the ledger records them.
  6. Credentials in calls. The new instance option credentials: [service, …] gives that instance CallContext.Credentials (plugin.Credential): for each listed service the person has active, the directory, the home_env variables set to it, and the env variables filled from the secret store. While a login is open, every tool call of its run also gets the login's directory. Credentials are added only to the call made to the instance that receives them, never to the context that guards, context providers or observers see. plugin.Env.CredentialRoot names the root, which file tools must refuse.
  7. Commands. The trigger decisions login, logins and logout (the chat trigger's /login <service>, /logins and /logout <service>) are handled by the Host on every connection. /login starts the service's login skill. The other two list and revoke the sender's own credentials. In groups all three are refused with login.direct_only. Operators use orquelo login list|revoke. Revoking deletes the row, the directory and the secrets, and every open, close, use and revocation is logged without the material.
  8. MCP OAuth (S3, amends ADR 0004). A person's token for a remote MCP server is their credential mcp:<server> of the instance; the broker keeps it through login.OAuthStore, so it is listed, revoked and marked logged out like any login. {prefix}__sign_in shows a sign_in card of kind link in the requester's direct chat, through the Host's SignInLink, which manifest adapters use. A login completes when the person's credential of its service and source becomes active after it opened, as the OAuth callback makes it. In a group the tool is refused with login.direct_only, instead of asking in the requester's direct chat.
  9. Connect page and browser (S2). The Host serves /connect/{token} on the ADR 0004 listener. A link is random, kept only as a hash, entered once within 10 minutes, and only with the 6-digit code shown on the person's sign-in card; five wrong codes kill it. This is the owner's choice of 2026-11-19, instead of a channel login; it proves access to the person's direct chat. Its page session lasts as long as the login. It hosts the password of a sign_in_ask (input password), which answers the entry as the requester, and the live view of sign_in_show (kind live_view). Without a public URL both report login.needs_public_url. plugin.Credential gains Profile, the browser profile inside the person's directory when the skill sets browser_profile, and Login. A tool plugin may implement plugin.LiveViewer (LiveFrame, LiveInput; builtin plugins only for now) to show and drive a login's page. The builtin browser plugin offers generic page tools on Chrome, Chromium or Edge through its own small DevTools client; browser_fill takes a secret: reference.
  1. One login plugin (S4, the owner's decisions of 2026-11-19). The per-service login skills give way to one skill-only login plugin. Its login skill lists the services it knows in a credentials front-matter list, in place of decision 1's single credential block; per_site: true makes one service per site, web:<site>, and credential_open refuses a site that is not public (login.not_public). A service opens only when an instance lists it in credentials, the operator's one list (login.not_enabled); web there covers every site. /login <words> starts the login skill with the person's words, and the model drives every login by that skill, the owner's choice over a relay without the model. What a service needs beyond the generic steps is a note in that skill. A CLI is pointed at the person's folder by its own variables, not by a per-person HOME, which cost lark-cli its macOS keychain.
  1. One person (S5, the owner's decisions of 2026-11-20). Logins serve the agent's tools and data, CLIs and websites alike, and for now one person. A login lands where the CLI or the site keeps it anyway: in the CLI's own configuration in the Host user's home, and in the browser's one persistent profile. The Host stores nothing for it and adds nothing to later calls. This removes the per-person folders and the credential root, CallContext.Credentials and the credentials instance option (decision 6), the browser profile per credential (decision 9), and the skill's credentials and per-site services (decisions 1 and 10). MCP sign-ins keep their tokens per person (decision 8). Only admins log in, and only in a direct chat (login.admins_only), since a login acts for everyone who uses the bot. The login skill is marked by metadata.orquelo.login, and the model finds each service's login itself; a note in that skill is added only where it cannot. The browser runs headless and opens a window on the Host's screen on request, for picture checks and sliders. Several people need a sandbox per person (design, section 8).
  1. The browser is a CLI (S6, the owner's decisions of 2026-11-20). Orquelo does not build its own browser. Websites are reached through Vercel's agent-browser CLI, driven through the shell like any CLI, with its own usage guide (agent-browser skills get core); the agent-browser plugin brings the CLI, which installs with it, and adds one skill for using it here. Every task uses one session and one persistent profile, which the plugin gives the shell (ADR 0001, decisions 8 and 9), so a site's login lands in that profile. A code from sign_in_ask is typed through secret_env, as for any CLI. A QR screenshot reaches the card through localenv's read, which names an image's artifact. A picture check relaunches the same profile in a window on the Host's screen (--headed). The builtin browser plugin, LiveViewer and the connect page's live view are removed; a person away from the Host logs in with a QR code or a code. Every shell result is marked untrusted, since web pages now reach the model through it.

Consequences

  • ◆New optional fields in Question, QuestionView, SkillCard, CallContext and Env, three decision actions, one optional host method, and two store tables. Old plugins ignore all of them. Process plugins gain host/resolve_secret.
  • ◆A shell running as the Host's OS user can still read the credential files. Keeping them from the model fully needs a sandbox, which is out of scope.
  • ◆Web pages reach the model as shell output, marked untrusted like every shell result (decision 12). The agent-browser CLI is a prerequisite of the Host, outside Orquelo's code and releases.