games-development-ai/contracts/templates/business-sim.schema.json
lili 046c061d60 feat(aigc): U7 R-TPL 品类玩法模板注册(经营模拟/剧情互动/解谜闯关/TRPG/非遗科普·constants-only·克隆generic代码生成契约)
注册 5 品类玩法模板(business-sim/narrative/puzzle/trpg/heritage),替代单一 generic 状态:
- 3 处代码同源点:AigcTemplateConstants.SUPPORTED_TEMPLATE_IDS 加 5 ID(保留 generic);
  PromptResourceLoader.TEMPLATE_RESOURCES 加 5 行(pom 通配自动复制资源,零 pom 改动);
  AigcTaskServiceImpl.getTemplateList() 回填 5 TemplateRespVO(中文品类名/说明/示例 Prompt/封面占位)。
- 10 契约文件:每品类 1 prompt(克隆 generic-coder.md frontmatter 形态 + 品类引导正文,范式=agent 写
  GameHostFactory 源码而非填 GameConfig)+ 1 schema(克隆 generic.schema.json 的 bundle 校验结构,
  校验 bundleText/hasGlobalName/bundleRawBytes,draft 2020-12,非旧 config-fill)。
- GameConfigSchemaValidator 无需改(经 getAllTemplateSchemaTexts 自动消费 5 新 schema)。
- 不触 SAA/executor/dispatcher/graph 代码(plan001 领域),仅动模板注册面。
- 测试:PromptResourceLoaderTest 9 / GameConfigSchemaValidatorTest 11 / AigcTaskServiceImplTest 11 全绿;
  启动自检 PromptResourceLoader ready + 校验器编译就绪含 5 新模板。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 11:45:39 -07:00

43 lines
2.9 KiB
JSON
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.

{
"$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 在启动期编译本 schemadraft 2020-12缺失或非法 → ready=false 卡 context load。bundleSize 双阈值权威 = B1 入场券tech-decisions.md:14raw≤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.5MB1572864 字节tech-decisions.md:14下界取 1KB 防空 bundle/截断产物。超上界 worker 即回 failed 不交件。",
"type": "integer",
"minimum": 1024,
"maximum": 1572864
},
"bundleGzBytes": {
"description": "bundle gzip 压缩后字节数gz。B1 入场券上界 = 350KB358400 字节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"
}
}
}