UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

174 lines • 7.96 kB
import { $a as AgentPromptSurfaceKind, _w as PluginConversationBindingRequestParams, eo as OpenClawPluginCommandDefinition, gw as PluginConversationBinding, no as PluginCommandResult, vw as PluginConversationBindingRequestResult, yc as PluginInteractiveHandlerRegistration, yv as requestPluginConversationBinding } from "./config-contracts-DzLaG7FV.js"; import { r as PluginCommandDispatchContext } from "./plugin-command-runtime-B3gHWyGP.js"; import "./command-specs-BvlVjOWC.js"; //#region src/plugins/command-registry-state.d.ts type RegisteredPluginCommand = OpenClawPluginCommandDefinition & { pluginId: string; pluginName?: string; pluginRoot?: string; trustedOwnerStatusExposure?: true; }; declare function clearPluginCommands(): void; declare function listRegisteredPluginAgentPromptGuidance(params?: { surface?: AgentPromptSurfaceKind; includeLegacyGlobalGuidance?: boolean; }): string[]; //#endregion //#region src/plugins/command-registration.d.ts type CommandRegistrationResult = { ok: boolean; error?: string; }; declare function registerPluginCommand(pluginId: string, command: OpenClawPluginCommandDefinition, opts?: { pluginName?: string; pluginRoot?: string; allowReservedCommandNames?: boolean; allowOwnerStatusExposure?: boolean; }): CommandRegistrationResult; //#endregion //#region src/plugins/plugin-command-execution.d.ts type PluginCommandExecutionParams = PluginCommandDispatchContext & { command: RegisteredPluginCommand; args?: string; }; //#endregion //#region src/plugins/commands.d.ts /** Match one compatibility command invocation against the current command registry. */ declare function matchPluginCommand(commandBody: string, options?: { channel?: string; }): { command: RegisteredPluginCommand; args?: string; } | null; declare function executePluginCommand(params: { -readonly [Key in keyof PluginCommandExecutionParams as Exclude<Key, "runtimeContext">]: PluginCommandExecutionParams[Key]; }): Promise<PluginCommandResult>; //#endregion //#region src/plugins/interactive-binding-helpers.d.ts type RegisteredInteractiveMetadata = { pluginId: string; pluginName?: string; pluginRoot?: string; }; type PluginBindingConversation = Parameters<typeof requestPluginConversationBinding>[0]["conversation"]; declare function createInteractiveConversationBindingHelpers(params: { registration: RegisteredInteractiveMetadata; senderId?: string; conversation: PluginBindingConversation; }): { requestConversationBinding: (binding?: PluginConversationBindingRequestParams) => Promise<PluginConversationBindingRequestResult>; detachConversationBinding: () => Promise<{ removed: boolean; }>; getCurrentConversationBinding: () => Promise<PluginConversationBinding | null>; }; //#endregion //#region src/plugins/interactive-registry.d.ts /** Registered interactive handler with owning plugin metadata. */ type RegisteredInteractiveHandler = PluginInteractiveHandlerRegistration & { pluginId: string; pluginName?: string; pluginRoot?: string; }; /** Registration result for plugin interactive namespace handlers. */ type InteractiveRegistrationResult = { ok: boolean; error?: string; }; /** Registers one process-global interactive handler. */ declare function registerPluginInteractiveHandler(pluginId: string, registration: PluginInteractiveHandlerRegistration, opts?: { pluginName?: string; pluginRoot?: string; }): InteractiveRegistrationResult; /** Clears all active plugin interactive handlers. */ declare function clearPluginInteractiveHandlers(): void; //#endregion //#region src/plugins/interactive.d.ts type InteractiveDispatchResult<TResult = unknown> = { matched: false; handled: false; duplicate: false; } | { matched: true; handled: boolean; duplicate: boolean; result?: TResult; }; type PluginInteractiveDispatchRegistration = { channel: string; namespace: string; }; /** Resolved interactive handler match passed to plugin callback dispatch. */ type PluginInteractiveMatch<TRegistration extends PluginInteractiveDispatchRegistration> = { registration: RegisteredInteractiveHandler & TRegistration; namespace: string; payload: string; }; type ChannelInteractivePayload = { data: string; namespace: string; payload: string; }; type ChannelInteractiveDispatchPayload<T> = T extends ChannelInteractivePayload ? Omit<T, keyof ChannelInteractivePayload> : never; type ChannelInteractiveDispatchBase = { accountId: string; conversationId: string; parentConversationId?: string; senderId?: string; threadId?: string | number; auth: { isAuthorizedSender: boolean; }; }; type ChannelInteractiveHandlerContext<TChannel extends string, TInteractiveKey extends PropertyKey> = ChannelInteractiveDispatchBase & { channel: TChannel; respond: unknown; } & Record<TInteractiveKey, ChannelInteractivePayload>; type ChannelInteractiveOwnedContextKey<TInteractiveKey> = TInteractiveKey | "respond" | "channel" | "requestConversationBinding" | "detachConversationBinding" | "getCurrentConversationBinding"; type ChannelInteractiveDispatchContext<TContext, TInteractiveKey extends keyof TContext, TDispatchInteractiveKey extends PropertyKey> = Omit<TContext, ChannelInteractiveOwnedContextKey<TInteractiveKey>> & ChannelInteractiveDispatchBase & Record<TDispatchInteractiveKey, ChannelInteractiveDispatchPayload<TContext[TInteractiveKey]>>; /** Dispatches one interactive callback payload to a matching plugin handler. */ declare function dispatchPluginInteractiveHandler<TRegistration extends PluginInteractiveDispatchRegistration, TResult extends { handled?: boolean; } | void = { handled?: boolean; } | void>(params: { channel: TRegistration["channel"]; data: string; dedupeId?: string; onMatched?: () => Promise<void> | void; invoke: (match: PluginInteractiveMatch<TRegistration>) => Promise<TResult> | TResult; afterInvoke?: (result: TResult) => Promise<void> | void; }): Promise<InteractiveDispatchResult<TResult>>; /** Creates a channel dispatcher for plugin-owned interactive callbacks. */ declare function createChannelInteractiveDispatcher<TChannel extends string, TInteractiveKey extends PropertyKey, TContext extends ChannelInteractiveHandlerContext<TChannel, TInteractiveKey>, TResult extends { handled?: boolean; } | void = { handled?: boolean; } | void, TDispatchInteractiveKey extends PropertyKey = TInteractiveKey>(config: { channel: TChannel; interactiveKey: TInteractiveKey; dispatchInteractiveKey?: TDispatchInteractiveKey; }): (params: { data: string; dedupeId: string; ctx: ChannelInteractiveDispatchContext<TContext, TInteractiveKey, TDispatchInteractiveKey>; respond: TContext["respond"]; conversation?: Parameters<typeof createInteractiveConversationBindingHelpers>[0]["conversation"]; onMatched?: () => Promise<void> | void; afterInvoke?: (result: TResult) => Promise<void> | void; }) => Promise<InteractiveDispatchResult<TResult>>; //#endregion //#region src/plugins/lazy-service-module.d.ts type LazyServiceModule = Record<string, unknown>; type LazyPluginServiceHandle = { stop: () => Promise<void>; }; declare function startLazyPluginServiceModule(params: { skipEnvVar?: string; overrideEnvVar?: string; validateOverrideSpecifier?: (specifier: string) => string; loadDefaultModule: () => Promise<LazyServiceModule>; loadOverrideModule?: (specifier: string) => Promise<LazyServiceModule>; startExportNames: string[]; stopExportNames?: string[]; }): Promise<LazyPluginServiceHandle | null>; //#endregion export { clearPluginInteractiveHandlers as a, executePluginCommand as c, clearPluginCommands as d, listRegisteredPluginAgentPromptGuidance as f, dispatchPluginInteractiveHandler as i, matchPluginCommand as l, startLazyPluginServiceModule as n, registerPluginInteractiveHandler as o, createChannelInteractiveDispatcher as r, createInteractiveConversationBindingHelpers as s, LazyPluginServiceHandle as t, registerPluginCommand as u };