'use strict';

var errors = require('./runtime/errors.cjs');
var legacy = require('./presets/legacy.cjs');

/**
 * Preset registry for SuperDoc LLM tools.
 *
 * A preset is a self-contained collection of LLM tools — provider catalogs
 * (openai / anthropic / vercel / generic), a system prompt, and a dispatcher.
 * Multiple presets can coexist in the SDK; consumers select one at runtime via
 * `chooseTools({ preset })`.
 *
 *     const { tools, meta } = await chooseTools({ provider: 'vercel', preset: 'legacy' });
 *
 * v1 ships a single preset: `'legacy'` — a thin wrapper around today's
 * codegen-emitted intent tools. When callers omit `preset`, `legacy` is used.
 * The default may move once a replacement preset reaches parity; bumping it is
 * a coordinated change in this file alone.
 *
 * Presets are NOT versioned. The preset id encodes the variant; a new shape
 * ships as a new id, not a new version of an existing one.
 *
 * @internal
 */
// ---------------------------------------------------------------------------
// Registry
// ---------------------------------------------------------------------------
/**
 * The default preset returned when callers omit `preset`. Set to `'legacy'`
 * so consumers built before presets existed (today's intent-tool path) keep
 * working without changes.
 */
const DEFAULT_PRESET = 'legacy';
const PRESETS = {
    legacy: legacy.legacyPreset,
};
/** List the IDs of all registered presets. */
function listPresets() {
    return Object.keys(PRESETS);
}
/**
 * Resolve a preset by ID. Throws {@link SuperDocCliError} with code
 * `PRESET_NOT_FOUND` if the ID is not registered. Omit the argument to
 * get the default preset.
 */
function getPreset(id = DEFAULT_PRESET) {
    const preset = PRESETS[id];
    if (preset == null) {
        throw new errors.SuperDocCliError(`Unknown LLM-tools preset: "${id}"`, {
            code: 'PRESET_NOT_FOUND',
            details: { id, availablePresets: Object.keys(PRESETS) },
        });
    }
    return preset;
}

exports.DEFAULT_PRESET = DEFAULT_PRESET;
exports.getPreset = getPreset;
exports.listPresets = listPresets;
