/**
 * Native extension manifests — single source of truth for built-in extensions.
 *
 * Native extensions are loaded by default on all machines unless explicitly
 * disabled via `Settings.disabledNativeExtensions`. Each extension has a
 * stable `id` used in settings, a human-readable label for the landing UI,
 * and an optional file path for extensions that live as separate files.
 *
 * Extensions with empty `entryPath` are "core" features implemented directly
 * in the agent runtime (e.g., memory). They don't need a file to load, but
 * they still appear in the settings panel so users can see and toggle them.
 */
/**
 * Canonical list of native extensions.
 *
 * To add a new native extension, add its manifest here. The extension will
 * automatically appear in the landing settings panel and be loaded by default
 * unless `defaultEnabled: false`.
 */
export const NATIVE_EXTENSIONS = [
    {
        id: "memory",
        label: "Observational Memory",
        description: "Persists observations and reflections across sessions for long-term context. " +
            "Enables the agent to remember project conventions, decisions, and patterns.",
        category: "core",
        entryPath: "",
        defaultEnabled: true,
        tags: ["core", "context"],
    },
    {
        id: "browser",
        label: "Browser Automation",
        description: "Controls a real Chromium browser: navigate to URLs, click elements, type text, " +
            "take screenshots, inspect network traffic, and more. 23 automation tools powered by Playwright.",
        category: "automation",
        entryPath: "src/extensions/browser/index.ts",
        defaultEnabled: true,
        tags: ["automation", "playwright", "chrome"],
    },
    {
        id: "kanban",
        label: "Kanban Bridge",
        description: "Manages Kanban tasks on the Aexol Studio board. Enables task-driven execution " +
            "with BACKLOG → TODO → IN_PROGRESS → DONE workflow tracking.",
        category: "integration",
        entryPath: "src/extensions/kanban-bridge.ts",
        defaultEnabled: true,
        tags: ["studio", "tasks", "project-management"],
    },
    {
        id: "studio-mcp",
        label: "Aexol Studio MCP",
        description: "Proxies remote Studio tools to the agent: inference, cloud file operations, " +
            "project binding, and team management.",
        category: "integration",
        entryPath: "src/extensions/aexol-mcp.ts",
        defaultEnabled: true,
        tags: ["studio", "mcp", "cloud"],
    },
    {
        id: "openrouter-attribution",
        label: "OpenRouter Attribution",
        description: "Adds attribution headers for OpenRouter API usage tracking and compliance.",
        category: "integration",
        entryPath: "src/extensions/openrouter-attribution.ts",
        defaultEnabled: true,
        tags: ["api", "attribution"],
    },
    {
        id: "spectral-vision-fallback",
        label: "Spectral Vision Fallback",
        description: "Provides image description capabilities via configured vision models " +
            "when direct image analysis is not available.",
        category: "core",
        entryPath: "src/extensions/spectral-vision-fallback.ts",
        defaultEnabled: true,
        tags: ["vision", "images"],
    },
];
/**
 * Look up a native extension by id. Returns undefined for unknown ids.
 */
export function getNativeExtension(id) {
    return NATIVE_EXTENSIONS.find((e) => e.id === id);
}
/**
 * Get the list of native extension entry paths that should be loaded,
 * respecting a set of disabled extension ids.
 */
export function getEnabledNativeExtensionPaths(disabledIds) {
    return NATIVE_EXTENSIONS
        .filter((e) => e.defaultEnabled && !disabledIds.has(e.id) && e.entryPath !== "")
        .map((e) => e.entryPath);
}
/**
 * Build the payload for the `native_extensions_info` relay frame.
 */
export function buildNativeExtensionsInfo(disabledIds) {
    return NATIVE_EXTENSIONS.map((e) => ({
        id: e.id,
        label: e.label,
        description: e.description,
        category: e.category,
        enabled: e.defaultEnabled && !disabledIds.has(e.id),
        tags: e.tags,
    }));
}
