876529e668
- 删除 ProjectSupervisorView、SupervisorChatOnlyView、ProjectWorkspaceChatPane、AgentConversationOverlay、DeveloperProjectPanels、DeveloperRuntimePanels 与 features/agent-runtime/panels.tsx - 删除 Supervisor 独立调试窗口:windows.rs 的 supervisor_chat_window_url / open_project_supervisor_chat_window、main.rs 的 invoke 注册、?supervisor-chat 与 ?agent-chat 前端入口、developer.json capability 和对应 Rust 用例 - 删除工作台壳的开发者 Agent 面板:DeveloperAgentPanel、useDeveloperAgentPanel、useDeveloperAgentState、developerAgentControls - App.tsx 删除只服务退役面板的 state/ref/effect/handler(agentConversation*、文件/记忆/资产/画板/预览面板处理、commandLog、llmConfigStatus、editorBaseUrl、回放历史与 trace 面板状态、selectedAgent 等)以及由此产生的空分支,并把 requestRuntimeConfigOpen 接回本地 RuntimeConfigDialog - 立项策划独立成模块:Design Agent 与 Planning V2 的容器和表现移到 view/project-development/planning/(PlanningChatView、PlanningUserInputCard、GddApprovalCard、DesignAgentSurface、PlanningLaneRuntimeStrip、planningLane、planningSessionV2、planningSessionContract) - 改名到中性概念:ProjectSupervisorComponentProps→ProjectChatComponentProps、WorkspaceLauncherShellProps.ProjectSupervisor→ProjectChat、ProjectDevelopmentView.supervisor→chat、orchestrationMode→agentDockVisible、initialSupervisorMessageClaims→initialTurnClaims、ProjectManifestSnapshotSource 'supervisor'→'chat'、CSS project-supervisor-*/project-planning-*→project-chat-* - 删除 PROJECT_SUPERVISOR_AGENT_ID 与 PROJECT_SUPERVISOR_PLAN_SOURCE 常量 - 工作台壳自己订阅 game-creator-manifest-invalidated,用 revision→清单→revision 配对读(source: asset-event)并入 currentProjectContext,且不重新检查项目目录;测试夹具改为按监听器集合广播该事件 - 删除只钉住退役界面的 appSurface 用例(旧调试窗口、开发者面板、Agent 对话浮层、运行历史面板) - 同步文档:ADR、DirectProject 聊天模块抽离实施计划与里程碑、Provider 推理里程碑、策划会话 RuntimeV2、AI 游戏创作实施计划,并在 decision-log 新增 2026-09-19 条 - 删除随退役面板失去调用方的模块与导出:projectSummaryCommands.ts(1054 行旧 Supervisor 斜杠命令处理器)、AGENT_RUN_HISTORY_* 常量、agent-runtime/model.ts 与 project-summary/agentPresentation.ts 里的死导出,以及 agentRunTrace / memoryCommands / projectCommandPolicy 中无调用方的校验与解析函数 - 更新 scripts/check-config.mjs 与 scripts/check-native-shells.mjs 的窗口与命令守卫
77 lines
2.2 KiB
TypeScript
77 lines
2.2 KiB
TypeScript
// @vitest-environment jsdom
|
|
|
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
import { StrictMode } from 'react';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
import type { AgentRuntimeUserInputRequest } from '../src/app/types';
|
|
import { PlanningUserInputCard } from '../src/view/project-development/planning/PlanningUserInputCard';
|
|
|
|
function clarificationRequest(): AgentRuntimeUserInputRequest {
|
|
return {
|
|
schemaVersion: 'agc.user_input_request.v1',
|
|
requestId: 'req-1',
|
|
agentId: 'planning-agent-v2',
|
|
taskId: 'task-1',
|
|
sessionId: 'session-1',
|
|
runId: 'run-1',
|
|
actionId: 'action-1',
|
|
status: 'pending',
|
|
questions: [
|
|
{
|
|
id: 'q1',
|
|
header: '第1轮·当前要决定:首版路线',
|
|
question: '这局游戏的重玩动力是什么?',
|
|
options: [
|
|
{ label: '分数驱动', description: '刷新纪录后重开' },
|
|
{ label: '成长驱动', description: '解锁新能力后重开' },
|
|
],
|
|
},
|
|
],
|
|
allowFreeform: true,
|
|
responseId: null,
|
|
requestedAt: 1,
|
|
updatedAt: 1,
|
|
};
|
|
}
|
|
|
|
describe('PlanningUserInputCard 澄清输入', () => {
|
|
it('手动输入自由回答不会让页面崩溃', () => {
|
|
render(
|
|
<StrictMode>
|
|
<PlanningUserInputCard
|
|
request={clarificationRequest()}
|
|
controlBusy={false}
|
|
/>
|
|
</StrictMode>,
|
|
);
|
|
|
|
const textarea = screen.getByLabelText(
|
|
'第1轮·当前要决定:首版路线 其他回答',
|
|
);
|
|
fireEvent.change(textarea, { target: { value: '玩家自己写的答案' } });
|
|
|
|
expect((textarea as HTMLTextAreaElement).value).toBe('玩家自己写的答案');
|
|
});
|
|
|
|
it('先选中选项再清空填充文本不会让页面崩溃', () => {
|
|
render(
|
|
<StrictMode>
|
|
<PlanningUserInputCard
|
|
request={clarificationRequest()}
|
|
controlBusy={false}
|
|
/>
|
|
</StrictMode>,
|
|
);
|
|
|
|
fireEvent.click(screen.getByText('分数驱动'));
|
|
const textarea = screen.getByLabelText(
|
|
'第1轮·当前要决定:首版路线 其他回答',
|
|
) as HTMLTextAreaElement;
|
|
expect(textarea.value).toBe('分数驱动');
|
|
|
|
fireEvent.change(textarea, { target: { value: '' } });
|
|
expect(textarea.value).toBe('');
|
|
});
|
|
});
|