feat(web): remove Build/Plan toggle from the composer (#5551)
Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
a8cd2ad2eb
commit
48aa875c0e
6 files changed
+66
-22
No files matched your search
@@ -29,6 +29,7 @@ const clientSettings: ClientSettings = {
|
||||
fontSizeTerminal: 12,
|
||||
fontSmoothing: true,
|
||||
glassOpacity: 80,
|
||||
planModeEnabled: false,
|
||||
providerModelPreferences: {},
|
||||
sidebarAutoSettleAfterDays: 3,
|
||||
sidebarProjectGroupingMode: "repository_path",
|
||||
|
||||
@@ -1481,8 +1481,13 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
? (localServerError ?? activeServerThread?.session?.lastError ?? null)
|
||||
: localDraftError;
|
||||
const runtimeMode = composerRuntimeMode ?? activeThread?.runtimeMode ?? DEFAULT_RUNTIME_MODE;
|
||||
const interactionMode =
|
||||
composerInteractionMode ?? activeThread?.interactionMode ?? DEFAULT_INTERACTION_MODE;
|
||||
// Plan mode is legacy (Settings → Beta). With the flag off the effective
|
||||
// mode is forced to "default" — even for threads with a stored plan mode —
|
||||
// so nobody is trapped in plan mode while its toggle is hidden. The next
|
||||
// send persists "default" back to the thread.
|
||||
const interactionMode = settings.planModeEnabled
|
||||
? (composerInteractionMode ?? activeThread?.interactionMode ?? DEFAULT_INTERACTION_MODE)
|
||||
: DEFAULT_INTERACTION_MODE;
|
||||
const isLocalDraftThread = !isServerThread && localDraftThread !== undefined;
|
||||
const canCheckoutPullRequestIntoThread = isLocalDraftThread;
|
||||
const activeThreadId = activeThread?.id ?? null;
|
||||
@@ -4811,7 +4816,10 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
});
|
||||
return;
|
||||
}
|
||||
// Legacy plan mode: /plan and /default only act when the beta flag is on;
|
||||
// otherwise they send as plain text like any other message.
|
||||
const standaloneSlashCommand =
|
||||
settings.planModeEnabled &&
|
||||
composerImages.length === 0 &&
|
||||
sendableComposerTerminalContexts.length === 0 &&
|
||||
composerElementContexts.length === 0 &&
|
||||
|
||||
@@ -875,14 +875,16 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
|
||||
|
||||
const selectedPromptEffort = composerProviderState.promptEffort;
|
||||
const selectedModelOptionsForDispatch = composerProviderState.modelOptionsForDispatch;
|
||||
// Plan mode is a legacy feature behind Settings → Beta. With the flag off,
|
||||
// ChatView forces the effective mode to "default", so hiding the toggle
|
||||
// can't trap anyone in plan mode.
|
||||
const planModeUiEnabled = settings.planModeEnabled;
|
||||
const composerProviderControls = useMemo(
|
||||
() => ({
|
||||
showInteractionModeToggle: getProviderInteractionModeToggle(
|
||||
providerStatuses,
|
||||
selectedProvider,
|
||||
),
|
||||
showInteractionModeToggle:
|
||||
planModeUiEnabled && getProviderInteractionModeToggle(providerStatuses, selectedProvider),
|
||||
}),
|
||||
[providerStatuses, selectedProvider],
|
||||
[planModeUiEnabled, providerStatuses, selectedProvider],
|
||||
);
|
||||
const selectedModelSelection = useMemo<ModelSelection>(
|
||||
() => createModelSelection(selectedInstanceId, selectedModel, selectedModelOptionsForDispatch),
|
||||
@@ -1043,20 +1045,24 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
|
||||
label: "/model",
|
||||
description: "Switch response model for this thread",
|
||||
},
|
||||
{
|
||||
id: "slash:plan",
|
||||
type: "slash-command",
|
||||
command: "plan",
|
||||
label: "/plan",
|
||||
description: "Switch this thread into plan mode",
|
||||
},
|
||||
{
|
||||
id: "slash:default",
|
||||
type: "slash-command",
|
||||
command: "default",
|
||||
label: "/default",
|
||||
description: "Switch this thread back to normal build mode",
|
||||
},
|
||||
...(planModeUiEnabled
|
||||
? ([
|
||||
{
|
||||
id: "slash:plan",
|
||||
type: "slash-command",
|
||||
command: "plan",
|
||||
label: "/plan",
|
||||
description: "Switch this thread into plan mode",
|
||||
},
|
||||
{
|
||||
id: "slash:default",
|
||||
type: "slash-command",
|
||||
command: "default",
|
||||
label: "/default",
|
||||
description: "Switch this thread back to normal build mode",
|
||||
},
|
||||
] as const)
|
||||
: []),
|
||||
] satisfies ReadonlyArray<Extract<ComposerCommandItem, { type: "slash-command" }>>;
|
||||
const providerSlashCommandItems = (selectedProviderStatus?.slashCommands ?? []).map(
|
||||
(command) => ({
|
||||
@@ -1091,7 +1097,13 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
|
||||
);
|
||||
}
|
||||
return [];
|
||||
}, [composerTrigger, selectedProvider, selectedProviderStatus, workspaceEntries.entries]);
|
||||
}, [
|
||||
composerTrigger,
|
||||
planModeUiEnabled,
|
||||
selectedProvider,
|
||||
selectedProviderStatus,
|
||||
workspaceEntries.entries,
|
||||
]);
|
||||
|
||||
const composerMenuOpen = Boolean(composerTrigger);
|
||||
const composerMenuSearchKey = composerTrigger
|
||||
@@ -1857,6 +1869,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
|
||||
event: KeyboardEvent,
|
||||
) => {
|
||||
if (key === "Tab" && event.shiftKey) {
|
||||
if (!planModeUiEnabled) return false;
|
||||
toggleInteractionMode();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ export function BetaSettingsPanel() {
|
||||
const sidebarAutoSettleAfterDays = useClientSettings(
|
||||
(settings) => settings.sidebarAutoSettleAfterDays,
|
||||
);
|
||||
const planModeEnabled = useClientSettings((settings) => settings.planModeEnabled);
|
||||
const updateSettings = useUpdateClientSettings();
|
||||
|
||||
return (
|
||||
@@ -114,6 +115,17 @@ export function BetaSettingsPanel() {
|
||||
) : null}
|
||||
</>
|
||||
) : null}
|
||||
<SettingsRow
|
||||
{...searchableSetting("restore-plan-mode")}
|
||||
description="Legacy feature. Brings back the Build/Plan toggle in the composer along with the /plan and /default commands and the Shift+Tab shortcut. While off, every thread runs in build mode."
|
||||
control={
|
||||
<Switch
|
||||
checked={planModeEnabled}
|
||||
onCheckedChange={(checked) => updateSettings({ planModeEnabled: Boolean(checked) })}
|
||||
aria-label="Restore plan mode (legacy)"
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</SettingsSection>
|
||||
</SettingsPageContainer>
|
||||
);
|
||||
|
||||
@@ -177,6 +177,11 @@ export const SETTINGS_SEARCH_ITEMS = [
|
||||
to: "/settings/beta",
|
||||
targetId: "sidebar-v2",
|
||||
},
|
||||
{
|
||||
id: "restore-plan-mode",
|
||||
title: "Restore plan mode (legacy)",
|
||||
to: "/settings/beta",
|
||||
},
|
||||
{
|
||||
id: "archive",
|
||||
title: "Archived threads",
|
||||
|
||||
@@ -167,6 +167,10 @@ export const ClientSettingsSchema = Schema.Struct({
|
||||
modelOrder: Schema.Array(Schema.String).pipe(Schema.withDecodingDefault(Effect.succeed([]))),
|
||||
}),
|
||||
).pipe(Schema.withDecodingDefault(Effect.succeed({}))),
|
||||
// Legacy plan mode. The composer's Build/Plan toggle was removed from the
|
||||
// default UI; this beta flag restores it (plus the /plan and /default slash
|
||||
// commands) for users who still rely on the old workflow.
|
||||
planModeEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
|
||||
sidebarAutoSettleAfterDays: Schema.NullOr(SidebarAutoSettleAfterDays).pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_AUTO_SETTLE_AFTER_DAYS)),
|
||||
),
|
||||
@@ -781,6 +785,7 @@ export const ClientSettingsPatch = Schema.Struct({
|
||||
}),
|
||||
),
|
||||
),
|
||||
planModeEnabled: Schema.optionalKey(Schema.Boolean),
|
||||
sidebarAutoSettleAfterDays: Schema.optionalKey(Schema.NullOr(SidebarAutoSettleAfterDays)),
|
||||
sidebarProjectGroupingMode: Schema.optionalKey(SidebarProjectGroupingMode),
|
||||
sidebarProjectGroupingOverrides: Schema.optionalKey(
|
||||
|
||||
Reference in new issue
Block a user