import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
interface DecisionAllow {
    behavior: 'allow';
    updatedInput?: Record<string, unknown>;
}
interface DecisionDeny {
    behavior: 'deny';
    message?: string;
}
type Decision = DecisionAllow | DecisionDeny;
interface ReminderResult {
    ok: boolean;
    result?: unknown;
    error?: string;
}
type MemoResult = ReminderResult;
type GoalResult = ReminderResult;
type A2aOutputFile = {
    name: string;
    bytes: number;
    mtime: string;
};
type A2aSuccess = {
    ok: true;
    result: string;
    jobId: number;
    agent: string;
    durationMs: number;
    artifactsDir?: string;
    outputs?: A2aOutputFile[];
    warnings?: string[];
};
type A2aFailure = {
    ok: false;
    error: string;
};
type A2aResult = A2aSuccess | A2aFailure;
type PushResult = ReminderResult;
type MemoryResult = ReminderResult;
interface AskOk {
    ok: true;
    result: {
        index: number;
        label: string;
        via: 'button' | 'text';
        raw: string;
    };
}
interface AskFail {
    ok: false;
    error: string;
    reason?: 'timeout' | 'cancelled' | 'invalid' | 'no-messenger';
}
type AskResult = AskOk | AskFail;
type SkillResult = ReminderResult;
declare class ApprovalClient {
    private readonly socketPath;
    private readonly runId;
    private socket;
    private buf;
    private pending;
    private pendingReminders;
    private pendingMemos;
    private pendingA2A;
    private pendingPush;
    private pendingMemory;
    private pendingAsk;
    private pendingSkill;
    private pendingGoal;
    private connectErr;
    private closed;
    private connectPromise;
    constructor(socketPath: string, runId: string);
    private connect;
    private onData;
    private dispatch;
    private onClose;
    /**
     * Send an approval request and wait for the decision. If the bus is
     * unreachable or the connection has dropped, returns a deny synchronously.
     */
    request(args: {
        toolName: string;
        input: Record<string, unknown>;
        toolUseId: string;
    }): Promise<Decision>;
    /**
     * Send a reminder RPC and wait for the result. Same socket as approvals,
     * different message type. Bus delegates to reminder-rpc.ts which actually
     * touches reminders.db.
     */
    requestReminder(op: string, payload: Record<string, unknown>): Promise<ReminderResult>;
    /** Stage 3 / P0 #3 — skills loader RPC. op ∈ 'read'|'list'|'refresh'. */
    requestSkill(op: string, payload: Record<string, unknown>): Promise<SkillResult>;
    /** v1.5 — long-term memory ops via approval-bus. */
    requestMemory(op: string, payload: Record<string, unknown>): Promise<MemoryResult>;
    /** v1.3 — agent-initiated push to an IM thread. */
    requestPush(payload: Record<string, unknown>): Promise<PushResult>;
    /** P0 #5 — agent asks the user a question, waits for the reply. */
    requestAsk(payload: Record<string, unknown>): Promise<AskResult>;
    /** v1.2.63 — goal RPC. op ∈ 'long_task' | 'complete_goal'. */
    requestGoal(op: string, payload: Record<string, unknown>): Promise<GoalResult>;
    /** Same shape as requestReminder, different message type. Bus delegates
     *  to memo-rpc.ts which actually writes memos.db. */
    requestMemo(op: string, payload: Record<string, unknown>): Promise<MemoResult>;
    /** A2A — ask the bus to invoke another agent. Bus resolves the
     *  caller via runId → RunContext, validates depth + self-call, runs
     *  the callee via a2a.callAgentByName, and writes back the result.
     *
     *  L2 additions (all optional):
     *    inputs        — file payloads dropped into the callee's
     *                    _agim-input/ before it runs.
     *    expectOutputs — filenames the callee is expected to produce;
     *                    misses become warnings, not failures. */
    requestCallAgent(payload: {
        agent: string;
        prompt: string;
        timeoutMs?: number;
        inputs?: Array<{
            name: string;
            fromCallerOutput: string;
        } | {
            name: string;
            fromAbsolutePath: string;
        } | {
            name: string;
            content: string;
        }>;
        expectOutputs?: string[];
    }): Promise<A2aResult>;
    close(): Promise<void>;
}
/**
 * Build the MCP server. Exposed as a function (rather than top-level `await`)
 * so tests can construct it without spinning up stdio.
 */
export declare function buildServer(client: ApprovalClient): McpServer;
export { ApprovalClient };
//# sourceMappingURL=mcp-approval-server.d.ts.map