Open History to see the last commit
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>[];
34}
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[];
50}
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;
102}
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;
265}
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;
285}
286
287export interface DesktopUpdateReleaseNote {
288 version: string;
289 items: ReadonlyArray<string>;
290 totalItems: number;
291}
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;
331}
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;
342}
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;
360}
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;
384}
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";
401}
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;
418}
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;
489}
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;
502}
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;
514}
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;
526}
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;
543}
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;
578}
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 favicon?: DesktopPreviewFavicon;
594 updatedAt: string;
595}
596
597export const DesktopPreviewTabIdSchema = Schema.String.check(Schema.isTrimmed()).check(
598 Schema.isNonEmpty(),
599);
600
601export interface DesktopPreviewPointerEvent {
602 tabId: string;
603 phase: "move" | "click";
604 x: number;
605 y: number;
606 sequence: number;
607 createdAt: string;
608}
609
610export interface DesktopPreviewOpenLinkEvent {
611 tabId: string;
612 url: string;
613 background: boolean;
614}
615
616export const DesktopPreviewRecordingInputSchema = Schema.Union([
617 Schema.Struct({
618 type: Schema.Literal("pointer"),
619 phase: Schema.Literals(["move", "down", "up", "click"]),
620 x: Schema.Finite,
621 y: Schema.Finite,
622 width: Schema.Finite.check(Schema.isGreaterThan(0)),
623 height: Schema.Finite.check(Schema.isGreaterThan(0)),
624 }),
625 Schema.Struct({
626 type: Schema.Literal("key"),
627 label: Schema.NullOr(Schema.String.check(Schema.isMaxLength(100))),
628 held: Schema.Boolean,
629 width: Schema.Finite.check(Schema.isGreaterThan(0)),
630 }),
631 Schema.Struct({ type: Schema.Literal("clear") }),
632]);
633export type DesktopPreviewRecordingInput = typeof DesktopPreviewRecordingInputSchema.Type;
634export interface DesktopPreviewRecordingInputEvent {
635 readonly tabId: string;
636 readonly input: DesktopPreviewRecordingInput;
637}
638
639export interface DesktopPreviewWebviewConfig {
640 partition: string;
641 /** Sandboxed with contextIsolation off so the picker preload can read the React DevTools hook. */
642 webPreferences: string;
643 /** Absolute file:// preload URL; null requires disabling element picking. */
644 preloadUrl: string | null;
645}
646
647export const DesktopPreviewWebviewConfigSchema: Schema.Codec<DesktopPreviewWebviewConfig> =
648 Schema.Struct({
649 partition: Schema.String,
650 webPreferences: Schema.String,
651 preloadUrl: Schema.NullOr(Schema.String),
652 });
653
654export interface DesktopPreviewAnnotationTheme {
655 colorScheme: "light" | "dark";
656 radius: string;
657 background: string;
658 foreground: string;
659 popover: string;
660 popoverForeground: string;
661 primary: string;
662 primaryForeground: string;
663 muted: string;
664 mutedForeground: string;
665 accent: string;
666 accentForeground: string;
667 border: string;
668 input: string;
669 ring: string;
670 fontSans: string;
671 fontMono: string;
672}
673
674export const DesktopPreviewAnnotationThemeSchema: Schema.Codec<DesktopPreviewAnnotationTheme> =
675 Schema.Struct({
676 colorScheme: Schema.Literals(["light", "dark"]),
677 radius: Schema.String,
678 background: Schema.String,
679 foreground: Schema.String,
680 popover: Schema.String,
681 popoverForeground: Schema.String,
682 primary: Schema.String,
683 primaryForeground: Schema.String,
684 muted: Schema.String,
685 mutedForeground: Schema.String,
686 accent: Schema.String,
687 accentForeground: Schema.String,
688 border: Schema.String,
689 input: Schema.String,
690 ring: Schema.String,
691 fontSans: Schema.String,
692 fontMono: Schema.String,
693 });
694
695export interface DesktopPreviewRecordingFrame {
696 tabId: string;
697 data: string;
698 width: number;
699 height: number;
700 receivedAt: string;
701}
702
703export interface DesktopPreviewRecordingArtifact {
704 id: string;
705 tabId: string;
706 path: string;
707 mimeType: string;
708 sizeBytes: number;
709 createdAt: string;
710}
711
712export const DesktopPreviewRecordingArtifactSchema: Schema.Codec<DesktopPreviewRecordingArtifact> =
713 Schema.Struct({
714 id: Schema.String,
715 tabId: DesktopPreviewTabIdSchema,
716 path: Schema.String,
717 mimeType: Schema.String,
718 sizeBytes: Schema.Int,
719 createdAt: Schema.String,
720 });
721
722export interface DesktopPreviewScreenshotArtifact {
723 id: string;
724 tabId: string;
725 path: string;
726 mimeType: "image/png";
727 sizeBytes: number;
728 createdAt: string;
729}
730
731export const DesktopPreviewScreenshotArtifactSchema: Schema.Codec<DesktopPreviewScreenshotArtifact> =
732 Schema.Struct({
733 id: Schema.String,
734 tabId: DesktopPreviewTabIdSchema,
735 path: Schema.String,
736 mimeType: Schema.Literal("image/png"),
737 sizeBytes: Schema.Int,
738 createdAt: Schema.String,
739 });
740
741export interface PickedElementStackFrame {
742 functionName: string | null;
743 fileName: string | null;
744 lineNumber: number | null;
745 columnNumber: number | null;
746}
747
748export const PickedElementStackFrameSchema: Schema.Codec<PickedElementStackFrame> = Schema.Struct({
749 functionName: Schema.NullOr(Schema.String),
750 fileName: Schema.NullOr(Schema.String),
751 lineNumber: Schema.NullOr(Schema.Number),
752 columnNumber: Schema.NullOr(Schema.Number),
753});
754
755export interface PickedElementPayload {
756 pageUrl: string;
757 pageTitle: string | null;
758 tagName: string;
759 selector: string | null;
760 htmlPreview: string;
761 componentName: string | null;
762 source: PickedElementStackFrame | null;
763 stack: ReadonlyArray<PickedElementStackFrame>;
764 styles: string;
765 pickedAt: string;
766}
767
768export const PickedElementPayloadSchema: Schema.Codec<PickedElementPayload> = Schema.Struct({
769 pageUrl: Schema.String,
770 pageTitle: Schema.NullOr(Schema.String),
771 tagName: Schema.String,
772 selector: Schema.NullOr(Schema.String),
773 htmlPreview: Schema.String,
774 componentName: Schema.NullOr(Schema.String),
775 source: Schema.NullOr(PickedElementStackFrameSchema),
776 stack: Schema.Array(PickedElementStackFrameSchema),
777 styles: Schema.String,
778 pickedAt: Schema.String,
779});
780
781export interface PreviewAnnotationRect {
782 x: number;
783 y: number;
784 width: number;
785 height: number;
786}
787
788export const PreviewAnnotationRectSchema: Schema.Codec<PreviewAnnotationRect> = Schema.Struct({
789 x: Schema.Number,
790 y: Schema.Number,
791 width: Schema.Number,
792 height: Schema.Number,
793});
794
795export interface PreviewAnnotationPoint {
796 x: number;
797 y: number;
798}
799
800export const PreviewAnnotationPointSchema: Schema.Codec<PreviewAnnotationPoint> = Schema.Struct({
801 x: Schema.Number,
802 y: Schema.Number,
803});
804
805export interface PreviewAnnotationElementTarget {
806 id: string;
807 element: PickedElementPayload;
808 rect: PreviewAnnotationRect;
809}
810
811export const PreviewAnnotationElementTargetSchema: Schema.Codec<PreviewAnnotationElementTarget> =
812 Schema.Struct({
813 id: Schema.String,
814 element: PickedElementPayloadSchema,
815 rect: PreviewAnnotationRectSchema,
816 });
817
818export interface PreviewAnnotationRegionTarget {
819 id: string;
820 rect: PreviewAnnotationRect;
821}
822
823export const PreviewAnnotationRegionTargetSchema: Schema.Codec<PreviewAnnotationRegionTarget> =
824 Schema.Struct({
825 id: Schema.String,
826 rect: PreviewAnnotationRectSchema,
827 });
828
829export interface PreviewAnnotationStrokeTarget {
830 id: string;
831 color: string;
832 width: number;
833 points: ReadonlyArray<PreviewAnnotationPoint>;
834 bounds: PreviewAnnotationRect;
835}
836
837export const PreviewAnnotationStrokeTargetSchema: Schema.Codec<PreviewAnnotationStrokeTarget> =
838 Schema.Struct({
839 id: Schema.String,
840 color: Schema.String,
841 width: Schema.Number,
842 points: Schema.Array(PreviewAnnotationPointSchema),
843 bounds: PreviewAnnotationRectSchema,
844 });
845
846export interface PreviewAnnotationStyleChange {
847 targetId: string;
848 selector: string | null;
849 property: string;
850 previousValue: string;
851 value: string;
852}
853
854export const PreviewAnnotationStyleChangeSchema: Schema.Codec<PreviewAnnotationStyleChange> =
855 Schema.Struct({
856 targetId: Schema.String,
857 selector: Schema.NullOr(Schema.String),
858 property: Schema.String,
859 previousValue: Schema.String,
860 value: Schema.String,
861 });
862
863export interface PreviewAnnotationScreenshot {
864 dataUrl: string;
865 width: number;
866 height: number;
867 cropRect: PreviewAnnotationRect;
868}
869
870export const PreviewAnnotationScreenshotSchema: Schema.Codec<PreviewAnnotationScreenshot> =
871 Schema.Struct({
872 dataUrl: Schema.String,
873 width: Schema.Number,
874 height: Schema.Number,
875 cropRect: PreviewAnnotationRectSchema,
876 });
877
878export interface PreviewAnnotationPayload {
879 id: string;
880 pageUrl: string;
881 pageTitle: string | null;
882 comment: string;
883 elements: ReadonlyArray<PreviewAnnotationElementTarget>;
884 regions: ReadonlyArray<PreviewAnnotationRegionTarget>;
885 strokes: ReadonlyArray<PreviewAnnotationStrokeTarget>;
886 styleChanges: ReadonlyArray<PreviewAnnotationStyleChange>;
887 screenshot: PreviewAnnotationScreenshot | null;
888 createdAt: string;
889}
890
891export const PreviewAnnotationPayloadSchema: Schema.Codec<PreviewAnnotationPayload> = Schema.Struct(
892 {
893 id: Schema.String,
894 pageUrl: Schema.String,
895 pageTitle: Schema.NullOr(Schema.String),
896 comment: Schema.String,
897 elements: Schema.Array(PreviewAnnotationElementTargetSchema),
898 regions: Schema.Array(PreviewAnnotationRegionTargetSchema),
899 strokes: Schema.Array(PreviewAnnotationStrokeTargetSchema),
900 styleChanges: Schema.Array(PreviewAnnotationStyleChangeSchema),
901 screenshot: Schema.NullOr(PreviewAnnotationScreenshotSchema),
902 createdAt: Schema.String,
903 },
904);
905
906export type PreviewAnnotationSubmission = "attach" | "send";
907export const PreviewAnnotationSubmissionSchema: Schema.Codec<PreviewAnnotationSubmission> =
908 Schema.Literals(["attach", "send"]);
909
910export interface PreviewAnnotationSubmissionResult {
911 annotation: PreviewAnnotationPayload;
912 submission: PreviewAnnotationSubmission;
913 screenshotFailed?: boolean;
914}
915export const PreviewAnnotationSubmissionResultSchema: Schema.Codec<PreviewAnnotationSubmissionResult> =
916 Schema.Struct({
917 annotation: PreviewAnnotationPayloadSchema,
918 submission: PreviewAnnotationSubmissionSchema,
919 screenshotFailed: Schema.optionalKey(Schema.Boolean),
920 });
921
922export const DesktopPreviewTabInputSchema = Schema.Struct({
923 tabId: DesktopPreviewTabIdSchema,
924});
925
926/** Apply zoom and color scheme at creation to avoid flashing browser defaults. */
927export const DesktopPreviewCreateTabInputSchema = Schema.Struct({
928 tabId: DesktopPreviewTabIdSchema,
929 zoomFactor: Schema.optional(Schema.Number.check(Schema.isGreaterThan(0))),
930 colorScheme: Schema.optional(DesktopPreviewColorSchemeSchema),
931 serverTab: Schema.optional(
932 Schema.Struct({ threadId: TrimmedNonEmptyString, tabId: TrimmedNonEmptyString }),
933 ),
934});
935
936export interface DesktopPreviewTabDefaults {
937 readonly zoomFactor?: number | undefined;
938 readonly colorScheme?: DesktopPreviewColorScheme | undefined;
939 readonly serverTab?: { readonly threadId: string; readonly tabId: string } | undefined;
940}
941
942export const DesktopPreviewRegisterWebviewInputSchema = Schema.Struct({
943 tabId: DesktopPreviewTabIdSchema,
944 webContentsId: Schema.Int.check(Schema.isGreaterThan(0)),
945});
946
947export const DesktopPreviewNavigateInputSchema = Schema.Struct({
948 tabId: DesktopPreviewTabIdSchema,
949 url: Schema.String,
950});
951
952export const DesktopPreviewConfigInputSchema = Schema.Struct({
953 environmentId: EnvironmentId,
954 /** Main must derive the partition to ensure its session has UA rewrites and permission handlers. */
955 profileId: Schema.optional(BrowserProfileId),
956});
957
958export const DesktopPreviewClearDataInputSchema = Schema.Struct({
959 environmentId: EnvironmentId,
960 /** Omit to clear every profile; otherwise only this profile's partition. */
961 profileId: Schema.optional(BrowserProfileId),
962});
963
964export const DesktopPreviewSetColorSchemeInputSchema = Schema.Struct({
965 tabId: DesktopPreviewTabIdSchema,
966 colorScheme: DesktopPreviewColorSchemeSchema,
967});
968
969export const DesktopPreviewSetZoomFactorInputSchema = Schema.Struct({
970 tabId: DesktopPreviewTabIdSchema,
971 zoomFactor: Schema.Number.check(Schema.isGreaterThan(0)),
972});
973
974export const DesktopPreviewSetAudioMutedInputSchema = Schema.Struct({
975 tabId: DesktopPreviewTabIdSchema,
976 audioMuted: Schema.Boolean,
977});
978
979export const DesktopPreviewAnnotationThemeInputSchema = Schema.Struct({
980 theme: DesktopPreviewAnnotationThemeSchema,
981});
982
983export const DesktopPreviewAnnotationSendEnabledInputSchema = Schema.Struct({
984 tabId: DesktopPreviewTabIdSchema,
985 enabled: Schema.Boolean,
986});
987
988export const DesktopPreviewArtifactInputSchema = Schema.Struct({
989 path: Schema.String.check(Schema.isTrimmed()).check(Schema.isNonEmpty()),
990});
991
992export const DesktopPreviewRecordingSaveInputSchema = Schema.Struct({
993 tabId: DesktopPreviewTabIdSchema,
994 mimeType: Schema.String.check(Schema.isTrimmed()).check(Schema.isNonEmpty()),
995 data: Schema.Uint8Array,
996});
997
998export const SystemSettingsPaneSchema = Schema.Literals(["full-disk-access"]);
999export type SystemSettingsPane = typeof SystemSettingsPaneSchema.Type;
1000
1001export interface DesktopBridge {
1002 getAppBranding: () => DesktopAppBranding | null;
1003 getRelayTelemetryEnabled?: () => boolean;
1004 getPathForFile?: (file: File) => string;
1005 getClientPlatform?: () => string;
1006 setNotificationBadge?: (badge: { count: number; image: string | null }) => Promise<void>;
1007 onNotificationBadgeClear?: (listener: () => void) => () => void;
1008 onTrackpadScrollEnd?: (listener: () => void) => () => void;
1009 /**
1010 * Renderer `window.focus()` cannot raise an Electron window, and on Wayland
1011 * only the main process can spend a notification click's activation token.
1012 */
1013 revealWindow?: () => Promise<void>;
1014 /**
1015 * The OS locale as a BCP-47 tag, which the renderer cannot read for itself:
1016 * the packaged app ships only the `en-US` Chromium locale pak, so
1017 * `navigator.language` and the default `Intl` locale are pinned to `en-US`
1018 * regardless of OS settings.
1019 */
1020 getSystemLocale?: () => string | null;
1021 getLocalEnvironmentBootstraps: () => readonly DesktopEnvironmentBootstrap[];
1022 getLocalEnvironmentEnabled?: () => boolean;
1023 setLocalEnvironmentEnabled?: (enabled: boolean) => Promise<void>;
1024 getLocalEnvironmentBearerToken: () => Promise<string>;
1025 getClientSettings: () => Promise<ClientSettings | null>;
1026 setClientSettings: (settings: ClientSettings) => Promise<void>;
1027 getConnectionCatalog?: () => Promise<string | null>;
1028 setConnectionCatalog?: (catalog: string) => Promise<boolean>;
1029 clearConnectionCatalog?: () => Promise<void>;
1030 discoverSshHosts: () => Promise<readonly DesktopDiscoveredSshHost[]>;
1031 resolveSshHost: (alias: string) => Promise<DesktopSshEnvironmentTarget>;
1032 requestSnapShotPermissions?: (includeAccessibility: boolean) => Promise<void>;
1033 getSnapShotState?: () => Promise<DesktopSnapShotState>;
1034 setupSnapShot?: (action: DesktopSnapShotSetupAction) => Promise<void>;
1035 previewSnapShotConfig?: (
1036 request: DesktopCaptureConfigRequest,
1037 ) => Promise<DesktopCaptureConfigPreview | null>;
1038 applySnapShotConfig?: (previewId: string) => Promise<DesktopCaptureConfigApplied>;
1039 checkSnapShotShortcut?: (
1040 shortcut: SnapShotShortcut,
1041 ) => Promise<DesktopSnapShotShortcutAvailability>;
1042 setSnapShotShortcutSuppressed?: (suppressed: boolean) => Promise<void>;
1043 listPendingSnapShots?: () => Promise<readonly DesktopPendingSnapShot[]>;
1044 readSnapShot?: (id: string) => Promise<DesktopSnapShot>;
1045 setSnapShotAnimationDestination?: (
1046 destination: DesktopSnapShotAnimationDestination,
1047 ) => Promise<void>;
1048 dismissSnapShotAnimation?: (id: DesktopSnapShotId) => Promise<void>;
1049 acknowledgeSnapShot?: (id: string) => Promise<void>;
1050 ensureSshEnvironment: (
1051 target: DesktopSshEnvironmentTarget,
1052 options?: { issuePairingToken?: boolean },
1053 ) => Promise<DesktopSshEnvironmentBootstrap>;
1054 disconnectSshEnvironment: (target: DesktopSshEnvironmentTarget) => Promise<void>;
1055 fetchSshEnvironmentDescriptor: (httpBaseUrl: string) => Promise<ExecutionEnvironmentDescriptor>;
1056 bootstrapSshBearerSession: (
1057 httpBaseUrl: string,
1058 credential: string,
1059 ) => Promise<AuthAccessTokenResult>;
1060 fetchSshSessionState: (httpBaseUrl: string, bearerToken: string) => Promise<AuthSessionState>;
1061 issueSshWebSocketTicket: (
1062 httpBaseUrl: string,
1063 bearerToken: string,
1064 ) => Promise<AuthWebSocketTicketResult>;
1065 onSshPasswordPrompt: (listener: (request: DesktopSshPasswordPromptRequest) => void) => () => void;
1066 resolveSshPasswordPrompt: (requestId: string, password: string | null) => Promise<void>;
1067 getServerExposureState: () => Promise<DesktopServerExposureState>;
1068 setServerExposureMode: (mode: DesktopServerExposureMode) => Promise<DesktopServerExposureState>;
1069 setTailscaleServeEnabled: (input: {
1070 readonly enabled: boolean;
1071 readonly port?: number;
1072 }) => Promise<DesktopServerExposureState>;
1073 getAdvertisedEndpoints: () => Promise<readonly AdvertisedEndpoint[]>;
1074 getWslState: () => Promise<DesktopWslState>;
1075 setWslBackendEnabled: (enabled: boolean) => Promise<DesktopWslState>;
1076 setWslDistro: (distro: string | null) => Promise<DesktopWslState>;
1077 setWslOnly: (enabled: boolean) => Promise<DesktopWslState>;
1078 pickFolder: (options?: PickFolderOptions) => Promise<string | null>;
1079 pickProjectFavicon?: (initialPath?: string) => Promise<string | null>;
1080 pickThemeFiles?: () => Promise<readonly PickedThemeFile[] | null>;
1081 setTheme: (theme: DesktopTheme) => Promise<void>;
1082 showContextMenu: <T extends string>(
1083 items: readonly ContextMenuItem<T>[],
1084 position?: { x: number; y: number },
1085 ) => Promise<T | null>;
1086 receiveProviderAuthCallback?: (authorizationUrl: string) => Promise<string>;
1087 cancelProviderAuthCallback?: (authorizationUrl: string) => Promise<void>;
1088 openExternal: (url: string) => Promise<boolean>;
1089 openSystemSettings?: (pane: SystemSettingsPane) => Promise<boolean>;
1090 checkSystemPermission?: (pane: SystemSettingsPane) => Promise<boolean>;
1091 /** Older builds lack this; fall back to VS Code only. */
1092 probeRemoteEditors?: () => Promise<readonly EditorId[]>;
1093 pasteAsText?: () => Promise<void>;
1094 onMenuAction: (listener: (action: string) => void) => () => void;
1095 onSnapShotEvent?: (listener: (event: DesktopSnapShotEvent) => void) => () => void;
1096 onQuitShortcut?: (listener: (event: QuitShortcutHintEvent) => void) => () => void;
1097 getWindowFullscreenState: () => boolean;
1098 onWindowFullscreenStateChange: (listener: (fullscreen: boolean) => void) => () => void;
1099 /** App window zoom; older desktop shells omit this method. */
1100 getWindowZoomFactor?: () => number;
1101 getUpdateState: () => Promise<DesktopUpdateState>;
1102 setUpdateChannel: (channel: DesktopUpdateChannel) => Promise<DesktopUpdateState>;
1103 checkForUpdate: () => Promise<DesktopUpdateCheckResult>;
1104 downloadUpdate: () => Promise<DesktopUpdateActionResult>;
1105 installUpdate: () => Promise<DesktopUpdateActionResult>;
1106 onUpdateState: (listener: (state: DesktopUpdateState) => void) => () => void;
1107 cliCommand?: {
1108 getState: () => Promise<DesktopCliCommandState>;
1109 install: () => Promise<DesktopCliCommandState>;
1110 uninstall: () => Promise<DesktopCliCommandState>;
1111 };
1112 webLinks?: {
1113 setReady: (ready: boolean) => Promise<void>;
1114 onOpen: (listener: (url: string) => void) => () => void;
1115 };
1116 appActivation?: {
1117 setReady: (ready: boolean) => Promise<void>;
1118 complete: (response: DesktopAppActivationResponse) => Promise<void>;
1119 onRequest: (listener: (request: DesktopAppActivationRequest) => void) => () => void;
1120 };
1121 preview?: DesktopPreviewBridge;
1122}
1123
1124/** Renderer callback invoked by Electron with a fresh user gesture before display-media capture. */
1125export const DESKTOP_PREVIEW_RECORDING_CAPTURE_TRIGGER = "__t3DesktopPreviewRecordingCapture";
1126
1127export interface DesktopPreviewBridge {
1128 setForwardedShortcuts?: (shortcuts: ReadonlyArray<PreviewForwardedShortcut>) => Promise<void>;
1129 createTab: (tabId: string, defaults?: DesktopPreviewTabDefaults) => Promise<void>;
1130 closeTab: (tabId: string) => Promise<void>;
1131 registerWebview: (tabId: string, webContentsId: number) => Promise<void>;
1132 navigate: (tabId: string, url: string) => Promise<void>;
1133 goBack: (tabId: string) => Promise<void>;
1134 goForward: (tabId: string) => Promise<void>;
1135 refresh: (tabId: string) => Promise<void>;
1136 zoomIn: (tabId: string) => Promise<void>;
1137 zoomOut: (tabId: string) => Promise<void>;
1138 resetZoom: (tabId: string) => Promise<void>;
1139 setZoomFactor: (tabId: string, zoomFactor: number) => Promise<void>;
1140 hardReload: (tabId: string) => Promise<void>;
1141 setColorScheme: (tabId: string, colorScheme: DesktopPreviewColorScheme) => Promise<void>;
1142 setAudioMuted: (tabId: string, audioMuted: boolean) => Promise<void>;
1143 openDevTools: (tabId: string) => Promise<void>;
1144 clearCookies: (environmentId: EnvironmentId, profileId?: string) => Promise<void>;
1145 clearCache: (environmentId: EnvironmentId, profileId?: string) => Promise<void>;
1146 getPreviewConfig: (
1147 environmentId: EnvironmentId,
1148 profileId?: string,
1149 ) => Promise<DesktopPreviewWebviewConfig>;
1150 listBrowserImportSources: () => Promise<ReadonlyArray<BrowserImportSource>>;
1151 importBrowserCookies: (input: {
1152 readonly environmentId: EnvironmentId;
1153 readonly sourceId: BrowserImportSourceId;
1154 readonly sourceProfileDirectory: string;
1155 readonly targetProfileId: string;
1156 }) => Promise<BrowserImportResult>;
1157 setAnnotationTheme: (theme: DesktopPreviewAnnotationTheme) => Promise<void>;
1158 setAnnotationSendEnabled: (tabId: string, enabled: boolean) => Promise<void>;
1159 /** Resolves with the annotation and attach/send intent, or null on cancellation. Rejects if activation fails. */
1160 pickElement: (tabId: string) => Promise<PreviewAnnotationSubmissionResult | null>;
1161 cancelPickElement: (tabId: string) => Promise<void>;
1162 captureScreenshot: (
1163 tabId: string,
1164 ) => Promise<DesktopPreviewScreenshotArtifact | PreviewCaptureFailureEncoded>;
1165 revealArtifact: (path: string) => Promise<void>;
1166 copyArtifactToClipboard: (path: string) => Promise<void>;
1167 pictureInPicture: {
1168 open: (tabId: string) => Promise<void>;
1169 close: (tabId: string) => Promise<void>;
1170 };
1171 recording: {
1172 onInput: (listener: (event: DesktopPreviewRecordingInputEvent) => void) => () => void;
1173 startScreencast: (tabId: string) => Promise<void | PreviewCaptureFailureEncoded>;
1174 stopScreencast: (tabId: string) => Promise<void>;
1175 save: (
1176 tabId: string,
1177 mimeType: string,
1178 data: Uint8Array,
1179 ) => Promise<DesktopPreviewRecordingArtifact>;
1180 onFrame: (listener: (frame: DesktopPreviewRecordingFrame) => void) => () => void;
1181 };
1182 onStateChange: (listener: (tabId: string, state: DesktopPreviewTabState) => void) => () => void;
1183 onPointerEvent: (listener: (event: DesktopPreviewPointerEvent) => void) => () => void;
1184 onOpenLink: (listener: (event: DesktopPreviewOpenLinkEvent) => void) => () => void;
1185}
1186
1187export type ConfirmDialogVariant = "default" | "destructive";
1188
1189export interface ConfirmDialogOptions {
1190 readonly variant?: ConfirmDialogVariant;
1191}
1192
1193export interface LocalApi {
1194 dialogs: {
1195 pickFolder: (options?: PickFolderOptions) => Promise<string | null>;
1196 confirm: (message: string, options?: ConfirmDialogOptions) => Promise<boolean>;
1197 };
1198 shell: {
1199 openExternal: (url: string) => Promise<void>;
1200 openSystemSettings: (pane: SystemSettingsPane) => Promise<void>;
1201 };
1202 contextMenu: {
1203 show: <T extends string>(
1204 items: readonly ContextMenuItem<T>[],
1205 position?: { x: number; y: number },
1206 ) => Promise<T | null>;
1207 close: () => Promise<void>;
1208 };
1209 persistence: {
1210 getClientSettings: () => Promise<ClientSettings | null>;
1211 setClientSettings: (settings: ClientSettings) => Promise<void>;
1212 };
1213}