File tree Expand file tree Collapse file tree 4 files changed +16
-5
lines changed
Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ - Support manual approval for specific tools. #44
6+
57## 0.25.0
68
79- Improve plan-mode to do file changes with diffs.
Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ interface Config {
205205 };
206206 disabledTools: string [],
207207 toolCall? : {
208- manualApproval? : boolean ,
208+ manualApproval? : boolean | string [], // manual approve all tools or the specified tools
209209 };
210210 mcpTimeoutSeconds: number ;
211211 mcpServers: {[key : string ]: {
@@ -255,7 +255,7 @@ interface Config {
255255 " excludeCommands" : []}},
256256 " disabledTools" : [],
257257 " toolCall" : {
258- " manualApproval" : false ,
258+ " manualApproval" : null ,
259259 },
260260 " mcpTimeoutSeconds" : 10 ,
261261 " mcpServers" : [],
Original file line number Diff line number Diff line change 107107 :state :running
108108 :text " Parsing given context" }))
109109 (let [db @db*
110- manual-approval? (get-in config [:toolCall :manualApproval ] false )
111110 all-models (models/all )
112111 provider (get-in all-models [model :provider ])
113112 rules (f.rules/all config (:workspace-folders db))
175174 :origin (tool-name->origin name all-tools)
176175 :arguments-text (get-in @tool-call-by-id* [id :args ])
177176 :id id
178- :manual-approval manual-approval?}
177+ :manual-approval ( f.tools/ manual-approval? name config) }
179178 :summary (f.tools/tool-call-summary all-tools name nil ))))
180179 :on-tools-called (fn [tool-calls]
181180 (assert-chat-not-stopped! chat-ctx)
188187 (let [approved?* (promise )
189188 details (f.tools/get-tool-call-details name arguments)
190189 summary (f.tools/tool-call-summary all-tools name arguments)
191- origin (tool-name->origin name all-tools)]
190+ origin (tool-name->origin name all-tools)
191+ manual-approval? (f.tools/manual-approval? name config)]
192192 ; ; Inform UI the tool is about to run and store approval promise
193193 (send-content! chat-ctx :assistant
194194 (assoc-some
Original file line number Diff line number Diff line change 112112 (assoc :type :mcp )
113113 (update :tools #(mapv with-tool-status %)))))})))
114114
115+ (defn manual-approval? [name config]
116+ (let [manual-approval? (get-in config [:toolCall :manualApproval ] nil )]
117+ (logger/info manual-approval?
118+ (coll? manual-approval?)
119+ name)
120+ (if (coll? manual-approval?)
121+ (some #(= name (str %)) manual-approval?)
122+ manual-approval?)))
123+
115124(defn tool-call-summary [all-tools name args]
116125 (when-let [summary-fn (:summary-fn (first (filter #(= name (:name %))
117126 all-tools)))]
You can’t perform that action at this time.
0 commit comments