/**
 * workspace-swap-manager.ts
 *
 * Manages mutable runtime.workingDir transitions.
 *
 * The working directory hosts all conversation-scoped state:
 * sessions, memory, logs, artifacts, knowledge stores. It can be swapped
 * at runtime via POST /config {key:"runtime.workingDir", value:"<path>"}.
 *
 * Swap policy:
 *   - Refused with WORKSPACE_BUSY when any session has pendingInputCount > 0.
 *   - Returns INVALID_PATH when the new path cannot be created.
 *   - On success, persists the new path to <daemonHomeDir>/daemon-settings.json.
 *
 * Events emitted on runtimeBus (domain: 'workspace'):
 *   WORKSPACE_SWAP_STARTED   — before swap begins
 *   WORKSPACE_SWAP_REFUSED   — when swap is rejected
 *   WORKSPACE_SWAP_COMPLETED — after all stores re-rooted
 *   WORKSPACE_SWAP_FAILED    — when mkdir or rerootStores fails
 */
import type { RuntimeEventBus } from '../runtime/events/index.js';
export interface WorkspaceSwapDeps {
    readonly runtimeBus: RuntimeEventBus | null;
    readonly daemonHomeDir: string;
    /**
     * Called by the manager to check whether any session currently has pending
     * input (i.e. `pendingInputCount > 0`). Returns the count of busy sessions.
     */
    readonly getBusySessionCount: () => number;
    /**
     * Called after the manager validates the new path.
     * Implementations must close existing stores and re-open them at newWorkingDir.
     * May throw; the manager catches and returns INVALID_PATH.
     */
    readonly rerootStores: (newWorkingDir: string) => Promise<void>;
}
export type WorkspaceSwapResult = {
    ok: true;
    previous: string;
    current: string;
} | {
    ok: false;
    code: 'WORKSPACE_BUSY';
    reason: string;
    retryAfter: number;
} | {
    ok: false;
    code: 'INVALID_PATH';
    reason: string;
};
export declare class WorkspaceSwapManager {
    private readonly deps;
    private currentWorkingDir;
    private swapInProgress;
    constructor(initialWorkingDir: string, deps: WorkspaceSwapDeps);
    getCurrentWorkingDir(): string;
    requestSwap(newWorkingDir: string): Promise<WorkspaceSwapResult>;
    private _requestSwapInner;
    private _emit;
}
//# sourceMappingURL=workspace-swap-manager.d.ts.map