| import 'package:schemantic/schemantic.dart'; |
| |
| import '../../logic/run/agent_interaction_controller.dart'; |
| import '../../models/agent_tool_event.dart'; |
| import '../../models/agent_tool_id.dart'; |
| import '../base/agent_tool.dart'; |
| import '../tool_schemas.dart'; |
| |
| class PlanExitTool extends AgentTool<PlanExitInput, PlanExitOutput> { |
| const PlanExitTool({ |
| required this.interactionController, |
| }); |
| |
| final AgentInteractionController interactionController; |
| |
| @override |
| AgentToolId get toolId => AgentToolId.planExit; |
| |
| @override |
| String get name => 'planExit'; |
| |
| @override |
| String get description => |
| 'Transition from plan mode to build mode. Call this after outputting the complete implementation plan as visible text in the response, ' |
| 'allowing the user to approve the plan or request changes.'; |
| |
| @override |
| SchemanticType<PlanExitInput> get inputSchema => PlanExitInput.$schema; |
| |
| @override |
| SchemanticType<PlanExitOutput> get outputSchema => PlanExitOutput.$schema; |
| |
| @override |
| Future<PlanExitOutput> run(PlanExitInput input) async { |
| final decision = await interactionController.requestPlanExit(); |
| return PlanExitOutput( |
| implementPlan: decision.implementPlan, |
| instruction: decision.instruction, |
| ); |
| } |
| |
| @override |
| AgentToolEvent mapToToolEvent(PlanExitInput input, PlanExitOutput output) { |
| return createToolEvent( |
| status: ToolStatus.success, |
| summary: output.implementPlan ? 'planExit - implement plan' : 'planExit - continue planning', |
| ); |
| } |
| } |