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

server.ts

1,033 lines41.6 KB

1import * as Effect from "effect/Effect";
2import * as Schema from "effect/Schema";
3import { AcpRegistryUrlAuthAction } from "./acpRegistry.ts";
4import {
5 type EnvironmentMachineKind,
6 ExecutionEnvironmentDescriptor,
7 ServerSelfUpdateMethod,
8} from "./environment.ts";
9import { ServerAuthDescriptor } from "./auth.ts";
10import {
11 ForwardCompatibleArray,
12 IsoDateTime,
13 NonNegativeInt,
14 PositiveInt,
15 ProjectId,
16 ThreadId,
17 TrimmedNonEmptyString,
18} from "./baseSchemas.ts";
19import {
20 KeybindingCommand,
21 KeybindingValue,
22 KeybindingWhen,
23 ResolvedKeybindingsConfig,
24} from "./keybindings.ts";
25import { EditorId, FileManagerRevealKind, RemoteOpenTarget } from "./editor.ts";
26import { ModelCapabilities } from "./model.ts";
27import { RuntimeMode } from "./providerPolicy.ts";
28import { ProviderDriverKind, ProviderInstanceId } from "./providerInstance.ts";
29import { ServerProviderUsageLimits, UsageLimitSourceSnapshots } from "./providerUsageLimits.ts";
30import { ServerSettings } from "./settings.ts";
31​
32const KeybindingsMalformedConfigIssue = Schema.Struct({
33 kind: Schema.Literal("keybindings.malformed-config"),
34 message: TrimmedNonEmptyString,
35});
36​
37const KeybindingsInvalidEntryIssue = Schema.Struct({
38 kind: Schema.Literal("keybindings.invalid-entry"),
39 message: TrimmedNonEmptyString,
40 index: Schema.Number,
41});
42​
43export const ServerConfigIssue = Schema.Union([
44 KeybindingsMalformedConfigIssue,
45 KeybindingsInvalidEntryIssue,
46]);
47export type ServerConfigIssue = typeof ServerConfigIssue.Type;
48​
49// Issue kinds grow over time; older clients must not fail the whole config
50// decode over a kind they cannot render.
51const ServerConfigIssues = ForwardCompatibleArray(ServerConfigIssue);
52​
53export const ServerProviderState = Schema.Literals(["ready", "warning", "error", "disabled"]);
54export type ServerProviderState = typeof ServerProviderState.Type;
55​
56export const ServerProviderAuthStatus = Schema.Literals([
57 "authenticated",
58 "unauthenticated",
59 "unknown",
60]);
61export type ServerProviderAuthStatus = typeof ServerProviderAuthStatus.Type;
62​
63export const ServerProviderAuth = Schema.Struct({
64 status: ServerProviderAuthStatus,
65 type: Schema.optional(TrimmedNonEmptyString),
66 label: Schema.optional(TrimmedNonEmptyString),
67 email: Schema.optional(TrimmedNonEmptyString),
68 action: Schema.optional(AcpRegistryUrlAuthAction),
69 canLogout: Schema.optional(Schema.Boolean),
70 subscriptionSharing: Schema.optional(Schema.Boolean),
71 profileId: Schema.optional(TrimmedNonEmptyString),
72 /**
73 * The workspace or organization whose quota the login draws on, such as a
74 * ChatGPT workspace or Claude organization id. One email can belong to
75 * several, each with its own quota.
76 */
77 workspaceId: Schema.optional(TrimmedNonEmptyString),
78});
79export type ServerProviderAuth = typeof ServerProviderAuth.Type;
80​
81export const ServerProviderModel = Schema.Struct({
82 slug: TrimmedNonEmptyString,
83 name: TrimmedNonEmptyString,
84 shortName: Schema.optional(TrimmedNonEmptyString),
85 subProvider: Schema.optional(TrimmedNonEmptyString),
86 aliases: Schema.optional(Schema.Array(TrimmedNonEmptyString)),
87 badge: Schema.optional(Schema.Literal("new")),
88 isCustom: Schema.Boolean,
89 isDefault: Schema.optional(Schema.Boolean),
90 isLegacy: Schema.optional(Schema.Boolean),
91 capabilities: Schema.NullOr(ModelCapabilities),
92});
93export type ServerProviderModel = typeof ServerProviderModel.Type;
94​
95/**
96 * A model the model manifest announces that the installed provider version is
97 * too old to run. It is never selectable; clients show it so users learn that
98 * updating the provider unlocks it.
99 */
100export const ServerProviderUpdateRequiredModel = Schema.Struct({
101 slug: TrimmedNonEmptyString,
102 name: TrimmedNonEmptyString,
103 badge: Schema.optional(Schema.Literal("new")),
104 minVersion: TrimmedNonEmptyString,
105});
106export type ServerProviderUpdateRequiredModel = typeof ServerProviderUpdateRequiredModel.Type;
107​
108export const ServerProviderSlashCommandInput = Schema.Struct({
109 hint: TrimmedNonEmptyString,
110});
111export type ServerProviderSlashCommandInput = typeof ServerProviderSlashCommandInput.Type;
112​
113export const ServerProviderSlashCommand = Schema.Struct({
114 name: TrimmedNonEmptyString,
115 description: Schema.optional(TrimmedNonEmptyString),
116 input: Schema.optional(ServerProviderSlashCommandInput),
117});
118export type ServerProviderSlashCommand = typeof ServerProviderSlashCommand.Type;
119​
120export const ServerProviderSkill = Schema.Struct({
121 name: TrimmedNonEmptyString,
122 description: Schema.optional(TrimmedNonEmptyString),
123 path: TrimmedNonEmptyString,
124 scope: Schema.optional(TrimmedNonEmptyString),
125 enabled: Schema.Boolean,
126 displayName: Schema.optional(TrimmedNonEmptyString),
127 shortDescription: Schema.optional(TrimmedNonEmptyString),
128 /**
129 * The skill is hidden from the agent's own skill tool, so only the user can
130 * start it — Claude Code's `disable-model-invocation`. Composers must offer
131 * it as a slash command; naming it in prose does nothing.
132 */
133 userInvocationOnly: Schema.optional(Schema.Boolean),
134 /**
135 * The mirror of {@link ServerProviderSkill.userInvocationOnly}: Claude Code's
136 * `user-invocable: false` keeps the skill out of its own slash commands, so
137 * only the agent can start it. Composers must not offer it under `/`.
138 */
139 userInvocable: Schema.optional(Schema.Boolean),
140});
141export type ServerProviderSkill = typeof ServerProviderSkill.Type;
142​
143export const ServerProviderWorkspaceSnapshot = Schema.Struct({
144 cwd: TrimmedNonEmptyString,
145 checkedAt: IsoDateTime,
146 slashCommands: Schema.Array(ServerProviderSlashCommand),
147 /** Skills are available, but command discovery still needs a retry. */
148 slashCommandsPending: Schema.optional(Schema.Boolean),
149 skills: Schema.Array(ServerProviderSkill),
150});
151export type ServerProviderWorkspaceSnapshot = typeof ServerProviderWorkspaceSnapshot.Type;
152​
153/**
154 * How long a workspace's skill and command scan stays current. Nothing watches
155 * skill directories, so a composer opened after this rescans on use, and the
156 * server answers repeat requests inside the window from its cache.
157 */
158export const PROVIDER_WORKSPACE_SNAPSHOT_TTL_MS = 5 * 60_000;
159​
160export function isProviderWorkspaceSnapshotCurrent(
161 snapshot: Pick<ServerProviderWorkspaceSnapshot, "checkedAt">,
162 nowMs: number,
163): boolean {
164 return nowMs - Date.parse(snapshot.checkedAt) < PROVIDER_WORKSPACE_SNAPSHOT_TTL_MS;
166​
167/**
168 * Availability of a configured provider instance from the runtime's POV.
169 *
170 * - `available` — the build ships this driver and an instance is wired
171 * up. Default for legacy snapshots produced from the closed
172 * `ServerSettings.providers` map.
173 * - `unavailable` — the user's `ServerSettings.providerInstances` (or a
174 * persisted thread / session binding) references a driver this build
175 * doesn't ship. Common after rolling back from a fork or PR branch
176 * that introduced a new driver. The snapshot is preserved so the UI
177 * can render "missing driver" affordances and so the data round-trips
178 * when the user moves back to the fork.
179 *
180 * Snapshots with `availability: "unavailable"` MUST set
181 * `installed: false` and `enabled: false`; the runtime refuses turn
182 * starts against them with a structured error.
183 */
184export const ServerProviderAvailability = Schema.Literals(["available", "unavailable"]);
185export type ServerProviderAvailability = typeof ServerProviderAvailability.Type;
186​
187export const ServerProviderContinuation = Schema.Struct({
188 groupKey: TrimmedNonEmptyString,
189});
190export type ServerProviderContinuation = typeof ServerProviderContinuation.Type;
191​
192export const ServerProviderCompatibilityStatus = Schema.Literals([
193 "unknown",
194 "supported",
195 "graceful",
196 "unsupported",
197 "broken",
198]);
199export const ServerProviderCompatibilityAdvisory = Schema.Struct({
200 status: ServerProviderCompatibilityStatus,
201 latestVersionStatus: Schema.optionalKey(ServerProviderCompatibilityStatus),
202 message: Schema.NullOr(TrimmedNonEmptyString),
203 recommendedVersion: Schema.NullOr(TrimmedNonEmptyString),
204 recommendedRange: Schema.NullOr(TrimmedNonEmptyString),
205});
206export type ServerProviderCompatibilityAdvisory = typeof ServerProviderCompatibilityAdvisory.Type;
207​
208export const ServerProviderVersionAdvisoryStatus = Schema.Literals([
209 "unknown",
210 "current",
211 "behind_latest",
212]);
213export type ServerProviderVersionAdvisoryStatus = typeof ServerProviderVersionAdvisoryStatus.Type;
214​
215export const ServerProviderVersionAdvisory = Schema.Struct({
216 status: ServerProviderVersionAdvisoryStatus,
217 currentVersion: Schema.NullOr(TrimmedNonEmptyString),
218 latestVersion: Schema.NullOr(TrimmedNonEmptyString),
219 updateCommand: Schema.NullOr(TrimmedNonEmptyString),
220 canUpdate: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
221 canInstallVersion: Schema.optionalKey(Schema.Boolean),
222 checkedAt: Schema.NullOr(IsoDateTime),
223 message: Schema.NullOr(TrimmedNonEmptyString),
224});
225export type ServerProviderVersionAdvisory = typeof ServerProviderVersionAdvisory.Type;
226​
227export const ServerProviderUpdateStatus = Schema.Literals([
228 "idle",
229 "queued",
230 "running",
231 "succeeded",
232 "failed",
233 "unchanged",
234]);
235export type ServerProviderUpdateStatus = typeof ServerProviderUpdateStatus.Type;
236​
237export const ServerProviderUpdateState = Schema.Struct({
238 status: ServerProviderUpdateStatus,
239 startedAt: Schema.NullOr(IsoDateTime),
240 finishedAt: Schema.NullOr(IsoDateTime),
241 message: Schema.NullOr(TrimmedNonEmptyString),
242 output: Schema.NullOr(Schema.String.check(Schema.isMaxLength(10_000))),
243});
244export type ServerProviderUpdateState = typeof ServerProviderUpdateState.Type;
245​
246export const ServerProvider = Schema.Struct({
247 // Routing key for the configured instance this snapshot represents. This
248 // is the only stable identity consumers may use for provider routing.
249 instanceId: ProviderInstanceId,
250 // Open driver kind slug that selects the implementation handling this
251 // instance. It is metadata/capability context, not a routing key.
252 driver: ProviderDriverKind,
253 displayName: Schema.optional(TrimmedNonEmptyString),
254 accentColor: Schema.optional(TrimmedNonEmptyString),
255 // Optional visual identity supplied by the owning provider driver. Clients
256 // must still validate remote URLs against that driver's trusted origin.
257 iconUrl: Schema.optional(TrimmedNonEmptyString.check(Schema.isMaxLength(2_048))),
258 badgeLabel: Schema.optional(TrimmedNonEmptyString),
259 continuation: Schema.optional(ServerProviderContinuation),
260 showInteractionModeToggle: Schema.optional(Schema.Boolean),
261 // The driver streams context window usage, so a started thread will have a
262 // meter once its activities load. Clients reserve the meter's space on it.
263 reportsContextWindow: Schema.optional(Schema.Boolean),
264 supportedRuntimeModes: Schema.optional(ForwardCompatibleArray(RuntimeMode)),
265 requiresNewThreadForModelChange: Schema.optional(Schema.Boolean),
266 supportsConversationRollback: Schema.optional(Schema.Boolean),
267 supportsTextGeneration: Schema.optional(Schema.Boolean),
268 setup: Schema.optional(
269 Schema.Struct({
270 canAuthenticate: Schema.Boolean,
271 canInstall: Schema.Boolean,
272 documentationUrl: Schema.optionalKey(TrimmedNonEmptyString.check(Schema.isMaxLength(2_048))),
273 }),
274 ),
275 nativeSessions: Schema.optional(
276 Schema.Struct({
277 canList: Schema.Boolean,
278 canLoad: Schema.Boolean,
279 canResume: Schema.Boolean,
280 canDelete: Schema.optional(Schema.Boolean),
281 }),
282 ),
283 configurableProviders: Schema.optional(Schema.Boolean),
284 runtimePaths: Schema.optionalKey(
285 Schema.Struct({
286 homePath: TrimmedNonEmptyString,
287 shadowHomePath: Schema.NullOr(TrimmedNonEmptyString),
288 }),
289 ),
290 enabled: Schema.Boolean,
291 installed: Schema.Boolean,
292 version: Schema.NullOr(TrimmedNonEmptyString),
293 status: ServerProviderState,
294 auth: ServerProviderAuth,
295 checkedAt: IsoDateTime,
296 message: Schema.optional(TrimmedNonEmptyString),
297 // Optional for back-compat: every legacy producer omits this field and
298 // an absent value is interpreted as `"available"` by consumers (see
299 // `isProviderAvailable`). New `ProviderInstanceRegistry` outputs set it
300 // explicitly so the UI can render unavailable shadows from
301 // `ServerSettings.providerInstances`.
302 availability: Schema.optional(ServerProviderAvailability),
303 // Human-readable reason populated when `availability === "unavailable"`.
304 // Surfaces in the UI alongside the missing-driver affordance.
305 unavailableReason: Schema.optional(TrimmedNonEmptyString),
306 models: Schema.Array(ServerProviderModel),
307 // Kept apart from `models` so clients that predate it never offer them.
308 updateRequiredModels: Schema.optionalKey(Schema.Array(ServerProviderUpdateRequiredModel)),
309 slashCommands: Schema.Array(ServerProviderSlashCommand).pipe(
310 Schema.withDecodingDefault(Effect.succeed([])),
311 ),
312 skills: Schema.Array(ServerProviderSkill).pipe(Schema.withDecodingDefault(Effect.succeed([]))),
313 workspaceSnapshots: Schema.optionalKey(Schema.Array(ServerProviderWorkspaceSnapshot)),
314 // Absent when the driver has no notion of subscription usage.
315 usageLimits: Schema.optional(ServerProviderUsageLimits),
316 versionAdvisory: Schema.optionalKey(ServerProviderVersionAdvisory),
317 compatibilityAdvisory: Schema.optionalKey(ServerProviderCompatibilityAdvisory),
318 updateState: Schema.optionalKey(ServerProviderUpdateState),
319});
320export type ServerProvider = typeof ServerProvider.Type;
321​
322// Provider status kinds grow over time (ServerProviderState,
323// ServerProviderAuthStatus, ServerProviderVersionAdvisoryStatus,
324// ServerProviderUpdateStatus); an older client must not fail the whole config
325// decode over one provider it cannot render.
326export const ServerProviders = ForwardCompatibleArray(ServerProvider);
327export type ServerProviders = typeof ServerProviders.Type;
328​
329/**
330 * Treat the optional `availability` as "available" when absent. This is
331 * the rule legacy producers (which omit the field) and new producers
332 * (which set it explicitly) agree on so consumers never have to thread
333 * `?? "available"` defaults through their code paths.
334 */
335export const isProviderAvailable = (snapshot: ServerProvider): boolean =>
336 snapshot.availability !== "unavailable";
337​
338/**
339 * Treat an absent `supportsTextGeneration` as supported so legacy
340 * producers, which all support application text generation, keep working
341 * without resending the field.
342 */
343export const isProviderTextGenerationCapable = (snapshot: ServerProvider): boolean =>
344 snapshot.supportsTextGeneration !== false;
345​
346export const ServerObservability = Schema.Struct({
347 logsDirectoryPath: TrimmedNonEmptyString,
348 localTracingEnabled: Schema.Boolean,
349 otlpTracesUrl: Schema.optional(TrimmedNonEmptyString),
350 otlpTracesEnabled: Schema.Boolean,
351 otlpMetricsUrl: Schema.optional(TrimmedNonEmptyString),
352 otlpMetricsEnabled: Schema.Boolean,
353 otlpLogsUrl: Schema.optional(TrimmedNonEmptyString),
354 // Absent on servers from before the log signal shipped, so a newer client
355 // reads those as having no log export rather than rejecting the whole config.
356 otlpLogsEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
357});
358export type ServerObservability = typeof ServerObservability.Type;
359​
360export const OtlpSignal = Schema.Literals(["traces", "metrics", "logs"]);
361export type OtlpSignal = typeof OtlpSignal.Type;
362​
363export const OtlpEndpointCheckInput = Schema.Struct({
364 signal: OtlpSignal,
365 // Receivers are HTTP only; other schemes, such as data:, answer without contacting one.
366 url: TrimmedNonEmptyString.check(Schema.isPattern(/^https?:\/\/./i)),
367});
368export type OtlpEndpointCheckInput = typeof OtlpEndpointCheckInput.Type;
369​
370/**
371 * What the server saw when it sent an empty export to an endpoint: accepted,
372 * answered with an error status, or never answered.
373 */
374export const OtlpEndpointCheckResult = Schema.Union([
375 Schema.TaggedStruct("Accepted", { latencyMs: Schema.Number }),
376 Schema.TaggedStruct("Rejected", { status: Schema.Number }),
377 Schema.TaggedStruct("Unreachable", { timedOut: Schema.Boolean }),
378]);
379export type OtlpEndpointCheckResult = typeof OtlpEndpointCheckResult.Type;
380​
381export const ServerTraceDiagnosticsErrorKind = Schema.Literals([
382 "trace-file-not-found",
383 "trace-file-read-failed",
384]);
385export type ServerTraceDiagnosticsErrorKind = typeof ServerTraceDiagnosticsErrorKind.Type;
386​
387export const ServerTraceDiagnosticsSpanSummary = Schema.Struct({
388 name: TrimmedNonEmptyString,
389 count: NonNegativeInt,
390 failureCount: NonNegativeInt,
391 totalDurationMs: Schema.Number,
392 averageDurationMs: Schema.Number,
393 maxDurationMs: Schema.Number,
394});
395export type ServerTraceDiagnosticsSpanSummary = typeof ServerTraceDiagnosticsSpanSummary.Type;
396​
397export const ServerTraceDiagnosticsFailureSummary = Schema.Struct({
398 name: TrimmedNonEmptyString,
399 cause: TrimmedNonEmptyString,
400 count: NonNegativeInt,
401 lastSeenAt: Schema.DateTimeUtc,
402 traceId: TrimmedNonEmptyString,
403 spanId: TrimmedNonEmptyString,
404});
405export type ServerTraceDiagnosticsFailureSummary = typeof ServerTraceDiagnosticsFailureSummary.Type;
406​
407export const ServerTraceDiagnosticsRecentFailure = Schema.Struct({
408 name: TrimmedNonEmptyString,
409 cause: TrimmedNonEmptyString,
410 durationMs: Schema.Number,
411 endedAt: Schema.DateTimeUtc,
412 traceId: TrimmedNonEmptyString,
413 spanId: TrimmedNonEmptyString,
414});
415export type ServerTraceDiagnosticsRecentFailure = typeof ServerTraceDiagnosticsRecentFailure.Type;
416​
417export const ServerTraceDiagnosticsSpanOccurrence = Schema.Struct({
418 name: TrimmedNonEmptyString,
419 durationMs: Schema.Number,
420 endedAt: Schema.DateTimeUtc,
421 traceId: TrimmedNonEmptyString,
422 spanId: TrimmedNonEmptyString,
423});
424export type ServerTraceDiagnosticsSpanOccurrence = typeof ServerTraceDiagnosticsSpanOccurrence.Type;
425​
426export const ServerTraceDiagnosticsLogEvent = Schema.Struct({
427 spanName: TrimmedNonEmptyString,
428 level: TrimmedNonEmptyString,
429 message: TrimmedNonEmptyString,
430 seenAt: Schema.DateTimeUtc,
431 traceId: TrimmedNonEmptyString,
432 spanId: TrimmedNonEmptyString,
433});
434export type ServerTraceDiagnosticsLogEvent = typeof ServerTraceDiagnosticsLogEvent.Type;
435​
436export const ServerTraceDiagnosticsResult = Schema.Struct({
437 traceFilePath: TrimmedNonEmptyString,
438 scannedFilePaths: Schema.Array(TrimmedNonEmptyString),
439 readAt: Schema.DateTimeUtc,
440 recordCount: NonNegativeInt,
441 parseErrorCount: NonNegativeInt,
442 firstSpanAt: Schema.Option(Schema.DateTimeUtc),
443 lastSpanAt: Schema.Option(Schema.DateTimeUtc),
444 failureCount: NonNegativeInt,
445 interruptionCount: NonNegativeInt,
446 slowSpanThresholdMs: NonNegativeInt,
447 slowSpanCount: NonNegativeInt,
448 logLevelCounts: Schema.Record(TrimmedNonEmptyString, NonNegativeInt),
449 topSpansByCount: Schema.Array(ServerTraceDiagnosticsSpanSummary),
450 slowestSpans: Schema.Array(ServerTraceDiagnosticsSpanOccurrence),
451 commonFailures: Schema.Array(ServerTraceDiagnosticsFailureSummary),
452 latestFailures: Schema.Array(ServerTraceDiagnosticsRecentFailure),
453 latestWarningAndErrorLogs: Schema.Array(ServerTraceDiagnosticsLogEvent),
454 partialFailure: Schema.Option(Schema.Boolean),
455 error: Schema.Option(
456 Schema.Struct({
457 kind: ServerTraceDiagnosticsErrorKind,
458 message: TrimmedNonEmptyString,
459 }),
460 ),
461});
462export type ServerTraceDiagnosticsResult = typeof ServerTraceDiagnosticsResult.Type;
463​
464export const ServerProcessSignal = Schema.Literals(["SIGINT", "SIGKILL"]);
465export type ServerProcessSignal = typeof ServerProcessSignal.Type;
466​
467export const ServerProcessDiagnosticsEntry = Schema.Struct({
468 pid: PositiveInt,
469 startTimeMs: NonNegativeInt,
470 ppid: NonNegativeInt,
471 pgid: Schema.Option(Schema.Int),
472 status: TrimmedNonEmptyString,
473 cpuPercent: Schema.Number,
474 rssBytes: NonNegativeInt,
475 elapsed: TrimmedNonEmptyString,
476 command: TrimmedNonEmptyString,
477 depth: NonNegativeInt,
478 childPids: Schema.Array(PositiveInt),
479});
480export type ServerProcessDiagnosticsEntry = typeof ServerProcessDiagnosticsEntry.Type;
481​
482export const ServerProcessDiagnosticsResult = Schema.Struct({
483 serverPid: PositiveInt,
484 readAt: Schema.DateTimeUtc,
485 processCount: NonNegativeInt,
486 totalRssBytes: NonNegativeInt,
487 totalCpuPercent: Schema.Number,
488 processes: Schema.Array(ServerProcessDiagnosticsEntry),
489 error: Schema.Option(
490 Schema.Struct({
491 message: TrimmedNonEmptyString,
492 }),
493 ),
494});
495export type ServerProcessDiagnosticsResult = typeof ServerProcessDiagnosticsResult.Type;
496​
497export const ServerProcessResourceHistoryInput = Schema.Struct({
498 windowMs: NonNegativeInt,
499 bucketMs: NonNegativeInt,
500});
501export type ServerProcessResourceHistoryInput = typeof ServerProcessResourceHistoryInput.Type;
502​
503export const ServerProcessResourceHistoryBucket = Schema.Struct({
504 startedAt: Schema.DateTimeUtc,
505 endedAt: Schema.DateTimeUtc,
506 avgCpuPercent: Schema.Number,
507 maxCpuPercent: Schema.Number,
508 maxRssBytes: NonNegativeInt,
509 maxProcessCount: NonNegativeInt,
510});
511export type ServerProcessResourceHistoryBucket = typeof ServerProcessResourceHistoryBucket.Type;
512​
513export const ServerProcessResourceHistorySummary = Schema.Struct({
514 processKey: TrimmedNonEmptyString,
515 pid: PositiveInt,
516 ppid: NonNegativeInt,
517 command: TrimmedNonEmptyString,
518 depth: NonNegativeInt,
519 isServerRoot: Schema.Boolean,
520 firstSeenAt: Schema.DateTimeUtc,
521 lastSeenAt: Schema.DateTimeUtc,
522 currentCpuPercent: Schema.Number,
523 avgCpuPercent: Schema.Number,
524 maxCpuPercent: Schema.Number,
525 cpuSecondsApprox: Schema.Number,
526 currentRssBytes: NonNegativeInt,
527 maxRssBytes: NonNegativeInt,
528 sampleCount: NonNegativeInt,
529});
530export type ServerProcessResourceHistorySummary = typeof ServerProcessResourceHistorySummary.Type;
531​
532export const ServerProcessResourceHistoryFailureTag = Schema.Literals([
533 "ProcessDiagnosticsQueryTimeoutError",
534 "ProcessDiagnosticsQueryFailedError",
535 "ProcessDiagnosticsServerProcessSignalError",
536 "ProcessDiagnosticsNotDescendantError",
537 "ProcessDiagnosticsSignalFailedError",
538]);
539export type ServerProcessResourceHistoryFailureTag =
540 typeof ServerProcessResourceHistoryFailureTag.Type;
541​
542export const ServerProcessResourceHistoryResult = Schema.Struct({
543 readAt: Schema.DateTimeUtc,
544 windowMs: NonNegativeInt,
545 bucketMs: NonNegativeInt,
546 sampleIntervalMs: NonNegativeInt,
547 retainedSampleCount: NonNegativeInt,
548 totalCpuSecondsApprox: Schema.Number,
549 buckets: Schema.Array(ServerProcessResourceHistoryBucket),
550 topProcesses: Schema.Array(ServerProcessResourceHistorySummary),
551 error: Schema.Option(
552 Schema.Struct({
553 failureTag: ServerProcessResourceHistoryFailureTag,
554 message: TrimmedNonEmptyString,
555 }),
556 ),
557});
558export type ServerProcessResourceHistoryResult = typeof ServerProcessResourceHistoryResult.Type;
559​
560export const ServerSignalProcessInput = Schema.Struct({
561 pid: PositiveInt,
562 startTimeMs: NonNegativeInt,
563 signal: ServerProcessSignal,
564});
565export type ServerSignalProcessInput = typeof ServerSignalProcessInput.Type;
566​
567export const ServerSignalProcessResult = Schema.Struct({
568 pid: PositiveInt,
569 signal: ServerProcessSignal,
570 signaled: Schema.Boolean,
571 message: Schema.Option(TrimmedNonEmptyString),
572});
573export type ServerSignalProcessResult = typeof ServerSignalProcessResult.Type;
574​
575/**
576 * A palette the environment's machine publishes for T3 Code to follow, read
577 * from a theme file next to the rest of the environment's state. Two seed
578 * colors rather than a full palette: clients derive the remaining roles with
579 * the same generator the guided theme editor uses, so a desktop theme carries
580 * over as a coherent T3 Code palette instead of a foreign one.
581 */
582export const EnvironmentThemeColor = Schema.String.check(
583 Schema.isPattern(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/),
584);
585export type EnvironmentThemeColor = typeof EnvironmentThemeColor.Type;
586​
587/**
588 * Matches the client-side theme id rule, so a published id is selectable.
589 * The appearance keywords are excluded outright: a published `dark.json`
590 * would otherwise capture every client whose stored preference is the stock
591 * `"dark"`, retinting people who never chose it.
592 */
593export const EnvironmentThemeId = Schema.String.check(
594 Schema.isPattern(/^(?!(?:system|light|dark)$)[a-z0-9](?:[a-z0-9-]{0,47})$/),
595);
596export type EnvironmentThemeId = typeof EnvironmentThemeId.Type;
597​
598/**
599 * Role colors as published. Values are any CSS color the client's theme
600 * parser accepts (exported theme files use oklch), canonicalized client-side;
601 * roles a build does not know are dropped there, so a machine may publish
602 * roles a newer client added without breaking an older one. Keys must still
603 * be role-shaped and values color-sized, so the record stays open to future
604 * vocabulary without being an arbitrary-payload channel.
605 */
606const EnvironmentThemeColors = Schema.Record(
607 Schema.String.check(Schema.isPattern(/^[a-zA-Z][a-zA-Z0-9]{0,63}$/)),
608 TrimmedNonEmptyString.check(Schema.isMaxLength(64)),
609);
610​
611const environmentThemeFields = {
612 /**
613 * Standard exported theme files (the Download button's output) carry
614 * `version: 1`; the seeded short form a desktop generates has no version.
615 */
616 version: Schema.optional(Schema.Literal(1)),
617 /** Shown on the theme card, e.g. the desktop theme's own name. */
618 name: TrimmedNonEmptyString.check(Schema.isMaxLength(48)),
619 appearance: Schema.Literals(["light", "dark"]),
620 /**
621 * Seed colors. When present, clients derive the full palette from them with
622 * the guided theme editor's generator and layer `colors` on top; when
623 * absent, `colors` is the palette, as in an exported theme file.
624 */
625 canvas: Schema.optional(EnvironmentThemeColor),
626 accent: Schema.optional(EnvironmentThemeColor),
627 colors: Schema.optional(EnvironmentThemeColors),
628 /** The other appearance's palette, as exported theme files carry it. */
629 variants: Schema.optional(
630 Schema.Struct({
631 light: Schema.optional(EnvironmentThemeColors),
632 dark: Schema.optional(EnvironmentThemeColors),
633 }),
634 ),
635};
636​
637/** One published theme file. The id is the filename, not part of the content,
638 * so a file cannot claim another file's identity; an embedded `id` is ignored. */
639export const EnvironmentThemeFile = Schema.Struct(environmentThemeFields);
640export type EnvironmentThemeFile = typeof EnvironmentThemeFile.Type;
641​
642export const EnvironmentTheme = Schema.Struct({
643 /** The publishing filename without its extension, stable across recolors. */
644 id: EnvironmentThemeId,
645 ...environmentThemeFields,
646});
647export type EnvironmentTheme = typeof EnvironmentTheme.Type;
648​
649/**
650 * Whether a theme file carries anything to render. A file with neither seeds
651 * nor colors would show as the stock palette wearing a name, which reads as a
652 * bug rather than a theme — the CLI and the server watcher both reject it,
653 * through this one predicate so they cannot drift.
654 */
655export function environmentThemeFileHasColors(file: EnvironmentThemeFile): boolean {
656 return (
657 (file.canvas !== undefined && file.accent !== undefined) ||
658 (file.colors !== undefined && Object.keys(file.colors).length > 0)
659 );
661​
662/**
663 * "tailnet" when the address is on this machine's Tailscale interface, "lan"
664 * for any other private address, including other VPNs in 100.64.0.0/10.
665 */
666export const ServerDirectEndpointKind = Schema.Literals(["lan", "tailnet"]);
667export type ServerDirectEndpointKind = typeof ServerDirectEndpointKind.Type;
668​
669export const ServerDirectEndpoint = Schema.Struct({
670 kind: ServerDirectEndpointKind,
671 httpBaseUrl: TrimmedNonEmptyString,
672});
673export type ServerDirectEndpoint = typeof ServerDirectEndpoint.Type;
674​
675export const ServerConfig = Schema.Struct({
676 environment: ExecutionEnvironmentDescriptor,
677 auth: ServerAuthDescriptor,
678 cwd: TrimmedNonEmptyString,
679 keybindingsConfigPath: TrimmedNonEmptyString,
680 keybindings: ResolvedKeybindingsConfig,
681 issues: ServerConfigIssues,
682 providers: ServerProviders,
683 // Editor ids grow over time; drop ones this build does not know rather than
684 // failing the whole config decode.
685 availableEditors: ForwardCompatibleArray(EditorId),
686 /**
687 * SSH hosts this environment advertises for remote open-in-editor links.
688 * Absent on servers that predate the feature; empty when the machine has no
689 * sshd or no advertisable name.
690 */
691 remoteOpenTargets: Schema.optionalKey(ForwardCompatibleArray(RemoteOpenTarget)),
692 /**
693 * Direct addresses this server listens on right now (LAN and tailnet), so a
694 * client connected one way can learn the others. Hints only: the client
695 * checks each address answers as this environment before using it. Absent on
696 * servers that predate the feature; empty when bound to loopback only.
697 */
698 directEndpoints: Schema.optionalKey(ForwardCompatibleArray(ServerDirectEndpoint)),
699 observability: ServerObservability,
700 settings: ServerSettings,
701 /** Whether shell subscriptions can emit an opt-in catch-up completion marker. */
702 shellResumeCompletionMarker: Schema.optionalKey(Schema.Boolean),
703 /** Whether shell.openInEditor honors `LaunchEditorInput.reveal` for the
704 file-manager editor. */
705 shellRevealInFileManager: Schema.optionalKey(Schema.Boolean),
706 /** File-manager wording clients should use for reveal actions. */
707 shellRevealInFileManagerKind: Schema.optionalKey(FileManagerRevealKind),
708 /** Whether thread subscriptions can emit an opt-in catch-up completion marker. */
709 threadResumeCompletionMarker: Schema.optionalKey(Schema.Boolean),
710 /**
711 * Whether thread detail reads accept a turn window (`turnLimit`/
712 * `beforeCursor`) and return `page` metadata. Clients must not send window
713 * fields to servers that don't advertise this.
714 */
715 threadSnapshotPagination: Schema.optionalKey(Schema.Boolean),
716 /** Whether thread reads accept the reasoningMessages opt-in. */
717 reasoningMessages: Schema.optionalKey(Schema.Boolean),
718 threadFind: Schema.optionalKey(Schema.Boolean),
719 threadFindProgressive: Schema.optionalKey(Schema.Boolean),
720 /**
721 * Folder behind this environment's Scratch project, for threads that need
722 * no repository. Present only on servers that answer projects.ensureScratch
723 * and whose data dir is outside a Git checkout.
724 */
725 scratchWorkspaceRoot: Schema.optionalKey(TrimmedNonEmptyString),
726 /**
727 * Folder that holds projects started from just a name. Present only on
728 * servers that answer projects.createNew.
729 */
730 newProjectsRoot: Schema.optionalKey(TrimmedNonEmptyString),
731 /**
732 * Palettes published by this environment's machine. Never sent in a config
733 * snapshot: the theme stream emits the current set before any change, so a
734 * snapshot carrying it too would hand every subscriber the same array twice
735 * per connect. Clients populate this by projecting `environmentThemesUpdated`,
736 * and it stays absent for subscribers that did not opt in.
737 */
738 environmentThemes: Schema.optional(Schema.Array(EnvironmentTheme)),
739 /**
740 * Quota reported by configured `usageLimitSources`. Like themes, never in
741 * a snapshot: the source stream emits the current set on subscribe, and it
742 * stays absent for subscribers that did not opt in.
743 */
744 usageLimitSources: Schema.optional(UsageLimitSourceSnapshots),
745});
746export type ServerConfig = typeof ServerConfig.Type;
747​
748/**
749 * The machine an environment should be drawn as: the user's pick, else what
750 * the server detected, else a generic server. Settings only exist once
751 * connected; a descriptor alone (relay discovery, before any connection)
752 * still yields the detected kind. A null config (nothing known yet, or an
753 * older server) resolves to the same generic so rows never flicker between
754 * glyphs.
755 */
756export function resolveEnvironmentMachineKind(
757 config: {
758 readonly environment: Pick<ExecutionEnvironmentDescriptor, "platform">;
759 readonly settings?: Pick<ServerSettings, "environmentIcon">;
760 } | null,
761): EnvironmentMachineKind {
762 return config?.settings?.environmentIcon ?? config?.environment.platform.machine ?? "server";
764​
765const ServerUpsertKeybindingReplaceTarget = Schema.Struct({
766 key: KeybindingValue,
767 command: KeybindingCommand,
768 when: Schema.optional(KeybindingWhen),
769});
770​
771export const ServerUpsertKeybindingInput = Schema.Struct({
772 key: KeybindingValue,
773 command: KeybindingCommand,
774 when: Schema.optional(KeybindingWhen),
775 replace: Schema.optional(ServerUpsertKeybindingReplaceTarget),
776});
777export type ServerUpsertKeybindingInput = typeof ServerUpsertKeybindingInput.Type;
778​
779export const ServerRemoveKeybindingInput = ServerUpsertKeybindingReplaceTarget;
780export type ServerRemoveKeybindingInput = typeof ServerRemoveKeybindingInput.Type;
781​
782export const ServerUpsertKeybindingResult = Schema.Struct({
783 keybindings: ResolvedKeybindingsConfig,
784 issues: ServerConfigIssues,
785});
786export type ServerUpsertKeybindingResult = typeof ServerUpsertKeybindingResult.Type;
787​
788export const ServerRemoveKeybindingResult = ServerUpsertKeybindingResult;
789export type ServerRemoveKeybindingResult = typeof ServerRemoveKeybindingResult.Type;
790​
791export const ServerConfigUpdatedPayload = Schema.Struct({
792 issues: ServerConfigIssues,
793 providers: ServerProviders,
794 settings: Schema.optional(ServerSettings),
795});
796export type ServerConfigUpdatedPayload = typeof ServerConfigUpdatedPayload.Type;
797​
798export const ServerConfigKeybindingsUpdatedPayload = Schema.Struct({
799 keybindings: ResolvedKeybindingsConfig,
800 issues: ServerConfigIssues,
801});
802export type ServerConfigKeybindingsUpdatedPayload =
803 typeof ServerConfigKeybindingsUpdatedPayload.Type;
804​
805export const ServerConfigProviderStatusesPayload = Schema.Struct({
806 providers: ServerProviders,
807});
808export type ServerConfigProviderStatusesPayload = typeof ServerConfigProviderStatusesPayload.Type;
809​
810export const ServerConfigSettingsUpdatedPayload = Schema.Struct({
811 settings: ServerSettings,
812});
813export type ServerConfigSettingsUpdatedPayload = typeof ServerConfigSettingsUpdatedPayload.Type;
814​
815export const ServerConfigStreamSnapshotEvent = Schema.Struct({
816 version: Schema.Literal(1),
817 type: Schema.Literal("snapshot"),
818 config: ServerConfig,
819});
820export type ServerConfigStreamSnapshotEvent = typeof ServerConfigStreamSnapshotEvent.Type;
821​
822export const ServerConfigStreamKeybindingsUpdatedEvent = Schema.Struct({
823 version: Schema.Literal(1),
824 type: Schema.Literal("keybindingsUpdated"),
825 payload: ServerConfigKeybindingsUpdatedPayload,
826});
827export type ServerConfigStreamKeybindingsUpdatedEvent =
828 typeof ServerConfigStreamKeybindingsUpdatedEvent.Type;
829​
830export const ServerConfigStreamProviderStatusesEvent = Schema.Struct({
831 version: Schema.Literal(1),
832 type: Schema.Literal("providerStatuses"),
833 payload: ServerConfigProviderStatusesPayload,
834});
835export type ServerConfigStreamProviderStatusesEvent =
836 typeof ServerConfigStreamProviderStatusesEvent.Type;
837​
838export const ServerConfigStreamSettingsUpdatedEvent = Schema.Struct({
839 version: Schema.Literal(1),
840 type: Schema.Literal("settingsUpdated"),
841 payload: ServerConfigSettingsUpdatedPayload,
842});
843export type ServerConfigStreamSettingsUpdatedEvent =
844 typeof ServerConfigStreamSettingsUpdatedEvent.Type;
845​
846export const ServerConfigEnvironmentThemesUpdatedPayload = Schema.Struct({
847 /** The full published set; empty once the machine publishes none. */
848 themes: Schema.Array(EnvironmentTheme),
849});
850export type ServerConfigEnvironmentThemesUpdatedPayload =
851 typeof ServerConfigEnvironmentThemesUpdatedPayload.Type;
852​
853export const ServerConfigStreamEnvironmentThemesUpdatedEvent = Schema.Struct({
854 version: Schema.Literal(1),
855 type: Schema.Literal("environmentThemesUpdated"),
856 payload: ServerConfigEnvironmentThemesUpdatedPayload,
857});
858export type ServerConfigStreamEnvironmentThemesUpdatedEvent =
859 typeof ServerConfigStreamEnvironmentThemesUpdatedEvent.Type;
860​
861export const ServerConfigUsageLimitSourcesUpdatedPayload = Schema.Struct({
862 /** The full set; empty once no source is configured. */
863 sources: UsageLimitSourceSnapshots,
864});
865export type ServerConfigUsageLimitSourcesUpdatedPayload =
866 typeof ServerConfigUsageLimitSourcesUpdatedPayload.Type;
867​
868export const ServerConfigStreamUsageLimitSourcesUpdatedEvent = Schema.Struct({
869 version: Schema.Literal(1),
870 type: Schema.Literal("usageLimitSourcesUpdated"),
871 payload: ServerConfigUsageLimitSourcesUpdatedPayload,
872});
873export type ServerConfigStreamUsageLimitSourcesUpdatedEvent =
874 typeof ServerConfigStreamUsageLimitSourcesUpdatedEvent.Type;
875​
876export const ServerConfigStreamEvent = Schema.Union([
877 ServerConfigStreamSnapshotEvent,
878 ServerConfigStreamKeybindingsUpdatedEvent,
879 ServerConfigStreamProviderStatusesEvent,
880 ServerConfigStreamSettingsUpdatedEvent,
881 ServerConfigStreamEnvironmentThemesUpdatedEvent,
882 ServerConfigStreamUsageLimitSourcesUpdatedEvent,
883]);
884export type ServerConfigStreamEvent = typeof ServerConfigStreamEvent.Type;
885​
886/** Terminal selection recorded by the service launcher for one update. */
887export const ServerSelfUpdateOutcome = Schema.Struct({
888 id: TrimmedNonEmptyString,
889 fromVersion: TrimmedNonEmptyString,
890 targetVersion: TrimmedNonEmptyString,
891 status: Schema.Literals(["committed", "rolled-back", "failed"]),
892 reason: Schema.optionalKey(TrimmedNonEmptyString),
893});
894export type ServerSelfUpdateOutcome = typeof ServerSelfUpdateOutcome.Type;
895​
896export const ServerLifecycleReadyPayload = Schema.Struct({
897 at: IsoDateTime,
898 environment: ExecutionEnvironmentDescriptor,
899 /** Present when this process resumed a launcher-managed update. */
900 updateOutcome: Schema.optionalKey(ServerSelfUpdateOutcome),
901});
902export type ServerLifecycleReadyPayload = typeof ServerLifecycleReadyPayload.Type;
903​
904export const ServerLifecycleWelcomePayload = Schema.Struct({
905 environment: ExecutionEnvironmentDescriptor,
906 cwd: TrimmedNonEmptyString,
907 projectName: TrimmedNonEmptyString,
908 bootstrapStatus: Schema.optional(Schema.Literals(["pending", "complete"])),
909 bootstrapProjectId: Schema.optional(ProjectId),
910 bootstrapThreadId: Schema.optional(ThreadId),
911 bootstrapProjectCreated: Schema.optional(Schema.Boolean),
912 bootstrapThreadCreated: Schema.optional(Schema.Boolean),
913});
914export type ServerLifecycleWelcomePayload = typeof ServerLifecycleWelcomePayload.Type;
915​
916export const ServerLifecycleLegacyThreadMigrationPayload = Schema.Struct({
917 status: Schema.Union([Schema.Literal("running"), Schema.Literal("complete")]),
918 totalThreadCount: NonNegativeInt,
919});
920export type ServerLifecycleLegacyThreadMigrationPayload =
921 typeof ServerLifecycleLegacyThreadMigrationPayload.Type;
922​
923export const ServerLifecycleStreamWelcomeEvent = Schema.Struct({
924 version: Schema.Literal(1),
925 sequence: NonNegativeInt,
926 type: Schema.Literal("welcome"),
927 payload: ServerLifecycleWelcomePayload,
928});
929export type ServerLifecycleStreamWelcomeEvent = typeof ServerLifecycleStreamWelcomeEvent.Type;
930​
931export const ServerLifecycleStreamReadyEvent = Schema.Struct({
932 version: Schema.Literal(1),
933 sequence: NonNegativeInt,
934 type: Schema.Literal("ready"),
935 payload: ServerLifecycleReadyPayload,
936});
937export type ServerLifecycleStreamReadyEvent = typeof ServerLifecycleStreamReadyEvent.Type;
938​
939export const ServerLifecycleStreamLegacyThreadMigrationEvent = Schema.Struct({
940 version: Schema.Literal(1),
941 sequence: NonNegativeInt,
942 type: Schema.Literal("legacyThreadMigration"),
943 payload: ServerLifecycleLegacyThreadMigrationPayload,
944});
945export type ServerLifecycleStreamLegacyThreadMigrationEvent =
946 typeof ServerLifecycleStreamLegacyThreadMigrationEvent.Type;
947​
948export const ServerLifecycleStreamEvent = Schema.Union([
949 ServerLifecycleStreamWelcomeEvent,
950 ServerLifecycleStreamReadyEvent,
951 ServerLifecycleStreamLegacyThreadMigrationEvent,
952]);
953export type ServerLifecycleStreamEvent = typeof ServerLifecycleStreamEvent.Type;
954​
955export const ServerProviderUpdatedPayload = Schema.Struct({
956 providers: ServerProviders,
957});
958export type ServerProviderUpdatedPayload = typeof ServerProviderUpdatedPayload.Type;
959​
960export const ServerProviderUpdateInput = Schema.Struct({
961 provider: ProviderDriverKind,
962 targetVersion: Schema.optionalKey(TrimmedNonEmptyString),
963 instanceId: Schema.optionalKey(ProviderInstanceId),
964});
965export type ServerProviderUpdateInput = typeof ServerProviderUpdateInput.Type;
966​
967export class ServerProviderUpdateError extends Schema.TaggedError<ServerProviderUpdateError>()(
968 "ServerProviderUpdateError",
969 {
970 provider: ProviderDriverKind,
971 reason: TrimmedNonEmptyString,
972 cause: Schema.optional(Schema.Defect()),
973 },
974) {
975 override get message(): string {
976 return `Provider update failed for ${this.provider}: ${this.reason}`;
977 }
979​
980export const ServerSelfUpdateInput = Schema.Struct({
981 /** Exact npm version of the `t3` package to install (never a dist-tag, so
982 the server and the acknowledging client agree on what was requested). */
983 targetVersion: TrimmedNonEmptyString,
984 /** Opt-in recovery for provider turns that are running when the server
985 hands off to its replacement. Missing and false keep restart behavior
986 conservative under version skew. */
987 continueRunningThreads: Schema.optionalKey(Schema.Boolean),
988});
989export type ServerSelfUpdateInput = typeof ServerSelfUpdateInput.Type;
990​
991/** Acknowledgement that the update artifact is installed and the server is
992 about to restart into it — the connection will drop moments later. */
993export const ServerSelfUpdateResult = Schema.Struct({
994 targetVersion: TrimmedNonEmptyString,
995 method: ServerSelfUpdateMethod,
996 /** Launcher-generated correlation ID. Absent when talking to older servers. */
997 updateId: Schema.optionalKey(TrimmedNonEmptyString),
998 /** Desktop preparation token. Present only for the desktop-app method. */
999 desktopUpdateToken: Schema.optionalKey(TrimmedNonEmptyString),
1000});
1001export type ServerSelfUpdateResult = typeof ServerSelfUpdateResult.Type;
1002​
1003export const DesktopUpdateCommitInput = Schema.Struct({
1004 requestId: TrimmedNonEmptyString,
1005});
1006export type DesktopUpdateCommitInput = typeof DesktopUpdateCommitInput.Type;
1007​
1008export const ServerSelfUpdateProgressStage = Schema.Literals(["downloading", "installing"]);
1009export type ServerSelfUpdateProgressStage = typeof ServerSelfUpdateProgressStage.Type;
1010​
1011export const ServerSelfUpdateProgressEvent = Schema.Union([
1012 Schema.Struct({
1013 type: Schema.Literal("progress"),
1014 stage: ServerSelfUpdateProgressStage,
1015 }),
1016 Schema.Struct({
1017 type: Schema.Literal("complete"),
1018 result: ServerSelfUpdateResult,
1019 }),
1020]);
1021export type ServerSelfUpdateProgressEvent = typeof ServerSelfUpdateProgressEvent.Type;
1022​
1023export class ServerSelfUpdateError extends Schema.TaggedError<ServerSelfUpdateError>()(
1024 "ServerSelfUpdateError",
1026 reason: TrimmedNonEmptyString,
1027 cause: Schema.optional(Schema.Defect()),
1028 },
1029) {
1030 override get message(): string {
1031 return `Server update failed: ${this.reason}`;