mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:40:44 +00:00
fix: scope provider auth runtime loading
This commit is contained in:
@@ -17,6 +17,10 @@ import {
|
|||||||
pickAuthMethod,
|
pickAuthMethod,
|
||||||
resolveProviderMatch,
|
resolveProviderMatch,
|
||||||
} from "./provider-auth-choice-helpers.js";
|
} from "./provider-auth-choice-helpers.js";
|
||||||
|
import {
|
||||||
|
resolveManifestProviderAuthChoice,
|
||||||
|
type ProviderAuthChoiceMetadata,
|
||||||
|
} from "./provider-auth-choices.js";
|
||||||
import { applyAuthProfileConfig } from "./provider-auth-helpers.js";
|
import { applyAuthProfileConfig } from "./provider-auth-helpers.js";
|
||||||
import { resolveProviderInstallCatalogEntry } from "./provider-install-catalog.js";
|
import { resolveProviderInstallCatalogEntry } from "./provider-install-catalog.js";
|
||||||
import { createVpsAwareOAuthHandlers } from "./provider-oauth-flow.js";
|
import { createVpsAwareOAuthHandlers } from "./provider-oauth-flow.js";
|
||||||
@@ -154,6 +158,20 @@ async function loadPluginProviderRuntime() {
|
|||||||
return await providerAuthChoiceDeps.loadPluginProviderRuntime();
|
return await providerAuthChoiceDeps.loadPluginProviderRuntime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resolveManifestAuthChoiceScope(params: {
|
||||||
|
authChoice: string;
|
||||||
|
config: OpenClawConfig;
|
||||||
|
workspaceDir: string;
|
||||||
|
env?: NodeJS.ProcessEnv;
|
||||||
|
}): ProviderAuthChoiceMetadata | undefined {
|
||||||
|
return resolveManifestProviderAuthChoice(params.authChoice, {
|
||||||
|
config: params.config,
|
||||||
|
workspaceDir: params.workspaceDir,
|
||||||
|
env: params.env,
|
||||||
|
includeUntrustedWorkspacePlugins: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export const __testing = {
|
export const __testing = {
|
||||||
resetDepsForTest(): void {
|
resetDepsForTest(): void {
|
||||||
providerAuthChoiceDeps = defaultProviderAuthChoiceDeps;
|
providerAuthChoiceDeps = defaultProviderAuthChoiceDeps;
|
||||||
@@ -258,6 +276,12 @@ export async function applyAuthChoiceLoadedPluginProvider(
|
|||||||
let enabledConfig = params.config;
|
let enabledConfig = params.config;
|
||||||
const { resolvePluginProviders, resolveProviderPluginChoice, runProviderModelSelectedHook } =
|
const { resolvePluginProviders, resolveProviderPluginChoice, runProviderModelSelectedHook } =
|
||||||
await loadPluginProviderRuntime();
|
await loadPluginProviderRuntime();
|
||||||
|
const manifestAuthChoice = resolveManifestAuthChoiceScope({
|
||||||
|
authChoice: params.authChoice,
|
||||||
|
config: nextConfig,
|
||||||
|
workspaceDir,
|
||||||
|
env: params.env,
|
||||||
|
});
|
||||||
const installCatalogEntry = resolveProviderInstallCatalogEntry(params.authChoice, {
|
const installCatalogEntry = resolveProviderInstallCatalogEntry(params.authChoice, {
|
||||||
config: nextConfig,
|
config: nextConfig,
|
||||||
workspaceDir,
|
workspaceDir,
|
||||||
@@ -282,6 +306,12 @@ export async function applyAuthChoiceLoadedPluginProvider(
|
|||||||
workspaceDir,
|
workspaceDir,
|
||||||
env: params.env,
|
env: params.env,
|
||||||
mode: "setup",
|
mode: "setup",
|
||||||
|
...(manifestAuthChoice
|
||||||
|
? {
|
||||||
|
onlyPluginIds: [manifestAuthChoice.pluginId],
|
||||||
|
providerRefs: [manifestAuthChoice.providerId],
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
});
|
});
|
||||||
let resolved = resolveProviderPluginChoice({
|
let resolved = resolveProviderPluginChoice({
|
||||||
providers,
|
providers,
|
||||||
@@ -313,6 +343,12 @@ export async function applyAuthChoiceLoadedPluginProvider(
|
|||||||
workspaceDir,
|
workspaceDir,
|
||||||
env: params.env,
|
env: params.env,
|
||||||
mode: "setup",
|
mode: "setup",
|
||||||
|
...(manifestAuthChoice
|
||||||
|
? {
|
||||||
|
onlyPluginIds: [manifestAuthChoice.pluginId],
|
||||||
|
providerRefs: [manifestAuthChoice.providerId],
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
});
|
});
|
||||||
resolved = resolveProviderPluginChoice({
|
resolved = resolveProviderPluginChoice({
|
||||||
providers,
|
providers,
|
||||||
|
|||||||
Reference in New Issue
Block a user