Skip to content
pi-c Artifact [dddbfb4a7c]
Login

Artifact [dddbfb4a7c]

Artifact dddbfb4a7c9c3a25268b8d69a1cb752ea8a67a6bae60e54da66edef528acf278:


# Subscription sign-in

Status: implemented on the oauth-login branch (ticket 30); the credential seam awaits the owner's
review

Tier: bundled (`src/oauth.c`, `src/oauth_openai.c`, `src/oauth_openrouter.c`). Clock: vendor. Record:
a `picu_credential` row of kind `oauth`. Default: on.

## The seam

Core's credential store (`cred.h`) gains `pic_cred_oauth_ops`: a sign-in label per provider, a login
that returns what to seal, and a refresh. The composition root registers the bundled table; core
calls only through it, so core names no provider and links without the flows (tiers checks 4 and
5). It is a new seam, which [keel](keel.md) sends to the owner. The lighter alternative, the flows
in core with the provider names behind an allowance, was refused: the allowance only shrinks.

## Decisions

- Providers: OpenAI's Sign in with ChatGPT (OpenAI's published program for open-source agents, Pi a
  launch partner) and OpenRouter (documented PKCE for third-party apps). Pi's Anthropic sign-in is
  refused by Anthropic's terms (February 2026); Codex, Copilot, xAI, Meta and Kimi reuse first-party
  client ids with no published permission. None of them is built.
- Refresh runs under a lock file beside `pic.sqlite`, not a `BEGIN IMMEDIATE` around the network
  call, so other writers never wait on a token endpoint. The row is read again inside the lock.
- RPC: Pi has no credential commands. pic's `login` and `logout`, which used to refuse, now work, and
  `get_auth_status` is pic's own.
- The device-code poll (RFC 8628) is built and tested, but no provider pic signs in to offers it.