mirror of
https://github.com/usestrix/strix.git
synced 2026-12-01 01:07:18 +00:00
Without a tty on stdin and stdout (CI, nohup, pipes, cron, TERM=dumb) the Go TUI handshakes fine and then exits 1 the moment Bubble Tea tries to take over the screen. Because the backend was already activated, that exit escaped the pre-activation mapping and surfaced as a raw traceback: RuntimeError: Bubble Tea TUI exited with status 1. Now main() checks for a terminal right after argument parsing. With a target it switches to the headless path (same as -n) and prints one dim notice. Without a target the start screen is the only way to enter one, so it prints a panel telling the user to pass -t <target> -n and exits 1. A bare --resume is left to the picker, which already lists runs when there is no terminal. If the sidecar still dies after startup, check_return_code raises TuiProcessExitedError, run_tui maps it to InteractiveInterfaceExitedError, and main() prints an INTERACTIVE INTERFACE STOPPED panel with the -n hint under its own telemetry name instead of re-raising.
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
"""Launch the interactive terminal interface."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
from typing import TYPE_CHECKING
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
import argparse
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class InteractiveSetupUnavailableError(RuntimeError):
|
|
"""Raised when the interactive TUI cannot be launched."""
|
|
|
|
|
|
class InteractiveInterfaceExitedError(RuntimeError):
|
|
"""Raised when the TUI process dies after it was up (no terminal, killed)."""
|
|
|
|
|
|
async def run_tui(args: argparse.Namespace) -> None:
|
|
"""Run the Bubble Tea TUI."""
|
|
from strix.interface.tui.runtime import (
|
|
GoTuiPreActivationError,
|
|
run_go_tui,
|
|
)
|
|
from strix.interface.tui.sidecar import TuiProcessExitedError
|
|
|
|
try:
|
|
await run_go_tui(args)
|
|
except GoTuiPreActivationError as exc:
|
|
raise InteractiveSetupUnavailableError(
|
|
f"The interactive interface could not start: {exc}"
|
|
) from exc
|
|
except TuiProcessExitedError as exc:
|
|
raise InteractiveInterfaceExitedError(str(exc)) from exc
|
|
|
|
|
|
__all__ = [
|
|
"InteractiveInterfaceExitedError",
|
|
"InteractiveSetupUnavailableError",
|
|
"run_tui",
|
|
]
|