mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-29 08:59:31 +00:00
feat(auth): guided credential flow — prompt for token and retry
When a thread completes with authentication_required, the router
enters "auth mode" for that user:
1. Detects credential_name from the error in the thread response
2. Looks up setup_instructions from the skill's credential spec
3. Emits AuthRequired to CLI/gateway with instructions
4. Stores PendingAuth — next user message is treated as a token
5. Stores the token in SecretsStore
6. Retries the original user request automatically
CLI flow:
› create an issue in github
⚿ Authentication required: github_token
Create a PAT at https://github.com/settings/tokens
Paste your token below (or type 'cancel'):
› ghp_abc123...
✓ github_token authenticated: Credential stored. Retrying...
● http(https://api.github.com/repos/.../issues)
Issue created: https://github.com/...
Gateway flow: same but AuthRequired SSE event shows the auth modal.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
@@ -133,6 +133,11 @@ impl ToolRegistry {
|
||||
self.credential_registry.as_ref()
|
||||
}
|
||||
|
||||
/// Get a reference to the secrets store (for credential storage during auth flows).
|
||||
pub fn secrets_store(&self) -> Option<&Arc<dyn SecretsStore + Send + Sync>> {
|
||||
self.secrets_store.as_ref()
|
||||
}
|
||||
|
||||
/// Get the shared rate limiter for checking built-in tool limits.
|
||||
pub fn rate_limiter(&self) -> &RateLimiter {
|
||||
&self.rate_limiter
|
||||
|
||||
Reference in New Issue
Block a user