Open History to see the last commit
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 { DEFAULT_GIT_TEXT_GENERATION_MODEL, ProviderOptionSelections } from "./model.ts";
7import { ModelSelection } from "./orchestration.ts";
8import { ProviderInstanceConfig, ProviderInstanceId } from "./providerInstance.ts";
9
10// ── Client Settings (local-only) ───────────────────────────────
11
12export const TimestampFormat = Schema.Literals(["locale", "12-hour", "24-hour"]);
13export type TimestampFormat = typeof TimestampFormat.Type;
14export const DEFAULT_TIMESTAMP_FORMAT: TimestampFormat = "locale";
15
16export const SidebarProjectSortOrder = Schema.Literals(["updated_at", "created_at", "manual"]);
17export type SidebarProjectSortOrder = typeof SidebarProjectSortOrder.Type;
18export const DEFAULT_SIDEBAR_PROJECT_SORT_ORDER: SidebarProjectSortOrder = "updated_at";
19
20export const SidebarThreadSortOrder = Schema.Literals(["updated_at", "created_at"]);
21export type SidebarThreadSortOrder = typeof SidebarThreadSortOrder.Type;
22export const DEFAULT_SIDEBAR_THREAD_SORT_ORDER: SidebarThreadSortOrder = "updated_at";
23
24export const SidebarProjectGroupingMode = Schema.Literals([
25 "repository",
26 "repository_path",
27 "separate",
28]);
29export type SidebarProjectGroupingMode = typeof SidebarProjectGroupingMode.Type;
30export const DEFAULT_SIDEBAR_PROJECT_GROUPING_MODE: SidebarProjectGroupingMode = "repository";
31export const MIN_SIDEBAR_THREAD_PREVIEW_COUNT = 1;
32export const MAX_SIDEBAR_THREAD_PREVIEW_COUNT = 15;
33export const SidebarThreadPreviewCount = Schema.Int.check(
34 Schema.isBetween({
35 minimum: MIN_SIDEBAR_THREAD_PREVIEW_COUNT,
36 maximum: MAX_SIDEBAR_THREAD_PREVIEW_COUNT,
37 }),
38);
39export type SidebarThreadPreviewCount = typeof SidebarThreadPreviewCount.Type;
40export const DEFAULT_SIDEBAR_THREAD_PREVIEW_COUNT: SidebarThreadPreviewCount = 6;
41
42export const ClientSettingsSchema = Schema.Struct({
43 autoOpenPlanSidebar: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
44 confirmThreadArchive: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
45 confirmThreadDelete: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
46 dismissedProviderUpdateNotificationKeys: Schema.Array(TrimmedNonEmptyString).pipe(
47 Schema.withDecodingDefault(Effect.succeed([])),
48 ),
49 diffIgnoreWhitespace: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
50 // Model favorites. Historically keyed by provider kind, now
51 // widened to `ProviderInstanceId` so users can favorite a specific model
52 // on a custom provider instance (e.g. "Codex Personal · gpt-5") without
53 // the UI collapsing it into the same bucket as the default Codex. The
54 // widening is backward-compatible by construction: prior provider-kind
55 // strings satisfy the `ProviderInstanceId` slug schema, so previously
56 // persisted favorites decode unchanged and continue to point at the
57 // default instance for their kind (because `defaultInstanceIdForDriver(kind)`
58 // uses the same slug). The field name is kept as `provider` for storage
59 // stability; new call sites should treat the value as an instance id.
60 favorites: Schema.Array(
61 Schema.Struct({
62 provider: ProviderInstanceId,
63 model: TrimmedNonEmptyString,
64 }),
65 ).pipe(Schema.withDecodingDefault(Effect.succeed([]))),
66 providerModelPreferences: Schema.Record(
67 ProviderInstanceId,
68 Schema.Struct({
69 hiddenModels: Schema.Array(Schema.String).pipe(
70 Schema.withDecodingDefault(Effect.succeed([])),
71 ),
72 modelOrder: Schema.Array(Schema.String).pipe(Schema.withDecodingDefault(Effect.succeed([]))),
73 }),
74 ).pipe(Schema.withDecodingDefault(Effect.succeed({}))),
75 sidebarProjectGroupingMode: SidebarProjectGroupingMode.pipe(
76 Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_PROJECT_GROUPING_MODE)),
77 ),
78 sidebarProjectGroupingOverrides: Schema.Record(
79 TrimmedNonEmptyString,
80 SidebarProjectGroupingMode,
81 ).pipe(Schema.withDecodingDefault(Effect.succeed({}))),
82 sidebarProjectSortOrder: SidebarProjectSortOrder.pipe(
83 Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_PROJECT_SORT_ORDER)),
84 ),
85 sidebarThreadSortOrder: SidebarThreadSortOrder.pipe(
86 Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_SORT_ORDER)),
87 ),
88 sidebarThreadPreviewCount: SidebarThreadPreviewCount.pipe(
89 Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_PREVIEW_COUNT)),
90 ),
91 timestampFormat: TimestampFormat.pipe(
92 Schema.withDecodingDefault(Effect.succeed(DEFAULT_TIMESTAMP_FORMAT)),
93 ),
94 wordWrap: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
95});
96export type ClientSettings = typeof ClientSettingsSchema.Type;
97
98export const DEFAULT_CLIENT_SETTINGS: ClientSettings = Schema.decodeSync(ClientSettingsSchema)({});
99
100// ── Server Settings (server-authoritative) ────────────────────
101
102export const ThreadEnvMode = Schema.Literals(["local", "worktree"]);
103export type ThreadEnvMode = typeof ThreadEnvMode.Type;
104
105const makeBinaryPathSetting = (fallback: string) =>
106 TrimmedString.pipe(
107 Schema.decodeTo(
108 Schema.String,
109 SchemaTransformation.transformOrFail({
110 decode: (value) => Effect.succeed(value || fallback),
111 encode: (value) => Effect.succeed(value),
112 }),
113 ),
114 Schema.withDecodingDefault(Effect.succeed(fallback)),
115 );
116
117export type ProviderSettingsFormControl = "text" | "password" | "textarea" | "switch";
118
119export interface ProviderSettingsFormAnnotation {
120 readonly control?: ProviderSettingsFormControl | undefined;
121 readonly placeholder?: string | undefined;
122 readonly hidden?: boolean | undefined;
123 readonly clearWhenEmpty?: "omit" | "persist" | undefined;
124}
125
126export interface ProviderSettingsFormSchemaAnnotation {
127 readonly order?: readonly string[] | undefined;
128}
129
130declare module "effect/Schema" {
131 namespace Annotations {
132 interface Annotations {
133 readonly providerSettingsForm?: ProviderSettingsFormAnnotation | undefined;
134 readonly providerSettingsFormSchema?: ProviderSettingsFormSchemaAnnotation | undefined;
135 }
136 }
137}
138
139export type ProviderSettingsOrder<Fields extends Schema.Struct.Fields> = readonly Extract<
140 keyof Fields,
141 string
142>[];
143
144export function makeProviderSettingsSchema<const Fields extends Schema.Struct.Fields>(
145 fields: Fields,
146 options?: {
147 readonly order?: ProviderSettingsOrder<Fields> | undefined;
148 },
149): Schema.Struct<Fields> {
150 return Schema.Struct(fields).pipe(
151 Schema.annotate({
152 providerSettingsFormSchema:
153 options?.order === undefined ? undefined : { order: options.order },
154 }),
155 );
156}
157
158export const CodexSettings = makeProviderSettingsSchema(
159 {
160 enabled: Schema.Boolean.pipe(
161 Schema.withDecodingDefault(Effect.succeed(true)),
162 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
163 ),
164 binaryPath: makeBinaryPathSetting("codex").pipe(
165 Schema.annotateKey({
166 title: "Binary path",
167 description: "Path to the Codex binary used by this instance.",
168 providerSettingsForm: { placeholder: "codex", clearWhenEmpty: "omit" },
169 }),
170 ),
171 homePath: TrimmedString.pipe(
172 Schema.withDecodingDefault(Effect.succeed("")),
173 Schema.annotateKey({
174 title: "CODEX_HOME path",
175 description: "Custom Codex home and config directory.",
176 providerSettingsForm: {
177 placeholder: "~/.codex",
178 clearWhenEmpty: "omit",
179 },
180 }),
181 ),
182 shadowHomePath: TrimmedString.pipe(
183 Schema.withDecodingDefault(Effect.succeed("")),
184 Schema.annotateKey({
185 title: "Shadow home path",
186 description:
187 "Account-specific Codex home. Keeps auth.json separate while sharing state from CODEX_HOME.",
188 providerSettingsForm: {
189 placeholder: "~/.codex-t3/personal",
190 clearWhenEmpty: "omit",
191 },
192 }),
193 ),
194 customModels: Schema.Array(Schema.String).pipe(
195 Schema.withDecodingDefault(Effect.succeed([])),
196 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
197 ),
198 },
199 {
200 order: ["binaryPath", "homePath", "shadowHomePath"],
201 },
202);
203export type CodexSettings = typeof CodexSettings.Type;
204
205export const ClaudeSettings = makeProviderSettingsSchema(
206 {
207 enabled: Schema.Boolean.pipe(
208 Schema.withDecodingDefault(Effect.succeed(true)),
209 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
210 ),
211 binaryPath: makeBinaryPathSetting("claude").pipe(
212 Schema.annotateKey({
213 title: "Binary path",
214 description: "Path to the Claude binary used by this instance.",
215 providerSettingsForm: { placeholder: "claude", clearWhenEmpty: "omit" },
216 }),
217 ),
218 homePath: TrimmedString.pipe(
219 Schema.withDecodingDefault(Effect.succeed("")),
220 Schema.annotateKey({
221 title: "Claude HOME path",
222 description:
223 "Custom HOME used when running this Claude instance. Keeps .claude.json and .claude separate.",
224 providerSettingsForm: { placeholder: "~", clearWhenEmpty: "omit" },
225 }),
226 ),
227 customModels: Schema.Array(Schema.String).pipe(
228 Schema.withDecodingDefault(Effect.succeed([])),
229 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
230 ),
231 launchArgs: Schema.String.pipe(
232 Schema.withDecodingDefault(Effect.succeed("")),
233 Schema.annotateKey({
234 title: "Launch arguments",
235 description: "Additional CLI arguments passed on session start.",
236 providerSettingsForm: {
237 placeholder: "e.g. --chrome",
238 clearWhenEmpty: "omit",
239 },
240 }),
241 ),
242 },
243 {
244 order: ["binaryPath", "homePath", "launchArgs"],
245 },
246);
247export type ClaudeSettings = typeof ClaudeSettings.Type;
248
249export const CursorSettings = makeProviderSettingsSchema(
250 {
251 enabled: Schema.Boolean.pipe(
252 Schema.withDecodingDefault(Effect.succeed(false)),
253 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
254 ),
255 binaryPath: makeBinaryPathSetting("agent").pipe(
256 Schema.annotateKey({
257 title: "Binary path",
258 description: "Path to the Cursor agent binary.",
259 providerSettingsForm: { placeholder: "agent", clearWhenEmpty: "omit" },
260 }),
261 ),
262 apiEndpoint: TrimmedString.pipe(
263 Schema.withDecodingDefault(Effect.succeed("")),
264 Schema.annotateKey({
265 title: "API endpoint",
266 description: "Override the Cursor API endpoint for this instance.",
267 providerSettingsForm: {
268 placeholder: "https://...",
269 clearWhenEmpty: "omit",
270 },
271 }),
272 ),
273 customModels: Schema.Array(Schema.String).pipe(
274 Schema.withDecodingDefault(Effect.succeed([])),
275 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
276 ),
277 },
278 {
279 order: ["binaryPath", "apiEndpoint"],
280 },
281);
282export type CursorSettings = typeof CursorSettings.Type;
283
284export const GrokSettings = makeProviderSettingsSchema(
285 {
286 enabled: Schema.Boolean.pipe(
287 Schema.withDecodingDefault(Effect.succeed(true)),
288 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
289 ),
290 binaryPath: makeBinaryPathSetting("grok").pipe(
291 Schema.annotateKey({
292 title: "Binary path",
293 description: "Path to the Grok CLI binary.",
294 providerSettingsForm: { placeholder: "grok", clearWhenEmpty: "omit" },
295 }),
296 ),
297 customModels: Schema.Array(Schema.String).pipe(
298 Schema.withDecodingDefault(Effect.succeed([])),
299 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
300 ),
301 },
302 {
303 order: ["binaryPath"],
304 },
305);
306export type GrokSettings = typeof GrokSettings.Type;
307
308export const OpenCodeSettings = makeProviderSettingsSchema(
309 {
310 enabled: Schema.Boolean.pipe(
311 Schema.withDecodingDefault(Effect.succeed(true)),
312 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
313 ),
314 binaryPath: makeBinaryPathSetting("opencode").pipe(
315 Schema.annotateKey({
316 title: "Binary path",
317 description: "Path to the OpenCode binary.",
318 providerSettingsForm: {
319 placeholder: "opencode",
320 clearWhenEmpty: "omit",
321 },
322 }),
323 ),
324 serverUrl: TrimmedString.pipe(
325 Schema.withDecodingDefault(Effect.succeed("")),
326 Schema.annotateKey({
327 title: "Server URL",
328 description: "Leave blank to let T3 Code spawn the server when needed.",
329 providerSettingsForm: {
330 placeholder: "http://127.0.0.1:4096",
331 clearWhenEmpty: "omit",
332 },
333 }),
334 ),
335 serverPassword: TrimmedString.pipe(
336 Schema.withDecodingDefault(Effect.succeed("")),
337 Schema.annotateKey({
338 title: "Server password",
339 description: "Stored in plain text on disk.",
340 providerSettingsForm: {
341 control: "password",
342 placeholder: "Optional",
343 clearWhenEmpty: "omit",
344 },
345 }),
346 ),
347 customModels: Schema.Array(Schema.String).pipe(
348 Schema.withDecodingDefault(Effect.succeed([])),
349 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
350 ),
351 },
352 {
353 order: ["binaryPath", "serverUrl", "serverPassword"],
354 },
355);
356export type OpenCodeSettings = typeof OpenCodeSettings.Type;
357
358export const ObservabilitySettings = Schema.Struct({
359 otlpTracesUrl: TrimmedString.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
360 otlpMetricsUrl: TrimmedString.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
361});
362export type ObservabilitySettings = typeof ObservabilitySettings.Type;
363
364export const DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL = Duration.seconds(30);
365
366export const ServerSettings = Schema.Struct({
367 enableAssistantStreaming: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
368 enableProviderUpdateChecks: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
369 automaticGitFetchInterval: Schema.DurationFromMillis.pipe(
370 Schema.withDecodingDefault(
371 Effect.succeed(Duration.toMillis(DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL)),
372 ),
373 ),
374 defaultThreadEnvMode: ThreadEnvMode.pipe(
375 Schema.withDecodingDefault(Effect.succeed("local" as const satisfies ThreadEnvMode)),
376 ),
377 newWorktreesStartFromOrigin: Schema.Boolean.pipe(
378 Schema.withDecodingDefault(Effect.succeed(false)),
379 ),
380 addProjectBaseDirectory: TrimmedString.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
381 textGenerationModelSelection: ModelSelection.pipe(
382 Schema.withDecodingDefault(
383 Effect.succeed({
384 instanceId: ProviderInstanceId.make("codex"),
385 model: DEFAULT_GIT_TEXT_GENERATION_MODEL,
386 }),
387 ),
388 ),
389
390 // Legacy single-instance-per-driver settings. Continues to be the source
391 // of truth until `providerInstances` (below) lands per-driver migration
392 // shims and the server starts hydrating instances from it. Driver-specific
393 // schemas live here for the duration of the migration; once each driver
394 // owns its config in its own package, this struct shrinks to nothing and
395 // is removed entirely.
396 providers: Schema.Struct({
397 codex: CodexSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
398 claudeAgent: ClaudeSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
399 cursor: CursorSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
400 grok: GrokSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
401 opencode: OpenCodeSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
402 }).pipe(Schema.withDecodingDefault(Effect.succeed({}))),
403 // New driver-agnostic instance map. Keyed by `ProviderInstanceId`; values
404 // are `ProviderInstanceConfig` envelopes. The driver-specific config blob
405 // is `Schema.Unknown` at this layer so envelopes with unknown drivers
406 // (forks, downgrades, in-flight PR branches) round-trip without loss.
407 // See providerInstance.ts for the forward/backward compatibility invariant.
408 providerInstances: Schema.Record(ProviderInstanceId, ProviderInstanceConfig).pipe(
409 Schema.withDecodingDefault(Effect.succeed({})),
410 ),
411 observability: ObservabilitySettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
412});
413export type ServerSettings = typeof ServerSettings.Type;
414
415export const DEFAULT_SERVER_SETTINGS: ServerSettings = Schema.decodeSync(ServerSettings)({});
416
417export const ServerSettingsOperation = Schema.Literals([
418 "normalize",
419 "check-exists",
420 "read-file",
421 "read-secret",
422 "remove-secret",
423 "remove-stale-secret",
424 "write-secret",
425 "write-file",
426 "prepare-directory",
427]);
428export type ServerSettingsOperation = typeof ServerSettingsOperation.Type;
429
430export class ServerSettingsError extends Schema.TaggedErrorClass<ServerSettingsError>()(
431 "ServerSettingsError",
432 {
433 settingsPath: Schema.String,
434 operation: ServerSettingsOperation,
435 providerInstanceId: Schema.optional(Schema.String),
436 environmentVariable: Schema.optional(Schema.String),
437 cause: Schema.Defect(),
438 },
439) {
440 override get message(): string {
441 const provider =
442 this.providerInstanceId === undefined ? "" : ` for provider ${this.providerInstanceId}`;
443 const variable =
444 this.environmentVariable === undefined
445 ? ""
446 : ` and environment variable ${this.environmentVariable}`;
447 return `Server settings ${this.operation} failed${provider}${variable} at ${this.settingsPath}.`;
448 }
449}
450
451// ── Unified type ─────────────────────────────────────────────────────
452
453export type UnifiedSettings = ServerSettings & ClientSettings;
454export const DEFAULT_UNIFIED_SETTINGS: UnifiedSettings = {
455 ...DEFAULT_SERVER_SETTINGS,
456 ...DEFAULT_CLIENT_SETTINGS,
457};
458
459// ── Server Settings Patch (replace with a Schema.deepPartial if available) ──────────────────────────────────────────
460
461const ModelSelectionPatch = Schema.Struct({
462 instanceId: Schema.optionalKey(ProviderInstanceId),
463 model: Schema.optionalKey(TrimmedNonEmptyString),
464 options: Schema.optionalKey(ProviderOptionSelections),
465});
466
467const CodexSettingsPatch = Schema.Struct({
468 enabled: Schema.optionalKey(Schema.Boolean),
469 binaryPath: Schema.optionalKey(TrimmedString),
470 homePath: Schema.optionalKey(TrimmedString),
471 shadowHomePath: Schema.optionalKey(TrimmedString),
472 customModels: Schema.optionalKey(Schema.Array(Schema.String)),
473});
474
475const ClaudeSettingsPatch = Schema.Struct({
476 enabled: Schema.optionalKey(Schema.Boolean),
477 binaryPath: Schema.optionalKey(TrimmedString),
478 homePath: Schema.optionalKey(TrimmedString),
479 customModels: Schema.optionalKey(Schema.Array(Schema.String)),
480 launchArgs: Schema.optionalKey(TrimmedString),
481});
482
483const CursorSettingsPatch = Schema.Struct({
484 enabled: Schema.optionalKey(Schema.Boolean),
485 binaryPath: Schema.optionalKey(TrimmedString),
486 apiEndpoint: Schema.optionalKey(TrimmedString),
487 customModels: Schema.optionalKey(Schema.Array(Schema.String)),
488});
489
490const GrokSettingsPatch = Schema.Struct({
491 enabled: Schema.optionalKey(Schema.Boolean),
492 binaryPath: Schema.optionalKey(TrimmedString),
493 customModels: Schema.optionalKey(Schema.Array(Schema.String)),
494});
495
496const OpenCodeSettingsPatch = Schema.Struct({
497 enabled: Schema.optionalKey(Schema.Boolean),
498 binaryPath: Schema.optionalKey(TrimmedString),
499 serverUrl: Schema.optionalKey(TrimmedString),
500 serverPassword: Schema.optionalKey(TrimmedString),
501 customModels: Schema.optionalKey(Schema.Array(Schema.String)),
502});
503
504export const ServerSettingsPatch = Schema.Struct({
505 // Server settings
506 enableAssistantStreaming: Schema.optionalKey(Schema.Boolean),
507 enableProviderUpdateChecks: Schema.optionalKey(Schema.Boolean),
508 automaticGitFetchInterval: Schema.optionalKey(Schema.DurationFromMillis),
509 defaultThreadEnvMode: Schema.optionalKey(ThreadEnvMode),
510 newWorktreesStartFromOrigin: Schema.optionalKey(Schema.Boolean),
511 addProjectBaseDirectory: Schema.optionalKey(TrimmedString),
512 textGenerationModelSelection: Schema.optionalKey(ModelSelectionPatch),
513 observability: Schema.optionalKey(
514 Schema.Struct({
515 otlpTracesUrl: Schema.optionalKey(TrimmedString),
516 otlpMetricsUrl: Schema.optionalKey(TrimmedString),
517 }),
518 ),
519 providers: Schema.optionalKey(
520 Schema.Struct({
521 codex: Schema.optionalKey(CodexSettingsPatch),
522 claudeAgent: Schema.optionalKey(ClaudeSettingsPatch),
523 cursor: Schema.optionalKey(CursorSettingsPatch),
524 grok: Schema.optionalKey(GrokSettingsPatch),
525 opencode: Schema.optionalKey(OpenCodeSettingsPatch),
526 }),
527 ),
528 // Whole-map replacement for the new instance config. Patching individual
529 // entries is intentionally out of scope: the map is small, and partial
530 // patches risk leaving driver-specific config in a half-merged state.
531 // The web UI sends a fully-formed map every time it edits this field.
532 providerInstances: Schema.optionalKey(Schema.Record(ProviderInstanceId, ProviderInstanceConfig)),
533});
534export type ServerSettingsPatch = typeof ServerSettingsPatch.Type;
535
536export const ClientSettingsPatch = Schema.Struct({
537 autoOpenPlanSidebar: Schema.optionalKey(Schema.Boolean),
538 confirmThreadArchive: Schema.optionalKey(Schema.Boolean),
539 confirmThreadDelete: Schema.optionalKey(Schema.Boolean),
540 diffIgnoreWhitespace: Schema.optionalKey(Schema.Boolean),
541 favorites: Schema.optionalKey(
542 Schema.Array(
543 Schema.Struct({
544 provider: ProviderInstanceId,
545 model: TrimmedNonEmptyString,
546 }),
547 ),
548 ),
549 providerModelPreferences: Schema.optionalKey(
550 Schema.Record(
551 ProviderInstanceId,
552 Schema.Struct({
553 hiddenModels: Schema.Array(Schema.String).pipe(
554 Schema.withDecodingDefault(Effect.succeed([])),
555 ),
556 modelOrder: Schema.Array(Schema.String).pipe(
557 Schema.withDecodingDefault(Effect.succeed([])),
558 ),
559 }),
560 ),
561 ),
562 sidebarProjectGroupingMode: Schema.optionalKey(SidebarProjectGroupingMode),
563 sidebarProjectGroupingOverrides: Schema.optionalKey(
564 Schema.Record(TrimmedNonEmptyString, SidebarProjectGroupingMode),
565 ),
566 sidebarProjectSortOrder: Schema.optionalKey(SidebarProjectSortOrder),
567 sidebarThreadSortOrder: Schema.optionalKey(SidebarThreadSortOrder),
568 sidebarThreadPreviewCount: Schema.optionalKey(SidebarThreadPreviewCount),
569 timestampFormat: Schema.optionalKey(TimestampFormat),
570 wordWrap: Schema.optionalKey(Schema.Boolean),
571});
572export type ClientSettingsPatch = typeof ClientSettingsPatch.Type;