补充Run产物读取入口
新增聊天侧run-artifacts命令列出最近Run产物读取草稿 补充帮助命令和主窗口Run产物入口测试 同步AI游戏创作App技术方案和共享决策记录
This commit is contained in:
@@ -1844,6 +1844,7 @@ const chatCommandHelp = [
|
||||
'/files:列出本地项目文件',
|
||||
'/assets:列出本地项目资产',
|
||||
'/artifacts:列出常用生成产物读取命令',
|
||||
'/run-artifacts:列出最近 Run 产物读取命令',
|
||||
'/asset-register 路径 [kind] [mediaType]:登记项目内已有资产',
|
||||
'/read 路径:读取本地项目内文本文件',
|
||||
'/run:运行自检,启动本地 HTTP 预览并交给外部浏览器',
|
||||
@@ -3363,6 +3364,28 @@ function readableArtifactPathFromAgentRunTrace(
|
||||
)?.path;
|
||||
}
|
||||
|
||||
function readableArtifactsFromAgentRunTrace(trace: GameCreationAgentRunTrace) {
|
||||
return trace.artifacts.filter((artifact) =>
|
||||
isSafeProjectRelativePath(artifact.path),
|
||||
);
|
||||
}
|
||||
|
||||
function summarizeRunArtifactReadDrafts(trace: GameCreationAgentRunTrace | null) {
|
||||
if (!trace) {
|
||||
return '最近 Run 产物:暂无最近 trace';
|
||||
}
|
||||
const artifacts = readableArtifactsFromAgentRunTrace(trace);
|
||||
if (artifacts.length === 0) {
|
||||
return '最近 Run 产物:暂无可读取产物';
|
||||
}
|
||||
return `最近 Run 产物读取命令:\n${artifacts
|
||||
.map(
|
||||
(artifact) =>
|
||||
`- ${artifact.path} · ${artifact.sizeBytes}B · ${artifact.checksum}:/read ${artifact.path}`,
|
||||
)
|
||||
.join('\n')}`;
|
||||
}
|
||||
|
||||
function localAgentConversationReceipt(agent: AgentStatusCard) {
|
||||
return `已记录给 ${agent.title}。下一次生成会把这条对话作为该 agent 的上下文读取。`;
|
||||
}
|
||||
@@ -5359,6 +5382,26 @@ export function App() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (prompt === '/run-artifacts') {
|
||||
if (!requireChatProjectForUserAction()) {
|
||||
return;
|
||||
}
|
||||
const artifacts = agentRunTrace
|
||||
? readableArtifactsFromAgentRunTrace(agentRunTrace)
|
||||
: [];
|
||||
const firstArtifact = artifacts[0] ?? null;
|
||||
setMessages((current) => [
|
||||
...current,
|
||||
{
|
||||
role: 'assistant',
|
||||
text: summarizeRunArtifactReadDrafts(agentRunTrace),
|
||||
draftCommand: firstArtifact ? `/read ${firstArtifact.path}` : undefined,
|
||||
draftCommandLabel: firstArtifact ? '读取首个 Run 产物' : undefined,
|
||||
},
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (prompt.startsWith('/asset-register ')) {
|
||||
if (!requireChatProjectForUserAction()) {
|
||||
return;
|
||||
|
||||
@@ -2209,6 +2209,20 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
fireEvent.click(readEntryButtons[readEntryButtons.length - 1]);
|
||||
expect(composerInput).toHaveProperty('value', '/read game/index.html');
|
||||
await waitFor(() => expect(document.activeElement).toBe(composerInput));
|
||||
submitChat('/run-artifacts');
|
||||
expect(
|
||||
await screen.findByText(
|
||||
/最近 Run 产物读取命令:[\s\S]*exports\/README\.md · 128B · fnv1a64:exports:\/read exports\/README\.md/,
|
||||
),
|
||||
).not.toBeNull();
|
||||
fireEvent.click(screen.getByRole('button', { name: '读取首个 Run 产物' }));
|
||||
expect(composerInput).toHaveProperty('value', '/read exports/README.md');
|
||||
expect(invoke).not.toHaveBeenCalledWith(
|
||||
'read_local_project_file',
|
||||
expect.objectContaining({
|
||||
relativePath: 'exports/README.md',
|
||||
}),
|
||||
);
|
||||
fireEvent.click(screen.getByRole('button', { name: '打开画板' }));
|
||||
expect(composerInput).toHaveProperty('value', '/canvas ');
|
||||
await waitFor(() => expect(document.activeElement).toBe(composerInput));
|
||||
@@ -7634,6 +7648,9 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
expect(
|
||||
screen.getByText(/\/artifacts:列出常用生成产物读取命令/),
|
||||
).not.toBeNull();
|
||||
expect(
|
||||
screen.getByText(/\/run-artifacts:列出最近 Run 产物读取命令/),
|
||||
).not.toBeNull();
|
||||
expect(
|
||||
screen.getByText(/\/canvas 画板项目ID:打开本机画板项目/),
|
||||
).not.toBeNull();
|
||||
|
||||
@@ -3860,7 +3860,7 @@
|
||||
- 2026-07-03 调整:开发窗口日志面板提供 `.agent/logs/command.log`、`.agent/logs/preview.log` 和 `.agent/logs/agent.log` 的只读查看入口,复用 `file.read` 授权策略;普通用户窗口仍只通过聊天 `/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` 只列出同一组固定读取命令并提供首个读取草稿;实际读取仍走聊天侧 `file.read` 权限流,不直接读本地文件。
|
||||
- 2026-07-03 调整:主窗口新增常用生成产物读取入口,只把入口 HTML、设计、数值、美术清单、音频清单和发布说明对应的 `/read` 草稿填入聊天输入框;聊天命令 `/artifacts` 只列出同一组固定读取命令并提供首个读取草稿,`/run-artifacts` 只列出最近 trace 里的产物读取命令并提供首个 `/read` 草稿;实际读取仍走聊天侧 `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
Reference in New Issue
Block a user