feat(sandbox-policy): describe enforced file families

This commit is contained in:
NI0317
2026-07-30 18:51:29 +08:00
parent d3323494ba
commit 87a4aaa32e
48 changed files with 623 additions and 140 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/fs/fs-sandbox/README.md
README.md: 790444a4184b9bcccd3a0798cf0c09cb6f1b166e
README.zh.md: d54bdcbe65673b6892ebd1d539dd066f66d68cb6
README.md: a376f2c23dca9f0895525fa274a1ae0545823f63
README.zh.md: 4fa2deecb7d10124da8b7920997196b816457fcc

View File

@@ -22,11 +22,19 @@ A denial is a structured `FsError` (`FS_SANDBOX_DENIED`, carrying the effective
## Model Experience
Indirectly, through `dsh-tool-fs`, which renders this backend's `FS_SANDBOX_DENIED` refusals as the `[sandbox: file access denied under <mode> mode]` marker plus the same-turn escalation hint.
### Filesystem policy and refusals
#### What the model sees
This backend contributes the write/edit family to the owner-rendered `sandbox:policy` section. Indirectly, `dsh-tool-fs` renders its `FS_SANDBOX_DENIED` refusals as the `[sandbox: file access denied under <mode> mode]` marker plus the same-turn escalation hint.
#### Token effect
The current-policy clause adds a small fixed prefix while this backend is mounted; a denial adds the bounded marker and escalation hint to conversation history.
#### KV Cache effect
No direct invalidation; the named consumer owns any request-prefix changes.
A standing-policy or family-composition change updates the owner-rendered request prefix; operation results remain append-only.
## Known Limitations and Deferred Work

View File

@@ -22,11 +22,19 @@
## 模型体验
通过 `dsh-tool-fs` 间接产生影响;该消费方把本后端的 `FS_SANDBOX_DENIED` 拒绝渲染为 `[sandbox: file access denied under <mode> mode]` 标记和同轮次升级提示。
### 文件系统策略与拒绝
#### 模型看到的内容
该后端会向归属方渲染的 `sandbox:policy` 段落贡献 write/edit 家族。作为间接影响,`dsh-tool-fs` 会把本后端的 `FS_SANDBOX_DENIED` 拒绝渲染为 `[sandbox: file access denied under <mode> mode]` 标记和同轮次升级提示。
#### Token 影响
该后端挂载期间,当前策略条款会在前缀中增加少量固定内容;拒绝则会把有界标记和升级提示追加到对话历史。
#### KV Cache 影响
不会直接使缓存失效;上述消费方负责请求前缀的任何变化
常驻策略或家族组合发生变化时,归属方渲染的请求前缀会更新;操作结果保持仅追加
## 已知限制与暂缓事项

View File

@@ -63,6 +63,7 @@ export class SandboxedFileSystem extends LocalFileSystem {
constructor(ctx: Context, config: Config) {
super(ctx, config)
this.defaultMode = ctx.sandboxPolicy.defaultMode
ctx.sandboxPolicy.registerEnforcedFamily('filesystem')
}
/** The deployment default mode — the capability fact the tool layer reads to advertise escalation. */