修正首页建项两用例对 DirectProject 首轮链路的过期假设
- 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 同一份派生
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user