api.tools

删除文档

tools: { delete_document: api.tools.deleteDocument }

让运行从调用器计算机的视图中移除文件或文件夹, 将其变成回收箱, 而不是不存在的回收箱。

declaration onlyfreerecoverable
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

声明A,四个不是它的名字所暗示的: 没有什么被摧毁。

模型发送的内容

pathstring必填

相对于工作空间,要删除的文件或文件夹 。

// What the run reports back
{ path: "Launch plan/draft.md",
  trash: ".trash/2026-10-07T09-12-44-000Z/Launch plan/draft.md" }
# What the run reports back
{"path": "Launch plan/draft.md",
 "trash": ".trash/2026-10-07T09-12-44-000Z/Launch plan/draft.md"}

是一个移动到. 倾斜

这个项目后来 .trash/<timestamp>/<original path>。时间戳是将同一路径的两条删除分开的标志,而原始路径则被保存在下面,因此恢复就是返回。

// Restoring what a run removed
const trashed = ".trash/2026-10-07T09-12-44-000Z/Launch plan/draft.md";
await pc.files.move(trashed, "Launch plan/draft.md");
# Restoring what a run removed
trashed = ".trash/2026-10-07T09-12-44-000Z/Launch plan/draft.md"
pc.files.move(trashed, "Launch plan/draft.md")
隐藏文件夹不在列表中

点名被跳过 files.list(),所以垃圾箱不会作为工作出现。阅读它是一个命名问题——这就是没有第二个机制就有可能恢复的原因。

为什么跑跑从不删除真的

代理人在它所读的文字上行事——一页、一份文件、它被指示。错误的步骤不应该是最后的,而没有示范判断值值得文件。因此,完全没有宣布破坏性行动:所宣布的是可逆的。

清空垃圾箱是你们自己做的

空无清 .trash 自己决定何时真的有东西消失,

for (const batch of await pc.files.list(".trash")) {
  if (Date.parse(batch.name.replace(/-(\d{3})Z$/, ".$1Z")) < Date.now() - 30 * 86_400_000) {
    await pc.files.remove(`.trash/${batch.name}`);
  }
}
import shutil, time

# Python's list() hides dot folders: walk .trash from the workspace root
month_ago = time.time() - 30 * 86_400
for batch in (pc.files.root / ".trash").iterdir():
    if batch.stat().st_mtime < month_ago:
        shutil.rmtree(batch)
它通过电话机的电脑 和包件运行

服务器无法到达磁盘。 当代理器调用此功能时, 运行会要求持有密钥的机器执行它, 软件包在那里工作, 答案会回到运行中。 所以只有在您的程序正在监听时它才会起作用, 并且文件的任何一个内容都不会被写入 。

拒绝运行报告

  • 这条路没有
  • 工作空间以外的路径,或者绝对路径。
  • 工作空间根 。
  • 已经在同一时间持有相同路径的文件夹项 。