运行游戏不再往聊天写"运行通过"提示

- 删掉 AGC 播放/运行本地游戏成功后的聊天提示:它每次播放都会堆在对话底部遮挡运行画面,成功与否由客户端运行视图本身体现,失败仍照原样回报
- appSurface 三处用例改为断言 start_local_game_preview 真被调用且聊天里不再出现该提示
- 补排障记录:本地 node_modules 内置 Codex 原生包过旧会让 AGC build script panic,需在仓库根目录 npm ci
This commit is contained in:
2026-09-21 19:08:43 +08:00
parent 4951b71d71
commit cc8c03a40d
5 changed files with 41 additions and 31 deletions
+2 -9
View File
@@ -9531,15 +9531,8 @@ export function App({
if (!directCodexProductRuntime) {
void refreshAgentRunTrace(nextProjectPath);
}
if (announceToChat) {
setMessages((current) => [
...current,
{
role: 'assistant',
text: `运行通过,已载入客户端运行视图:${previewResult.url}`,
},
]);
}
// 运行成功的提示不再写进聊天:它会一直堆在对话底部遮挡视野,而客户端运行视图
// 本身就是这条动作的可见反馈。失败仍按下面的分支回报,用户需要知道为什么没跑起来。
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
setLimitedCommandStatus(message);
@@ -3025,11 +3025,13 @@ export function registerProjectCommandTests() {
).not.toBeNull();
fireEvent.click(screen.getByRole('button', { name: '确认' }));
expect(
await screen.findByText(
/运行通过,已载入客户端运行视图:http:\/\/127\.0\.0\.1:3210\//,
),
).not.toBeNull();
// /run 成功只切换客户端运行视图,不再往聊天里追加“运行通过”提示。
await waitFor(() =>
expect(invoke).toHaveBeenCalledWith('start_local_game_preview', {
projectPath: '/tmp/authorized-game',
}),
);
expect(screen.queryByText(/运行通过/)).toBeNull();
expect(invoke).toHaveBeenCalledWith('run_limited_local_command', {
projectPath: '/tmp/authorized-game',
commandId: 'game.static_smoke',
@@ -7199,13 +7199,16 @@ export function registerProjectSupervisorSurfaceTests() {
}),
);
expect(
await screen.findByText(
/运行通过,已载入客户端运行视图/,
{},
{ timeout: 3_000 },
),
).not.toBeNull();
// 顶部播放请求只负责把游戏起在运行视图里;聊天里不再新增“运行通过”提示,
// 否则每次播放都会在对话底部堆一条遮挡运行画面。
await waitFor(
() =>
expect(invoke).toHaveBeenCalledWith('start_local_game_preview', {
projectPath,
}),
{ timeout: 3_000 },
);
expect(screen.queryByText(/运行通过/)).toBeNull();
expect(handled).toHaveBeenCalledWith(7);
expect(invoke).toHaveBeenCalledWith('start_local_game_preview', {
projectPath,
@@ -7251,11 +7254,12 @@ export function registerProjectSupervisorSurfaceTests() {
}),
);
expect(
await screen.findByText(
'运行通过,已载入客户端运行视图:http://127.0.0.1:43126/',
),
).not.toBeNull();
await waitFor(() =>
expect(invoke).toHaveBeenCalledWith('start_local_game_preview', {
projectPath,
}),
);
expect(screen.queryByText(/运行通过/)).toBeNull();
expect(invoke).toHaveBeenCalledWith('start_local_game_preview', {
projectPath,
});
@@ -822,11 +822,14 @@ export function registerProjectToolsAndPreviewTests() {
fireEvent.click(screen.getByRole('button', { name: '运行' }));
expect(await screen.findByText('game.run_local')).not.toBeNull();
fireEvent.click(screen.getByRole('button', { name: '确认' }));
expect(
await screen.findByText(
/运行通过,已载入客户端运行视图:http:\/\/127\.0\.0\.1:3210\//,
),
).not.toBeNull();
// 运行成功不再写聊天提示(会一直堆在对话底部遮挡运行画面),改成断言预览真的起来了
// 且聊天里不再出现那条提示。
await waitFor(() =>
expect(invoke).toHaveBeenCalledWith('start_local_game_preview', {
projectPath: '/tmp/authorized-game',
}),
);
expect(screen.queryByText(/运行通过/)).toBeNull();
expect(invoke).toHaveBeenCalledWith('run_limited_local_command', {
projectPath: '/tmp/authorized-game',
@@ -5874,3 +5874,11 @@ Cocos Creator 根目录由 `package.json.creator.version` 与普通 `assets/`
- **原因**:校验器对每个 `input_text` 单独执行 `trim().is_empty()` 并立即拒绝,混淆了结构化片段合法性和整条消息是否有实际内容。
- **处理(现行口径)**`input_text` 允许空字符串、空格和换行,校验过程保持全部片段的原文、分段与顺序,不做合并或删除;遍历完整条消息后,只在既没有非空白文字、也没有合法 `agc_resource_reference` / `agc_runtime_region_reference` 时返回“聊天内容不能为空”。两类引用仍逐个执行原有校验,消息带正文也不能绕过非法引用。
- **关联**`apps/ai-game-creator-shell/src-tauri/src/agent/direct_codex_user_item/validation.rs``docs/【功能说明】AGC聊天素材引用-2026-09-08.md`
## 2026-09-21 本地 node_modules 里的内置 Codex 原生包过旧会让 AGC build script panic
- **现象**`npm run agc` 编到壳 crate 的 build script 时中止,stderr 是 `panicked at build.rs:103: Codex 原生包版本、布局或架构不匹配目标 x86_64-pc-windows-msvc`stdout 只打印了 `cargo:rustc-env=AGC_BUILD_TARGET=...`
- **原因**`build_support/codex_bundle.rs` 把随包 Codex CLI 钉在 `0.155.1`(随 #439 升级),而本地 `node_modules/@openai/codex-win32-x64/vendor/x86_64-pc-windows-msvc/codex-package.json` 仍是 `0.147.0``package-lock.json` 早就是 `0.155.1`,缺的只是本地安装;这条判据只看版本元数据,文件齐全、架构正确也照样拦。
- **处理(现行口径)**:在仓库根目录执行 `npm ci`(不要改成子目录或单包安装),随后 `node_modules/@openai/codex/package.json` 与 vendor 的 `codex-package.json` 都应为 `0.155.1`。Windows 上 `npm ci` 会先 unlink 整个 `node_modules`RustRover 的 Tailwind language server / `oxide-helper` 进程会占住 `@tailwindcss/oxide-*.node`,报 `EPERM: operation not permitted, unlink ...` 时先结束这些 helper 再重试,否则会停在半装状态。
- **验证**`npm ci``cargo build --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml` 输出 `Finished dev profile ... in 1m 26s`,不再触发该 panic。
- **关联**`apps/ai-game-creator-shell/src-tauri/build.rs``apps/ai-game-creator-shell/src-tauri/build_support/codex_bundle.rs``package-lock.json`