注册 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>
43 lines
2.9 KiB
JSON
43 lines
2.9 KiB
JSON
{
|
||
"$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"
|
||
}
|
||
}
|
||
}
|