Files
Genarrative/server-rs/crates/module-runtime-story/README.md

1.5 KiB
Raw Blame History

module-runtime-story

module-runtime-story 承接 RPG runtime story 的纯领域规则、应用用例、事件和错误模型,不依赖 HTTP / AppState / SpacetimeDB。

当前已经迁入的历史快照态纯逻辑会继续收口为 session scoped 新主链;顶层 DDD 物理拆分已经完成:

  1. src/domain.rs 承载 action 结算结果结构、NPC 委托上下文、functionId / 队伍上限常量。
  2. src/commands.rs 承载 action 文本解析 helper。
  3. src/application.rs 承载 action response 组装参数、status patch 和 world type helper。
  4. src/events.rs 承载 runtime story 领域事件。
  5. src/errors.rs 承载 runtime story 纯规则错误。
  6. src/lib.rs 只保留模块声明、公开导出和子模块 re-export。

bootstrap.rs 需要组装较深的运行时初始 game_state JSON 模板crate 级 recursion_limit = "512" 仅用于支撑 serde_json::json! 宏展开,不承载额外领域规则。

当前 WP-RS 写链路已经通过 POST /api/story/sessions/runtimePOST /api/story/sessions/{storySessionId}/actions/resolve 收口到 session scoped 新接口。后续只按 battle / forge / NPC / quest / presentation 的顺序增强领域规则和投影,并在 WP-DEL 中删除运行代码不再需要的旧入口命名。

配套记录见 ../../../docs/technical/SERVER_RS_DDD_WP_RS_RUNTIME_STORY_DOMAIN_SPLIT_2026-04-30.md