Files
Reims-Go/frontend/src/types.ts
T
Nwflower 9204b58987 feat(driver): disambiguate VMs with VMRef
Keep same-named VMs from different drivers, reject ambiguous bare-name resolution, and add exact ResolveRef routing with driver-qualified keys.

Declare DataRoot-relative VM roots in guest driver manifests, validate traversal and absolute paths, and scan declarations for unavailable drivers.

Add data layout v3 for driver-qualified per-VM plugin settings, preserve explicit values during migration, and pass VMRef keys from the settings UI.
2026-11-30 07:38:46 -07:00

174 lines
6.3 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, 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<reims.VMListItem> & {
driver_id?: string
state: 'running' | 'stopped' | 'broken'
}
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
}
export type AppUpdateInfo = version.UpdateInfo
export type VMDetail = reims.VMDetail
export type VMStats = app.VMStats
export type DriveShareSettings = Model<app.DriveShareSettings>
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 = reims.DiskResizeResult
export type DiskCompactResult = reims.DiskCompactResult
export type DiskSnapshot = reims.DiskSnapshot
export type StorageBreakdown = Model<app.StorageBreakdown>
export type SetOpts = reims.SetOpts
export type CreateOpts = Model<reims.CreateOpts> & {
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 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
}