mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-27 00:17:29 +00:00
refactor(plugins): move auth and model policy to providers
This commit is contained in:
@@ -20,7 +20,9 @@ For model selection rules, see [/concepts/models](/concepts/models).
|
||||
OpenClaw merges that output into `models.providers` before writing
|
||||
`models.json`.
|
||||
- Provider manifests can declare `providerAuthEnvVars` so generic env-based
|
||||
auth probes do not need to load plugin runtime.
|
||||
auth probes do not need to load plugin runtime. The remaining core env-var
|
||||
map is now just for non-plugin/core providers and a few generic-precedence
|
||||
cases such as Anthropic API-key-first onboarding.
|
||||
- Provider plugins can also own provider runtime behavior via
|
||||
`resolveDynamicModel`, `prepareDynamicModel`, `normalizeResolvedModel`,
|
||||
`capabilities`, `prepareExtraParams`, `wrapStreamFn`,
|
||||
@@ -37,6 +39,10 @@ the generic inference loop.
|
||||
|
||||
Typical split:
|
||||
|
||||
- `auth[].run` / `auth[].runNonInteractive`: provider owns onboarding/login
|
||||
flows for `openclaw onboard`, `openclaw models auth`, and headless setup
|
||||
- `wizard.onboarding` / `wizard.modelPicker`: provider owns auth-choice labels,
|
||||
hints, and setup entries in onboarding/model pickers
|
||||
- `catalog`: provider appears in `models.providers`
|
||||
- `resolveDynamicModel`: provider accepts model ids not present in the local
|
||||
static catalog yet
|
||||
|
||||
@@ -1230,7 +1230,8 @@ The non-interactive context includes:
|
||||
- the current and base config
|
||||
- parsed onboarding CLI options
|
||||
- runtime logging/error helpers
|
||||
- agent/workspace dirs
|
||||
- agent/workspace dirs so the provider can persist auth into the same scoped
|
||||
store used by the rest of onboarding
|
||||
- `resolveApiKey(...)` to read provider keys from flags, env, or existing auth
|
||||
profiles while honoring `--secret-input-mode`
|
||||
- `toApiKeyCredential(...)` to convert a resolved key into an auth-profile
|
||||
@@ -1407,10 +1408,13 @@ api.registerProvider({
|
||||
Notes:
|
||||
|
||||
- `run` receives a `ProviderAuthContext` with `prompter`, `runtime`,
|
||||
`openUrl`, and `oauth.createVpsAwareHandlers` helpers.
|
||||
`openUrl`, `oauth.createVpsAwareHandlers`, `secretInputMode`, and
|
||||
`allowSecretRefPrompt` helpers/state. Onboarding/configure flows can use
|
||||
these to honor `--secret-input-mode` or offer env/file/exec secret-ref
|
||||
capture, while `openclaw models auth` keeps a tighter prompt surface.
|
||||
- `runNonInteractive` receives a `ProviderAuthMethodNonInteractiveContext`
|
||||
with `opts`, `resolveApiKey`, and `toApiKeyCredential` helpers for
|
||||
headless onboarding.
|
||||
with `opts`, `agentDir`, `resolveApiKey`, and `toApiKeyCredential` helpers
|
||||
for headless onboarding.
|
||||
- Return `configPatch` when you need to add default models or provider config.
|
||||
- Return `defaultModel` so `--set-default` can update agent defaults.
|
||||
- `wizard.setup` adds a provider choice to `openclaw onboard`.
|
||||
|
||||
Reference in New Issue
Block a user