Files
my-pi/config/pi-permission-policy.jsonc
T
云服务部-叶林立andDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> 7e6a8faae1 feat(pi-permission-system): AutoReview 改为跟随主模型的对话式工具调用审查
AutoReview:

- 审查器回到 Codex Guardian 风格的对话式审查,默认跟随会话当前主模型
  (每次审查实时读取 ctx.model);provider/model 必须同时设置才固定审查
  模型,只设其一视为配置错误并转人工。
- 结论只通过 approve / reject 两个工具给出,参数仅 reason;不强制
  toolChoice,正文文本(即使是合法 JSON)一律忽略。
- approve 自动放行;reject 转人工并在弹窗显示理由(标注模型生成)。
  超时、Provider 错误、截断、未调用工具、多次调用、参数无效等异常同样
  转人工,并附固定的系统说明;用户按 Esc 中止时直接拒绝。
- 模型调用改为 modelRegistry.streamSimple(...).result():Pi 1.3.0 面向
  扩展的 ModelRegistry 没有 completeSimple,原写法在真实环境中每次都会
  转人工。
- 对话记录保留可信度标注;工具结果在有更短的 pi-compaction 摘要时替换
  为摘要;token 估算改为非 ASCII 字符按 1 token 计;预算可配置。
- 同一条用户消息内完全相同的请求只缓存 approve 结论。
- 默认 reasoning low、总超时 30 秒、最多 2 次尝试、maxOutputTokens 4000。

删除:

- 未发布过的 TypeSafe Jev 分类器实现、DenialCircuitBreaker。
- 整个 annotator 机制(model-explanation、注册表、registerAnnotator、
  provider-timeout);annotators 配置键保留为已弃用并忽略,避免旧配置
  被拒绝。

测试:

- 新增 reviewer / transcript / 弹窗说明 / 默认配置测试;清理重复、恒真
  或只测实现细节的旧测试。
- 使用 deepseek-v4.1-flash 实测 5 个场景各 5 次,25 次结论全部符合预期。

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-19 01:54:17 -07:00

149 lines
4.3 KiB
JSON

{
"debugLog": false,
"permissionReviewLog": true,
"yoloMode": false,
"doublePressToConfirm": true,
// AutoReview is the default authority for deterministic review decisions.
//
// The reviewer is a conversational model asked to judge one planned action
// under a bundled security policy. With no provider/model pair it follows
// the session's current model, so review quality tracks whatever you run.
// It answers by calling `approve` or `reject`; a reject — and every failure
// (timeout, provider error, malformed verdict) — defers to the human
// permission prompt with the model's reason shown. Approvals are cached
// within one user message, so the same ask does not pay for a second review.
//
// To pin a dedicated review model instead, set BOTH "provider" and "model";
// exactly one set is a misconfiguration and also defers to the human.
// "reasoning" defaults to "low" and only applies to reasoning-capable models.
"authorizerChain": ["auto-review"],
"autoReview": {
"enabled": true
},
"shellTools": {
"ssh_bash": {
"commandArgument": "command",
"decisionFloor": "ask"
}
},
"permission": {
// Unknown tools are reviewed instead of silently allowed.
"*": "ask",
"read": "allow",
"write": "allow",
"edit": "allow",
"grep": "allow",
"find": "allow",
"multi_grep": "allow",
"codegraph_explore": "allow",
"lsp_diagnostics": "allow",
"ctx_execute": "allow",
"ctx_execute_file": "allow",
"ctx_batch_execute": "allow",
"tool_search": "allow",
"ask_user_question": "allow",
// Hermes memory tools write only to the extension's own agent-directory
// stores and never touch the workspace, so they stay allowed. memory_search
// is invoked by the injected memory policy on most turns and must not
// trigger an AutoReview round trip each time.
"memory_search": "allow",
"session_search": "allow",
"memory_add": "allow",
"memory_replace": "allow",
"memory_remove": "allow",
"skill_manage": "allow",
// pi-compaction's evidence recovery reads only the extension's own segment
// index and never touches the workspace. It is pinned in Tool Search's
// alwaysEnabled set, so it must not pay an AutoReview round trip per turn.
"context_tree_query": "allow",
"ssh_connect": "ask",
"ssh_cd": "ask",
"ssh_read": "ask",
"ssh_write": "ask",
"ssh_edit": "ask",
"ssh_find": "ask",
"ssh_grep": "ask",
"path": {
"*": "allow",
".git/*": "ask"
},
"bash": {
"*": "allow",
"rg*": "deny",
"grep*": "deny",
"find*": "deny",
"fd*": "deny",
"git *": "ask",
"git status*": "allow",
"git diff*": "allow",
"git log*": "allow",
"git show*": "allow",
"git rev-parse*": "allow",
"git ls-files*": "allow",
"git grep*": "deny",
"git branch": "allow",
"git branch --show-current*": "allow",
"git remote -v": "allow",
"git remote get-url*": "allow",
"npm install *": "ask",
"npm add *": "ask",
"npm uninstall *": "ask",
"npm update *": "ask",
"pnpm install *": "ask",
"pnpm add *": "ask",
"pnpm uninstall *": "ask",
"pnpm update *": "ask",
"bun install *": "ask",
"bun add *": "ask",
"bun uninstall *": "ask",
"bun update *": "ask",
"pip install *": "ask",
"pip3 install *": "ask",
"brew install *": "ask",
"brew uninstall *": "ask",
"rm *": "ask",
"/bin/rm *": "ask",
"rmdir *": "ask",
"/bin/rmdir *": "ask",
"unlink *": "ask",
"/usr/bin/unlink *": "ask",
"mv *": "ask",
"/bin/mv *": "ask",
"truncate *": "ask",
"dd *": "ask",
"chmod *": "ask",
"chown *": "ask",
"sudo *": "ask",
"su *": "ask",
"kill *": "ask",
"pkill *": "ask",
"diskutil *": "ask",
"security *": "ask",
"launchctl *": "ask",
"osascript *": "ask",
"open *": "ask",
"ssh *": "ask",
"scp *": "ask",
"sftp *": "ask",
"rsync *": "ask",
"curl *": "ask",
"wget *": "ask",
"printenv*": "ask"
},
"mcp": {
"*": "ask",
"mcp_status": "allow",
"mcp_list": "allow"
},
"skill": {
"*": "allow"
}
}
}