/**
 * remote/port — the RemoteControlPort + the RemoteControlHub reference impl.
 *
 * The hub is the central object of remote-control. It:
 *   - IS a `SessionEventSink` — the agent loop emits events to it;
 *   - keeps a ring buffer of recent events so a reconnecting client can
 *     backfill gap-free (using each event's monotonic `seq`);
 *   - fans events out to live subscribers (the SSE/relay transports);
 *   - owns the `InstructionInbox` — the inbound steering channel;
 *   - derives live `SessionState` from the event stream.
 *
 * Transport-agnostic: `http-server.ts` and `relay-client.ts` are thin
 * adapters over this hub — exactly the port/transport split the SDK already
 * uses for HITL (`ApprovalChannel` + `hitl/slack.ts`).
 *
 * @public @since 2.11.0 — preste remote-control T1
 */
import { type EventNamingMode } from "./event-name-map.js";
import type { SessionEvent } from "./events.js";
import { type InstructionInbox } from "./inbox.js";
import { type PersistencePort } from "./persistence.js";
import { type SignFn } from "./signing.js";
import type { SessionEventSink } from "./sink.js";
import { type VetoChannel } from "./veto.js";
/** A live snapshot of the controlled session. */
export interface SessionState {
    runId: string | null;
    agentId: string | null;
    status: "idle" | "running" | "finished";
    stepCount: number;
    costUsd: number;
    elapsedMs: number;
    /** HITL requests currently awaiting a verdict. */
    pendingHitl: number;
}
/**
 * The surface a remote client drives. The hub is the reference impl; any
 * transport (HTTP/SSE, relay, a future gRPC adapter) consumes this port.
 */
export interface RemoteControlPort extends SessionEventSink {
    /** Subscribe to live events. Returns an unsubscribe function. */
    subscribe(fn: (event: SessionEvent) => void): () => void;
    /**
     * Replay buffered events with `seq` strictly greater than `sinceSeq`
     * (omit `sinceSeq` for the full buffer) — gap-free reconnection.
     */
    backlog(sinceSeq?: number): SessionEvent[];
    /** The inbound steering channel. */
    readonly inbox: InstructionInbox;
    /** Pre-tool-call veto bus — T6a veto window. */
    readonly vetoChannel: VetoChannel;
    /** Current derived session state. */
    state(): SessionState;
}
export interface RemoteControlHubOptions {
    /** Max events retained for backfill. Default 1000. */
    bufferSize?: number;
    /** Inbox implementation. Default: a fresh InMemoryInstructionInbox. */
    inbox?: InstructionInbox;
    /**
     * When provided, every emitted event is Ed25519-signed before it is
     * buffered + streamed — the remote-control transcript becomes a
     * tamper-evident audit trail. See `remote/signing.ts`.
     */
    signFn?: SignFn;
    /** Pre-tool-call veto bus (T6a). Default: a fresh InMemoryVetoChannel. */
    vetoChannel?: VetoChannel;
    /**
     * Durable backing store for events + revocations (T7). When provided,
     * every emitted event is fire-and-forget written to disk. Persistence
     * failures are logged but never thrown into the agent loop.
     *
     * The hub does NOT pre-load events from persistence — callers wanting
     * to warm the buffer after a crash should call
     * `await loadHubFromPersistence(hub, persistence, opts)` before
     * starting the agent run.
     */
    persistence?: PersistencePort;
    /**
     * Event vocabulary used for the emitted `type` field.
     *
     * - `"canonical"` (default since 2.28.0) ; AG-UI Linux Foundation canonical
     *   UPPER_SNAKE_CASE (`RUN_STARTED`, `TEXT_MESSAGE_CONTENT`, etc.) ; aligned
     *   with the Linux Foundation AG-UI conformance suite.
     * - `"legacy"` (opt-in since 2.28.0) ; Vauban dotted-lowercase (`run.start`,
     *   etc.) ; required by consumers that have not yet shipped a canonical-aware
     *   reader (preste-pwa, dashboard wire-format, gateway render, signed-event
     *   verification flows that pre-existed 2.28.0). Pass this explicitly until
     *   every downstream is canonical-aware.
     *
     * Vauban-specific extensions with no AG-UI peer (`tool.intent`, `hitl.*`,
     * `instruction.injected`) are projected onto `CUSTOM_*` names in canonical
     * mode ; round-tripping through `event-name-map.ts` is lossless.
     *
     * Roadmap : 2.29.0 emits a deprecation warning on every legacy-mode emit ;
     * 3.0.0 removes legacy entirely. See {@link normalizeEventType} +
     * `event-name-map.ts`.
     *
     * @default "canonical"
     * @public @since 2.27.0 (default flipped to canonical in 2.28.0)
     */
    eventNaming?: EventNamingMode;
}
/** Create a RemoteControlHub — the reference RemoteControlPort. */
export declare function createRemoteControlHub(opts?: RemoteControlHubOptions): RemoteControlPort;
/**
 * Warm a hub's in-memory backlog from a persistence store. Call once
 * after `createRemoteControlHub` and before serving traffic ; the events
 * become accessible via `hub.backlog()` exactly as if they had just been
 * emitted (no re-signing, no subscriber dispatch).
 *
 * Bounded by the hub's `bufferSize` ; oldest events are dropped first.
 *
 * @param hub          The hub returned by {@link createRemoteControlHub}.
 * @param persistence  The same persistence handed to the hub options.
 * @param opts         Optional cutoff `sinceSeq` (load only newer events).
 *
 * @public @since 2.21.0 — preste remote-control P7
 */
export declare function loadHubFromPersistence(hub: RemoteControlPort, persistence: PersistencePort, opts?: {
    sinceSeq?: number;
}): Promise<{
    loaded: number;
    maxSeq: number;
}>;
//# sourceMappingURL=port.d.ts.map