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

desktopBootstrap.ts

34 lines1.5 KB

1import * as Schema from "effect/Schema";
2​
3import { PortSchema, PositiveInt, TrimmedNonEmptyString } from "./baseSchemas.ts";
4​
5// A supervisor must not restart a server refused by the state-directory owner.
6export const SERVER_EXIT_CODE_STATE_DIR_OWNED = 78;
7​
8export const DesktopBackendBootstrap = Schema.Struct({
9 mode: Schema.Literal("desktop"),
10 noBrowser: Schema.Boolean,
11 port: PortSchema,
12 // Omitted when the desktop launches the backend inside WSL, since the
13 // Windows-side baseDir maps to /mnt/c/... and the Linux side should use its
14 // own home directory instead.
15 t3Home: Schema.optional(Schema.String),
16 host: Schema.String,
17 desktopBootstrapToken: Schema.String,
18 tailscaleServeEnabled: Schema.Boolean,
19 tailscaleServePort: PortSchema,
20 otlpTracesUrl: Schema.optional(Schema.String),
21 otlpMetricsUrl: Schema.optional(Schema.String),
22 otlpLogsUrl: Schema.optional(Schema.String),
23 desktopTelemetryFd: Schema.optionalKey(PositiveInt),
24 desktopTelemetryControlFd: Schema.optionalKey(PositiveInt),
25 resourceMonitorPath: Schema.optionalKey(TrimmedNonEmptyString),
26});
27​
28export type DesktopBackendBootstrap = typeof DesktopBackendBootstrap.Type;
29​
30/** Written to `<t3Home>/runtime` just before the desktop app stops its
31 backend to install an update. The updated app starts a new backend right
32 away, so a backend that sees a fresh marker at shutdown keeps its managed
33 tunnel. */
34export const DESKTOP_UPDATE_RESTART_MARKER_FILE = "desktop-update-restart";