import type { ToolDefinition } from "@sheason/pi-coding-agent";
import type { HubLogSink } from "../tui/hub-log.js";
import { type McpClientHandle } from "./mcp-client.js";
import type { McpRuntimeStatus, McpServerConfig } from "./types.js";
export interface McpHostOptions {
    cwd: string;
    customTools: ToolDefinition[];
    configPath?: string;
    configRoot?: () => unknown;
    timeoutMs?: number;
    createClient?: (config: McpServerConfig, opts: {
        timeoutMs: number;
    }) => Promise<McpClientHandle>;
    logs?: HubLogSink;
}
type MutateOk = {
    ok: true;
    servers: McpRuntimeStatus[];
};
type MutateErr = {
    ok: false;
    error: string;
};
type MutateResult = MutateOk | MutateErr;
export declare class McpHost {
    private readonly cwd;
    private readonly customTools;
    private readonly configPath?;
    private readonly configRoot?;
    private readonly timeoutMs;
    private readonly createClient;
    private readonly logs;
    private _configError;
    /** From the last `readMcpConfig` that succeeded. Empty on parse failure or when file empty. */
    private orderedServers;
    /** State aligned with `orderedServers` order for `getStatuses()`. */
    private lastStates;
    private clients;
    /** In-flight `restart()`: all concurrent callers share one stop+start cycle. */
    private _restartInFlight;
    constructor(options: McpHostOptions);
    private log;
    /**
     * The shared `ToolDefinition[]` from construction (mutated by this host; same
     * instance as the hub / agent `customTools` array when wired from `HubRuntime`).
     */
    getSharedCustomToolsArray(): ToolDefinition[];
    /** Populated when `mcp.json` is missing or not valid JSON, or the parser fails. */
    getConfigError(): string | undefined;
    getStatuses(): McpRuntimeStatus[];
    /**
     * `stop()` + `start()` in sequence. Concurrent callers await the same in-flight
     * operation so the host does not interleave `close` and `connect` for multiple cycles.
     */
    restart(): Promise<void>;
    stop(): Promise<void>;
    start(): Promise<void>;
    private requireKnownServerInConfigOrFail;
    pauseServer(resourceId: string): Promise<MutateResult>;
    restartServer(resourceId: string): Promise<MutateResult>;
    removeServer(resourceId: string): Promise<MutateResult>;
}
export {};
//# sourceMappingURL=mcp-host.d.ts.map