feat(tools): 复活 list_directory/copy_path 开 @<会话id> 只读历史通道;recall 收敛纯记忆三 op

- recall 删 files/link 两 op(沙箱外克隆必漂移:link 漏抄 mint_public_link 的
  realpath 符号链接防线,整删即消洞);description 重写:去跨工具越权指引与
  重复细节,补纯文本返回契约与空态语义;count 补 minimum/maximum/default
- list_directory:单层 ls、≤200 条、隐藏项不列;'@<sid>/<rel>' 列历史会话,
  条目输出 @sid/ 全形路径可直抄进 copy_path
- copy_path:历史成果唯一进口。resolvePastPath 校验单点(形状+存在+同用户);
  目标拒 @(历史只读、写只进本会话)、撞名拒覆盖、预算 200 文件/200MB、
  符号链接整趟拒绝防逃逸;导入后 read_file/vision/mint 全量生效,零核心沙箱改动
- advising:阶段硬闸名单加入 copy_path,白名单点名放行 list_directory
- definitions 保持按 name 字母序;ARCHITECTURE 记部分复活与撤销理由
  (生产 terminal 在远端 executor 容器,host-tasks 被 wrapper unmount,
  当年「统一走 terminal」的删除理由不覆盖跨会话场景)
- 验证:harness 23/23(@ 下钻/跨用户/撞名/symlink/退役 op 回归);node --check 全过

版本 2.2.0 → 2.3.0
This commit is contained in:
2026-09-30 09:44:14 +08:00
parent ba4b1149aa
commit 419008597d
7 changed files with 209 additions and 65 deletions
+3 -2
View File
@@ -345,7 +345,8 @@ function effectiveTools(profileName) {
// ---------- 阶段(sessions.phase:advising 顾问 / executing 执行) ----------
// advising:新建会话与「清空」的落点。profile 被 resolveProfileName 强制为 'advising',
// 只聊和读不写(write_file/edit_file 不在其 schema,批内幻觉调用也在 runLoopInner 挡下);
// 只聊和读不写(write_file/edit_file/copy_path 不在其 schema,批内幻觉调用也在 runLoopInner 挡下;
// list_directory 在白名单里——顾问翻阅历史目录正当其用);
// 唯一出口 = handoff 工具成功返回(brief 由 handler 落盘任务目录根 task.md,见 tools/executor.js)。
// executing:一路走到底,只有清空才回 advising;压缩不碰 phase(压完仍回原模式)。
@@ -783,7 +784,7 @@ async function runLoopInner(sessionId, run) {
output = chk.error;
isError = true;
} else if (session.phase === 'advising'
&& (tc.function.name === 'write_file' || tc.function.name === 'edit_file')) {
&& (tc.function.name === 'write_file' || tc.function.name === 'edit_file' || tc.function.name === 'copy_path')) {
// 顾问单入口硬约束:写类工具不在其 schema,但「名单外照跑」是全局策略(executeTool 全表),
// 幻觉调用会真写文件、绕过出口制造假承诺——阶段契约优先,挡下并指向 handoff。
output = 'Error: 顾问阶段不能写文件。任务书请通过 handoff 工具的 brief 参数提交。';