补充项目时间线聊天入口

新增 /timeline 项目活动摘要和日志草稿

补充 /next 与 /help 的时间线入口覆盖

同步技术方案和项目决策记录
This commit is contained in:
AIGameCreator App
2026-07-03 17:05:40 +08:00
parent 25868e099a
commit 3a4504a04f
4 changed files with 149 additions and 4 deletions
+75
View File
@@ -1871,6 +1871,7 @@ const chatCommandHelp = [
'/risks:查看当前项目风险',
'/review:查看 Evaluator 评审和返工焦点',
'/context:查看生成上下文来源',
'/timeline:查看项目活动时间线',
'/handoff:生成当前项目交接摘要',
'/next:查看下一步建议',
'/publish:查看发布准备清单',
@@ -2293,6 +2294,62 @@ function summarizeProjectContextSources(
};
}
function summarizeProjectTimeline(
nextManifest: GameCreationAppManifest,
trace: GameCreationAgentRunTrace | null,
) {
const commandRuns = (nextManifest.commandRuns ?? []).slice(-5);
const commandLines = commandRuns.map((commandRun) => {
const logSuffix = isSafeProjectRelativePath(commandRun.logPath)
? ` · 日志 /read ${commandRun.logPath}`
: '';
return `- 命令 ${commandRun.commandId} · ${
commandRun.status === 'completed' ? '完成' : '失败'
}${logSuffix}`;
});
const visibleSteps = trace?.steps.slice(-6) ?? [];
const stepLines = visibleSteps.map((step) => {
const outputPaths = step.outputPaths
.filter(isSafeProjectRelativePath)
.slice(0, 3);
return [
`- ${step.agent} #${step.pass} / ${step.phase} · ${step.status} · ${step.summary}`,
outputPaths.length > 0 ? `输出 ${outputPaths.join(', ')}` : null,
]
.filter(Boolean)
.join(' · ');
});
const latestSafeLogPath = [...commandRuns]
.reverse()
.find((commandRun) =>
isSafeProjectRelativePath(commandRun.logPath),
)?.logPath;
const draftCommand = latestSafeLogPath
? `/read ${latestSafeLogPath}`
: trace
? '/trace'
: '/history';
return {
text: [
'项目时间线:',
`- Run${trace ? `${trace.runId} · ${formatAgentRunStatus(trace)}` : '暂无最近 run'}`,
commandLines.length > 0
? `- 最近命令:\n${commandLines.join('\n')}`
: '- 最近命令:暂无',
stepLines.length > 0
? `- 最近步骤:\n${stepLines.join('\n')}`
: '- 最近步骤:暂无',
].join('\n'),
draftCommand,
draftCommandLabel: latestSafeLogPath
? '读取最近日志'
: trace
? '查看 trace'
: '查看历史',
};
}
function summarizeProjectHandoff(
nextManifest: GameCreationAppManifest,
nextProjectPath: string,
@@ -2645,6 +2702,7 @@ function summarizeNextProjectActions(
addSuggestion('查看试玩状态', '/playtest');
addSuggestion('查看评审和返工焦点', '/review');
addSuggestion('查看生成上下文来源', '/context');
addSuggestion('查看项目活动时间线', '/timeline');
addSuggestion('查看最近 trace 摘要', '/trace');
addSuggestion('列出最近 Run 产物', '/run-artifacts');
addSuggestion('列出 Agent 轮次产物', '/passes');
@@ -6264,6 +6322,23 @@ export function App() {
return;
}
if (prompt === '/timeline') {
if (!requireChatProjectForUserAction()) {
return;
}
const summary = summarizeProjectTimeline(manifest, agentRunTrace);
setMessages((current) => [
...current,
{
role: 'assistant',
text: summary.text,
draftCommand: summary.draftCommand,
draftCommandLabel: summary.draftCommandLabel,
},
]);
return;
}
if (prompt === '/handoff') {
const nextProjectPath = requireChatProjectForUserAction();
if (!nextProjectPath) {
@@ -2329,6 +2329,71 @@ describe('AI 游戏创作 App 界面边界', () => {
),
).toHaveLength(fileReadCountBeforeContext);
const fileReadCountBeforeTimeline = invoke.mock.calls.filter(
([command]) => command === 'read_local_project_file',
).length;
const manifestReadCountBeforeTimeline = invoke.mock.calls.filter(
([command]) => command === 'get_local_game_manifest',
).length;
const runLocalCountBeforeTimeline = invoke.mock.calls.filter(
([command]) => command === 'run_limited_local_command',
).length;
const startPreviewCountBeforeTimeline = invoke.mock.calls.filter(
([command]) => command === 'start_local_game_preview',
).length;
const openPreviewCountBeforeTimeline = invoke.mock.calls.filter(
([command]) => command === 'open_local_game_preview',
).length;
submitChat('/timeline');
expect(await screen.findByText(/项目时间线:/)).not.toBeNull();
const timelineMessages = screen.getAllByText(/项目时间线:/);
const timelineMessage = timelineMessages[timelineMessages.length - 1];
expect(timelineMessage.textContent).toContain(
'Runrun-main-shortcut-trace · passed / done',
);
expect(timelineMessage.textContent).toContain(
'命令 game.static_smoke · 完成 · 日志 /read .agent/logs/command.log',
);
expect(timelineMessage.textContent).toContain(
'Generator #1 / generate · completed · 生成可运行草案 · 输出 .agent/passes/pass-1/draft.json',
);
expect(timelineMessage.textContent).toContain(
'Evaluator #1 / evaluation · passed · 质量评审通过',
);
const timelineDraftButtons = screen.getAllByRole('button', {
name: '读取最近日志',
});
fireEvent.click(timelineDraftButtons[timelineDraftButtons.length - 1]);
expect(screen.getByLabelText('创作想法')).toHaveProperty(
'value',
'/read .agent/logs/command.log',
);
expect(
invoke.mock.calls.filter(
([command]) => command === 'read_local_project_file',
),
).toHaveLength(fileReadCountBeforeTimeline);
expect(
invoke.mock.calls.filter(
([command]) => command === 'get_local_game_manifest',
),
).toHaveLength(manifestReadCountBeforeTimeline);
expect(
invoke.mock.calls.filter(
([command]) => command === 'run_limited_local_command',
),
).toHaveLength(runLocalCountBeforeTimeline);
expect(
invoke.mock.calls.filter(
([command]) => command === 'start_local_game_preview',
),
).toHaveLength(startPreviewCountBeforeTimeline);
expect(
invoke.mock.calls.filter(
([command]) => command === 'open_local_game_preview',
),
).toHaveLength(openPreviewCountBeforeTimeline);
const manifestReadCountBeforeHandoff = invoke.mock.calls.filter(
([command]) => command === 'get_local_game_manifest',
).length;
@@ -2453,6 +2518,7 @@ describe('AI 游戏创作 App 界面边界', () => {
expect(screen.getByText(/查看试玩状态:\/playtest/)).not.toBeNull();
expect(screen.getByText(/查看评审和返工焦点:\/review/)).not.toBeNull();
expect(screen.getByText(/查看生成上下文来源:\/context/)).not.toBeNull();
expect(screen.getByText(/查看项目活动时间线:\/timeline/)).not.toBeNull();
expect(
screen.getByText(/列出内部真相源读取命令:\/internals/),
).not.toBeNull();
@@ -8348,6 +8414,7 @@ describe('AI 游戏创作 App 界面边界', () => {
screen.getByText(/\/review:查看 Evaluator 评审和返工焦点/),
).not.toBeNull();
expect(screen.getByText(/\/context:查看生成上下文来源/)).not.toBeNull();
expect(screen.getByText(/\/timeline:查看项目活动时间线/)).not.toBeNull();
expect(screen.getByText(/\/handoff:生成当前项目交接摘要/)).not.toBeNull();
expect(screen.getByText(/\/next:查看下一步建议/)).not.toBeNull();
expect(screen.getByText(/\/publish:查看发布准备清单/)).not.toBeNull();
@@ -3869,6 +3869,7 @@
- 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 调整:普通用户通过聊天输入 `/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 文件,也不得新增普通用户时间线面板。
- 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 读取、不得滚动加载更多历史、不得启动或打开预览,也不得新增普通用户面板。
@@ -3879,7 +3880,7 @@
- 2026-07-03 调整:普通用户通过聊天输入 `/art` 查看美术素材,只基于当前 manifest 盘点图片、视频和序列帧素材的数量、来源、画板接入状态和路径,并提供 `/generate-art 首版核心美术素材``/read assets/manifest.art.json` 草稿;该入口不得触发 Tauri 读写、平台生成、画板同步或新增普通用户美术面板。
- 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``/context``/playtest``/run``/open-preview``/assets``/art``/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``/context``/timeline``/playtest``/run``/open-preview``/assets``/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