/** * module: human-tool —— 本模块要外界提供的能力(编码规范 §10.1 / §5.3)。 */ import type { ChatCard, StaffId, TaskId, WorkOrder } from '@contracts'; export type Clock = { now(): Date; }; export type IdGenerator = { next(): string; }; export type CardStore = { saveWorkOrder(taskId: TaskId, order: WorkOrder, recipientId: StaffId): Promise; getWorkOrder(id: string): Promise<{ taskId: TaskId; order: WorkOrder; recipientId: StaffId; } | undefined>; listWorkOrders(taskId: TaskId, openOnly: boolean): Promise; markWorkOrderDone(id: string, done: NonNullable): Promise; /** 局部改卡面 —— 只增不改是对**已回传**的卡;未答的卡还可补齐契约事实(如选择组) */ patchWorkOrder(id: string, patch: Partial): Promise; saveChatCard(taskId: TaskId, card: ChatCard, recipientId: StaffId): Promise; getChatCard(id: string): Promise<{ taskId: TaskId; card: ChatCard; recipientId: StaffId; } | undefined>; listChatCards(taskId: TaskId): Promise; updateChatCard(card: ChatCard): Promise; closeChatCard(id: string, supersededBy: string, reason: string): Promise; /** 调人次数 —— 打扰率与预算的计数面 */ humanCallCount(taskId: TaskId): Promise; openCardsOf(staffId: StaffId): Promise>; }; /** 跨人卡的到达面 —— app 注入 `message`(L2) */ export type MessageOutbox = { sendElicitation(input: { staffId: StaffId; title: string; body: string; cardId: string; sourceTaskId: string; payload: Record; }): Promise<{ id: string; }>; }; /** 回传即留痕 —— app 注入 `memory`(L2) */ export type MemoryRecorder = { append(input: { taskId: TaskId; kind: 'card-sent' | 'card-reply' | 'release-verdict'; title: string; detail?: Record; }): Promise; }; /** 人事件 —— app 注入 `event`(L1):回传经统一入口写回任务 */ export type HumanEventPublisher = { publishHumanEvent(input: { taskId: TaskId; cardId: string; payload: Record; }): Promise; };