@@ -292,22 +292,56 @@ fn format_model_switch_report(previous: &str, next: &str, message_count: usize)
292292}
293293
294294fn format_permissions_report ( mode : & str ) -> String {
295+ let modes = [
296+ ( "read-only" , "Read/search tools only" , mode == "read-only" ) ,
297+ (
298+ "workspace-write" ,
299+ "Edit files inside the workspace" ,
300+ mode == "workspace-write" ,
301+ ) ,
302+ (
303+ "danger-full-access" ,
304+ "Unrestricted tool access" ,
305+ mode == "danger-full-access" ,
306+ ) ,
307+ ]
308+ . into_iter ( )
309+ . map ( |( name, description, is_current) | {
310+ let marker = if is_current {
311+ "● current"
312+ } else {
313+ "○ available"
314+ } ;
315+ format ! ( " {name:<18} {marker:<11} {description}" )
316+ } )
317+ . collect :: < Vec < _ > > ( )
318+ . join (
319+ "
320+ " ,
321+ ) ;
322+
295323 format ! (
296324 "Permissions
297- Current mode {mode}
325+ Active mode {mode}
326+ Mode status live session default
298327
299- Available modes
300- read-only Allow read/search tools only
301- workspace-write Allow editing within the workspace
302- danger-full-access Allow unrestricted tool access"
328+ Modes
329+ {modes}
330+
331+ Usage
332+ Inspect current mode with /permissions
333+ Switch modes with /permissions <mode>"
303334 )
304335}
305336
306337fn format_permissions_switch_report ( previous : & str , next : & str ) -> String {
307338 format ! (
308339 "Permissions updated
309- Previous {previous}
310- Current {next}"
340+ Result mode switched
341+ Previous mode {previous}
342+ Active mode {next}
343+ Applies to subsequent tool calls
344+ Usage /permissions to inspect current mode"
311345 )
312346}
313347
@@ -1566,17 +1600,21 @@ mod tests {
15661600 fn permissions_report_uses_sectioned_layout ( ) {
15671601 let report = format_permissions_report ( "workspace-write" ) ;
15681602 assert ! ( report. contains( "Permissions" ) ) ;
1569- assert ! ( report. contains( "Current mode workspace-write" ) ) ;
1570- assert ! ( report. contains( "Available modes" ) ) ;
1571- assert ! ( report. contains( "danger-full-access" ) ) ;
1603+ assert ! ( report. contains( "Active mode workspace-write" ) ) ;
1604+ assert ! ( report. contains( "Modes" ) ) ;
1605+ assert ! ( report. contains( "read-only ○ available Read/search tools only" ) ) ;
1606+ assert ! ( report. contains( "workspace-write ● current Edit files inside the workspace" ) ) ;
1607+ assert ! ( report. contains( "danger-full-access ○ available Unrestricted tool access" ) ) ;
15721608 }
15731609
15741610 #[ test]
15751611 fn permissions_switch_report_is_structured ( ) {
15761612 let report = format_permissions_switch_report ( "read-only" , "workspace-write" ) ;
15771613 assert ! ( report. contains( "Permissions updated" ) ) ;
1578- assert ! ( report. contains( "Previous read-only" ) ) ;
1579- assert ! ( report. contains( "Current workspace-write" ) ) ;
1614+ assert ! ( report. contains( "Result mode switched" ) ) ;
1615+ assert ! ( report. contains( "Previous mode read-only" ) ) ;
1616+ assert ! ( report. contains( "Active mode workspace-write" ) ) ;
1617+ assert ! ( report. contains( "Applies to subsequent tool calls" ) ) ;
15801618 }
15811619
15821620 #[ test]
0 commit comments