33 lines
1.8 KiB
Swift
33 lines
1.8 KiB
Swift
// swift-tools-version: 6.2
|
|
import PackageDescription
|
|
|
|
// The native in-guest automation agent for Nucleic's macOS VMs (docs/MACOS_VM_NATIVE_AGENT.md).
|
|
//
|
|
// A SEPARATE package from the main Nucleic one on purpose: this binary runs INSIDE the guest, so it
|
|
// has its own package rather than inheriting the host app's target. It floors at macOS 27 — the
|
|
// guest images we provision are macOS 27, and the agent uses macOS 27-only features. (SwiftPM has no
|
|
// per-target platform floors, which is the other reason for the split.)
|
|
//
|
|
// Built on the HOST (scripts/build-vm-agent.sh wraps it into a signed NucleicVMAgent.app) and baked
|
|
// into the golden base image by scripts/provision-macos-guest.sh; never shipped with the host app.
|
|
let package = Package(
|
|
name: "NucleicVMAgent",
|
|
platforms: [.macOS("27.0")],
|
|
targets: [
|
|
// C shim for the AF_VSOCK listener: `struct sockaddr_vm` (<sys/vsock.h>) isn't surfaced to
|
|
// Swift by the Darwin overlay, so the socket/bind/listen dance lives in C.
|
|
.target(name: "CVsock"),
|
|
// Pure, framework-light logic (wire constants, NDJSON line splitting, key-chord parsing) —
|
|
// unit-testable on any Mac without TCC grants or a GUI session.
|
|
.target(name: "VMAgentCore"),
|
|
// The agent itself: vsock accept loop + the op handlers (AXUIElement / ScreenCaptureKit /
|
|
// CGEvent). Swift 5 language mode: the handlers are thread-confined by construction (one
|
|
// blocking thread per connection), which strict concurrency can't see past the CF/AX types.
|
|
.executableTarget(
|
|
name: "NucleicVMAgent",
|
|
dependencies: ["CVsock", "VMAgentCore"],
|
|
swiftSettings: [.swiftLanguageMode(.v5)]),
|
|
.testTarget(name: "VMAgentCoreTests", dependencies: ["VMAgentCore"]),
|
|
]
|
|
)
|