Run a virtual iPhone on an Apple Silicon Mac.
Swift
Bind each machine to its own Core Bundle in Launchpad
Jacky9205fd25fd23
diff --git a/AGENTS.md b/AGENTS.mdindex fefbb58b..4a8966f3 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -50,7 +50,7 @@ See `Research/` for detailed firmware pipeline, component origins, patch breakdo- `VPhoneKit`: shared core, archive, and external access kits with their tests.- `VPhoneDaemon`: guest `vphoned`, native operations, and daemon configuration.- `VPhoneGuestComponents`: guest dylibs built by Makefile from the bundle build phase.-- `VPhoneLaunchpad`: `vphone-launchpad.app`, the workstation app that downloads and manages `VPhone.bundle` releases and drives VMs through the active bundle's `vphone-cli`, plus its SMJobBless helper `com.vphone.launchpad.helper` and `vphone-launchpad-cli`, a stateless client of the running app over a same-user Unix socket (`Documents/Guides/launchpad-cli.md`; use it to install and test a local `VPhone.bundle` build). Shipped separately from the bundle. Settings live only in `VPhoneLaunchpad/Configuration/*.xcconfig`; the pbxproj holds none.+- `VPhoneLaunchpad`: `vphone-launchpad.app`, the workstation app that downloads and manages `VPhone.bundle` releases and drives each VM through the `vphone-cli` of the Core Bundle that machine is bound to (`launchpad.json` in the machine folder; the default bundle only seeds new machines and library-wide commands), plus its SMJobBless helper `com.vphone.launchpad.helper` and `vphone-launchpad-cli`, a stateless client of the running app over a same-user Unix socket (`Documents/Guides/launchpad-cli.md`; use it to install and test a local `VPhone.bundle` build). Shipped separately from the bundle. Settings live only in `VPhoneLaunchpad/Configuration/*.xcconfig`; the pbxproj holds none.The `VPhone` scheme puts host programs in `VPhone.bundle/Contents/MacOS` and everything installed into the guest (vphoned, guest dylibs, their plists) in `Contents/Resources/guest-resources`. Xcode targets have `CODE_SIGNING_ALLOWED=NO`; the bundle build phase signs each binary ad hoc with only its own entitlements, then seals the outer bundle. `VPhoneVirtualization.entitlements` belongs to `vphone-vm`; `VPhoneDaemon.entitlements` belongs to `vphoned`. The bundle and CLI have no private entitlements.diff --git a/Documents/Guides/launchpad-cli.md b/Documents/Guides/launchpad-cli.mdindex abe3cdd6..964ae48d 100644--- a/Documents/Guides/launchpad-cli.md+++ b/Documents/Guides/launchpad-cli.md@@ -5,10 +5,10 @@ drives the running Launchpad over a Unix socket at`~/Library/Application Support/vphone-launchpad/control.sock` (mode 0600,served only to the same user) and starts Launchpad in the background when itis not running. It has no privileges and no state of its own: bundles are-installed through Launchpad's helper, machines run through the active-bundle's `vphone-cli`, and every command appears in Launchpad's window and-command history. Nothing listens on the network; reach it over ssh from-another machine.+installed through Launchpad's helper, each machine runs through the+`vphone-cli` of its own Core Bundle, and every command appears in Launchpad's+window and command history. Nothing listens on the network; reach it over ssh+from another machine.Progress lines go to stderr as they arrive. The result is one JSON document onstdout. The exit status is 0 on success and 1 on failure, with the reason on@@ -21,6 +21,30 @@ ln -s /Applications/vphone-launchpad.app/Contents/MacOS/vphone-launchpad-cli /usvphone-launchpad-cli help```+## Core Bundle per machine++Every machine is bound to one installed `VPhone.bundle` version, chosen when+it is created and kept in `launchpad.json` in the machine folder. Installing a+bundle never changes a machine's binding. A machine is made of three layers,+each from a bundle at a different time:++| Layer | What | Comes from |+| --- | --- | --- |+| Host Programs | `vphone-cli`, `vphone-vm` | The bound bundle, on every command. A new binding applies at the next start. |+| Guest Environment | vphoned and the hook dylibs | `cfw install` at creation, and `cfw update-environment` (stopped machine) later. |+| Boot Chain | Patched firmware, restore, CFW patches | `fw patch`, `restore` and `cfw install` at creation. Fixed; only a new machine changes it. |++The **default** bundle (formerly "active") decides only the version+`vm create` binds when `--bundle` is not given, and what `exec` and+library-wide commands run with. A new install becomes the default unless+`--keep-default` is passed. The first start of a machine in a Launchpad+session checks its bundle (execution policy exception, AMFI, host preflight)+once.++Local builds install as `<version>-local.<hash>`, the hash taken from the+bundle's code-signature seal, so two builds of one version sit side by side.+Older stores may still hold `<version>-local` or `<version>-ci.<commit>`.+## Testing a VPhone.bundle build```sh@@ -28,44 +52,86 @@ xcodebuild -workspace VPhone.xcworkspace -scheme VPhone \-configuration Debug -destination 'platform=macOS,arch=arm64' \-derivedDataPath .build/XcodeBundle build-# Installs as <version>-local, makes it active, adds the execution policy-# exception, allows the new vphone-vm cdhash and runs host preflight.+# Installs as <version>-local.<hash>, makes it the default, adds the execution+# policy exception, allows the new vphone-vm cdhash and runs host preflight.vphone-launchpad-cli bundle install-local .build/XcodeBundle/Build/Products/Debug/VPhone.bundle+# Move an existing machine to it; --update-environment also redeploys the+# new vphoned and hook dylibs (the machine must be stopped).+vphone-launchpad-cli vm set-bundle research-01 2.4.0-local.1a2b3c4d --update-environment+vphone-launchpad-cli vm start research-01 --waitvphone-launchpad-cli guest rpc research-01 device.infovphone-launchpad-cli guest rpc research-01 apps.list '{}'vphone-launchpad-cli vm log research-01 --lines 100vphone-launchpad-cli vm stop research-01+```++The exact version is in the install result and in `bundle list`. The first+step that needs the helper after its five-minute authorization expires asks+for an administrator password on the Mac, as the window does.++## Comparing two builds++Install both without moving the default, then give each its own machine:-# The same checks against the release it replaces.-vphone-launchpad-cli bundle use 2.1.2+```sh+vphone-launchpad-cli bundle install-local /path/to/A/VPhone.bundle --keep-default+vphone-launchpad-cli bundle install-local /path/to/B/VPhone.bundle --keep-default+vphone-launchpad-cli bundle list # note both versions++vphone-launchpad-cli vm create cmp-a --bundle 2.4.0-local.aaaaaaaa+vphone-launchpad-cli vm create cmp-b --bundle 2.4.0-local.bbbbbbbb```-The first step that needs the helper after its five-minute authorization-expires asks for an administrator password on the Mac, as the window does.+Machines created this way differ in all three layers. To compare only host+programs and guest environment on one boot chain, clone a machine in the+window and rebind the copy:++```sh+vphone-launchpad-cli vm set-bundle cmp-b 2.4.0-local.bbbbbbbb --update-environment+```++`vm list` shows which bundle each layer came from. `bundle remove` refuses a+version while a machine is bound to it; rebind or delete those machines first.## Commands| Command | Does || --- | --- |-| `status` | Host checks, helper, active bundle, machine counts |-| `bundle list` | Installed versions, receipts, cdhashes and check results |-| `bundle install-local <path>` | Install a local `VPhone.bundle` folder or `.zip` |-| `bundle install-release <version\|latest>` | Download and install a GitHub release |-| `bundle use <version>` / `bundle verify <version>` | Switch to or re-check an installed version |-| `bundle accept <version> [--off]` / `bundle remove <version>` | Skip failed checks, or remove a version |-| `vm list` | Machines in every library with run state and log path |-| `vm start <name> [--headless] [--wait]` / `vm stop <name>` | Launch or stop; `--wait` waits for vphoned |+| `status` | Host checks, helper, default bundle, machine counts |+| `bundle list` | Installed versions, receipts, cdhashes, check results, bound machines |+| `bundle install-local <path> [--keep-default]` | Install a local `VPhone.bundle` folder or `.zip` |+| `bundle install-release <version\|latest> [--keep-default]` | Download and install a GitHub release |+| `bundle set-default <version>` / `bundle verify <version>` | Make a version the default, or re-check it. `bundle use` is the old name of `set-default` |+| `bundle accept <version> [--off]` / `bundle remove <version>` | Skip failed checks, or remove a version no machine is bound to |+| `vm list` | Machines in every library with run state, Core Bundle and log path |+| `vm start <name> [--headless] [--wait]` / `vm stop <name>` | Launch with the machine's bundle, or stop; `--wait` waits for vphoned || `vm wait <name>` / `vm log <name> [--kind create\|dfu\|patch]` | Wait for vphoned; read a console log |-| `vm create <name> [...] [--from <step>]` | The New Machine pipeline; `--from` retries from a step |-| `cfw install <name>` | Install CFW into a stopped machine through the helper |-| `cfw update-environment <name>` | Redeploy the active bundle's guest resources (vphoned, hook dylibs) into a stopped machine through the helper; nothing else changes |+| `vm create <name> [--bundle <version>] [...] [--from <step>]` | The New Machine pipeline, bound to `--bundle` or the default; `--from` retries from a step |+| `vm set-bundle <name> <version> [--update-environment]` | Bind a machine to another installed version. `--update-environment` also redeploys that version's guest environment and needs a stopped machine |+| `cfw install <name>` | Install CFW into a stopped machine with its own bundle, through the helper |+| `cfw update-environment <name>` | Redeploy the machine's own bundle's guest resources (vphoned, hook dylibs) into it while stopped, through the helper; nothing else changes || `guest send <name> <json>` | One raw `vphone.sock` request (tap, swipe, key, screenshot) || `guest rpc <name> <method> [params]` | Any vphoned method, see `Research/vphoned_http_api.md` |-| `exec <vphone-cli arguments>` | Run the active bundle's `vphone-cli`, streaming its output |+| `exec [--bundle <version>] <vphone-cli arguments>` | Run the default bundle's `vphone-cli`, or that version's, streaming its output. `--bundle` must come first |Machine commands take `--root <library>` when two libraries hold a machinewith the same name. `guest` commands and `--wait` go through the machine's`vphone.sock`, which every launch serves; bundles up to 2.0.9 serve it onlyfor machines launched with a window.++## Bundle fields in results++| Command | Field | Meaning |+| --- | --- | --- |+| `status` | `defaultBundle` | The default version. `activeBundle` holds the same value for older scripts |+| `bundle list` | `default` | This version is the default. `active` holds the same value for older scripts |+| `bundle list` | `machines` | Names of the machines bound to this version |+| `vm list` | `bundle` | The version the machine's host programs run with |+| `vm list` | `guestEnvironmentBundle` | The version whose guest environment was installed last; `null` while unknown |+| `vm list` | `bootChainBundle` | The version that built the boot chain; `null` for a machine created before Launchpad recorded it |+| `vm create`, `cfw …`, `exec` | `bundle` | The version the command ran with |++When `guestEnvironmentBundle` differs from `bundle`, host and guest come from+different builds; `cfw update-environment` brings the guest in line.diff --git a/Skills/vphone-guest-control/SKILL.md b/Skills/vphone-guest-control/SKILL.mdindex 97beb259..f3899364 100644--- a/Skills/vphone-guest-control/SKILL.md+++ b/Skills/vphone-guest-control/SKILL.md@@ -26,7 +26,9 @@ against these guests.- `canInstallBundles: false` or `helper` not `ready`: the user must finishHost Setup in the app (administrator password, Developer Tools access).You cannot do this for them; say exactly what is missing.- - `activeBundle: null` or `bundleReady: false`: install or verify a bundle.+ - `defaultBundle: null` or `bundleReady: false`: install or verify a bundle.+ Each machine runs with its own bundle (`vm list` → `bundle`); the default+ only decides what new machines get.- `machines: 0`: create one ([machines](references/machines.md)).- Otherwise: list machines, start the one the user named, then control it.2. **Pick the reference for the task, and read it before acting.**@@ -35,7 +37,7 @@ against these guests.| --- | --- || Install Launchpad or a bundle, host requirements, series matching | [references/install.md](references/install.md) || An install step failed: "damaged", Developer Tools access turns off, several macOS installations, `zsh: killed`, not Apple silicon | [references/install-faq.md](references/install-faq.md) |- | Create, start, stop, retry, update a machine | [references/machines.md](references/machines.md) |+ | Create, start, stop, retry, update a machine, change its Core Bundle | [references/machines.md](references/machines.md) || Tap, swipe, key, screenshot, anything on `vphone.sock` | [references/guest-socket.md](references/guest-socket.md) || Call a vphoned method: apps, files, logs, UI tree, processes | [references/rpc-methods.md](references/rpc-methods.md) || Installing an IPA | [references/rpc-methods.md](references/rpc-methods.md#installing-an-app) |diff --git a/Skills/vphone-guest-control/references/install-faq.md b/Skills/vphone-guest-control/references/install-faq.mdindex e931cb3e..0b0b4e3c 100644--- a/Skills/vphone-guest-control/references/install-faq.md+++ b/Skills/vphone-guest-control/references/install-faq.md@@ -70,7 +70,9 @@ user on an ad hoc build must reset after every switch. `status` →- Launchpad refuses a bundle that is too old; it may list bundles from a newerseries. Stay in the same series (`Documents/Downloads/README.md`).- Launchpad never updates itself; the user replaces the app.-- A rebuilt local bundle needs `install-local` again (new signature).+- A rebuilt local bundle needs `install-local` again (new signature). It+ installs as a new `<version>-local.<hash>` beside the old build; machines stay+ on theirs until `vm set-bundle`.## Creating a machinediff --git a/Skills/vphone-guest-control/references/install.md b/Skills/vphone-guest-control/references/install.mdindex b6680f69..7706e58a 100644--- a/Skills/vphone-guest-control/references/install.md+++ b/Skills/vphone-guest-control/references/install.md@@ -71,25 +71,27 @@ newer series; do not install those, update Launchpad first.```shvphone-launchpad-cli bundle install-release 2.2.3 # an explicit X.Y.z of Launchpad's seriesvphone-launchpad-cli bundle list-vphone-launchpad-cli bundle use 2.2.3 # switch the active one+vphone-launchpad-cli bundle set-default 2.2.3 # what new machines getvphone-launchpad-cli bundle verify 2.2.3 # re-check````install-release` downloads the release from GitHub, verifies it, installs it-into the root-owned store through the helper, makes it active, and runs host-preflight. `bundle list` shows per version: `active`, `accepted`, `policy`,-`preflight`, `preflightDetail`, `cdhashes`, `path`.+into the root-owned store through the helper, makes it the default (unless+`--keep-default`), and runs host preflight. Existing machines keep the bundle+they are bound to; see [machines](machines.md#core-bundle-of-a-machine).+`bundle list` shows per version: `default`, `machines` (bound to it),+`accepted`, `policy`, `preflight`, `preflightDetail`, `cdhashes`, `path`.Always pass an explicit version. `latest` means the newest release by publish-date, prereleases included, and it is installed and made active at once, so it-can land in a newer series than Launchpad. Read Launchpad's version with+date, prereleases included, and it is installed and made the default at once,+so it can land in a newer series than Launchpad. Read Launchpad's version with`/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' /Applications/vphone-launchpad.app/Contents/Info.plist`(`status` does not report it), then pick the newest non-prerelease `X.Y.z` of thesame `X.Y` from `gh release list -R Lakr233/vphone-cli` or the releases page.`bundle accept <version>` uses a version although its checks failed and-`--off` takes that back. `bundle remove <version>` deletes one. Neither is for-routine use; ask first.+`--off` takes that back. `bundle remove <version>` deletes one, and refuses+while a machine is bound to it. Neither is for routine use; ask first.The first step that needs the helper after its five-minute authorizationexpires asks the user for an administrator password on the Mac. Warn them@@ -107,12 +109,15 @@ xcodebuild -workspace VPhone.xcworkspace -scheme VPhone \vphone-launchpad-cli bundle install-local .build/XcodeBundle/Build/Products/Debug/VPhone.bundle```-`install-local` takes a folder or a `.zip`, installs it as `<version>-local`,-makes it active, adds the execution policy exception, allows the new-`vphone-vm` cdhash and runs preflight. Relative paths are resolved by the CLI.-Every rebuild changes the cdhash, so run `install-local` again (or-`bundle verify <version>-local`) after each build. Compare against the release-it replaces with `bundle use <version>`.+`install-local` takes a folder or a `.zip`, installs it as+`<version>-local.<hash>` (from the code-signature seal, so each build is its own+version), makes it the default unless `--keep-default`, adds the execution+policy exception, allows the new `vphone-vm` cdhash and runs preflight. Relative+paths are resolved by the CLI. Installing does not move existing machines: bind+one with `vm set-bundle <name> <version> --update-environment`, or create one+with `vm create <name> --bundle <version>`. Each rebuild installs as a new+version; remove old ones no machine uses. To compare two builds, see+`Documents/Guides/launchpad-cli.md` (Comparing two builds).## When an install step fails@@ -124,5 +129,5 @@ installations, `zsh: killed`, and the rest.## Checking the result`vphone-launchpad-cli status` should show `hostReady: true`, `helper` as-`ready (…)`, `bundleReady: true` and an `activeBundle`. Then continue with+`ready (…)`, `bundleReady: true` and a `defaultBundle`. Then continue with[machines](machines.md).diff --git a/Skills/vphone-guest-control/references/machines.md b/Skills/vphone-guest-control/references/machines.mdindex b46aa881..34100373 100644--- a/Skills/vphone-guest-control/references/machines.md+++ b/Skills/vphone-guest-control/references/machines.md@@ -7,6 +7,7 @@- Retry a failed creation- Start, wait, stop- Logs+- Core Bundle of a machine- Updating a machine's guest components- Where things live@@ -18,9 +19,11 @@ vphone-launchpad-cli vm listOne object per machine: `name`, `libraryRoot`, `state` (`stopped`, `running`,`busy: <activity>`), `cpuCount`, `memoryMB`, `network`, `panicked`, `log`,-`controlSocket` (null until the machine serves `vphone.sock`), and when known-`udid`, `ios` and `cloudOS`. Check `state` before any machine command; start-and update refuse a machine that is not `stopped`.+`controlSocket` (null until the machine serves `vphone.sock`), `bundle`,+`guestEnvironmentBundle`, `bootChainBundle` (see+[Core Bundle of a machine](#core-bundle-of-a-machine)), and when known `udid`,+`ios` and `cloudOS`. Check `state` before any machine command; start and+update refuse a machine that is not `stopped`.## Create@@ -29,16 +32,19 @@ installs the custom firmware into the guest, and boots once to prove vphonedanswers. It leaves a **stopped** machine. Success is not a running guest.Before starting, check free disk (tens of GB, more with `--keep-artifacts`),-that no other creation is running, and that `status` shows `bundleReady`.+that no other creation is running, and that `status` shows `bundleReady` (or+that the version you pass to `--bundle` passed its checks in `bundle list`).```sh-vphone-launchpad-cli vm create myphone \+vphone-launchpad-cli vm create myphone [--bundle <version>] \[--iphone-source <path-or-url>] [--cloudos-source <path-or-url>] \[--cpu 8] [--memory 8192] [--disk-size 64] \[--network nat|bridged|none] [--preset standard|experimental] \[--keep-artifacts] [--no-wait]```+- **`--bundle`** binds the machine to an installed version; the default bundle+ otherwise. Every step runs with it, and the result reports it as `bundle`.- **Sources are optional.** If either is omitted, the newest pairing from`vphone-cli fw catalog` is used (the CLI prints `firmware: <iphone> + <cloudos>`).Pass both explicitly to pin a pairing; verified pairings are listed in@@ -103,6 +109,30 @@ vphone-launchpad-cli vm log myphone --kind create|dfu|patch --lines 200Files live in `~/Library/Logs/vphone-launchpad/`: `<name>.log` (VM console andkernel output), `<name>-create.log`, `<name>-dfu.log`, `<name>-patch.log`.+## Core Bundle of a machine++Each machine is bound to one installed `VPhone.bundle` version, kept in+`launchpad.json` in its folder. Installing a bundle or changing the default+never moves a machine. Three layers come from a bundle at different times:++| Layer | `vm list` field | Changes when |+| --- | --- | --- |+| Host programs (`vphone-cli`, `vphone-vm`) | `bundle` | At the next start after `vm set-bundle` |+| Guest environment (vphoned, hook dylibs) | `guestEnvironmentBundle` | `cfw install`, `cfw update-environment` |+| Boot chain and patches | `bootChainBundle` | Never; create a new machine |++```sh+vphone-launchpad-cli vm set-bundle myphone 2.2.4 --update-environment+```++`vm set-bundle` rebinds the machine. With `--update-environment` it also+redeploys that version's guest environment, which needs a stopped machine;+without it, the guest keeps the old vphoned and hooks, and `vm list` shows+`guestEnvironmentBundle` differing from `bundle`. A running machine picks up+the new host programs at its next start. `bundle remove` refuses a version+while a machine is bound to it. Rebind only when the user asks; it changes+what their machine runs.+## Updating a machine's guest componentsFor a **stopped** machine:@@ -111,16 +141,17 @@ For a **stopped** machine:vphone-launchpad-cli cfw update-environment myphone```-This redeploys the active bundle's guest resources (vphoned and the hook-dylibs) and changes nothing else. Do it after moving to another bundle version.-`cfw install myphone` redoes the whole custom-firmware install through the root+This redeploys the guest resources (vphoned and the hook dylibs) of the+machine's own bundle and changes nothing else. Do it when+`guestEnvironmentBundle` differs from `bundle`, such as after `vm set-bundle`+without `--update-environment`. `cfw install myphone` redoes the whole custom-firmware install through the roothelper; use it only to repair a machine, and only when asked.## Where things live| Path | Contents || --- | --- |-| `~/.vphone/machines/<name>/` | One machine: disk, `config.plist`, `vphone.sock` while running |+| `~/.vphone/machines/<name>/` | One machine: disk, `config.plist`, `launchpad.json` (its Core Bundle), `vphone.sock` while running || `~/.vphone/ipsws/` | Downloaded source IPSWs, shared || `~/.vphone/gpu-drivers/<version>_<build>/` | GPU driver extracted per cloudOS build, shared || `~/Library/Logs/vphone-launchpad/` | Console and creation logs |diff --git a/Skills/vphone-guest-control/references/troubleshooting.md b/Skills/vphone-guest-control/references/troubleshooting.mdindex 889f0faf..98d19da9 100644--- a/Skills/vphone-guest-control/references/troubleshooting.md+++ b/Skills/vphone-guest-control/references/troubleshooting.md@@ -21,7 +21,7 @@ notes.| --- | --- || `vphone-launchpad-cli: command not found` | Not installed or not on PATH. [install](install.md) || `canInstallBundles: false` | `helper` is missing or outdated, or Developer Tools access is not granted. The user fixes it in Launchpad's Host Setup; relaunch Launchpad afterwards |-| "The active VPhone.bundle has not passed its checks" | `bundle verify <version>`. If it keeps failing, read `bundle list` → `preflightDetail` |+| "Unable to Start <name>" with "did not pass host preflight", or "is not installed" | The machine's own bundle (`vm list` → `bundle`) failed its checks or is gone. `bundle verify <version>`, then read `bundle list` → `preflightDetail`; for a missing one, install it or `vm set-bundle` to another version || `vphone-vm` is killed before a window opens | AMFI refused the entitled binary. `bundle verify`; a rebuilt bundle has a new cdhash and needs the allowlist again. Host SIP/AMFI settings are the owner's to change || Prompt for an administrator password | Expected after the helper's five-minute authorization lapses. Tell the user; do not loop || Launchpad too old for the bundle | Series mismatch. Update Launchpad; do not install a newer-series bundle |diff --git a/VPhoneLaunchpad/Configuration/Version.xcconfig b/VPhoneLaunchpad/Configuration/Version.xcconfigindex 36a1776d..52791aeb 100644--- a/VPhoneLaunchpad/Configuration/Version.xcconfig+++ b/VPhoneLaunchpad/Configuration/Version.xcconfig@@ -1,4 +1,4 @@MARKETING_VERSION = 2.4.0// Bump whenever the helper changes. The app blesses the helper again when the// installed helper's version or bytes differ from the copy it embeds.-CURRENT_PROJECT_VERSION = 10+CURRENT_PROJECT_VERSION = 11diff --git a/VPhoneLaunchpad/Tests/BundleNamesTests.sh b/VPhoneLaunchpad/Tests/BundleNamesTests.shnew file mode 100755index 00000000..d90b00f5--- /dev/null+++ b/VPhoneLaunchpad/Tests/BundleNamesTests.sh@@ -0,0 +1,15 @@+#!/bin/zsh+set -euo pipefail++launchpad="${0:a:h:h}"+temporary="$(/usr/bin/mktemp -d)"+trap '/bin/rm -rf "$temporary"' EXIT++/usr/bin/xcrun swiftc -swift-version 6 -strict-concurrency=complete \+ -parse-as-library \+ "$launchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift" \+ "$launchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachine.swift" \+ "$launchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineBinding.swift" \+ "$launchpad/Tests/BundleNamesTests.swift" \+ -o "$temporary/bundle-names-tests"+"$temporary/bundle-names-tests" "$@"diff --git a/VPhoneLaunchpad/Tests/BundleNamesTests.swift b/VPhoneLaunchpad/Tests/BundleNamesTests.swiftnew file mode 100644index 00000000..f2fe8c05--- /dev/null+++ b/VPhoneLaunchpad/Tests/BundleNamesTests.swift@@ -0,0 +1,91 @@+import Foundation++@main+struct BundleNamesTests {+ struct Expectation {+ let name: String+ let bundleVersion: String+ let isLocalBuild: Bool+ let isCompatible: Bool+ let isValid: Bool+ }++ static func main() throws {+ // MARK: - Store names++ // A store name is the bundle's version plus an optional build suffix:+ // `-local` (legacy), `-local.<8+ lowercase hex>` or `-ci.<7+ hex>`.+ // Anything else is kept whole, so it never parses as a version.+ let expectations: [Expectation] = [+ Expectation(name: "2.4.2", bundleVersion: "2.4.2", isLocalBuild: false, isCompatible: true, isValid: true),+ Expectation(name: "2.4.2-local", bundleVersion: "2.4.2", isLocalBuild: true, isCompatible: true, isValid: true),+ Expectation(name: "2.4.2-local.ab12cd34", bundleVersion: "2.4.2", isLocalBuild: true, isCompatible: true, isValid: true),+ // The build identifier is lowercase hex; uppercase is no build.+ Expectation(name: "2.4.2-local.AB12CD34", bundleVersion: "2.4.2-local.AB12CD34", isLocalBuild: false, isCompatible: false, isValid: true),+ Expectation(name: "2.4.2-local.ab12", bundleVersion: "2.4.2-local.ab12", isLocalBuild: false, isCompatible: false, isValid: true),+ Expectation(name: "2.4.2-ci.abcdef1", bundleVersion: "2.4.2", isLocalBuild: false, isCompatible: true, isValid: true),+ Expectation(name: "2.3.9-local.ab12cd34", bundleVersion: "2.3.9", isLocalBuild: true, isCompatible: false, isValid: true),+ Expectation(name: "../x", bundleVersion: "../x", isLocalBuild: false, isCompatible: false, isValid: false),+ Expectation(name: "", bundleVersion: "", isLocalBuild: false, isCompatible: false, isValid: false),+ ]+ for expected in expectations {+ let name = expected.name+ precondition(VPhoneLaunchpadNames.bundleVersion(of: name) == expected.bundleVersion,+ "bundleVersion(of: \"\(name)\") is \(VPhoneLaunchpadNames.bundleVersion(of: name))")+ precondition(VPhoneLaunchpadNames.isLocalBuild(name) == expected.isLocalBuild, "isLocalBuild(\"\(name)\")")+ precondition(VPhoneLaunchpadNames.isCompatibleBundleVersion(name) == expected.isCompatible, "isCompatibleBundleVersion(\"\(name)\")")+ precondition(VPhoneLaunchpadNames.isValidVersion(name) == expected.isValid, "isValidVersion(\"\(name)\")")+ }+ print("Bundle name tests passed: \(expectations.count) store names")++ // MARK: - Machine binding++ let fileManager = FileManager.default+ let root = fileManager.temporaryDirectory.appendingPathComponent("bundle-names-\(UUID().uuidString)", isDirectory: true)+ defer { try? fileManager.removeItem(at: root) }+ let machine = VPhoneLaunchpadMachinePath(libraryRoot: root.path, name: "research-01")+ try fileManager.createDirectory(at: machine.url, withIntermediateDirectories: true)+ let file = VPhoneLaunchpadMachineBinding.url(for: machine)++ precondition(VPhoneLaunchpadMachineBinding.load(machine) == nil, "A machine without launchpad.json has no binding")++ let binding = VPhoneLaunchpadMachineBinding(bundle: "2.3.2-local.ab12cd34", bootChain: "2.3.1", guestEnvironment: "2.3.1")+ try binding.save(to: machine)+ precondition(VPhoneLaunchpadMachineBinding.load(machine) == binding, "A saved binding loads back unchanged")+ precondition(binding.hasMixedVersions, "A guest environment from another bundle is mixed")++ precondition(!VPhoneLaunchpadMachineBinding(bundle: "2.3.2").hasMixedVersions, "An unknown guest environment is not mixed")+ precondition(!VPhoneLaunchpadMachineBinding(bundle: "2.3.2", guestEnvironment: "2.3.2").hasMixedVersions,+ "A guest environment from the same bundle is not mixed")++ // Every version in the file becomes a store path, so each is checked.+ for json in [+ #"{"bundle":"../evil"}"#,+ #"{"bundle":"2.3.2","bootChain":"../evil"}"#,+ #"{"bundle":"2.3.2","guestEnvironment":"a/b"}"#,+ #"{"bundle":""}"#,+ #"{"bootChain":"2.3.2"}"#,+ "not json",+ ] {+ try Data(json.utf8).write(to: file)+ precondition(VPhoneLaunchpadMachineBinding.load(machine) == nil, "Rejected binding: \(json)")+ }++ // A symbolic link is not read, even when it points at a valid binding.+ let elsewhere = root.appendingPathComponent("elsewhere.json")+ try JSONEncoder().encode(binding).write(to: elsewhere)+ try fileManager.removeItem(at: file)+ try fileManager.createSymbolicLink(at: file, withDestinationURL: elsewhere)+ precondition(VPhoneLaunchpadMachineBinding.load(machine) == nil, "A symbolic link launchpad.json is rejected")++ // Saving replaces the link rather than writing through it.+ let replacement = VPhoneLaunchpadMachineBinding(bundle: "2.3.3")+ try replacement.save(to: machine)+ let values = try file.resourceValues(forKeys: [.isSymbolicLinkKey])+ precondition(values.isSymbolicLink != true, "Saving replaces a symbolic link")+ precondition(VPhoneLaunchpadMachineBinding.load(machine) == replacement, "The replacement loads back")+ let target = try JSONDecoder().decode(VPhoneLaunchpadMachineBinding.self, from: Data(contentsOf: elsewhere))+ precondition(target == binding, "The link's target is left unchanged")+ print("Machine binding tests passed: round trip, mixed versions, invalid versions, symbolic link")+ }+}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadMenuBar.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadMenuBar.swiftindex f252f840..eaed06fd 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadMenuBar.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadMenuBar.swift@@ -38,8 +38,8 @@ struct VPhoneLaunchpadMenuBarMenu: View {Task { await model.machines.stop(machine.path) }}case .stopped:- Button("Start") { model.machines.start(machine.path) }- Button("Start Headless") { model.machines.start(machine.path, headless: true) }+ Button("Start") { Task { await model.machines.start(machine.path) } }+ Button("Start Headless") { Task { await model.machines.start(machine.path, headless: true) } }case let .busy(activity):Text(activity)}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swiftindex 139a9ce9..4b6057ea 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift@@ -43,6 +43,7 @@ final class VPhoneLaunchpadModel {host = VPhoneLaunchpadHostSetup(helper: helper, libraryRoot: libraryRoot)bundles = VPhoneLaunchpadCoreBundle(helper: helper, history: history)machines = VPhoneLaunchpadMachineLibrary(bundles: bundles, helper: helper)+ bundles.boundMachines = { [machines] version in machines.machineNames(boundTo: version) }}// MARK: - Panels@@ -109,12 +110,12 @@ final class VPhoneLaunchpadModel {machines.startMonitoring()async let listed: Void = machines.refresh()async let hostChecked: Void = host.refresh()- await bundles.checkActive()+ await bundles.checkDefault()await hostCheckedif case .outdated = helper.state {await host.installHelper()await host.refresh()- await bundles.checkActive()+ await bundles.checkDefault()}await listed// An unfinished install reopens its own sheet instead.@@ -156,9 +157,11 @@ final class VPhoneLaunchpadModel {/// An install shows its progress in a sheet of its own, which replaces/// the Core Bundle sheet it started from.- func installBundle(_ release: VPhoneLaunchpadRelease) async {+ /// `keepsDefault` leaves the default version as it is, as+ /// `vphone-launchpad-cli bundle install-* --keep-default` asks.+ func installBundle(_ release: VPhoneLaunchpadRelease, keepsDefault: Bool = false) async {revealInstall()- await bundles.install(release)+ await bundles.install(release, keepsDefault: keepsDefault)await machines.refresh()}@@ -168,9 +171,9 @@ final class VPhoneLaunchpadModel {await machines.refresh()}- func installLocalBundle(_ source: URL) async {+ func installLocalBundle(_ source: URL, keepsDefault: Bool = false) async {revealInstall()- await bundles.installLocal(source)+ await bundles.installLocal(source, keepsDefault: keepsDefault)await machines.refresh()}@@ -187,10 +190,13 @@ final class VPhoneLaunchpadModel {var showsInspector = true+ /// Refused while a machine is bound to the version; the error lands in+ /// `bundles.actionError`.func removeBundle(_ version: String) async {+ await machines.refresh()await bundles.remove(version)- if let active = bundles.activeVersion, bundles.active?.preflight == .pending {- await bundles.verify(active)+ if let fallback = bundles.defaultVersion, bundles.defaultBundle?.preflight == .pending {+ await bundles.verify(fallback)}}}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swiftindex 97b00629..660128e4 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift@@ -275,6 +275,7 @@static let creationOptions = VPhoneLaunchpadCreationPipeline.Options(name: "ios27-rc",libraryRoot: VPhoneLaunchpadMachineLocations.defaultRoot,+ bundleVersion: releases[1].version,iphoneSource: "https://updates.cdn-apple.com/example/iPhone17,3_27.0_24A435_Restore.ipsw",cloudOSSource: "https://updates.cdn-apple.com/example/cloudos-26.4",cpuCount: 8,diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadCommandLine.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadCommandLine.swiftindex ac1d443a..c3bfee14 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadCommandLine.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadCommandLine.swift@@ -92,7 +92,7 @@ final class VPhoneLaunchpadCommandHistory {// MARK: - vphone-cli-/// Runs the active bundle's `vphone-cli` by absolute path. Nothing here goes+/// Runs one installed bundle's `vphone-cli` by absolute path. Nothing here goes/// through a shell or `$PATH`.@MainActorstruct VPhoneLaunchpadCommandLine {diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swiftindex 92d01d51..bbebc8e4 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift@@ -43,10 +43,10 @@ struct VPhoneLaunchpadControlCommands {}switch command.name {case "status": return status()- case "bundle.list": return bundles.installed.map(report)+ case "bundle.list": return await listBundles()case "bundle.install-local": return try await installLocal(request, emit: emit)case "bundle.install-release": return try await installRelease(request, emit: emit)- case "bundle.use": return try await use(request)+ case "bundle.set-default", "bundle.use": return try await setDefault(request)case "bundle.verify": return try await verify(request)case "bundle.accept": return try accept(request)case "bundle.remove": return try await remove(request)@@ -56,6 +56,7 @@ struct VPhoneLaunchpadControlCommands {case "vm.wait": return try await waitMachine(request, emit: emit)case "vm.log": return try await log(request)case "vm.create": return try await create(request, emit: emit)+ case "vm.set-bundle": return try await setBundle(request, emit: emit)case "cfw.install": return try await installCustomFirmware(request, emit: emit)case "cfw.update-environment": return try await updateGuestEnvironment(request, emit: emit)case "guest.send": return try await sendToGuest(request)@@ -80,7 +81,9 @@ struct VPhoneLaunchpadControlCommands {"hostReady": model.host.requiredPassed,"developerTools": model.host.isDeveloperToolAuthorized,"canInstallBundles": model.canInstallBundles,- "activeBundle": bundles.activeVersion ?? NSNull(),+ "defaultBundle": bundles.defaultVersion ?? NSNull(),+ // The name before machines had their own bundle, kept for scripts.+ "activeBundle": bundles.defaultVersion ?? NSNull(),"bundleReady": bundles.isReady,"installing": bundles.isInstalling,"machines": library.machines.count,@@ -91,10 +94,19 @@ struct VPhoneLaunchpadControlCommands {// MARK: - Bundles+ private func listBundles() async -> Any {+ await refreshMachines()+ return bundles.installed.map(report)+ }+private func report(_ item: VPhoneLaunchpadCoreBundle.Installed) -> [String: Any] {- [+ let isDefault = item.version == bundles.defaultVersion+ return ["version": item.version,- "active": item.version == bundles.activeVersion,+ "default": isDefault,+ // The name before machines had their own bundle, kept for scripts.+ "active": isDefault,+ "machines": library.machineNames(boundTo: item.version),"accepted": bundles.isAccepted(item.version),"policy": item.policy.rawValue,"preflight": item.preflight.rawValue,@@ -132,8 +144,9 @@ struct VPhoneLaunchpadControlCommands {throw VPhoneLaunchpadError("The bundle path must be absolute.")}try requireInstallable()+ let keepsDefault = request.flag("keep-default")return try await watchInstall(emit: emit) {- await model.installLocalBundle(URL(fileURLWithPath: path))+ await model.installLocalBundle(URL(fileURLWithPath: path), keepsDefault: keepsDefault)}}@@ -149,8 +162,9 @@ struct VPhoneLaunchpadControlCommands {guard let release else {throw VPhoneLaunchpadError("No release \(wanted) was found.", detail: bundles.releasesError)}+ let keepsDefault = request.flag("keep-default")return try await watchInstall(emit: emit) {- await model.installBundle(release)+ await model.installBundle(release, keepsDefault: keepsDefault)}}@@ -193,13 +207,15 @@ struct VPhoneLaunchpadControlCommands {}}- private func use(_ request: VPhoneLaunchpadControlRequest) async throws -> Any {+ /// The default only picks what new machines bind and what library-wide+ /// commands run with; bound machines keep their version.+ private func setDefault(_ request: VPhoneLaunchpadControlRequest) async throws -> Any {let version = request.arguments[0]_ = try installed(version)guard VPhoneLaunchpadNames.isCompatibleBundleVersion(version) else {throw VPhoneLaunchpadError("VPhone.bundle \(version) is older than \(VPhoneLaunchpadNames.minimumBundleVersion).")}- await bundles.use(version)+ await bundles.setDefault(version)await library.refresh()return try checked(version)}@@ -275,6 +291,12 @@ struct VPhoneLaunchpadControlCommands {"controlSocket": FileManager.default.fileExists(atPath: Self.controlSocket(path))? Self.controlSocket(path) : NSNull(),]+ // Host programs come from `bundle` at each start; the other two were+ // written by the bundles named, and stay until replaced.+ let binding = library.bindings[path]+ report["bundle"] = library.bundleVersion(for: path) ?? NSNull()+ report["bootChainBundle"] = binding?.bootChain ?? NSNull()+ report["guestEnvironmentBundle"] = binding?.guestEnvironment ?? NSNull()if let udid = machine.udid {report["udid"] = udid}@@ -325,11 +347,9 @@ struct VPhoneLaunchpadControlCommands {guard library.state(of: machine) == .stopped else {throw VPhoneLaunchpadError("\(machine.name) is already running or busy.")}- guard bundles.isReady else {- throw VPhoneLaunchpadError("The active VPhone.bundle has not passed its checks. Run bundle verify.")- }library.actionError = nil- library.start(machine, headless: request.flag("headless"))+ // Checks the machine's own bundle first, once per Launchpad session.+ await library.start(machine, headless: request.flag("headless"))guard library.launchedProcess(machine) != nil else {throw takeLibraryError() ?? VPhoneLaunchpadError("\(machine.name) could not be started.")}@@ -484,9 +504,20 @@ struct VPhoneLaunchpadControlCommands {guard VPhoneLaunchpadMachineLocations.socketPathFits(root: machine.libraryRoot, name: machine.name) else {throw VPhoneLaunchpadError("The machine path is too long for its vphone.sock. Use a shorter name or library path.")}- guard bundles.isReady, let commandLine = bundles.commandLine() else {- throw VPhoneLaunchpadError("The active VPhone.bundle has not passed its checks. Run bundle verify.")+ guard let version = request.option("bundle") ?? bundles.defaultVersion else {+ throw VPhoneLaunchpadError("No Core Bundle version is installed. Run bundle install-local or bundle install-release.")}+ guard bundles.selectableVersions.contains(version) else {+ throw VPhoneLaunchpadError(+ "VPhone.bundle \(version) is not installed or not supported.",+ detail: "Installed: \(bundles.selectableVersions.joined(separator: ", "))",+ )+ }+ try await bundles.prepare(version)+ guard let commandLine = bundles.commandLine(version: version) else {+ throw VPhoneLaunchpadError("VPhone.bundle \(version) is not installed.")+ }+ emit("Core Bundle: \(version)")var iphone = request.option("iphone-source")var cloudOS = request.option("cloudos-source")@@ -518,6 +549,7 @@ struct VPhoneLaunchpadControlCommands {let options = try VPhoneLaunchpadCreationPipeline.Options(name: machine.name,libraryRoot: machine.libraryRoot,+ bundleVersion: version,iphoneSource: iphone ?? "",cloudOSSource: cloudOS ?? "",cpuCount: number("cpu", 8),@@ -550,6 +582,7 @@ struct VPhoneLaunchpadControlCommands {["name": pipeline.machine.name,"libraryRoot": pipeline.machine.libraryRoot,+ "bundle": pipeline.options.bundleVersion,"running": pipeline.isRunning,"log": pipeline.logFile.path,"steps": VPhoneLaunchpadCreationPipeline.Step.allCases.map { step -> [String: Any] in@@ -562,13 +595,56 @@ struct VPhoneLaunchpadControlCommands {]}+ // MARK: - Core Bundle of a machine++ /// Rebinds one machine. `setBundle` skips the environment update of a+ /// running machine without saying so, so that is refused here instead.+ private func setBundle(_ request: VPhoneLaunchpadControlRequest, emit: @escaping Emit) async throws -> Any {+ let machine = try await machine(request)+ let version = request.arguments[1]+ guard bundles.selectableVersions.contains(version) else {+ throw VPhoneLaunchpadError(+ "VPhone.bundle \(version) is not installed or not supported.",+ detail: "Installed: \(bundles.selectableVersions.joined(separator: ", "))",+ )+ }+ guard library.creations[machine]?.isRunning != true else {+ throw VPhoneLaunchpadError("\(machine.name) is still being created.")+ }+ let updatesEnvironment = request.flag("update-environment")+ let state = library.state(of: machine)+ if updatesEnvironment, state != .stopped {+ throw VPhoneLaunchpadError("Stop \(machine.name) before updating its guest environment.")+ }+ library.actionError = nil+ if updatesEnvironment {+ emit("updating the guest environment; console log: \(VPhoneLaunchpadMachineLibrary.consoleLog(machine).path)")+ }+ await library.setBundle(version, for: [machine], updateEnvironment: updatesEnvironment)+ if let error = takeLibraryError() {+ throw error+ }+ if state == .running {+ emit("\(machine.name) is running; it uses \(version) from its next start")+ }+ await library.refresh()+ return report(machine)+ }+// MARK: - CFW+ /// The version a machine's own commands run with: its binding, else the+ /// default.+ private func bundleVersion(of machine: VPhoneLaunchpadMachinePath) throws -> String {+ guard let version = library.bundleVersion(for: machine) else {+ throw VPhoneLaunchpadError("No Core Bundle version is installed. Run bundle install-local or bundle install-release.")+ }+ return version+ }+private func installCustomFirmware(_ request: VPhoneLaunchpadControlRequest, emit: @escaping Emit) async throws -> Any {let machine = try await machine(request)- guard let version = bundles.activeVersion else {- throw VPhoneLaunchpadError("No Core Bundle version is in use.")- }+ let version = try bundleVersion(of: machine)guard library.state(of: machine) == .stopped else {throw VPhoneLaunchpadError("Stop \(machine.name) before installing CFW.")}@@ -582,14 +658,13 @@ struct VPhoneLaunchpadControlCommands {guard status == 0 else {throw VPhoneLaunchpadError("Unable to install custom firmware. Check the log for details.")}+ library.recordGuestEnvironment(machine, version)return ["name": machine.name, "bundle": version, "status": status]}private func updateGuestEnvironment(_ request: VPhoneLaunchpadControlRequest, emit: @escaping Emit) async throws -> Any {let machine = try await machine(request)- guard let version = bundles.activeVersion else {- throw VPhoneLaunchpadError("No Core Bundle version is in use.")- }+ let version = try bundleVersion(of: machine)guard library.state(of: machine) == .stopped else {throw VPhoneLaunchpadError("Stop \(machine.name) before updating its guest environment.")}@@ -602,6 +677,7 @@ struct VPhoneLaunchpadControlCommands {guard status == 0 else {throw VPhoneLaunchpadError("Unable to update the guest environment. Check the log for details.")}+ library.recordGuestEnvironment(machine, version)return ["name": machine.name, "bundle": version, "status": status]}@@ -636,16 +712,25 @@ struct VPhoneLaunchpadControlCommands {// MARK: - vphone-cli+ /// Runs the default bundle's `vphone-cli`, or that of `--bundle`. A+ /// command on one machine should name that machine's own version, which+ /// `vm list` reports.private func exec(_ request: VPhoneLaunchpadControlRequest, emit: @escaping Emit) async throws -> Any {- guard let commandLine = bundles.commandLine() else {- throw VPhoneLaunchpadError("No Core Bundle version is in use.")+ guard let version = request.option("bundle") ?? bundles.defaultVersion else {+ throw VPhoneLaunchpadError("No Core Bundle version is installed. Run bundle install-local or bundle install-release.")+ }+ guard let commandLine = bundles.commandLine(version: version) else {+ throw VPhoneLaunchpadError(+ "VPhone.bundle \(version) is not installed or not supported.",+ detail: "Installed: \(bundles.selectableVersions.joined(separator: ", "))",+ )}let result = try await commandLine.run(request.arguments, onLine: emit)try Task.checkCancellation()guard result.succeeded else {throw VPhoneLaunchpadError("vphone-cli exited with status \(result.status).")}- return ["status": result.status, "bundle": bundles.activeVersion ?? ""]+ return ["status": result.status, "bundle": version]}}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swiftindex cd54fa52..3a5dbe5d 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swift@@ -2,7 +2,7 @@ import ExecutionPolicyimport Foundationimport Observation-/// The second stage: installed VPhone.bundle versions, the one in use, and+/// The second stage: installed VPhone.bundle versions, the default one, and/// installing new ones from GitHub releases.@MainActor@Observable@@ -75,6 +75,10 @@ final class VPhoneLaunchpadCoreBundle {var errorMessage: String?var errorDetail: String?var startedAt = Date()+ /// True when the installed version must not become the default, as+ /// `vphone-launchpad-cli bundle install-local --keep-default` asks.+ /// Optional so a progress file from an older Launchpad still reads.+ var keepsDefault: Bool?init(release: VPhoneLaunchpadRelease) {version = release.version@@ -147,7 +151,7 @@ final class VPhoneLaunchpadCoreBundle {private let helper: VPhoneLaunchpadHelperClientprivate let history: VPhoneLaunchpadCommandHistory- private static let activeVersionKey = "VPhoneLaunchpadActiveBundleVersion"+ private static let defaultVersionKey = "VPhoneLaunchpadActiveBundleVersion"private static let acceptedVersionsKey = "VPhoneLaunchpadAcceptedBundleVersions"/// Version → receipt SHA-256 of bundles whose last check passed.private static let passedVersionsKey = "VPhoneLaunchpadPassedBundleVersions"@@ -185,37 +189,63 @@ final class VPhoneLaunchpadCoreBundle {passed[version] = nil}UserDefaults.standard.set(passed, forKey: Self.passedVersionsKey)+ if isUsable(version) {+ checkedThisSession.insert(version)+ } else {+ checkedThisSession.remove(version)+ }}- // MARK: - Active version+ // MARK: - Default version- var activeVersion: String? {+ /// The version New Machine offers first, and the one library-wide+ /// commands such as `vm list` run with. Each machine runs with the+ /// version in its own binding (`VPhoneLaunchpadMachineBinding`), so+ /// changing the default, or installing a bundle, leaves existing+ /// machines alone. The defaults key keeps its old name.+ var defaultVersion: String? {get {- access(keyPath: \.activeVersion)- let stored = UserDefaults.standard.string(forKey: Self.activeVersionKey)+ access(keyPath: \.defaultVersion)+ let stored = UserDefaults.standard.string(forKey: Self.defaultVersionKey)if let stored, installed.contains(where: { $0.version == stored && VPhoneLaunchpadNames.isCompatibleBundleVersion($0.version) }) {return stored}return installed.first { VPhoneLaunchpadNames.isCompatibleBundleVersion($0.version) }?.version}set {- withMutation(keyPath: \.activeVersion) {- UserDefaults.standard.set(newValue, forKey: Self.activeVersionKey)+ withMutation(keyPath: \.defaultVersion) {+ UserDefaults.standard.set(newValue, forKey: Self.defaultVersionKey)}}}- var active: Installed? {- installed.first { $0.version == activeVersion }+ var defaultBundle: Installed? {+ installed.first { $0.version == defaultVersion }}- /// The active bundle passed host preflight, or the user chose to use it+ /// The default bundle passed host preflight, or the user chose to use it/// without.var isReady: Bool {- guard let active else {+ guard let defaultVersion else {+ return false+ }+ return isUsable(defaultVersion)+ }++ /// `version` is installed, supported, and passed host preflight or was+ /// accepted without.+ func isUsable(_ version: String) -> Bool {+ guard VPhoneLaunchpadNames.isCompatibleBundleVersion(version),+ let item = installed.first(where: { $0.version == version })+ else {return false}- return active.preflight == .passed || isAccepted(active.version)+ return item.preflight == .passed || isAccepted(version)+ }++ /// Versions offered for a machine: installed and supported, newest first.+ var selectableVersions: [String] {+ installed.map(\.version).filter(VPhoneLaunchpadNames.isCompatibleBundleVersion)}var isInstalling: Bool {@@ -261,8 +291,18 @@ final class VPhoneLaunchpadCoreBundle {return latest}+ /// The default version's `vphone-cli`, for commands that belong to no+ /// machine. A machine's own commands go through+ /// `VPhoneLaunchpadMachineLibrary.commandLine(for:)`.func commandLine() -> VPhoneLaunchpadCommandLine? {- guard let version = activeVersion else {+ defaultVersion.flatMap(commandLine(version:))+ }++ /// `vphone-cli` of one installed, supported version.+ func commandLine(version: String) -> VPhoneLaunchpadCommandLine? {+ guard VPhoneLaunchpadNames.isCompatibleBundleVersion(version),+ installed.contains(where: { $0.version == version })+ else {return nil}return VPhoneLaunchpadCommandLine(@@ -271,23 +311,76 @@ final class VPhoneLaunchpadCoreBundle {)}+ // MARK: - Readiness++ /// Versions checked since Launchpad started that passed, or were+ /// accepted. The default is checked at launch; another version is+ /// checked the first time a machine needs it, since its policy exception+ /// or AMFI admission may be gone after a restart.+ private var checkedThisSession: Set<String> = []+ private var checks: [String: Task<Void, Never>] = [:]++ /// True when `version` passed, or was accepted, since Launchpad started,+ /// so `prepare` returns without checking it again.+ func isChecked(_ version: String) -> Bool {+ checkedThisSession.contains(version) && checks[version] == nil+ }++ /// Makes sure `version` can run a machine: installed, supported, and+ /// checked in this session. Checks of one version are shared by every+ /// caller waiting on it.+ func prepare(_ version: String) async throws {+ guard installed.contains(where: { $0.version == version }) else {+ throw VPhoneLaunchpadError(+ String(localized: "VPhone.bundle \(version) is not installed."),+ detail: String(localized: "Install it in Core Bundle, or choose another version for this machine."),+ )+ }+ guard VPhoneLaunchpadNames.isCompatibleBundleVersion(version) else {+ throw VPhoneLaunchpadError(String(localized: "Requires VPhone.bundle \(VPhoneLaunchpadNames.minimumBundleVersion) or newer."))+ }+ if checks[version] != nil || !checkedThisSession.contains(version) {+ await check(version)+ }+ guard isUsable(version) else {+ throw VPhoneLaunchpadError(+ String(localized: "VPhone.bundle \(version) did not pass host preflight."),+ detail: installed.first { $0.version == version }?.preflightDetail,+ )+ }+ }+// MARK: - Refreshfunc refresh() async {- await checkActive()+ await checkDefault()await fetchReleases()await fetchArtifacts()}- /// Rereads the store and checks the active bundle again. A bundle that+ /// Rereads the store and checks the default bundle again. A bundle that/// passed keeps showing so while the check runs.- func checkActive() async {+ func checkDefault() async {loadInstalled()- if let version = activeVersion {- await verify(version, showsProgress: false)+ if let version = defaultVersion {+ await check(version)}}+ /// Verifies `version` without showing progress, or waits for the check+ /// of it already running, so a machine started during the launch check+ /// does not run a second preflight beside it.+ private func check(_ version: String) async {+ if let running = checks[version] {+ await running.value+ return+ }+ let check = Task { await verify(version, showsProgress: false) }+ checks[version] = check+ await check.value+ checks[version] = nil+ }+func fetchReleases() async {do {releases = try await VPhoneLaunchpadRelease.fetch()@@ -410,8 +503,9 @@ final class VPhoneLaunchpadCoreBundle {// MARK: - Install- func install(_ release: VPhoneLaunchpadRelease) async {+ func install(_ release: VPhoneLaunchpadRelease, keepsDefault: Bool = false) async {progress = InstallProgress(release: release)+ progress?.keepsDefault = keepsDefaultvar archive: URL?defer {if let archive {@@ -444,9 +538,10 @@ final class VPhoneLaunchpadCoreBundle {}/// Installs a VPhone.bundle folder or .zip built on this Mac as- /// `<version>-local`.- func installLocal(_ source: URL) async {+ /// `<version>-local.<build>`.+ func installLocal(_ source: URL, keepsDefault: Bool = false) async {progress = InstallProgress(local: source)+ progress?.keepsDefault = keepsDefaultvar work: URL?defer {if let work {@@ -470,8 +565,9 @@ final class VPhoneLaunchpadCoreBundle {/// `<version>-ci.<commit>`. The artifact is checked against the digest/// GitHub published; the bundle zip inside it is then handed over like a/// local build.- func installArtifact(_ artifact: VPhoneLaunchpadArtifact) async {+ func installArtifact(_ artifact: VPhoneLaunchpadArtifact, keepsDefault: Bool = false) async {progress = InstallProgress(artifact: artifact)+ progress?.keepsDefault = keepsDefaultvar archive: URL?var work: URL?defer {@@ -517,17 +613,34 @@ final class VPhoneLaunchpadCoreBundle {}}- /// The steps every source shares: the helper installs the- /// archive as root, then the new version becomes active and is checked.+ /// The steps every source shares: the helper installs the archive as+ /// root, then the new version becomes the default, unless the install+ /// keeps it, and is checked. Machines bound to other versions stay on+ /// them.+ ///+ /// A local build already in the store under the same name is the same+ /// build, since the name comes from its code signature seal, so it is not+ /// installed again: replacing it would pull the files from under the+ /// machines running from it.private func installAndVerify(version: String, archive: URL, sha256: String) async throws {set(.install, .running)- let handle = try FileHandle(forReadingFrom: archive)- defer { try? handle.close() }- try await helper.installBundle(version: version, archive: handle, sha256: sha256)+ loadInstalled()+ // A bare `-local` from an older Launchpad names no build, so it is+ // replaced as before.+ let isSameBuild = VPhoneLaunchpadNames.isLocalBuild(version)+ && !version.hasSuffix(VPhoneLaunchpadLocalBundle.versionSuffix)+ && installed.contains { $0.version == version }+ if !isSameBuild {+ let handle = try FileHandle(forReadingFrom: archive)+ defer { try? handle.close() }+ try await helper.installBundle(version: version, archive: handle, sha256: sha256)+ loadInstalled()+ }set(.install, .passed)- loadInstalled()- activeVersion = version+ if progress?.keepsDefault != true {+ defaultVersion = version+ }try await checkInstalled(version)}@@ -576,13 +689,14 @@ final class VPhoneLaunchpadCoreBundle {}return}+ let keepsDefault = progress.keepsDefault ?? falseswitch progress.source {case let .release(release):- await install(release)+ await install(release, keepsDefault: keepsDefault)case let .artifact(artifact):- await installArtifact(artifact)+ await installArtifact(artifact, keepsDefault: keepsDefault)case let .local(path):- await installLocal(URL(fileURLWithPath: path))+ await installLocal(URL(fileURLWithPath: path), keepsDefault: keepsDefault)}}@@ -648,15 +762,31 @@ final class VPhoneLaunchpadCoreBundle {progress?.steps[step] = status}- // MARK: - Use and remove+ // MARK: - Default and remove- func use(_ version: String) async {+ /// Makes `version` the default for new machines and library-wide+ /// commands. Machines keep the version they are bound to.+ func setDefault(_ version: String) async {guard VPhoneLaunchpadNames.isCompatibleBundleVersion(version) else { return }- activeVersion = version+ defaultVersion = versionawait verify(version)}+ /// The machines bound to a version, by name. The model connects this to+ /// the machine library, which knows the bindings.+ var boundMachines: @MainActor (String) -> [String] = { _ in [] }++ /// Refuses a version a machine is bound to: removing it would leave the+ /// machine with no `vphone-vm` to start it.func remove(_ version: String) async {+ let bound = boundMachines(version)+ guard bound.isEmpty else {+ actionError = VPhoneLaunchpadError(+ String(localized: "Unable to Remove VPhone.bundle \(version)"),+ detail: String(localized: "These machines use it: \(bound.joined(separator: ", ")). Choose another Core Bundle for them first."),+ )+ return+ }do {try await helper.removeBundle(version: version)} catch {diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swiftindex fdcd8a18..2c599ef0 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift@@ -85,28 +85,40 @@ struct VPhoneLaunchpadCoreBundleView: View {} header: {Text("Installed")} footer: {- Text("Stored in \(VPhoneLaunchpadBundleStore.root.path) and managed by the helper.")- .foregroundStyle(.secondary)+ VStack(alignment: .leading, spacing: 4) {+ Text("New machines use the default version. Each machine keeps its own Core Bundle, which you change from the machine list.")+ Text("Stored in \(VPhoneLaunchpadBundleStore.root.path) and managed by the helper.")+ }+ .foregroundStyle(.secondary)}}private func installedRow(_ bundle: VPhoneLaunchpadCoreBundle.Installed) -> some View {- let isActive = bundle.version == bundles.activeVersion+ let isDefault = bundle.version == bundles.defaultVersion+ let users = model.machines.machineNames(boundTo: bundle.version)return HStack(alignment: .firstTextBaseline, spacing: 12) {VStack(alignment: .leading, spacing: 2) {- // The version in use is the one with the green title.- Text(verbatim: "VPhone.bundle \(bundle.version)")- .foregroundStyle(isActive ? AnyShapeStyle(.green) : AnyShapeStyle(.primary))- .accessibilityValue(isActive ? "In use" : "")- .help(isActive ? "In use" : "")+ HStack(alignment: .firstTextBaseline, spacing: 6) {+ Text(verbatim: "VPhone.bundle \(bundle.version)")+ if isDefault {+ Text("Default")+ .foregroundStyle(.green)+ .help("Used for new machines.")+ }+ }Group {if VPhoneLaunchpadLocalBundle.isLocal(version: bundle.version) {- Text("Local build · Installed \(bundle.receipt.installedAt.formatted(date: .abbreviated, time: .shortened)) · SHA-256 \(Self.shortDigest(bundle.receipt.sha256))")+ if let build = Self.localBuild(bundle.version) {+ Text("Local build \(build) · Installed \(bundle.receipt.installedAt.formatted(date: .abbreviated, time: .shortened)) · SHA-256 \(Self.shortDigest(bundle.receipt.sha256))")+ } else {+ Text("Local build · Installed \(bundle.receipt.installedAt.formatted(date: .abbreviated, time: .shortened)) · SHA-256 \(Self.shortDigest(bundle.receipt.sha256))")+ }} else if bundle.version != VPhoneLaunchpadNames.bundleVersion(of: bundle.version) {Text("GitHub Actions build · Installed \(bundle.receipt.installedAt.formatted(date: .abbreviated, time: .shortened)) · SHA-256 \(Self.shortDigest(bundle.receipt.sha256))")} else {Text("Installed \(bundle.receipt.installedAt.formatted(date: .abbreviated, time: .omitted)) · SHA-256 \(Self.shortDigest(bundle.receipt.sha256))")}+ usersLabel(users)}.font(.caption).foregroundStyle(.secondary)@@ -122,8 +134,8 @@ struct VPhoneLaunchpadCoreBundleView: View {.font(.callout).help(checkHelp(bundle))Menu {- Button("Use This Version") { Task { await bundles.use(bundle.version) } }- .disabled(isActive || !VPhoneLaunchpadNames.isCompatibleBundleVersion(bundle.version))+ Button("Set as Default") { Task { await bundles.setDefault(bundle.version) } }+ .disabled(isDefault || !VPhoneLaunchpadNames.isCompatibleBundleVersion(bundle.version))Button("Run Preflight Again") { Task { await bundles.verify(bundle.version) } }.disabled(!VPhoneLaunchpadNames.isCompatibleBundleVersion(bundle.version))if bundles.isAccepted(bundle.version) {@@ -135,8 +147,10 @@ struct VPhoneLaunchpadCoreBundleView: View {NSWorkspace.shared.activateFileViewerSelecting([VPhoneLaunchpadBundleStore.bundle(version: bundle.version)])}Divider()+ // The store refuses too; saying so here spares a failed attempt.Button("Remove…", role: .destructive) { removal = bundle.version }- .disabled(bundles.isInstalling)+ .disabled(bundles.isInstalling || !users.isEmpty)+ .help(users.isEmpty ? "" : "Choose another Core Bundle for its machines first.")} label: {Image(systemName: "ellipsis")}@@ -146,6 +160,28 @@ struct VPhoneLaunchpadCoreBundleView: View {}}+ /// Names a few machines; past that, a count with the names in the help.+ @ViewBuilder+ private func usersLabel(_ users: [String]) -> some View {+ if users.isEmpty {+ Text("Not used by any machine")+ } else if users.count <= 3 {+ Text("Used by \(users.formatted(.list(type: .and)))")+ } else {+ Text("Used by \(users.count) machines")+ .help(users.formatted(.list(type: .and)))+ }+ }++ /// The build identifier of a `-local.<build>` version; nil for the bare+ /// `-local` an older Launchpad used.+ static func localBuild(_ version: String) -> String? {+ guard VPhoneLaunchpadLocalBundle.isLocal(version: version),+ let marker = version.range(of: "\(VPhoneLaunchpadLocalBundle.versionSuffix).", options: .backwards)+ else { return nil }+ return String(version[marker.upperBound...])+ }+/// Policy exception and preflight folded into one status: the worst of/// the two, with a skipped preflight shown as a warning.private func checkStatus(_ bundle: VPhoneLaunchpadCoreBundle.Installed) -> VPhoneLaunchpadStatus {diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadLocalBundle.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadLocalBundle.swiftindex 7a6123a6..6f3c93fb 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadLocalBundle.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadLocalBundle.swift@@ -10,11 +10,14 @@ import Foundation/// has no published digest, so the hash only proves that the helper installs/// the bytes prepared here.nonisolated struct VPhoneLaunchpadLocalBundle: Sendable {- /// Local builds are stored as `<version>-local`. They never replace a- /// release of the same version, and a newer local build of that version- /// replaces the older one.+ /// Local builds are stored as `<version>-local.<build>`, where `<build>`+ /// is the start of the SHA-256 of the bundle's code signature seal. They+ /// never replace a release of the same version, and two different builds+ /// of one version are kept side by side, so machines can stay on either.+ /// Installing the same build again keeps its name.static let versionSuffix = "-local"static let bundleIdentifier = "com.vphone.bundle"+ private static let sealPath = "Contents/_CodeSignature/CodeResources"let version: Stringlet archive: URL@@ -24,17 +27,17 @@ nonisolated struct VPhoneLaunchpadLocalBundle: Sendable {let workDirectory: URLstatic func isLocal(version: String) -> Bool {- version.hasSuffix(versionSuffix)+ VPhoneLaunchpadNames.isLocalBuild(version)}// MARK: - Prepare/// Reads the version from the bundle's Info.plist and produces the zip/// and digest the helper expects. A GitHub Actions build passes its own- /// suffix in place of `-local`.+ /// suffix in place of `-local.<build>`.@concurrent static func prepare(_ source: URL,- suffix: String = versionSuffix,+ suffix: String? = nil,) async throws -> VPhoneLaunchpadLocalBundle {let values = try? source.resourceValues(forKeys: [.isDirectoryKey])let isDirectory = values?.isDirectory ?? false@@ -45,6 +48,7 @@ nonisolated struct VPhoneLaunchpadLocalBundle: Sendable {do {let infoPlist: Data+ let seal: Data?let archive: URLif isDirectory {guard source.pathExtension == "bundle" else {@@ -54,6 +58,7 @@ nonisolated struct VPhoneLaunchpadLocalBundle: Sendable {throw notVPhoneBundle(source)}infoPlist = data+ seal = try? Data(contentsOf: source.appendingPathComponent(sealPath))// The helper expects VPhone.bundle at the top of the zip, so a// renamed build is copied under that name first.var bundle = source@@ -76,14 +81,20 @@ nonisolated struct VPhoneLaunchpadLocalBundle: Sendable {)}infoPlist = data+ seal = try? run("/usr/bin/unzip", ["-p", source.path, "VPhone.bundle/\(sealPath)"])archive = source}- let version = try version(from: infoPlist, source: source, suffix: suffix)- return try VPhoneLaunchpadLocalBundle(+ let digest = try sha256(of: archive)+ let version = try version(+ from: infoPlist,+ source: source,+ suffix: suffix ?? localSuffix(seal: seal, archiveDigest: digest),+ )+ return VPhoneLaunchpadLocalBundle(version: version,archive: archive,- sha256: sha256(of: archive),+ sha256: digest,workDirectory: work,)} catch {@@ -92,6 +103,16 @@ nonisolated struct VPhoneLaunchpadLocalBundle: Sendable {}}+ /// `-local.<build>`. The seal lists the digest of every file in the+ /// bundle, so it names the build however it was zipped; a bundle without+ /// one is named by its archive instead.+ private static func localSuffix(seal: Data?, archiveDigest: String) -> String {+ let build = seal.flatMap { $0.isEmpty ? nil : $0 }+ .map { SHA256.hash(data: $0).map { String(format: "%02x", $0) }.joined() }+ ?? archiveDigest+ return "\(versionSuffix).\(build.prefix(8))"+ }+private static func version(from infoPlist: Data, source: URL, suffix: String) throws -> String {guard let plist = try? PropertyListSerialization.propertyList(from: infoPlist, format: nil) as? [String: Any],plist["CFBundleIdentifier"] as? String == bundleIdentifier,diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swift b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swiftindex 1cdaa471..fe4a813d 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swift@@ -277,7 +277,7 @@ final class VPhoneLaunchpadHelperClient {}}- /// Runs `cfw update-environment` as root: redeploys the active bundle's+ /// Runs `cfw update-environment` as root: redeploys the given bundle's/// guest resources into a stopped machine. Output lines go to `onLine`.func updateGuestEnvironment(bundleVersion: String,diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstringsindex 23c531ad..ab9fb332 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings@@ -5363,40 +5363,6 @@}}},- "In use" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "In use"- }- },- "ja" : {- "stringUnit" : {- "state" : "translated",- "value" : "使用中"- }- },- "ko" : {- "stringUnit" : {- "state" : "translated",- "value" : "사용 중"- }- },- "vi" : {- "stringUnit" : {- "state" : "translated",- "value" : "Đang dùng"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "正在使用"- }- }- }- },"Include the restore IPSW directory" : {"localizations" : {"en" : {@@ -12159,40 +12125,6 @@}}},- "Use This Version" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Use This Version"- }- },- "ja" : {- "stringUnit" : {- "state" : "translated",- "value" : "このバージョンを使用"- }- },- "ko" : {- "stringUnit" : {- "state" : "translated",- "value" : "이 버전 사용"- }- },- "vi" : {- "stringUnit" : {- "state" : "translated",- "value" : "Dùng phiên bản này"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "使用此版本"- }- }- }- },"Use this version without the failed checks." : {"localizations" : {"en" : {@@ -12904,6 +12836,348 @@"vi" : { "stringUnit" : { "state" : "translated", "value" : "Phân giải tên của máy Mac này trong máy khách" } },"zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "在客户机内解析这台 Mac 的名称" } }}+ },+ "%@ (Default)" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "%@ (Default)" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "%@(デフォルト)" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "%@(기본값)" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "%@ (Mặc định)" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "%@(默认)" } }+ }+ },+ "Apply" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Apply" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "適用" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "적용" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Áp dụng" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "应用" } }+ }+ },+ "Boot Chain" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Boot Chain" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ブートチェーン" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "부트 체인" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Chuỗi khởi động" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "启动链" } }+ }+ },+ "Change Core Bundle of %@" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Change Core Bundle of %@" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "%@ のコアバンドルを変更" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "%@의 코어 번들 변경" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đổi Bundle lõi của %@" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "更改 %@ 的核心 Bundle" } }+ }+ },+ "Change Core Bundle of %lld Machines" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Change Core Bundle of %lld Machines" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "%lld 台のマシンのコアバンドルを変更" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "머신 %lld대의 코어 번들 변경" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đổi Bundle lõi của %lld máy" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "更改 %lld 台机器的核心 Bundle" } }+ }+ },+ "Change Core Bundle…" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Change Core Bundle…" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "コアバンドルを変更…" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "코어 번들 변경…" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đổi Bundle lõi…" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "更改核心 Bundle…" } }+ }+ },+ "Change…" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Change…" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "変更…" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "변경…" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Thay đổi…" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "更改…" } }+ }+ },+ "Checking Core Bundle…" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Checking Core Bundle…" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "コアバンドルを確認中…" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "코어 번들 확인 중…" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đang kiểm tra Bundle lõi…" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "正在检查核心 Bundle…" } }+ }+ },+ "Choose another Core Bundle for its machines first." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Choose another Core Bundle for its machines first." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "先に、このバージョンを使うマシンに別のコアバンドルを選択してください。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "먼저 이 버전을 사용하는 머신에 다른 코어 번들을 선택하세요." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Hãy chọn Bundle lõi khác cho các máy đang dùng phiên bản này trước." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "请先为使用此版本的机器选择其他核心 Bundle。" } }+ }+ },+ "Current" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Current" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "現在" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "현재" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Hiện tại" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "当前" } }+ }+ },+ "Default" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Default" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "デフォルト" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "기본값" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Mặc định" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "默认" } }+ }+ },+ "Fixed when the machine was created." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Fixed when the machine was created." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "マシンの作成時に固定されています。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "머신을 만들 때 고정되었습니다." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Được cố định khi tạo máy." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "在创建机器时已固定。" } }+ }+ },+ "Guest Environment" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Guest Environment" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ゲスト環境" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "게스트 환경" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Môi trường máy khách" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "客户机环境" } }+ }+ },+ "Host Programs" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Host Programs" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ホストプログラム" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "호스트 프로그램" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Chương trình máy chủ" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "主机程序" } }+ }+ },+ "Host programs change at the next start. The guest environment is updated now on stopped machines; running machines keep theirs until it is updated later. The boot chain and patches stay as they were when the machine was created." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Host programs change at the next start. The guest environment is updated now on stopped machines; running machines keep theirs until it is updated later. The boot chain and patches stay as they were when the machine was created." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ホストプログラムは次回の起動時に切り替わります。停止中のマシンではゲスト環境を今すぐ更新します。実行中のマシンは、後で更新するまで現在のゲスト環境のままです。ブートチェーンとパッチはマシン作成時のままです。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "호스트 프로그램은 다음 시작부터 바뀝니다. 정지된 머신은 게스트 환경을 지금 업데이트하고, 실행 중인 머신은 나중에 업데이트할 때까지 기존 환경을 유지합니다. 부트 체인과 패치는 머신을 만들 때 그대로 유지됩니다." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Chương trình máy chủ sẽ thay đổi từ lần khởi động tiếp theo. Môi trường máy khách được cập nhật ngay trên các máy đang dừng; máy đang chạy giữ môi trường hiện tại cho đến khi được cập nhật sau. Chuỗi khởi động và các bản vá giữ nguyên như khi tạo máy." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "主机程序在下次启动时切换。已停止的机器会立即更新客户机环境;正在运行的机器保留原有环境,直到之后再更新。启动链和补丁保持创建机器时的状态。" } }+ }+ },+ "Install it in Core Bundle, or choose another version for this machine." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Install it in Core Bundle, or choose another version for this machine." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "「コアバンドル」でインストールするか、このマシンに別のバージョンを選択してください。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "코어 번들에서 설치하거나 이 머신에 다른 버전을 선택하세요." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Hãy cài đặt trong Bundle lõi, hoặc chọn phiên bản khác cho máy này." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "请在“核心 Bundle”中安装,或为这台机器选择其他版本。" } }+ }+ },+ "Local build %@ · Installed %@ · SHA-256 %@" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Local build %@ · Installed %@ · SHA-256 %@" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ローカルビルド %1$@ · インストール日 %2$@ · SHA-256 %3$@" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "로컬 빌드 %1$@ · 설치 %2$@ · SHA-256 %3$@" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Bản dựng cục bộ %1$@ · Cài đặt %2$@ · SHA-256 %3$@" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "本地构建 %1$@ · 安装于 %2$@ · SHA-256 %3$@" } }+ }+ },+ "New machines use the default version. Each machine keeps its own Core Bundle, which you change from the machine list." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "New machines use the default version. Each machine keeps its own Core Bundle, which you change from the machine list." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "新しいマシンはデフォルトのバージョンを使います。各マシンは自分のコアバンドルを保持し、マシン一覧から変更できます。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "새 머신은 기본 버전을 사용합니다. 각 머신은 자체 코어 번들을 유지하며, 머신 목록에서 변경할 수 있습니다." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Máy mới dùng phiên bản mặc định. Mỗi máy giữ Bundle lõi riêng, có thể đổi từ danh sách máy." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "新机器使用默认版本。每台机器保留自己的核心 Bundle,可在机器列表中更改。" } }+ }+ },+ "No Core Bundle is installed. Install one in Core Bundle." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "No Core Bundle is installed. Install one in Core Bundle." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "コアバンドルがインストールされていません。「コアバンドル」でインストールしてください。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "설치된 코어 번들이 없습니다. 코어 번들에서 설치하세요." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Chưa cài Bundle lõi nào. Hãy cài đặt trong Bundle lõi." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "未安装核心 Bundle。请在“核心 Bundle”中安装。" } }+ }+ },+ "No Core Bundle version is installed. Install one in Core Bundle." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "No Core Bundle version is installed. Install one in Core Bundle." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "コアバンドルのバージョンがインストールされていません。「コアバンドル」でインストールしてください。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "설치된 코어 번들 버전이 없습니다. 코어 번들에서 설치하세요." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Chưa cài phiên bản Bundle lõi nào. Hãy cài đặt trong Bundle lõi." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "未安装任何核心 Bundle 版本。请在“核心 Bundle”中安装。" } }+ }+ },+ "Not used by any machine" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Not used by any machine" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "どのマシンにも使われていません" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "어떤 머신에서도 사용하지 않음" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Không máy nào dùng" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "没有机器使用" } }+ }+ },+ "Set as Default" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Set as Default" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "デフォルトに設定" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "기본값으로 설정" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đặt làm mặc định" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "设为默认" } }+ }+ },+ "The Core Bundle of %@ is not installed. Choose another Core Bundle for it." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "The Core Bundle of %@ is not installed. Choose another Core Bundle for it." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "%@ のコアバンドルがインストールされていません。別のコアバンドルを選択してください。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "%@의 코어 번들이 설치되어 있지 않습니다. 다른 코어 번들을 선택하세요." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Bundle lõi của %@ chưa được cài đặt. Hãy chọn Bundle lõi khác cho máy này." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "%@ 的核心 Bundle 未安装。请为它选择其他核心 Bundle。" } }+ }+ },+ "The boot chain and patches are fixed when the machine is created; host programs and the guest environment can be changed later." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "The boot chain and patches are fixed when the machine is created; host programs and the guest environment can be changed later." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ブートチェーンとパッチはマシンの作成時に固定されます。ホストプログラムとゲスト環境は後から変更できます。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "부트 체인과 패치는 머신을 만들 때 고정됩니다. 호스트 프로그램과 게스트 환경은 나중에 변경할 수 있습니다." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Chuỗi khởi động và các bản vá được cố định khi tạo máy; chương trình máy chủ và môi trường máy khách có thể thay đổi sau." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "启动链和补丁在创建机器时固定;主机程序和客户机环境之后仍可更改。" } }+ }+ },+ "The guest environment is from %@." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "The guest environment is from %@." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ゲスト環境は %@ のものです。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "게스트 환경은 %@에서 가져온 것입니다." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Môi trường máy khách lấy từ %@." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "客户机环境来自 %@。" } }+ }+ },+ "The host programs and the guest environment come from different Core Bundles. Update the guest environment to match." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "The host programs and the guest environment come from different Core Bundles. Update the guest environment to match." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ホストプログラムとゲスト環境が異なるコアバンドルから来ています。ゲスト環境を更新して揃えてください。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "호스트 프로그램과 게스트 환경이 서로 다른 코어 번들에서 왔습니다. 게스트 환경을 업데이트해 맞추세요." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Chương trình máy chủ và môi trường máy khách đến từ các Bundle lõi khác nhau. Hãy cập nhật môi trường máy khách cho khớp." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "主机程序与客户机环境来自不同的核心 Bundle。请更新客户机环境以保持一致。" } }+ }+ },+ "These machines use it: %@. Choose another Core Bundle for them first." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "These machines use it: %@. Choose another Core Bundle for them first." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "次のマシンが使用しています:%@。先に別のコアバンドルを選択してください。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "다음 머신이 사용 중입니다: %@. 먼저 다른 코어 번들을 선택하세요." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Các máy sau đang dùng: %@. Hãy chọn Bundle lõi khác cho chúng trước." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "以下机器正在使用:%@。请先为它们选择其他核心 Bundle。" } }+ }+ },+ "Unable to Change the Core Bundle of %@" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Unable to Change the Core Bundle of %@" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "%@ のコアバンドルを変更できません" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "%@의 코어 번들을 변경할 수 없음" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Không thể đổi Bundle lõi của %@" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "无法更改 %@ 的核心 Bundle" } }+ }+ },+ "Unable to record the Core Bundle of %@." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Unable to record the Core Bundle of %@." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "%@ のコアバンドルを記録できません。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "%@의 코어 번들을 기록할 수 없습니다." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Không thể ghi lại Bundle lõi của %@." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "无法记录 %@ 的核心 Bundle。" } }+ }+ },+ "Update guest environment" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Update guest environment" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ゲスト環境を更新" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "게스트 환경 업데이트" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Cập nhật môi trường máy khách" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "更新客户机环境" } }+ }+ },+ "Used by %@" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Used by %@" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "使用中:%@" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "사용 중: %@" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đang dùng: %@" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "使用者:%@" } }+ }+ },+ "Used by %lld machines" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Used by %lld machines" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "%lld 台のマシンが使用中" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "머신 %lld대가 사용 중" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "%lld máy đang dùng" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "%lld 台机器正在使用" } }+ }+ },+ "Used for new machines." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Used for new machines." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "新しいマシンに使われます。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "새 머신에 사용됩니다." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Dùng cho máy mới." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "用于新机器。" } }+ }+ },+ "VPhone.bundle %@ did not pass host preflight." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ did not pass host preflight." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ はホストの事前チェックに合格しませんでした。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@이(가) 호스트 사전 검사를 통과하지 못했습니다." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ không vượt qua kiểm tra máy chủ." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ 未通过主机预检。" } }+ }+ },+ "VPhone.bundle %@ is not installed." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ is not installed." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ はインストールされていません。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@이(가) 설치되어 있지 않습니다." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ chưa được cài đặt." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ 未安装。" } }+ }+ },+ "VPhone.bundle %@ is not installed. Choose Change Core Bundle… to run this machine with another version." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ is not installed. Choose Change Core Bundle… to run this machine with another version." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ はインストールされていません。「コアバンドルを変更…」を選択して、このマシンを別のバージョンで実行してください。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@이(가) 설치되어 있지 않습니다. 코어 번들 변경…을 선택해 이 머신을 다른 버전으로 실행하세요." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ chưa được cài đặt. Chọn Đổi Bundle lõi… để chạy máy này với phiên bản khác." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "VPhone.bundle %@ 未安装。请选择“更改核心 Bundle…”,用其他版本运行这台机器。" } }+ }+ },+ "vphone-cli and vphone-vm come from this bundle at every start." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "vphone-cli and vphone-vm come from this bundle at every start." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "vphone-cli と vphone-vm は起動のたびにこのバンドルから読み込まれます。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "vphone-cli와 vphone-vm은 시작할 때마다 이 번들에서 실행됩니다." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "vphone-cli và vphone-vm được lấy từ bundle này mỗi lần khởi động." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "每次启动时都使用此 Bundle 中的 vphone-cli 和 vphone-vm。" } }+ }+ },+ "vphoned and the hook libraries in the guest." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "vphoned and the hook libraries in the guest." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ゲスト内の vphoned とフックライブラリ。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "게스트의 vphoned와 후크 라이브러리." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "vphoned và các thư viện hook trong máy khách." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "客户机中的 vphoned 和 hook 库。" } }+ }}},"version" : "1.0"diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadChangeBundleView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadChangeBundleView.swiftnew file mode 100644index 00000000..6a5033cd--- /dev/null+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadChangeBundleView.swift@@ -0,0 +1,92 @@+import SwiftUI++// MARK: - Change Core Bundle++/// Binds one or more machines to another installed Core Bundle. The host+/// programs follow at the next start; the guest environment can be updated+/// now on stopped machines. The boot chain stays as created.+struct VPhoneLaunchpadChangeBundleView: View {+ let machines: [VPhoneLaunchpadMachine]+ @Environment(VPhoneLaunchpadModel.self) private var model+ @Environment(\.dismiss) private var dismiss+ @State private var version = ""+ @State private var updatesEnvironment = true++ private var library: VPhoneLaunchpadMachineLibrary {+ model.machines+ }++ private var title: Text {+ machines.count == 1+ ? Text("Change Core Bundle of \(machines[0].name)")+ : Text("Change Core Bundle of \(machines.count) Machines")+ }++ /// Nothing to do when every machine already runs with `version` and+ /// its guest environment is left alone.+ private var canApply: Bool {+ !version.isEmpty && (updatesEnvironment || machines.contains { library.bundleVersion(for: $0.path) != version })+ }++ var body: some View {+ VPhoneLaunchpadSheet(title) {+ Form {+ Section("Current") {+ ForEach(machines) { machine in+ LabeledContent(machine.name) {+ Text(verbatim: library.bundleVersion(for: machine.path) ?? "—")+ .lineLimit(1)+ .truncationMode(.middle)+ }+ }+ }+ Section {+ Picker("Core Bundle", selection: $version) {+ ForEach(model.bundles.selectableVersions, id: \.self) { version in+ if version == model.bundles.defaultVersion {+ Text("\(version) (Default)").tag(version)+ } else {+ Text(verbatim: version).tag(version)+ }+ }+ }+ Toggle("Update guest environment", isOn: $updatesEnvironment)+ } footer: {+ Text("Host programs change at the next start. The guest environment is updated now on stopped machines; running machines keep theirs until it is updated later. The boot chain and patches stay as they were when the machine was created.")+ .foregroundStyle(.secondary)+ }+ }+ .formStyle(.grouped)+ } actions: {+ Button("Cancel") { dismiss() }+ .keyboardShortcut(.cancelAction)+ Button("Apply") { apply() }+ .keyboardShortcut(.defaultAction)+ .disabled(!canApply)+ }+ .frame(width: 460)+ .fixedSize(horizontal: false, vertical: true)+ .onAppear {+ // The machines' own version when they share one, else the default.+ let current = Set(machines.map { library.bundleVersion(for: $0.path) })+ let versions = model.bundles.selectableVersions+ if current.count == 1, let shared = current.first ?? nil, versions.contains(shared) {+ version = shared+ } else {+ version = model.bundles.defaultVersion.flatMap { versions.contains($0) ? $0 : nil } ?? versions.first ?? ""+ }+ }+ }++ private func apply() {+ // setBundle leaves out machines with no guest environment to update.+ let version = version+ let library = library+ let paths = machines.map(\.path)+ let updatesEnvironment = updatesEnvironment+ Task {+ await library.setBundle(version, for: paths, updateEnvironment: updatesEnvironment)+ }+ dismiss()+ }+}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swiftindex 0721e006..809b96a5 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift@@ -18,6 +18,9 @@ final class VPhoneLaunchpadCreationPipeline {var name: String/// The canonical library the machine is created in.var libraryRoot: String+ /// The installed Core Bundle every step runs with. The machine is+ /// bound to it once `vm new` has made its folder.+ var bundleVersion: Stringvar iphoneSource: Stringvar cloudOSSource: Stringvar cpuCount: Int@@ -176,6 +179,12 @@ final class VPhoneLaunchpadCreationPipeline {statuses[step] = .runninglet began = Date()do {+ // `vm launch --dfu` needs the bundle's policy exception and+ // AMFI admission, so the version is checked before any step+ // runs. A failure shows on the step that was about to run.+ if step == first {+ try await prepareBundle()+ }try await perform(step)try Task.checkCancellation()statuses[step] = .passed@@ -234,9 +243,20 @@ final class VPhoneLaunchpadCreationPipeline {// MARK: - Steps+ /// Checks the machine's Core Bundle once per Launchpad session; later+ /// runs return at once.+ private func prepareBundle() async throws {+ let version = options.bundleVersion+ if !bundles.isChecked(version) {+ append("checking Core Bundle \(version)")+ }+ try await bundles.prepare(version)+ }+private func perform(_ step: Step) async throws {- guard let commandLine = bundles.commandLine() else {- throw VPhoneLaunchpadError(String(localized: "No Core Bundle version is in use. Choose a version in Core Bundle."))+ let version = options.bundleVersion+ guard let commandLine = bundles.commandLine(version: version) else {+ throw VPhoneLaunchpadError(String(localized: "VPhone.bundle \(version) is not installed."))}let name = options.namelet library = machine.libraryArguments@@ -253,6 +273,16 @@ final class VPhoneLaunchpadCreationPipeline {case .create:try await run(["vm", "new", name, "--cpu", String(options.cpuCount),"--memory", String(options.memoryMB), "--disk-size", String(options.diskSizeGB)] + library)+ // The folder exists now. Every later command, here and after+ // creation, runs with the version recorded in it.+ do {+ try self.library?.bind(machine, VPhoneLaunchpadMachineBinding(bundle: version, bootChain: version))+ } catch {+ throw VPhoneLaunchpadError(+ String(localized: "Unable to record the Core Bundle of \(name)."),+ detail: error.localizedDescription,+ )+ }if options.network != "nat" {try await run(["vm", "config", name, "--network", options.network] + library)}@@ -269,7 +299,7 @@ final class VPhoneLaunchpadCreationPipeline {// the patch output is also kept in a log of its own for later// diagnosis.let patchLog = VPhoneLaunchpadLogWriter(url: VPhoneLaunchpadMachineLibrary.consoleLog(machine, suffix: "-patch"))- patchLog.write("# \(options.name), \(Date().formatted(.iso8601)), Core Bundle \(bundles.activeVersion ?? "?")")+ patchLog.write("# \(options.name), \(Date().formatted(.iso8601)), Core Bundle \(version)")let tee: @Sendable (String) -> Void = { line inlog.write(line)patchLog.write(line)@@ -339,9 +369,6 @@ final class VPhoneLaunchpadCreationPipeline {try await Task.sleep(for: .seconds(5))case .installCFW:- guard let version = bundles.activeVersion else {- throw VPhoneLaunchpadError(String(localized: "No Core Bundle version is in use. Choose a version in Core Bundle."))- }let status = try await helper.installCustomFirmware(bundleVersion: version,machineName: name,@@ -355,6 +382,7 @@ final class VPhoneLaunchpadCreationPipeline {guard status == 0 else {throw VPhoneLaunchpadError(String(localized: "Unable to install custom firmware. Check the log for details."), detail: log.tail)}+ self.library?.recordGuestEnvironment(machine, version)case .firstBoot:try await firstBoot()@@ -369,7 +397,7 @@ final class VPhoneLaunchpadCreationPipeline {}let name = options.nameappend("$ vphone-cli vm launch \(name)")- library.start(machine)+ await library.start(machine)guard let child = library.launchedProcess(machine) else {throw VPhoneLaunchpadError(String(localized: "\(name) could not be started."))}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineBinding.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineBinding.swiftnew file mode 100644index 00000000..1ad3bf40--- /dev/null+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineBinding.swift@@ -0,0 +1,73 @@+import Foundation++/// The Core Bundle a machine runs with, and the bundles that built the parts+/// of it a later bundle does not replace.+///+/// A machine is made of three layers that come from a bundle at different+/// times:+/// - the host programs (`vphone-cli`, `vphone-vm`), taken from `bundle` on+/// every command, so changing it takes effect on the next start;+/// - the guest environment (vphoned and the hook dylibs), copied in by+/// `cfw install` and again by `cfw update-environment`;+/// - the boot chain and the custom firmware patches, written by `fw patch`,+/// `restore` and `cfw install` when the machine is created. Only creating+/// the machine again changes them.+///+/// Launchpad keeps this in `launchpad.json` inside the machine folder, so it+/// moves with `vm rename` and is copied by `vm clone`. vphone-cli neither+/// reads nor writes it.+nonisolated struct VPhoneLaunchpadMachineBinding: Codable, Equatable, Sendable {+ /// The store version every command on this machine runs with.+ var bundle: String+ /// The bundle that patched and restored the boot chain. Nil for a+ /// machine created before Launchpad recorded it.+ var bootChain: String?+ /// The bundle whose guest environment was installed last. Nil while+ /// unknown.+ var guestEnvironment: String?++ static let fileName = "launchpad.json"++ init(bundle: String, bootChain: String? = nil, guestEnvironment: String? = nil) {+ self.bundle = bundle+ self.bootChain = bootChain+ self.guestEnvironment = guestEnvironment+ }++ /// True when the guest environment is known to come from another bundle+ /// than the host programs that talk to it.+ var hasMixedVersions: Bool {+ guestEnvironment.map { $0 != bundle } ?? false+ }++ // MARK: - File++ static func url(for machine: VPhoneLaunchpadMachinePath) -> URL {+ machine.url.appendingPathComponent(fileName)+ }++ /// Nil when the machine has no binding yet, or the file is not one+ /// Launchpad wrote. Every version is checked, since the file is in a+ /// folder the user owns and a version becomes a path in the store.+ static func load(_ machine: VPhoneLaunchpadMachinePath) -> VPhoneLaunchpadMachineBinding? {+ let url = url(for: machine)+ guard let values = try? url.resourceValues(forKeys: [.isRegularFileKey, .isSymbolicLinkKey]),+ values.isRegularFile == true, values.isSymbolicLink != true,+ let data = try? Data(contentsOf: url),+ let binding = try? JSONDecoder().decode(Self.self, from: data),+ VPhoneLaunchpadNames.isValidVersion(binding.bundle),+ [binding.bootChain, binding.guestEnvironment].allSatisfy({ $0.map(VPhoneLaunchpadNames.isValidVersion) ?? true })+ else {+ return nil+ }+ return binding+ }++ /// Atomic, so a `launchpad.json` that is a symbolic link is replaced+ /// rather than written through.+ func save(to machine: VPhoneLaunchpadMachinePath) throws {+ let encoder = JSONEncoder()+ encoder.outputFormatting = [.prettyPrinted, .sortedKeys]+ try encoder.encode(self).write(to: Self.url(for: machine), options: .atomic)+ }+}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swiftindex 64b26e6a..fe215722 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift@@ -34,6 +34,38 @@ struct VPhoneLaunchpadMachineStateLabel: View {}}+// MARK: - Core Bundle label++/// The version a machine runs with, as the table shows it, with a warning+/// when that version is gone or the guest environment came from another.+struct VPhoneLaunchpadMachineBundleLabel: View {+ let machine: VPhoneLaunchpadMachinePath+ @Environment(VPhoneLaunchpadModel.self) private var model++ var body: some View {+ let library = model.machines+ let version = library.bundleVersion(for: machine)+ let warning: String? = if let version, !model.bundles.selectableVersions.contains(version) {+ String(localized: "VPhone.bundle \(version) is not installed. Choose Change Core Bundle… to run this machine with another version.")+ } else if let binding = library.bindings[machine], binding.hasMixedVersions, let guest = binding.guestEnvironment {+ String(localized: "The guest environment is from \(guest).") + " " + VPhoneLaunchpadMachineInspector.mixedHelp+ } else {+ nil+ }+ HStack(spacing: 4) {+ Text(verbatim: version ?? "—")+ .lineLimit(1)+ .truncationMode(.middle)+ if warning != nil {+ Image(systemName: "exclamationmark.triangle.fill")+ .foregroundStyle(.yellow)+ .imageScale(.small)+ }+ }+ .help(warning ?? version ?? "")+ }+}+// MARK: - Inspector/// The trailing inspector for the selected machine. Values are split into@@ -43,6 +75,7 @@ struct VPhoneLaunchpadMachineInspector: View {let machine: VPhoneLaunchpadMachinelet onShowProgress: (VPhoneLaunchpadMachinePath) -> Voidlet onOpenConsole: (VPhoneLaunchpadMachinePath) -> Void+ var onChangeBundle: (VPhoneLaunchpadMachine) -> Void = { _ in }@Environment(VPhoneLaunchpadModel.self) private var model@State private var showsCommands = false@@ -82,6 +115,8 @@ struct VPhoneLaunchpadMachineInspector: View {}}+ coreBundleSection+Section("Hardware") {LabeledContent("CPU", value: String(localized: "\(machine.cpuCount) cores"))LabeledContent("Memory", value: VPhoneLaunchpadMachinesView.memory(machine.memoryMB))@@ -130,6 +165,62 @@ struct VPhoneLaunchpadMachineInspector: View {}}+ static var mixedHelp: String {+ String(localized: "The host programs and the guest environment come from different Core Bundles. Update the guest environment to match.")+ }++ // MARK: - Core Bundle++ /// The three layers a bundle provides, each from the bundle that last+ /// wrote it. A new binding reaches the host programs at the next start+ /// and the guest environment when it is updated, never the boot chain.+ private var coreBundleSection: some View {+ let binding = library.bindings[machine.path]+ let version = library.bundleVersion(for: machine.path)+ let isInstalled = version.map(model.bundles.selectableVersions.contains) ?? false+ return Section("Core Bundle") {+ layer(+ "Host Programs",+ version ?? String(localized: "Unknown"),+ warning: isInstalled ? nil : version.map { String(localized: "VPhone.bundle \($0) is not installed.") },+ help: String(localized: "vphone-cli and vphone-vm come from this bundle at every start."),+ )+ layer(+ "Guest Environment",+ binding?.guestEnvironment ?? String(localized: "Unknown"),+ warning: binding?.hasMixedVersions == true ? Self.mixedHelp : nil,+ help: String(localized: "vphoned and the hook libraries in the guest."),+ )+ layer(+ "Boot Chain",+ binding?.bootChain ?? String(localized: "Unknown"),+ help: String(localized: "Fixed when the machine was created."),+ )+ HStack {+ Spacer()+ Button("Change…") { onChangeBundle(machine) }+ .disabled(model.bundles.selectableVersions.isEmpty || library.creations[machine.path]?.isRunning == true)+ }+ }+ }++ private func layer(_ title: LocalizedStringKey, _ value: String, warning: String? = nil, help: String) -> some View {+ LabeledContent(title) {+ HStack(spacing: 4) {+ if warning != nil {+ Image(systemName: "exclamationmark.triangle.fill")+ .foregroundStyle(.yellow)+ .imageScale(.small)+ }+ Text(value)+ .lineLimit(1)+ .truncationMode(.middle)+ .textSelection(.enabled)+ }+ .help(warning ?? help)+ }+ }+private func value(_ title: LocalizedStringKey, _ value: String) -> some View {LabeledContent(title) {Text(value)diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swiftindex eeeb780e..bdbcdf94 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift@@ -28,6 +28,8 @@ final class VPhoneLaunchpadMachineLibrary {/// them. The console text itself stays in the log file.private(set) var panicked: Set<Path> = []private(set) var creations: [Path: VPhoneLaunchpadCreationPipeline] = [:]+ /// Each listed machine's Core Bundle, read from its `launchpad.json`.+ private(set) var bindings: [Path: VPhoneLaunchpadMachineBinding] = [:]private(set) var globalActivity: String?/// Folders chosen in New Machine, in the order they were added. The/// default library is not among them.@@ -204,6 +206,7 @@ final class VPhoneLaunchpadMachineLibrary {}let paths = machines.map(\.path)externallyRunning = await Task.detached { Self.machinesHoldingDisks(paths) }.value+ await loadBindings(paths)}/// The same test `vm stop` uses: a machine runs while some process holds@@ -249,6 +252,102 @@ final class VPhoneLaunchpadMachineLibrary {return name}+ // MARK: - Core Bundle++ /// Reads every machine's binding. A machine without one, created before+ /// bindings existed or outside Launchpad, is bound to the default+ /// version, so a bundle installed later does not change what it runs. A+ /// machine still being created is skipped: its pipeline binds it.+ private func loadBindings(_ paths: [Path]) async {+ let pending = Set(creations.keys)+ let fallback = bundles.defaultVersion+ let before = bindings+ var loaded = await Task.detached {+ var bindings: [Path: VPhoneLaunchpadMachineBinding] = [:]+ for path in paths {+ if let binding = VPhoneLaunchpadMachineBinding.load(path) {+ bindings[path] = binding+ } else if !pending.contains(path), let fallback {+ let binding = VPhoneLaunchpadMachineBinding(bundle: fallback)+ // An unwritable folder still runs with the default.+ if (try? binding.save(to: path)) != nil {+ bindings[path] = binding+ }+ }+ }+ return bindings+ }.value+ // A binding written while the files were read is newer than its file+ // was then.+ for (path, binding) in bindings where before[path] != binding {+ loaded[path] = binding+ }+ bindings = loaded+ }++ /// The version a machine runs with: its binding, else the default.+ func bundleVersion(for machine: Path) -> String? {+ bindings[machine]?.bundle ?? bundles.defaultVersion+ }++ /// `vphone-cli` of the machine's own bundle. Nil when that version is+ /// not installed, for example on a machine imported from another Mac.+ func commandLine(for machine: Path) -> VPhoneLaunchpadCommandLine? {+ bundleVersion(for: machine).flatMap(bundles.commandLine(version:))+ }++ /// Names of the listed machines bound to `version`.+ func machineNames(boundTo version: String) -> [String] {+ machines.filter { bundleVersion(for: $0.path) == version }.map(\.name)+ }++ /// Writes a machine's binding and keeps the listed copy in step.+ func bind(_ machine: Path, _ binding: VPhoneLaunchpadMachineBinding) throws {+ try binding.save(to: machine)+ bindings[machine] = binding+ }++ /// Binds machines to another installed version. The host programs change+ /// on the next start. With `updateEnvironment`, each stopped machine also+ /// gets that version's guest environment; a running one keeps its own+ /// until it is updated later. Boot chain and patches stay as created.+ func setBundle(_ version: String, for machines: [Path], updateEnvironment: Bool) async {+ guard bundles.commandLine(version: version) != nil else {+ actionError = VPhoneLaunchpadError(String(localized: "VPhone.bundle \(version) is not installed."))+ return+ }+ for machine in machines {+ var binding = VPhoneLaunchpadMachineBinding.load(machine)+ ?? bindings[machine]+ ?? VPhoneLaunchpadMachineBinding(bundle: version)+ binding.bundle = version+ do {+ try bind(machine, binding)+ } catch {+ actionError = VPhoneLaunchpadError(+ String(localized: "Unable to Change the Core Bundle of \(machine.name)"),+ detail: error.localizedDescription,+ )+ continue+ }+ // A machine not restored yet, or whose custom firmware install+ // did not finish, has no guest environment to update.+ let listed = self.machines.first { $0.path == machine }+ if updateEnvironment, state(of: machine) == .stopped,+ listed?.restoreInfo != nil, listed?.customFirmwareInstalled != false+ {+ await updateGuestEnvironment(machine)+ }+ }+ }++ /// Records the bundle whose guest environment a machine now has.+ func recordGuestEnvironment(_ machine: Path, _ version: String) {+ var binding = VPhoneLaunchpadMachineBinding.load(machine) ?? VPhoneLaunchpadMachineBinding(bundle: version)+ binding.guestEnvironment = version+ try? bind(machine, binding)+ }+// MARK: - Console/// Machines in the default library keep their log names. Elsewhere the@@ -291,8 +390,33 @@ final class VPhoneLaunchpadMachineLibrary {// MARK: - Start and stop- func start(_ machine: Path, headless: Bool = false) {- guard let commandLine = bundles.commandLine() else {+ /// Starts a machine with its own bundle, after checking that bundle in+ /// this session (policy exception, host preflight and AMFI admission).+ func start(_ machine: Path, headless: Bool = false) async {+ guard let version = bundleVersion(for: machine) else {+ actionError = VPhoneLaunchpadError(String(localized: "No Core Bundle version is installed. Install one in Core Bundle."))+ return+ }+ let isChecking = !bundles.isChecked(version)+ if isChecking {+ activities[machine] = String(localized: "Checking Core Bundle…")+ }+ do {+ try await bundles.prepare(version)+ if isChecking {+ activities[machine] = nil+ }+ } catch {+ if isChecking {+ activities[machine] = nil+ }+ actionError = VPhoneLaunchpadError(+ String(localized: "Unable to Start \(machine.name)"),+ detail: VPhoneLaunchpadError.message(for: error),+ )+ return+ }+ guard let commandLine = bundles.commandLine(version: version) else {return}// `vm launch` refuses these too, but only into the console log.@@ -333,8 +457,8 @@ final class VPhoneLaunchpadMachineLibrary {/// Runs `cfw install` again through the helper, for a machine whose last/// install did not finish. Output goes to the machine's console log.func installCustomFirmware(_ machine: Path) async {- guard let version = bundles.activeVersion else {- actionError = VPhoneLaunchpadError(String(localized: "No Core Bundle version is in use. Choose a version in Core Bundle."))+ guard let version = bundleVersion(for: machine) else {+ actionError = VPhoneLaunchpadError(String(localized: "No Core Bundle version is installed. Install one in Core Bundle."))return}activities[machine] = String(localized: "Installing custom firmware…")@@ -354,6 +478,8 @@ final class VPhoneLaunchpadMachineLibrary {String(localized: "Unable to install custom firmware. Check the log for details."),detail: String(localized: "Choose Show Console Log for the full output."),)+ } else {+ recordGuestEnvironment(machine, version)}} catch {if !(error is CancellationError) {@@ -364,13 +490,13 @@ final class VPhoneLaunchpadMachineLibrary {await refresh()}- /// Redeploys the active bundle's guest resources (vphoned and the hook- /// dylibs) into a stopped machine through the helper, and nothing else.- /// This is how a machine created by an older bundle gets newer hooks,- /// since its restore tree is gone after the first boot.+ /// Redeploys the guest resources (vphoned and the hook dylibs) of the+ /// machine's own bundle into it while it is stopped, through the helper,+ /// and nothing else. This is how a machine created by an older bundle+ /// gets newer hooks, since its restore tree is gone after the first boot.func updateGuestEnvironment(_ machine: Path) async {- guard let version = bundles.activeVersion else {- actionError = VPhoneLaunchpadError(String(localized: "No Core Bundle version is in use. Choose a version in Core Bundle."))+ guard let version = bundleVersion(for: machine) else {+ actionError = VPhoneLaunchpadError(String(localized: "No Core Bundle version is installed. Install one in Core Bundle."))return}activities[machine] = String(localized: "Updating guest environment…")@@ -389,6 +515,8 @@ final class VPhoneLaunchpadMachineLibrary {String(localized: "Unable to update the guest environment."),detail: String(localized: "Choose Show Console Log for the full output."),)+ } else {+ recordGuestEnvironment(machine, version)}} catch {if !(error is CancellationError) {@@ -531,7 +659,13 @@ final class VPhoneLaunchpadMachineLibrary {_ arguments: [String],onProgress: (@Sendable (Double) -> Void)? = nil,) async -> Bool {- guard let commandLine = bundles.commandLine() else {+ guard let commandLine = machine.map(commandLine(for:)) ?? bundles.commandLine() else {+ if let machine {+ actionError = VPhoneLaunchpadError(+ String(localized: "Unable to Complete Action"),+ detail: String(localized: "The Core Bundle of \(machine.name) is not installed. Choose another Core Bundle for it."),+ )+ }return false}if let machine {@@ -594,6 +728,16 @@ final class VPhoneLaunchpadMachineLibrary {startedAt = [VPhoneLaunchpadPreview.path("research-01"): Date().addingTimeInterval(-6130)]creations = [creation.machine: creation]selection = [VPhoneLaunchpadPreview.path("research-01")]+ // One machine on an older bundle whose guest environment was not+ // updated with it, so the inspector shows mixed versions.+ let current = VPhoneLaunchpadPreview.releases[1].version+ let older = VPhoneLaunchpadPreview.releases[2].version+ bindings = Dictionary(uniqueKeysWithValues: machines.map { machine in+ let binding = machine.name == "research-01"+ ? VPhoneLaunchpadMachineBinding(bundle: current, bootChain: older, guestEnvironment: older)+ : VPhoneLaunchpadMachineBinding(bundle: current, bootChain: current, guestEnvironment: current)+ return (machine.path, binding)+ })}}#endifdiff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swiftindex c329759c..30d2793a 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift@@ -8,6 +8,7 @@ struct VPhoneLaunchpadMachinesView: View {case newMachinecase creation(MachinePath)case settings([VPhoneLaunchpadMachine])+ case changeBundle([VPhoneLaunchpadMachine])case rename(MachinePath)case clone(MachinePath)case export([MachinePath])@@ -18,6 +19,7 @@ struct VPhoneLaunchpadMachinesView: View {case .newMachine: "new"case let .creation(machine): "creation-\(machine.url.path)"case let .settings(machines): "settings-\(machines.map(\.path.url.path).joined(separator: "|"))"+ case let .changeBundle(machines): "bundle-\(machines.map(\.path.url.path).joined(separator: "|"))"case let .rename(machine): "rename-\(machine.url.path)"case let .clone(machine): "clone-\(machine.url.path)"case let .export(machines): "export-\(machines.map(\.url.path).joined(separator: "|"))"@@ -76,6 +78,7 @@ struct VPhoneLaunchpadMachinesView: View {machine: machine,onShowProgress: { path in sheet = .creation(path) },onOpenConsole: { path in sheet = .console(path) },+ onChangeBundle: { machine in sheet = .changeBundle([machine]) },)} else if library.selection.count > 1 {ContentUnavailableView("\(library.selection.count) Machines Selected", systemImage: "iphone")@@ -155,7 +158,7 @@ struct VPhoneLaunchpadMachinesView: View {}.menuIndicator(.hidden).help("Create a machine")- .disabled(model.bundles.activeVersion == nil)+ .disabled(model.bundles.defaultVersion == nil)}// Without it, macOS 26 draws New Machine and the search field in// one glass capsule.@@ -227,8 +230,10 @@ struct VPhoneLaunchpadMachinesView: View {}private func start(_ machines: [VPhoneLaunchpadMachine], headless: Bool = false) {- for machine in machines {- library.start(machine.path, headless: headless)+ Task {+ for machine in machines {+ await library.start(machine.path, headless: headless)+ }}}@@ -272,6 +277,7 @@ struct VPhoneLaunchpadMachinesView: View {let allStopped = stopped.count == machines.countButton("Settings…") { sheet = .settings(machines) }.disabled(!allStopped)+ changeBundleButton(machines)Button("Export…") { sheet = .export(machines.map(\.path)) }.disabled(!allStopped)Button("Delete…", role: .destructive) { deletion = machines.map(\.path) }@@ -289,11 +295,12 @@ struct VPhoneLaunchpadMachinesView: View {}} else if let machine = machines.first {let isStopped = library.state(of: machine.path) == .stopped- Button("Start Headless") { library.start(machine.path, headless: true) }+ Button("Start Headless") { Task { await library.start(machine.path, headless: true) } }.disabled(!isStopped)Divider()Button("Settings…") { sheet = .settings([machine]) }.disabled(!isStopped)+ changeBundleButton([machine])Button("Rename…") { sheet = .rename(machine.path) }.disabled(!isStopped)Button("Clone…") { sheet = .clone(machine.path) }@@ -306,8 +313,8 @@ struct VPhoneLaunchpadMachinesView: View {// Only for an unfinished install: that is when the restore tree it// reads is still there. A finished one removes it..disabled(!isStopped || machine.customFirmwareInstalled != false)- // The finished-install counterpart: redeploys the active bundle's- // guest resources without the restore tree.+ // The finished-install counterpart: redeploys the machine's own+ // bundle's guest resources without the restore tree.Button("Update Guest Environment") {Task { await library.updateGuestEnvironment(machine.path) }}@@ -330,6 +337,14 @@ struct VPhoneLaunchpadMachinesView: View {}}+ /// Rebinding applies at the next start, so running machines may change+ /// too. A machine still being created gets its bundle from the pipeline.+ private func changeBundleButton(_ machines: [VPhoneLaunchpadMachine]) -> some View {+ Button("Change Core Bundle…") { sheet = .changeBundle(machines) }+ .disabled(model.bundles.selectableVersions.isEmpty+ || machines.contains { library.creations[$0.path]?.isRunning == true })+ }+// MARK: - Tableprivate func table(selection: Binding<Set<MachinePath>>) -> some View {@@ -350,6 +365,10 @@ struct VPhoneLaunchpadMachinesView: View {Text(verbatim: machine.restoreInfo.map { "\($0.ios.version) (\($0.ios.build))" } ?? "—")}.width(min: 110, ideal: 120)+ TableColumn("Core Bundle") { machine in+ VPhoneLaunchpadMachineBundleLabel(machine: machine.path)+ }+ .width(min: 70, ideal: 90)TableColumn("State") { machine inVPhoneLaunchpadMachineStateLabel(state: library.state(of: machine.path),@@ -387,7 +406,7 @@ struct VPhoneLaunchpadMachinesView: View {@ViewBuilderprivate var emptyState: some View {- if model.bundles.activeVersion == nil {+ if model.bundles.defaultVersion == nil {ContentUnavailableView {Label("No Core Bundle", systemImage: "shippingbox")} description: {@@ -426,6 +445,8 @@ struct VPhoneLaunchpadMachinesView: View {}case let .settings(machines):VPhoneLaunchpadMachineSettingsView(machines: machines)+ case let .changeBundle(machines):+ VPhoneLaunchpadChangeBundleView(machines: machines)case let .rename(path):VPhoneLaunchpadNameSheet(title: "Rename \(path.name)", action: "Rename", initial: path.name, machine: path) { newName inTask { await library.rename(path, to: newName) }diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swiftindex 3f3e2edb..2627c467 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift@@ -10,6 +10,9 @@ struct VPhoneLaunchpadNewMachineAdvancedView: View {let patchCatalogError: String?/// New Machine owns the catalog, which is read again for each preset.let reloadPatches: () -> Void+ /// The Core Bundle chosen in New Machine, whose patches the editor lists.+ /// Nil reads the default version's.+ var bundleVersion: String?@Environment(VPhoneLaunchpadModel.self) private var model@Environment(\.dismiss) private var dismiss@@ -54,7 +57,7 @@ struct VPhoneLaunchpadNewMachineAdvancedView: View {.frame(width: 520).fixedSize(horizontal: false, vertical: true).sheet(isPresented: $showsPatchSettings) {- VPhoneLaunchpadPatchSettingsView(initial: patches) { selection in+ VPhoneLaunchpadPatchSettingsView(initial: patches, bundleVersion: bundleVersion) { selection inpatches = selectionreloadPatches()}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swiftindex 663bd59d..3d5d0f0e 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift@@ -1,14 +1,16 @@import AppKitimport SwiftUI-/// Name, location, firmware pairing from `fw catalog`, hardware and options.-/// Create hands off to the pipeline sheet.+/// Name, location, Core Bundle, firmware pairing from `fw catalog`, hardware+/// and options. Create hands off to the pipeline sheet.struct VPhoneLaunchpadNewMachineView: View {let onCreate: (VPhoneLaunchpadMachinePath) -> Void@Environment(VPhoneLaunchpadModel.self) private var model@Environment(\.dismiss) private var dismiss@State private var name = ""+ /// The Core Bundle picked here; nil follows the default version.+ @State private var chosenVersion: String?/// The canonical library the machine is created in.@State private var location = VPhoneLaunchpadMachineLocations.defaultRoot/// A folder chosen with Other… that is not one of the library's locations.@@ -29,6 +31,16 @@ struct VPhoneLaunchpadNewMachineView: View {@State private var showsAdvanced = false@State private var keepArtifacts = false+ /// The version every step of the creation runs with, and the one the+ /// firmware and patch catalogs are read from.+ private var bundleVersion: String? {+ let selectable = model.bundles.selectableVersions+ if let chosenVersion, selectable.contains(chosenVersion) {+ return chosenVersion+ }+ return model.bundles.defaultVersion ?? selectable.first+ }+private var selectedPairing: VPhoneLaunchpadFirmwareCatalog.Pairing? {catalog?.pairings.first { $0.id == pairing }}@@ -84,7 +96,7 @@ struct VPhoneLaunchpadNewMachineView: View {}private var canCreate: Bool {- nameProblem == nil && locationProblem == nil && sources != nil+ nameProblem == nil && locationProblem == nil && sources != nil && bundleVersion != nil}var body: some View {@@ -99,6 +111,8 @@ struct VPhoneLaunchpadNewMachineView: View {}}+ bundleSection+firmwareSection {@@ -131,11 +145,13 @@ struct VPhoneLaunchpadNewMachineView: View {patchCatalog: patchCatalog,patchCatalogError: patchCatalogError,reloadPatches: { Task { await loadPatchCatalog() } },+ bundleVersion: bundleVersion,).environment(model)}- .task { await loadCatalog() }- .task { await loadPatchCatalog() }+ // Each bundle version has its own firmware pairings and patch sets.+ .task(id: bundleVersion) { await loadCatalog() }+ .task(id: bundleVersion) { await loadPatchCatalog() }.onAppear {let root = model.machines.preferredRootlocation = root@@ -179,6 +195,50 @@ struct VPhoneLaunchpadNewMachineView: View {return "\(network) · \(preset)"}+ // MARK: - Core Bundle++ private var bundleSection: some View {+ Section {+ if model.bundles.selectableVersions.isEmpty {+ Label("No Core Bundle is installed. Install one in Core Bundle.", systemImage: "exclamationmark.triangle")+ .foregroundStyle(.secondary)+ } else {+ Picker("Core Bundle", selection: versionBinding) {+ ForEach(model.bundles.selectableVersions, id: \.self) { version in+ // Store names keep their `-local.` and `-ci.` suffixes,+ // so a build that is not a release reads as one.+ if version == model.bundles.defaultVersion {+ Text("\(version) (Default)").tag(Optional(version))+ } else {+ Text(verbatim: version).tag(Optional(version))+ }+ }+ }+ }+ } footer: {+ Text("The boot chain and patches are fixed when the machine is created; host programs and the guest environment can be changed later.")+ .foregroundStyle(.secondary)+ }+ }++ /// A new version clears what was read from the old one, so Create cannot+ /// use a pairing or a preset that version never offered.+ private var versionBinding: Binding<String?> {+ Binding(+ get: { bundleVersion },+ set: { version in+ guard version != bundleVersion else {+ return+ }+ chosenVersion = version+ catalog = nil+ catalogError = nil+ patchCatalog = nil+ patchCatalogError = nil+ },+ )+ }+// MARK: - Location/// The library's locations that are mounted, the default one first, and@@ -338,51 +398,78 @@ struct VPhoneLaunchpadNewMachineView: View {return}#endif- guard catalog == nil, let commandLine = model.bundles.commandLine() else {+ let version = bundleVersion+ guard let commandLine = version.flatMap(model.bundles.commandLine(version:)) else {return}do {let result = try await commandLine.run(["fw", "catalog", "--json"], recordInHistory: false)+ // Another version may have been chosen meanwhile.+ guard version == bundleVersion else {+ return+ }guard result.succeeded, let data = result.jsonData else {catalogError = result.tailreturn}let catalog = try JSONDecoder().decode(VPhoneLaunchpadFirmwareCatalog.self, from: data)self.catalog = catalog- pairing = catalog.pairings.last?.id+ // The pairing chosen under the previous version stays when this+ // one offers it too.+ if !catalog.pairings.contains(where: { $0.id == pairing }) {+ pairing = catalog.pairings.last?.id+ }} catch {+ guard version == bundleVersion else {+ return+ }catalogError = error.localizedDescription}}- /// Read again whenever the preset changes: `inPreset`, which the note and the- /// editor read the checkmarks against, is reported per preset.+ /// Read again whenever the preset or the version changes: `inPreset`, which+ /// the note and the editor read the checkmarks against, is reported per+ /// preset, and each version declares its own patches.private func loadPatchCatalog() async {+ let version = bundleVersionlet requested = patches.presetdo {let catalog = try await VPhoneLaunchpadPatchCatalog.read(- using: model.bundles.commandLine(),+ using: version.flatMap(model.bundles.commandLine(version:)),machine: nil,preset: requested,)// A second switch may have overtaken this read.- guard requested == patches.preset else {+ guard requested == patches.preset, version == bundleVersion else {return}+ // Overrides naming a patch this version does not declare are dropped.+ patches.normalize(against: catalog)patchCatalog = catalogpatchCatalogError = nil} catch {+ guard requested == patches.preset, version == bundleVersion else {+ return+ }+ // The first read after a version change: that version may not+ // have the chosen preset, so fall back to the default one.+ if patchCatalog == nil, requested != VPhoneLaunchpadPatchSelection.defaultPreset {+ patches = VPhoneLaunchpadPatchSelection()+ await loadPatchCatalog()+ return+ }patchCatalogError = VPhoneLaunchpadError.message(for: error)}}private func create() {- guard let (iphone, cloudOS) = sources else {+ guard let (iphone, cloudOS) = sources, let bundleVersion else {return}let options = VPhoneLaunchpadCreationPipeline.Options(name: effectiveName,libraryRoot: location,+ bundleVersion: bundleVersion,iphoneSource: iphone,cloudOSSource: cloudOS,cpuCount: cpu,diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swiftindex 4a6dfd1d..4f1655dc 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swift@@ -5,8 +5,8 @@ import Foundation/// Mirrors the payload `vphone-cli fw patches --json` prints.////// The app declares no patch of its own. Everything the editor lists comes from-/// the active bundle, so a patch set this build of Launchpad has never heard of-/// still appears, with its own patches and version gates.+/// the Core Bundle it is read from, so a patch set this build of Launchpad has+/// never heard of still appears, with its own patches and version gates.nonisolated struct VPhoneLaunchpadPatchCatalog: Decodable, Sendable {struct Preset: Decodable, Hashable, Identifiable, Sendable {let identifier: String@@ -131,7 +131,7 @@ nonisolated struct VPhoneLaunchpadPatchCatalog: Decodable, Sendable {// MARK: - Readingextension VPhoneLaunchpadPatchCatalog {- /// Reads the catalogue from the active bundle's `vphone-cli`.+ /// Reads the catalogue with one Core Bundle version's `vphone-cli`.////// `preset` reports against that preset instead of the machine's own record,/// which is how the picker re-bases what `inPreset` means. Passing neither adiff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swiftindex 3b97abef..6eb17f96 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift@@ -16,6 +16,9 @@ struct VPhoneLaunchpadPatchSettingsView: View {/// What the boxes start from.let initial: VPhoneLaunchpadPatchSelection+ /// The Core Bundle New Machine creates with; its `vphone-cli` lists the+ /// patches. Nil reads the default version's.+ let bundleVersion: String?/// Hands the edited choice back; New Machine holds it until the VM exists.let onSave: (VPhoneLaunchpadPatchSelection) -> Void@@ -36,9 +39,11 @@ struct VPhoneLaunchpadPatchSettingsView: View {init(initial: VPhoneLaunchpadPatchSelection,+ bundleVersion: String? = nil,onSave: @escaping (VPhoneLaunchpadPatchSelection) -> Void,) {self.initial = initial+ self.bundleVersion = bundleVersionself.onSave = onSave_selection = State(initialValue: initial)}@@ -294,7 +299,7 @@ struct VPhoneLaunchpadPatchSettingsView: View {defer { isLoading = false }do {let catalog = try await Catalog.read(- using: model.bundles.commandLine(),+ using: bundleVersion.map(model.bundles.commandLine(version:)) ?? model.bundles.commandLine(),machine: nil,preset: preset,)diff --git a/VPhoneLaunchpad/VPhoneLaunchpadCLI/main.swift b/VPhoneLaunchpad/VPhoneLaunchpadCLI/main.swiftindex e5de1da8..97de424f 100644--- a/VPhoneLaunchpad/VPhoneLaunchpadCLI/main.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpadCLI/main.swift@@ -3,7 +3,7 @@ import Foundation// vphone-launchpad-cli: drives a running vphone-launchpad over its control// socket. It holds no state and no privileges of its own: the app installs-// bundles through its helper, runs the active bundle's vphone-cli, and shows+// bundles through its helper, runs each machine's own bundle, and shows// every command in its window. Output lines go to stderr as they arrive; the// result, a JSON document, goes to stdout. The exit status is 0 on success.@@ -16,6 +16,10 @@ func usage() -> String {Drives a running vphone-launchpad, starting it if needed. Progress goes tostderr; the result is JSON on stdout.+ Each machine runs with the Core Bundle it is bound to. The default bundle+ is only what vm create binds by default and what exec and library-wide+ commands run with.+"""for command in VPhoneLaunchpadControlCommand.all {text += "\n \(command.usage)\n \(command.summary)\n"@@ -50,8 +54,20 @@ func parse(_ words: [String]) -> VPhoneLaunchpadControlRequest {fail("unknown command \(words.prefix(2).joined(separator: " ")). Run vphone-launchpad-cli help.")}var request = VPhoneLaunchpadControlRequest(command: command.name)- // exec hands everything after it to vphone-cli untouched.+ // exec hands everything after it to vphone-cli untouched, except a+ // leading --bundle that picks whose vphone-cli runs.if command.name == "exec" {+ if let first = rest.first, first == "--bundle" || first.hasPrefix("--bundle=") {+ rest.removeFirst()+ if first == "--bundle" {+ guard !rest.isEmpty else {+ fail("--bundle needs a value.")+ }+ request.options["bundle"] = rest.removeFirst()+ } else {+ request.options["bundle"] = String(first.dropFirst("--bundle=".count))+ }+ }request.arguments = restreturn request}diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swiftindex ca3efa35..c98c2c4d 100644--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift@@ -85,18 +85,27 @@ nonisolated enum VPhoneLaunchpadNames {}/// The bundle's own version inside a store name. Builds that are not- /// releases carry a suffix: `-local` for one made on this Mac, and- /// `-ci.<commit>` for a GitHub Actions artifact.+ /// releases carry a suffix: `-local.<build>` for one made on this Mac+ /// (`-local` alone before builds were told apart), and `-ci.<commit>`+ /// for a GitHub Actions artifact.static func bundleVersion(of value: String) -> String {- if value.hasSuffix("-local") {- return String(value.dropLast("-local".count))- }- if let suffix = value.range(of: "-ci\\.[0-9a-f]{7,40}$", options: .regularExpression) {- return String(value[..<suffix.lowerBound])+ for pattern in [localSuffixPattern, "-ci\\.[0-9a-f]{7,40}$"] {+ if let suffix = value.range(of: pattern, options: .regularExpression) {+ return String(value[..<suffix.lowerBound])+ }}return value}+ /// `-local` followed by an optional build identifier. Each local build is+ /// stored under its own name, so two builds of one version can be+ /// installed side by side and machines can stay on either.+ private static let localSuffixPattern = "-local(\\.[0-9a-f]{8,64})?$"++ static func isLocalBuild(_ value: String) -> Bool {+ value.range(of: localSuffixPattern, options: .regularExpression) != nil+ }+static func isCompatibleBundleVersion(_ value: String) -> Bool {guard isValidVersion(value) else { return false }let parts = bundleVersion(of: value).split(separator: ".", omittingEmptySubsequences: false)diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swiftindex 7404a855..7298dd39 100644--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift@@ -124,11 +124,11 @@ nonisolated struct VPhoneLaunchpadControlCommand: Sendable {let summary: Stringvar usage: String {- var parts = [name.replacingOccurrences(of: ".", with: " ")]- parts += arguments.map { "<\($0)>" }- parts += options.map { "[--\($0) <value>]" }- parts += flags.map { "[--\($0)]" }- return parts.joined(separator: " ")+ let positional = arguments.map { "<\($0)>" }+ let named = options.map { "[--\($0) <value>]" } + flags.map { "[--\($0)]" }+ // exec reads its options only before the arguments it passes on.+ let parts = name == "exec" ? named + positional : positional + named+ return ([name.replacingOccurrences(of: ".", with: " ")] + parts).joined(separator: " ")}var takesRest: Bool {@@ -137,25 +137,27 @@ nonisolated struct VPhoneLaunchpadControlCommand: Sendable {static let all: [Self] = [Self(name: "status", arguments: [], options: [], flags: [],- summary: "Host checks, helper, active bundle and machine counts."),+ summary: "Host checks, helper, default bundle and machine counts."),Self(name: "bundle.list", arguments: [], options: [], flags: [],- summary: "Installed VPhone.bundle versions and their checks."),- Self(name: "bundle.install-local", arguments: ["path"], options: [], flags: [],- summary: "Install a VPhone.bundle folder or .zip built on this Mac as <version>-local, make it active and check it."),- Self(name: "bundle.install-release", arguments: ["version"], options: [], flags: [],- summary: "Download and install a GitHub release (a version, or \"latest\")."),+ summary: "Installed VPhone.bundle versions, their checks, and the machines bound to each."),+ Self(name: "bundle.install-local", arguments: ["path"], options: [], flags: ["keep-default"],+ summary: "Install a VPhone.bundle folder or .zip built on this Mac as <version>-local.<hash> and check it. It becomes the default unless --keep-default; machines keep their own bundle."),+ Self(name: "bundle.install-release", arguments: ["version"], options: [], flags: ["keep-default"],+ summary: "Download and install a GitHub release (a version, or \"latest\"). It becomes the default unless --keep-default."),+ Self(name: "bundle.set-default", arguments: ["version"], options: [], flags: [],+ summary: "Make an installed version the default for new machines and library-wide commands, and check it. Machines keep their own bundle."),Self(name: "bundle.use", arguments: ["version"], options: [], flags: [],- summary: "Make an installed version active and check it."),+ summary: "The old name of bundle set-default."),Self(name: "bundle.verify", arguments: ["version"], options: [], flags: [],summary: "Add the execution policy exception, allow vphone-vm if AMFI refuses it, and run host preflight."),Self(name: "bundle.accept", arguments: ["version"], options: [], flags: ["off"],summary: "Use a version even though its checks failed (--off takes that back)."),Self(name: "bundle.remove", arguments: ["version"], options: [], flags: [],- summary: "Remove an installed version."),+ summary: "Remove an installed version no machine is bound to."),Self(name: "vm.list", arguments: [], options: [], flags: [],- summary: "Machines in every library, with their run state."),+ summary: "Machines in every library, with their run state and Core Bundle."),Self(name: "vm.start", arguments: ["name"], options: ["root", "timeout"], flags: ["headless", "wait"],summary: "Launch a machine. --wait blocks until vphoned answers on vphone.sock."),Self(name: "vm.stop", arguments: ["name"], options: ["root"], flags: [],@@ -165,22 +167,24 @@ nonisolated struct VPhoneLaunchpadControlCommand: Sendable {Self(name: "vm.log", arguments: ["name"], options: ["root", "lines", "kind"], flags: [],summary: "The last lines of the console log (--kind create, dfu or patch for those logs)."),Self(name: "vm.create", arguments: ["name"], options: [- "root", "iphone-source", "cloudos-source", "cpu", "memory", "disk-size", "network", "preset", "from",+ "root", "bundle", "iphone-source", "cloudos-source", "cpu", "memory", "disk-size", "network", "preset", "from",], flags: ["keep-artifacts", "no-wait"],- summary: "Create a machine through every step, as New Machine does. --from <step> retries a failed creation from that step."),+ summary: "Create a machine through every step, as New Machine does, bound to --bundle (default: the default bundle). --from <step> retries a failed creation from that step."),+ Self(name: "vm.set-bundle", arguments: ["name", "version"], options: ["root"], flags: ["update-environment"],+ summary: "Bind a machine to another installed version; its host programs change at the next start. --update-environment also redeploys that version's guest environment into the stopped machine. The boot chain stays as created."),Self(name: "cfw.install", arguments: ["name"], options: ["root"], flags: ["keep-artifacts"],- summary: "Install CFW into a stopped machine through the root helper."),+ summary: "Install CFW into a stopped machine with its own bundle, through the root helper."),Self(name: "cfw.update-environment", arguments: ["name"], options: ["root"], flags: [],- summary: "Redeploy the active bundle's guest resources (vphoned and hook dylibs) into a stopped machine, and nothing else."),+ summary: "Redeploy the machine's own bundle's guest resources (vphoned and hook dylibs) into it while stopped, and nothing else."),Self(name: "guest.send", arguments: ["name", "json"], options: ["root"], flags: [],summary: "Send one raw vphone.sock request, such as {\"t\":\"tap\",\"x\":645,\"y\":1398}."),Self(name: "guest.rpc", arguments: ["name", "method", "params..."], options: ["root"], flags: ["screen"],summary: "Call a vphoned method; params is one JSON object."),- Self(name: "exec", arguments: ["arguments..."], options: [], flags: [],- summary: "Run the active bundle's vphone-cli with these arguments and stream its output."),+ Self(name: "exec", arguments: ["arguments..."], options: ["bundle"], flags: [],+ summary: "Run vphone-cli with these arguments and stream its output: the default bundle's, or that of --bundle <version> given before the arguments."),]static func named(_ name: String) -> Self? {