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.
This commit is contained in:
Andrew Beal 2025-12-30 22:42:23 +00:00
parent a4daa3a9df
commit 1b20533da9
2 changed files with 7 additions and 5 deletions

View file

@ -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.",

View file

@ -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 {