import type { AgentBinding, AgentsConfig } from "./types.agents.js";
import type { ApprovalsConfig } from "./types.approvals.js";
import type { AuditConfig } from "./types.audit.js";
import type { AuthProvidersConfig } from "./types.auth-providers.js";
import type { AuthConfig } from "./types.auth.js";
import type { DiagnosticsConfig, LoggingConfig, SessionConfig, WebConfig } from "./types.base.js";
import type { BrowserConfig } from "./types.browser.js";
import type { ChannelsConfig } from "./types.channels.js";
import type { CronConfig } from "./types.cron.js";
import type { CanvasHostConfig, DiscoveryConfig, GatewayConfig, TalkConfig } from "./types.gateway.js";
import type { HooksConfig } from "./types.hooks.js";
import type { MemoryConfig } from "./types.memory.js";
import type { AudioConfig, BroadcastConfig, CommandsConfig, MessagesConfig } from "./types.messages.js";
import type { ModelsConfig } from "./types.models.js";
import type { NodeHostConfig } from "./types.node-host.js";
import type { PluginsConfig } from "./types.plugins.js";
import type { SecurityAutonomyConfig } from "./types.security.js";
import type { SkillsConfig } from "./types.skills.js";
import type { ToolsConfig } from "./types.tools.js";
/**
 * Voice processing configuration.
 *
 * **Config coupling:** `voiceProcessing.mode` and `messages.tts.auto` must be
 * aligned for voice-in → voice-out behavior:
 * - `mode: "s2s"` + `tts.auto: "tagged"` — S2S handles audio output directly
 * - `mode: "chained"` + `tts.auto: "inbound"` — chained pipeline auto-generates TTS
 * - `mode: "chained"` + `tts.auto: "tagged"` — **broken**: voice notes get text replies
 */
export type VoiceProcessingConfig = {
    /** Voice processing mode: "chained" (STT→LLM→TTS, default) or "s2s" (OpenAI Realtime). */
    mode?: "chained" | "s2s";
    /** OpenAI Realtime model. Default: gpt-4o-realtime-preview */
    s2sModel?: string;
    /** Voice for S2S responses. Default: verse */
    s2sVoice?: string;
    /** OpenAI API key for Realtime API (does NOT work with OpenRouter). Falls back to OPENAI_API_KEY env var. */
    openaiApiKey?: string;
    /** Response timeout in ms. Default: 30000 */
    s2sTimeoutMs?: number;
};
export type MinionConfig = {
    $schema?: string;
    meta?: {
        /** Last Minion version that wrote this config. */
        lastTouchedVersion?: string;
        /** ISO timestamp when this config was last written. */
        lastTouchedAt?: string;
    };
    /**
     * Global admin peer IDs (all agents). Supports WhatsApp E164 (+15551234567),
     * Telegram (telegram:@username or telegram:123456), Discord (user:123456789),
     * channel-scoped (whatsapp:+15551234567), or identity link names from session.identityLinks.
     */
    admins?: string[];
    auth?: AuthConfig;
    /** OAuth provider configuration (Google, etc.) */
    authProviders?: AuthProvidersConfig;
    env?: {
        /** Opt-in: import missing secrets from a login shell environment (exec `$SHELL -l -c 'env -0'`). */
        shellEnv?: {
            enabled?: boolean;
            /** Timeout for the login shell exec (ms). Default: 15000. */
            timeoutMs?: number;
        };
        /** Inline env vars to apply when not already present in the process env. */
        vars?: Record<string, string>;
        /** Sugar: allow env vars directly under env (string values only). */
        [key: string]: string | Record<string, string> | {
            enabled?: boolean;
            timeoutMs?: number;
        } | undefined;
    };
    wizard?: {
        lastRunAt?: string;
        lastRunVersion?: string;
        lastRunCommit?: string;
        lastRunCommand?: string;
        lastRunMode?: "local" | "remote";
    };
    diagnostics?: DiagnosticsConfig;
    logging?: LoggingConfig;
    update?: {
        /** Update channel for git + npm installs ("stable", "beta", or "dev"). */
        channel?: "stable" | "beta" | "dev";
        /** Check for updates on gateway start (npm installs only). */
        checkOnStart?: boolean;
    };
    browser?: BrowserConfig;
    ui?: {
        /** Accent color for Minion UI chrome (hex). */
        seamColor?: string;
        assistant?: {
            /** Assistant display name for UI surfaces. */
            name?: string;
            /** Assistant avatar (emoji, short text, or image URL/data URI). */
            avatar?: string;
        };
    };
    skills?: SkillsConfig;
    plugins?: PluginsConfig;
    models?: ModelsConfig;
    nodeHost?: NodeHostConfig;
    agents?: AgentsConfig;
    tools?: ToolsConfig;
    bindings?: AgentBinding[];
    broadcast?: BroadcastConfig;
    audio?: AudioConfig;
    messages?: MessagesConfig;
    commands?: CommandsConfig;
    approvals?: ApprovalsConfig;
    session?: SessionConfig;
    web?: WebConfig;
    channels?: ChannelsConfig;
    cron?: CronConfig;
    hooks?: HooksConfig;
    discovery?: DiscoveryConfig;
    canvasHost?: CanvasHostConfig;
    talk?: TalkConfig;
    gateway?: GatewayConfig;
    memory?: MemoryConfig;
    security?: SecurityAutonomyConfig;
    /** Guardrail configuration for data leakage, topic boundaries, and action modes. */
    guardrails?: {
        profile?: "permissive" | "moderate" | "strict";
        dataLeakage?: {
            enabled?: boolean;
            patterns?: Array<{
                name: string;
                pattern: string;
                category?: string;
                action?: "redact" | "block" | "warn";
            }>;
            builtinPatterns?: boolean;
        };
        topicBoundaries?: {
            enabled?: boolean;
            blocklist?: string[];
        };
        actionMode?: "redact" | "block" | "warn";
        dryRun?: boolean;
        customPatterns?: Array<{
            name: string;
            pattern: string;
            category?: string;
            action?: "redact" | "block" | "warn";
        }>;
    };
    /** Media handling configuration. */
    media?: {
        preserveFilenames?: boolean;
    };
    /** Voice note processing: "chained" (STT→LLM→TTS) or "s2s" (OpenAI Realtime). */
    voiceProcessing?: VoiceProcessingConfig;
    personalAgents?: PersonalAgentsConfig;
    /** AudAgent Privacy Compliance Auditor (EU AI Act Article 50). */
    audit?: AuditConfig;
};
export type PersonalAgentsConfig = {
    /** Enable personal agent routing tier and auto-provisioning. Default: true. */
    enabled?: boolean;
};
export type ConfigValidationIssue = {
    path: string;
    message: string;
};
export type LegacyConfigIssue = {
    path: string;
    message: string;
};
/** @deprecated Alias for backward compatibility — prefer MinionConfig */
export type OpenClawConfig = MinionConfig;
export type ConfigFileSnapshot = {
    path: string;
    exists: boolean;
    raw: string | null;
    parsed: unknown;
    /**
     * Config after $include resolution and ${ENV} substitution, but BEFORE runtime
     * defaults are applied. Use this for config set/unset operations to avoid
     * leaking runtime defaults into the written config file.
     */
    resolved: MinionConfig;
    valid: boolean;
    config: MinionConfig;
    hash?: string;
    issues: ConfigValidationIssue[];
    warnings: ConfigValidationIssue[];
    legacyIssues: LegacyConfigIssue[];
};
