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',