mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 20:21:13 +00:00
fix: expose runtime-ready provider auth to plugins (#62753)
This commit is contained in:
@@ -50,10 +50,12 @@ export type {
|
||||
PluginLogger,
|
||||
ProviderAuthContext,
|
||||
ProviderAuthResult,
|
||||
ProviderPreparedRuntimeAuth,
|
||||
ProviderRuntimeModel,
|
||||
RealtimeTranscriptionProviderPlugin,
|
||||
SpeechProviderPlugin,
|
||||
} from "../plugins/types.js";
|
||||
export type { ResolvedProviderRuntimeAuth } from "../plugins/runtime/model-auth-types.js";
|
||||
export type {
|
||||
PluginRuntime,
|
||||
RuntimeLogger,
|
||||
|
||||
8
src/plugin-sdk/provider-auth-runtime.test.ts
Normal file
8
src/plugin-sdk/provider-auth-runtime.test.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import * as providerAuthRuntime from "./provider-auth-runtime.js";
|
||||
|
||||
describe("plugin-sdk provider-auth-runtime", () => {
|
||||
it("exports the runtime-ready auth helper", () => {
|
||||
expect(typeof providerAuthRuntime.getRuntimeAuthForModel).toBe("function");
|
||||
});
|
||||
});
|
||||
@@ -11,8 +11,12 @@ export {
|
||||
resolveAwsSdkEnvVarName,
|
||||
type ResolvedProviderAuth,
|
||||
} from "../agents/model-auth-runtime-shared.js";
|
||||
export type { ProviderPreparedRuntimeAuth } from "../plugins/types.js";
|
||||
export type { ResolvedProviderRuntimeAuth } from "../plugins/runtime/model-auth-types.js";
|
||||
|
||||
type ResolveApiKeyForProvider = typeof import("../agents/model-auth.js").resolveApiKeyForProvider;
|
||||
type GetRuntimeAuthForModel =
|
||||
typeof import("../plugins/runtime/runtime-model-auth.runtime.js").getRuntimeAuthForModel;
|
||||
type RuntimeModelAuthModule = typeof import("../plugins/runtime/runtime-model-auth.runtime.js");
|
||||
const RUNTIME_MODEL_AUTH_CANDIDATES = [
|
||||
"./runtime-model-auth.runtime",
|
||||
@@ -43,3 +47,10 @@ export async function resolveApiKeyForProvider(
|
||||
const { resolveApiKeyForProvider } = await loadRuntimeModelAuthModule();
|
||||
return resolveApiKeyForProvider(params);
|
||||
}
|
||||
|
||||
export async function getRuntimeAuthForModel(
|
||||
params: Parameters<GetRuntimeAuthForModel>[0],
|
||||
): Promise<Awaited<ReturnType<GetRuntimeAuthForModel>>> {
|
||||
const { getRuntimeAuthForModel } = await loadRuntimeModelAuthModule();
|
||||
return getRuntimeAuthForModel(params);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user