/** * module: channel —— 对外类型(编码规范 §10.1)。 */ import type { InboundMail, OwnershipResolution, TaskId } from '@contracts'; import type { ChannelInstanceConfig, ExtractRule, LedgerMapping, NormalizedWrite } from './internal/domain/payload-mapping.ts'; export type { ChannelInstanceConfig, ExtractRule, InboundMail, LedgerMapping, NormalizedWrite, OwnershipResolution }; export declare class ChannelNotFoundError extends Error { readonly channelId: string; constructor(channelId: string); } export declare class ChannelDisabledError extends Error { readonly channelId: string; constructor(channelId: string); } export type InboundOutcome = { readonly eventId: string; readonly resolution: OwnershipResolution; readonly writes: readonly NormalizedWrite[]; readonly listenersHit: number; readonly triggersHit: number; readonly fellBackToMessage: boolean; }; export type OutboundMail = { readonly taskId: TaskId; readonly to: readonly string[]; readonly cc?: readonly string[]; readonly subject: string; readonly body: string; readonly threadId?: string; readonly attachments?: ReadonlyArray<{ name: string; ref: string; }>; }; export type ChannelService = { list(): Promise; upsert(config: ChannelInstanceConfig): Promise; /** * 入站:归属解析 → 归一为**系统写** → 数据事件。 * 「环外回音经归属解析归一为数据写入后,以数据事件抛出 —— 活动认数据,不认通道。」 */ ingestMail(channelId: string, mail: InboundMail): Promise; /** 出站:触达世界的动作;发送即登记出站关联记录(归属解析①③级的对表来源) */ sendMail(channelId: string, mail: OutboundMail): Promise<{ messageId: string; threadId: string; }>; };