export interface ToolCall { name: string; arguments: Record | string; } /** Parse tool calls from raw LLM output into structured objects. * Handles Qwen/Hermes , Mistral [TOOL_CALLS], Llama bare JSON, * fenced JSON, nested OpenAI-style function objects, string-encoded args. */ export declare function parseToolCalls(text: string): ToolCall[]; /** Strip traces reasoning models prepend. */ export declare const stripThinking: (t: string) => string; /** Salvage a tool call from a *primed* generation. * * When the library forces a call it hands the model an already-open * `\n{"name": "` and lets it continue. Small models frequently * produce something that is nearly-but-not-quite JSON: an unterminated * object, a trailing explanation, a stray newline inside the braces. Strict * parsing throws all of that away and the forced turn is wasted — which is * exactly what "FORCE-FAILED" was: the model named the right tool and we * discarded it over a missing brace. * * So: try the strict parser first, then fall back to pulling the name and * arguments out with regexes, then match the name against what is actually * registered (exact, then case-insensitive, then unique substring). Returns * null when nothing trustworthy can be recovered. */ export declare function salvageToolCall(text: string, known: readonly string[]): ToolCall | null; /** Strip tool-call syntax out of text meant to be a human-facing answer. * * After results are in, a model still sees the tool schemas and the "return a * json object within " instruction in its template, and small ones * sometimes open a call again and stop. That fragment parses to nothing, so it * used to be handed back as the final answer — observed live on the demo: * the tool ran correctly and the user was shown the literal text * "". */ export declare const stripCallFragments: (t: string) => string;