File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -429,6 +429,12 @@ impl Agents {
429429
430430 local_agents. append ( & mut global_agents) ;
431431
432+ // If we are told which agent to set as active, we will fall back to a default whose
433+ // lifetime matches that of the session
434+ if agent_name. is_none ( ) {
435+ local_agents. push ( Agent :: default ( ) ) ;
436+ }
437+
432438 let _ = output. flush ( ) ;
433439
434440 Self {
@@ -443,8 +449,10 @@ impl Agents {
443449
444450 /// Returns a label to describe the permission status for a given tool.
445451 pub fn display_label ( & self , tool_name : & str , origin : & ToolOrigin ) -> String {
452+ error ! ( "## perm: name: display_label called" ) ;
446453 let tool_trusted = self . get_active ( ) . is_some_and ( |a| {
447454 a. allowed_tools . iter ( ) . any ( |name| {
455+ error ! ( "## perm: name: {name}, tool_name: {tool_name}" ) ;
448456 // Here the tool names can take the following forms:
449457 // - @{server_name}{delimiter}{tool_name}
450458 // - native_tool_name
Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ impl ToolsArgs {
110110 } )
111111 . collect :: < BTreeSet < _ > > ( ) ;
112112
113+ tracing:: error!( "## perm: command called" ) ;
113114 let to_display = sorted_tools. iter ( ) . fold ( String :: new ( ) , |mut acc, tool_name| {
114115 let width = longest - tool_name. len ( ) + 4 ;
115116 acc. push_str (
@@ -356,11 +357,22 @@ impl ToolsSubcommand {
356357 {
357358 active_agent. allowed_tools = orig_agent. allowed_tools ;
358359 }
360+ } else if session
361+ . conversation
362+ . agents
363+ . get_active ( )
364+ . is_some_and ( |a| a. name . as_str ( ) == "default" )
365+ {
366+ // We only want to reset the tool permission and nothing else
367+ if let Some ( active_agent) = session. conversation . agents . get_active_mut ( ) {
368+ active_agent. allowed_tools = Default :: default ( ) ;
369+ active_agent. tools_settings = Default :: default ( ) ;
370+ }
359371 }
360372 queue ! (
361373 session. stderr,
362374 style:: SetForegroundColor ( Color :: Green ) ,
363- style:: Print ( "\n Reset all tools to the permission levels as defined in persona ." ) ,
375+ style:: Print ( "\n Reset all tools to the permission levels as defined in agent ." ) ,
364376 style:: SetForegroundColor ( Color :: Reset ) ,
365377 ) ?;
366378 } ,
You can’t perform that action at this time.
0 commit comments