@devries-cameron20 / t3code Mirror · read-only / commits / a19f01fc19
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 12:45 UTC

feat(web): make context window indicator opt-in (#9190)

Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>

maria committed Sep 2, 2026 at 03:55 UTC a19f01fc19d209d9962c4bb66372ed9e03e320a9
6 files changed +45 -1
apps/desktop/src/settings/DesktopClientSettings.test.ts
+1
@@ -23,6 +23,7 @@ const clientSettings: ClientSettings = {
23 confirmThreadArchive: true,
24 confirmThreadDelete: false,
25 confirmThreadUnpin: false,
26 + contextWindowMeterEnabled: false,
27 dismissedProviderUpdateNotificationKeys: [],
28 diffIgnoreWhitespace: true,
29 environmentIdentificationMode: "artwork",
apps/web/src/components/chat/ChatComposer.tsx
+3 -1
@@ -4339,7 +4339,9 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
4339 ) : null}
4340 <ComposerFooterPrimaryActions
4341 compact={isComposerPrimaryActionsCompact}
4342 - activeContextWindow={activeContextWindow}
4342 + activeContextWindow={
4343 + settings.contextWindowMeterEnabled ? activeContextWindow : null
4344 + }
4345 activeThreadModelDisplayName={activeThreadModelDisplayName}
4346 pendingAction={pendingPrimaryAction}
4347 isRunning={phase === "running"}
apps/web/src/components/settings/SettingsPanels.tsx
+19
@@ -522,6 +522,9 @@ export function useSettingsRestore(onRestored?: () => void) {
522 ...(settings.showSkillsInSlashMenu !== DEFAULT_UNIFIED_SETTINGS.showSkillsInSlashMenu
523 ? ["Show skills in slash menu"]
524 : []),
525 + ...(settings.contextWindowMeterEnabled !== DEFAULT_UNIFIED_SETTINGS.contextWindowMeterEnabled
526 + ? ["Context window indicator"]
527 + : []),
528 ...(settings.enableLegacyTokenStreaming !==
529 DEFAULT_UNIFIED_SETTINGS.enableLegacyTokenStreaming
530 ? ["Stream token by token"]
@@ -576,6 +579,7 @@ export function useSettingsRestore(onRestored?: () => void) {
579 settings.newWorktreesStartFromOrigin,
580 settings.diffIgnoreWhitespace,
581 settings.environmentIdentificationMode,
582 + settings.contextWindowMeterEnabled,
583 settings.fontFamilyCode,
584 settings.fontFamilyComposer,
585 settings.fontFamilySans,
@@ -668,6 +672,7 @@ export function useSettingsRestore(onRestored?: () => void) {
672 wordWrap: DEFAULT_UNIFIED_SETTINGS.wordWrap,
673 diffIgnoreWhitespace: DEFAULT_UNIFIED_SETTINGS.diffIgnoreWhitespace,
674 showSkillsInSlashMenu: DEFAULT_UNIFIED_SETTINGS.showSkillsInSlashMenu,
675 + contextWindowMeterEnabled: DEFAULT_UNIFIED_SETTINGS.contextWindowMeterEnabled,
676 environmentIdentificationMode: DEFAULT_UNIFIED_SETTINGS.environmentIdentificationMode,
677 glassOpacity: DEFAULT_UNIFIED_SETTINGS.glassOpacity,
678 sidebarThreadPreviewCount: DEFAULT_UNIFIED_SETTINGS.sidebarThreadPreviewCount,
@@ -1750,6 +1755,7 @@ function AutoSettleDaysInput({
1755 // expand the section before its target can mount and scroll.
1756 const LEGACY_FEATURE_TARGET_IDS: ReadonlySet<string> = new Set([
1757 "legacy-plan-mode",
1758 + "legacy-context-window-indicator",
1759 "legacy-token-streaming",
1760 "legacy-sidebar",
1761 ]);
@@ -1826,6 +1832,19 @@ function LegacyFeaturesSection() {
1832 />
1833 }
1834 />
1835 + <SettingsRow
1836 + {...searchableSetting("legacy-context-window-indicator")}
1837 + description="Shows context window usage as a circular indicator in the composer."
1838 + control={
1839 + <Switch
1840 + checked={settings.contextWindowMeterEnabled}
1841 + onCheckedChange={(checked) =>
1842 + updateSettings({ contextWindowMeterEnabled: Boolean(checked) })
1843 + }
1844 + aria-label="Context window indicator (legacy)"
1845 + />
1846 + }
1847 + />
1848 <SettingsRow
1849 serverScoped
1850 {...searchableSetting("legacy-token-streaming")}
apps/web/src/components/settings/settingsSearch.ts
+6
@@ -261,6 +261,12 @@ export const SETTINGS_SEARCH_ITEMS = [
261 to: "/settings/general",
262 searchTerms: ["build plan composer old"],
263 },
264 + {
265 + id: "legacy-context-window-indicator",
266 + title: "Context window indicator (legacy)",
267 + to: "/settings/general",
268 + searchTerms: ["composer meter usage tokens circle old"],
269 + },
270 {
271 id: "legacy-token-streaming",
272 title: "Stream token by token (legacy)",
packages/contracts/src/settings.test.ts
+12
@@ -191,6 +191,18 @@ describe("ClientSettings sidebar", () => {
191 });
192 });
193
194 +describe("ClientSettings context window meter", () => {
195 + it("defaults off and preserves an explicit legacy opt-in", () => {
196 + expect(decodeClientSettings({}).contextWindowMeterEnabled).toBe(false);
197 + expect(
198 + decodeClientSettings({ contextWindowMeterEnabled: true }).contextWindowMeterEnabled,
199 + ).toBe(true);
200 + expect(
201 + decodeClientSettingsPatch({ contextWindowMeterEnabled: true }).contextWindowMeterEnabled,
202 + ).toBe(true);
203 + });
204 +});
205 +
206 describe("ServerSettings thread settlement", () => {
207 it("defaults merge settlement on and inactivity settlement to three days", () => {
208 const settings = decodeServerSettings({});
packages/contracts/src/settings.ts
+4
@@ -265,6 +265,9 @@ export const ClientSettingsSchema = Schema.Struct({
265 // default UI; this beta flag restores it (plus the /plan and /default slash
266 // commands) for users who still rely on the old workflow.
267 planModeEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
268 + // Legacy context window meter. The composer hides it by default; users who
269 + // still want the old usage indicator can restore it from Settings.
270 + contextWindowMeterEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
271 showSkillsInSlashMenu: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
272 // Legacy sidebar (the original per-project tree). Deliberately a fresh key
273 // (was `sidebarV2Enabled` + `sidebarV2ConfiguredByUser`): decoding drops the
@@ -990,6 +993,7 @@ export const ClientSettingsPatch = Schema.Struct({
993 ),
994 ),
995 planModeEnabled: Schema.optionalKey(Schema.Boolean),
996 + contextWindowMeterEnabled: Schema.optionalKey(Schema.Boolean),
997 showSkillsInSlashMenu: Schema.optionalKey(Schema.Boolean),
998 legacySidebarEnabled: Schema.optionalKey(Schema.Boolean),
999 sidebarProjectGroupingMode: Schema.optionalKey(SidebarProjectGroupingMode),