feat(builder): run codegen + preview on any configured LLM provider (#297)#320
Open
MarvinVomberg wants to merge 3 commits into
Open
feat(builder): run codegen + preview on any configured LLM provider (#297)#320MarvinVomberg wants to merge 3 commits into
MarvinVomberg wants to merge 3 commits into
Conversation
…yte5ai#297) The Agent Builder was hard-locked to Anthropic: the model resolver rejected non-Anthropic registry entries and both the builder agent loop and preview chat constructed an Anthropic provider at the call site. With the pluggable provider work merged (byte5ai#298) and per-instance orchestrator models (byte5ai#296), this lifts the last restriction. - modelRegistry: drop the Anthropic-only guard; source models from the global @omadia/llm-provider registry. Add resolve(ref) -> {provider, modelId} that throws an actionable error for an unregistered reference. Anthropic slugs stay as the default + a pre-boot fallback. - types/draftStore: BuilderModelId is now any registry reference (provider- qualified id or legacy slug); stored value is preserved, not coerced. - builderAgent + previewChatService: replace the anthropic-client dep with a resolveProvider seam; the LocalSubAgent is built from the resolved LlmProvider + bare vendor id. Re-resolved per turn (hot-swap safe). - index.ts: resolveBuilderProvider wires the Anthropic fast-path + the generic resolveLlmProvider path (vault scope + provider catalog). builderConnectedProviders feeds the picker so only providers with a configured key (or keyless ones) are selectable. - routes: /models lists models from every connected provider; chat/preview validate against the registry and pass the reference; preview-prompt resolves the reference for family inference. - web-ui: model picker is populated from /models, grouped per provider, instead of the fixed haiku|sonnet|opus set. New drafts still default to Anthropic; existing drafts keep their stored choice. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- modelRegistry/types/routes: surface model aliases so the codegen/preview picker maps a legacy slug value onto its canonical provider-qualified option (no duplicate option, no raw lowercase label); default stays the slug - previewChatService: yield a graceful builder.model_unavailable on provider resolution failure, mirroring builderAgent, instead of throwing raw - routes/builder: wrap GET /models in try/catch like its sibling routes - index: parallelize builderConnectedProviders key lookups; rename ANTHROPIC_SHARED_CLIENT_SOURCE -> ORCHESTRATOR_SECRET_SOURCE (provider-neutral) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…provider # Conflicts: # middleware/src/index.ts # middleware/src/plugins/builder/builderAgent.ts # middleware/src/plugins/builder/previewChatService.ts
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.
Closes #297.
Summary
Makes the Agent Builder provider-agnostic. The Builder was the last place still hard-locked to Anthropic:
modelRegistry.tsrejected any non-Anthropic registry entry, and both the builder agent loop and the preview chat constructed an Anthropic provider at the call site. Building on the pluggable provider registry (#298) and per-instance orchestrator models (#296), this lets a draft run codegen and preview on any model whose provider the operator has configured.Changes
@omadia/llm-providerregistry. Newresolve(ref) → { provider, modelId }throws a clear, actionable error for an unregistered reference. Anthropic slugs stay as the default and as a pre-boot fallback.BuilderModelIdis now any registry reference (provider-qualified id or legacy slug). The stored value is preserved as-is rather than coerced to a default, so a draft pinned to a removed provider fails loudly at run time instead of being silently reset.anthropic: () => AnthropicClientdependency is replaced by aresolveProviderseam. TheLocalSubAgentis built from the resolvedLlmProvider+ bare vendor id. Resolution happens per turn, so a hot-swapped key (Setup Wizard / admin secrets) is picked up without a restart.resolveBuilderProviderwires the Anthropic fast-path (shared hot-swappable client) plus the genericresolveLlmProviderpath (vault scope + provider catalog).builderConnectedProvidersfeeds the picker so only providers with a configured API key (or keyless providers like Ollama) are selectable.GET /modelslists models from every connected provider;builderChat/builderPreviewvalidate against the registry and pass the reference through;builderPreviewPromptresolves the reference for persona-family inference./models, grouped per provider (<optgroup>), instead of the fixedhaiku | sonnet | opusset.Acceptance criteria (#297)
modelRegistry.tsis gone; no code path assumes the Builder model is Anthropic.Testing
npm run typecheck(middleware + web-ui) clean.resolveProviderseam.codegen_modelwasmistral:mistral-large-latestcompleted its builder-chat turns, while drafts left on the Anthropic default returned a 401 from an invalid local Anthropic key. Reviewers should run their own end-to-end check with valid provider keys.🤖 Generated with Claude Code