import type { Api, Model } from "@earendil-works/pi-ai/compat";
/**
 * Reconstruct flattened Gemini tool-call arguments into proper nested
 * arrays/objects. Returns the original reference unchanged when there is nothing
 * to reconstruct. Bracket-indexed keys are always reconstructed; purely dotted
 * keys are reconstructed only when the optional `schema` marks their head
 * segment as an object/array container property. Reconstruction (and its
 * prototype-pollution guard) is delegated to the shared canonical helper.
 */
export declare function unflattenGeminiToolArguments(args: unknown, schema?: unknown): unknown;
/**
 * If `model` is a GitHub Copilot Gemini model, normalize flattened tool-call
 * arguments; otherwise return them unchanged. Used to gate
 * {@link unflattenGeminiToolArguments} by model at tool-call time. The optional
 * `schema` is the tool's parameter schema, used to disambiguate dotted keys.
 */
export declare function normalizeToolArgumentsForModel(args: unknown, model: Pick<Model<Api>, "provider" | "api" | "id"> | undefined, schema?: unknown): unknown;
/**
 * Reconstruct flattened GitHub Copilot Gemini tool-call arguments on the
 * **outbound replay payload**, so prior assistant tool calls are sent back to
 * CAPI in the nested array/object shape Gemini originally produced.
 *
 * Why this exists
 * ---------------
 * {@link normalizeToolArgumentsForModel} only unflattens at tool *execution*
 * time; the persisted assistant message keeps the raw flattened arguments CAPI
 * delivered (for example `{ "edits[0].newText": "..." }`). When that message is
 * replayed on the next turn, CAPI parses those literal keys straight into the
 * Gemini `FunctionCall.Args`, producing a function call that does not match the
 * tool's declared schema (nor the structure Gemini signed). Gemini then ends
 * the turn with `MALFORMED_FUNCTION_CALL` / `UNEXPECTED_TOOL_CALL` / `OTHER`,
 * which CAPI surfaces as a bare `finish_reason: "error"` — so multi-turn tool
 * use dies one turn after any array/object tool call (such as `edit`).
 *
 * This rewrites each replayed assistant `tool_calls[].function.arguments` JSON
 * into the reconstructed nested shape (reusing {@link unflattenGeminiToolArguments}
 * with the tool's own parameter schema, looked up from the payload's `tools`),
 * fixing both new and already-persisted sessions. Gated to GitHub Copilot Gemini
 * models, fail-open on non-JSON arguments, and a no-op for well-formed args.
 */
export declare function normalizeCopilotGeminiReplayToolArguments(payload: unknown, model: Pick<Model<Api>, "provider" | "api" | "id">): unknown;
//# sourceMappingURL=copilot-gemini-tool-arguments.d.ts.map