/**
 * Hook Install Snippet Generator (companion to W4.4 proxy onboarding).
 *
 * Generates customer-facing copy-paste snippets for wiring governance hooks
 * into their existing agent codebase. The proxy onboarding (W4.4) covers
 * cloud-LLM-only customers via URL swap; this generator covers customers
 * who need the full hook install for tool-using agents (Claude Code,
 * OpenAI Agents SDK function calling, LangChain agents with tools, etc.).
 *
 * Each framework gets:
 *   - install command (npm / pip)
 *   - configuration snippet (where the hook is wired)
 *   - verification step (how to confirm the hook fired the first time)
 *
 * @connexum/ai-governance  F-NEW-PRODUCT-AGENT-DISCOVERY-CLI / W5.1 hook-install path
 */
const DEFAULT_ENDPOINT = 'https://proxy.my-cc.io/api/v1/events';
export function buildHookInstallSnippet(input) {
    if (!input.tenantId || input.tenantId.trim() === '') {
        throw new Error('buildHookInstallSnippet: tenantId is required');
    }
    const endpoint = input.endpoint ?? DEFAULT_ENDPOINT;
    switch (input.framework) {
        case 'claude-code':
            return claudeCode(input.tenantId, endpoint);
        case 'openai-agents-py':
            return openaiAgentsPy(input.tenantId, endpoint);
        case 'openai-agents-ts':
            return openaiAgentsTs(input.tenantId, endpoint);
        case 'langchain-py':
            return langchainPy(input.tenantId, endpoint);
        case 'langchain-ts':
            return langchainTs(input.tenantId, endpoint);
        case 'crew-ai':
            return crewAi(input.tenantId, endpoint);
        case 'langgraph':
            return langgraph(input.tenantId, endpoint);
    }
}
function claudeCode(tenant, endpoint) {
    return {
        framework: 'claude-code',
        tenantId: tenant,
        endpoint,
        installCommand: 'npx @connexum/ai-governance init',
        configPath: '.claude/settings.json',
        snippet: `{
  "hooks": {
    "PreToolUse": [
      {
        "command": "npx @connexum/ai-governance hook",
        "env": {
          "CONNEXUM_TENANT": "${tenant}",
          "CONNEXUM_ENDPOINT": "${endpoint}"
        }
      }
    ],
    "PostToolUse": [
      {
        "command": "npx @connexum/ai-governance hook --post"
      }
    ]
  }
}`,
        verificationStep: `Run any tool call in this Claude Code workspace. Within 5 seconds, ` +
            `your dashboard should show "first event received" for tenant ${tenant}.`,
    };
}
function openaiAgentsPy(tenant, endpoint) {
    return {
        framework: 'openai-agents-py',
        tenantId: tenant,
        endpoint,
        installCommand: 'pip install connexum-governance',
        configPath: 'your agent module',
        snippet: `from connexum_governance import wrap_agent

agent = Agent(name="researcher", tools=[web_search, summarize])
agent = wrap_agent(
    agent,
    tenant_id="${tenant}",
    endpoint="${endpoint}",
)
# Use agent.run(...) normally; hooks fire pre + post every tool call.`,
        verificationStep: `Invoke agent.run(...) once. The dashboard should show first event ` +
            `for tenant ${tenant} within 5 seconds.`,
    };
}
function openaiAgentsTs(tenant, endpoint) {
    return {
        framework: 'openai-agents-ts',
        tenantId: tenant,
        endpoint,
        installCommand: 'npm install @connexum/ai-governance',
        configPath: 'your agent module',
        snippet: `import { wrapAgent } from '@connexum/ai-governance';
import { Agent } from '@openai/agents';

const raw = new Agent({ name: 'researcher', tools: [webSearch, summarize] });
const agent = wrapAgent(raw, {
  tenantId: '${tenant}',
  endpoint: '${endpoint}',
});
// Use agent.run(...) normally; hooks fire pre + post every tool call.`,
        verificationStep: `Invoke agent.run(...) once. The dashboard should show first event ` +
            `for tenant ${tenant} within 5 seconds.`,
    };
}
function langchainPy(tenant, endpoint) {
    return {
        framework: 'langchain-py',
        tenantId: tenant,
        endpoint,
        installCommand: 'pip install connexum-governance',
        configPath: 'your agent constructor',
        snippet: `from connexum_governance.callbacks import ConnexumGovernanceCallback

cb = ConnexumGovernanceCallback(
    tenant_id="${tenant}",
    endpoint="${endpoint}",
)
agent_executor = AgentExecutor(
    agent=agent,
    tools=tools,
    callbacks=[cb],
)`,
        verificationStep: `Call agent_executor.invoke({...}) once. The dashboard should show ` +
            `first event for tenant ${tenant} within 5 seconds.`,
    };
}
function langchainTs(tenant, endpoint) {
    return {
        framework: 'langchain-ts',
        tenantId: tenant,
        endpoint,
        installCommand: 'npm install @connexum/ai-governance',
        configPath: 'your agent constructor',
        snippet: `import { ConnexumGovernanceCallback } from '@connexum/ai-governance/langchain';

const cb = new ConnexumGovernanceCallback({
  tenantId: '${tenant}',
  endpoint: '${endpoint}',
});

const executor = AgentExecutor.fromAgentAndTools({
  agent,
  tools,
  callbacks: [cb],
});`,
        verificationStep: `Call executor.invoke({...}) once. The dashboard should show first ` +
            `event for tenant ${tenant} within 5 seconds.`,
    };
}
function crewAi(tenant, endpoint) {
    return {
        framework: 'crew-ai',
        tenantId: tenant,
        endpoint,
        installCommand: 'pip install connexum-governance',
        configPath: 'your crew module',
        snippet: `from connexum_governance.crewai import GovernedCrew

crew = GovernedCrew(
    agents=[researcher, writer],
    tasks=[task1, task2],
    connexum_tenant_id="${tenant}",
    connexum_endpoint="${endpoint}",
)
result = crew.kickoff()`,
        verificationStep: `Run crew.kickoff() once. The dashboard should show first event ` +
            `for tenant ${tenant} within 5 seconds.`,
    };
}
function langgraph(tenant, endpoint) {
    return {
        framework: 'langgraph',
        tenantId: tenant,
        endpoint,
        installCommand: 'pip install connexum-governance',
        configPath: 'your graph module',
        snippet: `from connexum_governance.langgraph import attach_governance

builder = StateGraph(MyState)
builder.add_node("plan", plan_node)
builder.add_node("act", act_node)
builder.add_edge(START, "plan")
builder.add_edge("plan", "act")

graph = builder.compile()
graph = attach_governance(
    graph,
    tenant_id="${tenant}",
    endpoint="${endpoint}",
)`,
        verificationStep: `Invoke graph.invoke({...}) once. The dashboard should show first ` +
            `event for tenant ${tenant} within 5 seconds.`,
    };
}
export const SUPPORTED_HOOK_FRAMEWORKS = [
    { id: 'claude-code', label: 'Claude Code' },
    { id: 'openai-agents-py', label: 'OpenAI Agents SDK (Python)' },
    { id: 'openai-agents-ts', label: 'OpenAI Agents SDK (TypeScript)' },
    { id: 'langchain-py', label: 'LangChain (Python)' },
    { id: 'langchain-ts', label: 'LangChain (TypeScript)' },
    { id: 'crew-ai', label: 'CrewAI' },
    { id: 'langgraph', label: 'LangGraph' },
];
//# sourceMappingURL=hook-install-snippet.js.map