import type { GrantPolicy } from "./role-store.js";
export interface ToolProvider {
    type: 'builtin' | 'bobbit-extension' | 'mcp';
    tool?: string;
    extension?: string;
    server?: string;
    mcpTool?: string;
}
export interface ToolInfo {
    name: string;
    description: string;
    group: string;
    docs?: string;
    detail_docs?: string;
    hasRenderer: boolean;
    rendererFile?: string;
    /** Grant policy from YAML; undefined means "not configured" */
    grantPolicy?: GrantPolicy;
    /** Optional positional parameter names (trailing `?` marks optional). */
    params?: string[];
}
/**
 * Tool definitions directory — .bobbit/config/tools/ (runtime config-layer, legacy export, deprecated).
 * @deprecated Use ToolManager.getExtensionPath() or ToolManager.getToolsDir() instead.
 */
export declare const TOOLS_DIR: string;
/** Test/maintenance hook: drop the scan cache. */
export declare function __resetToolScanCache(): void;
/** Recursively copy a directory. */
export declare function copyDirRecursive(src: string, dest: string): void;
/**
 * Manages tool definitions and metadata.
 * Tool definitions are loaded from tools/<group>/*.yaml on every read.
 * Supports a two-layer cascade: builtinToolsDir (read-only) → toolsDir (overrides).
 */
export declare class ToolManager {
    private externalTools;
    private readonly toolsDir;
    private readonly builtinToolsDir;
    constructor(configDir: string, builtinToolsDir?: string);
    /** Get the config-level tools directory. */
    getToolsDir(): string;
    /** Get the builtins tools directory (dist/server/defaults/tools/). */
    getBuiltinToolsDir(): string | undefined;
    /**
     * Resolve which tools/ parent directory contains a given group.
     * Config-level (toolsDir) takes priority over builtins.
     */
    getToolGroupBaseDir(groupDir: string): string;
    /**
     * Resolve the absolute path to a file within a tool group, respecting the cascade.
     * This is the primary method for resolving extension paths — replaces direct TOOLS_DIR usage.
     */
    getExtensionPath(groupDir: string, filename: string): string;
    /**
     * Delete a tool group from the config-level tools directory, reverting to the builtin version.
     * Returns true if the group was deleted, false if it didn't exist.
     */
    revertToolGroup(groupDir: string): boolean;
    /** Register tools from external sources (e.g. MCP servers). */
    registerExternalTools(tools: Array<{
        name: string;
        description: string;
        summary?: string;
        group: string;
        docs?: string;
        provider: ToolProvider;
    }>): void;
    /** Remove all external tools whose name starts with the given prefix. */
    removeExternalTools(prefix: string): void;
    /**
     * Returns only tools defined locally in the config dir (not inherited from builtins).
     * Used by the config cascade to determine which tools are server/project overrides.
     */
    getLocalTools(): ToolInfo[];
    /** Returns all tools, re-scanning the YAML directory on every call. */
    getAvailableTools(): ToolInfo[];
    /** Returns a single tool's full detail, or undefined if not found. Case-insensitive lookup. */
    getToolByName(name: string): ToolInfo | undefined;
    /**
     * Generate per-group detail docs markdown files in the state directory.
     * These are the full reference docs that the system prompt footer links to.
     * Call once at startup (or when tool definitions change).
     */
    generateDetailDocs(stateDir: string): void;
    /**
     * Returns formatted tool documentation for inclusion in system prompts.
     *
     * Generates a single `# Tools` section with per-group summaries, docs, and footer links.
     *
     * If `toolNames` is provided, only includes those tools; otherwise includes all.
     */
    getToolDocsForPrompt(toolNames?: string[], stateDir?: string): string;
    /** Returns the provider info for a tool, or undefined if not found. */
    getToolProvider(name: string): ToolProvider | undefined;
    /** Returns all tool providers with groupDir and baseDir in a single YAML scan. */
    getToolProviders(): Map<string, ToolProvider & {
        groupDir: string;
        baseDir: string;
    }>;
    /** Returns all tool names from YAML definitions. */
    getAllToolNames(): string[];
    /**
     * Updates tool metadata (description, group, docs) by writing directly to the YAML file.
     * If the tool's group only exists in builtins, copies the entire group to toolsDir first.
     */
    updateToolMetadata(name: string, updates: {
        description?: string;
        group?: string;
        docs?: string;
        detail_docs?: string;
        grantPolicy?: string;
    }): boolean;
}
//# sourceMappingURL=tool-manager.d.ts.map