diff --git a/docs/project-memory/plans/【里程碑】DirectProject聊天真相源收敛-2026-09-16.md b/docs/project-memory/plans/【里程碑】DirectProject聊天真相源收敛-2026-09-16.md index a0a96c31d..5ef47f156 100644 --- a/docs/project-memory/plans/【里程碑】DirectProject聊天真相源收敛-2026-09-16.md +++ b/docs/project-memory/plans/【里程碑】DirectProject聊天真相源收敛-2026-09-16.md @@ -95,3 +95,4 @@ AGC 项目开发对话的显示与恢复只依赖两项输入:**项目对话 - 宿主确实对外发布「这一轮正在跑」:快照 `phase=working`、`active` 里恰好一条 `kind=execute` 的在途许可、`executorStopped=false` —— 这正是界面重进时判断「有运行中回合可恢复/可终止」读的事实; - 收尾后账本落 `completed`、`active` 清空、`executorStopped=true`;宿主侧落的条目(中间文本 → 工具卡片 → 工具回执)顺序不变。 - 顺带记实:CLI / 无前端宿主的历史里**既没有用户消息、也没有最终助手回复**(两者都由前端 `append_direct_project_conversation_message` 写),CLI 只有宿主侧条目与回执文本;夹具断言据此只校验宿主侧条目。 +- **可复跑入口(2026-09-29)**:新增 `npm run check:agc-direct-execution-fixture`(`scripts/run-agc-direct-execution-fixture.mjs`)——默认用工作区 `src-tauri/target/debug` 里的 AGC 二进制跑**全部 11 个用例**(`completed / passes / mcp / mcp-write / native / native-resources / patch / deadline / native-session / restart / running`),也支持 `-- --cases <子集>` 与 `-- --agc-exe ` 透传。本轮实跑:**11/11 passed**(修复前这些用例要么根本到不了 Provider,要么统一卡在账本阶段)。这样这条真机证路不再需要手打长命令,后续改 DirectProject/执行许可链路可以直接拿它当判据。 diff --git a/package.json b/package.json index 09cab4938..733bc12a0 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "check:game-distribution-upload-resume": "node scripts/check-game-distribution-upload-resume.mjs", "check:agc-project-snapshot-admin-http": "node scripts/check-agc-project-snapshot-admin-http.mjs", "check:agc-update-channel-manifests": "node scripts/check-agc-update-channel-manifests.mjs", + "check:agc-direct-execution-fixture": "node scripts/run-agc-direct-execution-fixture.mjs", "check:game-distribution-sandbox-e2e": "node scripts/check-game-distribution-sandbox-e2e.mjs", "check:external-v1-scene-generation-smoke": "node scripts/check-external-v1-scene-generation-smoke.mjs", "check:game-distribution-web-e2e": "node scripts/check-game-distribution-web-e2e.mjs", diff --git a/scripts/run-agc-direct-execution-fixture.mjs b/scripts/run-agc-direct-execution-fixture.mjs new file mode 100644 index 000000000..c88852220 --- /dev/null +++ b/scripts/run-agc-direct-execution-fixture.mjs @@ -0,0 +1,71 @@ +// 真机 DirectProject 执行夹具的一键入口:真 AGC CLI → 真 app-server → loopback Responses +// fixtures,不需要账号、不花付费 Provider。 +// +// 与 `apps/ai-game-creator-shell/scripts/direct-execution-production-fixture.mjs` 的区别: +// 那个夹具必须显式传 `--agc-exe`;这里默认用工作区里已构建的 debug 二进制,省掉每次手打路径。 +// +// 用法: +// npm run check:agc-direct-execution-fixture # 默认跑全部用例 +// npm run check:agc-direct-execution-fixture -- --cases restart # 透传夹具参数 +// npm run check:agc-direct-execution-fixture -- --agc-exe # 指定其它二进制 +// +// 前置:先构建 debug 二进制(`cargo build --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml`)。 +import { spawnSync } from 'node:child_process'; +import { existsSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const repoRoot = path.resolve( + path.dirname(fileURLToPath(import.meta.url)), + '..', +); +const fixture = path.join( + repoRoot, + 'apps/ai-game-creator-shell/scripts/direct-execution-production-fixture.mjs', +); +const defaultExecutable = path.join( + repoRoot, + 'apps/ai-game-creator-shell/src-tauri/target/debug', + process.platform === 'win32' + ? 'genarrative-ai-game-creator-shell.exe' + : 'genarrative-ai-game-creator-shell', +); +const defaultCases = [ + 'completed', + 'passes', + 'mcp', + 'mcp-write', + 'native', + 'native-resources', + 'patch', + 'deadline', + 'native-session', + 'restart', + 'running', +].join(','); + +const forwarded = process.argv.slice(2); +const hasExecutable = forwarded.some( + (value) => value === '--agc-exe' || value.startsWith('--agc-exe='), +); +const hasCases = forwarded.some( + (value) => value === '--cases' || value.startsWith('--cases='), +); +if (!hasExecutable && !existsSync(defaultExecutable)) { + console.error( + `未找到 debug 二进制:${defaultExecutable}\n` + + '请先执行 `cargo build --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml`,' + + '或用 `-- --agc-exe ` 指定一个已构建的 AGC 二进制。', + ); + process.exit(2); +} + +const args = [fixture, ...forwarded]; +if (!hasExecutable) args.push('--agc-exe', defaultExecutable); +if (!hasCases) args.push('--cases', defaultCases); + +const result = spawnSync(process.execPath, args, { + cwd: repoRoot, + stdio: 'inherit', +}); +process.exit(result.status ?? 1);