Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(lume): standardize OCI format — remove legacy types, rename aux to nvram (#1213)

Francesco Bonacci9504e6207a3f
diff --git a/libs/lume/src/Commands/Run.swift b/libs/lume/src/Commands/Run.swift
index 835634d358..a5e69c9e94 100644
--- a/libs/lume/src/Commands/Run.swift
+++ b/libs/lume/src/Commands/Run.swift
@@ -56,6 +56,18 @@ struct Run: AsyncParsableCommand {
@Option(name: .customLong("storage"), help: "VM storage location to use or direct path to VM location")
var storage: String?
+ @Option(
+ name: .customLong("disk-path"),
+ help: "Override path to disk image file. When set, uses this file instead of the default disk.img in the VM directory.",
+ completion: .file())
+ var diskPath: String?
+
+ @Option(
+ name: .customLong("nvram-path"),
+ help: "Override path to NVRAM file. When set, uses this file instead of the default nvram.bin in the VM directory.",
+ completion: .file())
+ var nvramPath: String?
+
@Option(
name: .customLong("network"),
help: "Optional network override: 'nat', 'bridged', or 'bridged:<interface>' (e.g. 'bridged:en0'). Defaults to the VM's configured mode.")
@@ -141,6 +153,8 @@ struct Run: AsyncParsableCommand {
vncPassword: vncPassword,
recoveryMode: recoveryMode,
storage: storage,
+ diskPath: diskPath.map { Path($0) },
+ nvramPath: nvramPath.map { Path($0) },
usbMassStoragePaths: parsedUSBStorageDevices.isEmpty ? nil : parsedUSBStorageDevices,
networkMode: parsedNetworkMode,
clipboard: clipboard
diff --git a/libs/lume/src/ContainerRegistry/ImageContainerRegistry.swift b/libs/lume/src/ContainerRegistry/ImageContainerRegistry.swift
index cb93d7277f..ae5cf6c66a 100644
--- a/libs/lume/src/ContainerRegistry/ImageContainerRegistry.swift
+++ b/libs/lume/src/ContainerRegistry/ImageContainerRegistry.swift
@@ -102,15 +102,15 @@ enum ImageFormat {
case legacy // Lume legacy: LZ4-chunked disk, trycua media types
}
-/// Media type constants for the OCI-compliant kubelet image format.
+/// Media type constants for the OCI image format.
enum OCIMediaType {
static let config = "application/vnd.trycua.lume.config.v1+json"
static let disk = "application/vnd.trycua.lume.disk.v1"
- static let aux = "application/vnd.trycua.lume.aux.v1"
+ static let nvram = "application/vnd.trycua.lume.nvram.v1"
static func detect(_ manifest: Manifest) -> ImageFormat {
let hasOCIDisk = manifest.layers.contains { $0.mediaType == disk }
- let hasOCIConfig = manifest.config?.mediaType == config || manifest.config?.mediaType == LegacyMediaType.config
+ let hasOCIConfig = manifest.config?.mediaType == config
return (hasOCIDisk || hasOCIConfig) ? .oci : .legacy
}
}
@@ -123,24 +123,6 @@ enum OCIAnnotation {
static let chunkSize = "org.trycua.lume.chunk.size"
}
-/// Legacy annotation keys (Agoda-era) for backward-compatible pull.
-enum LegacyAnnotation {
- static let uncompressedSize = "com.agoda.macosvz.content.uncompressed-size"
- static let uncompressedDigest = "com.agoda.macosvz.content.uncompressed-digest"
-}
-
-/// Legacy media types (Agoda-era) for backward-compatible pull.
-enum LegacyMediaType {
- static let config = "application/vnd.agoda.macosvz.config.v1+json"
- static let disk = "application/vnd.agoda.macosvz.disk.image.v1"
- static let aux = "application/vnd.agoda.macosvz.aux.image.v1"
-}
-
-/// Look up an annotation by key, falling back to a legacy key.
-func annotationOrLegacy(_ annotations: [String: String]?, key: String, legacyKey: String) -> String? {
- annotations?[key] ?? annotations?[legacyKey]
-}
-
/// Holds per-chunk upload results for manifest construction.
struct DiskChunkDescriptor {
let partNumber: Int
@@ -151,16 +133,16 @@ struct DiskChunkDescriptor {
let diskOffset: UInt64
}
-/// OCI config JSON structure expected by the macOS-vz kubelet.
-struct KubeletOCIConfig: Codable {
+/// OCI config JSON structure for lume VM images.
+struct LumeOCIConfig: Codable {
let mediatype: String?
let os: String
- let hardwareModelData: String
- let machineIdData: String
- let storage: [KubeletStorageItem]?
+ let hardwareModel: String
+ let machineIdentifier: String
+ let storage: [LumeStorageItem]?
}
-struct KubeletStorageItem: Codable {
+struct LumeStorageItem: Codable {
let mediatype: String
let file: String
}
@@ -4087,29 +4069,29 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
return totalDecompressedBytes
}
- /// Build the kubelet-compatible config JSON blob from a VMConfig.
- private func createKubeletConfigData(_ vmConfig: VMConfig) throws -> Data {
- let hardwareModelData = vmConfig.hardwareModel?.base64EncodedString() ?? ""
- let machineIdData = vmConfig.machineIdentifier?.base64EncodedString() ?? ""
+ /// Build the OCI config JSON blob from a VMConfig.
+ private func createOCIConfigData(_ vmConfig: VMConfig) throws -> Data {
+ let hardwareModel = vmConfig.hardwareModel?.base64EncodedString() ?? ""
+ let machineIdentifier = vmConfig.machineIdentifier?.base64EncodedString() ?? ""
let configObj: [String: Any] = [
"mediatype": OCIMediaType.config,
"os": vmConfig.os,
- "hardwareModelData": hardwareModelData,
- "machineIdData": machineIdData,
+ "hardwareModel": hardwareModel,
+ "machineIdentifier": machineIdentifier,
"storage": [
- ["mediatype": OCIMediaType.aux, "file": "aux.img"],
- ["mediatype": OCIMediaType.disk, "file": "disk.img"],
+ ["mediatype": OCIMediaType.nvram, "file": "nvram.bin"],
+ ["mediatype": OCIMediaType.disk, "file": "disk.img"],
],
]
return try JSONSerialization.data(
withJSONObject: configObj, options: [.prettyPrinted, .sortedKeys])
}
- /// Build an OCI-compliant manifest dictionary (kubelet-compatible).
+ /// Build an OCI manifest dictionary.
private func createOCIManifest(
configDigest: String, configSize: Int,
- auxDigest: String, auxSize: Int,
+ nvramDigest: String, nvramSize: Int,
diskDigest: String, diskSize: Int,
uncompressedDiskDigest: String, uncompressedDiskSize: UInt64,
vmConfig: VMConfig?
@@ -4122,12 +4104,12 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
"annotations": ["org.opencontainers.image.title": "config.json"],
]
- // Aux (nvram) layer — stored uncompressed, title annotation only
- let auxLayer: [String: Any] = [
- "mediaType": OCIMediaType.aux,
- "digest": auxDigest,
- "size": auxSize,
- "annotations": ["org.opencontainers.image.title": "aux.img"],
+ // NVRAM layer — stored uncompressed, title annotation only
+ let nvramLayer: [String: Any] = [
+ "mediaType": OCIMediaType.nvram,
+ "digest": nvramDigest,
+ "size": nvramSize,
+ "annotations": ["org.opencontainers.image.title": "nvram.bin"],
]
// Disk layer — gzip-compressed with size/digest annotations
@@ -4159,7 +4141,7 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"config": configEntry,
- "layers": [auxLayer, diskLayer],
+ "layers": [nvramLayer, diskLayer],
"annotations": manifestAnnotations,
]
}
@@ -4167,7 +4149,7 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
/// Build an OCI manifest with multiple disk chunk layers.
private func createOCIManifest(
configDigest: String, configSize: Int,
- auxDigest: String, auxSize: Int,
+ nvramDigest: String, nvramSize: Int,
diskChunks: [DiskChunkDescriptor],
totalUncompressedSize: UInt64,
vmConfig: VMConfig?
@@ -4179,11 +4161,11 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
"annotations": ["org.opencontainers.image.title": "config.json"],
]
- let auxLayer: [String: Any] = [
- "mediaType": OCIMediaType.aux,
- "digest": auxDigest,
- "size": auxSize,
- "annotations": ["org.opencontainers.image.title": "aux.img"],
+ let nvramLayer: [String: Any] = [
+ "mediaType": OCIMediaType.nvram,
+ "digest": nvramDigest,
+ "size": nvramSize,
+ "annotations": ["org.opencontainers.image.title": "nvram.bin"],
]
let totalParts = diskChunks.count
@@ -4222,7 +4204,7 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"config": configEntry,
- "layers": [auxLayer] + diskChunkLayers,
+ "layers": [nvramLayer] + diskChunkLayers,
"annotations": manifestAnnotations,
]
}
@@ -4280,7 +4262,7 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
// ── Config ──────────────────────────────────────────────────────────
let vmConfig = try? JSONDecoder().decode(VMConfig.self, from: Data(contentsOf: configPath))
let fallbackConfig = try VMConfig(os: "darwin", display: "1920x1080")
- let configData = try createKubeletConfigData(vmConfig ?? fallbackConfig)
+ let configData = try createOCIConfigData(vmConfig ?? fallbackConfig)
let configDigest = "sha256:" + configData.sha256String()
let configSize = configData.count
@@ -4294,21 +4276,21 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
}
}
- // ── Aux (nvram) ──────────────────────────────────────────────────────
+ // ── NVRAM ────────────────────────────────────────────────────────────
guard FileManager.default.fileExists(atPath: nvramPath.path) else {
throw PushError.fileCreationFailed(nvramPath.path)
}
let nvramData = try Data(contentsOf: nvramPath)
- let auxDigest = "sha256:" + nvramData.sha256String()
- let auxSize = nvramData.count
+ let nvramDigest = "sha256:" + nvramData.sha256String()
+ let nvramSize = nvramData.count
if !dryRun {
- if !(try await blobExists(repository: repository, digest: auxDigest, token: token)) {
- Logger.debug("Uploading aux (nvram) blob")
+ if !(try await blobExists(repository: repository, digest: nvramDigest, token: token)) {
+ Logger.debug("Uploading nvram blob")
_ = try await uploadBlobFromData(
repository: repository, data: nvramData, token: token)
} else {
- Logger.debug("Aux blob already exists")
+ Logger.debug("NVRAM blob already exists")
}
}
@@ -4330,7 +4312,7 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
await singleProgress.setTotalUncompressed(Int64(diskSize))
await singleProgress.addLayer(id: "config", label: "config.json", totalBytes: Int64(configSize))
await singleProgress.markDone(id: "config")
- await singleProgress.addLayer(id: "nvram", label: "nvram.bin", totalBytes: Int64(auxSize))
+ await singleProgress.addLayer(id: "nvram", label: "nvram.bin", totalBytes: Int64(nvramSize))
await singleProgress.markDone(id: "nvram")
await singleProgress.addLayer(id: "disk", label: "disk.img", totalBytes: Int64(diskSize))
await singleProgress.updateStatus(id: "disk", status: .compressing)
@@ -4379,7 +4361,7 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
manifest = createOCIManifest(
configDigest: configDigest, configSize: configSize,
- auxDigest: auxDigest, auxSize: auxSize,
+ nvramDigest: nvramDigest, nvramSize: nvramSize,
diskDigest: compDigest, diskSize: compSize,
uncompressedDiskDigest: uncompDigest, uncompressedDiskSize: uncompSize,
vmConfig: vmConfig
@@ -4394,7 +4376,7 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
await progress.setTotalUncompressed(Int64(diskSize))
await progress.addLayer(id: "config", label: "config.json", totalBytes: Int64(configSize))
await progress.markDone(id: "config")
- await progress.addLayer(id: "nvram", label: "nvram.bin", totalBytes: Int64(auxSize))
+ await progress.addLayer(id: "nvram", label: "nvram.bin", totalBytes: Int64(nvramSize))
await progress.markDone(id: "nvram")
for i in 0..<chunkCount {
let estSize = Int64(min(chunkSize, diskSize - UInt64(i) * chunkSize))
@@ -4613,7 +4595,7 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
manifest = createOCIManifest(
configDigest: configDigest, configSize: configSize,
- auxDigest: auxDigest, auxSize: auxSize,
+ nvramDigest: nvramDigest, nvramSize: nvramSize,
diskChunks: await chunkCollector.getAll(),
totalUncompressedSize: diskSize,
vmConfig: vmConfig
@@ -4674,21 +4656,21 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
configData = try Data(contentsOf: blobDest)
}
- var auxBlobPath: URL?
- if let auxLayer = manifest.layers.first(where: { $0.mediaType == OCIMediaType.aux }) {
+ var nvramBlobPath: URL?
+ if let nvramLayer = manifest.layers.first(where: { $0.mediaType == OCIMediaType.nvram }) {
let blobDest = tempDir.appendingPathComponent(
- auxLayer.digest.replacingOccurrences(of: ":", with: "_"))
- Logger.info("Downloading aux layer (\(auxLayer.digest.prefix(19))…)")
+ nvramLayer.digest.replacingOccurrences(of: ":", with: "_"))
+ Logger.info("Downloading nvram layer (\(nvramLayer.digest.prefix(19))…)")
try await downloadLayer(
repository: repository,
- digest: auxLayer.digest,
- mediaType: auxLayer.mediaType,
+ digest: nvramLayer.digest,
+ mediaType: nvramLayer.mediaType,
token: token,
to: blobDest,
maxRetries: 5,
progress: downloadProgress
)
- auxBlobPath = blobDest
+ nvramBlobPath = blobDest
}
// ── Process config ────────────────────────────────────────────────────
@@ -4696,10 +4678,10 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
var diskUncompressedSize: UInt64?
if let data = configData,
- let kubeletCfg = try? JSONDecoder().decode(KubeletOCIConfig.self, from: data)
+ let ociCfg = try? JSONDecoder().decode(LumeOCIConfig.self, from: data)
{
- let hardwareModel = Data(base64Encoded: kubeletCfg.hardwareModelData)
- let machineIdentifier = Data(base64Encoded: kubeletCfg.machineIdData)
+ let hardwareModel = Data(base64Encoded: ociCfg.hardwareModel)
+ let machineIdentifier = Data(base64Encoded: ociCfg.machineIdentifier)
let ann = manifest.annotations
let cpuCount = ann?["org.trycua.lume.cpu-count"].flatMap(Int.init)
@@ -4716,7 +4698,7 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
$0.annotations?["org.trycua.lume.content.uncompressed-size"].flatMap(UInt64.init)
}.reduce(0, +)
} else if let singleLayer = diskLayers.first,
- let sizeStr = annotationOrLegacy(singleLayer.annotations, key: "org.trycua.lume.content.uncompressed-size", legacyKey: LegacyAnnotation.uncompressedSize),
+ let sizeStr = singleLayer.annotations?["org.trycua.lume.content.uncompressed-size"],
let size = UInt64(sizeStr) {
diskUncompressedSize = size
}
@@ -4725,7 +4707,7 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
?? diskUncompressedSize
vmConfig = try? VMConfig(
- os: kubeletCfg.os,
+ os: ociCfg.os,
cpuCount: cpuCount,
memorySize: memorySize,
diskSize: diskSize,
@@ -4745,10 +4727,10 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
try data.write(to: configDest)
}
- // ── Process aux (nvram) ───────────────────────────────────────────────
- if let auxPath = auxBlobPath {
+ // ── Process nvram ────────────────────────────────────────────────────
+ if let nvramPath = nvramBlobPath {
let nvramDest = destination.appendingPathComponent("nvram.bin")
- try FileManager.default.copyItem(at: auxPath, to: nvramDest)
+ try FileManager.default.copyItem(at: nvramPath, to: nvramDest)
Logger.info("Saved nvram.bin")
}
@@ -4863,7 +4845,7 @@ class ImageContainerRegistry: ImageRegistry, @unchecked Sendable {
progress: downloadProgress
)
- let uncompSizeStr = annotationOrLegacy(singleDiskLayer.annotations, key: "org.trycua.lume.content.uncompressed-size", legacyKey: LegacyAnnotation.uncompressedSize)
+ let uncompSizeStr = singleDiskLayer.annotations?["org.trycua.lume.content.uncompressed-size"]
if let sizeStr = uncompSizeStr, let uncompSize = UInt64(sizeStr), uncompSize > 0 {
Logger.info("Decompressing disk image (gzip, sparse-aware)…")
FileManager.default.createFile(atPath: diskDest.path, contents: nil)
diff --git a/libs/lume/src/LumeController.swift b/libs/lume/src/LumeController.swift
index 349824016f..b17434c0fe 100644
--- a/libs/lume/src/LumeController.swift
+++ b/libs/lume/src/LumeController.swift
@@ -907,6 +907,8 @@ final class LumeController {
vncPassword: String? = nil,
recoveryMode: Bool = false,
storage: String? = nil,
+ diskPath: Path? = nil,
+ nvramPath: Path? = nil,
usbMassStoragePaths: [Path]? = nil,
networkMode: NetworkMode? = nil,
clipboard: Bool = false
@@ -923,6 +925,8 @@ final class LumeController {
"vnc_port": "\(vncPort)",
"recovery_mode": "\(recoveryMode)",
"storage_param": storage ?? "home", // Log the original param
+ "disk_path_override": diskPath?.path ?? "none",
+ "nvram_path_override": nvramPath?.path ?? "none",
"usb_storage_devices": "\(usbMassStoragePaths?.count ?? 0)",
"network_override": networkMode?.description ?? "vm-config",
])
@@ -960,28 +964,47 @@ final class LumeController {
let effectiveStorage: String?
let vmDir: VMDirectory
+ // When disk/nvram path overrides are provided, the VM directory only needs
+ // config.json (not the full disk.img + nvram.bin). This lets external tools
+ // like lumelet store disk images in their own cache and point lume at them.
+ let hasPathOverrides = diskPath != nil || nvramPath != nil
+
if let storagePath = storage, storagePath.contains("/") || storagePath.contains("\\") {
// Storage is a direct path
vmDir = try home.getVMDirectoryFromPath(normalizedName, storagePath: storagePath)
- guard vmDir.initialized() else {
- if vmDir.exists() {
- throw VMError.notInitialized(normalizedName)
- } else {
+ if hasPathOverrides {
+ // With path overrides, only config.json is required
+ guard vmDir.configPath.exists() else {
throw VMError.notFound(normalizedName)
}
+ } else {
+ guard vmDir.initialized() else {
+ if vmDir.exists() {
+ throw VMError.notInitialized(normalizedName)
+ } else {
+ throw VMError.notFound(normalizedName)
+ }
+ }
}
effectiveStorage = storagePath // Use the path string
Logger.info("Using direct storage path", metadata: ["path": storagePath])
} else {
// Storage is nil or a named location - validate and get the actual name
- let actualLocationName = try validateVMExists(normalizedName, storage: storage)
- vmDir = try home.getVMDirectory(normalizedName, storage: actualLocationName) // Get VMDir for named location
- effectiveStorage = actualLocationName // Use the named location string
+ if hasPathOverrides {
+ // With overrides, try to find the VM but relax initialized check
+ let actualLocationName = try? validateVMExists(normalizedName, storage: storage)
+ vmDir = try home.getVMDirectory(normalizedName, storage: actualLocationName)
+ effectiveStorage = actualLocationName
+ } else {
+ let actualLocationName = try validateVMExists(normalizedName, storage: storage)
+ vmDir = try home.getVMDirectory(normalizedName, storage: actualLocationName) // Get VMDir for named location
+ effectiveStorage = actualLocationName // Use the named location string
+ }
Logger.info(
"Using named storage location",
metadata: [
"requested": storage ?? "home",
- "actual": actualLocationName ?? "default",
+ "actual": effectiveStorage ?? "default",
])
}
@@ -997,7 +1020,7 @@ final class LumeController {
)
// Load the VM directly using the located VMDirectory and storage context
- let vm = try self.loadVM(vmDir: vmDir, storage: effectiveStorage)
+ let vm = try self.loadVM(vmDir: vmDir, storage: effectiveStorage, diskPath: diskPath, nvramPath: nvramPath)
SharedVM.shared.setVM(name: normalizedName, vm: vm)
try await vm.run(
@@ -1360,17 +1383,21 @@ final class LumeController {
}
@MainActor
- private func loadVM(vmDir: VMDirectory, storage: String?) throws -> VM {
- // vmDir is now passed directly
- guard vmDir.initialized() else {
- throw VMError.notInitialized(vmDir.name) // Use name from vmDir
+ private func loadVM(vmDir: VMDirectory, storage: String?, diskPath: Path? = nil, nvramPath: Path? = nil) throws -> VM {
+ // With path overrides, only config.json is required (not full initialized check)
+ let hasPathOverrides = diskPath != nil || nvramPath != nil
+ if !hasPathOverrides {
+ guard vmDir.initialized() else {
+ throw VMError.notInitialized(vmDir.name)
+ }
}
let config: VMConfig = try vmDir.loadConfig()
- // Pass the provided storage (which could be a path or named location)
- let vmDirContext = VMDirContext(
+ var vmDirContext = VMDirContext(
dir: vmDir, config: config, home: home, storage: storage
)
+ vmDirContext.diskPathOverride = diskPath
+ vmDirContext.nvramPathOverride = nvramPath
let imageLoader =
config.os.lowercased() == "macos" ? imageLoaderFactory.createImageLoader() : nil
diff --git a/libs/lume/src/Server/Handlers.swift b/libs/lume/src/Server/Handlers.swift
index bf54f5cf9a..aae5816e59 100644
--- a/libs/lume/src/Server/Handlers.swift
+++ b/libs/lume/src/Server/Handlers.swift
@@ -340,7 +340,7 @@ extension Server {
body.flatMap { try? JSONDecoder().decode(RunVMRequest.self, from: $0) }
?? RunVMRequest(
noDisplay: nil, sharedDirectories: nil, recoveryMode: nil, storage: nil,
- network: nil, clipboard: nil)
+ diskPath: nil, nvramPath: nil, network: nil, clipboard: nil)
// Record telemetry
TelemetryClient.shared.record(event: TelemetryEvent.apiVMRun, properties: [
@@ -372,6 +372,8 @@ extension Server {
sharedDirectories: dirs,
recoveryMode: request.recoveryMode ?? false,
storage: request.storage,
+ diskPath: request.diskPath.map { Path($0) },
+ nvramPath: request.nvramPath.map { Path($0) },
networkMode: networkMode,
clipboard: request.clipboard ?? false
)
@@ -827,6 +829,8 @@ extension Server {
sharedDirectories: [SharedDirectory] = [],
recoveryMode: Bool = false,
storage: String? = nil,
+ diskPath: Path? = nil,
+ nvramPath: Path? = nil,
networkMode: NetworkMode? = nil,
clipboard: Bool = false
) {
@@ -858,6 +862,8 @@ extension Server {
sharedDirectories: sharedDirectories,
recoveryMode: recoveryMode,
storage: storage,
+ diskPath: diskPath,
+ nvramPath: nvramPath,
networkMode: networkMode,
clipboard: clipboard
)
diff --git a/libs/lume/src/Server/Requests.swift b/libs/lume/src/Server/Requests.swift
index 56bfed2208..86b4c30e19 100644
--- a/libs/lume/src/Server/Requests.swift
+++ b/libs/lume/src/Server/Requests.swift
@@ -16,6 +16,8 @@ struct RunVMRequest: Codable {
let sharedDirectories: [SharedDirectoryRequest]?
let recoveryMode: Bool?
let storage: String?
+ let diskPath: String?
+ let nvramPath: String?
let network: String?
let clipboard: Bool?
diff --git a/libs/lume/src/VM/VM.swift b/libs/lume/src/VM/VM.swift
index 3d5743ec7f..1a2c8ee187 100644
--- a/libs/lume/src/VM/VM.swift
+++ b/libs/lume/src/VM/VM.swift
@@ -10,14 +10,21 @@ struct VMDirContext {
let home: Home
let storage: String?
+ /// Optional override paths for disk and nvram files.
+ /// When set, these take precedence over the default directory-based paths.
+ /// This allows external tools (e.g. lumelet) to point lume at files
+ /// stored outside the standard VM directory layout.
+ var diskPathOverride: Path?
+ var nvramPathOverride: Path?
+
func saveConfig() throws {
try dir.saveConfig(config)
}
var name: String { dir.name }
var initialized: Bool { dir.initialized() }
- var diskPath: Path { dir.diskPath }
- var nvramPath: Path { dir.nvramPath }
+ var diskPath: Path { diskPathOverride ?? dir.diskPath }
+ var nvramPath: Path { nvramPathOverride ?? dir.nvramPath }
func setDisk(_ size: UInt64) throws {
try dir.setDisk(size)