feat(ai): multi-provider prefs, secrets IPC, shared schema core - #297
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Second slice of the local/multi-provider LLM work. Adds the prefs, secrets IPC, usage pricing, and shared schema core that later renderer + wiring PRs build on. All behavior-preserving: every tier still defaults to
anthropic, so existing installs route 100% cloud, unchanged.Changes
PROVIDERSruntime array (anthropic | openai | gemini) so prefs derive both the type and the enum codec values from one source.provider{Architect,Evaluator,Conversation}(defaultanthropic),openaiBaseUrl(defaulthttp://localhost:11434/v1, validated http/https + trailing-slash-stripped, never a path), and six{openai,gemini}Model{Role}strings. Enforced complete by theCODECSmapped type.SECRET_KEYSwhitelist +ai:provider:{hasKey,deleteKey,setKey}handlers. Provider isz.enum-validated; only whitelisted keychain secrets are reachable. Legacy anthropic channels kept for back-compat.pricingForpricesopenai:/gemini:-prefixed models at zero (local/self-hosted has no per-token cost); anthropic pricing unchanged.toGeminiSchema(uppercase types, strict-hostile keyword pruning, nullable folding) +toOpenAiJsonSchema. gemini.ts slimmed to import + re-export.structuredMode: 'json_object'fallback for endpoints without json_schema support; folds the schema into the system prompt.json_schemastays the default.Tests
Added: openai json_object mode, provider/base-URL prefs validation + coercion, usage zero-pricing. Gate green — typecheck, lint, 797 passed | 1 skipped (baseline 790).
Security
Each provider reads only its own keychain secret via the
SECRET_KEYSwhitelist;openaiBaseUrlis validated as an http/https URL, not a filesystem path; renderer never supplies keys or paths inline.🤖 Generated with Claude Code