import type { DaemonSnapshot } from "@oh-my-pi/pi-tui/tools/daemon"; import type { DaemonRpcResult } from "./protocol.js"; import type { ToolSession } from "../tools/index.js"; export interface ServiceReady { log?: string; port?: number; host?: string; timeout?: number; } export interface ServiceStart { name: string; command: string; cwd?: string; pty?: boolean; ready?: ServiceReady; /** Overlay on the configured shell env; wins over it. */ env?: Record; } export declare function hasLiveOwnedService(session: ToolSession): boolean; export declare function waitForOwnedServiceCompletion(session: ToolSession, signal?: AbortSignal): Promise; export declare function listServices(session: ToolSession, signal?: AbortSignal): Promise; /** * {@link listServices} for callers whose jobs and agents live in-process (`wait`, * `proc://`): a broker failure (timeout, crash) must not hide that state. Returns * the failure message alongside an empty list; owned-service tracking keeps its * last known state. A caller abort still throws. */ export declare function listServicesTolerant(session: ToolSession, signal?: AbortSignal): Promise<{ services: DaemonSnapshot[]; error?: string; }>; export declare function findService(session: ToolSession, name: string, signal?: AbortSignal): Promise; export declare function serviceLogPath(session: ToolSession, name: string): Promise; /** Render legacy broker PTY bytes outside the client process. */ export declare function renderServiceLogTerminalRows(result: Extract, lines?: number): Promise; export declare function serviceLogsWithRows(session: ToolSession, name: string, signal?: AbortSignal): Promise<{ text: string; terminalRows?: string[]; }>; export declare function serviceLogs(session: ToolSession, name: string, signal?: AbortSignal): Promise; /** * Start a session-owned daemon and wait for its requested readiness condition. * `readyInterrupt` ends only the readiness wait, after the broker acknowledged * the launch: the call then resolves `readyInterrupted` with the launched * snapshot while the service keeps starting. Validation, connection, and launch * failures still reject. */ export declare function startService(session: ToolSession, params: ServiceStart, signal?: AbortSignal, readyInterrupt?: AbortSignal): Promise<{ daemon: DaemonSnapshot; readyTimedOut: boolean; readyInterrupted: boolean; }>; export declare function sendService(session: ToolSession, name: string, content: string, signal?: AbortSignal): Promise; export declare function stopService(session: ToolSession, name: string, signal?: AbortSignal): Promise; export declare function modeService(session: ToolSession, name: string, mode: "persist" | "session" | "detached", signal?: AbortSignal): Promise; export declare function serviceStatus(daemon: DaemonSnapshot): string;