/**
 * @license
 * Copyright 2026 Amodal Labs, Inc.
 * SPDX-License-Identifier: MIT
 */
import type { StudioBackend } from './backend';
/**
 * A function that creates a StudioBackend for a given request.
 * Allows external deployments to inject per-request backends
 * (e.g. scoped to a specific agent or user context).
 */
export type BackendFactory = (req: Request) => Promise<StudioBackend>;
/**
 * Set a custom backend factory. When set, {@link getBackend} uses this
 * factory instead of the default singleton DrizzleStudioBackend.
 *
 * Call once at application startup (e.g. in a Next.js instrumentation hook).
 * Pass `null` to revert to the default singleton behavior.
 */
export declare function setBackendFactory(factory: BackendFactory | null): void;
/**
 * Get the StudioBackend instance for a request.
 *
 * If a custom {@link BackendFactory} has been set via {@link setBackendFactory},
 * it is called with the request to produce a per-request backend.
 *
 * Otherwise falls back to the singleton DrizzleStudioBackend, initialized
 * from environment variables:
 * - REPO_PATH: path to the agent's repo directory (required)
 * - DATABASE_URL: Postgres connection string (required, read by @amodalai/db)
 */
export declare function getBackend(req?: Request): Promise<StudioBackend>;
/**
 * Reset the backend singleton. Used for testing only.
 */
export declare function resetBackend(): void;
