/**
 * Chat-setup wizard detection layer (WIZ.2).
 *
 * Five pure-function readers that introspect the current state of the
 * user's machine WITHOUT prompting, writing, or mutating anything. The
 * wizard's interactive flow (WIZ.3, `chat_actions.ts`) consumes these
 * snapshots to decide which storyboard branch to enter (clean state vs
 * idempotent re-run vs broken config).
 *
 * Discipline (audit-critical):
 *   - PURE READ-ONLY. No `writeFile`, no `mkdir`, no `unlink`. Detection
 *     is observation; the caller owns the write decision.
 *   - SECRET-SAFE. We probe for `ANTHROPIC_API_KEY` + `OPENSQUID_TELEGRAM_
 *     BOT_TOKEN` presence in `~/.loop/.env` but NEVER return the values —
 *     the boolean is the only output. If a future detector needs the
 *     value, it goes through a separate explicitly-named getter.
 *   - ENOENT TOLERANT. Missing files / directories return empty state, not
 *     thrown errors. The wizard's job is to surface "what's there?" not
 *     "what's missing?".
 *   - PID LIVENESS. `process.kill(pid, 0)` is the canonical POSIX `kill -0`
 *     check — throws ESRCH if the pid is dead, EPERM if alive-but-foreign
 *     (still counts as running). Matches the daemon lifecycle pattern in
 *     `src/channels/daemon/lifecycle.ts`, the load-bearing production check.
 *   - NO `any` TYPES. Strict typed surface; opaque parse-error messages
 *     surfaced as `parseError: string` so the wizard can render them.
 *
 * Five detectors:
 *   detectModelsConfig    — ~/.opensquid/models.yaml + fast_chat alias
 *   detectPacksDir        — ~/.opensquid/packs/<id>/{manifest,chat_agent}.yaml
 *   detectChatDaemonRunning — ~/.opensquid/chat-daemon.pid + sock probe
 *   detectSecretsBackend  — ~/.loop/.env + op CLI + macOS keychain
 *   detectAgentBridgeRunning — ~/.opensquid/agent-bridge.pid (WAB.7 file)
 *
 * Imports from: node:fs/promises, node:os, node:path, ../../packs/yaml,
 *   ../../packs/schemas/{models,manifest}, ../../runtime/paths.
 * Imported by: src/setup/cli/chat_actions.ts (WIZ.3) +
 *   src/setup/cli/chat_state.test.ts.
 */
import { type ModelMode } from '../../packs/schemas/models.js';
export type { ModelMode };
export interface ModelsState {
    /** True if `~/.opensquid/models.yaml` exists on disk (even if malformed). */
    present: boolean;
    /** Absolute path the detector probed (for error messages + tests). */
    path: string;
    /** Top-level alias keys; empty array on missing/malformed file. */
    aliases: string[];
    /** Whether the `fast_chat` alias is declared. */
    hasFastChat: boolean;
    /** Mode of `fast_chat` when present (api | subscription | local | mcp). */
    fastChatMode?: ModelMode;
    /** YAML / schema error message — `present: true` but unusable. */
    parseError?: string;
}
export interface PackEntry {
    /** Pack id (directory name, validated as Manifest.name slug). */
    name: string;
    /** Absolute path to the pack root directory. */
    root: string;
    /** Whether `chat_agent.yaml` exists in the pack root. */
    hasChatAgent: boolean;
}
export interface PacksState {
    /** Absolute path to the packs directory the detector probed. */
    path: string;
    /** Per-pack entries, sorted by name. Empty when packs/ is missing or empty. */
    packs: PackEntry[];
}
export interface ChatDaemonState {
    /** Process responsive to `kill -0`. False on missing pidfile, stale pid,
     *  unparseable pidfile, or dead process. */
    running: boolean;
    /** Pidfile path the detector probed. */
    pidPath: string;
    /** PID parsed from the file; only meaningful when `running` is true. */
    pid?: number;
    /** Whether the Unix socket file exists (cheap proxy for IPC reachability;
     *  full UDS connect is intentionally NOT attempted — too coupled, and
     *  the wizard never makes RPC calls from the detector layer). */
    mcpReachable: boolean;
}
export type SecretsBackend = 'env' | 'op' | 'keychain';
export interface SecretsState {
    /** Backends the detector could observe on this machine. Order is stable:
     *  env first, then op (if `op` is on PATH), then keychain (darwin only). */
    backends: SecretsBackend[];
    /** Whether `~/.loop/.env` exists at all. */
    envPath: string;
    envPresent: boolean;
    /** Presence-only — the value is NEVER returned, only the boolean. */
    anthropicKeyPresent: boolean;
    /** Presence-only — the value is NEVER returned, only the boolean. */
    telegramTokenPresent: boolean;
}
export interface AgentBridgeState {
    /** Process responsive to `kill -0`. False on missing pidfile (WAB.7 hasn't
     *  shipped yet → pidfile doesn't exist → state is `running: false`). */
    running: boolean;
    pidPath: string;
    pid?: number;
}
export declare const defaultModelsPath: () => string;
export declare const defaultPacksDir: () => string;
export declare const defaultChatDaemonPidPath: () => string;
export declare const defaultChatDaemonSockPath: () => string;
export declare const defaultAgentBridgePidPath: () => string;
export declare const defaultEnvPath: () => string;
export declare function detectModelsConfig(path?: string): Promise<ModelsState>;
export declare function detectPacksDir(path?: string): Promise<PacksState>;
export declare function detectChatDaemonRunning(opts?: {
    pidPath?: string;
    sockPath?: string;
}): Promise<ChatDaemonState>;
export declare function detectSecretsBackend(opts?: {
    envPath?: string;
    env?: NodeJS.ProcessEnv;
}): Promise<SecretsState>;
export declare function detectAgentBridgeRunning(opts?: {
    pidPath?: string;
}): Promise<AgentBridgeState>;
//# sourceMappingURL=chat_state.d.ts.map