From f1294d4d6bc1691296e4571a906038ace93db5de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Mon, 21 Sep 2026 12:22:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=A6=96=E9=A1=B5=E5=BB=BA?= =?UTF-8?q?=E9=A1=B9=E4=B8=A4=E7=94=A8=E4=BE=8B=E5=AF=B9=20DirectProject?= =?UTF-8?q?=20=E9=A6=96=E8=BD=AE=E9=93=BE=E8=B7=AF=E7=9A=84=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=E5=81=87=E8=AE=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - apps/ai-game-creator-shell/tests/appSurface/home.suite.ts 两个首页建项用例补上 `get_local_game_manifest` 桩:首轮需求由 DirectProject 聊天容器认领,它要先读到项目清单(项目身份)才发送,不桩这条命令时清单读失败、首轮永不发出 - 「imports home attachments」用例改为 waitFor 断言首轮 invoke:发送发生在清单到位之后,不能在「工作台已出现」的同一帧断言 - 同用例的 `prompt` 期望由 `按这个角色做游戏` 改为 `按这个角色做游戏@角色参考.png`:附件以 `agc_attachment_reference` 进入 canonical content 后按 `@名称` 口径投影,与输入区、队列 chip 同一份派生 --- .../tests/appSurface/home.suite.ts | 59 ++++++++++++------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/apps/ai-game-creator-shell/tests/appSurface/home.suite.ts b/apps/ai-game-creator-shell/tests/appSurface/home.suite.ts index 8a84e24b4..8f65a77bf 100644 --- a/apps/ai-game-creator-shell/tests/appSurface/home.suite.ts +++ b/apps/ai-game-creator-shell/tests/appSurface/home.suite.ts @@ -1384,6 +1384,11 @@ export function registerHomeProjectCreationTests() { manifest, }; } + // DirectProject 聊天容器自己订阅项目清单(项目身份与 `@` 引用素材都来自它), + // 首轮需求要等清单到位才认领,所以这里必须提供清单读数。 + if (command === 'get_local_game_manifest') { + return manifest; + } if (command === 'chat_with_game_creator_direct_codex') { chatHarness.completeDirectThreadTurn({ turnId: String(args?.clientTurnId ?? ''), @@ -1512,6 +1517,9 @@ export function registerHomeProjectCreationTests() { manifest, }; } + if (command === 'get_local_game_manifest') { + return manifest; + } if (command === 'upload_local_asset') { return { id: 'asset-upload-1', @@ -1575,28 +1583,37 @@ export function registerHomeProjectCreationTests() { mediaType: 'image/png', bytes: fileBytes, }); - expect(invoke).toHaveBeenCalledWith('chat_with_game_creator_direct_codex', { - projectPath: automaticProjectPath, - prompt: '按这个角色做游戏', - creationType: 'game', - clientTurnId: expect.any(String), - userItem: { - id: expect.stringMatching(/^direct-codex:[A-Za-z0-9-]+:user$/), - type: 'message', - role: 'user', - // 首页附件随首轮一起进 canonical content:它就是这一轮输入的一部分。 - content: [ - { type: 'input_text', text: '按这个角色做游戏' }, - { - type: 'agc_attachment_reference', - name: '角色参考.png', - mediaType: 'image/png', - size: attachment.size, - localPath: 'assets/uploads/reference.png', - status: 'imported', + // 首轮需求由 DirectProject 聊天容器认领:它要先读到项目清单(项目身份就绪)才发送, + // 所以这里等一等,不能在「工作台已出现」的同一帧断言。 + await waitFor(() => { + expect(invoke).toHaveBeenCalledWith( + 'chat_with_game_creator_direct_codex', + { + projectPath: automaticProjectPath, + // `prompt` 是 canonical content 的可读投影:首页附件作为 + // `agc_attachment_reference` 也在这一轮输入里,按同一口径展开成 `@名称`。 + prompt: '按这个角色做游戏@角色参考.png', + creationType: 'game', + clientTurnId: expect.any(String), + userItem: { + id: expect.stringMatching(/^direct-codex:[A-Za-z0-9-]+:user$/), + type: 'message', + role: 'user', + // 首页附件随首轮一起进 canonical content:它就是这一轮输入的一部分。 + content: [ + { type: 'input_text', text: '按这个角色做游戏' }, + { + type: 'agc_attachment_reference', + name: '角色参考.png', + mediaType: 'image/png', + size: attachment.size, + localPath: 'assets/uploads/reference.png', + status: 'imported', + }, + ], }, - ], - }, + }, + ); }); expect(invoke).not.toHaveBeenCalledWith( 'chat_with_game_creator_home_direct_codex',