import type { AutomationRouteBinding } from '../automation/routes.js'; import type { SharedApprovalRecord } from '../control-plane/index.js'; import type { ChannelIngressAlarm } from './ingress-alarm.js'; import type { Tool } from '../types/tools.js'; import type { ChannelAdapterDescriptor, ChannelAllowlistEditInput, ChannelAllowlistEditResult, ChannelAllowlistResolution, ChannelAccountRecord, ChannelAccountLifecycleAction, ChannelAccountLifecycleResult, ChannelActorAuthorizationRequest, ChannelActorAuthorizationResult, ChannelCapabilityDescriptor, ChannelCapability, ChannelConversationKind, ChannelDirectoryEntry, ChannelDirectoryQueryOptions, ChannelDoctorReport, ChannelLifecycleState, ChannelOperatorActionDescriptor, ChannelRenderPolicy, ChannelRenderRequest, ChannelRenderResult, ChannelResolvedTarget, ChannelRepairAction, ChannelSetupSchema, ChannelStatusSnapshot, ChannelSurface, ChannelTargetResolveOptions, ChannelToolDescriptor } from './types.js'; import type { FeatureFlagReader } from '../runtime/feature-flags/index.js'; export interface ChannelPlugin { readonly id: string; readonly surface: ChannelSurface; readonly displayName: string; readonly capabilities: readonly ChannelCapability[]; readonly setupVersion?: number | undefined; readonly webhookPath?: string | undefined; readonly handleInbound?: ((req: Request) => Promise) | undefined; readonly renderPolicy?: (() => ChannelRenderPolicy | Promise) | undefined; readonly renderEvent?: ((request: ChannelRenderRequest) => Promise) | undefined; readonly deliverReply?: ((pending: unknown, message: string) => Promise) | undefined; readonly deliverProgress?: ((pending: unknown, progress: string) => Promise) | undefined; readonly notifyApproval?: ((approval: SharedApprovalRecord, binding: AutomationRouteBinding) => Promise) | undefined; readonly getSetupSchema?: ((accountId?: string) => Promise | ChannelSetupSchema) | undefined; readonly doctor?: ((accountId?: string) => Promise | ChannelDoctorReport) | undefined; readonly listRepairActions?: ((accountId?: string) => Promise | readonly ChannelRepairAction[]) | undefined; readonly getLifecycleState?: ((accountId?: string) => Promise | ChannelLifecycleState) | undefined; readonly resolveAllowlist?: ((input: ChannelAllowlistEditInput) => Promise | ChannelAllowlistResolution) | undefined; readonly editAllowlist?: ((input: ChannelAllowlistEditInput) => Promise | ChannelAllowlistEditResult) | undefined; readonly getStatus?: (() => Promise) | undefined; readonly listAccounts?: (() => Promise) | undefined; readonly getAccount?: ((accountId: string) => Promise) | undefined; readonly startAccount?: ((accountId?: string, input?: Record) => Promise) | undefined; readonly stopAccount?: ((accountId?: string, input?: Record) => Promise) | undefined; readonly loginAccount?: ((accountId?: string, input?: Record) => Promise) | undefined; readonly loginWithQrStart?: ((accountId?: string, input?: Record) => Promise) | undefined; readonly loginWithQrWait?: ((accountId?: string, input?: Record) => Promise) | undefined; readonly logoutAccount?: ((accountId?: string, input?: Record) => Promise) | undefined; readonly runAccountAction?: (action: ChannelAccountLifecycleAction, accountId?: string, input?: Record) => Promise; readonly authorizeActorAction?: ((request: ChannelActorAuthorizationRequest) => Promise) | undefined; readonly getActionAvailabilityState?: ((request: ChannelActorAuthorizationRequest) => Promise) | undefined; readonly listCapabilities?: (() => Promise | readonly ChannelCapabilityDescriptor[]) | undefined; readonly listTools?: (() => Promise | readonly ChannelToolDescriptor[]) | undefined; readonly runTool?: ((toolId: string, input?: Record) => Promise) | undefined; readonly listOperatorActions?: (() => Promise | readonly ChannelOperatorActionDescriptor[]) | undefined; readonly runOperatorAction?: ((actionId: string, input?: Record) => Promise) | undefined; readonly lookupDirectory?: ((query: string, options?: ChannelDirectoryQueryOptions) => Promise) | undefined; readonly queryDirectory?: ((query: ChannelDirectoryQueryOptions) => Promise) | undefined; readonly listGroupMembers?: ((groupId: string, options?: ChannelDirectoryQueryOptions) => Promise) | undefined; readonly parseExplicitTarget?: ((input: string, options?: ChannelTargetResolveOptions) => Promise | ChannelResolvedTarget | null) | undefined; readonly inferTargetConversationKind?: ((input: string, options?: ChannelTargetResolveOptions) => Promise | ChannelConversationKind | null) | undefined; readonly resolveTarget?: ((options: ChannelTargetResolveOptions) => Promise) | undefined; readonly resolveSessionTarget?: ((target: ChannelResolvedTarget, options?: ChannelTargetResolveOptions) => Promise | string | null) | undefined; readonly resolveParentConversationCandidates?: ((options: ChannelTargetResolveOptions) => Promise) | undefined; readonly listAgentTools?: (() => readonly Tool[]) | undefined; } export declare class ChannelPluginRegistry { private readonly plugins; private readonly pluginsBySurface; private readonly pluginsByPath; private readonly featureFlags; private ingressAlarm; private version; constructor(options?: { readonly featureFlags?: FeatureFlagReader; }); private isPluginEnabled; register(plugin: ChannelPlugin): void; unregister(pluginId: string): boolean; getVersion(): number; list(): ChannelPlugin[]; listDescriptors(): ChannelAdapterDescriptor[]; getBySurface(surface: ChannelSurface): ChannelPlugin | null; get(pluginId: string): ChannelPlugin | null; getByPath(pathname: string): ChannelPlugin | null; /** * THE shared inbound seam for every webhook-delivered surface. * * Wrapped rather than passed straight through, because this is the one place * that knows both "a message arrived from surface X" and "processing it * failed" for all twelve of them at once. Wiring the alarm per adapter would * mean twelve chances to forget, and the surface that got forgotten would be * silent in exactly the way the one that started this was. * * The error is RE-THROWN, deliberately. A webhook has no cursor to advance: * the provider decides whether to redeliver, and it decides on the status * code. Swallowing it here would turn a retryable 500 into a 200 and convert * "might be redelivered" into "definitely lost", the opposite of the fix. * The alarm records; the caller still fails. */ handleInbound(pathname: string, req: Request): Promise; /** * Install the alarm that turns a message this node could not process into * something the owner hears about. Optional: an embedder that wires none * keeps exactly the previous behaviour. */ setIngressAlarm(alarm: ChannelIngressAlarm | null): void; deliverReply(surface: ChannelSurface, pending: unknown, message: string): Promise; deliverProgress(surface: ChannelSurface, pending: unknown, progress: string): Promise; notifyApproval(surface: ChannelSurface, approval: SharedApprovalRecord, binding: AutomationRouteBinding): Promise; getRenderPolicy(surface: ChannelSurface): Promise; render(surface: ChannelSurface, request: ChannelRenderRequest): Promise; getSetupSchema(surface: ChannelSurface, accountId?: string): Promise; doctor(surface: ChannelSurface, accountId?: string): Promise; listRepairActions(surface: ChannelSurface, accountId?: string): Promise; getLifecycleState(surface: ChannelSurface, accountId?: string): Promise; resolveAllowlist(surface: ChannelSurface, input: ChannelAllowlistEditInput): Promise; editAllowlist(surface: ChannelSurface, input: ChannelAllowlistEditInput): Promise; listStatus(): Promise; listAccounts(surface?: ChannelSurface): Promise; getAccount(surface: ChannelSurface, accountId: string): Promise; runAccountAction(surface: ChannelSurface, action: ChannelAccountLifecycleAction, accountId?: string, input?: Record): Promise; authorizeActorAction(surface: ChannelSurface, request: ChannelActorAuthorizationRequest): Promise; listCapabilities(surface?: ChannelSurface): Promise; listTools(surface?: ChannelSurface): Promise; runTool(surface: ChannelSurface, toolId: string, input?: Record): Promise; listOperatorActions(surface?: ChannelSurface): Promise; runOperatorAction(surface: ChannelSurface, actionId: string, input?: Record): Promise; listAgentTools(surface?: ChannelSurface): Tool[]; resolveTarget(surface: ChannelSurface, options: ChannelTargetResolveOptions): Promise; resolveSessionTarget(surface: ChannelSurface, target: ChannelResolvedTarget, options?: ChannelTargetResolveOptions): Promise; resolveParentConversationCandidates(surface: ChannelSurface, options: ChannelTargetResolveOptions): Promise; lookupDirectory(surface: ChannelSurface, query: string, options?: ChannelDirectoryQueryOptions): Promise; queryDirectory(surface: ChannelSurface, options: ChannelDirectoryQueryOptions): Promise; listGroupMembers(surface: ChannelSurface, groupId: string, options?: ChannelDirectoryQueryOptions): Promise; } //# sourceMappingURL=plugin-registry.d.ts.map