/** * Durable lifecycle states shared by monitor hosts and operator clients. * * A monitor is a long-lived host-owned watch: its command streams stdout lines * that the host coalesces into batches and delivers to the originating * conversation as wake turns. Unlike a process job it produces MANY wakes, so * `running` is the normal steady state and every terminal state below delivers * exactly one final wake. */ export declare const MONITOR_STATES: readonly ["starting", "running", "exited", "timed_out", "cancelled", "spawn_failed", "rate_limited", "interrupted"]; export type MonitorState = (typeof MONITOR_STATES)[number]; /** Maximum monitor identities a channel adapter or operator client must retain. */ export declare const MAX_MONITOR_OUTSTANDING_LIFECYCLES = 1024; /** Stable machine-readable failures exposed at the runtime/operator boundary. */ export declare const MONITOR_ERROR_CODES: readonly ["monitor_unsupported", "monitor_unsupported_channel", "monitor_disabled", "monitor_controller_unavailable", "monitor_platform_unsupported", "monitor_not_found", "monitor_conflict", "monitor_capacity", "monitor_conversation_capacity", "monitor_chain_depth_exceeded", "monitor_spawn_failed", "monitor_exited", "monitor_timeout", "monitor_cancelled", "monitor_rate_limited", "monitor_agent_restarted", "monitor_cleanup_incomplete", "monitor_store_error", "monitor_wake_failed", "monitor_response_too_large", "monitor_invalid"]; export type MonitorErrorCode = (typeof MONITOR_ERROR_CODES)[number]; /** Stable secret-free messages paired with public monitor error codes. */ export declare const MONITOR_PUBLIC_ERROR_MESSAGES: Readonly>; /** Construct one stable public failure without retaining ambient exception text. */ export declare function monitorPublicError(code: MonitorErrorCode): MonitorProjectionError; export interface MonitorProjectionError { readonly code: MonitorErrorCode; readonly message: string; } export interface MonitorProjectionOrigin { /** Exact conversation identity, including any host-owned rollover bucket. */ readonly conversationId: string; readonly channel: string; readonly runId: string; readonly bucket: string | null; } export interface MonitorProjectionTimestamps { readonly startedAt: string; readonly runtimeDeadlineAt: string | null; readonly lastEventAt: string | null; readonly completedAt: string | null; } export interface MonitorProjectionLimits { readonly wakeOn: "batch" | "exit"; readonly dedupe: "none" | "batch"; readonly minWakeIntervalMs: number; readonly maxRuntimeMs: number; readonly coalesceMs: number; readonly maxBatchLines: number; readonly maxBatchBytes: number; readonly chainDepth: number; } /** * Cumulative, secret-free delivery accounting. `droppedLines` is the number of * oldest lines evicted from a pending batch that hit its bound; it is reported * to the model so a gap is never silently invisible. */ export interface MonitorProjectionCounters { readonly batchesSuppressed: number; readonly linesSuppressed: number; readonly followUpWakes: number; readonly steeredWakes: number; readonly unknownDispositionWakes: number; readonly seq: number; readonly batchesDelivered: number; readonly linesObserved: number; readonly linesDelivered: number; readonly droppedLines: number; readonly pendingLines: number; } /** * Secret-free operator projection of one live monitor. * * This intentionally excludes argv, environment values, sandbox settings paths, * PIDs, and process-incarnation evidence. `description` is the bounded, redacted * model-authored purpose; monitor event text is never retained here. */ export interface MonitorProjection { readonly schema: "mono-agent.monitor-projection.v2"; readonly monitorId: string; readonly state: MonitorState; readonly description: string; readonly persistent: boolean; readonly origin: MonitorProjectionOrigin; readonly timestamps: MonitorProjectionTimestamps; readonly limits: MonitorProjectionLimits; readonly counters: MonitorProjectionCounters; readonly exitCode: number | null; readonly signal: string | null; readonly cancelRequested: boolean; readonly lastError: MonitorProjectionError | null; } /** Neutral owner-authorized operator surface used by app, CLI, and web proxy. */ export interface MonitorOperator { /** Owner-only bearer used by local operator routes. Never expose to a model. */ readonly operatorToken: string; list(): Promise; get(monitorId: string): Promise; cancel(monitorId: string): Promise; } /** Strictly parse one projection, rejecting unknown keys at every depth. */ export declare function parseMonitorProjection(value: unknown): MonitorProjection; /** Strictly parse a bounded operator list response. */ export declare function parseMonitorProjections(value: unknown): readonly MonitorProjection[]; export declare function isMonitorState(value: unknown): value is MonitorState; export declare function isMonitorErrorCode(value: unknown): value is MonitorErrorCode; /** A monitor in a terminal state has delivered, or is owed, exactly one final wake. */ export declare function isTerminalMonitorState(state: MonitorState): boolean; //# sourceMappingURL=monitors.d.ts.map