import { listTraceSources } from "@mono-agent/observability"; import type { TraceSourceListItem } from "@mono-agent/observability"; import type { BackgroundSnapshot } from "./background-snapshot.js"; export interface RunTuiOptions { readonly configPath: string; readonly cwd: string; readonly env: Record; /** Explicit dotenv path baked into managed background restarts. */ readonly envFile?: string; /** --agent: connect to this label or sourceId directly. */ readonly agent?: string; /** --conversation: conversation id to chat under (default tui-). */ readonly conversationId?: string; /** Build the current folder's responder in this process instead of discovering a service. */ readonly local?: boolean; /** Attach to the managed background agent in a dedicated self-configuration session. */ readonly configure?: boolean; } /** Test seams: discovery + TUI boot are injectable. */ export interface RunTuiDeps { readonly listSources?: typeof listTraceSources; readonly startTui?: (options: Record) => Promise<{ waitUntilExit(): Promise; }>; readonly isTty?: boolean; readonly stdout?: { write(text: string): void; }; readonly stderr?: { write(text: string): void; }; readonly platform?: NodeJS.Platform; readonly createLocalSession?: (options: { readonly cwd: string; readonly configPath: string; readonly env: Record; }) => Promise<{ readonly responder: unknown; readonly title: string; dispose(): Promise; }>; readonly createRemoteConfigurationSession?: (options: { readonly cwd: string; readonly configPath: string; readonly env: Record; readonly envFile?: string; readonly restartBackground: (expectedSnapshot: BackgroundSnapshot) => Promise<{ readonly ok: true; readonly connection: { readonly baseUrl: string; readonly apiKey?: string; }; } | { readonly ok: false; readonly message: string; }>; }) => Promise<{ readonly configuration: unknown; dispose(): Promise; }>; readonly restartBackground?: (expectedSnapshot: BackgroundSnapshot, environment: Readonly>) => Promise<{ readonly ok: true; readonly connection: { readonly baseUrl: string; readonly apiKey?: string; }; } | { readonly ok: false; readonly message: string; }>; /** Re-prove launchd ownership, exact durable inputs, and TUI reachability before granting configuration authority. */ readonly verifyConfigurationSource?: (source: TraceSourceListItem, environment: Readonly>) => Promise; /** Reconstruct the exact dotenv-plus-operational environment used by the managed worker. */ readonly loadConfigurationEnvironment?: () => Promise>; } export type TuiLaunchPlan = { readonly kind: "none"; readonly message: string; } | { readonly kind: "error"; readonly message: string; } | { readonly kind: "connect"; readonly source: TraceSourceListItem; } | { readonly kind: "picker"; readonly sources: readonly TraceSourceListItem[]; }; /** * Pure selection logic for `mono-agent tui`: which running agent to connect * to, or whether to open the picker. `registryDirs` names every registry that * was consulted (one entry, or two when the configured registry and the * machine-wide global one differ) purely for the "nothing found" messaging. * Exported for unit tests. */ export declare function resolveTuiLaunch(sources: readonly TraceSourceListItem[], registryDirs: readonly string[], agentFilter: string | undefined): TuiLaunchPlan; /** Extract the tui channel's baseUrl from a manifest's channel summaries. */ export declare function tuiEndpointOf(source: TraceSourceListItem): string | undefined; /** * `mono-agent tui`: discover running agents (machine-wide registry), resolve * the target's stream endpoint + key, and launch the operator console. Works * from any directory — with no local config the registry falls back to * ~/.mono-agent/trace-sources. */ export declare function runTui(options: RunTuiOptions, deps?: RunTuiDeps): Promise; /** * Attest the configuration target against the one environment reconstructed * before discovery. Re-reading dotenv here could prove a different worker * input than the environment later used for authentication and restart. */ export declare function captureManagedConfigurationAttachSnapshot(target: Pick, environment: Readonly>): Promise; //# sourceMappingURL=tui-command.d.ts.map