automatic tool call repair for pi coding agent A developer created an automatic tool call repair extension for the Pi coding agent that fixes invalid tool call arguments before execution. The extension validates tool call parameters against their schemas and attempts to repair common issues like incorrect paths or missing required fields, logging all repair attempts for debugging. | // put in ~/.pi/agent/extensions/tool-input-repair.ts | | | // based off of https://x.com/MrAhmadAwais/status/2050956678502420612 | | | import { appendFile, mkdir } from "node:fs/promises"; | | | import { homedir } from "node:os"; | | | import { dirname, join } from "node:path"; | | | import { env } from "node:process"; | | | import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent"; | | | import { Compile } from "typebox/compile"; | | | import { Value } from "typebox/value"; | | | type Args = Record