import type { VisionClawConfig } from "../config/types.js";
import type { ScreenshotInjector } from "./screenshot-injector.js";
import type { RuntimeSurface } from "./runtime-surface.js";
import { type SessionMode } from "./mailbox.js";
import type { AgentSessionLike } from "./engines/session-types.js";
export interface SwitchRequest {
    target: SessionMode;
    memo: string;
    reason: "handoff" | "complete";
    forwardMessage: string;
    cwd?: string;
}
/**
 * Manages two AgentSessions (general + coding) with cooperative switching.
 *
 * Only one session is active at a time. The agent decides when to switch
 * by calling the switch_session tool. The manager handles suspending the
 * current session and resuming the target.
 */
export declare class SessionManager {
    private config;
    private buildBaseSystemPrompt;
    /** Resolved runtime tool and external MCP surface for this model/provider pair. */
    private runtimeSurface;
    private _requestedDualSessionEnabled;
    private _androidUseEnabled;
    private generalSession;
    private codingSession;
    private _activeMode;
    private _managerStopRequested;
    /** Set after a switch_session tool call is detected in the stream. */
    private _pendingSwitch;
    /** Propagated to all sessions for auto-screenshot after Playwright tools. */
    private _screenshotInjector;
    private buildCodingSystemPrompt;
    private buildGeneralSystemPrompt;
    private buildSessionContext;
    private createSession;
    constructor(config: VisionClawConfig, buildSystemPrompt: () => string, runtimeSurface: RuntimeSurface, options: {
        dualSessionEnabled: boolean;
        androidUseEnabled: boolean;
    });
    get dualSessionEnabled(): boolean;
    /**
     * Toggle dual-session mode at runtime. Takes effect on the next wake cycle
     * because each query() call rebuilds its tool surface.
     */
    setDualSessionEnabled(enabled: boolean): void;
    /**
     * Set the screenshot injector that auto-injects screenshots after
     * Playwright tool calls. Propagated to all existing sessions.
     */
    setScreenshotInjector(injector: ScreenshotInjector | null): void;
    get activeMode(): SessionMode;
    get activeSession(): AgentSessionLike;
    get pendingSwitch(): SwitchRequest | null;
    /**
     * Record a switch request detected from the stream.
     * The main loop should check this after each stream ends and act on it.
     */
    setSwitchRequest(req: SwitchRequest): void;
    /**
     * Execute a pending session switch.
     * - Writes the memo to the mailbox
     * - Creates the coding session if it doesn't exist
     * - Updates the active mode
     * Returns the forwarded message content to send to the new session.
     */
    executePendingSwitch(): {
        target: SessionMode;
        forwardMessage: string;
    } | null;
    /**
     * Get any unread memos for the currently active session.
     * Call this before sending a message to the active session so
     * the memos can be prepended to the context.
     */
    consumeMemosForActive(): string | null;
    /**
     * Acknowledge that consumed memos for the active session have been
     * successfully injected. Removes them from the mailbox on disk.
     */
    ackMemosForActive(): void;
    /**
     * End the coding session (task complete or abandoned).
     * Switches back to general mode.
     */
    endCodingSession(summary: string): void;
    /**
     * Discard pre-warmed subprocesses on every session so the next turn
     * rebuilds them from the current `config`. Use after mutating provider-
     * bound state (e.g. client-side provider fallback) — without this, the
     * Claude warm subprocess can silently keep using the previous provider
     * for one more turn.
     */
    discardAllWarmQueries(): void;
    requestStop(): void;
    clearStop(): void;
    isStopRequested(): boolean;
    getCodingSessionStatus(): string | null;
    /**
     * Reset the active session: rotates the current session ID to
     * `previousSessionIds`, clears the active session ID, and passes the
     * summary to the session object for injection into the next turn.
     *
     * The next `sendAndStream` will create a brand-new SDK session.
     */
    resetActiveSession(summary: string): void;
    /**
     * Mode-aware variant of {@link resetActiveSession}. Rotates the
     * mode's persisted session id into `previousSessionIds`, then hands
     * `summary` to the corresponding session object so it is prepended to
     * the next turn as priority context.
     *
     * Used by `/refresh` (via {@link resetActiveSession}, which targets the
     * currently-active mode).
     *
     * No-op when the target session has not been constructed (the coding
     * session is lazy-created when the mailbox marks it active).
     */
    resetSession(mode: SessionMode, summary: string): void;
    /**
     * Inject a summary into a session WITHOUT rotating its session id.
     *
     * Used by the startup engine-switch boundary: rotation and mailbox
     * clearing happen *before* `SessionManager` is constructed (so the
     * manager sees the post-collapse world), and then this method just
     * threads the combined summary into the freshly created session's
     * first turn.
     *
     * No-op when the target session has not been constructed.
     */
    injectSummary(mode: SessionMode, summary: string): void;
}
//# sourceMappingURL=session-manager.d.ts.map