File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 159159 all-tools))
160160 {:keys [allow ask byDefault]} (get-in config [:toolCall :approval ])]
161161 (cond
162- require-approval-fn
163- ( require-approval-fn args { :db db})
162+ ( and require-approval-fn ( require-approval-fn args { :db db}))
163+ true
164164
165165 (some #(approval-matches? % server tool-call-name args) ask)
166166 true
Original file line number Diff line number Diff line change 7272 {:name " download" :server " web" }]]
7373 (testing " tool has require-approval-fn which returns true"
7474 (is (true ? (f.tools/manual-approval? all-tools " eca_shell" {} {} {}))))
75- (testing " tool has require-approval-fn which returns false"
76- (is (false ? (f.tools/manual-approval? all-tools " eca_plan" {} {} {}))))
75+ (testing " tool has require-approval-fn which returns false we ignore it "
76+ (is (true ? (f.tools/manual-approval? all-tools " eca_plan" {} {} {}))))
7777 (testing " if legacy-manual-approval present, considers it"
7878 (is (true ? (f.tools/manual-approval? all-tools " request" {} {} {:toolCall {:manualApproval true }}))))
7979 (testing " if approval config is provided"
9191 {:toolCall {:approval {:allow {" web__request" {:argsMatchers {" url" [" .*foo.*" ]}}}}}}))))
9292 (testing " has arg and matches"
9393 (is (false ? (f.tools/manual-approval? all-tools " request" {" url" " http://foo.com" } {}
94- {:toolCall {:approval {:allow {" web__request" {:argsMatchers {" url" [" .*foo.*" ]}}}}}}))))
94+ {:toolCall {:approval {:allow {" web__request" {:argsMatchers {" url" [" .*foo.*" ]}}}}}})))
95+ (is (false ? (f.tools/manual-approval? all-tools " request" {" url" " foobar" } {}
96+ {:toolCall {:approval {:allow {" web__request" {:argsMatchers {" url" [" foo.*" ]}}}}}}))))
9597 (testing " has not that arg"
9698 (is (true ? (f.tools/manual-approval? all-tools " request" {" crazy-url" " http://foo.com" } {}
9799 {:toolCall {:approval {:allow {" web__request" {:argsMatchers {" url" [" .*foo.*" ]}}}}}}))))))
You can’t perform that action at this time.
0 commit comments