feat(coding-agent): added resolver-based auth retries to image and search tools

- Routed image-gen, inspect-image, and web search providers through `withAuth`.
- Used `reuseInitialApiKey`/`createAuthStorageResolver` for force-refresh and rotate retries.
- Attached HTTP status to thrown errors so the retry classifier detects retryable failures.
This commit is contained in:
can1357
2026-06-07 04:49:19 +02:00
parent fceff5e6b6
commit c10eb5e50e
28 changed files with 377 additions and 269 deletions
@@ -6,7 +6,7 @@ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
import type { Api, Model } from "@oh-my-pi/pi-ai";
import { completeSimple } from "@oh-my-pi/pi-ai";
import { logger, prompt } from "@oh-my-pi/pi-utils";
import { reuseInitialApiKey } from "../config/api-key-resolver";
import type { ModelRegistry } from "../config/model-registry";
import { resolveModelRoleValue } from "../config/model-resolver";
import type { Settings } from "../config/settings";
@@ -112,7 +112,7 @@ export async function generateCommitMessage(
messages: [{ role: "user", content: userMessage, timestamp: Date.now() }],
},
{
apiKey: reuseInitialApiKey(apiKey, registry, candidate.model.provider, {
apiKey: registry.resolver(candidate.model.provider, {
sessionId,
baseUrl: candidate.model.baseUrl,
}),