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
+47 -14
View File
@@ -1,4 +1,28 @@
[
{
"type": "function",
"function": {
"name": "copy_path",
"description": "Copies a file or directory, preserving the original; directories are copied recursively. More efficient than reading then writing contents. Returns confirmation with the destination path.\n\nImport past work: source_path accepts '@<session-id>/<rel>' to copy from your OWN past session (id from a diary fragment's 【…】 heading; use recall to find it, list_directory to browse it). destination_path never accepts '@' — past stays read-only, imports land in the current session directory. The destination must not exist yet; nothing is overwritten (pick a new name, or delete yours first via terminal).\n\nAfter import the file is fully local: read_file (including images via vision), terminal, mint_public_link all work on it.\n\nLimits per call: ≤200 MB total, ≤200 files for a directory tree; symlinks are refused (as a source or inside a copied tree) to prevent escaping the directory.",
"parameters": {
"type": "object",
"required": [
"source_path",
"destination_path"
],
"properties": {
"source_path": {
"type": "string",
"description": "File or directory to copy, relative to the session working directory (absolute paths inside it accepted). '@<session-id>/<rel>' imports from a same-user past session."
},
"destination_path": {
"type": "string",
"description": "Where to place the copy inside the CURRENT session directory (relative, or absolute inside it). '@' paths are rejected here. Must not already exist."
}
}
}
}
},
{
"type": "function",
"function": {
@@ -173,6 +197,22 @@
}
}
},
{
"type": "function",
"function": {
"name": "list_directory",
"description": "Lists the entries directly inside one directory (one level, like `ls`): folders and files, sorted; hidden entries (starting with '.') omitted; max 200 per call — go deeper by passing a deeper path.\n\npath is relative to the session working directory (absolute paths inside it accepted); empty/omitted lists the current task directory.\n\nPast sessions: '@<session-id>/<rel>' lists a PAST session's own directory, same user only (read-only view). The id is the 【…】 heading of a diary fragment — find it with recall op=search. In '@' mode entries are printed as complete '@<session-id>/...' paths — copy them straight into copy_path's source_path.",
"parameters": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "Directory to list, relative to the session working directory. Absolute paths accepted. '@<session-id>/<rel>' lists that past session's directory (same user only; id from a diary fragment's 【…】 heading)."
}
}
}
}
},
{
"type": "function",
"function": {
@@ -246,7 +286,7 @@
"type": "function",
"function": {
"name": "recall",
"description": "Access your long-term memory: the work diary. Each finished session leaves one short fragment (a few dozen characters, headed by the source session id), stored permanently; only the newest fragments were injected at session start. When the user vaguely recalls something from the past, search is your primary entry — you cannot know what you have forgotten. Read-only.\n\nop=search Requires query (keywords; space-separated words rank better, e.g. '身份证 水印'). Fuzzy fragment-level match across ALL dates (Chinese tolerant to partial phrases), best matches first. Optional count (default 10, max 30).\nop=days No arguments. Index of diary days (date + fragment count) — use when the user remembers roughly WHEN but not what; then op=day.\nop=day Requires date (YYYY-MM-DD, as listed by op=days). Full fragments of that day.\nop=files Requires id (the session id from a diary fragment's 【…】 heading). Files of that past session that still exist on disk right now.\nop=link Requires id and path (a name from op=files). Mint a temporary download link.",
"description": "Access your long-term memory: the work diary. Each finished session leaves one short fragment (a few dozen chars) there, headed by its source session id in 【…】; fragments are kept permanently, but only the newest were injected at session start — recall reads the whole archive on demand. Read-only.\n\nop=search Fuzzy keyword match over ALL fragments, best first. Primary entry when the user vaguely recalls something — you cannot know what you have forgotten.\nop=days Index of days that have entries (newest first) — when the user remembers roughly WHEN but not what.\nop=day Full fragments of one day.\n\nReturns are plain text: search hits print '--- date (match%) ---' followed by 【id】 and the fragment; days list '- date(n 条)'; day lists fragments. A miss comes back as a short 'no records / no diary' line — a normal answer, not an error.",
"parameters": {
"type": "object",
"required": [
@@ -258,31 +298,24 @@
"enum": [
"search",
"days",
"day",
"files",
"link"
"day"
],
"description": "What to recall: search = keyword fuzzy over all diary fragments (primary); days = which dates have entries; day = one date's full diary; files = a past session's current artifacts; link = a download link for one of them."
"description": "Recall operation; what each op does is in the tool description."
},
"query": {
"type": "string",
"description": "op=search: keywords to look for (space-separated words rank best, e.g. '身份证 水印'). Chinese and English both supported, case-insensitive."
"description": "op=search: keywords; space-separated words rank best (e.g. '身份证 水印'). Chinese and English, case-insensitive; Chinese tolerates partial phrases."
},
"count": {
"type": "integer",
"minimum": 1,
"maximum": 30,
"default": 10,
"description": "op=search: max fragments to return (default 10, max 30)."
},
"date": {
"type": "string",
"description": "op=day: the day to open, YYYY-MM-DD exactly as shown by op=days."
},
"id": {
"type": "string",
"description": "op=files / op=link: the source session id as written inside a diary fragment's 【…】 heading (e.g. 'task-20260929-003')."
},
"path": {
"type": "string",
"description": "op=link: file name inside that session's task directory, exactly as listed by op=files."
}
}
}