import type { WebTheme } from "@mono-agent/web"; import type { LaunchctlRunner, LaunchdPaths, LaunchdWebMaintenanceInfo } from "./launchd.js"; import type { ManagedWebLogMonitorDependencies } from "./managed-web-logs.js"; import { verifyManagedRuntimeMaintenanceEntrypoint } from "./managed-runtime-maintenance-entry.js"; import type { ManagedWebPaths } from "./web-maintenance-paths.js"; export { WEB_LAUNCHD_LABEL } from "./launchd.js"; export declare const DEFAULT_WEB_HOST = "0.0.0.0"; export declare const DEFAULT_WEB_PORT = 5050; export declare const MANAGED_WEB_WORKER_ENV = "MONO_AGENT_MANAGED_WEB_WORKER"; declare const TAILSCALE_OWNERSHIP_SCHEMA = "mono-agent.web-tailscale-serve.v1"; interface WebServerHandle { readonly url: string; readonly host?: string; readonly port?: number; readonly boundAddress?: string; stop(): Promise; } interface StartWebServerOptions { readonly host?: string; readonly port?: number; readonly theme?: WebTheme; readonly registryDirs?: readonly string[]; readonly stateDir?: string; readonly env?: Record; } interface ResetWebStateOptions { readonly stateDir?: string; readonly env?: Record; } interface PrepareWebStateOptions { readonly stateDir?: string; readonly env?: Record; } export interface RunWebCommandOptions { readonly positionals: readonly string[]; readonly env: Record; readonly host?: string; readonly port?: number; readonly theme?: string; readonly loopback?: boolean; readonly follow?: boolean; readonly lines?: number; readonly all?: boolean; readonly yes?: boolean; } export interface CommandResult { readonly code: number; readonly stdout: string; readonly stderr: string; } export type CommandRunner = (args: readonly string[]) => Promise; interface ManagedRuntimeResult { readonly cliPath: string; readonly nodePath: string; readonly launchProof: string; } export interface RunWebCommandDeps { readonly platform?: NodeJS.Platform; readonly getuid?: () => number; readonly now?: () => number; readonly sleep?: (ms: number) => Promise; readonly stdout?: { write(text: string): void; }; readonly stderr?: { write(text: string): void; }; readonly launchctl?: LaunchctlRunner; readonly tailscale?: CommandRunner; readonly startServer?: (options: StartWebServerOptions) => Promise; readonly resetState?: (options: ResetWebStateOptions) => Promise; readonly prepareState?: (options: PrepareWebStateOptions) => Promise; readonly waitForShutdown?: () => Promise; readonly healthcheck?: (url: string) => Promise; readonly isAlive?: (pid: number) => boolean; readonly ensureManagedRuntime?: (input: { readonly currentCliPath: string; readonly nodePath: string; }) => Promise; readonly verifyMaintenanceEntrypoint?: typeof verifyManagedRuntimeMaintenanceEntrypoint; readonly inspectMaintenanceService?: (runner: LaunchctlRunner, uid: number) => Promise; readonly spawnTail?: (args: readonly string[]) => Promise; readonly writePrivateFile?: (path: string, contents: string) => Promise; readonly acquireLifecycleLock?: (paths: WebPaths) => Promise<(() => Promise) | undefined>; readonly discoverNetworkAddresses?: () => readonly string[]; readonly startManagedLogMonitor?: (paths: Pick, dependencies: ManagedWebLogMonitorDependencies) => { stop(): void; }; readonly homeDir?: string; } export interface TailscaleServeOwnership { readonly schema: typeof TAILSCALE_OWNERSHIP_SCHEMA; readonly webKey: string; readonly httpsPort: number; readonly proxyTarget: string; /** Exact canonical TCP + Web handler config owned at publication time. */ readonly configSha256: string; readonly url: string; readonly configuredAt: string; } type TailscaleServeResult = { readonly kind: "active"; readonly ownership: TailscaleServeOwnership; readonly reused: boolean; } | { readonly kind: "unavailable"; readonly detail: string; /** The old owned route was migrated, so the replacement worker must also be rolled back. */ readonly requiresServiceRollback?: true; }; export type WebPaths = ManagedWebPaths; export declare function webPaths(homeDir?: string): WebPaths; export declare function renderWebHelp(): string; /** Route the `mono-agent web` service namespace. Bare invocation is read-only. */ export declare function runWebCommand(options: RunWebCommandOptions, deps?: RunWebCommandDeps): Promise; export declare function webHealthcheck(url: string): Promise; export declare function ensureTailscaleServe(paths: WebPaths, bindHost: string, appPort: number, env: Record, deps: RunWebCommandDeps, expectedDnsName?: string): Promise; export declare function tailscaleProxyTarget(bindHost: string, appPort: number): string | undefined; export declare function removeOwnedTailscaleServe(paths: WebPaths, deps: RunWebCommandDeps): Promise<{ readonly kind: "removed" | "absent"; } | { readonly kind: "unavailable"; readonly detail: string; }>; export declare function chooseTailscaleHttpsPort(status: Record): number | undefined; //# sourceMappingURL=web-command.d.ts.map