import type DreamApp from '../dream-app/index.js';
/**
* The number of databases in the pre-created pool (including the unsuffixed
* base at index 1). Shared by the CLI pool-creation / drop loops and the claim
* probe so they always agree on the index range.
*/
export declare function testDatabasePoolSize(parallelTests: number | undefined): number;
/**
* Normalize configured test parallelism to the minimum safe pool width input.
* Even a serial vitest run can overlap old/new worker processes, so missing,
* invalid, zero, or fractional-below-one values all mean "one active worker",
* not "disable the per-live-worker database pool".
*/
export declare function normalizeTestDatabaseParallelism(parallelTests: number | undefined): number;
/**
* The database name for a pool index given the un-suffixed base name. Index 1
* is the base itself (no suffix); higher indexes are `_`. This is
* the single naming rule, used by both the claim path and the CLI loops.
*/
export declare function testDatabaseNameForIndex(baseName: string, index: number): string;
/**
* Sync read of the already-claimed pool index, or null if no claim has
* completed yet in this process. `DreamApp.dbName()` (synchronous, called when
* Kysely builds a pool) relies on the claim having been awaited earlier in the
* worker — `DreamApp.init()` awaits {@link claimTestDatabase} before the first
* connection is built, and `truncate` awaits it too — so by the time any
* connection resolves its database name the index is populated.
*/
export declare function claimedTestDatabaseIndexOrNull(): number | null;
/**
* Claim a free pool database for this worker (idempotent). On first call it
* opens the default driver's dedicated lock session, probes
* {@link TestDatabaseLockSession.tryAcquire} across the pool indexes until one
* succeeds, and caches the claimed index for the rest of the process.
* Subsequent calls (and concurrent callers) return the same index.
*
* Throws a loud, actionable error if the pool is genuinely exhausted after the
* wait-for-free window — telling the reader to recreate the pool with
* ` psy db:reset`.
*/
export declare function claimTestDatabase(dreamApp: DreamApp): Promise;
/**
* Test-only escape hatch for dream's own spec suite: release the claim and
* close the lock session so a test can exercise the claim machinery in
* isolation. Not part of the public API.
*
* @internal
*/
export declare function __resetTestDatabaseClaimForSpec(): Promise;