/** * Adapter-side contracts of the channels layer: what a platform adapter * implements ({@link ChannelAdapter}) and what the engine hands it at start * ({@link AdapterContext} with the engine-owned {@link IngressSink}). */ import type { CredentialPort, IngressHost } from "./ports.js"; import type { ActorQuery, ChannelActor, ChannelMessage, ChannelPlatform, ConversationEvent, ConversationHealth, ConversationKey, InboundReaction, IngressAck, MessageRef, OutboundMessage, ReplyTarget, SurfaceCapabilities } from "./types.js"; /** Minimal logging seam; hosts bridge to their own log store. Defaults to console. */ export type ChannelLogger = { info(msg: string, data?: Record): void; warn(msg: string, data?: Record): void; error(msg: string, err?: unknown, data?: Record): void; }; /** Default {@link ChannelLogger} writing `[channels]`-prefixed lines to the console. */ export declare const consoleChannelLogger: ChannelLogger; /** Everything an adapter receives at start() — engine-owned sink + host-owned ports. */ export type AdapterContext = { sink: IngressSink; credentials: CredentialPort; ingress: IngressHost; logger: ChannelLogger; }; /** * Implemented once per chat platform; runs in the host process (spec §6). * Egress refs are structured MessageRefs; `post` is idempotent via `dedupeKey` * (a retried post with the same key returns the prior MessageRef, no second * platform side effect — spec §8 at-least-once discipline). * Adapters MUST filter their own bot-account's messages before the sink. */ export interface ChannelAdapter { readonly platform: ChannelPlatform; readonly capabilities: SurfaceCapabilities; start(ctx: AdapterContext): Promise; stop(): Promise; post(target: ReplyTarget, msg: OutboundMessage, dedupeKey: string): Promise; update(ref: MessageRef, msg: OutboundMessage): Promise; postEphemeral?(target: ReplyTarget, actor: ChannelActor, msg: OutboundMessage): Promise; /** Native typing indicator, when supportsTyping (Decision 9). */ indicateTyping?(target: ReplyTarget): Promise; /** Backs the mention lookup tool (spec §6.1). */ lookupActor?(query: ActorQuery): Promise; /** Bind-time / engine-start preflight (forge-tui verifyChannels pattern). */ verifyConversation?(key: ConversationKey): Promise; } /** * Engine-owned ingress. `onMessage` MUST resolve within the adapter's * `capabilities.ackDeadlineMs`; real work detaches (spec §7.1.3). */ export interface IngressSink { onMessage(evt: ChannelMessage): Promise; onReaction?(evt: InboundReaction): Promise; onConversationEvent?(evt: ConversationEvent): Promise; } //# sourceMappingURL=adapter.d.ts.map