/** * module: interaction —— 本模块要外界提供的能力(编码规范 §10.1 / §5.3)。 */ import type { ChatMessage, StaffId, TaskId, ViewBlock } from '@contracts'; import type { InteractionPhase } from './internal/domain/control-handover.ts'; export type Clock = { now(): Date; }; export type IdGenerator = { next(): string; }; export type InteractionStore = { appendMessage(taskId: TaskId, message: ChatMessage): Promise; listMessages(taskId: TaskId): Promise; putView(taskId: TaskId, view: { blocks?: readonly ViewBlock[]; html?: string; }): Promise; setPhase(taskId: TaskId, phase: InteractionPhase): Promise; phaseOf(taskId: TaskId): Promise; }; /** 自由输入即人事件 —— app 注入 `event`(L1) */ export type HumanEventPublisher = { publishHumanEvent(input: { taskId: TaskId; cardId: string; payload: Record; }): Promise; }; /** 留痕 —— app 注入 `memory`(L2):时间线即任务记忆的可读投影 */ export type MemoryRecorder = { append(input: { taskId: TaskId; kind: 'human-input'; title: string; detail?: Record; }): Promise; }; /** 收件人解析 —— app 注入 `org`(L1):SSE 只推给有权看的人 */ export type Audience = { canSee(staffId: StaffId, taskId: TaskId): Promise; };