/**
 * intelligenceProviderFactory — pick the right IntelligenceProvider
 * implementation for a configured framework.
 *
 * Provider-portability v1.0.0: until v0.x, ClaudeCliIntelligenceProvider
 * was the ONLY implementation, and every reviewer/sentinel/canary
 * routed through `claude -p`. This factory lets the composition root
 * pick `claude-code`, `codex-cli`, or another framework's implementation
 * at startup based on `INSTAR_FRAMEWORK` env var or the agent's
 * configured `primaryFramework`.
 *
 * When the configured framework's binary isn't installed, the factory
 * returns null. The composition root decides whether that's a fatal
 * error or a "fall back to whatever IS installed" situation.
 */
import type { IntelligenceProvider } from './types.js';
import type { LlmCircuitBreaker } from './LlmCircuitBreaker.js';
import { type SubscriptionPathMode, type SubscriptionRouteInfo, type SubscriptionDegradeInfo } from './AnthropicSubscriptionRouter.js';
import type { ProviderAdapter } from '../providers/registry.js';
import type { AgentSdkCreditSnapshot } from '../providers/primitives/observability/usageMeterProvider.js';
/**
 * Stable framework identifiers the factory recognizes. Adding a new
 * framework requires (a) extending this union and (b) wiring up a case
 * in `buildIntelligenceProvider`.
 *
 * NOTE (apprenticeship Step 2): extending this union is the ONLY
 * compiler-forced wiring — it forces the `never`-exhaustive switch below
 * and every `Record<IntelligenceFramework, …>` map. The ~10 parallel
 * hardcoded `'claude-code' | 'codex-cli'` unions across the tree are NOT
 * related to this type by the compiler; they are a hand-audit checklist
 * (see APPRENTICESHIP-STEP2-GEMINI-RUNTIME-ADAPTER-SPEC §4.3).
 */
export type IntelligenceFramework = 'claude-code' | 'codex-cli' | 'gemini-cli' | 'pi-cli';
export interface BuildIntelligenceProviderOptions {
    /**
     * Which framework's CLI to route through. Defaults to 'claude-code'
     * for backwards-compat — v0.x behavior is preserved when the field
     * is unset.
     */
    framework?: IntelligenceFramework;
    /**
     * Explicit binary path override. When unset, detection runs.
     */
    binaryPath?: string;
    /**
     * Optional working directory (currently used only by Codex).
     */
    workingDirectory?: string;
    /**
     * Optional circuit breaker to wrap the provider with. When omitted, the
     * account-global singleton is used (today's behavior). The IntelligenceRouter
     * passes a DISTINCT breaker per framework so per-framework rate-limit isolation
     * actually holds (docs/specs/per-component-framework-routing.md, D3).
     */
    breaker?: LlmCircuitBreaker;
    /**
     * Optional quota-state path for providers whose live capacity signal is only
     * available after invoking the CLI. Currently used by gemini-cli to persist
     * CLI-reported usage-limit windows into the existing quota gate.
     */
    quotaStateFile?: string;
    /**
     * Anthropic subscription-path routing (June-15 readiness, spec 04 Rule 1).
     * claude-code framework only; ignored for codex/gemini. When present, the
     * ClaudeCliIntelligenceProvider is wrapped in an AnthropicSubscriptionRouter
     * (SDK-credit `claude -p` ⟷ interactive REPL pool) BEFORE the circuit
     * breaker. When absent (config mode 'off' / unset), the claude-code path is
     * byte-for-byte today's behavior.
     */
    subscriptionPath?: {
        mode: SubscriptionPathMode;
        /** The registered anthropic-interactive-pool adapter (bootRegistration). */
        poolAdapter: ProviderAdapter;
        /** Real credit reader (bootRegistration.buildReadSdkCredit). */
        readSdkCredit: () => Promise<AgentSdkCreditSnapshot | null>;
        safetyMarginFraction?: number;
        onRoute?: (info: SubscriptionRouteInfo) => void;
        onDegrade?: (info: SubscriptionDegradeInfo) => void;
    };
    /**
     * pi-cli only (PI-HARNESS-INTEGRATION-SPEC §4.4): the REQUIRED pi model
     * pattern (`provider/id`, e.g. 'openai-codex/gpt-5.5'). Sourced from
     * frameworkDefaultModels['pi-cli'] at the wiring site. Without it the
     * pi-cli case degrades to null (the subscription guard denies
     * pattern-less pi calls by design).
     */
    piModel?: string;
    /**
     * pi-cli only (spec §4.3): explicit opt-in for Anthropic-routed patterns.
     * Sourced from `.instar/config.json` → `piCli.allowAnthropicProviders`.
     * Even when true, allowed calls are audit-logged with a cost warning.
     */
    piAllowAnthropicProviders?: boolean;
    /**
     * codex-cli only (token-audit-completeness): per-call kill-switch read for
     * exec-json mode. Construction sites with config thread
     * `createCodexExecJsonConfigResolver()`; absent, the provider falls back to
     * env `INSTAR_CODEX_EXEC_JSON !== '0'` so config-less sites keep a working
     * rollback lever.
     */
    resolveExecJson?: () => boolean;
}
/**
 * Build an IntelligenceProvider for the given framework. Returns null
 * if the required binary can't be located. The caller decides what
 * happens next — fatal error, fall-back to a different framework, or
 * disable LLM-backed paths entirely.
 *
 * @example
 *   const intel = buildIntelligenceProvider({ framework: 'codex-cli' });
 *   if (intel === null) {
 *     console.warn('Codex CLI not found — LLM-backed paths disabled.');
 *   }
 */
export declare function buildIntelligenceProvider(options?: BuildIntelligenceProviderOptions): IntelligenceProvider | null;
/**
 * Convenience: read the framework selection from the environment.
 * Returns null when no framework is explicitly selected, leaving
 * the caller to apply the default (`claude-code`) or its own logic.
 */
export declare function frameworkFromEnv(env?: NodeJS.ProcessEnv): IntelligenceFramework | null;
//# sourceMappingURL=intelligenceProviderFactory.d.ts.map