From 7251edd0cee7964e13bf666225cec685ead1ce23 Mon Sep 17 00:00:00 2001 From: Lakshman Patel Date: Tue, 15 Sep 2026 21:50:21 +0530 Subject: [PATCH] refactor(engine): drop planning re-export shim Remove internal/engine/planning_reexports.go and qualify the six call sites in tool_service.go with the planning package directly. First of the 23 engine re-export shims to go; the plan doc frames this as incremental multi-PR work. --- internal/engine/planning_reexports.go | 62 --------------------------- internal/engine/tool_service.go | 11 ++--- 2 files changed, 6 insertions(+), 67 deletions(-) delete mode 100644 internal/engine/planning_reexports.go diff --git a/internal/engine/planning_reexports.go b/internal/engine/planning_reexports.go deleted file mode 100644 index ffabc6aa..00000000 --- a/internal/engine/planning_reexports.go +++ /dev/null @@ -1,62 +0,0 @@ -// This file re-exports symbols from the planning sub-package so that existing -// callers of engine.ExecutionPlan, engine.NewExecutionPlanner, etc. keep compiling -// during the Stage 2 migration. See docs/plans/engine-refactor-plan.md. -package engine - -import "github.com/GrayCodeAI/rho/internal/engine/planning" - -type ( - ExecutionPlan = planning.ExecutionPlan - ExecutionStep = planning.ExecutionStep - PlannedCall = planning.PlannedCall - ExecutionPlanner = planning.ExecutionPlanner - BlastRadius = planning.BlastRadius - BlastRadiusReport = planning.BlastRadiusReport - Task = planning.Task - TaskPlan = planning.TaskPlan - TaskDecomposer = planning.TaskDecomposer - Subtask = planning.Subtask - PlanState = planning.PlanState - GoalStatus = planning.GoalStatus - Goal = planning.Goal - GoalEvent = planning.GoalEvent - GoalTracker = planning.GoalTracker - GoalOption = planning.GoalOption - SuggestedTask = planning.SuggestedTask - TaskQueue = planning.TaskQueue - ActionRequired = planning.ActionRequired - FormField = planning.FormField - FormResponse = planning.FormResponse - ActionManager = planning.ActionManager -) - -var ( - NewExecutionPlanner = planning.NewExecutionPlanner - EstimateBlastRadius = planning.EstimateBlastRadius - NewTaskDecomposer = planning.NewTaskDecomposer - NewPlanState = planning.NewPlanState - DecomposePrompt = planning.DecomposePrompt - ParseSubtasks = planning.ParseSubtasks - WithPriority = planning.WithPriority - WithBudget = planning.WithBudget - WithDependencies = planning.WithDependencies - WithTags = planning.WithTags - NewGoalTracker = planning.NewGoalTracker - NewTaskQueue = planning.NewTaskQueue - ScanGitTasks = planning.ScanGitTasks - ScanTODOs = planning.ScanTODOs - ScanTestFailures = planning.ScanTestFailures - FormatTasks = planning.FormatTasks - NewActionManager = planning.NewActionManager - Validate = planning.Validate - BuildFormPrompt = planning.BuildFormPrompt - FormatResponse = planning.FormatResponse -) - -// Blast radius constants re-exported from planning package. -const ( - RadiusSmall = planning.RadiusSmall - RadiusMedium = planning.RadiusMedium - RadiusLarge = planning.RadiusLarge - RadiusHuge = planning.RadiusHuge -) diff --git a/internal/engine/tool_service.go b/internal/engine/tool_service.go index 441a0f14..158e048b 100644 --- a/internal/engine/tool_service.go +++ b/internal/engine/tool_service.go @@ -11,6 +11,7 @@ import ( "sync" "github.com/GrayCodeAI/rho/internal/engine/diff" + "github.com/GrayCodeAI/rho/internal/engine/planning" "github.com/GrayCodeAI/rho/internal/hooks" "github.com/GrayCodeAI/rho/internal/intelligence/repomap" "github.com/GrayCodeAI/rho/internal/observability/metrics" @@ -317,12 +318,12 @@ func (s *ToolService) ExecuteAll(ctx context.Context, calls []types.ToolCall, ch } return results } - plannedCalls := make([]PlannedCall, len(calls)) + plannedCalls := make([]planning.PlannedCall, len(calls)) concurrentCalls := make([]indexedToolCall, 0, len(calls)) sequentialCalls := make([]indexedToolCall, 0, len(calls)) for i, call := range calls { targets := s.ExtractTargets(call) - plannedCalls[i] = PlannedCall{ToolName: call.Name, Args: call.Arguments, Targets: targets} + plannedCalls[i] = planning.PlannedCall{ToolName: call.Name, Args: call.Arguments, Targets: targets} item := indexedToolCall{index: i, tc: call} if tool.IsReadOnly(call.Name) { concurrentCalls = append(concurrentCalls, item) @@ -330,7 +331,7 @@ func (s *ToolService) ExecuteAll(ctx context.Context, calls []types.ToolCall, ch sequentialCalls = append(sequentialCalls, item) } } - if report := EstimateBlastRadius(plannedCalls); report.Radius.NeedsConfirmation() && ch != nil { + if report := planning.EstimateBlastRadius(plannedCalls); report.Radius.NeedsConfirmation() && ch != nil { emitEvent(ctx, ch, StreamEvent{Type: "blast_radius", Content: report.Message}) } @@ -879,8 +880,8 @@ func (s *ToolService) ExtractTargets(tc types.ToolCall) []string { // EstimateBlastRadius returns a blast-radius report for a set of // planned tool calls. Drives the "needs confirmation" prompt. -func (s *ToolService) EstimateBlastRadius(planned []PlannedCall) *BlastRadiusReport { - return EstimateBlastRadius(planned) +func (s *ToolService) EstimateBlastRadius(planned []planning.PlannedCall) *planning.BlastRadiusReport { + return planning.EstimateBlastRadius(planned) } // ExecuteRegistered is the compatibility entry point for callers that still