Repository navigation
如何工具运行在workspace之外的路径 (指定项目路径) #3522
|
根据你当前的 sandbox 安全策略(已在 MEMORY.md 中明确固化为硬性规则): ✅ 所有文件工具(如 read_file, list_files, glob_files, grep_files)仅允许访问以下两个根路径内的文件:
|
Replies: 1 comment 2 replies
|
With the config you pasted, the framework already allows D:/zxq/agent/QCodeTest. The refusal you quoted looks like it comes from the model, not from the filesystem layer. In ROOTED mode, absolute paths are accepted when they fall under the project root, the workspace, or any extra roots. Your message says the allowed roots are QCode and So the likely cause is that MEMORY.md in your workspace contains that "hard rule" text, and the model is obeying it. Edit or remove that section of MEMORY.md, or clear the old memory, and the agent should stop refusing. If it still gets a real error from a tool, paste the exact tool error. A model's own explanation is not evidence of what the tool enforces. To give the agent several directories, keep one as new LocalFilesystemSpec()
.project(Path.of("D:/zxq/agent/QCodeTest"))
.addRoot(Path.of("D:/zxq/agent/QCode"))
.mode(LocalFsMode.ROOTED)
.projectWritable(true)
Two other notes:
(I looked this up in the code with help from an AI assistant; the links are to the lines I checked.) |
With the config you pasted, the framework already allows D:/zxq/agent/QCodeTest. The refusal you quoted looks like it comes from the model, not from the filesystem layer.
In ROOTED mode, absolute paths are accepted when they fall under the project root, the workspace, or any extra roots.
LocalFilesystemSpec.toFilesystembuilds that list from exactly those three sources, so your.project(Path.of("D:/zxq/agent/QCodeTest"))is in the allow-list:agentscope-java/agentscope-harness/src/main/java/io/agentscope/harness/agent/filesystem/spec/LocalFilesystemSpec.java
Lines 325 to 329 in 44ec9e7