/**
 * SessionsHttpClient — the managed transport for `agents sessions export
 * --to-r2` / `import --from-r2` when the caller is signed in to Phoenix.
 *
 * Same put / get / list / delete surface as `R2Client` (`./r2.ts`), so the
 * export/import command drives EITHER a managed HTTP client or a BYO S3 client
 * through the one shared {@link SessionsBackupClient} interface. The difference
 * is only the wire: this talks to the managed sessions Worker over `fetch` with
 * a `Authorization: Bearer <phoenix-token>` header (the same request shape as
 * `traces/sync.ts`), instead of SigV4 against R2 directly.
 *
 * The userId namespace prefix is prepended INSIDE this client
 * (`${baseUrl}/${userId}/${key}`), so the caller passes the SAME object key it
 * passes to `R2Client` (`sessions/<machine>/<agent>/<sessionId>.jsonl`). That
 * keeps the BYO object layout (SES-27a) byte-identical while the managed Worker
 * gets its required `segments[0] === userId` prefix.
 */
/**
 * The verbs the session backup/restore path needs, satisfied by BOTH the
 * managed {@link SessionsHttpClient} and the BYO `R2Client`. `list` takes an
 * optional prefix: BYO passes the `sessions/` prefix; managed ignores it and
 * enumerates the whole owner namespace server-side.
 */
export interface SessionsBackupClient {
    readonly kind: 'managed' | 'byo';
    put(key: string, body: string | Uint8Array, contentType?: string): Promise<void>;
    get(key: string): Promise<string | null>;
    list(prefix?: string): Promise<string[]>;
    delete(key: string): Promise<void>;
}
/** Managed-only extension used to establish an immutable escrow key. */
export interface ManagedSessionsBackupClient extends SessionsBackupClient {
    readonly kind: 'managed';
    putIfAbsent(key: string, body: string | Uint8Array, contentType?: string): Promise<boolean>;
}
export declare class SessionsHttpClient implements ManagedSessionsBackupClient {
    readonly kind: "managed";
    private base;
    private userId;
    private token;
    constructor(opts: {
        baseUrl: string;
        userId: string;
        token: string;
    });
    /** `${baseUrl}/<userId>/<key>` with every path segment percent-encoded. */
    private objUrl;
    private authHeaders;
    /** Upload an object under this owner's namespace. Overwrites unconditionally. */
    put(key: string, body: string | Uint8Array, contentType?: string): Promise<void>;
    /** Create an object exactly once. A concurrent winner returns false. */
    putIfAbsent(key: string, body: string | Uint8Array, contentType?: string): Promise<boolean>;
    /** Fetch an object as text, or null if it does not exist (404). */
    get(key: string): Promise<string | null>;
    /**
     * List this owner's object keys, each relative to the `<userId>/` prefix (so
     * they feed straight back into `get`/`delete`). The `prefix` arg is accepted
     * for interface parity with `R2Client` but ignored — the managed Worker
     * enumerates the whole owner namespace and excludes the reserved `__` keys
     * server-side.
     */
    list(_prefix?: string): Promise<string[]>;
    /** Delete an object (the Worker refunds its bytes to the quota ledger). */
    delete(key: string): Promise<void>;
}
