( fromMode: string, toMode: string, )
| 1387 | } |
| 1388 | |
| 1389 | export function handleAutoModeTransition( |
| 1390 | fromMode: string, |
| 1391 | toMode: string, |
| 1392 | ): void { |
| 1393 | // Auto↔plan transitions are handled by prepareContextForPlanMode (auto may |
| 1394 | // stay active through plan if opted in) and ExitPlanMode (restores mode). |
| 1395 | // Skip both directions so this function only handles direct auto transitions. |
| 1396 | if ( |
| 1397 | (fromMode === 'auto' && toMode === 'plan') || |
| 1398 | (fromMode === 'plan' && toMode === 'auto') |
| 1399 | ) { |
| 1400 | return |
| 1401 | } |
| 1402 | const fromIsAuto = fromMode === 'auto' |
| 1403 | const toIsAuto = toMode === 'auto' |
| 1404 | |
| 1405 | // If switching TO auto mode, clear any pending exit attachment |
| 1406 | // This prevents sending both auto_mode and auto_mode_exit when user toggles quickly |
| 1407 | if (toIsAuto && !fromIsAuto) { |
| 1408 | STATE.needsAutoModeExitAttachment = false |
| 1409 | } |
| 1410 | |
| 1411 | // If switching out of auto mode, trigger the auto_mode_exit attachment |
| 1412 | if (fromIsAuto && !toIsAuto) { |
| 1413 | STATE.needsAutoModeExitAttachment = true |
| 1414 | } |
| 1415 | } |
| 1416 | |
| 1417 | // LSP plugin recommendation session tracking |
| 1418 | export function hasShownLspRecommendationThisSession(): boolean { |
no outgoing calls
no test coverage detected