mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
系统提示词封面(新增能力):
- extensions/system-prompt-cover.ts:读取 ~/.pi/agent/SYSTEM_COVER.md,
在 before_agent_start 返回 { systemPrompt },用文本拼接替换 Pi 默认
系统提示词的开头,同时保留 tools / rules / docs / skills /
project_context / cwd 全部分区及其原始顺序。
- 必须走 forceSystemPrompt 投影路径。customPrompt 选项会连带抑制
tools / rules / docs 三个分区,而回填只能追加到末尾,无法恢复原顺序;
且 forceSystemPrompt 优先级更高,二者同时存在时 customPrompt 会被
静默忽略,因此 handler 不得写 customPrompt。
- 分割边界要求独占一行的裸标签:<project_instructions path="..."> 嵌套在
<project_context> 内,只有裸标签才是分区边界。
- 注册在 tool-routing 之前,否则提示词已被压平,改 systemPromptOptions
不再影响本轮请求。
- scripts/deploy-system-prompt-cover.mjs:同目录临时文件 + rename 原子
覆盖,不保留备份;install.sh 从脚本目录、update.sh 从升级后组合包
定位 helper,禁止回退到可能陈旧的脚本目录。
- 封面缺失、不可读或空白时静默 no-op,Pi 行为保持不变;封面每轮重新
读取,修改后在下一轮生效,不影响已结束的历史对话。
pi-compaction 投影修正:
- 仅在「摘要 + Source 行」严格短于原文时才替换工具结果。此前命中即
无条件替换,小结果反而被包壳放大;未替换的结果完整保留原始 content
parts(含非文本部分)。
- deterministic.maxStubTokens 由 256 提升到 1024。
pi-tool-search 常驻工具:
- alwaysEnabled 增加 context_tree_query:恢复被投影的工具证据不应依赖
一次 tool_search 激活,常驻同时保持请求前缀稳定。
- BUNDLE_TOOL_SEARCH_DEFAULTS_VERSION 由 3 提升到 4;
scripts/migrate-tool-search-settings.mjs 新增 version-3 快照常量,
使其与 version-2 一样可被完整精确匹配并迁移。
- 权限策略为 context_tree_query 显式 allow:它只读扩展自己的 segment
索引、不触碰工作区,常驻后不应每轮触发 AutoReview 往返。该种子仅在
全新安装时部署,已存在的用户 policy.jsonc 不会被覆盖。
文档与测试同步:
- AGENTS.md:新增 system-prompt-cover 开发约定,修正加载顺序、
bundleDefaultsVersion、可迁移旧快照集合与常驻工具范围的描述。
- pi-tool-search 的 README / CHANGELOG 同步 version 4 与新增常驻工具。
- tests/system-prompt-cover.test.ts:覆盖顺序保持、尾部逐字节不变、
嵌套 project_instructions 不误判、部署幂等与覆盖、缺源时非零退出。
- 修正 pi-tool-search/test/config.test.ts 与
tests/tool-search-settings-migration.test.ts 中写死的 version 3 与
工具列表断言。
- update-git-clean-recovery / tool-search-settings-migration 的 mock
组合包补拷 scripts/,与真实发布包结构一致,避免 helper 定位失败。
测试:根 61/61、pi-compaction 36/36 + tsc、pi-tool-search 16/16 + tsc、
pi-permission-system 2577/2577;sh -n 与 git diff --check 通过。
139 lines
3.7 KiB
JSON
139 lines
3.7 KiB
JSON
{
|
|
"debugLog": false,
|
|
"permissionReviewLog": true,
|
|
"yoloMode": false,
|
|
"doublePressToConfirm": true,
|
|
|
|
// AutoReview is the default authority for deterministic review decisions.
|
|
// Automatic review stays inactive until you name both a provider and a model
|
|
// here; until then every ask goes to the human permission prompt.
|
|
"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"
|
|
}
|
|
}
|
|
}
|