fix: expose runtime-ready provider auth to plugins (#62753)

This commit is contained in:
Josh Lehman
2026-04-07 19:28:36 -07:00
committed by GitHub
parent 5050017543
commit b8f12d99b2
12 changed files with 273 additions and 2 deletions

View File

@@ -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,

View 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");
});
});

View File

@@ -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);
}