补充评审状态聊天入口

新增 /review 评审摘要和读取草稿

补充 /next 与 /help 的评审入口覆盖

同步技术方案和项目决策记录
This commit is contained in:
AIGameCreator App
2026-07-03 16:25:16 +08:00
parent 169f74b3c8
commit 7250ecf0cc
4 changed files with 199 additions and 6 deletions
+90
View File
@@ -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(/- Runrun-main-shortcut-trace/)).not.toBeNull();
expect(screen.getByText(/Readyart\/Asset 规划美术资产/)).not.toBeNull();
expect(screen.getByText(/历史:已加载 0 个 run/)).not.toBeNull();
const handoffMessages = screen.getAllByText(/项目交接:/);
const handoffMessage = handoffMessages[handoffMessages.length - 1];
expect(handoffMessage.textContent).toContain(
'- Runrun-main-shortcut-trace',
);
expect(handoffMessage.textContent).toContain(
'Readyart/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();
@@ -3867,6 +3867,7 @@
- 2026-07-03 调整:主窗口 header 常驻项目摘要只从当前已加载的 manifest / trace 派生任务完成数、ready 数、资产来源分布和最近命令结果;未选择工作区时不显示,不为了摘要额外触发 Tauri 读取或写入,也不把任务、文件、run history 或预览开发面板搬进普通用户窗口。
- 2026-07-03 调整:普通用户通过聊天输入 `/brief` 触发项目简报入口,只基于主窗口当前已加载的 manifest、最近 run trace、预览状态、资产数量和最近命令生成聊天内简报,并提供 `/next` 作为后续草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动或打开预览,也不得新增普通用户面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/risks` 查看当前项目风险,只基于主窗口当前已加载的 manifest、最近 run trace、预览状态、任务状态、资产来源和最近命令派生风险摘要,并提供首个风险处理草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动或打开预览,也不得新增普通用户面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/review` 查看 Evaluator 评审状态,只基于主窗口当前已加载的最近 run trace 派生通过 / 需返工状态、返工焦点、返工路线和最近评审步骤,并提供 `/read .agent/findings.md``/agent-resume ` 草稿;该入口不得直接读取评审文件、不得触发 Tauri 读写,也不得新增普通用户评审面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/handoff` 生成当前项目交接摘要,只基于主窗口当前已加载的 manifest、授权项目路径、最近 run trace、Agent 状态和已加载 run 历史生成交接信息,并提供 `/next` 后续草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动或打开预览,也不得新增普通用户面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/runs` 查看已加载 Run 历史读取命令,只基于主窗口当前已加载的 latest trace 和最多 100 个历史 run 中已经载入的批次生成 `/trace``/read .agent/runs/...` 草稿;该入口不得额外触发 Tauri 读取、不得滚动加载更多历史、不得启动或打开预览,也不得新增普通用户面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/run-files` 查看 Agent 运行辅助文件读取命令,只列出 `.agent/output.jsonl``.agent/activity.jsonl``.agent/context.bundle.json` 对应 `/read` 草稿并提供首个草稿;该入口不得直接读取辅助文件、不得触发 Tauri 读写,也不得新增普通用户面板。
@@ -3875,7 +3876,7 @@
- 2026-07-03 调整:单 Agent 对话面板允许用户把当前输入手动追加到该 agent 的 `memory/agents/<group>/<role>.md` 私有记忆;写入复用 `memory.write` 项目策略、项目锁和 Tauri 本地目录能力,不把普通对话流水自动混入私有记忆;聊天侧 `/agent-conversations``/agent-memories` 只列出同一批 Agent 对话与私有记忆读取命令并提供首个 `/read` 草稿,不直接读取文件。
- 2026-07-03 调整:主窗口新增音效登记和画板音频导入快捷入口,只填入 `/asset-register assets/audio/sfx.wav audio audio/wav``/import-canvas-asset assets/audio/sfx.wav ` 草稿;聊天输入 `/audio` 只基于当前 manifest 盘点音频素材、来源和路径,并给出登记音效或读取 `assets/manifest.audio.json` 的草稿。音乐组仍复用现有资产登记 / 画板回流链路,不新增独立音频生成系统。
- 2026-07-03 调整:主窗口新增常用生成产物读取入口,只把入口 HTML、设计、数值、美术清单、音频清单和发布说明对应的 `/read` 草稿填入聊天输入框;聊天命令 `/artifacts` 只列出同一组固定读取命令并提供首个读取草稿,`/run-artifacts` 只列出最近 trace 里的产物读取命令并提供首个 `/read` 草稿,`/logs` 只列出固定日志读取命令;实际读取仍走聊天侧 `file.read` 权限流,不直接读本地文件。
- 2026-07-03 调整:普通用户通过聊天输入 `/next` 触发下一步建议入口,只基于主窗口当前已加载的 manifest、最近 run trace 和最近命令摘要生成聊天建议,列出 `/tasks``/trace``/run``/open-preview``/assets``/audio``/publish``/artifacts``/run-artifacts``/passes``/run-files``/internals``/logs``/agent-resume ` 等安全命令草稿方向,并提供一个首选草稿;该命令不得直接执行 Tauri 读写、启动或打开预览、读取本地文件,也不得绕过原有命令确认和 `file.read` 权限流。
- 2026-07-03 调整:普通用户通过聊天输入 `/next` 触发下一步建议入口,只基于主窗口当前已加载的 manifest、最近 run trace 和最近命令摘要生成聊天建议,列出 `/tasks``/trace``/review``/run``/open-preview``/assets``/audio``/publish``/artifacts``/run-artifacts``/passes``/run-files``/internals``/logs``/agent-resume ` 等安全命令草稿方向,并提供一个首选草稿;该命令不得直接执行 Tauri 读写、启动或打开预览、读取本地文件,也不得绕过原有命令确认和 `file.read` 权限流。
- 2026-07-03 调整:普通用户通过聊天输入 `/publish` 生成发布准备清单,只基于主窗口当前已加载的 manifest、最近 run trace、预览状态、资产来源和最近命令摘要列出原型通过、预览、任务、资产、音频、包装说明和试玩包状态,并提供 `/run``/trace``/agent-resume ``/export` 草稿;该入口不得触发 Tauri 读写、不得启动或打开预览、不得读取文件,也不得新增普通用户发布面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/internals` 只列出 `.agent/manifest.json``.agent/run.latest.json``.agent/spec.md``.agent/findings.md``.agent/policy.json``.agent/project.index.json``.agent/agent.db``.agent/conversations/project.jsonl``/read` 草稿,并提供首个读取草稿;该入口不得直接读取内部文件、不得触发 Tauri 读写,也不得新增普通用户内部文件面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/passes` 只从当前已加载的最近 run trace artifacts 中筛选 `.agent/passes/` 轮次产物,列出 `/read` 草稿并提供首个读取草稿;该入口不得直接读取轮次文件、不得触发 Tauri 读写,也不得新增普通用户轮次面板。
File diff suppressed because one or more lines are too long