diff --git a/src/core/prompts/responses.ts b/src/core/prompts/responses.ts index caf3827f..95ba50b4 100644 --- a/src/core/prompts/responses.ts +++ b/src/core/prompts/responses.ts @@ -130,8 +130,8 @@ Otherwise, if you have not completed the task and do not need additional informa cwd: string, wasRecent: boolean | 0 | undefined, responseText?: string, - ): [string, string] => { - const taskResumptionMessage = `[TASK RESUMPTION] ${ + ) => { + return `[TASK RESUMPTION] ${ mode === "plan" ? `This task was interrupted ${agoText}. The conversation may have been incomplete. Be aware that the project state may have changed since then. The current working directory is now '${cwd.toPosix()}'.\n\nNote: If you previously attempted a tool use that the user did not provide a result for, you should assume the tool use was not successful. However you are in PLAN MODE, so rather than continuing the task, you must respond to the user's message.` : `This task was interrupted ${agoText}. It may or may not be complete, so please reassess the task context. Be aware that the project state may have changed since then. The current working directory is now '${cwd.toPosix()}'. If the task has not been completed, retry the last step before interruption and proceed with completing the task.\n\nNote: If you previously attempted a tool use that the user did not provide a result for, you should assume the tool use was not successful and assess whether you should retry. If the last tool was a browser_action, the browser has been closed and you must launch a new browser if needed.` @@ -139,17 +139,13 @@ Otherwise, if you have not completed the task and do not need additional informa wasRecent ? "\n\nIMPORTANT: If the last tool use was a replace_in_file or write_to_file that was interrupted, the file was reverted back to its original state before the interrupted edit, and you do NOT need to re-read the file as you already have its up-to-date contents." : "" - }` - - const userResponseMessage = `${ + }${ responseText - ? `${mode === "plan" ? "New message to respond to with plan_mode_respond tool (be sure to provide your response in the parameter)" : "New instructions for task continuation"}:\n\n${responseText}\n` + ? `\n\n${mode === "plan" ? "New message to respond to with plan_mode_respond tool (be sure to provide your response in the parameter)" : "New instructions for task continuation"}:\n\n${responseText}\n` : mode === "plan" ? "(The user did not provide a new message. Consider asking them how they'd like you to proceed, or to switch to Act mode to continue with the task.)" : "" }` - - return [taskResumptionMessage, userResponseMessage] }, planModeInstructions: () => { diff --git a/src/core/task/index.ts b/src/core/task/index.ts index 4bf6470f..9766f547 100644 --- a/src/core/task/index.ts +++ b/src/core/task/index.ts @@ -942,22 +942,15 @@ export class Task { const wasRecent = lastClineMessage?.ts && Date.now() - lastClineMessage.ts < 30_000 - const [taskResumptionMessage, userResponseMessage] = formatResponse.taskResumption( - this.chatSettings?.mode === "plan" ? "plan" : "act", - agoText, - cwd, - wasRecent, - responseText, - ) - newUserContent.push({ type: "text", - text: taskResumptionMessage, - }) - - newUserContent.push({ - type: "text", - text: userResponseMessage, + text: formatResponse.taskResumption( + this.chatSettings?.mode === "plan" ? "plan" : "act", + agoText, + cwd, + wasRecent, + responseText, + ), }) if (responseImages && responseImages.length > 0) {