Run the agent loop on every provider, not just API keys
The loop was gated to API-key providers, so a GPT-account (Codex) CEO failed with 'requires an API-key provider'. Port Pi's actual request handlers natively so every agent-capable provider runs: - chat-completions turn for xAI, Groq, Mistral, Cerebras, OpenRouter - Codex SSE Responses for GPT account - Anthropic-OAuth (Claude Code system + beta headers) for Claude Pro/Max - Copilot proxy (baseUrl from the token) for GitHub Copilot - Gemini Code Assist for Google Antigravity A credential resolver refreshes expired OAuth access tokens at request time and persists the rotation; the runner routes by provider key and passes the resolved credential. The heartbeat now retries failed tasks (bounded to 3 attempts) so a run that failed on the old gate recovers automatically. Cloud providers (Azure/Bedrock/Vertex) still report a clear unsupported message.
This commit is contained in:
1 parent
61f2162236
commit
937fdfa23f
16 files changed
+876
-129
No files matched your search
@@ -125,6 +125,25 @@ export class AuthBrokerService {
|
||||
return this.vault.decryptSecret(Buffer.from(row.ciphertext));
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-encrypts a refreshed OAuth credential into its existing credential row,
|
||||
* keeping the same credential id (and active auth profile) so request-time
|
||||
* token refresh persists without re-binding the provider.
|
||||
*/
|
||||
updateProviderSecret(input: { orgId: string; providerKey: string; credentialId: string; secret: string }): void {
|
||||
const secret = input.secret.trim();
|
||||
if (!secret) throw new Error("Credential is required.");
|
||||
const displayHint = credentialDisplayHint(secret);
|
||||
const result = this.db.prepare(`
|
||||
update credentials
|
||||
set ciphertext = ?, display_hint = ?
|
||||
where id = ? and org_id = ? and provider_key = ?
|
||||
`).run(this.vault.encryptSecret(secret), displayHint, input.credentialId, input.orgId, input.providerKey);
|
||||
if (result.changes === 0) throw new Error("Provider credential was not found.");
|
||||
this.db.prepare("update provider_auth_profiles set display_hint = ? where credential_id = ? and org_id = ?")
|
||||
.run(displayHint, input.credentialId, input.orgId);
|
||||
}
|
||||
|
||||
revokeProviderProfile(input: RevokeProviderAuthProfileInput): void {
|
||||
const row = this.db.prepare(`
|
||||
select id, credential_id
|
||||
|
||||
Reference in new issue
Block a user