import z from "@deepseek-ai/schemastery"; import { Context } from "@deepseek-ai/cordis"; //#region src/startup.d.ts /** Stable Cordis plugin name. */ declare const name = "tui-startup"; /** Services required before the flags can be resolved. */ declare const inject: string[]; /** Incompatible dsh harness ranges and the guidance each deserves. Entries * are checked in ORDER and the first whose range covers the installed dsh * version wins. * * Range semantics: `min` is inclusive, `max` is EXCLUSIVE. An entry with * only `max` covers everything below it (the common "too old" case); an * entry with only `min` covers everything at or above it ("too new" — * e.g. a harness that removed a seam we still use). * * `since` names the bundle release line that FIRST imposed the constraint: * it is shown as the fallback version label (`>= `) when the * bundle's own version cannot be read, so the message stays truthful. * * The current line has a minimum of the published npm release * dsh-v0.2.1-rc.2 and a recommended upgrade target of the newer * dsh-v0.2.1-rc.5. The recovery guidance names the recommended published * upgrade target — which may be NEWER than the floor — and allows its native * install scripts. The already-published 0.5.0 line keeps its own * rc.1-era contract and remains the compatible fallback for a * dsh-v0.2.0-rc.1 runtime. */ interface HarnessCompatEntry { /** Inclusive lower bound of the incompatible range; absent = unbounded below. */ min?: string; /** Exclusive upper bound of the incompatible range; absent = unbounded above. */ max?: string; /** The bundle release line that first required this constraint. */ since: string; /** Human-readable requirement, e.g. `DeepSeek Harness 0.1.7-alpha.2 or later`. */ requires: string; /** The target DSH version to install when the current runtime is too old. */ upgradeDsh?: string; /** An exact install command when the target needs install-script flags. */ upgradeCommand?: string; /** The compatible TUI line to install when keeping an old DSH runtime. */ fallbackTui?: string; /** Special guidance for a range that is not covered by the normal recovery * commands, such as an unvalidated future DSH line. */ guidance?: string; } /** The compatibility table, derived from the shared matrix and ordered from * oldest to newest so `harnessCompatEntryFor()` can return the first matching * range. The oldest entry is the catch-all floor; each matrix row contributes * a range that ends at the NEXT row's lower bound (the last row is the current * supported line and produces no incompatible entry). * * Two boundaries are worth keeping in mind: cross-core prereleases do not * satisfy an older TUI package's semver peer range, and the official * dsh-v0.1.5-alpha.1/.2 tags predate the setup contract required by the next * supported TUI line, so they carry no fallback. */ declare const HARNESS_COMPAT: readonly HarnessCompatEntry[]; /** The compat entry covering the installed dsh version, or undefined when * the harness is supported. */ declare function harnessCompatEntryFor(installed: string): HarnessCompatEntry | undefined; /** The bundle's own version label for the gate message, read from * package.json at runtime (never hardcoded). Falls back to the release * line that first imposed the requirement when unreadable. */ declare function bundleVersionLabel(since: string): string; /** The actionable compatibility notice printed when the installed harness * falls in an incompatible range. `entry` MUST be the entry * {@link harnessCompatEntryFor} matched for `installed`. The notice is * advisory: DSH Loader mounts profile entries concurrently, so this row cannot * guarantee that its output precedes another row's import failure. */ declare function incompatibleHarnessMessage(installed: string, entry: HarnessCompatEntry, profile: string): string; /** Service provided by this plugin and injected by the TUI runner row. */ declare const TUI_STARTUP_SERVICE = "tuiStartup"; /** * The ONE immutable Session-launch intent `--session ` / * `-c, --continue` parsed. It is resolved against the official Host Session * roster by the runner; it never replaces the exact `sessionId` identity field * used by the internal split-Client channel. */ type CliSessionLaunchIntent = /** Bare `--session`, an explicitly empty value, or a whitespace-only query: * open the Session Browser on Browse All. */ { readonly kind: 'browse'; readonly query: string; } /** Any other non-blank value: resolve it as a full/listed id or a unique * short prefix, otherwise seed the same Browser search with it. */ | { readonly kind: 'lookup'; readonly query: string; } /** `-c, --continue`: continue the newest readable main Session in the * CONFIRMED Host Workspace. */ | { readonly kind: 'continue'; }; /** What the runner row reads from {@link TUI_STARTUP_SERVICE}. */ interface TuiStartupValues { /** The EXACT Session identity of the internal split-Client channel. The * public `--session` grammar never fills this field: production CLI * launches carry {@link sessionLaunch} instead. */ sessionId?: string; /** `--preset`, the agent preset a fresh session starts on. */ presetId?: string; /** The public CLI Session launch intent, absent on a plain cold start. It is * mutually exclusive with the exact fields above. */ sessionLaunch?: CliSessionLaunchIntent; /** * Mark the TUI required surface as mounted. `src/index.ts` calls this once * its synchronous initialization succeeded and its async startup root is * established. The readiness handshake registered by this row exits nonzero * when the launcher commits readiness without it: 0.1.6 app-boot treats a * failed `tui-app` row as an OPTIONAL plugin failure, so without this the * explicitly requested TUI could report a successful startup that never * mounted. Optional so structural test providers can omit it. */ markSurfaceMounted?(): void; } /** * Service provided when the invocation selects the local daemon backend * (M6-2A). The daemon-launcher row injects it, launches exactly one foreground * Client OS process, and waits for its real exit. */ declare const TUI_DAEMON_STARTUP_SERVICE = "tuiDaemonStartup"; /** * The ONE public backend selector (M6-2A). `direct` keeps the in-process TUI * of earlier releases; `daemon` launches one foreground Client against a local * Host. The value is chosen per cold launch from the environment override or * the persisted Profile Config — never a CLI flag and never a hot switch. */ type PublicBackend = 'direct' | 'daemon'; /** The public daemon management verbs (M6-2C). */ type DaemonControlVerb = 'status' | 'start' | 'stop' | 'restart' | 'logs' | 'install' | 'uninstall'; /** One immutable daemon management intent parsed by the nested CLI grammar. */ interface DaemonControlIntent { readonly verb: DaemonControlVerb; /** `logs` only: a validated integer in 1..1000. */ readonly lines?: number; } /** The client-launch arm of {@link TuiDaemonStartupValues}. */ interface TuiDaemonClientStartup { readonly kind: 'client'; /** The public CLI Session launch intent, resolved Client-locally against the * official Host roster (never an exact-id field). */ readonly sessionLaunch?: CliSessionLaunchIntent; /** `--preset`, the agent preset a fresh session starts on. */ readonly presetId?: string; /** * The read-only public-backend choice for THIS launch: its value and whether * the environment overrode the Profile. Carried to the Client so its Settings * row can show the real "environment override" source WITHOUT depending on the * deliberately-cleared `DSH_PI_TUI_BACKEND` (and never persisted). */ readonly backendSource?: { readonly value: PublicBackend; readonly source: 'env' | 'profile'; }; /** * Mark the daemon Coordinator (the launcher row) as mounted. The readiness * handshake the daemon branch registers exits nonzero when readiness commits * without it — i.e. the launcher row is missing, failed or pending on * `tuiDaemonStartup`. Optional so structural test providers may omit it. */ markCoordinatorMounted?(): void; } /** The management arm: no TUI, no Client, exactly one operation. */ interface TuiDaemonControlStartup { readonly kind: 'control'; readonly control: DaemonControlIntent; /** Same one-shot cold-ready handshake as the client arm. */ markCoordinatorMounted?(): void; } /** The public headless Web CLI verbs (M6 Web CLI). */ type WebControlVerb = 'status' | 'enable' | 'disable' | 'url' | 'open'; /** One immutable headless Web control intent parsed by the nested CLI grammar. */ interface WebControlIntent { readonly verb: WebControlVerb; } /** The headless Web CLI arm: no TUI, no Client, no Host start. */ interface TuiWebControlStartup { readonly kind: 'web-control'; readonly control: WebControlIntent; /** Same one-shot cold-ready handshake as the client arm. */ markCoordinatorMounted?(): void; } /** What the daemon-launcher row reads from {@link TUI_DAEMON_STARTUP_SERVICE}. */ type TuiDaemonStartupValues = TuiDaemonClientStartup | TuiDaemonControlStartup | TuiWebControlStartup; /** * The row's Profile Config: the persisted backend selector. `.volatile()` * projects the field into the official Settings form and keeps it live-editable * (M6-2A writes it through the official revision-checked settings mutation); the * selector reads it back via `config.backend.get()` at cold launch. The value is * a plain string on purpose: an out-of-band illegal value then fails closed in * THIS row with an explicit reason, instead of a Loader schema rejection that * would also block an explicit environment override. */ interface Config { readonly backend: { readonly get: () => string; }; } declare const Config: z; /** * Parse and provide the TUI invocation as an ordinary Cordis service. The * command's action publishes the flags this invocation named; on `--help` * nothing is provided, so no TUI row mounts. * @param ctx - plugin context carrying the command line. */ declare function apply(ctx: Context, config?: Config): void; //#endregion export { name as S, apply as _, HARNESS_COMPAT as a, incompatibleHarnessMessage as b, TUI_DAEMON_STARTUP_SERVICE as c, TuiDaemonControlStartup as d, TuiDaemonStartupValues as f, WebControlVerb as g, WebControlIntent as h, DaemonControlVerb as i, TUI_STARTUP_SERVICE as l, TuiWebControlStartup as m, Config as n, HarnessCompatEntry as o, TuiStartupValues as p, DaemonControlIntent as r, PublicBackend as s, CliSessionLaunchIntent as t, TuiDaemonClientStartup as u, bundleVersionLabel as v, inject as x, harnessCompatEntryFor as y };