Documentation
¶
Overview ¶
Package login is the supervisor's store of the owner's model logins (supervise.md, "The workspace runner"): the Claude token `factory-agent login claude` reads on stdin and the codex ChatGPT login `factory-agent login codex` imports from codex's auth.json. Each is a file under <statedir>/logins (0700), written 0600 through a temp file and a rename. The gateway reads the claude login on every request, so a re-import applies to the next one. The codex login is the gateway's chatgpt.Refresher's Store (ChatGPT): it refreshes the tokens and writes them back here.
No value here is ever logged or printed: Codex's String, Format, LogValue and MarshalJSON redact, and every error names the file or the field, never its content.
Index ¶
Constants ¶
const ( ClaudeFile = "claude.json" CodexFile = "codex.json" )
The store's files.
const Dir = "logins"
Dir is the store's directory under the state dir.
Variables ¶
var ErrNoLogin = errors.New("no login")
ErrNoLogin is a login that was never stored.
Functions ¶
func ClaudeToken ¶
ClaudeToken is the one OAuth token in text: what `claude setup-token` printed around it (prose, a URL, terminal escapes), as pasted. A token repeated is one; none, or two different ones, is an error that names neither.
Types ¶
type ChatGPT ¶
type ChatGPT struct{ Store Store }
ChatGPT is the codex login as the gateway's chatgpt.Refresher loads and saves it.
type Codex ¶
type Codex struct {
AccessToken, RefreshToken string
AccountID, UserID, PlanType string
Issuer, ClientID string
LastRefresh time.Time
}
Codex is the owner's codex ChatGPT login: the tokens, the account identifiers the run bundle carries (runbundle.CodexAccount), codex's tokens.oauth_provenance (Issuer and ClientID, both or neither) and its last_refresh. It never prints its values.
func ParseCodexAuth ¶
ParseCodexAuth reads codex's auth.json (a ChatGPT login): the tokens, the account identifiers from the id_token's claims (its signature isn't checked: the file is the owner's own), tokens.oauth_provenance when it has one (codex main writes it; rust-v0.163.0 doesn't) and last_refresh. tokens.account_id, when set, must match the claim's.
type Store ¶
type Store struct{ Path string }
Store is the login store at Path (<statedir>/logins).
func (Store) SaveClaude ¶
SaveClaude stores token, the one ClaudeToken found in `claude setup-token`'s output: one line, surrounding white space trimmed.