import { type AutomaticAnalysisHooks } from "./automatic-analysis-completion.js"; import { Command } from "commander"; import { discoverProviderKeys } from "./key-resolution.js"; import { checkCommsConnection } from "./comms-setup.js"; import { promptSecret } from "./secret-prompt.js"; import { type TelemetryProperties } from "./telemetry.js"; import type { CuaActorLabResult } from "./cua-actor-lab.js"; import type { ObserverResult, ObserverServer } from "./observer.js"; import type { OssMetaLabResult } from "./oss-meta-lab.js"; import { type TuiModule } from "./tui-contract.js"; export declare const CLI_RESPONSE_SCHEMA = "humanish.cli-response.v1"; export interface CliIo { writeOut(text: string): void; writeErr(text: string): void; setExitCode(code: number): void; } export interface UnexpectedErrorEnvelope { schema: typeof CLI_RESPONSE_SCHEMA; ok: false; error: { /** HUMANISH_PORT_IN_USE (#484): a bind failed because the port is held; every command that * opens a loopback server (watch, observe, run --open, serve) reports it under one code. */ code: "HUMANISH_UNEXPECTED" | "HUMANISH_PORT_IN_USE"; message: string; }; } /** * Enrich commander's flag rejections with where the flag actually lives. A bare "unknown option" * is accurate and unhelpful in the same way `no labs here yet` was: it reports a fact about this * command and says nothing the reader can act on. Silence is preserved when no sibling has it — * inventing a suggestion would be worse than none. */ export declare function withSiblingFlagHint(text: string, root: Command): string; export declare function createProgram(io?: Partial & { keyDiscovery?: typeof discoverProviderKeys; tuiRuntime?: Partial; }): Command; /** * The pieces of the outside world the `tui` command touches. Injectable for the same reason * `keyDiscovery` is: the refusals ARE the behavior worth testing, and a test cannot make a real * TTY, an old Node, or a missing bundle appear. */ export interface TuiRuntime { checkComms: typeof checkCommsConnection; promptSecret: typeof promptSecret; stdin: NodeJS.ReadStream; stdout: NodeJS.WriteStream; nodeVersion: string; /** Injected so a test can pose as an agent session without touching the real process env. */ env: NodeJS.ProcessEnv; /** Resolves the bundle, or null when it is not present. */ loadTui(bundle: URL): Promise; } /** * Default browser-open policy for a lab backend run. Mirrors the observe/watch gate: * an explicit --open/--no-open wins; --json (machine mode) never auto-opens; otherwise a * lab-config `defaults.open` wins, and the final fallback opens only for an interactive * `watch` on a real TTY. Extracted so all lab backends share one gate (and one test). */ export declare function resolveBackendShouldOpen(args: { optionOpen: boolean | undefined; defaultsOpen: boolean | undefined; mode: string; wantsMachine: boolean; }): boolean; export declare function formatCuaLabHuman(result: CuaActorLabResult): string; export declare function writeResult(command: Command, io: CliIo, result: T, formatHuman: (result: T) => string): void; /** Exported for tests: the facts writeResult read off a command's result document. */ export declare function studyFactsFor(command: Command): TelemetryProperties; type WatchStopSignal = "SIGINT" | "SIGTERM" | "SIGHUP"; interface WatchSignalTarget { once(event: WatchStopSignal, listener: () => void): unknown; removeListener(event: WatchStopSignal, listener: () => void): unknown; } export declare function followObserver(io: CliIo, result: ObserverResult, server: ObserverServer, options?: { onStop?: () => Promise; signalTarget?: WatchSignalTarget; signals?: WatchStopSignal[]; }): Promise; export declare function shouldForceExitAfterOssMetaLab(output: OssMetaLabResult, options: { detach: boolean; wantsMachine: boolean; }): boolean; export declare function shouldServeOssMetaLabObserver(output: OssMetaLabResult, options: { wantsFollow: boolean; }): output is OssMetaLabResult & { observer: ObserverResult & { ok: true; }; }; export declare function exitCodeForOssMetaLab(output: OssMetaLabResult): number; /** Listeners exist only while post-run analysis is active; actor signal behavior is unchanged. */ export declare function cliAutomaticAnalysisHooks(io: Pick): AutomaticAnalysisHooks; /** Preserve the run's own result while making requested post-processing failures machine-visible. */ export declare function automaticAnalysisEnvelope(result: T): T; export {};