Skip to content

S10 - Technology Choices

Purpose: Fix languages, libraries, packaging, and repository layout, with the reason for each choice.

Requirements: NFR04-host-platformsNFR04-host-platforms: Host platformsFirst target: Apple Silicon, macOS 27 or later, because wb image build needs the guest provisioning options that are new in macOS 27 (X17-image-build)., NFR07-maintainabilityNFR07-maintainability: MaintainabilityMost code is cross-platform Go., NFR08-licensingNFR08-licensing: LicensingApache-2.0; dependencies under permissive licenses only., SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts., FR17-same-everywhereFR17-same-everywhere: Same on every hostThe same wb commands, flags, policy files, and behavior on every host OS..

Tests: C05-credentials-and-storeC05-credentials-and-store: Credentials and the Secret StoreThe test cases for the secret store and its callers, the signing setup that gives development builds their Keychain groups, and the credential checks wb-proxyd makes on guest requests and server responses.

Page What it covers
S10-01-librariesS10-01-libraries: LibrariesThe libraries and programs Wraith Box uses, and their licenses. The libraries and programs Wraith Box uses, and their licenses
S10-02-packaging-and-signingS10-02-packaging-and-signing: Packaging and SigningHow Wraith Box is packaged and signed on each host, and the one version every build stamps. The app bundle, helper bundles, signing, other hosts, and the build version

Most of Wraith Box is Go, and the same on every host OS. A platform-native language is used only where Go cannot reasonably reach a platform API. It then runs in a separate process with a gRPC contract (S12-platformsS12-platforms: PlatformsWhich host and guest operating systems Wraith Box targets, how platform-specific code is isolated, what each platform uses, and how wb works inside WSL.).

Component Language Reason
wb Go One static binary per OS with millisecond start-up; mature PTY and terminal handling; the same CLI everywhere
wb-hostd Go Sessions, policy, approvals, audit, and the git gateway are platform-independent logic
wb-netd, wb-proxyd Go gVisor’s network stack is Go; strong standard TLS/HTTP/HTTP2 libraries; built-in fuzzing for the parsers that face the guest
wb-guestd, git-remote-wb Go One code base for macOS, Linux, and Windows guests; PTY, vsock, and user management
wb-vmd on Windows and Linux Go HCS and Hyper-V sockets have Go bindings; Linux VMMs are driven over sockets and processes
wb-vmd on macOS, macOS notification helper, macOS guest Network Extension (S13-guest-confinementS13-guest-confinement: Guest ConfinementControls inside the guest that narrow what a project user's processes can do, and tell the host which program opened each connection.) Swift 6 First-class access to the Virtualization framework (macOS guests, save/restore, file-handle network attachment), to notifications, and to the Network Extension provider classes
Windows notification and tray helper (later) C# (.NET) Native Windows notifications with actions

No other language is added without a spec change.

packages/
wraithbox-go/ Go module: cmd/{wb,wb-hostd,wb-netd,wb-proxyd,wb-guestd,wb-vmd}, internal/…
internal/platform: host/guest matrix and per-OS interfaces (S12-platforms)
internal/gen/wraithbox/<area>/v1: generated code for every .proto package
wraithbox-swift/ SwiftPM package: WraithBoxVM library, wb-vmd executable (macOS)
Sources/wb-dev-bundle: test tooling, never in the app bundle
Sources/WraithBoxRPC: generated code for wraithbox.vmd.v1 only
WraithBox.xcodeproj, App/: the app target of Wraith Box.app (S17-01-bundle)
wraithbox-dotnet/ .NET solution for Windows-native helpers (when the first one is built)
wraithbox-doc/ documentation site
proto/ .proto contracts shared by every language: wraithbox/<area>/v1/<area>.proto
buf.yaml buf module and lint and breaking rules for proto/
buf.gen.yaml Go generation; buf.gen.swift.yaml: Swift generation
docs/spec/ specifications (this directory)

The code generated from proto/ is committed (B52-proto-contractsB52-proto-contracts: How are the gRPC contracts between the processes written, generated, and checked?Recommended to commit generated code, made by pinned local plugins and checked in CI for drift and breaking changes.). So a fresh clone builds with go build and swift build alone, on every OS.

  • mise run proto:generate writes the Go code, and proto:generate-swift the Swift code on macOS. Nobody edits it by hand.
  • mise run proto:check runs buf lint and buf breaking against main, and fails when the Go code differs from what buf generate makes. proto:check-swift does the same for the Swift code. Both are part of lint.
  • Every plugin is local, never remote:. The Go plugins are tool lines in go.mod. The Swift plugins are built from the Swift package’s pinned dependencies.
  • The generated files record the plugin versions. So a bump of protoc-gen-go, protoc-gen-go-grpc or the Swift plugins’ packages needs mise run proto:generate or proto:generate-swift in the same change, or the drift check fails.
  • cspell and SwiftLint skip the generated paths. swift format skips the generated files, which say swift-format-ignore-file. golangci-lint skips generated Go files.
  • Only wraithbox.vmd.v1 has Swift code, because wb-vmd is the only Swift process that serves or calls a contract.

cmd/wb-vmd in the Go module builds for Windows and Linux. On macOS, the binary of that name comes from the Swift package.

Some programs exist only to develop and test Wraith Box. They are never in the app bundle (S17-01-bundleS17-01-bundle: The BundleWhat a Wraith Box bundle holds, and how mise run build builds and signs it.), and no product program links their code. They are held to the same gates as the product code.

Program Language What it does
wb-dev-app Go Builds the app bundle’s Go half, runs its check, and installs it (mise run app:*)
wb-dev-bundle Swift Makes, clones, provisions, stops and removes macOS test bundles in the spike cache (mise run vm:*)
wb-dev-vm Go Starts the signed wb-vmd as wb-launcher is to, boots the bundle in the work slot, and runs wb-guestd’s hello or relays a local socket to a guest port below 1024

wb-dev-vm lets VM spikes and needs-vm work reach their guest code through wb-vmd’s hand-off. It runs one VM at a time (NFR05-two-macos-vmsNFR05-two-macos-vms: Platform limitmacOS permits at most two concurrently running macOS guests per host.), and the bundle has to be in the work slot before it starts. mise run go:build ::: swift:sign builds it with the same stamp as wb-vmd, because wb-vmd refuses a peer of another build version.

wb-dev-bundle comes from the X18-vsock-handoffX18-vsock-handoff: Host-guest socket and descriptor hand-offCan wb-guestd, written in Go, open AFVSOCK sockets in a macOS guest? host tool, and mise run vm:build signs it ad hoc with spikes/vm.entitlements. It accepts paths only in ~/Library/Caches/wraithbox-spikes/. Its provisioning boot gives a test guest an SSH user and Remote Login on Apple’s NAT network, which no product guest gets (SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable.). The page docs/agents/host-work.md says how agents use it.

See S12-platformsS12-platforms: PlatformsWhich host and guest operating systems Wraith Box targets, how platform-specific code is isolated, what each platform uses, and how wb works inside WSL. for the host/guest matrix. v1 is Apple Silicon, macOS 27 or later, with macOS guests (NFR04-host-platformsNFR04-host-platforms: Host platformsFirst target: Apple Silicon, macOS 27 or later, because wb image build needs the guest provisioning options that are new in macOS 27 (X17-image-build).). The image build needs macOS 27 in the guest as well (S06-02-image-buildS06-02-image-build: Image BuildHow wb image build makes a guest image: the build VM, its two provisioning stages, terminfo, sealing, and storage.). Above that, the guest image’s macOS version is independent of the host’s, within what the Virtualization framework supports.

Go runs natively in CI on macOS, Linux, and Windows. See S02-toolchainS02-toolchain: ToolchainStandardize how this repository manages runtime versions, repo tasks, and CI. for the toolchain itself.

Status: Draft