删除策划对话栏未接通的文件浏览死接线
Project CI / Repository checks (pull_request) Successful in 2m21s
Project CI / Frontend tests (pull_request) Successful in 2m56s
Project CI / Backend tests (pull_request) Successful in 5m52s
Project CI / Native shell tests (pull_request) Successful in 17m55s

DesignAgentSurface 移除从未消费的 files 与预览 props

ProjectSupervisorView 同步移除死 props 声明与透传

App 移除 designWorkspaceFiles 等状态与 refreshDesignWorkspace,每轮策划事件不再多打一次 list_design_workspace
This commit is contained in:
2026-09-12 09:44:09 +08:00
parent 86adaa738f
commit 22c4807612
3 changed files with 4 additions and 92 deletions
+2 -62
View File
@@ -55,7 +55,6 @@ import type {
DesignClarificationRequest,
DesignEvent,
DesignView,
DesignWorkspaceEntry,
GameCreatorAgentRuntimeUpdateEvent,
GameCreatorChatAgentReply,
GameCreatorDirectTurnUpdateEvent,
@@ -569,13 +568,6 @@ export function App({
projectPath: string;
clientTurnId: string;
} | null>(null);
const [designWorkspaceFiles, setDesignWorkspaceFiles] = useState<
DesignWorkspaceEntry[]
>([]);
const [designPreviewPath, setDesignPreviewPath] = useState<string | null>(
null,
);
const [designPreviewText, setDesignPreviewText] = useState('');
// 做方案入口独立成链:立项策划需要委派、澄清 pending 与 GDD 审批,这些只存在于
// Supervisor Runtimedirect-codex 是单回合「生成→试玩→修」循环,没有对应机制。
// 因此策划入口不走产品默认的 direct-codex,做游戏与做素材保持 master 的新默认。
@@ -895,26 +887,6 @@ export function App({
latestMessagesRef.current = conversation;
}
async function refreshDesignWorkspace(nextProjectPath: string) {
const invoke = resolveTauriInvoke();
if (!invoke || !nextProjectPath.trim()) {
return;
}
try {
const files = await invoke<DesignWorkspaceEntry[]>(
'list_design_workspace',
{ projectPath: nextProjectPath },
);
if (localProjectPathRef.current === nextProjectPath) {
setDesignWorkspaceFiles(files);
}
} catch {
if (localProjectPathRef.current === nextProjectPath) {
setDesignWorkspaceFiles([]);
}
}
}
async function hydrateDesignAgentSession(nextProjectPath: string) {
const invoke = resolveTauriInvoke();
if (!invoke || !nextProjectPath.trim()) {
@@ -931,7 +903,6 @@ export function App({
return null;
}
applyDesignView(view, nextProjectPath);
await refreshDesignWorkspace(nextProjectPath);
return view;
}
@@ -962,7 +933,6 @@ export function App({
return;
}
applyDesignView(view, nextProjectPath);
await refreshDesignWorkspace(nextProjectPath);
} catch (error) {
if (localProjectPathRef.current !== nextProjectPath) {
return;
@@ -1472,9 +1442,6 @@ export function App({
designAgentLaneRef.current = planningStartMode;
designAgentTurnRef.current = null;
setDesignAgentView(null);
setDesignWorkspaceFiles([]);
setDesignPreviewPath(null);
setDesignPreviewText('');
}
function syncTerminalProjectSupervisorConversation(
@@ -1924,7 +1891,6 @@ export function App({
}
if (payload.view) {
applyDesignView(payload.view, payload.projectPath);
void refreshDesignWorkspace(payload.projectPath);
}
})
.then((unlisten) => {
@@ -1939,8 +1905,8 @@ export function App({
disposed = true;
cleanup?.();
};
// applyDesignView / refreshDesignWorkspace 读的是 refs 和当前项目路径,
// 把它写进依赖会在每轮回复时重订事件。
// applyDesignView 读的是 refs 和当前项目路径,
// 把它写进依赖会在每轮回复时重订事件。
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [planningV2Active]);
@@ -11660,9 +11626,6 @@ export function App({
onPlanGddDecision={decidePlanGdd}
planningLane={planningV2Active}
designView={useDesignAgentSurface ? designAgentView : null}
designFiles={designWorkspaceFiles}
designPreviewPath={designPreviewPath}
designPreviewText={designPreviewText}
onDesignApprove={
useDesignAgentSurface
? (requestId, approved) => {
@@ -11687,7 +11650,6 @@ export function App({
})
.then((view) => {
applyDesignView(view, nextProjectPath);
return refreshDesignWorkspace(nextProjectPath);
})
.catch((error) => {
setPlanGddError(String(error));
@@ -11737,28 +11699,6 @@ export function App({
}
: undefined
}
onDesignOpenFile={
useDesignAgentSurface
? (path) => {
const nextProjectPath = resolveChatProjectPath(localProject);
const invoke = resolveTauriInvoke();
if (!nextProjectPath || !invoke) {
return;
}
void invoke<string>('read_design_workspace_file', {
projectPath: nextProjectPath,
path,
}).then((text) => {
setDesignPreviewPath(path);
setDesignPreviewText(text);
});
}
: undefined
}
onDesignClosePreview={() => {
setDesignPreviewPath(null);
setDesignPreviewText('');
}}
onMakeGameFromApprovedGdd={
onMakeGameFromApprovedGdd
? () =>
@@ -1,11 +1,7 @@
import { Check, RotateCcw, X } from 'lucide-react';
import { useLayoutEffect, useState } from 'react';
import type {
DesignClarificationRequest,
DesignView,
DesignWorkspaceEntry,
} from '../../app/types';
import type { DesignClarificationRequest, DesignView } from '../../app/types';
const PHASE_LABELS: Record<string, string> = {
concept: '概念设计',
@@ -18,9 +14,6 @@ const PHASE_LABELS: Record<string, string> = {
type DesignAgentSurfaceProps = {
view: DesignView | null;
files: DesignWorkspaceEntry[];
previewPath: string | null;
previewText: string;
busy: boolean;
error: string | null;
onApprove: (requestId: string, approved: boolean) => void;
@@ -31,8 +24,6 @@ type DesignAgentSurfaceProps = {
) => void;
onRetry: () => void;
onMakeGame: () => void;
onOpenFile: (path: string) => void;
onClosePreview: () => void;
};
export function DesignAgentSurface({
@@ -18,11 +18,7 @@ import type {
PlanGddDecisionAction,
PlanGddStateViewV1,
} from '../../app/types';
import type {
DesignClarificationRequest,
DesignView,
DesignWorkspaceEntry,
} from '../../app/types';
import type { DesignClarificationRequest, DesignView } from '../../app/types';
import { ChatMarkdownMessage } from '../../components/ChatMarkdownMessage';
import {
projectProfessionalAgentLabel,
@@ -106,9 +102,6 @@ type ProjectSupervisorViewProps = RuntimePanelProps & {
) => Promise<void>;
onMakeGameFromApprovedGdd?: () => Promise<void>;
designView?: DesignView | null;
designFiles?: DesignWorkspaceEntry[];
designPreviewPath?: string | null;
designPreviewText?: string;
onDesignApprove?: (requestId: string, approved: boolean) => void;
onDesignClarify?: (
question: DesignClarificationRequest,
@@ -117,8 +110,6 @@ type ProjectSupervisorViewProps = RuntimePanelProps & {
) => void;
onDesignRetry?: () => void;
onDesignMakeGame?: () => void;
onDesignOpenFile?: (path: string) => void;
onDesignClosePreview?: () => void;
};
export function ProjectSupervisorView({
@@ -156,15 +147,10 @@ export function ProjectSupervisorView({
onPlanGddDecision,
onMakeGameFromApprovedGdd,
designView = null,
designFiles = [],
designPreviewPath = null,
designPreviewText = '',
onDesignApprove,
onDesignClarify,
onDesignRetry,
onDesignMakeGame,
onDesignOpenFile,
onDesignClosePreview,
...runtimePanelProps
}: ProjectSupervisorViewProps) {
const planningSurfaceActive =
@@ -196,17 +182,12 @@ export function ProjectSupervisorView({
{designView || onDesignApprove ? (
<DesignAgentSurface
view={designView}
files={designFiles}
previewPath={designPreviewPath}
previewText={designPreviewText}
busy={runtimePanelProps.controlBusy || planGddDecisionBusy}
error={planGddError}
onApprove={onDesignApprove ?? (() => undefined)}
onClarify={onDesignClarify ?? (() => undefined)}
onRetry={onDesignRetry ?? (() => undefined)}
onMakeGame={onDesignMakeGame ?? (() => undefined)}
onOpenFile={onDesignOpenFile ?? (() => undefined)}
onClosePreview={onDesignClosePreview ?? (() => undefined)}
/>
) : (
<PlanGddSurface