// Force strict mode and setup for ESM
"use strict";
import "./chunk-APATH2AK.js";
import "./chunk-K5PGHDBN.js";
import "./chunk-VIEIRAK3.js";
import "./chunk-O4PICXES.js";
import "./chunk-TW522KN6.js";
import "./chunk-BJ5HQ23U.js";
import "./chunk-SFRV6BGY.js";
import "./chunk-ZOFNJQNJ.js";
import "./chunk-WPTCDQN6.js";
import "./chunk-OMX7CUOE.js";
import "./chunk-MLZQVCF3.js";
import "./chunk-LD2XBG6Z.js";
import "./chunk-CPVI5J2L.js";
import "./chunk-ZMIBJS45.js";
import "./chunk-77WXWU44.js";
import "./chunk-B4ZF2KSI.js";
import "./chunk-6EQ7T7HK.js";
import "./chunk-3PJXIDKI.js";
import "./chunk-UWCTAVOD.js";
import "./chunk-OFEVLU4C.js";
import "./chunk-IQHSD7K5.js";
import "./chunk-LYRSMKLS.js";
import "./chunk-RTTAC5VW.js";
import {
  BaseDeclarativeTool,
  BaseToolInvocation,
  ToolDisplayNames,
  ToolNames
} from "./chunk-ZNUMXPNK.js";
import "./chunk-IDYDPBBN.js";
import "./chunk-FIQECJTQ.js";
import "./chunk-64WXLC72.js";
import "./chunk-LXYWINWF.js";
import "./chunk-NNIYWQIS.js";
import "./chunk-LYSND7KR.js";
import "./chunk-55ZMG67I.js";
import "./chunk-H6BD2ELD.js";
import "./chunk-5IFG2VC4.js";
import {
  createDebugLogger
} from "./chunk-HA2UEYZP.js";
import "./chunk-ZERZSAZL.js";
import "./chunk-QN5NZ3UQ.js";
import "./chunk-BR4QREVK.js";
import "./chunk-Z2Z3GUXZ.js";
import {
  init_esbuild_shims
} from "./chunk-A4BMJM77.js";
import {
  __name
} from "./chunk-J2S4EL5Y.js";

// packages/core/src/tools/enterPlanMode.ts
init_esbuild_shims();
var debugLogger = createDebugLogger("ENTER_PLAN_MODE");
var enterPlanModeToolDescription = `Use this tool to lower into plan mode before doing uncertain or complex work. Entering plan mode is a privilege reduction, so it does not require user confirmation.

## When to Use This Tool
Use this tool when the task is not yet clear enough to safely execute, for example when it requires multi-file changes, design choices, investigation before a plan can be summarized, or when requirements are ambiguous. While investigating, if complexity rises or you find yourself repeatedly needing to ask the user, enter plan mode and consolidate a plan.

## When NOT to Use This Tool
If the request is already clear, small, and low-risk, you may execute directly without entering plan mode. Do not make speculative small edits before you have thought the change through.

## Important
Do NOT use this tool if the user has explicitly asked you not to use plan mode.`;
var enterPlanModeToolSchemaData = {
  name: "enter_plan_mode",
  description: enterPlanModeToolDescription,
  parametersJsonSchema: {
    type: "object",
    properties: {},
    additionalProperties: false,
    $schema: "http://json-schema.org/draft-07/schema#"
  }
};
var EnterPlanModeToolInvocation = class extends BaseToolInvocation {
  constructor(config, params) {
    super(params);
    this.config = config;
  }
  static {
    __name(this, "EnterPlanModeToolInvocation");
  }
  getDescription() {
    return "Enter plan mode";
  }
  /**
   * Entering plan mode lowers privileges, so it is always allowed without a
   * confirmation prompt.
   */
  async getDefaultPermission() {
    return "allow";
  }
  async execute(_signal) {
    const isAcpMode = this.config.getExperimentalZedIntegration?.() || this.config.getInputFormat?.() === "stream-json" /* STREAM_JSON */;
    if (!this.config.isInteractive() && !isAcpMode) {
      return {
        llmContent: "Cannot enter plan mode in non-interactive mode without ACP support. The gate exit paths require user interaction.",
        returnDisplay: "Plan mode unavailable in non-interactive mode."
      };
    }
    try {
      if (this.config.getApprovalMode() !== "plan" /* PLAN */) {
        this.config.setApprovalMode("plan" /* PLAN */);
      }
    } catch (error) {
      const errorMessage = error instanceof Error ? error.message : String(error);
      debugLogger.error(
        `[EnterPlanModeTool] Failed to set approval mode to plan: ${errorMessage}`
      );
      return {
        llmContent: `Failed to enter plan mode: ${errorMessage}`,
        returnDisplay: `Error entering plan mode: ${errorMessage}`
      };
    }
    return {
      llmContent: "Plan mode is now active. Continue with read-only investigation, ask the user when needed, and use exit_plan_mode when the plan is ready.",
      returnDisplay: "Entered plan mode."
    };
  }
};
var EnterPlanModeTool = class _EnterPlanModeTool extends BaseDeclarativeTool {
  constructor(config) {
    super(
      _EnterPlanModeTool.Name,
      ToolDisplayNames.ENTER_PLAN_MODE,
      enterPlanModeToolDescription,
      "think" /* Think */,
      enterPlanModeToolSchemaData.parametersJsonSchema,
      true,
      // isOutputMarkdown
      false,
      // canUpdateOutput
      false,
      // shouldDefer — always visible so the model can enter plan mode
      false,
      // alwaysLoad
      "plan mode enter start"
    );
    this.config = config;
  }
  static {
    __name(this, "EnterPlanModeTool");
  }
  static Name = ToolNames.ENTER_PLAN_MODE;
  createInvocation(params) {
    return new EnterPlanModeToolInvocation(this.config, params);
  }
};
export {
  EnterPlanModeTool
};
/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */
