docs(agent-presets): record that a preset file is never written back
The Loader writes a tree back to its source whenever it decides the config changed, and a row disposing its own fiber is enough to decide that. The mounted subtree overrides `write()` as a no-op for that reason — a fact that lived only in a PR description, so nothing in the repo said why the override exists or what removing it would cost.
This commit is contained in:
@@ -42,6 +42,12 @@ agent 工厂的 `setup(agentCtx)` 钩子是唯一受支持的调用点。只有
|
||||
|
||||
最后一条规则由本包的运行时不变量在每次服务通知时复查,因为从定时器或异步续体中发布的行会绕过一次性审计。
|
||||
|
||||
## preset 文件是输入,不是持久化目标
|
||||
|
||||
只要 Loader 认为配置变了,它就会把树写回源文件——而一个行释放自己的 fiber 就足以让它这么认为:该 entry 被标记 `disabled`,随即触发写回。若继承该行为,一个会话的运行时状态就会被烧进所有会话共享的文件里:YAML 往返会抹掉注释,而对随附的只读 preset,`writeFile` 还会在 `setTimeout` 内抛出无人接管的 rejection。
|
||||
|
||||
因此被挂载的子树把 `write()` 覆写为空操作。本包不写任何组装;创作组装是另一件独立且显式的操作。
|
||||
|
||||
## 信任
|
||||
|
||||
preset 就是组装,因此一个 preset 的权限恰好等于它所引用的插件。`user` preset——无论由人还是由 agent 写出——与 shell 访问权限同级;`trust` 字段的存在是为了让消费方呈现这一差异,而不是用来强制隔离。
|
||||
|
||||
Reference in New Issue
Block a user