Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
Fix plan follow-up mode switching and submission text
Julius Marminge010ba70561cf
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsxindex 94d10ee5b..63def5864 100644--- a/apps/web/src/components/ChatView.tsx+++ b/apps/web/src/components/ChatView.tsx@@ -92,6 +92,7 @@ import {buildPlanImplementationPrompt,buildProposedPlanMarkdownFilename,proposedPlanTitle,+ resolvePlanFollowUpSubmission,} from "../proposedPlan";import { truncateTitle } from "../truncateTitle";import {@@ -2318,19 +2319,18 @@ export default function ChatView({ threadId }: ChatViewProps) {}const trimmed = prompt.trim();if (showPlanFollowUpPrompt && activeProposedPlan) {- const followUpText =- trimmed.length > 0- ? trimmed- : buildPlanImplementationPrompt(activeProposedPlan.planMarkdown);- const nextInteractionMode = trimmed.length > 0 ? "plan" : "default";+ const followUp = resolvePlanFollowUpSubmission({+ draftText: trimmed,+ planMarkdown: activeProposedPlan.planMarkdown,+ });promptRef.current = "";clearComposerDraftContent(activeThread.id);setComposerHighlightedItemId(null);setComposerCursor(0);setComposerTrigger(null);await onSubmitPlanFollowUp({- text: followUpText,- interactionMode: nextInteractionMode,+ text: followUp.text,+ interactionMode: followUp.interactionMode,});return;}@@ -2795,6 +2795,10 @@ export default function ChatView({ threadId }: ChatViewProps) {interactionMode: nextInteractionMode,});+ // Keep the mode toggle and plan-follow-up banner in sync immediately+ // while the same-thread implementation turn is starting.+ setComposerDraftInteractionMode(threadIdForSend, nextInteractionMode);+await api.orchestration.dispatchCommand({type: "thread.turn.start",commandId: newCommandId(),@@ -2840,6 +2844,7 @@ export default function ChatView({ threadId }: ChatViewProps) {selectedModel,selectedModelOptionsForDispatch,selectedProvider,+ setComposerDraftInteractionMode,setThreadError,settings.enableAssistantStreaming,],diff --git a/apps/web/src/proposedPlan.test.ts b/apps/web/src/proposedPlan.test.tsindex 02e4e78ae..b8431bdbc 100644--- a/apps/web/src/proposedPlan.test.ts+++ b/apps/web/src/proposedPlan.test.ts@@ -5,6 +5,7 @@ import {buildPlanImplementationPrompt,buildProposedPlanMarkdownFilename,proposedPlanTitle,+ resolvePlanFollowUpSubmission,} from "./proposedPlan";describe("proposedPlanTitle", () => {@@ -25,6 +26,32 @@ describe("buildPlanImplementationPrompt", () => {});});+describe("resolvePlanFollowUpSubmission", () => {+ it("switches to default mode when implementing the ready plan without extra text", () => {+ expect(+ resolvePlanFollowUpSubmission({+ draftText: " ",+ planMarkdown: "## Ship it\n\n- step 1\n",+ }),+ ).toEqual({+ text: "PLEASE IMPLEMENT THIS PLAN:\n## Ship it\n\n- step 1",+ interactionMode: "default",+ });+ });++ it("stays in plan mode when the user adds a follow-up prompt", () => {+ expect(+ resolvePlanFollowUpSubmission({+ draftText: "Refine step 2 first",+ planMarkdown: "## Ship it\n\n- step 1\n",+ }),+ ).toEqual({+ text: "Refine step 2 first",+ interactionMode: "plan",+ });+ });+});+describe("buildPlanImplementationThreadTitle", () => {it("uses the plan heading when building the implementation thread title", () => {expect(buildPlanImplementationThreadTitle("# Integrate RPC\n\nBody")).toBe(diff --git a/apps/web/src/proposedPlan.ts b/apps/web/src/proposedPlan.tsindex fdfe85972..1550eb7de 100644--- a/apps/web/src/proposedPlan.ts+++ b/apps/web/src/proposedPlan.ts@@ -16,6 +16,27 @@ export function buildPlanImplementationPrompt(planMarkdown: string): string {return `PLEASE IMPLEMENT THIS PLAN:\n${planMarkdown.trim()}`;}+export function resolvePlanFollowUpSubmission(input: {+ draftText: string;+ planMarkdown: string;+}): {+ text: string;+ interactionMode: "default" | "plan";+} {+ const trimmedDraftText = input.draftText.trim();+ if (trimmedDraftText.length > 0) {+ return {+ text: trimmedDraftText,+ interactionMode: "plan",+ };+ }++ return {+ text: buildPlanImplementationPrompt(input.planMarkdown),+ interactionMode: "default",+ };+}+export function buildPlanImplementationThreadTitle(planMarkdown: string): string {const title = proposedPlanTitle(planMarkdown);if (!title) {