import { type Json } from "./protocol.js";
/**
 * The terminal's way through owner proof (owner-proof.ts). Once a phone has
 * signed, an unsigned owner-only request is refused, and the owner's own
 * terminal cannot sign. A terminal command that sends
 * `X-Phren-Owner-Confirm: wait` is held instead: the request appears on the
 * phone (`GET /v1/owner-confirms`, or the overview socket's `ownerConfirms`
 * frame when it asks with `confirms=1`) and goes ahead only when the phone
 * answers `POST /v1/owner-confirms/answer` with approve, a request the phone
 * signs like any owner action. An agent can ask the same way, but only the
 * owner's phone can say yes, and the card names the exact action.
 */
export declare const OWNER_CONFIRM_HEADER = "x-phren-owner-confirm";
export declare const OWNER_CONFIRM_HOLD_MS: number;
/** Held requests at once; more are refused, so an agent cannot flood the phone. */
export declare const MAX_OWNER_CONFIRMS = 4;
export interface OwnerConfirmView {
    id: string;
    kind: "owner-confirm";
    computer: string;
    /** One plain sentence: what goes ahead on approve. */
    title: string;
    detail?: string;
    /** `METHOD /path` of the held request. */
    route: string;
    askedAt: string;
    expiresAt: string;
}
/** What the phone shows for a held request; undefined for routes the terminal may not confirm this way. */
export declare function describeOwnerAction(method: string, pathname: string, data: Json): {
    title: string;
    detail?: string;
} | undefined;
export interface OwnerConfirmOptions {
    computer: () => string;
    holdMs?: number;
    now?: () => number;
}
export declare class OwnerConfirmBroker {
    private options;
    private pending;
    private events;
    constructor(options: OwnerConfirmOptions);
    list(): OwnerConfirmView[];
    subscribe(listener: (requests: OwnerConfirmView[]) => void): () => void;
    private changed;
    /** Hold a request until the phone answers. Resolves on approve; throws 403
     * on deny, 408 when no answer came in time, 429 when too many are waiting. */
    confirm(method: string, pathname: string, data: Json, closed?: Promise<void>): Promise<void>;
    /** The phone's signed answer. False when the request is no longer waiting. */
    answer(id: string, approve: boolean): boolean;
}
