补充项目进度聊天入口

新增 /progress 项目进度摘要

补充 /next 与 /help 的进度入口覆盖

验证 /progress 不触发文件读取、运行、预览、导出或写入

同步 AI 游戏创作 App 技术方案和决策记录
This commit is contained in:
AIGameCreator App
2026-07-04 15:01:38 +08:00
parent 5649316217
commit 3340b307d6
4 changed files with 227 additions and 2 deletions
+119
View File
@@ -1870,6 +1870,7 @@ const chatCommandHelp = [
'/status:查看项目状态',
'/brief:生成当前项目简报',
'/goal:查看创作目标',
'/progress:查看项目进度',
'/spec:查看创作规格包',
'/mvp:查看本轮最小可玩范围',
'/pitch:查看试玩定位与卖点',
@@ -2152,6 +2153,106 @@ function summarizeProjectGoal(
};
}
function summarizeProjectProgress(
nextManifest: GameCreationAppManifest,
trace: GameCreationAgentRunTrace | null,
) {
const manifestTasks = taskRowsFromManifest(nextManifest);
const traceTasks = trace?.taskGraph.tasks ?? [];
const traceTasksById = new Map(traceTasks.map((task) => [task.id, task]));
const tasks = manifestTasks.map(
(task) => traceTasksById.get(task.id) ?? task,
);
const taskIds = new Set(tasks.map((task) => task.id));
for (const task of traceTasks) {
if (!taskIds.has(task.id)) {
tasks.push(task);
taskIds.add(task.id);
}
}
const completedCount = tasks.filter(
(task) => task.status === 'completed',
).length;
const failedCount = tasks.filter((task) => task.status === 'failed').length;
const readyCount =
trace?.taskGraph.readyTaskIds.filter((taskId) => taskIds.has(taskId))
.length ?? selectGameCreationAppReadyTasks({ tasks }).length;
const progressPercent =
tasks.length > 0 ? Math.round((completedCount / tasks.length) * 100) : 0;
const preview = nextManifest.preview;
const previewRunning = preview?.status === 'running' && preview.url;
const previewSummary = previewRunning
? `运行中 ${preview.url}`
: preview
? previewStatusLabels[preview.status]
: '未启动';
const commandRuns = nextManifest.commandRuns ?? [];
const staticSmokePassed = commandRuns.some(
(commandRun) =>
commandRun.commandId === 'game.static_smoke' &&
commandRun.status === 'completed',
);
const exported = commandRuns.some(
(commandRun) =>
commandRun.commandId === 'project.export_package' &&
commandRun.status === 'completed',
);
const visualAssetCount =
nextManifest.assets.filter(isProjectVisualAsset).length;
const audioAssetCount = nextManifest.assets.filter(isProjectAudioAsset).length;
const tracePassed = isAgentRunTracePassed(trace);
const blockedTrace =
trace?.lifecycleStatus === 'killed' ||
trace?.status === 'failed' ||
trace?.status === 'needs-revision' ||
trace?.stopReason === 'max-passes-exhausted';
let phase = '准备生成';
let draftCommand = '/guide';
let draftCommandLabel = '查看导引';
if (blockedTrace) {
phase = '需修复';
draftCommand = '/review';
draftCommandLabel = '查看评审';
} else if (exported) {
phase = '已导出';
draftCommand = '/share';
draftCommandLabel = '准备交付';
} else if (previewRunning) {
phase = '试玩中';
draftCommand = '/test-plan';
draftCommandLabel = '准备测试';
} else if (tracePassed) {
phase = '已生成';
draftCommand = '/run';
draftCommandLabel = '启动预览';
} else if (trace) {
phase = '生成中/待验收';
draftCommand = readyCount > 0 ? '/todo' : '/trace';
draftCommandLabel = readyCount > 0 ? '查看小步' : '查看 trace';
}
return {
text: [
'项目进度:',
`- 项目:${nextManifest.name}`,
`- 当前阶段:${phase}`,
`- 任务完成度:${completedCount}/${tasks.length} · ${progressPercent}% · ready ${readyCount} · 失败 ${failedCount}`,
trace
? `- 最近 Run${trace.runId} · ${formatAgentRunStatus(trace)}`
: '- 最近 Run:暂无',
`- 预览:${previewSummary}`,
`- 素材:共 ${nextManifest.assets.length} 个 · 美术 ${visualAssetCount} · 音频 ${audioAssetCount}`,
`- 交付:自检 ${staticSmokePassed ? '已通过' : '未通过'} · 试玩包 ${exported ? '已导出' : '未导出'}`,
'- 边界:只整理项目进度;不读取文件;不启动 run;不启动预览;不导出试玩包;不写项目',
`- 建议:${draftCommand}`,
].join('\n'),
draftCommand,
draftCommandLabel,
};
}
function summarizeProjectMvpScope(
nextManifest: GameCreationAppManifest,
trace: GameCreationAgentRunTrace | null,
@@ -6510,6 +6611,7 @@ function summarizeNextProjectActions(
}
addSuggestion('查看创作目标', '/goal');
addSuggestion('查看普通用户操作导引', '/guide');
addSuggestion('查看项目进度', '/progress');
addSuggestion('查看创作规格包', '/spec');
addSuggestion('查看本轮 MVP 范围', '/mvp');
addSuggestion('查看试玩定位与卖点', '/pitch');
@@ -10372,6 +10474,23 @@ export function App() {
return;
}
if (prompt === '/progress') {
if (!requireChatProjectForUserAction()) {
return;
}
const summary = summarizeProjectProgress(manifest, agentRunTrace);
setMessages((current) => [
...current,
{
role: 'assistant',
text: summary.text,
draftCommand: summary.draftCommand,
draftCommandLabel: summary.draftCommandLabel,
},
]);
return;
}
if (prompt === '/spec') {
if (!requireChatProjectForUserAction()) {
return;
@@ -5269,6 +5269,106 @@ describe('AI 游戏创作 App 界面边界', () => {
invoke.mock.calls.filter(([command]) => command === 'control_agent_run'),
).toHaveLength(commandCountsBeforeGuide.controlAgentRun);
const commandCountsBeforeProgress = {
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('/progress');
const progressMessages = await screen.findAllByText(/项目进度:/);
const progressMessage = progressMessages[progressMessages.length - 1];
expect(progressMessage.textContent).toContain('项目:未命名游戏原型');
expect(progressMessage.textContent).toContain('当前阶段:已生成');
expect(progressMessage.textContent).toMatch(
/任务完成度:0\/\d+ · 0% · ready 1 · 失败 0/,
);
expect(progressMessage.textContent).toContain(
'最近 Runrun-main-shortcut-trace · passed / done · 1/3 轮 · evaluator-passed',
);
expect(progressMessage.textContent).toContain('预览:未启动');
expect(progressMessage.textContent).toContain('素材:共 2 个 · 美术 1 · 音频 0');
expect(progressMessage.textContent).toContain(
'交付:自检 已通过 · 试玩包 未导出',
);
expect(progressMessage.textContent).toContain(
'边界:只整理项目进度;不读取文件;不启动 run;不启动预览;不导出试玩包;不写项目',
);
expect(progressMessage.textContent).toContain('建议:/run');
const progressMessageList = document.querySelector('.message-list');
expect(progressMessageList).not.toBeNull();
const progressDraftButtons = within(
progressMessageList as HTMLElement,
).getAllByRole('button', { name: '启动预览' });
fireEvent.click(progressDraftButtons[progressDraftButtons.length - 1]);
expect(screen.getByLabelText('创作想法')).toHaveProperty('value', '/run');
expect(
invoke.mock.calls.filter(
([command]) => command === 'get_local_game_manifest',
),
).toHaveLength(commandCountsBeforeProgress.manifestRead);
expect(
invoke.mock.calls.filter(
([command]) => command === 'read_local_project_file',
),
).toHaveLength(commandCountsBeforeProgress.fileRead);
expect(
invoke.mock.calls.filter(
([command]) => command === 'list_local_project_files',
),
).toHaveLength(commandCountsBeforeProgress.fileList);
expect(
invoke.mock.calls.filter(
([command]) => command === 'run_limited_local_command',
),
).toHaveLength(commandCountsBeforeProgress.runLocal);
expect(
invoke.mock.calls.filter(
([command]) => command === 'start_local_game_preview',
),
).toHaveLength(commandCountsBeforeProgress.startPreview);
expect(
invoke.mock.calls.filter(
([command]) => command === 'open_local_game_preview',
),
).toHaveLength(commandCountsBeforeProgress.openPreview);
expect(
invoke.mock.calls.filter(
([command]) => command === 'export_local_project_package',
),
).toHaveLength(commandCountsBeforeProgress.exportPackage);
expect(
invoke.mock.calls.filter(
([command]) => command === 'list_local_project_export_packages',
),
).toHaveLength(commandCountsBeforeProgress.exportList);
expect(
invoke.mock.calls.filter(([command]) => command === 'control_agent_run'),
).toHaveLength(commandCountsBeforeProgress.controlAgentRun);
const runLocalCountBeforeNext = invoke.mock.calls.filter(
([command]) => command === 'run_limited_local_command',
).length;
@@ -5277,6 +5377,7 @@ describe('AI 游戏创作 App 界面边界', () => {
expect(screen.getByText(/运行自检并启动本地预览:\/run/)).not.toBeNull();
expect(screen.getByText(/查看创作目标:\/goal/)).not.toBeNull();
expect(screen.getByText(/查看普通用户操作导引:\/guide/)).not.toBeNull();
expect(screen.getByText(/查看项目进度:\/progress/)).not.toBeNull();
expect(screen.getByText(/查看创作规格包:\/spec/)).not.toBeNull();
expect(screen.getByText(/查看本轮 MVP 范围:\/mvp/)).not.toBeNull();
expect(screen.getByText(/查看试玩定位与卖点:\/pitch/)).not.toBeNull();
@@ -13144,6 +13245,7 @@ describe('AI 游戏创作 App 界面边界', () => {
expect(
screen.getByText(/\/guide:查看普通用户操作导引/),
).not.toBeNull();
expect(screen.getByText(/\/progress:查看项目进度/)).not.toBeNull();
expect(screen.getByText(/\/spec:查看创作规格包/)).not.toBeNull();
expect(screen.getByText(/\/mvp:查看本轮最小可玩范围/)).not.toBeNull();
expect(screen.getByText(/\/pitch:查看试玩定位与卖点/)).not.toBeNull();
@@ -3868,6 +3868,7 @@
- 2026-07-03 调整:普通用户通过聊天输入 `/brief` 触发项目简报入口,只基于主窗口当前已加载的 manifest、最近 run trace、预览状态、资产数量和最近命令生成聊天内简报,并提供 `/next` 作为后续草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动或打开预览,也不得新增普通用户面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/goal` 查看创作目标,只基于当前 manifest.goal、最近 run goal 和 taskGraph.goal 汇总项目目标来源,并提供 `/agent-resume 细化目标:``/next` 草稿;该入口不得触发 Tauri 读写、不得读取 spec、上下文或 trace 文件,也不得新增普通用户目标面板。
- 2026-07-04 调整:普通用户通过聊天输入 `/guide` 查看操作导引,只基于当前 manifest、最近 run trace、preview 和已加载命令状态判断未开始、需修复、可预览、可导出或已导出阶段,给出最多 3 个推荐命令和首选草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动 run、不得启动预览、不得写项目,也不得新增普通用户导引面板。`/guide` 只回答“下一步怎么操作”,不承接 `/brief` 的项目快照、`/mvp` 的最小范围或 `/plan` 的分工计划。
- 2026-07-04 调整:普通用户通过聊天输入 `/progress` 查看项目进度,只基于当前 manifest、最近 run trace、preview、任务、素材和已加载命令状态汇总项目阶段、任务完成度、最近 run、预览、素材和交付进度,并提供 `/run``/review``/share``/test-plan``/todo``/trace``/guide` 草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动 run、不得启动预览、不得导出试玩包、不得写项目,也不得新增普通用户进度面板。`/progress` 只回答“当前走到哪了”,不承接 `/status` 的项目状态详情、`/ready` 的试玩门槛判断、`/groups` 的逐组进度或 `/next` 的长命令目录。
- 2026-07-04 调整:普通用户通过聊天输入 `/spec` 查看创作规格包,只基于当前 manifest、最近 run trace、任务声明产物和 trace 输入 / 输出路径汇总 Planner 规格、玩法设计、数值表、美术清单、音频清单和发布说明状态,并提供 `/read .agent/spec.md``/next` 草稿;该入口不得触发 Tauri 读写、不得读取规格文件、不得启动预览、不得写项目,也不得新增普通用户规格面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/mvp` 查看本轮最小可玩范围,只基于当前 manifest、最近 run trace、preview、任务、资产和最近命令汇总 MVP 内、当前状态、试玩包状态和暂不做事项,并提供 `/review``/criteria``/trace``/run``/export``/exports``/next` 草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动或打开预览、不得导出试玩包,也不得新增普通用户 MVP 面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/pitch` 查看试玩定位与卖点,只基于当前 manifest、最近 run trace 和 preview 状态汇总试玩定位、一句话、核心乐趣、当前可演示状态、测试者讲解口径和暂不承诺事项,并提供 `/mvp``/review``/trace``/open-preview``/run` 草稿;该入口不得触发 Tauri 读写、不得读取文件、不得启动或打开预览、不得直接继续 run,也不得新增普通用户定位面板。该入口服务试玩讲解,不承接 `/listing` 的作品页包装。
@@ -3927,7 +3928,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``/guide``/spec``/mvp``/pitch``/demo``/rules``/tutorial``/mobile``/compatibility``/accessibility``/localization``/performance``/polish``/blockers``/ready``/evidence``/deps``/revise``/privacy``/audience``/invite``/bug-report``/survey``/cover``/screenshots``/trailer``/faq``/post``/store``/media-kit``/release-notes``/known-issues``/tasks``/criteria``/groups``/balance``/budget``/qa``/changes``/plan``/todo``/trace``/review``/context``/timeline``/playtest``/test-plan``/feedback``/retention``/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``/guide``/progress``/spec``/mvp``/pitch``/demo``/rules``/tutorial``/mobile``/compatibility``/accessibility``/localization``/performance``/polish``/blockers``/ready``/evidence``/deps``/revise``/privacy``/audience``/invite``/bug-report``/survey``/cover``/screenshots``/trailer``/faq``/post``/store``/media-kit``/release-notes``/known-issues``/tasks``/criteria``/groups``/balance``/budget``/qa``/changes``/plan``/todo``/trace``/review``/context``/timeline``/playtest``/test-plan``/feedback``/retention``/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