"use strict";
/**
 * Pinecone vector DB RAG parser.
 * Detects Pinecone spans and returns standard RAGCall[].
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.pineconeRagParser = void 0;
const utils_1 = require("../utils");
const SYSTEM_NAME = 'pinecone';
const DB_SYSTEM = 'db.system';
const DB_SYSTEM_NAME = 'db.system.name';
function isPineconeSpan(span) {
    const attrs = span.attributes ?? {};
    const res = span.resourceAttributes ?? {};
    const sys = attrs[DB_SYSTEM_NAME] ?? attrs[DB_SYSTEM] ?? res[DB_SYSTEM_NAME] ?? res[DB_SYSTEM];
    if (sys != null && String(sys).toLowerCase().includes('pinecone'))
        return true;
    const name = (span.name ?? '').toLowerCase();
    const svc = (span.serviceName ?? '').toLowerCase();
    return name.includes('pinecone') || svc.includes('pinecone');
}
exports.pineconeRagParser = {
    name: 'pinecone',
    canParse(spans) {
        return (spans ?? []).some(isPineconeSpan);
    },
    parse(spans) {
        return (spans ?? [])
            .filter(isPineconeSpan)
            .map((span) => (0, utils_1.buildRAGCall)(span, { systemName: SYSTEM_NAME }));
    },
};
//# sourceMappingURL=pinecone.js.map