import { GLOBAL_ENV_SPECS, PROJECT_ENV_SPECS, envVarNameFromPath, } from '../env/config-env-overrides.js';
import { PROVIDER_OPTIONS_TRACKED_KEYS, } from '../providerOptionsContract.js';
const PROJECT_TRACKED_KEYS = [
    'language',
    'provider',
    'model',
    'logging',
    'worktree_dir',
    'allow_git_hooks',
    'allow_git_filters',
    'vcs_provider',
    'auto_pr',
    'draft_pr',
    'disabled_builtins',
    'anthropic_api_key',
    'openai_api_key',
    'gemini_api_key',
    'google_api_key',
    'groq_api_key',
    'openrouter_api_key',
    'codex_cli_path',
    'claude_cli_path',
    'cursor_cli_path',
    'copilot_cli_path',
    'kiro_cli_path',
    'copilot_github_token',
    'kiro_api_key',
    'opencode_api_key',
    'cursor_api_key',
    'bookmarks_file',
    'submodules',
    'with_submodules',
    'concurrency',
    'pipeline',
    'pipeline.default_branch_prefix',
    'pipeline.commit_message_template',
    'pipeline.pr_body_template',
    'assistant',
    'assistant.init_files',
    'takt_providers',
    'persona_providers',
    'branch_name_strategy',
    'minimal_output',
    'task_poll_interval_ms',
    'interactive_preview_steps',
    'sync_project_local_takt_on_retry',
    'analytics',
    'analytics.enabled',
    'analytics.events_path',
    'analytics.retention_days',
    'observability',
    'observability.enabled',
    'observability.monitor',
    'observability.session_log_exporter',
    'observability.usage_events_phase',
    'provider_profiles',
    'rate_limit_fallback',
    'rate_limit_fallback.switch_chain',
    'base_branch',
    'workflow_overrides',
    'runtime',
    'runtime.prepare',
    'workflow_runtime_prepare',
    'workflow_runtime_prepare.custom_scripts',
    'workflow_command_gates',
    'workflow_command_gates.custom_scripts',
    'workflow_arpeggio',
    'workflow_arpeggio.custom_data_source_modules',
    'workflow_arpeggio.custom_merge_inline_js',
    'workflow_arpeggio.custom_merge_files',
    'sync_conflict_resolver',
    'sync_conflict_resolver.auto_approve_tools',
    'workflow_mcp_servers',
    'workflow_mcp_servers.stdio',
    'workflow_mcp_servers.sse',
    'workflow_mcp_servers.http',
    'prevent_sleep',
    'notification_sound',
    'notification_sound_events',
    'auto_fetch',
    ...PROVIDER_OPTIONS_TRACKED_KEYS,
];
const GLOBAL_TRACKED_KEYS = [
    'language',
    'provider',
    'model',
    'logging',
    'logging.level',
    'logging.trace',
    'logging.debug',
    'logging.provider_events',
    'logging.usage_events',
    'analytics',
    'analytics.enabled',
    'analytics.events_path',
    'analytics.retention_days',
    'observability',
    'observability.enabled',
    'observability.monitor',
    'observability.session_log_exporter',
    'observability.usage_events_phase',
    'worktree_dir',
    'allow_git_hooks',
    'allow_git_filters',
    'vcs_provider',
    'auto_pr',
    'draft_pr',
    'disabled_builtins',
    'enable_builtin_workflows',
    'anthropic_api_key',
    'openai_api_key',
    'gemini_api_key',
    'google_api_key',
    'groq_api_key',
    'openrouter_api_key',
    'codex_cli_path',
    'claude_cli_path',
    'cursor_cli_path',
    'copilot_cli_path',
    'kiro_cli_path',
    'copilot_github_token',
    'kiro_api_key',
    'opencode_api_key',
    'cursor_api_key',
    'bookmarks_file',
    'workflow_categories_file',
    'provider_profiles',
    'rate_limit_fallback',
    'rate_limit_fallback.switch_chain',
    'workflow_overrides',
    'pipeline',
    'takt_providers',
    'persona_providers',
    'branch_name_strategy',
    'minimal_output',
    'concurrency',
    'task_poll_interval_ms',
    'interactive_preview_steps',
    'sync_project_local_takt_on_retry',
    'runtime',
    'runtime.prepare',
    'workflow_runtime_prepare',
    'workflow_runtime_prepare.custom_scripts',
    'workflow_command_gates',
    'workflow_command_gates.custom_scripts',
    'workflow_arpeggio',
    'workflow_arpeggio.custom_data_source_modules',
    'workflow_arpeggio.custom_merge_inline_js',
    'workflow_arpeggio.custom_merge_files',
    'sync_conflict_resolver',
    'sync_conflict_resolver.auto_approve_tools',
    'workflow_mcp_servers',
    'workflow_mcp_servers.stdio',
    'workflow_mcp_servers.sse',
    'workflow_mcp_servers.http',
    'prevent_sleep',
    'notification_sound',
    'notification_sound_events',
    'notification_sound_events.iteration_limit',
    'notification_sound_events.workflow_complete',
    'notification_sound_events.workflow_abort',
    'notification_sound_events.run_complete',
    'notification_sound_events.run_abort',
    'auto_fetch',
    'base_branch',
    ...PROVIDER_OPTIONS_TRACKED_KEYS,
];
const GLOBAL_DEFAULTS = new Map([
    ['language', 'en'],
    ['provider', 'claude'],
    ['disabled_builtins', []],
    ['auto_fetch', false],
]);
function envTypeToFormat(type) {
    if (type === 'boolean')
        return Boolean;
    if (type === 'number')
        return Number;
    if (type === 'json')
        return 'json';
    return String;
}
function buildTracedSchema(keys, envSpecs, defaults, fileOrigin) {
    const envSpecByPath = new Map(envSpecs.map((spec) => [spec.path, spec]));
    const schema = {};
    for (const key of keys) {
        const envSpec = envSpecByPath.get(key);
        schema[key] = {
            default: defaults.get(key),
            doc: key,
            format: envSpec ? envTypeToFormat(envSpec.type) : undefined,
            env: envVarNameFromPath(key),
            sources: {
                global: fileOrigin === 'global',
                local: fileOrigin === 'local',
                env: envSpec !== undefined,
                cli: false,
            },
        };
    }
    return schema;
}
const globalTracedSchema = buildTracedSchema(GLOBAL_TRACKED_KEYS, GLOBAL_ENV_SPECS, GLOBAL_DEFAULTS, 'global');
const projectTracedSchema = buildTracedSchema(PROJECT_TRACKED_KEYS, PROJECT_ENV_SPECS, new Map(), 'local');
export function getGlobalTracedSchema() {
    return globalTracedSchema;
}
export function getProjectTracedSchema() {
    return projectTracedSchema;
}
//# sourceMappingURL=tracedConfigSchema.js.map