Expand description
vmette — local Linux microVM sandbox for macOS via Virtualization.framework.
This crate is the host-side library. It wraps Apple’s Virtualization
framework via objc2-virtualization and exposes a Rust API for booting
a Linux guest with virtio-fs shares, virtio-blk disks, virtio-net,
vsock, and a base64-encoded shell command delivered via the kernel
cmdline.
See Config for the configurable surface and run for the
synchronous entry point.
Re-exports§
pub use error::Error;pub use provider::BlockFs;pub use provider::RootfsArtifact;
Modules§
- desktop
- Desktop computer-use protocol: the framed request/response codec that
carries the
crate::Actionvocabulary between the hostcrate::Session(Agent workload) and the in-guestvmette-desktop-agent. - error
- ffi
- C ABI for the vmette library.
- provider
- Pluggable rootfs providers.
Structs§
- Config
- One-shot VM configuration. Build with
Config::new, populate public fields, then pass torun. - Response
Header - JSON header of a response frame (guest → host).
okreports success; on failureerrorcarries a message and no payload follows.x/yare populated byAction::CursorPosition.payload_lenis the count of binary bytes (e.g. PNG) following this header in the frame. - Rootfs
Block - A filesystem image attached as virtio-blk slot 0 (
/dev/vda) and mounted read-only as the lower layer of a tmpfs-backed overlay root. Mutually exclusive withRootfsShare. - Rootfs
Share - Host directory exposed as the guest’s
/. - RunOutput
- Result of a completed
run. Currently only carries the exit code, but kept as a struct so we can grow it without breaking callers. - Session
- A booted VM and everything that must outlive its dispatch queue.
- Session
Client Sendhandle for issuing desktopActions against a live session from a thread other than the one that owns theSession. The data path is plain blockingread/writeon the accepted vsock fd, independent of the VM’s dispatch queue.- Share
Mount - The one workspace-wide host-directory share descriptor, owned by
vmette-protoso the daemon’s run protocol and this config API share a single type. Re-exported here as part of the core’s public surface. A host directory exposed to the guest:<tag>→<path>. The single share-descriptor type for the whole workspace (re-exported asvmette::ShareMountfor the core config API and used bycrate::daemon::Request). - Stop
Handle Sendhandle for stopping a live session from another thread. Holds a reference to the VM and its queue; all fields areSend, so the handle isSendwithout an explicit unsafe impl.
Enums§
- Action
- A single computer-use action sent host → guest. Serialized as the JSON header of a request frame (no payload). Variants mirror the Anthropic computer-use tool so the MCP layer maps 1:1.
- Scroll
Direction - Scroll wheel direction for
Action::Scroll. - Session
End - How a session ended. The first writer into the [
EndSlot] wins, so a timeout that races a natural poweroff reportsTimedOut. - Vsock
Port - Per-invocation host vsock port policy.
- Workload
Strategy - Selects what the guest does once booted, and therefore which terminal
event ends the
Session.
Functions§
- run
- Boot the configured guest, exec the command, block until poweroff, then exit the process with the guest’s exit code.