Files
Genarrative/server-rs/crates/shared-contracts/README.md

30 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# shared-contracts 共享 package 占位说明
日期:`2026-04-20`
## 1. package 职责
`shared-contracts` 是前后端兼容 contract 共享 package后续负责
1. HTTP 请求与响应 DTO
2. SSE 事件结构与事件名约定
3. response envelope、错误结构、兼容头部契约
4. 各模块对外暴露的共享协议类型
## 2. 当前阶段说明
当前提交仅完成目录占位,不提前进入 DTO、事件与兼容结构实现。
后续与本 package 直接相关的任务包括:
1. 对齐现有前端直接依赖的响应头与 envelope
2. 对齐 story、custom world、chat 等 SSE 事件结构
3. 对齐 auth、runtime、assets 等兼容 DTO
4. 为 breaking change 建立显式变更边界
## 3. 边界约束
1. `shared-contracts` 只放协议类型与兼容结构,不承接业务规则、供应商适配或状态写入逻辑。
2. 各模块 package 对外暴露的协议优先复用这里的共享定义,避免重复散落。
3. 前端兼容契约一旦进入本 package就必须与任务清单和基线文档同步维护。