@@ -1277,8 +1277,6 @@ impl ChatSession {
1277
1277
} )
1278
1278
} else {
1279
1279
// Check for a pending tool approval
1280
- let tool_denied_without_reason = [ "n" , "N" ] . contains ( & input) ;
1281
-
1282
1280
if let Some ( index) = self . pending_tool_index {
1283
1281
let is_trust = [ "t" , "T" ] . contains ( & input) ;
1284
1282
let tool_use = & mut self . tool_uses [ index] ;
@@ -1289,21 +1287,6 @@ impl ChatSession {
1289
1287
tool_use. accepted = true ;
1290
1288
1291
1289
return Ok ( ChatState :: ExecuteTools ) ;
1292
- // Prompt reason if no selected
1293
- } else if tool_denied_without_reason {
1294
- tool_use. accepted = false ;
1295
- execute ! (
1296
- self . output,
1297
- style:: SetForegroundColor ( Color :: DarkGrey ) ,
1298
- style:: Print (
1299
- "\n Please provide a reason for denying this tool use, or otherwise continue your conversation:\n \n "
1300
- ) ,
1301
- style:: SetForegroundColor ( Color :: Reset ) ,
1302
- ) ?;
1303
-
1304
- return Ok ( ChatState :: PromptUser {
1305
- skip_printing_tools : true ,
1306
- } ) ;
1307
1290
}
1308
1291
} else if !self . pending_prompts . is_empty ( ) {
1309
1292
let prompts = self . pending_prompts . drain ( 0 ..) . collect ( ) ;
@@ -1378,6 +1361,8 @@ impl ChatSession {
1378
1361
continue ;
1379
1362
}
1380
1363
1364
+ self . pending_tool_index = Some ( i) ;
1365
+
1381
1366
return Ok ( ChatState :: PromptUser {
1382
1367
skip_printing_tools : false ,
1383
1368
} ) ;
@@ -1871,6 +1856,7 @@ impl ChatSession {
1871
1856
}
1872
1857
1873
1858
self . tool_uses = queued_tools;
1859
+ self . pending_tool_index = Some ( 0 ) ;
1874
1860
Ok ( ChatState :: ExecuteTools )
1875
1861
}
1876
1862
@@ -2393,13 +2379,11 @@ mod tests {
2393
2379
"/tools untrust fs_write" . to_string( ) ,
2394
2380
"create a file" . to_string( ) , // prompt again due to untrust
2395
2381
"n" . to_string( ) , // cancel
2396
- "no reason" . to_string( ) , // dummy reason
2397
2382
"/tools trust fs_write" . to_string( ) ,
2398
2383
"create a file" . to_string( ) , // again without prompting due to '/tools trust'
2399
2384
"/tools reset" . to_string( ) ,
2400
2385
"create a file" . to_string( ) , // prompt again due to reset
2401
2386
"n" . to_string( ) , // cancel
2402
- "no reason" . to_string( ) , // dummy reason
2403
2387
"exit" . to_string( ) ,
2404
2388
] ) ,
2405
2389
false ,
@@ -2413,7 +2397,7 @@ mod tests {
2413
2397
)
2414
2398
. await
2415
2399
. unwrap ( )
2416
- . next ( & mut ctx, & mut database, & telemetry)
2400
+ . spawn ( & mut ctx, & mut database, & telemetry)
2417
2401
. await
2418
2402
. unwrap ( ) ;
2419
2403
@@ -2512,7 +2496,7 @@ mod tests {
2512
2496
)
2513
2497
. await
2514
2498
. unwrap ( )
2515
- . next ( & mut ctx, & mut database, & telemetry)
2499
+ . spawn ( & mut ctx, & mut database, & telemetry)
2516
2500
. await
2517
2501
. unwrap ( ) ;
2518
2502
@@ -2573,7 +2557,7 @@ mod tests {
2573
2557
SharedWriter :: stdout ( ) ,
2574
2558
None ,
2575
2559
InputSource :: new_mock ( vec ! [
2576
- "/tools trustall " . to_string( ) ,
2560
+ "/tools trust-all " . to_string( ) ,
2577
2561
"create a new file" . to_string( ) ,
2578
2562
"/tools reset" . to_string( ) ,
2579
2563
"create a new file" . to_string( ) ,
@@ -2590,7 +2574,7 @@ mod tests {
2590
2574
)
2591
2575
. await
2592
2576
. unwrap ( )
2593
- . next ( & mut ctx, & mut database, & telemetry)
2577
+ . spawn ( & mut ctx, & mut database, & telemetry)
2594
2578
. await
2595
2579
. unwrap ( ) ;
2596
2580
@@ -2646,7 +2630,7 @@ mod tests {
2646
2630
)
2647
2631
. await
2648
2632
. unwrap ( )
2649
- . next ( & mut ctx, & mut database, & telemetry)
2633
+ . spawn ( & mut ctx, & mut database, & telemetry)
2650
2634
. await
2651
2635
. unwrap ( ) ;
2652
2636
0 commit comments