games-development-ai/contracts/game-package.schema.json
zizi 28a57b8e00 feat(contracts): T1b-β P2 三契约冻结(grounded 据真签名+插件真调用面)——待对抗复审
①受控面引擎能力透传通道 PluginContext.getEngine()→EngineCapabilities(api.d.ts):白名单3项particles.spawnEmitter/audio.synth/math.lerp+smoothStep(YAGNI核6件impl真调用点);铁律=封装禁裸Vector2/引擎import只活集成段host背书engineFactory不散进插件impl(保引擎可换+满足门1真接线);random/time集成段换引擎RandomGenerator/timeReal背书(契约形状不变)
②GamePackage manifest加packageUrl+immutable(additive,复用后端packageUrl镜像走DB-manifest降级,checksum复用旧字段供门4防demo假阳性)
③SDK StoragePlugin根契约上提(sdk-interface.d.ts):前端contract.ts定稿对象形态上提+含R4-P1 array排除契约语义声明

grounded工位核impl逮关键澄清:hitStop/屏震非通道项(impl.js:582-615=受控面输出+游戏层render.js:915应用闭环,插件不调引擎;屏震引擎化=render.js切相机属agent生成域)→通道收敛6件→3项,§7/§6 A2同步澄清;audio.synth留契约A2据SIZES定用否
JSON校验过+.d.ts括号平衡

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-13 05:12:35 +00:00

107 lines
6.3 KiB
JSON
Raw 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.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://wanxiang.ai/contracts/game-package.schema.json",
"title": "GamePackage",
"description": "绘境AI 游戏包契约(契约 #4,owner=WS3+WS2)。生成链路(aigc/studio)的产出物,runtime 编译/预览/发布的输入物。贯穿 生成→编译→预览→发布→游戏流→试玩 全链路,是平台最核心的数据契约。",
"type": "object",
"required": ["schemaVersion", "gameId", "versionId", "templateId", "gameConfig", "assets", "manifest", "meta"],
"additionalProperties": false,
"properties": {
"schemaVersion": {
"description": "本契约版本。新增字段不升版本;删除/重命名字段升版本。",
"type": "string",
"const": "1.0"
},
"gameId": {
"description": "游戏全局唯一 ID(project.game_project.id)",
"type": "string",
"minLength": 1
},
"versionId": {
"description": "游戏版本 ID(project.game_version.id)。资源 OSS 路径按 /games/{gameId}/versions/{versionId}/ 版本化。",
"type": "string",
"minLength": 1
},
"templateId": {
"description": "玩法模板 ID(aigc 模板注册表)。MVP 取值范围 = 3-5 个 P0 模板,如 dodge/runner/clicker/puzzle/shooter(最终由产品拍板)。",
"type": "string",
"minLength": 1
},
"gameConfig": {
"description": "可玩游戏配置(模板相关的玩法参数)。结构由各模板的 GameConfig JSON Schema 约束(contracts 后续批 templates/*.schema.json);此处仅约定为对象并要求 templateId 自洽。runtime 编译前做静态 Schema 校验(门禁④)。",
"type": "object"
},
"assets": {
"description": "资源清单。每项资源 hash 命名长期缓存;编译期校验总大小(≤10MB)、首屏(≤2MB)。",
"type": "array",
"items": {
"type": "object",
"required": ["id", "type", "url", "hash", "bytes", "mime"],
"additionalProperties": false,
"properties": {
"id": { "description": "资源在包内的逻辑 ID", "type": "string" },
"type": { "description": "资源类型", "type": "string", "enum": ["image", "audio", "spine", "json", "font", "atlas"] },
"url": { "description": "资源可访问 URL(MVP 本地 MinIO / 生产 OSS+CDN)", "type": "string", "format": "uri" },
"hash": { "description": "资源内容 sha256(hex),用于完整性校验与 CDN 永久缓存命名", "type": "string", "pattern": "^[a-f0-9]{64}$" },
"bytes": { "description": "资源字节大小", "type": "integer", "minimum": 0 },
"mime": { "description": "资源 MIME 类型", "type": "string" }
}
}
},
"manifest": {
"description": "运行清单。runtime 据此加载与做完整性校验。",
"type": "object",
"required": ["runtimeVersion", "entry", "preloadPolicy", "bundleSize", "checksum"],
"additionalProperties": false,
"properties": {
"runtimeVersion": { "description": "目标 WanxiangGameSDK / Canvas Runtime 版本(semver)", "type": "string" },
"entry": { "description": "入口文件相对路径", "type": "string" },
"preloadPolicy": {
"description": "三容器预加载策略:eager=进容器即加载 / lazy=可见时加载",
"type": "string",
"enum": ["eager", "lazy"]
},
"bundleSize": { "description": "包总字节(编译期门禁校验上限)", "type": "integer", "minimum": 0 },
"checksum": { "description": "整包 sha256(hex),Manifest 完整性校验。T1b-β 门4 防 demo 兜底假阳性=Network 捕获本 checksum 比对发布版本", "type": "string", "pattern": "^[a-f0-9]{64}$" },
"packageUrl": {
"description": "运行包可访问 URL(T1b-β Runner v2 交付锚;additive 可选,存量消费者无此字段时回退后端 resolveManifestUrl 原链路)。MVP 默认降级=复用后端 game_version.package_url 走 DB-manifest 端点 /app-api/runtime/package/{versionId}/manifest(天然含 versionId 版本化,不接 OSS、不改写链);切 OSS 后=OSS 版本化路径。= 后端 RuntimePackageDO.packageUrl 的 GamePackage 契约镜像(同源同物,后端写权)。",
"type": "string",
"format": "uri"
},
"immutable": {
"description": "本 URL 是否携带 immutable 强缓存语义(Cache-Control: public,max-age=31536000,immutable)。true=URL 版本化+内容寻址、命中即永久缓存(编译缓存靠 versionId 兜,门4 用 CDP Network timing 验缓存命中 fromCache/304);false/缺省=普通缓存。additive 可选。",
"type": "boolean"
}
}
},
"meta": {
"description": "展示与合规元信息(发布前检查清单门禁⑦校验)。",
"type": "object",
"required": ["title", "summary", "cover", "ageRating"],
"additionalProperties": false,
"properties": {
"title": { "description": "标题", "type": "string", "minLength": 1, "maxLength": 60 },
"summary": { "description": "简介", "type": "string", "maxLength": 500 },
"cover": { "description": "封面图 URL(首屏卡片展示)", "type": "string", "format": "uri" },
"tags": { "description": "标签", "type": "array", "items": { "type": "string" }, "maxItems": 10 },
"ageRating": {
"description": "适龄提示(发布前必填,门禁⑦)。all=全年龄 / 8+ / 12+ / 16+",
"type": "string",
"enum": ["all", "8+", "12+", "16+"]
}
}
},
"provenance": {
"description": "可追溯来源(质量门禁与缓存命中用)。相同 promptHash 命中缓存可跳过 LLM 生成。",
"type": "object",
"additionalProperties": false,
"properties": {
"promptHash": { "description": "生成所用 Prompt 的 hash(产物缓存键)", "type": "string" },
"model": { "description": "生成所用 LLM 标识(如 deepseek-chat / qwen-max)", "type": "string" },
"traceId": { "description": "贯穿 生成→编译→加载→运行 的 trace_id", "type": "string" },
"generatedAt": { "description": "生成时间(ISO 8601)", "type": "string", "format": "date-time" }
}
}
}
}