import type { StorageBackend, DeregisterResult } from "./storage-backend.js";
import type { PeerInfo, MessageRecord, CliExecResult } from "../types.js";
import { type HealthCheckResult } from "../services/health-check.js";
import type { HttpClient } from "../cloud/http-client.js";
/**
 * Cloud-mode storage backend.
 *
 * Implements StorageBackend by translating all state operations into REST
 * API calls to the cloud relay server. Used when COGENT_ENDPOINT is
 * set to an HTTP/HTTPS URL.
 *
 * Cloud-specific behavior differences from FileBackend:
 * - updateLastSeen is a no-op (server tracks activity automatically)
 * - validateSession always returns true (server validates on every request)
 * - execClaude returns a synthetic result (no CLI subprocess in cloud mode)
 * - checkHealth queries the server health endpoint instead of local checks
 */
export declare class HttpBackend implements StorageBackend {
    private readonly http;
    private readonly sessionId;
    constructor(http: HttpClient, sessionId: string);
    /**
     * Register a peer in the cloud session.
     * POST /api/sessions/:sessionId/peers
     *
     * The sessionId parameter from StorageBackend is the local CC sessionId;
     * in cloud mode we ignore it and use this.sessionId (the cloud session).
     */
    registerPeer(peerId: string, _sessionId: string, cwd: string, label: string, clientVersion?: string, mode?: "observer" | "agent", _channelSessionId?: string, capabilities?: string[], workspaceId?: string, threadId?: string, 
    /**
     * AUD-003 ownership proof, replayed from the local credential file when this agent's token has
     * changed since the peer was created (a re-join). Gated on the relay advertising
     * `peer-ownership`: the register schema is .strict(), so sending it to a relay that does not
     * know the field would 400 EVERY registration — the exact shape of AUD-001 and of the
     * 2026-08-07 outage.
     */
    peerSecret?: string): Promise<PeerInfo>;
    /**
     * Deregister a peer from the cloud session.
     * DELETE /api/sessions/:sessionId/peers/:peerId
     *
     * Returns `{ removed, mailboxDeprovisioned }`. `mailboxDeprovisioned` reflects the relay's
     * `X-Cogent-Mailbox-Deprovisioned` response header (Cogent Mail F3) — true ONLY when the relay
     * confirmed the Team mailbox was reaped, so the deregister-peer tool can clear the now-dead
     * local mail creds. A 404 (peer not found) resolves to `{ removed: false, ... }`, not a throw.
     */
    deregisterPeer(peerId: string, peerSecret?: string): Promise<DeregisterResult>;
    /**
     * Get a single peer by ID.
     * No dedicated single-peer REST endpoint exists, so we list all peers
     * and filter client-side.
     */
    getPeer(peerId: string): Promise<PeerInfo | undefined>;
    /**
     * List all peers in the cloud session.
     * GET /api/sessions/:sessionId/peers
     */
    listPeers(): Promise<PeerInfo[]>;
    /**
     * Update last-seen timestamp for a peer.
     * Calls the lightweight heartbeat endpoint on the cloud relay server.
     */
    updateLastSeen(peerId: string): Promise<void>;
    /**
     * Record a message in the cloud session.
     * POST /api/sessions/:sessionId/messages
     *
     * Sends the message to the server which stores it and returns
     * { id, success, timestamp }. We merge the server response with
     * the input record to construct a full MessageRecord.
     */
    recordMessage(record: Omit<MessageRecord, "id" | "timestamp">): Promise<MessageRecord>;
    /**
     * Get message history from the cloud session.
     * GET /api/sessions/:sessionId/messages
     *
     * Supports optional peerId filter and limit (default 300).
     */
    getHistory(peerId?: string, limit?: number, includeRelayEchoes?: boolean, metadataOnly?: boolean, dedupInferredEchoes?: boolean): Promise<MessageRecord[]>;
    /**
     * Update an existing message record's response field on the server.
     * PATCH /api/sessions/:sessionId/messages/:messageId
     *
     * Called by send-message after receiving the async cloud response,
     * so that get-history shows the actual response (not null).
     */
    updateMessageResponse(messageId: string, response: string | null, durationMs: number, pending?: boolean): Promise<void>;
    /**
     * Validate a session.
     * In cloud mode, the server validates session authenticity on every
     * authenticated request, so this always returns true.
     */
    validateSession(_sessionId: string, _cwd: string): Promise<boolean>;
    /**
     * Execute a Claude CLI command.
     * In cloud mode, there is no CLI subprocess. Message delivery is
     * handled by recordMessage() via REST. The send-message tool handler
     * calls execClaude() after validating peers, then calls recordMessage()
     * separately. In cloud mode, execClaude simply returns a synthetic
     * result indicating the message was delivered via the cloud relay.
     */
    execClaude(_sessionId: string, _message: string, _cwd: string, _timeoutMs?: number): Promise<CliExecResult>;
    /**
     * Check health of the cloud relay server.
     * GET /api/health
     *
     * Maps the server's HealthResponse into the local HealthCheckResult
     * format with cloud-mode-specific diagnostics.
     */
    checkHealth(): Promise<HealthCheckResult>;
    /**
     * Lazy lookup of the upstream relay's `version` field via GET /api/health,
     * memoized for 60s. Returns null on fetch failure or malformed payload.
     * Never throws — the caller (health-check tool) treats null as "unknown"
     * and keeps the rest of the response intact.
     *
     * Delegates to the module-scoped cache in `relay-version-cache.ts` so the
     * TTL is shared across all callers and tests can reset state via
     * `__resetCacheForTest()`. VER-02 (3.2).
     */
    getRelayVersion(): Promise<string | null>;
}
//# sourceMappingURL=http-backend.d.ts.map