Modal that captures and persists an API key for one provider.
Dismissal values are members of AuthResult so callers in the recovery
path can distinguish "user just saved a key ā retry the failed
operation" from "user just cleared their key ā don't retry, that would
loop into the same error" from "user cancelled ā leave state alone".
Provider name (e.g., "anthropic").
Canonical env var the SDK reads, shown as helper text.
May be None for providers that don't use one of the
hardcoded env-var bindings (rare; the prompt still works).
Optional one-line context, e.g.,
"Required to use anthropic:claude-opus-4-7".
Compose the prompt.
Apply ASCII border when needed.
Validate, persist, and dismiss.
Reads both fields regardless of which one was submitted, so pressing Enter in either the key or the base-URL input saves the pair.
Dismiss without saving.
Open the delete-confirmation overlay, or quit when nothing is stored.
Ctrl+D deletes a stored credential, but its priority binding also
intercepts the app-level Ctrl+D=quit. When there's no credential to
delete, fall through to quit rather than swallowing the key (mirroring
the thread selector). app.exit() is used instead of dismiss(), which
would just close the modal silently and re-swallow the key.