feat(pi-overflow): 新增统一的新工具结果展示截断扩展

此前截断分散在多层且互相冲突:Pi bash 保留尾部 50KB,RTK 兜底截断又只留
开头 12000 字符(砍掉报错与完整输出路径),pi-chrome 截开头 30K,web_fetch
各 provider 不一致。新扩展统一负责"新结果给模型看多少":
- capture.ts 最先加载暂存原文,index.ts 最后加载(system-prompt 之前)
- 超过 24K 字符时原文落盘 <agentDir>/my-pi/pi-overflow/(700/600、原子写),
  优先取 bash fullOutputPath 完整文件;模型看到 头 + 中段信号行 + 尾 的有界
  视图,行号基于落盘原文、结尾永远可见
- overflow_query:按 id 正则搜索、行区间、jsonPath 只读查询,id 校验防穿越
- 收编:RTK truncate 默认关闭、删除 pi-chrome truncateText、web_fetch 默认
  每页 20000(上限 100000)、web_search max_results 限定 1–20
- pi-compaction 遮蔽带 details.overflow.id 的结果时在占位符提示 overflow_query
- 登记 tools.jsonc / routing / 权限 allow / tool-search 常驻与分组

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
云服务部-叶林立
2026-10-21 20:25:44 -07:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent a6d8416c76
commit 2a6bf8c929
44 changed files with 1882 additions and 34 deletions
+13
View File
@@ -0,0 +1,13 @@
{
"enabled": true,
"thresholdChars": 24000,
"headLines": 40,
"tailLines": 120,
"maxSignalLines": 40,
"signalPattern": "\\b(error|errors|fail|failed|failure|warn|warning|exception|traceback|panic|fatal)\\b",
"maxLineChars": 500,
"exemptTools": ["read", "edit", "write", "overflow_query", "ask_user_question"],
"retentionDays": 7,
"maxStoreBytes": 1073741824,
"maxEntryBytes": 67108864
}
+3
View File
@@ -86,6 +86,9 @@
// 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",
// pi-overflow's inspector reads only the extension's own stored output
// directory (id-validated); pinned in Tool Search's alwaysEnabled set.
"overflow_query": "allow",
// Model-chosen URLs can exfiltrate data — same reason curl/wget ask.
"web_fetch": "ask",
+4
View File
@@ -65,6 +65,10 @@
"whenAll": ["chrome_snapshot", "ctx_execute_file"],
"text": "After chrome_snapshot or a Chrome action with includeSnapshot=true, immediately analyze the returned workspace-relative capture path with ctx_execute_file; never use read or cat for the raw JSON. Print only the uids, text, or state needed for the next action, and take a fresh snapshot after any interaction because the previous capture may be stale."
},
{
"whenAny": ["overflow_query"],
"text": "When a tool result starts with or ends with a [pi-overflow id=…] marker, the full original output is stored; inspect it with overflow_query (search, line ranges, or jsonPath) instead of re-running the command or dumping it again."
},
{
"whenAny": ["read"],
"text": "Use read only when exact source is needed or the file is small. Before editing, request the smallest useful offset/limit range; do not read a complete large file merely to copy, compare, hash, count, explore, or summarize it."
+1
View File
@@ -62,6 +62,7 @@
"memory_remove": { "inherit": true },
"skill_manage": { "inherit": true },
"context_tree_query": { "inherit": true },
"overflow_query": { "inherit": true },
"ask_user_question": { "inherit": true },
+1 -1
View File
@@ -11,7 +11,7 @@
"enabled": false
},
"truncate": {
"enabled": true,
"enabled": false,
"maxChars": 12000
},
"sourceCodeFilteringEnabled": false,
+2 -1
View File
@@ -11,7 +11,8 @@
"memory_replace",
"memory_remove",
"skill_manage",
"context_tree_query"
"context_tree_query",
"overflow_query"
],
"showToolSearchFooterStatus": false,
"maxActiveGroups": 5,