diff --git a/packages/kilo-vscode/tests/unit/question-dock-utils.test.ts b/packages/kilo-vscode/tests/unit/question-dock-utils.test.ts index aa5781dea1..9b882d0395 100644 --- a/packages/kilo-vscode/tests/unit/question-dock-utils.test.ts +++ b/packages/kilo-vscode/tests/unit/question-dock-utils.test.ts @@ -105,6 +105,67 @@ describe("resolveSelectedQuestionMode", () => { }) }) +describe("plan follow-up Continue here option", () => { + it("resolves to code mode when option carries mode: code matching the Continue here label", () => { + const questions = [ + { + options: [ + { + label: "Start new session", + description: "Implement in a fresh session", + labelKey: "plan.followup.answer.newSession", + descriptionKey: "plan.followup.answer.newSession.description", + }, + { + label: "Continue here", + description: "Implement the plan in this session", + labelKey: "plan.followup.answer.continue", + descriptionKey: "plan.followup.answer.continue.description", + mode: "code", + }, + ], + }, + ] + expect(resolveSelectedQuestionMode(questions, [["Continue here"]])).toBe("code") + }) + + it("does not resolve a mode for Start new session (it carries no mode)", () => { + const questions = [ + { + options: [ + { + label: "Start new session", + description: "Implement in a fresh session", + labelKey: "plan.followup.answer.newSession", + descriptionKey: "plan.followup.answer.newSession.description", + }, + { + label: "Continue here", + description: "Implement the plan in this session", + labelKey: "plan.followup.answer.continue", + descriptionKey: "plan.followup.answer.continue.description", + mode: "code", + }, + ], + }, + ] + expect(resolveSelectedQuestionMode(questions, [["Start new session"]])).toBeUndefined() + }) + + it("resolves optimistic agent to code when Continue here is picked while in plan mode", () => { + const mode = resolveSelectedQuestionMode( + [ + { + options: [{ label: "Continue here", description: "Implement here", mode: "code" }], + }, + ], + [["Continue here"]], + ) + const result = resolveOptimisticQuestionAgent(undefined, "plan", mode) + expect(result).toEqual({ base: "plan", agent: "code" }) + }) +}) + describe("resolveOptimisticQuestionAgent", () => { it("stores the previous agent when applying an optimistic mode", () => { const result = resolveOptimisticQuestionAgent(undefined, "ask", "code") diff --git a/packages/opencode/src/kilocode/plan-followup.ts b/packages/opencode/src/kilocode/plan-followup.ts index 71b226a820..24f43c7417 100644 --- a/packages/opencode/src/kilocode/plan-followup.ts +++ b/packages/opencode/src/kilocode/plan-followup.ts @@ -297,6 +297,7 @@ export namespace PlanFollowup { labelKey: "plan.followup.answer.continue", description: "Implement the plan in this session", descriptionKey: "plan.followup.answer.continue.description", + mode: "code", }, ], }, diff --git a/packages/opencode/src/question/index.ts b/packages/opencode/src/question/index.ts index fe9271a5aa..a0d6a407af 100644 --- a/packages/opencode/src/question/index.ts +++ b/packages/opencode/src/question/index.ts @@ -29,6 +29,11 @@ export class Option extends Schema.Class