From 4d0dd2d721df99f447aee84c2f12b7afcd5840ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 15 Sep 2026 18:06:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E7=B4=A7=20UI=20=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=A1=A5=E6=8E=A5=E7=9A=84=20manifest=20kind=20UI=20=E5=8E=9F?= =?UTF-8?q?=E5=9E=8B=E4=B8=8E=E6=96=87=E6=A1=A3=E9=93=BE=E6=8E=A5=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E7=94=9F=E6=88=90=E6=9E=9A=E4=B8=BE=E8=BE=B9=E7=95=8C?= =?UTF-8?q?=20=E5=88=A0=E9=99=A4=20ui-prototype=20=E7=9A=84=E4=B8=BB?= =?UTF-8?q?=E5=8A=A8=20alias=20=E4=BD=BF=E7=94=A8=E5=B9=B6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=B5=8B=E8=AF=95=E6=B8=85=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../features/ui-editor/uiDesignResourceBridge.ts | 14 ++++++++++++-- .../tests/uiDesignResourceBridge.test.ts | 2 +- ...【待办】AGC资源kind枚举化扫描清单-2026-09-15.md | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/ai-game-creator-shell/src/features/ui-editor/uiDesignResourceBridge.ts b/apps/ai-game-creator-shell/src/features/ui-editor/uiDesignResourceBridge.ts index c42ca8c58..358af30c9 100644 --- a/apps/ai-game-creator-shell/src/features/ui-editor/uiDesignResourceBridge.ts +++ b/apps/ai-game-creator-shell/src/features/ui-editor/uiDesignResourceBridge.ts @@ -6,6 +6,7 @@ import { GAME_CREATION_APP_UI_DESIGN_DOC_ASSET_KIND, GAME_CREATION_APP_UI_DESIGN_DOC_MEDIA_TYPE, } from '../../../../../packages/shared/src/contracts/gameCreationApp'; +import { parseGameCreationAppAssetKind } from '../../contracts/assetKind'; export type UiDesignResourceBridgeResult = { asset: GameCreationAppAssetManifestEntry; @@ -52,7 +53,10 @@ export function findLinkedUiDesignResource( manifest.assets .filter( (asset) => - asset.kind === GAME_CREATION_APP_UI_DESIGN_DOC_ASSET_KIND && + parseGameCreationAppAssetKind( + asset.kind, + 'ui-design-resource-bridge.linked-document', + ) === GAME_CREATION_APP_UI_DESIGN_DOC_ASSET_KIND && asset.mediaType === GAME_CREATION_APP_UI_DESIGN_DOC_MEDIA_TYPE && asset.source.referenceResourceIds?.some((reference) => referenceIds.has(reference), @@ -84,7 +88,13 @@ export async function ensureUiDesignResourceForPrototype({ const prototype = manifest.assets.find( (asset) => asset.id === normalizedPrototypeAssetId, ); - if (!prototype || prototype.kind !== 'ui-prototype') { + if ( + !prototype || + parseGameCreationAppAssetKind( + prototype.kind, + 'ui-design-resource-bridge.prototype', + ) !== 'ui-design' + ) { throw new Error('目标资源不是 UI 原型图片'); } if (!prototype.mediaType.toLowerCase().startsWith('image/')) { diff --git a/apps/ai-game-creator-shell/tests/uiDesignResourceBridge.test.ts b/apps/ai-game-creator-shell/tests/uiDesignResourceBridge.test.ts index 18b2a235d..42d2f5003 100644 --- a/apps/ai-game-creator-shell/tests/uiDesignResourceBridge.test.ts +++ b/apps/ai-game-creator-shell/tests/uiDesignResourceBridge.test.ts @@ -16,7 +16,7 @@ import { function manifestWithPrototype(): GameCreationAppManifest { const prototype: GameCreationAppAssetManifestEntry = { id: 'prototype-asset', - kind: 'ui-prototype', + kind: 'ui-design', mediaType: 'image/png', localPath: 'assets/ui-prototype.png', source: { kind: 'canvas', referenceResourceIds: [] }, diff --git a/docs/project-memory/todos/【待办】AGC资源kind枚举化扫描清单-2026-09-15.md b/docs/project-memory/todos/【待办】AGC资源kind枚举化扫描清单-2026-09-15.md index e4085b1d4..e7d293a98 100644 --- a/docs/project-memory/todos/【待办】AGC资源kind枚举化扫描清单-2026-09-15.md +++ b/docs/project-memory/todos/【待办】AGC资源kind枚举化扫描清单-2026-09-15.md @@ -216,5 +216,6 @@ - `src/contracts/assetKind.ts`:消费 Rust 生成的 `GameCreationAppAssetKind`,未知输入记录 `rawKind` / `sourceContext` 并返回 `unknown`,不做旧 alias 转换。 - `src/features/project-workspace/resourceReferences.ts`:资源引用 kind 改为生成枚举类型并通过 parser 收口。 - `src/view/project-development/index.tsx`:画布引用入口通过同一 parser 构造资源引用 kind。 +- `src/features/ui-editor/uiDesignResourceBridge.ts`:UI 原型 manifest kind 只接受 `ui-design`,UI 文档链接只接受 `ui-design-doc`;旧 `ui-prototype` 不再 alias。 其余 `packages/shared` import 和前端 manifest `kind: string` 字段仍未迁移,继续作为后续小切片,不在本次提交中伪装完成。