import type { PlatformAdapter } from '../adapter.js'; import type { MessageRef, MessageContent, MessageContext, MessageEditContext, ActionContext, ModalSubmitContext, ModalDefinition, PlatformCapabilities, PlatformFileRef, DownloadedFile, Destination, PostMessageOpts, FileUploadOpts, ActionElement, RichBlock } from '../types.js'; import type { OutputStream, MutableRegion, OpenOutputStreamOpts } from '../output-stream.js'; import { TuiGatewayAdapter } from './tui/index.js'; /** * OutputStream that broadcasts all operations to an array of sub-streams. * Used by CompositeAdapter for project-report destinations. */ export declare class FanOutOutputStream implements OutputStream { private _subs; constructor(subs: OutputStream[]); emitText(text: string): void; openMutable(text: string): MutableRegion; postInteractive(text: string, opts?: { richBlocks?: RichBlock[]; actions?: ActionElement[]; }): Promise; flush(): Promise; getRefs(): MessageRef[]; getParentRef(): MessageRef | null; } /** * Combines N sub-adapters (e.g. Slack + Feishu + TUI) behind a single * PlatformAdapter surface. Outbound operations route to the owning sub-adapter * by conduit prefix (`adapter.ownsConduit(conduit)`); inbound handlers are * registered on every sub-adapter; system-notice and project-report fan out. */ export declare class CompositeAdapter implements PlatformAdapter { readonly name = "composite"; readonly capabilities: PlatformCapabilities; private _adapters; /** Cached TUI gateway reference (if any) for setBus / extractTuiAdapter. */ private _tui; constructor(adapters: PlatformAdapter[]); start(): Promise; stop(): Promise; onMessage(handler: (ctx: MessageContext) => Promise): void; onMessageEdit(handler: (ctx: MessageEditContext) => Promise): void; onAction(actionId: string, handler: (ctx: ActionContext) => Promise): void; onModalSubmit(callbackId: string, handler: (ctx: ModalSubmitContext) => Promise): void; /** Route a conduit to its owning sub-adapter (falls back to the first). */ private _adapterForConduit; private _adapterForRef; /** Route a triggerId (same prefix namespace as conduits) to its adapter. */ private _adapterForTrigger; /** Return sub-adapter(s) for a destination (single-target types only). * system-notice fans out to every real primary (each drops if its own admin * channel is unconfigured) but NOT the TUI gateway, which has no admin * channel concept. With a single primary this is just `[primary]`. */ private _adaptersForDest; /** Resolve which sub-adapters should receive a project-report. * Real primaries (Slack/Feishu) are ALWAYS targeted: each self-resolves to * the bound conduit, or falls back to its own admin DM, or drops internally * when neither exists. This makes every platform independently fall back to * its DM for projects it has no binding for. The TUI gateway has no admin-DM * concept, so it is targeted only when it has at least one live conduit (for * cross-project notification fan-out). */ private _getTargetAdaptersForProjectReport; postMessage(destination: Destination, content: MessageContent, opts?: PostMessageOpts): Promise; updateMessage(ref: MessageRef, content: MessageContent): Promise; deleteMessage(ref: MessageRef): Promise; postInteractive(destination: Destination, content: MessageContent & { actions: ActionElement[]; }, opts?: PostMessageOpts): Promise; openModal(triggerId: string, modal: ModalDefinition): Promise; markQueued(ref: MessageRef): Promise; uploadFile(destination: Destination, filePath: string, opts?: FileUploadOpts): Promise; downloadFile(fileRef: PlatformFileRef, destDir: string): Promise; getPermalink(ref: MessageRef): Promise; openOutputStream(destination: Destination, opts?: OpenOutputStreamOpts): OutputStream; /** Resolve the thread anchor messageId for one sub-adapter from the composite anchor. * - anchorRef.parts present → the part owned by this adapter (else null → self-anchor). * - anchorRef without parts → its messageId only if this adapter owns its conduit. * - no anchorRef → legacy behavior: the first adapter gets opts.threadId, the rest null * (the bare threadId belongs to whichever adapter produced the original `first` ref). */ private _resolveAnchorThreadId; bindProjectConduit(projectId: string, conduitHint: string): Promise; unbindProjectConduit(projectId: string): Promise; getProjectConduits(): Promise>; resolveInboundProject(conduit: string): Promise; ownsConduit(conduit: string): boolean; } /** * Extract the TuiGatewayAdapter from an adapter. * - CompositeAdapter: return the inner gateway (if any) * - TuiGatewayAdapter: return itself * - otherwise: return null */ export declare function extractTuiAdapter(adapter: PlatformAdapter): TuiGatewayAdapter | null;