/**
 * Centralized session resume/create logic for all CodeVibe plugins.
 *
 * All three plugins (Claude, Codex, Gemini) need the same pattern:
 * 1. Check if session exists in backend (getSession)
 * 2. If exists: reactivate + restore E2E session key from encryptedKeys
 * 3. If not exists: generate encryption keys + create session
 *
 * This module eliminates the duplication across plugins.
 */
import { AppSyncClient } from '../appsync';
import { Logger } from '../logger';
import { AgentType, EncryptedSessionKey } from '../types';
export interface ResumeOrCreateSessionInput {
    sessionId: string;
    userId: string;
    agentType: AgentType;
    projectPath: string;
    metadata?: Record<string, any>;
}
export interface ResumeOrCreateSessionResult {
    /** Whether an existing session was found and reactivated */
    resumed: boolean;
    /** The E2E session key (for encrypting/decrypting events), or null if no encryption */
    sessionKey: string | null;
}
/**
 * Prepare E2E encryption for a new session.
 *
 * Generates a random session key and encrypts it for all registered devices.
 * Does NOT cache the session key — callers should cache only after the session
 * is successfully created in the backend.
 *
 * @returns Encryption data or null if no device keys found / error
 */
export declare function prepareSessionEncryption(sessionId: string, appSyncClient: AppSyncClient, logger: Logger): Promise<{
    sessionKey: string;
    encryptedKeys: EncryptedSessionKey[];
} | null>;
/**
 * Resume an existing session or create a new one.
 *
 * Resume path (session exists in backend):
 *   - Reactivates session (status → ACTIVE)
 *   - Restores E2E session key from encryptedKeys
 *
 * Create path (session does not exist):
 *   - Prepares E2E encryption (generates key, encrypts for all devices)
 *   - Encrypts projectPath and metadata
 *   - Creates session in backend
 *   - Caches session key only after successful creation
 *
 * @throws Propagates createSession errors (e.g., SESSION_LIMIT_EXCEEDED)
 */
export declare function resumeOrCreateSession(input: ResumeOrCreateSessionInput, appSyncClient: AppSyncClient, logger: Logger): Promise<ResumeOrCreateSessionResult>;
