import { type Server } from 'node:net'; import type { PiNotifier, GatewayCoordinator } from './slack.js'; import type { PiApplyResult, PiModel } from './pi-rpc.js'; /** Bound ordinary daemon commands without applying a short network deadline to Slack. */ export declare const CONTROL_COMMAND_DEADLINE_MS = 10000; export declare const SLACK_NETWORK_DEADLINE_MS = 60000; export declare function deadlineForCommand(command: string): number; type Request = { version: 1; id: string; command: string; params: Record; }; type Reply = { id: string; result?: unknown; error?: { code: string; message: string; }; }; type PostFlushResult = { result: unknown; postFlush: () => Promise; cancelPostFlush: () => void; }; export type DaemonRuntimeStatus = { control: 'ok' | 'degraded'; lastError: string | null; }; export type ControlServices = { notifier: PiNotifier; coordinator: GatewayCoordinator; sessionStatus?: () => Promise; /** Daemon-owned runtime state; never inspect persistence to produce this value. */ runtimeStatus?: () => DaemonRuntimeStatus; archivePath?: string; sessionControls?: { availableModels(): Promise; availableThinkingLevels(): Promise; applyDesired(): Promise; reset?(): Promise<{ archivedTo: string; recoverySent: boolean; }>; confirmReset?(challenge: string): Promise; }; }; export declare function dispatch(request: Request, services?: ControlServices): unknown; export declare function errorReply(id: string, error: unknown): Reply; export interface ControlServer { /** Closes the listener and removes only the socket inode this server bound. */ close(): Promise; lastError(): Error | null; } export type ControlServerOptions = { path?: string; /** Test/embedding hook for reporting an asynchronous listener failure. */ onRuntimeError?: (error: Error) => void; /** Internal validation seam used to exercise post-bind cleanup. */ validateBoundSocket?: (path: string) => void; /** Internal seam for observing a listener's runtime error handling. */ onServerCreated?: (server: Server) => void; }; export declare function startControlServer(services?: ControlServices, options?: ControlServerOptions): Promise; export {};