Feature 08 task 1: Provider interface, typed errors and Fake provider #33

2 Commits
Author SHA1 Message Date
dev_agentandClaude Opus 5.5 518e78db54 Require secrets for ProviderError redaction and omit unredactable bodies
Independent review Codex gpt-6-sol high: APPROVED (0 findings)
CI / ci (push) Successful in 1m28s
CI / ci (pull_request) Successful in 1m27s
NewProviderError now takes the secrets to redact as a required []string
instead of an optional variadic. When no non-empty secret is given the
body cannot be redacted, so no excerpt is stored and Body()/Error() never
expose raw vendor output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:56:32 -04:00
dev_agentandClaude Opus 5.5 cb925618bc Add LLM Provider interface, typed errors and Fake provider
Independent review Codex gpt-6-sol high: CHANGES_REQUIRED (1 high)
CI / ci (push) Successful in 1m28s
CI / ci (pull_request) Successful in 1m28s
internal/ai/llm defines the single Provider interface (Generate,
ListModels, Verify) shared by every vendor adapter, with Request,
Message, JSONSchema, Response, Usage and Model types.

Typed errors work with errors.Is/As: sentinels ErrAuth, ErrTimeout and
ErrBadOutput; *RateLimitedError (RetryAfter) matching ErrRateLimited;
*ProviderError (status and body excerpt) matching ErrProvider.
NewProviderError redacts every given secret before truncating the body,
so no part of an API key reaches an error string.

Fake is a thread-safe scripted Provider for tests: it returns queued
results in order, fails unscripted calls, and records deep copies of
every Request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:52:15 -04:00