1a7abfd059
Project CI / AI game creator shell Rust shard 4/4 (push) Has been cancelled
Project CI / AI game creator shell Rust smoke (push) Has been cancelled
Project CI / AI game creator shell Rust crates (push) Has been cancelled
Project CI / Backend tests (push) Has been cancelled
Project CI / Native shell tests (push) Has been cancelled
Project CI / Frontend tests (push) Has been cancelled
Project CI / Repository checks (push) Has been cancelled
Project CI / AI game creator shell web tests (push) Has been cancelled
Project CI / AI game creator shell Rust shard 1/4 (push) Has been cancelled
Project CI / AI game creator shell Rust shard 2/4 (push) Has been cancelled
Project CI / AI game creator shell Rust shard 3/4 (push) Has been cancelled
## 交付内容
- 客户端新增 `project_snapshot` 模块:项目扫描与排除口径、增量索引、差异对比、上传编排、状态查询。
- 触发:工作区窗口存活期间的周期定时器 + 工作区窗口关闭(`CloseRequested`);应用退出只在有界预算内等待在途同步收尾,不重复发起。
- 服务端新增两条登录态路由 `POST /api/agc/project-snapshots/files` 与 `/manifest`,由 api-server 用服务端凭据写入私有前缀 `agc/project-snapshots/v1/{user}/{project}/`;客户端不持有 OSS 凭据、不直连 OSS。
- `platform-oss` 新增内部对象精确写入与探测、项目快照对象键构造;修复 `head_internal_object` 读 HEAD 响应长度恒为 0(会导致服务端"已存在即跳过"永不生效)。
- `shared-contracts` 新增 `agc_project_snapshots` DTO 与项目 ID、相对路径、摘要校验。
- 真实 OSS 存储层冒烟示例 + 客户端真实链路冒烟用例(`#[ignore]`,env 驱动)。
- 登记 `check-config.mjs` 的 native-only 命令白名单,恢复 `npm run agc` 可启动。
## 验证证据
- 存储层:`cargo run -p platform-oss --example agc_project_snapshot_live_smoke` 对真实 `agc-dev` 完成写入 → 读回(contentLength 32)→ 清单写入 → 探针清理。
- HTTP 层:登录态下 7 项校验(401 无 token、400 路径穿越/长度不一致/非法摘要/空正文/重复路径清单)全部符合预期且不写对象。
- 客户端链路(真实项目 gameagent-033b6cf3…):第一次 `synced uploaded=6 uploadedBytes=36694 remoteSkipped=6`,紧接着第二次 `no-op uploaded=0`。
- GUI 触发:`trigger=periodic ... uploaded=6`;把周期设为 600 秒排除干扰、改一个文件后关窗得到 `trigger=project-close ... revision=2 uploaded=1`,索引摘要由 `28d837cd84f8ab62` 推进到 `bff34e2e336d901f`(同步在进程退出前完成)。
- 门禁:AGC `project_snapshot` 14 passed(+1 ignored live)、api-server `project_snapshots` 3 passed、platform-oss 39 passed、shared-contracts 87 passed、`cargo fmt --check`(两处)、`check:encoding`、`check:doc-index`、`git diff --check`、`check-config.mjs` 全部通过。
## 已知未决(不阻塞本里程碑)
- 远端对象只增不减:没有删除路径,也没有 bucket 生命周期规则;要收口需要先定保留语义(清单引用 GC 还是 OSS 生命周期)。
- 部署环境需确认 `GENARRATIVE_AGC_PROJECT_SNAPSHOT_OSS_*` 或回退的 `ALIYUN_OSS_*` 具备目标 bucket 私有前缀的 `PutObject` 权限;未配置时接口返回 503、客户端失败关闭(不推进索引)。
- 缺少按用户/项目的配额与限流(error_reports 有每小时提交上限的先例,本功能没有)。
- 没有界面入口与状态可见性:`read_local_project_snapshot_state` 已注册但未接 UI,失败只写本机日志。
## 不做
- 不做云端下载/恢复、跨设备合并、版本回滚。
- 不改 `/api/external/v1` 与 External OpenAPI,不新增 SpacetimeDB 表。
---------
Co-authored-by: kdletters <61648117+kdletters@users.noreply.github.com>
Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/400
shared-contracts 共享 crate 说明
日期:2026-04-21
1. crate 职责
shared-contracts 是前后端兼容 contract 共享 crate,后续负责:
- HTTP 请求与响应 DTO
- SSE 事件结构与事件名约定
- response envelope、错误结构、兼容头部契约
- 各模块对外暴露的共享协议类型
2. 当前阶段说明
当前阶段已完成 Stage1 最小真实落地:
- 统一 response envelope / 头部常量
auth/login-optionsauth/meauth/sessionsruntime/settings
当前阶段继续补齐的 Stage2 鉴权 DTO:
auth/entryauth/refreshauth/logoutauth/logout-allauth/phone/send-codeauth/phone/loginauth/wechat/startauth/wechat/callbackauth/wechat/bind-phoneauth/wechat/miniprogram-login
当前阶段继续补齐的 Stage3 公开请求 DTO:
assets/direct-upload-ticketsassets/read-urlassets/objects/confirmassets/objects/bindstory-sessions/beginstory-sessions/continue
当前阶段继续补齐的 Stage4 显式成功响应 DTO:
assets/direct-upload-ticketsassets/read-urlassets/objects/confirmassets/objects/bindstory-sessions/beginstory-sessions/continue
当前阶段新增 Stage6 character visual 兼容 DTO:
assets/character-visual/generateassets/character-visual/jobs/:taskIdassets/character-visual/publish
当前阶段新增 Stage7 character animation 模板与导入兼容 DTO:
assets/character-animation/templatesassets/character-animation/import-video
当前阶段新增 Stage8 character workflow cache 第一批兼容 DTO:
assets/character-workflow-cacheassets/character-workflow-cache/:characterId
当前阶段新增 Stage9 character animation 主链兼容 DTO:
assets/character-animation/generateassets/character-animation/jobs/:taskIdassets/character-animation/publish
当前阶段新增 Stage5 story session scoped runtime story 写读 DTO:
BeginStoryRuntimeSessionRequestResolveStoryRuntimeActionRequestStoryRuntimeProjectionResponseStoryRuntimeMutationResponseStoryRuntimeSnapshotPayload仅用于 story session scoped 写侧持久化边界,不复用旧/api/runtime/story/*总入口 contract。
WP-DEL 已删除旧 runtime story HTTP DTO:RuntimeStoryStateResolveRequest、RuntimeStoryBootstrapRequest/Response、RuntimeStoryActionResponse 和旧 RuntimeStorySnapshotPayload。runtime_story 模块中仍保留的 RuntimeStoryViewModel、RuntimeStoryPresentation、RuntimeStoryPatch 与 battle presentation 是当前投影/表现构件,不作为旧 HTTP 写入口。
当前仍刻意未做:
- SSE 事件结构
- 自动代码生成或跨语言 contract 同步
- 其他尚未收口模块的 handler 响应体显式 DTO 化
3. 边界约束
shared-contracts只放协议类型与兼容结构,不承接业务规则、供应商适配或状态写入逻辑。- 各模块 crate 对外暴露的协议优先复用这里的共享定义,避免重复散落。
- 前端兼容契约一旦进入本 crate,就必须与任务清单和基线文档同步维护。
assets模块依赖platform-oss的稳定返回类型,默认通过oss-contractsfeature 给api-server使用;SpacetimeDB WASM 构建链路必须通过 workspace 依赖关闭默认 feature,避免把platform-oss/reqwest/wasm-bindgen带进spacetime-module。