From 1b20533da9a816bd21558fa4ddfb76f55a1a2fb5 Mon Sep 17 00:00:00 2001 From: Andrew Beal Date: Tue, 30 Dec 2025 22:42:23 +0000 Subject: [PATCH] refactor: return structured next step data instead of embedding in message Previously the next step description was embedded in the completion message string. Now return it as a separate structured object with step number, description, instruction, and optional context for better programmatic access. --- Enums/Copy.ts | 2 +- Types/ExecutionPlan.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Enums/Copy.ts b/Enums/Copy.ts index 9372000..57dbfec 100644 --- a/Enums/Copy.ts +++ b/Enums/Copy.ts @@ -70,7 +70,7 @@ export enum Copy { PlanningFailedError = "Planning failed. No execution plan was generated. Please consult with the user about how to proceed.", StepDoesNotExistError = "Step {stepNumber} does not exist in the execution plan. Valid step numbers are 1-{totalSteps}.", StepMustBeCompletedInOrderError = "Cannot complete step {stepNumber}. Step \"{incompletStep}\" is not yet completed. Steps must be completed in order.", - StepCompletedWithNextStep = "Step {stepNumber} completed successfully. Now proceed with step {nextStepNumber}: {nextStepDescription}", + StepCompletedWithNextStep = "Step {stepNumber} completed successfully. Now proceed with step {nextStepNumber}.", AllStepsCompleted = "Step {stepNumber} completed successfully. All steps in the execution plan have been completed. Provide a final summary to the user based on the completed steps and overall success criteria.", MaxPlanningIterationsReached = "I've attempted multiple planning iterations but encountered persistent issues completing the task. It may need to be broken down further or requires additional clarification.", diff --git a/Types/ExecutionPlan.ts b/Types/ExecutionPlan.ts index d9e99a7..ae59b2c 100644 --- a/Types/ExecutionPlan.ts +++ b/Types/ExecutionPlan.ts @@ -64,7 +64,6 @@ export class ExecutionPlan { }; } } - currentStep.status = ExecutionStatus.Completed; const nextStep = this.executionSteps[stepIndex + 1]; @@ -73,9 +72,12 @@ export class ExecutionPlan { return { message: replaceCopy(Copy.StepCompletedWithNextStep, [ stepNumber.toString(), - (stepNumber + 1).toString(), - nextStep.description - ]) + (stepNumber + 1).toString() + ]), + step: nextStep.step, + description: nextStep.description, + instruction: nextStep.instruction, + ...(nextStep.context && { context: nextStep.context }) }; } else { return {