import { MatcherState, SyncExpectationResult } from '@vitest/expect'; import { Adapter, ChatInstance, StateAdapter } from 'chat'; declare const PROCESS_HANDLERS: readonly ["processMessage", "processMessageUpdated", "processMessageDeleted", "processReaction", "processAction", "processSlashCommand", "processOptionsLoad", "processModalSubmit", "processModalClose", "processInstalled", "processUninstalled", "processMemberJoinedChannel", "processAppHomeOpened", "processAgentSessionStopped", "processAgentSessionTitleChanged", "processAssistantThreadStarted", "processAssistantContextChanged", "processAppContextChanged"]; type ChatHandler = (typeof PROCESS_HANDLERS)[number]; /** * Assert that a mock `Adapter` posted to a given thread. * * Inspects `adapter.postMessage(threadId, message)` calls. If `textPattern` is * provided, the matcher extracts a string from the message — handling plain * strings, `PostableMarkdown.markdown`, `PostableRaw.raw`, and * `PostableCard.fallbackText` — and compares with string equality or * `RegExp.test`. AST-shaped messages (`PostableAst`) and cards without a * `fallbackText` aren't text-matchable; assert without `textPattern` to verify * a post happened, then inspect `adapter.postMessage.mock.calls` directly for * deeper assertions. */ declare function toHavePosted(this: MatcherState, received: Adapter, threadId: string, textPattern?: string | RegExp): SyncExpectationResult; /** * Assert that a mock `ChatInstance` dispatched an event through a given handler. * * Useful for adapter authors verifying their adapter routes through the right * `process*` method. */ declare function toHaveDispatched(this: MatcherState, received: ChatInstance, handler: ChatHandler): SyncExpectationResult; /** * Assert that a mock `StateAdapter` is currently subscribed to a thread. * * Calls the adapter's own `isSubscribed` so this matcher works against any * state adapter shape — including real adapters in integration tests, not * just `createMockState()`. */ declare function toBeSubscribedTo(this: MatcherState, received: StateAdapter, threadId: string): Promise; /** * Assert that a mock `Adapter` edited a specific message. * * Inspects `adapter.editMessage(threadId, messageId, message)` calls. If * `textPattern` is provided, it's matched against the same text-bearing * fields as `toHavePosted` (string, `markdown`, `raw`, `fallbackText`). */ declare function toHaveEdited(this: MatcherState, received: Adapter, threadId: string, messageId: string, textPattern?: string | RegExp): SyncExpectationResult; /** * Assert that a mock `Adapter` deleted a specific message. * * Inspects `adapter.deleteMessage(threadId, messageId)` calls. */ declare function toHaveDeleted(this: MatcherState, received: Adapter, threadId: string, messageId: string): SyncExpectationResult; /** * Assert that a mock `Adapter` added a reaction to a specific message. * * Inspects `adapter.addReaction(threadId, messageId, emoji)` calls. The `emoji` * argument may be a plain string or an `EmojiValue` — pass the expected name * as a string and the matcher handles both. */ declare function toHaveReactedWith(this: MatcherState, received: Adapter, threadId: string, messageId: string, emoji: string): SyncExpectationResult; /** * Assert that a mock `Adapter` started a typing indicator on a thread. * * Inspects `adapter.startTyping(threadId, status?)` calls. */ declare function toHaveStartedTyping(this: MatcherState, received: Adapter, threadId: string): SyncExpectationResult; /** * Assert that a mock `Adapter` posted to a channel (top-level, not in a thread). * * Inspects `adapter.postChannelMessage(channelId, message)` calls. Same text * extraction rules as `toHavePosted`. */ declare function toHavePostedToChannel(this: MatcherState, received: Adapter, channelId: string, textPattern?: string | RegExp): SyncExpectationResult; declare const matchers: { toHavePosted: typeof toHavePosted; toHaveEdited: typeof toHaveEdited; toHaveDeleted: typeof toHaveDeleted; toHaveReactedWith: typeof toHaveReactedWith; toHaveStartedTyping: typeof toHaveStartedTyping; toHavePostedToChannel: typeof toHavePostedToChannel; toHaveDispatched: typeof toHaveDispatched; toBeSubscribedTo: typeof toBeSubscribedTo; }; interface ChatMatchers { toBeSubscribedTo(threadId: string): Promise; toHaveDeleted(threadId: string, messageId: string): R; toHaveDispatched(handler: ChatHandler): R; toHaveEdited(threadId: string, messageId: string, textPattern?: string | RegExp): R; toHavePosted(threadId: string, textPattern?: string | RegExp): R; toHavePostedToChannel(channelId: string, textPattern?: string | RegExp): R; toHaveReactedWith(threadId: string, messageId: string, emoji: string): R; toHaveStartedTyping(threadId: string): R; } declare module "vitest" { interface Matchers extends ChatMatchers { } } export { type ChatHandler, matchers, toBeSubscribedTo, toHaveDeleted, toHaveDispatched, toHaveEdited, toHavePosted, toHavePostedToChannel, toHaveReactedWith, toHaveStartedTyping };