mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
feat(prompt): 重新注册 bash,把"不要用 bash 搜索"写进工具描述
真实会话里模型仍习惯性先调 bash grep,被拒后才改用 grep 工具;系统提示词里已有 4 处 提醒,但模型下调用决定时看的是工具 schema 描述,而 Pi 内置 bash 描述对此只字未提。 - 新增 extensions/bash-override.ts:用 Pi 的 createBashToolDefinition 重新注册 bash, 执行、输出结构与 codemode 说明完全沿用上游;shellPath/commandPrefix 按 ctx.cwd 经 SettingsManager 惰性解析,与内置一致 - tools.jsonc 新增 descriptionAppend 字段,由 prompt-guard 注册时拼接到上游描述后 - bash 增加命令→工具对照规则(grep -n / grep -rl / find -name),并提示 文件清单用 $(git ls-files) 传参、不要接 xargs(会触发权限审核) Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
2b21163a18
commit
87940da51a
@@ -2,17 +2,26 @@
|
||||
// Bundle-authoritative tool guidance, owned by extensions/system-prompt.ts.
|
||||
//
|
||||
// Every tool the bundle can expose must have an entry. Per field:
|
||||
// "snippet" — replaces the tool's one-line <tools> entry (null hides it)
|
||||
// "guidelines" — replaces the tool's <rules> lines
|
||||
// "description" — replaces the tool description at registration; only
|
||||
// applied to third-party tools loaded through a bundle
|
||||
// adapter (in-repo tools edit their own source instead)
|
||||
// "snippet" — replaces the tool's one-line <tools> entry (null hides it)
|
||||
// "guidelines" — replaces the tool's <rules> lines
|
||||
// "description" — replaces the tool description at registration
|
||||
// "descriptionAppend" — appended to the description at registration (on top
|
||||
// of "description" when both are set)
|
||||
// "description"/"descriptionAppend" only apply to tools registered through a
|
||||
// bundle adapter (prompt-guard), which includes the bash override and the
|
||||
// third-party wrappers; other in-repo tools edit their own source instead.
|
||||
// An absent field keeps the upstream text. "inherit": true means the
|
||||
// upstream text was reviewed against this bundle and is kept as-is.
|
||||
"version": 1,
|
||||
"tools": {
|
||||
"bash": {
|
||||
"snippet": "Run shell commands for builds, tests, git, package scripts, and other programs; search files with the find/grep tools, not bash"
|
||||
"snippet": "Run shell commands for builds, tests, git, package scripts, and other programs; search files with the find/grep tools, not bash",
|
||||
"descriptionAppend": "Not for searching files: use the grep tool for file contents and the find tool for paths (e.g. `grep -n X src/*.ts` → grep {pattern: \"X\", path: \"src/*.ts\"}); grep, rg, find, fd, and git grep are denied here. When a program needs many files, pass $(git ls-files '<glob>') as arguments instead of piping into xargs, which triggers a permission review.",
|
||||
"guidelines": [
|
||||
"You can inspect PI_* environment variables for current model and session details.",
|
||||
"Search commands are denied in bash; call the tools instead: `grep -n X src/*.ts` → grep {pattern: \"X\", path: \"src/*.ts\"}; `grep -rl X src` → grep {pattern: \"X\", path: \"src/\"} and take the file names; `find . -name '*.ts'` → find {pattern: \"\", path: \"**/*.ts\"}.",
|
||||
"When a program needs many files (wc, node, tsc), pass $(git ls-files '<glob>') as arguments; piping into xargs triggers a permission review."
|
||||
]
|
||||
},
|
||||
"read": { "inherit": true },
|
||||
"edit": {
|
||||
|
||||
Reference in New Issue
Block a user