mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 00:10:42 +00:00
refactor(runtime): add prepared runtime foundation (#78248)
* docs(runtime): document prepared runtime guidance * refactor(provider-runtime): thread prepared provider handles * refactor(runtime-plan): add prepared runtime foundation * refactor(outbound): add prepared channel runtime facts * refactor(models): add scoped model reference helpers * refactor(plugin-sdk): expose prepared runtime helper surfaces
This commit is contained in:
@@ -10,6 +10,7 @@ export * from "../agents/identity.js";
|
||||
export * from "../agents/model-auth-markers.js";
|
||||
export * from "../agents/model-auth.js";
|
||||
export * from "../agents/model-catalog.js";
|
||||
export * from "../agents/model-catalog-scope.js";
|
||||
export * from "../agents/model-selection.js";
|
||||
export * from "../agents/simple-completion-runtime.js";
|
||||
export * from "../agents/pi-embedded-block-chunker.js";
|
||||
|
||||
@@ -3,6 +3,7 @@ import { createRequire } from "node:module";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { emptyChannelConfigSchema } from "../channels/plugins/config-schema.js";
|
||||
import type { ChannelOutboundAdapter } from "../channels/plugins/types.adapters.js";
|
||||
import type { ChannelConfigSchema } from "../channels/plugins/types.config.js";
|
||||
import type { ChannelLegacyStateMigrationPlan } from "../channels/plugins/types.core.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
|
||||
@@ -52,6 +53,7 @@ type DefineBundledChannelEntryOptions<TPlugin = ChannelPlugin> = {
|
||||
description: string;
|
||||
importMetaUrl: string;
|
||||
plugin: BundledEntryModuleRef;
|
||||
outbound?: BundledEntryModuleRef;
|
||||
secrets?: BundledEntryModuleRef;
|
||||
configSchema?: ChannelEntryConfigSchema<TPlugin> | (() => ChannelEntryConfigSchema<TPlugin>);
|
||||
runtime?: BundledEntryModuleRef;
|
||||
@@ -108,6 +110,9 @@ export type BundledChannelEntryContract<TPlugin = ChannelPlugin> = {
|
||||
features?: BundledChannelEntryFeatures;
|
||||
register: (api: OpenClawPluginApi) => void;
|
||||
loadChannelPlugin: (options?: BundledEntryModuleLoadOptions) => TPlugin;
|
||||
loadChannelOutbound?: (
|
||||
options?: BundledEntryModuleLoadOptions,
|
||||
) => ChannelOutboundAdapter | undefined;
|
||||
loadChannelSecrets?: (
|
||||
options?: BundledEntryModuleLoadOptions,
|
||||
) => ChannelPlugin["secrets"] | undefined;
|
||||
@@ -435,6 +440,7 @@ export function defineBundledChannelEntry<TPlugin = ChannelPlugin>({
|
||||
description,
|
||||
importMetaUrl,
|
||||
plugin,
|
||||
outbound,
|
||||
secrets,
|
||||
configSchema,
|
||||
runtime,
|
||||
@@ -449,6 +455,14 @@ export function defineBundledChannelEntry<TPlugin = ChannelPlugin>({
|
||||
: ((configSchema ?? emptyChannelConfigSchema()) as ChannelEntryConfigSchema<TPlugin>);
|
||||
const loadChannelPlugin = (options?: BundledEntryModuleLoadOptions) =>
|
||||
loadBundledEntryExportSync<TPlugin>(importMetaUrl, plugin, options);
|
||||
const loadChannelOutbound = outbound
|
||||
? (options?: BundledEntryModuleLoadOptions) =>
|
||||
loadBundledEntryExportSync<ChannelOutboundAdapter | undefined>(
|
||||
importMetaUrl,
|
||||
outbound,
|
||||
options,
|
||||
)
|
||||
: undefined;
|
||||
const loadChannelSecrets = secrets
|
||||
? (options?: BundledEntryModuleLoadOptions) =>
|
||||
loadBundledEntryExportSync<ChannelPlugin["secrets"] | undefined>(
|
||||
@@ -511,6 +525,7 @@ export function defineBundledChannelEntry<TPlugin = ChannelPlugin>({
|
||||
profile("bundled-register:registerFull", () => registerFull?.(api));
|
||||
},
|
||||
loadChannelPlugin,
|
||||
...(loadChannelOutbound ? { loadChannelOutbound } : {}),
|
||||
...(loadChannelSecrets ? { loadChannelSecrets } : {}),
|
||||
...(loadChannelAccountInspector ? { loadChannelAccountInspector } : {}),
|
||||
...(setChannelRuntime ? { setChannelRuntime } : {}),
|
||||
|
||||
@@ -37,6 +37,7 @@ export { parseTtsDirectives } from "../tts/directives.js";
|
||||
export {
|
||||
canonicalizeSpeechProviderId,
|
||||
getSpeechProvider,
|
||||
listLoadedSpeechProviders,
|
||||
listSpeechProviders,
|
||||
normalizeSpeechProviderId,
|
||||
} from "../tts/provider-registry.js";
|
||||
|
||||
@@ -33,6 +33,10 @@ function loadFacadeModule(): FacadeModule {
|
||||
});
|
||||
}
|
||||
|
||||
export function prewarmTtsRuntimeFacade(): void {
|
||||
loadFacadeModule();
|
||||
}
|
||||
|
||||
export const _test: FacadeModule["_test"] = createLazyFacadeObjectValue(
|
||||
() => loadFacadeModule()._test,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user