Files
Genarrative/server-rs/crates/module-custom-world
高物 3cb3efb4d0 Prune stale docs and update .hermes content
Delete a large set of outdated documentation (many files under docs/ and .hermes/plans/, including audits, design, prd, technical, planning, assets, and todos). Update and consolidate .hermes content: refresh shared-memory pages (decision-log, development-workflow, document-map, pitfalls, project-overview, team-conventions) and several skills/references under .hermes/skills. Also modify AGENTS.md, README.md, UI_CODING_STANDARD.md, docs/README.md and .encoding-check-ignore. Purpose: clean up stale planning/audit material and keep current hermes documentation and related top-level docs in sync.
2026-05-15 06:24:07 +08:00
..

module-custom-world 独立模块 package 说明

日期:2026-04-21

1. package 职责

module-custom-world 是自定义世界与 agent 模块 package后续负责

  1. custom_world_profilecustom_world_session 等世界状态模型
  2. custom_world_agent_session、消息、操作、草稿卡等 agent 状态模型
  3. 传统问答流、library、gallery、agent 会话的模块级编排
  4. apps/api-server 的 custom world 兼容接口与 SSE 对接
  5. apps/spacetime-module 的 custom world 表、reducer、view 聚合对接

2. 当前阶段说明

当前阶段已经不再是单纯目录占位,custom world / agent 类型契约、字段校验、发布编译规则和 Agent action 应用结果已经固定到 DDD 骨架中,避免 spacetime-module 在缺少领域边界的情况下直接堆表。

当前已落地:

  1. 真实 Cargo.toml crate scaffold
  2. src/domain.rs 承接基础枚举、进度常量、profile/session/card/gallery/publish gate 快照与结果类型。
  3. src/commands.rs 承接 profile、library/gallery、Agent session/message/operation/action、published profile compile 和 publish world 输入 DTO。
  4. src/application.rs 承接字段校验、默认 JSON、profile canonicalize、published profile compile 和 publish gate 相关纯规则。
  5. src/errors.rs 承接 CustomWorldFieldError 与中文错误文案。
  6. src/events.rs 承接 Custom World 领域事件与 payload struct。
  7. src/lib.rs 只保留模块声明、公开导出和测试,继续保持 module_custom_world::* 公开 API。
  8. spacetime-modulegenerate_charactersgenerate_landmarksgenerate_role_assetssync_role_assetsgenerate_scene_assetssync_scene_assetsexpand_long_tail 已移除最小兼容占位,改为确定性状态编排。

当前 crate 仍然只承接:

  1. 共享枚举、进度常量与类型口径,基础枚举统一从 src/domain.rs 导出。
  2. 字段校验、字符串归一化与发布编译纯规则。
  3. published profile compile 与 publish world 的输入输出 contract。
  4. 后续 spacetime-module 聚合表时需要复用的领域边界。

当前阶段明确不提前进入:

  1. 旧问答流 reducer 编排
  2. 外部 LLM 创作编排、图片生成、OSS 上传和 SSE 推送。
  3. 资产对象真相表、资产绑定表和完整资产历史。
  4. 前端创作流程和 UI 表现状态。

当前文档入口

当前长期工程口径已融合到:

  1. ../../../docs/【后端架构】server-rs与SpacetimeDB数据契约-2026-05-15.md
  2. ../../../docs/【玩法创作】平台入口与玩法链路-2026-05-15.md
  3. ../../../docs/【开发运维】本地开发验证与生产运维-2026-05-15.md

旧阶段设计文档不再作为实现依据。

3. 边界约束

  1. module-custom-world 负责世界状态真相、agent 状态与模块级编排,不把整个会话重新塞回单大 JSON 体。
  2. 外部 LLM、图片生成、OSS 写入等副作用通过平台适配和应用层完成,状态最终回写到 spacetime-module 聚合的状态模型中。
  3. 前端兼容 REST 与 SSE 由 api-server 暴露,但自定义世界主链状态不能再次分散到本地 session store 或前端临时状态中。
  4. custom_world_asset_link 本轮不冻结,等待 asset_object / asset_entity_binding / M6 assets 的槽位规则稳定后再接。