# module: interaction 职责: 交互协议:对话流单入口、视图区推送与净化门、控制权按态转交、SSE 会话与失效广播 不负责: 卡的内容与回传校验(见 human-tool)、任务记忆的权威存放(见 memory)、 前端渲染(见 apps/web);视图 HTML 的容器渲染由 `@ui` 的 `ViewContainer` 统一实现 公开出口: index.ts - 类型:`InteractionService` `PushEnvelope` `InteractionPhase` `ControlHolder` `TemplateViolation` - 错误:`TemplateRejectedError` - 端口类型:`InteractionStore` `HumanEventPublisher` `MemoryRecorder` `Audience` `Clock` `IdGenerator` - 用例工厂:`createInteractionService(deps): InteractionService` - 纯函数:`outputControl` `inputControl` `handoverHappens` `checkTemplate` `templateIsSafe` - adapter:`createInteractionStore`;Drizzle 表:`chatMessageTable` `taskViewTable` 层级: L3(编码规范 §4) 依赖: @contracts;@shared/db;port:`HumanEventPublisher`(app 注入 event)、 `MemoryRecorder`(app 注入 memory)、`Audience`(app 注入 org) 被依赖: release, loop-engine, flow-engine, task, app(SSE 路由) 不变量(OS 4.1 / 09,AM 07): - **输入单入口**:`inputControl()` 恒为 system —— 输入侧不参与转交; 视图区不得产生回环输入,浏览性交互由前端容器本地处理 - **控制权按态转交**:活动在跑(active / awaiting-*)归活动,其余归系统; 转交随引擎事件自动发生,活动不感知交接 - **视图区无脚本执行权**:含 `