补充Agent记忆读取入口
新增聊天侧agent-memories命令列出私有记忆读取草稿 补充帮助命令和主窗口记忆入口测试 同步AI游戏创作App技术方案和共享决策记录
This commit is contained in:
@@ -1833,6 +1833,7 @@ const chatCommandHelp = [
|
||||
'/policy-auto 命令:恢复自动执行',
|
||||
'/tasks:查看任务拆分',
|
||||
'/agents:查看每个 Agent 的当前状态',
|
||||
'/agent-memories:列出 Agent 私有记忆读取命令',
|
||||
'/trace 或 /loop:查看最近一次 Agent loop trace',
|
||||
'/agent-status:查看最近 run 生命周期',
|
||||
'/agent-kill:标记最近 run 为 killed',
|
||||
@@ -3196,6 +3197,52 @@ function summarizeAgentStatusCardsForChat(
|
||||
.join('\n')}`;
|
||||
}
|
||||
|
||||
const agentRoleMemoryFileNames: Record<string, string> = {
|
||||
Director: 'director.md',
|
||||
Gameplay: 'gameplay.md',
|
||||
Difficulty: 'difficulty.md',
|
||||
Asset: 'asset.md',
|
||||
Polish: 'polish.md',
|
||||
SFX: 'sfx.md',
|
||||
Code: 'code.md',
|
||||
Review: 'review.md',
|
||||
Preview: 'preview.md',
|
||||
Playtest: 'playtest.md',
|
||||
Publish: 'publish.md',
|
||||
};
|
||||
|
||||
function agentMemoryReadDraftFromTask(task: GameCreationAppTaskState) {
|
||||
const fileName = agentRoleMemoryFileNames[task.role];
|
||||
if (!fileName) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
task,
|
||||
path: `memory/agents/${task.group}/${fileName}`,
|
||||
};
|
||||
}
|
||||
|
||||
function agentMemoryReadDraftsFromManifest(
|
||||
nextManifest: GameCreationAppManifest,
|
||||
) {
|
||||
return taskRowsFromManifest(nextManifest)
|
||||
.map(agentMemoryReadDraftFromTask)
|
||||
.filter((draft): draft is NonNullable<typeof draft> => draft !== null);
|
||||
}
|
||||
|
||||
function summarizeAgentMemoryReadDrafts(nextManifest: GameCreationAppManifest) {
|
||||
const drafts = agentMemoryReadDraftsFromManifest(nextManifest);
|
||||
if (drafts.length === 0) {
|
||||
return 'Agent 私有记忆:暂无可读取记忆路径';
|
||||
}
|
||||
return `Agent 私有记忆读取命令:\n${drafts
|
||||
.map(
|
||||
({ task, path }) =>
|
||||
`- ${taskGroupLabels[task.group]} / ${task.role} · ${task.title}:/read ${path}`,
|
||||
)
|
||||
.join('\n')}`;
|
||||
}
|
||||
|
||||
function formatTraceTaskId(taskId: string, tasks: GameCreationAppTaskState[]) {
|
||||
const task = tasks.find((candidate) => candidate.id === taskId);
|
||||
if (!task) {
|
||||
@@ -5356,6 +5403,26 @@ export function App() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (prompt === '/agent-memories') {
|
||||
if (!requireChatProjectForUserAction()) {
|
||||
return;
|
||||
}
|
||||
const drafts = agentMemoryReadDraftsFromManifest(manifest);
|
||||
const firstDraft = drafts[0] ?? null;
|
||||
setMessages((current) => [
|
||||
...current,
|
||||
{
|
||||
role: 'assistant',
|
||||
text: summarizeAgentMemoryReadDrafts(manifest),
|
||||
draftCommand: firstDraft ? `/read ${firstDraft.path}` : undefined,
|
||||
draftCommandLabel: firstDraft
|
||||
? `读取${firstDraft.task.title}记忆`
|
||||
: undefined,
|
||||
},
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (prompt === '/trace' || prompt === '/loop') {
|
||||
void executeAgentTraceChat();
|
||||
return;
|
||||
|
||||
@@ -2058,6 +2058,25 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
/Agent 状态:[\s\S]*美术组 \/ Asset · 规划美术资产 · 待处理[\s\S]*LLM:已配置 · art-model/,
|
||||
),
|
||||
).not.toBeNull();
|
||||
submitChat('/agent-memories');
|
||||
expect(
|
||||
await screen.findByText(
|
||||
/Agent 私有记忆读取命令:[\s\S]*美术组 \/ Asset · 规划美术资产:\/read memory\/agents\/art\/asset\.md/,
|
||||
),
|
||||
).not.toBeNull();
|
||||
fireEvent.click(
|
||||
screen.getByRole('button', { name: '读取拆解创作方向记忆' }),
|
||||
);
|
||||
expect(screen.getByLabelText('创作想法')).toHaveProperty(
|
||||
'value',
|
||||
'/read memory/agents/design/director.md',
|
||||
);
|
||||
expect(invoke).not.toHaveBeenCalledWith(
|
||||
'read_local_project_file',
|
||||
expect.objectContaining({
|
||||
relativePath: 'memory/agents/design/director.md',
|
||||
}),
|
||||
);
|
||||
|
||||
fireEvent.click(
|
||||
within(agentStatusPane).getByRole('button', {
|
||||
@@ -7567,6 +7586,9 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
expect(
|
||||
screen.getByText(/\/agents:查看每个 Agent 的当前状态/),
|
||||
).not.toBeNull();
|
||||
expect(
|
||||
screen.getByText(/\/agent-memories:列出 Agent 私有记忆读取命令/),
|
||||
).not.toBeNull();
|
||||
expect(
|
||||
screen.getByText(/\/agent-status:查看最近 run 生命周期/),
|
||||
).not.toBeNull();
|
||||
|
||||
@@ -3858,7 +3858,7 @@
|
||||
- 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 对话面板允许用户把当前输入手动追加到该 agent 的 `memory/agents/<group>/<role>.md` 私有记忆;写入复用 `memory.write` 项目策略、项目锁和 Tauri 本地目录能力,不把普通对话流水自动混入私有记忆。
|
||||
- 2026-07-03 调整:单 Agent 对话面板允许用户把当前输入手动追加到该 agent 的 `memory/agents/<group>/<role>.md` 私有记忆;写入复用 `memory.write` 项目策略、项目锁和 Tauri 本地目录能力,不把普通对话流水自动混入私有记忆;聊天侧 `/agent-memories` 只列出同一批私有记忆读取命令并提供首个 `/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-06-25 调整:本地 HTTP 预览静态 `HEAD` 必须返回与 `GET` 相同的真实 `Content-Length`,但不返回 body;浏览器、图片、音频和视频探测不能拿到 `Content-Length: 0` 的假响应。
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user