Merge pull request 'fix(sessions): unify dual suspension systems, wire approve to agentic_resume' (#18) from fix/agentic-tool-approval-unification into main
fix(sessions): unify dual suspension systems, wire approve to agentic_resume
This commit was merged in pull request #18.
This commit is contained in:
@@ -691,7 +691,13 @@ fn agentic_loop(session_id: String, model: String, safe_sys: String, tools_json:
|
||||
// A real tool turn that targets a tool the soul cannot run in-process is a
|
||||
// CLIENT bridge: suspend the loop and hand the tool to the client.
|
||||
let is_tool_turn: Bool = str_eq(stop_reason, "tool_use") && has_tool
|
||||
let needs_bridge: Bool = is_tool_turn && !is_builtin_tool(tool_name)
|
||||
// If the user previously chose "always allow" for this tool in this session,
|
||||
// treat it like a builtin — run server-side via dispatch_tool and skip the
|
||||
// bridge suspension entirely so the approval UI is never shown again.
|
||||
let always_key: String = "always_allow_" + session_id
|
||||
let always_list: String = if !str_eq(session_id, "") { state_get(always_key) } else { "" }
|
||||
let is_always_allowed: Bool = !str_eq(tool_name, "") && !str_eq(always_list, "") && str_contains(always_list, tool_name)
|
||||
let needs_bridge: Bool = is_tool_turn && !is_builtin_tool(tool_name) && !is_always_allowed
|
||||
|
||||
// Built-in tools dispatch locally; bridged tools yield "" (never sent upstream).
|
||||
let tool_result_raw: String = if is_tool_turn && !needs_bridge { dispatch_tool(tool_name, tool_input) } else { "" }
|
||||
|
||||
Reference in New Issue
Block a user