import type { ToolDefinition } from "../pi.js"; import type { CombinerConnection, ToolSummary } from "./connection.js"; export type DirectToolsSpec = string[] | "search"; /** Names that must never be shadowed by a promoted tool (pi builtins). Callers add * their own tool names on top. */ export declare const RESERVED_TOOL_NAMES: readonly ["read", "bash", "edit", "write", "grep", "find", "ls", "mcp", "glob"]; /** Apply a server allow/deny filter to a combined tool list. Server names may * contain underscores (gws_georgeharker), so matching is by PREFIX — a tool * belongs to entry E iff its name starts `E_` (subsumes first-segment equality). */ export declare function toolServerMatches(toolName: string, serverEntry: string): boolean; /** Apply a server allow/deny filter to a combined tool list (`_` prefix, * underscore-safe via toolServerMatches). */ export declare function applyServerFilter(tools: ToolSummary[], filter: { allow?: string[]; deny?: string[]; } | undefined): ToolSummary[]; /** fnmatch-lite: `*` → any run, `?` → one char, everything else literal. */ export declare function globToRegExp(pattern: string): RegExp; export declare function matchesGlob(name: string, pattern: string): boolean; /** Resolve the allowlist spec against the combined tool list (server filter applied * by the caller). Returns matching tools in list order. */ export declare function resolveAllowlist(tools: ToolSummary[], patterns: string[]): ToolSummary[]; export type DirectToolDeps = { connection: CombinerConnection; /** Names already registered (shared across syncs + search activation). */ registered: Set; /** Reserved names to refuse (builtins + this extension's own tool names). */ reserved: Set; register: (tool: ToolDefinition) => void; log: (level: "info" | "warn" | "error", message: string) => void; }; /** Build the Pi tool definition for one promoted combiner tool. */ export declare function buildDirectTool(tool: ToolSummary, deps: DirectToolDeps): ToolDefinition; /** Register one tool if new and not reserved. Returns the name, or undefined when skipped. */ export declare function registerDirectTool(tool: ToolSummary, deps: DirectToolDeps): string | undefined; /** Allowlist sync: register every matching, not-yet-registered tool. */ export declare function syncAllowlistTools(tools: ToolSummary[], patterns: string[], deps: DirectToolDeps): number; /** Search-mode activation: register matched tools (bounded per activation). Returns * the newly activated names — empty when everything matched was already live. */ export declare function activateFromSearch(matches: ToolSummary[], deps: DirectToolDeps, max?: number): string[]; //# sourceMappingURL=direct-tools.d.ts.map