// ---------------------------------------------------------------------------
// Predefined chains
// ---------------------------------------------------------------------------
/** Predefined tool chain catalog. */
export const TOOL_CHAINS = [
    {
        id: 'full-spec',
        name: 'Full Spec Creation',
        triggers: [
            'quiero una spec completa',
            'spec completa con todo',
            'haceme la spec completa',
            'create full spec',
            'full spec with everything',
            'spec completa del',
            'complete spec for',
        ],
        steps: [
            { tool: 'clarify_requirements', optional: true, paramMapping: {} },
            { tool: 'create_spec', optional: false, paramMapping: {} },
            { tool: 'suggest_stack', optional: true, paramMapping: {} },
            { tool: 'estimate', optional: true, paramMapping: { specId: 'specId' } },
            { tool: 'generate_checklist', optional: true, paramMapping: { specId: 'specId' } },
        ],
    },
    {
        id: 'audit-all',
        name: 'Full Project Audit',
        triggers: [
            'audita todo el proyecto',
            'audit everything',
            'audit all',
            'revisa todo el proyecto',
            'full audit',
            'auditoria completa',
        ],
        steps: [
            { tool: 'audit', optional: false, paramMapping: {} },
            { tool: 'suggest_tooling', optional: true, paramMapping: {} },
            { tool: 'detect_drift', optional: true, paramMapping: {} },
        ],
    },
    {
        id: 'prep-implement',
        name: 'Prepare for Implementation',
        triggers: [
            'preparame esto para implementar',
            'prepare for implementation',
            'prep for implementation',
            'lista para implementar',
            'ready to implement',
            'preparar para implementar',
        ],
        steps: [
            { tool: 'validate', optional: false, paramMapping: { specId: 'specId' } },
            { tool: 'generate_tests', optional: true, paramMapping: { specId: 'specId' } },
            { tool: 'generate_docs', optional: true, paramMapping: { specId: 'specId' } },
        ],
    },
];
// ---------------------------------------------------------------------------
// Matching
// ---------------------------------------------------------------------------
/**
 * Match a natural language input (and optional NLI resolution) to a predefined chain.
 * Returns the first matching chain, or null if no chain matches.
 */
export function matchIntentToChain(input, nliResolution) {
    const lower = input.toLowerCase();
    // 1. Keyword trigger matching
    for (const chain of TOOL_CHAINS) {
        for (const trigger of chain.triggers) {
            if (lower.includes(trigger)) {
                return chain;
            }
        }
    }
    // 2. Fallback to toolChain hint from NLI resolver
    if (nliResolution?.toolMapping.toolChain) {
        const chainId = nliResolution.toolMapping.toolChain[0];
        return TOOL_CHAINS.find((c) => c.id === chainId) ?? null;
    }
    return null;
}
/**
 * Get a chain by its ID. Returns null if not found.
 */
export function getChainById(id) {
    return TOOL_CHAINS.find((c) => c.id === id) ?? null;
}
//# sourceMappingURL=intent-mapper.js.map