use std::time::Instant;
use async_trait::async_trait;
use crate::domain::{ToolDefinition, ToolOutcome};
use super::super::ctx::ExecContext;
use super::ToolExecutor;
pub struct EnterPlanModeTool;
#[async_trait]
impl ToolExecutor for EnterPlanModeTool {
fn name(&self) -> &'static str {
crate::domain::plan::ENTER_PLAN_MODE_TOOL
}
fn schema(&self) -> ToolDefinition {
crate::domain::plan::enter_plan_mode_definition()
}
fn is_internal(&self) -> bool {
true
}
async fn execute(&self, _args: serde_json::Value, ctx: ExecContext) -> ToolOutcome {
let start = Instant::now();
if ctx.plan_file.is_some() {
return ToolOutcome::error("already in plan mode", start.elapsed().as_secs_f64());
}
ToolOutcome::success(
"Plan mode is on: the read-only floor now applies and the next system prompt names \
the plan file to author. Ground the design in the code, ask the user about genuine \
preferences, and finish by calling exit_plan_mode.",
"plan mode on",
start.elapsed().as_secs_f64(),
)
}
}