"use strict";
/**
 * agent-signatures.ts
 *
 * Provider and framework detection signatures for the agent-dir scanner.
 * Each signature carries a regex (applied line-by-line after stripping
 * comments and triple-quoted blocks), a provider/framework tag, and a kind.
 *
 * F-NEW-PRODUCT-AGENT-DIR-WRAPPER slice 1
 * @connexum/ai-governance
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.TYPESCRIPT_FRAMEWORK_SIGNATURES = exports.TYPESCRIPT_SIGNATURES = exports.PYTHON_FRAMEWORK_SIGNATURES = exports.PYTHON_SIGNATURES = void 0;
// ---------------------------------------------------------------------------
// Python — 8 provider signatures
// ---------------------------------------------------------------------------
exports.PYTHON_SIGNATURES = [
    {
        provider: 'openai',
        framework: null,
        // matches: `from openai import OpenAI`, `from openai import AsyncOpenAI`,
        //          `import openai` — but NOT `import openai_telemetry` (word boundary)
        regex: /^\s*(from\s+openai\s+import\s+\w+|import\s+openai\b)/,
        kind: 'import',
    },
    {
        provider: 'anthropic',
        framework: null,
        regex: /^\s*(from\s+anthropic\s+import\s+\w+|import\s+anthropic\b)/,
        kind: 'import',
    },
    {
        provider: 'google',
        framework: null,
        // google.generativeai SDK (Gemini)
        regex: /^\s*(import\s+google\.generativeai|from\s+google\.generativeai\s+import\s+\w+|from\s+google\s+import\s+generativeai)/,
        kind: 'import',
    },
    {
        provider: 'bedrock',
        framework: null,
        // boto3 / botocore access to Bedrock
        regex: /^\s*(import\s+boto3\b|from\s+boto3\s+import|from\s+botocore\s+import).*bedrock/i,
        kind: 'import',
    },
    {
        provider: 'ollama',
        framework: null,
        // subprocess invocation: subprocess.run(['ollama', ...]) or subprocess.Popen(['ollama', ...])
        regex: /subprocess\.(run|Popen|call)\s*\(\s*\[['"]ollama['"]/,
        kind: 'subprocess',
    },
    {
        provider: 'replicate',
        framework: null,
        regex: /^\s*(import\s+replicate\b|from\s+replicate\s+import\s+\w+)/,
        kind: 'import',
    },
    {
        provider: 'huggingface',
        framework: null,
        regex: /^\s*(from\s+huggingface_hub\s+import\s+\w+|from\s+transformers\s+import\s+\w+|import\s+huggingface_hub\b|import\s+transformers\b)/,
        kind: 'import',
    },
    {
        // Raw HTTP to known LLM APIs — provider resolved by URL host
        provider: 'openai',
        framework: null,
        regex: /(httpx|requests|urllib)\.(post|get|request)\s*\(\s*['"]https:\/\/api\.openai\.com/,
        kind: 'http',
    },
    {
        provider: 'anthropic',
        framework: null,
        regex: /(httpx|requests|urllib)\.(post|get|request)\s*\(\s*['"]https:\/\/api\.anthropic\.com/,
        kind: 'http',
    },
    {
        provider: 'google',
        framework: null,
        regex: /(httpx|requests|urllib)\.(post|get|request)\s*\(\s*['"]https:\/\/generativelanguage\.googleapis\.com/,
        kind: 'http',
    },
];
// ---------------------------------------------------------------------------
// Python — 9 framework adapter signatures
// ---------------------------------------------------------------------------
exports.PYTHON_FRAMEWORK_SIGNATURES = [
    {
        framework: 'langchain',
        provider: null, // provider detected separately via provider sigs
        regex: /^\s*from\s+langchain[\w.]*\s+import\s+\w+/,
        kind: 'import',
    },
    {
        framework: 'crewai',
        provider: null,
        regex: /^\s*(from\s+crewai\s+import\s+\w+|import\s+crewai\b)/,
        kind: 'import',
    },
    {
        framework: 'autogen',
        provider: null,
        regex: /^\s*(from\s+autogen\s+import\s+\w+|import\s+autogen\b)/,
        kind: 'import',
    },
    {
        framework: 'langgraph',
        provider: null,
        regex: /^\s*(from\s+langgraph[\w.]*\s+import\s+\w+|import\s+langgraph\b)/,
        kind: 'import',
    },
    {
        framework: 'pydantic-ai',
        provider: null,
        regex: /^\s*(from\s+pydantic_ai\s+import\s+\w+|import\s+pydantic_ai\b)/,
        kind: 'import',
    },
    {
        framework: 'haystack',
        provider: null,
        regex: /^\s*(from\s+haystack[\w.]*\s+import\s+\w+|import\s+haystack\b)/,
        kind: 'import',
    },
    {
        framework: 'llama-index',
        provider: null,
        regex: /^\s*(from\s+llama_index[\w.]*\s+import\s+\w+|import\s+llama_index\b)/,
        kind: 'import',
    },
    {
        framework: 'semantic-kernel',
        provider: null,
        regex: /^\s*(from\s+semantic_kernel[\w.]*\s+import\s+\w+|import\s+semantic_kernel\b)/,
        kind: 'import',
    },
    {
        framework: 'langchain',
        provider: 'openai',
        // `from langchain.llms import OpenAI` — treated as langchain AND openai
        regex: /^\s*from\s+langchain[\w.]*\s+import\s+.*OpenAI/,
        kind: 'import',
    },
];
// ---------------------------------------------------------------------------
// TypeScript / JavaScript — 8 provider signatures
// ---------------------------------------------------------------------------
exports.TYPESCRIPT_SIGNATURES = [
    {
        provider: 'openai',
        framework: null,
        // import OpenAI from 'openai' / import { OpenAI } from 'openai'
        regex: /^\s*import\s+.*\bfrom\s+['"]openai['"]/,
        kind: 'import',
    },
    {
        provider: 'anthropic',
        framework: null,
        regex: /^\s*import\s+.*\bfrom\s+['"]@anthropic-ai\/sdk['"]/,
        kind: 'import',
    },
    {
        provider: 'google',
        framework: null,
        regex: /^\s*import\s+.*\bfrom\s+['"]@google\/(generative-ai|genai)['"]/,
        kind: 'import',
    },
    {
        provider: 'bedrock',
        framework: null,
        regex: /^\s*import\s+.*BedrockRuntimeClient.*\bfrom\s+['"]@aws-sdk\/client-bedrock-runtime['"]/,
        kind: 'import',
    },
    {
        provider: 'azure',
        framework: null,
        regex: /^\s*import\s+.*\bfrom\s+['"]@azure\/openai['"]/,
        kind: 'import',
    },
    {
        provider: 'replicate',
        framework: null,
        regex: /^\s*import\s+.*\bfrom\s+['"]replicate['"]/,
        kind: 'import',
    },
    {
        provider: 'huggingface',
        framework: null,
        regex: /^\s*import\s+.*\bfrom\s+['"]@huggingface\/(inference|hub)['"]/,
        kind: 'import',
    },
    {
        provider: 'ollama',
        framework: null,
        regex: /^\s*import\s+.*\bfrom\s+['"]ollama['"]/,
        kind: 'import',
    },
    {
        provider: 'openai',
        framework: null,
        // Raw fetch to OpenAI API
        regex: /fetch\s*\(\s*['"]https:\/\/api\.openai\.com/,
        kind: 'http',
    },
    {
        provider: 'anthropic',
        framework: null,
        regex: /fetch\s*\(\s*['"]https:\/\/api\.anthropic\.com/,
        kind: 'http',
    },
];
// ---------------------------------------------------------------------------
// TypeScript / JavaScript — framework signatures
// ---------------------------------------------------------------------------
exports.TYPESCRIPT_FRAMEWORK_SIGNATURES = [
    {
        framework: 'langchain',
        provider: 'openai',
        regex: /^\s*import\s+.*\bfrom\s+['"]@langchain\/openai['"]/,
        kind: 'import',
    },
    {
        framework: 'langchain',
        provider: 'anthropic',
        regex: /^\s*import\s+.*\bfrom\s+['"]@langchain\/anthropic['"]/,
        kind: 'import',
    },
    {
        framework: 'langchain',
        provider: null,
        regex: /^\s*import\s+.*\bfrom\s+['"]langchain['"]/,
        kind: 'import',
    },
    {
        framework: 'langgraph',
        provider: null,
        regex: /^\s*import\s+.*\bfrom\s+['"]@langchain\/langgraph['"]/,
        kind: 'import',
    },
];
//# sourceMappingURL=agent-signatures.js.map