Open History to see the last commit
1import type {
2 VcsCreateRefInput,
3 VcsCreateRefResult,
4 VcsCreateWorktreeInput,
5 VcsCreateWorktreeResult,
6 VcsInitInput,
7 VcsListRefsInput,
8 VcsListRefsResult,
9 VcsPullInput,
10 VcsPullResult,
11 VcsRemoveWorktreeInput,
12 VcsSwitchRefInput,
13 VcsSwitchRefResult,
14 GitPreparePullRequestThreadInput,
15 GitPreparePullRequestThreadResult,
16 GitPullRequestRefInput,
17 GitResolvePullRequestResult,
18 VcsStatusInput,
19 VcsStatusResult,
20} from "./git.ts";
21import type { ReviewDiffPreviewInput, ReviewDiffPreviewResult } from "./review.ts";
22import type { FilesystemBrowseInput, FilesystemBrowseResult } from "./filesystem.ts";
23import type { AssetCreateUrlInput, AssetCreateUrlResult } from "./assets.ts";
24import type {
25 ProjectListEntriesInput,
26 ProjectListEntriesResult,
27 ProjectReadFileInput,
28 ProjectReadFileResult,
29 ProjectSearchEntriesInput,
30 ProjectSearchEntriesResult,
31 ProjectWriteFileInput,
32 ProjectWriteFileResult,
33} from "./project.ts";
34import type { ProviderInstanceId } from "./providerInstance.ts";
35import type {
36 ServerConfig,
37 ServerProcessDiagnosticsResult,
38 ServerProcessResourceHistoryInput,
39 ServerProcessResourceHistoryResult,
40 ServerProviderUpdateInput,
41 ServerProviderUpdatedPayload,
42 ServerRemoveKeybindingResult,
43 ServerSignalProcessInput,
44 ServerSignalProcessResult,
45 ServerTraceDiagnosticsResult,
46 ServerUpsertKeybindingResult,
47} from "./server.ts";
48import type {
49 TerminalAttachInput,
50 TerminalAttachStreamEvent,
51 TerminalClearInput,
52 TerminalCloseInput,
53 TerminalMetadataStreamEvent,
54 TerminalOpenInput,
55 TerminalResizeInput,
56 TerminalRestartInput,
57 TerminalSessionSnapshot,
58 TerminalWriteInput,
59} from "./terminal.ts";
60import type { ServerRemoveKeybindingInput, ServerUpsertKeybindingInput } from "./server.ts";
61import * as Schema from "effect/Schema";
62import type {
63 DiscoveredLocalServerList,
64 PreviewCloseInput,
65 PreviewEvent,
66 PreviewListInput,
67 PreviewListResult,
68 PreviewNavigateInput,
69 PreviewOpenInput,
70 PreviewRefreshInput,
71 PreviewReportStatusInput,
72 PreviewResizeInput,
73 PreviewSessionSnapshot,
74} from "./preview.ts";
75import {
76 PreviewAutomationClickInput,
77 PreviewAutomationEvaluateInput,
78 PreviewAutomationHost,
79 PreviewAutomationHostFocus,
80 PreviewAutomationPressInput,
81 PreviewAutomationResponse,
82 PreviewAutomationScrollInput,
83 PreviewAutomationSnapshot,
84 PreviewAutomationStatus,
85 PreviewAutomationStreamEvent,
86 PreviewAutomationTypeInput,
87 PreviewAutomationWaitForInput,
88} from "./previewAutomation.ts";
89import type {
90 ClientOrchestrationCommand,
91 OrchestrationGetFullThreadDiffInput,
92 OrchestrationGetFullThreadDiffResult,
93 OrchestrationGetTurnDiffInput,
94 OrchestrationGetTurnDiffResult,
95 OrchestrationShellSnapshot,
96 OrchestrationShellStreamItem,
97 OrchestrationSubscribeThreadInput,
98 OrchestrationThreadStreamItem,
99} from "./orchestration.ts";
100import { EnvironmentId } from "./baseSchemas.ts";
101import { AuthAccessTokenResult, AuthSessionState, AuthWebSocketTicketResult } from "./auth.ts";
102import { AdvertisedEndpoint } from "./remoteAccess.ts";
103import { EditorId } from "./editor.ts";
104import { ExecutionEnvironmentDescriptor } from "./environment.ts";
105import type { ClientSettings, ServerSettings, ServerSettingsPatch } from "./settings.ts";
106import type {
107 SourceControlCloneRepositoryInput,
108 SourceControlCloneRepositoryResult,
109 SourceControlDiscoveryResult,
110 SourceControlPublishRepositoryInput,
111 SourceControlPublishRepositoryResult,
112 SourceControlRepositoryInfo,
113 SourceControlRepositoryLookupInput,
114} from "./sourceControl.ts";
115
116export interface ContextMenuItem<T extends string = string> {
117 id: T;
118 label: string;
119 destructive?: boolean;
120 disabled?: boolean;
121 /** Renders as a non-interactive section header label. Web fallback only — stripped on desktop native menus. */
122 header?: boolean;
123 /** Icon keyword resolved by the web fallback. Stripped on desktop native menus. */
124 icon?: string;
125 children?: readonly ContextMenuItem<T>[];
126}
127
128export interface ContextMenuItemSchemaType {
129 readonly id: string;
130 readonly label: string;
131 readonly destructive?: boolean;
132 readonly disabled?: boolean;
133 readonly header?: boolean;
134 readonly icon?: string;
135 readonly children?: readonly ContextMenuItemSchemaType[];
136}
137
138export const ContextMenuItemSchema: Schema.Codec<ContextMenuItemSchemaType> = Schema.Struct({
139 id: Schema.String,
140 label: Schema.String,
141 destructive: Schema.optionalKey(Schema.Boolean),
142 disabled: Schema.optionalKey(Schema.Boolean),
143 header: Schema.optionalKey(Schema.Boolean),
144 icon: Schema.optionalKey(Schema.String),
145 children: Schema.optionalKey(
146 Schema.Array(
147 Schema.suspend((): Schema.Codec<ContextMenuItemSchemaType> => ContextMenuItemSchema),
148 ),
149 ),
150});
151
152export type DesktopUpdateStatus =
153 | "disabled"
154 | "idle"
155 | "checking"
156 | "up-to-date"
157 | "available"
158 | "downloading"
159 | "downloaded"
160 | "error";
161
162export type DesktopRuntimeArch = "arm64" | "x64" | "other";
163export type DesktopTheme = "light" | "dark" | "system";
164export type DesktopUpdateChannel = "latest" | "nightly";
165export type DesktopAppStageLabel = "Alpha" | "Dev" | "Nightly";
166
167export const DesktopUpdateStatusSchema = Schema.Literals([
168 "disabled",
169 "idle",
170 "checking",
171 "up-to-date",
172 "available",
173 "downloading",
174 "downloaded",
175 "error",
176]);
177export const DesktopRuntimeArchSchema = Schema.Literals(["arm64", "x64", "other"]);
178export const DesktopThemeSchema = Schema.Literals(["light", "dark", "system"]);
179export const DesktopUpdateChannelSchema = Schema.Literals(["latest", "nightly"]);
180export const DesktopAppStageLabelSchema = Schema.Literals(["Alpha", "Dev", "Nightly"]);
181
182export interface DesktopAppBranding {
183 baseName: string;
184 stageLabel: DesktopAppStageLabel;
185 displayName: string;
186}
187
188export const DesktopAppBrandingSchema = Schema.Struct({
189 baseName: Schema.String,
190 stageLabel: DesktopAppStageLabelSchema,
191 displayName: Schema.String,
192});
193
194export interface DesktopRuntimeInfo {
195 hostArch: DesktopRuntimeArch;
196 appArch: DesktopRuntimeArch;
197 runningUnderArm64Translation: boolean;
198}
199
200export const DesktopRuntimeInfoSchema = Schema.Struct({
201 hostArch: DesktopRuntimeArchSchema,
202 appArch: DesktopRuntimeArchSchema,
203 runningUnderArm64Translation: Schema.Boolean,
204});
205
206export interface DesktopUpdateState {
207 enabled: boolean;
208 status: DesktopUpdateStatus;
209 channel: DesktopUpdateChannel;
210 currentVersion: string;
211 hostArch: DesktopRuntimeArch;
212 appArch: DesktopRuntimeArch;
213 runningUnderArm64Translation: boolean;
214 availableVersion: string | null;
215 downloadedVersion: string | null;
216 downloadPercent: number | null;
217 checkedAt: string | null;
218 message: string | null;
219 errorContext: "check" | "download" | "install" | null;
220 canRetry: boolean;
221}
222
223export const DesktopUpdateStateSchema = Schema.Struct({
224 enabled: Schema.Boolean,
225 status: DesktopUpdateStatusSchema,
226 channel: DesktopUpdateChannelSchema,
227 currentVersion: Schema.String,
228 hostArch: DesktopRuntimeArchSchema,
229 appArch: DesktopRuntimeArchSchema,
230 runningUnderArm64Translation: Schema.Boolean,
231 availableVersion: Schema.NullOr(Schema.String),
232 downloadedVersion: Schema.NullOr(Schema.String),
233 downloadPercent: Schema.NullOr(Schema.Number),
234 checkedAt: Schema.NullOr(Schema.String),
235 message: Schema.NullOr(Schema.String),
236 errorContext: Schema.NullOr(Schema.Literals(["check", "download", "install"])),
237 canRetry: Schema.Boolean,
238});
239
240export interface DesktopUpdateActionResult {
241 accepted: boolean;
242 completed: boolean;
243 state: DesktopUpdateState;
244}
245
246export const DesktopUpdateActionResultSchema = Schema.Struct({
247 accepted: Schema.Boolean,
248 completed: Schema.Boolean,
249 state: DesktopUpdateStateSchema,
250});
251
252export interface DesktopUpdateCheckResult {
253 checked: boolean;
254 state: DesktopUpdateState;
255}
256
257export const DesktopUpdateCheckResultSchema = Schema.Struct({
258 checked: Schema.Boolean,
259 state: DesktopUpdateStateSchema,
260});
261
262// Stable id for the Windows-native primary backend. Desktop side wraps
263// this with a brand inside DesktopBackendManager; web side keeps it as
264// a plain string so the env-runtime can compare against it without
265// importing brand machinery from the desktop package.
266export const PRIMARY_LOCAL_ENVIRONMENT_ID = "primary";
267
268export interface DesktopEnvironmentBootstrap {
269 // Stable backend instance id (e.g. "primary" or "wsl:ubuntu"). The
270 // web env runtime keys local environments off this so projects
271 // routed to a specific backend reopen against the same one.
272 id: string;
273 label: string;
274 // Concrete WSL distro used by the current backend run. This stays separate
275 // from id because a default-tracking instance keeps the stable
276 // "wsl:default" IPC target while each run launches a specific distro.
277 runningDistro?: string | null;
278 httpBaseUrl: string | null;
279 wsBaseUrl: string | null;
280 bootstrapToken?: string;
281}
282
283export const DesktopEnvironmentBootstrapSchema = Schema.Struct({
284 id: Schema.String,
285 label: Schema.String,
286 runningDistro: Schema.optionalKey(Schema.NullOr(Schema.String)),
287 httpBaseUrl: Schema.NullOr(Schema.String),
288 wsBaseUrl: Schema.NullOr(Schema.String),
289 bootstrapToken: Schema.optionalKey(Schema.String),
290});
291
292export const DesktopSshEnvironmentTargetSchema = Schema.Struct({
293 alias: Schema.String,
294 hostname: Schema.String,
295 username: Schema.NullOr(Schema.String),
296 port: Schema.NullOr(Schema.Number),
297});
298export type DesktopSshEnvironmentTarget = typeof DesktopSshEnvironmentTargetSchema.Type;
299
300export type DesktopSshHostSource = "ssh-config" | "known-hosts";
301export const DesktopSshHostSourceSchema = Schema.Literals(["ssh-config", "known-hosts"]);
302
303export interface DesktopDiscoveredSshHost extends DesktopSshEnvironmentTarget {
304 source: DesktopSshHostSource;
305}
306
307export const DesktopDiscoveredSshHostSchema = Schema.Struct({
308 alias: Schema.String,
309 hostname: Schema.String,
310 username: Schema.NullOr(Schema.String),
311 port: Schema.NullOr(Schema.Number),
312 source: DesktopSshHostSourceSchema,
313});
314
315export interface DesktopSshEnvironmentBootstrap {
316 target: DesktopSshEnvironmentTarget;
317 httpBaseUrl: string;
318 wsBaseUrl: string;
319 pairingToken: string | null;
320 remotePort?: number;
321 remoteServerKind?: "external" | "managed";
322}
323
324export const DesktopSshEnvironmentBootstrapSchema = Schema.Struct({
325 target: DesktopSshEnvironmentTargetSchema,
326 httpBaseUrl: Schema.String,
327 wsBaseUrl: Schema.String,
328 pairingToken: Schema.NullOr(Schema.String),
329 remotePort: Schema.optionalKey(Schema.Number),
330 remoteServerKind: Schema.optionalKey(Schema.Literals(["external", "managed"])),
331});
332
333export interface DesktopSshPasswordPromptRequest {
334 requestId: string;
335 destination: string;
336 username: string | null;
337 prompt: string;
338 expiresAt: string;
339}
340
341export const DesktopSshPasswordPromptRequestSchema = Schema.Struct({
342 requestId: Schema.String,
343 destination: Schema.String,
344 username: Schema.NullOr(Schema.String),
345 prompt: Schema.String,
346 expiresAt: Schema.String,
347});
348
349export const DesktopSshPasswordPromptCancelledType = "ssh-password-prompt-cancelled" as const;
350
351export const DesktopSshPasswordPromptCancelledResultSchema = Schema.Struct({
352 type: Schema.Literal(DesktopSshPasswordPromptCancelledType),
353 message: Schema.String,
354});
355
356export const DesktopSshEnvironmentEnsureOptionsSchema = Schema.Struct({
357 issuePairingToken: Schema.optionalKey(Schema.Boolean),
358});
359
360export const DesktopSshEnvironmentEnsureInputSchema = Schema.Struct({
361 target: DesktopSshEnvironmentTargetSchema,
362 options: Schema.optionalKey(DesktopSshEnvironmentEnsureOptionsSchema),
363});
364
365export const DesktopSshEnvironmentEnsureResultSchema = Schema.Union([
366 DesktopSshEnvironmentBootstrapSchema,
367 DesktopSshPasswordPromptCancelledResultSchema,
368]);
369
370export const DesktopSshHttpBaseUrlInputSchema = Schema.Struct({
371 httpBaseUrl: Schema.String,
372});
373
374export const DesktopSshBearerRequestInputSchema = Schema.Struct({
375 httpBaseUrl: Schema.String,
376 bearerToken: Schema.String,
377});
378
379export const DesktopSshBearerBootstrapInputSchema = Schema.Struct({
380 httpBaseUrl: Schema.String,
381 credential: Schema.String,
382});
383
384export const DesktopSshPasswordPromptResolutionInputSchema = Schema.Struct({
385 requestId: Schema.String,
386 password: Schema.NullOr(Schema.String),
387});
388
389export const PersistedSavedEnvironmentRecordSchema = Schema.Struct({
390 environmentId: EnvironmentId,
391 label: Schema.String,
392 wsBaseUrl: Schema.String,
393 httpBaseUrl: Schema.String,
394 createdAt: Schema.String,
395 lastConnectedAt: Schema.NullOr(Schema.String),
396 desktopSsh: Schema.optionalKey(DesktopSshEnvironmentTargetSchema),
397 relayManaged: Schema.optionalKey(
398 Schema.Struct({
399 relayUrl: Schema.String,
400 }),
401 ),
402});
403export type PersistedSavedEnvironmentRecord = typeof PersistedSavedEnvironmentRecordSchema.Type;
404
405export type DesktopServerExposureMode = "local-only" | "network-accessible";
406
407export const DesktopServerExposureModeSchema = Schema.Literals([
408 "local-only",
409 "network-accessible",
410]);
411
412export interface DesktopServerExposureState {
413 mode: DesktopServerExposureMode;
414 endpointUrl: string | null;
415 advertisedHost: string | null;
416 tailscaleServeEnabled: boolean;
417 tailscaleServePort: number;
418}
419
420export const DesktopServerExposureStateSchema = Schema.Struct({
421 mode: DesktopServerExposureModeSchema,
422 endpointUrl: Schema.NullOr(Schema.String),
423 advertisedHost: Schema.NullOr(Schema.String),
424 tailscaleServeEnabled: Schema.Boolean,
425 tailscaleServePort: Schema.Number,
426});
427
428export interface PickFolderOptions {
429 initialPath?: string | null;
430 // When set, the desktop dialog opens against the named backend's
431 // filesystem instead of the primary's. Used by callers that already
432 // know which local environment they're targeting (e.g. opening a
433 // project that lives inside WSL). Omitting it keeps the historical
434 // behavior so non-WSL users never see a different picker.
435 targetEnvironmentId?: string;
436}
437
438export const PickFolderOptionsSchema = Schema.Struct({
439 initialPath: Schema.optionalKey(Schema.NullOr(Schema.String)),
440 targetEnvironmentId: Schema.optionalKey(Schema.String),
441});
442
443export interface DesktopWslDistro {
444 name: string;
445 isDefault: boolean;
446 version: 1 | 2;
447}
448
449export const DesktopWslDistroSchema = Schema.Struct({
450 name: Schema.String,
451 isDefault: Schema.Boolean,
452 version: Schema.Literals([1, 2]),
453});
454
455export interface DesktopWslState {
456 // True when the user has opted the WSL backend in; the actual backend
457 // process is registered with the desktop pool independently of this
458 // flag and may take a moment to come up after the user enables it.
459 enabled: boolean;
460 // null means "track the current WSL default distro".
461 distro: string | null;
462 available: boolean;
463 // When true (and `enabled` is also true) the desktop runs only the
464 // WSL backend as the primary; the Windows-side Node backend is not
465 // started. Toggling this requires an app restart because the
466 // primary backend's spec is captured once at layer init.
467 wslOnly: boolean;
468 distros: readonly DesktopWslDistro[];
469 // Reason the dual-mode WSL backend last failed preflight (no node, wrong
470 // version, missing build tools), or null. Surfaced inline in Connections
471 // settings. Always null in wsl-only mode — that path shows a dialog and
472 // falls back to Windows instead.
473 preflightError: string | null;
474}
475
476export const DesktopWslStateSchema = Schema.Struct({
477 enabled: Schema.Boolean,
478 distro: Schema.NullOr(Schema.String),
479 available: Schema.Boolean,
480 wslOnly: Schema.Boolean,
481 distros: Schema.Array(DesktopWslDistroSchema),
482 preflightError: Schema.NullOr(Schema.String),
483});
484
485/**
486 * Renderer-facing snapshot of a desktop preview tab. Mirrors the main-process
487 * PreviewTabState shape but uses serialisable primitives only.
488 */
489export type DesktopPreviewNavStatus =
490 | { kind: "Idle" }
491 | { kind: "Loading"; url: string; title: string }
492 | { kind: "Success"; url: string; title: string }
493 | {
494 kind: "LoadFailed";
495 url: string;
496 title: string;
497 code: number;
498 description: string;
499 };
500
501export interface DesktopPreviewTabState {
502 tabId: string;
503 webContentsId: number | null;
504 navStatus: DesktopPreviewNavStatus;
505 canGoBack: boolean;
506 canGoForward: boolean;
507 /** Current zoom factor (1.0 = 100%). */
508 zoomFactor: number;
509 controller: "human" | "agent" | "none";
510 updatedAt: string;
511}
512
513export const DesktopPreviewTabIdSchema = Schema.String.check(Schema.isTrimmed()).check(
514 Schema.isNonEmpty(),
515);
516
517export const DesktopPreviewNavStatusSchema = Schema.Union([
518 Schema.Struct({ kind: Schema.Literal("Idle") }),
519 Schema.Struct({
520 kind: Schema.Literal("Loading"),
521 url: Schema.String,
522 title: Schema.String,
523 }),
524 Schema.Struct({
525 kind: Schema.Literal("Success"),
526 url: Schema.String,
527 title: Schema.String,
528 }),
529 Schema.Struct({
530 kind: Schema.Literal("LoadFailed"),
531 url: Schema.String,
532 title: Schema.String,
533 code: Schema.Number,
534 description: Schema.String,
535 }),
536]);
537
538export const DesktopPreviewTabStateSchema: Schema.Codec<DesktopPreviewTabState> = Schema.Struct({
539 tabId: DesktopPreviewTabIdSchema,
540 webContentsId: Schema.NullOr(Schema.Int),
541 navStatus: DesktopPreviewNavStatusSchema,
542 canGoBack: Schema.Boolean,
543 canGoForward: Schema.Boolean,
544 zoomFactor: Schema.Number,
545 controller: Schema.Literals(["human", "agent", "none"]),
546 updatedAt: Schema.String,
547});
548
549export interface DesktopPreviewPointerEvent {
550 tabId: string;
551 phase: "move" | "click";
552 x: number;
553 y: number;
554 sequence: number;
555 createdAt: string;
556}
557
558export const DesktopPreviewPointerEventSchema: Schema.Codec<DesktopPreviewPointerEvent> =
559 Schema.Struct({
560 tabId: DesktopPreviewTabIdSchema,
561 phase: Schema.Literals(["move", "click"]),
562 x: Schema.Number,
563 y: Schema.Number,
564 sequence: Schema.Int,
565 createdAt: Schema.String,
566 });
567
568/**
569 * Static config a renderer needs to mount a preview `<webview>`. Returned
570 * atomically by `DesktopPreviewBridge.getPreviewConfig()` so the renderer
571 * doesn't have to wait on three separate IPC round-trips before the webview
572 * can attach.
573 */
574export interface DesktopPreviewWebviewConfig {
575 /** `persist:v12-preview` (or whatever the desktop chose). */
576 partition: string;
577 /**
578 * Canonical `<webview webpreferences="...">` string. Encodes the security
579 * posture (sandboxed but contextIsolation off so the picker preload can
580 * read the page's React DevTools hook). Always present.
581 */
582 webPreferences: string;
583 /**
584 * Absolute `file://`-style URL to the picker preload bundle. Set to null
585 * when the bundle isn't present (older builds, broken install) — the
586 * renderer must then disable element-pick affordances.
587 */
588 preloadUrl: string | null;
589}
590
591export const DesktopPreviewWebviewConfigSchema: Schema.Codec<DesktopPreviewWebviewConfig> =
592 Schema.Struct({
593 partition: Schema.String,
594 webPreferences: Schema.String,
595 preloadUrl: Schema.NullOr(Schema.String),
596 });
597
598export interface DesktopPreviewAnnotationTheme {
599 colorScheme: "light" | "dark";
600 radius: string;
601 background: string;
602 foreground: string;
603 popover: string;
604 popoverForeground: string;
605 primary: string;
606 primaryForeground: string;
607 muted: string;
608 mutedForeground: string;
609 accent: string;
610 accentForeground: string;
611 border: string;
612 input: string;
613 ring: string;
614 fontSans: string;
615 fontMono: string;
616}
617
618export const DesktopPreviewAnnotationThemeSchema: Schema.Codec<DesktopPreviewAnnotationTheme> =
619 Schema.Struct({
620 colorScheme: Schema.Literals(["light", "dark"]),
621 radius: Schema.String,
622 background: Schema.String,
623 foreground: Schema.String,
624 popover: Schema.String,
625 popoverForeground: Schema.String,
626 primary: Schema.String,
627 primaryForeground: Schema.String,
628 muted: Schema.String,
629 mutedForeground: Schema.String,
630 accent: Schema.String,
631 accentForeground: Schema.String,
632 border: Schema.String,
633 input: Schema.String,
634 ring: Schema.String,
635 fontSans: Schema.String,
636 fontMono: Schema.String,
637 });
638
639export interface DesktopPreviewRecordingFrame {
640 tabId: string;
641 data: string;
642 width: number;
643 height: number;
644 receivedAt: string;
645}
646
647export const DesktopPreviewRecordingFrameSchema: Schema.Codec<DesktopPreviewRecordingFrame> =
648 Schema.Struct({
649 tabId: DesktopPreviewTabIdSchema,
650 data: Schema.String,
651 width: Schema.Number,
652 height: Schema.Number,
653 receivedAt: Schema.String,
654 });
655
656export interface DesktopPreviewRecordingArtifact {
657 id: string;
658 tabId: string;
659 path: string;
660 mimeType: string;
661 sizeBytes: number;
662 createdAt: string;
663}
664
665export const DesktopPreviewRecordingArtifactSchema: Schema.Codec<DesktopPreviewRecordingArtifact> =
666 Schema.Struct({
667 id: Schema.String,
668 tabId: DesktopPreviewTabIdSchema,
669 path: Schema.String,
670 mimeType: Schema.String,
671 sizeBytes: Schema.Int,
672 createdAt: Schema.String,
673 });
674
675export interface DesktopPreviewScreenshotArtifact {
676 id: string;
677 tabId: string;
678 path: string;
679 mimeType: "image/png";
680 sizeBytes: number;
681 createdAt: string;
682}
683
684export const DesktopPreviewScreenshotArtifactSchema: Schema.Codec<DesktopPreviewScreenshotArtifact> =
685 Schema.Struct({
686 id: Schema.String,
687 tabId: DesktopPreviewTabIdSchema,
688 path: Schema.String,
689 mimeType: Schema.Literal("image/png"),
690 sizeBytes: Schema.Int,
691 createdAt: Schema.String,
692 });
693
694/**
695 * Single stack frame captured by react-grab's `getElementContext`. We surface
696 * the source file/line so coding agents can jump straight to the JSX that
697 * produced the picked DOM node.
698 */
699export interface PickedElementStackFrame {
700 functionName: string | null;
701 fileName: string | null;
702 lineNumber: number | null;
703 columnNumber: number | null;
704}
705
706export const PickedElementStackFrameSchema: Schema.Codec<PickedElementStackFrame> = Schema.Struct({
707 functionName: Schema.NullOr(Schema.String),
708 fileName: Schema.NullOr(Schema.String),
709 lineNumber: Schema.NullOr(Schema.Number),
710 columnNumber: Schema.NullOr(Schema.Number),
711});
712
713/**
714 * A successful element pick from the preview webview. All fields are
715 * best-effort — pages that don't ship a React fiber tree (or aren't running
716 * in dev) will still produce a usable payload (selector + html preview),
717 * just without component / source attribution.
718 */
719export interface PickedElementPayload {
720 /** URL of the page the element was picked on. */
721 pageUrl: string;
722 /** Optional `<title>` of that page (best-effort). */
723 pageTitle: string | null;
724 /** Lowercase tag name, e.g. `"button"`. */
725 tagName: string;
726 /** CSS selector resolving back to the element on a re-render. */
727 selector: string | null;
728 /** Truncated outer-HTML preview (matches react-grab's `htmlPreview`). */
729 htmlPreview: string;
730 /** Nearest React component display name, or null when unavailable. */
731 componentName: string | null;
732 /** First source-mapped stack frame (file + line of the JSX source). */
733 source: PickedElementStackFrame | null;
734 /** Full owner-stack frames; can be empty. Useful for richer context. */
735 stack: ReadonlyArray<PickedElementStackFrame>;
736 /** Author CSS only (UA defaults stripped) — react-grab's `styles`. */
737 styles: string;
738 /** Wall-clock pick time as ISO-8601 string. */
739 pickedAt: string;
740}
741
742export const PickedElementPayloadSchema: Schema.Codec<PickedElementPayload> = Schema.Struct({
743 pageUrl: Schema.String,
744 pageTitle: Schema.NullOr(Schema.String),
745 tagName: Schema.String,
746 selector: Schema.NullOr(Schema.String),
747 htmlPreview: Schema.String,
748 componentName: Schema.NullOr(Schema.String),
749 source: Schema.NullOr(PickedElementStackFrameSchema),
750 stack: Schema.Array(PickedElementStackFrameSchema),
751 styles: Schema.String,
752 pickedAt: Schema.String,
753});
754
755export interface PreviewAnnotationRect {
756 x: number;
757 y: number;
758 width: number;
759 height: number;
760}
761
762export const PreviewAnnotationRectSchema: Schema.Codec<PreviewAnnotationRect> = Schema.Struct({
763 x: Schema.Number,
764 y: Schema.Number,
765 width: Schema.Number,
766 height: Schema.Number,
767});
768
769export interface PreviewAnnotationPoint {
770 x: number;
771 y: number;
772}
773
774export const PreviewAnnotationPointSchema: Schema.Codec<PreviewAnnotationPoint> = Schema.Struct({
775 x: Schema.Number,
776 y: Schema.Number,
777});
778
779export interface PreviewAnnotationElementTarget {
780 id: string;
781 element: PickedElementPayload;
782 rect: PreviewAnnotationRect;
783}
784
785export const PreviewAnnotationElementTargetSchema: Schema.Codec<PreviewAnnotationElementTarget> =
786 Schema.Struct({
787 id: Schema.String,
788 element: PickedElementPayloadSchema,
789 rect: PreviewAnnotationRectSchema,
790 });
791
792export interface PreviewAnnotationRegionTarget {
793 id: string;
794 rect: PreviewAnnotationRect;
795}
796
797export const PreviewAnnotationRegionTargetSchema: Schema.Codec<PreviewAnnotationRegionTarget> =
798 Schema.Struct({
799 id: Schema.String,
800 rect: PreviewAnnotationRectSchema,
801 });
802
803export interface PreviewAnnotationStrokeTarget {
804 id: string;
805 color: string;
806 width: number;
807 points: ReadonlyArray<PreviewAnnotationPoint>;
808 bounds: PreviewAnnotationRect;
809}
810
811export const PreviewAnnotationStrokeTargetSchema: Schema.Codec<PreviewAnnotationStrokeTarget> =
812 Schema.Struct({
813 id: Schema.String,
814 color: Schema.String,
815 width: Schema.Number,
816 points: Schema.Array(PreviewAnnotationPointSchema),
817 bounds: PreviewAnnotationRectSchema,
818 });
819
820export interface PreviewAnnotationStyleChange {
821 targetId: string;
822 selector: string | null;
823 property: string;
824 previousValue: string;
825 value: string;
826}
827
828export const PreviewAnnotationStyleChangeSchema: Schema.Codec<PreviewAnnotationStyleChange> =
829 Schema.Struct({
830 targetId: Schema.String,
831 selector: Schema.NullOr(Schema.String),
832 property: Schema.String,
833 previousValue: Schema.String,
834 value: Schema.String,
835 });
836
837export interface PreviewAnnotationScreenshot {
838 dataUrl: string;
839 width: number;
840 height: number;
841 cropRect: PreviewAnnotationRect;
842}
843
844export const PreviewAnnotationScreenshotSchema: Schema.Codec<PreviewAnnotationScreenshot> =
845 Schema.Struct({
846 dataUrl: Schema.String,
847 width: Schema.Number,
848 height: Schema.Number,
849 cropRect: PreviewAnnotationRectSchema,
850 });
851
852/**
853 * A submitted preview annotation. One annotation may reference multiple DOM
854 * elements, freeform regions, and ink strokes. The desktop main process adds
855 * the screenshot after the guest preload submits the structured draft.
856 */
857export interface PreviewAnnotationPayload {
858 id: string;
859 pageUrl: string;
860 pageTitle: string | null;
861 comment: string;
862 elements: ReadonlyArray<PreviewAnnotationElementTarget>;
863 regions: ReadonlyArray<PreviewAnnotationRegionTarget>;
864 strokes: ReadonlyArray<PreviewAnnotationStrokeTarget>;
865 styleChanges: ReadonlyArray<PreviewAnnotationStyleChange>;
866 screenshot: PreviewAnnotationScreenshot | null;
867 createdAt: string;
868}
869
870export const PreviewAnnotationPayloadSchema: Schema.Codec<PreviewAnnotationPayload> = Schema.Struct(
871 {
872 id: Schema.String,
873 pageUrl: Schema.String,
874 pageTitle: Schema.NullOr(Schema.String),
875 comment: Schema.String,
876 elements: Schema.Array(PreviewAnnotationElementTargetSchema),
877 regions: Schema.Array(PreviewAnnotationRegionTargetSchema),
878 strokes: Schema.Array(PreviewAnnotationStrokeTargetSchema),
879 styleChanges: Schema.Array(PreviewAnnotationStyleChangeSchema),
880 screenshot: Schema.NullOr(PreviewAnnotationScreenshotSchema),
881 createdAt: Schema.String,
882 },
883);
884
885export const DesktopPreviewTabInputSchema = Schema.Struct({
886 tabId: DesktopPreviewTabIdSchema,
887});
888
889export const DesktopPreviewRegisterWebviewInputSchema = Schema.Struct({
890 tabId: DesktopPreviewTabIdSchema,
891 webContentsId: Schema.Int.check(Schema.isGreaterThan(0)),
892});
893
894export const DesktopPreviewNavigateInputSchema = Schema.Struct({
895 tabId: DesktopPreviewTabIdSchema,
896 url: Schema.String,
897});
898
899export const DesktopPreviewConfigInputSchema = Schema.Struct({
900 environmentId: EnvironmentId,
901});
902
903export const DesktopPreviewAnnotationThemeInputSchema = Schema.Struct({
904 theme: DesktopPreviewAnnotationThemeSchema,
905});
906
907export const DesktopPreviewArtifactInputSchema = Schema.Struct({
908 path: Schema.String.check(Schema.isTrimmed()).check(Schema.isNonEmpty()),
909});
910
911export const DesktopPreviewRecordingSaveInputSchema = Schema.Struct({
912 tabId: DesktopPreviewTabIdSchema,
913 mimeType: Schema.String.check(Schema.isTrimmed()).check(Schema.isNonEmpty()),
914 data: Schema.Uint8Array,
915});
916
917export const DesktopPreviewAutomationClickInputSchema = Schema.Struct({
918 tabId: DesktopPreviewTabIdSchema,
919 input: PreviewAutomationClickInput,
920});
921
922export const DesktopPreviewAutomationTypeInputSchema = Schema.Struct({
923 tabId: DesktopPreviewTabIdSchema,
924 input: PreviewAutomationTypeInput,
925});
926
927export const DesktopPreviewAutomationPressInputSchema = Schema.Struct({
928 tabId: DesktopPreviewTabIdSchema,
929 input: PreviewAutomationPressInput,
930});
931
932export const DesktopPreviewAutomationScrollInputSchema = Schema.Struct({
933 tabId: DesktopPreviewTabIdSchema,
934 input: PreviewAutomationScrollInput,
935});
936
937export const DesktopPreviewAutomationEvaluateInputSchema = Schema.Struct({
938 tabId: DesktopPreviewTabIdSchema,
939 input: PreviewAutomationEvaluateInput,
940});
941
942export const DesktopPreviewAutomationWaitForInputSchema = Schema.Struct({
943 tabId: DesktopPreviewTabIdSchema,
944 input: PreviewAutomationWaitForInput,
945});
946
947export interface DesktopBridge {
948 getAppBranding: () => DesktopAppBranding | null;
949 // One bootstrap per pool instance currently registered with bootstrap
950 // info (omits instances whose backend hasn't produced a config yet).
951 // The primary backend is identified by id === PRIMARY_LOCAL_ENVIRONMENT_ID.
952 getLocalEnvironmentBootstraps: () => readonly DesktopEnvironmentBootstrap[];
953 getLocalEnvironmentBearerToken: () => Promise<string>;
954 getClientSettings: () => Promise<ClientSettings | null>;
955 setClientSettings: (settings: ClientSettings) => Promise<void>;
956 getConnectionCatalog?: () => Promise<string | null>;
957 setConnectionCatalog?: (catalog: string) => Promise<boolean>;
958 clearConnectionCatalog?: () => Promise<void>;
959 discoverSshHosts: () => Promise<readonly DesktopDiscoveredSshHost[]>;
960 ensureSshEnvironment: (
961 target: DesktopSshEnvironmentTarget,
962 options?: { issuePairingToken?: boolean },
963 ) => Promise<DesktopSshEnvironmentBootstrap>;
964 disconnectSshEnvironment: (target: DesktopSshEnvironmentTarget) => Promise<void>;
965 fetchSshEnvironmentDescriptor: (httpBaseUrl: string) => Promise<ExecutionEnvironmentDescriptor>;
966 bootstrapSshBearerSession: (
967 httpBaseUrl: string,
968 credential: string,
969 ) => Promise<AuthAccessTokenResult>;
970 fetchSshSessionState: (httpBaseUrl: string, bearerToken: string) => Promise<AuthSessionState>;
971 issueSshWebSocketTicket: (
972 httpBaseUrl: string,
973 bearerToken: string,
974 ) => Promise<AuthWebSocketTicketResult>;
975 onSshPasswordPrompt: (listener: (request: DesktopSshPasswordPromptRequest) => void) => () => void;
976 resolveSshPasswordPrompt: (requestId: string, password: string | null) => Promise<void>;
977 getServerExposureState: () => Promise<DesktopServerExposureState>;
978 setServerExposureMode: (mode: DesktopServerExposureMode) => Promise<DesktopServerExposureState>;
979 setTailscaleServeEnabled: (input: {
980 readonly enabled: boolean;
981 readonly port?: number;
982 }) => Promise<DesktopServerExposureState>;
983 getAdvertisedEndpoints: () => Promise<readonly AdvertisedEndpoint[]>;
984 getWslState: () => Promise<DesktopWslState>;
985 setWslBackendEnabled: (enabled: boolean) => Promise<DesktopWslState>;
986 setWslDistro: (distro: string | null) => Promise<DesktopWslState>;
987 setWslOnly: (enabled: boolean) => Promise<DesktopWslState>;
988 pickFolder: (options?: PickFolderOptions) => Promise<string | null>;
989 confirm: (message: string) => Promise<boolean>;
990 setTheme: (theme: DesktopTheme) => Promise<void>;
991 showContextMenu: <T extends string>(
992 items: readonly ContextMenuItem<T>[],
993 position?: { x: number; y: number },
994 ) => Promise<T | null>;
995 openExternal: (url: string) => Promise<boolean>;
996 onMenuAction: (listener: (action: string) => void) => () => void;
997 getWindowFullscreenState: () => boolean;
998 onWindowFullscreenStateChange: (listener: (fullscreen: boolean) => void) => () => void;
999 getUpdateState: () => Promise<DesktopUpdateState>;
1000 setUpdateChannel: (channel: DesktopUpdateChannel) => Promise<DesktopUpdateState>;
1001 checkForUpdate: () => Promise<DesktopUpdateCheckResult>;
1002 downloadUpdate: () => Promise<DesktopUpdateActionResult>;
1003 installUpdate: () => Promise<DesktopUpdateActionResult>;
1004 onUpdateState: (listener: (state: DesktopUpdateState) => void) => () => void;
1005 /**
1006 * Desktop-only preview surface. Present iff the renderer is hosted by the
1007 * Electron desktop build; web builds have `preview === undefined`.
1008 */
1009 preview?: DesktopPreviewBridge;
1010}
1011
1012export interface DesktopPreviewBridge {
1013 createTab: (tabId: string) => Promise<void>;
1014 closeTab: (tabId: string) => Promise<void>;
1015 registerWebview: (tabId: string, webContentsId: number) => Promise<void>;
1016 navigate: (tabId: string, url: string) => Promise<void>;
1017 goBack: (tabId: string) => Promise<void>;
1018 goForward: (tabId: string) => Promise<void>;
1019 refresh: (tabId: string) => Promise<void>;
1020 zoomIn: (tabId: string) => Promise<void>;
1021 zoomOut: (tabId: string) => Promise<void>;
1022 resetZoom: (tabId: string) => Promise<void>;
1023 /** Reload bypassing the HTTP cache. */
1024 hardReload: (tabId: string) => Promise<void>;
1025 /** Open the guest webview's DevTools (detached). */
1026 openDevTools: (tabId: string) => Promise<void>;
1027 /** Drop cookies + storage data for the preview partition (all tabs). */
1028 clearCookies: () => Promise<void>;
1029 /** Drop the HTTP cache for the preview partition (all tabs). */
1030 clearCache: () => Promise<void>;
1031 /**
1032 * One-shot config for mounting a preview `<webview>`. Replaces three
1033 * earlier round-trip calls (`getBrowserPartition`, `getWebviewPreferences`,
1034 * `getPickPreloadPath`) so adding a new field here only requires touching
1035 * the contract + main, not the renderer's mount logic.
1036 */
1037 getPreviewConfig: (environmentId: EnvironmentId) => Promise<DesktopPreviewWebviewConfig>;
1038 setAnnotationTheme: (theme: DesktopPreviewAnnotationTheme) => Promise<void>;
1039 /**
1040 * Activate the in-page element picker for the given tab. Resolves with
1041 * the picked payload, or `null` when the user cancels (Escape / nav). The
1042 * promise rejects if the picker can't be activated (no webview, etc.).
1043 */
1044 pickElement: (tabId: string) => Promise<PreviewAnnotationPayload | null>;
1045 /** Cancel an in-flight preview annotation session. */
1046 cancelPickElement: (tabId: string) => Promise<void>;
1047 captureScreenshot: (tabId: string) => Promise<DesktopPreviewScreenshotArtifact>;
1048 revealArtifact: (path: string) => Promise<void>;
1049 copyArtifactToClipboard: (path: string) => Promise<void>;
1050 recording: {
1051 startScreencast: (tabId: string) => Promise<void>;
1052 stopScreencast: (tabId: string) => Promise<void>;
1053 save: (
1054 tabId: string,
1055 mimeType: string,
1056 data: Uint8Array,
1057 ) => Promise<DesktopPreviewRecordingArtifact>;
1058 onFrame: (listener: (frame: DesktopPreviewRecordingFrame) => void) => () => void;
1059 };
1060 automation: {
1061 status: (tabId: string) => Promise<PreviewAutomationStatus>;
1062 snapshot: (tabId: string) => Promise<PreviewAutomationSnapshot>;
1063 click: (tabId: string, input: PreviewAutomationClickInput) => Promise<void>;
1064 type: (tabId: string, input: PreviewAutomationTypeInput) => Promise<void>;
1065 press: (tabId: string, input: PreviewAutomationPressInput) => Promise<void>;
1066 scroll: (tabId: string, input: PreviewAutomationScrollInput) => Promise<void>;
1067 evaluate: (tabId: string, input: PreviewAutomationEvaluateInput) => Promise<unknown>;
1068 waitFor: (tabId: string, input: PreviewAutomationWaitForInput) => Promise<void>;
1069 };
1070 onStateChange: (listener: (tabId: string, state: DesktopPreviewTabState) => void) => () => void;
1071 onPointerEvent: (listener: (event: DesktopPreviewPointerEvent) => void) => () => void;
1072}
1073
1074/**
1075 * APIs bound to the local app shell, not to any particular backend environment.
1076 *
1077 * These capabilities describe the desktop/browser host that the user is
1078 * currently running: dialogs, editor/external-link opening, context menus, and
1079 * app-level settings/config access. They must not be used as a proxy for
1080 * "whatever environment the user is targeting", because in a multi-environment
1081 * world the local shell and a selected backend environment are distinct
1082 * concepts.
1083 */
1084export interface LocalApi {
1085 dialogs: {
1086 pickFolder: (options?: PickFolderOptions) => Promise<string | null>;
1087 confirm: (message: string) => Promise<boolean>;
1088 };
1089 shell: {
1090 openInEditor: (cwd: string, editor: EditorId) => Promise<void>;
1091 openExternal: (url: string) => Promise<void>;
1092 };
1093 contextMenu: {
1094 show: <T extends string>(
1095 items: readonly ContextMenuItem<T>[],
1096 position?: { x: number; y: number },
1097 ) => Promise<T | null>;
1098 };
1099 persistence: {
1100 getClientSettings: () => Promise<ClientSettings | null>;
1101 setClientSettings: (settings: ClientSettings) => Promise<void>;
1102 };
1103 server: {
1104 getConfig: () => Promise<ServerConfig>;
1105 /**
1106 * Refresh provider snapshots. When `input.instanceId` is supplied only that
1107 * configured instance is probed; otherwise every configured instance is
1108 * refreshed (legacy untargeted refresh).
1109 */
1110 refreshProviders: (input?: {
1111 readonly instanceId?: ProviderInstanceId;
1112 }) => Promise<ServerProviderUpdatedPayload>;
1113 updateProvider: (input: ServerProviderUpdateInput) => Promise<ServerProviderUpdatedPayload>;
1114 upsertKeybinding: (input: ServerUpsertKeybindingInput) => Promise<ServerUpsertKeybindingResult>;
1115 removeKeybinding: (input: ServerRemoveKeybindingInput) => Promise<ServerRemoveKeybindingResult>;
1116 getSettings: () => Promise<ServerSettings>;
1117 updateSettings: (patch: ServerSettingsPatch) => Promise<ServerSettings>;
1118 discoverSourceControl: () => Promise<SourceControlDiscoveryResult>;
1119 getTraceDiagnostics: () => Promise<ServerTraceDiagnosticsResult>;
1120 getProcessDiagnostics: () => Promise<ServerProcessDiagnosticsResult>;
1121 getProcessResourceHistory: (
1122 input: ServerProcessResourceHistoryInput,
1123 ) => Promise<ServerProcessResourceHistoryResult>;
1124 signalProcess: (input: ServerSignalProcessInput) => Promise<ServerSignalProcessResult>;
1125 };
1126}
1127
1128/**
1129 * APIs bound to a specific backend environment connection.
1130 *
1131 * These operations must always be routed with explicit environment context.
1132 * They represent remote stateful capabilities such as orchestration, terminal,
1133 * project, VCS, and provider operations. In multi-environment mode, each environment gets
1134 * its own instance of this surface, and callers should resolve it by
1135 * `environmentId` rather than reaching through the local desktop bridge.
1136 */
1137export interface EnvironmentApi {
1138 terminal: {
1139 open: (input: typeof TerminalOpenInput.Encoded) => Promise<TerminalSessionSnapshot>;
1140 attach: (
1141 input: typeof TerminalAttachInput.Encoded,
1142 callback: (event: TerminalAttachStreamEvent) => void,
1143 options?: {
1144 onResubscribe?: () => void;
1145 },
1146 ) => () => void;
1147 write: (input: typeof TerminalWriteInput.Encoded) => Promise<void>;
1148 resize: (input: typeof TerminalResizeInput.Encoded) => Promise<void>;
1149 clear: (input: typeof TerminalClearInput.Encoded) => Promise<void>;
1150 restart: (input: typeof TerminalRestartInput.Encoded) => Promise<TerminalSessionSnapshot>;
1151 close: (input: typeof TerminalCloseInput.Encoded) => Promise<void>;
1152 onMetadata: (
1153 callback: (event: TerminalMetadataStreamEvent) => void,
1154 options?: {
1155 onResubscribe?: () => void;
1156 },
1157 ) => () => void;
1158 };
1159 projects: {
1160 listEntries: (input: ProjectListEntriesInput) => Promise<ProjectListEntriesResult>;
1161 readFile: (input: ProjectReadFileInput) => Promise<ProjectReadFileResult>;
1162 searchEntries: (input: ProjectSearchEntriesInput) => Promise<ProjectSearchEntriesResult>;
1163 writeFile: (input: ProjectWriteFileInput) => Promise<ProjectWriteFileResult>;
1164 };
1165 filesystem: {
1166 browse: (input: FilesystemBrowseInput) => Promise<FilesystemBrowseResult>;
1167 };
1168 assets: {
1169 createUrl: (input: AssetCreateUrlInput) => Promise<AssetCreateUrlResult>;
1170 };
1171 sourceControl: {
1172 lookupRepository: (
1173 input: SourceControlRepositoryLookupInput,
1174 ) => Promise<SourceControlRepositoryInfo>;
1175 cloneRepository: (
1176 input: SourceControlCloneRepositoryInput,
1177 ) => Promise<SourceControlCloneRepositoryResult>;
1178 publishRepository: (
1179 input: SourceControlPublishRepositoryInput,
1180 ) => Promise<SourceControlPublishRepositoryResult>;
1181 };
1182 vcs: {
1183 listRefs: (input: VcsListRefsInput) => Promise<VcsListRefsResult>;
1184 createWorktree: (input: VcsCreateWorktreeInput) => Promise<VcsCreateWorktreeResult>;
1185 removeWorktree: (input: VcsRemoveWorktreeInput) => Promise<void>;
1186 createRef: (input: VcsCreateRefInput) => Promise<VcsCreateRefResult>;
1187 switchRef: (input: VcsSwitchRefInput) => Promise<VcsSwitchRefResult>;
1188 init: (input: VcsInitInput) => Promise<void>;
1189 pull: (input: VcsPullInput) => Promise<VcsPullResult>;
1190 refreshStatus: (input: VcsStatusInput) => Promise<VcsStatusResult>;
1191 onStatus: (
1192 input: VcsStatusInput,
1193 callback: (status: VcsStatusResult) => void,
1194 options?: {
1195 onResubscribe?: () => void;
1196 },
1197 ) => () => void;
1198 };
1199 git: {
1200 resolvePullRequest: (input: GitPullRequestRefInput) => Promise<GitResolvePullRequestResult>;
1201 preparePullRequestThread: (
1202 input: GitPreparePullRequestThreadInput,
1203 ) => Promise<GitPreparePullRequestThreadResult>;
1204 };
1205 review: {
1206 getDiffPreview: (input: ReviewDiffPreviewInput) => Promise<ReviewDiffPreviewResult>;
1207 };
1208 orchestration: {
1209 dispatchCommand: (command: ClientOrchestrationCommand) => Promise<{ sequence: number }>;
1210 getTurnDiff: (input: OrchestrationGetTurnDiffInput) => Promise<OrchestrationGetTurnDiffResult>;
1211 getFullThreadDiff: (
1212 input: OrchestrationGetFullThreadDiffInput,
1213 ) => Promise<OrchestrationGetFullThreadDiffResult>;
1214 getArchivedShellSnapshot: () => Promise<OrchestrationShellSnapshot>;
1215 subscribeShell: (
1216 callback: (event: OrchestrationShellStreamItem) => void,
1217 options?: {
1218 onResubscribe?: () => void;
1219 },
1220 ) => () => void;
1221 subscribeThread: (
1222 input: OrchestrationSubscribeThreadInput,
1223 callback: (event: OrchestrationThreadStreamItem) => void,
1224 options?: {
1225 onResubscribe?: () => void;
1226 },
1227 ) => () => void;
1228 };
1229 preview: {
1230 open: (input: typeof PreviewOpenInput.Encoded) => Promise<PreviewSessionSnapshot>;
1231 navigate: (input: typeof PreviewNavigateInput.Encoded) => Promise<PreviewSessionSnapshot>;
1232 resize: (input: typeof PreviewResizeInput.Encoded) => Promise<PreviewSessionSnapshot>;
1233 refresh: (input: typeof PreviewRefreshInput.Encoded) => Promise<void>;
1234 close: (input: typeof PreviewCloseInput.Encoded) => Promise<void>;
1235 list: (input: typeof PreviewListInput.Encoded) => Promise<PreviewListResult>;
1236 reportStatus: (input: typeof PreviewReportStatusInput.Encoded) => Promise<void>;
1237 automation: {
1238 connect: (
1239 input: PreviewAutomationHost,
1240 callback: (event: PreviewAutomationStreamEvent) => void,
1241 options?: { onResubscribe?: () => void },
1242 ) => () => void;
1243 respond: (response: PreviewAutomationResponse) => Promise<void>;
1244 focusHost: (input: PreviewAutomationHostFocus) => Promise<void>;
1245 };
1246 onEvent: (
1247 callback: (event: PreviewEvent) => void,
1248 options?: { onResubscribe?: () => void },
1249 ) => () => void;
1250 subscribePorts: (
1251 callback: (servers: DiscoveredLocalServerList) => void,
1252 options?: { onResubscribe?: () => void },
1253 ) => () => void;
1254 };
1255}