lili c44681b580 feat(runtime): A-model 地基——4 编排插件 + 2 skill + _template/catch-fruit + SAA 改写评审版
- 新增 4 编排层插件(session-score/hud-ui/scene-fsm/timer-scheduler),barrel 注册 12 件,各 impl/api.d.ts/manifest/PLUGIN.md/test,全 node 测绿;audio-music manifest 描述修红门
- skill littlejs-game-dev(code 层:12 插件 API/结构/写-vs-调/资产-mmx/工厂契约)+ sim-business-game-design(design 层:经营模拟范式 + 反"无趣"配方)
- _template(游戏克隆起点,10/10)+ catch-fruit(sonnet 扮生成 agent 只凭 skill 产出,25/25,真浏览器可玩 + canvas 自适应修复)
- docs/agent-specs SAA→A-model 改写评审版(Opus+Codex 双评审收口;D1=A 全压 A-model/D6=A 押 SAA,D6 已 mini-desktop 活验证 1/1)
- staging-ops 加「ssh 绕代理直连内网 IP」配方

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 09:58:52 -07:00

34 lines
2.0 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* entry.js — 「点圆得分」的 esbuild 打包入口(引擎 import 只落本文件;打成 iife → index.html 加载)
* owner_template 克隆起点 消费方scripts/build.mjs(打包)→ index.html(运行)
*
* 【定位 · 精简自 wanglanmei entry.js】
* 把「core 协议 + 所用插件 + 游戏(逻辑/渲染/宿主)+ 引擎」汇成一个 iife 全局(TemplateGame),
* index.html 调 bootGame 启动。**引擎 import 只活本文件**(Q4 铁律),且经动态 import 延后求值:
* · node import entry.js 时**不**触发引擎装载(bootGame 未被调用)→ entry.js node import-safe;
* · esbuild(bundle+iife,无 splitting)把动态 import 的引擎内联进单文件产物;
* · 浏览器运行期调 bootGame 时才求值引擎(window/AudioContext 已存在),拿名字空间注入 main.js real 通道。
* Q4 铁律不破:main.js(host 层)经注入用引擎、不直接 import;game.js 游戏工厂零引擎 import。
*
* 【构建(沿 scripts/build.mjs 锁参)】
* node scripts/build.mjs games/_template/entry.js games/_template/dist/template-bundle.js --global-name=TemplateGame
* (本模板未预置 dist 产物;克隆后按上行构建即可在浏览器跑 ?engine=real;node headless 走 src/main.js stub,免构建。)
*/
'use strict';
import { bootGame as bootGameCore } from './src/main.js';
/**
* 对外 bootGame:动态 import 引擎名字空间后注入、委托 main.js 真实现。
* index.html 调的是 iife 全局 TemplateGame.bootGame(即本包装)。
* @param {{canvas: HTMLCanvasElement, statusEl?: HTMLElement, engine?: any}} [opts]
* @returns {Promise<object>} gameHost 句柄
*/
export async function bootGame(opts) {
// 动态 import:求值时机延后到 bootGame 被调用(浏览器运行期)。esbuild 内联,无外部请求。
// 调用方已显式给 engine 则尊重其值,不重复装载(便于复用)。
const engine = (opts && opts.engine) || (await import('littlejsengine'));
return bootGameCore(Object.assign({}, opts, { engine }));
}