import { ClaudeCodeAdapter } from "./adapters/claude-code/ClaudeCodeAdapter.js";
import { ClaudeCodeSessionProvider } from "./adapters/claude-code/ClaudeCodeSessionProvider.js";
// ── Agent Provider (execution) ──────────────────────────────────────
let _provider = null;
export function getAgentProvider() {
    if (!_provider)
        _provider = new ClaudeCodeAdapter();
    return _provider;
}
/**
 * Test-only injection hook. Replaces the process-wide provider with a test
 * double (e.g. `MockAgentProvider`). Pass `null` to reset to lazy default.
 *
 * Not intended for production use — kept intentionally undocumented in
 * user-facing places. Phase 4 (plan) uses this to prove the seam with tests.
 */
export function setAgentProviderForTesting(provider) {
    _provider = provider;
}
// ── Session Provider (discovery) ────────────────────────────────────
let _sessionProviders = null;
/**
 * All registered session providers. Callers that list or search sessions
 * iterate over this array to merge results from all providers.
 *
 * Defaults to a single ClaudeCodeSessionProvider on first access.
 */
export function getSessionProviders() {
    if (!_sessionProviders) {
        _sessionProviders = [new ClaudeCodeSessionProvider()];
    }
    return _sessionProviders;
}
/**
 * Find a specific session provider by kind.
 * Returns undefined if no provider of that kind is registered.
 */
export function getSessionProvider(kind) {
    return getSessionProviders().find((p) => p.kind === kind);
}
/**
 * Test-only injection hook. Pass `null` to reset to lazy default.
 */
export function setSessionProvidersForTesting(providers) {
    _sessionProviders = providers;
}
