feat: audit local agent file writes
- 为本地 agent 写入补充审计事件,区分原生修改与 mnote tool 写入 - 只读 grant 写入尝试会记录拒绝事件,便于会话面板追踪 changed files - 页面 AI smoke 脚本补充 changed files 展示链路验证 - 更新当前优先级 checklist 的完成状态与验证记录
This commit is contained in:
+10
-4
@@ -130,9 +130,10 @@
|
||||
|
||||
- [x] 设计本地审计目录:建议放在 `/mnt/Data1T/Mnote_data/control-plane/agent-audit/`。
|
||||
- [x] 定义审计事件 JSONL 字段:`eventId`、`actorId`、`agentKind`、`runId`、`rootUri`、`permission`、`changedFiles`、`diffSummary`、`createdAt`。
|
||||
- [ ] 区分 agent 原生文件修改与 MNote tool 写入:二者都要能归入同一个 run audit。
|
||||
- [ ] 对只读 grant 的 agent run 写入尝试记录拒绝事件。
|
||||
- 当前已补齐工具层只读拒绝:`mnote.doc.markdown_edit` / `mnote.page.save` / `mnote.block.*` 在 `read_only` AI scope 下直接拒绝写入;待 run 结束审计事件也记录 `writeAttemptRejected` 后再勾选。
|
||||
- [x] 区分 agent 原生文件修改与 MNote tool 写入:二者都要能归入同一个 run audit。
|
||||
- 实现:agent 原生文件修改继续由 run 前后 root snapshot 生成 `changedFiles`;MNote tool 本地成功写入额外追加 `origin=mnote_tool` 的同 `runId` audit event,只读拒绝追加 `writeAttemptRejected=true` 的同 `runId` audit event。
|
||||
- [x] 对只读 grant 的 agent run 写入尝试记录拒绝事件。
|
||||
- 实现:`mnote.doc.markdown_edit` / `mnote.page.save` / `mnote.block.*` 在 `read_only` AI scope 下直接拒绝写入;本地 mnote tool 写入拒绝会按同一 `runId` 追加 control-plane `agent-audit.jsonl` 事件,标记 `writeAttemptRejected=true`。
|
||||
|
||||
### 3.2 写入采集
|
||||
|
||||
@@ -147,8 +148,13 @@
|
||||
|
||||
- [x] 单测:run 前后文件变化可生成 changed files。
|
||||
- 验证:`cargo test -p mnote-web local_agent_audit_snapshot_detects_changed_files -- --nocapture`
|
||||
- [ ] 单测:只读授权下写入被拒绝并产生拒绝审计事件。
|
||||
- [x] 单测:只读授权下写入被拒绝并产生拒绝审计事件。
|
||||
- 验证:`cargo test -p mnote-web hermes_tools_markdown_edit_shared_read -- --nocapture`
|
||||
- [x] 单测:MNote tool 本地写入归入同一 run audit,并标记 `origin=mnote_tool`。
|
||||
- 验证:`cargo test -p mnote-web hermes_tools_page_save_local_folder_writes_markdown_file -- --nocapture`
|
||||
- [ ] browser smoke:AI 修改一篇本地 markdown 后,会话面板显示 changed files。
|
||||
- 已验证 UI 展示链路:`PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/google-chrome-stable node scripts/task-hermes-page-ai-smoke.js` 可渲染 mocked `run.completed.agentAudit.changedFiles` 的 `agent.changed_files` 工具卡。
|
||||
- 待补:真实 local_folder agent run 写入 `.md` 后,由后端审计事件驱动会话面板展示 changed files。
|
||||
|
||||
补充验证:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user