补充下一轮分工计划聊天入口

新增 /plan 下一轮分工计划摘要

补充 /next 与 /help 的计划入口覆盖

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

同步 AI 游戏创作 App 技术方案和决策记录
This commit is contained in:
AIGameCreator App
2026-07-04 14:36:13 +08:00
parent d6571d3ccd
commit 7fc7f930c6
4 changed files with 248 additions and 1 deletions
+136
View File
@@ -1913,6 +1913,7 @@ const chatCommandHelp = [
'/timeline:查看项目活动时间线',
'/handoff:生成当前项目交接摘要',
'/next:查看下一步建议',
'/plan:查看下一轮分工计划',
'/todo:查看下一轮小步清单',
'/publish:查看发布准备清单',
'/listing:准备作品页文案清单',
@@ -5039,6 +5040,123 @@ function summarizeProjectTodoList(
};
}
function summarizeProjectNextRoundPlan(
nextManifest: GameCreationAppManifest,
trace: GameCreationAgentRunTrace | null,
) {
const manifestTasks = taskRowsFromManifest(nextManifest);
const traceTasks = trace?.taskGraph.tasks ?? [];
const taskSource = traceTasks.length > 0 ? traceTasks : manifestTasks;
const manifestTasksById = new Map(
manifestTasks.map((task) => [task.id, task]),
);
const taskSourceById = new Map(taskSource.map((task) => [task.id, task]));
const selectedTasks: Array<{
task: GameCreationAppTaskState;
marker: string;
}> = [];
const seenTaskIds = new Set<string>();
const addTask = (taskId: string, marker: string) => {
if (seenTaskIds.has(taskId)) {
return;
}
const task = taskSourceById.get(taskId) ?? manifestTasksById.get(taskId);
if (!task) {
return;
}
selectedTasks.push({ task, marker });
seenTaskIds.add(task.id);
};
taskSource
.filter((task) => task.status === 'failed')
.forEach((task) => addTask(task.id, '失败'));
trace?.taskGraph.activeTaskIds.forEach((taskId) =>
addTask(taskId, 'active'),
);
trace?.taskGraph.carriedTaskIds.forEach((taskId) =>
addTask(taskId, 'carry'),
);
trace?.taskGraph.readyTaskIds.forEach((taskId) => addTask(taskId, 'ready'));
if (selectedTasks.length === 0) {
selectGameCreationAppReadyTasks({ tasks: manifestTasks }).forEach((task) =>
addTask(task.id, 'ready'),
);
}
if (selectedTasks.length === 0) {
taskSource
.filter((task) => task.status !== 'completed')
.slice(0, 6)
.forEach((task) => addTask(task.id, taskStatusLabels[task.status]));
}
const groups: GameCreationAppAgentGroup[] = [
'design',
'art',
'code',
'balance',
'audio',
'publishing',
];
const groupLines = groups.flatMap((group) => {
const groupTasks = selectedTasks.filter(({ task }) => task.group === group);
return groupTasks.slice(0, 2).map(({ task, marker }) => {
const acceptance = task.acceptanceCriteria[0] ?? '暂无';
return `- ${taskGroupLabels[group]}${marker} · ${task.role} ${task.title}(${task.id}) · 验收:${acceptance}`;
});
});
const selectedGroups = groups.filter((group) =>
selectedTasks.some(({ task }) => task.group === group),
);
const idleGroups = groups.filter((group) => !selectedGroups.includes(group));
const firstTask = selectedTasks[0]?.task ?? null;
const blockedTrace =
trace?.lifecycleStatus === 'killed' ||
trace?.status === 'failed' ||
trace?.status === 'needs-revision' ||
trace?.stopReason === 'max-passes-exhausted';
const draftCommand = blockedTrace
? '/review'
: firstTask
? `/agent-resume 下一轮计划:${taskGroupLabels[firstTask.group]} / ${firstTask.role} ${firstTask.title}`
: '/next';
const draftCommandLabel = blockedTrace
? '查看评审'
: firstTask
? '继续执行计划'
: '查看下一步';
return {
text: [
'下一轮分工计划:',
`- 项目:${nextManifest.name}`,
trace ? `- Run${trace.runId} · ${formatAgentRunStatus(trace)}` : null,
trace?.nextStep ? `- 编排焦点:${trace.nextStep}` : null,
selectedGroups.length > 0
? `- 协作顺序:${selectedGroups
.map((group) => taskGroupLabels[group])
.join(' -> ')}`
: '- 协作顺序:暂无',
groupLines.length > 0
? `- 分工:\n${groupLines.join('\n')}`
: '- 分工:暂无待接手任务',
idleGroups.length > 0
? `- 空档组:${idleGroups
.map((group) => taskGroupLabels[group])
.join('、')}`
: '- 空档组:暂无',
'- 边界:只整理下一轮分工;不读取任务文件;不启动 run;不修改项目',
`- 建议:${draftCommand}`,
]
.filter(Boolean)
.join('\n'),
draftCommand,
draftCommandLabel,
};
}
function summarizeProjectSpecSheet(
nextManifest: GameCreationAppManifest,
trace: GameCreationAgentRunTrace | null,
@@ -6438,6 +6556,7 @@ function summarizeNextProjectActions(
}
addSuggestion('查看质量检查清单', '/qa');
addSuggestion('查看最近生成变更', '/changes');
addSuggestion('查看下一轮分工计划', '/plan');
addSuggestion('查看下一轮小步清单', '/todo');
if (nextManifest.assets.length > 0) {
@@ -10954,6 +11073,23 @@ export function App() {
return;
}
if (prompt === '/plan') {
if (!requireChatProjectForUserAction()) {
return;
}
const summary = summarizeProjectNextRoundPlan(manifest, agentRunTrace);
setMessages((current) => [
...current,
{
role: 'assistant',
text: summary.text,
draftCommand: summary.draftCommand,
draftCommandLabel: summary.draftCommandLabel,
},
]);
return;
}
if (prompt === '/todo') {
if (!requireChatProjectForUserAction()) {
return;
@@ -5071,6 +5071,110 @@ describe('AI 游戏创作 App 界面边界', () => {
),
).toHaveLength(commandCountsBeforeTodo.exportList);
const commandCountsBeforePlan = {
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('/plan');
const planMessages = await screen.findAllByText(/下一轮分工计划:/);
const planMessage = planMessages[planMessages.length - 1];
expect(planMessage.textContent).toContain('项目:未命名游戏原型');
expect(planMessage.textContent).toContain(
'Runrun-main-shortcut-trace · passed / done · 1/3 轮 · evaluator-passed',
);
expect(planMessage.textContent).toContain('编排焦点:preview');
expect(planMessage.textContent).toContain('协作顺序:美术组');
expect(planMessage.textContent).toContain(
'美术组:ready · Asset 规划美术资产(art-asset-plan) · 验收:角色、场景、UI 和动画需求已映射到画板或本地资产',
);
expect(planMessage.textContent).toContain(
'空档组:策划组、程序组、数值组、音乐组、运营组',
);
expect(planMessage.textContent).toContain(
'边界:只整理下一轮分工;不读取任务文件;不启动 run;不修改项目',
);
expect(planMessage.textContent).toContain(
'建议:/agent-resume 下一轮计划:美术组 / Asset 规划美术资产',
);
const planMessageList = document.querySelector('.message-list');
expect(planMessageList).not.toBeNull();
const planDraftButtons = within(
planMessageList as HTMLElement,
).getAllByRole('button', { name: '继续执行计划' });
fireEvent.click(planDraftButtons[planDraftButtons.length - 1]);
expect(screen.getByLabelText('创作想法')).toHaveProperty(
'value',
'/agent-resume 下一轮计划:美术组 / Asset 规划美术资产',
);
expect(
invoke.mock.calls.filter(
([command]) => command === 'get_local_game_manifest',
),
).toHaveLength(commandCountsBeforePlan.manifestRead);
expect(
invoke.mock.calls.filter(
([command]) => command === 'read_local_project_file',
),
).toHaveLength(commandCountsBeforePlan.fileRead);
expect(
invoke.mock.calls.filter(
([command]) => command === 'list_local_project_files',
),
).toHaveLength(commandCountsBeforePlan.fileList);
expect(
invoke.mock.calls.filter(
([command]) => command === 'run_limited_local_command',
),
).toHaveLength(commandCountsBeforePlan.runLocal);
expect(
invoke.mock.calls.filter(
([command]) => command === 'start_local_game_preview',
),
).toHaveLength(commandCountsBeforePlan.startPreview);
expect(
invoke.mock.calls.filter(
([command]) => command === 'open_local_game_preview',
),
).toHaveLength(commandCountsBeforePlan.openPreview);
expect(
invoke.mock.calls.filter(
([command]) => command === 'export_local_project_package',
),
).toHaveLength(commandCountsBeforePlan.exportPackage);
expect(
invoke.mock.calls.filter(
([command]) => command === 'list_local_project_export_packages',
),
).toHaveLength(commandCountsBeforePlan.exportList);
expect(
invoke.mock.calls.filter(([command]) => command === 'control_agent_run'),
).toHaveLength(commandCountsBeforePlan.controlAgentRun);
const runLocalCountBeforeNext = invoke.mock.calls.filter(
([command]) => command === 'run_limited_local_command',
).length;
@@ -5102,6 +5206,7 @@ describe('AI 游戏创作 App 界面边界', () => {
expect(screen.getByText(/查看专业组进度:\/groups/)).not.toBeNull();
expect(screen.getByText(/查看质量检查清单:\/qa/)).not.toBeNull();
expect(screen.getByText(/查看最近生成变更:\/changes/)).not.toBeNull();
expect(screen.getByText(/查看下一轮分工计划:\/plan/)).not.toBeNull();
expect(screen.getByText(/查看下一轮小步清单:\/todo/)).not.toBeNull();
expect(screen.getByText(/查看当前阻塞项:\/blockers/)).not.toBeNull();
expect(screen.getByText(/查看试玩就绪度:\/ready/)).not.toBeNull();
@@ -13000,6 +13105,7 @@ describe('AI 游戏创作 App 界面边界', () => {
expect(screen.getByText(/\/timeline:查看项目活动时间线/)).not.toBeNull();
expect(screen.getByText(/\/handoff:生成当前项目交接摘要/)).not.toBeNull();
expect(screen.getByText(/\/next:查看下一步建议/)).not.toBeNull();
expect(screen.getByText(/\/plan:查看下一轮分工计划/)).not.toBeNull();
expect(screen.getByText(/\/todo:查看下一轮小步清单/)).not.toBeNull();
expect(screen.getByText(/\/publish:查看发布准备清单/)).not.toBeNull();
expect(screen.getByText(/\/listing:准备作品页文案清单/)).not.toBeNull();
@@ -3893,6 +3893,7 @@
- 2026-07-03 调整:普通用户通过聊天输入 `/qa` 查看质量检查清单,只基于当前 manifest、最近 run trace、最近命令和 preview 状态汇总 Evaluator、任务、静态自检、试玩和产物状态,并提供 `/review``/tasks``/trace``/playtest``/publish``/next` 草稿;该入口不得触发 Tauri 读写、不得读取 trace 或日志文件、不得启动或打开预览,也不得新增普通用户 QA 面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/changes` 查看最近生成变更,只基于当前 manifest、最近 run trace 的 artifacts / steps 和最近命令汇总可验产物、最近输出、当前资产和真实差异查看方向,并提供 `/read <首个可验产物>``/run-artifacts` 草稿;该入口不得触发 Tauri 读写、不得读取产物或日志文件、不得执行 checkpoint diff,也不得新增普通用户变更面板。
- 2026-07-04 调整:普通用户通过聊天输入 `/todo` 查看下一轮小步清单,只基于当前 manifest 和最近 run trace 汇总失败、active、carry、ready 或待处理任务,并提供 `/tasks``/review``/next` 草稿;该入口不得触发 Tauri 读写、不得读取任务文件、不得启动 run、不得修改项目,也不得新增普通用户小步面板。
- 2026-07-04 调整:普通用户通过聊天输入 `/plan` 查看下一轮分工计划,只基于当前 manifest 和最近 run trace 汇总协作顺序、各专业组接手任务、空档组和首个继续执行草稿,并提供 `/agent-resume 下一轮计划:...``/review``/next` 草稿;该入口不得触发 Tauri 读写、不得读取任务文件、不得启动 run、不得修改项目,也不得新增普通用户计划面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/review` 查看 Evaluator 评审状态,只基于主窗口当前已加载的最近 run trace 派生通过 / 需返工状态、返工焦点、返工路线和最近评审步骤,并提供 `/read .agent/findings.md``/agent-resume ` 草稿;该入口不得直接读取评审文件、不得触发 Tauri 读写,也不得新增普通用户评审面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/context` 查看生成上下文来源,只基于当前 manifest 和最近 run trace 列出项目对话、短期记忆、长期记忆、项目黑板、Agent 对话、Agent 私有记忆、manifest、最近 trace 和最近 LLM 输入路径,并提供 `/read``/memory blackboard` 草稿;该入口不得触发 Tauri 读写、不得读取上下文文件,也不得新增普通用户上下文面板。
- 2026-07-03 调整:普通用户通过聊天输入 `/timeline` 查看项目活动时间线,只基于当前 manifest.commandRuns 和最近 run trace 汇总最近命令、日志读取草稿和最近 Agent 步骤,并提供 `/read``/trace``/history` 草稿;该入口不得触发 Tauri 读写、不得读取日志或 trace 文件,也不得新增普通用户时间线面板。
@@ -3925,7 +3926,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``/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``/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``/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