Commit Graph

5382 Commits

Author SHA1 Message Date
k88936 f631a2f06b 清理失效的 generated TS 覆盖配置
删除 .prettierrc.json 中指向 packages/shared/src/contracts/generated/**/*.ts 的 overrides
该目录已加入 .prettierignore,覆盖项不再生效,只会误导维护者

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 11:15:11 +08:00
k88936 06eb4e668c 修复(计费): 升级报价总期数改由周期类型推导
- 删除 RuntimeProfileMembershipUpgradeQuoteInput.cycle_count 入参,改由 target.cycle_kind.cycle_count() 推导(月付 1 / 年付 12),杜绝入参期数与周期类型不一致导致按错误期数计费
- 报价数值自检的期号上界改为相对推导出的总期数判断
- spacetime-module 构造报价入参时不再传 cycle_count
- 同步升级报价单测:年付 12 期、当前第 3 期 → 剩余完整月数 9,金额与测试夹具一并修正
- 同步设计文档 §3 入参与自检说明、§5.3 年付示例(remainingFullMonths 9 / amountCents 158334)

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 20:26:48 +08:00
k88936 bc3d8dc7da 注释(计费): 记录会员目录重建暂不缓存的原因
runtime_profile_membership_plan_catalog 加 TODO,说明每次重建只有 5 行、开销可忽略

按作者意见标记 wont fix,暂不改 LazyLock / &'static 缓存

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 20:06:07 +08:00
k88936 51c5784c46 文档(计费): 同步会员档位 rank 可失败返回说明
ADR §3 更新 runtime_profile_membership_plan_rank 签名为 Option<u8>

说明目录缺行时返回 None,不再用 unwrap_or(0) 伪装成 Normal

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 20:06:01 +08:00
k88936 047e6d72e4 重构(计费): 会员档位 rank 解析改为可失败返回
runtime_profile_membership_plan_rank 返回 Option<u8>,目录缺行时返回 None

去掉 unwrap_or(0),不再把目录缺失伪装成 Normal 而误报 NotUpgrade

plan_rank_follows_catalog_order 测试断言同步改为 Some(..)

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 20:05:51 +08:00
k88936 3eaae417ba 文档(计费): 补充升级报价数值入参自检说明
- 在领域数据结构 §3 记录 quote_runtime_profile_membership_upgrade 的防御式自检与 invalid_quote_input 拒绝

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:58:39 +08:00
k88936 83dbd0cc77 修复(计费): 升级报价拒绝越界数值入参
- 新增 RuntimeProfileMembershipUpgradeRejection::InvalidQuoteInput 及 wire token

- 报价前校验期号范围与账期窗口,避免 saturating_sub 静默夹取

- 新增 invalid_numeric_input_is_rejected 回归测试

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:57:04 +08:00
k88936 f09701f6d4 重构(计费): module-runtime 去掉通配 re-export 改为策展导出
- lib.rs 移除 pub use civil_calendar::*,公历基元只保留 civil_calendar:: 命名空间

- lib.rs 移除 pub use membership::*,改为只重导出对外的会员契约符号

- 未改动 spacetime-module / spacetime-client / api-server,现有引用保持可用

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:56:54 +08:00
k88936 8e1471d7af 测试(计费): 固化会员目录价格与泥点随 rank 递增的不变量
在 catalog 文档写明升级补差依赖的单调性不变量,并新增回归测试断言 rank 越高月价、年价、每期泥点严格递增

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:23:36 +08:00
k88936 58a79a2e4e 修复(计费): 北京本地时间换算校验当日时刻范围
beijing_local_micros 增加 time_of_day_micros 越界即返回 0 的校验,避免越界时刻被解释成另一天

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:22:36 +08:00
k88936 5ab6f161d0 文档(计费): 修正北京本地时间换算的返回值说明
beijing_local_micros 文档由「本地日期不存在返回原值」改为「返回 0」,与实际实现一致

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:13:31 +08:00
k88936 f810064657 文档(计费): 澄清档位排序以目录 rank 为准
RuntimeProfileMembershipPlan 文档改为说明排序由目录 rank 决定、枚举不实现 Ord,避免误以为变体顺序是排序契约

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:13:10 +08:00
k88936 8b8213f0c8 修复(计费): 公历反算避免 i64 溢出
civil_from_days 用 saturating_add 计算日序号偏移,消除 date_key 接近 i64::MAX 时的加法溢出

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:12:34 +08:00
k88936 603ecb0887 修复(计费): 星期换算避免 i64 溢出
weekday_from_date_key 先按 7 取模再加偏移,消除 date_key 接近 i64::MAX 时的中间加法溢出

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:11:59 +08:00
k88936 5bb98fd8fc chore(契约): 生成产物不进 prettier,恢复逐字节一致
- .prettierignore 排除 packages/shared/src/contracts/generated/:prettier 重排会让 check:generated-bindings 的「重新生成逐字节比对」永远失败
- 按 ts-rs 实际输出重新生成 ProfileMudPointBalanceResponse.ts(含字段文档注释)

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:05:57 +08:00
k88936 a7cde25b28 docs(计费): 设计文档与决策记录更新为已落地
- 【技术设计】泥点三池与会员计费后端设计:余额投影改为扁平三池标量、报价请求不收周期、会员订单 product_id 编码档位与周期、充值中心改 membershipPlans,新增后台接口与 ts-rs 契约生成小节
- §10.2 实施状态由「待落地清单」改写为「已落地 + 明确不做」,注明永久余数仍是推导实现
- docs/README 索引标注两份文档已落地;decision-log 追加 2026-10-02 状态与实现期补充决断

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:03:55 +08:00
k88936 de082ad81a feat(后台): 新增会员档位页并收敛充值商品页
- 充值商品页改为纯泥点商品:去掉会员档位与 membership_* 字段,固定 kind=points,首充赠送默认 0
- 新增会员档位页:按档位枚举改月价 / 年价 / 每期泥点 / 模型权限 / 并发上限 / 可购买 / 排序,rank 只读
- adminApiTypes 用档位枚举替换旧 tier 类型并补会员档位请求响应类型,客户端补 listProfileMembershipPlans / upsertProfileMembershipPlan
- 注册 #membership-plans 路由与侧边栏图标

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:03:40 +08:00
k88936 144068187c 重构(平台入口): 平台侧与 AGC 壳改用三池余额,退役 legacy 总额写入通道
- 平台入口与钱包 store 不再从充值中心响应读 walletBalance,合计改为按三池派生
- AGC 账户钱包同步:只透传 mudPointBalance,删掉 RechargeContent 的 walletBalance 排除项
- 删除已无生产调用方的 applyLegacyWalletBalanceSnapshot 与对应测试;明细读取失败不再伪造「只有总额」的中间态
- 图片编辑器与平台入口测试 fixture 改为三池形状,钱包面板断言改用「永久泥点 / 月度泥点」

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:03:30 +08:00
k88936 3b9d645042 重构(钱包): 共享组件与钱包 store 改用三池余额
- createProfileWalletStore 的余额状态改为三池视图,去掉「响应只有 walletBalance 时兜底」的旧分支,缺少 mudPointBalance 一律算读取失败
- 泥点明细面板并列展示永久泥点 / 月度泥点 / 每日免费泥点,月度行带北京时间刷新时刻;「不限时泥点」标签改为「永久泥点」
- 充值弹层当前余额改用三池合计,不再读 walletBalance
- 三池与首充赠送相关的 store、明细面板、充值弹层测试同步更新

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:00:23 +08:00
k88936 abc92d230b chore(契约): 三池余额 DTO 交给 ts-rs 生成,同步 SpacetimeDB 绑定
- 给 ProfileMudPointBalanceResponse 加 ts-bindings 特性下的 ts_rs::TS 导出,u64 标 ts(type = "number") 避免前端分叉成 bigint
- 新增 packages/shared/src/contracts/generated/ProfileMudPointBalanceResponse.ts,runtime.ts 改为 re-export 不再手写第二份字段
- 新增 packages/shared/src/utils/mudPoints.ts:派生展示用合计与北京时间月度刷新文案
- 同步 spacetime-client 生成绑定:升级报价改名为 snapshot,与 module 侧改动对齐

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:00:08 +08:00
k88936 c772600d59 feat(会员): 新增补差升级报价接口、后台档位读写与订单权益快照
新增 POST /api/profile/membership/upgrade-quote:只读报价,下单时后端用同一纯函数重算

新增后台 /admin/api/profile/membership-plans 的读取与按档位改价改权益接口

订单与管理端契约补上会员权益变更快照(变更前后档位、周期、补点、有效期与价格拆分)

报价结果统一走「模块侧快照 + application 记录侧投影」两段式,与既有 DTO 约定一致

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 17:36:26 +08:00
k88936 703a24b682 重构(计费): 余额接口并列暴露三池并去掉会员 tier 字段
- 余额响应改为每日免费 / 月度 / 永久三池并列,不再暴露总额与会员限时泥点
- 会员响应与充值中心以 plan 取代 tier,充值中心改为输出会员目录
- 微信虚拟支付按目录档位校验会员商品,不再依赖会员商品配置行
- 同步 shared-contracts 测试夹具到新的三池与 plan 口径

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 16:59:49 +08:00
k88936 e98564e13c 重构(会员): 会员目录与自然月账期落到数据库与领域层
- 领域层新增会员档位枚举、自然月账期、目录快照与补差报价入参,删除旧 tier 相关函数
- profile_membership 表以 plan 与自然月期数取代 tier 与固定 30 天周期
- profile_recharge_order 末位追加会员权益变更快照,供人工复核退款
- profile_membership_plan 目录表成为价格与权益的唯一真相源,新增后台读写接口
- 充点商品收敛为六档且取消首充赠送,旧播种行按新规则迁移
- 充值中心改为输出会员目录,不再输出会员商品行与权益矩阵
- 重新生成 SpacetimeDB 绑定并同步客户端映射与 facade

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 16:59:34 +08:00
k88936 03073564b1 重构(会员): 会员表列改为 plan 与自然月账期,订单落权益变更快照
profile_membership 删除 tier / cycle_period_days 与四个会员商品权益列,末位追加 plan、cycle_index、cycle_count、cycle_kind

profile_recharge_product_config 删除 tier 与四个会员权益列,只保留充点商品;会员商品不再落该表

profile_recharge_order 末位追加会员变更快照列(变更类型、前后档位、前后周期、补点数、前后到期日 / 刷新日、价格快照)

会员周期刷新改为按北京时间自然月从原始锚点重算,到期清月度余额、永久泥点不受影响

会员购买与升级改走目录表实时价格:有效期内同周期升档按补差报价,补点向下取整、金额向上到分

会员账本幂等锚改为订单维度(membership-period-grant / membership-upgrade-grant 加订单 ID)

充点商品迁移规则改为六档无首充赠送,旧首充赠送行与停用的 ¥128 / ¥328 行一并归一

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 15:54:28 +08:00
k88936 01c7cc8b66 重构(会员): 档位身份改为 plan 枚举,价格以目录表为真相源
- 领域层清理:删除 RuntimeProfileMembershipTier 及旧的 tier 别名体系
- 会员目录行改名 RuntimeProfileMembershipPlanRecord,快照新增 enabled 字段
- 补差升级报价入参改为「目录表解析出的当前/目标套餐快照」
- 新增会员商品 product_id 编解码(档位 + 周期,严格解析拒绝未知 token)
- 报价与允许操作矩阵改为读取快照 rank / enabled,不再走编译期常量

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 15:38:52 +08:00
k88936 71c778ccee feat(会员): 会员档位目录随充值商品配置播种
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m23s
Project CI / Backend tests (pull_request) Failing after 28s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m56s
Project CI / Frontend tests (pull_request) Successful in 2m59s
Project CI / Repository checks (pull_request) Failing after 15s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m0s
Project CI / Native shell tests (pull_request) Successful in 7m6s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 11m24s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 13m27s
- 新增 ensure_default_profile_membership_plan,表为空时按会员目录种子整表播种。
- 播种入口挂在 ensure_default_profile_recharge_product_config,表非空时保留后台改价。
- 设计文档 §10 改为「已确认输入 + 实施状态」,记录三项拍板结论。
- 设计文档补充实施约束:module-runtime 与 spacetime-module 相互依赖,领域层清退必须与 schema 变更同批提交。
- 设计文档列出待落地清单(会员遗留清退、三池 DTO、报价接口、充点 6 档、前端同步)。
2026-10-02 15:02:15 +08:00
k88936 1790ddff6a Revert "重构:清退会员遗留档位与商品权益字段"
This reverts commit 103f3b548a.
2026-10-02 15:00:04 +08:00
k88936 103f3b548a 重构:清退会员遗留档位与商品权益字段
- 删除 RuntimeProfileMembershipTier 枚举与会员权益快照/记录。
- 会员快照与记录的 tier 改为 plan 枚举,新增 cycle_index / cycle_count / cycle_kind。
- 充点商品快照/记录与配置快照/记录移除 tier 及四个 membership_* 字段。
- 充值中心快照/记录改用 membership_plans,取代 membership_products 与 benefits。
- 充点商品重播种为六档并取消首充赠送,删除会员商品构造与档位查表 helper。
- 后台充值商品 upsert 只接受泥点商品,会员商品改由会员计划目录维护。
2026-10-02 14:55:31 +08:00
k88936 61d4db4610 feat(会员): 新增会员计划目录表 profile_membership_plan
- spacetime-module:新增 profile_membership_plan 表,主键为档位枚举 RuntimeProfileMembershipPlan,一行一档承载月价 / 年价 / 每期额度 / 模型权限 / 并发上限
- migration.rs:表目录登记 profile_membership_plan
- spacetime-client:重新生成绑定,新增目录表与档位 / 模型权限枚举
- docs:后端数据契约新增 profile_membership_plan 说明,并把表定义源码路径修正为 runtime/active/profile.rs

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:49:43 +08:00
k88936 f6fbd2a392 chore(会员): 删除未被引用的旧表定义副本
- spacetime-module:删除 src/runtime/profile.rs,它未被 src/runtime.rs 挂载(真正生效的是 runtime/active/profile.rs)
- 避免设计文档与实现指向失效文件,也避免后续删列改动误落两份

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:36:16 +08:00
k88936 26e1ea9e27 feat(泥点): 账本来源追加会员升级补点
- module-runtime:RuntimeProfileWalletLedgerSourceType 末尾追加 MembershipUpgradeGrant,保持枚举只追加
- shared-contracts:新增 PROFILE_WALLET_LEDGER_SOURCE_TYPE_MEMBERSHIP_UPGRADE_GRANT 常量
- api-server:后台枚举索引映射与来源格式化支持新来源,并补单测断言
- spacetime-client:手写 mapper 与生成绑定同步新增变体
- packages/shared 与主站前端:钱包流水来源标签新增「会员升级补点」

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:33:16 +08:00
k88936 ba22d178d3 重构:会员领域模块归并到 membership 目录
- 把 membership_catalog/cycle/limits/upgrade 四个文件移入 src/membership/ 并去掉公共前缀
- 新增 membership/mod.rs 统一声明子模块并按依赖顺序导出
- lib.rs 改为 pub mod membership,删除旧的四个模块声明
- membership/upgrade.rs 内部引用改为同级模块路径
- 无行为变化,cargo test -p module-runtime 全通过

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:21:01 +08:00
k88936 2b77fa08c3 领域层:新增会员补差升级报价纯函数
- 新增 membership_upgrade.rs:quote_runtime_profile_membership_upgrade 与 RuntimeProfileMembershipUpgradeQuoteInput / RuntimeProfileMembershipUpgradeQuote
- 月付按「新月价 − 当前月价」「新每期额度 − 当前每期额度」;年付按 (新年价 − 当前年价)/12×(后续完整月数 + 本期剩余比例)
- check_runtime_profile_membership_upgrade_allowed 实现允许操作矩阵:非会员 / 周期变更 / 同档降档 / 目标不可购买一律拒绝
- membership_cycle_remaining_ratio_ppm 计算本期剩余比例(ppm,向下取整)
- 金额向上取到分、补点向下取整;有效期 / 刷新日 / 期数保持不变
- 单测复现 spec 示例:Plus 月→Pro 月 ¥200 / 2500 点 / 余额 3115;Plus 年→Pro 年 ¥1083.34 / 1250 点 / 余额 1865
- 设计文档同步报价函数签名与「后续完整月数 = cycle_count − cycle_index」口径

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:11:54 +08:00
k88936 33a4c8dbc3 领域层:新增会员计划目录种子与档位解析
- membership_catalog.rs:runtime_profile_membership_plan_catalog 一行一档(Starter ¥39/400/¥390、Plus ¥99/1150/¥990、Pro ¥299/3650/¥2990、Max ¥699/8650/¥6990、Normal 全 0 且不可购买)
- 新增 RuntimeProfileMembershipPlanCatalogRow 与 RuntimeProfileMembershipPlanSnapshot
- resolve_runtime_profile_membership_plan_snapshot 按所选周期取月价 / 年价;rank 与可购买判定只来自目录
- 单测覆盖档位覆盖与排序、价格与点数、年价独立存储、Normal 语义、周期取价
- 设计文档同步登记目录纯函数入口

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:10:10 +08:00
k88936 969ee329d7 领域层:新增会员自然月账期与并发上限纯函数
- membership_cycle.rs:北京时间锚点解析、自然月推进与月末夹取(1/31 → 2/28 → 3/31,从原始锚点重算)、期窗口、到期日、本期剩余微秒
- membership_limits.rs:并发上限哨兵 MEMBERSHIP_UNLIMITED_CONCURRENCY = 128 与 is_unlimited_concurrency
- lib.rs 注册并导出两个模块
- 单测覆盖闰年、跨年、窗口连续性、零索引归一、哨兵判定
- 设计文档同步:membership_cycle_window 去掉无用的 cycle_kind 形参并列出账期推进基元

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:09:04 +08:00
k88936 741b179ca5 重构:抽出公历日期基元为独立模块 civil_calendar
- 新增 server-rs/crates/module-runtime/src/civil_calendar.rs:days_in_month / is_leap_year / days_from_civil / civil_from_days / weekday_from_date_key
- application.rs 删除上述重复实现,改为引用新模块,行为不变
- 新模块自带单元测试:闰年规则、日序号往返、已知日期星期
- 后续会员自然月账期、分析维表等纯日期逻辑统一复用该模块

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:08:04 +08:00
k88936 b827c93d39 领域层:新增会员档位、周期、模型权限与变更类型枚举
- 新增 RuntimeProfileMembershipPlan { Normal, Starter, Plus, Pro, Max } 作为档位权威身份,取代旧 RuntimeProfileMembershipTier
- 新增 RuntimeProfileMembershipCycleKind:月付 1 期、年付 12 期(每期仍为一个自然月)
- 新增 RuntimeProfileMembershipModelAccess { Basic, Full } 与 RuntimeProfileMembershipChangeKind { Purchase, Upgrade }
- 四个枚举各带 as_str 与 parse,未知对外 token 返回 None,由调用方显式拒绝
- 新增集成测试 tests/membership_plan_enum.rs:token 往返、Normal 不可购买、期数映射、未知 token 拒绝

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:06:20 +08:00
k88936 482af92327 文档:泥点三池与会员计费后端方案定稿
- 新增【技术设计】泥点三池与会员计费后端设计-2026-10-02.md:三池投影、会员档位枚举与目录表、账期与补差升级、接口契约、破坏性迁移计划与遗留清理清单
- 新增【实施计划】双余额泥点与会员补差升级-2026-10-02.md:规则细则、与现状差异、里程碑与验收判据
- 新增【ADR】泥点三池以单一总额为权威-2026-10-02.md
- 新增【ADR】会员账期按开通日自然月-2026-10-02.md
- 新增【ADR】会员订单复用充值订单与补差升级幂等锚点-2026-10-02.md
- 新增【ADR】会员档位以枚举为权威-2026-10-02.md
- CONTEXT.md 新增会员档位、会员计划目录、模型权限、并发上限等规范词
- decision-log.md 追加 2026-10-02 双余额与会员计费决策条目
- docs/README.md 新增「钱包与会员计费」文档索引分区

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:06:05 +08:00
lhk229 f2127a6489 修复 AGC 文件列举被无关临时锁删除打断(#552) (#580)
Project CI / AI game creator shell Rust smoke (push) Successful in 2m6s
Project CI / AI game creator shell Rust crates (push) Successful in 1m10s
Project CI / Backend tests (push) Successful in 4m15s
Project CI / Native shell tests (push) Successful in 6m43s
Project CI / Frontend tests (push) Successful in 2m54s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 11m2s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 10m12s
Project CI / AI game creator shell web tests (push) Successful in 2m23s
Project CI / Repository checks (push) Successful in 3m14s
列举 `assets` 时,原实现先递归扫描整个项目,再过滤范围;`.agent/project.lock` 在枚举与读取元数据之间正常删除会使整次查询失败。

现在在读取条目元数据前裁剪目标范围与受保护路径,只遍历目标子树及必要祖先。枚举后消失的文件/目录仅跳过 `NotFound`,其余权限与 IO 错误仍返回;进入排队目录前复核符号链接与 Windows 重解析点。通用文件树保留原有可见范围,Agent 结果继续过滤、排序后分页。

通过通道协调真实项目写锁释放,确定性覆盖全量扫描的 TOCTOU 及定向 `assets` 扫描;另覆盖目录消失/类型变化、权限错误、私有路径、链接、引擎目录和分页。同步更新 AGC 契约与共享排障记录。

验证:

- 15 条定向 Rust 测试通过:`cargo test --locked --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml --bin genarrative-ai-game-creator-shell -- --test-threads=1 project_file_listing generic_file_tools local_project_file_commands external_listing`
- 生产 Rust 检查通过:`cargo check --locked --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml --bin genarrative-ai-game-creator-shell`
- `npm run check:encoding`、`npm run check:doc-index`、`git diff --check` 通过。
- 本地验证在 Linux 执行,未运行 Windows 专属运行时验证;分页仍是实时观察,不承诺跨请求快照一致性。

Fixes #552

Reviewed-on: #580
2026-10-02 10:55:47 +08:00
lhk229 89d40c0836 修复素材导入与资源提交的项目锁争用 (#581)
Project CI / AI game creator shell Rust lane 1/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 web tests (push) Has been cancelled
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
修复 #551:本地素材导入、账户素材提交和资源编辑提交在 conversation.write 短暂持有项目锁时会立即失败。现在复用既有约 10 秒有界等待,并将同步取锁与提交放入阻塞线程池,等待期间异步 runtime 继续响应。

- 项目锁先于账号身份租约,等待后重新验证账号身份、导入权限及原 WritePermit;保留跨进程互斥、权限分类和持锁方诊断。
- 资源资产/版本提交和已完成结果清理保留 operation/project guard,取消异步等待不会提前释放仍在执行的提交互斥。超时保留原 operation、幂等键与 staging,恢复不重复远端生成。
- Runtime 素材导入与 UI workflow 切图登记也接入阻塞池,避免共享导入函数新增等待后阻塞这些调用方。同步更新 AGC 行为规范及共享记忆。

验证:163 项 Rust 定向测试通过,覆盖导入与资源编辑、Direct bridge、Runtime 导入、UI workflow、项目锁恢复和失败分类。包含同进程争用、单线程 runtime 心跳、并行 manifest/revision、账号切换、许可取消、完整超时后原 operation 恢复及取消后的 guard 生命周期。

```sh
cargo test --locked --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml --bin genarrative-ai-game-creator-shell -- resource_editor:: commands::agent_asset_import_tests agent::direct_tool_bridge::tests tests::project_lock_recovery project::write_lock agent::runtime_tools::context::asset_import_input_tests ui_editor::agent_tools --test-threads=1
npm run check:rustfmt
npm run check:encoding
npm run check:doc-index
git diff --check
```

全部上述检查通过。Linux 本地未执行 Windows 专属删除挂起行为测试;未调用真实付费 Provider,远端链路使用既有 mock 测试和已下载账本恢复测试验证。没有 API/DTO/schema 变更或数据迁移。

Closes #551

Reviewed-on: #581
Co-authored-by: lhk <ink29535@proton.me>
Co-committed-by: lhk <ink29535@proton.me>
2026-10-02 10:55:29 +08:00
k88936 92467dd53e Merge pull request 'Fix/修复测试用例竞态等问题' (#571) from fix/test-concurrent-problem into master
Project CI / AI game creator shell Rust crates (push) Successful in 1m45s
Project CI / AI game creator shell Rust smoke (push) Successful in 2m27s
Project CI / Backend tests (push) Successful in 3m59s
Project CI / Frontend tests (push) Successful in 2m7s
Project CI / Native shell tests (push) Successful in 6m6s
Project CI / AI game creator shell web tests (push) Successful in 1m41s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 10m20s
Project CI / Repository checks (push) Successful in 2m31s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 10m42s
Reviewed-on: #571
2026-10-02 01:51:59 +08:00
k88936 716ea9d410 Merge remote-tracking branch 'origin/master' into fix/test-concurrent-problem
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m41s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m14s
Project CI / Backend tests (pull_request) Successful in 4m28s
Project CI / Native shell tests (pull_request) Successful in 6m4s
Project CI / Frontend tests (pull_request) Successful in 2m13s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m53s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 10m23s
Project CI / Repository checks (pull_request) Successful in 2m24s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 10m57s
# Conflicts:
#	docs/project-memory/shared-memory/pitfalls.md
2026-10-02 01:35:26 +08:00
lhk229 ded9f13f02 Fix Issue 549 (#573)
Project CI / AI game creator shell Rust crates (push) Successful in 2m16s
Project CI / AI game creator shell Rust smoke (push) Successful in 2m39s
Project CI / Backend tests (push) Successful in 5m39s
Project CI / Native shell tests (push) Successful in 6m3s
Project CI / Frontend tests (push) Successful in 1m49s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 9m50s
Project CI / Repository checks (push) Successful in 2m15s
Project CI / AI game creator shell web tests (push) Successful in 1m40s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 6m18s
账户素材超过 500 项时,AGC 曾在筛选和分页前直接拒绝整个素材库,导致查询、预览和指定 ID 导入不可用。本 PR 移除账户素材总量及账户分页 offset=500 的客户端限制,允许大库继续使用现有客户端筛选分页。

Closes #549

## 实现范围

- 移除账户素材库原始条数超过 500 的拒绝,以及 MCP schema、桥接、Runtime 执行层和原生函数 strict schema 的账户分页 offset 上限。
- 保留单页最多 100 项、导入批次数量与下载体积、媒体类型、账号归属、权限及会话校验。项目文件查询的 offset 上限和绑定项目画布资源的数量上限保持原有契约。
- 账户素材 UI 列表、预览及指定 ID 导入同步恢复可用。
- 修复真实账户导入时,在持有身份租约期间重复读取会话互斥锁造成的自锁;写入前校验和覆盖写入过程的身份租约继续保留。
- 同步工具说明、技术方案与排障记录。服务端仍返回全库,传输和解析开销另由 #574 跟进,不作为本 PR 的验收前置条件。

## 验收

以下已完成项表示本地自动化与代码核查通过,不代表线上真实账号验收。

- [x] 覆盖 500/501 项素材库解析;503 张静态图片及 1 项不支持媒体的模拟素材库可正常工作。
- [x] MCP 查询支持 limit=1、folderId、query 和 offset>500;nextOffset、末页、越界空页及默认每页 100 项符合现有契约。
- [x] 直接调用 Runtime 执行层时 offset=501 可查询;MCP schema 与参数校验一致,仍拒绝负数、非整数 offset 和 limit>100。这项不覆盖 Runtime 下发给模型的原生函数 schema。
- [x] Runtime 原生函数 asset.library.list 的 strict schema 允许 offset>500;实际下发的完整函数参数已验证 offset=501/600/10000、null 可用,负数/非整数偏移及超界页长拒绝。补丁已提交并推送:41e2cc0b5。
- [x] 共用读取链路的 UI 素材列表和预览在大库场景可用。
- [x] 指定有效 assetId 完成实际下载、本地文件写入及 manifest/revision 更新;重复导入保持幂等。
- [x] 模拟素材库中的不存在 ID 和不支持媒体被拒绝,且不改变 manifest;返回 Agent 的当前页元数据不泄露媒体地址、对象键或凭据。
- [x] 会话退出、账号切换、凭据刷新、身份租约和取消写入相关定向测试通过。
- [x] 工具说明、技术方案和共享排障文档已同步;项目文件与画布资源原有独立边界已核对保留。
- [ ] 真实平台账号联调:超过 500 项素材时查询、预览和导入,以及实际删除、跨账号、无权限素材的拒绝行为。

## 验证证据

- 账户素材、导入、参数校验、项目文件、取消写入与平台会话定向 Rust 测试:33 项通过。
- runtime_prompt_bundle_build:17 项通过;prompt_source_boundaries:6 项通过。合计 56 项通过。
- Rust 格式检查、npm run check:encoding、npm run check:doc-index、git diff --check 通过。
- 以上 Rust 测试在快进 master 前运行;快进至 44f415d05 后已核对本次代码及工具文本与已测试版本一致,并再次通过编码、文档索引、差异检查和提交时 Rust 格式检查。
- 未运行全量测试,未做真实线上账号或付费操作验证。

初次修复提交:697f421e570606d0519f952a0a5689b5f639f902;原生函数 schema 审查补丁:41e2cc0b57b7f9f5faf06546c1f6108e88380ac3(已推送)。
- 审查补丁验证:24 项定向 Rust 测试通过,覆盖全部 agent_native_tools 测试、大库查询/导入和修正后的旧流式结果测试;格式、编码、文档索引、差异检查、提交及推送检查通过。本轮未重复全量测试,未做真实模型或线上账号调用。

Reviewed-on: #573
2026-10-01 20:55:28 +08:00
kdletters d74b2c003c Merge pull request '修正 H5 HostBridge 调用链门禁:邀请弹层下沉共享组件后的文件清单' (#579) from codex/profile-invite-gate-fix into master
Project CI / AI game creator shell Rust crates (push) Successful in 1m32s
Project CI / AI game creator shell Rust smoke (push) Successful in 2m5s
Project CI / AI game creator shell Rust lane 1/2 (push) Has been cancelled
Project CI / Backend 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 2/2 (push) Has been cancelled
Project CI / Native shell tests (push) Has been cancelled
2026-10-01 20:31:57 +08:00
kdletters 350e9f51b7 修正 H5 HostBridge 调用链门禁:邀请弹层下沉共享组件后的文件清单
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m25s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m6s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Failing after 7m50s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Failing after 7m11s
Project CI / Backend tests (pull_request) Successful in 5m23s
Project CI / Frontend tests (pull_request) Successful in 2m26s
Project CI / Repository checks (pull_request) Successful in 3m6s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m50s
Project CI / Native shell tests (pull_request) Successful in 6m44s
- check-native-shells 的 H5 HostBridge 调用链必需文件清单移除已删除的 src/components/platform-entry/PlatformProfileReferralModal.tsx
- 补入改为在宿主侧消费宿主剪贴板能力的 src/components/platform-entry/PlatformEntryActiveFlowShell.tsx
- 本地 npm run check:native-shells:contract 通过(含 production-shell-dev-scaffold-scan)
2026-10-01 20:25:38 +08:00
kdletters 22f67d185b Merge pull request '我的页签恢复邀请好友入口,AGC 客户端账号菜单接入邀请码与玩家社区' (#578) from codex/profile-invite-entry into master
Project CI / AI game creator shell Rust smoke (push) Successful in 2m22s
Project CI / AI game creator shell Rust crates (push) Successful in 1m39s
Project CI / Native shell tests (push) Failing after 55s
Project CI / Frontend tests (push) Successful in 1m44s
Project CI / Backend tests (push) Successful in 4m45s
Project CI / Repository checks (push) Successful in 2m22s
Project CI / AI game creator shell web tests (push) Successful in 1m40s
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
2026-10-01 20:08:37 +08:00
k88936 6cfc69abf5 Merge remote-tracking branch 'origin/master' into fix/test-concurrent-problem
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Failing after 1m44s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Failing after 2m57s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m48s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m15s
Project CI / Backend tests (pull_request) Failing after 18s
Project CI / Repository checks (pull_request) Failing after 22s
Project CI / Frontend tests (pull_request) Successful in 2m31s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m24s
Project CI / Native shell tests (pull_request) Successful in 6m53s
# Conflicts:
#	docs/project-memory/shared-memory/pitfalls.md
2026-10-01 19:50:10 +08:00
kdletters 41b882e1fe 我的页签恢复邀请好友入口,AGC 客户端账号菜单接入邀请码与玩家社区
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m50s
Project CI / Backend tests (pull_request) Failing after 15s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m26s
Project CI / Native shell tests (pull_request) Failing after 36s
Project CI / Repository checks (pull_request) Failing after 26s
Project CI / Frontend tests (pull_request) Successful in 2m35s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m25s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 11m17s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 12m41s
- 主站「我的」页签常用功能宫格补回「邀请好友」,邀请码与邀请链接拆成两个复制动作
- 邀请弹层下沉到 packages/shared/src/components/PlatformProfileReferralModal,主站与客户端共用一份实现
- 邀请奖励说明不再写死次数与金额,每日上限由 todayInviterRewardCount 与 todayInviterRewardRemaining 推导
- 奖励说明从面板正文移入右上角帮助按钮,鼠标悬浮展开、触屏与键盘点击开合
- 帮助按钮复用平台 .platform-icon-button 配色,说明气泡复用 PlatformStatusMessage 的 warning token
- AGC 客户端账号菜单新增「邀请码」与「玩家社区」两项,弹层标题与菜单入口文案保持一致
- 新增 Tauri 命令 read_profile_referral_invite_center,用登录 origin 补全 inviteLinkPath 后交给渲染层
- 客户端邀请中心按登录账号隔离,切号重置并作废在飞响应,不本地另存邀请码
- 新命令登记进 apps/ai-game-creator-shell/scripts/check-config.mjs 的 native-only 白名单门禁
- 微信群与 QQ 群二维码从 media/social-media-group 迁入共享组件 assets
- 移除已下线文件的 Tailwind @source 与客户端专用弹层样式,原地删除旧邀请弹层实现
- 同步决策记录与产品基线文档中邀请奖励、跨端复用与文案口径
2026-10-01 19:46:18 +08:00
kdletters 1aa457c36b Merge branch 'master' of https://git.genarrative.world/git/GenarrativeAI/Genarrative
Project CI / AI game creator shell Rust crates (push) Successful in 1m24s
Project CI / AI game creator shell Rust lane 1/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 web tests (push) Has been cancelled
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
2026-10-01 19:45:43 +08:00
lhk229 3193182665 修复 AGC 测试编译并保留 CI 编译诊断
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
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 / 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
删除 Claude 流式结果测试中已失效的回合参数
分片运行器使用 Cargo 渲染诊断并保留 JSON 产物发现
新增编译失败诊断回归测试并更新排障文档
2026-10-01 11:42:48 +00:00