* Returns an auto_mode_exit attachment if we just exited auto mode. * This is a one-time notification to tell the model it's no longer in auto mode.
( toolUseContext: ToolUseContext, )
| 1378 | * This is a one-time notification to tell the model it's no longer in auto mode. |
| 1379 | */ |
| 1380 | async function getAutoModeExitAttachment( |
| 1381 | toolUseContext: ToolUseContext, |
| 1382 | ): Promise<Attachment[]> { |
| 1383 | if (!needsAutoModeExitAttachment()) { |
| 1384 | return [] |
| 1385 | } |
| 1386 | |
| 1387 | const appState = toolUseContext.getAppState() |
| 1388 | // Suppress when auto is still active — covers both mode==='auto' and |
| 1389 | // plan-with-auto-active (where mode==='plan' but classifier runs). |
| 1390 | if ( |
| 1391 | appState.toolPermissionContext.mode === 'auto' || |
| 1392 | (autoModeStateModule?.isAutoModeActive() ?? false) |
| 1393 | ) { |
| 1394 | setNeedsAutoModeExitAttachment(false) |
| 1395 | return [] |
| 1396 | } |
| 1397 | |
| 1398 | setNeedsAutoModeExitAttachment(false) |
| 1399 | return [{ type: 'auto_mode_exit' }] |
| 1400 | } |
| 1401 | |
| 1402 | /** |
| 1403 | * Detects when the local date has changed since the last turn (user coding |
no test coverage detected