13 Commits

Author SHA1 Message Date
lili
33d9cd62ad feat(adapter): 时间压力维度——新增 elapsed 相对秒,支撑 time-based win/lose 规则
修一处潜在语义错 + 补休闲玩法时间压力维度(限时/倒计时):
- 旧 state.t = nowMs/1000 是【绝对单调时】(受控面明禁跨设备比绝对值),用作 `t >= timeLimit` 规则会因时钟原点(performance.now/Date.now)立判或漂移——错
- 新增 state.elapsed = (now - startMs)/1000(init 记 startMs,相对秒),forensics 暴露 elapsed;规则 `elapsed >= config.timeLimit → win/lose` 正确(零新增 op,正交叠加任一族)
- 单测经注入时钟(createHostDevContext({clock}))验:init@1s 起点,clockMs=3000 时 elapsed=2(相对,非绝对 3)仍 playing,clockMs=4500 时 elapsed=3.5 触发 lose——证相对非绝对

验证:src 全量 197/197 绿(+1 时间压力);additive 改动经回归九门(tap-targets 重建探针 A–I 全绿,H score:0→3+latch)确认不破坏既有 6 族,探针已清场。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 15:10:52 -07:00
lili
46aef4e11c feat(adapter): E3 补齐顶层资产消费——scene 类 → 背景(url drawImage 满幅 / 默认底兜底)
对齐 contracts/agent-loop/source-project.schema.json 冻结 assetSpec(id/category/ref/url?/provider?),补齐 sprite 之外唯一的「顶层资产消费」缺口:
- scene 类资产 = 关卡背景(非实体引用):取首个 category==='scene',有 url → 浏览器 new Image + render drawImage(0,0,满幅);node/无 url → 默认底色 #0d1117 兜底(spec-only)
- 单测:① node 兜底不崩 + forensics assets[] 可观测 scene 类;② Image stub 验 url→drawImage 满幅 390×844 分支(非兜底)
- README 增「六类资产消费」表:sprite/character/ui/effect 经 render 组件 .asset;scene 顶层背景;music 经 url 不可消费(受控面 getEngine().audio 仅 zzfx synth,无播文件音频能力——跨线契约缺口,已记)
- README 记 KTD1 族边界:aim-fire/drag-aiming/match-3 的抛射物理/旋转瞄准/读盘消除属复杂 behavior 逻辑,归 code-agent __GameBundle,不入声明式适配器(避越界+过拟合)

验证:src 全量 196/196 绿(+2 scene 用例)。music 消费缺口与复杂族边界为跨线/架构事实,已在 README 落账供后端线/创始人定夺,未臆造消费路。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 15:04:45 -07:00
lili
d45945af5b feat(adapter): E1 第6游戏族 avoidance(辨别/规避)——tap-safe 负反馈 + forensics safe 标记
补齐休闲玩法最后一个机制维度「辨别/负反馈」(点对计分、点错即负),六族覆盖点击/连续控制/离散 steer/物理/导航/辨别:
- 新增 input op `tap-safe`(点中 safe 目标 → 计分+绿反馈;点中 .hazards 列出的 hazard → 记 miss,交 lose 规则)
- forensics targets[] additive 暴露 `safe` 标记(非 hazard 即 true,无 hazard 声明时全 true 向后兼容),供 play.cdp.cjs 的 tap-targets safeOnly driver 只点安全目标跑透核心循环
- hazardIds 在 adapt 期从 tap-safe.hazards 派生(自包含于行为,不污染 component 契约)
- fixtures/avoid.source.json(3 safe + 2 hazard) + 3 条单测(safe 标记 / 点对点错分流 / 点 hazard → lose)

验证:src 全量 194/194 绿;avoidance 临时探针经真九门 A–I 全绿(首局门自动判族=avoidance,H score:0→3 increased+latch,driver 只点 3 个 safe 全避 hazard → win,F tap-safe 绿反馈真接线),探针构建件已清场。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 14:58:15 -07:00
lili
72a62cca00 feat(adapter): E1 第5游戏族 seek-x(导航/收集)——move-lr 方向 steer + reach-goal 抵达计分
声明式 gameDefinition → GameInstance 适配器再加一族,验 E1 跨族泛化(tap/drift/control/flappy/seek 五族均过真九门):
- 新增 input op `move-lr`(点左/右半 → 实体左/右移一步,方向式 steer,供 seek-x driver 经 leftX/rightX 左右驱动)
- 新增 update op `reach-goal`(控制体 x 抵达目标 x 容差内 → 计分 + particles/audio 反馈 + 受控随机重生目标)
- forensics additive 暴露 mover{x}/nextGoal{x}(供 play.cdp.cjs 的 seek-x driver 读 entityPath/targetPath)
- fixtures/seek.source.json + 3 条 seek-x 单测(forensics 暴露 / move-lr 方向 / steer 抵达计分)

验证:src 全量 191/191 绿;seek-x 临时探针经真九门 A–I 全绿(H score:0→3 increased+latch 驻留,F particles.spawnEmitter+audio.synth.synthSfx 真接线,首局门 skill 派生通过),探针构建件已清场。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 14:53:22 -07:00
lili
5164f28f69 feat(adapter): E1 第四游戏族 flappy——flap + flappy-gap,真九门绿(flap-to-gap driver)
flappy/runner 族:重力下落 + 点击振翅(flap input op,vy 上冲)+ 单缝隙左滚穿缝判定(flappy-gap update op:
重力推进 bird、缝隙越过 bird.x → 在缝内计分+穿缝反馈(粒子/音效)否则漏接、回收缝隙、出界=漏+复位)。
- forensics additive 暴露 bird{x,y,vy}/nextGap{centerY}(供 flap-to-gap driver 速度前瞻穿缝)。
- flappy.source.json fixture;单测 +3(forensics/flap 上冲/重力+穿缝机制),共 27 adapter。
- e2e(本机):scaffoldFromSource 落 flappy → build → 真九门 A–I 全过(score 0→2 latch、flap-to-gap 导航穿缝、F 门反馈);瞬时件已清。
- 全 game-runtime 套件 188/188 绿。

证成:E1 适配器覆盖四大游戏族(静态点击/realtime 漂移/控制类 paddle-intercept/flappy 物理)均过真九门
(含 I 门),声明式适配器跨游戏族泛化稳固。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 14:40:29 -07:00
lili
413f8edce4 feat(adapter): E1 forensics+HUD 加 remaining——对齐 prompt.py "HUD 显示剩余目标数" 硬规则
生产可玩性契约对齐:适配器渲染的游戏须像 prompt.py 硬规则要求的那样"HUD 看得到进展"。
- forensics 加 remaining=max(0,winScore-score)(harness H 门可读,tictactoe 同字段);render HUD 加"剩余 N"。
- 单测 +1(remaining 随 score 降、win 归 0);全 game-runtime 套件 185/185 绿。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 14:35:08 -07:00
lili
2d5acc5bb0 test(adapter): E1 鲁棒性边界——便宜模型畸形 gameDefinition 优雅降级(+5 测,共 23)
生产路硬化:cheap 模型产的 gameDefinition 常残缺/畸形,适配器须不崩。
- 空 gameDefinition / 实体缺 transform / 组件引用不存在 / 畸形 rule condition / 不支持 behavior op / init 前调 render·update。
- 全优雅降级(几何兜底、条件不误触发、op 忽略、阶段防御),无缺口需修;回归保护。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 14:27:16 -07:00
lili
28797531d4 feat(adapter): E1 控制类 archetype——control-x + fall-and-catch,真九门含 I 门绿
第三 archetype 家族:连续控制 + 下落物理 + 接住(paddle-intercept 族),退役"声明式过拟合"之虑。
- control-x(input op):指定实体 x 中心对齐触点(连续控制);fall-and-catch(update op):下落物每步下移、
  触底接住(中心距≤半宽和)计分 + 接住反馈(粒子/音效,F 门)、漏接计 miss、重生回顶+受控随机 x。
- forensics additive 暴露 paddle{x,w}/ball{x,y}(供 paddle-intercept driver 的 controlCheck.paddlePath/ballPath)。
- catch.source.json fixture(realtime/continuous);控制类单测 +4(共 18 adapter)。
- e2e(集成段,本机):scaffoldFromSource 落 catch → build → 真九门 A–I 全过,**含 I 门控制跟手**
  (tap60→挡板 move-135、tap330→move270)+ score 0→2 latch + 首局门 control-body-moved 判真;瞬时件已清。
- 全 game-runtime 套件 179/179 绿。

证成:三迥异 archetype(静态点击 / realtime 漂移 / 控制类 paddle-intercept)经同一适配器都过真九门
(含仅控制类点亮的 I 门)→ E1 声明式适配器跨游戏族泛化牢固成立。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 14:20:23 -07:00
lili
cbae7b7e57 feat(adapter): E1 收口 lose outcome——win/lose 规则全支持(rule 序 win 优先)
适配器从 win-only 扩到 win/lose:点空(半径内无目标)累计 state.misses;rule outcome=lose
(condition 如 misses >= config.maxMisses)→ phase=gameover + result=lose + latch 驻留。
evalCondition 已泛化(读任意 state 数值字段),update 规则循环已处理 win|lose,故 additive。
- fixture 加 lose 规则 + config.maxMisses(additive);单测 +2(lose 触发 / win 优先于 lose)。
- 全 game-runtime 套件 175/175 绿(adapter 14 + core + 9 插件)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 14:10:35 -07:00
lili
59d4eb1c83 feat(adapter): E3 asset 产消通道——适配器消费 sourceProject.assets[] + 几何兜底
U4/E3(plan 002):打通六类资产产消通道(engine 侧)。
- 适配器读 SourceProject.assets[](§5.1 顶层 assetSpec);render 组件经 .asset 引用 sprite 资产 id。
- 有真 url → 浏览器侧 new Image + drawImage(node 无 Image 守卫);spec-only → 几何兜底(§5.5 MVP:v0 可只产 spec)。
- forensics 暴露 assets[{id,category}] → §10.2-3 通道可观测。
- fixture 加 assets[] + 组件 asset 引用(additive);E3 单测 +1(共 12 绿)。

边界:GamePackage assets[] 填充 + host 真载(§10.2-3 全链)属 build/后端侧;真资产 provider(mmx-cli)= additive 升级。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 14:07:51 -07:00
lili
67371e77dd feat(adapter): E1 泛化——drift-targets(update 行为)+ 第二 archetype 真九门绿
U1 展开(plan 002):证适配器不止 tap-targets,泛化到 realtime/update 行为。
- 加 trigger=update 词汇 op=drift-targets(目标随 ctx.time 慢漂移,amplitude/speed 可配);targets 记 baseX/baseY/phase。
- 新 fixture moving-targets.source.json(tickModel=realtime + drift behavior + tap behavior + win rule)。
- drift 单测 +2(共 8):update 后目标漂移 / 漂移下 tap 当前位仍命中计分。单测 11/11 绿(adapter 8 + scaffold 3)。
- e2e(集成段,本机):scaffoldFromSource 落 moving-targets → build → 真九门 A–I + 首局门全过
  (tap driver 命中漂移目标、score 0→3、latch 驻留;瞬时验证件已清)。

证成:两迥异 archetype(静态点击 + realtime 漂移)经同一适配器都过真九门 → 退役 adversarial F4
「声明式最小集过不了九门」之虑;E1 声明式路泛化成立。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 14:00:05 -07:00
lili
046454d95e feat(adapter): E1 build→九门端到端验证——_adapter-probe 真九门全过(score 0→3 latch✓)
U1 前置另一半(plan 002):声明式 gameDefinition → 适配器 → entry-bundle → build.mjs → 真九门绿。
- _adapter-probe/:generated-factory(adaptGameDefinition+内联 source)+ entry-bundle(拷模板)+ index(拷模板)
  + play-spec(tap-targets driver, assert score increased, expectLatch) + bundle.iife.js(211KB, LittleJS 真入包)。
- 真九门(本机快走查):A装载/B未捕获0/C掌帧Δ30/D真渲染/E活性5/5/F真接线(particles+audio)/
  G输入有效/H 机制+latch(score 0→3 + 终态驻留)/I(无 controlCheck);首局门 可玩51ms/首反馈/60s闭环7s 全过。
- 适配器跟进:① _forensicsView 改契约形态 { seed, state:()=>snapshot }(对齐 boot-game-host:283 + tictactoe);
  ② 命中加引擎粒子+音效反馈(game-feel + 满足 F 门),经 ctx.getEngine 容错。单测仍 6/6 绿。

证成:E1(repo 标"真空白"最高风险件)声明式路端到端可行;build-from-sourceProject 管线(E2)可行;
回答 adversarial MVP-latch 质疑——单 behavior 声明式游戏确过 H 门 latch。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 13:46:17 -07:00
lili
fd022821ae feat(adapter): E1 2D 适配器最小贯穿实验——声明式 gameDefinition→GameInstance(单测绿)
U1 硬前置(plan 002):验「声明式路」接缝形态端到端可行。
- create-game-from-definition.js:adaptGameDefinition(SourceProject)→GameHostFactory;
  解释 entities/components(render)/scenes/rules + 最小 behavior 词汇(input:hit-nearest-target);
  零引擎 import、容错 null engine、render 到 boot.mainContext、坐标 390×844、随机/钟走 ctx。
- _forensicsView 暴露 phase/score/targets(供九门 H + tap-targets driver)。
- rule(score>=winScore→win)在 update 评估→phase=gameover+latch 终态驻留。
- 单测 6/6 绿(node --test):init/render/tap 因果/落空/命中全部 win+latch/destroy 幂等。

边界:复杂 behavior 真逻辑由 code agent 产、编进 bundle(KTD1),本切片只证声明式路。
下一步:build.mjs→九门真玩 验输出件(U2/U3 切片)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 13:40:33 -07:00