补充性能加载聊天入口
新增 /performance 性能与加载检查摘要 补充 /next 与 /help 的性能入口覆盖 同步 AI 游戏创作 App 技术方案和决策记录
This commit is contained in:
@@ -1875,6 +1875,7 @@ const chatCommandHelp = [
|
||||
'/tutorial:查看新手引导检查',
|
||||
'/mobile:查看移动试玩检查',
|
||||
'/accessibility:查看可读性与无障碍检查',
|
||||
'/performance:查看性能与加载检查',
|
||||
'/risks:查看当前项目风险',
|
||||
'/criteria:查看当前任务验收标准',
|
||||
'/groups:查看专业组进度',
|
||||
@@ -2668,6 +2669,125 @@ function summarizeProjectAccessibilityGuide(
|
||||
};
|
||||
}
|
||||
|
||||
function summarizeProjectPerformanceCheck(
|
||||
nextManifest: GameCreationAppManifest,
|
||||
trace: GameCreationAgentRunTrace | null,
|
||||
) {
|
||||
const preview = nextManifest.preview;
|
||||
const previewRunning = preview?.status === 'running' && preview.url;
|
||||
const previewSummary = previewRunning
|
||||
? `运行中 ${preview.url}`
|
||||
: preview
|
||||
? previewStatusLabels[preview.status]
|
||||
: '未启动';
|
||||
const tracePassed = isAgentRunTracePassed(trace);
|
||||
const goal =
|
||||
nextManifest.goal?.trim() ||
|
||||
trace?.goal?.trim() ||
|
||||
trace?.taskGraph.goal?.trim() ||
|
||||
'暂无';
|
||||
const artifacts = trace ? readableArtifactsFromAgentRunTrace(trace) : [];
|
||||
const totalArtifactBytes = artifacts.reduce(
|
||||
(total, artifact) => total + artifact.sizeBytes,
|
||||
0,
|
||||
);
|
||||
const visibleArtifacts = artifacts.slice(0, 6);
|
||||
const artifactLines = visibleArtifacts.map(
|
||||
(artifact) =>
|
||||
`- ${artifact.path} · ${artifact.sizeBytes}B · ${artifact.checksum}`,
|
||||
);
|
||||
if (artifacts.length > visibleArtifacts.length) {
|
||||
artifactLines.push(
|
||||
`- 还有 ${artifacts.length - visibleArtifacts.length} 个产物`,
|
||||
);
|
||||
}
|
||||
const manifestTasks = taskRowsFromManifest(nextManifest);
|
||||
const traceTasks = trace?.taskGraph.tasks ?? [];
|
||||
const tasks = manifestTasks.map(
|
||||
(task) => traceTasks.find((traceTask) => traceTask.id === task.id) ?? task,
|
||||
);
|
||||
const relevantTasks = [
|
||||
'code-prototype',
|
||||
'preview-readiness',
|
||||
'preview-playtest',
|
||||
]
|
||||
.map((taskId) => tasks.find((task) => task.id === taskId))
|
||||
.filter((task): task is NonNullable<typeof task> => Boolean(task));
|
||||
const taskLines = relevantTasks.map(
|
||||
(task) =>
|
||||
`- ${task.id}:${taskGroupLabels[task.group]} / ${task.role} ${task.title} · ${taskStatusLabels[task.status]}`,
|
||||
);
|
||||
const hasGameArtifact =
|
||||
trace?.artifacts.some(
|
||||
(artifact) =>
|
||||
artifact.path === 'game/index.html' || artifact.path === 'game/',
|
||||
) ?? false;
|
||||
const latestPerformanceStep =
|
||||
trace?.steps
|
||||
.filter(
|
||||
(step) =>
|
||||
step.taskId === 'code-prototype' ||
|
||||
step.taskId === 'preview-readiness' ||
|
||||
step.taskId === 'preview-playtest' ||
|
||||
step.group === 'code' ||
|
||||
step.phase === 'generate' ||
|
||||
step.phase === 'playtest' ||
|
||||
step.toolCalls.some(
|
||||
(toolCall) =>
|
||||
toolCall.toolId === 'game.static_smoke' ||
|
||||
toolCall.toolId.startsWith('preview.'),
|
||||
),
|
||||
)
|
||||
.slice(-1)[0] ?? null;
|
||||
|
||||
let draftCommand = '/next';
|
||||
let draftCommandLabel = '查看下一步';
|
||||
if (trace && !tracePassed) {
|
||||
draftCommand = '/review';
|
||||
draftCommandLabel = '查看评审';
|
||||
} else if (artifacts.length > 0) {
|
||||
draftCommand = '/run-artifacts';
|
||||
draftCommandLabel = '列出 Run 产物';
|
||||
} else if (previewRunning) {
|
||||
draftCommand = '/open-preview';
|
||||
draftCommandLabel = '打开预览';
|
||||
} else if (tracePassed) {
|
||||
draftCommand = '/run';
|
||||
draftCommandLabel = '启动预览';
|
||||
}
|
||||
|
||||
return {
|
||||
text: [
|
||||
'性能与加载:',
|
||||
`- 项目:${nextManifest.name}`,
|
||||
`- 目标:${goal}`,
|
||||
`- 当前证据:${
|
||||
tracePassed
|
||||
? `最近 run 已通过${trace?.runId ? ` ${trace.runId}` : ''}`
|
||||
: trace
|
||||
? `最近 run 未通过 ${trace.status} / ${trace.stopReason}`
|
||||
: '暂无最近 run'
|
||||
};预览 ${previewSummary};入口 ${hasGameArtifact ? '已生成' : '未见 trace 产物'};产物 ${artifacts.length} 个 / ${totalArtifactBytes}B;资产 ${nextManifest.assets.length} 个`,
|
||||
'- 检查范围:入口 HTML 自包含;首屏不空白;素材体积;主循环稳定;无远程依赖;预览启动',
|
||||
artifactLines.length > 0
|
||||
? `- 关键产物:\n${artifactLines.join('\n')}`
|
||||
: '- 关键产物:暂无',
|
||||
taskLines.length > 0
|
||||
? `- 关联任务:\n${taskLines.join('\n')}`
|
||||
: '- 关联任务:暂无',
|
||||
`- 最近性能相关步骤:${
|
||||
latestPerformanceStep
|
||||
? `${latestPerformanceStep.agent} #${latestPerformanceStep.pass} · ${latestPerformanceStep.status} · ${latestPerformanceStep.summary}`
|
||||
: '暂无'
|
||||
}`,
|
||||
'- 参考:/run-artifacts;/playtest;/qa;/export',
|
||||
`- 建议:${draftCommand}`,
|
||||
].join('\n'),
|
||||
draftCommand,
|
||||
draftCommandLabel,
|
||||
};
|
||||
}
|
||||
|
||||
function summarizeProjectRisks(
|
||||
nextManifest: GameCreationAppManifest,
|
||||
trace: GameCreationAgentRunTrace | null,
|
||||
@@ -3935,6 +4055,7 @@ function summarizeNextProjectActions(
|
||||
addSuggestion('查看新手引导检查', '/tutorial');
|
||||
addSuggestion('查看移动试玩检查', '/mobile');
|
||||
addSuggestion('查看可读性与无障碍检查', '/accessibility');
|
||||
addSuggestion('查看性能与加载检查', '/performance');
|
||||
addSuggestion('查看数值与难度口径', '/balance');
|
||||
|
||||
const readyTasks = selectGameCreationAppReadyTasks({
|
||||
@@ -7744,6 +7865,23 @@ export function App() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (prompt === '/performance') {
|
||||
if (!requireChatProjectForUserAction()) {
|
||||
return;
|
||||
}
|
||||
const summary = summarizeProjectPerformanceCheck(manifest, agentRunTrace);
|
||||
setMessages((current) => [
|
||||
...current,
|
||||
{
|
||||
role: 'assistant',
|
||||
text: summary.text,
|
||||
draftCommand: summary.draftCommand,
|
||||
draftCommandLabel: summary.draftCommandLabel,
|
||||
},
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (prompt === '/risks') {
|
||||
if (!requireChatProjectForUserAction()) {
|
||||
return;
|
||||
|
||||
@@ -2880,6 +2880,127 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
invoke.mock.calls.filter(([command]) => command === 'control_agent_run'),
|
||||
).toHaveLength(commandCountsBeforeAccessibility.controlAgentRun);
|
||||
|
||||
const commandCountsBeforePerformance = {
|
||||
manifestRead: invoke.mock.calls.filter(
|
||||
([command]) => command === 'get_local_game_manifest',
|
||||
).length,
|
||||
fileRead: invoke.mock.calls.filter(
|
||||
([command]) => command === 'read_local_project_file',
|
||||
).length,
|
||||
fileList: invoke.mock.calls.filter(
|
||||
([command]) => command === 'list_local_project_files',
|
||||
).length,
|
||||
runLocal: invoke.mock.calls.filter(
|
||||
([command]) => command === 'run_limited_local_command',
|
||||
).length,
|
||||
startPreview: invoke.mock.calls.filter(
|
||||
([command]) => command === 'start_local_game_preview',
|
||||
).length,
|
||||
openPreview: invoke.mock.calls.filter(
|
||||
([command]) => command === 'open_local_game_preview',
|
||||
).length,
|
||||
exportPackage: invoke.mock.calls.filter(
|
||||
([command]) => command === 'export_local_project_package',
|
||||
).length,
|
||||
exportList: invoke.mock.calls.filter(
|
||||
([command]) => command === 'list_local_project_export_packages',
|
||||
).length,
|
||||
controlAgentRun: invoke.mock.calls.filter(
|
||||
([command]) => command === 'control_agent_run',
|
||||
).length,
|
||||
};
|
||||
submitChat('/performance');
|
||||
const performanceMessages = await screen.findAllByText(/性能与加载:/);
|
||||
const performanceMessage =
|
||||
performanceMessages[performanceMessages.length - 1];
|
||||
expect(performanceMessage.textContent).toContain('项目:未命名游戏原型');
|
||||
expect(performanceMessage.textContent).toContain(
|
||||
'目标:做一个厨房弹幕游戏',
|
||||
);
|
||||
expect(performanceMessage.textContent).toContain(
|
||||
'当前证据:最近 run 已通过 run-main-shortcut-trace;预览 未启动;入口 未见 trace 产物;产物 3 个 / 416B;资产 2 个',
|
||||
);
|
||||
expect(performanceMessage.textContent).toContain(
|
||||
'检查范围:入口 HTML 自包含;首屏不空白;素材体积;主循环稳定;无远程依赖;预览启动',
|
||||
);
|
||||
expect(performanceMessage.textContent).toContain(
|
||||
'exports/README.md · 128B · fnv1a64:exports',
|
||||
);
|
||||
expect(performanceMessage.textContent).toContain(
|
||||
'.agent/passes/pass-1/agenda.md · 96B · fnv1a64:agenda',
|
||||
);
|
||||
expect(performanceMessage.textContent).toContain(
|
||||
'code-prototype:程序组 / Code 生成可运行原型 · 待处理',
|
||||
);
|
||||
expect(performanceMessage.textContent).toContain(
|
||||
'preview-readiness:程序组 / Preview 执行静态自检 · 待处理',
|
||||
);
|
||||
expect(performanceMessage.textContent).toContain(
|
||||
'preview-playtest:程序组 / Playtest 预览并试玩验收 · 待处理',
|
||||
);
|
||||
expect(performanceMessage.textContent).toContain(
|
||||
'最近性能相关步骤:Generator #1 · completed · 生成可运行草案',
|
||||
);
|
||||
expect(performanceMessage.textContent).toContain(
|
||||
'参考:/run-artifacts;/playtest;/qa;/export',
|
||||
);
|
||||
expect(performanceMessage.textContent).toContain('建议:/run-artifacts');
|
||||
const performanceMessageList = document.querySelector('.message-list');
|
||||
expect(performanceMessageList).not.toBeNull();
|
||||
const performanceDraftButtons = within(
|
||||
performanceMessageList as HTMLElement,
|
||||
).getAllByRole('button', { name: '列出 Run 产物' });
|
||||
fireEvent.click(
|
||||
performanceDraftButtons[performanceDraftButtons.length - 1],
|
||||
);
|
||||
expect(screen.getByLabelText('创作想法')).toHaveProperty(
|
||||
'value',
|
||||
'/run-artifacts',
|
||||
);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'get_local_game_manifest',
|
||||
),
|
||||
).toHaveLength(commandCountsBeforePerformance.manifestRead);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'read_local_project_file',
|
||||
),
|
||||
).toHaveLength(commandCountsBeforePerformance.fileRead);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'list_local_project_files',
|
||||
),
|
||||
).toHaveLength(commandCountsBeforePerformance.fileList);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'run_limited_local_command',
|
||||
),
|
||||
).toHaveLength(commandCountsBeforePerformance.runLocal);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'start_local_game_preview',
|
||||
),
|
||||
).toHaveLength(commandCountsBeforePerformance.startPreview);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'open_local_game_preview',
|
||||
),
|
||||
).toHaveLength(commandCountsBeforePerformance.openPreview);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'export_local_project_package',
|
||||
),
|
||||
).toHaveLength(commandCountsBeforePerformance.exportPackage);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'list_local_project_export_packages',
|
||||
),
|
||||
).toHaveLength(commandCountsBeforePerformance.exportList);
|
||||
expect(
|
||||
invoke.mock.calls.filter(([command]) => command === 'control_agent_run'),
|
||||
).toHaveLength(commandCountsBeforePerformance.controlAgentRun);
|
||||
|
||||
const commandCountsBeforeCredits = {
|
||||
manifestRead: invoke.mock.calls.filter(
|
||||
([command]) => command === 'get_local_game_manifest',
|
||||
@@ -3656,6 +3777,9 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
expect(
|
||||
screen.getByText(/查看可读性与无障碍检查:\/accessibility/),
|
||||
).not.toBeNull();
|
||||
expect(
|
||||
screen.getByText(/查看性能与加载检查:\/performance/),
|
||||
).not.toBeNull();
|
||||
expect(screen.getByText(/查看数值与难度口径:\/balance/)).not.toBeNull();
|
||||
expect(screen.getByText(/查看 .* 个 ready 任务:\/tasks/)).not.toBeNull();
|
||||
expect(screen.getByText(/查看当前任务验收标准:\/criteria/)).not.toBeNull();
|
||||
@@ -9855,6 +9979,9 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
expect(
|
||||
screen.getByText(/\/accessibility:查看可读性与无障碍检查/),
|
||||
).not.toBeNull();
|
||||
expect(
|
||||
screen.getByText(/\/performance:查看性能与加载检查/),
|
||||
).not.toBeNull();
|
||||
expect(screen.getByText(/\/risks:查看当前项目风险/)).not.toBeNull();
|
||||
expect(screen.getByText(/\/criteria:查看当前任务验收标准/)).not.toBeNull();
|
||||
expect(screen.getByText(/\/groups:查看专业组进度/)).not.toBeNull();
|
||||
|
||||
@@ -3873,6 +3873,7 @@
|
||||
- 2026-07-03 调整:普通用户通过聊天输入 `/tutorial` 查看新手引导检查,只基于当前 manifest、最近 run trace、preview 和任务状态汇总首屏目标、首局 30 秒引导、原型证据、试玩任务、最近引导证据和补齐项,并提供 `/rules`、`/review`、`/agent-resume 新手引导:...`、`/open-preview` 或 `/run` 草稿;该入口不得触发 Tauri 读写、不得读取设计文件、不得启动或打开预览、不得直接继续 run,也不得新增普通用户引导面板。
|
||||
- 2026-07-03 调整:普通用户通过聊天输入 `/mobile` 查看移动试玩检查,只基于当前 manifest、最近 run trace、preview 和任务状态汇总移动试玩目标、键盘 / 触屏输入口径、原型证据、移动检查项、关联任务和最近移动相关步骤,并提供 `/rules`、`/review`、`/agent-resume 移动试玩:...`、`/open-preview` 或 `/run` 草稿;该入口不得触发 Tauri 读写、不得读取代码文件、不得启动或打开预览、不得直接继续 run,也不得新增普通用户移动适配面板。
|
||||
- 2026-07-04 调整:普通用户通过聊天输入 `/accessibility` 查看可读性与无障碍检查,只基于当前 manifest、最近 run trace、preview 和任务状态汇总文字可读、颜色对比、按钮 / 状态命名、键盘等价、可见焦点、非颜色唯一反馈和静音可玩检查,并提供 `/rules`、`/review`、`/agent-resume 可读性与无障碍:...`、`/open-preview` 或 `/run` 草稿;该入口不得触发 Tauri 读写、不得读取代码或 trace 文件、不得启动或打开预览、不得直接继续 run,也不得新增普通用户无障碍面板。
|
||||
- 2026-07-04 调整:普通用户通过聊天输入 `/performance` 查看性能与加载检查,只基于当前 manifest、最近 run trace、preview、资产数量和 trace artifact 摘要汇总入口自包含、首屏不空白、素材体积、主循环稳定、无远程依赖和预览启动检查,并提供 `/run-artifacts`、`/review`、`/open-preview`、`/run` 或 `/next` 草稿;该入口不得触发 Tauri 读写、不得读取产物或日志文件、不得启动或打开预览、不得直接继续 run,也不得新增普通用户性能面板。
|
||||
- 2026-07-03 调整:普通用户通过聊天输入 `/credits` 查看素材署名与来源,只基于当前 manifest.assets 汇总素材数量、上传 / 生成 / 画板来源分布、来源清单和交付前需要确认的授权 / 模型 / 画板资源口径,并提供 `/assets` 草稿;该入口不得触发 Tauri 读写、不得刷新资产、不得读取素材清单、不得导出试玩包,也不得新增普通用户署名面板。
|
||||
- 2026-07-03 调整:普通用户通过聊天输入 `/risks` 查看当前项目风险,只基于主窗口当前已加载的 manifest、最近 run trace、预览状态、任务状态、资产来源和最近命令派生风险摘要,并提供首个风险处理草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动或打开预览,也不得新增普通用户面板。
|
||||
- 2026-07-03 调整:普通用户通过聊天输入 `/criteria` 查看当前任务验收标准,只基于当前 manifest.tasks 和最近 run trace.taskGraph 汇总 active、carry、ready、失败或待处理任务的验收条件和产物,并提供 `/tasks` 草稿;该入口不得触发 Tauri 读写、不得读取任务文件或 trace 文件,也不得新增普通用户验收面板。
|
||||
@@ -3897,7 +3898,7 @@
|
||||
- 2026-07-03 调整:普通用户通过聊天输入 `/balance` 查看数值与难度口径,只基于当前 manifest.tasks、最近 run trace.taskGraph、trace artifacts 和 steps 汇总数值组任务、验收口径、`game/balance.json` 状态和最近数值步骤,并提供 `/read game/balance.json` 或 `/agent-resume 数值调整:...` 草稿;该入口不得触发 Tauri 读写、不得读取数值表、不得启动预览或继续 run,也不得新增普通用户数值面板。
|
||||
- 2026-07-03 调整:主窗口新增常用生成产物读取入口,只把入口 HTML、设计、数值、美术清单、音频清单和发布说明对应的 `/read` 草稿填入聊天输入框;聊天命令 `/artifacts` 只列出同一组固定读取命令并提供首个读取草稿,`/run-artifacts` 只列出最近 trace 里的产物读取命令并提供首个 `/read` 草稿,`/logs` 只列出固定日志读取命令;实际读取仍走聊天侧 `file.read` 权限流,不直接读本地文件。
|
||||
- 2026-07-03 调整:普通用户通过聊天输入 `/share` 准备试玩交付清单,只基于当前 manifest、授权项目路径、最近 run trace、preview 状态和 manifest.commandRuns 汇总原型通过状态、本地预览、本地试玩包、测试者说明和反馈收集方向,并提供 `/export`、`/exports`、`/trace`、`/review` 或 `/next` 草稿;该入口不得触发 Tauri 读写、不得导出试玩包、不得列出历史包、不得上传云端、不得生成公开分享链接,也不得新增普通用户分享面板。
|
||||
- 2026-07-03 调整,2026-07-04 更新:普通用户通过聊天输入 `/next` 触发下一步建议入口,只基于主窗口当前已加载的 manifest、最近 run trace 和最近命令摘要生成聊天建议,列出 `/goal`、`/mvp`、`/pitch`、`/rules`、`/tutorial`、`/mobile`、`/accessibility`、`/tasks`、`/criteria`、`/groups`、`/balance`、`/budget`、`/qa`、`/changes`、`/trace`、`/review`、`/context`、`/timeline`、`/playtest`、`/feedback`、`/share`、`/listing`、`/run`、`/open-preview`、`/assets`、`/credits`、`/art`、`/audio`、`/publish`、`/artifacts`、`/run-artifacts`、`/passes`、`/run-files`、`/internals`、`/logs`、`/agent-resume ` 等安全命令草稿方向,并提供一个首选草稿;该命令不得直接执行 Tauri 读写、启动或打开预览、读取本地文件,也不得绕过原有命令确认和 `file.read` 权限流。
|
||||
- 2026-07-03 调整,2026-07-04 更新:普通用户通过聊天输入 `/next` 触发下一步建议入口,只基于主窗口当前已加载的 manifest、最近 run trace 和最近命令摘要生成聊天建议,列出 `/goal`、`/mvp`、`/pitch`、`/rules`、`/tutorial`、`/mobile`、`/accessibility`、`/performance`、`/tasks`、`/criteria`、`/groups`、`/balance`、`/budget`、`/qa`、`/changes`、`/trace`、`/review`、`/context`、`/timeline`、`/playtest`、`/feedback`、`/share`、`/listing`、`/run`、`/open-preview`、`/assets`、`/credits`、`/art`、`/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
Reference in New Issue
Block a user