import type { Command } from 'commander';
import type { SessionMeta } from '../lib/session/types.js';
import { type SessionsBackupClient } from '../lib/session/sync/net-client.js';
import { type BundleHeader, type BundleRecord } from '../lib/session/bundle.js';
export declare function registerSessionsExportCommand(sessionsCmd: Command): void;
interface GlobalSelection {
    since?: string;
    limit?: string;
    all?: boolean;
    agent?: string;
    redact?: boolean;
    encrypt?: boolean;
    toR2?: boolean;
    byo?: boolean;
    output?: string;
    stdout?: boolean;
    host?: string[];
    claude?: boolean;
    codex?: boolean;
    kimi?: boolean;
    grok?: boolean;
    opencode?: boolean;
    antigravity?: boolean;
}
/**
 * Upload each record to R2 as its own self-describing one-record bundle, keyed by
 * the surviving object layout (`sessions/<machine>/<agent>/<sessionId>.jsonl`, or
 * `.../<sessionId>/<relKey>` for dir-shaped agents). Each object is independently
 * a valid bundle, so `import --from-r2` restores it through the same parse/place
 * path as a local bundle. Fails loud on the first upload error (no silent
 * partial-success).
 */
/**
 * `--to-r2` preflight as a pure, unit-testable function: the impossible-combo +
 * not-configured gate. Returns the message to fail loud with, or null when the
 * export may proceed. Only meaningful when `g.toR2` is set (the caller gates on
 * that). Kept pure — no process.exit, no keychain read — so both the command and
 * its test drive the exact same decision.
 */
export declare function r2ExportGateError(g: Pick<GlobalSelection, 'toR2' | 'host'>, isConfigured: boolean): string | null;
export declare function uploadToR2(header: BundleHeader, records: BundleRecord[], resolvedClient?: SessionsBackupClient): Promise<void>;
/** Fail-closed guard at the managed transport boundary, not only at record construction. */
export declare function managedUploadEncryptionError(header: BundleHeader, records: BundleRecord[]): string | null;
/** R2 object key for one record — dir-shaped agents key by relKey, file-shaped by session. */
export declare function r2KeyForRecord(rec: BundleRecord): string;
/**
 * Resolve the AES key for an R2 backup: the fleet-shared R2_SYNC_ENC_KEY from the
 * r2.backups bundle so any box on the bundle can restore. Unlike a local bundle,
 * an ephemeral key is useless here (it is never stored, so a fresh box could not
 * decrypt), so a missing key means the objects go up unencrypted (R2 server-side
 * encryption only) with a loud warning — never a silent weaker default.
 */
export declare function resolveR2BackupKey(): Buffer | null;
/** ids > query > everything-in-scope. Exported for the id-resolution test. */
export declare function selectSessions(metas: SessionMeta[], selectors: string[]): SessionMeta[];
export {};
