1203 lines · 40.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 { 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 { ProviderInstanceId } from "./providerInstance.ts";import type {  ServerConfig,  ServerProcessDiagnosticsResult,  ServerProcessResourceHistoryInput,  ServerProcessResourceHistoryResult,  ServerProviderUpdateInput,  ServerProviderUpdatedPayload,  ServerRemoveKeybindingResult,  ServerSignalProcessInput,  ServerSignalProcessResult,  ServerTraceDiagnosticsResult,  ServerUpsertKeybindingResult,} from "./server.ts";import type {  TerminalAttachInput,  TerminalAttachStreamEvent,  TerminalClearInput,  TerminalCloseInput,  TerminalMetadataStreamEvent,  TerminalOpenInput,  TerminalResizeInput,  TerminalRestartInput,  TerminalSessionSnapshot,  TerminalWriteInput,} from "./terminal.ts";import type { ServerRemoveKeybindingInput, ServerUpsertKeybindingInput } from "./server.ts";import * as Schema from "effect/Schema";import type {  DiscoveredLocalServerList,  PreviewCloseInput,  PreviewEvent,  PreviewListInput,  PreviewListResult,  PreviewNavigateInput,  PreviewOpenInput,  PreviewRefreshInput,  PreviewReportStatusInput,  PreviewSessionSnapshot,} from "./preview.ts";import {  PreviewAutomationClickInput,  PreviewAutomationEvaluateInput,  PreviewAutomationOwner,  PreviewAutomationOwnerIdentity,  PreviewAutomationPressInput,  PreviewAutomationRequest,  PreviewAutomationResponse,  PreviewAutomationScrollInput,  PreviewAutomationSnapshot,  PreviewAutomationStatus,  PreviewAutomationTypeInput,  PreviewAutomationWaitForInput,} from "./previewAutomation.ts";import type {  ClientOrchestrationCommand,  OrchestrationGetFullThreadDiffInput,  OrchestrationGetFullThreadDiffResult,  OrchestrationGetTurnDiffInput,  OrchestrationGetTurnDiffResult,  OrchestrationShellSnapshot,  OrchestrationShellStreamItem,  OrchestrationSubscribeThreadInput,  OrchestrationThreadStreamItem,} from "./orchestration.ts";import { EnvironmentId } from "./baseSchemas.ts";import { AuthAccessTokenResult, AuthSessionState, AuthWebSocketTicketResult } from "./auth.ts";import { AdvertisedEndpoint } from "./remoteAccess.ts";import { EditorId } from "./editor.ts";import { ExecutionEnvironmentDescriptor } from "./environment.ts";import type { ClientSettings, ServerSettings, ServerSettingsPatch } from "./settings.ts";import type {  SourceControlCloneRepositoryInput,  SourceControlCloneRepositoryResult,  SourceControlDiscoveryResult,  SourceControlPublishRepositoryInput,  SourceControlPublishRepositoryResult,  SourceControlRepositoryInfo,  SourceControlRepositoryLookupInput,} from "./sourceControl.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;  children?: readonly ContextMenuItem<T>[];} export interface ContextMenuItemSchemaType {  readonly id: string;  readonly label: string;  readonly destructive?: boolean;  readonly disabled?: boolean;  readonly header?: boolean;  readonly icon?: string;  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),  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 interface DesktopRuntimeInfo {  hostArch: DesktopRuntimeArch;  appArch: DesktopRuntimeArch;  runningUnderArm64Translation: boolean;} export const DesktopRuntimeInfoSchema = Schema.Struct({  hostArch: DesktopRuntimeArchSchema,  appArch: DesktopRuntimeArchSchema,  runningUnderArm64Translation: Schema.Boolean,}); export interface DesktopUpdateState {  enabled: boolean;  status: DesktopUpdateStatus;  channel: DesktopUpdateChannel;  currentVersion: string;  hostArch: DesktopRuntimeArch;  appArch: DesktopRuntimeArch;  runningUnderArm64Translation: boolean;  availableVersion: string | null;  downloadedVersion: string | null;  downloadPercent: number | null;  checkedAt: string | null;  message: string | null;  errorContext: "check" | "download" | "install" | null;  canRetry: boolean;} 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),  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,}); export interface DesktopEnvironmentBootstrap {  label: string;  httpBaseUrl: string | null;  wsBaseUrl: string | null;  bootstrapToken?: string;} export const DesktopEnvironmentBootstrapSchema = Schema.Struct({  label: 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"])),}); export interface DesktopSshPasswordPromptRequest {  requestId: string;  destination: string;  username: string | null;  prompt: string;  expiresAt: string;} export const DesktopSshPasswordPromptRequestSchema = Schema.Struct({  requestId: Schema.String,  destination: Schema.String,  username: Schema.NullOr(Schema.String),  prompt: Schema.String,  expiresAt: Schema.String,}); export const DesktopSshPasswordPromptCancellationErrorTag =  "DesktopSshPasswordPromptCancellationError" as const; export const DesktopSshPasswordPromptCancellationReason = Schema.Literals([  "user-cancelled",  "window-closed",  "service-stopped",  "timed-out",]);export type DesktopSshPasswordPromptCancellationReason =  typeof DesktopSshPasswordPromptCancellationReason.Type; export class DesktopSshPasswordPromptCancellationError extends Schema.TaggedErrorClass<DesktopSshPasswordPromptCancellationError>()(  DesktopSshPasswordPromptCancellationErrorTag,  {    reason: DesktopSshPasswordPromptCancellationReason,    requestId: Schema.String,    destination: Schema.String,    cause: Schema.Defect(),  },) {  override get message(): string {    return `SSH authentication did not complete for ${this.destination}.`;  }} export const isDesktopSshPasswordPromptCancellationError = Schema.is(  DesktopSshPasswordPromptCancellationError,); export const DesktopSshEnvironmentEnsureOptionsSchema = Schema.Struct({  issuePairingToken: Schema.optionalKey(Schema.Boolean),}); export const DesktopSshEnvironmentEnsureInputSchema = Schema.Struct({  target: DesktopSshEnvironmentTargetSchema,  options: Schema.optionalKey(DesktopSshEnvironmentEnsureOptionsSchema),}); export const DesktopSshEnvironmentEnsureResultSchema = Schema.Union([  DesktopSshEnvironmentBootstrapSchema,  DesktopSshPasswordPromptCancellationError,]); export const DesktopSshHttpBaseUrlInputSchema = Schema.Struct({  httpBaseUrl: Schema.String,}); export const DesktopSshBearerRequestInputSchema = Schema.Struct({  httpBaseUrl: Schema.String,  bearerToken: Schema.String,}); export const DesktopSshBearerBootstrapInputSchema = Schema.Struct({  httpBaseUrl: Schema.String,  credential: Schema.String,}); export const DesktopSshPasswordPromptResolutionInputSchema = Schema.Struct({  requestId: Schema.String,  password: Schema.NullOr(Schema.String),}); export const PersistedSavedEnvironmentRecordSchema = Schema.Struct({  environmentId: EnvironmentId,  label: Schema.String,  wsBaseUrl: Schema.String,  httpBaseUrl: Schema.String,  createdAt: Schema.String,  lastConnectedAt: Schema.NullOr(Schema.String),  desktopSsh: Schema.optionalKey(DesktopSshEnvironmentTargetSchema),  relayManaged: Schema.optionalKey(    Schema.Struct({      relayUrl: Schema.String,    }),  ),});export type PersistedSavedEnvironmentRecord = typeof PersistedSavedEnvironmentRecordSchema.Type; export type DesktopServerExposureMode = "local-only" | "network-accessible"; export const DesktopServerExposureModeSchema = Schema.Literals([  "local-only",  "network-accessible",]); export interface DesktopServerExposureState {  mode: DesktopServerExposureMode;  endpointUrl: string | null;  advertisedHost: string | null;  tailscaleServeEnabled: boolean;  tailscaleServePort: number;} export const DesktopServerExposureStateSchema = Schema.Struct({  mode: DesktopServerExposureModeSchema,  endpointUrl: Schema.NullOr(Schema.String),  advertisedHost: Schema.NullOr(Schema.String),  tailscaleServeEnabled: Schema.Boolean,  tailscaleServePort: Schema.Number,}); export interface PickFolderOptions {  initialPath?: string | null;} export const PickFolderOptionsSchema = Schema.Struct({  initialPath: Schema.optionalKey(Schema.NullOr(Schema.String)),}); /** * Renderer-facing snapshot of a desktop preview tab. Mirrors the main-process * PreviewTabState shape but uses serialisable primitives only. */export type DesktopPreviewNavStatus =  | { kind: "Idle" }  | { kind: "Loading"; url: string; title: string }  | { kind: "Success"; url: string; title: string }  | {      kind: "LoadFailed";      url: string;      title: string;      code: number;      description: string;    }; export interface DesktopPreviewTabState {  tabId: string;  webContentsId: number | null;  navStatus: DesktopPreviewNavStatus;  canGoBack: boolean;  canGoForward: boolean;  /** Current zoom factor (1.0 = 100%). */  zoomFactor: number;  controller: "human" | "agent" | "none";  updatedAt: string;} export const DesktopPreviewTabIdSchema = Schema.String.check(Schema.isTrimmed()).check(  Schema.isNonEmpty(),); export const DesktopPreviewNavStatusSchema = Schema.Union([  Schema.Struct({ kind: Schema.Literal("Idle") }),  Schema.Struct({    kind: Schema.Literal("Loading"),    url: Schema.String,    title: Schema.String,  }),  Schema.Struct({    kind: Schema.Literal("Success"),    url: Schema.String,    title: Schema.String,  }),  Schema.Struct({    kind: Schema.Literal("LoadFailed"),    url: Schema.String,    title: Schema.String,    code: Schema.Number,    description: Schema.String,  }),]); export const DesktopPreviewTabStateSchema: Schema.Codec<DesktopPreviewTabState> = Schema.Struct({  tabId: DesktopPreviewTabIdSchema,  webContentsId: Schema.NullOr(Schema.Int),  navStatus: DesktopPreviewNavStatusSchema,  canGoBack: Schema.Boolean,  canGoForward: Schema.Boolean,

Lines 1–500 of 1203.