/** * Model-callable tools for the pi-context-optimizer loop. * * write_plan — RESEARCHING/PLAN_DRAFTING only. Writes plan.md, opens * it in VS Code, flips state → REVIEW_PENDING, and tells * the LLM to STOP and wait for /approve. * update_tasks — EXECUTING only. Rewrites tasks.md checklist; returns * remaining/done counts. Honors `[DONE:n]` markers in * assistant turns via index.ts's turn_end hook too. * write_walkthrough — EXECUTING-end. Writes walkthrough.md, opens it, * returns state to INERT. * write_knowledge_item — phase-2 stub: appends to /knowledge/. * * All file writes go through `withFileMutationQueue` so they share the per-file * queue with pi's built-in edit/write tool (no torn writes between us and the * agent if both touch the same file). * * Enum params use `StringEnum` (not Type.Union/Literal) for Google API compat, * per docs/extensions.md. * * Tools throw to signal errors (returning a value never sets isError=true). */ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; import { type TaskItem } from "./utils.ts"; import type { AgState } from "./state.ts"; export interface ToolDeps { getState: () => AgState; setState: (next: AgState) => void; /** Called after write_plan to refresh the status.json file + watcher. */ onPlanSubmitted: () => Promise; /** Called after update_tasks to reflect counts into status.json and the live task state. */ onTasksUpdated: (done: number, total: number, items?: TaskItem[]) => Promise; /** Called after write_walkthrough to reset status. */ onWalkthroughWritten: () => Promise; /** Get active dispatcher status if running. */ getDispatcherStatus?: () => { done: number; inFlight: number; failed: number; queued: number; total: number; } | null; } export declare function registerTools(pi: ExtensionAPI, deps: ToolDeps): void; //# sourceMappingURL=tools.d.ts.map