/**
 * Auto-detection and configuration management.
 *
 * Finds tmux, Claude CLI, and project structure automatically.
 * Adapted from dawn-server's config.ts — the battle-tested version.
 */
import type { InstarConfig } from './types.js';
export declare function getInstarVersion(): string;
export declare function detectGitPath(): string | null;
export declare function detectGhPath(): string | null;
export declare function detectTmuxPath(): string | null;
/**
 * Per-framework CLI binary identifiers.
 *
 * Provider-portability v1.0.0: every framework Instar can drive has its
 * own CLI binary. `detectFrameworkBinary` locates it across the common
 * install paths (npm-global, Homebrew, nvm/fnm, system PATH) without
 * baking any single absolute path into the codebase. Add a framework
 * here and detection works automatically.
 */
export type FrameworkBinary = 'claude' | 'codex' | 'gemini' | 'pi' | 'aider' | 'goose' | 'cursor-cli' | 'opencode' | 'plandex';
/** Test-only: clear the detection memo. */
export declare function _resetFrameworkBinaryCache(): void;
export declare function detectFrameworkBinary(name: FrameworkBinary): string | null;
/**
 * Detect the Claude Code CLI. Convenience wrapper preserved for
 * backwards-compat with existing call sites. New code should use
 * `detectFrameworkBinary('claude')` directly.
 */
export declare function detectClaudePath(): string | null;
/**
 * Detect the OpenAI Codex CLI. Provider-portability v1.0.0 sibling of
 * detectClaudePath. Replaces hardcoded developer-specific path that
 * previously lived in `src/providers/adapters/openai-codex/config.ts`.
 */
export declare function detectCodexPath(): string | null;
/**
 * Detect the Gemini CLI. Apprenticeship Step 2 sibling of
 * detectClaudePath / detectCodexPath. The known-location probe
 * (`~/.gemini/bin/gemini`) + the standard install search are already
 * wired in `detectFrameworkBinary('gemini')`; this is the convenience
 * wrapper the gemini-cli intelligence provider + config consume.
 */
export declare function detectGeminiPath(): string | null;
/**
 * Detect the pi CLI (PI-HARNESS-INTEGRATION-SPEC Phase A sibling of the
 * detectors above). pi installs via `npm install -g
 * @earendil-works/pi-coding-agent`, which puts a `pi` shim on PATH — the
 * standard install search in `detectFrameworkBinary('pi')` covers it.
 */
export declare function detectPiPath(): string | null;
/**
 * Inputs to the framework-prerequisite check. Pure-function shape so the
 * check is unit-testable without spawning a real Config.load() against
 * the host filesystem.
 */
export interface FrameworkPrerequisiteInput {
    /** Framework selected by config or env. */
    configuredFramework: 'claude-code' | 'codex-cli' | 'gemini-cli' | 'pi-cli';
    /** Path to claude binary if detected, else null. */
    claudePathDetected: string | null;
    /** Path to codex binary if detected, else null. */
    codexPathDetected: string | null;
    /** Path to gemini binary if detected, else null. */
    geminiPathDetected?: string | null;
    /** Path to pi binary if detected, else null. */
    piPathDetected?: string | null;
}
export interface FrameworkPrerequisiteResult {
    /** True when the configured framework's binary is present. */
    satisfied: boolean;
    /**
     * Human-readable error message when satisfied=false. Includes the
     * install URL/command for the missing framework.
     */
    error?: string;
}
/**
 * Check whether the configured framework's required binary is available.
 *
 * Provider-portability v1.0.0: this replaces the v0.x unconditional
 * "Claude CLI not found" error that blocked every non-Claude install
 * at startup. Now codex-cli installs only need the codex binary,
 * claude-code installs only need the claude binary.
 */
export declare function checkFrameworkPrerequisite(input: FrameworkPrerequisiteInput): FrameworkPrerequisiteResult;
/**
 * Resolve the configured framework from a (possibly-undefined) config
 * file value and the current environment. Pure function so callers can
 * unit-test the resolution independently.
 */
export declare function resolveConfiguredFramework(configValue: 'claude-code' | 'codex-cli' | 'gemini-cli' | 'pi-cli' | undefined, envValue: string | undefined, enabledFrameworks?: ('claude-code' | 'codex-cli' | 'gemini-cli' | 'pi-cli')[]): 'claude-code' | 'codex-cli' | 'gemini-cli' | 'pi-cli';
/**
 * Look up a provider's credential. Returns null when none is configured.
 *
 * Use this in any code path that previously read `config.anthropicApiKey`
 * — the helper consults the new `credentials` map first and falls back
 * to the legacy field for 'anthropic' so existing installs continue to
 * work without migration.
 *
 * @example
 *   const cred = getProviderCredential(config, 'anthropic');
 *   if (cred?.kind === 'oauth-token') { ... }
 */
export declare function getProviderCredential(config: import('./types.js').SessionManagerConfig, providerId: string): import('./types.js').ProviderCredential | null;
/**
 * Build env vars to inject into a spawned subprocess for the given
 * provider credential. Provider-aware: maps the credential to the env
 * var the framework's CLI expects.
 *
 * For Anthropic:
 *   - oauth-token → CLAUDE_CODE_OAUTH_TOKEN set, ANTHROPIC_API_KEY cleared
 *   - api-key     → ANTHROPIC_API_KEY set, CLAUDE_CODE_OAUTH_TOKEN cleared
 *   - baseUrl     → ANTHROPIC_BASE_URL set
 *
 * For OpenAI/Codex:
 *   - api-key     → OPENAI_API_KEY set
 *   - oauth-token → (no env var — Codex CLI reads its own auth.json)
 *
 * For Google/Gemini:
 *   - api-key     → GOOGLE_API_KEY set
 *
 * Returns a flat list of [`-e`, `KEY=value`, ...] suitable for tmux
 * `new-session -e KEY=VAL`. Empty if the credential is missing/unknown.
 */
export declare function buildProviderEnvFlags(providerId: string, credential: import('./types.js').ProviderCredential): ReadonlyArray<string>;
export declare function detectProjectDir(startDir?: string): string;
/**
 * Get the path to the standalone agents directory.
 */
export declare function standaloneAgentsDir(): string;
/**
 * Resolve an agent directory from a name or path.
 *
 * Resolution order:
 * 1. If nameOrPath is an absolute path under ~/.instar/agents/ or cwd, use it
 * 2. If nameOrPath matches a standalone agent name, return ~/.instar/agents/<name>/
 * 3. If no argument, use detectProjectDir() (existing behavior)
 */
export declare function resolveAgentDir(nameOrPath?: string): string;
export declare function loadConfig(projectDir?: string): InstarConfig;
/**
 * Ensure the state directory structure exists.
 */
export declare function ensureStateDir(stateDir: string): void;
//# sourceMappingURL=Config.d.ts.map