Files
Genarrative/server-rs/crates/shared-kernel
suzmii c1ad1a19f8
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
修复 api-server 未使用常量并给已清零的 Rust 包加 warning 门禁
删除 api-server src/llm/mod.rs 中零引用的测试常量 TEST_AGC_MODEL_DEFAULT_ID,全仓仅定义处命中,无调用方与专属用例。

server-rs workspace 根新增 [workspace.lints.rust] warnings = "deny",27 个成员 crate 各自新增 [lints] workspace = true。

4 个被 exclude 的独立 crate(agent-runtime-core、agent-runtime-orchestration、editor-adapter-api、platform-agent)各自新增 [lints.rust] warnings = "deny"。

apps/desktop-shell/src-tauri 与 unity/godot/cocos 三个编辑器 bridge 各自新增 [lints.rust] warnings = "deny";未触碰 apps/ai-game-creator-shell/src-tauri 及其 vendor。

验证:server-rs --workspace --all-targets、desktop-shell、三个 bridge、4 个 exclude crate 全部 rc=0 且输出 0 条 warning;api-server llm:: 定向用例 30 passed / 0 failed。

门禁自证:api-server 与 editor-adapter-api 各插入未使用变量后 cargo check 均失败并报 -D warnings(-D unused-variables implied by -D warnings),撤销后同一命令转绿 rc=0。
2026-10-06 16:32:28 +08:00
..
2026-07-16 18:33:06 +08:00

shared-kernel 共享 crate 阶段性说明

日期:2026-04-22

1. crate 职责

shared-kernel 是跨模块共享领域内核 crate,当前阶段已经开始承接最小共享基础能力,负责:

  1. 共享 ID、值对象、枚举与基础领域类型
  2. 共享时间、状态、版本、通用校验等基础规则
  3. 供各模块 package 复用的最小领域内核

2. 当前阶段说明

当前阶段已落地的共享能力:

  1. 必填/可选字符串归一化
  2. 字符串列表归一化
  3. 前缀 UUID / 前缀种子 ID 生成
  4. RFC3339 格式化与解析
  5. 微秒时间戳文本格式化

后续与本 crate 直接相关的任务包括:

  1. 统一用户、会话、世界、角色、资产等核心 ID 类型
  2. 统一时间戳、版本号、状态枚举等共享结构
  3. 抽取真正跨模块复用的最小领域规则
  4. 避免把模块私有规则错误上提到共享内核

当前已接入的 crate 已覆盖:

  1. module-assets
  2. module-auth
  3. platform-auth
  4. module-runtime
  5. module-story
  6. spacetime-client
  7. api-server
  8. module-ai
  9. module-inventory
  10. module-runtime-item
  11. module-npc
  12. module-quest
  13. module-combat
  14. module-progression

3. 边界约束

  1. shared-kernel 只放跨模块最小共享内核,不承接具体业务模块的私有规则。
  2. 任何进入本 crate 的类型都必须证明至少被多个模块稳定复用。
  3. 不能把主模块实现重新堆进共享内核,避免形成新的“大公共垃圾桶”。

当前文档入口

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

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

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