feat(agent): 渲染时读取 ACL,内存+磁盘 last-good 保证 fail-closed 跨重启

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-07-23 02:01:45 +08:00
parent 4155fc8542
commit 87d5afa703
3 changed files with 140 additions and 1 deletions
+9
View File
@@ -176,3 +176,12 @@ func (ac *ACLConfig) rules() []any {
}
return out
}
// persistACL 把成功加载的 ACL 快照原子写到 path,供 agent 冷启动兜底。
func persistACL(path string, ac *ACLConfig) error {
data, err := json.MarshalIndent(ac, "", " ")
if err != nil {
return fmt.Errorf("agentd: marshal acl snapshot: %w", err)
}
return atomicWrite(path, data, 0o600)
}