mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-02 07:03:45 +00:00
chore: cleanup external_dir perm logic (#11845)
This commit is contained in:
@@ -128,7 +128,10 @@ export const BashTool = Tool.define("bash", async () => {
|
||||
process.platform === "win32" && resolved.match(/^\/[a-z]\//)
|
||||
? resolved.replace(/^\/([a-z])\//, (_, drive) => `${drive.toUpperCase()}:\\`).replace(/\//g, "\\")
|
||||
: resolved
|
||||
if (!Instance.containsPath(normalized)) directories.add(normalized)
|
||||
if (!Instance.containsPath(normalized)) {
|
||||
const dir = (await Filesystem.isDir(normalized)) ? normalized : path.dirname(normalized)
|
||||
directories.add(dir)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,10 +144,11 @@ export const BashTool = Tool.define("bash", async () => {
|
||||
}
|
||||
|
||||
if (directories.size > 0) {
|
||||
const globs = Array.from(directories).map((dir) => path.join(dir, "*"))
|
||||
await ctx.ask({
|
||||
permission: "external_directory",
|
||||
patterns: Array.from(directories),
|
||||
always: Array.from(directories).map((x) => path.dirname(x) + "*"),
|
||||
patterns: globs,
|
||||
always: globs,
|
||||
metadata: {},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user