Class: LLMExperiment::Auth
- Inherits:
-
Object
- Object
- LLMExperiment::Auth
- Defined in:
- lib/llm_experiment/auth.rb
Overview
One-time interactive step: log the agent CLIs in to the user's plan subscriptions, and keep the credentials in a directory that every later trial mounts read-write.
Nothing is baked into an image and no API key is required. Re-run this when
a refresh token expires; llmx run stops with that instruction rather than
burning trials against a dead login.
Claude and Codex are pointed at the credential store through CLAUDE_CONFIG_DIR and CODEX_HOME, so their logins land there directly. opencode takes no such variable: it keeps credentials in XDG_DATA_HOME next to its sessions and its database, so logging in writes a whole state directory. This points XDG_DATA_HOME at a container-local directory that dies with the container and copies out the one credential file afterwards, which gets opencode the same shape as the other two without carrying its session store along.
Constant Summary collapse
- AGENTS =
%w[claude codex opencode].freeze
Instance Method Summary collapse
-
#initialize(container: nil, shell: Shell) ⇒ Auth
constructor
A new instance of Auth.
- #login(agents: AGENTS) ⇒ Object
- #verify ⇒ Object
Constructor Details
Instance Method Details
#login(agents: AGENTS) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/llm_experiment/auth.rb', line 28 def login(agents: AGENTS) wanted = wanted_agents(agents) image = ready_image! print_intro(wanted) # Interactive: hand the terminal to the container so the device flows work. @shell.interactive(*run_argv(image, login_script, interactive: true)) puts "\nVerifying what persisted..." @shell.sh(*run_argv(image, verify_script), allow_failure: true) print_persisted end |
#verify ⇒ Object
41 42 43 |
# File 'lib/llm_experiment/auth.rb', line 41 def verify @shell.sh(*run_argv(ready_image!, verify_script)) end |