补充评审状态聊天入口
新增 /review 评审摘要和读取草稿 补充 /next 与 /help 的评审入口覆盖 同步技术方案和项目决策记录
This commit is contained in:
@@ -1869,6 +1869,7 @@ const chatCommandHelp = [
|
||||
'/status:查看项目状态',
|
||||
'/brief:生成当前项目简报',
|
||||
'/risks:查看当前项目风险',
|
||||
'/review:查看 Evaluator 评审和返工焦点',
|
||||
'/handoff:生成当前项目交接摘要',
|
||||
'/next:查看下一步建议',
|
||||
'/publish:查看发布准备清单',
|
||||
@@ -2171,6 +2172,77 @@ function isAgentRunTracePassed(trace: GameCreationAgentRunTrace | null) {
|
||||
);
|
||||
}
|
||||
|
||||
function isAgentReviewStep(step: GameCreationAgentRunStep) {
|
||||
return (
|
||||
step.agent.toLowerCase().includes('evaluator') ||
|
||||
step.phase === 'evaluation' ||
|
||||
step.phase === 'evaluate' ||
|
||||
step.taskId === 'quality-review'
|
||||
);
|
||||
}
|
||||
|
||||
function summarizeAgentReviewState(trace: GameCreationAgentRunTrace | null) {
|
||||
if (!trace) {
|
||||
return {
|
||||
text: '评审状态:暂无最近 trace',
|
||||
draftCommand: '/next',
|
||||
draftCommandLabel: '查看下一步',
|
||||
};
|
||||
}
|
||||
|
||||
const reviewSteps = trace.steps.filter(isAgentReviewStep);
|
||||
const visibleReviewSteps = reviewSteps.slice(-3);
|
||||
const reviewStepLines = visibleReviewSteps.map((step) => {
|
||||
const outputPaths = step.outputPaths.filter(isSafeProjectRelativePath);
|
||||
return [
|
||||
`- ${step.agent} #${step.pass} · ${step.status} · ${step.summary}`,
|
||||
outputPaths.length > 0 ? `输出 ${outputPaths.join(', ')}` : null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ');
|
||||
});
|
||||
if (reviewSteps.length > visibleReviewSteps.length) {
|
||||
reviewStepLines.push(
|
||||
`- 还有 ${reviewSteps.length - visibleReviewSteps.length} 个较早评审步骤`,
|
||||
);
|
||||
}
|
||||
const repair = formatTraceRepairRoutes(
|
||||
trace.taskGraph.repairRoutes,
|
||||
trace.taskGraph.tasks,
|
||||
);
|
||||
const needsResume =
|
||||
trace.lifecycleStatus === 'killed' ||
|
||||
trace.status === 'failed' ||
|
||||
trace.status === 'needs-revision' ||
|
||||
trace.stopReason === 'max-passes-exhausted';
|
||||
const evaluatorState = isAgentRunTracePassed(trace)
|
||||
? '通过'
|
||||
: needsResume
|
||||
? '需返工'
|
||||
: '未通过';
|
||||
|
||||
return {
|
||||
text: [
|
||||
'评审状态:',
|
||||
`- Run:${trace.runId} · ${formatAgentRunStatus(trace)}`,
|
||||
`- Evaluator:${evaluatorState}`,
|
||||
`- 返工焦点:${
|
||||
trace.taskGraph.repairFocus.length > 0
|
||||
? trace.taskGraph.repairFocus.join(';')
|
||||
: '暂无'
|
||||
}`,
|
||||
`- 返工路线:${repair || '暂无'}`,
|
||||
`- 下一步:${trace.nextStep}`,
|
||||
'- 评审记录:/read .agent/findings.md',
|
||||
reviewStepLines.length > 0
|
||||
? `- 最近评审步骤:\n${reviewStepLines.join('\n')}`
|
||||
: '- 最近评审步骤:暂无',
|
||||
].join('\n'),
|
||||
draftCommand: needsResume ? '/agent-resume ' : '/read .agent/findings.md',
|
||||
draftCommandLabel: needsResume ? '继续修复' : '读取评审记录',
|
||||
};
|
||||
}
|
||||
|
||||
function summarizeProjectHandoff(
|
||||
nextManifest: GameCreationAppManifest,
|
||||
nextProjectPath: string,
|
||||
@@ -2409,6 +2481,7 @@ function summarizeNextProjectActions(
|
||||
|
||||
if (trace) {
|
||||
addSuggestion('查看发布准备清单', '/publish');
|
||||
addSuggestion('查看评审和返工焦点', '/review');
|
||||
addSuggestion('查看最近 trace 摘要', '/trace');
|
||||
addSuggestion('列出最近 Run 产物', '/run-artifacts');
|
||||
addSuggestion('列出 Agent 轮次产物', '/passes');
|
||||
@@ -5911,6 +5984,23 @@ export function App() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (prompt === '/review') {
|
||||
if (!requireChatProjectForUserAction()) {
|
||||
return;
|
||||
}
|
||||
const summary = summarizeAgentReviewState(agentRunTrace);
|
||||
setMessages((current) => [
|
||||
...current,
|
||||
{
|
||||
role: 'assistant',
|
||||
text: summary.text,
|
||||
draftCommand: summary.draftCommand,
|
||||
draftCommandLabel: summary.draftCommandLabel,
|
||||
},
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (prompt === '/handoff') {
|
||||
const nextProjectPath = requireChatProjectForUserAction();
|
||||
if (!nextProjectPath) {
|
||||
|
||||
@@ -128,6 +128,22 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
summary: '代码已通过生成',
|
||||
toolCalls: [],
|
||||
},
|
||||
{
|
||||
pass: 1,
|
||||
agent: 'Evaluator',
|
||||
phase: 'evaluation',
|
||||
status: 'passed',
|
||||
inputPaths: ['.agent/passes/pass-1/draft.json', '.agent/findings.md'],
|
||||
outputPaths: ['.agent/findings.md'],
|
||||
summary: '质量评审通过',
|
||||
toolCalls: [
|
||||
{
|
||||
toolId: 'agent.evaluate',
|
||||
status: 'ok',
|
||||
summary: 'Evaluator 质量评审',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
taskGraph: {
|
||||
goal: '做一个厨房弹幕游戏',
|
||||
@@ -1747,6 +1763,22 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
pass: 1,
|
||||
agent: 'Evaluator',
|
||||
phase: 'evaluation',
|
||||
status: 'passed',
|
||||
inputPaths: ['.agent/passes/pass-1/draft.json', '.agent/findings.md'],
|
||||
outputPaths: ['.agent/findings.md'],
|
||||
summary: '质量评审通过',
|
||||
toolCalls: [
|
||||
{
|
||||
toolId: 'agent.evaluate',
|
||||
status: 'ok',
|
||||
summary: 'Evaluator 质量评审',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
artifacts: [
|
||||
{
|
||||
@@ -2211,6 +2243,64 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
),
|
||||
).toHaveLength(runLocalCountBeforeRisks);
|
||||
|
||||
const fileReadCountBeforeReview = invoke.mock.calls.filter(
|
||||
([command]) => command === 'read_local_project_file',
|
||||
).length;
|
||||
const manifestReadCountBeforeReview = invoke.mock.calls.filter(
|
||||
([command]) => command === 'get_local_game_manifest',
|
||||
).length;
|
||||
const runLocalCountBeforeReview = invoke.mock.calls.filter(
|
||||
([command]) => command === 'run_limited_local_command',
|
||||
).length;
|
||||
const startPreviewCountBeforeReview = invoke.mock.calls.filter(
|
||||
([command]) => command === 'start_local_game_preview',
|
||||
).length;
|
||||
const openPreviewCountBeforeReview = invoke.mock.calls.filter(
|
||||
([command]) => command === 'open_local_game_preview',
|
||||
).length;
|
||||
submitChat('/review');
|
||||
expect(await screen.findByText(/评审状态:/)).not.toBeNull();
|
||||
expect(screen.getByText(/Evaluator:通过/)).not.toBeNull();
|
||||
expect(screen.getByText(/返工焦点:暂无/)).not.toBeNull();
|
||||
expect(
|
||||
screen.getByText(/评审记录:\/read \.agent\/findings\.md/),
|
||||
).not.toBeNull();
|
||||
const reviewMessages = screen.getAllByText(/评审状态:/);
|
||||
const reviewMessage = reviewMessages[reviewMessages.length - 1];
|
||||
expect(reviewMessage.textContent).toContain(
|
||||
'Evaluator #1 · passed · 质量评审通过',
|
||||
);
|
||||
fireEvent.click(screen.getByRole('button', { name: '读取评审记录' }));
|
||||
expect(screen.getByLabelText('创作想法')).toHaveProperty(
|
||||
'value',
|
||||
'/read .agent/findings.md',
|
||||
);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'read_local_project_file',
|
||||
),
|
||||
).toHaveLength(fileReadCountBeforeReview);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'get_local_game_manifest',
|
||||
),
|
||||
).toHaveLength(manifestReadCountBeforeReview);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'run_limited_local_command',
|
||||
),
|
||||
).toHaveLength(runLocalCountBeforeReview);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'start_local_game_preview',
|
||||
),
|
||||
).toHaveLength(startPreviewCountBeforeReview);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'open_local_game_preview',
|
||||
),
|
||||
).toHaveLength(openPreviewCountBeforeReview);
|
||||
|
||||
const manifestReadCountBeforeHandoff = invoke.mock.calls.filter(
|
||||
([command]) => command === 'get_local_game_manifest',
|
||||
).length;
|
||||
@@ -2222,9 +2312,15 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
).length;
|
||||
submitChat('/handoff');
|
||||
expect(await screen.findByText(/项目交接:/)).not.toBeNull();
|
||||
expect(screen.getByText(/- Run:run-main-shortcut-trace/)).not.toBeNull();
|
||||
expect(screen.getByText(/Ready:art\/Asset 规划美术资产/)).not.toBeNull();
|
||||
expect(screen.getByText(/历史:已加载 0 个 run/)).not.toBeNull();
|
||||
const handoffMessages = screen.getAllByText(/项目交接:/);
|
||||
const handoffMessage = handoffMessages[handoffMessages.length - 1];
|
||||
expect(handoffMessage.textContent).toContain(
|
||||
'- Run:run-main-shortcut-trace',
|
||||
);
|
||||
expect(handoffMessage.textContent).toContain(
|
||||
'Ready:art/Asset 规划美术资产',
|
||||
);
|
||||
expect(handoffMessage.textContent).toContain('历史:已加载 0 个 run');
|
||||
const nextActionButtons = screen.getAllByRole('button', {
|
||||
name: '查看下一步',
|
||||
});
|
||||
@@ -2325,6 +2421,7 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
expect(screen.getByText(/运行自检并启动本地预览:\/run/)).not.toBeNull();
|
||||
expect(screen.getByText(/查看 .* 个 ready 任务:\/tasks/)).not.toBeNull();
|
||||
expect(screen.getByText(/查看发布准备清单:\/publish/)).not.toBeNull();
|
||||
expect(screen.getByText(/查看评审和返工焦点:\/review/)).not.toBeNull();
|
||||
expect(
|
||||
screen.getByText(/列出内部真相源读取命令:\/internals/),
|
||||
).not.toBeNull();
|
||||
@@ -8123,6 +8220,9 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
).not.toBeNull();
|
||||
expect(screen.getByText(/\/brief:生成当前项目简报/)).not.toBeNull();
|
||||
expect(screen.getByText(/\/risks:查看当前项目风险/)).not.toBeNull();
|
||||
expect(
|
||||
screen.getByText(/\/review:查看 Evaluator 评审和返工焦点/),
|
||||
).not.toBeNull();
|
||||
expect(screen.getByText(/\/handoff:生成当前项目交接摘要/)).not.toBeNull();
|
||||
expect(screen.getByText(/\/next:查看下一步建议/)).not.toBeNull();
|
||||
expect(screen.getByText(/\/publish:查看发布准备清单/)).not.toBeNull();
|
||||
|
||||
Reference in New Issue
Block a user