补充试玩状态聊天入口

新增 /playtest 试玩摘要和下一步草稿

补充 /next 与 /help 的试玩入口覆盖

同步技术方案和项目决策记录
This commit is contained in:
AIGameCreator App
2026-07-03 16:34:45 +08:00
parent 7250ecf0cc
commit bc057b7ef7
4 changed files with 190 additions and 3 deletions
+123
View File
@@ -1873,6 +1873,7 @@ const chatCommandHelp = [
'/handoff:生成当前项目交接摘要',
'/next:查看下一步建议',
'/publish:查看发布准备清单',
'/playtest:查看试玩状态与下一步',
'/open-project:在系统文件管理器中显示项目目录',
'/switch-project:回到项目启动器切换工作区',
'/index:刷新本地项目索引',
@@ -2415,6 +2416,110 @@ function summarizeProjectPublishReadiness(
};
}
function isPlaytestTraceStep(step: GameCreationAgentRunStep) {
return (
step.agent.toLowerCase().includes('playtest') ||
step.phase === 'playtest' ||
step.taskId === 'preview-playtest' ||
step.toolCalls.some(
(toolCall) =>
toolCall.toolId === 'game.static_smoke' ||
toolCall.toolId.startsWith('preview.'),
)
);
}
function summarizeProjectPlaytestState(
nextManifest: GameCreationAppManifest,
trace: GameCreationAgentRunTrace | null,
) {
const tasks = taskRowsFromManifest(nextManifest);
const traceTasks = trace?.taskGraph.tasks ?? [];
const playtestTask =
traceTasks.find((task) => task.id === 'preview-playtest') ??
tasks.find((task) => task.id === 'preview-playtest') ??
null;
const readyTaskIds = new Set(
trace
? trace.taskGraph.readyTaskIds
: selectGameCreationAppReadyTasks({ tasks }).map((task) => task.id),
);
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 blockedTrace =
trace?.lifecycleStatus === 'killed' ||
trace?.status === 'failed' ||
trace?.status === 'needs-revision' ||
trace?.stopReason === 'max-passes-exhausted';
const latestPlaytestStep =
trace?.steps.filter(isPlaytestTraceStep).slice(-1)[0] ?? null;
let draftCommand = '/next';
let draftCommandLabel = '查看下一步';
if (blockedTrace) {
draftCommand = '/review';
draftCommandLabel = '查看评审';
} else if (trace && !tracePassed) {
draftCommand = '/trace';
draftCommandLabel = '查看 trace';
} else if (previewRunning) {
draftCommand = '/open-preview';
draftCommandLabel = '打开预览';
} else if (tracePassed) {
draftCommand = '/run';
draftCommandLabel = '启动试玩';
}
const taskMarkers: string[] = [];
if (playtestTask) {
taskMarkers.push(taskStatusLabels[playtestTask.status]);
if (readyTaskIds.has(playtestTask.id)) {
taskMarkers.push('ready');
}
if (trace?.taskGraph.activeTaskIds.includes(playtestTask.id)) {
taskMarkers.push('active');
}
if (trace?.taskGraph.carriedTaskIds.includes(playtestTask.id)) {
taskMarkers.push('carry');
}
}
return {
text: [
'试玩状态:',
`- 原型:${
tracePassed
? `最近 run 已通过 ${trace?.runId ?? ''}`.trim()
: trace
? `最近 run 未通过 ${trace.status} / ${trace.stopReason}`
: '暂无最近 run'
}`,
`- 预览:${previewSummary}${
previewRunning ? ' · 建议 /open-preview' : ' · 建议 /run'
}`,
`- Playtest 任务:${
playtestTask
? `${taskGroupLabels[playtestTask.group]} / ${playtestTask.role} ${playtestTask.title} · ${taskMarkers.join(' / ')}`
: '暂无 preview-playtest 任务'
}`,
`- 最近试玩步骤:${
latestPlaytestStep
? `${latestPlaytestStep.agent} #${latestPlaytestStep.pass} · ${latestPlaytestStep.status} · ${latestPlaytestStep.summary}`
: '暂无'
}`,
'- 试玩日志:/read .agent/logs/preview.log',
].join('\n'),
draftCommand,
draftCommandLabel,
};
}
function summarizeNextProjectActions(
nextManifest: GameCreationAppManifest,
trace: GameCreationAgentRunTrace | null,
@@ -2481,6 +2586,7 @@ function summarizeNextProjectActions(
if (trace) {
addSuggestion('查看发布准备清单', '/publish');
addSuggestion('查看试玩状态', '/playtest');
addSuggestion('查看评审和返工焦点', '/review');
addSuggestion('查看最近 trace 摘要', '/trace');
addSuggestion('列出最近 Run 产物', '/run-artifacts');
@@ -6063,6 +6169,23 @@ export function App() {
return;
}
if (prompt === '/playtest') {
if (!requireChatProjectForUserAction()) {
return;
}
const summary = summarizeProjectPlaytestState(manifest, agentRunTrace);
setMessages((current) => [
...current,
{
role: 'assistant',
text: summary.text,
draftCommand: summary.draftCommand,
draftCommandLabel: summary.draftCommandLabel,
},
]);
return;
}
if (prompt === '/index') {
void queueOrExecuteProjectIndex();
return;
@@ -2421,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(/查看试玩状态:\/playtest/)).not.toBeNull();
expect(screen.getByText(/查看评审和返工焦点:\/review/)).not.toBeNull();
expect(
screen.getByText(/列出内部真相源读取命令:\/internals/),
@@ -2493,6 +2494,65 @@ describe('AI 游戏创作 App 界面边界', () => {
),
).toHaveLength(startPreviewCountBeforePublish);
const fileReadCountBeforePlaytest = invoke.mock.calls.filter(
([command]) => command === 'read_local_project_file',
).length;
const manifestReadCountBeforePlaytest = invoke.mock.calls.filter(
([command]) => command === 'get_local_game_manifest',
).length;
const runLocalCountBeforePlaytest = invoke.mock.calls.filter(
([command]) => command === 'run_limited_local_command',
).length;
const startPreviewCountBeforePlaytest = invoke.mock.calls.filter(
([command]) => command === 'start_local_game_preview',
).length;
const openPreviewCountBeforePlaytest = invoke.mock.calls.filter(
([command]) => command === 'open_local_game_preview',
).length;
submitChat('/playtest');
const playtestMessages = await screen.findAllByText(/试玩状态:/);
const playtestMessage = playtestMessages[playtestMessages.length - 1];
expect(playtestMessage.textContent).toContain(
'原型:最近 run 已通过 run-main-shortcut-trace',
);
expect(playtestMessage.textContent).toContain('预览:未启动 · 建议 /run');
expect(playtestMessage.textContent).toContain(
'Playtest 任务:程序组 / Playtest 预览并试玩验收 · 待处理',
);
expect(playtestMessage.textContent).toContain(
'试玩日志:/read .agent/logs/preview.log',
);
const playtestDraftButtons = screen.getAllByRole('button', {
name: '启动试玩',
});
fireEvent.click(playtestDraftButtons[playtestDraftButtons.length - 1]);
expect(screen.getByLabelText('创作想法')).toHaveProperty('value', '/run');
expect(
invoke.mock.calls.filter(
([command]) => command === 'read_local_project_file',
),
).toHaveLength(fileReadCountBeforePlaytest);
expect(
invoke.mock.calls.filter(
([command]) => command === 'get_local_game_manifest',
),
).toHaveLength(manifestReadCountBeforePlaytest);
expect(
invoke.mock.calls.filter(
([command]) => command === 'run_limited_local_command',
),
).toHaveLength(runLocalCountBeforePlaytest);
expect(
invoke.mock.calls.filter(
([command]) => command === 'start_local_game_preview',
),
).toHaveLength(startPreviewCountBeforePlaytest);
expect(
invoke.mock.calls.filter(
([command]) => command === 'open_local_game_preview',
),
).toHaveLength(openPreviewCountBeforePlaytest);
fireEvent.click(screen.getByRole('button', { name: '权限' }));
expect(
await screen.findByText(/策略:\.agent\/policy\.json/),
@@ -8226,6 +8286,7 @@ describe('AI 游戏创作 App 界面边界', () => {
expect(screen.getByText(/\/handoff:生成当前项目交接摘要/)).not.toBeNull();
expect(screen.getByText(/\/next:查看下一步建议/)).not.toBeNull();
expect(screen.getByText(/\/publish:查看发布准备清单/)).not.toBeNull();
expect(screen.getByText(/\/playtest:查看试玩状态与下一步/)).not.toBeNull();
expect(
screen.getByText(/\/run-files:列出 Agent 运行辅助文件读取命令/),
).not.toBeNull();
@@ -3868,6 +3868,7 @@
- 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 调整:普通用户通过聊天输入 `/playtest` 查看试玩状态,只基于主窗口当前已加载的 manifest、最近 run trace 和 preview 状态派生原型是否通过、预览是否运行、Playtest 任务状态、最近试玩步骤和预览日志读取命令,并提供 `/run`、`/open-preview`、`/trace` 或 `/review` 草稿;该入口不得触发 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 读写,也不得新增普通用户面板。
@@ -3876,7 +3877,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`、`/review`、`/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`、`/playtest`、`/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