1599 lines · 56.2 KB · TypeScript
RawDownload
import type {  VcsCreateRefInput,  VcsCreateRefResult,  VcsCreateWorktreeInput,  VcsCreateWorktreeResult,  VcsInitInput,  VcsListRefsInput,  VcsListRefsResult,  VcsPullInput,  VcsPullResult,  VcsRemoveWorktreeInput,  VcsSwitchRefInput,  VcsSwitchRefResult,  GitPreparePullRequestThreadInput,  GitPreparePullRequestThreadResult,  GitPullRequestRefInput,  GitResolvePullRequestResult,  VcsStatusInput,  VcsStatusResult,} from "./git.ts";import type {  ReviewDiffFileContentsInput,  ReviewDiffFileContentsResult,  ReviewDiffPreviewInput,  ReviewDiffPreviewResult,} from "./review.ts";import type { FilesystemBrowseInput, FilesystemBrowseResult } from "./filesystem.ts";import type { AssetCreateUrlInput, AssetCreateUrlResult } from "./assets.ts";import type {  ProjectListEntriesInput,  ProjectListEntriesResult,  ProjectReadFileInput,  ProjectReadFileResult,  ProjectSearchEntriesInput,  ProjectSearchEntriesResult,  ProjectWriteFileInput,  ProjectWriteFileResult,} from "./project.ts";import type {  TerminalAttachInput,  TerminalAttachStreamEvent,  TerminalClearInput,  TerminalCloseInput,  TerminalMetadataStreamEvent,  TerminalOpenInput,  TerminalResizeInput,  TerminalRestartInput,  TerminalSessionSnapshot,  TerminalWriteInput,} from "./terminal.ts";import * as Schema from "effect/Schema";import type {  DiscoveredLocalServerList,  PreviewCloseInput,  PreviewEvent,  PreviewListInput,  PreviewListResult,  PreviewNavigateInput,  PreviewOpenInput,  PreviewRefreshInput,  PreviewReportStatusInput,  PreviewResizeInput,  PreviewSessionSnapshot,} from "./preview.ts";import {  PreviewAutomationClickInput,  PreviewAutomationEvaluateInput,  PreviewAutomationHost,  PreviewAutomationHostFocus,  PreviewAutomationPressInput,  PreviewAutomationResponse,  PreviewAutomationScrollInput,  PreviewAutomationSnapshot,  PreviewAutomationStatus,  PreviewAutomationStreamEvent,  PreviewAutomationTypeInput,  PreviewAutomationWaitForInput,} from "./previewAutomation.ts";import type {  ClientOrchestrationCommand,  OrchestrationGetFullThreadDiffInput,  OrchestrationGetFullThreadDiffResult,  OrchestrationGetTurnDiffInput,  OrchestrationGetTurnDiffResult,  OrchestrationShellSnapshot,  OrchestrationShellStreamItem,  OrchestrationSubscribeThreadInput,  OrchestrationThreadStreamItem,} from "./orchestration.ts";import { SnapShotSource } from "./orchestration.ts";import { EnvironmentId, TrimmedNonEmptyString } from "./baseSchemas.ts";import { BrowserProfileId } from "./browserProfile.ts";import type {  BrowserImportResult,  BrowserImportSource,  BrowserImportSourceId,} from "./browserImport.ts";import { AuthAccessTokenResult, AuthSessionState, AuthWebSocketTicketResult } from "./auth.ts";import { AdvertisedEndpoint } from "./remoteAccess.ts";import { ExecutionEnvironmentDescriptor } from "./environment.ts";import { type ClientSettings, type QuitConfirmationMode, SnapShotShortcut } from "./settings.ts";import type { EditorId } from "./editor.ts";import type {  SourceControlCloneRepositoryInput,  SourceControlCloneRepositoryResult,  SourceControlPublishRepositoryInput,  SourceControlPublishRepositoryResult,  SourceControlRepositoryInfo,  SourceControlRepositoryLookupInput,} from "./sourceControl.ts";import type {  DesktopAppActivationRequest,  DesktopAppActivationResponse,} from "./desktopAppActivation.ts"; export interface ContextMenuItem<T extends string = string> {  id: T;  label: string;  destructive?: boolean;  disabled?: boolean;  /** Renders as a non-interactive section header label. Web fallback only — stripped on desktop native menus. */  header?: boolean;  /** Icon keyword resolved by the web fallback. Stripped on desktop native menus. */  icon?: string;  /** Inserts a visual section divider immediately before this item. */  separatorBefore?: boolean;  children?: readonly ContextMenuItem<T>[];} export type QuitShortcutHintEvent =  | { readonly state: "down"; readonly mode: Exclude<QuitConfirmationMode, "direct"> }  | { readonly state: "up" }; export interface ContextMenuItemSchemaType {  readonly id: string;  readonly label: string;  readonly destructive?: boolean;  readonly disabled?: boolean;  readonly header?: boolean;  readonly icon?: string;  readonly separatorBefore?: boolean;  readonly children?: readonly ContextMenuItemSchemaType[];} export const ContextMenuItemSchema: Schema.Codec<ContextMenuItemSchemaType> = Schema.Struct({  id: Schema.String,  label: Schema.String,  destructive: Schema.optionalKey(Schema.Boolean),  disabled: Schema.optionalKey(Schema.Boolean),  header: Schema.optionalKey(Schema.Boolean),  icon: Schema.optionalKey(Schema.String),  separatorBefore: Schema.optionalKey(Schema.Boolean),  children: Schema.optionalKey(    Schema.Array(      Schema.suspend((): Schema.Codec<ContextMenuItemSchemaType> => ContextMenuItemSchema),    ),  ),}); export type DesktopUpdateStatus =  | "disabled"  | "idle"  | "checking"  | "up-to-date"  | "available"  | "downloading"  | "downloaded"  | "error"; export type DesktopRuntimeArch = "arm64" | "x64" | "other";export type DesktopTheme = "light" | "dark" | "system";export type DesktopUpdateChannel = "latest" | "nightly";export type DesktopAppStageLabel = "Alpha" | "Dev" | "Nightly"; export const DesktopUpdateStatusSchema = Schema.Literals([  "disabled",  "idle",  "checking",  "up-to-date",  "available",  "downloading",  "downloaded",  "error",]);export const DesktopRuntimeArchSchema = Schema.Literals(["arm64", "x64", "other"]);export const DesktopThemeSchema = Schema.Literals(["light", "dark", "system"]);export const DesktopUpdateChannelSchema = Schema.Literals(["latest", "nightly"]);export const DesktopAppStageLabelSchema = Schema.Literals(["Alpha", "Dev", "Nightly"]); export interface DesktopAppBranding {  baseName: string;  stageLabel: DesktopAppStageLabel;  displayName: string;} export const DesktopAppBrandingSchema = Schema.Struct({  baseName: Schema.String,  stageLabel: DesktopAppStageLabelSchema,  displayName: Schema.String,}); export const DesktopSnapShotMode = Schema.Literals(["direct", "portal", "unavailable"]);export type DesktopSnapShotMode = typeof DesktopSnapShotMode.Type; export const DesktopCaptureExtensionState = Schema.Struct({  status: Schema.Literals([    "not-installed",    "disabled",    "enabled",    "restart-required",    "update-required",    "extensions-disabled",    "unsupported",    "error",  ]),  message: Schema.String,});export type DesktopCaptureExtensionState = typeof DesktopCaptureExtensionState.Type; export const DesktopCaptureHelperState = Schema.Struct({  status: Schema.Literals(["not-installed", "update-required", "ready", "error"]),  message: Schema.String,  feedbackAvailable: Schema.optional(Schema.Boolean),});export type DesktopCaptureHelperState = typeof DesktopCaptureHelperState.Type; export const DesktopSnapShotSetupAction = Schema.Literals([  "install-extension",  "enable-extension",  "disable-extension",  "install-kde-helper",  "remove-kde-helper",  "install-hyprland-helper",  "remove-hyprland-helper",  "test-mac-capture",  "allow-screen-recording",  "allow-accessibility",  "retry-shortcut",]);export type DesktopSnapShotSetupAction = typeof DesktopSnapShotSetupAction.Type; export const DesktopCaptureConfigRequest = Schema.Struct({  operation: Schema.Literals(["install", "remove"]),  chooseFile: Schema.Boolean,  shortcut: Schema.optional(Schema.String.check(Schema.isMaxLength(80))),});export type DesktopCaptureConfigRequest = typeof DesktopCaptureConfigRequest.Type; export const DesktopCaptureConfigPreview = Schema.Struct({  id: Schema.String,  path: Schema.String,  resolvedPath: Schema.String,  before: Schema.String,  after: Schema.String,  shortcut: Schema.String,  operation: Schema.Literals(["install", "remove"]),});export type DesktopCaptureConfigPreview = typeof DesktopCaptureConfigPreview.Type; export const DesktopCaptureConfigApplied = Schema.Struct({  backupPath: Schema.NullOr(Schema.String),  warning: Schema.NullOr(Schema.String),});export type DesktopCaptureConfigApplied = typeof DesktopCaptureConfigApplied.Type; export const DesktopSnapShotState = Schema.Struct({  mode: DesktopSnapShotMode,  windows: Schema.optional(Schema.Boolean),  linuxDesktop: Schema.optional(Schema.Literals(["gnome", "kde", "niri", "hyprland"])),  linuxBackend: Schema.optional(    Schema.Literals(["screenshot-portal", "gnome-extension", "niri", "kde", "hyprland", "picker"]),  ),  linuxFeedbackAvailable: Schema.optional(Schema.Boolean),  shortcut: SnapShotShortcut,  shortcutRegistered: Schema.Boolean,  shortcutPending: Schema.optional(Schema.Boolean),  shortcutCanRetry: Schema.optional(Schema.Boolean),  shortcutLabel: Schema.optional(Schema.String),  shortcutMessage: Schema.NullOr(Schema.String),  shortcutBinding: Schema.optional(Schema.String),  shortcutConfigPath: Schema.optional(Schema.String),  shortcutActionRegistered: Schema.optional(Schema.Boolean),  gnomeExtension: Schema.optional(DesktopCaptureExtensionState),  kdeHelper: Schema.optional(DesktopCaptureHelperState),  hyprlandHelper: Schema.optional(DesktopCaptureHelperState),  macPermissions: Schema.optional(    Schema.Struct({ screenRecording: Schema.Boolean, accessibility: Schema.Boolean }),  ),  shortcutVerified: Schema.optional(Schema.Boolean),  message: Schema.NullOr(Schema.String),});export type DesktopSnapShotState = typeof DesktopSnapShotState.Type; export const DesktopSnapShotShortcutAvailability = Schema.Struct({  available: Schema.Boolean,  message: Schema.NullOr(Schema.String),});export type DesktopSnapShotShortcutAvailability = typeof DesktopSnapShotShortcutAvailability.Type; export const DesktopSnapShotId = TrimmedNonEmptyString.check(  Schema.isMaxLength(64),  Schema.isPattern(/^[a-f0-9-]+$/i),);export type DesktopSnapShotId = typeof DesktopSnapShotId.Type; /** Main-process capture lifecycle pushes. `id` is absent for failures before a capture exists. */export const DesktopSnapShotEvent = Schema.Union([  Schema.Struct({ type: Schema.Literal("requested"), id: DesktopSnapShotId }),  Schema.Struct({ type: Schema.Literal("started"), id: DesktopSnapShotId }),  Schema.Struct({ type: Schema.Literal("ready"), id: DesktopSnapShotId }),  Schema.Struct({ type: Schema.Literal("failed"), id: Schema.optional(DesktopSnapShotId) }),  Schema.Struct({ type: Schema.Literal("shortcut-changed") }),]);export type DesktopSnapShotEvent = typeof DesktopSnapShotEvent.Type; export const DesktopPendingSnapShot = Schema.Struct({  id: DesktopSnapShotId,  name: Schema.String,  mimeType: Schema.Literal("image/png"),  sizeBytes: Schema.Int,  source: SnapShotSource,});export type DesktopPendingSnapShot = typeof DesktopPendingSnapShot.Type; export const DesktopSnapShot = Schema.Struct({  ...DesktopPendingSnapShot.fields,  dataUrl: Schema.String,});export type DesktopSnapShot = typeof DesktopSnapShot.Type; export const DesktopSnapShotAnimationDestination = Schema.Struct({  id: DesktopSnapShotId,  viewportFrame: Schema.Struct({    x: Schema.Number,    y: Schema.Number,    width: Schema.Number,    height: Schema.Number,  }),  backgroundColor: Schema.String,  borderColor: Schema.String,  borderWidth: Schema.Number,  cornerRadius: Schema.Number,  details: Schema.optional(    Schema.Struct({      appName: SnapShotSource.fields.appName,      windowTitle: SnapShotSource.fields.windowTitle,      appIconDataUrl: SnapShotSource.fields.appIconDataUrl,    }),  ),});export type DesktopSnapShotAnimationDestination = typeof DesktopSnapShotAnimationDestination.Type; export interface DesktopRuntimeInfo {  hostArch: DesktopRuntimeArch;  appArch: DesktopRuntimeArch;  runningUnderArm64Translation: boolean;} export interface DesktopUpdateState {  enabled: boolean;  status: DesktopUpdateStatus;  channel: DesktopUpdateChannel;  currentVersion: string;  hostArch: DesktopRuntimeArch;  appArch: DesktopRuntimeArch;  runningUnderArm64Translation: boolean;  availableVersion: string | null;  downloadedVersion: string | null;  releaseNotes: ReadonlyArray<DesktopUpdateReleaseNote>;  omittedReleaseCount: number;  downloadPercent: number | null;  checkedAt: string | null;  message: string | null;  errorContext: "check" | "download" | "install" | null;  canRetry: boolean;} export interface DesktopUpdateReleaseNote {  version: string;  items: ReadonlyArray<string>;  totalItems: number;} export const DesktopUpdateReleaseNoteSchema = Schema.Struct({  version: Schema.String,  items: Schema.Array(Schema.String),  totalItems: Schema.Number,}); export const DesktopUpdateStateSchema = Schema.Struct({  enabled: Schema.Boolean,  status: DesktopUpdateStatusSchema,  channel: DesktopUpdateChannelSchema,  currentVersion: Schema.String,  hostArch: DesktopRuntimeArchSchema,  appArch: DesktopRuntimeArchSchema,  runningUnderArm64Translation: Schema.Boolean,  availableVersion: Schema.NullOr(Schema.String),  downloadedVersion: Schema.NullOr(Schema.String),  releaseNotes: Schema.Array(DesktopUpdateReleaseNoteSchema),  omittedReleaseCount: Schema.Number,  downloadPercent: Schema.NullOr(Schema.Number),  checkedAt: Schema.NullOr(Schema.String),  message: Schema.NullOr(Schema.String),  errorContext: Schema.NullOr(Schema.Literals(["check", "download", "install"])),  canRetry: Schema.Boolean,}); export interface DesktopUpdateActionResult {  accepted: boolean;  completed: boolean;  state: DesktopUpdateState;} export const DesktopUpdateActionResultSchema = Schema.Struct({  accepted: Schema.Boolean,  completed: Schema.Boolean,  state: DesktopUpdateStateSchema,}); export interface DesktopUpdateCheckResult {  checked: boolean;  state: DesktopUpdateState;} export const DesktopUpdateCheckResultSchema = Schema.Struct({  checked: Schema.Boolean,  state: DesktopUpdateStateSchema,}); // Stable id for the Windows-native primary backend. Desktop side wraps// this with a brand inside DesktopBackendManager; web side keeps it as// a plain string so the env-runtime can compare against it without// importing brand machinery from the desktop package.export const PRIMARY_LOCAL_ENVIRONMENT_ID = "primary"; export interface DesktopEnvironmentBootstrap {  // Stable backend instance id (e.g. "primary" or "wsl:ubuntu"). The  // web env runtime keys local environments off this so projects  // routed to a specific backend reopen against the same one.  id: string;  label: string;  // Concrete WSL distro used by the current backend run. This stays separate  // from id because a default-tracking instance keeps the stable  // "wsl:default" IPC target while each run launches a specific distro.  runningDistro?: string | null;  httpBaseUrl: string | null;  wsBaseUrl: string | null;  bootstrapToken?: string;} export const DesktopEnvironmentBootstrapSchema = Schema.Struct({  id: Schema.String,  label: Schema.String,  runningDistro: Schema.optionalKey(Schema.NullOr(Schema.String)),  httpBaseUrl: Schema.NullOr(Schema.String),  wsBaseUrl: Schema.NullOr(Schema.String),  bootstrapToken: Schema.optionalKey(Schema.String),}); export const DesktopSshEnvironmentTargetSchema = Schema.Struct({  alias: Schema.String,  hostname: Schema.String,  username: Schema.NullOr(Schema.String),  port: Schema.NullOr(Schema.Number),});export type DesktopSshEnvironmentTarget = typeof DesktopSshEnvironmentTargetSchema.Type; export type DesktopSshHostSource = "ssh-config" | "known-hosts";export const DesktopSshHostSourceSchema = Schema.Literals(["ssh-config", "known-hosts"]); export interface DesktopDiscoveredSshHost extends DesktopSshEnvironmentTarget {  source: DesktopSshHostSource;} export const DesktopDiscoveredSshHostSchema = Schema.Struct({  alias: Schema.String,  hostname: Schema.String,  username: Schema.NullOr(Schema.String),  port: Schema.NullOr(Schema.Number),  source: DesktopSshHostSourceSchema,}); export interface DesktopSshEnvironmentBootstrap {  target: DesktopSshEnvironmentTarget;  httpBaseUrl: string;  wsBaseUrl: string;  pairingToken: string | null;  remotePort?: number;  remoteServerKind?: "external" | "managed";} export const DesktopSshEnvironmentBootstrapSchema = Schema.Struct({  target: DesktopSshEnvironmentTargetSchema,  httpBaseUrl: Schema.String,  wsBaseUrl: Schema.String,  pairingToken: Schema.NullOr(Schema.String),  remotePort: Schema.optionalKey(Schema.Number),  remoteServerKind: Schema.optionalKey(Schema.Literals(["external", "managed"])),});

Lines 1–500 of 1599.