feat: runtime provider configuration API (BYOK setup) - #12
Open
amos-aios wants to merge 1 commit into
Open
Conversation
amos-aios
added a commit
to aios-pub/mofa-studio
that referenced
this pull request
Aug 25, 2026
…RD-02) On top of the engine's runtime provider-config API (upstream PR mofa-org/mofa-engine#12): - gateway: GET/POST /v1/config/providers proxied to the engine; the key crosses the gateway once and persists engine-side (config.toml) — the frontend never stores it - engineConfig service: vendor→engine registration mapping, 国内可达优先 vendor ordering, curated default model names (deepseek/qwen/glm/kimi…), paste-time key validation (prefix/whitespace/length with specific reasons); 10 unit tests - KeyWizard (/onboarding/key, linked from the welcome flow's 开始配置 CTA): vendor picker with apply-page deep link, masked key input with inline validation feedback, editable default model, register + connectivity test (engine model list must expose the vendor), success screen; the onboarded flag flips on completion - 98 frontend tests green Co-Authored-By: Claude <noreply@anthropic.com>
amos-aios
force-pushed
the
feat/provider-config-api
branch
from
August 25, 2026 17:18
44ad8f3 to
1d28d6b
Compare
Rebased onto upstream main (post cloud-video-gen merge) as a single clean commit; adapts to the new provider-kind matrix (LiterLLM, LocalAsr, LocalImageGen, LocalVideoGen, CloudVideoGen dialect) and the associated-function server style. - Engine::build_provider extracted from startup assembly; shared with Engine::add_provider_config, which registers a provider at runtime behind an RwLock (replacing same-name entries); find_provider, routing_providers, and discover_all all consult the runtime list, so a registered provider is routable and discoverable immediately - SDK: GET/POST /v1/config/providers with masked listing derived from live capability cards; add validates (name/kind/api_key), appends a [[providers]] entry to the resolved config file for restart survival, then registers + refreshes. ProviderConfig::provider_kind made pub so external API layers can validate before calling into the engine. - EngineConfig::resolved_path: MOFA_ENGINE_CONFIG env > ./config.toml > ~/.config/mofa-engine/config.toml. - Tests: factory smoke over the full kind matrix + full runtime registration (discoverability, invoke routing, disabled rejection) against a live mock endpoint. Co-Authored-By: Claude <noreply@anthropic.com>
amos-aios
force-pushed
the
feat/provider-config-api
branch
from
August 25, 2026 17:21
1d28d6b to
d853ddb
Compare
Author
|
Rebased onto current main as a single clean commit (d853ddb): the runtime provider-config API now covers the full provider-kind matrix merged from the engine branch (LiterLLM, LocalAsr, LocalImageGen, LocalVideoGen, CloudVideoGen) and follows the associated-function server style. Tests: full workspace suite green (11 test binaries), including a live-mock runtime registration round trip (discoverability + invoke routing + disabled rejection). Note: the sibling PRs (#9/#10/#11/#13) were closed as their capabilities landed on main separately; this PR's runtime config API remains novel. |
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
Setup UIs (BYOK key wizards) can now add providers without editing config files or restarting:
Engine.add_provider_config— registers a provider at runtime (RwLock-guarded list next to the startup registrations);find_provider/routing_providers/discover_allconsult both, so a runtime provider is routable and discoverable immediately.Engine.build_provideris extracted from startup assembly and shared.POST /v1/config/providers— validates (kind resolvable, name non-empty, api_key present for openai_compatible), appends a[[providers]]TOML entry to the resolved config file (restart survival), registers + refreshes capabilitiesGET /v1/config/providers— masked listing derived from live capability cards; keys never leave the engineEngineConfig::resolved_path—MOFA_ENGINE_CONFIGenv >./config.toml>~/.config/mofa-engine/config.tomlTesting
runtime_provider_registration_serves_requests— registers an OpenAI-compatible provider against a live mock endpoint at runtime, asserts capabilities pick it up and invoke routes to it. Full suite 102 green.Stacked on #11; will rebase on landing.
🤖 Generated with Claude Code