import { z } from "zod";
const EnterPlanParams = z.object({
    reason: z
        .string()
        .optional()
        .describe("Why you are entering plan mode, e.g. a complex multi-file task"),
});
export function createEnterPlanTool(onEnterPlan) {
    return {
        name: "enter_plan",
        description: "Enter plan mode for safe, read-only exploration before making changes. " +
            "Use this when a complex or risky task benefits from research and an explicit plan. " +
            "In plan mode, bash, edit, subagent, and normal writes are restricted; write is only allowed under .ezcoder/plans/.",
        parameters: EnterPlanParams,
        executionMode: "sequential",
        async execute({ reason }) {
            const entered = await onEnterPlan(reason);
            // The host can decline plan mode (e.g. during an unattended task run where
            // an approval pane would stall the loop). When declined, tell the agent to
            // skip planning and implement the task directly.
            if (entered === false) {
                return ("Plan mode is unavailable during a task run. Skip planning and implement " +
                    "the task directly: make the code changes, verify them, and mark the task done.");
            }
            return ("Plan mode activated. You are now in read-only research mode.\n\n" +
                "Allowed actions:\n" +
                "- Use read, grep, find, ls, source_path, web_fetch/web_search, and code search tools to investigate\n" +
                "- Write the implementation plan to .ezcoder/plans/<name>.md\n\n" +
                "Restricted: bash, edit, write outside .ezcoder/plans/, subagent, and task mutation.\n\n" +
                "When the plan is ready, call exit_plan with the plan file path.");
        },
    };
}
//# sourceMappingURL=enter-plan.js.map