/**
 * Shared install/connect diagnosis.
 *
 * One place computes "what state is this install in, and what is the single
 * next action" so the answer is identical whether an AI calls the ungated
 * `setup_status` MCP tool, a human runs `mailpouch doctor`, or a test asserts
 * the decision logic. The pure `computeSetupStatus()` holds the decision tree;
 * `gatherSetupStatus()` does the IO (config + keychain + TCP probe) and calls it.
 *
 * Deliberately light: it does NOT perform a live IMAP/SMTP auth handshake (that
 * needs the running services and is what `get_connection_status` is for, after
 * approval). It reports configured-ness, TCP reachability, and grant state —
 * the three things that block a fresh install from connecting — plus the exact
 * command/action to unblock each one.
 */
import type { AgentGrantStatus } from "../agents/types.js";
export type SetupState = "unconfigured" | "bridge-unreachable" | "pending-approval" | "revoked" | "ready";
export interface SetupStatusInput {
    configExists: boolean;
    configPath: string;
    username: string;
    hasPassword: boolean;
    credentialStorage: "keychain" | "encrypted-file" | "config" | null;
    imap: {
        host: string;
        port: number;
        reachable: boolean;
    };
    smtp: {
        host: string;
        port: number;
        reachable: boolean;
    };
    allowInsecureBridge: boolean;
    bridgeCertConfigured: boolean;
    settingsPort: number;
    /** True when the config file exists on disk but could not be parsed (invalid JSON). */
    configError?: boolean;
    /** Per-agent grant state for the calling client, when the agent gate is active. */
    grant?: {
        status: AgentGrantStatus;
        clientName?: string;
    };
}
export interface SetupStatusResult {
    state: SetupState;
    configured: boolean;
    bridgeReachable: boolean;
    configExists: boolean;
    configPath: string;
    username: string | null;
    credentialStorage: string | null;
    imap: {
        host: string;
        port: number;
        reachable: boolean;
    };
    smtp: {
        host: string;
        port: number;
        reachable: boolean;
    };
    insecureTls: boolean;
    grantStatus: AgentGrantStatus | null;
    /** Single most-important action for the current state. */
    nextStep: string;
    /** Human-readable multi-line summary (shared by the tool text and `doctor`). */
    summary: string;
}
/** Pure decision tree — given a resolved snapshot, pick the state + next step. */
export declare function computeSetupStatus(input: SetupStatusInput): SetupStatusResult;
/** Lightweight TCP reachability probe (connect-then-drop). Never throws. */
export declare function probeTcp(host: string, port: number, timeoutMs?: number): Promise<boolean>;
export interface GatherSetupStatusOptions {
    /** Calling agent's grant state, when the per-agent gate is active. */
    grant?: {
        status: AgentGrantStatus;
        clientName?: string;
    };
    /** Injectable TCP probe (tests). Defaults to {@link probeTcp}. */
    probe?: (host: string, port: number, timeoutMs?: number) => Promise<boolean>;
}
/** Read config, resolve the active account, probe the Bridge ports, and compute the diagnosis. */
export declare function gatherSetupStatus(opts?: GatherSetupStatusOptions): Promise<SetupStatusResult>;
//# sourceMappingURL=setup-status.d.ts.map