Files
Reims-Go/frontend/src/types.ts
T
NwflowerandClaude Opus 5.5 fa3e1e2889 feat: add plugin views and expand the sandboxed page bridge
Plugins can add pages to the sidebar, VM tabs, Settings and dialogs. Their
pages can now use host forms and navigation, VM and settings access,
authorized file I/O, task progress, controlled HTTP requests, events and
private storage.

Plugin pages cannot change allow_ai_access, which stays the user's per-VM
consent. Closing a page cancels its unfinished tasks, and running plugin
tasks no longer block changing the data folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 23:11:23 -07:00

207 lines
7.7 KiB
TypeScript

// Backend types come from the Wails-generated models (wailsjs/go/models.ts,
// regenerated by `wails dev` / `wails build`). This file only adds what Go
// cannot say: string unions, and `| null` for slices Go may send as nil.
import { app, config, driver, host, installer, opencore, plugin, reims, runtime, version } from '../wailsjs/go/models'
/** A generated class as a plain data shape (no convertValues helper). */
type Model<T> = Omit<T, 'convertValues'>
export type BuiltinLocale = 'zh-CN' | 'en-US'
export type Locale = BuiltinLocale | (string & {})
export type Config = Model<config.Config> & {
locale: Locale
runtime_channel?: 'stable' | 'alpha' | ''
}
export type DisplayInfo = host.DisplayInfo
export type DisplayPreset = host.DisplayPreset
export type AudioInfo = host.AudioInfo
export type WHPXCapabilities = host.WHPXCapabilities
export type LogicalCPUInfo = host.LogicalCPUInfo
export type GPUCompat = 'supported' | 'warn' | 'unsupported' | 'unknown'
export type GPUInfo = Omit<Model<host.GPUInfo>, 'compat'> & {
kind: 'discrete' | 'integrated' | 'virtual' | 'unknown'
compat?: GPUCompat
}
export type OptimizationStatus = 'recommended' | 'available' | 'experimental' | 'auto' | 'unavailable'
export type Optimization = Model<host.Optimization> & {
id: 'pcore_pin' | 'kernel_irqchip' | 'cold_reboot' | 'discrete_gpu' | string
status: OptimizationStatus
}
export type HostReport = Omit<Model<host.Report>, 'gpus' | 'recommended_gpu'> & {
whpx: 'ready' | 'no_hypervisor' | 'missing' | 'unsupported'
gpus: GPUInfo[]
recommended_gpu?: GPUInfo
}
export type RuntimeManifest = Model<runtime.Manifest>
export type InstalledRuntime = Model<runtime.Installed>
export type RemoteRuntime = Model<runtime.Remote> & {
channel: 'stable' | 'alpha'
}
export type VMListItem = Model<driver.VMListItem> & {
driver_id?: string
state: 'running' | 'stopped' | 'suspended' | 'broken' | 'driver_unavailable'
}
export type PendingChange = app.PendingChange
export type AppState = Omit<Model<app.AppState>, 'config' | 'host' | 'optimizations' | 'runtimes' | 'active_runtime' | 'vms'> & {
config: Config
host: HostReport
optimizations?: Optimization[]
runtimes: InstalledRuntime[] | null
active_runtime?: InstalledRuntime
vms: VMListItem[] | null
vm_list_error?: string
}
export type AppUpdateInfo = version.UpdateInfo
export type SuspendInfo = reims.SuspendInfo
export type VMDetail = reims.VMDetail
export type SMBIOSIdentity = opencore.SMBIOSIdentity
export type VMStats = app.VMStats
export type VMNetworkSettings = Model<app.VMNetworkSettings>
export type VMNetworkPlan = Model<app.VMNetworkPlan>
export type DriveShareSettings = Model<app.DriveShareSettings>
export type SharedFolderInfo = Model<app.SharedFolderInfo>
export type SharedFolderSettings = Model<app.SharedFolderSettings>
export type SharedFolderMode = 'disabled' | 'ro' | 'rw'
export type VMAffinityMode = 'auto' | 'all' | 'pcores' | 'non_lpe' | 'custom'
export type VMAffinityUpdate = {
mode: VMAffinityMode
cpus?: number[]
disable_eco_qos: boolean
}
export type VMAffinityStatus = Omit<Model<app.VMAffinityStatus>, 'mode' | 'effective_mode'> & {
mode: VMAffinityMode
effective_mode: VMAffinityMode
}
/** One frame of a VM's screen (internal/app/thumbnail_flow.go). Empty data_url: none yet. */
export type VMThumbnail = app.VMThumbnail
export type ValidationIssue = reims.ValidationIssue
export type DiskResizeResult = driver.DiskResizeResult
export type DiskCompactResult = driver.DiskCompactResult
export type DiskSnapshot = driver.DiskSnapshot
export type StorageBreakdown = Model<app.StorageBreakdown>
export type SetOpts = reims.SetOpts
export type CreateOpts = Model<reims.CreateOpts> & {
network_mode?: 'off' | 'nat' | 'bridge'
uplink_guid?: string
source_mode?: 'offline' | 'apple' | 'installer' | 'disk'
disk_mode?: 'copy' | 'in-place'
disk_controller?: 'nvme' | 'ahci' | 'virtio'
graphics: 'reims-vgpu' | 'vmware-svga'
cpus: number
memory: string
gpu: string
resolution: string
displays: number
}
export type TaskStatus = 'running' | 'done' | 'failed' | 'canceled'
export type InstallerKind = 'offline' | 'online'
export type InstallerPhase = 'queued' | 'downloading'
/** A tracked long-running job pushed as "reims:task" (internal/app/tasks.go). */
export type Task = Model<app.Task> & {
kind: 'installer-download' | 'recovery-download' | 'vm-create' | 'runtime-install' | 'app-update' | string
installer_kind?: InstallerKind | ''
installer_phase?: InstallerPhase | ''
status: TaskStatus
}
/** An offline installer Apple offers (`reims-util offline-installer list`). */
export type Release = installer.Release
/** A file kept in the installers directory. */
export type CachedInstaller = Model<installer.Cached> & {
kind: 'offline' | 'online' | 'ipsw' | 'other'
}
export type DataRootChoice = app.DataRootChoice
export type DataRootCheck = app.DataRootCheck
export type LocalizedText = plugin.LocalizedText
export type PermissionSpec = plugin.PermissionSpec
export type SettingProperty = plugin.SettingProperty
export type SettingsSchema = plugin.SettingsSchema
export type PluginInfo = plugin.PluginInfo
export type DoctorFinding = plugin.DoctorFinding
export type ScanFinding = plugin.ScanFinding
export type ExecutableFile = plugin.ExecutableFile
export type CapabilityItem = plugin.CapabilityItem
export type ScanReport = plugin.ScanReport
export type MarketEntry = plugin.MarketEntry
export type MarketWithdrawal = plugin.MarketWithdrawal
export type MarketCatalogItem = plugin.MarketCatalogItem
export type MarketBrowseResult = plugin.MarketBrowseResult
export type TokenDeriveRule = plugin.TokenDeriveRule
export type ThemeScheme = plugin.ThemeScheme
export type ThemeDecoration = plugin.ThemeDecoration
export type ThemeDecorationState = plugin.ThemeDecorationState
export type ThemeContribution = plugin.ThemeContribution
export type CustomThemeScheme = plugin.CustomThemeScheme
export type ActiveThemePayload = plugin.ActiveThemePayload
export interface ResolvedLocaleFont {
family: string
url: string
weight?: string
style?: string
unicodeRange?: string
}
export type ResolvedLocalePack = Model<plugin.ResolvedLocalePack> & {
has_ui_messages?: boolean
plugin_messages?: Record<string, Record<string, string>>
fonts?: ResolvedLocaleFont[]
}
export type MenuContribution = plugin.MenuContribution
export type VMCardContribution = plugin.VMCardContribution
export type PanelContribution = plugin.PanelContribution
export type ViewContribution = plugin.ViewContribution
export type ImageSourceContribution = plugin.ImageSourceContribution
export type StatusItemContribution = plugin.StatusItemContribution
export type PluginUIContributions = app.PluginUIContributions
export type DriverSummary = driver.DriverSummary
export type DriverCreateRequest = driver.CreateRequest
export type RuntimeKindSpec = runtime.KindSpec
/** A "reims:log" event (internal/app/app.go emitLog); not a Go struct, so not generated. */
export interface LogEntry {
ts: string
source: string
line: string
}
export type VMKeymapPreset = 'off' | 'win_to_cmd' | 'swap_alt_win' | 'custom'
export type VMKeymapHostModifier = 'lwin' | 'rwin' | 'lalt' | 'ralt' | 'lctrl' | 'rctrl' | 'capslock'
export type VMKeymapGuestModifier = 'default' | 'lcmd' | 'rcmd' | 'lopt' | 'ropt' | 'lctrl' | 'rctrl' | 'esc' | 'disabled'
export interface VMKeymapUpdate {
preset: VMKeymapPreset
bindings: Partial<Record<VMKeymapHostModifier, VMKeymapGuestModifier>>
capture_host_shortcuts?: boolean
}
export interface VMKeymapStatus extends VMKeymapUpdate {
capture_host_shortcuts: boolean
needs_guest_tools: boolean
guest_connected: boolean
guest_agent_version?: number
required_agent_version: number
input_service_available: boolean
guest_keymap_active: boolean
hook_active: boolean
running: boolean
}