/**
 * NERF Security Extension for the nerf runtime.
 *
 * Registers security tools, commands, event hooks, and prompt templates
 * that transform the execution engine into a security operations platform.
 *
 * Tools: scan, review, compliance, osint, memory, benchmark, lookup,
 *        techdetect, decode, dirprobe
 *
 * Hooks: before_agent_start (mode injection), context (RAG knowledge),
 *        tool_call (audit logging), resources_discover (prompt templates)
 *
 * Commands: /nerf-status, /nerf-doctor, /nerf-skills
 * Prompts: 34 security command templates (/nerf:redteam, /nerf:engage, etc.)
 */
import { registerNerfTools } from "./tools.js";
import { registerNerfCommands } from "./commands.js";
import { registerNerfHooks } from "./hooks.js";
import { registerNerfAdapter } from "./adapter.js";
import { registerNerfValidators } from "./validators.js";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { existsSync } from "node:fs";
const __dirname = fileURLToPath(new URL(".", import.meta.url));
export default async function registerExtension(pi) {
    registerNerfTools(pi);
    registerNerfCommands(pi);
    registerNerfHooks(pi);
    registerNerfAdapter(pi);
    registerNerfValidators(pi);
    // Register prompt templates for /nerf:* slash commands.
    // The prompts dir lives alongside this extension file — pi copies it
    // when installing the extension to ~/.nerf/agent/extensions/nerf/.
    pi.on("resources_discover", () => {
        const promptsDir = join(__dirname, "prompts");
        if (existsSync(promptsDir)) {
            return { promptPaths: [promptsDir] };
        }
        return undefined;
    });
}
