/** * Command-line intake for the SSH TUI. Parses the app arguments handed over * by the dsh launcher, mints or resumes the `main` agent identity, and * provides the `sshTuiStartup` service consumed by the agent-loop row and the * TUI row. */ import type { Context } from '@deepseek-ai/cordis'; import { SessionId } from '@deepseek-ai/dsh-session'; import { type DisplayMode } from './display-mode.js'; /** Service key under which the parsed TUI launch options are provided. */ export declare const SSH_TUI_STARTUP_SERVICE = "sshTuiStartup"; /** Config `id` of the agent-loop entry the TUI drives. */ export declare const MAIN_AGENT_ID = "main"; /** Parsed TUI launch identity and presentation options. */ export interface SshTuiStartup { /** Exact session id the `main` agent runs under, fresh or resumed. */ readonly sessionId: SessionId; /** Whether the session resumes persisted history. */ readonly resume: boolean; /** Whether the launcher should open the history-session picker on boot. */ readonly resumePicker: boolean; /** Model override supplied at launch, when given. */ readonly model?: string; /** Provider route override supplied at launch, when given. */ readonly provider?: string; /** ANSI color opt-out supplied at launch. */ readonly noColor?: boolean; /** * Where the bytes go: `stdio` when the parent speaks the display protocol on * stdin/stdout (a GUI, a web terminal, a harness) instead of owning a TTY. */ readonly display?: DisplayMode; } declare module '@deepseek-ai/cordis' { interface Context { sshTuiStartup?: SshTuiStartup; } } export declare const name = "ssh-tui-startup"; export declare const inject: string[]; /** * Whether another application already owns this profile's command line. * * `@deepseek-ai/dsh-cmdline` has **no arbitration between apps**: every app plugin is * handed the same argv and parses it with its own grammar, and an unknown flag is * `program.error`, which exits the process. A profile that hosts two apps therefore * requires the second one to understand the first one's flags — and the desktop * application passes `--no-open` (the web app's own flag) to its host, so this row's * grammar rejected it: the host exited 1, the application reported * `dsh desktop host exited with 1: error: unknown option '--no-open'` and died. Only * the *startup* row did that; the TUI row never ran, which is why 0.8.1's inert-when- * headless fix could not have caught it. * * The signals are two, and they overlap on purpose: * * - the launcher facts (`desktopLauncher`): an Electron host, `DeepSeek Harness.exe`, * or `app.asar` in argv — true whatever the profile's row order is; * - `webStartup`: the web app provides it as soon as it has parsed, and a `web` * profile is not a terminal profile in any case. * * Stepping aside is not a degraded mode: the TUI row `inject`s `sshTuiStartup`, so * nothing of this plugin activates and the host keeps its own grammar and its own app. */ export declare function anotherAppOwnsCommandLine(ctx: Context): boolean; /** * Build the TUI command grammar and provide the session identity for the * agent-loop row plus the {@link SshTuiStartup} service. On `--help` or a * usage error nothing is provided, so dependent rows never activate and the * process exits through the cmdline exit seam. */ export declare function apply(ctx: Context): void;