/** * The `tool_search` meta-tool — promotes deferred tools on demand. * * Phase-3 sibling of the Rust reference `tool_search.rs`. Mirrors the behaviour, * not the type shapes (this core has no `ToolRegistry` — tools are a plain array * on {@link AgentOptions}). * * As a tool set grows past ~20-30 entries, every model turn pays tokens to read * schemas it isn't going to use, diluting the model's attention budget. So a caller * can register some tools as **deferred** (`AgentOptions.deferredTools`): their * schemas are hidden from the model. Instead the agent advertises a single built-in * `tool_search(query)` meta-tool. When the model calls it, this fuzzy-matches the * query against the deferred tools' names + descriptions, **promotes** the matches * into the visible set (so the model can call them on subsequent turns), and returns * each match's name + description as JSON. * * A deferred tool that has not been promoted is *not* dispatchable — calling it * surfaces as an unknown tool until `tool_search` adds it to the promoted set. */ import type { Tool } from './agent.js'; /** The built-in meta-tool's name. Reserved when deferred tools are in play. */ export declare const TOOL_SEARCH_NAME = "tool_search"; /** * Cap on how many deferred tools a single `tool_search` call may promote, so a * generic query like "tool" doesn't promote the entire deferred set in one shot. */ export declare const MAX_MATCHES = 8; /** * Drives deferred-tool promotion for one agent run. Implements {@link Tool} so the * agent can advertise + dispatch it like any other tool. Holds the deferred tools * (by name) and the mutable set of promoted names; the agent consults * {@link promotedTools} each iteration to decide which deferred schemas are now * visible/dispatchable. */ export declare class ToolSearch implements Tool { readonly name = "tool_search"; readonly description: string; readonly parameters: Record; private readonly deferredByName; private readonly promoted; constructor(deferred: Tool[]); /** True if any tool was registered deferred (the meta-tool is advertised only then). */ hasDeferred(): boolean; /** True if a deferred tool has been promoted and is now dispatchable. */ isPromoted(name: string): boolean; /** The deferred tools that have been promoted — their schemas join the visible set. */ promotedTools(): Tool[]; /** Resolve a promoted deferred tool for dispatch. Unpromoted deferred tools are invisible. */ toolByName(name: string): Tool | undefined; /** Mark a deferred tool promoted. Returns false if no such deferred tool. */ promote(name: string): boolean; /** Fuzzy-match the query, promote matches, and return their schemas as JSON. */ execute(args: Record): Promise; } //# sourceMappingURL=toolSearch.d.ts.map