Files
openclaw/src/plugins/provider-runtime.runtime.ts
Peter Steinberger 98e3f729bc refactor: remove dead plugin loader exports (#105937)
* refactor(plugins): trim activation and contract exports

* test(plugins): restore fixture cleanup

* refactor(plugins): trim install and loader exports

* test(plugins): fully reset loader caches

* refactor(plugins): trim metadata and catalog exports

* test(plugins): preserve catalog trust coverage

* refactor(plugins): trim provider and plugin exports

* refactor(plugins): trim runtime and tool exports

* test(plugins): update dead-export consumers

* test(plugins): remove empty dead-export suites

* refactor(plugins): align exports with split registry

* refactor(plugins): trim drifted loader exports

* style(plugins): format test fixtures

* refactor(scripts): use supported plugin APIs

* refactor(plugins): finish dead export cleanup

* chore(deadcode): refresh export baseline

* test(cli): mock production memory state

* chore(deadcode): sync latest export baseline

* fix(tests): keep plugin fixtures inside core

* chore(deadcode): refresh rebased export baseline

* chore(deadcode): sync current ratchets

* fix(plugins): retain reserved slot invariant

* fix(plugins): preserve dead-export invariants

* test(plugins): use neutral catalog query fixture

* test(plugins): satisfy catalog lint

* test(plugins): preserve integrity drift coverage

* fix(ci): register skill experience live proof
2026-07-13 01:29:33 -07:00

65 lines
3.0 KiB
TypeScript

/** Runtime-side provider discovery and provider registration resolution helpers. */
import { createLazyImportLoader } from "../shared/lazy-promise.js";
type ProviderRuntimeModule = typeof import("./provider-runtime.js");
type AugmentModelCatalogWithProviderPlugins =
ProviderRuntimeModule["augmentModelCatalogWithProviderPlugins"];
type BuildProviderAuthDoctorHintWithPlugin =
ProviderRuntimeModule["buildProviderAuthDoctorHintWithPlugin"];
type FormatProviderAuthProfileApiKeyWithPlugin =
ProviderRuntimeModule["formatProviderAuthProfileApiKeyWithPlugin"];
type PrepareProviderRuntimeAuth = ProviderRuntimeModule["prepareProviderRuntimeAuth"];
type RefreshProviderOAuthCredentialWithPlugin =
ProviderRuntimeModule["refreshProviderOAuthCredentialWithPlugin"];
const providerRuntimeLoader = createLazyImportLoader<ProviderRuntimeModule>(
() => import("./provider-runtime.js"),
);
async function loadProviderRuntime(): Promise<ProviderRuntimeModule> {
// Keep the heavy provider runtime behind an actual async boundary so callers
// can import this wrapper eagerly without collapsing the lazy chunk.
return await providerRuntimeLoader.load();
}
/** Lazily augments the model catalog with provider plugin metadata. */
export async function augmentModelCatalogWithProviderPlugins(
...args: Parameters<AugmentModelCatalogWithProviderPlugins>
): Promise<Awaited<ReturnType<AugmentModelCatalogWithProviderPlugins>>> {
const runtime = await loadProviderRuntime();
return runtime.augmentModelCatalogWithProviderPlugins(...args);
}
/** Lazily builds doctor hint text for provider auth problems. */
export async function buildProviderAuthDoctorHintWithPlugin(
...args: Parameters<BuildProviderAuthDoctorHintWithPlugin>
): Promise<Awaited<ReturnType<BuildProviderAuthDoctorHintWithPlugin>>> {
const runtime = await loadProviderRuntime();
return runtime.buildProviderAuthDoctorHintWithPlugin(...args);
}
/** Lazily formats API-key auth profile display text with provider plugin rules. */
export async function formatProviderAuthProfileApiKeyWithPlugin(
...args: Parameters<FormatProviderAuthProfileApiKeyWithPlugin>
): Promise<Awaited<ReturnType<FormatProviderAuthProfileApiKeyWithPlugin>>> {
const runtime = await loadProviderRuntime();
return runtime.formatProviderAuthProfileApiKeyWithPlugin(...args);
}
/** Lazily prepares provider runtime auth for model execution. */
export async function prepareProviderRuntimeAuth(
...args: Parameters<PrepareProviderRuntimeAuth>
): Promise<Awaited<ReturnType<PrepareProviderRuntimeAuth>>> {
const runtime = await loadProviderRuntime();
return runtime.prepareProviderRuntimeAuth(...args);
}
/** Lazily refreshes OAuth credentials through provider plugin runtime hooks. */
export async function refreshProviderOAuthCredentialWithPlugin(
...args: Parameters<RefreshProviderOAuthCredentialWithPlugin>
): Promise<Awaited<ReturnType<RefreshProviderOAuthCredentialWithPlugin>>> {
const runtime = await loadProviderRuntime();
return runtime.refreshProviderOAuthCredentialWithPlugin(...args);
}