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

ipc.ts

1,209 lines40.7 KB

1import * as Schema from "effect/Schema";
2import type { PreviewCaptureFailureEncoded } from "./previewCapture.ts";
3​
4import { SnapShotSource } from "./chatAttachment.ts";
5import { EnvironmentId, TrimmedNonEmptyString } from "./baseSchemas.ts";
6import { BrowserProfileId } from "./browserProfile.ts";
7import type {
8 BrowserImportResult,
9 BrowserImportSource,
10 BrowserImportSourceId,
11} from "./browserImport.ts";
12import { AuthAccessTokenResult, AuthSessionState } from "./auth.ts";
13import { AdvertisedEndpoint } from "./remoteAccess.ts";
14import { ExecutionEnvironmentDescriptor } from "./environment.ts";
15import { type ClientSettings, type QuitConfirmationMode, SnapShotShortcut } from "./settings.ts";
16import type { EditorId } from "./editor.ts";
17import type { PreviewForwardedShortcut } from "./keybindings.ts";
18​
19import type {
20 DesktopAppActivationRequest,
21 DesktopAppActivationResponse,
22} from "./desktopAppActivation.ts";
23​
24export interface ContextMenuItem<T extends string = string> {
25 id: T;
26 label: string;
27 destructive?: boolean;
28 disabled?: boolean;
29 header?: boolean;
30 icon?: string;
31 separatorBefore?: boolean;
32 checked?: boolean;
33 children?: readonly ContextMenuItem<T>[];
35​
36export type QuitShortcutHintEvent =
37 | { readonly state: "down"; readonly mode: Exclude<QuitConfirmationMode, "direct"> }
38 | { readonly state: "up" };
39​
40export interface ContextMenuItemSchemaType {
41 readonly id: string;
42 readonly label: string;
43 readonly destructive?: boolean;
44 readonly disabled?: boolean;
45 readonly header?: boolean;
46 readonly icon?: string;
47 readonly separatorBefore?: boolean;
48 readonly checked?: boolean;
49 readonly children?: readonly ContextMenuItemSchemaType[];
51​
52export const ContextMenuItemSchema: Schema.Codec<ContextMenuItemSchemaType> = Schema.Struct({
53 id: Schema.String,
54 label: Schema.String,
55 destructive: Schema.optionalKey(Schema.Boolean),
56 disabled: Schema.optionalKey(Schema.Boolean),
57 header: Schema.optionalKey(Schema.Boolean),
58 icon: Schema.optionalKey(Schema.String),
59 separatorBefore: Schema.optionalKey(Schema.Boolean),
60 checked: Schema.optionalKey(Schema.Boolean),
61 children: Schema.optionalKey(
62 Schema.Array(
63 Schema.suspend((): Schema.Codec<ContextMenuItemSchemaType> => ContextMenuItemSchema),
64 ),
65 ),
66});
67​
68export type DesktopUpdateStatus =
69 | "disabled"
70 | "idle"
71 | "checking"
72 | "up-to-date"
73 | "available"
74 | "downloading"
75 | "downloaded"
76 | "error";
77​
78export type DesktopRuntimeArch = "arm64" | "x64" | "other";
79export type DesktopTheme = "light" | "dark" | "system";
80export type DesktopUpdateChannel = "latest" | "nightly";
81export type DesktopAppStageLabel = "Alpha" | "Beta" | "Dev" | "Nightly";
82​
83export const DesktopUpdateStatusSchema = Schema.Literals([
84 "disabled",
85 "idle",
86 "checking",
87 "up-to-date",
88 "available",
89 "downloading",
90 "downloaded",
91 "error",
92]);
93export const DesktopRuntimeArchSchema = Schema.Literals(["arm64", "x64", "other"]);
94export const DesktopThemeSchema = Schema.Literals(["light", "dark", "system"]);
95export const DesktopUpdateChannelSchema = Schema.Literals(["latest", "nightly"]);
96export const DesktopAppStageLabelSchema = Schema.Literals(["Alpha", "Beta", "Dev", "Nightly"]);
97​
98export interface DesktopAppBranding {
99 baseName: string;
100 stageLabel: DesktopAppStageLabel;
101 displayName: string;
103​
104export const DesktopAppBrandingSchema = Schema.Struct({
105 baseName: Schema.String,
106 stageLabel: DesktopAppStageLabelSchema,
107 displayName: Schema.String,
108});
109​
110export const DesktopSnapShotMode = Schema.Literals(["direct", "portal", "unavailable"]);
111export type DesktopSnapShotMode = typeof DesktopSnapShotMode.Type;
112​
113export const DesktopCaptureExtensionState = Schema.Struct({
114 status: Schema.Literals([
115 "not-installed",
116 "disabled",
117 "enabled",
118 "restart-required",
119 "update-required",
120 "extensions-disabled",
121 "unsupported",
122 "error",
123 ]),
124 message: Schema.String,
125});
126export type DesktopCaptureExtensionState = typeof DesktopCaptureExtensionState.Type;
127​
128export const DesktopCaptureHelperState = Schema.Struct({
129 status: Schema.Literals(["not-installed", "update-required", "ready", "error"]),
130 message: Schema.String,
131 feedbackAvailable: Schema.optional(Schema.Boolean),
132});
133export type DesktopCaptureHelperState = typeof DesktopCaptureHelperState.Type;
134​
135export const DesktopSnapShotSetupAction = Schema.Literals([
136 "install-extension",
137 "enable-extension",
138 "disable-extension",
139 "install-kde-helper",
140 "remove-kde-helper",
141 "install-hyprland-helper",
142 "remove-hyprland-helper",
143 "test-mac-capture",
144 "allow-screen-recording",
145 "allow-accessibility",
146 "retry-shortcut",
147]);
148export type DesktopSnapShotSetupAction = typeof DesktopSnapShotSetupAction.Type;
149​
150export const DesktopCaptureConfigRequest = Schema.Struct({
151 operation: Schema.Literals(["install", "remove"]),
152 chooseFile: Schema.Boolean,
153 shortcut: Schema.optional(Schema.String.check(Schema.isMaxLength(80))),
154});
155export type DesktopCaptureConfigRequest = typeof DesktopCaptureConfigRequest.Type;
156​
157export const DesktopCaptureConfigPreview = Schema.Struct({
158 id: Schema.String,
159 path: Schema.String,
160 resolvedPath: Schema.String,
161 before: Schema.String,
162 after: Schema.String,
163 shortcut: Schema.String,
164 operation: Schema.Literals(["install", "remove"]),
165});
166export type DesktopCaptureConfigPreview = typeof DesktopCaptureConfigPreview.Type;
167​
168export const DesktopCaptureConfigApplied = Schema.Struct({
169 backupPath: Schema.NullOr(Schema.String),
170 warning: Schema.NullOr(Schema.String),
171});
172export type DesktopCaptureConfigApplied = typeof DesktopCaptureConfigApplied.Type;
173​
174export const DesktopSnapShotState = Schema.Struct({
175 mode: DesktopSnapShotMode,
176 windows: Schema.optional(Schema.Boolean),
177 linuxDesktop: Schema.optional(Schema.Literals(["gnome", "kde", "niri", "hyprland"])),
178 linuxBackend: Schema.optional(
179 Schema.Literals(["screenshot-portal", "gnome-extension", "niri", "kde", "hyprland", "picker"]),
180 ),
181 linuxFeedbackAvailable: Schema.optional(Schema.Boolean),
182 shortcut: SnapShotShortcut,
183 shortcutRegistered: Schema.Boolean,
184 shortcutPending: Schema.optional(Schema.Boolean),
185 shortcutCanRetry: Schema.optional(Schema.Boolean),
186 shortcutLabel: Schema.optional(Schema.String),
187 shortcutMessage: Schema.NullOr(Schema.String),
188 shortcutBinding: Schema.optional(Schema.String),
189 shortcutConfigPath: Schema.optional(Schema.String),
190 shortcutActionRegistered: Schema.optional(Schema.Boolean),
191 gnomeExtension: Schema.optional(DesktopCaptureExtensionState),
192 kdeHelper: Schema.optional(DesktopCaptureHelperState),
193 hyprlandHelper: Schema.optional(DesktopCaptureHelperState),
194 macPermissions: Schema.optional(
195 Schema.Struct({ screenRecording: Schema.Boolean, accessibility: Schema.Boolean }),
196 ),
197 shortcutVerified: Schema.optional(Schema.Boolean),
198 message: Schema.NullOr(Schema.String),
199});
200export type DesktopSnapShotState = typeof DesktopSnapShotState.Type;
201​
202export const DesktopSnapShotShortcutAvailability = Schema.Struct({
203 available: Schema.Boolean,
204 message: Schema.NullOr(Schema.String),
205});
206export type DesktopSnapShotShortcutAvailability = typeof DesktopSnapShotShortcutAvailability.Type;
207​
208export const DesktopSnapShotId = TrimmedNonEmptyString.check(
209 Schema.isMaxLength(64),
210 Schema.isPattern(/^[a-f0-9-]+$/i),
211);
212export type DesktopSnapShotId = typeof DesktopSnapShotId.Type;
213​
214/** `id` is absent for failures before a capture exists. */
215export const DesktopSnapShotEvent = Schema.Union([
216 Schema.Struct({ type: Schema.Literal("requested"), id: DesktopSnapShotId }),
217 Schema.Struct({ type: Schema.Literal("started"), id: DesktopSnapShotId }),
218 Schema.Struct({ type: Schema.Literal("ready"), id: DesktopSnapShotId }),
219 Schema.Struct({ type: Schema.Literal("failed"), id: Schema.optional(DesktopSnapShotId) }),
220 Schema.Struct({ type: Schema.Literal("shortcut-changed") }),
221]);
222export type DesktopSnapShotEvent = typeof DesktopSnapShotEvent.Type;
223​
224export const DesktopPendingSnapShot = Schema.Struct({
225 id: DesktopSnapShotId,
226 name: Schema.String,
227 mimeType: Schema.Literal("image/png"),
228 sizeBytes: Schema.Int,
229 source: SnapShotSource,
230});
231export type DesktopPendingSnapShot = typeof DesktopPendingSnapShot.Type;
232​
233export const DesktopSnapShot = Schema.Struct({
234 ...DesktopPendingSnapShot.fields,
235 dataUrl: Schema.String,
236});
237export type DesktopSnapShot = typeof DesktopSnapShot.Type;
238​
239export const DesktopSnapShotAnimationDestination = Schema.Struct({
240 id: DesktopSnapShotId,
241 viewportFrame: Schema.Struct({
242 x: Schema.Number,
243 y: Schema.Number,
244 width: Schema.Number,
245 height: Schema.Number,
246 }),
247 backgroundColor: Schema.String,
248 borderColor: Schema.String,
249 borderWidth: Schema.Number,
250 cornerRadius: Schema.Number,
251 details: Schema.optional(
252 Schema.Struct({
253 appName: SnapShotSource.fields.appName,
254 windowTitle: SnapShotSource.fields.windowTitle,
255 appIconDataUrl: SnapShotSource.fields.appIconDataUrl,
256 }),
257 ),
258});
259export type DesktopSnapShotAnimationDestination = typeof DesktopSnapShotAnimationDestination.Type;
260​
261export interface DesktopRuntimeInfo {
262 hostArch: DesktopRuntimeArch;
263 appArch: DesktopRuntimeArch;
264 runningUnderArm64Translation: boolean;
266​
267export interface DesktopUpdateState {
268 enabled: boolean;
269 status: DesktopUpdateStatus;
270 channel: DesktopUpdateChannel;
271 currentVersion: string;
272 hostArch: DesktopRuntimeArch;
273 appArch: DesktopRuntimeArch;
274 runningUnderArm64Translation: boolean;
275 availableVersion: string | null;
276 downloadedVersion: string | null;
277 releaseNotes: ReadonlyArray<DesktopUpdateReleaseNote>;
278 omittedReleaseCount: number;
279 downloadPercent: number | null;
280 checkedAt: string | null;
281 message: string | null;
282 errorContext: "check" | "download" | "install" | null;
283 canRetry: boolean;
284 notAppliedVersion?: string;
286​
287export interface DesktopUpdateReleaseNote {
288 version: string;
289 items: ReadonlyArray<string>;
290 totalItems: number;
292​
293export const DesktopUpdateReleaseNoteSchema = Schema.Struct({
294 version: Schema.String,
295 items: Schema.Array(Schema.String),
296 totalItems: Schema.Number,
297});
298​
299export const DesktopUpdateStateSchema = Schema.Struct({
300 enabled: Schema.Boolean,
301 status: DesktopUpdateStatusSchema,
302 channel: DesktopUpdateChannelSchema,
303 currentVersion: Schema.String,
304 hostArch: DesktopRuntimeArchSchema,
305 appArch: DesktopRuntimeArchSchema,
306 runningUnderArm64Translation: Schema.Boolean,
307 availableVersion: Schema.NullOr(Schema.String),
308 downloadedVersion: Schema.NullOr(Schema.String),
309 releaseNotes: Schema.Array(DesktopUpdateReleaseNoteSchema),
310 omittedReleaseCount: Schema.Number,
311 downloadPercent: Schema.NullOr(Schema.Number),
312 checkedAt: Schema.NullOr(Schema.String),
313 message: Schema.NullOr(Schema.String),
314 errorContext: Schema.NullOr(Schema.Literals(["check", "download", "install"])),
315 canRetry: Schema.Boolean,
316 notAppliedVersion: Schema.optionalKey(Schema.String),
317});
318​
319export const DesktopCliCommandStateSchema = Schema.Struct({
320 supported: Schema.Boolean,
321 installedPath: Schema.NullOr(Schema.String),
322 onPath: Schema.Boolean,
323 shadowedBy: Schema.optionalKey(Schema.String),
324 /** The app's bundled `t3` launcher, which runs without Node or a PATH entry. */
325 launcherPath: Schema.NullOr(Schema.String),
326});
327export type DesktopCliCommandState = typeof DesktopCliCommandStateSchema.Type;
328​
329export interface DesktopUpdateActionResult {
330 accepted: boolean;
331 completed: boolean;
332 state: DesktopUpdateState;
334​
335export const DesktopUpdateActionResultSchema = Schema.Struct({
336 accepted: Schema.Boolean,
337 completed: Schema.Boolean,
338 state: DesktopUpdateStateSchema,
339});
340​
341export interface DesktopUpdateCheckResult {
342 checked: boolean;
343 state: DesktopUpdateState;
345​
346export const DesktopUpdateCheckResultSchema = Schema.Struct({
347 checked: Schema.Boolean,
348 state: DesktopUpdateStateSchema,
349});
350​
351export const PRIMARY_LOCAL_ENVIRONMENT_ID = "primary";
352​
353export interface DesktopEnvironmentBootstrap {
354 // Stable backend identity used to reopen routed projects.
355 id: string;
356 label: string;
357 // Actual distro for this run; id stays wsl:default when tracking the default.
358 runningDistro?: string | null;
359 httpBaseUrl: string | null;
360 wsBaseUrl: string | null;
361 bootstrapToken?: string;
363​
364export const DesktopEnvironmentBootstrapSchema = Schema.Struct({
365 id: Schema.String,
366 label: Schema.String,
367 runningDistro: Schema.optionalKey(Schema.NullOr(Schema.String)),
368 httpBaseUrl: Schema.NullOr(Schema.String),
369 wsBaseUrl: Schema.NullOr(Schema.String),
370 bootstrapToken: Schema.optionalKey(Schema.String),
371});
372​
373export const DesktopSshEnvironmentTargetSchema = Schema.Struct({
374 alias: Schema.String,
375 hostname: Schema.String,
376 username: Schema.NullOr(Schema.String),
377 port: Schema.NullOr(Schema.Number),
378});
379export type DesktopSshEnvironmentTarget = typeof DesktopSshEnvironmentTargetSchema.Type;
380​
381export type DesktopSshHostSource = "ssh-config" | "known-hosts";
382export const DesktopSshHostSourceSchema = Schema.Literals(["ssh-config", "known-hosts"]);
383​
384export interface DesktopDiscoveredSshHost extends DesktopSshEnvironmentTarget {
385 source: DesktopSshHostSource;
387​
388export const DesktopDiscoveredSshHostSchema = Schema.Struct({
389 alias: Schema.String,
390 hostname: Schema.String,
391 username: Schema.NullOr(Schema.String),
392 port: Schema.NullOr(Schema.Number),
393 source: DesktopSshHostSourceSchema,
394});
395​
396export interface DesktopSshEnvironmentBootstrap {
397 target: DesktopSshEnvironmentTarget;
398 httpBaseUrl: string;
399 wsBaseUrl: string;
400 pairingToken: string | null;
401 remotePort?: number;
402 remoteServerKind?: "external" | "managed";
404​
405export const DesktopSshEnvironmentBootstrapSchema = Schema.Struct({
406 target: DesktopSshEnvironmentTargetSchema,
407 httpBaseUrl: Schema.String,
408 wsBaseUrl: Schema.String,
409 pairingToken: Schema.NullOr(Schema.String),
410 remotePort: Schema.optionalKey(Schema.Number),
411 remoteServerKind: Schema.optionalKey(Schema.Literals(["external", "managed"])),
412});
413​
414export interface DesktopSshPasswordPromptRequest {
415 requestId: string;
416 destination: string;
417 username: string | null;
418 prompt: string;
419 expiresAt: string;
421​
422export const DesktopSshPasswordPromptCancelledType = "ssh-password-prompt-cancelled" as const;
423​
424export const DesktopSshPasswordPromptCancelledResultSchema = Schema.Struct({
425 type: Schema.Literal(DesktopSshPasswordPromptCancelledType),
426 message: Schema.String,
427});
428​
429export const DesktopSshEnvironmentEnsureOptionsSchema = Schema.Struct({
430 issuePairingToken: Schema.optionalKey(Schema.Boolean),
431});
432​
433export const DesktopSshEnvironmentEnsureInputSchema = Schema.Struct({
434 target: DesktopSshEnvironmentTargetSchema,
435 options: Schema.optionalKey(DesktopSshEnvironmentEnsureOptionsSchema),
436});
437​
438export const DesktopSshEnvironmentEnsureResultSchema = Schema.Union([
439 DesktopSshEnvironmentBootstrapSchema,
440 DesktopSshPasswordPromptCancelledResultSchema,
441]);
442​
443export const DesktopSshHttpBaseUrlInputSchema = Schema.Struct({
444 httpBaseUrl: Schema.String,
445});
446​
447export const DesktopSshBearerRequestInputSchema = Schema.Struct({
448 httpBaseUrl: Schema.String,
449 bearerToken: Schema.String,
450});
451​
452export const DesktopSshBearerBootstrapInputSchema = Schema.Struct({
453 httpBaseUrl: Schema.String,
454 credential: Schema.String,
455});
456​
457export const DesktopSshPasswordPromptResolutionInputSchema = Schema.Struct({
458 requestId: Schema.String,
459 password: Schema.NullOr(Schema.String),
460});
461​
462export const PersistedSavedEnvironmentRecordSchema = Schema.Struct({
463 environmentId: EnvironmentId,
464 label: Schema.String,
465 wsBaseUrl: Schema.String,
466 httpBaseUrl: Schema.String,
467 createdAt: Schema.String,
468 lastConnectedAt: Schema.NullOr(Schema.String),
469 desktopSsh: Schema.optionalKey(DesktopSshEnvironmentTargetSchema),
470 relayManaged: Schema.optionalKey(
471 Schema.Struct({
472 relayUrl: Schema.String,
473 }),
474 ),
475});
476export type PersistedSavedEnvironmentRecord = typeof PersistedSavedEnvironmentRecordSchema.Type;
477​
478export type DesktopServerExposureMode = "local-only" | "network-accessible";
479​
480export const DesktopServerExposureModeSchema = Schema.Literals([
481 "local-only",
482 "network-accessible",
483]);
484​
485export interface DesktopServerExposureState {
486 mode: DesktopServerExposureMode;
487 endpointUrl: string | null;
488 advertisedHost: string | null;
489 tailscaleServeEnabled: boolean;
490 tailscaleServePort: number;
492​
493export const DesktopServerExposureStateSchema = Schema.Struct({
494 mode: DesktopServerExposureModeSchema,
495 endpointUrl: Schema.NullOr(Schema.String),
496 advertisedHost: Schema.NullOr(Schema.String),
497 tailscaleServeEnabled: Schema.Boolean,
498 tailscaleServePort: Schema.Number,
499});
500​
501export interface PickFolderOptions {
502 initialPath?: string | null;
503 targetEnvironmentId?: string;
505​
506export const PickFolderOptionsSchema = Schema.Struct({
507 initialPath: Schema.optionalKey(Schema.NullOr(Schema.String)),
508 targetEnvironmentId: Schema.optionalKey(Schema.String),
509});
510​
511/** Oversized files have empty text so the main process never loads their contents. */
512export interface PickedThemeFile {
513 name: string;
514 size: number;
515 text: string;
517​
518export const PickedThemeFileSchema = Schema.Struct({
519 name: Schema.String,
520 size: Schema.Number,
521 text: Schema.String,
522});
523​
524export interface DesktopWslDistro {
525 name: string;
526 isDefault: boolean;
527 version: 1 | 2;
529​
530export const DesktopWslDistroSchema = Schema.Struct({
531 name: Schema.String,
532 isDefault: Schema.Boolean,
533 version: Schema.Literals([1, 2]),
534});
535​
536export interface DesktopWslState {
537 enabled: boolean;
538 // null means "track the current WSL default distro".
539 distro: string | null;
540 available: boolean;
541 wslOnly: boolean;
542 distros: readonly DesktopWslDistro[];
543 // Always null in wsl-only mode, which falls back to Windows with a dialog.
544 preflightError: string | null;
546​
547export const DesktopWslStateSchema = Schema.Struct({
548 enabled: Schema.Boolean,
549 distro: Schema.NullOr(Schema.String),
550 available: Schema.Boolean,
551 wslOnly: Schema.Boolean,
552 distros: Schema.Array(DesktopWslDistroSchema),
553 preflightError: Schema.NullOr(Schema.String),
554});
555​
556export type DesktopPreviewNavStatus =
557 | { kind: "Idle" }
558 | { kind: "Loading"; url: string; title: string }
559 | { kind: "Success"; url: string; title: string }
560 | {
561 kind: "LoadFailed";
562 url: string;
563 title: string;
564 code: number;
565 description: string;
566 };
567​
568export type DesktopPreviewColorScheme = "system" | "light" | "dark";
569​
570export const DesktopPreviewColorSchemeSchema: Schema.Codec<DesktopPreviewColorScheme> =
571 Schema.Literals(["system", "light", "dark"]);
572​
573export const FAVICON_DATA_URL_MAX_LENGTH = 8192;
574export const FAVICON_CAPTURED_AT_MAX = 8_640_000_000_000_000;
575​
576export interface DesktopPreviewFavicon {
577 dataUrl: string;
578 pageUrl: string;
579 capturedAt: number;
581​
582export interface DesktopPreviewTabState {
583 tabId: string;
584 webContentsId: number | null;
585 navStatus: DesktopPreviewNavStatus;
586 canGoBack: boolean;
587 canGoForward: boolean;
588 zoomFactor: number;
589 pictureInPicture: boolean;
590 colorScheme: DesktopPreviewColorScheme;
591 audioMuted: boolean;
592 /** Chromium reports playback even when audioMuted is true. */
593 audible: boolean;
594 controller: "human" | "agent" | "none";
595 /** A screenshot or stream of the guest is pending, so the client keeps it painting while hidden. */
596 capturing: boolean;
597 favicon?: DesktopPreviewFavicon;
598 updatedAt: string;
600​
601export const DesktopPreviewTabIdSchema = Schema.String.check(Schema.isTrimmed()).check(
602 Schema.isNonEmpty(),
603);
604​
605export interface DesktopPreviewPointerEvent {
606 tabId: string;
607 phase: "move" | "click";
608 x: number;
609 y: number;
610 sequence: number;
611 createdAt: string;
613​
614export interface DesktopPreviewOpenLinkEvent {
615 tabId: string;
616 url: string;
617 background: boolean;
619​
620export const DesktopPreviewRecordingInputSchema = Schema.Union([
621 Schema.Struct({
622 type: Schema.Literal("pointer"),
623 phase: Schema.Literals(["move", "down", "up", "click"]),
624 x: Schema.Finite,
625 y: Schema.Finite,
626 width: Schema.Finite.check(Schema.isGreaterThan(0)),
627 height: Schema.Finite.check(Schema.isGreaterThan(0)),
628 }),
629 Schema.Struct({
630 type: Schema.Literal("key"),
631 label: Schema.NullOr(Schema.String.check(Schema.isMaxLength(100))),
632 held: Schema.Boolean,
633 width: Schema.Finite.check(Schema.isGreaterThan(0)),
634 }),
635 Schema.Struct({ type: Schema.Literal("clear") }),
636]);
637export type DesktopPreviewRecordingInput = typeof DesktopPreviewRecordingInputSchema.Type;
638export interface DesktopPreviewRecordingInputEvent {
639 readonly tabId: string;
640 readonly input: DesktopPreviewRecordingInput;
642​
643export interface DesktopPreviewWebviewConfig {
644 partition: string;
645 /** Sandboxed with contextIsolation off so the picker preload can read the React DevTools hook. */
646 webPreferences: string;
647 /** Absolute file:// preload URL; null requires disabling element picking. */
648 preloadUrl: string | null;
650​
651export const DesktopPreviewWebviewConfigSchema: Schema.Codec<DesktopPreviewWebviewConfig> =
652 Schema.Struct({
653 partition: Schema.String,
654 webPreferences: Schema.String,
655 preloadUrl: Schema.NullOr(Schema.String),
656 });
657​
658export interface DesktopPreviewAnnotationTheme {
659 colorScheme: "light" | "dark";
660 radius: string;
661 background: string;
662 foreground: string;
663 popover: string;
664 popoverForeground: string;
665 primary: string;
666 primaryForeground: string;
667 muted: string;
668 mutedForeground: string;
669 accent: string;
670 accentForeground: string;
671 border: string;
672 input: string;
673 ring: string;
674 fontSans: string;
675 fontMono: string;
677​
678export const DesktopPreviewAnnotationThemeSchema: Schema.Codec<DesktopPreviewAnnotationTheme> =
679 Schema.Struct({
680 colorScheme: Schema.Literals(["light", "dark"]),
681 radius: Schema.String,
682 background: Schema.String,
683 foreground: Schema.String,
684 popover: Schema.String,
685 popoverForeground: Schema.String,
686 primary: Schema.String,
687 primaryForeground: Schema.String,
688 muted: Schema.String,
689 mutedForeground: Schema.String,
690 accent: Schema.String,
691 accentForeground: Schema.String,
692 border: Schema.String,
693 input: Schema.String,
694 ring: Schema.String,
695 fontSans: Schema.String,
696 fontMono: Schema.String,
697 });
698​
699export interface DesktopPreviewRecordingFrame {
700 tabId: string;
701 data: string;
702 width: number;
703 height: number;
704 receivedAt: string;
706​
707export interface DesktopPreviewRecordingArtifact {
708 id: string;
709 tabId: string;
710 path: string;
711 mimeType: string;
712 sizeBytes: number;
713 createdAt: string;
715​
716export const DesktopPreviewRecordingArtifactSchema: Schema.Codec<DesktopPreviewRecordingArtifact> =
717 Schema.Struct({
718 id: Schema.String,
719 tabId: DesktopPreviewTabIdSchema,
720 path: Schema.String,
721 mimeType: Schema.String,
722 sizeBytes: Schema.Int,
723 createdAt: Schema.String,
724 });
725​
726export interface DesktopPreviewScreenshotArtifact {
727 id: string;
728 tabId: string;
729 path: string;
730 mimeType: "image/png";
731 sizeBytes: number;
732 createdAt: string;
734​
735export const DesktopPreviewScreenshotArtifactSchema: Schema.Codec<DesktopPreviewScreenshotArtifact> =
736 Schema.Struct({
737 id: Schema.String,
738 tabId: DesktopPreviewTabIdSchema,
739 path: Schema.String,
740 mimeType: Schema.Literal("image/png"),
741 sizeBytes: Schema.Int,
742 createdAt: Schema.String,
743 });
744​
745export interface PickedElementStackFrame {
746 functionName: string | null;
747 fileName: string | null;
748 lineNumber: number | null;
749 columnNumber: number | null;
751​
752export const PickedElementStackFrameSchema: Schema.Codec<PickedElementStackFrame> = Schema.Struct({
753 functionName: Schema.NullOr(Schema.String),
754 fileName: Schema.NullOr(Schema.String),
755 lineNumber: Schema.NullOr(Schema.Number),
756 columnNumber: Schema.NullOr(Schema.Number),
757});
758​
759export interface PickedElementPayload {
760 pageUrl: string;
761 pageTitle: string | null;
762 tagName: string;
763 selector: string | null;
764 htmlPreview: string;
765 componentName: string | null;
766 source: PickedElementStackFrame | null;
767 stack: ReadonlyArray<PickedElementStackFrame>;
768 styles: string;
769 pickedAt: string;
771​
772export const PickedElementPayloadSchema: Schema.Codec<PickedElementPayload> = Schema.Struct({
773 pageUrl: Schema.String,
774 pageTitle: Schema.NullOr(Schema.String),
775 tagName: Schema.String,
776 selector: Schema.NullOr(Schema.String),
777 htmlPreview: Schema.String,
778 componentName: Schema.NullOr(Schema.String),
779 source: Schema.NullOr(PickedElementStackFrameSchema),
780 stack: Schema.Array(PickedElementStackFrameSchema),
781 styles: Schema.String,
782 pickedAt: Schema.String,
783});
784​
785export interface PreviewAnnotationRect {
786 x: number;
787 y: number;
788 width: number;
789 height: number;
791​
792export const PreviewAnnotationRectSchema: Schema.Codec<PreviewAnnotationRect> = Schema.Struct({
793 x: Schema.Number,
794 y: Schema.Number,
795 width: Schema.Number,
796 height: Schema.Number,
797});
798​
799export interface PreviewAnnotationPoint {
800 x: number;
801 y: number;
803​
804export const PreviewAnnotationPointSchema: Schema.Codec<PreviewAnnotationPoint> = Schema.Struct({
805 x: Schema.Number,
806 y: Schema.Number,
807});
808​
809export interface PreviewAnnotationElementTarget {
810 id: string;
811 element: PickedElementPayload;
812 rect: PreviewAnnotationRect;
814​
815export const PreviewAnnotationElementTargetSchema: Schema.Codec<PreviewAnnotationElementTarget> =
816 Schema.Struct({
817 id: Schema.String,
818 element: PickedElementPayloadSchema,
819 rect: PreviewAnnotationRectSchema,
820 });
821​
822export interface PreviewAnnotationRegionTarget {
823 id: string;
824 rect: PreviewAnnotationRect;
826​
827export const PreviewAnnotationRegionTargetSchema: Schema.Codec<PreviewAnnotationRegionTarget> =
828 Schema.Struct({
829 id: Schema.String,
830 rect: PreviewAnnotationRectSchema,
831 });
832​
833export interface PreviewAnnotationStrokeTarget {
834 id: string;
835 color: string;
836 width: number;
837 points: ReadonlyArray<PreviewAnnotationPoint>;
838 bounds: PreviewAnnotationRect;
840​
841export const PreviewAnnotationStrokeTargetSchema: Schema.Codec<PreviewAnnotationStrokeTarget> =
842 Schema.Struct({
843 id: Schema.String,
844 color: Schema.String,
845 width: Schema.Number,
846 points: Schema.Array(PreviewAnnotationPointSchema),
847 bounds: PreviewAnnotationRectSchema,
848 });
849​
850export interface PreviewAnnotationStyleChange {
851 targetId: string;
852 selector: string | null;
853 property: string;
854 previousValue: string;
855 value: string;
857​
858export const PreviewAnnotationStyleChangeSchema: Schema.Codec<PreviewAnnotationStyleChange> =
859 Schema.Struct({
860 targetId: Schema.String,
861 selector: Schema.NullOr(Schema.String),
862 property: Schema.String,
863 previousValue: Schema.String,
864 value: Schema.String,
865 });
866​
867export interface PreviewAnnotationScreenshot {
868 dataUrl: string;
869 width: number;
870 height: number;
871 cropRect: PreviewAnnotationRect;
873​
874export const PreviewAnnotationScreenshotSchema: Schema.Codec<PreviewAnnotationScreenshot> =
875 Schema.Struct({
876 dataUrl: Schema.String,
877 width: Schema.Number,
878 height: Schema.Number,
879 cropRect: PreviewAnnotationRectSchema,
880 });
881​
882export interface PreviewAnnotationPayload {
883 id: string;
884 pageUrl: string;
885 pageTitle: string | null;
886 comment: string;
887 elements: ReadonlyArray<PreviewAnnotationElementTarget>;
888 regions: ReadonlyArray<PreviewAnnotationRegionTarget>;
889 strokes: ReadonlyArray<PreviewAnnotationStrokeTarget>;
890 styleChanges: ReadonlyArray<PreviewAnnotationStyleChange>;
891 screenshot: PreviewAnnotationScreenshot | null;
892 createdAt: string;
894​
895export const PreviewAnnotationPayloadSchema: Schema.Codec<PreviewAnnotationPayload> = Schema.Struct(
896 {
897 id: Schema.String,
898 pageUrl: Schema.String,
899 pageTitle: Schema.NullOr(Schema.String),
900 comment: Schema.String,
901 elements: Schema.Array(PreviewAnnotationElementTargetSchema),
902 regions: Schema.Array(PreviewAnnotationRegionTargetSchema),
903 strokes: Schema.Array(PreviewAnnotationStrokeTargetSchema),
904 styleChanges: Schema.Array(PreviewAnnotationStyleChangeSchema),
905 screenshot: Schema.NullOr(PreviewAnnotationScreenshotSchema),
906 createdAt: Schema.String,
907 },
908);
909​
910export type PreviewAnnotationSubmission = "attach" | "send";
911export const PreviewAnnotationSubmissionSchema: Schema.Codec<PreviewAnnotationSubmission> =
912 Schema.Literals(["attach", "send"]);
913​
914export interface PreviewAnnotationSubmissionResult {
915 annotation: PreviewAnnotationPayload;
916 submission: PreviewAnnotationSubmission;
917 screenshotFailed?: boolean;
919export const PreviewAnnotationSubmissionResultSchema: Schema.Codec<PreviewAnnotationSubmissionResult> =
920 Schema.Struct({
921 annotation: PreviewAnnotationPayloadSchema,
922 submission: PreviewAnnotationSubmissionSchema,
923 screenshotFailed: Schema.optionalKey(Schema.Boolean),
924 });
925​
926export const DesktopPreviewTabInputSchema = Schema.Struct({
927 tabId: DesktopPreviewTabIdSchema,
928});
929​
930/** Apply zoom and color scheme at creation to avoid flashing browser defaults. */
931export const DesktopPreviewCreateTabInputSchema = Schema.Struct({
932 tabId: DesktopPreviewTabIdSchema,
933 zoomFactor: Schema.optional(Schema.Number.check(Schema.isGreaterThan(0))),
934 colorScheme: Schema.optional(DesktopPreviewColorSchemeSchema),
935 serverTab: Schema.optional(
936 Schema.Struct({ threadId: TrimmedNonEmptyString, tabId: TrimmedNonEmptyString }),
937 ),
938});
939​
940export interface DesktopPreviewTabDefaults {
941 readonly zoomFactor?: number | undefined;
942 readonly colorScheme?: DesktopPreviewColorScheme | undefined;
943 readonly serverTab?: { readonly threadId: string; readonly tabId: string } | undefined;
945​
946export const DesktopPreviewRegisterWebviewInputSchema = Schema.Struct({
947 tabId: DesktopPreviewTabIdSchema,
948 webContentsId: Schema.Int.check(Schema.isGreaterThan(0)),
949});
950​
951export const DesktopPreviewNavigateInputSchema = Schema.Struct({
952 tabId: DesktopPreviewTabIdSchema,
953 url: Schema.String,
954});
955​
956export const DesktopPreviewConfigInputSchema = Schema.Struct({
957 environmentId: EnvironmentId,
958 /** Main must derive the partition to ensure its session has UA rewrites and permission handlers. */
959 profileId: Schema.optional(BrowserProfileId),
960});
961​
962export const DesktopPreviewClearDataInputSchema = Schema.Struct({
963 environmentId: EnvironmentId,
964 /** Omit to clear every profile; otherwise only this profile's partition. */
965 profileId: Schema.optional(BrowserProfileId),
966});
967​
968export const DesktopPreviewSetColorSchemeInputSchema = Schema.Struct({
969 tabId: DesktopPreviewTabIdSchema,
970 colorScheme: DesktopPreviewColorSchemeSchema,
971});
972​
973export const DesktopPreviewSetZoomFactorInputSchema = Schema.Struct({
974 tabId: DesktopPreviewTabIdSchema,
975 zoomFactor: Schema.Number.check(Schema.isGreaterThan(0)),
976});
977​
978export const DesktopPreviewSetAudioMutedInputSchema = Schema.Struct({
979 tabId: DesktopPreviewTabIdSchema,
980 audioMuted: Schema.Boolean,
981});
982​
983export const DesktopPreviewAnnotationThemeInputSchema = Schema.Struct({
984 theme: DesktopPreviewAnnotationThemeSchema,
985});
986​
987export const DesktopPreviewAnnotationSendEnabledInputSchema = Schema.Struct({
988 tabId: DesktopPreviewTabIdSchema,
989 enabled: Schema.Boolean,
990});
991​
992export const DesktopPreviewArtifactInputSchema = Schema.Struct({
993 path: Schema.String.check(Schema.isTrimmed()).check(Schema.isNonEmpty()),
994});
995​
996export const DesktopPreviewRecordingSaveInputSchema = Schema.Struct({
997 tabId: DesktopPreviewTabIdSchema,
998 mimeType: Schema.String.check(Schema.isTrimmed()).check(Schema.isNonEmpty()),
999 data: Schema.Uint8Array,
1000});
1001​
1002export const SystemSettingsPaneSchema = Schema.Literals(["full-disk-access"]);
1003export type SystemSettingsPane = typeof SystemSettingsPaneSchema.Type;
1004​
1005export interface DesktopBridge {
1006 getAppBranding: () => DesktopAppBranding | null;
1007 getRelayTelemetryEnabled: () => boolean;
1008 getPathForFile: (file: File) => string;
1009 getClientPlatform: () => string;
1010 setNotificationBadge: (badge: { count: number; image: string | null }) => Promise<void>;
1011 onNotificationBadgeClear: (listener: () => void) => () => void;
1012 onTrackpadScrollEnd: (listener: () => void) => () => void;
1013 /**
1014 * Renderer `window.focus()` cannot raise an Electron window, and on Wayland
1015 * only the main process can spend a notification click's activation token.
1016 */
1017 revealWindow: () => Promise<void>;
1018 /**
1019 * The OS locale as a BCP-47 tag, which the renderer cannot read for itself:
1020 * the packaged app ships only the `en-US` Chromium locale pak, so
1021 * `navigator.language` and the default `Intl` locale are pinned to `en-US`
1022 * regardless of OS settings.
1023 */
1024 getSystemLocale: () => string | null;
1025 getLocalEnvironmentBootstraps: () => readonly DesktopEnvironmentBootstrap[];
1026 getLocalEnvironmentEnabled: () => boolean;
1027 setLocalEnvironmentEnabled: (enabled: boolean) => Promise<void>;
1028 getLocalEnvironmentBearerToken: () => Promise<string>;
1029 getClientSettings: () => Promise<ClientSettings | null>;
1030 setClientSettings: (settings: ClientSettings) => Promise<void>;
1031 getConnectionCatalog: () => Promise<string | null>;
1032 setConnectionCatalog: (catalog: string) => Promise<boolean>;
1033 discoverSshHosts: () => Promise<readonly DesktopDiscoveredSshHost[]>;
1034 resolveSshHost: (alias: string) => Promise<DesktopSshEnvironmentTarget>;
1035 requestSnapShotPermissions: (includeAccessibility: boolean) => Promise<void>;
1036 getSnapShotState: () => Promise<DesktopSnapShotState>;
1037 setupSnapShot: (action: DesktopSnapShotSetupAction) => Promise<void>;
1038 previewSnapShotConfig: (
1039 request: DesktopCaptureConfigRequest,
1040 ) => Promise<DesktopCaptureConfigPreview | null>;
1041 applySnapShotConfig: (previewId: string) => Promise<DesktopCaptureConfigApplied>;
1042 checkSnapShotShortcut: (
1043 shortcut: SnapShotShortcut,
1044 ) => Promise<DesktopSnapShotShortcutAvailability>;
1045 setSnapShotShortcutSuppressed: (suppressed: boolean) => Promise<void>;
1046 listPendingSnapShots: () => Promise<readonly DesktopPendingSnapShot[]>;
1047 readSnapShot: (id: string) => Promise<DesktopSnapShot>;
1048 setSnapShotAnimationDestination: (
1049 destination: DesktopSnapShotAnimationDestination,
1050 ) => Promise<void>;
1051 dismissSnapShotAnimation: (id: DesktopSnapShotId) => Promise<void>;
1052 acknowledgeSnapShot: (id: string) => Promise<void>;
1053 ensureSshEnvironment: (
1054 target: DesktopSshEnvironmentTarget,
1055 options?: { issuePairingToken?: boolean },
1056 ) => Promise<DesktopSshEnvironmentBootstrap>;
1057 disconnectSshEnvironment: (target: DesktopSshEnvironmentTarget) => Promise<void>;
1058 fetchSshEnvironmentDescriptor: (httpBaseUrl: string) => Promise<ExecutionEnvironmentDescriptor>;
1059 bootstrapSshBearerSession: (
1060 httpBaseUrl: string,
1061 credential: string,
1062 ) => Promise<AuthAccessTokenResult>;
1063 fetchSshSessionState: (httpBaseUrl: string, bearerToken: string) => Promise<AuthSessionState>;
1064 onSshPasswordPrompt: (listener: (request: DesktopSshPasswordPromptRequest) => void) => () => void;
1065 resolveSshPasswordPrompt: (requestId: string, password: string | null) => Promise<void>;
1066 getServerExposureState: () => Promise<DesktopServerExposureState>;
1067 setServerExposureMode: (mode: DesktopServerExposureMode) => Promise<DesktopServerExposureState>;
1068 setTailscaleServeEnabled: (input: {
1069 readonly enabled: boolean;
1070 readonly port?: number;
1071 }) => Promise<DesktopServerExposureState>;
1072 getAdvertisedEndpoints: () => Promise<readonly AdvertisedEndpoint[]>;
1073 getWslState: () => Promise<DesktopWslState>;
1074 setWslBackendEnabled: (enabled: boolean) => Promise<DesktopWslState>;
1075 setWslDistro: (distro: string | null) => Promise<DesktopWslState>;
1076 setWslOnly: (enabled: boolean) => Promise<DesktopWslState>;
1077 pickFolder: (options?: PickFolderOptions) => Promise<string | null>;
1078 pickProjectFavicon: (initialPath?: string) => Promise<string | null>;
1079 pickThemeFiles: () => Promise<readonly PickedThemeFile[] | null>;
1080 setTheme: (theme: DesktopTheme) => Promise<void>;
1081 showContextMenu: <T extends string>(
1082 items: readonly ContextMenuItem<T>[],
1083 position?: { x: number; y: number },
1084 ) => Promise<T | null>;
1085 receiveProviderAuthCallback: (authorizationUrl: string) => Promise<string>;
1086 cancelProviderAuthCallback: (authorizationUrl: string) => Promise<void>;
1087 openExternal: (url: string) => Promise<boolean>;
1088 openSystemSettings: (pane: SystemSettingsPane) => Promise<boolean>;
1089 checkSystemPermission: (pane: SystemSettingsPane) => Promise<boolean>;
1090 probeRemoteEditors: () => Promise<readonly EditorId[]>;
1091 pasteAsText: () => Promise<void>;
1092 onMenuAction: (listener: (action: string) => void) => () => void;
1093 onSnapShotEvent: (listener: (event: DesktopSnapShotEvent) => void) => () => void;
1094 onQuitShortcut: (listener: (event: QuitShortcutHintEvent) => void) => () => void;
1095 getWindowFullscreenState: () => boolean;
1096 onWindowFullscreenStateChange: (listener: (fullscreen: boolean) => void) => () => void;
1097 getWindowZoomFactor: () => number;
1098 getUpdateState: () => Promise<DesktopUpdateState>;
1099 setUpdateChannel: (channel: DesktopUpdateChannel) => Promise<DesktopUpdateState>;
1100 checkForUpdate: () => Promise<DesktopUpdateCheckResult>;
1101 downloadUpdate: () => Promise<DesktopUpdateActionResult>;
1102 installUpdate: () => Promise<DesktopUpdateActionResult>;
1103 onUpdateState: (listener: (state: DesktopUpdateState) => void) => () => void;
1104 cliCommand: {
1105 getState: () => Promise<DesktopCliCommandState>;
1106 install: () => Promise<DesktopCliCommandState>;
1107 uninstall: () => Promise<DesktopCliCommandState>;
1108 };
1109 webLinks: {
1110 setReady: (ready: boolean) => Promise<void>;
1111 onOpen: (listener: (url: string) => void) => () => void;
1112 };
1113 appActivation: {
1114 setReady: (ready: boolean) => Promise<void>;
1115 complete: (response: DesktopAppActivationResponse) => Promise<void>;
1116 onRequest: (listener: (request: DesktopAppActivationRequest) => void) => () => void;
1117 };
1118 preview: DesktopPreviewBridge;
1120​
1121/** Renderer callback invoked by Electron with a fresh user gesture before display-media capture. */
1122export const DESKTOP_PREVIEW_RECORDING_CAPTURE_TRIGGER = "__t3DesktopPreviewRecordingCapture";
1123​
1124export interface DesktopPreviewBridge {
1125 setForwardedShortcuts: (shortcuts: ReadonlyArray<PreviewForwardedShortcut>) => Promise<void>;
1126 createTab: (tabId: string, defaults?: DesktopPreviewTabDefaults) => Promise<void>;
1127 closeTab: (tabId: string) => Promise<void>;
1128 registerWebview: (tabId: string, webContentsId: number) => Promise<void>;
1129 navigate: (tabId: string, url: string) => Promise<void>;
1130 goBack: (tabId: string) => Promise<void>;
1131 goForward: (tabId: string) => Promise<void>;
1132 refresh: (tabId: string) => Promise<void>;
1133 zoomIn: (tabId: string) => Promise<void>;
1134 zoomOut: (tabId: string) => Promise<void>;
1135 resetZoom: (tabId: string) => Promise<void>;
1136 setZoomFactor: (tabId: string, zoomFactor: number) => Promise<void>;
1137 hardReload: (tabId: string) => Promise<void>;
1138 setColorScheme: (tabId: string, colorScheme: DesktopPreviewColorScheme) => Promise<void>;
1139 setAudioMuted: (tabId: string, audioMuted: boolean) => Promise<void>;
1140 openDevTools: (tabId: string) => Promise<void>;
1141 clearCookies: (environmentId: EnvironmentId, profileId?: string) => Promise<void>;
1142 clearCache: (environmentId: EnvironmentId, profileId?: string) => Promise<void>;
1143 getPreviewConfig: (
1144 environmentId: EnvironmentId,
1145 profileId?: string,
1146 ) => Promise<DesktopPreviewWebviewConfig>;
1147 listBrowserImportSources: () => Promise<ReadonlyArray<BrowserImportSource>>;
1148 importBrowserCookies: (input: {
1149 readonly environmentId: EnvironmentId;
1150 readonly sourceId: BrowserImportSourceId;
1151 readonly sourceProfileDirectory: string;
1152 readonly targetProfileId: string;
1153 }) => Promise<BrowserImportResult>;
1154 setAnnotationTheme: (theme: DesktopPreviewAnnotationTheme) => Promise<void>;
1155 setAnnotationSendEnabled: (tabId: string, enabled: boolean) => Promise<void>;
1156 /** Resolves with the annotation and attach/send intent, or null on cancellation. Rejects if activation fails. */
1157 pickElement: (tabId: string) => Promise<PreviewAnnotationSubmissionResult | null>;
1158 cancelPickElement: (tabId: string) => Promise<void>;
1159 captureScreenshot: (
1160 tabId: string,
1161 ) => Promise<DesktopPreviewScreenshotArtifact | PreviewCaptureFailureEncoded>;
1162 revealArtifact: (path: string) => Promise<void>;
1163 copyArtifactToClipboard: (path: string) => Promise<void>;
1164 pictureInPicture: {
1165 open: (tabId: string) => Promise<void>;
1166 close: (tabId: string) => Promise<void>;
1167 };
1168 recording: {
1169 onInput: (listener: (event: DesktopPreviewRecordingInputEvent) => void) => () => void;
1170 startScreencast: (tabId: string) => Promise<void | PreviewCaptureFailureEncoded>;
1171 stopScreencast: (tabId: string) => Promise<void>;
1172 save: (
1173 tabId: string,
1174 mimeType: string,
1175 data: Uint8Array,
1176 ) => Promise<DesktopPreviewRecordingArtifact>;
1177 };
1178 onStateChange: (listener: (tabId: string, state: DesktopPreviewTabState) => void) => () => void;
1179 onPointerEvent: (listener: (event: DesktopPreviewPointerEvent) => void) => () => void;
1180 onOpenLink: (listener: (event: DesktopPreviewOpenLinkEvent) => void) => () => void;
1182​
1183export type ConfirmDialogVariant = "default" | "destructive";
1184​
1185export interface ConfirmDialogOptions {
1186 readonly variant?: ConfirmDialogVariant;
1188​
1189export interface LocalApi {
1190 dialogs: {
1191 pickFolder: (options?: PickFolderOptions) => Promise<string | null>;
1192 confirm: (message: string, options?: ConfirmDialogOptions) => Promise<boolean>;
1193 };
1194 shell: {
1195 openExternal: (url: string) => Promise<void>;
1196 openSystemSettings: (pane: SystemSettingsPane) => Promise<void>;
1197 };
1198 contextMenu: {
1199 show: <T extends string>(
1200 items: readonly ContextMenuItem<T>[],
1201 position?: { x: number; y: number },
1202 ) => Promise<T | null>;
1203 close: () => Promise<void>;
1204 };
1205 persistence: {
1206 getClientSettings: () => Promise<ClientSettings | null>;
1207 setClientSettings: (settings: ClientSettings) => Promise<void>;
1208 };