import { listRecordedRuns } from "@mono-agent/observability"; import type { MonoAgentApp } from "./app.js"; import type { BackgroundDeps } from "./background.js"; import type { LaunchdMaintenanceCommandArgs } from "./launchd-maintenance-command.js"; import type { LaunchdMaintenanceLifecycleLease } from "./launchd-maintenance-gate.js"; import type { ManagedLaunchdLogMonitor, ManagedLaunchdLogMonitorDependencies } from "./background-log-maintenance.js"; import type { ChannelStatus } from "./channels.js"; import type { ParsedCliArgs } from "./cli-args.js"; import type { ValidationReport } from "./doctor.js"; declare const BACKGROUND_COMMANDS: readonly ["start", "restart", "stop", "status", "logs"]; /** * Outcome of the start/restart preflight. `code` is the process exit status to * return when refusing: 2 for a missing config file (a usage problem, matching * the arg-parse convention) and 1 for a config that loads but has errors. */ export type PreflightResult = { readonly ok: true; } | { readonly ok: false; readonly code: 2; readonly kind: "missing-config"; readonly configPath: string; } | { readonly ok: false; readonly code: 1; readonly kind: "validation"; readonly report: ValidationReport; }; /** * Gate for `start`/`restart`: refuse unless the directory has a present, valid * config. First the config FILE must exist (env vars alone are not enough — a * folder without a config is not a configured agent). Then run the structural * validation with `liveness:false` (network probes only yield `waiting`, never * `error`, so skipping them keeps the verdict while avoiding bounded network * timeouts) and refuse on any `error` section. `waiting` (e.g. * Ollama/Supermemory/Phoenix not up yet) is runtime-soft and never blocks. */ export declare function ensureStartable(args: Pick, env?: Record, options?: { readonly cwd?: string; readonly configPath?: string; readonly preferAppPluginInstall?: boolean; readonly verifiedRuntimeProvenanceDetail?: string; }): Promise; export declare function runStart(args: ParsedCliArgs, env?: Record, managedBackgroundWorker?: boolean): Promise; /** The exact managed-worker composition, exported for a real idle-path contract test. */ export declare function startManagedBackgroundLogMonitorForConfig(configPath: string, deps: ManagedLaunchdLogMonitorDependencies): ManagedLaunchdLogMonitor; export declare function runBackgroundCommand(args: ParsedCliArgs, command: (typeof BACKGROUND_COMMANDS)[number], env?: Record): Promise; /** Private launchd-only entry point; `runCli` recognizes its launchd-only env marker. */ export declare function runLaunchdLogMaintenanceCommand(args: ParsedCliArgs, deps?: BackgroundDeps): Promise; /** Heavy reconciliation path callable only with the per-agent capability minted by the leaf gate. */ export declare function runLaunchdLogMaintenanceCommandWithLifecycleLease(args: LaunchdMaintenanceCommandArgs | ParsedCliArgs, ownership: LaunchdMaintenanceLifecycleLease, deps?: BackgroundDeps): Promise; export interface PrintAppStatusOptions { readonly listRecordedRuns?: typeof listRecordedRuns; readonly nowMs?: number; } export declare function printAppStatus(app: MonoAgentApp, options?: PrintAppStatusOptions): Promise; export declare function describeChannelStatus(status: ChannelStatus): string; /** * Block the foreground process until SIGINT/SIGTERM, then stop the app and * resolve the exit code. A referenced no-op timer owns the event loop so the * process stays alive even with no channel handle (signal listeners alone do * NOT keep Node running, and the trace heartbeat is unref'd). Cleared on stop so * the loop drains cleanly without a forceful `process.exit`. Exported for tests. */ export declare function waitForShutdownSignal(app: Pick, beforeAppStop?: () => void): Promise; export {}; //# sourceMappingURL=cli-background-command.d.ts.map