Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/desktop/src/settings/DesktopClientSettings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const clientSettings: ClientSettings = {
confirmThreadArchive: true,
confirmThreadDelete: false,
confirmThreadUnpin: false,
contextWindowMeterEnabled: false,
contextWindowMeterEnabled: true,
composerCollapseOnScroll: true,
dismissedProviderUpdateNotificationKeys: [],
diffFilesCollapsed: true,
Expand Down
43 changes: 28 additions & 15 deletions apps/web/src/components/settings/SettingsPanels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,9 @@ export function useSettingsRestore(onRestored?: () => void) {
diffLayout: DEFAULT_UNIFIED_SETTINGS.diffLayout,
proactivePanelsEnabled: DEFAULT_UNIFIED_SETTINGS.proactivePanelsEnabled,
showSkillsInSlashMenu: DEFAULT_UNIFIED_SETTINGS.showSkillsInSlashMenu,
contextWindowMeterEnabled: DEFAULT_UNIFIED_SETTINGS.contextWindowMeterEnabled,
composerCollapseOnScroll: DEFAULT_UNIFIED_SETTINGS.composerCollapseOnScroll,
followUpBehavior: DEFAULT_UNIFIED_SETTINGS.followUpBehavior,
contextWindowMeterEnabled: DEFAULT_UNIFIED_SETTINGS.contextWindowMeterEnabled,
environmentIdentificationMode: DEFAULT_UNIFIED_SETTINGS.environmentIdentificationMode,
glassOpacity: DEFAULT_UNIFIED_SETTINGS.glassOpacity,
panelAnimationDurationMs: DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs,
Expand Down Expand Up @@ -1997,7 +1997,6 @@ function AutoSettleDaysInput({
// expand the section before its target can mount and scroll.
const LEGACY_FEATURE_TARGET_IDS: ReadonlySet<string> = new Set([
"legacy-plan-mode",
"legacy-context-window-indicator",
"legacy-sidebar",
]);

Expand Down Expand Up @@ -2052,19 +2051,6 @@ function LegacyFeaturesSection() {
/>
}
/>
<SettingsRow
{...searchableSetting("legacy-context-window-indicator")}
description="Shows context window usage as a circular indicator in the composer."
control={
<Switch
checked={settings.contextWindowMeterEnabled}
onCheckedChange={(checked) =>
updateSettings({ contextWindowMeterEnabled: Boolean(checked) })
}
aria-label="Context window indicator (legacy)"
/>
}
/>
<SettingsRow
{...searchableSetting("legacy-sidebar")}
description="Restore per-project thread trees instead of the default flat sidebar."
Expand Down Expand Up @@ -2567,6 +2553,33 @@ export function GeneralSettingsPanel() {
}
/>

<SettingsRow
{...searchableSetting("context-window-indicator")}
description="Show context window usage as a circular indicator in the composer."
resetAction={
settings.contextWindowMeterEnabled !==
DEFAULT_UNIFIED_SETTINGS.contextWindowMeterEnabled ? (
<SettingResetButton
label="context window indicator"
onClick={() =>
updateSettings({
contextWindowMeterEnabled: DEFAULT_UNIFIED_SETTINGS.contextWindowMeterEnabled,
})
}
/>
) : null
}
control={
<Switch
checked={settings.contextWindowMeterEnabled}
onCheckedChange={(checked) =>
updateSettings({ contextWindowMeterEnabled: Boolean(checked) })
}
aria-label="Context window indicator"
/>
}
/>

<SettingsRow
{...searchableSetting("composer-collapse")}
description="Rest the composer of an existing thread into a single line when you scroll the conversation. Focus the composer or start typing to expand it again."
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/settingsSearch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ describe("settings search targets", () => {
const streaming = getSettingsSearchTargetScope("response-streaming")!;
expect(streaming.scope).toBe("project-defaults");
expect(isSettingsSearchScopeAvailable(streaming.scope, "project")).toBe(true);
for (const id of ["legacy-plan-mode", "legacy-context-window-indicator", "legacy-sidebar"]) {
for (const id of ["legacy-plan-mode", "legacy-sidebar"]) {
expect(getSettingsSearchTargetScope(id)!.scope).toBeNull();
}
});
Expand Down
12 changes: 6 additions & 6 deletions apps/web/src/components/settings/settingsSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ export const SETTINGS_SEARCH_ITEMS = [
to: "/settings/general",
searchTerms: ["command menu dollar $ slash /"],
},
{
id: "context-window-indicator",
title: "Context window indicator",
to: "/settings/general",
searchTerms: ["composer meter usage tokens circle percent"],
},
{
id: "composer-collapse",
title: "Collapse composer on scroll",
Expand Down Expand Up @@ -399,12 +405,6 @@ export const SETTINGS_SEARCH_ITEMS = [
to: "/settings/general",
searchTerms: ["build plan composer old"],
},
{
id: "legacy-context-window-indicator",
title: "Context window indicator (legacy)",
to: "/settings/general",
searchTerms: ["composer meter usage tokens circle old"],
},
{
id: "legacy-sidebar",
title: "Sidebar (legacy)",
Expand Down
12 changes: 6 additions & 6 deletions packages/contracts/src/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,14 +518,14 @@ describe("ClientSettings sidebar", () => {
});

describe("ClientSettings context window meter", () => {
it("defaults off and preserves an explicit legacy opt-in", () => {
expect(decodeClientSettings({}).contextWindowMeterEnabled).toBe(false);
it("defaults on and preserves an explicit opt-out", () => {
expect(decodeClientSettings({}).contextWindowMeterEnabled).toBe(true);
expect(
decodeClientSettings({ contextWindowMeterEnabled: true }).contextWindowMeterEnabled,
).toBe(true);
decodeClientSettings({ contextWindowMeterEnabled: false }).contextWindowMeterEnabled,
).toBe(false);
expect(
decodeClientSettingsPatch({ contextWindowMeterEnabled: true }).contextWindowMeterEnabled,
).toBe(true);
decodeClientSettingsPatch({ contextWindowMeterEnabled: false }).contextWindowMeterEnabled,
).toBe(false);
});
});

Expand Down
6 changes: 3 additions & 3 deletions packages/contracts/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,9 @@ export const ClientSettingsSchema = Schema.Struct({
// 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))),
// Legacy context window meter. The composer hides it by default; users who
// still want the old usage indicator can restore it from Settings.
contextWindowMeterEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
// Context window meter in the composer footer. On by default; users who
// prefer a cleaner composer can switch it off from Settings → General.
contextWindowMeterEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
// Desktop resting composer: scrolling an existing thread's conversation
// settles the composer into its single-line layout. Losing focus never does.
composerCollapseOnScroll: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
Expand Down
Loading