( params: SessionLifecycleInput, )
| 34 | } |
| 35 | |
| 36 | export function determineSessionLifecycle( |
| 37 | params: SessionLifecycleInput, |
| 38 | ): SessionLifecycle { |
| 39 | // SDK / headless / print modes are non-interactive inference. |
| 40 | // They run locally but without a TUI and should skip TUI-specific |
| 41 | // prefetches (bootstrap model options, fast mode, example commands). |
| 42 | if ( |
| 43 | params.sdkUrl || |
| 44 | params.print || |
| 45 | (params.inputFormat === 'stream-json' && params.outputFormat === 'stream-json') |
| 46 | ) { |
| 47 | return 'noninteractive' |
| 48 | } |
| 49 | |
| 50 | // Feature-gated connection modes take precedence over local REPL. |
| 51 | if (params.hasPendingSSH) { |
| 52 | return 'ssh_remote' |
| 53 | } |
| 54 | if (params.hasPendingConnect) { |
| 55 | return 'direct_connect' |
| 56 | } |
| 57 | if (params.hasPendingAssistant) { |
| 58 | return 'assistant' |
| 59 | } |
| 60 | |
| 61 | // Explicit remote-session verbs. |
| 62 | if (params.remote !== null) { |
| 63 | return 'remote' |
| 64 | } |
| 65 | if (params.teleport !== null) { |
| 66 | return 'teleport' |
| 67 | } |
| 68 | |
| 69 | // Everything else is a local interactive session (continue, resume, etc). |
| 70 | return 'local_interactive' |
| 71 | } |
no outgoing calls
no test coverage detected