Commit Graph

1330 Commits

Author SHA1 Message Date
lhk229 782fa77950 Merge branch 'master' into design_agent_refactor
Project CI / Repository checks (pull_request) Successful in 3m43s
Project CI / Frontend tests (pull_request) Successful in 4m37s
Project CI / Backend tests (pull_request) Successful in 7m30s
Project CI / Native shell tests (pull_request) Successful in 18m45s
2026-09-10 23:50:49 +08:00
suzmii ff42fff61c 按评审意见把写锁等待挪出 runtime worker 并收紧 wait_exhausted 记账
Project CI / Repository checks (pull_request) Successful in 3m18s
Project CI / Frontend tests (pull_request) Successful in 4m3s
Project CI / Backend tests (pull_request) Successful in 7m25s
Project CI / Native shell tests (pull_request) Successful in 19m35s
- agc_write_file 写路径改经 bridge_write_file_in_blocking_pool 走 tokio::task::spawn_blocking:有界等待是同步轮询(最多约 10 秒),直接在 async handler 里跑会占住 tokio worker,争用窗口内同一轮并行写多个文件时会波及共享同一 runtime 的只读端点与 UI 命令
- 新增用例用默认 current_thread runtime 加心跳任务锁住该性质;把 handler 临时改回同步直调时该用例按预期失败,确认有区分度
- project.write_lock.wait_exhausted 与终态改判一起改为只在真的等过(max_attempts > 1)时发生:hydrate 的单次试探不再写 waitedMs 近似 0 的“耗尽”日志
- 技术方案、decision-log、pitfalls 同步这两条,并补“同步有界等待不能直接跑在 async handler 里”的排障经验
2026-09-10 21:38:48 +08:00
suzmii 71e9ad3133 修复锁失败终态判据漏传平台导致 CI 把权限改判成争用
Project CI / Repository checks (pull_request) Successful in 6m17s
Project CI / Frontend tests (pull_request) Successful in 8m23s
Project CI / Backend tests (pull_request) Successful in 12m7s
Project CI / Native shell tests (pull_request) Successful in 25m6s
- project_write_lock_permission_is_ambiguous 改为按平台加原始错误码判定(Windows 的 ACCESS_DENIED(5));只看 ErrorKind 在 Linux 上会得出相反结论:errno 5 在 Windows 是 ACCESS_DENIED、在 Linux 是 EIO
- ProjectWriteLockFailure::Retryable 携带 platform,终态改判与争用文案都用同一次分类的平台,不再依赖宿主 errno 语义
- 终态投影用例显式用 Windows 平台构造失败并补 Unix 反例,两个平台上结论一致;CI 首次推送正是在此失败(2358 passed / 1 failed,left contention / right permission_denied)
- pitfalls 补充“判据的每一环都要带平台”的排障经验
2026-09-10 20:46:10 +08:00
suzmii 06f738dc99 将项目写锁从 project/filesystem.rs 纯搬移到 project/write_lock.rs
Project CI / Repository checks (pull_request) Successful in 2m37s
Project CI / Frontend tests (pull_request) Successful in 3m30s
Project CI / Backend tests (pull_request) Successful in 6m36s
Project CI / Native shell tests (pull_request) Failing after 13m57s
- 新建 project/write_lock.rs:取锁、等待分类、持锁方诊断、残留回收与 4 条锁用例整体搬移,逻辑不变
- project/filesystem.rs 只保留项目文件 IO(1533 → 680 行),锁相关常量、结构、进程判据与用例全部移出
- project.rs 注册 mod write_lock 并 pub(crate) use write_lock::*,crate::project:: 与 crate:: 既有路径不变
- windows_metadata_is_reparse_point 提为 pub(crate),供 write_lock 复用同一条 reparse point 判据
- agent_db.rs 与 checkpoint.rs 的 PROJECT_FILE_FLAG_OPEN_REPARSE_POINT 导入路径改为 super::write_lock
- 同步修正技术方案、Fast GDD 技术方案、decision-log、pitfalls 中指向锁实现的文件路径,并把“拆锁”从后续事项改为已完成
2026-09-10 20:12:28 +08:00
suzmii 8c639e5d13 修复项目写锁重试判据用一次元数据观察误判瞬时争用
- 项目写锁分类改为只按错误码判定重试性,不再用 path.exists() 决定“要不要等”:真机 6 万次建锁/删锁竞争实测 396-538 例命中“ACCESS_DENIED(5) + 目标不可见”,旧判据会让等待层立刻失败关闭,把毫秒级竞争换成更误导的 ACL 文案
- 新增 ProjectWriteLockFailure(Retryable / Terminal)与 acquire_project_write_lock_failure,有界等待改按类型分流,acquire_project_write_lock 退化为它的文案包装
- Windows 的 ACCESS_DENIED(5) 终态改判移到等待预算耗尽之后:只有真的等过预算且目标此刻仍不存在时才投影成权限拒绝,单次试探保持争用语义
- 锁分类判据改为平台参数传入(project_write_lock_open_failure_for),Linux CI 可覆盖 Windows 分支;替换原先只在 Windows 本地执行的分类用例
- 零等待入口在错误码不可区分时补一句“可能是删除挂起、删除拆链窗口或权限 / ACL 拒绝”,争用前缀逐字不变,调用方既有重试语义不受影响
- PROJECT_WRITE_LOCK_CONTENTION_PREFIX 收口 provider_recovery.rs、planning_session_v2.rs、direct_runtime.rs 三处手写文案
- project.write_lock.wait_exhausted 日志补 projection= 分类,attempts 记为实际尝试次数
- 同步更新技术方案、decision-log、pitfalls,并修正 ownerIsSelf 只比 PID 的表述
2026-09-10 20:07:28 +08:00
suzmii 59cab3d9fd Merge remote-tracking branch 'origin/master' into fix/issue-318-write-lock-classification 2026-09-10 19:58:05 +08:00
lhk229 36dc93222a 合并最新 master
Project CI / Frontend tests (pull_request) Successful in 3m23s
Project CI / Backend tests (pull_request) Successful in 5m41s
Project CI / Native shell tests (pull_request) Failing after 15m24s
Project CI / Repository checks (pull_request) Has been cancelled
2026-09-10 11:19:35 +00:00
lhk229 9b5d1fe107 修复仓库回退配置模板被读取通道私有化 ACL 锁定
Project CI / Frontend tests (pull_request) Successful in 3m30s
Project CI / Backend tests (pull_request) Successful in 6m27s
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
- config.rs 新增 game_creator_config_path_is_runtime_managed 判定,read_game_creator_config_file 按路径归属分流:AppData 托管目录内的真实凭据维持私有加固读取,仓库旁边的回退模板与 local 覆盖改用 open_project_snapshot_regular_file 非变异快照通道
- 根因:开发 CLI 无 AppHandle 时回退读取 worktree 内 git 跟踪模板,私有读通道在 Windows 上无条件收紧 DACL 为仅当前进程用户,导致其他账号与 cargo include_str! 全部 Access Denied
- tests/mod.rs 新增 clear_test_runtime_config_dir 辅助
- tests/configuration.rs 新增两个回归测试锁定快照 / 私有两条读取通道的分流
- pitfalls.md 记录该排障经验与读取通道副作用白名单教训
2026-09-10 08:57:31 +00:00
lhk229 aaa52c2b34 接入策划 Agent 生产迁移初版
Project CI / Repository checks (pull_request) Has been cancelled
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
新增独立设计会话、工作区工具和随包资源
platform-llm 支持 Responses 原生 input 续轮
无旧 V2 会话的策划入口切换到新设计 Agent
增加阶段审批、澄清卡和工作区文件浏览
同步迁移方案与决策记录
2026-09-10 08:45:11 +00:00
suzmii 81c2389132 修复 AGC Direct 写通道项目锁零等待与持锁方不可诊断
Project CI / Repository checks (pull_request) Successful in 3m9s
Project CI / Frontend tests (pull_request) Successful in 4m7s
Project CI / Backend tests (pull_request) Successful in 6m54s
Project CI / Native shell tests (pull_request) Failing after 14m11s
- Direct 写路径(agc_write_file)改用统一的有界等待,与 file.write / file.patch / file.delete 同语义,同一轮并行写多个文件按同一把锁串行,不再在 24-42ms 内把重叠判成"项目正在被其他写操作占用"
- create_new 失败拆成争用 / 权限拒绝 / 其它三类:锁文件不存在却仍创建失败不再投影成争用;sharing violation(32) 与 lock violation(33) 恒定归争用
- 争用错误与等待日志带上持锁方身份(commandId / pid / createdAt / ownerIsSelf),锁文件处于删除挂起或未写完时显式表达成"身份不可读"
- ProjectWriteLockSnapshot 补 commandId 与 describe_holder(),沿用既有快照 + 字节 CAS 回收机制,不新增第二套回收判据
- 有界等待预算耗尽记 project.write_lock.wait_exhausted(含等待毫秒数),权限拒绝记 project.write_lock.permission_denied,争用不在零等待入口里逐次记账
- 新增同进程重叠写等待、同轮并行写、活外部进程持锁带身份、权限拒绝分类、ACL 拒绝不投影成争用五条回归用例
- 同步 decision-log、pitfalls 与技术方案文档
2026-09-10 16:30:22 +08:00
suzmii a1b9b24891 修复 AGC Ctrl+C 残留上个工作树后端导致切换工作树复用旧后端 (#315)
Project CI / Frontend tests (push) Successful in 3m14s
Project CI / Backend tests (push) Successful in 8m54s
Project CI / Repository checks (push) Successful in 2m29s
Project CI / Native shell tests (push) Successful in 19m23s
closes #314

## 现象

`npm run agc` 按 Ctrl+C 后有概率残留上个工作树的 `api-server.exe` / SpacetimeDB,切换 worktree 再启动时 AGC 复用旧后端,改过数据库 / schema 的工作树会串库。

## 根因

1. Windows 下长驻服务都经 Node `shell: true` 的 `cmd.exe /d /s /c` 包装层启动,Ctrl+C 先杀包装层(`0xC000013A`);`dev.mjs` 的 `stopProcess` 见到直接子进程已退出就 return,`taskkill /PID <已退出 PID> /T /F` 也只会失败,深处的 `cargo → api-server.exe` 无人清理。
2. 按根 PID 遍历依赖快照里的父子链,中间层先消失时链断,只能拿到根 PID。
3. 复用判据只看 `.app/dev-stack.json` status 与 `/healthz`、`/readyz`、`/v1/ping`,不校验端口上的进程属于哪个工作树,残留后端照样被判为健康并复用。

## 改动

- 新增 `scripts/dev-windows-process.mjs`:按根 PID 遍历 + 按身份匹配(`server-rs/target/debug/api-server.exe` 绝对路径、SpacetimeDB `--data-dir`)两条独立清理路径,带 1s 快照缓存避免清理被拖慢。
- `scripts/dev.mjs`:直接子进程已退出时仍按记录 PID 清理后代;退出时按身份兜底清扫本工作树后端(复用他人 standalone 时跳过);启动前清理旧 api-server 保留 `Wait-Process` 语义,避免 `failed to remove file`。
- `apps/ai-game-creator-shell/scripts/start-dev-stack.mjs`:复用前校验端口监听进程归属,无法证明归属就不复用、改为启动本工作树后端并允许端口漂移;信号与 `finally` 各兜底清扫一次;`taskkill` 失败时降级按 PID 遍历;等待就绪时输出归属校验失败原因,避免静默超时。探测不可用时退化为旧行为,不阻断本地启动。
- 测试与文档:新增 `scripts/dev-windows-process.test.ts`、扩充 AGC 复用门禁用例;同步 `docs/project-memory/shared-memory/pitfalls.md` 与本地开发运维文档。

## 验证

- 伪造 `api-server.exe` 进程:按身份精确命中并杀掉(`matched=[17284] stopped=[17284]`)。
- 3 个真实监听进程下归属判定:`owned` / `api-server-owner-mismatch` / `spacetime-owner-mismatch` 均正确。
- `npx vitest run scripts/dev.test.ts scripts/dev-windows-process.test.ts scripts/dev-stack-port-utils.test.ts apps/ai-game-creator-shell/tests/...`:119 passed(唯一失败为 Windows 文件权限用例,已确认在合并基线 `origin/master` 上同样失败)。
- `node --check`、`eslint --max-warnings 0`、`prettier --check`、`npm run check:encoding`、`git diff --check` 全部通过。

## 备注

Rust 侧 `api-server` 的 `with_graceful_shutdown` 没有超时上限,是「有概率」的来源之一;本次只在 Node 侧收口,是否给优雅退出加 deadline 可另行评估。

Reviewed-on: https://git.genarrative.world/git/GenarrativeAI/Genarrative/pulls/315
Co-authored-by: Suzumiya <suzmii@qq.com>
Co-committed-by: Suzumiya <suzmii@qq.com>
2026-09-09 20:08:04 +08:00
suzmii c0ef876b14 修复 AGC 项目写锁回收的并发删除竞争与启动诊断死路径
Project CI / Backend tests (pull_request) Successful in 5m56s
Project CI / Repository checks (pull_request) Successful in 2m29s
Project CI / Frontend tests (pull_request) Successful in 3m5s
Project CI / Native shell tests (pull_request) Successful in 17m44s
- 锁文件回收改为单次快照解析:payload 只解析一次,删除前重新核对字节,内容已被并发方替换或文件已消失时返回 false 并重试 create_new,不再无条件 unlink,也不再把 remove_file 的 NotFound 当成硬失败
- mtime 读取失败改用 Option 区分“未知”与“纪元 0”:未知年龄不回收,未知锁创建时间不做 PID 复用推断,避免把保守判定反转成抢走活持有者
- 新增并发替换/已消失、旧格式活持有者、存活未知、mtime 未知四条回归用例
- 启动日志槽优先用已经生效的配置目录(含 --config-dir),否则退到平台配置根(APPDATA / Application Support / XDG_CONFIG_HOME)
- 日志路径未知时 StartupLogSlot::fail 仍然给出用户可见提示,四处 inspect_err 不再被路径判空挡掉
- 同步 check-config 守卫、decision-log、pitfalls 与技术方案文档的用例数与新判据
2026-09-09 19:44:46 +08:00
suzmii b7f27721c5 修复 AGC 项目写锁回收判据的跨平台 PID 边界
Project CI / Repository checks (pull_request) Successful in 3m8s
Project CI / Frontend tests (pull_request) Successful in 4m15s
Project CI / Backend tests (pull_request) Successful in 6m47s
Project CI / Native shell tests (pull_request) Successful in 17m58s
- 项目写锁存活判定把平台不可能分配出的进程号(0 或超出平台 pid 宽度)判为持有者不存在并直接回收,不再落回 600 秒保守分支
- 回归用例的死进程 PID fixture 由 0xFFFF_FFF0 改为 i32::MAX - 1,同时落在两个平台进程号空间之外且在 Unix 有符号 32 位范围内
- 新增 project_write_lock_reclaims_unrepresentable_owner_pid 用例,覆盖 u64::MAX 非法进程号残留锁
- 修正 project_lock_recovery 头部注释,说明这些用例是回归护栏而不是待修缺陷
- 同步 decision-log 的 PID 边界决策与 pitfalls 的跨平台 fixture 经验
2026-09-09 18:00:53 +08:00
suzmii 3153d4f674 修复 AGC 项目写锁残留无法回收与启动失败无诊断
Project CI / Repository checks (pull_request) Successful in 2m50s
Project CI / Frontend tests (pull_request) Successful in 3m30s
Project CI / Native shell tests (pull_request) Failing after 4m30s
Project CI / Backend tests (pull_request) Successful in 6m32s
- .agent/project.lock 新增 processStartedAt,PID 存活时核对进程启动身份,身份不一致判定 PID 复用并回收
- 旧锁缺少 processStartedAt 时退回“进程启动时间晚于锁 createdAt 加 5 秒容差”的 PID 复用推断
- 空锁 / 坏锁(崩溃停在 create_new 与落盘之间)宽限期由 600 秒收紧到 30 秒,无法判定持有者存活时仍保持 600 秒
- 新增 StartupLogSlot,配置目录就绪前后都能写 startup.log,startup.*.failed 与启动错误提示不再是死分支
- Windows 启动失败恢复系统消息框并附诊断日志路径,其它平台写 stderr,同一进程只提示一次
- 新增 project_lock_recovery 6 条回归用例:死 PID、空锁宽限、PID 复用时间推断、PID 复用身份不一致、身份一致不抢锁、新鲜空锁不抢锁
- 同步 decision-log 与 App 实施计划文档
2026-09-09 16:58:41 +08:00
lhk229 04128eb661 Merge branch 'master' into feat/design_agent_simple
Project CI / Repository checks (pull_request) Has been cancelled
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 (push) Successful in 2m48s
Project CI / Frontend tests (push) Successful in 3m26s
Project CI / Backend tests (push) Successful in 7m17s
Project CI / Native shell tests (push) Successful in 19m27s
2026-09-09 16:34:16 +08:00
k88936 7288c6f641 Fix/修复无限画布图标文字模糊 (#285)
Project CI / Repository checks (push) Successful in 2m59s
Project CI / Frontend tests (push) Successful in 3m29s
Project CI / Backend tests (push) Successful in 8m37s
Project CI / Native shell tests (push) Successful in 20m55s
closes #279
closes #284

实现: 从2(暂定)倍放大绘制的画布scale 0.5* 真正的scale

before:
![shotmd-1788579338.jpg](/attachments/9d44ec5e-454c-449b-86bc-b2131fbbc8cc)
![shotmd-1788578910.jpg](/attachments/c9da61a2-b467-43eb-a5de-e5e4d5cb8f70)

after:
![shotmd-1788580930.jpg](/attachments/f1f06e8e-90bf-45e2-a30b-a63ccc308c19)
![shotmd-1788583400.jpg](/attachments/c48ca741-e470-42b3-8030-064e0579f63a)
svg看起来stroke窄了一点点, 可以接受

Reviewed-on: #285
2026-09-09 16:32:43 +08:00
lhk229 852d9af483 合并最新 master
Project CI / Repository checks (pull_request) Successful in 2m44s
Project CI / Backend tests (pull_request) Successful in 13m7s
Project CI / Frontend tests (pull_request) Successful in 13m55s
Project CI / Native shell tests (pull_request) Failing after 29m47s
同步远端主线至 b129589e7

保留当前分支的 V1 清理与主线文档和测试更新
2026-09-09 06:06:35 +00:00
lhk229 310091d28e 合并最新 master
Project CI / Repository checks (pull_request) Failing after 9s
Project CI / Backend tests (pull_request) Failing after 9s
Project CI / Frontend tests (pull_request) Successful in 6m0s
Project CI / Native shell tests (pull_request) Has been cancelled
同步主线 DirectProject 历史与 Markdown 展示改动

保留策划 V2 退役方案文档索引
2026-09-09 05:49:33 +00:00
lhk229 08c5917490 修复配置覆盖层写入失败后的部分更新
Project CI / Frontend tests (pull_request) Successful in 3m5s
Project CI / Backend tests (pull_request) Failing after 3m52s
Project CI / Native shell tests (pull_request) Failing after 4m5s
Project CI / Repository checks (pull_request) Failing after 1m8s
提前序列化配置变更并在多文件写入失败时逆序回滚
保留单文件保存路径且不增加外部诊断或保存后回读
补充覆盖层写入失败回归测试及配置保存文档
2026-09-09 04:34:57 +00:00
lhk229 1b4f0ed203 修复原生应用CI测试与持久化图片生成恢复
Project CI / Repository checks (pull_request) Failing after 1m6s
Project CI / Frontend tests (pull_request) Successful in 2m42s
Project CI / Backend tests (pull_request) Successful in 10m7s
Project CI / Native shell tests (pull_request) Failing after 18m54s
将已有 HTML 项目测试夹具与 npm 项目初始化契约对齐
更新图片生成与角色提示词断言,移除已退役视觉门禁测试
按持久化请求快照恢复旧图片生成任务缺省参数
修正运行中生成任务查询的测试路由和响应夹具
同步技术方案与共享开发约定
2026-09-09 03:17:03 +00:00
k88936 d3f5d0a355 feat/AGC codex的工具调用 持久化处理 (#282)
Project CI / Repository checks (push) Successful in 2m7s
Project CI / Frontend tests (push) Successful in 2m46s
Project CI / Backend tests (push) Failing after 3m53s
Project CI / Native shell tests (push) Failing after 3m50s
重构directproject的thread持久化,  保存response items用来恢复thread

修改了DirectProject的对话jsonl格式,  不兼容不迁移. (测试需要手动清理旧对话jsonl文件)

AGC显式写入user msg, 对codex 返回的user msg忽略
清理原来的上下文滑动窗口, 因为codex内部会自动compact

工具调用后重启,继续对话:
![shotmd-1788579616.jpg](/attachments/8350c924-9498-47cd-b3da-8be6b79696f9)

close #249
close #277

---------

Co-authored-by: 段舒康 <kdletters@qq.com>
Reviewed-on: #282
Co-authored-by: 王德宇 <kvtodev@outlook.com>
Co-committed-by: 王德宇 <kvtodev@outlook.com>
2026-09-08 22:04:37 +08:00
lhk229 14d76419b8 修复策划回答身份绑定与迟到恢复结果覆盖
Project CI / Repository checks (pull_request) Successful in 2m48s
Project CI / Backend tests (pull_request) Successful in 6m28s
Project CI / Native shell tests (pull_request) Failing after 13m45s
Project CI / Frontend tests (pull_request) Successful in 44m47s
在既有回合锁内核对问题与会话身份,保留已完成回合重放。
前端回答携带卡片问题标识,hydrate 写回前检查请求序列和项目路径。
补充后端与界面回归测试,同步技术合同与项目决策。
2026-09-08 13:25:24 +00:00
lhk229 8d03b73582 修复 Planning V2 恢复与审批重放
Project CI / Frontend tests (pull_request) Successful in 12m56s
Project CI / Backend tests (pull_request) Successful in 22m19s
Project CI / Repository checks (pull_request) Failing after 33m17s
Project CI / Native shell tests (pull_request) Failing after 33m40s
恢复已落盘结构化 question 为成功回合并补齐会话投影

允许审批 receipt 在重启后复用原始 decisionId

恢复旁路不干扰正常 run 并补充设计原则文档
2026-09-08 12:52:18 +00:00
lhk229 c8fec98758 Merge branch 'master' into feat/design_agent_simple
Project CI / Repository checks (pull_request) Failing after 2m8s
Project CI / Backend tests (pull_request) Successful in 17m24s
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
2026-09-08 19:12:36 +08:00
lhk229 2fa967a93a 删除策划 V1 的测试脚本入口并同步退役文档
Project CI / Repository checks (pull_request) Failing after 12s
Project CI / Backend tests (pull_request) Failing after 9s
Project CI / Frontend tests (pull_request) Successful in 3m15s
Project CI / Native shell tests (pull_request) Failing after 15m21s
删除 agent-swarm-test-chat.mjs 的 --plan 模式、自动 GDD 审批回路与 planning 产物检查
删除根与应用 package.json 的 test:plan / test:plan:manual / agc:test:plan* 四条脚本
同步删除 agentSwarmTestEntry.test.ts 中只覆盖 V1 审批回路与 --plan 参数的用例
GddApprovalCard.tsx 注释改指 planning_gdd_model.rs 的现行路径权威定义
立项策划Agent(Fast GDD)方案文档头部标注已退役,仅作历史推导记录
策划会话 Runtime V2 方案文档状态更新为 P5 已完成并记录源码删除执行清单
Provider 兼容性缺陷文档的缺陷 4 标注相关代码已随 V1 退役删除
decision-log 新增 2026-09-08 策划 V1 链路源码整体退役决策记录
2026-09-08 10:43:38 +00:00
kdletters 1498247e9f AGC产物迁移npm与Phaser4
Project CI / Repository checks (push) Successful in 2m54s
Project CI / Native shell tests (push) Failing after 16m56s
Project CI / Frontend tests (push) Successful in 3m4s
Project CI / Backend tests (push) Successful in 8m10s
新增 npm + Vite + Phaser 4.2.1 游戏工程脚手架

允许 DirectProject 在项目边界内安装依赖并执行构建

让预览、静态检查、投影和试玩导出统一使用 dist 产物

补充 Phaser Skill、技术方案、项目记忆和定向测试
2026-09-08 15:11:36 +08:00
suzmii 456cc42dd3 优化泥点流水的素材消耗原因展示 (#302)
Project CI / Repository checks (push) Successful in 1m59s
Project CI / Frontend tests (push) Successful in 3m7s
Project CI / Backend tests (push) Successful in 6m13s
Project CI / Native shell tests (push) Successful in 19m24s
Close #296

## 问题

钱包流水目前只把素材类扣费暴露为 `asset_operation_consume`,共享账单组件统一显示“资产操作消耗”,无法说明本次泥点实际用于哪类素材生成。

## 落地方案

- 在既有钱包流水 metadata 中记录服务端确定的 `assetKind`,不修改 SpacetimeDB schema。
- `api-server` 只将内部素材类型白名单映射为用户可见 `reason`,不暴露原始 metadata、资源 ID 或任务 ID。
- 共享钱包流水契约与组件优先展示具体原因;历史、未知或空 metadata 继续回退为“资产操作消耗”。
- 主站、图片画布与 AGC 继续复用同一共享账单组件。

## 当前进度

- [x] 补充权威后端数据契约
- [x] 写入素材操作类型 metadata
- [x] 扩展钱包流水公开 DTO 与安全映射
- [x] 更新共享账单展示与回归测试
- [x] 完成定向验证与边界检查

## 用户可见映射

- 图片、图标图集、美术规范、UI 设计、发布素材:生成美术素材
- 图片修改:编辑美术素材
- UI 素材提取:提取美术素材
- 角色动画:生成角色动画
- 视频:生成视频素材
- 音效:生成音效素材
- 背景音乐:生成背景音乐
- 历史、未知、空 metadata:资产操作消耗

## 验证

- `cargo fmt --all -- --check`
- `cargo test -p api-server profile_wallet_ledger_reason_only_exposes_known_asset_operations`
- `cargo test -p api-server worker_billing_context_freezes_charge_and_preserves_job_metadata`
- `cargo test -p shared-contracts profile_wallet_ledger_response_uses_camel_case_fields`
- `npx vitest run packages/shared/src/components/PlatformProfileWalletLedgerModal/index.test.tsx`
- `npm run typecheck`
- `npx eslint packages/shared/src/components/PlatformProfileWalletLedgerModal/model.ts packages/shared/src/components/PlatformProfileWalletLedgerModal/index.test.tsx packages/shared/src/contracts/runtime.ts`
- `npm run check:encoding`
- `npm run check:spacetime-schema`
- `git diff --check`

以上均通过;Rust 仅输出仓库已有 dead-code warnings。

## 未验证边界

- 未执行真实登录、生成并读取新钱包流水的端到端联调。本机 `8082/3101` 已由另一套本地栈占用,为避免当前分支挂接同一数据库并带起 worker 处理现有队列,本轮未启动 `npm run dev:api-server`。
- 四项远端 CI 已全部通过,PR 已转为 Ready for review。

## 不变项

- 不修改历史流水数据。
- 不调整泥点价格、扣费顺序、幂等 ledger、失败退款或余额结算。
- 不修改 SpacetimeDB schema。

---------

Co-authored-by: 段舒康 <kdletters@qq.com>
Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/302
Co-authored-by: Suzumiya <suzmii@qq.com>
Co-committed-by: Suzumiya <suzmii@qq.com>
2026-09-08 14:56:16 +08:00
lhk229 d7a09276e6 合并 origin/master 到 feat/design_agent_simple
- 合入 AGC 官方 LLM Router 账号链路与流式联网输出(#242)
- 新增后台模型别名与对话选择能力及 AGC 模型目录
- 解决 ProjectSupervisorView.tsx 与 decision-log.md 冲突
2026-09-07 03:07:05 +00:00
suzmii 736a1b6ac6 接入 LLM Router 累计额度结算
Project CI / Repository checks (pull_request) Successful in 2m36s
Project CI / Frontend tests (pull_request) Successful in 3m15s
Project CI / Backend tests (pull_request) Successful in 7m35s
Project CI / Native shell tests (pull_request) Failing after 7m43s
按 Router used_quota 累计值与首次基线结算泥点
新增原子 checkpoint 事务及 llm_router_consume 钱包流水
同步额度查询校验、前端展示、生成绑定和技术文档
2026-09-06 00:36:31 +08:00
lhk229 267c085b57 澄清策划V2流式事件契约
Project CI / Repository checks (pull_request) Has been cancelled
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
明确 Provider 流式传输属于底层实现能力

明确 text_delta 是 Runtime 内部事件而非前端业务事件

明确用户可见结果以结构化工具调用为准

补充文档措辞约束避免误读
2026-09-05 11:59:47 +00:00
suzmii 34e3f70409 补充服务启动配置校验并优化模型菜单
Project CI / Repository checks (pull_request) Has been cancelled
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
启动时校验 LLM Router 地址、模型和相关密钥配置

将刷新操作移入模型展开菜单并修复菜单样式覆盖

更新启动运维文档与定向测试
2026-09-05 19:48:27 +08:00
lhk229 2d7226dad8 修复策划V2修改意见撞项目锁
V2 审批、续跑、落盘、失败投影和 GDD 认领改为完整等待窗口
V2 hydrate 改为短窗口等待
前端 V2 hydrate 忽略瞬时锁争用
补充审批、续跑、hydrate 锁等待测试
同步决策、踩坑和技术方案
2026-09-05 11:28:37 +00:00
suzmii 4f3f0f24ff 接入AGC后台模型目录与对话模型选择
新增后台 AGC 模型目录、别名、启停和默认项管理

客户端设置页恢复原状,对话框右下角按别名选择模型

服务端按稳定模型标识映射并校验实际模型白名单

修复 AGC 配套后端端口漂移、启动等待和 SpacetimeDB 版本检查

补充迁移、文档、启动与模型选择测试
2026-09-05 19:10:49 +08:00
lhk229 4127686e18 修复新建项目锁误触发 Windows UAC
Project CI / Repository checks (pull_request) Failing after 15s
Project CI / Backend tests (pull_request) Failing after 16s
Project CI / Frontend tests (pull_request) Successful in 2m39s
Project CI / Native shell tests (pull_request) Successful in 17m50s
新建 sidecar 改为本进程收紧 DACL,不再因继承 ACE 自动提权。
项目锁先写入并释放独占句柄后再 harden,回读内容校验,不再对这把新锁走 prepare_for_read。
提权 ArgumentList 改为一条按 Windows 规则加引号的字符串,避免含空格路径被拆开。
补充含空格项目根取锁与 quoted ArgumentList 定向测试。
同步 ACL 提权边界、决策记录和排障记录。
2026-09-05 10:53:15 +00:00
lhk229 b1456d9f11 修正策划V2流式交互契约
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
明确用户交互以工具调用结果为准

取消逐 delta 投影的业务契约要求

同步技术方案与长期决策记录
2026-09-05 08:17:04 +00:00
lhk229 27246fbc5e 收口P4并关闭旧版策划入口
Project CI / Repository checks (pull_request) Has been cancelled
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-supervisor-plan 来源统一返回退役错误

避免旧入口启动 Runtime 或 Provider

同步收口 P4 验收状态与最简 P5 方案

记录 V1 不迁移且历史文件只读保留
2026-09-05 08:10:26 +00:00
lhk229 861ed14a6f 补充策划问询不对称设计说明
明确模型侧 3 轮策略与 Runtime 侧 8 个问题门禁的分层语义

补充自动评测和代码评审口径,说明两者有意不对称
2026-09-05 07:07:31 +00:00
lhk229 1b764fd878 补充策划 Provider 诊断持久化
保存 Planning V2 每次 Provider 尝试的请求、响应和解析分类产物

诊断写入不参与工作流、恢复、重试或 GDD 判断

同步 Planning V2 技术方案与项目决策记录
2026-09-04 13:22:34 +00:00
lhk229 0c7ddf26db 调整策划 V2 决定 ID 由 Runtime 分配
删除 plan_submit_gdd Provider schema 中的 decisions[].id 和 prototypeValidationItems[].id

由 Runtime 生成 initial-request 与后续决定 ID,并绑定原型验证项

同步更新 Planning V2 技术方案和项目决策记录
2026-09-04 12:15:45 +00:00
lhk229 ca62243628 修复策划 V2 孤儿 GDD 无法恢复
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
把 gdd.vN.json 创建成功当作提交点

persist、hydrate 与回合启动认领下一连续版本并补投影

重试不再用新 UUID 覆盖同一版本

补充孤儿认领与下一版本分配测试
2026-09-04 10:47:17 +00:00
lhk229 c1d967b17d 将策划 V2 输出从正文 JSON 改为协议工具
Project CI / Backend tests (pull_request) Failing after 14s
Project CI / Repository checks (pull_request) Failing after 14s
Project CI / Native shell tests (pull_request) Successful in 17m12s
Project CI / Frontend tests (pull_request) Successful in 3m43s
挂 plan_ask_question / plan_submit_gdd,tool_choice 固定 auto

删除正文 JSON 解析、骨架提示词和入参 schemaVersion 必填

形状改由工具 schema 承担,既有校验门禁与落盘 plan-gdd.v2 不变

同步技术方案、决策记录和 DeepSeek thinking 排障
2026-09-04 10:10:50 +00:00
lhk229 67c2f85743 精简策划 V2 提示词为形状和策略
Project CI / Backend tests (pull_request) Failing after 21s
Project CI / Repository checks (pull_request) Failing after 15s
Project CI / Frontend tests (pull_request) Successful in 2m54s
Project CI / Native shell tests (pull_request) Successful in 19m25s
system prompt 只保留问询/GDD 骨架、同级字段边界和一行易错数量范围

去掉逐字段长度清单和 V1 编排残留说明,校验与重试路径不变

同步 Runtime V2 技术方案和项目决策记录
2026-09-04 08:04:14 +00:00
lhk229 45568797f9 将策划 V2 既有阻断校验回灌给 Provider
把当前 question/GDD 硬校验契约写入 V2 system prompt,不扩大校验范围或新增门禁

校验失败的一次重试改为列出具体阻断原因并要求逐项修复

同步 Runtime V2 技术方案和项目决策记录
2026-09-04 07:40:36 +00:00
lhk229 f35ec812d9 完善策划 V2 人工测试与推断语义
修复做方案首轮额外命名等待、处理中反馈和重复错误展示

补全 GDD 输出字段提示,避免模型生成非法 decisions 字段

统一 V2 assumption_pending 与 agent_inferred 语义并同步核心闭环问询策略

保持旧 Supervisor/V1 的 default_pending 与 default 语义不变

更新 Runtime V2 技术方案和项目决策记录
2026-09-03 13:15:14 +00:00
suzmii 703b90938b 合并 master 并保留 Router 账号链路整改
合并 origin/master 最新 UI 编辑器与 AGC 运行时变更

保留 external_api_key 恢复为 master 原始结构

保留 LLM Router 凭据统一存储于 llm_router_account 的整改

解决 App.tsx 与 appSurface 测试冲突并完成定向验证
2026-09-03 20:05:50 +08:00
lhk229 eecd097117 Merge branch 'master' into feat/design_agent_simple
Project CI / Repository checks (pull_request) Has been cancelled
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
2026-09-03 19:32:23 +08:00
k88936 520b9344ef Fix/AGC上下文丢失问题 (#247)
Project CI / Frontend tests (push) Successful in 3m27s
Project CI / Backend tests (push) Successful in 7m20s
Project CI / Repository checks (push) Successful in 3m1s
Project CI / Native shell tests (push) Has been cancelled
权衡之后选择附加历史消息构造一个巨大的prompt
before:
```
1. user:  aabb
2. assistant: bbaa 这里codex崩溃了或者重启上下文丢失
```
after:
重启之后发送新消息abab
 codex看到:
```
user:  aabb
assistant: bbaa
这里崩溃了!
user: abab
```

移除了原来的"会话最后只有用户消息就自动重新发送用户消息"功能, 因为存在冲突: 现在的实现是每次用户手动发送新消息才做以上的步骤

before and after:
![shotmd-1788345830.jpg](/attachments/28549e4d-9913-459a-bae2-a195b8ee9e04)

Close #249

---------

Co-authored-by: 段舒康 <kdletters@qq.com>
Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/247
Co-authored-by: 王德宇 <kvtodev@outlook.com>
Co-committed-by: 王德宇 <kvtodev@outlook.com>
2026-09-03 19:30:21 +08:00
lhk229 059808d9e8 接入策划会话 Runtime V2 入口与界面
Project CI / Repository checks (pull_request) Has been cancelled
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
做方案入口改用 start/continue/decide_planning_session_v2 命令

新增 V2 Session、问题、GDD 和审批结果的前端适配层

接通 hydrate 会话历史、流式回复、问询卡、审批卡和处理耗时展示

保持做游戏、做素材及无 V2 旧项目读取路径不变

同步策划入口回归测试、Runtime V2 技术方案和项目决策记录
2026-09-03 11:29:55 +00:00
suzmii 6d41dc2f89 切换 LLM Router 凭据到专用账号表
Project CI / Backend tests (pull_request) Failing after 15s
Project CI / Repository checks (pull_request) Failing after 16s
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
- 将 Router 账号、API Key 元数据和密文统一保存到 llm_router_account

- 增加 Router API Key 的进程内缓存并清理旧 external_api_key 兼容路径

- 更新 SpacetimeDB 绑定、后端架构文档和决策记录
2026-09-03 19:03:40 +08:00
lhk229 12da570d28 策划 Agent Runtime V2 完成 P2 产物闭环
新增单 Agent GDD 策略、版本产物和审批命令

补齐问询计数、上下文进度和输出校验边界

注册 Planning V2 Tauri 命令并纳入私有产物路径

更新 Runtime V2 技术方案与项目决策记录
2026-09-03 10:04:48 +00:00