import type { AnyAgentTool } from "../agents/tools/common.js"; import type { ChannelDock } from "../channels/dock.js"; import type { ChannelPlugin } from "../channels/plugins/types.js"; import type { GatewayRequestHandler, GatewayRequestHandlers } from "../gateway/server-methods/types.js"; import { registerInternalHook } from "../hooks/internal-hooks.js"; import type { HookEntry } from "../hooks/types.js"; import type { PluginRuntime } from "./runtime/types.js"; import type { BotPluginApi, BotPluginChannelRegistration, BotPluginCliRegistrar, BotPluginCommandDefinition, BotPluginHttpRouteAuth, BotPluginHttpRouteMatch, BotPluginHttpRouteHandler, BotPluginHookOptions, ProviderPlugin, BotPluginService, BotPluginToolFactory, PluginConfigUiHint, PluginDiagnostic, PluginLogger, PluginOrigin, PluginKind, PluginHookName, PluginHookHandlerMap, PluginHookRegistration as TypedPluginHookRegistration } from "./types.js"; export type PluginToolRegistration = { pluginId: string; factory: BotPluginToolFactory; names: string[]; optional: boolean; source: string; }; export type PluginCliRegistration = { pluginId: string; register: BotPluginCliRegistrar; commands: string[]; source: string; }; export type PluginHttpRouteRegistration = { pluginId?: string; path: string; handler: BotPluginHttpRouteHandler; auth: BotPluginHttpRouteAuth; match: BotPluginHttpRouteMatch; source?: string; }; export type PluginChannelRegistration = { pluginId: string; plugin: ChannelPlugin; dock?: ChannelDock; source: string; }; export type PluginProviderRegistration = { pluginId: string; provider: ProviderPlugin; source: string; }; export type PluginHookRegistration = { pluginId: string; entry: HookEntry; events: string[]; source: string; }; export type PluginServiceRegistration = { pluginId: string; service: BotPluginService; source: string; }; export type PluginCommandRegistration = { pluginId: string; command: BotPluginCommandDefinition; source: string; }; export type PluginRecord = { id: string; name: string; version?: string; description?: string; kind?: PluginKind; source: string; origin: PluginOrigin; workspaceDir?: string; enabled: boolean; status: "loaded" | "disabled" | "error"; error?: string; toolNames: string[]; hookNames: string[]; channelIds: string[]; providerIds: string[]; gatewayMethods: string[]; cliCommands: string[]; services: string[]; commands: string[]; httpRoutes: number; hookCount: number; configSchema: boolean; configUiHints?: Record; configJsonSchema?: Record; }; export type PluginRegistry = { plugins: PluginRecord[]; tools: PluginToolRegistration[]; hooks: PluginHookRegistration[]; typedHooks: TypedPluginHookRegistration[]; channels: PluginChannelRegistration[]; providers: PluginProviderRegistration[]; gatewayHandlers: GatewayRequestHandlers; httpRoutes: PluginHttpRouteRegistration[]; cliRegistrars: PluginCliRegistration[]; services: PluginServiceRegistration[]; commands: PluginCommandRegistration[]; diagnostics: PluginDiagnostic[]; }; export type PluginRegistryParams = { logger: PluginLogger; coreGatewayHandlers?: GatewayRequestHandlers; runtime: PluginRuntime; }; type PluginTypedHookPolicy = { allowPromptInjection?: boolean; }; export declare function createEmptyPluginRegistry(): PluginRegistry; export declare function createPluginRegistry(registryParams: PluginRegistryParams): { registry: PluginRegistry; createApi: (record: PluginRecord, params: { config: BotPluginApi["config"]; pluginConfig?: Record; hookPolicy?: PluginTypedHookPolicy; }) => BotPluginApi; pushDiagnostic: (diag: PluginDiagnostic) => void; registerTool: (record: PluginRecord, tool: AnyAgentTool | BotPluginToolFactory, opts?: { name?: string; names?: string[]; optional?: boolean; }) => void; registerChannel: (record: PluginRecord, registration: BotPluginChannelRegistration | ChannelPlugin) => void; registerProvider: (record: PluginRecord, provider: ProviderPlugin) => void; registerGatewayMethod: (record: PluginRecord, method: string, handler: GatewayRequestHandler) => void; registerCli: (record: PluginRecord, registrar: BotPluginCliRegistrar, opts?: { commands?: string[]; }) => void; registerService: (record: PluginRecord, service: BotPluginService) => void; registerCommand: (record: PluginRecord, command: BotPluginCommandDefinition) => void; registerHook: (record: PluginRecord, events: string | string[], handler: Parameters[1], opts: BotPluginHookOptions | undefined, config: BotPluginApi["config"]) => void; registerTypedHook: (record: PluginRecord, hookName: K, handler: PluginHookHandlerMap[K], opts?: { priority?: number; }, policy?: PluginTypedHookPolicy) => void; }; export {};