@@ -3,6 +3,7 @@ import { createRequire } from "node:module";
33import path from "node:path" ;
44import { fileURLToPath } from "node:url" ;
55import { emptyChannelConfigSchema } from "../channels/plugins/config-schema.js" ;
6+ import type { ChannelOutboundAdapter } from "../channels/plugins/types.adapters.js" ;
67import type { ChannelConfigSchema } from "../channels/plugins/types.config.js" ;
78import type { ChannelLegacyStateMigrationPlan } from "../channels/plugins/types.core.js" ;
89import type { ChannelPlugin } from "../channels/plugins/types.plugin.js" ;
@@ -52,6 +53,7 @@ type DefineBundledChannelEntryOptions<TPlugin = ChannelPlugin> = {
5253 description : string ;
5354 importMetaUrl : string ;
5455 plugin : BundledEntryModuleRef ;
56+ outbound ?: BundledEntryModuleRef ;
5557 secrets ?: BundledEntryModuleRef ;
5658 configSchema ?: ChannelEntryConfigSchema < TPlugin > | ( ( ) => ChannelEntryConfigSchema < TPlugin > ) ;
5759 runtime ?: BundledEntryModuleRef ;
@@ -108,6 +110,9 @@ export type BundledChannelEntryContract<TPlugin = ChannelPlugin> = {
108110 features ?: BundledChannelEntryFeatures ;
109111 register : ( api : OpenClawPluginApi ) => void ;
110112 loadChannelPlugin : ( options ?: BundledEntryModuleLoadOptions ) => TPlugin ;
113+ loadChannelOutbound ?: (
114+ options ?: BundledEntryModuleLoadOptions ,
115+ ) => ChannelOutboundAdapter | undefined ;
111116 loadChannelSecrets ?: (
112117 options ?: BundledEntryModuleLoadOptions ,
113118 ) => ChannelPlugin [ "secrets" ] | undefined ;
@@ -435,6 +440,7 @@ export function defineBundledChannelEntry<TPlugin = ChannelPlugin>({
435440 description,
436441 importMetaUrl,
437442 plugin,
443+ outbound,
438444 secrets,
439445 configSchema,
440446 runtime,
@@ -449,6 +455,14 @@ export function defineBundledChannelEntry<TPlugin = ChannelPlugin>({
449455 : ( ( configSchema ?? emptyChannelConfigSchema ( ) ) as ChannelEntryConfigSchema < TPlugin > ) ;
450456 const loadChannelPlugin = ( options ?: BundledEntryModuleLoadOptions ) =>
451457 loadBundledEntryExportSync < TPlugin > ( importMetaUrl , plugin , options ) ;
458+ const loadChannelOutbound = outbound
459+ ? ( options ?: BundledEntryModuleLoadOptions ) =>
460+ loadBundledEntryExportSync < ChannelOutboundAdapter | undefined > (
461+ importMetaUrl ,
462+ outbound ,
463+ options ,
464+ )
465+ : undefined ;
452466 const loadChannelSecrets = secrets
453467 ? ( options ?: BundledEntryModuleLoadOptions ) =>
454468 loadBundledEntryExportSync < ChannelPlugin [ "secrets" ] | undefined > (
@@ -511,6 +525,7 @@ export function defineBundledChannelEntry<TPlugin = ChannelPlugin>({
511525 profile ( "bundled-register:registerFull" , ( ) => registerFull ?.( api ) ) ;
512526 } ,
513527 loadChannelPlugin,
528+ ...( loadChannelOutbound ? { loadChannelOutbound } : { } ) ,
514529 ...( loadChannelSecrets ? { loadChannelSecrets } : { } ) ,
515530 ...( loadChannelAccountInspector ? { loadChannelAccountInspector } : { } ) ,
516531 ...( setChannelRuntime ? { setChannelRuntime } : { } ) ,
0 commit comments