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

desktopBootstrap.ts

35 lines1.7 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 // Omit in WSL to use the Linux home instead of the mapped Windows directory.
13 t3Home: Schema.optional(Schema.String),
14 host: Schema.String,
15 desktopBootstrapToken: Schema.String,
16 // Derives rotating tokens instead of trusting desktopBootstrapToken indefinitely; see @t3tools/shared/desktopBootstrapToken.
17 desktopBootstrapSecret: Schema.optionalKey(Schema.String),
18 // Absent means the backend must hydrate PATH, as WSL and older desktops require.
19 shellEnvironmentPrepared: Schema.optionalKey(Schema.Boolean),
20 tailscaleServeEnabled: Schema.Boolean,
21 tailscaleServePort: PortSchema,
22 otlpTracesUrl: Schema.optional(Schema.String),
23 otlpMetricsUrl: Schema.optional(Schema.String),
24 otlpLogsUrl: Schema.optional(Schema.String),
25 desktopTelemetryFd: Schema.optionalKey(PositiveInt),
26 desktopTelemetryControlFd: Schema.optionalKey(PositiveInt),
27 desktopBrowserFd: Schema.optionalKey(PositiveInt),
28 desktopBrowserControlFd: Schema.optionalKey(PositiveInt),
29 resourceMonitorPath: Schema.optionalKey(TrimmedNonEmptyString),
30});
31​
32export type DesktopBackendBootstrap = typeof DesktopBackendBootstrap.Type;
33​
34/** Written to `<t3Home>/runtime` before update shutdown so the backend retains its managed tunnel. */
35export const DESKTOP_UPDATE_RESTART_MARKER_FILE = "desktop-update-restart";