7.5 KiB
Rust API Server 路由索引(2026-04-23)
更新时间:2026-05-13
2026-04-29 补充:本文件保留为迁移期路由快照。DDD G1 后续并行工作的契约冻结口径以
SERVER_RS_DDD_G1_CONTRACT_AND_ROUTE_MATRIX_2026-04-29.md为准,尤其是新增的 Big Fish、Puzzle、profile、runtime chat、story facade 和兼容路由删除计划。2026-04-29 WP-RS 进度:旧
/api/runtime/story/*HTTP compat 路由已从api-server/src/app.rs取消挂载,并删除api-server/src/runtime_story*兼容实现。当前 Rustapi-server对外 story 主链只保留/api/story/*、/api/runtime/sessions/{runtime_session_id}/inventory与 runtime chat 相关路由。
1. 文档目标
本文件记录当前 server-rs/crates/api-server/src/app.rs 中已挂载的 Rust Axum 路由面,用于对照 Node 后端 96 条路由能力基线。
本文件只做路由索引,不替代单个阶段的设计文档;接口字段、权限、错误模型仍以各阶段技术方案和 shared-contracts 为准。
2. 当前统计
当前 Rust api-server 从 app.rs 可抽取到 116 条路由:
- 管理后台 API:
6条。 - 内部鉴权调试接口:
2条。 - AI task 接口:
9条。 - assets / OSS 接口:
15条。 - auth 接口:
13条。 - custom world / agent 接口:
23条。 - match3d creation / runtime 接口:
14条。 - llm proxy 接口:
1条。 - profile / runtime profile 接口:
12条。 - runtime story / story gameplay 接口:
15条。 - legacy generated 静态标识:
6类历史路径字符串,直读代理已下线。 - health check:
1条。
3. 路由清单
3.1 管理后台 API
POST /admin/api/loginGET /admin/api/meGET /admin/api/overviewPOST /admin/api/debug/httpPOST /admin/api/profile/redeem-codesPOST /admin/api/profile/redeem-codes/disable
GET /admin 同源内嵌页面入口已取消挂载,后台 UI 后续由独立前端工程承接。
3.2 内部鉴权调试
GET /_internal/auth/claimsGET /_internal/auth/refresh-cookie
3.3 AI Task
POST /api/ai/tasksPOST /api/ai/tasks/{task_id}/startPOST /api/ai/tasks/{task_id}/cancelPOST /api/ai/tasks/{task_id}/completePOST /api/ai/tasks/{task_id}/failPOST /api/ai/tasks/{task_id}/chunksPOST /api/ai/tasks/{task_id}/referencesPOST /api/ai/tasks/{task_id}/stages/{stage_kind}/startPOST /api/ai/tasks/{task_id}/stages/{stage_kind}/complete
3.4 Assets / OSS
POST /api/assets/direct-upload-ticketsPOST /api/assets/sts-upload-credentialsPOST /api/assets/objects/confirmPOST /api/assets/objects/bindGET /api/assets/read-urlPOST /api/assets/character-visual/generateGET /api/assets/character-visual/jobs/{task_id}POST /api/assets/character-visual/publishPOST /api/assets/character-animation/generateGET /api/assets/character-animation/jobs/{task_id}POST /api/assets/character-animation/publishPOST /api/assets/character-animation/import-videoGET /api/assets/character-animation/templatesGET /api/assets/character-workflow-cache/{character_id}GET / POST /api/assets/character-workflow-cache
3.5 Auth
GET /api/auth/login-optionsGET /api/auth/mePOST /api/auth/logoutPOST /api/auth/logout-allGET /api/auth/sessionsPOST /api/auth/sessions/{session_id}/revokePOST /api/auth/refreshPOST /api/auth/phone/send-codePOST /api/auth/phone/loginGET /api/auth/wechat/startGET /api/auth/wechat/callbackPOST /api/auth/wechat/bind-phonePOST /api/auth/entry
3.6 Custom World / Agent
GET /api/runtime/custom-world-libraryGET /api/runtime/custom-world-library/{profile_id}POST /api/runtime/custom-world-library/{profile_id}/publishPOST /api/runtime/custom-world-library/{profile_id}/unpublishGET /api/runtime/custom-world-galleryGET /api/runtime/custom-world-gallery/{owner_user_id}/{profile_id}GET /api/runtime/custom-world/worksPOST /api/runtime/custom-world/agent/sessionsGET /api/runtime/custom-world/agent/sessions/{session_id}POST /api/runtime/custom-world/agent/sessions/{session_id}/messagesGET /api/runtime/custom-world/agent/sessions/{session_id}/messages/streamGET /api/runtime/custom-world/agent/sessions/{session_id}/operations/{operation_id}GET /api/runtime/custom-world/agent/sessions/{session_id}/cards/{card_id}POST /api/runtime/custom-world/agent/sessions/{session_id}/actionsPOST /api/custom-world/entityPOST /api/runtime/custom-world/entityPOST /api/custom-world/scene-npcPOST /api/runtime/custom-world/scene-npcPOST /api/custom-world/scene-imagePOST /api/custom-world/cover-imagePOST /api/custom-world/cover-uploadPOST /api/runtime/custom-world/cover-imagePOST /api/runtime/custom-world/cover-upload
3.7 LLM Proxy
POST /api/llm/chat/completions
3.8 Match3D Creation / Runtime
POST /api/creation/match3d/sessionsGET /api/creation/match3d/sessions/{session_id}POST /api/creation/match3d/sessions/{session_id}/messagesPOST /api/creation/match3d/sessions/{session_id}/messages/streamPOST /api/creation/match3d/sessions/{session_id}/actionsPOST /api/creation/match3d/sessions/{session_id}/compileGET /api/creation/match3d/worksGET / PATCH / PUT / DELETE /api/creation/match3d/works/{profile_id}POST /api/creation/match3d/works/{profile_id}/publishGET /api/runtime/match3d/galleryPOST /api/runtime/match3d/works/{profile_id}/runsGET /api/runtime/match3d/runs/{run_id}POST /api/runtime/match3d/runs/{run_id}/clickPOST /api/runtime/match3d/runs/{run_id}/stop / restart / time-up
3.9 Profile / Runtime Profile
GET /api/profile/dashboardGET /api/runtime/profile/dashboardGET /api/profile/play-statsGET /api/runtime/profile/play-statsGET /api/profile/wallet-ledgerGET /api/runtime/profile/wallet-ledgerGET /api/profile/browse-historyGET /api/runtime/profile/browse-historyGET /api/profile/save-archivesGET /api/runtime/profile/save-archivesPOST /api/profile/save-archives/{world_key}POST /api/runtime/profile/save-archives/{world_key}
3.10 Runtime Story / Gameplay
POST /api/runtime/save/snapshotGET /api/runtime/settingsPOST /api/story/sessionsPOST /api/story/sessions/continueGET /api/story/sessions/{story_session_id}/statePOST /api/story/battlesPOST /api/story/battles/resolveGET /api/story/battles/{battle_state_id}POST /api/story/npc/battleGET /api/runtime/sessions/{runtime_session_id}/inventory
3.11 Legacy Generated 路径
旧 /generated-* 直读代理已下线。生成资产读取统一走 GET /api/assets/read-url 或 asset object projection;/generated-* 字符串仅作为 legacyPublicPath / OSS object key 兼容标识保留。
3.12 Health
GET /healthz
4. 维护规则
- 新增、删除或改名 Rust 路由时,必须同步更新本索引。
- 如果 Rust 后端公开能力面发生变化,必须同时更新本索引、当前后端实现基线与对应阶段任务清单。
- 任何 breaking route change 都必须先更新阶段设计文档,再改代码。
- 真实切流前,必须用本索引对照代理层、前端调用面和 smoke 清单,避免只完成编译而遗漏外部可访问路径。