mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-24 17:44:49 +00:00
fix: Add apply_patch to EDIT_TOOLS filter (#18009)
This commit is contained in:
@@ -69,7 +69,7 @@ export namespace PermissionNext {
|
|||||||
return S.evaluate(permission, pattern, ...rulesets)
|
return S.evaluate(permission, pattern, ...rulesets)
|
||||||
}
|
}
|
||||||
|
|
||||||
const EDIT_TOOLS = ["edit", "write", "patch", "multiedit"]
|
const EDIT_TOOLS = ["edit", "write", "apply_patch", "multiedit"]
|
||||||
|
|
||||||
export function disabled(tools: string[], ruleset: Ruleset): Set<string> {
|
export function disabled(tools: string[], ruleset: Ruleset): Set<string> {
|
||||||
const result = new Set<string>()
|
const result = new Set<string>()
|
||||||
|
|||||||
@@ -395,9 +395,9 @@ test("disabled - disables tool when denied", () => {
|
|||||||
expect(result.has("read")).toBe(false)
|
expect(result.has("read")).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("disabled - disables edit/write/patch/multiedit when edit denied", () => {
|
test("disabled - disables edit/write/apply_patch/multiedit when edit denied", () => {
|
||||||
const result = PermissionNext.disabled(
|
const result = PermissionNext.disabled(
|
||||||
["edit", "write", "patch", "multiedit", "bash"],
|
["edit", "write", "apply_patch", "multiedit", "bash"],
|
||||||
[
|
[
|
||||||
{ permission: "*", pattern: "*", action: "allow" },
|
{ permission: "*", pattern: "*", action: "allow" },
|
||||||
{ permission: "edit", pattern: "*", action: "deny" },
|
{ permission: "edit", pattern: "*", action: "deny" },
|
||||||
@@ -405,7 +405,7 @@ test("disabled - disables edit/write/patch/multiedit when edit denied", () => {
|
|||||||
)
|
)
|
||||||
expect(result.has("edit")).toBe(true)
|
expect(result.has("edit")).toBe(true)
|
||||||
expect(result.has("write")).toBe(true)
|
expect(result.has("write")).toBe(true)
|
||||||
expect(result.has("patch")).toBe(true)
|
expect(result.has("apply_patch")).toBe(true)
|
||||||
expect(result.has("multiedit")).toBe(true)
|
expect(result.has("multiedit")).toBe(true)
|
||||||
expect(result.has("bash")).toBe(false)
|
expect(result.has("bash")).toBe(false)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user