From 1a08df517fbe07a32e03791fdd4d2d651720ebf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 5 Sep 2026 13:30:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A9=20Direct=20=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E9=81=B5=E5=AE=88=E9=A1=B9=E7=9B=AE=E5=86=99=E5=85=A5=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Direct 回合启动前检查 conversation.write 策略 确认后复用同一 clientTurnId 重试,拒绝则不启动回合 --- apps/ai-game-creator-shell/src/App.tsx | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/apps/ai-game-creator-shell/src/App.tsx b/apps/ai-game-creator-shell/src/App.tsx index cb5a6aa9d..5674806e7 100644 --- a/apps/ai-game-creator-shell/src/App.tsx +++ b/apps/ai-game-creator-shell/src/App.tsx @@ -387,6 +387,7 @@ type ExecuteChatAgentReplyInput = { clientTurnId?: string; creationType?: HomeCreationType | null; attachments?: DirectCodexTurnAttachment[]; + directPolicyChecked?: boolean; }; export function App({ @@ -5296,6 +5297,7 @@ export function App({ clientTurnId: directConversationTurnId, creationType, attachments, + directPolicyChecked = false, }: ExecuteChatAgentReplyInput) { // Product default: send the conversation directly to Codex app-server. // The legacy Supervisor/harness path remains below for rollback and tests. @@ -5305,6 +5307,38 @@ export function App({ if (directProjectPath && directInvoke) { const clientTurnId = directConversationTurnId ?? createDirectCodexConversationTurnId(); + if (!directPolicyChecked) { + try { + const policyPaused = await queueProjectPolicyConfirmationIfNeeded( + directInvoke, + 'conversation.write', + directProjectPath, + '写入 DirectProject 对话历史', + 'DirectProject 对话写入需要确认。', + () => { + void executeChatAgentReply({ + prompt, + clientTurnId, + creationType, + attachments, + directPolicyChecked: true, + }); + }, + ); + if (policyPaused) { + return; + } + } catch (error) { + if (localProjectPathRef.current === directProjectPath) { + setProjectSupervisorRuntimeError( + `DirectProject 对话权限检查失败:${ + error instanceof Error ? error.message : String(error) + }`, + ); + } + return; + } + } const directUserMessageId = directCodexConversationMessageId( clientTurnId, 'user',