()
| 349 | * - Otherwise, use in-process (return true) |
| 350 | */ |
| 351 | export function isInProcessEnabled(): boolean { |
| 352 | // Force in-process mode for non-interactive sessions (-p mode) |
| 353 | // since tmux-based teammates don't make sense without a terminal UI |
| 354 | if (getIsNonInteractiveSession()) { |
| 355 | logForDebugging( |
| 356 | '[BackendRegistry] isInProcessEnabled: true (non-interactive session)', |
| 357 | ) |
| 358 | return true |
| 359 | } |
| 360 | |
| 361 | const mode = getTeammateMode() |
| 362 | |
| 363 | let enabled: boolean |
| 364 | if (mode === 'in-process') { |
| 365 | enabled = true |
| 366 | } else if (mode === 'tmux') { |
| 367 | enabled = false |
| 368 | } else { |
| 369 | // 'auto' mode - if a prior spawn fell back to in-process because no pane |
| 370 | // backend was available, stay in-process (scoped to auto mode only so a |
| 371 | // mid-session Settings change to explicit 'tmux' still takes effect). |
| 372 | if (inProcessFallbackActive) { |
| 373 | logForDebugging( |
| 374 | '[BackendRegistry] isInProcessEnabled: true (fallback after pane backend unavailable)', |
| 375 | ) |
| 376 | return true |
| 377 | } |
| 378 | // Check if a pane backend environment is available |
| 379 | // If inside tmux or iTerm2, use pane backend; otherwise use in-process |
| 380 | const insideTmux = isInsideTmuxSync() |
| 381 | const inITerm2 = isInITerm2() |
| 382 | enabled = !insideTmux && !inITerm2 |
| 383 | } |
| 384 | |
| 385 | logForDebugging( |
| 386 | `[BackendRegistry] isInProcessEnabled: ${enabled} (mode=${mode}, insideTmux=${isInsideTmuxSync()}, inITerm2=${isInITerm2()})`, |
| 387 | ) |
| 388 | return enabled |
| 389 | } |
| 390 | |
| 391 | /** |
| 392 | * Returns the resolved teammate executor mode for this session. |
no test coverage detected