import type { PlatformAdapter } from './adapter.js'; import type { MessageRef, MessageContent, MessageContext, MessageEditContext, ActionContext, ModalSubmitContext, ModalDefinition, ModalFieldValue, PlatformCapabilities, PlatformFileRef, DownloadedFile, Destination, PostMessageOpts, FileUploadOpts, ActionElement, RichBlock } from './types.js'; import type { OutputStream, MutableRegion, OpenOutputStreamOpts } from './output-stream.js'; export interface PostedMessage { destination: Destination; content: MessageContent; threadId?: string; actions?: ActionElement[]; } export interface UpdatedMessage { ref: MessageRef; content: MessageContent; } export interface DeletedMessage { ref: MessageRef; } export interface MarkedQueued { ref: MessageRef; } export interface UploadedFile { destination: Destination; filePath: string; opts?: FileUploadOpts; } export interface OpenedModal { triggerId: string; modal: ModalDefinition; } export interface MockSegmentRecord { kind: 'text' | 'mutable-open' | 'mutable-update' | 'interactive'; text: string; actions?: ActionElement[]; } /** Mock OutputStream that records a typed segment trail. * Routes real posts through MockAdapter.postMessage/postInteractive * so existing posted[] assertions keep working. Does no coalescing, * mirroring TUI behavior. */ export declare class MockOutputStream implements OutputStream { private adapter; private destination; private _parentRef; readonly segments: MockSegmentRecord[]; readonly refs: MessageRef[]; constructor(adapter: MockAdapter, destination: Destination, _opts?: OpenOutputStreamOpts); emitText(text: string): void; openMutable(text: string): MutableRegion; postInteractive(text: string, opts?: { richBlocks?: RichBlock[]; actions?: ActionElement[]; }): Promise; flush(): Promise; getRefs(): MessageRef[]; getParentRef(): MessageRef | null; private _genCounter; private _nextGen; private _mutableUpdate; } export declare class MockAdapter implements PlatformAdapter { readonly name = "mock"; readonly capabilities: PlatformCapabilities; posted: PostedMessage[]; updated: UpdatedMessage[]; deleted: DeletedMessage[]; marksQueued: MarkedQueued[]; uploads: UploadedFile[]; modals: OpenedModal[]; /** Optional fault injection for tests: count of remaining failures, then succeed. */ failPostMessageCount: number; failUpdateMessageCount: number; failPostInteractiveCount: number; private nextId; private _adminChannel; private messageHandlers; private editHandlers; private actionHandlers; private modalHandlers; constructor(opts?: Partial | { adminChannel?: string; capabilities?: Partial; }); 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; 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; private _projectConduits; bindProjectConduit(projectId: string, conduitHint: string): Promise; unbindProjectConduit(projectId: string): Promise; getProjectConduits(): Promise>; resolveInboundProject(conduit: string): Promise; /** Default ownership: anything not owned by the TUI gateway. Override per-test * via `ownsConduitFn` to simulate platform-specific routing. */ ownsConduitFn: ((conduit: string) => boolean) | null; ownsConduit(conduit: string): boolean; /** Simulate an inbound message for testing event handlers. */ simulateMessage(channel: string, text: string, opts?: { senderId?: string; threadId?: string; isBot?: boolean; }): Promise; /** Simulate a message edit for testing edit handlers. */ simulateMessageEdit(channel: string, messageId: string, newText: string): Promise; /** Simulate a button/action click for testing action handlers. */ simulateAction(actionId: string, value: string, opts?: { channelId?: string; userId?: string; triggerId?: string; messageRef?: MessageRef; }): Promise; /** Simulate a modal submission for testing modal handlers. */ simulateModalSubmit(callbackId: string, values: Record>, opts?: { privateMetadata?: string; userId?: string; }): Promise; /** Reset all recorded state. */ reset(): void; }