{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://wanxiang.ai/contracts/templates/business-sim.schema.json", "title": "BusinessSimBundleMeta", "description": "U7 R-TPL 经营模拟(business-sim)品类玩法模板 schema(克隆 generic.schema.json 的 bundle 校验结构,2026-06-18)。⚠️ 与旧四模板 config-fill schema 语义不同:本 schema 校验「bundle 形态/元数据」(worker 产出的 __GameBundle iife bundle 文本及其自检元数据:全局名/体量/默认导出),而非 GameConfig 玩法字段——P3 走引擎 bundle 路(agent 写代码),游戏逻辑全在 bundle 内、不再填参 GameConfig。品类区分(经营模拟=资源/经济循环)由配套 business-sim-designer.md prompt 正文引导,产物校验口径与 generic 完全一致。后端 PromptResourceLoader.getAllTemplateSchemaTexts→GameConfigSchemaValidator 在启动期编译本 schema(draft 2020-12),缺失或非法 → ready=false 卡 context load。bundleSize 双阈值权威 = B1 入场券(tech-decisions.md:14):raw≤1.5MB ∧ gz≤350KB。", "type": "object", "required": ["bundleText", "hasGlobalName", "bundleRawBytes"], "additionalProperties": true, "properties": { "bundleText": { "description": "worker 产出的 iife bundle 全文。顶层全局名固定 __GameBundle(宿主据此从 window.__GameBundle 取 GameHostFactory,见 game-runtime/src/core/game-host.d.ts)。校验:文本须含 __GameBundle 全局名字面量(pattern 守门,避免产物缺全局名导致宿主取不到工厂)。", "type": "string", "minLength": 1, "pattern": "__GameBundle" }, "hasGlobalName": { "description": "worker 自检:bundle 顶层全局名 __GameBundle 是否存在(selfCheck.hasGlobalName,须为 true 方可交件)。", "type": "boolean", "const": true }, "bundleRawBytes": { "description": "bundle 原始字节数(raw,未压缩)。B1 入场券上界 = 1.5MB(1572864 字节,tech-decisions.md:14);下界取 1KB 防空 bundle/截断产物。超上界 worker 即回 failed 不交件。", "type": "integer", "minimum": 1024, "maximum": 1572864 }, "bundleGzBytes": { "description": "bundle gzip 压缩后字节数(gz)。B1 入场券上界 = 350KB(358400 字节,tech-decisions.md:14);下界 256 字节防异常。可选(worker 自检若提供则后端据此核 B1 门)。", "type": "integer", "minimum": 256, "maximum": 358400 }, "hasDefaultExport": { "description": "worker 自检:bundle 是否含默认导出(GameHostFactory 默认导出,game-host.d.ts)。可选自检位。", "type": "boolean" }, "esbuildOk": { "description": "worker 自检:esbuild 打包是否成功(selfCheck.esbuildOk,须为 true)。可选自检位。", "type": "boolean" } } }