import type { NativeToolCall, ProviderId, ToolChoice, ToolDefinition } from "../types.js"; export type { NativeToolCall, ToolChoice, ToolDefinition }; export type ToolDialect = "openai" | "anthropic" | "gemini" | "ollama" | "none"; export type ToolCallingMode = "auto" | "native" | "text"; /** Max argument JSON size while streaming (~32 MB). */ export declare const MAX_TOOL_ARG_BYTES: number; /** Primary wire form: dots → underscores, keep camelCase (fs.writeMany → fs_writeMany). */ export declare function toWireName(canonical: string): string; /** * Full snake_case wire form models sometimes emit * (fs.writeMany → fs_write_many). Used as a reverse alias only. */ export declare function toSnakeWireName(canonical: string): string; export declare function registerWireName(canonical: string, wire?: string): void; /** Register primary wire + snake_case alias when they differ. */ export declare function registerWireNamesFor(canonical: string): string; /** * Strip model channel / commentary / XML junk from tool names * (e.g. `fs.write<|channel|>commentary` → `fs.write`). */ export declare function sanitizeToolName(raw: string): string; export declare function fromWireName(wire: string): string | undefined; /** * Recover arguments from a provider that repeats the whole arguments object in * consecutive streaming deltas, producing `{"path":"x"}{"path":"x"}`. * Observed on Bynara/Grok; concatenation made every such call unparseable and * the tool never ran. Later non-empty values win so a growing snapshot keeps * its final state. */ export declare function repairConcatenatedToolArguments(raw: string): Record | undefined; export declare function parseToolArguments(raw: unknown): Record; export declare function syntheticToolCallId(index: number): string; export declare function isToolsUnsupportedError(error: unknown): boolean; export declare function mapToolChoiceToOpenAi(choice: ToolChoice | undefined): unknown; export declare function mapToolChoiceToAnthropic(choice: ToolChoice | undefined): unknown; export declare function mapToolChoiceToGemini(choice: ToolChoice | undefined): { mode: string; allowedFunctionNames?: string[]; }; export declare function textOnlyKey(provider: ProviderId, model: string): string; export declare function markTextOnlyModel(provider: ProviderId, model: string): void; export declare function isTextOnlyModel(provider: ProviderId, model: string): boolean; export declare function clearTextOnlyModels(): void; export interface OpenAiToolCallAccumulator { id?: string; name?: string; arguments: string; } export interface AccumulateToolCallDeltaResult { index: number; id?: string | undefined; name?: string | undefined; /** True when this delta first set a non-empty function name. */ nameBecameKnown: boolean; argumentsBytes: number; } /** Accumulate OpenAI-style streaming tool_calls deltas by index. */ export declare function accumulateOpenAiToolCallDelta(state: Map, entry: { index?: number; id?: string; type?: string; function?: { name?: string; arguments?: string | Record; }; }): AccumulateToolCallDeltaResult; export declare function finalizeOpenAiToolCalls(state: Map): NativeToolCall[]; export declare function parseOpenAiMessageToolCalls(toolCalls: Array<{ id?: string; type?: string; function?: { name?: string; arguments?: string; }; }> | undefined): NativeToolCall[];