Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

settings.ts

982 lines41.5 KB

1import * as Effect from "effect/Effect";
2import * as Duration from "effect/Duration";
3import * as Schema from "effect/Schema";
4import * as SchemaTransformation from "effect/SchemaTransformation";
5import { TrimmedNonEmptyString, TrimmedString } from "./baseSchemas.ts";
6import { ThreadEnvMode } from "./environment.ts";
7import {
8 DEFAULT_TEXT_GENERATION_MODEL,
9 DEFAULT_TEXT_GENERATION_REASONING_EFFORT,
10 ProviderOptionSelections,
11} from "./model.ts";
12import { ModelSelection } from "./orchestration.ts";
13import {
14 DEFAULT_PREVIEW_APPEARANCE,
15 DEFAULT_PREVIEW_ZOOM_FACTOR,
16 FILL_PREVIEW_VIEWPORT,
17 PreviewAppearancePreference,
18 PreviewViewportSetting,
19 PreviewZoomFactor,
20} from "./preview.ts";
21import {
22 ProviderInstanceConfig,
23 ProviderInstanceId,
24 type ProviderDriverKind,
25} from "./providerInstance.ts";
26​
27// ── Client Settings (local-only) ───────────────────────────────
28​
29export const TimestampFormat = Schema.Literals(["locale", "12-hour", "24-hour"]);
30export type TimestampFormat = typeof TimestampFormat.Type;
31export const DEFAULT_TIMESTAMP_FORMAT: TimestampFormat = "locale";
32​
33export const SidebarProjectSortOrder = Schema.Literals(["updated_at", "created_at", "manual"]);
34export type SidebarProjectSortOrder = typeof SidebarProjectSortOrder.Type;
35export const DEFAULT_SIDEBAR_PROJECT_SORT_ORDER: SidebarProjectSortOrder = "updated_at";
36​
37export const SidebarThreadSortOrder = Schema.Literals(["updated_at", "created_at"]);
38export type SidebarThreadSortOrder = typeof SidebarThreadSortOrder.Type;
39export const DEFAULT_SIDEBAR_THREAD_SORT_ORDER: SidebarThreadSortOrder = "updated_at";
40​
41export const SidebarProjectGroupingMode = Schema.Literals([
42 "repository",
43 "repository_path",
44 "separate",
45]);
46export type SidebarProjectGroupingMode = typeof SidebarProjectGroupingMode.Type;
47export const DEFAULT_SIDEBAR_PROJECT_GROUPING_MODE: SidebarProjectGroupingMode = "repository";
48export const MIN_SIDEBAR_THREAD_PREVIEW_COUNT = 1;
49export const MAX_SIDEBAR_THREAD_PREVIEW_COUNT = 15;
50export const SidebarThreadPreviewCount = Schema.Int.check(
51 Schema.isBetween({
52 minimum: MIN_SIDEBAR_THREAD_PREVIEW_COUNT,
53 maximum: MAX_SIDEBAR_THREAD_PREVIEW_COUNT,
54 }),
55);
56export type SidebarThreadPreviewCount = typeof SidebarThreadPreviewCount.Type;
57export const DEFAULT_SIDEBAR_THREAD_PREVIEW_COUNT: SidebarThreadPreviewCount = 6;
58export const MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS = 1;
59export const MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS = 90;
60export const SidebarAutoSettleAfterDays = Schema.Number.check(
61 Schema.isBetween({
62 minimum: MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
63 maximum: MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
64 }),
65);
66export type SidebarAutoSettleAfterDays = typeof SidebarAutoSettleAfterDays.Type;
67export const DEFAULT_SIDEBAR_AUTO_SETTLE_AFTER_DAYS: SidebarAutoSettleAfterDays = 3;
68export const MIN_GLASS_OPACITY = 40;
69export const MAX_GLASS_OPACITY = 100;
70export const GlassOpacity = Schema.Int.check(
71 Schema.isBetween({
72 minimum: MIN_GLASS_OPACITY,
73 maximum: MAX_GLASS_OPACITY,
74 }),
75);
76export type GlassOpacity = typeof GlassOpacity.Type;
77export const DEFAULT_GLASS_OPACITY: GlassOpacity = 80;
78​
79export const MIN_APPEARANCE_CONTRAST = 50;
80export const MAX_APPEARANCE_CONTRAST = 200;
81export const AppearanceContrast = Schema.Int.check(
82 Schema.isBetween({ minimum: MIN_APPEARANCE_CONTRAST, maximum: MAX_APPEARANCE_CONTRAST }),
83);
84export type AppearanceContrast = typeof AppearanceContrast.Type;
85export const DEFAULT_APPEARANCE_CONTRAST: AppearanceContrast = 100;
86/**
87 * Font size preferences, in CSS pixels. The ranges are deliberately narrow:
88 * the interface size scales every rem-based dimension in the app, so the
89 * bounds keep layouts intact rather than offering unusable extremes.
90 */
91export const MIN_INTERFACE_FONT_SIZE = 12;
92export const MAX_INTERFACE_FONT_SIZE = 20;
93export const InterfaceFontSize = Schema.Int.check(
94 Schema.isBetween({ minimum: MIN_INTERFACE_FONT_SIZE, maximum: MAX_INTERFACE_FONT_SIZE }),
95);
96export type InterfaceFontSize = typeof InterfaceFontSize.Type;
97export const DEFAULT_INTERFACE_FONT_SIZE: InterfaceFontSize = 16;
98​
99export const MIN_PROMPT_FONT_SIZE = 12;
100export const MAX_PROMPT_FONT_SIZE = 20;
101export const PromptFontSize = Schema.Int.check(
102 Schema.isBetween({ minimum: MIN_PROMPT_FONT_SIZE, maximum: MAX_PROMPT_FONT_SIZE }),
103);
104export type PromptFontSize = typeof PromptFontSize.Type;
105export const DEFAULT_PROMPT_FONT_SIZE: PromptFontSize = 14;
106​
107export const MIN_CODE_FONT_SIZE = 10;
108export const MAX_CODE_FONT_SIZE = 18;
109export const CodeFontSize = Schema.Int.check(
110 Schema.isBetween({ minimum: MIN_CODE_FONT_SIZE, maximum: MAX_CODE_FONT_SIZE }),
111);
112export type CodeFontSize = typeof CodeFontSize.Type;
113export const DEFAULT_CODE_FONT_SIZE: CodeFontSize = 13;
114​
115export const MIN_TERMINAL_FONT_SIZE = 8;
116export const MAX_TERMINAL_FONT_SIZE = 20;
117export const TerminalFontSize = Schema.Int.check(
118 Schema.isBetween({ minimum: MIN_TERMINAL_FONT_SIZE, maximum: MAX_TERMINAL_FONT_SIZE }),
119);
120export type TerminalFontSize = typeof TerminalFontSize.Type;
121export const DEFAULT_TERMINAL_FONT_SIZE: TerminalFontSize = 12;
122​
123export const EnvironmentIdentificationMode = Schema.Literals(["artwork", "pill", "none"]);
124export type EnvironmentIdentificationMode = typeof EnvironmentIdentificationMode.Type;
125export const DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE: EnvironmentIdentificationMode = "artwork";
126​
127/**
128 * A user-chosen font family (a single name or a comma-separated list). Empty
129 * means "use the app default"; clients compose their own fallback stacks.
130 */
131export const FontFamilyPreference = Schema.String.check(Schema.isMaxLength(200));
132export type FontFamilyPreference = typeof FontFamilyPreference.Type;
133​
134/**
135 * The environment's theme, set with `t3 theme set <id>`. Each client applies
136 * it once per value — live when connected, on its next connect otherwise — so
137 * setting it switches every client, while a theme a user picks in Settings
138 * afterwards sticks until the next set. Empty means "no environment theme",
139 * which is also how it is cleared.
140 */
141export const DefaultThemePreference = Schema.String.check(Schema.isMaxLength(64));
142// Deliberately absent from ServerSettingsPatch: `t3 theme set` checks that an
143// id is syntactically valid and actually resolvable, and a generic RPC patch
144// would let a client write a theme no client can resolve, bypassing both.
145export type DefaultThemePreference = typeof DefaultThemePreference.Type;
146​
147/**
148 * Defaults for the in-app preview browser, applied whenever a tab is opened
149 * without an explicit viewport/zoom/appearance — by the user opening a browser
150 * tab, or by an agent calling `preview_open` with no size. Client-local
151 * because the Chromium guest they configure is desktop-local.
152 */
153export const DEFAULT_BROWSER_VIEWPORT: PreviewViewportSetting = FILL_PREVIEW_VIEWPORT;
154export const DEFAULT_BROWSER_AUTO_SHOW_FLOATING_PREVIEW = true;
155​
156export const ClientSettingsSchema = Schema.Struct({
157 appearanceContrast: AppearanceContrast.pipe(
158 Schema.withDecodingDefault(Effect.succeed(DEFAULT_APPEARANCE_CONTRAST)),
159 ),
160 browserDefaultViewport: PreviewViewportSetting.pipe(
161 Schema.withDecodingDefault(Effect.succeed(DEFAULT_BROWSER_VIEWPORT)),
162 ),
163 browserDefaultZoomFactor: PreviewZoomFactor.pipe(
164 Schema.withDecodingDefault(Effect.succeed(DEFAULT_PREVIEW_ZOOM_FACTOR)),
165 ),
166 browserDefaultAppearance: PreviewAppearancePreference.pipe(
167 Schema.withDecodingDefault(Effect.succeed(DEFAULT_PREVIEW_APPEARANCE)),
168 ),
169 /**
170 * Whether an agent opening a preview pops the floating mini player into
171 * view. Only applies when the agent didn't ask either way — an explicit
172 * `open`/`show` on `preview_open` still wins, since that is the agent
173 * deliberately showing or hiding its work.
174 */
175 browserAutoShowFloatingPreview: Schema.Boolean.pipe(
176 Schema.withDecodingDefault(Effect.succeed(DEFAULT_BROWSER_AUTO_SHOW_FLOATING_PREVIEW)),
177 ),
178 // Desktop-only: require holding the quit shortcut (Cmd/Ctrl+Q) before the
179 // app quits; a quick tap only shows a hint. Browser clients ignore it.
180 confirmQuit: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
181 confirmThreadArchive: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
182 confirmThreadDelete: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
183 confirmThreadUnpin: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
184 dismissedProviderUpdateNotificationKeys: Schema.Array(TrimmedNonEmptyString).pipe(
185 Schema.withDecodingDefault(Effect.succeed([])),
186 ),
187 diffIgnoreWhitespace: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
188 environmentIdentificationMode: EnvironmentIdentificationMode.pipe(
189 Schema.withDecodingDefault(Effect.succeed(DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE)),
190 ),
191 glassOpacity: GlassOpacity.pipe(
192 Schema.withDecodingDefault(Effect.succeed(DEFAULT_GLASS_OPACITY)),
193 ),
194 fontSizeInterface: InterfaceFontSize.pipe(
195 Schema.withDecodingDefault(Effect.succeed(DEFAULT_INTERFACE_FONT_SIZE)),
196 ),
197 fontSizePrompt: PromptFontSize.pipe(
198 Schema.withDecodingDefault(Effect.succeed(DEFAULT_PROMPT_FONT_SIZE)),
199 ),
200 fontSizeCode: CodeFontSize.pipe(
201 Schema.withDecodingDefault(Effect.succeed(DEFAULT_CODE_FONT_SIZE)),
202 ),
203 fontSizeTerminal: TerminalFontSize.pipe(
204 Schema.withDecodingDefault(Effect.succeed(DEFAULT_TERMINAL_FONT_SIZE)),
205 ),
206 fontFamilyCode: FontFamilyPreference.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
207 fontFamilyComposer: FontFamilyPreference.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
208 fontFamilySans: FontFamilyPreference.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
209 fontFamilyTerminal: FontFamilyPreference.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
210 // Grayscale `-webkit-font-smoothing: antialiased` (thinner strokes);
211 // disabling restores the platform's heavier default. No effect off macOS.
212 fontSmoothing: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
213 // Model favorites. Historically keyed by provider kind, now
214 // widened to `ProviderInstanceId` so users can favorite a specific model
215 // on a custom provider instance (e.g. "Codex Personal · gpt-5") without
216 // the UI collapsing it into the same bucket as the default Codex. The
217 // widening is backward-compatible by construction: prior provider-kind
218 // strings satisfy the `ProviderInstanceId` slug schema, so previously
219 // persisted favorites decode unchanged and continue to point at the
220 // default instance for their kind (because `defaultInstanceIdForDriver(kind)`
221 // uses the same slug). The field name is kept as `provider` for storage
222 // stability; new call sites should treat the value as an instance id.
223 favorites: Schema.Array(
224 Schema.Struct({
225 provider: ProviderInstanceId,
226 model: TrimmedNonEmptyString,
227 }),
228 ).pipe(Schema.withDecodingDefault(Effect.succeed([]))),
229 providerModelPreferences: Schema.Record(
230 ProviderInstanceId,
231 Schema.Struct({
232 hiddenModels: Schema.Array(Schema.String).pipe(
233 Schema.withDecodingDefault(Effect.succeed([])),
234 ),
235 modelOrder: Schema.Array(Schema.String).pipe(Schema.withDecodingDefault(Effect.succeed([]))),
236 }),
237 ).pipe(Schema.withDecodingDefault(Effect.succeed({}))),
238 // Legacy plan mode. The composer's Build/Plan toggle was removed from the
239 // default UI; this beta flag restores it (plus the /plan and /default slash
240 // commands) for users who still rely on the old workflow.
241 planModeEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
242 showSkillsInSlashMenu: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
243 // Legacy sidebar (the original per-project tree). Deliberately a fresh key
244 // (was `sidebarV2Enabled` + `sidebarV2ConfiguredByUser`): decoding drops the
245 // old keys, so everyone, including prior beta opt-outs, resets to the new
246 // default sidebar.
247 legacySidebarEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
248 sidebarAutoSettleAfterDays: Schema.NullOr(SidebarAutoSettleAfterDays).pipe(
249 Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_AUTO_SETTLE_AFTER_DAYS)),
250 ),
251 sidebarAutoSettleOnMerge: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
252 sidebarProjectGroupingMode: SidebarProjectGroupingMode.pipe(
253 Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_PROJECT_GROUPING_MODE)),
254 ),
255 sidebarProjectGroupingOverrides: Schema.Record(
256 TrimmedNonEmptyString,
257 SidebarProjectGroupingMode,
258 ).pipe(Schema.withDecodingDefault(Effect.succeed({}))),
259 sidebarProjectSortOrder: SidebarProjectSortOrder.pipe(
260 Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_PROJECT_SORT_ORDER)),
261 ),
262 sidebarThreadSortOrder: SidebarThreadSortOrder.pipe(
263 Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_SORT_ORDER)),
264 ),
265 sidebarThreadPreviewCount: SidebarThreadPreviewCount.pipe(
266 Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_PREVIEW_COUNT)),
267 ),
268 timestampFormat: TimestampFormat.pipe(
269 Schema.withDecodingDefault(Effect.succeed(DEFAULT_TIMESTAMP_FORMAT)),
270 ),
271 wordWrap: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
272});
273export type ClientSettings = typeof ClientSettingsSchema.Type;
274​
275export const DEFAULT_CLIENT_SETTINGS: ClientSettings = Schema.decodeSync(ClientSettingsSchema)({});
276​
277// ── Server Settings (server-authoritative) ────────────────────
278​
279// Moved to environment.ts so orchestration contracts can use it without an
280// import cycle; re-exported here for compatibility with deep imports.
281export { ThreadEnvMode } from "./environment.ts";
282​
283const makeBinaryPathSetting = (fallback: string) =>
284 TrimmedString.pipe(
285 Schema.decodeTo(
286 Schema.String,
287 SchemaTransformation.transformOrFail({
288 decode: (value) => Effect.succeed(value || fallback),
289 encode: (value) => Effect.succeed(value),
290 }),
291 ),
292 Schema.withDecodingDefault(Effect.succeed(fallback)),
293 );
294​
295export type ProviderSettingsFormControl = "text" | "password" | "textarea" | "switch";
296​
297export interface ProviderSettingsFormAnnotation {
298 readonly control?: ProviderSettingsFormControl | undefined;
299 readonly placeholder?: string | undefined;
300 readonly hidden?: boolean | undefined;
301 readonly clearWhenEmpty?: "omit" | "persist" | undefined;
303​
304export interface ProviderSettingsFormSchemaAnnotation {
305 readonly order?: readonly string[] | undefined;
307​
308declare module "effect/Schema" {
309 namespace Annotations {
310 interface Annotations {
311 readonly providerSettingsForm?: ProviderSettingsFormAnnotation | undefined;
312 readonly providerSettingsFormSchema?: ProviderSettingsFormSchemaAnnotation | undefined;
313 }
314 }
316​
317export type ProviderSettingsOrder<Fields extends Schema.Struct.Fields> = readonly Extract<
318 keyof Fields,
319 string
320>[];
321​
322export function makeProviderSettingsSchema<const Fields extends Schema.Struct.Fields>(
323 fields: Fields,
324 options?: {
325 readonly order?: ProviderSettingsOrder<Fields> | undefined;
326 },
327): Schema.Struct<Fields> {
328 return Schema.Struct(fields).pipe(
329 Schema.annotate({
330 providerSettingsFormSchema:
331 options?.order === undefined ? undefined : { order: options.order },
332 }),
333 );
335​
336export const CodexSettings = makeProviderSettingsSchema(
337 {
338 enabled: Schema.Boolean.pipe(
339 Schema.withDecodingDefault(Effect.succeed(true)),
340 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
341 ),
342 binaryPath: makeBinaryPathSetting("codex").pipe(
343 Schema.annotateKey({
344 title: "Binary path",
345 description: "Path to the Codex binary used by this instance.",
346 providerSettingsForm: { placeholder: "codex", clearWhenEmpty: "omit" },
347 }),
348 ),
349 homePath: TrimmedString.pipe(
350 Schema.withDecodingDefault(Effect.succeed("")),
351 Schema.annotateKey({
352 title: "CODEX_HOME path",
353 description: "Custom Codex home and config directory.",
354 providerSettingsForm: {
355 placeholder: "~/.codex",
356 clearWhenEmpty: "omit",
357 },
358 }),
359 ),
360 shadowHomePath: TrimmedString.pipe(
361 Schema.withDecodingDefault(Effect.succeed("")),
362 Schema.annotateKey({
363 title: "Shadow home path",
364 description:
365 "Account-specific Codex home. Keeps auth.json separate while sharing state from CODEX_HOME.",
366 providerSettingsForm: {
367 placeholder: "~/.codex-t3/personal",
368 clearWhenEmpty: "omit",
369 },
370 }),
371 ),
372 launchArgs: TrimmedString.pipe(
373 Schema.withDecodingDefault(Effect.succeed("")),
374 Schema.annotateKey({
375 title: "Launch arguments",
376 description: "Additional CLI arguments passed to codex app-server on session start.",
377 }),
378 ),
379 customModels: Schema.Array(Schema.String).pipe(
380 Schema.withDecodingDefault(Effect.succeed([])),
381 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
382 ),
383 },
384 {
385 order: ["binaryPath", "homePath", "shadowHomePath", "launchArgs"],
386 },
387);
388export type CodexSettings = typeof CodexSettings.Type;
389​
390// Empty, or an integer from 100,000 to 1,000,000. Shared by the full
391// Claude settings schema and its patch so an out-of-range value fails at
392// the update that introduced it.
393const CLAUDE_AUTO_COMPACT_WINDOW_PATTERN = /^(?:|[1-9]\d{5}|1000000)$/;
394​
395export const ClaudeSettings = makeProviderSettingsSchema(
396 {
397 enabled: Schema.Boolean.pipe(
398 Schema.withDecodingDefault(Effect.succeed(true)),
399 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
400 ),
401 binaryPath: makeBinaryPathSetting("claude").pipe(
402 Schema.annotateKey({
403 title: "Binary path",
404 description: "Path to the Claude binary used by this instance.",
405 providerSettingsForm: { placeholder: "claude", clearWhenEmpty: "omit" },
406 }),
407 ),
408 homePath: TrimmedString.pipe(
409 Schema.withDecodingDefault(Effect.succeed("")),
410 Schema.annotateKey({
411 title: "CLAUDE_CONFIG_DIR path",
412 description:
413 "Custom Claude home and config directory. Keeps .claude.json and .claude separate.",
414 providerSettingsForm: { placeholder: "~/.claude", clearWhenEmpty: "omit" },
415 }),
416 ),
417 customModels: Schema.Array(Schema.String).pipe(
418 Schema.withDecodingDefault(Effect.succeed([])),
419 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
420 ),
421 launchArgs: Schema.String.pipe(
422 Schema.withDecodingDefault(Effect.succeed("")),
423 Schema.annotateKey({
424 title: "Launch arguments",
425 description: "Additional CLI arguments passed on session start.",
426 providerSettingsForm: {
427 placeholder: "e.g. --chrome",
428 clearWhenEmpty: "omit",
429 },
430 }),
431 ),
432 autoCompactWindow: TrimmedString.check(
433 Schema.isPattern(CLAUDE_AUTO_COMPACT_WINDOW_PATTERN),
434 ).pipe(
435 Schema.withDecodingDefault(Effect.succeed("")),
436 Schema.annotateKey({
437 title: "Auto-compact after",
438 description:
439 "Compact after 100,000 to 1,000,000 tokens. Leave empty to use Claude's default.",
440 providerSettingsForm: {
441 placeholder: "e.g. 300000",
442 clearWhenEmpty: "omit",
443 },
444 }),
445 ),
446 },
447 {
448 order: ["binaryPath", "homePath", "autoCompactWindow", "launchArgs"],
449 },
450);
451export type ClaudeSettings = typeof ClaudeSettings.Type;
452​
453export const CursorSettings = makeProviderSettingsSchema(
454 {
455 // Off by default like Grok and OpenCode. Users opt in from Settings.
456 enabled: Schema.Boolean.pipe(
457 Schema.withDecodingDefault(Effect.succeed(false)),
458 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
459 ),
460 binaryPath: makeBinaryPathSetting("cursor-agent").pipe(
461 Schema.annotateKey({
462 title: "Binary path",
463 description: "Path to the Cursor agent binary.",
464 providerSettingsForm: { placeholder: "cursor-agent", clearWhenEmpty: "omit" },
465 }),
466 ),
467 apiEndpoint: TrimmedString.pipe(
468 Schema.withDecodingDefault(Effect.succeed("")),
469 Schema.annotateKey({
470 title: "API endpoint",
471 description: "Override the Cursor API endpoint for this instance.",
472 providerSettingsForm: {
473 placeholder: "https://...",
474 clearWhenEmpty: "omit",
475 },
476 }),
477 ),
478 customModels: Schema.Array(Schema.String).pipe(
479 Schema.withDecodingDefault(Effect.succeed([])),
480 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
481 ),
482 },
483 {
484 order: ["binaryPath", "apiEndpoint"],
485 },
486);
487export type CursorSettings = typeof CursorSettings.Type;
488​
489export const GrokSettings = makeProviderSettingsSchema(
490 {
491 // Off by default (like Cursor and OpenCode): the binding is not yet
492 // stable enough to probe on every install. Users opt in from Settings.
493 enabled: Schema.Boolean.pipe(
494 Schema.withDecodingDefault(Effect.succeed(false)),
495 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
496 ),
497 binaryPath: makeBinaryPathSetting("grok").pipe(
498 Schema.annotateKey({
499 title: "Binary path",
500 description: "Path to the Grok CLI binary.",
501 providerSettingsForm: { placeholder: "grok", clearWhenEmpty: "omit" },
502 }),
503 ),
504 customModels: Schema.Array(Schema.String).pipe(
505 Schema.withDecodingDefault(Effect.succeed([])),
506 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
507 ),
508 },
509 {
510 order: ["binaryPath"],
511 },
512);
513export type GrokSettings = typeof GrokSettings.Type;
514​
515export const OpenCodeSettings = makeProviderSettingsSchema(
516 {
517 // Off by default (like Cursor and Grok): the binding is not yet stable
518 // enough to probe on every install. Users opt in from Settings.
519 enabled: Schema.Boolean.pipe(
520 Schema.withDecodingDefault(Effect.succeed(false)),
521 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
522 ),
523 binaryPath: makeBinaryPathSetting("opencode").pipe(
524 Schema.annotateKey({
525 title: "Binary path",
526 description: "Path to the OpenCode binary.",
527 providerSettingsForm: {
528 placeholder: "opencode",
529 clearWhenEmpty: "omit",
530 },
531 }),
532 ),
533 serverUrl: TrimmedString.pipe(
534 Schema.withDecodingDefault(Effect.succeed("")),
535 Schema.annotateKey({
536 title: "Server URL",
537 description: "Leave blank to let T3 Code spawn the server when needed.",
538 providerSettingsForm: {
539 placeholder: "http://127.0.0.1:4096",
540 clearWhenEmpty: "omit",
541 },
542 }),
543 ),
544 serverPassword: TrimmedString.pipe(
545 Schema.withDecodingDefault(Effect.succeed("")),
546 Schema.annotateKey({
547 title: "Server password",
548 description: "Stored in plain text on disk.",
549 providerSettingsForm: {
550 control: "password",
551 placeholder: "Optional",
552 clearWhenEmpty: "omit",
553 },
554 }),
555 ),
556 customModels: Schema.Array(Schema.String).pipe(
557 Schema.withDecodingDefault(Effect.succeed([])),
558 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
559 ),
560 },
561 {
562 order: ["binaryPath", "serverUrl", "serverPassword"],
563 },
564);
565export type OpenCodeSettings = typeof OpenCodeSettings.Type;
566​
567export const ObservabilitySettings = Schema.Struct({
568 otlpTracesUrl: TrimmedString.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
569 otlpMetricsUrl: TrimmedString.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
570});
571export type ObservabilitySettings = typeof ObservabilitySettings.Type;
572​
573export const SourceControlWritingStyleMode = Schema.Literals([
574 "repo_conventions",
575 "conventional_commits",
576 "custom",
577]);
578export type SourceControlWritingStyleMode = typeof SourceControlWritingStyleMode.Type;
579​
580export const SourceControlWritingStyleSettings = Schema.Struct({
581 mode: SourceControlWritingStyleMode.pipe(
582 Schema.withDecodingDefault(Effect.succeed("repo_conventions" as const)),
583 ),
584 customInstructions: TrimmedString.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
585 followChangeRequestTemplates: Schema.Boolean.pipe(
586 Schema.withDecodingDefault(Effect.succeed(true)),
587 ),
588});
589export type SourceControlWritingStyleSettings = typeof SourceControlWritingStyleSettings.Type;
590​
591export const DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL = Duration.seconds(30);
592export const DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL = Duration.minutes(5);
593​
594export const BackgroundActivityProfile = Schema.Literals([
595 "balanced",
596 "performance",
597 "battery-saver",
598]);
599export type BackgroundActivityProfile = typeof BackgroundActivityProfile.Type;
600export const DEFAULT_BACKGROUND_ACTIVITY_PROFILE: BackgroundActivityProfile = "balanced";
601​
602export const BackgroundActivityProfileSelection = Schema.Literals([
603 "balanced",
604 "performance",
605 "battery-saver",
606 "custom",
607]);
608export type BackgroundActivityProfileSelection = typeof BackgroundActivityProfileSelection.Type;
609​
610export const BackgroundActivityOverrides = Schema.Struct({
611 automaticGitFetchInterval: Schema.optionalKey(Schema.DurationFromMillis),
612 providerHealthRefreshInterval: Schema.optionalKey(Schema.DurationFromMillis),
613 hostPowerMonitorActiveInterval: Schema.optionalKey(Schema.DurationFromMillis),
614 hostPowerMonitorIdleInterval: Schema.optionalKey(Schema.DurationFromMillis),
615 idleClientTtl: Schema.optionalKey(Schema.DurationFromMillis),
616 pauseWhenHostLocked: Schema.optionalKey(Schema.Boolean),
617 pauseWhenHostLowPower: Schema.optionalKey(Schema.Boolean),
618 pauseWhenClientLowPower: Schema.optionalKey(Schema.Boolean),
619 pauseWhenOnBattery: Schema.optionalKey(Schema.Boolean),
620});
621export type BackgroundActivityOverrides = typeof BackgroundActivityOverrides.Type;
622​
623export const BackgroundActivitySettings = Schema.Struct({
624 schemaVersion: Schema.Literal(1).pipe(Schema.withDecodingDefault(Effect.succeed(1 as const))),
625 profile: BackgroundActivityProfileSelection.pipe(
626 Schema.withDecodingDefault(Effect.succeed(DEFAULT_BACKGROUND_ACTIVITY_PROFILE)),
627 ),
628 baseProfile: Schema.optionalKey(BackgroundActivityProfile),
629 overrides: BackgroundActivityOverrides.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
630}).pipe(Schema.withDecodingDefault(Effect.succeed({})));
631export type BackgroundActivitySettings = typeof BackgroundActivitySettings.Type;
632​
633export const ServerSettings = Schema.Struct({
634 // Legacy token-by-token assistant output. Deliberately a fresh key (was
635 // `enableAssistantStreaming`): decoding drops the old key, so everyone,
636 // including prior opt-ins, resets to the buffered default.
637 enableLegacyTokenStreaming: Schema.Boolean.pipe(
638 Schema.withDecodingDefault(Effect.succeed(false)),
639 ),
640 enableProviderUpdateChecks: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
641 /**
642 * Whether agents may drive the in-app preview browser. Turning this off
643 * withholds the MCP credential, so the `t3-code` server (and with it every
644 * `preview_*` tool) is never attached to a provider session, and the prompt
645 * text describing those tools is dropped along with them. The user's own
646 * browser panel is unaffected — this gates agent access only.
647 *
648 * Server-authoritative rather than client-local: tool injection and prompt
649 * construction both happen on the server, and the answer must not differ
650 * between a desktop window and a phone attached to the same server.
651 */
652 enableAgentBrowserAccess: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
653 backgroundActivity: BackgroundActivitySettings,
654 // Legacy flat fields retained for old settings files and old clients. New
655 // consumers should resolve `backgroundActivity` instead.
656 automaticGitFetchInterval: Schema.DurationFromMillis.pipe(
657 Schema.withDecodingDefault(
658 Effect.succeed(Duration.toMillis(DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL)),
659 ),
660 ),
661 providerHealthRefreshInterval: Schema.DurationFromMillis.pipe(
662 Schema.withDecodingDefault(
663 Effect.succeed(Duration.toMillis(DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL)),
664 ),
665 ),
666 backgroundActivityProfile: BackgroundActivityProfile.pipe(
667 Schema.withDecodingDefault(Effect.succeed(DEFAULT_BACKGROUND_ACTIVITY_PROFILE)),
668 ),
669 defaultTheme: DefaultThemePreference.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
670 /**
671 * When the environment's theme was last set, so clients can tell a re-set
672 * of the same value from one they already applied: `t3 theme set` must act
673 * even when it names the theme it named before. Empty on environments
674 * provisioned by builds that predate it, where clients fall back to
675 * applying once per value.
676 */
677 defaultThemeSetAt: Schema.String.check(Schema.isMaxLength(64)).pipe(
678 Schema.withDecodingDefault(Effect.succeed("")),
679 ),
680 defaultThreadEnvMode: ThreadEnvMode.pipe(
681 Schema.withDecodingDefault(Effect.succeed("local" as const satisfies ThreadEnvMode)),
682 ),
683 newWorktreesStartFromOrigin: Schema.Boolean.pipe(
684 Schema.withDecodingDefault(Effect.succeed(true)),
685 ),
686 addProjectBaseDirectory: TrimmedString.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
687 textGenerationModelSelection: ModelSelection.pipe(
688 Schema.withDecodingDefault(
689 Effect.succeed({
690 instanceId: ProviderInstanceId.make("codex"),
691 model: DEFAULT_TEXT_GENERATION_MODEL,
692 options: [
693 {
694 id: "reasoningEffort",
695 value: DEFAULT_TEXT_GENERATION_REASONING_EFFORT,
696 },
697 ],
698 }),
699 ),
700 ),
701 sourceControlWritingStyle: SourceControlWritingStyleSettings.pipe(
702 Schema.withDecodingDefault(Effect.succeed({})),
703 ),
704 sourceControlWriterModelSelection: Schema.NullOr(ModelSelection).pipe(
705 Schema.withDecodingDefault(Effect.succeed(null)),
706 ),
707​
708 // Legacy single-instance-per-driver settings. Continues to be the source
709 // of truth until `providerInstances` (below) lands per-driver migration
710 // shims and the server starts hydrating instances from it. Driver-specific
711 // schemas live here for the duration of the migration; once each driver
712 // owns its config in its own package, this struct shrinks to nothing and
713 // is removed entirely.
714 providers: Schema.Struct({
715 codex: CodexSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
716 claudeAgent: ClaudeSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
717 cursor: CursorSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
718 grok: GrokSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
719 opencode: OpenCodeSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
720 }).pipe(Schema.withDecodingDefault(Effect.succeed({}))),
721 // New driver-agnostic instance map. Keyed by `ProviderInstanceId`; values
722 // are `ProviderInstanceConfig` envelopes. The driver-specific config blob
723 // is `Schema.Unknown` at this layer so envelopes with unknown drivers
724 // (forks, downgrades, in-flight PR branches) round-trip without loss.
725 // See providerInstance.ts for the forward/backward compatibility invariant.
726 providerInstances: Schema.Record(ProviderInstanceId, ProviderInstanceConfig).pipe(
727 Schema.withDecodingDefault(Effect.succeed({})),
728 ),
729 observability: ObservabilitySettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
730});
731export type ServerSettings = typeof ServerSettings.Type;
732​
733export const DEFAULT_SERVER_SETTINGS: ServerSettings = Schema.decodeSync(ServerSettings)({});
734​
735/**
736 * Read the legacy `enabled` flag embedded in a provider instance config
737 * blob. The envelope-level `ProviderInstanceConfig.enabled` is the single
738 * flag going forward; this reader exists for legacy `providers.<kind>`
739 * blobs and old settings files that still carry the flag in-config.
740 */
741export const providerInstanceConfigEnabledFlag = (config: unknown): boolean | undefined => {
742 if (config === null || typeof config !== "object" || Array.isArray(config)) {
743 return undefined;
744 }
745 const enabled = (config as { readonly enabled?: unknown }).enabled;
746 return typeof enabled === "boolean" ? enabled : undefined;
747};
748​
749/**
750 * Default enabled state for a built-in driver when neither the envelope nor
751 * the config blob carries a flag. Derived from the driver's settings schema
752 * through `DEFAULT_SERVER_SETTINGS`, so the schema's decoding default stays
753 * the single source of truth. Unknown (fork) drivers default to enabled.
754 */
755export const defaultEnabledForDriver = (driver: ProviderDriverKind): boolean => {
756 const legacyDefaults = DEFAULT_SERVER_SETTINGS.providers as Record<
757 string,
758 { readonly enabled?: boolean } | undefined
759 >;
760 return legacyDefaults[driver]?.enabled ?? true;
761};
762​
763/**
764 * Resolve whether a configured provider instance is enabled. An explicit
765 * false on either the envelope or the in-config flag wins (most
766 * restrictive), so a user's disable is never silently undone by the other
767 * flag. Otherwise: envelope, then config, then the driver's default.
768 */
769export const resolveProviderInstanceEnabled = (
770 instance: Pick<ProviderInstanceConfig, "driver" | "enabled" | "config">,
771): boolean => {
772 const configEnabled = providerInstanceConfigEnabledFlag(instance.config);
773 if (instance.enabled === false || configEnabled === false) {
774 return false;
775 }
776 return instance.enabled ?? configEnabled ?? defaultEnabledForDriver(instance.driver);
777};
778​
779export const ServerSettingsOperation = Schema.Literals([
780 "normalize",
781 "check-exists",
782 "read-file",
783 "read-provider-history",
784 "read-secret",
785 "remove-secret",
786 "remove-stale-secret",
787 "write-secret",
788 "write-file",
789 "prepare-directory",
790]);
791export type ServerSettingsOperation = typeof ServerSettingsOperation.Type;
792​
793export class ServerSettingsError extends Schema.TaggedErrorClass<ServerSettingsError>()(
794 "ServerSettingsError",
795 {
796 settingsPath: Schema.String,
797 operation: ServerSettingsOperation,
798 providerInstanceId: Schema.optional(Schema.String),
799 environmentVariable: Schema.optional(Schema.String),
800 cause: Schema.Defect(),
801 },
802) {
803 override get message(): string {
804 const provider =
805 this.providerInstanceId === undefined ? "" : ` for provider ${this.providerInstanceId}`;
806 const variable =
807 this.environmentVariable === undefined
808 ? ""
809 : ` and environment variable ${this.environmentVariable}`;
810 return `Server settings ${this.operation} failed${provider}${variable} at ${this.settingsPath}.`;
811 }
813​
814// ── Unified type ─────────────────────────────────────────────────────
815​
816export type UnifiedSettings = ServerSettings & ClientSettings;
817export const DEFAULT_UNIFIED_SETTINGS: UnifiedSettings = {
818 ...DEFAULT_SERVER_SETTINGS,
819 ...DEFAULT_CLIENT_SETTINGS,
820};
821​
822// ── Server Settings Patch (replace with a Schema.deepPartial if available) ──────────────────────────────────────────
823​
824const ModelSelectionPatch = Schema.Struct({
825 instanceId: Schema.optionalKey(ProviderInstanceId),
826 model: Schema.optionalKey(TrimmedNonEmptyString),
827 options: Schema.optionalKey(ProviderOptionSelections),
828});
829​
830const CodexSettingsPatch = Schema.Struct({
831 enabled: Schema.optionalKey(Schema.Boolean),
832 binaryPath: Schema.optionalKey(TrimmedString),
833 homePath: Schema.optionalKey(TrimmedString),
834 shadowHomePath: Schema.optionalKey(TrimmedString),
835 launchArgs: Schema.optionalKey(TrimmedString),
836 customModels: Schema.optionalKey(Schema.Array(Schema.String)),
837});
838​
839const ClaudeSettingsPatch = Schema.Struct({
840 enabled: Schema.optionalKey(Schema.Boolean),
841 binaryPath: Schema.optionalKey(TrimmedString),
842 homePath: Schema.optionalKey(TrimmedString),
843 customModels: Schema.optionalKey(Schema.Array(Schema.String)),
844 launchArgs: Schema.optionalKey(TrimmedString),
845 // Validated at the patch boundary so a typo fails the one update with a
846 // schema error instead of a generic whole-settings failure.
847 autoCompactWindow: Schema.optionalKey(
848 TrimmedString.check(Schema.isPattern(CLAUDE_AUTO_COMPACT_WINDOW_PATTERN)),
849 ),
850});
851​
852const CursorSettingsPatch = Schema.Struct({
853 enabled: Schema.optionalKey(Schema.Boolean),
854 binaryPath: Schema.optionalKey(TrimmedString),
855 apiEndpoint: Schema.optionalKey(TrimmedString),
856 customModels: Schema.optionalKey(Schema.Array(Schema.String)),
857});
858​
859const GrokSettingsPatch = Schema.Struct({
860 enabled: Schema.optionalKey(Schema.Boolean),
861 binaryPath: Schema.optionalKey(TrimmedString),
862 customModels: Schema.optionalKey(Schema.Array(Schema.String)),
863});
864​
865const OpenCodeSettingsPatch = Schema.Struct({
866 enabled: Schema.optionalKey(Schema.Boolean),
867 binaryPath: Schema.optionalKey(TrimmedString),
868 serverUrl: Schema.optionalKey(TrimmedString),
869 serverPassword: Schema.optionalKey(TrimmedString),
870 customModels: Schema.optionalKey(Schema.Array(Schema.String)),
871});
872​
873export const ServerSettingsPatch = Schema.Struct({
874 // Server settings
875 enableLegacyTokenStreaming: Schema.optionalKey(Schema.Boolean),
876 enableProviderUpdateChecks: Schema.optionalKey(Schema.Boolean),
877 enableAgentBrowserAccess: Schema.optionalKey(Schema.Boolean),
878 backgroundActivity: Schema.optionalKey(
879 Schema.Struct({
880 schemaVersion: Schema.optionalKey(Schema.Literal(1)),
881 profile: Schema.optionalKey(BackgroundActivityProfileSelection),
882 baseProfile: Schema.optionalKey(BackgroundActivityProfile),
883 overrides: Schema.optionalKey(BackgroundActivityOverrides),
884 }),
885 ),
886 automaticGitFetchInterval: Schema.optionalKey(Schema.DurationFromMillis),
887 providerHealthRefreshInterval: Schema.optionalKey(Schema.DurationFromMillis),
888 backgroundActivityProfile: Schema.optionalKey(BackgroundActivityProfile),
889 defaultThreadEnvMode: Schema.optionalKey(ThreadEnvMode),
890 newWorktreesStartFromOrigin: Schema.optionalKey(Schema.Boolean),
891 addProjectBaseDirectory: Schema.optionalKey(TrimmedString),
892 textGenerationModelSelection: Schema.optionalKey(ModelSelectionPatch),
893 sourceControlWritingStyle: Schema.optionalKey(
894 Schema.Struct({
895 mode: Schema.optionalKey(SourceControlWritingStyleMode),
896 customInstructions: Schema.optionalKey(TrimmedString),
897 followChangeRequestTemplates: Schema.optionalKey(Schema.Boolean),
898 }),
899 ),
900 sourceControlWriterModelSelection: Schema.optionalKey(Schema.NullOr(ModelSelection)),
901 observability: Schema.optionalKey(
902 Schema.Struct({
903 otlpTracesUrl: Schema.optionalKey(TrimmedString),
904 otlpMetricsUrl: Schema.optionalKey(TrimmedString),
905 }),
906 ),
907 providers: Schema.optionalKey(
908 Schema.Struct({
909 codex: Schema.optionalKey(CodexSettingsPatch),
910 claudeAgent: Schema.optionalKey(ClaudeSettingsPatch),
911 cursor: Schema.optionalKey(CursorSettingsPatch),
912 grok: Schema.optionalKey(GrokSettingsPatch),
913 opencode: Schema.optionalKey(OpenCodeSettingsPatch),
914 }),
915 ),
916 // Whole-map replacement for the new instance config. Patching individual
917 // entries is intentionally out of scope: the map is small, and partial
918 // patches risk leaving driver-specific config in a half-merged state.
919 // The web UI sends a fully-formed map every time it edits this field.
920 providerInstances: Schema.optionalKey(Schema.Record(ProviderInstanceId, ProviderInstanceConfig)),
921});
922export type ServerSettingsPatch = typeof ServerSettingsPatch.Type;
923​
924export const ClientSettingsPatch = Schema.Struct({
925 appearanceContrast: Schema.optionalKey(AppearanceContrast),
926 browserDefaultViewport: Schema.optionalKey(PreviewViewportSetting),
927 browserDefaultZoomFactor: Schema.optionalKey(PreviewZoomFactor),
928 browserDefaultAppearance: Schema.optionalKey(PreviewAppearancePreference),
929 browserAutoShowFloatingPreview: Schema.optionalKey(Schema.Boolean),
930 confirmQuit: Schema.optionalKey(Schema.Boolean),
931 confirmThreadArchive: Schema.optionalKey(Schema.Boolean),
932 confirmThreadDelete: Schema.optionalKey(Schema.Boolean),
933 confirmThreadUnpin: Schema.optionalKey(Schema.Boolean),
934 diffIgnoreWhitespace: Schema.optionalKey(Schema.Boolean),
935 environmentIdentificationMode: Schema.optionalKey(EnvironmentIdentificationMode),
936 glassOpacity: Schema.optionalKey(GlassOpacity),
937 fontSizeInterface: Schema.optionalKey(InterfaceFontSize),
938 fontSizePrompt: Schema.optionalKey(PromptFontSize),
939 fontSizeCode: Schema.optionalKey(CodeFontSize),
940 fontSizeTerminal: Schema.optionalKey(TerminalFontSize),
941 fontFamilyCode: Schema.optionalKey(FontFamilyPreference),
942 fontFamilyComposer: Schema.optionalKey(FontFamilyPreference),
943 fontFamilySans: Schema.optionalKey(FontFamilyPreference),
944 fontFamilyTerminal: Schema.optionalKey(FontFamilyPreference),
945 fontSmoothing: Schema.optionalKey(Schema.Boolean),
946 favorites: Schema.optionalKey(
947 Schema.Array(
948 Schema.Struct({
949 provider: ProviderInstanceId,
950 model: TrimmedNonEmptyString,
951 }),
952 ),
953 ),
954 providerModelPreferences: Schema.optionalKey(
955 Schema.Record(
956 ProviderInstanceId,
957 Schema.Struct({
958 hiddenModels: Schema.Array(Schema.String).pipe(
959 Schema.withDecodingDefault(Effect.succeed([])),
960 ),
961 modelOrder: Schema.Array(Schema.String).pipe(
962 Schema.withDecodingDefault(Effect.succeed([])),
963 ),
964 }),
965 ),
966 ),
967 planModeEnabled: Schema.optionalKey(Schema.Boolean),
968 showSkillsInSlashMenu: Schema.optionalKey(Schema.Boolean),
969 legacySidebarEnabled: Schema.optionalKey(Schema.Boolean),
970 sidebarAutoSettleAfterDays: Schema.optionalKey(Schema.NullOr(SidebarAutoSettleAfterDays)),
971 sidebarAutoSettleOnMerge: Schema.optionalKey(Schema.Boolean),
972 sidebarProjectGroupingMode: Schema.optionalKey(SidebarProjectGroupingMode),
973 sidebarProjectGroupingOverrides: Schema.optionalKey(
974 Schema.Record(TrimmedNonEmptyString, SidebarProjectGroupingMode),
975 ),
976 sidebarProjectSortOrder: Schema.optionalKey(SidebarProjectSortOrder),
977 sidebarThreadSortOrder: Schema.optionalKey(SidebarThreadSortOrder),
978 sidebarThreadPreviewCount: Schema.optionalKey(SidebarThreadPreviewCount),
979 timestampFormat: Schema.optionalKey(TimestampFormat),
980 wordWrap: Schema.optionalKey(Schema.Boolean),
981});
982export type ClientSettingsPatch = typeof ClientSettingsPatch.Type;