From fd5a4c313611f729452ebdba7e5424eaeae56600 Mon Sep 17 00:00:00 2001 From: Linghong Date: Fri, 11 Sep 2026 11:21:07 +0000 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AD=96=E5=88=92=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=97=A5=E5=BF=97=E9=BB=98=E8=AE=A4=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit npm run agc 开发启动时默认开启 design debug 其他启动方式默认不创建 .debug 目录 --- apps/ai-game-creator-shell/scripts/start-tauri-dev.mjs | 6 +++++- .../src-tauri/src/agent/design_runtime.rs | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/ai-game-creator-shell/scripts/start-tauri-dev.mjs b/apps/ai-game-creator-shell/scripts/start-tauri-dev.mjs index 95a866f95..87144db48 100644 --- a/apps/ai-game-creator-shell/scripts/start-tauri-dev.mjs +++ b/apps/ai-game-creator-shell/scripts/start-tauri-dev.mjs @@ -20,6 +20,7 @@ import { const appRoot = fileURLToPath(new URL('..', import.meta.url)); const repoRoot = resolve(appRoot, '../..'); const tauriCliPath = resolve(repoRoot, 'node_modules/@tauri-apps/cli/tauri.js'); +const AGC_DESIGN_DEBUG_ENV = 'GENARRATIVE_AGC_DESIGN_DEBUG'; function buildTauriArguments(argv, devUrl = readAgcDevEndpoint().url) { const args = [...argv]; @@ -108,7 +109,10 @@ async function runTauriDev( if (!prepared || shutdownSignal) return 1; const tauriArguments = buildTauriArguments(argv, endpoint.url); child = spawnCli(tauriArguments, { - env: withAgcDevEndpointEnv(endpoint), + env: { + ...withAgcDevEndpointEnv(endpoint), + [AGC_DESIGN_DEBUG_ENV]: '1', + }, }); const childResult = waitForCli(child); const outcome = await Promise.race([ diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/design_runtime.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/design_runtime.rs index f20f92c23..8dba870dd 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/design_runtime.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/design_runtime.rs @@ -460,6 +460,13 @@ fn build_design_request( // 调试队列只接收副本,写盘慢或失败时丢弃,不参与会话恢复。 fn design_debug(root: &Path, kind: &str, data: Value) { + if std::env::var("GENARRATIVE_AGC_DESIGN_DEBUG") + .ok() + .as_deref() + != Some("1") + { + return; + } type Entry = (PathBuf, Value); static QUEUE: OnceLock> = OnceLock::new(); let sender = QUEUE.get_or_init(|| {