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