export const coreConfigDefaults = {
    display: {
        stream: true,
        lineNumbers: 'off',
        collapseThreshold: 30,
        theme: 'vaporwave',
        showThinking: false,
        showReasoningSummary: false,
        showTokenSpeed: false,
        showToolPreview: false,
    },
    provider: {
        reasoningEffort: 'medium',
        model: 'openrouter/free',
        provider: 'openrouter',
        embeddingProvider: 'hashed-local',
        systemPromptFile: '',
    },
    behavior: {
        autoApprove: false,
        autoCompactThreshold: 80,
        staleContextWarnings: true,
        saveHistory: true,
        notifyOnComplete: true,
        suggestAlternativeOnProviderFail: false,
        hitlMode: 'balanced',
        returnContextMode: 'off',
        guidanceMode: 'minimal',
    },
    storage: {
        secretPolicy: 'preferred_secure',
    },
    permissions: {
        mode: 'prompt',
        tools: {
            read: 'allow',
            write: 'prompt',
            edit: 'prompt',
            exec: 'prompt',
            find: 'allow',
            fetch: 'prompt',
            analyze: 'allow',
            inspect: 'allow',
            agent: 'prompt',
            state: 'allow',
            workflow: 'prompt',
            registry: 'allow',
            delegate: 'prompt',
            mcp: 'prompt',
        },
    },
    orchestration: {
        recursionEnabled: false,
        maxActiveAgents: 8,
        maxDepth: 0,
    },
    sandbox: {
        replIsolation: 'shared-vm',
        mcpIsolation: 'disabled',
        windowsMode: 'native-basic',
        vmBackend: 'local',
        qemuBinary: 'qemu-system-x86_64',
        qemuImagePath: '',
        qemuExecWrapper: '',
        qemuGuestHost: '',
        qemuGuestPort: 2222,
        qemuGuestUser: 'goodvibes',
        qemuWorkspacePath: '/workspace',
        qemuSessionMode: 'attach',
    },
    ui: {
        voiceEnabled: false,
        systemMessages: 'panel',
        operationalMessages: 'panel',
        wrfcMessages: 'both',
    },
    release: {
        channel: 'stable',
    },
    danger: {
        daemon: false,
        httpListener: false,
    },
    tools: {
        llmEnabled: false,
        llmProvider: '',
        llmModel: '',
        autoHeal: false,
        defaultTokenBudget: 5000,
        hooksFile: 'hooks.json',
    },
    wrfc: {
        scoreThreshold: 9.9,
        maxFixAttempts: 5,
        autoCommit: true,
        gates: [
            { name: 'typecheck', command: 'npx tsc --noEmit', enabled: true },
            { name: 'lint', command: 'npx eslint . --max-warnings 0', enabled: true },
            { name: 'build', command: 'npm run build', enabled: false },
        ],
    },
    cache: {
        enabled: true,
        stableTtl: '1h',
        monitorHitRate: true,
        hitRateWarningThreshold: 0.3,
    },
    helper: {
        enabled: false,
        globalProvider: '',
        globalModel: '',
    },
    notifications: {
        webhookUrls: [],
    },
    featureFlags: {},
};
export const coreHeadConfigSettings = [
    {
        key: 'display.stream',
        type: 'boolean',
        default: true,
        description: 'Stream LLM tokens as they arrive',
    },
    {
        key: 'display.lineNumbers',
        type: 'enum',
        default: 'off',
        description: 'Show line numbers for all assistant output, code blocks only, or not at all',
        enumValues: ['all', 'code', 'off'],
    },
    {
        key: 'display.collapseThreshold',
        type: 'number',
        default: 30,
        description: 'Line count threshold for collapsing tool output',
        validate: (v) => typeof v === 'number' && v >= 1 && v <= 1000,
    },
    {
        key: 'display.theme',
        type: 'string',
        default: 'vaporwave',
        description: 'Color theme name',
    },
    {
        key: 'display.showThinking',
        type: 'boolean',
        default: false,
        description: 'Show reasoning/thinking content in a dimmed block above assistant responses',
    },
    {
        key: 'display.showReasoningSummary',
        type: 'boolean',
        default: false,
        description: 'Show reasoning summary (Mercury-2) in a dimmed block above assistant responses',
    },
    {
        key: 'display.showTokenSpeed',
        type: 'boolean',
        default: false,
        description: 'Show streaming tokens/sec counter during generation',
    },
    {
        key: 'display.showToolPreview',
        type: 'boolean',
        default: false,
        description: 'Show partial tool call preview while streaming',
    },
    {
        key: 'provider.reasoningEffort',
        type: 'enum',
        default: 'medium',
        description: 'Reasoning effort level for models that support it',
        enumValues: ['instant', 'low', 'medium', 'high'],
    },
    {
        key: 'provider.model',
        type: 'string',
        default: 'openrouter/free',
        description: 'Default LLM model ID',
    },
    {
        key: 'provider.provider',
        type: 'string',
        default: 'openrouter',
        description: 'Default provider name',
    },
    {
        key: 'provider.embeddingProvider',
        type: 'string',
        default: 'hashed-local',
        description: 'Default memory embedding provider',
    },
    {
        key: 'provider.systemPromptFile',
        type: 'string',
        default: '',
        description: 'Path to a file containing the system prompt (empty = none)',
    },
    {
        key: 'behavior.autoApprove',
        type: 'boolean',
        default: false,
        description: 'Auto-approve all tool permission requests (--no-worries-just-vibes)',
    },
    {
        key: 'behavior.autoCompactThreshold',
        type: 'number',
        default: 80,
        description: 'Compact conversation when context usage exceeds this percentage',
        validate: (v) => typeof v === 'number' && v >= 10 && v <= 100,
    },
    {
        key: 'behavior.staleContextWarnings',
        type: 'boolean',
        default: true,
        description: 'Emit proactive context-pressure warnings before compaction is required',
    },
    {
        key: 'behavior.saveHistory',
        type: 'boolean',
        default: true,
        description: 'Persist conversation history to disk',
    },
    {
        key: 'behavior.notifyOnComplete',
        type: 'boolean',
        default: true,
        description: 'Emit terminal bell and desktop notification when a long turn completes',
    },
    {
        key: 'behavior.returnContextMode',
        type: 'enum',
        default: 'off',
        description: 'Resume summary mode: off, local deterministic summary, or helper-assisted summary',
        enumValues: ['off', 'local', 'assisted'],
    },
    {
        key: 'behavior.guidanceMode',
        type: 'enum',
        default: 'minimal',
        description: 'Operational guidance mode: off, minimal, or guided',
        enumValues: ['off', 'minimal', 'guided'],
    },
    {
        key: 'storage.secretPolicy',
        type: 'enum',
        default: 'preferred_secure',
        description: 'Secret persistence policy: plaintext allowed, preferred secure, or require secure',
        enumValues: ['plaintext_allowed', 'preferred_secure', 'require_secure'],
    },
    {
        key: 'permissions.mode',
        type: 'enum',
        default: 'prompt',
        description: 'Permission approval mode: prompt (default), allow-all, or custom',
        enumValues: ['prompt', 'allow-all', 'custom'],
    },
    {
        key: 'permissions.tools.read',
        type: 'enum',
        default: 'allow',
        description: 'Permission for file read operations (read, find, analyze)',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.write',
        type: 'enum',
        default: 'prompt',
        description: 'Permission for file write operations',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.edit',
        type: 'enum',
        default: 'prompt',
        description: 'Permission for file edit/patch operations',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.exec',
        type: 'enum',
        default: 'prompt',
        description: 'Permission for shell command execution',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.find',
        type: 'enum',
        default: 'allow',
        description: 'Permission for file/directory search operations',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.fetch',
        type: 'enum',
        default: 'prompt',
        description: 'Permission for outbound network fetch requests (custom mode only)',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.analyze',
        type: 'enum',
        default: 'allow',
        description: 'Permission for code/project analysis operations',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.inspect',
        type: 'enum',
        default: 'allow',
        description: 'Permission for inspecting runtime state and objects',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.agent',
        type: 'enum',
        default: 'prompt',
        description: 'Permission for spawning subagents or delegating tasks',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.state',
        type: 'enum',
        default: 'allow',
        description: 'Permission for reading runtime/session state',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.workflow',
        type: 'enum',
        default: 'prompt',
        description: 'Permission for executing multi-step workflow automation',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.registry',
        type: 'enum',
        default: 'allow',
        description: 'Permission for querying the tool/skill registry',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.mcp',
        type: 'enum',
        default: 'prompt',
        description: 'Permission for MCP tool calls (external server tools)',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'permissions.tools.delegate',
        type: 'enum',
        default: 'prompt',
        description: 'Permission for unknown or unregistered tools (safe default: prompt)',
        enumValues: ['allow', 'prompt', 'deny'],
    },
    {
        key: 'orchestration.recursionEnabled',
        type: 'boolean',
        default: false,
        description: 'Allow recursive agent orchestration under bounded policy controls',
    },
    {
        key: 'orchestration.maxActiveAgents',
        type: 'number',
        default: 8,
        description: 'Total active agents allowed across the orchestration tree',
        validate: (v) => typeof v === 'number' && v >= 1 && v <= 20,
    },
    {
        key: 'orchestration.maxDepth',
        type: 'number',
        default: 0,
        description: 'Maximum recursive orchestration depth: 0=disabled, higher values allow deeper bounded recursion',
        validate: (v) => typeof v === 'number' && v >= 0 && v <= 5,
    },
    {
        key: 'sandbox.replIsolation',
        type: 'enum',
        default: 'shared-vm',
        description: 'Preferred isolation mode for evaluation runtimes once virtualization is enabled',
        enumValues: ['shared-vm', 'per-runtime-vm'],
    },
    {
        key: 'sandbox.mcpIsolation',
        type: 'enum',
        default: 'disabled',
        description: 'Preferred isolation mode for MCP servers once virtualization is enabled',
        enumValues: ['disabled', 'shared-vm', 'hybrid', 'per-server-vm'],
    },
    {
        key: 'sandbox.windowsMode',
        type: 'enum',
        default: 'native-basic',
        description: 'Windows host posture: native basic mode or require WSL before enabling virtualized sandboxing',
        enumValues: ['native-basic', 'require-wsl'],
    },
    {
        key: 'sandbox.vmBackend',
        type: 'enum',
        default: 'local',
        description: 'Sandbox backend: local host execution by default, or QEMU for virtualized isolation',
        enumValues: ['local', 'qemu'],
    },
    {
        key: 'sandbox.qemuBinary',
        type: 'string',
        default: 'qemu-system-x86_64',
        description: 'QEMU system binary to use when vmBackend=qemu',
    },
    {
        key: 'sandbox.qemuImagePath',
        type: 'string',
        default: '',
        description: 'Disk image path for QEMU-backed sandbox sessions; when empty, QEMU sessions remain planned-only',
    },
    {
        key: 'sandbox.qemuExecWrapper',
        type: 'string',
        default: '',
        description: 'Host-side wrapper/bridge used to execute guest commands inside a configured QEMU sandbox',
    },
    {
        key: 'sandbox.qemuGuestHost',
        type: 'string',
        default: '',
        description: 'Optional guest host/IP used by the QEMU wrapper for real guest command transport',
    },
    {
        key: 'sandbox.qemuGuestPort',
        type: 'number',
        default: 2222,
        description: 'Optional guest SSH port used by the QEMU wrapper for real guest command transport',
        validate: (v) => typeof v === 'number' && Number.isInteger(v) && v >= 1 && v <= 65535,
    },
    {
        key: 'sandbox.qemuGuestUser',
        type: 'string',
        default: 'goodvibes',
        description: 'Optional guest username used by the QEMU wrapper for real guest command transport',
    },
    {
        key: 'sandbox.qemuWorkspacePath',
        type: 'string',
        default: '/workspace',
        description: 'Guest workspace path used by the QEMU wrapper when executing commands inside the guest',
    },
    {
        key: 'sandbox.qemuSessionMode',
        type: 'enum',
        enumValues: ['attach', 'launch-per-command'],
        default: 'attach',
        description: 'Whether the QEMU wrapper attaches to an already running guest or launches a guest per command',
    },
    {
        key: 'ui.voiceEnabled',
        type: 'boolean',
        default: false,
        description: 'Enable the optional local-first voice control surface',
    },
    {
        key: 'ui.systemMessages',
        type: 'enum',
        default: 'panel',
        description: 'Where operational system messages render by default: panel, conversation, or both',
        enumValues: ['panel', 'conversation', 'both'],
    },
    {
        key: 'ui.operationalMessages',
        type: 'enum',
        default: 'panel',
        description: 'Where tool, agent, MCP, plugin, and other operational activity messages render by default: panel, conversation, or both',
        enumValues: ['panel', 'conversation', 'both'],
    },
    {
        key: 'ui.wrfcMessages',
        type: 'enum',
        default: 'both',
        description: 'Where WRFC lifecycle updates render by default: panel, conversation, or both',
        enumValues: ['panel', 'conversation', 'both'],
    },
    {
        key: 'release.channel',
        type: 'enum',
        default: 'stable',
        description: 'Preferred release channel for install/update flows',
        enumValues: ['stable', 'preview'],
    },
];
export const coreTailConfigSettings = [
    {
        key: 'danger.daemon',
        type: 'boolean',
        default: false,
        description: 'Enable daemon mode (runs goodvibes-sdk as a background service)',
    },
    {
        key: 'danger.httpListener',
        type: 'boolean',
        default: false,
        description: 'Enable HTTP webhook listener for receiving external events',
    },
    {
        key: 'tools.llmEnabled',
        type: 'boolean',
        default: false,
        description: 'Enable dedicated tool LLM for internal operations (off = tools use the main conversation model only when needed)',
    },
    {
        key: 'tools.llmProvider',
        type: 'string',
        default: '',
        description: 'Provider for tool LLM calls (empty = use currently selected provider)',
    },
    {
        key: 'tools.llmModel',
        type: 'string',
        default: '',
        description: 'Model for tool LLM calls (empty = fastest available for the provider)',
    },
    {
        key: 'tools.autoHeal',
        type: 'boolean',
        default: false,
        description: 'Automatically fix syntax errors on precision write/edit operations',
    },
    {
        key: 'tools.defaultTokenBudget',
        type: 'number',
        default: 5000,
        description: 'Default token budget for precision read operations',
        validate: (v) => typeof v === 'number' && v >= 100 && v <= 100000,
    },
    {
        key: 'tools.hooksFile',
        type: 'string',
        default: 'hooks.json',
        description: 'Hook configuration file name (relative to the host .goodvibes data directory)',
    },
    {
        key: 'wrfc.scoreThreshold',
        type: 'number',
        default: 9.9,
        description: 'Minimum review score to pass WRFC (0-10)',
        validate: (v) => typeof v === 'number' && v >= 0 && v <= 10,
    },
    {
        key: 'wrfc.maxFixAttempts',
        type: 'number',
        default: 5,
        description: 'Maximum gate retry depth before aborting WRFC chain',
        validate: (v) => typeof v === 'number' && v >= 1 && v <= 20,
    },
    {
        key: 'wrfc.autoCommit',
        type: 'boolean',
        default: true,
        description: 'Auto-commit when WRFC chain passes review and quality gates',
    },
    {
        key: 'cache.enabled',
        type: 'boolean',
        default: true,
        description: 'Enable prompt caching for eligible providers (Anthropic)',
    },
    {
        key: 'cache.stableTtl',
        type: 'enum',
        default: '1h',
        description: 'Cache TTL for stable content (system prompt + tools): 5m (ephemeral) or 1h (persistent)',
        enumValues: ['5m', '1h'],
    },
    {
        key: 'cache.monitorHitRate',
        type: 'boolean',
        default: true,
        description: 'Monitor cache hit rate and warn when below threshold',
    },
    {
        key: 'cache.hitRateWarningThreshold',
        type: 'number',
        default: 0.3,
        description: 'Warn when cache hit rate falls below this fraction (0.0–1.0)',
        validate: (v) => typeof v === 'number' && v >= 0 && v <= 1,
    },
    {
        key: 'helper.enabled',
        type: 'boolean',
        default: false,
        description: 'Enable helper model routing for grunt-work tasks',
    },
    {
        key: 'helper.globalProvider',
        type: 'string',
        default: '',
        description: 'Provider for the global helper model (empty = disabled)',
    },
    {
        key: 'helper.globalModel',
        type: 'string',
        default: '',
        description: 'Model ID for the global helper model (empty = disabled)',
    },
    {
        key: 'behavior.suggestAlternativeOnProviderFail',
        type: 'boolean',
        default: false,
        description: 'Show alternative model suggestion when current provider fails non-transiently',
    },
    {
        key: 'behavior.hitlMode',
        type: 'enum',
        default: 'balanced',
        description: 'HITL UX mode: controls notification verbosity and burst batching (quiet/balanced/operator)',
        enumValues: ['quiet', 'balanced', 'operator'],
    },
];
