feat(contracts): studio.yaml 冻结生命周期 API delta /studio/{create,modify,extend}(C3)

两线开工的临门 M0 契约(前↔后交汇)。additive,零改现 draft/generate/task/
regenerate 两步路。对齐已冻 keystone source-project.schema.json + execution
§5.6 modifyPatch / §12-⑥。

新增:
- 3 端点:create(draft+generate 一步式封装,templateId 缺省 generic)/modify
  (改源不改产物:deterministic 免LLM | regenerate-module 重生成单 behavior,产
  新预览版、不动 currentVersion、走发布审核)/extend(additive 内容扩展)。
- 6 VO:StudioCreateReqVO/StudioModifyReqVO/StudioModifyTarget/StudioModifyPayload/
  StudioExtendReqVO/StudioAssetContextItem(六类素材引用,取代旧 attachments)。
- TaskChainRespVO 加 additive baseVersionId(modify/extend 血缘)。
- 头注补生命周期编排说明 + x-feign seam(aigc.submitGenerate 扩 mode/baseVersionId/
  modifyPatch/idempotency=后端线落地;project 取 base 源项目引用+新预览版落库)。

校验:YAML 解析绿、14 $ref 零悬空、六类与 keystone 逐字对齐、modifyPatch enum 对齐 §5.6。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
zizi 2026-06-17 15:46:23 +00:00
parent 5f9f9f5b32
commit d97d0bae5c

View File

@ -16,6 +16,19 @@ openapi: 3.0.3
# - aigc-api AigcApi.submitGenerate / getTask / retryTask / getTemplateListWave3 新增 seam纯暴露层委托 AigcTaskService
# attachmentsR7StudioGenerateReqVO.attachments 本波仅持久化studio 侧落库),不透传 aigcaigc reqDTO 无 attachments 字段P1 再透传。
# 狠切留 seam 不实现P1rig/对白树/可视化批量资产图仅槽位表game_studio_asset+ 单步调度,不六路并发。
# ---------------------------------------------------------------------------
# 生命周期编排扩展(契约 C3 | 2026-06-17 固定架构+SAA studio execution §5.6/§12-⑥):
# 范式:游戏 = 长生命周期源项目LLM as 工作室)。新增 create/modify/extend 三生命周期操作additive不破现 draft/generate/regenerate 两步路)。
# - POST /create = draft+generate 一步式封装templateId 缺省 generic一句话直生免选模板对齐 generic 桥接 7534bdf9
# - POST /modify = 改源不改打包产物:在 baseVersion 源项目上改一处(换美术/调参/改关卡=确定性免 LLM改玩法=LLM 重生成单 behavior→ 重构建出新预览版;
# 不动 currentVersion、不自动入 feed仍走发布审核B1 链);失败=不建新版、base 不动。
# - POST /extend = additive 内容扩展(加关卡/机制/内容,不重写既有部件)→ 新预览版。
# 三者均委托 aigcjob 模型 mode/baseVersionId/modifyPatch/idempotency→ SAA 固定架构图产源项目 → 唯一确定性构建 → handleCallback 唯一写入路径落包;
# 产物均经 taskChain 轮询(复用 /task/{id}),完成后 versionId=新(预览)版。
# 关联冻结契约contracts/agent-loop/source-project.schema.json源项目工件、modifyPatchexecution §5.6)、六类 assetContext取代旧 attachmentsadditive
# x-feign-contracts新增 seamstudio 为调用方,本契约不对外暴露 Feign
# - aigc-api AigcApi.submitGenerate 扩 mode/baseVersionId/modifyPatch/idempotencyKey生命周期编排参数additive后端线落地
# - project-api ProjectApi 取 baseVersion 源项目引用 + 新预览版落库version 产物权威仍在 project源项目独立 game_source_project 表存 V18
info:
title: 造梦AI studio 模块 API
version: 1.0.0
@ -112,6 +125,68 @@ paths:
application/json:
schema: { $ref: '#/components/schemas/CommonResultStudioTaskChain' }
# ---------------------------------------------------------------------------
# 生命周期操作(契约 C3execution §5.6/§12-⑥additive不破现两步路
# ---------------------------------------------------------------------------
/app-api/studio/create:
post:
tags: [app-studio]
summary: 一步式创作C3draft+generate 封装P-CRT-01/10
description: >-
编排:建草稿(委托 project createProjecttemplateId 缺省 generic→ 立即委托 aigc submitGenerate → 落任务链(status=1)
→ 返回任务链句柄供前端轮询(复用 /task/{id})。一步式封装,不破现 draft+generate 两步路additive
六类 assetContext 透传生成上下文(取代旧 attachments
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/StudioCreateReqVO' }
responses:
'200':
description: 成功(任务链句柄,含 aigc_task_id
content:
application/json:
schema: { $ref: '#/components/schemas/CommonResultStudioTaskChain' }
/app-api/studio/modify:
post:
tags: [app-studio]
summary: 修改C3改源不改产物P-CRT-09 进阶)
description: >-
编排:取 baseVersion 源项目 → 应用 modifyPatchmode=deterministic 确定性编辑免 LLM / regenerate-module LLM 只重生成单 behavior
→ 唯一确定性构建出新预览版 → 落任务链供轮询。产物=新预览版(不动 currentVersion、不自动入 feed仍走发布审核
失败=不建新版、base 不动。modifyPatch 字段见 execution §5.6。
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/StudioModifyReqVO' }
responses:
'200':
description: 成功(新预览版任务链句柄,完成后 versionId=新预览版、baseVersionId=被改版本)
content:
application/json:
schema: { $ref: '#/components/schemas/CommonResultStudioTaskChain' }
/app-api/studio/extend:
post:
tags: [app-studio]
summary: 扩展C3additive 内容扩展)
description: >-
编排:在 baseVersion 源项目上做 additive 内容扩展(加关卡/机制/内容)→ 重构建出新预览版 → 落任务链供轮询。
语义=additive不重写既有部件产物处置同 modify新预览版、不动 currentVersion、走发布审核
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/StudioExtendReqVO' }
responses:
'200':
description: 成功(新预览版任务链句柄)
content:
application/json:
schema: { $ref: '#/components/schemas/CommonResultStudioTaskChain' }
components:
schemas:
# ========== 请求 VO ==========
@ -132,6 +207,64 @@ components:
prompt: { type: string, maxLength: 1000, description: '一句话 Prompt透传 aigc submitGenerate', example: '做一个躲避陨石的小游戏' }
attachments: { type: string, description: '附件上下文 JSONP-CRT-04【本波仅持久化P1 透传 aigc】——studio 侧落库持久化,本波不透传 aigc' }
# ---- 生命周期操作请求 VO契约 C3execution §5.6----
StudioCreateReqVO:
type: object
required: [title, prompt]
description: 一步式创作draft+generate 封装templateId 缺省 genericassetContext 取代旧 attachments
properties:
title: { type: string, maxLength: 128, description: '作品标题(透传 project createProject', example: '我的放置小镇' }
prompt: { type: string, maxLength: 1000, description: '一句话 Prompt一步式必填透传 aigc', example: '做一个躲避陨石的小游戏' }
templateId: { type: string, description: '玩法模板/品类引导 ID缺省 generic一句话直生免选模板对齐 7534bdf9', example: 'generic' }
assetContext: { type: array, items: { $ref: '#/components/schemas/StudioAssetContextItem' }, description: '六类素材引用(取代旧 attachmentsadditive空=纯一句话生成' }
idempotencyKey: { type: string, maxLength: 64, description: '幂等键C3防重复提交触发重复生成可空' }
StudioModifyReqVO:
type: object
required: [baseVersionId, mode, target]
description: 改源不改产物execution §5.6 modifyPatch产新预览版不动 currentVersion走发布审核
properties:
baseVersionId: { type: integer, format: int64, description: '被改的 base 产物版本 IDproject.game_version.id', example: 4096 }
mode: { type: string, enum: [deterministic, regenerate-module], description: 'deterministic=确定性编辑源文件免 LLMregenerate-module=LLM 只重生成单 behavior 模块', example: 'deterministic' }
target: { $ref: '#/components/schemas/StudioModifyTarget' }
payload: { $ref: '#/components/schemas/StudioModifyPayload' }
idempotencyKey: { type: string, maxLength: 64, description: '幂等键C3可空' }
StudioModifyTarget:
type: object
required: [kind]
description: 寻址源项目部件path 与 id 二选一)
properties:
kind: { type: string, enum: [asset, config, level, behavior], description: '换美术=asset / 调参=config / 改关卡=level(scene) / 改玩法=behavior' }
path: { type: string, description: '源项目内 JSON 指针(如 /config/speed、/assets/0、/gameDefinition/scenes/2', example: '/config/speed' }
id: { type: string, description: '或按部件 id 寻址behaviors[].id / assets[].id' }
StudioModifyPayload:
type: object
description: mode=deterministic 用 value直接覆写免 LLMmode=regenerate-module 用 intent喂 LLM 重生成意图)
properties:
value: { type: object, additionalProperties: true, description: 'deterministic 新值(确定性覆写)' }
intent: { type: string, maxLength: 1000, description: 'regenerate-module 改玩法逻辑的自然语言意图(只重生成那一个 behavior', example: '把陨石下落改成会左右摇摆' }
StudioExtendReqVO:
type: object
required: [baseVersionId, intent]
description: additive 内容扩展(加关卡/机制/内容),不重写既有部件
properties:
baseVersionId: { type: integer, format: int64, description: '在哪个产物版本上扩展', example: 4096 }
intent: { type: string, maxLength: 1000, description: '扩展意图(加关卡/机制/内容)', example: '再加一个 boss 关卡' }
assetContext: { type: array, items: { $ref: '#/components/schemas/StudioAssetContextItem' }, description: '扩展用的新增六类素材引用(可空)' }
idempotencyKey: { type: string, maxLength: 64, description: '幂等键C3可空' }
StudioAssetContextItem:
type: object
required: [category, ref]
description: 六类素材引用(对齐 source-project.schema.json assetSpec.category取代旧 attachments
properties:
category: { type: string, enum: [sprite, character, effect, scene, ui, music], description: '六类:图元/角色/特效/场景/界面/音乐' }
ref: { type: string, description: '平台 assetId/ref', example: 'asset_88231' }
url: { type: string, format: uri, description: '只读镜像 URL可空' }
# ========== 响应 VO ==========
StudioTemplateRespVO:
type: object
@ -164,6 +297,7 @@ components:
status: { type: integer, description: '任务链状态0初始 1生成中 2完成 3失败', example: 1 }
progress: { type: integer, description: '进度百分比 0-100透传 aigc', example: 60 }
retryOf: { type: integer, format: int64, description: '若为重生成,指向原任务链 IDP-CRT-09 血缘)', example: 1000 }
baseVersionId: { type: integer, format: int64, description: 'modify/extend 血缘:本预览版派生自的 base 版本create/generate 为空additive', example: 4096 }
# ========== CommonResult 信封 ==========
CommonResultStudioTemplateList: