Compare commits

..

265 Commits

Author SHA1 Message Date
k88936 eb27bb9226 清掉 api-server 两条编译告警:未使用导入与测试态死代码
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m50s
Project CI / Backend tests (pull_request) Failing after 18s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m17s
Project CI / Frontend tests (pull_request) Successful in 1m54s
Project CI / Repository checks (pull_request) Failing after 15s
Project CI / AI game creator shell web tests (pull_request) Failing after 1m26s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 8m51s
Project CI / Native shell tests (pull_request) Successful in 6m23s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 11m5s
- server-rs/crates/api-server/src/tripo3d/routes.rs:删除未使用的 Model3dJobTarget 导入,同批使用的 Model3dJobKind 等保留
- server-rs/crates/api-server/src/state.rs:map_editor_generation_pricing_persistence_error 只被 cfg(not(test)) 分支调用,补 cfg_attr(test, allow(dead_code)),与同文件 seed_editor_generation_pricing_config 的既有写法一致
- 验证:cargo check --workspace --all-targets 零告警零错误
2026-09-23 19:59:09 +08:00
k88936 d231cc4602 合并 origin/master:保留 3D 契约与 provider checkpoint,旧玩法表随主线退役
- server-rs/crates/shared-contracts/src/lib.rs:采用主线的模块裁剪(删掉 cfg(any()) 遗留模块、补上 agc_analytics 与 game_distribution),同时保留本分支的 editor_canvas、model3d 模块与 EDITOR_GENERATION_OPERATION_KINDS 导出
- server-rs/crates/spacetime-module/src/migration.rs:主线删除的 410 行旧玩法表 normalize 段保持删除,保留本分支的 provider_kind / provider_task_id 兼容段与对应用例
- docs/【开发运维】本地开发验证与生产运维-2026-05-15.md:校验清单同时保留 Tripo 3D 生成任务与 editor_background_music_generation / model3d_text_to_model / model3d_image_to_model
- .gitignore:补回本分支新增的 3D 模型文件忽略规则(*.glb / *.gltf 等 12 行),压测数据段随主线一并删除
- 共享记忆:本分支的 3D 决策与踩坑条目保留在主线重排后的 decision-log.md 与 pitfalls.md 中
2026-09-23 19:39:30 +08:00
k88936 5ee9a1e2e2 共享记忆补记本轮 3D 收口的三条决策与一条踩坑
- decision-log:视图输入显式化并改按文档 view-key 形态发出、派生来源取自请求 source、失败态提交开新一代
- pitfalls:失败态沿用同一尝试代次会让主按钮只是重现同一次失败,以及新增提交入口时的判断口径
2026-09-23 18:59:54 +08:00
k88936 f198b7a6d0 multiview 视图输入显式化为 url / fileToken,线上按文档 view-key 形态发出
- 契约新增 Model3dViewInput(url / fileToken 的 tagged enum),views 的四个视图都改用它,裸字符串在契约层即被拒绝
- platform-tripo 不再走 SDK 的位置数组形态:按 Tripo 文档推荐的 view-key 构造 inputs,值写成显式 {url} / {file_token},种类由契约字段决定、链路上不再猜前缀
- 视图校验(front 必填、至少两张、空白按未提供)与 inputs 构造合并成一条路径,不再两处重复规则
- 新增 4 条定向用例钉住发出的 JSON 形状、空白视图、视图数量与 taskId 复用;契约用例补齐裸字符串与视图内未知字段被拒
- 重新生成 ts-rs 绑定与导出索引,技术方案同步 multiview 输入口径
2026-09-23 18:59:05 +08:00
kdletters ebb288a6a4 统一客户端渠道产品名称
Project CI / AI game creator shell Rust smoke (push) Successful in 1m28s
Project CI / AI game creator shell Rust crates (push) Successful in 59s
Project CI / Backend tests (push) Successful in 4m50s
Project CI / Native shell tests (push) Successful in 5m43s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 7m23s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 8m55s
Project CI / Frontend tests (push) Successful in 2m8s
Project CI / AI game creator shell web tests (push) Failing after 1m52s
Project CI / Repository checks (push) Successful in 2m29s
dev 渠道显示为陶泥儿开发版并保持既有 identifier 与升级链。

将产品名注入 Tauri、原生窗口、前端标题栏和关于页面,统一快捷方式与注册表展示来源。

补充渠道配置门禁、发布脚本测试和渠道身份文档。
2026-09-23 18:53:23 +08:00
k88936 661867c307 Merge pull request '功能:引用输入区支持粘贴解析 @显示名 / $名称' (#473) from feat/smart-paste into master
Project CI / AI game creator shell Rust lane 2/2 (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 lane 1/2 (push) Has been cancelled
Reviewed-on: #473
Reviewed-by: 孔令弘 <ink29535@proton.me>
2026-09-23 18:51:23 +08:00
k88936 5ebc6df6ae 3D 失败态下主按钮也开新一代,不再重现同一次失败
- Model3dGenerationModal 主按钮与「重试」共用失败态重置后的 dialog(refreshModel3dAttemptNonce),失败态点主按钮不再沿用旧幂等键
- 新增用例:失败态主按钮提交的代次必须变化、状态回到 idle,且按钮保持可点
2026-09-23 18:51:15 +08:00
k88936 df6694c4a9 图生 3D 的资源派生来源改为取自请求的 source
- job.rs 新增 Model3dJobRequest::source_resource_id():resource 来源带出画布资源 id,素材库来源与文生 3D 没有可登记的来源资源
- worker.rs 落库时资源行与素材行都改用它:资源行记派生来源,素材行优先指向本项目的资源行、只落素材库时退回请求里的来源资源
- 新增单测钉住三种来源(resource / asset / 文生)的取值,不再拿本次新生成的输出资源 id 冒充来源
2026-09-23 18:51:10 +08:00
k88936 c0e233fe6c Merge remote-tracking branch 'origin/master' into feat/smart-paste
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 smoke (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
2026-09-23 18:50:15 +08:00
k88936 136e1ebceb Remove redundant fuzzy_lookup methods from test ReferenceProviders for cleanup
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 smoke (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
2026-09-23 18:49:07 +08:00
lhk229 c2ec978199 修复宿主继续请求重复发送原始用户输入 (#500)
Project CI / AI game creator shell Rust crates (push) Successful in 1m23s
Project CI / AI game creator shell Rust smoke (push) Successful in 2m0s
Project CI / Backend tests (push) Successful in 4m51s
Project CI / Native shell tests (push) Successful in 5m57s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 8m2s
Project CI / Frontend tests (push) Successful in 2m1s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 9m7s
Project CI / AI game creator shell web tests (push) Successful in 1m20s
Project CI / Repository checks (push) Successful in 1m43s
区分首次用户请求与宿主反馈,继续时发送实际验收或错误信息
固定 GUI 和 CLI 的原始用户条目,保留历史与回合身份关联
补充结构化输入、反馈发送、图片输入和历史去重的定向回归测试
同步更新实施计划与排障记录,保持交付验收条件和预算不变

Reviewed-on: https://git.genarrative.world/git/GenarrativeAI/Genarrative/pulls/500
Co-authored-by: Linghong <ink29535@proton.me>
Co-committed-by: Linghong <ink29535@proton.me>
2026-09-23 18:20:42 +08:00
k88936 6b1114356c 59/60/61/65 按决定不修复,改为在代码里写清取舍
- worker.rs:说明 last_error_message 是落库且前端直接展示的摘要,只取 provider message,不塞内部 reason/taskStatus(#59)
- platform-tripo error.rs:说明 ADR 0001 要求平台层不带出 SDK 错误模型,Io/Serde 只保留文本(#60)
- platform-tripo mapping.rs:说明 Tripo 文档把 generated_image_url 列为 text_to_model 固定字段,按 ADR 0001 失败关闭保留必填(#61)
- platform-tripo image_to_model/client.rs:说明 PublicUrl 只做非空白校验的边界条件与将来接外部地址时的校验位置(#65)
2026-09-23 18:04:29 +08:00
k88936 58c59b750e Merge remote-tracking branch 'origin/master' into feat/smart-paste
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m14s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 56s
Project CI / Backend tests (pull_request) Successful in 4m42s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 8m4s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 8m15s
Project CI / Native shell tests (pull_request) Successful in 6m1s
Project CI / Frontend tests (pull_request) Successful in 2m26s
Project CI / Repository checks (pull_request) Successful in 2m33s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m31s
# Conflicts:
#	docs/project-memory/shared-memory/decision-log.md
2026-09-23 17:52:49 +08:00
k88936 985955205c 把 checkpoint 分支写实为 at-most-once 硬约束而非续跑能力
- worker.rs 模块注释明确 Tripo job 固定 max_attempts = 1,崩溃后租约耗尽直接终态失败、不会被重新 claim,因此不存在续跑路径
- worker.rs 说明 existing_checkpoint 是防御性硬约束,checkpoint 的日常用途是人工对账
- 技术方案与 ADR 把「崩溃后重新 claim 只查询」改写为「不重新 claim,带 checkpoint 的路径绝不二次 submit」
- 实施计划与里程碑同步 checkpoint 语义,不再宣称续跑
2026-09-23 17:50:04 +08:00
k88936 85219ad1d4 提交前先判预算,耗尽时不再发起计费的 submit
- run_model3d_job 在没有 checkpoint 的分支上先走 ensure_submit_budget:
  预算已被解析 / 排队耗光时直接按 provider 超时终态失败,不去白花一次 provider 提交
- 续跑(已有 checkpoint)分支不受影响,仍然只轮询不提交
- 新增用例:预算耗尽必须拒绝提交,仍有预算必须放行
2026-09-23 17:45:22 +08:00
k88936 42b4315b4f 可重试性改为显式判定,不再由 status 缺省推断
- TripoError::Request 增加 retryable 字段:由产生错误的一方按真实分类判定
- 传输层失败按 reqwest 的 is_timeout / is_connect 分类(新增 transport_error_is_transient,
  以及状态集合 http_status_is_transient)
- SDK 的 Error::Request 只在带瞬时状态码、或底层 reqwest 错误确实瞬时时可重试;
  source 为空(空 body / 格式错误 / 缺 data 字段)不再重试
- 产物客户端构造失败标为不可重试;无数据推进、body 读取失败与长度不一致标为可重试
- 新增四组用例:显式标记、状态集合、SDK 分类,以及用真实 reqwest 错误(连接被拒 vs 非法地址)验证分类
- 同步技术方案:写明「可重试性由产生错误处判定」的口径
2026-09-23 17:40:18 +08:00
kdletters 297d7bf1e7 优化 AGC 发布资料与截图交互
Project CI / AI game creator shell Rust crates (push) Successful in 1m24s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m56s
Project CI / Backend tests (push) Successful in 4m39s
Project CI / Native shell tests (push) Successful in 5m49s
Project CI / Frontend tests (push) Successful in 2m1s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 8m29s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 8m31s
Project CI / AI game creator shell web tests (push) Successful in 1m53s
Project CI / Repository checks (push) Successful in 2m25s
发布门禁阻断提示改为独立弹窗且不写入聊天记录
移除发布面板发行包技术摘要
新增免费发布简介与分类建议接口和前端回填
接入封面泥点定价、确认与生成流程
截图改为并行上传,单张失败隔离且不阻断发布
截图操作改为图标,失败项内嵌错误与删除
同步发布合同、实施计划和决策记录
2026-09-23 17:40:08 +08:00
k88936 f6f41f22c3 geometry_quality 预检只拒绝 detailed,standard 按不传处理
- validate_generation_options 对非 v3.1 / v3.0 家族只在取值 detailed 时拒绝,
  与 quad / smart_low_poly / generate_parts「只拒绝启用值」的处理对称
- 新增 wire_geometry_quality:不支持的家族把 standard 收敛成不发(等价于 provider 默认档),
  三个 endpoint 的请求映射都过这一层,避免 provider 因「不支持该字段」整单拒绝
- 新增两组表驱动用例:非 v3 家族 standard 放行 / detailed 拒绝,以及映射层的收敛结果
- 同步技术方案:写明「预检只拒绝启用值」与映射层收敛 standard 的口径
2026-09-23 17:33:51 +08:00
suzmii 64018f9661 Merge pull request '修复 AGC 最近项目「检查失败」被钉死:失败退避重试 + 按轮重查(#490)' (#492) from fix/agc-recent-project-status-retry into master
Project CI / AI game creator shell Rust crates (push) Successful in 1m22s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m50s
Project CI / Backend tests (push) Successful in 3m52s
Project CI / AI game creator shell Rust lane 1/2 (push) Failing after 5m48s
Project CI / Frontend tests (push) Successful in 2m24s
Project CI / Native shell tests (push) Successful in 6m22s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 8m14s
Project CI / Repository checks (push) Successful in 2m32s
Project CI / AI game creator shell web tests (push) Successful in 2m7s
Reviewed-on: #492
Reviewed-by: 孔令弘 <ink29535@proton.me>
2026-09-23 17:30:59 +08:00
suzmii b48953f87c Merge remote-tracking branch 'origin/fix/agc-recent-project-status-retry' into fix/agc-recent-project-status-retry
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m30s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m9s
Project CI / Backend tests (pull_request) Successful in 5m2s
Project CI / Native shell tests (pull_request) Successful in 6m57s
Project CI / Frontend tests (pull_request) Successful in 2m35s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 9m19s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 9m23s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m23s
Project CI / Repository checks (pull_request) Successful in 1m48s
2026-09-23 17:13:23 +08:00
suzmii 924d5d3fd0 Merge remote-tracking branch 'origin/master' into fix/agc-recent-project-status-retry
# Conflicts:
#	docs/project-memory/shared-memory/decision-log.md
2026-09-23 17:10:38 +08:00
lhk229 5bc5328c06 客户端埋点复用已有下载渠道配置 (#496)
Project CI / AI game creator shell Rust crates (push) Successful in 1m18s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m55s
Project CI / Backend tests (push) Successful in 3m42s
Project CI / Frontend tests (push) Successful in 1m44s
Project CI / Native shell tests (push) Successful in 5m37s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 8m24s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 8m30s
Project CI / Repository checks (push) Successful in 2m0s
Project CI / AI game creator shell web tests (push) Successful in 1m31s
删除独立埋点 origin 环境变量及配置字段,按 dev/release 渠道校验官方站点。
本地开发、测试及容器的 dev 渠道允许规范回环地址,兼容可变端口。
同步环境变量示例、技术方案和运维说明,补充渠道隔离与身份校验测试。

Reviewed-on: https://git.genarrative.world/git/GenarrativeAI/Genarrative/pulls/496
2026-09-23 17:03:17 +08:00
k88936 508cf30f5d 共享记忆补记本轮 3D 收口的四条决策
- 产物 content type 不再兜底:白名单外一律按上游内容不合法失败(并作废预览条目里的回落口径)
- 两个改价字段 geometryQuality / textureQuality 允许缺省,按 standard 计价
- provider 客户端构造即校验配置(零超时 / 空白凭据)与产物重试包住整个 body 记录在同一条
2026-09-23 17:02:16 +08:00
k88936 b33a8a141c 3D 产物下载的重试改为覆盖整个响应体
- download_model / download_rendered_image 把「取响应头 + 读完 body」作为一次可重试事务,
  每次尝试都重新取响应头并整体重下,不做断点续传
- body 传输失败与长度不一致归一成可重试的传输错误(不再带 HTTP 200),HTTP 状态只留在文案里
- 新增 TripoArtifactBytes(读完的产物)并公开 download_model / download_rendered_image 的 max_bytes 上限;
  超限按 OutputSchema 失败且不重试,流式句柄 TripoDownloadedArtifact 收回 crate 内部
- api-server 的 read_artifact 改成对完整产物做落库前校验(只判空),体积上限转由调用方传入
- smoke 示例改为一次写入完整字节;新增「body 中途断开后整体重下成功」与「超限不重试」两个用例
- 同步技术方案与实施计划:把「只重试响应头」的描述改成「重试包住整个 body」
2026-09-23 17:01:40 +08:00
suzmii e6ed3cae2c Merge remote-tracking branch 'origin/master' into fix/agc-recent-project-status-retry
# Conflicts:
#	docs/project-memory/shared-memory/decision-log.md
2026-09-23 16:54:56 +08:00
kdletters e072c66ce9 修复 AGC 模板库筛选与卡片状态的表现缺陷
Project CI / AI game creator shell Rust lane 1/2 (push) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (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 Rust crates (push) Has been cancelled
Project CI / AI game creator shell web tests (push) Has been cancelled
Project CI / AI game creator shell Rust smoke (push) Has been cancelled
- 模板库筛选区改用共享筛选条与标签 chip:选中为实心品牌填充 + 反白文字,未选为浅底描边
- 未选中悬停不再借用品牌色(品牌色专属已选中),状态阶梯固定为静止 / 悬停 / 按下 / 选中
- 新增 getPlatformCategoryChipClassName 收敛筛选 chip 类名口径,模板库、资源画布、参考图弹窗与平台 Web 端共用
- PlatformSegmentedTabs 增加 accent 选中口径,与筛选 chip 共用 --platform-chip-* 语义色
- 修复卡片文字区按 grid auto 行排版导致的标题 / 简介 / 标签被裁:行高契约拆为分项常量,文字区固定 174
- 修复忙状态下动作行塞入第三个元素导致的按钮文案换行顶出卡片:忙状态写在触发它的按钮上
- 修复经典滚动条占宽导致的卡片区横向滚动条:按竖滚动条预留列宽后再算列宽行高
- 焦点环由 15% 透明度改为实心色并用 outline 绘制,选中项聚焦不再被状态投影盖掉
- 封面加载失败改为隐藏图片留中性底色,不再出现浏览器裂图图标
- 补充状态对比度、行高契约、滚动条预留、封面兜底与忙状态文案的回归测试
- 同步技术方案、踩坑记录与决策记录的口径
2026-09-23 16:51:15 +08:00
k88936 347d066fc5 3D 允许 projectId 为空的文档与共享记忆同步
- 实施计划(API 契约):交付验收补上「只给 assetFolderId 合法」这一条。
- 里程碑(API 契约):落点口径写成「两个都给合法、只给 assetFolderId(无画布工程)同样合法」。
- 实施计划(前端入口):发送门禁改成「两个落点至少给一个」,projectId 可空、缺失时不发该字段,没有工程时结果只落素材库。
- 共享记忆 decision-log:在 G5 条目的「代价与取舍」里把「3D 仍要求 projectId」改成「同日按用户决定改为与其它工具一致」,并追加一条收尾说明(门禁常量改名、canvasCompletion 只随 projectId 下发、无工程时的读回边界)。
- 验证:node scripts/check-doc-index.mjs(221 份 Markdown 通过)、npm run check:encoding、git diff --check 通过。
2026-09-23 16:42:15 +08:00
suzmii 5bdf25cfd7 评审收口:提权类失败不再重试、重命名路径复用重试、退避预算绑定失败集合
- useRecentProjects:区分可重试失败与提权/权限类失败,后者不再就地重试、也不驱动整表重查,避免自己驱动 UAC 反复弹窗
- useRecentProjects:提权类失败的项目在用户主动打开/新建项目或重命名刷新前跳过检查
- useRecentProjects:退避重查预算绑定到失败集合,集合变化或整轮无失败即重置,长期坏目录不再吃满额度
- useRecentProjects:重命名后的单条刷新复用同一套就地重试与有界重查
- app/tauri:删除重复的 TauriInvoke 类型,统一引用 app/types 的既有定义
- tests/recentProjectsHook:失败不跨轮保留改为断言在途「检查中」,新增提权类失败不重试用例
- docs:decision-log、pitfalls、生命周期方案与异步闭环方案同步失败自愈口径与提权边界
2026-09-23 16:41:10 +08:00
k88936 a4132616d8 3D 产物 content type 只认字节或槽位白名单,去掉兜底
- 删除 fallback_extension 与「未知声明原样放行 + 扩展名兜底」的归一逻辑
- 槽位白名单收敛为唯一映射表(content type ↔ 对象键扩展名),跨槽位类型返回 None
- resolve_artifact_content_type 改为返回 Result:字节认不出且声明不在白名单时按 502 失败,
  不再把 text/plain 之类的声明连同拼出来的 .glb 扩展名落进 OSS 与 asset_object
- 错误体只回显截断到 64 字符的声明值,避免把任意长度的 provider 文本带进响应
- 重写 storage 测试:新增白名单外声明、跨槽位类型与字节认不出三类用例
- 同步技术方案:说明白名单范围与「不做任何兜底」的口径
2026-09-23 16:39:15 +08:00
k88936 e8d987c207 Merge pull request 'refactor/收口退役AGC项目对话斜杠命令与终端swarm chat入口' (#488) from fix/clean-history-cmd into master
Project CI / AI game creator shell Rust crates (push) Successful in 1m21s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m43s
Project CI / Backend tests (push) Successful in 3m47s
Project CI / Frontend tests (push) Successful in 2m23s
Project CI / Native shell tests (push) Successful in 6m14s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 8m13s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 9m19s
Project CI / Repository checks (push) Successful in 2m9s
Project CI / AI game creator shell web tests (push) Successful in 1m45s
Reviewed-on: #488
2026-09-23 16:34:03 +08:00
k88936 6a7cf294a0 3D 生成请求允许缺省 textureQuality 并按 standard 计价
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
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
- PricingParamView::validate 不再要求 texture=true 时显式给出 textureQuality,缺省按 standard 计价
- 只有显式 detailed / extreme 才命中 hdTexture / ultraTexture 加价,缺省不改变报价
- v2.5 拒绝任何显式 texture_quality,必填规则会让 H25 + texture=true 永远不可达
- texture=false 仍禁止出现贴图档位,原有冲突校验与用例保持不变
- 同步技术方案:说明 geometryQuality / textureQuality 两个字段允许缺省的共同理由
2026-09-23 16:30:22 +08:00
k88936 427b9f19a1 3D 生成请求允许缺省 geometryQuality 并按 standard 计价
- PricingParamView::validate 去掉 geometryQuality 必填,缺省按 standard 计入定价
- 只有显式 detailed 才命中 hdGeometry 加价,缺省不会改变报价
- 新增缺省几何质量的定价用例(v3.1 与 v2.5 两条路径),并把它从必填字段用例里移除
- 同步技术方案:说明该字段允许缺省的原因,v2.5 / P1 / P2 因 provider 不支持该参数而必须允许缺省
2026-09-23 16:24:18 +08:00
suzmii cfd41b5a0d Merge remote-tracking branch 'origin/master' into fix/agc-recent-project-status-retry 2026-09-23 16:24:13 +08:00
kdletters f426944701 调整 AGC 更新弹窗并停止自动生成更新日志
Project CI / AI game creator shell Rust crates (push) Successful in 1m18s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m46s
Project CI / Backend tests (push) Successful in 3m36s
Project CI / Frontend tests (push) Successful in 1m43s
Project CI / Native shell tests (push) Successful in 5m40s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 7m35s
Project CI / Repository checks (push) Successful in 1m50s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 8m31s
Project CI / AI game creator shell web tests (push) Successful in 1m16s
- 更新弹窗改为窗口居中纵向排版

- 停止自动生成渠道清单更新摘要

- 仅保留 AGC_UPDATE_RELEASE_NOTES 手动更新说明

- 清理 Jenkins 摘要锚点与 macOS 额外拉取 master 逻辑

- 同步开发运维、技术方案和回归测试
2026-09-23 16:18:04 +08:00
k88936 ffee739774 platform-tripo 构造配置时拒绝零超时与空白凭据
- TripoSettings::new 改为返回 Result:request_timeout 必须大于零,api_key / base_url 不能是空白
- 新增 TripoSettings::validate 与 TripoError::Configuration,字段是公开的,因此 TripoProviderClient::new 在使用前再校验一次
- 拒绝零超时的理由是同一个值存在两种语义:tokio::time::timeout 立即超时,reqwest 却当成不超时
- api-server 构造入口把构造失败按既有 503 口径映射,并补全 TripoError 的匹配分支
- smoke 示例与 platform-tripo 测试跟进新的构造签名,新增零超时 / 空白凭据用例
2026-09-23 16:16:27 +08:00
k88936 825dde6602 3D 落点与结果引用对齐其它生成工具的文档同步
- 技术方案:落点改为「至少一个、两个可同给」,补上归一在预检之前完成并写回请求(预检值 = 队列载荷 = 落库值);完成结果读取补上双落点与平坦引用的说明。
- 技术方案素材库一节改为「素材库行已接 model3d 分支(预览图渲染 + 拖入画布)」,后台 renderer / 精选 read model / 公开 grant 仍未接。
- 里程碑与实施计划(API 契约、前端入口、结果前端预览)同步新口径:两个落点同给合法、前端同时发 projectId + assetFolderId + assetLabel、素材库行已进入。
- 共享记忆 decision-log 追加本次决策(原因、代价、影响面、验证方式),并在旧的「二选一」条目上标注 2026-09-23 追加修正。
- 验证:node scripts/check-doc-index.mjs(221 份 Markdown 通过)、npm run check:encoding、git diff --check 通过。
2026-09-23 15:55:02 +08:00
k88936 a753ac4cd8 3D 前端提交跟随其它画布生成工具同时落素材库
- buildModel3dSubmissionPlan 接收当前素材夹与素材名,与图片/图标/音效等工具一样同时发 projectId + assetFolderId + assetLabel(素材名缺省回落本次结果标题),没有素材夹时只发 projectId。
- useModel3dGenerationTask 新增 assetFolderId 入参,画布生成链路把当前素材夹透传下来;结果仍走既有画布路径读回,刷新素材库沿用 applyGeneratedProjectSnapshot 的既有行为,不新增 3D 专用刷新。
- 素材库行加 model3d 分支:缩略图按预览图(asset.src)渲染,objectKey(模型本体 .glb)不参与图片签名,与画布 3D 卡片的 objectKey={null} 口径一致,避免素材行去加载模型文件。
- 用例补齐:请求体同时带两个落点、无素材夹时不带 assetFolderId/assetLabel、素材夹只 trim 且素材名回落标题,以及素材行 3D 预览不签模型对象键 / 普通图片仍按 objectKey 换签名地址。
- 验证:npx vitest run src/components/image-editor/model3d-generation src/components/image-editor/ImageCanvasAssetRowView.test.tsx(67 passed)、npm run typecheck、check:encoding / git diff --check 通过。
2026-09-23 15:54:39 +08:00
k88936 158f9b741d 3D 落点放宽为「至少一个」并把结果引用改成平坦字段
- 校验层不再要求「projectId 与 assetFolderId 恰好一个」:两个都不给 400 点名 projectId,canvasCompletion 与「没有 projectId」同现 400 点名 canvasCompletion,两个都给按合法处理;与其它画布生成工具同一口径。
- 落点预检改成对给出的每个落点逐个定点查,出错字段只在「只给一个」时点名该键,两个都给无法归因回落到 target;去掉已经没有意义的旧用法注释。
- 结果侧 Model3dGenerationTargetRef 从 tagged enum(kind=projectResource/assetLibrary)改成与请求落点同形的平坦可选字段 resourceId / assetId,两个落点都写就两个都带;生成绑定同步变宽。
- worker 的 target_ref 改为按「写了哪条落点行」分别带 ID,完成结果用例改成断言平坦字段且只落项目资源时不得凭空出现 assetId;契约测试对称覆盖「只落素材库」形态。
- 验证:cargo test -p api-server tripo3d::(56 passed)、cargo test -p shared-contracts、npm run contracts:model3d:generate、check:rustfmt / check:encoding / git diff --check 通过。
2026-09-23 15:54:07 +08:00
k88936 ede6efbe73 Merge remote-tracking branch 'origin/master' into fix/clean-history-cmd
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m23s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m51s
Project CI / Backend tests (pull_request) Successful in 3m38s
Project CI / Frontend tests (pull_request) Successful in 1m55s
Project CI / Native shell tests (pull_request) Successful in 5m38s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 8m16s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 8m28s
Project CI / Repository checks (pull_request) Successful in 1m47s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m17s
# Conflicts:
#	docs/project-memory/shared-memory/decision-log.md
#	docs/technical/【技术方案】AI游戏创作智能体App实施计划-2026-06-24.md
2026-09-23 15:32:47 +08:00
k88936 c64bfc3867 3D 预览产物 content type 改为按字节识别
- storage.rs 新增 sniff_preview_content_type(PNG / JPEG / WebP),resolve_artifact_content_type 改为按槽位判定:预览与模型一样先嗅探字节,嗅不出才回落声明值(最终仍回落 image/webp)
- 修掉 provider / CDN 不写或写错 Content-Type 时 PNG 预览被写成 image/webp 并传播到 OSS metadata、asset_object.content_type 与生成结果的问题;对象键扩展名随之正确
- 定向用例重写为「字节优先 / 未知回落」两组,替换原先钉住「预览不嗅探」的用例
- 技术方案与决策记录同步该口径,并记录与其它图片链路(bgfilter / VectorEngine / 生成图落 OSS 适配器)的一致性对照
2026-09-23 15:28:23 +08:00
lhk229 a1dd382489 Merge branch 'master' into fix/agc-recent-project-status-retry
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m15s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m22s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Failing after 4m35s
Project CI / Backend tests (pull_request) Successful in 3m56s
Project CI / Frontend tests (pull_request) Successful in 1m41s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 8m40s
Project CI / Native shell tests (pull_request) Successful in 6m17s
Project CI / Repository checks (pull_request) Successful in 2m28s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m57s
2026-09-23 15:22:32 +08:00
k88936 1fa413a352 图生 3D 图片输入的失败语义同步到文档
- 实施计划写明预检失败的状态码口径:400 只覆盖跨 owner / 未登记 / 已删除 / kind 不符,403 / 409 / 5xx 保留原状态码,缺对象键 502
- 决策记录新增同日条目,说明收窄收敛范围与缺对象键改判 502 的原因、代价与验证方式
2026-09-23 14:59:52 +08:00
k88936 11d1324857 3D 图生输入解析的测试改为断言可观察行为
- 删掉 include_str! 嵌源码、按 token 断言「没出现列工程 / 列素材库」的守卫:它测的是实现文本,改名、换格式、调顺序都会误伤
- 定点查询用例改成覆盖 resource / asset 两个分支,断言每个分支只发起一次按 ID 的查询、且对象键原样来自记录
- 模块文档写明定点查询由注入签名收口(一个 ID → 一条记录),失败语义与测试口径一并写实
2026-09-23 14:58:44 +08:00
kdletters 016356e509 合并 AGC 发布前原型门禁与进度弹窗
Project CI / AI game creator shell Rust crates (push) Successful in 1m25s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m56s
Project CI / Backend tests (push) Successful in 3m54s
Project CI / Frontend tests (push) Successful in 1m54s
Project CI / Native shell tests (push) Successful in 5m55s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 7m56s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 8m58s
Project CI / Repository checks (push) Successful in 1m53s
Project CI / AI game creator shell web tests (push) Successful in 1m18s
合并 codex/agc-publish-prototype-gate
2026-09-23 14:55:45 +08:00
k88936 1be77d2f99 3D 图生输入解析只收敛「引用不可用」状态码
- resolve_source_object_key_with 的 4xx 收敛从 is_client_error() 收窄为 400 / 404,不再把 403 服务身份校验失败与 409 并发冲突也说成「图片必须是已登记资源」
- 与模块注释「只有基础设施失败保留原状态码」的实际口径统一,403 / 409 / 5xx 一律按原状态码上报
- 定向用例改名 image_source_resolution_only_collapses_unavailable_references,覆盖 400 / 404 收敛与 403 / 409 / 500 保留
2026-09-23 14:51:09 +08:00
k88936 8a8c00fbb6 3D 图生输入解析把「缺对象键」改判为服务端问题
- resolve_source_object_key_with 在记录已解析但缺对象键时返回 502 与 model3d-image-source-object-key-missing,不再复用「引用不可用」的 400
- 未登记 / 跨 owner / 已删除仍收敛成同一句 400;缺对象键口径与 editor_project::validate_editor_reference_id_for_owner 的 BAD_GATEWAY 对齐
- 定向用例改名为 image_source_resolution_reports_missing_object_key_as_server_side_failure,断言状态码与 reason
2026-09-23 14:49:18 +08:00
kdletters 8dc0da4608 完善 AGC 发布前原型门禁与进度弹窗
发布前校验可运行原型,未完成时禁止触发用户项目构建

缺失发布说明时自动生成 exports/README.md

移除发布流程的聊天确认卡,新增全屏发布进度弹窗

补充前后端回归测试与项目决策文档
2026-09-23 14:47:43 +08:00
suzmii 7157a90d31 合并 master(含 #494):AGC 提示词断言同步改采 master 版本
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m22s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m52s
Project CI / Backend tests (pull_request) Successful in 3m54s
Project CI / Frontend tests (pull_request) Successful in 1m55s
Project CI / Native shell tests (pull_request) Successful in 5m58s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 8m13s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 8m47s
Project CI / Repository checks (pull_request) Successful in 2m1s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m26s
- 合并 origin/master(6b4c6b8a6 修复策划 Agent 提示词契约误删 #494)
- Rust 断言同步与本分支 25d331ca0 重复,冲突按 master 版本解决(#494 用「请求含该 run 任务文本」替代 run_id 断言)
- 保留本分支独有改动:最近项目检查失败退避重试、TauriInvoke 命名类型、admin-web 409 聚焦断言等待
- 丢弃本地 cargo 运行重新生成的 chat/generated/*.ts,按 master 版本还原
2026-09-23 14:46:39 +08:00
k88936 9edb4e5f80 3D 提交侧归一落点并删掉 Standard 顶层 result 透传
- 提交侧新增归一并写回请求:项目 ID 只 trim,素材夹 ID 走其它工具同一套 normalize_generated_asset_folder_id(project / 旧 folder-* 收敛到 owner 默认素材夹),素材名走 resolve_editor_generated_asset_label(trim、截断到上限、缺省「3D 模型」),保证预检值 = 队列载荷 = 落库值。
- 队列行 sourceEntityId 改用共用 editor_generation_source_entity_id(项目 ID,缺项目回落 job kind),不再拿素材夹 ID 顶替。
- 按你的决定删掉 Standard 消费者顶层 result 逐字透传:标准消费者只回来源身份,3D 结果与图片等画布任务一样靠画布 placement / 素材行读回,连带删掉「3D 生成没有画布读回路径」这条错注释。
- 技术方案与共享记忆同步落点归一、身份口径与结果读取路径;job.rs 补归一用例(含素材名截断)。
- 验证:cargo test -p api-server(1193 passed)、cargo test -p api-server tripo3d::(55 passed)、npx vitest run src/components/image-editor/model3d-generation src/components/image-editor/model3d-preview(63 passed)、check:rustfmt / check:encoding / check-doc-index / git diff --check 通过。
2026-09-23 14:36:50 +08:00
lhk229 6b4c6b8a63 修复策划 Agent 提示词契约误删 (#494)
Project CI / AI game creator shell Rust crates (push) Successful in 1m26s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m55s
Project CI / AI game creator shell Rust lane 2/2 (push) Failing after 5m15s
Project CI / Backend tests (push) Successful in 3m53s
Project CI / Frontend tests (push) Successful in 2m4s
Project CI / Repository checks (push) Successful in 2m16s
Project CI / Native shell tests (push) Successful in 6m15s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 8m33s
Project CI / AI game creator shell web tests (push) Successful in 1m34s
恢复策划产物路径及模板、示例资源定位。
恢复决定台账 D-xx 编号与跨文档引用。
恢复验收及 Skill 标识和阶段审批成功条件。
保留战斗系统示例非必读约定。

Reviewed-on: https://git.genarrative.world/git/GenarrativeAI/Genarrative/pulls/494
Co-authored-by: Linghong <ink29535@proton.me>
Co-committed-by: Linghong <ink29535@proton.me>
2026-09-23 14:25:02 +08:00
k88936 ce70171b43 修正AGC退役后遗留的 prompt 源文件门禁与本地 Provider 冒烟断言
- prompt_source_boundaries.rs 移除已删除的 src/agent/interaction.rs 条目(否则读源文件直接 NotFound)
- smoke-agent-run-local-provider.mjs 删除已退役的画板回流建议断言,对应被删的 suggested_canvas_tool_call
2026-09-23 14:23:02 +08:00
k88936 21b9d850c7 3D 落点契约文档同步为平坦可选字段
- 技术方案的请求契约段改成平坦可选 projectId / canvasCompletion / assetFolderId / assetLabel,并把「二选一 + 同现拒绝」的口径与落点预检路径写清。
- 里程碑与实施计划把 tagged enum 的表述改成平坦字段与二选一验收口径。
- 前端入口与 Worker 计划的落点表述去掉 target 分支写法,改为只发 projectId / 素材库落点产出 assetId。
- 决策记录补一条:撤销请求侧 tagged enum、复用统一定点预检、素材名缺省回落默认名,并记下未做的目录归一与原因。
2026-09-23 14:03:13 +08:00
k88936 f659ddfcf0 3D 生成前端提交体跟随平坦落点契约
- buildModel3dSubmissionPlan 不再拼 tagged target,把 projectId 与 canvasCompletion 直接摊进请求体;画布链路仍只落项目资源。
- submitModel3dGenerationRequest 的提交体注释同步落点字段改名。
- 请求体、幂等键与排队用例改为断言扁平落点字段。
- 定向验证:npx vitest run src/components/image-editor/model3d-generation src/components/image-editor/model3d-preview(63 passed)、npm run typecheck 通过。
2026-09-23 14:02:57 +08:00
k88936 fd48829c24 3D 生成请求落点改为平坦可选字段并复用统一落点预检
- shared-contracts 的 text-to-model / image-to-model 请求用平坦可选 projectId / canvasCompletion / assetFolderId / assetLabel 取代 tagged enum target,删除 Model3dGenerationTarget 及其契约测试。
- 同步 ts-rs 生成绑定:新增四个可选字段并移除 Model3dGenerationTarget.ts 与 barrel 导出。
- api-server 校验层改按「项目资源 / 素材库二选一」校验,缺失、冲突与空白值都返回 400 并点名具体字段。
- 落点预检改用其它付费编辑器生成共用的 preflight_editor_generation_target_and_return,素材库落点不再读整库。
- worker 按平坦字段落库,素材名缺省回落到 MODEL3D_DEFAULT_ASSET_LABEL。
- 定向验证:cargo test -p shared-contracts 与 cargo test -p api-server tripo3d:: 全绿(54 passed)。
2026-09-23 14:02:44 +08:00
suzmii 25d331ca0a 同步 #491 漏改的提示词断言,修 master 上两条 AGC Rust lane 的 CI 红
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m20s
Project CI / Backend tests (pull_request) Failing after 12s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m6s
Project CI / Frontend tests (pull_request) Successful in 2m3s
Project CI / Repository checks (pull_request) Failing after 12s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m23s
Project CI / Native shell tests (pull_request) Successful in 5m45s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 8m8s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 8m52s
- tests/provider:工具计划与修复请求的 run_id 断言反转为「不得携带」(#491 已把 runId 移出提示词)
- tests/response_stream:4 个 finalization/replan 用例同步 run_id 与 session_id 断言(同一 run 改由 runtime/DB 断言承担)
- tests/project_tools:删除确认后的重规划请求同样反转为「不得携带 run_id」
- admin-web:AGC 模板 409 写入错误用例把聚焦断言套进 waitFor,消除 CI 抢跑 flake
2026-09-23 13:28:17 +08:00
k88936 fc39080f27 Merge remote-tracking branch 'origin/master' into fix/clean-history-cmd
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Failing after 1m31s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m8s
Project CI / AI game creator shell Rust smoke (pull_request) Failing after 1m25s
Project CI / Frontend tests (pull_request) Successful in 2m17s
Project CI / Backend tests (pull_request) Successful in 3m56s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Failing after 4m58s
Project CI / Repository checks (pull_request) Successful in 2m3s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m33s
Project CI / Native shell tests (pull_request) Successful in 5m54s
# Conflicts:
#	CONTEXT.md
#	apps/ai-game-creator-shell/scripts/check-config.mjs
#	apps/ai-game-creator-shell/src/App.tsx
#	apps/ai-game-creator-shell/src/view/project-development/chat/controller/useDirectProjectChatController.ts
#	docs/README.md
#	docs/project-memory/shared-memory/decision-log.md
2026-09-23 13:27:52 +08:00
k88936 cba98be35f Merge remote-tracking branch 'origin/master' into feat/smart-paste
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m23s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m57s
Project CI / Backend tests (pull_request) Successful in 4m32s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Failing after 6m44s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Failing after 8m24s
Project CI / Frontend tests (pull_request) Successful in 2m37s
Project CI / Native shell tests (pull_request) Successful in 6m49s
Project CI / Repository checks (pull_request) Successful in 2m50s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m52s
2026-09-23 13:23:10 +08:00
k88936 28a6fd97f8 修复:润色回写与粘贴共用同一条落点兜底,认不出的引用落文本而不是消失
ResourceReferenceInput 新增 mentionTokenOrText:provider 的 mentionToken,答不出来(契约被破坏)时退 contentPartText 的通用文本形态;粘贴插入、润色回写的候选扫描、整根替换的落点共用这一条
润色回写的候选不再跳过「答不出 token 的 part」:这类 part 在回包里没被提到时作为末尾孤儿补回来,而不是在翻译阶段直接消失
applyContentToRoot(初始草稿与润色回写共用)解析不出引用时落文本,不再是整条吃掉
新增两处输入区用例:provider 只答得出引用答不出 token 时润色回写仍保住引用;初始草稿里已解析不出的引用落成 @resourceId 文本。两处去掉兜底即变红
同步 AGC 聊天素材引用功能说明、引用粘贴解析实施计划与决策记录(落点兜底一条,含初始草稿行为变化的记录)
2026-09-23 13:11:17 +08:00
k88936 f138f648e7 修复:粘贴插入解析不出引用时落下文本形态,不再什么都不插
resourceReferences.ts 抽出 contentPartToken:part → 正文 token 的逐字投影,不补白、不裁剪(补白只在 joinMentionText 拼整段文本时加);directCodexContentToPromptText 与新导出 contentPartText 都走这一份
contentPartText 就是单个非文本 part 的文本形态:资源落 @resourceId、Skill 落 $名称、附件落 @附件名、运行区域落 @标签,文本 part 返回 null
$insertContentAtSelection 的兜底链改成 provider 的 mentionToken 之外再接 contentPartText,解析不出引用也一定有一段正常文本落到光标处,删掉「两条都答不出来就什么都不插」这条违背「粘贴内容逐字保留」的分支
新增单测覆盖四类 part 的文本形态与文本 part 返回 null;新增输入区集成用例(provider 的 toReference 与 mentionToken 都答不出来时粘贴仍按 @resourceId 落下),去掉兜底即变红
同步 AGC 聊天素材引用功能说明的粘贴解析小节,并在实施计划补记本轮评审的收口
2026-09-23 13:06:43 +08:00
kdletters 97bb0673bf 合并 修复 AGC 发布入口在 DirectProject 下的反馈与确认
Project CI / AI game creator shell Rust crates (push) Successful in 1m24s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m53s
Project CI / Backend tests (push) Successful in 4m13s
Project CI / AI game creator shell Rust lane 1/2 (push) Failing after 6m31s
Project CI / Frontend tests (push) Successful in 2m39s
Project CI / AI game creator shell Rust lane 2/2 (push) Failing after 8m55s
Project CI / Native shell tests (push) Successful in 7m2s
Project CI / Repository checks (push) Successful in 2m35s
Project CI / AI game creator shell web tests (push) Successful in 1m28s
- 发布动作即时回显权限检查与构建打包状态
- DirectProject 对话渲染项目权限确认卡片并回传确认与取消
- 权限拒绝、取消和查询失败统一回显到项目对话
- 新增发布反馈回归用例并记录排障口径
2026-09-23 13:01:45 +08:00
kdletters ba45ca7048 修复 AGC 发布入口在 DirectProject 下的反馈与确认
- 发布动作即时回显权限检查与构建打包状态
- DirectProject 对话渲染项目权限确认卡片并回传确认与取消
- 权限拒绝、取消和查询失败统一回显到项目对话
- 新增发布反馈回归用例并记录排障口径
2026-09-23 12:59:17 +08:00
suzmii ceb6418877 Merge branch 'master' into fix/agc-recent-project-status-retry
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m22s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m51s
Project CI / Backend tests (pull_request) Successful in 3m40s
Project CI / Frontend tests (pull_request) Failing after 45s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Failing after 6m23s
Project CI / Native shell tests (pull_request) Successful in 5m57s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Failing after 7m57s
Project CI / Repository checks (pull_request) Successful in 2m16s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m42s
2026-09-23 12:53:17 +08:00
suzmii 04b738755f 修复 AGC 最近项目「检查失败」被钉死:失败退避重试 + 按轮重查
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m20s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 57s
Project CI / Backend tests (pull_request) Failing after 19s
Project CI / Frontend tests (pull_request) Successful in 2m3s
Project CI / Repository checks (pull_request) Failing after 14s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m20s
Project CI / Native shell tests (pull_request) Successful in 5m31s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 7m28s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 8m11s
- useRecentProjects:单次目录检查失败先就地重试一次(300ms),不再立刻落成失败状态
- useRecentProjects:增量投影只保留成功结果,上一轮的失败项回到「检查中」并重新检查
- useRecentProjects:一轮结束仍有失败行时按 15s/45s/120s 退避重跑整张列表,连续无失败即清零
- app/tauri:导出命名类型 TauriInvoke,替换 3 处 ReturnType<typeof resolveTauriInvoke> 写法
- tests/recentProjectsHook:新增「单次失败会重试」「刷新时重查失败项」两个用例
- tests/appSurface/home.suite:失败状态改为异步等待(重试后才会落成)
2026-09-23 12:38:04 +08:00
k88936 d019e48f58 删除AGC steer 判定链相关前端类型、prompt 键与门禁条目
- 删除前端 AgentRuntimeSteerResult 类型
- 删除 interaction.json 中只服务该判定链的 steer_decision_description / steer_decision_system / steer_decision_user 提示词键
- 移除 check-config.mjs 未调用 Tauri 命令允许清单里的 steer_game_creator_agent_runtime_task
2026-09-23 12:36:11 +08:00
k88936 ba9832a287 删除AGC无调用方的 steer Tauri 命令与 LLM steer 判定链
- 删除 Tauri 命令 steer_game_creator_agent_runtime_task,并同步 main.rs invoke_handler 注册与 AgentRuntimeSteerResult 的 assistantReply / interruptDecision / decisionReason 字段
- 删除只服务该命令的 agent/interaction.rs 整层(runtime_steer_decision 工具、判定请求构建与响应解析、decide_game_creator_agent_runtime_steer_at)及其 agent.rs 模块挂载
- 删除 runtime.interrupt_for_steer_decision RPC 与 Runner 客户端/派发分支、持久 decision 记录 agent.runtime.steer_decision、AgentRuntimeProviderInterrupt::applied_steer_cursor 及 register 的 cursor 参数
- 删除只测该链条的 provider / runner / runtime_state 用例
2026-09-23 12:35:44 +08:00
k88936 857acd4190 文档:记录退役收尾删除AGC LLM steer 判定链
- ADR 与里程碑的复查收尾改为「steer 命令删除后整条 LLM 判定链一并退役」,去掉“单独评估”的过渡口径
- Runtime V1.1 的 V1.53 与主实施计划的 2026-08-10 节新增 2026-09-23 复查收尾说明,标明判定链已删除、现役只保留 runtime.steer 唤醒
- decision-log 的 2026-08-10 条目补更新说明,并从已知失败基线用例里移除已删除的 runtime_interrupt_for_true_steer_decision_only_interrupts_older_provider_cursor
- pitfalls 的「Supervisor steer 不能只有内部排队事件」标注判定链实现已删除
- 里程碑验证段补充本轮 cargo check / typecheck / 编码与文档索引 / 幂等检索的实测结果
2026-09-23 12:35:08 +08:00
kdletters f789db7f2f 收敛 AGC 外置智能体提示词,去掉客户端与宿主实现细节 (#491)
Project CI / AI game creator shell Rust smoke (push) Successful in 1m33s
Project CI / AI game creator shell Rust crates (push) Successful in 59s
Project CI / AI game creator shell Rust lane 1/2 (push) Failing after 6m23s
Project CI / Backend tests (push) Successful in 4m52s
Project CI / AI game creator shell Rust lane 2/2 (push) Failing after 8m6s
Project CI / Frontend tests (push) Successful in 2m25s
Project CI / Native shell tests (push) Successful in 6m28s
Project CI / Repository checks (push) Successful in 2m37s
Project CI / AI game creator shell web tests (push) Successful in 1m57s
## 背景
AGC 外置智能体提示词里暴露了过多客户端/宿主实现细节。本次按「提示词只写模型必须遵守的指令与契约」的边界做收敛:删掉"我们系统怎么实现"的叙述,保留模型真正要执行的契约。

## 改动
- `prompts/runtime`:删除宿主机制叙述(交付合同冻结与自动关闭、manifest 幂等投影、回执认领与 continuation 派生、浏览器证据回灌、Runtime 自动推进阶段)
- 删除内部技术栈与部署细节(bubblewrap/Chromium profile 沙箱、执行器锁与 stage ledger、DLL/gdextension 分发、Chromium loopback 预览)
- 删除内部预算与字段(`validation.maxRuns`、共用客户端持久预算、preMutationLoopLimit、源码字符上限、错误反馈重试计数)
- 删除内部标识与名词(Runtime 元数据 `instanceId/sessionId/runId/executionMode/contextBoundary`、`DirectProject`/`workspaceMode`、`autonomous-game-build`、Run Profile、manifest DAG)
- `resources/agc-skills`:8 个 skill 的客户端职责/状态枚举叙述收敛,skill pack 版本与内容哈希同步
- `design-agent`:系统提示、阶段上下文、模板与示例中的渲染器、内部落盘路径、登记编号与平台实现措辞收敛
- 保留不动:工具名与参数、回执字段与枚举、调用顺序、禁止项、失败与鉴权处理、产物要求
- 约定写入 `docs/project-memory/shared-memory/team-conventions.md`:提示词不写宿主实现细节;改占位符须同步 Rust 调用点与断言

## 验证
- `cargo check --offline --tests`:通过
- `cargo test … prompt`:76 passed;`design`:60 passed;`autonomous_game_build`:29 passed;`tool_planning`:10 passed
- `npm run check:encoding`、`npm run check:rustfmt`、`node scripts/check-skill-pack.mjs`、`git diff --check`:均通过
- 本机既有环境失败(非本次引入,已在未改动 HEAD 上用 stash 复现):mock provider 相关的 runtime_actions 用例、isolated-registry 进程会话用例

Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/491
Co-authored-by: kdletters <kdletters@qq.com>
Co-committed-by: kdletters <kdletters@qq.com>
2026-09-23 12:31:20 +08:00
k88936 48ba8b3133 3D 结果序列化失败不再落「完成但 result 为空」的终态
- job_result_payload 改为返回 Result,失败按 500 上报服务端问题,去掉 result:null 兜底形状
- worker 持久化前用 ? 把失败交给既有失败链路:任务按失败终态处理并冲正扣费
- worker 测试夹具同步改为 expect,断言完成结果可序列化
2026-09-23 12:15:02 +08:00
k88936 83913785ae 补齐 Tripo 3D 错误映射的剩余分支测试
- 增补 SDK 参数错误、无状态码 Api、Api 5xx、Sdk 兜底与传输错误的 502 用例,断言只回固定文案、不回显上游报文与 task id
- 增补 map_request_error 的字段口径用例:平台字段路径、provider 字段名与字段未知时不写 field
- 增补 map_pricing_error / map_pricing_store_error / oss_unavailable 的状态码、provider 与 reason 断言
2026-09-23 12:12:26 +08:00
k88936 10f2f05437 文档:同步收尾清理里已删除的 Tauri 后台任务命令
- ADR 与里程碑的收尾清理段区分已删除的 start_game_creator_agent_runtime_task 与待处置的 steer 命令
2026-09-23 12:11:00 +08:00
k88936 271b7172bd 删除AGC无调用方的 Tauri 后台任务命令并清理门禁注释
- 删除 commands.rs 的 start_game_creator_agent_runtime_task(前端无调用方,内部实现与 CLI 入口保持不变)
- main.rs invoke_handler 同步移除该命令注册
- check-config.mjs 的 native-only allowlist 同步移除该条目
- check-config.mjs allowlist 注释去掉「终端 swarm CLI 也已退役」的墓碑式表述
2026-09-23 12:08:09 +08:00
k88936 5b2318acf3 删除AGC退役后零引用的真实E2E harness 导出与函数
- runtime-state.mjs 删除只被已删套件使用的 4 个 schema 常量(runProfileBinding / autonomousCompletionContract / autonomousPlaytestReceipt / autonomousGameBuildRunProfile)
- assertions/runtime.mjs 删除 runtimePublicStatusMessageId
- harness/project.mjs 删除 productionDefaultGameIndexHtml
- collaboration-policy.mjs 删除 validateSupervisorSwarmIsolatedSpawnInput 及其专属的静态隔离校验函数族
- persistence.mjs 删除 5 个 supervisorSwarmIsolated*Identity 函数
- 移除随之失去用途的 import(hashJsonValue、isolatedJoinDeliveryTarget、supervisorSwarmIsolatedReviews)
2026-09-23 12:07:51 +08:00
k88936 8d710738e2 清理AGC退役残留:配置向导悬空脚本、用户文案与孤儿 prompt 键
- 配置向导删除指向已删 npm 脚本的 `npm run test:chat` 调用与失去含义的 `--configure-only` 开关
- 删除只服务该分支的 askYesNo 与 npmCommand,保持 TTY 前置检查语义不变
- App 内用户文案 `请先用 /project 设置本地项目。` 改为 `请先打开本地项目。`
- chatPromptPolish 头部注释去掉已退役的 `/` 命令表述
- 删除 interaction.json 中只服务已删交互内核的 7 个 prompt 键(execute_description、resume_description、project_location_description、protocol、system、user、user_with_context)
- harness/process.mjs 的账号 fixture 注释改为描述现役隔离 Runner 机制
2026-09-23 12:07:37 +08:00
k88936 645ef30752 文档:修正AGC斜杠命令与终端swarm chat退役口径并记录收尾清理
- 修正 ADR 与里程碑中「agent.compact / agent.resume / agent.run_status 权限门禁消失」的过宽表述,限定为 swarm_cli/input.rs 里那份终端命令校验,现役门禁仍在
- 修正 `GAME_CREATION_APP_COMMANDS`「开发 Agent UI 仍在用」的说法为 App 只消费命令 id 类型与审计粒度
- 里程碑新增「收尾清理」小节,记录配置向导悬空脚本、用户文案、孤儿 prompt 键、harness 死导出与无调用方 Tauri 命令的清理结论
- 里程碑验证段更新为本次实测数据(typecheck、appSurface 211 tests、cargo check、编码与文档索引、harness self-test)
- AGC 渠道安装身份隔离实施计划移除已删除的 agent-swarm-test-chat.mjs
- pitfalls 去掉 `agc:test:chat` 与 `--configure-only` 的过期表述
- CONTEXT 的「项目命令 id」术语按现役消费方改写
- 主实施计划与 decision-log 中被删 Tauri 后台任务命令名改为现役入口 start_game_creator_agent_background_task_for_session_at
2026-09-23 12:07:20 +08:00
k88936 c9bb5a93f0 文档:说明引用名归一化可能撞名,以及碰撞目前只在解析侧兜住
normalizeMentionName 的注释补上「归一化不保证名字唯一」:`hero v2` 与 `hero-v2` 折成同一个 token,候选菜单侧不做冲突检测、会显示同一个标签,碰撞由 buildContentFromPastedText 的「同名多候选一律按文本保留」兜住
同步 AGC 聊天素材引用功能说明的引用名空白不变量小节,写明这是已知残留
2026-09-23 11:55:53 +08:00
k88936 3391ecf7d4 加固:粘贴接管改为「真的插进正文之后」才生效,插入为空时放行默认粘贴
ResourceReferenceInput 的 PASTE_COMMAND 处理器原先先 preventDefault 再去插入:插入为空时这段文字既不进我们的插入、又被挡掉了默认导入。现在先做插入,只有插入确实发生了才 preventDefault 并返回 true,否则返回 false 交给 Lexical 的默认粘贴
$insertContentAtSelection 改为返回「插进去没有」:选区取不到、或每个 part 都没落下内容时返回 false
编辑器已在一次更新里时 editor.update 会把回调排队,这时按原口径先接管(ranSync 标记区分「回调已同步跑完」与「回调被排队」),避免误判成插入为空而放行默认粘贴造成双份插入
同步 AGC 聊天素材引用功能说明的粘贴解析小节
2026-09-23 11:55:40 +08:00
k88936 3f9c698a67 修复:粘贴解析跳过只有触发符的退化 token,不再错认正文里的裸 @
buildContentFromPastedText 组装候选时跳过 token 长度小于等于 1 的条目(引用名为空时 token 就是裸 `@` / `$`):边界规则会让它在正文里匹配到任何一处触发符,认下来等于把无关文字错认成一条引用
函数注释的保守规则从两条补成三条,写明空名字按「宁可不成 chip」的同一口径跳过
新增用例:空名字引用的 token 是 `@` 时不认领正文里的裸 `@`、其余 token 照常解析;去掉该跳过分支后用例变红
同步 AGC 聊天素材引用功能说明的粘贴解析小节
2026-09-23 11:54:09 +08:00
k88936 4e90465c45 修复:素材显示名在词干为空时回退 asset.id,不再产生空引用名
resourceDisplayName 在文件名去掉扩展名后为空(`.env` / `.gitignore` 这类整名就是扩展名的文件)时回退 asset.id,回退值同样过 normalizeMentionName;空名字会让 token 退化成只有触发符的裸 `@`,候选菜单里是空芯片、粘贴解析还会认领正文里任何一处裸 `@`
normalizeMentionName 的注释改为「只做归一化、不做兜底」,把兜底的落点写明在名字的来源侧
新增用例:`.env` 与 `config/.gitignore` 的显示名回退 asset.id、引用标签不再为空;把该回退去掉后用例变红
同步决策记录(校正「不做 resourceId 兜底」一条)、AGC 聊天素材引用功能说明与引用粘贴解析实施计划
2026-09-23 11:53:14 +08:00
k88936 5b488f5a59 补齐定价版本术语与 Tripo 技术方案的乐观锁说明
- CONTEXT.md 补「定价版本(乐观锁)」术语,并在 3D 生成定价条目写明权威事实源与公开投影
- Tripo 技术方案补后台保存的版本比对与 409 语义
2026-09-23 11:51:34 +08:00
k88936 5285832acb 3D 查看器容器宽高比变化时按新比例重算取景
- framing 新增 resolveModel3dViewerReframedCameraPosition:保留朝向与相对缩放并钳进新缩放范围
- scene 的 ResizeObserver 不再只认首次尺寸,宽高比变化超过 1% 就重算取景
- resetView 改为按容器当前宽高比重算,不再复用可能过期的取景
- 首帧直接套用创建时的取景,避免重复一次顶点采样
- 补 framing 测试:朝向保留、相对缩放保留、缩放钳制与方向退化
2026-09-23 11:51:26 +08:00
k88936 f4083dcb6d 3D 查看器给签名地址的兄弟资源补回鉴权 query
- loader 新增 resolveModel3dViewerSourceQuery / resolveModel3dViewerResourceUrl,只补模型目录下的资源地址
- glTF / FBX 解析改用带 URL 修饰器的专用 LoadingManager,不动全局 DefaultLoadingManager
- 补测试:query 提取与片段剔除、目录内外的补与不补、多文件 glTF 兄弟资源解析
2026-09-23 11:48:48 +08:00
k88936 c5a718ac0e 3D 定价后台可编辑补齐实现状态、验收证据与踩坑记录
- 主规范补公开读模型投影口径、覆盖文件缺段补齐、旧形状覆盖文件的发布前置门禁与加价项一致性约束
- 实施计划补实现状态表、逐条判据的验收证据与真实环境待验收项;里程碑标记已实现待验收
- 后端架构文档补 upsert input 的期望版本与事务内 CAS 语义
- pitfalls 补「省略即沿用会静默覆盖」与「公开读模型形状不能跟着存储形状走」两条
- decision-log 补实现期的四个口径:公开投影取文生加价项、CAS 复用 updated_at、覆盖文件缺段按默认补齐、旧形状不兼容改发布门禁
2026-09-23 11:48:30 +08:00
k88936 c901f6954f 后台模型定价页新增 3D 两段编辑区块与乐观锁提示
- 新增 3D 定价区块:按端点分「文生 3D / 图生 3D」,各渲染模型版本 × {无贴图, 带贴图} 底价与加价项输入,键全部来自接口返回
- 抽出 adminEditorGenerationPricing 纯模块:数值解析、提交前 ≥1 校验、加价项中文标签、保存请求组装
- 保存整段回传 models 与 3D 两段,并带 expectedUpdatedAtMicros;409 提示重新读取且提供入口
- 后端未配置 3D 段时提示并禁用保存,不在页面新建或停用整段
- API 类型与客户端补两段、定价版本与保存请求类型;补组件与纯模块用例
2026-09-23 11:44:44 +08:00
k88936 ee4a9434fa 后台定价读取带版本、保存整段必填并做事务内乐观锁
- shared-contracts 新增定价版本冲突标记,module 与 api-server 共用一处声明
- SpacetimeDB upsert input 增加期望版本,事务内比对不一致即整笔拒绝(种子写入显式不比对)
- 定价 store 记录当前版本,读取路径带出 updated_at 微秒值
- 后台 GET 返回 models / 3D 两段 / updatedAtMicros,POST 要求两段显式给出且带期望版本
- 缺 3D 段 400、版本不匹配 409,退役 with_previous_model3d 与「省略即沿用」用例
- 绑定按 input 新字段重新生成,模块补乐观锁比对用例
2026-09-23 11:38:23 +08:00
k88936 952bc1ccaa 覆盖文件缺 3D 段时按受控默认价补齐,不再把 3D 整段算成未配置
- 新增 backfill_legacy_model3d_pricing:旧覆盖文件整段没有 3D 时补上默认 JSON 的两段并告警
- 覆盖文件继续只承担种子与兜底,避免老种子文件把 3D 生成整段关掉
- 补用例覆盖覆盖文件缺 3D 段的读取
2026-09-23 11:15:42 +08:00
k88936 f4294660d2 退役AGC项目对话斜杠命令与终端swarm chat入口:真实E2E、脚本与门禁清理
- 删除 scripts/agent-swarm-test-chat.mjs、agent-runtime-deterministic-playable-e2e.mjs、deterministic-lane-defense-provider.mjs
- 删除 user-input、supervisor-autonomous-playable-lane-defense、supervisor-swarm-autonomous-chat、static-isolated 与 collaboration-policy-mixed 套件
- 删除仅服务终端入口的交互式 CLI harness 管道与其进程清理、残留校验逻辑
- 清理 collaboration-assertions、evidence 模板与校验、self-test 中随之失效的混合与静态隔离断言及占位字段
- 移除 check-config.mjs 中钉住已删脚本、命令与套件的断言
- 删除 root 与应用 package.json 的 agc:test*、agc:chat、agc:swarm、各 *-real-e2e 与 test:chat* 脚本
- game-creator-config-wizard.mjs 改为从 channel-identity.mjs 取应用标识
2026-09-23 11:13:03 +08:00
k88936 5e47f0c41e 3D 定价记录转换与读取归一化接上 SpacetimeDB 两段列
- 新增 editor_generation_model3d_records 深模块:配置与两段记录行之间双向转换
- 写入方向严格:落库前按契约强校验,缺键与契约外键都不写
- 读取方向归一化:记录缺键(含整段缺失的老行)用本地配置同段补齐,契约外键剔除并告警,补齐后仍不合法才判非法
- 定价配置读取以表为准,覆盖文件降级为种子与兜底;state.rs 保存路径写入两段
- spacetime-client 补导出 3D 定价记录类型,api-server 定向用例覆盖往返、补齐、剔除与拒绝
2026-09-23 11:12:57 +08:00
k88936 6106b4e67c 退役AGC项目对话斜杠命令与终端swarm chat入口:应用与Rust实现删除
- 删除应用侧 /history 精确匹配分支与 reloadHistory、chatPromptPolish 的 / 前缀绕过、chatCommandMetadata、memoryCommands、projectSummaryConstants 命令清单
- 删除只服务退役摘要面板的 project-summary/*Summaries.ts 与 agentTrace.ts 及对应测试
- 删除 /sync-canvas-project、/read、/trace 草稿回填死链(agentPresentation.ts 与 Rust suggested_canvas_tool_call)
- 删除无人调用的 Tauri 命令 get_game_creation_agent_capabilities 与 get_limited_local_commands
- 删除 --swarm-chat 入口、SwarmChat 变体、src/swarm_cli.rs 与整个 swarm_cli/ 目录
- 收敛 agent/interaction.rs 至自然语言 steer 决策路径,删除交互内核整层
- 删除 SWARM_TURN_*_ERROR、print_runtime_response_stream_status 及其专属测试
- 更新 ChatMarkdownMessage、chatPromptPolish、rememberCommand 与 appSurface 用例,移除斜杠命令断言
2026-09-23 11:12:39 +08:00
k88936 530538842e 文档:收口退役AGC项目对话斜杠命令与终端swarm chat入口
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m20s
Project CI / Backend tests (pull_request) Failing after 16s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m8s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Failing after 7m22s
Project CI / Repository checks (pull_request) Failing after 12s
Project CI / Frontend tests (pull_request) Successful in 3m9s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 8m12s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m36s
Project CI / Native shell tests (pull_request) Successful in 7m13s
- 新增 ADR:记录斜杠命令与终端 swarm chat 入口整体退役的决策、保留项与影响边界
- 新增里程碑计划:登记删除范围、检查点、验证命令与未做边界
- 更新 decision-log:新增 2026-09-22 决策条目,清理被本次退役取代的历史命令条目
- 更新 pitfalls:移除已退役命令入口的现役表述
- 更新 CONTEXT.md 术语:把「斜杠命令」标为已退役说法
- 更新 docs/README.md:登记新 ADR
- 更新 AGC 主实施计划:删除全部「聊天输入 /<cmd>」能力条目与终端聊天入口承诺
- 更新 Agent Runtime V1.1 文档:删除终端 swarm chat 入口整节,控制面统一记为 --agent-* CLI
- 更新 DirectProject 里程碑计划:/history 入口表述改为显式重新加载对话
2026-09-23 11:10:55 +08:00
k88936 ebd904e193 公开读模型 3D 段保持迁移前的旧形状
- 新增 Model3dPricingPublicView,把内部两段结构投影回 basePrices 端点判别 + addOnPrices 单表
- 公开路由改用投影视图,画布 3D 入口与前端类型不需要随本次迁移改动
- 投影取文生 3D 段的加价项,两段不一致时打告警提示前端升级前不要差异化
- 公开路由用例补断言钉住 3D 段旧形状
2026-09-23 11:04:50 +08:00
k88936 44148542f1 Merge remote-tracking branch 'origin/master' into feat/smart-paste
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m10s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m30s
Project CI / Backend tests (pull_request) Successful in 4m43s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 8m16s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 9m10s
Project CI / Frontend tests (pull_request) Successful in 2m23s
Project CI / Native shell tests (pull_request) Successful in 7m2s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m10s
Project CI / Repository checks (pull_request) Successful in 2m49s
# Conflicts:
#	docs/project-memory/shared-memory/decision-log.md
2026-09-23 11:04:46 +08:00
k88936 9f4a71d2e3 3D 定价段拆成端点并列的两段结构
- Model3dPricingConfig 改为 textToModelPricing / imageToModelPricing 两段并列,各持自己的 versionPrices 与 addOnPrices
- 新增 Model3dEndpointPricing 承接单端点定价,校验与查价按端点委派,溢出检查覆盖两段
- 受控默认 JSON 的 model3d 段同步改为两段结构
- 3D 定价相关用例夹具与断言更新到两段形状
2026-09-23 11:01:20 +08:00
k88936 774b74d3d6 SpacetimeDB 定价表追加 3D 两段列,记录形状先能表达端点 × 版本 × 贴图与加价项
- editor_generation_pricing_config 末尾追加 text_to_model_pricing / image_to_model_pricing 两个 Option 列并带显式默认值
- 新增模型版本底价、加价项、端点定价三个 SpacetimeType 行类型,模块侧按段校验空段、缺半段、重复键与非正价格
- upsert 输入、快照、生成绑定与客户端记录映射同步两段字段
- api-server 保存路径本次先写空值,读取仍走本地文件缓存;补模块段级归一化用例
2026-09-23 10:54:01 +08:00
k88936 1327cd53b7 3D 生成定价迁移先落文档:两段并列结构、SpacetimeDB 权威与后台编辑
- 主规范把 3D 定价改成按端点两段并列结构,事实源改为 SpacetimeDB,补契约归一化、后台保存语义与验收项
- 新增 ADR 0005,记录权威事实源迁移、公开读模型不变的取舍与四条被否决做法
- 新增里程碑规范与实施计划,列出范围、验收标准、文件切分、验证命令与两个回滚点
- 同步 Tripo 技术方案的定价段形状、后端架构表目录的两列说明、CONTEXT.md 术语与决策记录
2026-09-23 10:53:28 +08:00
k88936 5e36b61534 修复:引用名内部空白统一折成 -,粘贴解析不再多插一枚芯片
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m21s
Project CI / Backend tests (pull_request) Failing after 11s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m53s
Project CI / Frontend tests (pull_request) Successful in 2m4s
Project CI / Repository checks (pull_request) Failing after 12s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m19s
Project CI / Native shell tests (pull_request) Successful in 5m13s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 6m46s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 8m16s
resourceReferences.ts 新增共享 normalizeMentionName:内部空白折 `-`、裁掉首尾,token 层幂等再折一次
素材显示名(resourceDisplayName)、Skill 名(目录读入与 toReference / mentionToken)、附件名(导入映射与 toReference / mentionToken)统一过这一份口径
resourceDisplayName 去掉 `|| asset.id` 兜底:引用名假定非空,不再回退 resourceId
前缀重叠 bug 由此收口:`@hero` 不再命中 `@hero-v2`(后一个字符不是空白),粘贴只剩正确的那一枚芯片
新增用例:素材 / Skill / 附件三类归一化口径、前缀重叠回归、Skill 目录名带空白、附件名带空白;把 normalizeMentionName 变异成恒等函数后新增用例全红
顺带修掉 referenceSourceProviders 用例里重命名遗留的 provider.match 断言与 skill provider 注释里的 match
同步 CONTEXT.md 术语、功能说明、实施计划与决策记录
2026-09-23 10:40:21 +08:00
k88936 072bf691d9 修复:粘贴解析注释里的 provider 成员名与实际 API 对齐
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 smoke (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
buildContentFromPastedText 的注释仍写着重命名前的 ReferenceProvider.candidates,改成 lookup
顺带写明候选来自调用方传入的引用清单,避免把「谁去查候选」误记进这个纯函数
2026-09-22 19:56:21 +08:00
k88936 14f11e77a2 修复:粘贴解析出的引用若解析不出来,退化成 token 文本而不是整条丢掉
$insertContentAtSelection 的引用分支补 else:referenceFromPart 返回 null 时插入该 part 的 token 文本
此前上游 buildContentFromPastedText 已把 token 摘走,插入端再丢一次就会让这段内容静默消失
新增用例:provider 认得出 token 但插入时已解析不出引用,断言正文保持 `看 @hero 一眼`、不产生芯片
变异验证:去掉该兜底后同一用例变红(正文变成 `看  一眼`),恢复即绿
2026-09-22 19:54:36 +08:00
k88936 9e50947d02 重构:引用输入区的选区兜底收敛成一个 helper
抽出 $selectionOrRootEnd():选区缺失或指向已被重建掉的节点时统一回落到草稿末尾
insertReferences / insertText / $insertContentAtSelection 三处重复的兜底判断改为调用它
行为不变:插件插入与粘贴插入仍走同一套「插到草稿末尾」的策略,只是不再各写一份
2026-09-22 19:53:42 +08:00
k88936 ec1f207021 重构:引用 provider 的 match / candidates 改名为 fuzzyLookup / lookup,删除 onPasteText
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m16s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m7s
Project CI / Frontend tests (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 / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
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
match(query) 改名 fuzzyLookup(query):名字写明它是包含匹配 + 截断的模糊菜单查询
candidates() 改名 lookup():名字写明它是精确查找用的就绪全量候选,不模糊不截断
删除 onPasteText 补读钩子:粘贴只用此刻就绪的候选,不等待、不补读,也不为解析提前读盘
输入区与资源 / Skill provider 同步改名,粘贴接管路径改读 lookup()
provider 用例与粘贴集成用例同步:Skill 冷启动改为「保持字面,敲过 `$` 后可解析」
补 jsdom 缺的 Range.getBoundingClientRect 与 ResizeObserver 桩(候选菜单测量用,真实浏览器都有)
同步 ADR 修订、实施计划、功能说明与决策记录
2026-09-22 19:50:42 +08:00
k88936 6950e08506 功能:引用输入区支持粘贴解析 @显示名 / $名称
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m26s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m55s
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
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 / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
新增 buildContentFromPastedText:粘贴文本按显示口径反解析,同名多候选与未命中 token 一律按文本保留
ReferenceProvider 增加可选 candidates 与 onPasteText:候选枚举保持纯函数,Skill 目录冷启动时补读一次
资源与 Skill provider 落地新缝,静默 provider(附件 / 运行画面区域)不参与粘贴解析
输入区在 CRITICAL 优先级接管 PASTE_COMMAND,仅解析出引用时插入并打 PASTE_TAG,一次 Ctrl+Z 整体回退
补充粘贴解析规则矩阵、provider 候选枚举与补读、输入区粘贴集成用例
同步 ADR 修订、实施计划、术语表、功能说明与决策记录
2026-09-22 19:06:19 +08:00
k88936 caafb8baa3 3D 提交体改用端点契约类型而非 Record
- Model3dSubmissionPlan.body 与 submitModel3dGenerationRequest 的 body 收紧为两个端点请求契约
- 提交计划按端点分支分别构造 text-to-model / image-to-model 请求体
- 幂等键入参同步收紧,测试夹具按契约补全 body
2026-09-22 17:04:11 +08:00
k88936 4e46202c10 3D 提交收到无任务状态的成功响应不再静默复位
- 新增 MODEL3D_SUBMISSION_MISSING_QUEUE_STATE_MESSAGE 提示文案
- 空 body 或缺 status 的 2xx 响应改判失败态并保留提示,不再直接回 idle
- 补用例断言不再触发排队链路且对话框进入失败态
2026-09-22 17:00:13 +08:00
k88936 00eed191c5 3D 提交把兜底铸的尝试代次写回对话框状态
- 新增 resolveModel3dAttemptNonce,提交计划带出本次实际使用的代次
- 提交编排在进入 generating 时把该代次写回 dialog,缺代次的老快照不再每次换键
- 补老快照场景用例,断言幂等键前缀与写回的代次一致
2026-09-22 16:59:18 +08:00
k88936 62f1ca4537 3D 提交失败提示不再直接显示传输层英文文案
- resolveModel3dGenerationErrorMessage 对超时单独给出中文可重试提示
- fetch 失败与中断收敛到中文兜底,服务端文案仍原样透出
- 补服务端文案透出、传输层兜底与超时提示的用例
2026-09-22 16:57:55 +08:00
k88936 852e65f7d8 查看器字节来源注明引用必须稳定
- Model3DViewerSource 的 bytes 分支补充 buffer 生命周期与稳定引用要求
- 说明同内容换新引用会触发场景重建与 GPU 重传的后果
2026-09-22 16:56:19 +08:00
k88936 aa6e3b8d79 SDK 请求错误不再丢弃响应体与底层错误链
- 映射 tripo3d_sdk::Error::Request 时带上 body 与 source 字段
- 响应体截断到 512 字符,疑似带 http(s) 地址的响应体整体丢弃
- 只取错误链底层文本,避免 reqwest 顶层 Display 带出完整签名 URL
- 补错误链收集、响应体过滤与截断的用例
2026-09-22 16:55:16 +08:00
k88936 3ab7b386f1 补外部生成主表 provider checkpoint 归一化单测
- 新增 old_external_generation_job_rows_default_to_unsubmitted_provider
- 断言旧迁移行的 provider_kind 与 provider_task_id 都归一成 null
- 守住 at-most-once submit 的向后兼容路径
2026-09-22 16:52:19 +08:00
k88936 ed2eb43fe6 补 3D 生成选项校验的表驱动单测
- 覆盖最简选项全模型放行、fast 必须配 v3.5 贴图版本
- 覆盖 generate_parts 的 texture/pbr/quad/smart_low_poly 互斥组合
- 覆盖 quad 家族限制与各模式 face_limit 的 min-1/min/max/max+1 边界
- 覆盖空白 task id 按 OutputSchema 失败与 trim 行为
2026-09-22 16:50:06 +08:00
k88936 62bf602fb1 多视图请求 DTO 补齐字段级说明并重生成绑定
- Model3dMultiviewToModelRequest 每个字段补一行中文语义说明与取值范围
- 结构体补严格反序列化与组合校验归属的说明
- 重新生成 ts-rs TS 绑定,注释同步进 Model3dMultiviewToModelRequest.ts
2026-09-22 16:48:57 +08:00
k88936 2348315dba 3D 结果打标契约测试补齐 preview 与 imageToModel 分支
- textToModel 用例补 preview 产物的相等断言
- 新增对称的 imageToModel 用例,守住 tag 路由与分支字段
- 裸字符串 source 的负例改为点名 Model3dGenerationSource 并单独反序列化 source 值
2026-09-22 16:46:19 +08:00
k88936 bba96e18a1 队列状态映射改为借用记录避免提交路径整行克隆
- editor_generation_queue_state 收 &ExternalGenerationJobRecord,只克隆输出需要的三个字段
- Model3dSubmissionResponse::from_job 不再克隆整行 job,status_url 提前算好避免额外克隆
- 其余调用点改为传引用,行为不变
2026-09-22 16:44:47 +08:00
k88936 433ffb4a15 落库的模型版本改用严格 wire 取值
- Model3dJobRequest::model_version 改为返回 Result 并使用 wire_str
- worker 落库前取不到契约取值即按服务端问题失败,不再写 Debug 兜底名
- 新增用例断言落库取值为契约线上值 v3.1-20260211
2026-09-22 16:40:48 +08:00
k88936 4e5ff179b2 3D 查价拒绝 texture=false 与贴图加价项的矛盾组合
- Model3dPricingError 新增 InconsistentTextureAddOn 变体与对应文案
- price() 在命中的 add-on 含贴图类而 texture=false 时失败关闭,不再照价收费
- 补齐矛盾组合报错与 texture=true 合法组合的价格用例
2026-09-22 16:38:24 +08:00
k88936 87ca86ae6a 图片输入解析抽出可注入查询的解析规则并补齐行为用例
- resolve_source_object_key 拆出 resolve_source_object_key_with 与 ResolvedReference 窄结果
- 新增按 ID 定点查询、类型不符、缺对象键、4xx 收敛与基础设施错误保留状态码的用例
- 源码文本断言不再按函数签名切片,只检查本模块不出现列工程 / 列素材库
2026-09-22 16:36:16 +08:00
k88936 48cde9624c operation_kind 白名单改为两 crate 共用的共享常量
- 白名单常量迁到 shared-contracts 并从 crate 根导出
- spacetime-module 的原子落库事务改为引用该常量,删除本地重复定义
- api-server 的登记测试不再解析对方源码文本,改为直接断言常量内容
- 后端架构文档补上白名单常量的位置与共用口径
2026-09-22 16:30:28 +08:00
k88936 e359158ecf 校验文案的版本标签改为从契约枚举推导
- validate_generation_options 的错误文案改用 wire_str_lossy 取 serde 线上值
- v3.x 家族的模型标签收敛到 v3_model_labels 助手
- 契约改名后诊断文案随之更新,不再手写重复的版本字符串
2026-09-22 16:19:09 +08:00
k88936 bcac5a7c12 三个提交入口的生成选项映射收敛为单一字段清单
- common::validation 用 tripo_generation_options_from! 由一份字段清单派生三个 From 实现
- multiview 手写的 TripoGenerationOptions 映射改为复用该 From 实现
- 新增共享字段时三条路径一起跟上,缺字段会在编译期报错
2026-09-22 16:15:38 +08:00
k88936 c8b4160fcd 3D 查价错误并入统一的定价错误枚举
- EditorGenerationPricingError 新增 Model3d 变体并实现 From<Model3dPricingError>
- model3d_price 改为返回 EditorGenerationPricingError,内层文案直通保持响应不变
- 提交路由对 3D 定价错误与定价快照错误分别映射,未配置用例改断言 Model3d(NotConfigured)
2026-09-22 16:11:17 +08:00
k88936 9800477c7c 模型版本清单从声明表派生避免漏加新版本
- Model3dModelVersion 的变体、线上值与 ALL 改为由 model3d_model_versions! 单一声明表生成
- ALL 类型改为 &'static [Self],新增版本只需在声明表加一行
- 定价校验与测试的遍历改用 iter().copied()
2026-09-22 16:03:55 +08:00
k88936 2e9aed3750 三个提交入口统一校验 provider 返回的 task id
- 新增 submitted_task_handle:空白 id 在提交调用附近以 OutputSchema 失败
- text / image / multiview 提交路径共用它,任务不再以孤儿状态等到下游查询才报错
2026-09-22 15:53:37 +08:00
k88936 09f0c51b81 空白视图规则收敛到单一助手
- 新增 view_input 同时服务提交前计数校验与 SDK 参数转换
- 空白 / 纯空白视图的判定不再有两份实现,避免校验与转换漂移
2026-09-22 15:49:34 +08:00
k88936 be07eb79c6 未知任务状态错误带上 task id
- map_status 接收 task_id,Unknown 分支改用与其它映射失败一致的 OutputSchema
- provider 异常可与具体任务对上,不再是一条无主错误
2026-09-22 15:47:01 +08:00
k88936 1749f427c1 任务快照只在失败终态保留 failure
- failure 改由终态判定驱动,不再只看 provider 是否留下错误字段
- 已完成的任务即使带过期错误字段也不再挂 failure,保持快照内部自洽
2026-09-22 15:45:45 +08:00
k88936 d9aa686e9a Merge remote-tracking branch 'origin/master' into feat/tribo3d-integeration
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m36s
Project CI / Backend tests (pull_request) Failing after 11s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m11s
Project CI / Frontend tests (pull_request) Successful in 4m15s
Project CI / Repository checks (pull_request) Failing after 11s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 6m36s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 8m33s
Project CI / Native shell tests (pull_request) Successful in 9m19s
Project CI / AI game creator shell web tests (pull_request) Successful in 4m29s
# Conflicts:
#	docs/project-memory/shared-memory/pitfalls.md
2026-09-22 15:35:47 +08:00
k88936 050909a0b7 后台定价保存不再清空 3D 段
- payload 的 model3d 缺席或为 null 统一表示沿用当前 3D 定价,显式给出时才覆盖
- 保存路径先取当前快照合并,避免改图 / 视频价格让 3D 提交一直失败关闭
- 补用例覆盖「省略保持」与「显式覆盖」两种语义
2026-09-22 15:27:19 +08:00
k88936 ee2d505eb3 3D 提交在扣费前预检落点归属
- 新增 target 预检模块:画布项目按 (project_id, owner) 定点确认,素材库文件夹按 owner 的库匹配
- 两个提交路由都在查价与入队之前调用;跨 owner / 不存在的落点回 400 model3d-target-unavailable
- 只剩基础设施故障保留原状态码,并补了收敛口径的单测
2026-09-22 15:21:25 +08:00
k88936 8473877bc3 5xx 错误响应不再回带 provider task id
- TaskFailure / OutputSchema / 上游兜底分支只回固定文案,完整错误写入服务端日志
- 补一条断言 502 details 不含 task id 与 provider 原文的用例
2026-09-22 15:17:50 +08:00
k88936 cda7724cae 上游瞬时状态不再回落成 400
- 408 / 425 / 429 与 platform-tripo 的 is_retryable 口径对齐,分别回 504 / 502 / 429
- 补上这三档与客户端 4xx 的分支测试
2026-09-22 15:15:27 +08:00
k88936 e18c6ee502 产物下载客户端不再跟随跳转
- 产物地址来自 provider 响应,禁止 reqwest 自动跳转以防 SSRF
- 需要跳转的地址会以非成功状态显式暴露,不再由服务端静默代发
2026-09-22 15:12:06 +08:00
k88936 669a08c7c2 产物下载失败信息补上可诊断上下文
- 传输失败带上脱敏 URL 与底层错误 source 链
- 非成功状态补上状态码文案与脱敏 URL
2026-09-22 13:51:29 +08:00
k88936 01a9941cbc 任务快照映射不再多余克隆字符串
- task_id 与 error_message 直接移交所有权,只保留错误路径上的必要克隆
2026-09-22 13:51:23 +08:00
k88936 fd0a37969e 3D 产物落盘文件名补上安全处理
- URL 无可用扩展名时按 content type 兜底,预览图不再写成 .glb
- 文件名主干中性化路径分隔符与遍历片段,避免逃出目标目录
2026-09-22 13:50:29 +08:00
k88936 7dd7bdd3c7 provider checkpoint 存在性校验补上 provider_kind
- at-most-once submit 的两字段不变量在数据层一起判定
2026-09-22 13:50:24 +08:00
k88936 5049c27f3d 3D 定价表加载时拦截加总溢出
- 底价与加价项累加改用 checked_add 校验,配置阶段即失败
- 避免结算路径 saturating_add 在异常配置下静默少收
2026-09-22 13:49:01 +08:00
k88936 129e2234f3 删掉 3D 引用解析里两个无人调用的宽查函数
- 两个 pub(crate) resolver 全仓无调用方,且会整表列举项目与素材
- 定点解析仍走既有按 ID 的窄查函数
2026-09-22 13:48:53 +08:00
k88936 2916e112df 3D provider 重试次数按上限 10 封顶
- TRIPO_RETRIES 配置异常时不再让产物下载近乎无限重试
2026-09-22 13:48:13 +08:00
k88936 c5e0c6a14d 去掉被丢弃的 remove 返回值告警
- 幂等指纹字段摘除改为显式丢弃返回值,表明这是 best-effort 行为
2026-09-22 13:48:10 +08:00
k88936 e2809b83c0 3D 冒烟示例单端点失败不再中断其余端点
- wait_for_task / get_task / download_model 失败时记录该端点错误并继续
- 保留 throw_on_failure: false 的原有语义,仅补齐传输与超时类错误
2026-09-22 13:45:50 +08:00
k88936 058d851a69 去掉 model3d_price 上已过期的 dead_code 豁免
- server-rs/crates/api-server/src/editor_generation_config.rs:model3d_price 现在由 tripo3d 提交路由真实消费,删掉「里程碑二的路由接上之前只有测试消费」这句已过期注释与配套的 #[allow(dead_code)]

验证:cargo check -p api-server(--locked)无该函数相关告警
2026-09-22 13:43:45 +08:00
k88936 444520b464 修正 storage.rs 注释错别字
- server-rs/crates/api-server/src/tripo3d/storage.rs:sniff_model_content_type 文档注释「说慌」改为「说谎」

验证:npm run check:encoding、git diff --check
2026-09-22 13:42:37 +08:00
k88936 326729a5ac Idempotency-Key 校验错误保留请求上下文
- server-rs/crates/api-server/src/tripo3d/routes.rs:require_idempotency_key 增加 request_context 参数,缺失 / 格式非法的两个 400 改用 into_response_with_context(Some(..)),与同处理器其它校验、定价错误一致;此前传 None,客户端拿不到请求 ID / 关联标识

验证:cargo test -p api-server --locked idempotency_key(相关 6 个用例全绿)
2026-09-22 13:42:34 +08:00
k88936 14740e0ef6 3D 任务参数用例改为断言真实主张
- server-rs/crates/api-server/src/tripo3d/job.rs:把 job_request_rejects_payload_without_fingerprint_stripping_support 改名为 job_request_stays_strict_after_stripping_platform_fingerprint 并补断言——带指纹 + 其它未知字段的合法 payload 仍必须被拒(摘下平台字段不等于放宽严格解析);原用例名声称验证指纹摘除,实际只断言了「缺字段的 payload 被拒」和「未知 job kind 被拒」

验证:cargo test -p api-server --locked job_request(2 个用例全绿)、npm run check:rustfmt
2026-09-22 13:40:13 +08:00
k88936 48a5bf06d0 3D 产物读取不再克隆 content type
- server-rs/crates/api-server/src/tripo3d/artifacts.rs:content_type 只在本函数取一次、之后不再读句柄字段,改用 take() 转移所有权而不是 clone()

验证:cargo check -p api-server(--locked)
2026-09-22 13:36:28 +08:00
k88936 9263d79d42 3D 产物读取按声明长度预分配缓冲
- server-rs/crates/api-server/src/tripo3d/artifacts.rs:read_artifact 用 Vec::with_capacity 按 provider 声明的 content_length 预分配(并封顶到 512 MiB 上限,防止谎报长度撑爆内存),避免几百 MB 产物逐块 extend 反复搬移

验证:cargo check -p api-server(--locked)
2026-09-22 13:36:25 +08:00
k88936 6d8164d37a OSS 不可用错误补上机器可读的 reason
- server-rs/crates/api-server/src/tripo3d/errors.rs:oss_unavailable 增加 reason=oss-unavailable,与同文件其它 5xx 映射及 editor_agent 的 OSS 错误口径一致,客户端可按 reason 分类这个 503

验证:cargo check -p api-server(--locked)
2026-09-22 13:35:23 +08:00
k88936 66b8c2bed0 3D 定价快照读取失败补上机器可读的 reason
- server-rs/crates/api-server/src/tripo3d/errors.rs:map_pricing_store_error 增加 reason=model3d-pricing-store-error,与同文件其它映射一致,客户端可按 reason 分类这个 500;provider 保持 editor-generation-pricing(全仓库定价错误都是这个口径),不改写为 TRIPO_PROVIDER

验证:cargo check -p api-server(--locked)
2026-09-22 13:35:20 +08:00
k88936 cb136fb445 画布图层的媒体渲染分派抽成独立函数
- src/components/image-editor/ImageCanvasWorldView.tsx:音频 / 视频 / 序列帧 / model3d / 默认图片这条五层三元链提成 renderCanvasLayerMedia(早返回写成一列判断),渲染分支与传参不变,新增媒体类型不再加深三元

验证:npx vitest run src/components/image-editor/ImageCanvasWorldView.test.tsx(57 用例全绿)、npm run typecheck
2026-09-22 13:33:14 +08:00
k88936 d1478e3859 文生 / 图生 3D 面板入口合并到同一个 opener
- src/components/image-editor/useImageCanvasGenerationWorkflow.ts:新增 openModel3dGenerationDialog(mode),openModel3dTextToModelDialog / openModel3dImageToModelDialog 退化成两个只传 mode 的薄包装;两条入口此前是除 mode 外逐字相同的复制,改逻辑时容易只改一处

验证:npm run typecheck
2026-09-22 13:31:48 +08:00
k88936 b41d156edd 底部工具栏的子选项锚点 ref 改用查表
- src/components/image-editor/ImageCanvasBottomToolbarView.tsx:把 spec / music / model3d / publication 的三层三元 ref 选择链提成 toolWrapRefs 映射表,新增子选项时不再延长三元链

验证:npx vitest run src/components/image-editor/ImageCanvasBottomToolbarView.test.tsx(3 用例全绿)、npm run typecheck
2026-09-22 13:31:46 +08:00
k88936 4363a6219a 修正查看器失败文案穷尽检查的写法(上一提交未通过类型检查)
- src/components/image-editor/model3d-preview/Model3dViewerModel.ts:上一提交把 never 断言写在 switch (detail?.reason) 上,default 分支里可选链未被收窄,npm run typecheck 报 TS2322(undefined 不能赋给 never)。改为先取局部常量并早返回「原因缺失 / load-failed」,switch 只处理其余三种原因,default 保留 never 断言
- 文案与判定结果不变

验证:npm run typecheck(tsconfig.typecheck-guardrails,exit 0);临时给 Model3dViewerFailureReason 增加一个成员,确认该 default 分支会编译报错(TS2322),随后已还原;npx vitest run src/components/image-editor/model3d-preview(18 用例全绿)
2026-09-22 13:31:24 +08:00
k88936 0ec0a13cbc 关闭 3D 预览面板时清掉查看器状态
- src/components/image-editor/model3d-preview/Model3dViewerModal.tsx:layer 变 null(面板关闭)时把 viewerStatus 复位,下一次打开从禁用的「重置视角」开始,不再继承上一轮实例的 ready;只处理关闭不处理换模型,避免 effect 晚于查看器上报而盖掉 loading
- src/components/image-editor/model3d-preview/Model3dViewerModal.test.tsx:新增「关闭后重开不沿用 ready」的回归用例

验证:npx vitest run src/components/image-editor/model3d-preview(18 用例全绿)
2026-09-22 13:29:10 +08:00
k88936 c96d7fe847 查看器失败文案改用穷尽 switch
- src/components/image-editor/model3d-preview/Model3dViewerModel.ts:resolveModel3dViewerFailureText 从早返回改成 switch,并给 default 加 never 穷尽检查;查看器今后新增失败原因会在此处编译报错,而不是静默落到通用兜底文案。文案与判定结果不变

验证:npx vitest run src/components/image-editor/model3d-preview、npx tsc -p tsconfig.typecheck-guardrails.json --noEmit
2026-09-22 13:28:14 +08:00
k88936 8131a70a2f 失败态的重试按钮也按 canSubmit 门禁渲染
- src/components/image-editor/model3d-generation/Model3dGenerationModal.tsx:重试按钮改为 dialog.status === 'failed' && canSubmit 才渲染;此前定价失效或参考图未上传完时它仍可点,提交管线再挡回来,交互上表现为「点了没反应」

验证:npx vitest run src/components/image-editor/model3d-generation/Model3dGenerationModal.test.tsx(8 用例全绿)
2026-09-22 13:27:39 +08:00
k88936 73f34ecbc9 前端补上「分件 + 方形布线 / 智能低多边形」的互斥校验
- src/components/image-editor/model3d-generation/Model3dGenerationFormModel.ts:resolveModel3dGenerationParams 增加 generateParts 与 quad / smartLowPoly 的互斥判定,与 provider 的 validate_generation_options 对齐;此前纯几何档位下这两个开关仍可同开,前端能出价、提交后才被后端拒
- src/components/image-editor/model3d-generation/Model3dGenerationFormModel.test.ts:新增该组合被拒的用例

验证:npx vitest run src/components/image-editor/model3d-generation(40 用例全绿)
2026-09-22 13:26:49 +08:00
k88936 25fe98836f 幂等键指纹的键排序改成具名比较函数
- src/components/image-editor/model3d-generation/Model3dGenerationSubmission.ts:canonicalizeModel3dRequestValue 里的嵌套三元比较器提成模块级 compareModel3dRequestEntryKeys,排序结果不变,只是不再嵌三元且不必每次递归重建比较器

验证:npx vitest run src/components/image-editor/model3d-generation(39 用例全绿)
2026-09-22 13:26:28 +08:00
k88936 b48c34d6b4 删掉重复且无人使用的 3D 提交超时常量
- src/components/image-editor/model3d-generation/Model3dGenerationSubmission.ts:删除 MODEL3D_SUBMISSION_TIMEOUT_MS;实际生效的是 editorProjectClient 的 EDITOR_MODEL3D_SUBMISSION_TIMEOUT_MS(submitModel3dGenerationRequest 用它),保留两份 60_000 只会各自漂移

验证:全仓库检索该常量只剩定义处(已删);npx tsc -p tsconfig.typecheck-guardrails.json --noEmit
2026-09-22 13:26:00 +08:00
k88936 5bdabdc7f7 3D 提交计划在非 3D 模式改用专门的原因文案
- src/components/image-editor/model3d-generation/Model3dGenerationSubmission.ts:buildModel3dSubmissionPlan 的 mode 兜底改用 MODEL3D_MODE_UNSUPPORTED_REASON,不再把非 3D 面板说成「3D 模型定价尚未配置」

验证:npx vitest run src/components/image-editor/model3d-generation
2026-09-22 13:25:38 +08:00
k88936 9b1c99f37b 非 3D 面板不再复用「定价未配置」这句原因
- src/components/image-editor/model3d-generation/Model3dGenerationFormModel.ts:新增 MODEL3D_MODE_UNSUPPORTED_REASON,resolveModel3dGenerationQuote 在 mode 不是 3D 生成模式时返回它;原文案会把「模式不支持」误报成定价配置问题

验证:npx vitest run src/components/image-editor/model3d-generation
2026-09-22 13:25:37 +08:00
k88936 9a62941779 贴图质量映射抽成单一函数,去掉嵌套三元
- src/components/image-editor/model3d-generation/Model3dGenerationFormModel.ts:resolveModel3dGenerationParams 里的贴图质量嵌套三元提成 resolveModel3dTextureQuality(tier),取值与判定条件不变

验证:npx vitest run src/components/image-editor/model3d-generation
2026-09-22 13:25:22 +08:00
k88936 7987fed204 删掉无人引用的 MODEL3D_IMAGE_PROMPT_MAX_LENGTH
- src/components/image-editor/model3d-generation/Model3dGenerationFormModel.ts:删除只导出、全仓库无引用的图生 3D 提示词长度常量;文生上限与画布尺寸常量仍在使用

验证:全仓库检索该常量只剩定义处;npx tsc -p tsconfig.typecheck-guardrails.json --noEmit
2026-09-22 13:25:18 +08:00
k88936 02df355281 3D 提交地址改成按 endpoint 穷尽映射
- src/services/image-editor/editorProjectClient.ts:新增 EDITOR_MODEL3D_ENDPOINT_API(Record<Model3dPricingEndpoint, string>)取代三元判断;原写法对非 image-to-model 的值一律回落 text-to-model,endpoint 联合扩容时会静默走错接口

验证:npx tsc -p tsconfig.typecheck-guardrails.json --noEmit
2026-09-22 13:24:43 +08:00
k88936 5d47ef9347 3D 提交的「不自动重试」选项改回 retry 字段
- src/services/image-editor/editorProjectClient.ts:submitModel3dGenerationRequest 把 EDITOR_GENERATION_REQUEST_RETRY_OPTIONS 从顶层展开改成 retry 字段;requestJson 只认 options.retry,顶层展开的 maxRetries / retryUnsafeMethods 会被静默忽略,计费 POST 的「不自动重试」意图丢失(当前只是靠 POST 默认 maxRetries=0 侥幸不重试)

验证:文件内 9 处生成入口现在统一使用 retry 字段
2026-09-22 13:24:22 +08:00
k88936 fc8a674e91 3D 模型角标改用 Tailwind v4 可用的类与专用 CSS 规则
- src/index.css:新增 .image-canvas-editor__kind-badge--model3d 规则,背景与阴影沿用原取值,与其它 asset kind 的写法一致
- src/components/image-editor/ImageCanvasWorldView.tsx:model3d 角标改成引用该规则;原写法用 Tailwind v3 的 `!` 前缀(v4 改后缀),实际不会生成工具类,角标退化成白字无底色的白药丸

验证:npx prettier --check src/index.css src/components/image-editor/ImageCanvasWorldView.tsx
2026-09-22 13:23:24 +08:00
k88936 f1d0aed7dd 3D 生成面板补上浮动菜单的 portal 与定位参数
- src/components/image-editor/ImageCanvasGenerationComposerView.tsx:Model3dGenerationModal 传入 renderEditorPortal / buildPortalMenuStyle,与同文件其余生成面板一致;此前走默认的恒等实现,「参考图来源」菜单内联在文档流里且没有定位样式

验证:npx tsc -p tsconfig.typecheck-guardrails.json --noEmit
2026-09-22 13:22:44 +08:00
k88936 9f4f7341c9 修复 AGC 资源工具条缺 onPreviewModel3d 导致的类型检查失败
- apps/ai-game-creator-shell/src/view/project-development/index.tsx:给 ImageCanvasSelectedLayerToolbarView 补上 onPreviewModel3d 空实现,并写明资源画布不登记 preview-model3d、按钮不会渲染;此前该必填属性缺失,AGC 严格模式报 TS2741

验证:npm run ai-game-creator-shell:typecheck(修复前 error TS2741,修复后 exit 0、error TS 计数 0)
2026-09-22 13:21:10 +08:00
k88936 928aee403a 修正 model3d 绑定生成的 editor_canvas 测试过滤词
- package.json:contracts:model3d:generate 的测试过滤词由 editorcanvas 改为 editor_canvas;libtest 过滤词按子串区分大小写,而模块名是 editor_canvas::export_bindings_*,原写法命中 0 个用例,packages/shared/src/contracts/editor-canvas 实际只被 prettier 重排、从未重新生成

验证:cargo test --locked -p shared-contracts -- model3d editor_canvas(25 个导出用例命中,含 editor_canvas 的 2 个;修复前该过滤词命中 0 个)、npm run contracts:model3d:generate 后 packages/shared 零 diff
2026-09-22 13:19:34 +08:00
k88936 d24347d78e gitignore 的 3D 样例规则改为大小写不敏感
- .gitignore:把 /*.glb 一类规则改成 /*.[gG][lL][bB] 形式;gitignore 匹配与 core.ignoreCase 无关,浏览器下载保留下来的 Model.GLB / scene.GLTF 等大写扩展名此前仍会出现在 git status 里

验证:git check-ignore -v model.GLB scene.GLTF asset.FBX model.bin s.png(均命中新规则)
2026-09-22 13:19:09 +08:00
k88936 0ae73f7e0e gitignore 连 glTF 兄弟资源一起忽略
- .gitignore:仓库根目录手工下载的 3D 样例除容器文件外,再忽略多文件产物的 .bin 缓冲与 png / jpg / jpeg / webp / ktx2 / tga 贴图,避免整套样例在 git status 里逐条冒出来

验证:git check-ignore -v image_to_model.glb companion.bin scene.png(根目录同名文件命中新规则)
2026-09-22 13:18:55 +08:00
k88936 fb9c1d0e29 查看器取消时一并中止在途的模型下载
- packages/model3d-viewer/src/loader.ts:readModel3dViewerSource 与 loadModel3dViewerObject 新增可选 AbortSignal,透传给 fetch;signal 已中止时抛 Model3dViewerAbortedError,不再当成 load-failed
- packages/model3d-viewer/src/scene.ts:场景输入新增 signal,创建时透传给模型加载
- packages/model3d-viewer/src/Model3DViewer.tsx:加载 effect 内建 AbortController,卸载 / 换源时先 abort 再释放场景,避免下载要读完 64 MiB 才被丢弃
- packages/model3d-viewer/src/loader.test.ts:新增回归用例,断言 signal 确实交给 fetch 且中止后抛取消错误

验证:npx vitest run packages/model3d-viewer(20 用例全绿)、npx tsc 严格模式检查查看器包全部源文件
2026-09-22 13:18:40 +08:00
k88936 b71d18b166 场景释放不再强制丢失 WebGL 上下文
- packages/model3d-viewer/src/scene.ts:teardown 去掉 renderer.forceContextLoss(),只保留 renderer.dispose(),并写明原因;宿主 Model3DViewer 全程复用同一个 <canvas>,强制丢上下文会让下一个模型拿到已丢失的上下文渲染全黑

验证:npx tsc(严格模式单文件检查)、npx vitest run packages/model3d-viewer
2026-09-22 13:18:04 +08:00
k88936 4bcf0cdb86 释放材质时用 if/else 取代嵌套三元
- packages/model3d-viewer/src/scene.ts:disposeModel3dViewerObject 里把材质归一化成数组的三元链改成 if/else,展开层级与语义不变,只是去掉内层三元嵌套

验证:npx tsc(严格模式单文件检查)、npx vitest run packages/model3d-viewer
2026-09-22 13:17:43 +08:00
k88936 104656aa99 去掉 Model3DViewer 加载 effect 里冗余的 sourceKind 依赖
- packages/model3d-viewer/src/Model3DViewer.tsx:删除只出现在依赖数组里的 sourceKind 变量与依赖项,effect 实际只分支 sourceData / sourceUrl,kind 变化必然带动这两者之一变化

验证:npx tsc(严格模式单文件检查)、npx vitest run packages/model3d-viewer
2026-09-22 13:17:27 +08:00
k88936 de8bb9d373 取景近远裁剪面比例改为具名常量
- packages/model3d-viewer/src/framing.ts:把 near / far 推导里内联的 1/1000 与 10 提成 NEAR_DISTANCE_RATIO / FAR_DISTANCE_RATIO,与同文件其它比例常量口径一致,取值不变

验证:npx vitest run packages/model3d-viewer(19 用例全绿)
2026-09-22 13:17:02 +08:00
k88936 f9750bde0b 查看器取景距离改用前校验有限正数
- packages/model3d-viewer/src/framing.ts:computeModel3dViewerFitDistance 不再无条件采信调用方传入的 distance,改为 Number.isFinite 且大于 0 才采用,否则回落包围盒角点求解,避免 0 / 负数 / NaN 让 maxDistance 小于 minDistance

验证:npx vitest run packages/model3d-viewer、npx tsc -p tsconfig.typecheck-guardrails.json --noEmit
2026-09-22 13:16:40 +08:00
k88936 93002f1bd2 统一 model3d 查看器状态类型命名:Model3DViewerStatus 改回 Model3dViewerStatus
- packages/model3d-viewer/src/status.ts:状态类型改名,与同文件的 Model3dViewerFailureReason / Model3dViewerStatusDetail 以及仓库既有 Model3d* 口径一致
- packages/model3d-viewer/src/Model3DViewer.tsx、packages/model3d-viewer/src/index.ts:跟随改名更新导入与引用
- src/components/image-editor/model3d-preview/Model3dViewerModal.tsx:跟随改名更新导入与状态类型引用

验证:npx tsc -p tsconfig.typecheck-guardrails.json --noEmit、npm run lint:eslint(改动文件)
2026-09-22 13:16:05 +08:00
k88936 e7b067e977 恢复合并时丢掉的 AGC 壳依赖 codex-patch-parser 与 chrono
Project CI / AI game creator shell Rust crates (pull_request) Successful in 3m7s
Project CI / Backend tests (pull_request) Failing after 12s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 3m58s
Project CI / Native shell tests (pull_request) Failing after 2m50s
Project CI / Repository checks (pull_request) Failing after 12s
Project CI / Frontend tests (pull_request) Successful in 3m27s
Project CI / AI game creator shell web tests (pull_request) Failing after 1m34s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 9m23s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 9m24s
- apps/ai-game-creator-shell/src-tauri/Cargo.toml:[dependencies] 补回 master 侧新增的 `codex-patch-parser = { path = "vendor/codex-patch-parser" }` 与 `chrono = { version = "0.4", default-features = false, features = ["std"] }`(冲突解决时随同段落的 ts-rs 一起被丢掉,导致 src/agent/direct_patch.rs 与 src/agent/direct_codex_audit.rs 报 8 条 E0433 / E0432)
- apps/ai-game-creator-shell/src-tauri/Cargo.lock:按清单恢复 genarrative-ai-game-creator-shell 条目里的 chrono 与 codex-patch-parser 依赖
- docs/project-memory/shared-memory/pitfalls.md:新增 2026-09-22 条,记录「合并后 CI 报 cannot find module or crate 先查对方新增的依赖行」的判据与踩坑点
- docs/project-memory/shared-memory/decision-log.md:在 2026-09-22 合并条目补记这次丢依赖与验证

验证:cargo metadata --locked(AGC workspace)、cargo test --locked --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml --no-run(bin + 4 个集成测试目标全部编译)、cargo check --locked --workspace --manifest-path server-rs/Cargo.toml、npm run check:native-shells:agc-rust-crates、npm run check:encoding、npm run check:doc-index、git diff --check
2026-09-22 13:13:00 +08:00
k88936 10e63ecb6b 合并 origin/master 到 feat/tribo3d-integeration:ts-rs 一律常开、Cargo 清单去重
- server-rs/Cargo.toml:删除与 workspace git 固定重复的 registry `ts-rs = "12.0.1"`,保留固定 commit 并写明「ts-rs 一律常开、绑定命令固定为 cargo test -p shared-contracts export_bindings」
- server-rs/crates/shared-contracts/Cargo.toml:删除 master 侧新增的 `ts-bindings` feature,`ts-rs` 保持常开依赖
- server-rs/crates/shared-contracts/src/game_creation_app/asset_kind.rs:去掉 `cfg_attr(feature = "ts-bindings", …)` 门控,derive 与字段级 `ts(...)` 无条件展开
- apps/ai-game-creator-shell/src-tauri/Cargo.toml:shared-contracts 依赖去掉 `features = ["ts-bindings"]`,继续保留本分支的 ts-rs git 固定
- apps/ai-game-creator-shell/src-tauri/Cargo.lock:按上述依赖变更同步(shared-contracts 指向 git 源 ts-rs)
- docs:同步 5 处绑定生成命令(去掉 `--features ts-bindings`),并在 decision-log 记本次合并的决策、代价与验证
- 其余暂存改动为 origin/master 带入的内容,冲突按两侧目的逐一合并

验证:cargo metadata --locked(server-rs 与 AGC 两个 workspace)、cargo test -p shared-contracts(119 + 5 + 5 + 2 + 2 全绿且无告警)、npm run contracts:model3d:generate 后 packages/shared 零 diff、cargo check -p spacetime-module --target wasm32-unknown-unknown、npm run check:encoding、npm run check:rustfmt、npm run check:spacetime-schema、git diff --check、暂存集 eslint / prettier 全过
2026-09-22 13:12:28 +08:00
k88936 61fe4c48af 图片画布接入 3D 资源:新增 model3d 类别、3D 预览与 3D 生成入口
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Failing after 16s
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Failing after 18s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Failing after 18s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Failing after 18s
Project CI / AI game creator shell Rust smoke (pull_request) Failing after 16s
Project CI / Backend tests (pull_request) Failing after 16s
Project CI / AI game creator shell Rust crates (pull_request) Failing after 16s
Project CI / Native shell tests (pull_request) Failing after 16s
Project CI / Frontend tests (pull_request) Failing after 7s
Project CI / Repository checks (pull_request) Failing after 12s
Project CI / AI game creator shell web tests (pull_request) Failing after 12s
- 后端资源投影按 asset_kind 分叉,新增 project_editor_client_media_src 与 EDITOR_MODEL3D_ASSET_KIND:model3d 只投影预览图,模型本体只留 objectKey,预览缺失才回落历史口径
- tripo3d 存储新增按字节魔数识别模型 content_type 与扩展名映射,不采信 provider 声明与下载响应头
- editor_project_storage 把 model3d 加入 EDITOR_CANVAS_ASSET_KINDS 白名单
- 前端 CanvasAssetKind 与 image-canvas-core 类型新增 model3d:画布卡片渲染预览图或 3D 占位,类型角标新增「3D模型」,覆盖资格只在它与空类别之间成立
- 新增 model3d-preview 子目录(Model3dViewerModal / Model3dViewerModel),Tailwind 内联、不新增 CSS,失败原因分超限 / 格式不可识别 / 无 WebGL2 三类展示
- 选中工具条新增只读 preview-model3d 能力位,仅 objectKey 为空时置灰;打开预览同时选中图层并暂停画布快捷键与舞台交互
- 查看器包源对象 format 改为可选,新增「声明 Content-Type → 字节魔数 → 地址扩展名」三级格式判定并导出支持格式清单
- 导出工作流新增 3d_models/ 目录,模型下载按真实响应头 MIME 定扩展名、对象键扩展名兜底
- 新增 3D 生成入口:底部工具栏浮动子选项与文生 / 图生 3D 面板,落 projectResource + canvasCompletion,复用占位框与任务侧栏
- 3D 定价只读实时定价查询,段缺失即入口不可提交;幂等键由前端铸造,用户重试必须换键
- 新增 ADR 0003 / 0004 与实施计划、里程碑文档;更新 Tripo 技术方案、后端架构、CONTEXT 术语、decision-log 与 pitfalls
- .gitignore 忽略仓库根目录手工下载的 3D 样例模型
2026-09-22 10:10:00 +08:00
k88936 9fc55a5cac 写入Tripo 3D泥点默认价并锁定credit换算口径
- 受控默认配置新增 model3d 段:底价按端点 × 模型版本 × 是否有贴图,add-on 六项独立计价

- 换算口径固定为泥点 = ceil(0.8 × Tripo 官方 credit),H 系列 10/20 与 20/30、P1 30/40 与 40/50、P2 100/110

- editor_generation_config 定向用例按 credit 表反算默认泥点价,改价必须先改 credit 表

- 段缺失语义改为显式摘段验证,仍保持 fail closed 不扣费不入队

- 主规范、里程碑、实施计划与定价管理方案同步默认价已确认与部署侧 override 风险
2026-09-21 22:07:55 +08:00
k88936 2691ca8aca 补记图生输入的OSS直读待讨论项
- api-server 的 image_source 模块头与 platform-tripo 的 upload_image 各留一条 TODO(oss-direct-read):交签名 URL 或对端直读 OSS 能省掉字节中转,但把私有对象与带时效凭据交给第三方,安全口径与可行性待讨论
- 技术方案文档把图生输入口径更新为当前的 source 站内引用 tagged enum,并补同一条待讨论说明
- 讨论清楚之前保持「api-server 自己读、自己传」的现口径,不改行为
2026-09-21 20:02:18 +08:00
k88936 14066eea11 产物下载改为按「无数据推进」判超时
- artifact reqwest client 不再设包含响应体的总超时,改成 connect_timeout + read_timeout(reqwest 0.12 的「每次读操作」语义,读完自动重置)
- 响应头之前没有数据推进时用显式 tokio::time::timeout 兜住,避免连上却不返回响应头时无限挂住
- 新增 TripoProviderClient::artifact_stall_timeout 统一承载三处预算,取值沿用 TripoSettings::request_timeout
- 补 3 个 mock TCP 用例:响应头一直不来、传输中途断流按无数据推进失败,慢速但持续的下载必须完整收完(后者能拦住「改回总超时」的回归)
- 同步技术方案与后端架构文档里的下载超时口径
2026-09-21 19:54:57 +08:00
k88936 609b24c779 text-to-model入口的submit改名带端点
- TripoProviderClient::submit 改名为 submit_text_to_model,与 submit_image_to_model / submit_multiview_to_model 一致
- 同步 api-server tripo3d worker 与 tripo_generation_smoke example 的调用点
- 同步技术方案文档里写死的 submit 口径,方法名不再与另两个入口分叉
2026-09-21 19:49:31 +08:00
k88936 3af0d3d90b 契约枚举的线上取值只由serde定义
- shared-contracts 新增 wire_str 与 wire_str_lossy:线上取值只从 serde rename / rename_all 取,不再维护第二份字面量
- 删除模型版本、纹理质量、纹理版本、纹理对齐、几何质量、输入方向、导出方向、压缩共 8 个枚举上手工维护的 as_str
- platform-tripo 新增 common/wire.rs 负责契约枚举到 provider 请求字符串的转换,三个入口的 to_sdk_params 改走它并把失败归一成 provider 错误
- api-server 的定价文案与 job 模型版本取值改用 serde 取值,job 的 model_version 由 &'static str 改为 String
- 取值来源只剩 serde 一处,改 rename 不会再静默分叉
2026-09-21 19:46:43 +08:00
k88936 c0d6531e92 三个入口的seed参数在TS契约里改用bigint
- seed 是 i64,JS number 表示不了全部取值却又没有范围校验,客户端传 64 位值会被静默舍入
- text_to_model / image_to_model / multiview_to_model 的 image_seed、model_seed、texture_seed 由 number|null 改为 bigint|null
- 同步重新生成的 ts-rs 绑定,仅这三个字段变化
2026-09-21 19:38:47 +08:00
k88936 a4d9418cd3 补记Tripo TS绑定目录化生成的重跑验证
- 实施计划进展记录 contracts:model3d:generate 重跑后 packages/shared 无 diff

- 验证命令清单补上该生成命令
2026-09-21 15:34:46 +08:00
k88936 7d842f0b15 补记spacetime-client重复副本文件的排障经验
- 记录 active.rs 用 path 属性指定真实模块、同名副本不参与编译的现象与原因

- 给出改动前先查 path 属性、只改 active 目录、用编译双绿确认的处理口径
2026-09-21 15:32:30 +08:00
k88936 d6c7a04a1c 同步Tripo3D的worker领取范围与长任务预算口径
- worker 领取清单补上 model3d_text_to_model 与 model3d_image_to_model

- 长任务预算说明补记两个 3D job kind 在单次 attempt 内轮询 provider 并占用并发位

- worker 化方案补记 Tripo provider 的四个环境变量、默认网关与缺密钥时的 503 口径
2026-09-21 15:31:04 +08:00
k88936 13dfe07f94 补记3D定价在模型定价体系中的例外口径
- 模型定价管理方案新增 model3d 段说明:形状、事实源仍为文件配置、后台改价不覆盖

- 说明段缺失即 fail closed,未确认前禁止写入猜测值或 provider credit 数字

- 记录后续把 3D 段迁入 SpacetimeDB 并接后台编辑的收敛路径

- 实施计划补记 spacetime schema guard 通过及其锚点
2026-09-21 15:26:31 +08:00
k88936 03d26d46af 修正provider文档里过期的下载包装类型名
- 文档写的 TripoDownloadedModel 已不存在,按当前代码改成 TripoDownloadedArtifact
- 上一条文档提交的说明里已提到这处改动,但当时补丁没落上,这次补实
2026-09-21 15:22:08 +08:00
k88936 c0fcb8553d 补Tripo worker纯逻辑定向用例
- checkpoint 只在 provider task id 非空且去空白后有效时才算存在,空白等同未提交

- 完成结果按端点严格区分,且序列化后不含 provider、taskId 与带签名的临时地址

- 预览图尺寸必须能真实解码,损坏字节直接失败而不是写占位宽高

- 预检用例去掉多余的通配导入,实施计划进展同步当前通过数
2026-09-21 15:22:01 +08:00
k88936 25ee11771c 同步Tripo provider文档与本次行为修正
- 脱敏输出保留原分隔符、带 userinfo 的地址解析即拒绝
- 图片与视图引用提交前 trim;校验原因分 Required / InvalidCombination / OutOfRange
- 下载前要求快照为完成态,filename 扩展名收紧为短 ASCII 字母数字
- 顺带把文档里的下载包装类型名改为当前的 TripoDownloadedArtifact
2026-09-21 15:21:12 +08:00
k88936 aebbd3bb99 多视图输入变体字段统一按camelCase序列化
- Model3dMultiviewInputs 的 serde 属性补 rename_all_fields = camelCase,结构体变体字段不再逐字段手工 rename
- TaskId 变体去掉冗余的 taskId 显式 rename,序列化结果与生成绑定均无变化
2026-09-21 15:20:36 +08:00
k88936 3e426a1006 容器首帧无尺寸时按真实比例重算取景
- 取景原先只在加载完成时按 measureViewport() 的宽高比算一次,隐藏面板里挂载时只能拿到方形兜底值
- 抽出 computeFraming(aspect),ResizeObserver 首次量到非零尺寸后按真实比例重算并复位一次,之后不再覆盖用户的缩放
2026-09-21 15:17:11 +08:00
k88936 f732555a44 为Tripo提交路由补应用级验收用例
- 走真实 build_router 断言两个端点未鉴权一律 401,路径写错或漏 merge 会退化成 404

- 断言缺 Idempotency-Key 在解析之后、组合校验与定价之前返回 400

- 断言贴图档位冲突与定价必填字段缺失都在定价与 provider 副作用之前返回 400 并定位字段

- 实施计划进展补记该组用例与当前全量测试通过数
2026-09-21 15:16:22 +08:00
k88936 d4af6802fb 补多视图请求契约的全字段往返用例
- 新增全字段往返:钉住 camelCase 字段名、各枚举线上取值与 Option 的可省略写法
- 新增显式 null 往返:确认可选字段回写时仍是 null 而不是整字段消失
- 补用例后字段改名或可空性漂移会被测试拦住,不再是只在 TS 绑定里可见
2026-09-21 15:16:06 +08:00
k88936 294b7461ff 去掉产物下载重试里的不可达panic分支
- download_artifact 原先用 for + last_error + expect 收尾,循环每轮都会 return,expect 实际不可达,却给库留下一条潜在 panic 路径
- 改为 loop 内递增 attempt,重试耗尽时直接返回最后一次错误,重试次数与退避行为不变
2026-09-21 15:15:07 +08:00
k88936 e9af6c0741 脱敏地址保留原始分隔符
- redacted 原先无条件用 ? 拼接脱敏标记,只有 fragment 的地址会被显示成带 query 的样子
- 改为按命中的分隔符原样拼接,日志里能区分 query 与 fragment
2026-09-21 15:14:51 +08:00
k88936 0f8ac57593 拒收带userinfo的产物地址
- TripoUrl::parse 原先只校验 scheme,带 user:password@ 的地址会被 Debug / redacted 原样打进日志
- 解析阶段直接拒绝 userinfo,产物地址不需要凭据
2026-09-21 15:14:07 +08:00
k88936 694a3c6f6c 产物下载前校验任务确实处于完成态
- download_model 与 download_rendered_image 原先只看 output 是否存在,快照字段全公开、status 与 output 可以被人为构造得不一致
- 两个入口统一走 completed_output:先校验 task_id,再要求 status=Completed 且有输出,否则按输出结构错误失败
2026-09-21 15:14:00 +08:00
k88936 6724f8b707 收紧产物文件名对远端扩展名的取值
- filename 直接取远端 URL 末段扩展名,path_segments 已百分号解码,%2F / %5C 会拼出跨目录路径
- 扩展名只接受长度不超过 10 的 ASCII 字母数字,其余一律退回 glb
2026-09-21 15:13:15 +08:00
k88936 03d5cde838 统一模型字节读取失败的报错口径
- response.arrayBuffer() 原先在 fetch 的 try/catch 之外,读到一半失败会直接抛出底层 DOMException
- 改为包一层并把失败归一成 Model3dViewerLoadError 的 load-failed,与其它加载失败路径一致
2026-09-21 15:11:30 +08:00
k88936 a87e19444b 修复模型查看器环境贴图失败时的显存泄漏
- RoomEnvironment 建好之后若 PMREM 生成失败,原先只把引用置空,它的几何与贴图不会释放
- 失败分支改为先释放已建出的 RoomEnvironment,再释放可能已建出的 PMREMGenerator
2026-09-21 15:11:25 +08:00
k88936 ae426df240 修复模型查看器自动旋转状态可能停在旧值
- 场景创建使用 effect 开始时的 autoRotateRef.current,加载期间 prop 变化时 setAutoRotate 的 effect 因 sceneRef 为空被丢弃
- 场景就绪后按最新的 autoRotateRef.current 重新同步一次,避免旋转状态与 prop 不一致
2026-09-21 15:11:20 +08:00
k88936 33cd943ff9 长度与范围越界改用独立校验原因
- TripoValidationReason 新增 OutOfRange,与「参数组合互斥」不再共用 InvalidCombination
- prompt 超 1024 字符、negative_prompt 超 255 字符改报 OutOfRange
- face_limit 越界属同一类范围错误,一并改报 OutOfRange,调用方可按原因分流
2026-09-21 15:11:12 +08:00
k88936 7193bd28c2 多视图可选视图去掉首尾空白再提交provider
- optional_view 先用 trim 判空、再把未 trim 的原串交给 FileInput,两侧口径不一致
- 改为提交前 trim,空白视图仍按未提供处理
2026-09-21 15:10:49 +08:00
k88936 e8467c2870 多视图前视图去掉首尾空白再提交provider
- front 只按 trim 后判空,但先前把未 trim 的原串交给 FileInput,带空白的取值会被原样发出
- 改为提交前 trim,与 image_to_model 的输入口径一致
2026-09-21 15:10:24 +08:00
k88936 0982b952cb 收敛Tripo三入口重复的extra字段构造
- 新增 common/extra.rs 统一构造 texture_version 与 delight 的 SDK extra 字段,键名只留一份
- text_to_model 与 image_to_model 删除各自的 extra_fields 副本,改调公共实现
- multiview_to_model 的内联 extra.insert 也改为复用同一构造
- 未提供的参数仍不写入 extra,请求体行为与原先一致
2026-09-21 15:08:50 +08:00
k88936 eb4256f883 图生3D图片引用改为提交时定点预检
- image_source 拆成预检与执行两条路径,预检只做归属、记录类型与对象键校验,不读正文也不调用 provider

- 定点解析改用既有 resolve_editor_reference_record_by_id_for_owner,取代列工程与读素材库的宽查询

- image-to-model 路由在扣费与入队前调用预检,跨 owner、未登记、已删除与 kind 不符统一返回 400

- editor_project 把定点引用查询暴露为 crate 内可见,供生成入口复用

- 新增源码钉住用例,防止预检退回宽查询或提前读图片正文
2026-09-21 15:08:46 +08:00
k88936 63c924dba0 补记Tripo图生3D图片引用提交预检口径
- 主规范明确图片引用解析分两步:提交时只做元数据预检,worker 执行时重新确认同一事实

- 主规范新增第 5 条验收标准,验收清单顺延至 12 条,里程碑同步引用范围

- 实施计划把图片输入预检写进固定执行顺序,并记录已改用定点引用查询取代宽查询

- 决策记录新增条目:站内引用禁止在提交路径读正文、调 provider 或列全量工程与素材库
2026-09-21 15:08:01 +08:00
k88936 02ef84d9b6 清理Tripo3D新代码的死代码与无意义断言
- 删除 job.rs 中无调用的 is_model3d_job_kind、source_entity_id 与本地 target_source_entity_id

- 删除 artifacts.rs 中未被引用的 map_artifact_error 及其 TripoError 导入

- 删除未被引用的 MODEL3D_JOB_MAX_ATTEMPTS 与只被同文件测试断言的 queue source module 常量

- 删除对常量自身取值的恒真断言测试
2026-09-21 14:45:04 +08:00
k88936 8a828a43ba 同步Tripo 3D生成的图片输入与完成结果口径
- 主规范明确图片输入先读字节再上传换 file_token,不把带签名的临时地址交给第三方
- 主规范补完成结果读取口径:由既有任务查询的 result 字段返回,标准消费者仅透传调用方显式给出的 result
- 实施计划把图片输入步骤改写为 file_token 口径,文件表补 storage.rs
- 实施计划新增进展一节,写清已落地步骤、未确认的定价数值与尚未跑通的真实端到端
- 风险一节补 worker 并发位与长任务超时的运维前提
2026-09-21 14:38:20 +08:00
k88936 29e554a30c 新增api-server Tripo3D worker执行链路与结果落库
- 新增 artifacts/result/worker 三个文件:产物读取、严格结果构造与 at-most-once submit 执行链路
- 没有 checkpoint 才 submit;submit 成功后先落 checkpoint 再轮询,checkpoint 写入失败按终态失败,不退回可重试队列
- 模型与预览图分别写入 OSS 并按 operation 稳定 ID 登记 asset_object,预览对象单独登记以便按对象键解析归属
- 落点按 target 分支写入项目资源或账号素材,imageSrc 与 thumbnailSrc 指向预览图,模型本体留在 objectKey
- 画布回填只走 placement-only;新增只依赖资源身份与尺寸的占位条目构造函数供 3D 复用
- 标准消费者的队列结果透传调用方显式给出的 result,使 3D 完成结果可从既有任务查询返回
- external_generation_worker 增加两个 job kind 分支并纳入长任务超时,用户可见失败文案收敛为稳定文本
2026-09-21 14:36:59 +08:00
k88936 ac08ccbe39 修正spacetime-client checkpoint facade的落点
- facade 方法补进真正参与编译的 active/external_generation.rs,此前误写在未被编译的重复文件里
- mapper 重新导出 ExternalGenerationJobProviderCheckpointRecordInput,调用方无需从子模块路径引用
- 删除未被编译的 src/external_generation.rs 重复副本,避免再次改到死文件
2026-09-21 14:33:51 +08:00
k88936 e809cdd850 新增api-server Tripo3D图片输入解析与产物对象写入
- editor_project 暴露按注册 ID 定点解析资源与素材对象键的入口,只认本账号已登记记录
- image_source 把站内引用解析成对象键后读字节并上传 provider 换 file_token,不把签名地址交给第三方
- storage 负责产物 PUT、HEAD 复核与 asset_object 登记,模型与预览图共用同一条链路
- asset_object ID 使用 operation 稳定派生值,避免被生成结果事务的白名单校验拒绝
- 完整字节写入路径留 TODO,等待 platform-oss 提供流式上传
2026-09-21 14:24:41 +08:00
k88936 a8799adf5d platform-tripo支持图片上传与预览图下载
- 产物下载类型改名为 TripoDownloadedArtifact,模型与预览图共用同一条流式读取路径
- 新增 download_rendered_image,读取 task 结果里的预览图地址
- 新增 upload_image,把图片字节上传 provider 换 file_token
- 图片输入收敛为 TripoImageInput 枚举,只有 file_token 与公网地址两种形态,不再接受裸字符串
- smoke 示例跟随新的图片输入类型
2026-09-21 14:06:47 +08:00
k88936 4edeadae7d 登记Tripo 3D的生成结果operation_kind白名单
- SpacetimeDB storage 的编辑器生成白名单加入 model3d_text_to_model 与 model3d_image_to_model
- 白名单是原子落库的 operation_kind 门禁,未登记会让整笔结果事务被拒
- api-server 侧按源码钉住两个 job kind 已在白名单内,避免只在运行期才发现
2026-09-21 14:02:58 +08:00
k88936 931be509f1 补记Tripo model3d的assetKind接入清单对照
- 主规范新增 assetKind 接入清单对照表,逐行登记后端-only 类别的触碰点口径
- 主规范明确原子落库 operation_kind 白名单必须新增两个 Tripo job kind,画布回填只走 placement-only
- 主规范登记用户标签覆盖、快速编辑与改造 capability 三项结论均为不进入,并写明后续接前端需重评
- 实施计划把 provider 配置文件行更正为 provider.rs,并在产物落库步骤补白名单与 placement 口径验收
- 后端架构文档补充说明:不走编辑器前端的生成类别同样适用清单,不能靠无前端入口跳过
2026-09-21 13:59:53 +08:00
k88936 dd8f48bad9 新增api-server Tripo3D提交路由与入队
- tripo3d 目录按 job 身份、provider 配置、错误映射、入队与路由拆分小文件
- 两个内部路由要求 Bearer 与 Idempotency-Key,顺序固定为解析、组合校验、查价、入队
- 入队复用编辑器生成队列的幂等 dedupe key,同键同请求返回原 operation,同键不同请求 409
- Tripo job 走既有 editor-canvas 来源与单次尝试口径,不新建队列、不新增状态
- 提交响应返回 operation、job kind 与既有任务查询状态地址,不暴露 provider 信息
- 补齐 ExternalGenerationJobRecord 测试夹具新增的 checkpoint 字段
2026-09-21 13:46:41 +08:00
k88936 d012392779 api-server 增加 Tripo 生成的环境配置
- AppConfig 新增 tripo_base_url / tripo_api_key / 请求超时 / 重试四个字段
- 默认网关指向 Tripo 官方 v3 地址,可由 TRIPO_BASE_URL 覆盖
- 环境变量沿用 provider 示例的 TRIPO_* 口径,API Key 缺省为空
- 默认值断言补进配置测试
2026-09-21 13:23:18 +08:00
k88936 2182b075b8 新增Tripo生成Worker执行链路实施计划
- 固定 api-server 侧 tripo3d 目录的文件切分与各文件职责
- 明确提交路由执行顺序、幂等口径与图片输入解析边界
- 记录 Tripo job 固定 max_attempts=1 与 checkpoint 收口语义
- 里程碑二转 active 并回链实施计划,里程碑一补实施计划入口
2026-09-21 13:17:24 +08:00
k88936 a11fd709fa 同步external_generation_job表目录的provider checkpoint口径
- 补记 provider_kind 与 provider_task_id 的追加字段、租约栅栏与禁止覆盖语义
- 说明 checkpoint 不进 payload、read model、BFF 响应与公开契约
- 事件表目录补充 provider_checkpoint 事件
2026-09-21 13:11:06 +08:00
k88936 aa1a1a63ed spacetime-client 暴露 provider checkpoint 写入入口
- 重新生成 module bindings,新增 checkpoint procedure 与输入类型、表行与快照投影
- mapper 增加 checkpoint 记录输入与到绑定输入的转换,快照映射补两个新字段
- facade 新增 set_external_generation_job_provider_checkpoint,复用 procedure 结果映射
- facade 注释说明已有 checkpoint 被拒是 at-most-once submit 保证,写入失败按失败处理
2026-09-21 13:10:11 +08:00
k88936 09ea0a5e76 新增external_generation_job的provider任务checkpoint
- provider_kind 与 provider_task_id 追加在表末尾,带显式默认值,旧行迁移时补 NULL
- 新增 set_external_generation_job_provider_checkpoint_and_return procedure,复用 running 租约栅栏
- 已有 checkpoint 时禁止覆盖并留下 provider_checkpoint 事件,作为 at-most-once submit 的数据层保证
- 快照与兼容快照同步投影两个新字段,轻量摘要按无 checkpoint 返回
- 增加 checkpoint 不可覆盖的不变量单测
2026-09-21 13:02:52 +08:00
k88936 36036eed7b 修正Tripo定价文档口径为 fail-closed 与无单位
- 主规范去掉 model3d 段的 unit 字段,3D 恒为按次计价
- 主规范把加载即校验改为段存在时必须全键,并补充段缺失即拒绝提交
- 契约里程碑验收第 6 条同步为段缺失 fail-closed
- 实施计划把定价步骤指向 api-server/src/tripo3d/pricing.rs
2026-09-21 13:00:45 +08:00
k88936 e105e34f83 新增Tripo生成请求的平台组合校验
- 价格相关参数必须显式给出,texture 与 textureQuality、pbr 不能互相矛盾
- 目标落点与图片引用的 ID 不能为空白
- provider 能力组合规则复用 platform-tripo 预检,不维护第二份
- 校验结果直接产出定价输入,路由在扣费与 provider 调用前执行
- api-server 依赖 platform-tripo
2026-09-21 12:53:22 +08:00
k88936 8f6458ffe2 新增api-server Tripo3D模块与泥点定价结构
- 新增 tripo3d/pricing.rs,底价按 endpoint × 模型版本 × 是否有贴图,add-on 按固定键表叠加
- 定价段加载即校验全部底价与 add-on 键,缺键即配置非法;缺段代表未配置,查价直接拒绝
- editor_generation_config 挂载可选 model3d 段并提供 fail-closed 查价入口
- 后台记录形状尚不支持 3D 段,暂由文件配置提供并留下同步待办
- model_version 增加 ALL 与排序,供定价表枚举校验
2026-09-21 12:53:02 +08:00
k88936 f90e114bcb 生成目录化的Tripo API与画布TS绑定
- 生成模型输入、结果落点、产物元数据与按端点的结果类型到 packages/shared/src/contracts/model3d 子目录
- 新增 editor-canvas 生成目录,画布占位载荷不再依赖手写 TS
- 更新 model3d 导出索引,移除已删除的占位作业类型
- contracts:model3d:generate 生成后自动跑 prettier
2026-09-21 12:39:33 +08:00
k88936 7790a181c4 provider按参数分层并公开组合校验入口
- submit 改为接收生成参数,图片输入由调用方解析后单独传入
- 公开 validate_text_to_model_params / validate_image_to_model_params 供平台层在副作用前预检
- 参数到 provider 校验选项的映射收敛为 From 实现,去掉重复拼装
- smoke 示例跟随新签名
2026-09-21 12:39:20 +08:00
k88936 e0108f7d57 分层Tripo生成的provider参数与平台API请求契约
- common 新增 Model3dGenerationSource、Model3dGenerationTarget、Model3dGenerationTargetRef 与产物元数据
- text/image 各自的参数类型独立成 params,API 请求为 generation + 平台字段 + target
- 图片输入只接受站内引用,input 由服务端解析后注入 provider
- 删除宽松的作业与结果占位 DTO,改为按端点的严格结果与端点 tagged enum
- 新增契约严格性测试,覆盖分支必填字段、图片输入歧义与顶层未知字段
2026-09-21 12:38:46 +08:00
k88936 93306952d9 把画布占位载荷移出受feature门控的assets模块
- 新增 shared-contracts::editor_canvas,承载画布占位与回填载荷并接入 ts-rs 生成
- assets 模块改为内部引用该类型,不再自带定义
- api-server 七处引用改到新模块路径
2026-09-21 12:38:28 +08:00
k88936 ddf8e2c213 同步Tripo生成API的文档索引与领域术语
- docs/README 增加主规范与 ADR 入口
- CONTEXT.md 补充 3D 模型生成操作、provider task、Tripo API facade 等术语
- provider 专题把应用层接入指向新主规范
- 文档生命周期索引改为指向活动计划目录
2026-09-21 12:29:40 +08:00
k88936 6db1079610 新增Tripo生成API的里程碑规范与实施计划
- 新增契约与数据模型里程碑,锁定范围、不做项与验收标准
- 新增 Worker 执行链路与 API 路由里程碑,标注 pending 与定价前置依赖
- 新增契约里程碑实施计划,固定步骤顺序、验证命令与回退范围
2026-09-21 12:29:29 +08:00
k88936 699f321651 新增Tripo生成API集成主规范与决策记录
- 新增主规范,固定两个端点的请求、异步执行、结果持久化与泥点扣费合同
- 新增 ADR 0002,记录不复用 Hyper3D、at-most-once submit、提交时定价与落库失败退款
2026-09-21 12:29:08 +08:00
k88936 49b6451548 补充Tripo下载器迁移待办
记录Provider侧流式下载与第三方SDK保持原样的边界

增加等待上游SDK原生stream能力后的替换TODO
2026-09-19 23:16:02 +08:00
k88936 188614d5d2 改用Provider流式下载Tripo产物
保持第三方SDK不变并在Provider侧读取签名模型URL

逐块暴露模型响应并校验Content-Length,smoke示例改为异步落盘

为未来SDK原生stream能力保留迁移TODO
2026-09-19 23:14:00 +08:00
k88936 4c7fd968dd 明确Tripo模型流式下载边界
记录SDK与Provider只提供分块模型下载流

约定未来OSS上传直接消费数据流而不缓存完整模型
2026-09-19 22:20:23 +08:00
k88936 c48f0627cf 修复 ts-rs 对 enum 级 deny_unknown_fields 的解析告警并保留契约严格性
- 把 server-rs 与 apps/ai-game-creator-shell/src-tauri 两个 workspace 的 ts-rs 从 registry 固定到上游修复 commit fd8679ef20f866f747c046b30bd29c15e3d7a003(PR #491:已发布版 12.0.1 的 EnumAttr 不识别 deny_unknown_fields,只有 StructAttr 会静默忽略它),两个 Cargo.lock 同步改成 git 源
- 说明固定原因与退出条件:crates.io 最新仍是 12.0.1、GitHub 最新 tag 仍是 v12.0.0,等发布 > 12.0.1 后改回 registry 版本并删除 commit 固定
- 明确不使用 ts-rs 的 no-serde-warnings feature 消警:它会连同 deserialize_with 这类真实未支持的 serde 属性一起静默,掩盖 Rust 与 TS 绑定的漂移
- 保留 shared-contracts 的 Model3dMultiviewInputs enum 级 deny_unknown_fields(该属性一直由 serde 生效,告警只来自 ts-rs 的属性解析),注释改为写明不要为消警删属性、也不要改用 no-serde-warnings
- 新增契约测试 tests/model3d_multiview_request_contract.rs:钉住 views/taskId 变体内部与请求体顶层拒绝未知字段,并覆盖 kind 与 camelCase 字段名解析
- 记录排障经验与决策:pitfalls.md 说明无 span 的告警不代表属性失效,decision-log.md 记录固定 commit、影响面与回退条件
- 验证:cargo check -p shared-contracts 与该 crate 的 cargo test 不再出现 deny_unknown_fields 告警且全绿;cargo test --locked -p shared-contracts model3d 加 prettier 后 packages/shared 的 model3d 绑定零 diff;AGC 的 cargo check --locked --bin genarrative-ai-game-creator-shell 不再出现该告警(AGC 侧仍保留 1 条既有的 deserialize_with 告警,与本改动无关);npm run check:encoding、npm run check:doc-index、git diff --check、cargo fmt --all --check 通过
2026-09-19 16:56:24 +08:00
k88936 092bca7444 更新Tripo 3D模型Provider集成文档覆盖三个生成入口
文档改名为「Tripo 3D模型Provider集成」,H1 同步去掉“文本到”前缀,并更新 docs/README.md 链接
目标段改为三个入口共用 TripoProviderClient,列明 submit / submit_image_to_model / submit_multiview_to_model
新增「三个入口的输入」小节,记录 prompt 长度上限、image input 裸字符串引用、multiview views 与 taskId 二选一及视图数量要求
新增「任务查询与下载」小节,记录 TripoTaskSnapshot、TripoDownloadedModel 与必须重复取 task 的原因
补充契约分层说明:产品级结果契约目前只服务 text-to-model,image 与 multiview 结果仍在 provider 层
非目标标注前端查看器由 packages/model3d-viewer 独立实现、本阶段不接 UI 链路,验收补上输入校验与 smoke 行为
2026-09-19 16:19:05 +08:00
k88936 b0054fd51c 新增 3D 模型查看器独立包
- 新增 packages/model3d-viewer(@genarrative/model3d-viewer),含 Model3DViewer、scene、loader、framing、status 与 index
- 组件只走 WebGL2 单一路径渲染 glb、单文件 gltf 与 fbx,未承诺格式或超过 32 MiB 时只渲染一行状态文案
- 取景按真实顶点做投影拟合,与模型尺度无关,复位回到打开时的取景
- 新增 framing 与 loader 的纯函数单测
- 根 package.json 的 workspaces 增加 packages/model3d-viewer
- scripts/check-npm-workspaces.mjs 与 scripts/check-npm-workspaces.test.mjs 同步工作区清单
- vitest.config.ts 增加新包测试匹配
- 同步 package-lock.json 的工作区链接
2026-09-19 16:13:55 +08:00
k88936 0c4b1c34d9 标注模型下载的重复 task 查询
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Successful in 7m17s
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Successful in 7m19s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Successful in 7m31s
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Successful in 7m39s
Project CI / Backend tests (pull_request) Failing after 10s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m3s
Project CI / Repository checks (pull_request) Failing after 10s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m36s
Project CI / Native shell tests (pull_request) Failing after 11m43s
Project CI / AI game creator shell web tests (pull_request) Failing after 10m21s
Project CI / Frontend tests (pull_request) Successful in 12m23s
在 download_model 增加 TODO,说明 SDK 只提供 download_model(&Task) 因而必须再取一次 task

若将来 SDK 支持按 URL 下载,可直接使用 snapshot 中的模型 URL 省掉这次请求
2026-09-19 14:17:31 +08:00
k88936 3c1059aa39 移除 TripoUrl 的 Display 实现
删除 TripoUrl 的 Display,避免 `{}` 这类通用格式化输出带签名的完整 URL

完整 URL 仍可通过 as_str() 显式读取,日志与调试统一走 redacted() 或脱敏后的 Debug

技术方案文档补充该收敛说明
2026-09-19 14:17:00 +08:00
k88936 1392303f1c 请求契约把 model 改为必填字段
三个生成请求的 model 由 Option<Model3dModelVersion> 改为必填 Model3dModelVersion,并同步重新生成 TypeScript 绑定

validate_generation_options 不再重复校验 model 缺失,直接由必填的 model 推导 family

三个 client 的 to_sdk_params 改为直接提交模型版本字符串

冒烟示例与技术方案文档同步为必填写法
2026-09-19 14:16:39 +08:00
k88936 12512f26b2 multiview 输入拒绝未知字段
Model3dMultiviewInputs 增加 deny_unknown_fields,与 Model3dMultiviewToModelRequest 的严格反序列化保持一致

未知视图键(例如拼写错误的 righ)不再被静默丢弃,避免用少于调用方预期的视图提交任务

ts-rs 12 不支持 enum 级该属性,构建时会打印一条可忽略的告警,已在代码注释说明
2026-09-19 14:14:55 +08:00
k88936 800da43a8d 说明生成结果 DTO 的 number 精度边界
为 poll_after_ms、updated_at_micros、size_bytes 补充注释,说明其量级远低于 2^53,按 TS number 导出即可精确表示

重新生成 TypeScript 绑定,把上述说明同步为 JSDoc

技术方案补充同一说明,明确不做 bigint/string 特殊处理
2026-09-19 14:14:14 +08:00
k88936 b703f0c374 同步Tripo集成文档的契约导出与脱敏说明
补充 TripoUrl 脱敏输出与 as_str 读取完整 URL 的说明

补充请求可选字段在 TypeScript 绑定中为 field?: T | null 及 model3d barrel 导出入口

补充 ts-rs 生成后需 prettier 格式化再提交的流程说明
2026-09-19 13:17:58 +08:00
k88936 b87d9358e5 对齐 Api 与 Request 的可重试状态码
TripoError::is_retryable 的 Api 分支补充 408 与 425,与 Request 分支的可重试集合保持一致
2026-09-19 13:15:31 +08:00
k88936 f4996d7ac2 auto_size 仅在显式开启时按模型能力拦截
validate_generation_options 中 auto_size 的 H25 校验由 is_some() 改为 == Some(true)

auto_size: false 不再被当作启用,与 quad、smart_low_poly、generate_parts 的取值语义保持一致
2026-09-19 13:15:00 +08:00
k88936 09ef92420f multiview 复用统一的 task_id 校验
删除 submit_multiview_to_model 中重复的空白判断,改为调用 common::validate_task_id

task_id 非法时的错误字段由 Inputs 改为更精确的 TaskId,与 get_task、download_model 保持一致
2026-09-19 13:14:32 +08:00
k88936 091938ed59 multiview 提交前裁剪 task_id
to_sdk_params 改为提交 task_id.trim(),与 task_id.trim().is_empty() 的校验使用同一份标准化输入

带前后空白的 task_id 不再原样转发给 Provider
2026-09-19 13:13:54 +08:00
k88936 ddb8b9e8ba multiview 空白视图按未提供处理
to_sdk_params 新增 optional_view,将仅含空白的 left、back、right 归一化为未提供

空白视图不再以 Some(FileInput) 形式提交,与提交前“至少两个视图”的校验保持一致
2026-09-19 13:13:35 +08:00
k88936 230e4d49f2 image_to_model 提交前统一使用裁剪后的输入
to_sdk_params 改为传入 request.input.trim(),与提交前的空值校验使用同一份标准化输入

带前后空白的输入不再原样转发给 Provider
2026-09-19 13:12:50 +08:00
k88936 6c209b115a 冒烟示例在任务未完成时跳过下载并继续后续入口
轮询改用 throw_on_failure=false,失败终态交回示例按 status 判定而不是直接返回错误

非 Completed 的任务打印 status 与 failure 后 continue,避免一个入口失败中断其余入口的冒烟
2026-09-19 13:12:23 +08:00
k88936 b631125a16 冒烟示例不再输出完整下载地址
产物行改用 TripoUrl::redacted(),避免把带签名的下载 URL 写入标准输出
2026-09-19 13:07:41 +08:00
k88936 771ff88440 脱敏 TripoUrl 的 Debug 输出
为 TripoUrl 手写 Debug 实现,改用隐藏 query 与 fragment 的脱敏形式

新增 TripoUrl::redacted 提供日志用脱敏 URL,完整 URL 仍由 as_str 显式读取

TripoTaskSnapshot、TripoTaskOutput、TripoDownloadedModel 的调试输出随之不再暴露带签名的下载地址
2026-09-19 13:07:41 +08:00
k88936 950209f038 为 model3d 请求契约的可选字段补充 ts(optional)
为 image_to_model、multiview_to_model、text_to_model 三个请求的可选字段添加 ts(optional = nullable)

multiview 视图分支的 left、back、right 同步标记为可选

重新生成 packages/shared/src/contracts/model3d 下的 TypeScript 绑定,使 TS 侧可按 serde 语义省略字段
2026-09-19 13:07:41 +08:00
k88936 42a5929a73 清理 model3d 请求契约中冗余的 serde(default)
移除 image_to_model、multiview_to_model、text_to_model 三个请求结构体 Option 字段上的 serde(default)

同步移除 multiview 视图分支中三个可选视图的 serde(default)

serde 对 Option 字段本身即按 None 处理缺失字段,生成的 TypeScript 绑定保持不变
2026-09-19 13:07:41 +08:00
k88936 eda9da4d8d 单点维护 model3d 的 ts-rs 导出根目录
在 model3d/mod.rs 新增 model3d_ts_export_dir 宏,集中定义仓库相对导出根路径

common、image_to_model、multiview_to_model、text_to_model 改为调用宏并只声明各自子目录名
2026-09-19 13:07:41 +08:00
k88936 35be25dbd6 补齐 model3d 契约在 packages/shared 的导出入口
新增 packages/shared/src/contracts/model3d/index.ts 聚合 ts-rs 生成的 3D 生成契约类型

contracts/index.ts 增加 export type * from './model3d'

src/index.ts 增加 export type * from './contracts/model3d'
2026-09-19 13:02:01 +08:00
k88936 da9ee65119 记录Tripo真实冒烟结果结构
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Successful in 7m41s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Successful in 7m48s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Successful in 7m50s
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Successful in 8m0s
Project CI / Backend tests (pull_request) Failing after 11s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m17s
Project CI / Repository checks (pull_request) Failing after 10s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m29s
Project CI / Frontend tests (pull_request) Successful in 14m49s
Project CI / AI game creator shell web tests (pull_request) Failing after 18m48s
Project CI / Native shell tests (pull_request) Failing after 27m31s
保留三个生成入口的脱敏真实结果形状与下载产物信息

使用实际可访问的 Rustacean 图片完成 image 与 multiview 示例

同步严格 endpoint 结果契约和真实 Provider 验收文档
2026-09-18 21:42:17 +08:00
k88936 527706b84e 按接口收紧Tripo任务结果类型
为 text、image、multiview 三类生成定义独立必填结果结构

以枚举关联任务类型与具体结果并对缺失字段失败关闭

将通用 URL 类型由 TripoModelUrl 更名为 TripoUrl
2026-09-18 21:37:38 +08:00
k88936 a4beb53dc6 完善Tripo冒烟CLI产物流程
等待三类生成任务完成并打印映射后的输出

完成后下载模型产物到当前目录并输出文件信息

仅在示例内部使用SDK轮询器,不扩展平台公共接口
2026-09-18 18:51:49 +08:00
k88936 25314d9a4a 新增Tripo三类生成冒烟CLI
增加仅通过环境变量配置的 Tripo generation example

顺序提交 text、image、multiview 三类任务并执行单次状态查询

保持无命令行参数且不调用 SDK 轮询接口
2026-09-18 18:42:58 +08:00
k88936 5be4a51ac1 完善Tripo枚举与参数组合校验
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Successful in 7m19s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Successful in 7m22s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Successful in 7m26s
Project CI / Backend tests (pull_request) Failing after 11s
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Successful in 7m38s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m1s
Project CI / Repository checks (pull_request) Failing after 15s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m54s
Project CI / Native shell tests (pull_request) Failing after 3m5s
Project CI / AI game creator shell web tests (pull_request) Failing after 2m13s
Project CI / Frontend tests (pull_request) Successful in 5m44s
按提供的 Tripo 文档补齐 compression、texture quality 与 texture version 枚举

移除未在三个生成接口出现的 style 占位字段并同步 Rust/TypeScript contracts

增加模型版本、纹理版本、生成部件、quad、smart-low-poly 与 face limit 的副作用前校验

同步 Provider 技术方案和 ADR
2026-09-18 17:23:55 +08:00
k88936 37b355a814 接入Tripo三类3D生成Provider
加入固定 revision 的 tripo-rust-sdk 与 platform-tripo workspace crate

实现 text-to-model、image-to-model、multiview-to-model 提交、通用任务查询和显式模型下载

抽取通用任务类型、状态映射、输出 URL 校验与 SDK 错误归一,保持 wait_for_task 不对外暴露

同步 Provider 边界文档并暂不接入 api-server
2026-09-18 16:02:13 +08:00
k88936 1c4009ea3b 建立3D生成目录化契约
新增 model3d common、text-to-model、image-to-model、multiview-to-model Rust contracts

通过 ts-rs 按目录生成 TypeScript bindings,移除依赖 barrel 的组织方式

增加 model3d contracts 定向生成脚本
2026-09-18 15:59:19 +08:00
512 changed files with 26650 additions and 40166 deletions
+2 -6
View File
@@ -237,14 +237,10 @@ GENARRATIVE_ENABLE_IMAGE_EDITOR_AGENT_SIDEBAR="false"
# 官网客户端下载检测渠道:dev、release 或自定义渠道;修改后重启 API 服务。
# Windows/macOS 是系统维度,不填写 dev-win/dev-mac。
# 客户端埋点也复用该渠道:dev 对应 https://dev.genarrative.worldrelease 对应 https://www.genarrative.world。
# 埋点不接受其它渠道;本地 dev 且 GENARRATIVE_ENV 为 development(默认)/test/container 时允许 loopback 地址及可变端口。
GENARRATIVE_CLIENT_DOWNLOAD_CHANNEL="dev"
# 客户端埋点接收绑定的公开 origin,由 API Server 运行时读取;修改后重启服务。
# 必须与客户端登录地址一致,不带 /api、路径或尾部斜杠;未配置/非法时上传接口返回 503。
# 本地端口按实际启动结果填写(端口漂移后需同步),localhost 与 127.0.0.1 不可混用。
# dev 使用 https://dev.genarrative.worldrelease 使用 https://www.genarrative.world。
GENARRATIVE_AGC_ANALYTICS_ORIGIN="http://127.0.0.1:8082"
# Optional: official VikingDB credentials for regenerating build-tag similarities
# with the Python embedding script. The script auto-loads `.env.local` and uses
# the fixed `bge-large-zh` embedding model.
+13
View File
@@ -88,3 +88,16 @@ nohup.out
spacetime.local.json
deploy/container/api-server.env
deploy/container/worker-smoke/
# 仓库根目录下手工下载的 3D 样例模型(Tripo 联调 / 查看器排查用),不入库;
# glTF / FBX 多文件产物会带着 .bin 缓冲与贴图落在同一目录,一并忽略
/*.[gG][lL][bB]
/*.[gG][lL][tT][fF]
/*.[fF][bB][xX]
/*.[bB][iI][nN]
/*.[pP][nN][gG]
/*.[jJ][pP][gG]
/*.[jJ][pP][eE][gG]
/*.[wW][eE][bB][pP]
/*.[kK][tT][xX]2
/*.[tT][gG][aA]
+101
View File
@@ -50,6 +50,86 @@ _Avoid_: 为每个玩法单独发明素材流水线、把系列素材建模成
## Language
### 3D Model Generation
**3D 模型生成操作**:
由文本提示或平台图片引用驱动、可异步查询并最终产生模型文件的 provider-neutral 操作;操作状态和产品资源结果分开建模。
_Avoid_: 直接把第三方 provider task 当作产品资源、把模型 URL 当作永久资源地址
**Provider task**:
第三方 3D 生成平台返回的任务引用与任务快照,只存在于 provider adapter 的 Rust 边界内;它不是 Genarrative 的内部操作 ID。
_Avoid_: 把 Tripo task ID 当作稳定产品 operationId、让 SDK 类型穿透 api-server
**临时 provider URL**:
第三方任务完成后返回的短时模型下载地址,必须通过显式下载流程转换为本地或持久化资源,不能直接当作长期资产地址。
_Avoid_: 永久 OSS URL、资源 ID
**模型 artifact**:
由 text-to-model、image-to-model 或 multiview-to-model 任务产生、待应用层登记和持久化的模型文件结果;provider adapter 只提供可下载结果,不负责生成 resourceId 或 assetId。
_Avoid_: 仅 UI 中展示的模型链接、没有来源任务的静态文件
**Tripo API facade**:
面向站内已认证调用方的全新 Tripo 3D 生成 API 上下文,负责把 API operation、用户归属、异步状态、产物持久化和正式资源引用连接起来;它独立于历史 Hyper3D adapter,不复用其路由、契约或实现。
_Avoid_: 把 Tripo API 当成 Hyper3D 的 provider 替换、让 Hyper3D 路由悄悄切换到 Tripo
**Tripo operation**:
Genarrative 为一次 Tripo 生成请求分配的内部异步操作标识;客户端只看到 operationIdTripo provider task 只作为服务端 checkpoint 保存,二者不是同一个 ID。
_Avoid_: 将 Tripo taskId 直接当公开 operationId、把 SDK task 状态模型穿透到 API
**模型产物持久化**:
Tripo 任务完成后,服务端下载模型与预览、写入受控对象存储并登记资源元数据,成功后才把 Tripo operation 置为 completed;本期按完整字节写入,流式上传是后续目标。
_Avoid_: 返回临时签名 URL作为永久资源、在 API handler 中把完整模型读成 Vec<u8>
**3D 生成底价**:
一次 3D 生成在指定端点和模型版本下、按是否带贴图区分的基准泥点价,不包含任何叠加项,也不随请求的其它参数变化。
_Avoid_: 把底价与加价项合并成一个档位价、把 provider 的 credit 数值当底价
**3D 生成加价项**:
叠加在底价之上、由请求参数判定的可选泥点加价;每个端点各自持有一份加价项价目,同一加价项在不同端点可以是不同价。
_Avoid_: 全局唯一一份加价项价目、按用途而不是按请求参数判定加价
**定价配置归一化**:
读取持久化定价时把它与当前契约对齐的过程:缺的键用受控默认值补齐,契约之外的遗留键剔除并告警;它只发生在读取方向,写入方向仍要求完整合法。
_Avoid_: 把「省略即沿用」当作保存语义、把归一化当成静默改价
**模型生成落点**:
3D 生成结果要进入的平台容器,调用方必须在工程资源与素材库资产之间显式二选一;工程分支可附带画布占位框回填,素材库分支必须给出目录与标签。
_Avoid_: 两个都不给就默认落素材库、把落点混进 provider 请求参数
**模型输入资源引用**:
image-to-model 请求对平台已有图片的明确 tagged 引用,可指向项目资源或素材库资产;服务端负责 owner 校验和 OSS 对象解析,不接受把多种来源塞进裸 `input` 字符串。
_Avoid_: 任意远程 URL、data URL、未区分语义的 resourceId/assetId 字符串
**3D 模型生成工具**:
图片画布工程里从底部工具栏打开、给出「文生 3D 模型」与「图生 3D 模型」两个子项的画布生成工具;提交后按画布既有生成链路的占位框、任务侧栏与失败退款口径推进,产物落成 **3D 模型资源**
_Avoid_: 独立 3D 生成页、把 3D 生成做成玩法类型或作品、把 3D 生成接进画布 Agent 对话
**3D 生成定价**:
3D 模型生成工具在提交前展示的泥点价格,来自编辑器生成定价查询的 `model3d` 段;该段缺失即入口不可提交,前端不内置兜底数值。该段的权威事实源是 SpacetimeDB 定价表里的两段强类型列,公开读取时投影回迁移前的旧形状。
_Avoid_: 前端写死 3D 价格、借用图片模型的兜底定价配置、按 0 元放行、把内部两段结构直接暴露给画布
**定价版本(乐观锁)**:
后台读取完整模型定价时一并拿到的版本号(SpacetimeDB 行的更新时间微秒值),保存时必须原样回传;与服务端当前版本不一致即整笔拒绝并返回 409,提示重新读取,避免静默覆盖他人的改价。
_Avoid_: 在前端自造或缓存该版本、把版本不匹配当成可重试的普通失败、把「省略字段」当成「沿用当前值」
### 3D 模型资源预览
**3D 模型资源**:
类别为 `model3d` 的平台资源 / 素材,一个资源同时持有模型本体与模型预览图两个对象;客户端默认消费预览图,模型本体只在 3D 查看器里加载。
_Avoid_: 只有模型文件的资源、把模型本体当图片素材、为模型新增并列媒体类型
**模型预览图**:
3D 模型资源的静态代表图,落在资源投影的 `imageSrc``thumbnailSrc` 上,供画布卡片、素材缩略图、后台列表和精选卡片使用。
_Avoid_: 用模型本体充当预览、按需实时渲染缩略图、把预览图当模型真相
**模型本体**:
3D 模型资源里的可下载模型文件,只由资源的 `objectKey` 指向,格式以对象内容类型为准。
_Avoid_: 把模型本体当图片地址、用预览图字段承载模型文件、按文件扩展名推断格式
**3D 查看器预览**:
在资源上打开模态把模型本体交给 3D 查看器渲染的只读能力,不修改资源、不产出新资源,也不是画布图层本身的编辑操作。
_Avoid_: 在画布里内联渲染模型、把预览当编辑、为预览产出新资源
### Puzzle Clear
**拼消消**:
@@ -194,6 +274,14 @@ _Avoid_: 进度通知、快照轮询、第二套历史
把项目对话历史条目与运行态事件转换成消息气泡和工具卡片的读取期转换;不持久化,也不构成事实源。
_Avoid_: 投影缓存文件、已脱敏卡片库、第二套 reducer
**项目对话输入**:
AGC 项目对话的输入只有自然语言回合(含 `@` 素材引用与附件);需要动作时由 Runtime 工具与确认卡承接,不从输入文本解析控制词。
_Avoid_: 斜杠命令、聊天命令草稿、命令发现列表
**项目命令 id**:
AGC 运行期工具与项目权限策略使用的稳定标识(`GAME_CREATION_APP_COMMANDS``GameCreationAppPermission`),由 Rust 运行期策略校验与 App 权限审计 / 项目前置条件判定消费,不是用户输入语法。
_Avoid_: 把命令 id 当作可输入的聊天命令、为权限位补聊天入口
**引用候选**:
输入区可以命中的对象集合(`@` 素材、`$` Skill),由宿主按种类注入;输入区不判断候选属于哪一类。
_Avoid_: 输入区自己读项目清单或应用目录、把候选取值写死在组件里
@@ -210,6 +298,18 @@ _Avoid_: 给附件或运行画面区域造候选、为它们保留输入区内
引用在正文文本里的形态(`@显示名` / `$名称` / `@附件名`)及其反解析;出站与解析必须同一口径,token 前后各留一个空白。
_Avoid_: 出站与解析各写一套、在空白边界之外再补兼容别名、让解析依赖具体种类的字段
**引用名**:
引用自己的名字,同时就是它在正文里的 token(资源显示名、Skill 名、附件名);内部不允许出现空白,空白统一经 `normalizeMentionName` 折成 `-`
_Avoid_: 名字与 token 各存一份、靠补兼容别名或 `resourceId` 兜底来消化空白
**引用候选枚举**:
一种引用种类当前就绪的全部可引用对象,与候选菜单共用同一份集合;区别只在没有查询过滤和条数上限。
_Avoid_: 拿菜单查询当枚举、为粘贴另建一份候选清单
**引用粘贴解析**:
把粘贴进来的纯文本按引用文本语法反解析回正文引用;只有身份唯一且逐字确认的 token 才成为引用,其余按原文保留。
_Avoid_: 猜文件名或路径、为不确定的 token 挑一个候选、改写用户粘贴的其余文字
**引用输入区**:
只负责编辑与渲染引用的共享输入组件;候选、身份解析与文本语法都来自注入的 provider,它不持有项目清单、不访问后端。
_Avoid_: 输入区自己拉 Skill 目录、把选择器面板塞在输入区内部
@@ -240,6 +340,7 @@ _Avoid_: 待发送附件列表与正文芯片并存、提交时再拼一遍附
- **引用输入区** 由宿主注入的若干 **引用 provider** 组成;**引用候选** 与 **引用文本语法** 都来自 provider,输入区不判断引用种类。
- **引用选择器** 不属于 **引用输入区**:它自己拿数据,确认后只通过输入区的插入缝交付引用。
- 只有带触发符的 **引用 provider** 会产生候选;**静默 provider** 没有触发符,只能由外部插入或草稿回填进入正文。
- **引用粘贴解析** 与出站显示是同一条 **引用文本语法** 的两端;**静默 provider** 的 token`@附件名` / `@区域标签`)没有候选,因此粘贴时不重建。
- **附件芯片** 是本轮附件的唯一事实源;附件导入失败时不产生芯片。
## Example dialogue
+2 -1
View File
@@ -57,6 +57,7 @@ import type {
AdminUpdateAccountResponse,
AdminUpdateAgcTemplateRequest,
AdminUploadedEditorShowcaseCampaignImage,
AdminUpsertEditorGenerationPricingRequest,
AdminUpsertEditorShowcaseCampaignRequest,
AdminUpsertFeatureGateConfigRequest,
AdminUpsertProfileInviteCodeRequest,
@@ -516,7 +517,7 @@ export function getAdminEditorGenerationPricing(token: string) {
export function upsertAdminEditorGenerationPricing(
token: string,
payload: EditorGenerationPricingConfigPayload,
payload: AdminUpsertEditorGenerationPricingRequest,
) {
return request<EditorGenerationPricingConfigPayload>(
'/admin/api/editor-generation-pricing',
+34
View File
@@ -428,8 +428,42 @@ export interface EditorGenerationModelPricingPayload {
prices?: Record<string, number>;
}
/** 某个 3D 模型版本在「无贴图 / 带贴图」两种形态下的泥点底价。 */
export interface EditorGenerationModel3dVersionPricePayload {
noTexture: number;
texture: number;
}
/**
* 单个 3D 生成端点的整套定价:模型版本底价 + 该端点自己的加价项价目。
*
* 键集合由后端契约决定,后台只改数值:模型版本键与加价项键都直接来自接口返回,
* 不在前端硬编码清单,也不能新增、删除或停用。
*/
export interface EditorGenerationModel3dEndpointPricingPayload {
versionPrices: Record<string, EditorGenerationModel3dVersionPricePayload>;
addOnPrices: Record<string, number>;
}
/** 3D 生成定价段:两个端点并列,各持自己的设置。 */
export interface EditorGenerationModel3dPricingPayload {
textToModelPricing: EditorGenerationModel3dEndpointPricingPayload;
imageToModelPricing: EditorGenerationModel3dEndpointPricingPayload;
}
export interface EditorGenerationPricingConfigPayload {
models: Record<string, EditorGenerationModelPricingPayload>;
/** 后端尚未配置 3D 段时缺省;缺失即 3D 生成不可提交,后台也不能新建整段。 */
model3d?: EditorGenerationModel3dPricingPayload | null;
/** 当前定价版本:保存时原样回传做乐观锁,冲突时后端返回 409。 */
updatedAtMicros: number;
}
/** 后台保存定价的请求体:`models` 与 3D 两段都必须显式给出,外加读取到的定价版本。 */
export interface AdminUpsertEditorGenerationPricingRequest {
models: Record<string, EditorGenerationModelPricingPayload>;
model3d: EditorGenerationModel3dPricingPayload | null;
expectedUpdatedAtMicros: number;
}
export interface AdminEditorAssetListQuery {
@@ -339,7 +339,10 @@ test.each([409, 503])(
await confirmWrite();
const message = await screen.findByRole('alert');
const feedback = message.parentElement!;
expect(document.activeElement).toBe(feedback);
// 聚焦发生在 React passive effect 里(AdminAgcTemplatesPage 的 feedback 聚焦 useEffect),
// 而 findByRole 在 alert 节点一挂上就返回,可能早于该 effect 执行;这里等聚焦落地,
// 避免在 CI 负载下抢跑。断言口径不变:焦点最终必须落在提示区而不是弹窗面板。
await waitFor(() => expect(document.activeElement).toBe(feedback));
expect(feedback.tabIndex).toBe(-1);
expect(focus).toHaveBeenCalledWith({ preventScroll: true });
expect(viewport.scrollTop).toBe(20);
@@ -0,0 +1,136 @@
import type { EditorGenerationModel3dPricingPayload } from '../api/adminApiTypes';
import {
EDITOR_MODEL3D_ENDPOINT_SECTIONS,
editorModel3dAddOnLabel,
parsePositiveInteger,
updateEditorModel3dEndpointPricing,
} from './adminEditorGenerationPricing';
interface AdminEditorGenerationModel3dPricingSectionProps {
model3d: EditorGenerationModel3dPricingPayload;
onChange: (next: EditorGenerationModel3dPricingPayload) => void;
}
/**
* 3D 生成定价区块:按端点分成「文生 3D」与「图生 3D」两组,每组是该端点自己的
* 「模型版本 × {无贴图, 带贴图}」底价表与加价项单值输入。
*
* 键集合全部来自接口返回,后台只能改数值:不能新增、删除键,也不能停用整段。
*/
export function AdminEditorGenerationModel3dPricingSection({
model3d,
onChange,
}: AdminEditorGenerationModel3dPricingSectionProps) {
function updateEndpoint(
section: (typeof EDITOR_MODEL3D_ENDPOINT_SECTIONS)[number]['key'],
updater: Parameters<typeof updateEditorModel3dEndpointPricing>[2],
) {
onChange(updateEditorModel3dEndpointPricing(model3d, section, updater));
}
return (
<section className="admin-panel admin-pricing-model-card">
<div className="admin-pricing-model-heading">
<strong>3D </strong>
<span className="admin-pricing-unit"></span>
</div>
<p className="admin-pricing-model3d-hint">
3D
</p>
<div className="admin-pricing-grid">
{EDITOR_MODEL3D_ENDPOINT_SECTIONS.map(({ key, label }) => (
<section className="admin-panel admin-pricing-model-card" key={key}>
<div className="admin-pricing-model-heading">
<strong>{label}</strong>
</div>
<div className="admin-pricing-model3d-list">
{Object.entries(model3d[key].versionPrices).map(
([version, price]) => (
<div className="admin-pricing-model3d-row" key={version}>
<span className="admin-pricing-model3d-row-label">
{version}
</span>
<label className="admin-field">
<span></span>
<input
aria-label={`${label} ${version} 无贴图`}
min={1}
step={1}
type="number"
value={price.noTexture}
onChange={(event) =>
updateEndpoint(key, (current) => ({
...current,
versionPrices: {
...current.versionPrices,
[version]: {
...price,
noTexture: parsePositiveInteger(
event.target.value,
),
},
},
}))
}
/>
</label>
<label className="admin-field">
<span></span>
<input
aria-label={`${label} ${version} 带贴图`}
min={1}
step={1}
type="number"
value={price.texture}
onChange={(event) =>
updateEndpoint(key, (current) => ({
...current,
versionPrices: {
...current.versionPrices,
[version]: {
...price,
texture: parsePositiveInteger(
event.target.value,
),
},
},
}))
}
/>
</label>
</div>
),
)}
</div>
<div className="admin-form-row">
{Object.entries(model3d[key].addOnPrices).map(
([addOn, price]) => (
<label className="admin-field" key={addOn}>
<span>{editorModel3dAddOnLabel(addOn)}</span>
<input
aria-label={`${label} ${editorModel3dAddOnLabel(addOn)}`}
min={1}
step={1}
type="number"
value={price}
onChange={(event) =>
updateEndpoint(key, (current) => ({
...current,
addOnPrices: {
...current.addOnPrices,
[addOn]: parsePositiveInteger(event.target.value),
},
}))
}
/>
</label>
),
)}
</div>
</section>
))}
</div>
</section>
);
}
@@ -5,20 +5,23 @@ import userEvent from '@testing-library/user-event';
import { beforeEach, expect, test, vi } from 'vitest';
import {
AdminApiError,
getAdminEditorGenerationPricing,
upsertAdminEditorGenerationPricing,
} from '../api/adminApiClient';
import type { EditorGenerationPricingConfigPayload } from '../api/adminApiTypes';
import { AdminEditorGenerationPricingPage } from './AdminEditorGenerationPricingPage';
vi.mock('../api/adminApiClient', () => ({
formatAdminApiError: vi.fn((error: unknown) =>
error instanceof Error ? error.message : '请求失败',
),
getAdminEditorGenerationPricing: vi.fn(),
isAdminApiError: vi.fn(() => false),
upsertAdminEditorGenerationPricing: vi.fn(),
}));
vi.mock('../api/adminApiClient', async () => {
const actual = await vi.importActual<typeof import('../api/adminApiClient')>(
'../api/adminApiClient',
);
return {
...actual,
getAdminEditorGenerationPricing: vi.fn(),
upsertAdminEditorGenerationPricing: vi.fn(),
};
});
const pricing: EditorGenerationPricingConfigPayload = {
models: {
@@ -41,36 +44,80 @@ const pricing: EditorGenerationPricingConfigPayload = {
'audio1.0': { unit: 'perGeneration', price: 5 },
'chirp-v5': { unit: 'perGeneration', price: 12 },
},
model3d: {
textToModelPricing: {
versionPrices: {
'v3.1-20260211': { noTexture: 8, texture: 16 },
'P2-20260801': { noTexture: 80, texture: 88 },
},
addOnPrices: {
hdTexture: 8,
ultraTexture: 16,
quadMesh: 4,
generateParts: 16,
},
},
imageToModelPricing: {
versionPrices: {
'v3.1-20260211': { noTexture: 16, texture: 24 },
'P2-20260801': { noTexture: 80, texture: 88 },
},
addOnPrices: {
hdTexture: 8,
ultraTexture: 16,
quadMesh: 4,
generateParts: 16,
},
},
},
updatedAtMicros: 1_700_000_000_000_000,
};
function savedPricing(
overrides: Partial<EditorGenerationPricingConfigPayload> = {},
) {
return {
...pricing,
updatedAtMicros: pricing.updatedAtMicros + 1,
...overrides,
};
}
beforeEach(() => {
vi.clearAllMocks();
vi.mocked(getAdminEditorGenerationPricing).mockResolvedValue(pricing);
vi.mocked(upsertAdminEditorGenerationPricing).mockResolvedValue({
...pricing,
models: {
...pricing.models,
'gpt-image-2': {
unit: 'perGeneration',
prices: { '1K': 20, '2K': 58 },
vi.mocked(upsertAdminEditorGenerationPricing).mockResolvedValue(
savedPricing({
models: {
...pricing.models,
'gpt-image-2': {
unit: 'perGeneration',
prices: { '1K': 20, '2K': 58 },
},
},
},
});
}),
);
});
test('模型定价后台按模型展示单位并保存尺寸定价', async () => {
const user = userEvent.setup();
async function renderPage() {
render(
<AdminEditorGenerationPricingPage
token="admin-token"
onUnauthorized={vi.fn()}
/>,
);
await screen.findByText('3D 生成定价');
}
test('模型定价后台按模型展示单位并保存尺寸定价', async () => {
const user = userEvent.setup();
await renderPage();
expect((await screen.findAllByText('按次')).length).toBeGreaterThan(0);
expect(screen.getAllByText('按秒').length).toBeGreaterThan(0);
const gptImage2kInput = screen.getByLabelText('gpt-image-2 2K');
fireEvent.change(gptImage2kInput, { target: { value: '58' } });
fireEvent.change(screen.getByLabelText('gpt-image-2 2K'), {
target: { value: '58' },
});
await user.click(screen.getByRole('button', { name: '保存定价' }));
await user.click(screen.getByRole('button', { name: '确认' }));
@@ -90,3 +137,99 @@ test('模型定价后台按模型展示单位并保存尺寸定价', async () =>
);
});
});
test('3D 区块按端点渲染版本底价与加价项,并随保存回传整段与定价版本', async () => {
const user = userEvent.setup();
await renderPage();
expect(screen.getByText('文生 3D')).toBeTruthy();
expect(screen.getByText('图生 3D')).toBeTruthy();
expect(screen.getAllByText('高清贴图').length).toBeGreaterThan(0);
fireEvent.change(screen.getByLabelText('文生 3D v3.1-20260211 带贴图'), {
target: { value: '18' },
});
fireEvent.change(screen.getByLabelText('图生 3D P2-20260801 无贴图'), {
target: { value: '86' },
});
fireEvent.change(screen.getByLabelText('文生 3D 四边形网格'), {
target: { value: '6' },
});
await user.click(screen.getByRole('button', { name: '保存定价' }));
await user.click(screen.getByRole('button', { name: '确认' }));
await waitFor(() => {
expect(upsertAdminEditorGenerationPricing).toHaveBeenCalledWith(
'admin-token',
expect.objectContaining({
expectedUpdatedAtMicros: pricing.updatedAtMicros,
model3d: {
textToModelPricing: expect.objectContaining({
versionPrices: expect.objectContaining({
'v3.1-20260211': { noTexture: 8, texture: 18 },
}),
addOnPrices: expect.objectContaining({ quadMesh: 6 }),
}),
imageToModelPricing: expect.objectContaining({
versionPrices: expect.objectContaining({
'P2-20260801': { noTexture: 86, texture: 88 },
}),
}),
},
}),
);
});
});
test('数值小于 1 时禁用保存并给出中文提示', async () => {
const user = userEvent.setup();
await renderPage();
fireEvent.change(screen.getByLabelText('文生 3D 四边形网格'), {
target: { value: '0' },
});
expect(await screen.findByText(/以下价格必须是不小于 1 的整数/)).toBeTruthy();
const saveButton = screen.getByRole('button', {
name: '保存定价',
}) as HTMLButtonElement;
expect(saveButton.disabled).toBe(true);
await user.click(saveButton);
expect(upsertAdminEditorGenerationPricing).not.toHaveBeenCalled();
});
test('保存遇到 409 时提示重新读取且不覆盖本地改动', async () => {
const user = userEvent.setup();
vi.mocked(upsertAdminEditorGenerationPricing).mockRejectedValue(
new AdminApiError({ message: '定价冲突', status: 409 }),
);
await renderPage();
await user.click(screen.getByRole('button', { name: '保存定价' }));
await user.click(screen.getByRole('button', { name: '确认' }));
expect(
await screen.findByText('定价已被其他人更新,请重新读取后再编辑保存'),
).toBeTruthy();
expect(screen.getByRole('button', { name: '重新读取' })).toBeTruthy();
});
test('后端未配置 3D 段时给出提示并禁止保存', async () => {
vi.mocked(getAdminEditorGenerationPricing).mockResolvedValue({
...pricing,
model3d: null,
});
render(
<AdminEditorGenerationPricingPage
token="admin-token"
onUnauthorized={vi.fn()}
/>,
);
expect(await screen.findByText(/当前部署未配置 3D 定价段/)).toBeTruthy();
expect(
(screen.getByRole('button', { name: '保存定价' }) as HTMLButtonElement)
.disabled,
).toBe(true);
});
@@ -3,14 +3,22 @@ import { FormEvent, useEffect, useState } from 'react';
import {
getAdminEditorGenerationPricing,
isAdminApiError,
upsertAdminEditorGenerationPricing,
} from '../api/adminApiClient';
import type {
EditorGenerationModel3dPricingPayload,
EditorGenerationModelPricingPayload,
EditorGenerationPricingConfigPayload,
EditorGenerationPricingUnitPayload,
} from '../api/adminApiTypes';
import { useAdminWriteConfirm } from '../components/useAdminWriteConfirm';
import { AdminEditorGenerationModel3dPricingSection } from './AdminEditorGenerationModel3dPricingSection';
import {
buildAdminEditorGenerationPricingRequest,
collectInvalidEditorGenerationPricingLabels,
parsePositiveInteger,
} from './adminEditorGenerationPricing';
import { handlePageError } from './pageUtils';
interface AdminEditorGenerationPricingPageProps {
@@ -20,6 +28,8 @@ interface AdminEditorGenerationPricingPageProps {
const emptyPricing: EditorGenerationPricingConfigPayload = {
models: {},
model3d: null,
updatedAtMicros: 0,
};
const unitLabels: Record<EditorGenerationPricingUnitPayload, string> = {
@@ -27,6 +37,9 @@ const unitLabels: Record<EditorGenerationPricingUnitPayload, string> = {
perSecond: '按秒',
};
const PRICING_VERSION_CONFLICT_MESSAGE =
'定价已被其他人更新,请重新读取后再编辑保存';
export function AdminEditorGenerationPricingPage({
token,
onUnauthorized,
@@ -36,6 +49,7 @@ export function AdminEditorGenerationPricingPage({
const [isLoading, setIsLoading] = useState(false);
const [isSaving, setIsSaving] = useState(false);
const [errorMessage, setErrorMessage] = useState('');
const [isPricingVersionStale, setIsPricingVersionStale] = useState(false);
const { confirmWrite, confirmDialog } = useAdminWriteConfirm();
useEffect(() => {
@@ -46,6 +60,7 @@ export function AdminEditorGenerationPricingPage({
async function refreshPricing() {
setIsLoading(true);
setErrorMessage('');
setIsPricingVersionStale(false);
try {
setPricing(await getAdminEditorGenerationPricing(token));
} catch (error: unknown) {
@@ -57,10 +72,11 @@ export function AdminEditorGenerationPricingPage({
async function handleSave(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
if (isSaving) {
if (isSaving || !canSave) {
return;
}
setErrorMessage('');
setIsPricingVersionStale(false);
const confirmed = await confirmWrite({
action: '保存模型定价',
target: '图片画布生成',
@@ -71,8 +87,18 @@ export function AdminEditorGenerationPricingPage({
setIsSaving(true);
try {
setPricing(await upsertAdminEditorGenerationPricing(token, pricing));
setPricing(
await upsertAdminEditorGenerationPricing(
token,
buildAdminEditorGenerationPricingRequest(pricing),
),
);
} catch (error: unknown) {
if (isAdminApiError(error) && error.status === 409) {
setErrorMessage(PRICING_VERSION_CONFLICT_MESSAGE);
setIsPricingVersionStale(true);
return;
}
handlePageError(error, onUnauthorized, setErrorMessage);
} finally {
setIsSaving(false);
@@ -120,6 +146,15 @@ export function AdminEditorGenerationPricingPage({
});
}
function updateModel3dPrice(next: EditorGenerationModel3dPricingPayload) {
setPricing((current) => ({ ...current, model3d: next }));
}
const invalidPriceLabels =
collectInvalidEditorGenerationPricingLabels(pricing);
const isModel3dMissing = !pricing.model3d;
const canSave = invalidPriceLabels.length === 0 && !isModel3dMissing;
return (
<section className="admin-page admin-page-wide">
<div className="admin-page-heading">
@@ -141,6 +176,31 @@ export function AdminEditorGenerationPricingPage({
{errorMessage ? (
<div className="admin-alert" role="status">
{errorMessage}
{isPricingVersionStale ? (
<button
className="admin-secondary-button"
disabled={isLoading}
type="button"
onClick={refreshPricing}
>
<RefreshCcw size={17} aria-hidden="true" />
<span></span>
</button>
) : null}
</div>
) : null}
{isModel3dMissing ? (
<div className="admin-alert" role="status">
3D 3D
</div>
) : null}
{invalidPriceLabels.length > 0 ? (
<div className="admin-alert" role="status">
{`以下价格必须是不小于 1 的整数:${invalidPriceLabels.join('、')}`}
</div>
) : null}
@@ -156,9 +216,16 @@ export function AdminEditorGenerationPricingPage({
)}
</div>
{pricing.model3d ? (
<AdminEditorGenerationModel3dPricingSection
model3d={pricing.model3d}
onChange={updateModel3dPrice}
/>
) : null}
<button
className="admin-primary-button"
disabled={isSaving}
disabled={isSaving || !canSave}
type="submit"
>
<Save size={17} aria-hidden="true" />
@@ -223,8 +290,3 @@ function renderModelPricingCard({
</section>
);
}
function parsePositiveInteger(value: string) {
const parsed = Number.parseInt(value, 10);
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
}
@@ -0,0 +1,88 @@
import { expect, test } from 'vitest';
import type { EditorGenerationPricingConfigPayload } from '../api/adminApiTypes';
import {
buildAdminEditorGenerationPricingRequest,
collectInvalidEditorGenerationPricingLabels,
editorModel3dAddOnLabel,
parsePositiveInteger,
} from './adminEditorGenerationPricing';
function pricingFixture(): EditorGenerationPricingConfigPayload {
return {
models: {
'gpt-image-2': { unit: 'perGeneration', prices: { '1K': 3, '2K': 5 } },
'audio1.0': { unit: 'perGeneration', price: 5 },
},
model3d: {
textToModelPricing: {
versionPrices: { 'v3.1-20260211': { noTexture: 8, texture: 16 } },
addOnPrices: { hdTexture: 8, unknownAddOn: 7 },
},
imageToModelPricing: {
versionPrices: { 'v3.1-20260211': { noTexture: 16, texture: 24 } },
addOnPrices: { hdTexture: 8 },
},
},
updatedAtMicros: 42,
};
}
test('数值解析把空串、非数字与 0 收敛成 0', () => {
expect(parsePositiveInteger('12')).toBe(12);
expect(parsePositiveInteger('')).toBe(0);
expect(parsePositiveInteger('abc')).toBe(0);
expect(parsePositiveInteger('0')).toBe(0);
expect(parsePositiveInteger('-3')).toBe(0);
});
test('未登记的 3D 加价项键回退显示原键名', () => {
expect(editorModel3dAddOnLabel('hdTexture')).toBe('高清贴图');
expect(editorModel3dAddOnLabel('unknownAddOn')).toBe('unknownAddOn');
});
test('校验覆盖模型档位与 3D 两段的全部数值', () => {
expect(collectInvalidEditorGenerationPricingLabels(pricingFixture())).toEqual(
[],
);
const invalid = pricingFixture();
const invalidImagePricing = invalid.models['gpt-image-2'];
const invalidTextEndpoint = invalid.model3d?.textToModelPricing;
const invalidImageEndpoint = invalid.model3d?.imageToModelPricing;
if (
!invalidImagePricing?.prices ||
!invalidTextEndpoint ||
!invalidImageEndpoint
) {
throw new Error('夹具必须包含图片档位与 3D 两段');
}
const imageVersionPrice = invalidImageEndpoint.versionPrices['v3.1-20260211'];
if (!imageVersionPrice) {
throw new Error('夹具必须包含图生 3D 的版本底价');
}
invalidImagePricing.prices['2K'] = 0;
invalidTextEndpoint.addOnPrices.hdTexture = 0;
imageVersionPrice.noTexture = 0;
expect(collectInvalidEditorGenerationPricingLabels(invalid)).toEqual([
'gpt-image-2 2K',
'文生 3D 高清贴图',
'图生 3D v3.1-20260211 无贴图',
]);
});
test('保存请求整段回传两段与定价版本,3D 缺失时回传 null', () => {
const pricing = pricingFixture();
expect(buildAdminEditorGenerationPricingRequest(pricing)).toEqual({
models: pricing.models,
model3d: pricing.model3d,
expectedUpdatedAtMicros: 42,
});
expect(
buildAdminEditorGenerationPricingRequest({ ...pricing, model3d: null }),
).toEqual({
models: pricing.models,
model3d: null,
expectedUpdatedAtMicros: 42,
});
});
@@ -0,0 +1,116 @@
import type {
AdminUpsertEditorGenerationPricingRequest,
EditorGenerationModel3dEndpointPricingPayload,
EditorGenerationModel3dPricingPayload,
EditorGenerationPricingConfigPayload,
} from '../api/adminApiTypes';
/** 3D 端点在两个并列段里的字段名与后台展示名。 */
export const EDITOR_MODEL3D_ENDPOINT_SECTIONS = [
{ key: 'textToModelPricing', label: '文生 3D' },
{ key: 'imageToModelPricing', label: '图生 3D' },
] as const satisfies ReadonlyArray<{
key: keyof EditorGenerationModel3dPricingPayload;
label: string;
}>;
/**
* 3D 加价项键到中文标签。键来自接口返回,这里只负责展示;遇到未登记的键回退显示原键名,
* 不因为标签缺失就把该项漏掉。
*/
const EDITOR_MODEL3D_ADD_ON_LABELS: Record<string, string> = {
hdTexture: '高清贴图',
ultraTexture: '超高清贴图',
hdGeometry: '高清几何',
quadMesh: '四边形网格',
smartLowPoly: '智能低面',
generateParts: '分件生成',
};
export function editorModel3dAddOnLabel(addOn: string) {
return EDITOR_MODEL3D_ADD_ON_LABELS[addOn] ?? addOn;
}
/** 输入框文本转整数;空串、非数字、0 与负数一律收敛成 0,交给提交前校验拦住。 */
export function parsePositiveInteger(value: string) {
const parsed = Number.parseInt(value, 10);
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
}
export function isPositiveMudPoints(value: number | null | undefined) {
return typeof value === 'number' && Number.isInteger(value) && value >= 1;
}
/**
* 提交前校验:所有泥点数值都必须是不小于 1 的整数,返回不合法项的展示名。
*
* 后端仍会独立校验一遍;这里只是不把明显非法的 payload 发出去,避免保存后才报错。
*/
export function collectInvalidEditorGenerationPricingLabels(
pricing: EditorGenerationPricingConfigPayload,
) {
const labels: string[] = [];
for (const [model, modelPricing] of Object.entries(pricing.models)) {
if (modelPricing.prices) {
for (const [tier, price] of Object.entries(modelPricing.prices)) {
if (!isPositiveMudPoints(price)) {
labels.push(`${model} ${tier}`);
}
}
continue;
}
if (!isPositiveMudPoints(modelPricing.price)) {
labels.push(`${model} 泥点`);
}
}
const model3d = pricing.model3d;
if (model3d) {
for (const { key, label } of EDITOR_MODEL3D_ENDPOINT_SECTIONS) {
const endpointPricing = model3d[key];
for (const [version, price] of Object.entries(
endpointPricing.versionPrices,
)) {
if (!isPositiveMudPoints(price.noTexture)) {
labels.push(`${label} ${version} 无贴图`);
}
if (!isPositiveMudPoints(price.texture)) {
labels.push(`${label} ${version} 带贴图`);
}
}
for (const [addOn, price] of Object.entries(
endpointPricing.addOnPrices,
)) {
if (!isPositiveMudPoints(price)) {
labels.push(`${label} ${editorModel3dAddOnLabel(addOn)}`);
}
}
}
}
return labels;
}
/**
* 组装保存请求:`models` 与 3D 两段整段回传,并带上读取时拿到的定价版本做乐观锁。
* 3D 段缺失时回传 `null`——服务端会以 400 拒绝,后台不允许在这里静默新建或丢弃整段。
*/
export function buildAdminEditorGenerationPricingRequest(
pricing: EditorGenerationPricingConfigPayload,
): AdminUpsertEditorGenerationPricingRequest {
return {
models: pricing.models,
model3d: pricing.model3d ?? null,
expectedUpdatedAtMicros: pricing.updatedAtMicros,
};
}
/** 单个端点段的不可变更新:底价与加价项各改一处,其余原样保留。 */
export function updateEditorModel3dEndpointPricing(
model3d: EditorGenerationModel3dPricingPayload,
section: keyof EditorGenerationModel3dPricingPayload,
updater: (
current: EditorGenerationModel3dEndpointPricingPayload,
) => EditorGenerationModel3dEndpointPricingPayload,
): EditorGenerationModel3dPricingPayload {
return { ...model3d, [section]: updater(model3d[section]) };
}
+29
View File
@@ -2972,6 +2972,34 @@ button:disabled {
gap: 10px;
}
.admin-pricing-model3d-list {
display: grid;
gap: 10px;
}
.admin-pricing-model3d-row {
display: grid;
grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 1fr));
align-items: end;
gap: 10px;
}
.admin-pricing-model3d-row-label {
color: #5c3a26;
font-size: 13px;
font-weight: 700;
line-height: 1.4;
overflow-wrap: anywhere;
padding-bottom: 10px;
}
.admin-pricing-model3d-hint {
color: #7b5a45;
font-size: 13px;
line-height: 1.5;
margin: 0;
}
.admin-pricing-unit {
flex: 0 0 auto;
border-radius: 999px;
@@ -3022,6 +3050,7 @@ button:disabled {
.admin-two-column-wide,
.admin-accounts-layout,
.admin-pricing-grid,
.admin-pricing-model3d-row,
.admin-form-row,
.admin-filter-grid,
.admin-table-query-grid,
-10
View File
@@ -15,20 +15,10 @@
"skill-pack:test": "node --test scripts/check-skill-pack.test.mjs",
"llm-status": "node scripts/run-cli-with-config.mjs --llm-status",
"agent-task": "node scripts/run-cli-with-config.mjs --agent-task",
"chat": "node scripts/run-cli-with-config.mjs --swarm-chat",
"swarm": "node scripts/run-cli-with-config.mjs --swarm-chat",
"config": "node scripts/game-creator-config-wizard.mjs",
"test:chat": "node scripts/agent-swarm-test-chat.mjs --task \"制作一个可直接试玩的原创植物塔防小游戏:玩家选择并放置原创守卫阻挡敌人,完成波次后可以进入下一关并重新开始。主题、单位名称与视觉语言必须原创,不使用任何现有游戏角色、单位名、Logo 或受保护视觉语言。请自主完成正式产物、静态检查和双视口试玩验证。\" --no-open",
"test:chat:manual": "node scripts/agent-swarm-test-chat.mjs",
"agent-run": "node scripts/run-cli-with-config.mjs --agent-run",
"agent-run:smoke": "node scripts/smoke-agent-run-local-provider.mjs",
"agent-runtime:real-e2e": "node scripts/agent-runtime-real-e2e.mjs",
"agent-runtime:collaboration-policy-real-e2e": "node scripts/agent-runtime-real-e2e.mjs --suite supervisor-swarm-collaboration-policy-mixed-recovery",
"agent-runtime:mixed-swarm-real-e2e": "node scripts/agent-runtime-real-e2e.mjs --suite supervisor-swarm-static-isolated-autonomous-chat",
"agent-runtime:supervisor-swarm-autonomous-chat-real-e2e": "node scripts/agent-runtime-real-e2e.mjs --suite supervisor-swarm-autonomous-chat",
"agent-runtime:supervisor-autonomous-playable-lane-defense-real-e2e": "node scripts/agent-runtime-real-e2e.mjs --suite supervisor-autonomous-playable-lane-defense",
"agent-runtime:supervisor-autonomous-playable-lane-defense-deterministic-e2e": "node scripts/agent-runtime-deterministic-playable-e2e.mjs",
"agent-runtime:supervisor-autonomous-playable-lane-defense-deterministic-self-test": "node scripts/agent-runtime-deterministic-playable-e2e.mjs --self-test",
"agent-runtime:supervisor-swarm-transient-retry-real-e2e": "node scripts/agent-runtime-real-e2e.mjs --suite supervisor-swarm-transient-retry",
"agent-runtime:supervisor-swarm-final-reply-transient-retry-real-e2e": "node scripts/agent-runtime-real-e2e.mjs --suite supervisor-swarm-final-reply-transient-retry",
"agent-runtime:supervisor-swarm-tool-plan-handoff-runner-kill-real-e2e": "node scripts/agent-runtime-real-e2e.mjs --suite supervisor-swarm-tool-plan-handoff-runner-kill",
File diff suppressed because it is too large Load Diff
@@ -1,69 +1,8 @@
import { createHash } from '../dependencies.mjs';
import { isPlainObject } from '../harness/config.mjs';
import {
interactiveCliOutput,
writeInteractiveCliLine,
} from '../harness/process.mjs';
import {
shutdownWaiters,
state,
userInputAnswerText,
} from '../runtime-state.mjs';
import { shutdownWaiters, state } from '../runtime-state.mjs';
import { disposableProjectPathVariants } from './runtime.mjs';
export async function answerRemainingInteractiveQuestions(session) {
let answeredPromptCount = 1;
const deadline = Date.now() + 60_000;
while (Date.now() < deadline) {
const output = interactiveCliOutput(session);
if (output.includes(`[\u5df2\u56de\u7b54] ${state.userInput.requestId}`))
return;
const promptCount = output.split('或直接输入其他答案:').length - 1;
while (answeredPromptCount < promptCount && answeredPromptCount < 3) {
writeInteractiveCliLine(session, userInputAnswerText);
answeredPromptCount += 1;
}
if (output.includes('[待确认]')) {
throw codedError('user-input-unexpected-tool-confirmation');
}
if (session.closed) throw codedError('user-input-cli-closed-before-answer');
await sleep(100);
}
throw codedError('user-input-answer-timeout');
}
export function parseSingleSwarmTurnReport(output, codePrefix) {
const reportLines = output
.split(/\r?\n/u)
.filter((line) => line.startsWith('[turn.report] '));
assert(reportLines.length === 1, `${codePrefix}-turn-report-count-invalid`);
const report = JSON.parse(reportLines[0].slice('[turn.report] '.length));
assert(
isPlainObject(report) &&
JSON.stringify(Object.keys(report).sort()) ===
JSON.stringify(
[
'schemaVersion',
'outcome',
'parentAgentId',
'sessionId',
'parentRunId',
'runtimeCount',
'busyRuntimeCount',
'pendingTaskCount',
'runningTaskCount',
'waitingForConfirmationCount',
'waitingForUserInputCount',
'newAssistantMessageCount',
'finalReplyChars',
'reconciliationAgentCount',
].sort(),
),
`${codePrefix}-turn-report-shape-invalid`,
);
return report;
}
export function isFailedTask(task) {
return (
['failed', 'cancelled', 'budget-exhausted'].includes(task.status) ||
@@ -2419,24 +2419,6 @@ export function finalMessageId(agentId, sessionId, runId) {
).slice(0, 32)}`;
}
export function runtimePublicStatusMessageId(
agentId,
sessionId,
runId,
status,
) {
const correlationId = runtimeMessageCorrelationId(
agentId,
sessionId,
runId,
).slice(0, 32);
const statusFingerprint = createHash('sha256')
.update(status)
.digest('hex')
.slice(0, 16);
return `runtime-public-status-${correlationId}-${statusFingerprint}`;
}
export function backgroundTaskMessageId(agentId, sessionId, runId, source) {
const fingerprint = createHash('sha256')
.update(`${agentId}\n${sessionId}\n${runId}\n${source}`)
File diff suppressed because it is too large Load Diff
@@ -37,26 +37,16 @@ import {
state,
steerRunnerKillAppDataSentinelFileName,
steerRunnerKillAppDataSentinelSchema,
supervisorAutonomousPlayableAppDataSentinelFileName,
supervisorAutonomousPlayableAppDataSentinelSchema,
supervisorSwarmAppDataSentinelFileName,
supervisorSwarmAppDataSentinelSchema,
supervisorSwarmAutonomousChatAppDataSentinelFileName,
supervisorSwarmAutonomousChatAppDataSentinelSchema,
supervisorSwarmCollaborationPolicyAppDataSentinelFileName,
supervisorSwarmCollaborationPolicyAppDataSentinelSchema,
supervisorSwarmFinalReplyTransientRetryAppDataSentinelFileName,
supervisorSwarmFinalReplyTransientRetryAppDataSentinelSchema,
supervisorSwarmRequiredAgentIds,
supervisorSwarmStaticIsolatedAutonomousChatAppDataSentinelFileName,
supervisorSwarmStaticIsolatedAutonomousChatAppDataSentinelSchema,
supervisorSwarmToolPlanHandoffRunnerKillAppDataSentinelFileName,
supervisorSwarmToolPlanHandoffRunnerKillAppDataSentinelSchema,
supervisorSwarmTransientRetryAppDataSentinelFileName,
supervisorSwarmTransientRetryAppDataSentinelSchema,
supervisorSwarmTransientRetryTargetAgentId,
userInputAppDataSentinelFileName,
userInputAppDataSentinelSchema,
webSearchAppDataSentinelFileName,
webSearchAppDataSentinelSchema,
windowsProcessHandleHelperSource,
@@ -68,21 +58,14 @@ import { isProjectSkillSuite } from '../suites/project-skill.mjs';
import { isResponseStreamSuite } from '../suites/response-stream.mjs';
import { isScopedAgentsSuite } from '../suites/scoped-agents.mjs';
import { isSteerRunnerKillSuite } from '../suites/steer-runner-kill.mjs';
import { isSupervisorAutonomousPlayableLaneDefenseSuite } from '../suites/supervisor-autonomous-playable.mjs';
import {
isSupervisorSwarmAutonomousChatSuite,
isSupervisorSwarmCollaborationPolicyMixedRecoverySuite,
isSupervisorSwarmFinalReplyTransientRetrySuite,
isSupervisorSwarmInitialTransientRetrySuite,
isSupervisorSwarmInteractiveChatSuite,
isSupervisorSwarmMixedHarnessSuite,
isSupervisorSwarmStaticIsolatedAutonomousChatSuite,
isSupervisorSwarmSuite,
isSupervisorSwarmToolPlanHandoffRunnerKillSuite,
isSupervisorSwarmTransientRetrySuite,
rebuildSupervisorSwarmTranscriptScanner,
} from '../suites/supervisor-swarm.mjs';
import { isUserInputRuntimeSuite } from '../suites/user-input.mjs';
import {
isWebSearchSuite,
sameEffectiveAgentLlmWithoutWebSearch,
@@ -100,19 +83,10 @@ import { appendBounded, runProcess } from './process.mjs';
import { decodeUtf8Fatal, isIsolatedRunnerSuite } from './reporting.mjs';
import { killRunnerOnce, readRunnerStatus, runnerBootId } from './runtime.mjs';
const platformSessionFixtureEnv = 'GENARRATIVE_AGC_PLATFORM_SESSION_FIXTURE';
const platformSessionFixtureMaxBytes = 16 * 1024;
const isolatedPlatformSessionFixtureName =
'.deterministic-platform-session.json';
const platformSessionFixtureSchema =
'genarrative-agc-platform-session-fixture.v1';
export function isolatedSuiteProtectsSourceAppData() {
return (
isSupervisorSwarmTransientRetrySuite() ||
isSupervisorSwarmToolPlanHandoffRunnerKillSuite() ||
isSupervisorAutonomousPlayableLaneDefenseSuite() ||
isSupervisorSwarmInteractiveChatSuite()
isSupervisorSwarmToolPlanHandoffRunnerKillSuite()
);
}
@@ -120,27 +94,6 @@ export function isolatedSuiteUsesSiblingAppData() {
return isWebSearchSuite() || isolatedSuiteProtectsSourceAppData();
}
export function sameSupervisorPlayableProviderBinding(left, right) {
const scalarFields = [
'providerAgentMode',
'providerModel',
'providerApiKind',
'providerReasoningEffort',
'providerBaseUrlSha256',
];
return (
left != null &&
right != null &&
scalarFields.every((field) => left[field] === right[field]) &&
Array.isArray(left.boundAgentIds) &&
Array.isArray(right.boundAgentIds) &&
left.boundAgentIds.length === right.boundAgentIds.length &&
left.boundAgentIds.every(
(agentId, index) => agentId === right.boundAgentIds[index],
)
);
}
export function isolatedSuiteAppDataProfile() {
if (isSteerRunnerKillSuite()) {
return {
@@ -174,14 +127,6 @@ export function isolatedSuiteAppDataProfile() {
codePrefix: 'context-compaction-appdata',
};
}
if (isUserInputRuntimeSuite()) {
return {
prefix: '.agent-runtime-real-e2e-user-input-',
sentinelName: userInputAppDataSentinelFileName,
sentinelSchema: userInputAppDataSentinelSchema,
codePrefix: 'user-input-appdata',
};
}
if (isScopedAgentsSuite()) {
return {
prefix: '.agent-runtime-real-e2e-scoped-agents-',
@@ -236,41 +181,6 @@ export function isolatedSuiteAppDataProfile() {
codePrefix: 'supervisor-swarm-transient-retry-appdata',
};
}
if (isSupervisorAutonomousPlayableLaneDefenseSuite()) {
return {
prefix: '.agent-runtime-real-e2e-supervisor-autonomous-playable-',
sentinelName: supervisorAutonomousPlayableAppDataSentinelFileName,
sentinelSchema: supervisorAutonomousPlayableAppDataSentinelSchema,
codePrefix: 'supervisor-autonomous-playable-appdata',
};
}
if (isSupervisorSwarmAutonomousChatSuite()) {
return {
prefix: '.agent-runtime-real-e2e-supervisor-swarm-autonomous-chat-',
sentinelName: supervisorSwarmAutonomousChatAppDataSentinelFileName,
sentinelSchema: supervisorSwarmAutonomousChatAppDataSentinelSchema,
codePrefix: 'supervisor-swarm-autonomous-chat-appdata',
};
}
if (isSupervisorSwarmStaticIsolatedAutonomousChatSuite()) {
return {
prefix:
'.agent-runtime-real-e2e-supervisor-swarm-static-isolated-autonomous-chat-',
sentinelName:
supervisorSwarmStaticIsolatedAutonomousChatAppDataSentinelFileName,
sentinelSchema:
supervisorSwarmStaticIsolatedAutonomousChatAppDataSentinelSchema,
codePrefix: 'supervisor-swarm-static-isolated-autonomous-chat-appdata',
};
}
if (isSupervisorSwarmCollaborationPolicyMixedRecoverySuite()) {
return {
prefix: '.agent-runtime-real-e2e-supervisor-swarm-collaboration-policy-',
sentinelName: supervisorSwarmCollaborationPolicyAppDataSentinelFileName,
sentinelSchema: supervisorSwarmCollaborationPolicyAppDataSentinelSchema,
codePrefix: 'supervisor-swarm-collaboration-policy-appdata',
};
}
if (isSupervisorSwarmSuite()) {
return {
prefix: '.agent-runtime-real-e2e-supervisor-swarm-',
@@ -505,120 +415,6 @@ export async function verifySourceAppDataDirectoryUntouched() {
state.isolatedRunner.sourceAppDataDirectoryUntouched = true;
}
async function readPlatformSessionFixtureForIsolatedSuite(sourceConfigDir) {
const rawPath = process.env[platformSessionFixtureEnv];
assert(
isNonEmptyString(rawPath) && path.isAbsolute(rawPath),
'supervisor-autonomous-playable-platform-session-fixture-missing',
);
const sourceRealPath = await fs.realpath(sourceConfigDir);
const requestedPath = path.resolve(rawPath);
const requestedMetadata = await fs.lstat(requestedPath).catch((error) => {
if (error?.code === 'ENOENT') return null;
throw error;
});
assert(
requestedMetadata?.isFile() && !requestedMetadata.isSymbolicLink(),
'supervisor-autonomous-playable-platform-session-fixture-not-regular',
);
assert(
requestedMetadata.size <= platformSessionFixtureMaxBytes,
'supervisor-autonomous-playable-platform-session-fixture-too-large',
);
const realPath = await fs.realpath(requestedPath);
assert(
isPathInside(sourceRealPath, realPath),
'supervisor-autonomous-playable-platform-session-fixture-outside-config',
);
const bytes = await fs.readFile(realPath);
assert(
bytes.length <= platformSessionFixtureMaxBytes,
'supervisor-autonomous-playable-platform-session-fixture-too-large',
);
let fixture;
try {
fixture = JSON.parse(
decodeUtf8Fatal(bytes, 'platform-session-fixture-invalid-utf8'),
);
} catch (error) {
throw codedError(
'supervisor-autonomous-playable-platform-session-fixture-invalid',
error,
);
}
const expectedKeys = [
'schemaVersion',
'userId',
'accessToken',
'apiBaseUrl',
'generation',
];
assert(
isPlainObject(fixture) &&
JSON.stringify(Object.keys(fixture).sort()) ===
JSON.stringify([...expectedKeys].sort()) &&
fixture.schemaVersion === platformSessionFixtureSchema &&
isNonEmptyString(fixture.userId) &&
isNonEmptyString(fixture.accessToken) &&
isNonEmptyString(fixture.apiBaseUrl) &&
Number.isSafeInteger(fixture.generation) &&
fixture.generation > 0,
'supervisor-autonomous-playable-platform-session-fixture-invalid',
);
return {
sourcePath: realPath,
bytes,
fixture,
sha256: createHash('sha256').update(bytes).digest('hex'),
};
}
async function installPlatformSessionFixtureIntoIsolatedAppData(
sourceConfigDir,
appDataDir,
) {
if (!isSupervisorAutonomousPlayableLaneDefenseSuite()) return;
const source =
await readPlatformSessionFixtureForIsolatedSuite(sourceConfigDir);
const isolatedPath = path.join(
appDataDir,
isolatedPlatformSessionFixtureName,
);
await fs.copyFile(
source.sourcePath,
isolatedPath,
fsConstants.COPYFILE_EXCL | fsConstants.COPYFILE_FICLONE,
);
await fs.chmod(isolatedPath, 0o600).catch(() => {});
const isolatedMetadata = await fs.lstat(isolatedPath);
assert(
isolatedMetadata.isFile() &&
!isolatedMetadata.isSymbolicLink() &&
isolatedMetadata.size === source.bytes.length,
'supervisor-autonomous-playable-platform-session-fixture-copy-invalid',
);
const isolatedBytes = await fs.readFile(isolatedPath);
assert(
createHash('sha256').update(isolatedBytes).digest('hex') === source.sha256,
'supervisor-autonomous-playable-platform-session-fixture-copy-mismatch',
);
state.isolatedRunner.platformSessionFixtureSourcePath = source.sourcePath;
state.isolatedRunner.platformSessionFixturePath = isolatedPath;
state.isolatedRunner.platformSessionFixtureSha256 = source.sha256;
state.isolatedRunner.platformSessionFixturePreviousEnv =
Object.prototype.hasOwnProperty.call(process.env, platformSessionFixtureEnv)
? process.env[platformSessionFixtureEnv]
: undefined;
process.env[platformSessionFixtureEnv] = isolatedPath;
state.formalConfigPathTranscriptScanner?.addSecrets(
absolutePathVariants(source.sourcePath, isolatedPath),
);
const previousLeakCount = state.transcriptScanner?.count ?? 0;
state.secrets = [...new Set([...state.secrets, source.fixture.accessToken])];
rebuildSupervisorSwarmTranscriptScanner();
state.transcriptScanner.count = previousLeakCount;
}
export async function prepareIsolatedSuiteAppData({
streamAgentId = null,
webSearchAgentId = null,
@@ -773,8 +569,7 @@ export async function prepareIsolatedSuiteAppData({
isScopedAgentsSuite() ||
isProjectSkillSuite() ||
isParallelReadSuite() ||
isSupervisorSwarmSuite() ||
isSupervisorAutonomousPlayableLaneDefenseSuite()
isSupervisorSwarmSuite()
? 'private-copy'
: 'hardlink';
try {
@@ -891,10 +686,6 @@ export async function prepareIsolatedSuiteAppData({
state.secrets = [...suiteSecrets];
rebuildSupervisorSwarmTranscriptScanner();
state.transcriptScanner.count = previousLeakCount;
await installPlatformSessionFixtureIntoIsolatedAppData(
sourceConfigDir,
appDataDir,
);
const unexpectedEndpoint = await fs
.lstat(path.join(appDataDir, runnerEndpointFileName))
.catch((error) => {
@@ -903,46 +694,6 @@ export async function prepareIsolatedSuiteAppData({
});
assert(!unexpectedEndpoint, `${profile.codePrefix}-endpoint-preexisted`);
state.runtimeConfigDir = appDataDir;
if (isSupervisorAutonomousPlayableLaneDefenseSuite()) {
const isolatedConfig = await loadConfig(appDataDir);
const expectedBinding = state.config.providerBinding;
const agentIds = [projectSupervisorAgentId];
const bindings = agentIds.map((agentId) => {
const effective = effectiveAgentLlmConfig(isolatedConfig.config, agentId);
assert(
['apiKey', 'baseUrl', 'model', 'apiKind', 'reasoningEffort'].every(
(key) => isNonEmptyString(effective[key]),
),
'supervisor-autonomous-playable-effective-provider-incomplete',
);
return {
providerModel: effective.model.trim(),
providerApiKind: effective.apiKind.trim(),
providerReasoningEffort: effective.reasoningEffort.trim(),
providerBaseUrlSha256: hashValue(effective.baseUrl.trim()),
};
});
const effectiveBinding = {
...bindings[0],
boundAgentIds: [...agentIds].sort(),
};
assert(
expectedBinding &&
bindings.every(
(binding) => JSON.stringify(binding) === JSON.stringify(bindings[0]),
) &&
sameSupervisorPlayableProviderBinding(
effectiveBinding,
expectedBinding,
),
'supervisor-autonomous-playable-effective-provider-binding-mismatch',
);
state.supervisorAutonomousPlayable.expectedProviderBinding = {
...expectedBinding,
};
state.supervisorAutonomousPlayable.effectiveProviderBinding =
effectiveBinding;
}
if (streamAgentId) {
const isolatedConfig = await loadConfig(appDataDir);
const isolatedEffective = effectiveAgentLlmConfig(
@@ -981,22 +732,6 @@ export async function prepareIsolatedSuiteAppData({
);
state.webSearch.effectiveEnabled = true;
}
if (isUserInputRuntimeSuite()) {
const isolatedConfig = await loadConfig(appDataDir);
const isolatedEffective = effectiveAgentLlmConfig(
isolatedConfig.config,
projectSupervisorAgentId,
);
assert(
isolatedEffective.model === 'gpt-5.5' &&
['apiKey', 'baseUrl', 'model'].every(
(key) =>
typeof isolatedEffective[key] === 'string' &&
isolatedEffective[key].trim().length > 0,
),
'user-input-effective-gpt-5-5-config-invalid',
);
}
if (isScopedAgentsSuite()) {
const isolatedConfig = await loadConfig(appDataDir);
const isolatedEffective = effectiveAgentLlmConfig(
@@ -1073,9 +808,8 @@ export async function prepareIsolatedSuiteAppData({
effective.requestTimeoutMs > 0 &&
Number.isSafeInteger(effective.maxRetries) &&
effective.maxRetries >=
(isSupervisorSwarmInteractiveChatSuite() ||
(isSupervisorSwarmTransientRetrySuite() &&
agentId !== supervisorSwarmTransientRetryTargetAgentId)
agentId !== supervisorSwarmTransientRetryTargetAgentId
? 0
: 1) &&
effective.maxRetries <= 3 &&
@@ -1095,24 +829,6 @@ export async function prepareIsolatedSuiteAppData({
{ llm: isolatedConfig.config.llm },
'',
);
if (isSupervisorSwarmMixedHarnessSuite()) {
assert(
globalEffective.model === 'gpt-5.5' &&
globalEffective.apiKind === 'openai_chat' &&
isNonEmptyString(globalEffective.reasoningEffort) &&
Number.isSafeInteger(globalEffective.requestTimeoutMs) &&
globalEffective.requestTimeoutMs > 0 &&
Number.isSafeInteger(globalEffective.maxRetries) &&
globalEffective.maxRetries >= 0 &&
globalEffective.maxRetries <= 3 &&
Number.isSafeInteger(globalEffective.retryBackoffMs) &&
globalEffective.retryBackoffMs > 0 &&
['apiKey', 'baseUrl', 'model'].every((key) =>
isNonEmptyString(globalEffective[key]),
),
'supervisor-swarm-mixed-default-provider-policy-invalid',
);
}
const configuredAgentIds = Object.keys(
isPlainObject(isolatedConfig.config.agentLlm)
? isolatedConfig.config.agentLlm
@@ -2000,31 +1716,6 @@ export async function verifyIsolatedSuiteConfigLinksUnchanged() {
'isolated-source-config-changed-during-suite',
);
}
const fixture = state.isolatedRunner;
if (
fixture.platformSessionFixtureSourcePath &&
fixture.platformSessionFixturePath &&
fixture.platformSessionFixtureSha256
) {
const [sourceMetadata, isolatedMetadata, sourceBytes, isolatedBytes] =
await Promise.all([
fs.lstat(fixture.platformSessionFixtureSourcePath),
fs.lstat(fixture.platformSessionFixturePath),
fs.readFile(fixture.platformSessionFixtureSourcePath),
fs.readFile(fixture.platformSessionFixturePath),
]);
assert(
sourceMetadata.isFile() &&
!sourceMetadata.isSymbolicLink() &&
isolatedMetadata.isFile() &&
!isolatedMetadata.isSymbolicLink() &&
createHash('sha256').update(sourceBytes).digest('hex') ===
fixture.platformSessionFixtureSha256 &&
createHash('sha256').update(isolatedBytes).digest('hex') ===
fixture.platformSessionFixtureSha256,
'supervisor-autonomous-playable-platform-session-fixture-changed',
);
}
}
export async function verifySourceConfigLinkCountsRestored() {
@@ -2064,22 +1755,7 @@ export async function removeIsolatedSuiteAppData() {
} catch (error) {
ownershipError = error;
}
try {
await fs.rm(appDataDir, { recursive: true, force: false });
} finally {
if (state.isolatedRunner.platformSessionFixtureSourcePath) {
const previous = state.isolatedRunner.platformSessionFixturePreviousEnv;
if (previous === undefined) {
delete process.env[platformSessionFixtureEnv];
} else {
process.env[platformSessionFixtureEnv] = previous;
}
}
state.isolatedRunner.platformSessionFixturePath = null;
state.isolatedRunner.platformSessionFixtureSourcePath = null;
state.isolatedRunner.platformSessionFixtureSha256 = null;
state.isolatedRunner.platformSessionFixturePreviousEnv = undefined;
}
await fs.rm(appDataDir, { recursive: true, force: false });
state.runtimeConfigDir = state.options.configDir;
try {
await verifySourceConfigLinkCountsRestored();
@@ -13,15 +13,10 @@ import {
responseStreamSuite,
scopedAgentsSuite,
steerRunnerKillSuite,
supervisorAutonomousPlayableLaneDefenseSuite,
supervisorSwarmAutonomousChatSuite,
supervisorSwarmCollaborationPolicyMixedRecoverySuite,
supervisorSwarmFinalReplyTransientRetrySuite,
supervisorSwarmStaticIsolatedAutonomousChatSuite,
supervisorSwarmSuite,
supervisorSwarmToolPlanHandoffRunnerKillSuite,
supervisorSwarmTransientRetrySuite,
userInputRuntimeSuite,
webSearchSuite,
} from '../runtime-state.mjs';
import { collectApiKeys, isPathInside } from './io.mjs';
@@ -58,7 +53,6 @@ export function parseArguments(args) {
suite === responseStreamSuite ||
suite === webSearchSuite ||
suite === contextCompactionSuite ||
suite === userInputRuntimeSuite ||
suite === scopedAgentsSuite ||
suite === projectSkillSuite ||
suite === parallelReadSuite ||
@@ -66,10 +60,6 @@ export function parseArguments(args) {
suite === supervisorSwarmTransientRetrySuite ||
suite === supervisorSwarmFinalReplyTransientRetrySuite ||
suite === supervisorSwarmToolPlanHandoffRunnerKillSuite ||
suite === supervisorSwarmAutonomousChatSuite ||
suite === supervisorAutonomousPlayableLaneDefenseSuite ||
suite === supervisorSwarmStaticIsolatedAutonomousChatSuite ||
suite === supervisorSwarmCollaborationPolicyMixedRecoverySuite ||
suite === steerRunnerKillSuite ||
processSessionSuites.has(suite),
'unsupported-suite',
@@ -2,7 +2,6 @@ import {
assert,
codedError,
hashValue,
sleep,
throwIfShutdownRequested,
} from '../assertions/core.mjs';
import { fs, path, spawn, withLoopbackNoProxy } from '../dependencies.mjs';
@@ -13,14 +12,9 @@ import {
manifestPath,
state,
} from '../runtime-state.mjs';
import {
isSupervisorSwarmTransientRetrySuite,
recordSupervisorSwarmChatSessionFailureDiagnostic,
} from '../suites/supervisor-swarm.mjs';
import { isSupervisorSwarmTransientRetrySuite } from '../suites/supervisor-swarm.mjs';
import { isIsolatedRunnerSuite } from './reporting.mjs';
export const activeInteractiveCliSessions = new Set();
export async function prepareCliBinary() {
const cargo = process.platform === 'win32' ? 'cargo.exe' : 'cargo';
await runProcess(
@@ -84,8 +78,8 @@ export function buildCliChildEnvironment() {
NO_COLOR: '1',
RUST_BACKTRACE: '0',
};
// The deterministic playable suite copies its account fixture into the
// sibling isolated AppData directory. Set the path explicitly here so
// The isolated runner copies its account fixture into the sibling isolated
// AppData directory. Set the path explicitly here so
// every CLI and the Runner it launches use the isolated copy, even if the
// parent harness environment was restored or changed after setup.
if (state.isolatedRunner.platformSessionFixturePath) {
@@ -144,197 +138,6 @@ export function codedProcessError(code, details) {
return error;
}
export function startInteractiveCli(args) {
assert(Boolean(state.cliBinary), 'interactive-cli-binary-not-ready');
assert(Boolean(state.runtimeConfigDir), 'interactive-config-dir-not-ready');
if (
isIsolatedRunnerSuite() &&
state.options?.configDir &&
path.resolve(state.runtimeConfigDir) ===
path.resolve(state.options.configDir)
) {
state.isolatedRunner.sourceConfigCliCallCount += 1;
}
const child = spawn(
state.cliBinary,
[...args, '--config-dir', state.runtimeConfigDir],
{
cwd: appRoot,
env: buildCliChildEnvironment(),
stdio: ['pipe', 'pipe', 'pipe'],
},
);
return createInteractiveCliSession(child);
}
export function createInteractiveCliSession(child) {
activeCommandChildren.add(child);
const session = {
child,
stdout: Buffer.alloc(0),
stderr: Buffer.alloc(0),
exited: false,
exitInfo: null,
exitPromise: null,
closed: false,
closeInfo: null,
closePromise: null,
stdioClosed: false,
stdioCloseInfo: null,
spawnError: null,
stdinError: null,
};
activeInteractiveCliSessions.add(session);
session.exitPromise = new Promise((resolve) => {
const settle = (result) => {
if (session.exited) return;
activeCommandChildren.delete(child);
session.exited = true;
session.closed = true;
session.exitInfo = result;
session.closeInfo = result;
resolve(result);
};
child.once('error', (error) => {
session.spawnError = error;
settle({ code: null, signal: null, error });
});
child.once('exit', (code, signal) => {
settle({ code, signal, error: null });
});
});
session.closePromise = new Promise((resolve) => {
child.once('close', (code, signal) => {
activeCommandChildren.delete(child);
activeInteractiveCliSessions.delete(session);
session.stdioClosed = true;
session.stdioCloseInfo = {
code,
signal,
error: session.spawnError,
};
resolve(session.stdioCloseInfo);
});
});
child.stdin?.on('error', (error) => {
session.stdinError ??= error;
});
child.stdout.on('data', (chunk) => {
state.transcriptScanner?.scan('interactive-stdout', chunk);
state.projectPathTranscriptScanner?.scan('interactive-stdout', chunk);
state.formalConfigPathTranscriptScanner?.scan('interactive-stdout', chunk);
session.stdout = appendBounded(session.stdout, chunk, commandOutputLimit);
});
child.stderr.on('data', (chunk) => {
state.transcriptScanner?.scan('interactive-stderr', chunk);
state.projectPathTranscriptScanner?.scan('interactive-stderr', chunk);
state.formalConfigPathTranscriptScanner?.scan('interactive-stderr', chunk);
session.stderr = appendBounded(session.stderr, chunk, commandOutputLimit);
});
return session;
}
export function interactiveCliOutput(session) {
return `${session.stdout.toString('utf8')}\n${session.stderr.toString('utf8')}`;
}
export function writeInteractiveCliLine(session, line) {
assert(!session.closed, 'interactive-cli-already-closed');
assert(session.child.stdin.writable, 'interactive-cli-stdin-not-writable');
session.child.stdin.write(`${line}\n`);
}
export async function waitForInteractiveCliOutput(
session,
predicate,
code,
timeoutMs,
{ allowAfterProcessExit = false } = {},
) {
const deadline = Date.now() + timeoutMs;
while (Date.now() < deadline) {
const output = interactiveCliOutput(session);
if (predicate(output)) return output;
if (session.exited && !allowAfterProcessExit) {
if (session === state.supervisorSwarmCliSession) {
recordSupervisorSwarmChatSessionFailureDiagnostic(session);
}
throw codedError(`${code}-cli-exited`);
}
if (session.stdioClosed) {
if (session === state.supervisorSwarmCliSession) {
recordSupervisorSwarmChatSessionFailureDiagnostic(session);
}
throw codedError(`${code}-cli-stdio-closed`);
}
await sleep(50);
}
throw codedError(code);
}
export async function waitForInteractiveCliExit(session, timeoutMs) {
const result = await Promise.race([
session.exitPromise,
sleep(timeoutMs).then(() => null),
]);
if (!result) throw codedError('interactive-cli-exit-timeout');
if (result.error) throw codedError('interactive-cli-process-error');
assert(
result.code === 0 && result.signal === null,
'interactive-cli-exit-invalid',
);
return result;
}
export async function closeInteractiveCli(session) {
if (!session) return null;
if (session.exited) return session.exitInfo;
if (
session.child.stdin.writable &&
!session.child.stdin.writableEnded &&
!session.child.stdin.destroyed
) {
session.child.stdin.write('/quit\n');
}
let result = await Promise.race([
session.exitPromise,
sleep(3_000).then(() => null),
]);
if (!result && !session.exited) {
session.child.kill('SIGTERM');
result = await Promise.race([
session.exitPromise,
sleep(2_000).then(() => null),
]);
}
if (!result && !session.exited) {
session.child.kill('SIGKILL');
result = await Promise.race([
session.exitPromise,
sleep(5_000).then(() => null),
]);
}
assert(Boolean(result), 'interactive-cli-cleanup-timeout');
return result;
}
export async function waitForInteractiveCliStdioClose(session, timeoutMs) {
if (!session || session.stdioClosed) return session?.stdioCloseInfo ?? null;
const result = await Promise.race([
session.closePromise,
sleep(timeoutMs).then(() => null),
]);
if (!result) throw codedError('interactive-cli-stdio-close-timeout');
return result;
}
export function destroyInteractiveCliOutputStreams(session) {
if (!session) return;
for (const stream of [session.child.stdout, session.child.stderr]) {
if (stream && !stream.destroyed) stream.destroy();
}
}
export async function runProcess(
program,
args,
@@ -406,214 +209,6 @@ export async function runProcess(
});
}
export async function listSystemProcessIdentities() {
if (process.platform === 'win32') {
const systemRoot = process.env.SystemRoot ?? process.env.SYSTEMROOT;
assert(
typeof systemRoot === 'string' && path.isAbsolute(systemRoot),
'owned-process-snapshot-system-root-invalid',
);
const powershell = path.join(
systemRoot,
'System32/WindowsPowerShell/v1.0/powershell.exe',
);
const metadata = await fs.lstat(powershell);
assert(
metadata.isFile() && !metadata.isSymbolicLink(),
'owned-process-snapshot-powershell-invalid',
);
const result = await runProcess(
powershell,
[
'-NoProfile',
'-NonInteractive',
'-Command',
'$processes = @(Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,CreationDate,Name); $processes | ConvertTo-Json -Compress',
],
{
cwd: appRoot,
timeoutMs: 30_000,
env: { ...process.env, NO_COLOR: '1', RUST_BACKTRACE: '0' },
},
);
const parsed = JSON.parse(result.stdout);
return (Array.isArray(parsed) ? parsed : [parsed])
.map((record) => ({
pid: Number(record?.ProcessId),
parentPid: Number(record?.ParentProcessId),
startedAt: String(record?.CreationDate ?? ''),
name: String(record?.Name ?? ''),
}))
.filter(validSystemProcessIdentity);
}
assert(
process.platform === 'linux' || process.platform === 'darwin',
'owned-process-snapshot-platform-unsupported',
);
const result = await runProcess(
'ps',
['-A', '-o', 'pid=', '-o', 'ppid=', '-o', 'lstart=', '-o', 'comm='],
{ cwd: appRoot, timeoutMs: 30_000 },
);
return result.stdout
.split(/\r?\n/u)
.map((line) => line.trim())
.filter(Boolean)
.map((line) => {
const fields = line.split(/\s+/u);
return {
pid: Number(fields[0]),
parentPid: Number(fields[1]),
startedAt: fields.slice(2, 7).join(' '),
name: fields.slice(7).join(' '),
};
})
.filter(validSystemProcessIdentity);
}
function validSystemProcessIdentity(record) {
return (
Number.isSafeInteger(record?.pid) &&
record.pid > 0 &&
Number.isSafeInteger(record.parentPid) &&
record.parentPid >= 0 &&
typeof record.startedAt === 'string' &&
record.startedAt.length > 0 &&
typeof record.name === 'string' &&
record.name.length > 0
);
}
export function buildOwnedProcessCleanupSnapshot(
processRecords,
{ rootPids = [], runnerPid = null, helperPids = [] } = {},
) {
assert(
Array.isArray(processRecords) &&
Array.isArray(rootPids) &&
Array.isArray(helperPids),
'owned-process-snapshot-input-invalid',
);
const records = processRecords.filter(validSystemProcessIdentity);
const byPid = new Map(records.map((record) => [record.pid, record]));
const childrenByParent = new Map();
for (const record of records) {
const children = childrenByParent.get(record.parentPid) ?? [];
children.push(record.pid);
childrenByParent.set(record.parentPid, children);
}
const normalizedRunnerPid = Number.isSafeInteger(runnerPid)
? runnerPid
: null;
const helperPidSet = new Set(
helperPids.filter((pid) => Number.isSafeInteger(pid) && pid > 0),
);
const roots = [
...new Set(
[...rootPids, normalizedRunnerPid, ...helperPidSet].filter(
(pid) => Number.isSafeInteger(pid) && pid > 0,
),
),
];
assert(roots.length > 0, 'owned-process-snapshot-root-missing');
const ownedPids = new Set();
const queue = [...roots];
while (queue.length > 0) {
const pid = queue.shift();
if (ownedPids.has(pid)) continue;
ownedPids.add(pid);
queue.push(...(childrenByParent.get(pid) ?? []));
}
const identities = [...ownedPids]
.map((pid) => byPid.get(pid))
.filter(Boolean)
.map((record) => ({
pid: record.pid,
startedAt: record.startedAt,
name: record.name,
kind: ownedProcessKind(record, normalizedRunnerPid, helperPidSet),
}))
.sort((left, right) => left.pid - right.pid);
return {
identities,
observedCounts: countOwnedProcessKinds(identities),
};
}
function ownedProcessKind(record, runnerPid, helperPids) {
if (record.pid === runnerPid) return 'runner';
if (helperPids.has(record.pid)) return 'helper';
const name = path.basename(record.name).toLowerCase();
if (/^node(?:\.exe)?$/u.test(name)) return 'node';
if (/^(?:chrome|chromium|msedge|google-chrome)(?:\.exe)?$/u.test(name)) {
return 'browser';
}
return 'command';
}
function countOwnedProcessKinds(identities) {
const counts = {
runner: 0,
helper: 0,
node: 0,
browser: 0,
command: 0,
total: identities.length,
};
for (const identity of identities) counts[identity.kind] += 1;
return counts;
}
export function inspectOwnedProcessCleanupResiduals(
snapshot,
processRecords,
{ activeCommandChildCount = 0, activeInteractiveCliSessionCount = 0 } = {},
) {
assert(
Array.isArray(snapshot?.identities) && Array.isArray(processRecords),
'owned-process-residual-input-invalid',
);
const currentByPid = new Map(
processRecords
.filter(validSystemProcessIdentity)
.map((record) => [record.pid, record]),
);
const residualIdentities = snapshot.identities.filter((identity) => {
const current = currentByPid.get(identity.pid);
return (
current?.startedAt === identity.startedAt &&
current?.name === identity.name
);
});
return {
residualCounts: countOwnedProcessKinds(residualIdentities),
activeCommandChildCount,
activeInteractiveCliSessionCount,
clean:
residualIdentities.length === 0 &&
activeCommandChildCount === 0 &&
activeInteractiveCliSessionCount === 0,
};
}
export async function captureOwnedProcessCleanupSnapshot(options) {
return buildOwnedProcessCleanupSnapshot(
await listSystemProcessIdentities(),
options,
);
}
export async function verifyOwnedProcessCleanupSnapshot(snapshot) {
return inspectOwnedProcessCleanupResiduals(
snapshot,
await listSystemProcessIdentities(),
{
activeCommandChildCount: activeCommandChildren.size,
activeInteractiveCliSessionCount: activeInteractiveCliSessions.size,
},
);
}
export function appendBounded(current, chunk, limit) {
const combined = Buffer.concat([current, chunk]);
return combined.length <= limit
@@ -28,12 +28,10 @@ import {
isGoalRuntimeSuite,
} from '../suites/goal.mjs';
import { isResponseStreamSuite } from '../suites/response-stream.mjs';
import { isSupervisorAutonomousPlayableLaneDefenseSuite } from '../suites/supervisor-autonomous-playable.mjs';
import {
isSupervisorSwarmSuite,
supervisorSwarmVerificationFixtureSource,
} from '../suites/supervisor-swarm.mjs';
import { isUserInputRuntimeSuite } from '../suites/user-input.mjs';
import { isWebSearchSuite } from '../suites/web-search.mjs';
import { createSentinelOwnedTempDirectory } from './app-data.mjs';
import { effectiveAgentLlmConfig } from './config.mjs';
@@ -41,19 +39,15 @@ import { runProcess } from './process.mjs';
import { isIsolatedRunnerSuite } from './reporting.mjs';
export function requiredAgentIdsForSuite() {
return isUserInputRuntimeSuite()
? [projectSupervisorAgentId]
: isSupervisorAutonomousPlayableLaneDefenseSuite()
? [projectSupervisorAgentId]
: isSupervisorSwarmSuite()
? [
projectSupervisorAgentId,
supervisorSwarmDesignAgentId,
supervisorSwarmQualityAgentId,
]
: isIsolatedRunnerSuite()
? [mainAgentId]
: [mainAgentId, 'quality-review'];
return isSupervisorSwarmSuite()
? [
projectSupervisorAgentId,
supervisorSwarmDesignAgentId,
supervisorSwarmQualityAgentId,
]
: isIsolatedRunnerSuite()
? [mainAgentId]
: [mainAgentId, 'quality-review'];
}
export function expectedProviderBindingForSuite(config) {
@@ -120,11 +114,9 @@ export async function checkPrerequisites(config) {
return {
llmConfigured,
providerBinding,
chromeAvailable:
!isIsolatedRunnerSuite() ||
isSupervisorAutonomousPlayableLaneDefenseSuite()
? Boolean(await findSupportedBrowser())
: false,
chromeAvailable: !isIsolatedRunnerSuite()
? Boolean(await findSupportedBrowser())
: false,
editorApiConfigured,
};
}
@@ -267,8 +259,7 @@ export async function seedDisposableProject({
? supervisorSwarmVerificationFixtureSource()
: isGoalRuntimeSuite() ||
isResponseStreamSuite() ||
isWebSearchSuite() ||
isSupervisorAutonomousPlayableLaneDefenseSuite()
isWebSearchSuite()
? goalRevisionOneVerificationFixtureSource()
: goalRevisionTwoVerificationFixtureSource(),
),
@@ -405,23 +396,6 @@ export function seededGameHtml() {
`;
}
export function productionDefaultGameIndexHtml() {
return `<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Genarrative Game Draft</title>
<style>
body { margin: 0; display: grid; min-height: 100vh; place-items: center; background: #101827; color: #d9e7ff; font: 16px system-ui, sans-serif; }
main { width: min(720px, calc(100vw - 32px)); }
</style>
</head>
<body><main>还没有生成游戏。回到聊天输入创意并确认生成后,这里会写入可试玩原型。</main></body>
</html>
`;
}
export function buildTaskPrompt(suite) {
const editorAssetOutcome =
suite === 'full'
@@ -20,9 +20,7 @@ import { isProjectSkillSuite } from '../suites/project-skill.mjs';
import { isResponseStreamSuite } from '../suites/response-stream.mjs';
import { isScopedAgentsSuite } from '../suites/scoped-agents.mjs';
import { isSteerRunnerKillSuite } from '../suites/steer-runner-kill.mjs';
import { isSupervisorAutonomousPlayableLaneDefenseSuite } from '../suites/supervisor-autonomous-playable.mjs';
import { isSupervisorSwarmSuite } from '../suites/supervisor-swarm.mjs';
import { isUserInputRuntimeSuite } from '../suites/user-input.mjs';
import { isWebSearchSuite } from '../suites/web-search.mjs';
import { isPathInside, readJson } from './io.mjs';
@@ -88,17 +86,12 @@ export function buildSummary() {
config: state.config,
blocked: state.blocked,
run: {
agentId:
isUserInputRuntimeSuite() ||
isSupervisorAutonomousPlayableLaneDefenseSuite() ||
isSupervisorSwarmSuite()
? projectSupervisorAgentId
: mainAgentId,
agentId: isSupervisorSwarmSuite()
? projectSupervisorAgentId
: mainAgentId,
runIdHash: hashValue(state.initialRunId),
sessionIdHash: hashValue(state.initialSessionId),
runnerKilled: isSupervisorAutonomousPlayableLaneDefenseSuite()
? false
: state.runnerKilled,
runnerKilled: state.runnerKilled,
resumed: state.resumed,
identityStable: state.identityStable,
},
@@ -110,11 +103,9 @@ export function buildSummary() {
projectPathReportLeakCount: state.projectPathReportLeakCount,
...(isWebSearchSuite() ||
isContextCompactionSuite() ||
isUserInputRuntimeSuite() ||
isScopedAgentsSuite() ||
isProjectSkillSuite() ||
isParallelReadSuite() ||
isSupervisorAutonomousPlayableLaneDefenseSuite() ||
isSupervisorSwarmSuite() ||
isSteerRunnerKillSuite()
? {
@@ -408,11 +399,9 @@ export function isIsolatedRunnerSuite() {
isResponseStreamSuite() ||
isWebSearchSuite() ||
isContextCompactionSuite() ||
isUserInputRuntimeSuite() ||
isScopedAgentsSuite() ||
isProjectSkillSuite() ||
isParallelReadSuite() ||
isSupervisorAutonomousPlayableLaneDefenseSuite() ||
isSupervisorSwarmSuite()
);
}
@@ -87,11 +87,7 @@ import {
import { isProjectSkillSuite } from '../suites/project-skill.mjs';
import { isScopedAgentsSuite } from '../suites/scoped-agents.mjs';
import { isSteerRunnerKillSuite } from '../suites/steer-runner-kill.mjs';
import {
confirmSupervisorSwarmPendingActionsInChat,
isSupervisorSwarmInteractiveChatSuite,
isSupervisorSwarmSuite,
} from '../suites/supervisor-swarm.mjs';
import { isSupervisorSwarmSuite } from '../suites/supervisor-swarm.mjs';
import { killRunnerPidOnce, verifyOwnedRunnerForKill } from './app-data.mjs';
import { isPlainObject } from './config.mjs';
import {
@@ -1038,13 +1034,6 @@ export async function confirmPendingActions(
allowedTools = null,
shouldConfirm = () => true,
) {
if (isSupervisorSwarmInteractiveChatSuite()) {
await confirmSupervisorSwarmPendingActionsInChat(
allowedTools,
shouldConfirm,
);
return;
}
for (const pending of await findPendingActions()) {
if (state.confirmedActionIds.has(pending.actionId)) continue;
if (!shouldConfirm(pending)) continue;
@@ -43,12 +43,6 @@ export const contextCompactionAppDataSentinelFileName =
export const contextCompactionAppDataSentinelSchema =
'genarrative-agent-runtime-real-e2e-context-compaction-appdata.v1';
export const userInputAppDataSentinelFileName =
'.agent-runtime-real-e2e-user-input-appdata.json';
export const userInputAppDataSentinelSchema =
'genarrative-agent-runtime-real-e2e-user-input-appdata.v1';
export const scopedAgentsAppDataSentinelFileName =
'.agent-runtime-real-e2e-scoped-agents-appdata.json';
@@ -109,30 +103,6 @@ export const supervisorSwarmToolPlanHandoffCheckpointReachedFileName =
export const supervisorSwarmToolPlanHandoffCheckpointReachedSchema =
'game-creator-tool-plan-handoff-runner-kill-checkpoint-reached.v1';
export const supervisorSwarmAutonomousChatAppDataSentinelFileName =
'.agent-runtime-real-e2e-supervisor-swarm-autonomous-chat-appdata.json';
export const supervisorSwarmAutonomousChatAppDataSentinelSchema =
'genarrative-agent-runtime-real-e2e-supervisor-swarm-autonomous-chat-appdata.v1';
export const supervisorAutonomousPlayableAppDataSentinelFileName =
'.agent-runtime-real-e2e-supervisor-autonomous-playable-appdata.json';
export const supervisorAutonomousPlayableAppDataSentinelSchema =
'genarrative-agent-runtime-real-e2e-supervisor-autonomous-playable-appdata.v1';
export const supervisorSwarmStaticIsolatedAutonomousChatAppDataSentinelFileName =
'.agent-runtime-real-e2e-supervisor-swarm-static-isolated-autonomous-chat-appdata.json';
export const supervisorSwarmStaticIsolatedAutonomousChatAppDataSentinelSchema =
'genarrative-agent-runtime-real-e2e-supervisor-swarm-static-isolated-autonomous-chat-appdata.v1';
export const supervisorSwarmCollaborationPolicyAppDataSentinelFileName =
'.agent-runtime-real-e2e-supervisor-swarm-collaboration-policy-appdata.json';
export const supervisorSwarmCollaborationPolicyAppDataSentinelSchema =
'genarrative-agent-runtime-real-e2e-supervisor-swarm-collaboration-policy-appdata.v1';
export const mainAgentId = 'code-prototype';
export const projectSupervisorAgentId = 'project-supervisor';
@@ -179,8 +149,6 @@ export const webSearchSuite = 'web-search';
export const contextCompactionSuite = 'context-compaction';
export const userInputRuntimeSuite = 'user-input-runtime';
export const scopedAgentsSuite = 'scoped-agents';
export const projectSkillSuite = 'project-skill';
@@ -213,18 +181,6 @@ export const supervisorSwarmTransientRetryBackoffMs = 30_000;
export const supervisorSwarmTransientRetryPreDueGuardMs = 1_500;
export const supervisorSwarmAutonomousChatSuite =
'supervisor-swarm-autonomous-chat';
export const supervisorAutonomousPlayableLaneDefenseSuite =
'supervisor-autonomous-playable-lane-defense';
export const supervisorSwarmStaticIsolatedAutonomousChatSuite =
'supervisor-swarm-static-isolated-autonomous-chat';
export const supervisorSwarmCollaborationPolicyMixedRecoverySuite =
'supervisor-swarm-collaboration-policy-mixed-recovery';
export const runtimeContextBundleSchemaVersion =
'game-creator-runtime-context-bundle.v5';
@@ -234,17 +190,6 @@ export const providerRequestLifecycleSchemaVersion =
export const providerActionBatchSchemaVersion =
'game-creator-provider-action-batch.v2';
export const runProfileBindingSchemaVersion =
'game-creator-run-profile-binding.v1';
export const autonomousCompletionContractSchemaVersion =
'game-creator-autonomous-completion-contract.v2';
export const autonomousPlaytestReceiptSchemaVersion =
'game-creator-autonomous-playtest-receipt.v2';
export const autonomousGameBuildRunProfile = 'autonomous-game-build';
export const supervisorCollaborationPolicySchemaVersion =
'game-creator-supervisor-collaboration-policy.v1';
@@ -287,12 +232,6 @@ export const contextCompactionTriggerTurns = new Set([4, 8]);
export const contextCompactionConstraintCanary = `GENARRATIVE_CONTEXT_CONSTRAINT_${randomUUID().replaceAll('-', '').slice(0, 20)}`;
export const userInputAnswerCanary = `GENARRATIVE_USER_CHOICE_${randomUUID()
.replaceAll('-', '')
.slice(0, 20)}`;
export const userInputAnswerText = `选择轻量像素风,优先保证移动端轮廓和动作可读性;确认标记 ${userInputAnswerCanary}`;
export const scopedAgentsRootCanary = `GENARRATIVE_SCOPE_ROOT_${randomUUID()
.replaceAll('-', '')
.slice(0, 20)}`;
@@ -461,143 +400,6 @@ export const supervisorSwarmConfirmedTools = [
'project.verify',
];
export const supervisorSwarmAutonomousTask =
'请把这个试玩项目推进到可以交给首批玩家体验的状态。以仓库现有的正式交付要求、临时检查要求和实际验证结果为准;按阶段生效的临时检查必须在各自生效后全部完成,不能把后续检查并入前置检查或漏掉。完成后简短说明交付内容、验证结论和仍需关注的问题。';
export const supervisorAutonomousPlayableLaneDefenseTask =
'做一个植物大战僵尸式的塔防游戏,要能选择植物、阻挡敌人、正常闯关,并且生成后可以直接试玩。';
export const supervisorAutonomousPlayableSourceFieldMaxChars = 8_000;
export const supervisorAutonomousPlayableSourceTotalMaxChars = 10_000;
export const supervisorAutonomousPlayableSafeStatuses = new Set([
'cancelling',
'budget-exhausted',
'cancelled',
'completed',
'failed',
'idle',
'needs-reconciliation',
'paused',
'pausing',
'pending',
'running',
'waiting-for-confirmation',
'waiting-for-user-input',
]);
export const supervisorAutonomousPlayableSafePhases = new Set([
'action',
'budget-exhausted',
'cancelled',
'cancelling',
'completion-contract-failed',
'completed',
'conversation-write-failed',
'executing',
'failed',
'finalizing',
'idle',
'needs-reconciliation',
'observation',
'parent-terminal',
'paused',
'pausing',
'planning',
'provider-action-batch',
'queued',
'response',
'running',
'waiting-for-agent',
'waiting-for-confirmation',
'waiting-for-delegate-receipts',
'waiting-for-isolated-join',
'waiting-for-process-session',
'waiting-for-provider-retry',
'waiting-for-user-input',
]);
export const supervisorAutonomousPlayableSafeDeliveryStatuses = new Set([
'claimed-by-parent',
'dispatched',
'ready',
'suppressed',
]);
export const supervisorAutonomousPlayableSafeTerminalStatuses = new Set([
'budget-exhausted',
'cancelled',
'completed',
'failed',
]);
export const supervisorAutonomousPlayableSafeTurnOutcomes = new Set([
'failed',
'incomplete',
'needs-reconciliation',
'settled',
]);
export const laneDefensePlaytestRequiredAssertions = [
'state-surface-valid',
'level-positive',
'start-control-clicked',
'start-sequence-advanced',
'start-phase-playing',
'defender-option-control-clicked',
'defender-selection-sequence-advanced',
'defender-selection-recorded',
'lane-cell-control-clicked',
'defender-placement-sequence-advanced',
'defender-count-increased',
'enemies-present-after-placement',
'speed-up-control-clicked',
'battle-sequence-advanced',
'battle-sequence-monotonic',
'enemy-position-changed',
'enemy-health-decreased',
'phase-won',
'next-level-control-clicked',
'next-level-sequence-advanced',
'level-increased',
'restart-control-clicked',
'restart-sequence-advanced',
'restart-phase-ready-or-playing',
];
export const supervisorSwarmAutonomousRoutingTerms = [
supervisorSwarmDesignAgentId,
supervisorSwarmQualityAgentId,
'agent.delegate',
'agent.run_status',
'同一个 planning 轮次',
'同轮',
'并行',
'返工',
'repair',
'一次',
'两个 Agent',
'两个专业',
'Runner',
'pidfd',
'actionId',
'delegationId',
];
export const supervisorSwarmCollaborationPolicyControlTerms = [
'.agent/collaboration-policy.json',
supervisorCollaborationPolicySchemaVersion,
'requiredInitialWave',
'minStaticDelegates',
'requiredStaticAgentIds',
'minIsolatedChildren',
'minIsolatedGroupsBeforeClaim',
'orchestratorOnlyAfterDelegation',
'policyFingerprint',
'contractFingerprint',
];
export const supervisorSwarmIsolatedReviews = [
{
path: 'e2e/isolated-a/evidence.txt',
@@ -625,17 +427,6 @@ export const supervisorSwarmIsolatedReviews = [
},
];
export const supervisorSwarmIsolatedReviewGroups = [
supervisorSwarmIsolatedReviews.slice(0, 2),
supervisorSwarmIsolatedReviews.slice(2),
];
export const supervisorSwarmInitialIsolatedReviews =
supervisorSwarmIsolatedReviewGroups[0];
export const supervisorSwarmFollowupIsolatedReviews =
supervisorSwarmIsolatedReviewGroups[1];
export const webSearchBaselineApiUrl =
'https://api.github.com/repos/nodejs/node/releases/latest';
@@ -703,8 +494,6 @@ export const pollIntervalMs = 750;
export const runTimeoutMs = 30 * 60 * 1000;
export const supervisorAutonomousPlayableRunTimeoutMs = 60 * 60 * 1000;
export const supervisorSwarmTerminalSidecarCleanupTimeoutMs = 10_000;
export const processRunnerKillStartTimeoutMs = 5 * 60 * 1000;
@@ -938,10 +727,6 @@ export class BlockedError extends Error {
export const isolatedRunnerState = {
appDataDir: null,
platformSessionFixturePath: null,
platformSessionFixtureSourcePath: null,
platformSessionFixtureSha256: null,
platformSessionFixturePreviousEnv: undefined,
ownerToken: null,
createdAt: 0,
current: null,
@@ -968,9 +753,6 @@ export const state = {
linuxPidfdPythonPath: null,
windowsProcessHandlePowerShellPath: null,
cleanupInProgress: false,
userInputCliSession: null,
supervisorSwarmCliSession: null,
supervisorAutonomousPlayableCliSession: null,
status: 'FAIL',
suite: null,
options: null,
@@ -1082,23 +864,6 @@ export const state = {
finalReplyFingerprint: null,
reportLeakCount: 0,
},
userInput: {
requestId: null,
responseId: null,
actionId: null,
questionMessageId: null,
answerMessageId: null,
questionCount: 0,
optionCount: 0,
providerStartedBeforeKill: 0,
providerStartedAfterRestart: 0,
conversationCountBeforeKill: 0,
conversationCountAfterRestart: 0,
oldRunnerBootId: null,
newRunnerBootId: null,
privateValues: [],
reportLeakCount: 0,
},
scopedAgents: {
effectiveModel: null,
effectiveApiKind: null,
@@ -1120,20 +885,6 @@ export const state = {
privateValues: [],
reportLeakCount: 0,
},
supervisorAutonomousPlayable: {
freshInitBaselineUsed: false,
initialGameIndexSha256: null,
expectedProviderBinding: null,
effectiveProviderBinding: null,
stdinWriteCount: 0,
stdinEnded: false,
stdinBytes: 0,
turnReport: null,
cliOutput: '',
privateValues: [],
reportLeakCount: 0,
ownedProcessCleanupSnapshot: null,
},
supervisorSwarm: {
effectiveModel: null,
effectiveApiKind: null,
@@ -1215,47 +966,7 @@ export const state = {
toolPlanHandoffLifecycleClosedExactlyOnce: false,
toolPlanHandoffAuditIdempotent: false,
toolPlanHandoffRecoveredPlanFingerprintMatched: false,
autonomousTaskRecipeFree: false,
autonomousRepositoryRecipeFree: false,
interactiveCliUsed: false,
chatSessionUnexpectedlyClosed: false,
chatSessionFailureKind: 'none',
chatSessionExitCode: 'none',
chatSessionCloseSignal: 'none',
chatSessionProcessErrorCode: 'none',
chatSessionStderrChars: 0,
chatSessionStderrSha256: 'none',
turnReport: null,
mixedSpawnActionId: null,
mixedSpawnRequestHash: null,
mixedFollowupSpawnActionId: null,
mixedFollowupSpawnRequestHash: null,
staticIsolatedProviderRequestIds: [],
staticIsolatedProviderOverlapObserved: false,
preKillMixedIdentity: null,
collaborationPolicyWritten: false,
collaborationPolicySnapshotInitialRecord: null,
collaborationPolicySnapshotInitialBytes: null,
collaborationPolicySnapshotInitialBytesSha256: null,
collaborationPolicySnapshotInitialIdentityHash: null,
collaborationPolicySnapshotBindingInitialRecord: null,
collaborationPolicySnapshotBindingInitialBytes: null,
collaborationPolicySnapshotBindingInitialBytesSha256: null,
chatSessionFailureDiagnostic: null,
collaborationPolicyDriftFixtureWritten: false,
collaborationPolicyDriftFixturePolicyFingerprint: null,
collaborationPolicyDriftedMinIsolatedGroupsBeforeClaim: null,
initialBatchRecoveryBoundaryObserved: false,
initialBatchRecoveryOldRunnerBootId: null,
initialBatchRecoveryNewRunnerBootId: null,
initialBatchRecoveryPreKillIdentity: null,
initialBatchRecoveryPostRecoveryIdentity: null,
initialBatchRecoveryPreKillSideEffects: null,
initialBatchRecoveryPostRecoverySideEffects: null,
initialBatchRecoveryIdentityStable: false,
initialBatchRecoveryConfirmationRestoredCount: 0,
initialBatchRecoveryPidfdClaimCount: 0,
initialBatchRecoveryPidfdSignalCount: 0,
},
confirmedActionIds: new Set(),
cleanupPerformed: false,
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More