补充日志读取命令入口

新增聊天侧logs命令列出常用日志读取草稿

补充帮助命令和主窗口日志入口测试

同步AI游戏创作App技术方案和共享决策记录
This commit is contained in:
AIGameCreator App
2026-07-03 03:59:26 +08:00
parent 53d8acc2dc
commit b8cb088056
4 changed files with 72 additions and 4 deletions
+29
View File
@@ -227,6 +227,12 @@ const commonProjectArtifactReadDrafts = [
{ label: '读发布说明', path: 'exports/README.md' },
] as const;
const commonProjectLogReadDrafts = [
{ label: '读命令日志', path: '.agent/logs/command.log' },
{ label: '读预览日志', path: '.agent/logs/preview.log' },
{ label: '读 Agent 日志', path: '.agent/logs/agent.log' },
] as const;
interface ListLocalProjectFilesResult {
projectPath: string;
files: LocalProjectFileEntry[];
@@ -1845,6 +1851,7 @@ const chatCommandHelp = [
'/assets:列出本地项目资产',
'/artifacts:列出常用生成产物读取命令',
'/run-artifacts:列出最近 Run 产物读取命令',
'/logs:列出常用日志读取命令',
'/asset-register 路径 [kind] [mediaType]:登记项目内已有资产',
'/read 路径:读取本地项目内文本文件',
'/run:运行自检,启动本地 HTTP 预览并交给外部浏览器',
@@ -2286,6 +2293,12 @@ function summarizeCommonProjectArtifactReadDrafts() {
.join('\n')}`;
}
function summarizeCommonProjectLogReadDrafts() {
return `常用日志读取命令:\n${commonProjectLogReadDrafts
.map((log) => `- ${log.label} · ${log.path} · /read ${log.path}`)
.join('\n')}`;
}
function summarizeProjectAssets(nextManifest: GameCreationAppManifest) {
if (nextManifest.assets.length === 0) {
return '本地项目还没有登记资产。';
@@ -5402,6 +5415,22 @@ export function App() {
return;
}
if (prompt === '/logs') {
if (!requireChatProjectForUserAction()) {
return;
}
setMessages((current) => [
...current,
{
role: 'assistant',
text: summarizeCommonProjectLogReadDrafts(),
draftCommand: `/read ${commonProjectLogReadDrafts[0].path}`,
draftCommandLabel: commonProjectLogReadDrafts[0].label,
},
]);
return;
}
if (prompt.startsWith('/asset-register ')) {
if (!requireChatProjectForUserAction()) {
return;
@@ -2223,6 +2223,41 @@ describe('AI 游戏创作 App 界面边界', () => {
relativePath: 'exports/README.md',
}),
);
submitChat('/logs');
expect(await screen.findByText(/常用日志读取命令:/)).not.toBeNull();
expect(
screen.getByText(/读命令日志 · \.agent\/logs\/command\.log/),
).not.toBeNull();
expect(
screen.getByText(/读 Agent 日志 · \.agent\/logs\/agent\.log/),
).not.toBeNull();
const commandLogReadCountBefore = invoke.mock.calls.filter(
([command, args]) =>
command === 'read_local_project_file' &&
args &&
'relativePath' in args &&
args.relativePath === '.agent/logs/command.log',
).length;
const messageList = document.querySelector('.message-list');
expect(messageList).not.toBeNull();
fireEvent.click(
within(messageList as HTMLElement).getByRole('button', {
name: '读命令日志',
}),
);
expect(composerInput).toHaveProperty(
'value',
'/read .agent/logs/command.log',
);
expect(
invoke.mock.calls.filter(
([command, args]) =>
command === 'read_local_project_file' &&
args &&
'relativePath' in args &&
args.relativePath === '.agent/logs/command.log',
),
).toHaveLength(commandLogReadCountBefore);
fireEvent.click(screen.getByRole('button', { name: '打开画板' }));
expect(composerInput).toHaveProperty('value', '/canvas ');
await waitFor(() => expect(document.activeElement).toBe(composerInput));
@@ -7651,6 +7686,9 @@ describe('AI 游戏创作 App 界面边界', () => {
expect(
screen.getByText(/\/run-artifacts:列出最近 Run 产物读取命令/),
).not.toBeNull();
expect(
screen.getByText(/\/logs:列出常用日志读取命令/),
).not.toBeNull();
expect(
screen.getByText(/\/canvas 画板项目ID:打开本机画板项目/),
).not.toBeNull();
@@ -3857,10 +3857,10 @@
- 2026-07-03 调整:主窗口 Agent 状态栏新增“继续说明”,只把 `/agent-resume ` 填入聊天输入框,让用户补充说明后再走原确认流;策略快捷入口新增 project.index、asset.register、memory.write、preview.open、preview.stop、conversation.read 和 conversation.write 确认草稿,同样只填输入框,不直接写 `.agent/policy.json`
- 2026-07-03 调整:主窗口 header 常驻项目摘要只从当前已加载的 manifest / trace 派生任务完成数、ready 数、资产来源分布和最近命令结果;未选择工作区时不显示,不为了摘要额外触发 Tauri 读取或写入,也不把任务、文件、run history 或预览开发面板搬进普通用户窗口。
- 2026-07-03 调整:`/llm-status` 读取到的 agent 级 LLM 配置状态可回填到主窗口 Agent 状态列表、聊天侧 `/agents` 汇总和单 Agent 对话头部,显示 provider 类型、模型、流式开关和 API Key 是否已读取;密钥本体仍不能进入聊天、状态列表、manifest、trace 或本地项目文件。
- 2026-07-03 调整:开发窗口日志面板提供 `.agent/logs/command.log``.agent/logs/preview.log``.agent/logs/agent.log` 的只读查看入口,复用 `file.read` 授权策略;普通用户窗口仍只通过聊天 `/read` 和摘要消息查看需要的日志,不新增日志面板
- 2026-07-03 调整:开发窗口日志面板提供 `.agent/logs/command.log``.agent/logs/preview.log``.agent/logs/agent.log` 的只读查看入口,复用 `file.read` 授权策略;普通用户聊天输入 `/logs` 只列出这三个日志文件对应的 `/read ...` 草稿 / 命令并提供首个草稿,不直接读取日志,不新增普通用户日志面板,实际读取仍走聊天侧 `file.read`
- 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 ` 草稿;音乐组仍复用现有资产登记 / 画板回流链路,不新增独立音频生成系统。
- 2026-07-03 调整:主窗口新增常用生成产物读取入口,只把入口 HTML、设计、数值、美术清单、音频清单和发布说明对应的 `/read` 草稿填入聊天输入框;聊天命令 `/artifacts` 只列出同一组固定读取命令并提供首个读取草稿,`/run-artifacts` 只列出最近 trace 里的产物读取命令并提供首个 `/read` 草稿;实际读取仍走聊天侧 `file.read` 权限流,不直接读本地文件。
- 2026-07-03 调整:主窗口新增常用生成产物读取入口,只把入口 HTML、设计、数值、美术清单、音频清单和发布说明对应的 `/read` 草稿填入聊天输入框;聊天命令 `/artifacts` 只列出同一组固定读取命令并提供首个读取草稿,`/run-artifacts` 只列出最近 trace 里的产物读取命令并提供首个 `/read` 草稿`/logs` 只列出固定日志读取命令;实际读取仍走聊天侧 `file.read` 权限流,不直接读本地文件。
- 2026-06-25 调整:本地 HTTP 预览静态 `HEAD` 必须返回与 `GET` 相同的真实 `Content-Length`,但不返回 body;浏览器、图片、音频和视频探测不能拿到 `Content-Length: 0` 的假响应。
- 2026-06-25 调整:普通用户通过聊天输入 `/run` 触发待确认 `game.run_local`,确认后只能复用白名单 `game.static_smoke` 自检当前 `game/index.html`,通过后启动 `127.0.0.1` 本地 HTTP 预览。独立执行 `game.static_smoke` 时如果已有 `.agent/run.latest.json`,必须追加 `Playtest / game.static_smoke` trace step,避免“运行了代码但编排 trace 不可见”。
- 2026-06-25 调整:普通用户通过聊天输入 `/trace` 触发只读 `agent.trace_read`,读取 `.agent/run.latest.json` 并在聊天里摘要 loop 轮次、stopReason、nextStep、active / carry-over 任务、repairRoutes、agent 建议命令和最近 step。trace 面板仍只在开发窗口展示,普通用户窗口不新增面板。
File diff suppressed because one or more lines are too long