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

ipc.ts

1,215 lines41.0 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, AuthWebSocketTicketResult } 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});
325export type DesktopCliCommandState = typeof DesktopCliCommandStateSchema.Type;
326​
327export interface DesktopUpdateActionResult {
328 accepted: boolean;
329 completed: boolean;
330 state: DesktopUpdateState;
332​
333export const DesktopUpdateActionResultSchema = Schema.Struct({
334 accepted: Schema.Boolean,
335 completed: Schema.Boolean,
336 state: DesktopUpdateStateSchema,
337});
338​
339export interface DesktopUpdateCheckResult {
340 checked: boolean;
341 state: DesktopUpdateState;
343​
344export const DesktopUpdateCheckResultSchema = Schema.Struct({
345 checked: Schema.Boolean,
346 state: DesktopUpdateStateSchema,
347});
348​
349export const PRIMARY_LOCAL_ENVIRONMENT_ID = "primary";
350​
351export interface DesktopEnvironmentBootstrap {
352 // Stable backend identity used to reopen routed projects.
353 id: string;
354 label: string;
355 // Actual distro for this run; id stays wsl:default when tracking the default.
356 runningDistro?: string | null;
357 httpBaseUrl: string | null;
358 wsBaseUrl: string | null;
359 bootstrapToken?: string;
361​
362export const DesktopEnvironmentBootstrapSchema = Schema.Struct({
363 id: Schema.String,
364 label: Schema.String,
365 runningDistro: Schema.optionalKey(Schema.NullOr(Schema.String)),
366 httpBaseUrl: Schema.NullOr(Schema.String),
367 wsBaseUrl: Schema.NullOr(Schema.String),
368 bootstrapToken: Schema.optionalKey(Schema.String),
369});
370​
371export const DesktopSshEnvironmentTargetSchema = Schema.Struct({
372 alias: Schema.String,
373 hostname: Schema.String,
374 username: Schema.NullOr(Schema.String),
375 port: Schema.NullOr(Schema.Number),
376});
377export type DesktopSshEnvironmentTarget = typeof DesktopSshEnvironmentTargetSchema.Type;
378​
379export type DesktopSshHostSource = "ssh-config" | "known-hosts";
380export const DesktopSshHostSourceSchema = Schema.Literals(["ssh-config", "known-hosts"]);
381​
382export interface DesktopDiscoveredSshHost extends DesktopSshEnvironmentTarget {
383 source: DesktopSshHostSource;
385​
386export const DesktopDiscoveredSshHostSchema = Schema.Struct({
387 alias: Schema.String,
388 hostname: Schema.String,
389 username: Schema.NullOr(Schema.String),
390 port: Schema.NullOr(Schema.Number),
391 source: DesktopSshHostSourceSchema,
392});
393​
394export interface DesktopSshEnvironmentBootstrap {
395 target: DesktopSshEnvironmentTarget;
396 httpBaseUrl: string;
397 wsBaseUrl: string;
398 pairingToken: string | null;
399 remotePort?: number;
400 remoteServerKind?: "external" | "managed";
402​
403export const DesktopSshEnvironmentBootstrapSchema = Schema.Struct({
404 target: DesktopSshEnvironmentTargetSchema,
405 httpBaseUrl: Schema.String,
406 wsBaseUrl: Schema.String,
407 pairingToken: Schema.NullOr(Schema.String),
408 remotePort: Schema.optionalKey(Schema.Number),
409 remoteServerKind: Schema.optionalKey(Schema.Literals(["external", "managed"])),
410});
411​
412export interface DesktopSshPasswordPromptRequest {
413 requestId: string;
414 destination: string;
415 username: string | null;
416 prompt: string;
417 expiresAt: string;
419​
420export const DesktopSshPasswordPromptCancelledType = "ssh-password-prompt-cancelled" as const;
421​
422export const DesktopSshPasswordPromptCancelledResultSchema = Schema.Struct({
423 type: Schema.Literal(DesktopSshPasswordPromptCancelledType),
424 message: Schema.String,
425});
426​
427export const DesktopSshEnvironmentEnsureOptionsSchema = Schema.Struct({
428 issuePairingToken: Schema.optionalKey(Schema.Boolean),
429});
430​
431export const DesktopSshEnvironmentEnsureInputSchema = Schema.Struct({
432 target: DesktopSshEnvironmentTargetSchema,
433 options: Schema.optionalKey(DesktopSshEnvironmentEnsureOptionsSchema),
434});
435​
436export const DesktopSshEnvironmentEnsureResultSchema = Schema.Union([
437 DesktopSshEnvironmentBootstrapSchema,
438 DesktopSshPasswordPromptCancelledResultSchema,
439]);
440​
441export const DesktopSshHttpBaseUrlInputSchema = Schema.Struct({
442 httpBaseUrl: Schema.String,
443});
444​
445export const DesktopSshBearerRequestInputSchema = Schema.Struct({
446 httpBaseUrl: Schema.String,
447 bearerToken: Schema.String,
448});
449​
450export const DesktopSshBearerBootstrapInputSchema = Schema.Struct({
451 httpBaseUrl: Schema.String,
452 credential: Schema.String,
453});
454​
455export const DesktopSshPasswordPromptResolutionInputSchema = Schema.Struct({
456 requestId: Schema.String,
457 password: Schema.NullOr(Schema.String),
458});
459​
460export const PersistedSavedEnvironmentRecordSchema = Schema.Struct({
461 environmentId: EnvironmentId,
462 label: Schema.String,
463 wsBaseUrl: Schema.String,
464 httpBaseUrl: Schema.String,
465 createdAt: Schema.String,
466 lastConnectedAt: Schema.NullOr(Schema.String),
467 desktopSsh: Schema.optionalKey(DesktopSshEnvironmentTargetSchema),
468 relayManaged: Schema.optionalKey(
469 Schema.Struct({
470 relayUrl: Schema.String,
471 }),
472 ),
473});
474export type PersistedSavedEnvironmentRecord = typeof PersistedSavedEnvironmentRecordSchema.Type;
475​
476export type DesktopServerExposureMode = "local-only" | "network-accessible";
477​
478export const DesktopServerExposureModeSchema = Schema.Literals([
479 "local-only",
480 "network-accessible",
481]);
482​
483export interface DesktopServerExposureState {
484 mode: DesktopServerExposureMode;
485 endpointUrl: string | null;
486 advertisedHost: string | null;
487 tailscaleServeEnabled: boolean;
488 tailscaleServePort: number;
490​
491export const DesktopServerExposureStateSchema = Schema.Struct({
492 mode: DesktopServerExposureModeSchema,
493 endpointUrl: Schema.NullOr(Schema.String),
494 advertisedHost: Schema.NullOr(Schema.String),
495 tailscaleServeEnabled: Schema.Boolean,
496 tailscaleServePort: Schema.Number,
497});
498​
499export interface PickFolderOptions {
500 initialPath?: string | null;
501 targetEnvironmentId?: string;
503​
504export const PickFolderOptionsSchema = Schema.Struct({
505 initialPath: Schema.optionalKey(Schema.NullOr(Schema.String)),
506 targetEnvironmentId: Schema.optionalKey(Schema.String),
507});
508​
509/** Oversized files have empty text so the main process never loads their contents. */
510export interface PickedThemeFile {
511 name: string;
512 size: number;
513 text: string;
515​
516export const PickedThemeFileSchema = Schema.Struct({
517 name: Schema.String,
518 size: Schema.Number,
519 text: Schema.String,
520});
521​
522export interface DesktopWslDistro {
523 name: string;
524 isDefault: boolean;
525 version: 1 | 2;
527​
528export const DesktopWslDistroSchema = Schema.Struct({
529 name: Schema.String,
530 isDefault: Schema.Boolean,
531 version: Schema.Literals([1, 2]),
532});
533​
534export interface DesktopWslState {
535 enabled: boolean;
536 // null means "track the current WSL default distro".
537 distro: string | null;
538 available: boolean;
539 wslOnly: boolean;
540 distros: readonly DesktopWslDistro[];
541 // Always null in wsl-only mode, which falls back to Windows with a dialog.
542 preflightError: string | null;
544​
545export const DesktopWslStateSchema = Schema.Struct({
546 enabled: Schema.Boolean,
547 distro: Schema.NullOr(Schema.String),
548 available: Schema.Boolean,
549 wslOnly: Schema.Boolean,
550 distros: Schema.Array(DesktopWslDistroSchema),
551 preflightError: Schema.NullOr(Schema.String),
552});
553​
554export type DesktopPreviewNavStatus =
555 | { kind: "Idle" }
556 | { kind: "Loading"; url: string; title: string }
557 | { kind: "Success"; url: string; title: string }
558 | {
559 kind: "LoadFailed";
560 url: string;
561 title: string;
562 code: number;
563 description: string;
564 };
565​
566export type DesktopPreviewColorScheme = "system" | "light" | "dark";
567​
568export const DesktopPreviewColorSchemeSchema: Schema.Codec<DesktopPreviewColorScheme> =
569 Schema.Literals(["system", "light", "dark"]);
570​
571export const FAVICON_DATA_URL_MAX_LENGTH = 8192;
572export const FAVICON_CAPTURED_AT_MAX = 8_640_000_000_000_000;
573​
574export interface DesktopPreviewFavicon {
575 dataUrl: string;
576 pageUrl: string;
577 capturedAt: number;
579​
580export interface DesktopPreviewTabState {
581 tabId: string;
582 webContentsId: number | null;
583 navStatus: DesktopPreviewNavStatus;
584 canGoBack: boolean;
585 canGoForward: boolean;
586 zoomFactor: number;
587 pictureInPicture: boolean;
588 colorScheme: DesktopPreviewColorScheme;
589 audioMuted: boolean;
590 /** Chromium reports playback even when audioMuted is true. */
591 audible: boolean;
592 controller: "human" | "agent" | "none";
593 /** A screenshot or stream of the guest is pending, so the client keeps it painting while hidden. */
594 capturing: boolean;
595 favicon?: DesktopPreviewFavicon;
596 updatedAt: string;
598​
599export const DesktopPreviewTabIdSchema = Schema.String.check(Schema.isTrimmed()).check(
600 Schema.isNonEmpty(),
601);
602​
603export interface DesktopPreviewPointerEvent {
604 tabId: string;
605 phase: "move" | "click";
606 x: number;
607 y: number;
608 sequence: number;
609 createdAt: string;
611​
612export interface DesktopPreviewOpenLinkEvent {
613 tabId: string;
614 url: string;
615 background: boolean;
617​
618export const DesktopPreviewRecordingInputSchema = Schema.Union([
619 Schema.Struct({
620 type: Schema.Literal("pointer"),
621 phase: Schema.Literals(["move", "down", "up", "click"]),
622 x: Schema.Finite,
623 y: Schema.Finite,
624 width: Schema.Finite.check(Schema.isGreaterThan(0)),
625 height: Schema.Finite.check(Schema.isGreaterThan(0)),
626 }),
627 Schema.Struct({
628 type: Schema.Literal("key"),
629 label: Schema.NullOr(Schema.String.check(Schema.isMaxLength(100))),
630 held: Schema.Boolean,
631 width: Schema.Finite.check(Schema.isGreaterThan(0)),
632 }),
633 Schema.Struct({ type: Schema.Literal("clear") }),
634]);
635export type DesktopPreviewRecordingInput = typeof DesktopPreviewRecordingInputSchema.Type;
636export interface DesktopPreviewRecordingInputEvent {
637 readonly tabId: string;
638 readonly input: DesktopPreviewRecordingInput;
640​
641export interface DesktopPreviewWebviewConfig {
642 partition: string;
643 /** Sandboxed with contextIsolation off so the picker preload can read the React DevTools hook. */
644 webPreferences: string;
645 /** Absolute file:// preload URL; null requires disabling element picking. */
646 preloadUrl: string | null;
648​
649export const DesktopPreviewWebviewConfigSchema: Schema.Codec<DesktopPreviewWebviewConfig> =
650 Schema.Struct({
651 partition: Schema.String,
652 webPreferences: Schema.String,
653 preloadUrl: Schema.NullOr(Schema.String),
654 });
655​
656export interface DesktopPreviewAnnotationTheme {
657 colorScheme: "light" | "dark";
658 radius: string;
659 background: string;
660 foreground: string;
661 popover: string;
662 popoverForeground: string;
663 primary: string;
664 primaryForeground: string;
665 muted: string;
666 mutedForeground: string;
667 accent: string;
668 accentForeground: string;
669 border: string;
670 input: string;
671 ring: string;
672 fontSans: string;
673 fontMono: string;
675​
676export const DesktopPreviewAnnotationThemeSchema: Schema.Codec<DesktopPreviewAnnotationTheme> =
677 Schema.Struct({
678 colorScheme: Schema.Literals(["light", "dark"]),
679 radius: Schema.String,
680 background: Schema.String,
681 foreground: Schema.String,
682 popover: Schema.String,
683 popoverForeground: Schema.String,
684 primary: Schema.String,
685 primaryForeground: Schema.String,
686 muted: Schema.String,
687 mutedForeground: Schema.String,
688 accent: Schema.String,
689 accentForeground: Schema.String,
690 border: Schema.String,
691 input: Schema.String,
692 ring: Schema.String,
693 fontSans: Schema.String,
694 fontMono: Schema.String,
695 });
696​
697export interface DesktopPreviewRecordingFrame {
698 tabId: string;
699 data: string;
700 width: number;
701 height: number;
702 receivedAt: string;
704​
705export interface DesktopPreviewRecordingArtifact {
706 id: string;
707 tabId: string;
708 path: string;
709 mimeType: string;
710 sizeBytes: number;
711 createdAt: string;
713​
714export const DesktopPreviewRecordingArtifactSchema: Schema.Codec<DesktopPreviewRecordingArtifact> =
715 Schema.Struct({
716 id: Schema.String,
717 tabId: DesktopPreviewTabIdSchema,
718 path: Schema.String,
719 mimeType: Schema.String,
720 sizeBytes: Schema.Int,
721 createdAt: Schema.String,
722 });
723​
724export interface DesktopPreviewScreenshotArtifact {
725 id: string;
726 tabId: string;
727 path: string;
728 mimeType: "image/png";
729 sizeBytes: number;
730 createdAt: string;
732​
733export const DesktopPreviewScreenshotArtifactSchema: Schema.Codec<DesktopPreviewScreenshotArtifact> =
734 Schema.Struct({
735 id: Schema.String,
736 tabId: DesktopPreviewTabIdSchema,
737 path: Schema.String,
738 mimeType: Schema.Literal("image/png"),
739 sizeBytes: Schema.Int,
740 createdAt: Schema.String,
741 });
742​
743export interface PickedElementStackFrame {
744 functionName: string | null;
745 fileName: string | null;
746 lineNumber: number | null;
747 columnNumber: number | null;
749​
750export const PickedElementStackFrameSchema: Schema.Codec<PickedElementStackFrame> = Schema.Struct({
751 functionName: Schema.NullOr(Schema.String),
752 fileName: Schema.NullOr(Schema.String),
753 lineNumber: Schema.NullOr(Schema.Number),
754 columnNumber: Schema.NullOr(Schema.Number),
755});
756​
757export interface PickedElementPayload {
758 pageUrl: string;
759 pageTitle: string | null;
760 tagName: string;
761 selector: string | null;
762 htmlPreview: string;
763 componentName: string | null;
764 source: PickedElementStackFrame | null;
765 stack: ReadonlyArray<PickedElementStackFrame>;
766 styles: string;
767 pickedAt: string;
769​
770export const PickedElementPayloadSchema: Schema.Codec<PickedElementPayload> = Schema.Struct({
771 pageUrl: Schema.String,
772 pageTitle: Schema.NullOr(Schema.String),
773 tagName: Schema.String,
774 selector: Schema.NullOr(Schema.String),
775 htmlPreview: Schema.String,
776 componentName: Schema.NullOr(Schema.String),
777 source: Schema.NullOr(PickedElementStackFrameSchema),
778 stack: Schema.Array(PickedElementStackFrameSchema),
779 styles: Schema.String,
780 pickedAt: Schema.String,
781});
782​
783export interface PreviewAnnotationRect {
784 x: number;
785 y: number;
786 width: number;
787 height: number;
789​
790export const PreviewAnnotationRectSchema: Schema.Codec<PreviewAnnotationRect> = Schema.Struct({
791 x: Schema.Number,
792 y: Schema.Number,
793 width: Schema.Number,
794 height: Schema.Number,
795});
796​
797export interface PreviewAnnotationPoint {
798 x: number;
799 y: number;
801​
802export const PreviewAnnotationPointSchema: Schema.Codec<PreviewAnnotationPoint> = Schema.Struct({
803 x: Schema.Number,
804 y: Schema.Number,
805});
806​
807export interface PreviewAnnotationElementTarget {
808 id: string;
809 element: PickedElementPayload;
810 rect: PreviewAnnotationRect;
812​
813export const PreviewAnnotationElementTargetSchema: Schema.Codec<PreviewAnnotationElementTarget> =
814 Schema.Struct({
815 id: Schema.String,
816 element: PickedElementPayloadSchema,
817 rect: PreviewAnnotationRectSchema,
818 });
819​
820export interface PreviewAnnotationRegionTarget {
821 id: string;
822 rect: PreviewAnnotationRect;
824​
825export const PreviewAnnotationRegionTargetSchema: Schema.Codec<PreviewAnnotationRegionTarget> =
826 Schema.Struct({
827 id: Schema.String,
828 rect: PreviewAnnotationRectSchema,
829 });
830​
831export interface PreviewAnnotationStrokeTarget {
832 id: string;
833 color: string;
834 width: number;
835 points: ReadonlyArray<PreviewAnnotationPoint>;
836 bounds: PreviewAnnotationRect;
838​
839export const PreviewAnnotationStrokeTargetSchema: Schema.Codec<PreviewAnnotationStrokeTarget> =
840 Schema.Struct({
841 id: Schema.String,
842 color: Schema.String,
843 width: Schema.Number,
844 points: Schema.Array(PreviewAnnotationPointSchema),
845 bounds: PreviewAnnotationRectSchema,
846 });
847​
848export interface PreviewAnnotationStyleChange {
849 targetId: string;
850 selector: string | null;
851 property: string;
852 previousValue: string;
853 value: string;
855​
856export const PreviewAnnotationStyleChangeSchema: Schema.Codec<PreviewAnnotationStyleChange> =
857 Schema.Struct({
858 targetId: Schema.String,
859 selector: Schema.NullOr(Schema.String),
860 property: Schema.String,
861 previousValue: Schema.String,
862 value: Schema.String,
863 });
864​
865export interface PreviewAnnotationScreenshot {
866 dataUrl: string;
867 width: number;
868 height: number;
869 cropRect: PreviewAnnotationRect;
871​
872export const PreviewAnnotationScreenshotSchema: Schema.Codec<PreviewAnnotationScreenshot> =
873 Schema.Struct({
874 dataUrl: Schema.String,
875 width: Schema.Number,
876 height: Schema.Number,
877 cropRect: PreviewAnnotationRectSchema,
878 });
879​
880export interface PreviewAnnotationPayload {
881 id: string;
882 pageUrl: string;
883 pageTitle: string | null;
884 comment: string;
885 elements: ReadonlyArray<PreviewAnnotationElementTarget>;
886 regions: ReadonlyArray<PreviewAnnotationRegionTarget>;
887 strokes: ReadonlyArray<PreviewAnnotationStrokeTarget>;
888 styleChanges: ReadonlyArray<PreviewAnnotationStyleChange>;
889 screenshot: PreviewAnnotationScreenshot | null;
890 createdAt: string;
892​
893export const PreviewAnnotationPayloadSchema: Schema.Codec<PreviewAnnotationPayload> = Schema.Struct(
894 {
895 id: Schema.String,
896 pageUrl: Schema.String,
897 pageTitle: Schema.NullOr(Schema.String),
898 comment: Schema.String,
899 elements: Schema.Array(PreviewAnnotationElementTargetSchema),
900 regions: Schema.Array(PreviewAnnotationRegionTargetSchema),
901 strokes: Schema.Array(PreviewAnnotationStrokeTargetSchema),
902 styleChanges: Schema.Array(PreviewAnnotationStyleChangeSchema),
903 screenshot: Schema.NullOr(PreviewAnnotationScreenshotSchema),
904 createdAt: Schema.String,
905 },
906);
907​
908export type PreviewAnnotationSubmission = "attach" | "send";
909export const PreviewAnnotationSubmissionSchema: Schema.Codec<PreviewAnnotationSubmission> =
910 Schema.Literals(["attach", "send"]);
911​
912export interface PreviewAnnotationSubmissionResult {
913 annotation: PreviewAnnotationPayload;
914 submission: PreviewAnnotationSubmission;
915 screenshotFailed?: boolean;
917export const PreviewAnnotationSubmissionResultSchema: Schema.Codec<PreviewAnnotationSubmissionResult> =
918 Schema.Struct({
919 annotation: PreviewAnnotationPayloadSchema,
920 submission: PreviewAnnotationSubmissionSchema,
921 screenshotFailed: Schema.optionalKey(Schema.Boolean),
922 });
923​
924export const DesktopPreviewTabInputSchema = Schema.Struct({
925 tabId: DesktopPreviewTabIdSchema,
926});
927​
928/** Apply zoom and color scheme at creation to avoid flashing browser defaults. */
929export const DesktopPreviewCreateTabInputSchema = Schema.Struct({
930 tabId: DesktopPreviewTabIdSchema,
931 zoomFactor: Schema.optional(Schema.Number.check(Schema.isGreaterThan(0))),
932 colorScheme: Schema.optional(DesktopPreviewColorSchemeSchema),
933 serverTab: Schema.optional(
934 Schema.Struct({ threadId: TrimmedNonEmptyString, tabId: TrimmedNonEmptyString }),
935 ),
936});
937​
938export interface DesktopPreviewTabDefaults {
939 readonly zoomFactor?: number | undefined;
940 readonly colorScheme?: DesktopPreviewColorScheme | undefined;
941 readonly serverTab?: { readonly threadId: string; readonly tabId: string } | undefined;
943​
944export const DesktopPreviewRegisterWebviewInputSchema = Schema.Struct({
945 tabId: DesktopPreviewTabIdSchema,
946 webContentsId: Schema.Int.check(Schema.isGreaterThan(0)),
947});
948​
949export const DesktopPreviewNavigateInputSchema = Schema.Struct({
950 tabId: DesktopPreviewTabIdSchema,
951 url: Schema.String,
952});
953​
954export const DesktopPreviewConfigInputSchema = Schema.Struct({
955 environmentId: EnvironmentId,
956 /** Main must derive the partition to ensure its session has UA rewrites and permission handlers. */
957 profileId: Schema.optional(BrowserProfileId),
958});
959​
960export const DesktopPreviewClearDataInputSchema = Schema.Struct({
961 environmentId: EnvironmentId,
962 /** Omit to clear every profile; otherwise only this profile's partition. */
963 profileId: Schema.optional(BrowserProfileId),
964});
965​
966export const DesktopPreviewSetColorSchemeInputSchema = Schema.Struct({
967 tabId: DesktopPreviewTabIdSchema,
968 colorScheme: DesktopPreviewColorSchemeSchema,
969});
970​
971export const DesktopPreviewSetZoomFactorInputSchema = Schema.Struct({
972 tabId: DesktopPreviewTabIdSchema,
973 zoomFactor: Schema.Number.check(Schema.isGreaterThan(0)),
974});
975​
976export const DesktopPreviewSetAudioMutedInputSchema = Schema.Struct({
977 tabId: DesktopPreviewTabIdSchema,
978 audioMuted: Schema.Boolean,
979});
980​
981export const DesktopPreviewAnnotationThemeInputSchema = Schema.Struct({
982 theme: DesktopPreviewAnnotationThemeSchema,
983});
984​
985export const DesktopPreviewAnnotationSendEnabledInputSchema = Schema.Struct({
986 tabId: DesktopPreviewTabIdSchema,
987 enabled: Schema.Boolean,
988});
989​
990export const DesktopPreviewArtifactInputSchema = Schema.Struct({
991 path: Schema.String.check(Schema.isTrimmed()).check(Schema.isNonEmpty()),
992});
993​
994export const DesktopPreviewRecordingSaveInputSchema = Schema.Struct({
995 tabId: DesktopPreviewTabIdSchema,
996 mimeType: Schema.String.check(Schema.isTrimmed()).check(Schema.isNonEmpty()),
997 data: Schema.Uint8Array,
998});
999​
1000export const SystemSettingsPaneSchema = Schema.Literals(["full-disk-access"]);
1001export type SystemSettingsPane = typeof SystemSettingsPaneSchema.Type;
1002​
1003export interface DesktopBridge {
1004 getAppBranding: () => DesktopAppBranding | null;
1005 getRelayTelemetryEnabled?: () => boolean;
1006 getPathForFile?: (file: File) => string;
1007 getClientPlatform?: () => string;
1008 setNotificationBadge?: (badge: { count: number; image: string | null }) => Promise<void>;
1009 onNotificationBadgeClear?: (listener: () => void) => () => void;
1010 onTrackpadScrollEnd?: (listener: () => void) => () => void;
1011 /**
1012 * Renderer `window.focus()` cannot raise an Electron window, and on Wayland
1013 * only the main process can spend a notification click's activation token.
1014 */
1015 revealWindow?: () => Promise<void>;
1016 /**
1017 * The OS locale as a BCP-47 tag, which the renderer cannot read for itself:
1018 * the packaged app ships only the `en-US` Chromium locale pak, so
1019 * `navigator.language` and the default `Intl` locale are pinned to `en-US`
1020 * regardless of OS settings.
1021 */
1022 getSystemLocale?: () => string | null;
1023 getLocalEnvironmentBootstraps: () => readonly DesktopEnvironmentBootstrap[];
1024 getLocalEnvironmentEnabled?: () => boolean;
1025 setLocalEnvironmentEnabled?: (enabled: boolean) => Promise<void>;
1026 getLocalEnvironmentBearerToken: () => Promise<string>;
1027 getClientSettings: () => Promise<ClientSettings | null>;
1028 setClientSettings: (settings: ClientSettings) => Promise<void>;
1029 getConnectionCatalog?: () => Promise<string | null>;
1030 setConnectionCatalog?: (catalog: string) => Promise<boolean>;
1031 clearConnectionCatalog?: () => Promise<void>;
1032 discoverSshHosts: () => Promise<readonly DesktopDiscoveredSshHost[]>;
1033 resolveSshHost: (alias: string) => Promise<DesktopSshEnvironmentTarget>;
1034 requestSnapShotPermissions?: (includeAccessibility: boolean) => Promise<void>;
1035 getSnapShotState?: () => Promise<DesktopSnapShotState>;
1036 setupSnapShot?: (action: DesktopSnapShotSetupAction) => Promise<void>;
1037 previewSnapShotConfig?: (
1038 request: DesktopCaptureConfigRequest,
1039 ) => Promise<DesktopCaptureConfigPreview | null>;
1040 applySnapShotConfig?: (previewId: string) => Promise<DesktopCaptureConfigApplied>;
1041 checkSnapShotShortcut?: (
1042 shortcut: SnapShotShortcut,
1043 ) => Promise<DesktopSnapShotShortcutAvailability>;
1044 setSnapShotShortcutSuppressed?: (suppressed: boolean) => Promise<void>;
1045 listPendingSnapShots?: () => Promise<readonly DesktopPendingSnapShot[]>;
1046 readSnapShot?: (id: string) => Promise<DesktopSnapShot>;
1047 setSnapShotAnimationDestination?: (
1048 destination: DesktopSnapShotAnimationDestination,
1049 ) => Promise<void>;
1050 dismissSnapShotAnimation?: (id: DesktopSnapShotId) => Promise<void>;
1051 acknowledgeSnapShot?: (id: string) => Promise<void>;
1052 ensureSshEnvironment: (
1053 target: DesktopSshEnvironmentTarget,
1054 options?: { issuePairingToken?: boolean },
1055 ) => Promise<DesktopSshEnvironmentBootstrap>;
1056 disconnectSshEnvironment: (target: DesktopSshEnvironmentTarget) => Promise<void>;
1057 fetchSshEnvironmentDescriptor: (httpBaseUrl: string) => Promise<ExecutionEnvironmentDescriptor>;
1058 bootstrapSshBearerSession: (
1059 httpBaseUrl: string,
1060 credential: string,
1061 ) => Promise<AuthAccessTokenResult>;
1062 fetchSshSessionState: (httpBaseUrl: string, bearerToken: string) => Promise<AuthSessionState>;
1063 issueSshWebSocketTicket: (
1064 httpBaseUrl: string,
1065 bearerToken: string,
1066 ) => Promise<AuthWebSocketTicketResult>;
1067 onSshPasswordPrompt: (listener: (request: DesktopSshPasswordPromptRequest) => void) => () => void;
1068 resolveSshPasswordPrompt: (requestId: string, password: string | null) => Promise<void>;
1069 getServerExposureState: () => Promise<DesktopServerExposureState>;
1070 setServerExposureMode: (mode: DesktopServerExposureMode) => Promise<DesktopServerExposureState>;
1071 setTailscaleServeEnabled: (input: {
1072 readonly enabled: boolean;
1073 readonly port?: number;
1074 }) => Promise<DesktopServerExposureState>;
1075 getAdvertisedEndpoints: () => Promise<readonly AdvertisedEndpoint[]>;
1076 getWslState: () => Promise<DesktopWslState>;
1077 setWslBackendEnabled: (enabled: boolean) => Promise<DesktopWslState>;
1078 setWslDistro: (distro: string | null) => Promise<DesktopWslState>;
1079 setWslOnly: (enabled: boolean) => Promise<DesktopWslState>;
1080 pickFolder: (options?: PickFolderOptions) => Promise<string | null>;
1081 pickProjectFavicon?: (initialPath?: string) => Promise<string | null>;
1082 pickThemeFiles?: () => Promise<readonly PickedThemeFile[] | null>;
1083 setTheme: (theme: DesktopTheme) => Promise<void>;
1084 showContextMenu: <T extends string>(
1085 items: readonly ContextMenuItem<T>[],
1086 position?: { x: number; y: number },
1087 ) => Promise<T | null>;
1088 receiveProviderAuthCallback?: (authorizationUrl: string) => Promise<string>;
1089 cancelProviderAuthCallback?: (authorizationUrl: string) => Promise<void>;
1090 openExternal: (url: string) => Promise<boolean>;
1091 openSystemSettings?: (pane: SystemSettingsPane) => Promise<boolean>;
1092 checkSystemPermission?: (pane: SystemSettingsPane) => Promise<boolean>;
1093 /** Older builds lack this; fall back to VS Code only. */
1094 probeRemoteEditors?: () => Promise<readonly EditorId[]>;
1095 pasteAsText?: () => Promise<void>;
1096 onMenuAction: (listener: (action: string) => void) => () => void;
1097 onSnapShotEvent?: (listener: (event: DesktopSnapShotEvent) => void) => () => void;
1098 onQuitShortcut?: (listener: (event: QuitShortcutHintEvent) => void) => () => void;
1099 getWindowFullscreenState: () => boolean;
1100 onWindowFullscreenStateChange: (listener: (fullscreen: boolean) => void) => () => void;
1101 /** App window zoom; older desktop shells omit this method. */
1102 getWindowZoomFactor?: () => number;
1103 getUpdateState: () => Promise<DesktopUpdateState>;
1104 setUpdateChannel: (channel: DesktopUpdateChannel) => Promise<DesktopUpdateState>;
1105 checkForUpdate: () => Promise<DesktopUpdateCheckResult>;
1106 downloadUpdate: () => Promise<DesktopUpdateActionResult>;
1107 installUpdate: () => Promise<DesktopUpdateActionResult>;
1108 onUpdateState: (listener: (state: DesktopUpdateState) => void) => () => void;
1109 cliCommand?: {
1110 getState: () => Promise<DesktopCliCommandState>;
1111 install: () => Promise<DesktopCliCommandState>;
1112 uninstall: () => Promise<DesktopCliCommandState>;
1113 };
1114 webLinks?: {
1115 setReady: (ready: boolean) => Promise<void>;
1116 onOpen: (listener: (url: string) => void) => () => void;
1117 };
1118 appActivation?: {
1119 setReady: (ready: boolean) => Promise<void>;
1120 complete: (response: DesktopAppActivationResponse) => Promise<void>;
1121 onRequest: (listener: (request: DesktopAppActivationRequest) => void) => () => void;
1122 };
1123 preview?: DesktopPreviewBridge;
1125​
1126/** Renderer callback invoked by Electron with a fresh user gesture before display-media capture. */
1127export const DESKTOP_PREVIEW_RECORDING_CAPTURE_TRIGGER = "__t3DesktopPreviewRecordingCapture";
1128​
1129export interface DesktopPreviewBridge {
1130 setForwardedShortcuts?: (shortcuts: ReadonlyArray<PreviewForwardedShortcut>) => Promise<void>;
1131 createTab: (tabId: string, defaults?: DesktopPreviewTabDefaults) => Promise<void>;
1132 closeTab: (tabId: string) => Promise<void>;
1133 registerWebview: (tabId: string, webContentsId: number) => Promise<void>;
1134 navigate: (tabId: string, url: string) => Promise<void>;
1135 goBack: (tabId: string) => Promise<void>;
1136 goForward: (tabId: string) => Promise<void>;
1137 refresh: (tabId: string) => Promise<void>;
1138 zoomIn: (tabId: string) => Promise<void>;
1139 zoomOut: (tabId: string) => Promise<void>;
1140 resetZoom: (tabId: string) => Promise<void>;
1141 setZoomFactor: (tabId: string, zoomFactor: number) => Promise<void>;
1142 hardReload: (tabId: string) => Promise<void>;
1143 setColorScheme: (tabId: string, colorScheme: DesktopPreviewColorScheme) => Promise<void>;
1144 setAudioMuted: (tabId: string, audioMuted: boolean) => Promise<void>;
1145 openDevTools: (tabId: string) => Promise<void>;
1146 clearCookies: (environmentId: EnvironmentId, profileId?: string) => Promise<void>;
1147 clearCache: (environmentId: EnvironmentId, profileId?: string) => Promise<void>;
1148 getPreviewConfig: (
1149 environmentId: EnvironmentId,
1150 profileId?: string,
1151 ) => Promise<DesktopPreviewWebviewConfig>;
1152 listBrowserImportSources: () => Promise<ReadonlyArray<BrowserImportSource>>;
1153 importBrowserCookies: (input: {
1154 readonly environmentId: EnvironmentId;
1155 readonly sourceId: BrowserImportSourceId;
1156 readonly sourceProfileDirectory: string;
1157 readonly targetProfileId: string;
1158 }) => Promise<BrowserImportResult>;
1159 setAnnotationTheme: (theme: DesktopPreviewAnnotationTheme) => Promise<void>;
1160 setAnnotationSendEnabled: (tabId: string, enabled: boolean) => Promise<void>;
1161 /** Resolves with the annotation and attach/send intent, or null on cancellation. Rejects if activation fails. */
1162 pickElement: (tabId: string) => Promise<PreviewAnnotationSubmissionResult | null>;
1163 cancelPickElement: (tabId: string) => Promise<void>;
1164 captureScreenshot: (
1165 tabId: string,
1166 ) => Promise<DesktopPreviewScreenshotArtifact | PreviewCaptureFailureEncoded>;
1167 revealArtifact: (path: string) => Promise<void>;
1168 copyArtifactToClipboard: (path: string) => Promise<void>;
1169 pictureInPicture: {
1170 open: (tabId: string) => Promise<void>;
1171 close: (tabId: string) => Promise<void>;
1172 };
1173 recording: {
1174 onInput: (listener: (event: DesktopPreviewRecordingInputEvent) => void) => () => void;
1175 startScreencast: (tabId: string) => Promise<void | PreviewCaptureFailureEncoded>;
1176 stopScreencast: (tabId: string) => Promise<void>;
1177 save: (
1178 tabId: string,
1179 mimeType: string,
1180 data: Uint8Array,
1181 ) => Promise<DesktopPreviewRecordingArtifact>;
1182 onFrame: (listener: (frame: DesktopPreviewRecordingFrame) => void) => () => void;
1183 };
1184 onStateChange: (listener: (tabId: string, state: DesktopPreviewTabState) => void) => () => void;
1185 onPointerEvent: (listener: (event: DesktopPreviewPointerEvent) => void) => () => void;
1186 onOpenLink: (listener: (event: DesktopPreviewOpenLinkEvent) => void) => () => void;
1188​
1189export type ConfirmDialogVariant = "default" | "destructive";
1190​
1191export interface ConfirmDialogOptions {
1192 readonly variant?: ConfirmDialogVariant;
1194​
1195export interface LocalApi {
1196 dialogs: {
1197 pickFolder: (options?: PickFolderOptions) => Promise<string | null>;
1198 confirm: (message: string, options?: ConfirmDialogOptions) => Promise<boolean>;
1199 };
1200 shell: {
1201 openExternal: (url: string) => Promise<void>;
1202 openSystemSettings: (pane: SystemSettingsPane) => Promise<void>;
1203 };
1204 contextMenu: {
1205 show: <T extends string>(
1206 items: readonly ContextMenuItem<T>[],
1207 position?: { x: number; y: number },
1208 ) => Promise<T | null>;
1209 close: () => Promise<void>;
1210 };
1211 persistence: {
1212 getClientSettings: () => Promise<ClientSettings | null>;
1213 setClientSettings: (settings: ClientSettings) => Promise<void>;
1214 };