Skip to content

A native macOS app for managing virtual iPhones - browse, create, and boot iOS research VMs from a single window.

Swift

docs: Add design spec, README, screenshots, and MIT license

zqxwceed9f9ca18504
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..476088b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 zqxwce
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..43c8a8f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,53 @@
+<div align="center">
+
+<img src="docs/logo.png" width="132" alt="vPhone Workstation icon">
+
+# vPhone Workstation
+
+**A native macOS app for managing virtual iPhones - browse, create, and boot iOS research VMs from a single window.**
+
+![vPhone Workstation - VM library and detail overview](docs/screenshots/overview.png)
+
+</div>
+
+---
+
+vPhone Workstation is a SwiftUI front-end for **[vphone-cli](https://github.com/Lakr233/vphone-cli)** - the command-line tool that boots virtual iPhones on Apple's Virtualization.framework using PCC research VMs.
+
+## Screenshots
+
+**Create wizard** - pick how much of iOS's security to peel back, then a recommended firmware pairing.
+
+![Create wizard - variant and firmware selection](docs/screenshots/create-wizard.png)
+
+## Features
+
+- **Library** - every VM with live running/stopped state, iOS + cloudOS build, and search.
+- **Detail overview** - iOS/cloudOS build, variant, CPU, memory, disk, network, device, and UDID at a glance.
+- **Lifecycle** - start, stop, and bring the running iPhone window to the front.
+- **Manage** - clone, rename, export (`.tar.xz`), and delete, plus per-VM settings.
+- **Create wizard** - name → variant (Less · Regular · Developer · Jailbreak · Experimental) → firmware pairing → resources (CPU, memory, disk), with **live step-by-step progress** streamed from `vphone-cli` and an exportable log for issue reports.
+- **Host readiness** - checks that `vphone-cli` is found, macOS is new enough, the host isn't itself a VM, research guests are allowed (`csrutil allow-research-guests`), and AMFI is bypassed (the `amfi_get_out_of_my_way` boot-arg **or** the `amfidont` daemon) - each with a clear, actionable message when it isn't.
+
+## Requirements
+
+- Apple Silicon Mac.
+- macOS 15 (Sequoia) or newer
+- **`vphone-cli`** (https://github.com/Lakr233/vphone-cli)
+
+ ```sh
+ brew install zqxwce/tap/vphone-cli
+ ```
+
+## Install
+
+```sh
+brew install zqxwce/tap/vphone-ws
+```
+
+## Build
+
+```sh
+./scripts/bundle.sh # swift build -c release + bundle .build/vphone-ws.app
+open .build/vphone-ws.app
+```
diff --git a/docs/design/vphone-ws-mockup.html b/docs/design/vphone-ws-mockup.html
new file mode 100644
index 0000000..a0231d5
--- /dev/null
+++ b/docs/design/vphone-ws-mockup.html
@@ -0,0 +1,535 @@
+<style>
+ :root{
+ color-scheme: light dark;
+ /* cool neutrals biased toward the blue accent */
+ --bg:#eef0f4; --surface:#ffffff; --surface-2:#f6f7f9; --inset:#eceff3;
+ --border:#dfe3ea; --border-strong:#c9cfd9;
+ --text:#1a1d23; --dim:#5b6472; --faint:#8a94a3;
+ --accent:#2f6fe0; --accent-ink:#ffffff; --accent-soft:rgba(47,111,224,.12);
+ --good:#1f9d40; --good-soft:rgba(31,157,64,.13);
+ --warn:#b57d00; --warn-soft:rgba(181,125,0,.14);
+ --crit:#cf2231; --crit-soft:rgba(207,34,49,.12);
+ --shadow:0 12px 34px -14px rgba(20,26,40,.30), 0 2px 6px -2px rgba(20,26,40,.14);
+ --radius:12px; --radius-sm:8px;
+ --mono:ui-monospace,"SF Mono",Menlo,monospace;
+ --sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue",sans-serif;
+ }
+ @media (prefers-color-scheme: dark){
+ :root{
+ --bg:#101216; --surface:#1b1e24; --surface-2:#21252c; --inset:#15181d;
+ --border:#2b303a; --border-strong:#3a404c;
+ --text:#e7eaef; --dim:#9aa4b2; --faint:#69727f;
+ --accent:#5b9bff; --accent-ink:#0b1220; --accent-soft:rgba(91,155,255,.16);
+ --good:#3fb950; --good-soft:rgba(63,185,80,.16);
+ --warn:#d29922; --warn-soft:rgba(210,153,34,.16);
+ --crit:#f85149; --crit-soft:rgba(248,81,73,.15);
+ --shadow:0 18px 44px -18px rgba(0,0,0,.66), 0 3px 10px -4px rgba(0,0,0,.5);
+ }
+ }
+ :root[data-theme="light"]{
+ --bg:#eef0f4; --surface:#ffffff; --surface-2:#f6f7f9; --inset:#eceff3;
+ --border:#dfe3ea; --border-strong:#c9cfd9;
+ --text:#1a1d23; --dim:#5b6472; --faint:#8a94a3;
+ --accent:#2f6fe0; --accent-ink:#ffffff; --accent-soft:rgba(47,111,224,.12);
+ --good:#1f9d40; --good-soft:rgba(31,157,64,.13);
+ --warn:#b57d00; --warn-soft:rgba(181,125,0,.14);
+ --crit:#cf2231; --crit-soft:rgba(207,34,49,.12);
+ --shadow:0 12px 34px -14px rgba(20,26,40,.30), 0 2px 6px -2px rgba(20,26,40,.14);
+ }
+ :root[data-theme="dark"]{
+ --bg:#101216; --surface:#1b1e24; --surface-2:#21252c; --inset:#15181d;
+ --border:#2b303a; --border-strong:#3a404c;
+ --text:#e7eaef; --dim:#9aa4b2; --faint:#69727f;
+ --accent:#5b9bff; --accent-ink:#0b1220; --accent-soft:rgba(91,155,255,.16);
+ --good:#3fb950; --good-soft:rgba(63,185,80,.16);
+ --warn:#d29922; --warn-soft:rgba(210,153,34,.16);
+ --crit:#f85149; --crit-soft:rgba(248,81,73,.15);
+ --shadow:0 18px 44px -18px rgba(0,0,0,.66), 0 3px 10px -4px rgba(0,0,0,.5);
+ }
+
+ *{box-sizing:border-box}
+ body{margin:0}
+ .page{
+ background:var(--bg); color:var(--text); font-family:var(--sans);
+ -webkit-font-smoothing:antialiased; line-height:1.5;
+ padding:48px 24px 80px; min-height:100vh;
+ }
+ .wrap{max-width:1120px; margin:0 auto}
+
+ /* ---- page masthead ---- */
+ .masthead{margin-bottom:40px}
+ .kicker{font-family:var(--mono); font-size:12px; letter-spacing:.14em; text-transform:uppercase;
+ color:var(--accent); margin:0 0 12px}
+ h1{font-size:clamp(28px,4vw,42px); line-height:1.05; margin:0 0 12px; letter-spacing:-.02em; text-wrap:balance; font-weight:700}
+ .lede{font-size:18px; color:var(--dim); max-width:60ch; margin:0}
+ .meta-row{display:flex; flex-wrap:wrap; gap:8px; margin-top:20px}
+ .tag{font-family:var(--mono); font-size:12px; padding:5px 10px; border:1px solid var(--border-strong);
+ border-radius:999px; color:var(--dim); background:var(--surface)}
+ .tag b{color:var(--text); font-weight:600}
+
+ /* ---- section scaffolding ---- */
+ .section{margin-top:52px}
+ .sec-head{display:flex; align-items:baseline; gap:14px; margin-bottom:6px}
+ .sec-num{font-family:var(--mono); font-size:13px; color:var(--faint)}
+ h2{font-size:22px; margin:0; letter-spacing:-.01em; font-weight:650}
+ .sec-note{color:var(--dim); margin:6px 0 22px; max-width:70ch}
+
+ /* ---- mac window chrome ---- */
+ .win{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
+ box-shadow:var(--shadow); overflow:hidden}
+ .titlebar{display:flex; align-items:center; gap:12px; height:40px; padding:0 14px;
+ background:var(--surface-2); border-bottom:1px solid var(--border)}
+ .lights{display:flex; gap:8px}
+ .lights i{width:12px; height:12px; border-radius:50%; display:block}
+ .lights i:nth-child(1){background:#ff5f57} .lights i:nth-child(2){background:#febc2e} .lights i:nth-child(3){background:#28c840}
+ .wtitle{font-size:13px; font-weight:600; color:var(--dim)}
+ .tbtools{margin-left:auto; display:flex; align-items:center; gap:8px}
+
+ /* toolbar buttons */
+ .btn{font-family:var(--sans); font-size:13px; border:1px solid var(--border-strong); background:var(--surface);
+ color:var(--text); padding:6px 12px; border-radius:var(--radius-sm); display:inline-flex; align-items:center;
+ gap:7px; cursor:default; white-space:nowrap}
+ .btn.sm{padding:5px 10px; font-size:12px}
+ .btn.primary{background:var(--accent); color:var(--accent-ink); border-color:transparent; font-weight:600}
+ .btn.danger{color:var(--crit); border-color:color-mix(in srgb,var(--crit) 40%,var(--border-strong))}
+ .btn svg{width:14px; height:14px}
+
+ .pill{display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:600;
+ padding:4px 10px; border-radius:999px; border:1px solid transparent}
+ .pill .dot{width:7px; height:7px; border-radius:50%}
+ .pill.run{background:var(--good-soft); color:var(--good); border-color:color-mix(in srgb,var(--good) 30%,transparent)}
+ .pill.run .dot{background:var(--good)}
+ .pill.stop{background:var(--inset); color:var(--faint); border:1px solid var(--border)}
+ .pill.stop .dot{background:var(--faint)}
+ .pill.warn{background:var(--warn-soft); color:var(--warn); border-color:color-mix(in srgb,var(--warn) 30%,transparent)}
+ .pill.warn .dot{background:var(--warn)}
+
+ @media (prefers-reduced-motion: no-preference){
+ .pill.run .dot, .status-dot.run{animation:pulse 2.4s ease-in-out infinite}
+ @keyframes pulse{0%,100%{box-shadow:0 0 0 0 var(--good-soft)}50%{box-shadow:0 0 0 4px transparent}}
+ }
+
+ /* ---- main manager layout ---- */
+ .mgr{display:grid; grid-template-columns:264px 1fr; min-height:560px}
+ .sidebar{background:var(--surface-2); border-right:1px solid var(--border); display:flex; flex-direction:column}
+ .search{margin:12px; display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border);
+ border-radius:var(--radius-sm); padding:7px 10px; color:var(--faint); font-size:13px}
+ .search svg{width:14px;height:14px}
+ .vmlist{list-style:none; margin:0; padding:0 8px; overflow:auto; flex:1}
+ .vmrow{display:flex; gap:11px; align-items:center; padding:10px 10px; border-radius:var(--radius-sm); cursor:default}
+ .vmrow + .vmrow{margin-top:2px}
+ .vmrow.active{background:var(--accent-soft)}
+ .vmrow .phone{flex:none; color:var(--dim)}
+ .vmrow.active .phone{color:var(--accent)}
+ .vmrow .vmname{font-size:13.5px; font-weight:600; display:flex; align-items:center; gap:7px}
+ .vmrow .vmsub{font-size:11.5px; color:var(--faint); font-family:var(--mono); margin-top:2px}
+ .status-dot{width:8px; height:8px; border-radius:50%; flex:none}
+ .status-dot.run{background:var(--good)} .status-dot.stop{background:var(--faint); opacity:.6}
+ .side-foot{border-top:1px solid var(--border); padding:10px 12px}
+ .newvm{display:flex; align-items:center; gap:8px; font-size:13px; color:var(--accent); font-weight:600}
+
+ /* detail pane */
+ .detail{padding:22px 24px; overflow:auto}
+ .d-head{display:flex; align-items:flex-start; gap:16px; flex-wrap:wrap}
+ .d-title{font-size:24px; font-weight:700; letter-spacing:-.01em; display:flex; align-items:center; gap:12px}
+ .d-path{font-family:var(--mono); font-size:12px; color:var(--faint); margin-top:6px}
+ .d-actions{margin-left:auto; display:flex; gap:8px; flex-wrap:wrap}
+ .callout{display:flex; gap:11px; align-items:flex-start; margin:22px 0 4px; padding:12px 14px; border-radius:var(--radius-sm);
+ background:var(--accent-soft); border:1px solid color-mix(in srgb,var(--accent) 26%,transparent); font-size:13px; color:var(--text)}
+ .callout svg{width:16px;height:16px;flex:none;color:var(--accent);margin-top:1px}
+ .callout b{font-weight:650}
+ .grid-label{font-family:var(--mono); font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--faint); margin:26px 0 12px}
+ .specs{display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:1px; background:var(--border); border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden}
+ .spec{background:var(--surface); padding:12px 14px}
+ .spec .k{font-size:11px; color:var(--faint); text-transform:uppercase; letter-spacing:.06em}
+ .spec .v{font-size:14px; font-weight:600; margin-top:5px; font-variant-numeric:tabular-nums}
+ .spec .v.mono{font-family:var(--mono); font-weight:500; font-size:12.5px; word-break:break-all}
+ .vbadge{display:inline-block; font-family:var(--mono); font-size:11px; padding:2px 7px; border-radius:5px; background:var(--warn-soft); color:var(--warn); font-weight:600}
+ .vbadge.exp{background:var(--crit-soft); color:var(--crit)}
+ .vbadge.reg{background:var(--accent-soft); color:var(--accent)}
+
+ /* ---- annotated captions ---- */
+ .cap{display:grid; grid-template-columns:1fr; gap:8px; margin-top:16px}
+ .anno{display:flex; gap:10px; font-size:13.5px; color:var(--dim); align-items:flex-start}
+ .anno .b{font:600 11px/1 var(--mono); letter-spacing:.04em; color:var(--accent); background:var(--accent-soft);
+ padding:4px 7px; border-radius:6px; flex:none; margin-top:1px}
+ .anno strong{color:var(--text); font-weight:600}
+
+ /* ---- wizard ---- */
+ .wizard{display:grid; grid-template-columns:210px 1fr; min-height:440px}
+ .steps{background:var(--surface-2); border-right:1px solid var(--border); padding:20px 16px; list-style:none; margin:0}
+ .steps li{display:flex; gap:11px; align-items:center; padding:9px 8px; border-radius:var(--radius-sm); font-size:13.5px; color:var(--faint)}
+ .steps li .n{width:22px; height:22px; border-radius:50%; border:1.5px solid var(--border-strong); display:grid; place-items:center; font:600 11px var(--mono); flex:none}
+ .steps li.done{color:var(--text)} .steps li.done .n{background:var(--good); border-color:var(--good); color:#fff}
+ .steps li.now{color:var(--text); font-weight:600} .steps li.now .n{border-color:var(--accent); color:var(--accent)}
+ .wbody{padding:24px 26px}
+ .wbody h3{margin:0 0 4px; font-size:18px; font-weight:650}
+ .wbody .sub{color:var(--dim); font-size:13.5px; margin:0 0 20px}
+ .variant-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px}
+ .vcard{border:1px solid var(--border); border-radius:var(--radius-sm); padding:13px 14px; background:var(--surface)}
+ .vcard.sel{border-color:var(--accent); background:var(--accent-soft)}
+ .vcard .vh{display:flex; align-items:center; justify-content:space-between; font-weight:650; font-size:14px}
+ .vcard .vd{font-size:12px; color:var(--dim); margin-top:6px}
+ .sec-meter{display:flex; gap:3px; margin-top:10px}
+ .sec-meter i{height:4px; flex:1; border-radius:2px; background:var(--border-strong)}
+ .sec-meter i.on{background:var(--accent)}
+ .wfoot{display:flex; justify-content:space-between; align-items:center; padding:14px 26px; border-top:1px solid var(--border); background:var(--surface-2)}
+ .field{margin-top:16px}
+ .field label{display:block; font-size:12px; color:var(--dim); margin-bottom:6px; font-weight:600}
+ .input{width:100%; background:var(--inset); border:1px solid var(--border); border-radius:var(--radius-sm); padding:9px 11px;
+ font-family:var(--mono); font-size:13px; color:var(--text)}
+ .stepper{display:inline-flex; align-items:center; gap:0; border:1px solid var(--border-strong); border-radius:var(--radius-sm); overflow:hidden}
+ .stepper span{padding:8px 12px; font-family:var(--mono); font-size:13px}
+ .stepper b{padding:8px 16px; font-family:var(--mono); font-size:13px; font-weight:600; border-left:1px solid var(--border); border-right:1px solid var(--border); min-width:70px; text-align:center}
+ .segmented{display:inline-flex; border:1px solid var(--border-strong); border-radius:var(--radius-sm); overflow:hidden}
+ .segmented .seg{padding:7px 15px; font-size:13px; color:var(--dim); border-right:1px solid var(--border-strong)}
+ .segmented .seg:last-child{border-right:0}
+ .segmented .seg.on{background:var(--accent); color:var(--accent-ink); font-weight:600}
+
+ /* ---- task console ---- */
+ .console-wrap{display:grid; grid-template-columns:1fr; gap:0}
+ .task{border-bottom:1px solid var(--border); padding:16px 20px}
+ .task:last-child{border-bottom:0}
+ .task-head{display:flex; align-items:center; gap:12px}
+ .task-title{font-weight:650; font-size:14px}
+ .stages{display:flex; gap:6px; margin:14px 0; flex-wrap:wrap}
+ .stage{font-family:var(--mono); font-size:11px; padding:4px 9px; border-radius:6px; border:1px solid var(--border); color:var(--faint); display:flex; gap:6px; align-items:center}
+ .stage.done{color:var(--good); border-color:color-mix(in srgb,var(--good) 30%,transparent); background:var(--good-soft)}
+ .stage.now{color:var(--accent); border-color:var(--accent); background:var(--accent-soft); font-weight:600}
+ .log{background:#0e1013; border:1px solid #232833; border-radius:var(--radius-sm); padding:12px 14px; font-family:var(--mono);
+ font-size:12px; line-height:1.65; color:#c7d0dc; overflow-x:auto}
+ .log .ok{color:#3fb950} .log .info{color:#5b9bff} .log .warn2{color:#d29922} .log .dimlog{color:#6b7484}
+ .log .path{color:#9aa4b2}
+ .elapsed{margin-left:auto; font-family:var(--mono); font-size:12px; color:var(--faint)}
+
+ /* ---- readiness ---- */
+ .checks{list-style:none; margin:0; padding:0}
+ .check{display:flex; gap:14px; align-items:flex-start; padding:16px 20px; border-bottom:1px solid var(--border)}
+ .check:last-child{border-bottom:0}
+ .ci{width:26px; height:26px; border-radius:50%; display:grid; place-items:center; flex:none; margin-top:1px}
+ .ci.ok{background:var(--good-soft); color:var(--good)} .ci.warn{background:var(--warn-soft); color:var(--warn)}
+ .ci svg{width:15px;height:15px}
+ .ctext{flex:1}
+ .ctext .ct{font-weight:600; font-size:14px}
+ .ctext .cd{font-size:13px; color:var(--dim); margin-top:3px}
+ .ctext code{font-family:var(--mono); font-size:12px; background:var(--inset); border:1px solid var(--border); padding:2px 6px; border-radius:5px; color:var(--text)}
+ .cfix{margin-top:9px}
+
+ /* ---- design legend ---- */
+ .legend{display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:16px}
+ .lg{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px}
+ .lg h4{margin:0 0 12px; font-size:13px; text-transform:uppercase; letter-spacing:.08em; color:var(--faint); font-family:var(--mono)}
+ .swatches{display:flex; flex-direction:column; gap:8px}
+ .sw{display:flex; align-items:center; gap:11px; font-size:13px}
+ .sw i{width:26px; height:26px; border-radius:7px; border:1px solid rgba(128,128,128,.25); flex:none}
+ .sw .lab{color:var(--dim)} .sw .lab b{color:var(--text); font-weight:600}
+ .typ-sans{font-family:var(--sans)} .typ-mono{font-family:var(--mono)}
+ .typ-row{padding:9px 0; border-bottom:1px dashed var(--border)}
+ .typ-row:last-child{border-bottom:0}
+ .typ-row .big{font-size:19px; font-weight:650} .typ-row .small{font-size:12px; color:var(--faint); margin-top:2px}
+
+ .foot{margin-top:56px; padding-top:22px; border-top:1px solid var(--border); color:var(--faint); font-size:13px; font-family:var(--mono)}
+
+ @media (max-width:820px){
+ .mgr,.wizard{grid-template-columns:1fr}
+ .sidebar,.steps{border-right:0; border-bottom:1px solid var(--border)}
+ .d-actions{margin-left:0; width:100%}
+ }
+</style>
+
+<div class="page">
+<div class="wrap">
+
+ <header class="masthead">
+ <p class="kicker">Design review · proposed UI</p>
+ <h1>vphone Workstation</h1>
+ <p class="lede">A friendly desktop manager for your virtual iPhones. It handles the library, settings, and lifecycle — and hands the live device off to <span class="typ-mono">vphone-cli</span>, which opens the iPhone screen in its own window.</p>
+ <div class="meta-row">
+ <span class="tag"><b>Standalone SwiftUI app</b> · macOS 15+</span>
+ <span class="tag">Shells out to <b>vphone-cli</b> · no entitlements needed</span>
+ <span class="tag">Grounded on <b>main @ 966bddb</b></span>
+ <span class="tag">iOS + cloudOS from <b>restore-info.json</b></span>
+ <span class="tag">v1 · full manager + create wizard</span>
+ </div>
+ </header>
+
+ <!-- ============ SCREEN 1 : MAIN MANAGER ============ -->
+ <section class="section">
+ <div class="sec-head"><span class="sec-num">01</span><h2>Main window — the library</h2></div>
+ <p class="sec-note">The home screen: a sidebar of every VM with its live status, and a detail pane for the selected one. Scan-and-operate, not read top-to-bottom — status reads at a glance from the colored dot, and the primary action is always the big button.</p>
+
+ <div class="win">
+ <div class="titlebar">
+ <span class="lights"><i></i><i></i><i></i></span>
+ <span class="wtitle">vphone Workstation</span>
+ <span class="tbtools">
+ <span class="pill run"><span class="dot"></span>Host ready</span>
+ </span>
+ </div>
+ <div class="mgr">
+ <!-- sidebar -->
+ <aside class="sidebar">
+ <div class="search">
+ <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6"><circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5 14 14"/></svg>
+ Search VMs
+ </div>
+ <ul class="vmlist">
+ <li class="vmrow active">
+ <span class="phone"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><rect x="6" y="2" width="12" height="20" rx="2.5"/><path d="M10 4.5h4"/></svg></span>
+ <div><div class="vmname"><span class="status-dot run"></span>research-jb</div><div class="vmsub">iOS 27.0 · cloudOS 26.4</div></div>
+ </li>
+ <li class="vmrow">
+ <span class="phone"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><rect x="6" y="2" width="12" height="20" rx="2.5"/><path d="M10 4.5h4"/></svg></span>
+ <div><div class="vmname"><span class="status-dot stop"></span>clean-26</div><div class="vmsub">iOS 26.3 · cloudOS 26.3</div></div>
+ </li>
+ <li class="vmrow">
+ <span class="phone"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><rect x="6" y="2" width="12" height="20" rx="2.5"/><path d="M10 4.5h4"/></svg></span>
+ <div><div class="vmname"><span class="status-dot stop"></span>touch-test</div><div class="vmsub">iOS 18.6.2 · cloudOS 26.1</div></div>
+ </li>
+ <li class="vmrow">
+ <span class="phone"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><rect x="6" y="2" width="12" height="20" rx="2.5"/><path d="M10 4.5h4"/></svg></span>
+ <div><div class="vmname"><span class="status-dot stop"></span>audio-27</div><div class="vmsub">iOS 27.0 · cloudOS 26.4</div></div>
+ </li>
+ </ul>
+ <div class="side-foot"><span class="newvm">+ New VM…</span></div>
+ </aside>
+
+ <!-- detail -->
+ <div class="detail">
+ <div class="d-head">
+ <div>
+ <div class="d-title">research-jb <span class="pill run"><span class="dot"></span>Running</span></div>
+ <div class="d-path">~/.vphone/VMs/research-jb</div>
+ </div>
+ <div class="d-actions">
+ <span class="btn danger"><svg viewBox="0 0 16 16" fill="currentColor"><rect x="4" y="4" width="8" height="8" rx="1.5"/></svg>Stop</span>
+ <span class="btn"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2.5" y="2.5" width="11" height="11" rx="2"/><path d="M6 6h4v4"/></svg>Show screen</span>
+ <span class="btn sm">Settings</span>
+ <span class="btn sm">Clone</span>
+ <span class="btn sm">⋯</span>
+ </div>
+ </div>
+
+ <div class="callout">
+ <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><path d="M8 7.2v4M8 4.8h.01"/></svg>
+ <span><b>The iPhone screen lives in its own window.</b> vphone Workstation manages this VM; the live display, touch, and menus are handled by <span class="typ-mono">vphone-cli</span>. “Show screen” brings that window forward.</span>
+ </div>
+
+ <div class="grid-label">Overview</div>
+ <div class="specs">
+ <div class="spec"><div class="k">iOS</div><div class="v">27.0 <span style="color:var(--faint);font-weight:400">(24A5380h)</span></div></div>
+ <div class="spec"><div class="k">cloudOS</div><div class="v">26.4 <span style="color:var(--faint);font-weight:400">(23E5207q)</span></div></div>
+ <div class="spec"><div class="k">Variant</div><div class="v"><span class="vbadge exp">experimental</span></div></div>
+ <div class="spec"><div class="k">CPU</div><div class="v">8 cores</div></div>
+ <div class="spec"><div class="k">Memory</div><div class="v">8192 MB</div></div>
+ <div class="spec"><div class="k">Disk</div><div class="v">64 GB <span style="color:var(--faint);font-weight:400">sparse</span></div></div>
+ <div class="spec"><div class="k">Network</div><div class="v">NAT</div></div>
+ <div class="spec"><div class="k">Device</div><div class="v mono">iPhone17,3</div></div>
+ <div class="spec"><div class="k">UDID</div><div class="v mono">0000FE01-67C0FDA7…</div></div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="cap">
+ <div class="anno"><span class="b">status</span><span><strong>Live running/stopped</strong> is computed by probing <span class="typ-mono">lsof</span> on each VM's <span class="typ-mono">Disk.img</span> (the CLI's own truth source) — it isn't in <span class="typ-mono">vm list --json</span>, so the app polls it every couple of seconds.</span></div>
+ <div class="anno"><span class="b">versions</span><span><strong>iOS &amp; cloudOS</strong> come straight from <span class="typ-mono">restore-info.json</span> (surfaced as <span class="typ-mono">restoreInfo</span> in <span class="typ-mono">vm list/info --json</span>) — recorded on every restore and carried inside <span class="typ-mono">vm export</span>, so it's correct even for imported VMs with no IPSW folder. No plist parsing in the app.</span></div>
+ <div class="anno"><span class="b">variant</span><span>The <strong>patch variant</strong> (regular/jb/exp) isn't recorded by the CLI, so vphone-ws remembers what the wizard used in a small app-owned sidecar; VMs created elsewhere show <em>Unknown</em> until upstream adds it to <span class="typ-mono">restore-info.json</span>.</span></div>
+ <div class="anno"><span class="b">actions</span><span><strong>Start</strong> spawns <span class="typ-mono">vphone-cli vm launch &lt;name&gt;</span>; <strong>Stop</strong> runs <span class="typ-mono">vm stop</span>. Clone/Rename/Delete/Export map 1:1 to CLI subcommands (always with explicit names + <span class="typ-mono">--force</span> so nothing prompts).</span></div>
+ </div>
+ </section>
+
+ <!-- ============ SCREEN 2 : SETTINGS ============ -->
+ <section class="section">
+ <div class="sec-head"><span class="sec-num">02</span><h2>VM settings</h2></div>
+ <p class="sec-note">Edit everything the VM's config safely supports — CPU, memory, and network. Parts baked into the built device (disk, display, identity) are shown for reference but can't change afterward. Edits apply on the next boot.</p>
+
+ <div class="win" style="max-width:620px">
+ <div class="titlebar"><span class="lights"><i></i><i></i><i></i></span><span class="wtitle">research-jb — Settings</span></div>
+ <div style="padding:24px 26px">
+ <div class="field">
+ <label>CPU cores</label>
+ <span class="stepper"><span>−</span><b>8</b><span>+</span></span>
+ </div>
+ <div class="field">
+ <label>Memory</label>
+ <span class="stepper"><span>−</span><b>8192 MB</b><span>+</span></span>
+ </div>
+ <div class="field">
+ <label>Network</label>
+ <div class="segmented"><span class="seg on">NAT</span><span class="seg">Bridged</span><span class="seg">Host-only</span><span class="seg">None</span></div>
+ </div>
+
+ <div class="grid-label">Fixed at build time</div>
+ <div class="specs">
+ <div class="spec"><div class="k">Disk</div><div class="v">64 GB</div></div>
+ <div class="spec"><div class="k">Display</div><div class="v mono">1290×2796 @460</div></div>
+ <div class="spec"><div class="k">Device</div><div class="v mono">iPhone17,3</div></div>
+ </div>
+ </div>
+ <div class="wfoot"><span class="btn sm">Cancel</span><span class="btn primary">Save</span></div>
+ </div>
+
+ <div class="cap">
+ <div class="anno"><span class="b">writes</span><span>Every edit goes through <span class="typ-mono">vphone-cli vm config</span> — the app never writes <span class="typ-mono">config.plist</span> itself, so the CLI stays the single source of truth. CPU/memory work today; the <strong>Network</strong> control needs a small <span class="typ-mono">vm config --network</span> option added to vphone-cli (dovetails with the in-flight bridged-networking work).</span></div>
+ <div class="anno"><span class="b">timing</span><span>Settings are editable while the VM is <strong>stopped</strong>; changes take effect at the next boot, since the VZ configuration is assembled fresh each launch.</span></div>
+ </div>
+ </section>
+
+ <!-- ============ SCREEN 3 : CREATE WIZARD ============ -->
+ <section class="section">
+ <div class="sec-head"><span class="sec-num">03</span><h2>Create-VM wizard</h2></div>
+ <p class="sec-note">A short, guided sheet that turns the long <span class="typ-mono">vm create</span> pipeline into four calm steps. Variants are explained in plain language with a security-level meter, so “which one do I pick” is obvious without reading docs.</p>
+
+ <div class="win" style="max-width:760px">
+ <div class="titlebar"><span class="lights"><i></i><i></i><i></i></span><span class="wtitle">New VM</span></div>
+ <div class="wizard">
+ <ol class="steps">
+ <li class="done"><span class="n">✓</span> Name</li>
+ <li class="now"><span class="n">2</span> iOS &amp; variant</li>
+ <li><span class="n">3</span> Resources</li>
+ <li><span class="n">4</span> Review &amp; create</li>
+ </ol>
+ <div class="wbody">
+ <h3>Choose iOS &amp; variant</h3>
+ <p class="sub">Pick how much of iOS's security you want peeled back. You can always create another VM with a different variant.</p>
+ <div class="variant-grid">
+ <div class="vcard"><div class="vh">Regular <span class="vbadge reg">safe</span></div><div class="vd">Boots stock-like iOS with core bypasses. Best starting point.</div><div class="sec-meter"><i class="on"></i><i class="on"></i><i></i><i></i><i></i></div></div>
+ <div class="vcard"><div class="vh">Developer</div><div class="vd">Adds entitlement &amp; debug bypass for tooling.</div><div class="sec-meter"><i class="on"></i><i class="on"></i><i class="on"></i><i></i><i></i></div></div>
+ <div class="vcard sel"><div class="vh">Jailbreak</div><div class="vd">Full JB — Sileo &amp; TrollStore auto-install on first boot.</div><div class="sec-meter"><i class="on"></i><i class="on"></i><i class="on"></i><i class="on"></i><i></i></div></div>
+ <div class="vcard"><div class="vh">Experimental</div><div class="vd">JB + anti-VM-detection research patches.</div><div class="sec-meter"><i class="on"></i><i class="on"></i><i class="on"></i><i class="on"></i><i class="on"></i></div></div>
+ </div>
+ <div class="field">
+ <label>iOS source — userland</label>
+ <input class="input" value="Download 26.3 (23D127) ▾ — or choose an .ipsw…" readonly>
+ </div>
+ <div class="field">
+ <label>cloudOS source — kernel</label>
+ <input class="input" value="Download 26.4 (23E5207q) ▾ — or choose an .ipsw…" readonly>
+ </div>
+ </div>
+ </div>
+ <div class="wfoot">
+ <span class="btn sm">Back</span>
+ <span class="btn primary">Continue</span>
+ </div>
+ </div>
+
+ <div class="cap">
+ <div class="anno"><span class="b">honest</span><span>The <strong>Review</strong> step states plainly that creating downloads multi-GB IPSWs, will <strong>ask you to authenticate once</strong> (for the CFW host-mount), and takes several minutes — then it runs live in the Task console (next screen).</span></div>
+ <div class="anno"><span class="b">safe</span><span>You authenticate through <strong>macOS's native authentication dialog</strong> — the same system prompt other apps use to make admin changes (Touch ID where available). No password is ever typed into the app, placed on a command line, or written to a log; <span class="typ-mono">vphone-ws</span> never sees it. The wizard still blocks early on a nested-VM host, matching the CLI's own guard.</span></div>
+ </div>
+ </section>
+
+ <!-- ============ SCREEN 3 : TASK CONSOLE ============ -->
+ <section class="section">
+ <div class="sec-head"><span class="sec-num">04</span><h2>Task console</h2></div>
+ <p class="sec-note">Every long or privileged operation (create, restore, CFW install, export/import) runs here — one place for progress, live logs, and cancellation. Stage chips are parsed from the CLI's <span class="typ-mono">=== … ===</span> banners; the terminal shows the raw stream for anyone who wants it.</p>
+
+ <div class="win">
+ <div class="titlebar"><span class="lights"><i></i><i></i><i></i></span><span class="wtitle">Tasks</span></div>
+ <div class="console-wrap">
+ <div class="task">
+ <div class="task-head">
+ <span class="pill warn"><span class="dot"></span>Running</span>
+ <span class="task-title">Creating “clean-26” · Regular</span>
+ <span class="elapsed">04:12 elapsed</span>
+ <span class="btn sm danger" style="margin-left:12px">Cancel</span>
+ </div>
+ <div class="stages">
+ <span class="stage done">✓ Prepare</span>
+ <span class="stage done">✓ Patch</span>
+ <span class="stage now">▸ Restore</span>
+ <span class="stage">Install CFW</span>
+ <span class="stage">First boot</span>
+ </div>
+ <div class="log">
+<span class="dimlog">[*]</span> <span class="info">=== Restore phase ===</span>
+<span class="ok">[+]</span> SHSH fetched for ECID 67C0FDA7D0F90EB3
+<span class="dimlog">[*]</span> entering recovery, sending iBEC…
+<span class="ok">[+]</span> restore: <span class="path">uploading RestoreRamDisk</span> <span class="dimlog">(38%)</span>
+<span class="info">[i]</span> pmd3: waiting for device mode <span class="dimlog">Recovery → Restore</span><span style="opacity:.5">▊</span>
+ </div>
+ </div>
+ <div class="task">
+ <div class="task-head">
+ <span class="pill run"><span class="dot"></span>Done</span>
+ <span class="task-title">Export “touch-test” → touch-test.tar.xz</span>
+ <span class="elapsed">finished 2m ago</span>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="cap">
+ <div class="anno"><span class="b">cancel</span><span><strong>Cancel</strong> forwards <span class="typ-mono">SIGINT</span> to the child (the CLI already handles it), and the app watches the child's exit code to mark success or failure — no guessing from log text.</span></div>
+ <div class="anno"><span class="b">robust</span><span>The console is the extensibility seam: any future long-running CLI verb becomes a task here for free.</span></div>
+ </div>
+ </section>
+
+ <!-- ============ SCREEN 4 : HOST READINESS ============ -->
+ <section class="section">
+ <div class="sec-head"><span class="sec-num">05</span><h2>Host readiness</h2></div>
+ <p class="sec-note">Host prerequisites are the #1 reason a launch fails with a cryptic <span class="typ-mono">zsh: killed</span>. This panel checks them up front and, when something's off, says exactly what to run — friendly, not scary. Reached from the “Host ready” pill in the toolbar.</p>
+
+ <div class="win" style="max-width:820px">
+ <div class="titlebar"><span class="lights"><i></i><i></i><i></i></span><span class="wtitle">Host readiness</span>
+ <span class="tbtools"><span class="pill warn"><span class="dot"></span>1 item needs attention</span></span>
+ </div>
+ <ul class="checks">
+ <li class="check"><span class="ci ok"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 8.5 6.5 12 13 4.5"/></svg></span>
+ <div class="ctext"><div class="ct">Apple Silicon Mac, macOS 15+</div><div class="cd">macOS 26.3 · Mac16,12 — supported.</div></div></li>
+ <li class="check"><span class="ci ok"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 8.5 6.5 12 13 4.5"/></svg></span>
+ <div class="ctext"><div class="ct">Not running inside a VM</div><div class="cd">Nested PV=3 guests can't boot. <span class="typ-mono">kern.hv_vmm_present = 0</span> — good.</div></div></li>
+ <li class="check"><span class="ci ok"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 8.5 6.5 12 13 4.5"/></svg></span>
+ <div class="ctext"><div class="ct">SIP relaxed for research guests</div><div class="cd"><span class="typ-mono">csrutil</span> configured with <span class="typ-mono">allow-research-guests</span>.</div></div></li>
+ <li class="check"><span class="ci warn"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 4v5M8 11.5h.01"/></svg></span>
+ <div class="ctext"><div class="ct">AMFI allowlist (amfidont) is not running</div>
+ <div class="cd">Without it, launching the signed VM binary is killed on start. Start the helper — it must stay running while you use VMs.</div>
+ <div class="cfix"><span class="btn primary sm">Start amfidont</span> <span class="btn sm">Show me the command</span></div></div></li>
+ <li class="check"><span class="ci ok"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 8.5 6.5 12 13 4.5"/></svg></span>
+ <div class="ctext"><div class="ct">vphone-cli found</div><div class="cd"><span class="typ-mono">/opt/homebrew/bin/vphone-cli</span> → v1.0.1</div></div></li>
+ </ul>
+ </div>
+
+ <div class="cap">
+ <div class="anno"><span class="b">source</span><span>Checks reuse the CLI's own <span class="typ-mono">boot_host_preflight.sh</span> where possible, plus direct <span class="typ-mono">sysctl</span>/<span class="typ-mono">csrutil</span> reads — so the app and the CLI never disagree about whether the host is ready.</span></div>
+ </div>
+ </section>
+
+ <!-- ============ DESIGN LANGUAGE ============ -->
+ <section class="section">
+ <div class="sec-head"><span class="sec-num">06</span><h2>Design language</h2></div>
+ <p class="sec-note">Inherits the vphone toolchain's flat, precise, dark-neutral identity — softened for approachability. One blue accent; status color kept separate and meaningful.</p>
+ <div class="legend">
+ <div class="lg">
+ <h4>Palette</h4>
+ <div class="swatches">
+ <div class="sw"><i style="background:#5b9bff"></i><span class="lab"><b>Accent</b> · systemBlue — actions, selection</span></div>
+ <div class="sw"><i style="background:#3fb950"></i><span class="lab"><b>Good</b> · running, ready</span></div>
+ <div class="sw"><i style="background:#d29922"></i><span class="lab"><b>Warn</b> · needs attention</span></div>
+ <div class="sw"><i style="background:#f85149"></i><span class="lab"><b>Critical</b> · stop, destructive</span></div>
+ <div class="sw"><i style="background:#101216"></i><span class="lab"><b>Ground</b> · cool near-black</span></div>
+ </div>
+ </div>
+ <div class="lg">
+ <h4>Type — friendly face, technical soul</h4>
+ <div class="typ-row"><div class="big typ-sans">SF Pro — UI &amp; copy</div><div class="small">Approachable, native, non-threatening</div></div>
+ <div class="typ-row"><div class="big typ-mono">SF Mono — logs · paths · values</div><div class="small">Research-instrument texture, reserved for data</div></div>
+ </div>
+ <div class="lg">
+ <h4>Principles</h4>
+ <div class="swatches" style="gap:10px">
+ <div class="sw"><span class="lab">Flat surfaces, 1px borders, no busy chrome</span></div>
+ <div class="sw"><span class="lab">Plain-English status before technical detail</span></div>
+ <div class="sw"><span class="lab">Every scary step is explained, never silent</span></div>
+ <div class="sw"><span class="lab">Adapts to light &amp; dark automatically</span></div>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <p class="foot">vphone Workstation · proposed design · shells out to vphone-cli · no special entitlements required</p>
+
+</div>
+</div>
diff --git a/docs/logo.png b/docs/logo.png
new file mode 100644
index 0000000..a4853f1
Binary files /dev/null and b/docs/logo.png differ
diff --git a/docs/screenshots/create-wizard.png b/docs/screenshots/create-wizard.png
new file mode 100644
index 0000000..3191e0e
Binary files /dev/null and b/docs/screenshots/create-wizard.png differ
diff --git a/docs/screenshots/overview.png b/docs/screenshots/overview.png
new file mode 100644
index 0000000..e5fb2e2
Binary files /dev/null and b/docs/screenshots/overview.png differ
diff --git a/docs/superpowers/plans/2026-08-02-vphone-ws-create-console.md b/docs/superpowers/plans/2026-08-02-vphone-ws-create-console.md
new file mode 100644
index 0000000..f4fc5fb
--- /dev/null
+++ b/docs/superpowers/plans/2026-08-02-vphone-ws-create-console.md
@@ -0,0 +1,802 @@
+# vphone-ws — Plan 3: Create Wizard & Task Console
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Add the long-running, streaming operations — a guided Create-VM wizard and the Task console that runs create/export/import with live progress, cancellation, native-auth elevation, and variant tracking.
+
+**Architecture:** A streaming process runner emits output line-by-line; a pure stage parser turns `vphone-cli`'s `=== … ===` banners into progress; a `TaskModel` drives one running command's state; command builders assemble the argv for `vm create`/`export`/`import`. The create wizard records its chosen variant in a `VariantStore` sidecar and launches a `TaskModel`. Elevation uses the CLI's `--root-popup` (native macOS auth), so vphone-ws never handles a password.
+
+**Tech Stack:** Swift 6, SwiftPM, SwiftUI, swift-testing. No third-party dependencies. macOS 15+.
+
+## Global Constraints
+
+- All Plan 1 constraints apply (macOS 15+, Swift 6, no `vphone-cli` source dependency, lowercase `tests/`, explicit VM names, commit convention).
+- **Elevation:** `vm create` runs with `--root-popup` — the CFW host-mount authenticates via the native macOS dialog. vphone-ws never captures, stores, or passes a password.
+- Success/failure of a long command is decided by the child **exit code**, never by scraping log text.
+- Cancellation forwards **SIGINT** to the child (the CLI handles it); it does not hard-kill.
+- Create validates non-empty name, no `/`, no leading `.`, and rejects an existing bundle name before running. It blocks on a nested-VM host.
+- Create argv: `vm create <name> -V <variant> --iphone-source <s> --cloudos-source <s> --root-popup` (+ `--library-root` when set).
+
+## File Structure
+
+- `Sources/VPhoneWSCore/Tasks/StageParser.swift` — pure banner/marker parser.
+- `Sources/VPhoneWSCore/Process/StreamingRunner.swift` — line-streaming spawn protocol + system impl.
+- `Sources/VPhoneWSCore/Tasks/TaskModel.swift` — one running command's observable state.
+- `Sources/VPhoneWSCore/Tasks/VPhoneCommandBuilder.swift` — argv builders for create/export/import.
+- `Sources/VPhoneWSCore/Variant/VariantStore.swift` — per-VM variant sidecar.
+- `Sources/vphone-ws/Views/TaskConsoleView.swift`, `CreateWizardView.swift` — UI.
+
+---
+
+### Task 1: Stage parser (pure)
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Tasks/StageParser.swift`
+- Test: `tests/VPhoneWSCoreTests/StageParserTests.swift`
+
+**Interfaces:**
+- Produces:
+ - `enum LogEvent: Equatable, Sendable { case stage(String); case marker(String); case plain(String) }`
+ - `static func classify(_ line: String) -> LogEvent` — a `=== X ===` line ⇒ `.stage("X")`; a line starting with `[*]`/`[+]`/`[-]`/`[!]` ⇒ `.marker(line)`; else `.plain(line)`.
+
+- [ ] **Step 1: Write the failing test**
+
+```swift
+// tests/VPhoneWSCoreTests/StageParserTests.swift
+import Testing
+@testable import VPhoneWSCore
+
+@Test func classifiesBannersMarkersAndPlain() {
+ #expect(StageParser.classify("=== Restore phase ===") == .stage("Restore phase"))
+ #expect(StageParser.classify("=== CFW install ===") == .stage("CFW install"))
+ #expect(StageParser.classify("[+] SHSH fetched") == .marker("[+] SHSH fetched"))
+ #expect(StageParser.classify("[-] panic") == .marker("[-] panic"))
+ #expect(StageParser.classify("uploading ramdisk") == .plain("uploading ramdisk"))
+}
+```
+
+- [ ] **Step 2: Run to verify it fails**
+
+Run: `swift test --filter StageParserTests`
+Expected: FAIL — `StageParser` undefined.
+
+- [ ] **Step 3: Implement**
+
+```swift
+// Sources/VPhoneWSCore/Tasks/StageParser.swift
+public enum LogEvent: Equatable, Sendable {
+ case stage(String)
+ case marker(String)
+ case plain(String)
+}
+
+public enum StageParser {
+ public static func classify(_ line: String) -> LogEvent {
+ let t = line.trimmingCharacters(in: .whitespaces)
+ if t.hasPrefix("===") && t.hasSuffix("===") && t.count > 6 {
+ let inner = t.dropFirst(3).dropLast(3).trimmingCharacters(in: .whitespaces)
+ return .stage(inner)
+ }
+ for m in ["[*]", "[+]", "[-]", "[!]"] where t.hasPrefix(m) {
+ return .marker(line)
+ }
+ return .plain(line)
+ }
+}
+
+import Foundation
+```
+
+- [ ] **Step 4: Run to verify green**
+
+Run: `swift test --filter StageParserTests`
+Expected: PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/Tasks/StageParser.swift tests/VPhoneWSCoreTests/StageParserTests.swift
+git commit -m "feat(tasks): add pure stage/marker log parser"
+```
+
+---
+
+### Task 2: `StreamingRunner` — line-streaming spawn
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Process/StreamingRunner.swift`
+- Test: `tests/VPhoneWSCoreTests/StreamingRunnerTests.swift`
+- Test helper: `tests/VPhoneWSCoreTests/Support/FakeStreamingRunner.swift`
+
+**Interfaces:**
+- Produces:
+ - `protocol StreamingRunner: Sendable { func run(executable: URL, arguments: [String], environment: [String: String]?, onStart: @escaping @Sendable (Int32) -> Void, onLine: @escaping @Sendable (String) -> Void) async throws -> Int32 }`
+ - `struct SystemStreamingRunner: StreamingRunner` — spawns, calls `onStart(pid)`, invokes `onLine` per stdout+stderr line, returns exit code.
+ - `final class FakeStreamingRunner: StreamingRunner` — emits a canned `[String]` of lines then returns a canned exit code; calls `onStart(stubPID)`.
+
+- [ ] **Step 1: Write the failing test**
+
+```swift
+// tests/VPhoneWSCoreTests/StreamingRunnerTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+@Test func fakeStreamerEmitsLinesThenExit() async throws {
+ let fake = FakeStreamingRunner(lines: ["=== Prepare ===", "[+] done"], exitCode: 0, stubPID: 9)
+ var seen: [String] = []; var startedPID: Int32 = 0
+ let code = try await fake.run(executable: URL(fileURLWithPath: "/x"), arguments: [], environment: nil,
+ onStart: { startedPID = $0 }, onLine: { seen.append($0) })
+ #expect(startedPID == 9)
+ #expect(seen == ["=== Prepare ===", "[+] done"])
+ #expect(code == 0)
+}
+
+@Test func systemStreamerEchoesLines() async throws {
+ let runner = SystemStreamingRunner()
+ var seen: [String] = []
+ let code = try await runner.run(executable: URL(fileURLWithPath: "/bin/echo"), arguments: ["one\ntwo"],
+ environment: nil, onStart: { _ in }, onLine: { seen.append($0) })
+ #expect(code == 0)
+ #expect(seen.contains("one"))
+ #expect(seen.contains("two"))
+}
+```
+
+- [ ] **Step 2: Write the fake helper**
+
+```swift
+// tests/VPhoneWSCoreTests/Support/FakeStreamingRunner.swift
+import Foundation
+@testable import VPhoneWSCore
+
+final class FakeStreamingRunner: StreamingRunner, @unchecked Sendable {
+ let lines: [String]; let exitCode: Int32; let stubPID: Int32
+ init(lines: [String], exitCode: Int32, stubPID: Int32 = 1) {
+ self.lines = lines; self.exitCode = exitCode; self.stubPID = stubPID
+ }
+ func run(executable: URL, arguments: [String], environment: [String: String]?,
+ onStart: @escaping @Sendable (Int32) -> Void, onLine: @escaping @Sendable (String) -> Void) async throws -> Int32 {
+ onStart(stubPID)
+ for line in lines { onLine(line) }
+ return exitCode
+ }
+}
+```
+
+- [ ] **Step 3: Run to verify it fails**
+
+Run: `swift test --filter StreamingRunnerTests`
+Expected: FAIL — types undefined.
+
+- [ ] **Step 4: Implement the system streamer**
+
+```swift
+// Sources/VPhoneWSCore/Process/StreamingRunner.swift
+import Foundation
+
+public protocol StreamingRunner: Sendable {
+ func run(executable: URL, arguments: [String], environment: [String: String]?,
+ onStart: @escaping @Sendable (Int32) -> Void,
+ onLine: @escaping @Sendable (String) -> Void) async throws -> Int32
+}
+
+public struct SystemStreamingRunner: StreamingRunner {
+ public init() {}
+
+ public func run(executable: URL, arguments: [String], environment: [String: String]?,
+ onStart: @escaping @Sendable (Int32) -> Void,
+ onLine: @escaping @Sendable (String) -> Void) async throws -> Int32 {
+ try await withCheckedThrowingContinuation { continuation in
+ let process = Process()
+ process.executableURL = executable
+ process.arguments = arguments
+ if let environment { process.environment = environment }
+ let pipe = Pipe()
+ process.standardOutput = pipe
+ process.standardError = pipe
+
+ let buffer = LineBuffer(onLine: onLine)
+ pipe.fileHandleForReading.readabilityHandler = { handle in
+ let data = handle.availableData
+ if data.isEmpty { return }
+ buffer.append(data)
+ }
+ process.terminationHandler = { proc in
+ pipe.fileHandleForReading.readabilityHandler = nil
+ let tail = pipe.fileHandleForReading.readDataToEndOfFile()
+ buffer.append(tail); buffer.flush()
+ continuation.resume(returning: proc.terminationStatus)
+ }
+ do {
+ try process.run()
+ onStart(process.processIdentifier)
+ } catch { continuation.resume(throwing: error) }
+ }
+ }
+}
+
+/// Splits a byte stream into lines, invoking `onLine` per complete line.
+final class LineBuffer: @unchecked Sendable {
+ private var partial = ""
+ private let onLine: @Sendable (String) -> Void
+ init(onLine: @escaping @Sendable (String) -> Void) { self.onLine = onLine }
+ func append(_ data: Data) {
+ partial += String(decoding: data, as: UTF8.self)
+ while let idx = partial.firstIndex(of: "\n") {
+ onLine(String(partial[..<idx]))
+ partial = String(partial[partial.index(after: idx)...])
+ }
+ }
+ func flush() { if !partial.isEmpty { onLine(partial); partial = "" } }
+}
+```
+
+- [ ] **Step 5: Run to verify green**
+
+Run: `swift test --filter StreamingRunnerTests`
+Expected: PASS.
+
+- [ ] **Step 6: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/Process/StreamingRunner.swift tests/VPhoneWSCoreTests/StreamingRunnerTests.swift tests/VPhoneWSCoreTests/Support/FakeStreamingRunner.swift
+git commit -m "feat(process): add line-streaming runner and fake"
+```
+
+---
+
+### Task 3: `TaskModel` — one running command's state
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Tasks/TaskModel.swift`
+- Test: `tests/VPhoneWSCoreTests/TaskModelTests.swift`
+
+**Interfaces:**
+- Consumes: `StreamingRunner` (Task 2), `StageParser` (Task 1).
+- Produces:
+ - `enum TaskStatus: Equatable, Sendable { case running; case succeeded; case failed(Int32); case cancelled }`
+ - `@MainActor @Observable final class TaskModel: Identifiable` with `let id = UUID()`, `let title: String`, `let plannedStages: [String]`, `private(set) var currentStage: String?`, `private(set) var completedStages: [String]`, `private(set) var logLines: [String]`, `private(set) var status: TaskStatus`.
+ - `init(title: String, plannedStages: [String])`.
+ - `func run(executable: URL, arguments: [String], runner: StreamingRunner) async` — streams lines (classifying each: `.stage` advances `currentStage`/`completedStages`, everything appended to `logLines`), sets `status` from the exit code (`0` ⇒ `.succeeded`, else `.failed(code)`).
+ - `func cancel()` — sends `SIGINT` to the recorded pid; marks `.cancelled`.
+
+- [ ] **Step 1: Write the failing tests (success + failure state transitions)**
+
+```swift
+// tests/VPhoneWSCoreTests/TaskModelTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+private let exe = URL(fileURLWithPath: "/usr/bin/vphone-cli")
+
+@MainActor
+@Test func runAdvancesStagesAndSucceeds() async {
+ let runner = FakeStreamingRunner(
+ lines: ["=== Prepare ===", "[*] downloading", "=== Restore phase ===", "[+] ok"],
+ exitCode: 0)
+ let task = TaskModel(title: "Create a", plannedStages: ["Prepare", "Restore phase"])
+ await task.run(executable: exe, arguments: ["vm", "create", "a"], runner: runner)
+ #expect(task.completedStages == ["Prepare"]) // last stage is "current", earlier ones completed
+ #expect(task.currentStage == "Restore phase")
+ #expect(task.logLines.contains("[*] downloading"))
+ #expect(task.status == .succeeded)
+}
+
+@MainActor
+@Test func nonZeroExitMarksFailed() async {
+ let runner = FakeStreamingRunner(lines: ["[-] boom"], exitCode: 3)
+ let task = TaskModel(title: "Create a", plannedStages: [])
+ await task.run(executable: exe, arguments: [], runner: runner)
+ #expect(task.status == .failed(3))
+}
+```
+
+- [ ] **Step 2: Run to verify it fails**
+
+Run: `swift test --filter TaskModelTests`
+Expected: FAIL — `TaskModel` undefined.
+
+- [ ] **Step 3: Implement**
+
+```swift
+// Sources/VPhoneWSCore/Tasks/TaskModel.swift
+import Foundation
+import Observation
+
+public enum TaskStatus: Equatable, Sendable {
+ case running, succeeded, cancelled
+ case failed(Int32)
+}
+
+@MainActor
+@Observable
+public final class TaskModel: Identifiable {
+ public let id = UUID()
+ public let title: String
+ public let plannedStages: [String]
+ public private(set) var currentStage: String?
+ public private(set) var completedStages: [String] = []
+ public private(set) var logLines: [String] = []
+ public private(set) var status: TaskStatus = .running
+
+ private var pid: Int32?
+
+ public init(title: String, plannedStages: [String]) {
+ self.title = title; self.plannedStages = plannedStages
+ }
+
+ public func run(executable: URL, arguments: [String], runner: StreamingRunner) async {
+ do {
+ let code = try await runner.run(
+ executable: executable, arguments: arguments, environment: nil,
+ onStart: { [weak self] pid in Task { @MainActor in self?.pid = pid } },
+ onLine: { [weak self] line in Task { @MainActor in self?.ingest(line) } })
+ if status != .cancelled { status = code == 0 ? .succeeded : .failed(code) }
+ } catch {
+ if status != .cancelled { status = .failed(-1) }
+ }
+ }
+
+ public func cancel() {
+ if let pid { kill(pid, SIGINT) }
+ status = .cancelled
+ }
+
+ private func ingest(_ line: String) {
+ switch StageParser.classify(line) {
+ case .stage(let name):
+ if let prev = currentStage { completedStages.append(prev) }
+ currentStage = name
+ case .marker, .plain:
+ break
+ }
+ logLines.append(line)
+ }
+}
+```
+
+- [ ] **Step 4: Run to verify green**
+
+Run: `swift test --filter TaskModelTests`
+Expected: PASS. (Note: `onLine` hops to the main actor via `Task { @MainActor in }`; the fake emits synchronously, but `run` awaits the runner's return, and the test asserts after `await`, so the ordered hops have completed. If ordering proves racy, change the fake to `await MainActor.run { onLine(line) }` — but keep the protocol closure non-async.)
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/Tasks/TaskModel.swift tests/VPhoneWSCoreTests/TaskModelTests.swift
+git commit -m "feat(tasks): add TaskModel state machine with stage tracking"
+```
+
+---
+
+### Task 4: `VariantStore` — per-VM variant sidecar
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Variant/VariantStore.swift`
+- Test: `tests/VPhoneWSCoreTests/VariantStoreTests.swift`
+
+**Interfaces:**
+- Produces:
+ - `struct VariantStore { init(libraryRoot: String) }`
+ - `func setVariant(_ variant: String, forVM name: String) throws` — writes `<libraryRoot>/<name>/.vphone-ws.json` = `{"variant":"jb"}`.
+ - `func variant(forVM name: String) -> String?` — reads it back; `nil` if the file is absent (VM created outside vphone-ws ⇒ "Unknown" in UI).
+
+- [ ] **Step 1: Write the failing test**
+
+```swift
+// tests/VPhoneWSCoreTests/VariantStoreTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+@Test func writesAndReadsVariant() throws {
+ let root = NSTemporaryDirectory() + "vws-\(UUID().uuidString)"
+ try FileManager.default.createDirectory(atPath: root + "/myvm", withIntermediateDirectories: true)
+ defer { try? FileManager.default.removeItem(atPath: root) }
+
+ let store = VariantStore(libraryRoot: root)
+ #expect(store.variant(forVM: "myvm") == nil)
+ try store.setVariant("jb", forVM: "myvm")
+ #expect(store.variant(forVM: "myvm") == "jb")
+}
+```
+
+- [ ] **Step 2: Run to verify it fails**
+
+Run: `swift test --filter VariantStoreTests`
+Expected: FAIL — `VariantStore` undefined.
+
+- [ ] **Step 3: Implement**
+
+```swift
+// Sources/VPhoneWSCore/Variant/VariantStore.swift
+import Foundation
+
+public struct VariantStore: Sendable {
+ private struct Sidecar: Codable { let variant: String }
+ private let libraryRoot: String
+ public init(libraryRoot: String) { self.libraryRoot = libraryRoot }
+
+ private func url(_ name: String) -> URL {
+ URL(fileURLWithPath: "\(libraryRoot)/\(name)/.vphone-ws.json")
+ }
+
+ public func setVariant(_ variant: String, forVM name: String) throws {
+ let data = try JSONEncoder().encode(Sidecar(variant: variant))
+ try data.write(to: url(name))
+ }
+
+ public func variant(forVM name: String) -> String? {
+ guard let data = try? Data(contentsOf: url(name)),
+ let side = try? JSONDecoder().decode(Sidecar.self, from: data) else { return nil }
+ return side.variant
+ }
+}
+```
+
+- [ ] **Step 4: Run to verify green**
+
+Run: `swift test --filter VariantStoreTests`
+Expected: PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/Variant tests/VPhoneWSCoreTests/VariantStoreTests.swift
+git commit -m "feat(variant): add per-VM variant sidecar store"
+```
+
+---
+
+### Task 5: Command builders — create / export / import argv
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Tasks/VPhoneCommandBuilder.swift`
+- Test: `tests/VPhoneWSCoreTests/VPhoneCommandBuilderTests.swift`
+
+**Interfaces:**
+- Produces:
+ - `struct VPhoneCommandBuilder { let libraryRoot: String? }`
+ - `func createArgs(name: String, variant: String, iphoneSource: String, cloudosSource: String) -> [String]` → `["vm","create",name,"-V",variant,"--iphone-source",iphoneSource,"--cloudos-source",cloudosSource,"--root-popup"]` (+ `--library-root` when set).
+ - `func exportArgs(name: String, out: String) -> [String]` → `["vm","export",name,"-o",out]` (+ library-root).
+ - `func importArgs(archive: String, name: String) -> [String]` → `["vm","import","-i",archive,"-n",name]` (+ library-root).
+ - `static let createStages = ["vm new","fw prepare","fw patch","Restore phase","CFW install","First boot"]` (progress hints matching the CLI's banners).
+
+- [ ] **Step 1: Write the failing test**
+
+```swift
+// tests/VPhoneWSCoreTests/VPhoneCommandBuilderTests.swift
+import Testing
+@testable import VPhoneWSCore
+
+@Test func createIncludesRootPopupAndSourcesAndLibraryRoot() {
+ let b = VPhoneCommandBuilder(libraryRoot: "/lib")
+ #expect(b.createArgs(name: "a", variant: "jb", iphoneSource: "26.3", cloudosSource: "26.4") ==
+ ["vm","create","a","-V","jb","--iphone-source","26.3","--cloudos-source","26.4","--root-popup","--library-root","/lib"])
+}
+
+@Test func exportAndImportArgs() {
+ let b = VPhoneCommandBuilder(libraryRoot: nil)
+ #expect(b.exportArgs(name: "a", out: "/tmp/a.tar.xz") == ["vm","export","a","-o","/tmp/a.tar.xz"])
+ #expect(b.importArgs(archive: "/tmp/a.tar.xz", name: "restored") == ["vm","import","-i","/tmp/a.tar.xz","-n","restored"])
+}
+```
+
+- [ ] **Step 2: Run to verify it fails**
+
+Run: `swift test --filter VPhoneCommandBuilderTests`
+Expected: FAIL — `VPhoneCommandBuilder` undefined.
+
+- [ ] **Step 3: Implement**
+
+```swift
+// Sources/VPhoneWSCore/Tasks/VPhoneCommandBuilder.swift
+public struct VPhoneCommandBuilder: Sendable {
+ public let libraryRoot: String?
+ public init(libraryRoot: String?) { self.libraryRoot = libraryRoot }
+
+ public static let createStages = ["vm new", "fw prepare", "fw patch", "Restore phase", "CFW install", "First boot"]
+
+ public func createArgs(name: String, variant: String, iphoneSource: String, cloudosSource: String) -> [String] {
+ withLibraryRoot(["vm", "create", name, "-V", variant,
+ "--iphone-source", iphoneSource, "--cloudos-source", cloudosSource, "--root-popup"])
+ }
+
+ public func exportArgs(name: String, out: String) -> [String] {
+ withLibraryRoot(["vm", "export", name, "-o", out])
+ }
+
+ public func importArgs(archive: String, name: String) -> [String] {
+ withLibraryRoot(["vm", "import", "-i", archive, "-n", name])
+ }
+
+ private func withLibraryRoot(_ argv: [String]) -> [String] {
+ guard let libraryRoot else { return argv }
+ return argv + ["--library-root", libraryRoot]
+ }
+}
+```
+
+- [ ] **Step 4: Run to verify green**
+
+Run: `swift test --filter VPhoneCommandBuilderTests`
+Expected: PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/Tasks/VPhoneCommandBuilder.swift tests/VPhoneWSCoreTests/VPhoneCommandBuilderTests.swift
+git commit -m "feat(tasks): add create/export/import command builders"
+```
+
+---
+
+### Task 6: Task console UI
+
+**Files:**
+- Create: `Sources/vphone-ws/Views/TaskConsoleView.swift`
+- Create: `Sources/VPhoneWSCore/Tasks/TaskCenter.swift`
+- Modify: `Sources/VPhoneWSCore/Store/AppEnvironment.swift`
+
+**Interfaces:**
+- Produces: `@MainActor @Observable final class TaskCenter { var tasks: [TaskModel]; func start(title:plannedStages:executable:arguments:runner:) -> TaskModel }` — appends a `TaskModel`, kicks off its `run(...)` in a `Task`, returns it. Add a `TaskCenter` and a `StreamingRunner` to `AppEnvironment.Services`.
+
+This task is UI + a small coordinator; verify manually via export (a real long op you already have VMs for).
+
+- [ ] **Step 1: Add `TaskCenter`**
+
+```swift
+// Sources/VPhoneWSCore/Tasks/TaskCenter.swift
+import Foundation
+
+@MainActor
+@Observable
+public final class TaskCenter {
+ public private(set) var tasks: [TaskModel] = []
+ private let runner: StreamingRunner
+ public init(runner: StreamingRunner) { self.runner = runner }
+
+ @discardableResult
+ public func start(title: String, plannedStages: [String], executable: URL, arguments: [String]) -> TaskModel {
+ let model = TaskModel(title: title, plannedStages: plannedStages)
+ tasks.insert(model, at: 0)
+ Task { await model.run(executable: executable, arguments: arguments, runner: runner) }
+ return model
+ }
+}
+```
+
+Add to `AppEnvironment.Services`: `let taskCenter: TaskCenter`, `let executable: URL`, `let commandBuilder: VPhoneCommandBuilder`, `let variants: VariantStore`. Construct them in `makeServices` (`taskCenter: TaskCenter(runner: SystemStreamingRunner())`, `commandBuilder: VPhoneCommandBuilder(libraryRoot: root)`, `variants: VariantStore(libraryRoot: root)`, `executable: exe`).
+
+- [ ] **Step 2: Implement `TaskConsoleView`**
+
+```swift
+// Sources/vphone-ws/Views/TaskConsoleView.swift
+import SwiftUI
+import VPhoneWSCore
+
+struct TaskConsoleView: View {
+ @Bindable var center: TaskCenter
+
+ var body: some View {
+ List(center.tasks) { task in
+ VStack(alignment: .leading, spacing: 10) {
+ HStack {
+ statusPill(task)
+ Text(task.title).fontWeight(.semibold)
+ Spacer()
+ if task.status == .running {
+ Button("Cancel", role: .destructive) { task.cancel() }
+ }
+ }
+ if !task.plannedStages.isEmpty {
+ HStack(spacing: 6) {
+ ForEach(task.plannedStages, id: \.self) { stage in
+ Text(stage).font(.caption.monospaced())
+ .padding(.horizontal, 8).padding(.vertical, 3)
+ .background(stageColor(task, stage)).clipShape(.rect(cornerRadius: 5))
+ }
+ }
+ }
+ ScrollView { Text(task.logLines.suffix(200).joined(separator: "\n"))
+ .font(.caption.monospaced()).frame(maxWidth: .infinity, alignment: .leading) }
+ .frame(height: 160).background(Color.black.opacity(0.85))
+ .clipShape(.rect(cornerRadius: 6))
+ }.padding(.vertical, 6)
+ }
+ }
+
+ private func statusPill(_ t: TaskModel) -> some View {
+ let (text, color): (String, Color) = switch t.status {
+ case .running: ("Running", .orange)
+ case .succeeded: ("Done", .green)
+ case .cancelled: ("Cancelled", .secondary)
+ case .failed(let c): ("Failed (\(c))", .red)
+ }
+ return Text(text).font(.caption.bold()).foregroundStyle(color)
+ }
+
+ private func stageColor(_ t: TaskModel, _ stage: String) -> Color {
+ if t.completedStages.contains(stage) { return .green.opacity(0.2) }
+ if t.currentStage == stage { return .accentColor.opacity(0.3) }
+ return .secondary.opacity(0.12)
+ }
+}
+```
+
+- [ ] **Step 3: Present the console** from a toolbar button in `LibraryView` (sheet or a bottom panel bound to `services.taskCenter`).
+
+- [ ] **Step 4: Verify with a real export (manual)**
+
+Trigger an export (Task 8 wires the menu, or temporarily call `services.taskCenter.start(title:"Export", plannedStages: [], executable: services.executable, arguments: services.commandBuilder.exportArgs(name: "<vm>", out: "/tmp/x.tar.xz"))`).
+Expected: a task appears, log streams live, status flips to Done on completion; Cancel SIGINTs a running task.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources
+git commit -m "feat(ui): add task console with live log and stage chips"
+```
+
+---
+
+### Task 7: Create-VM wizard
+
+**Files:**
+- Create: `Sources/vphone-ws/Views/CreateWizardView.swift`
+- Modify: `Sources/vphone-ws/Views/LibraryView.swift`
+
+**Interfaces:**
+- Consumes: `AppEnvironment.Services` (adds `taskCenter`, `executable`, `commandBuilder`, `variants`).
+
+This task is UI; verify with a real create run.
+
+- [ ] **Step 1: Implement `CreateWizardView`** (name → variant + sources → review → create)
+
+```swift
+// Sources/vphone-ws/Views/CreateWizardView.swift
+import SwiftUI
+import VPhoneWSCore
+
+struct CreateWizardView: View {
+ let services: AppEnvironment.Services
+ @Environment(\.dismiss) private var dismiss
+ @State private var name = ""
+ @State private var variant = "regular"
+ @State private var iphoneSource = ""
+ @State private var cloudosSource = ""
+
+ private var nameValid: Bool {
+ !name.isEmpty && !name.contains("/") && !name.hasPrefix(".")
+ && !services.store.rows.contains { $0.report.name == name }
+ }
+
+ var body: some View {
+ Form {
+ Section("Name") {
+ TextField("VM name", text: $name)
+ if !name.isEmpty && !nameValid {
+ Text("Invalid or already in use").font(.caption).foregroundStyle(.red)
+ }
+ }
+ Section("Variant") {
+ Picker("Variant", selection: $variant) {
+ ForEach(["less","regular","dev","jb","exp"], id: \.self) { Text($0) }
+ }.pickerStyle(.segmented)
+ }
+ Section("Firmware source") {
+ TextField("iOS (userland) — version or .ipsw path", text: $iphoneSource)
+ TextField("cloudOS (kernel) — version or .ipsw path", text: $cloudosSource)
+ }
+ Section {
+ Text("Creating downloads multi-GB IPSWs, authenticates once via the native macOS prompt (for the CFW host-mount), and takes several minutes. Progress shows in the Task console.")
+ .font(.caption).foregroundStyle(.secondary)
+ }
+ }
+ .frame(width: 460)
+ .toolbar {
+ ToolbarItem(placement: .confirmationAction) {
+ Button("Create") { startCreate() }
+ .disabled(!nameValid || iphoneSource.isEmpty || cloudosSource.isEmpty)
+ }
+ ToolbarItem(placement: .cancellationAction) { Button("Cancel") { dismiss() } }
+ }
+ }
+
+ private func startCreate() {
+ try? services.variants.setVariant(variant, forVM: name) // record before the long run
+ let args = services.commandBuilder.createArgs(
+ name: name, variant: variant, iphoneSource: iphoneSource, cloudosSource: cloudosSource)
+ services.taskCenter.start(title: "Create \(name) · \(variant)",
+ plannedStages: VPhoneCommandBuilder.createStages,
+ executable: services.executable, arguments: args)
+ dismiss()
+ }
+}
+```
+
+Note: `variants.setVariant` writes `<root>/<name>/.vphone-ws.json`; the bundle dir may not exist until `vm new` runs inside `vm create`. If the write fails because the dir is absent, retry it when the create task reaches `.succeeded` (observe the returned `TaskModel.status`) — the simplest robust approach is to write the sidecar in a `Task` that awaits the create task's completion. Adjust `startCreate` to capture the returned `TaskModel` and, on `.succeeded`, call `setVariant` then `store.refresh()`.
+
+- [ ] **Step 2: Add a "New VM" toolbar button** in `LibraryView` presenting `CreateWizardView(services:)` as a sheet.
+
+- [ ] **Step 3: Verify a real create (manual, device)**
+
+Run: `swift run vphone-ws` → New VM → fill name/variant/sources → Create.
+Expected: the Task console shows the create streaming through its stages; the native macOS auth dialog appears at CFW time; on success the VM appears in the sidebar and its variant sidecar is written.
+
+- [ ] **Step 4: Commit**
+
+```bash
+git add Sources
+git commit -m "feat(ui): add create-VM wizard driving vm create via task console"
+```
+
+---
+
+### Task 8: Export/Import actions + variant display
+
+**Files:**
+- Modify: `Sources/vphone-ws/Views/VMDetailView.swift`
+- Modify: `Sources/vphone-ws/Views/LibraryView.swift`
+
+**Interfaces:**
+- Consumes: `TaskCenter`, `VPhoneCommandBuilder`, `VariantStore` (via `Services`).
+
+- [ ] **Step 1: Add Export to the detail More menu**
+
+```swift
+Button("Export…") {
+ let panel = NSSavePanel(); panel.nameFieldStringValue = "\(row.report.name).tar.xz"
+ if panel.runModal() == .OK, let out = panel.url?.path {
+ services.taskCenter.start(title: "Export \(row.report.name)", plannedStages: [],
+ executable: services.executable, arguments: services.commandBuilder.exportArgs(name: row.report.name, out: out))
+ }
+}
+```
+
+- [ ] **Step 2: Add Import to the `LibraryView` toolbar**
+
+```swift
+Button("Import…") {
+ let panel = NSOpenPanel(); panel.allowedContentTypes = [.init(filenameExtension: "xz")!]
+ if panel.runModal() == .OK, let archive = panel.url?.path {
+ let base = panel.url!.deletingPathExtension().deletingPathExtension().lastPathComponent
+ services.taskCenter.start(title: "Import \(base)", plannedStages: [],
+ executable: services.executable, arguments: services.commandBuilder.importArgs(archive: archive, name: base))
+ }
+}
+```
+
+- [ ] **Step 3: Show variant in the detail Overview**
+
+In `VMDetailView`, read `services.variants.variant(forVM: row.report.name) ?? "Unknown"` and add a `("Variant", …)` spec row.
+
+- [ ] **Step 4: Verify (manual)**
+
+Export a VM (Save panel → task streams → `.tar.xz` produced), import it back under a new name (Open panel → task → VM appears). A wizard-created VM shows its variant; an externally-created one shows "Unknown".
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources
+git commit -m "feat(ui): add export/import actions and variant display"
+```
+
+---
+
+## Self-Review
+
+**Spec coverage (design spec §6.3 create wizard, §6.4 task console, §5.3 variant, §8 elevation):**
+- Streaming runner + stage parser + TaskModel + TaskCenter → Tasks 1–3, 6. ✓
+- Create wizard (name validation, variant, both sources, review copy, native-auth via `--root-popup`) → Tasks 5, 7. ✓
+- Success/failure from exit code; cancel via SIGINT → Task 3. ✓
+- Variant sidecar (write on create, read in detail, "Unknown" fallback) → Tasks 4, 7, 8. ✓
+- Export/import via the task engine → Tasks 5, 8. ✓
+
+**Placeholder scan:** none — every step has runnable code/commands. The two "adjust on completion" notes (variant write timing in Task 7; log-ordering fallback in Task 3) specify the exact concrete adjustment, not a vague TODO.
+
+**Type consistency:** `StreamingRunner.run(executable:arguments:environment:onStart:onLine:)` identical across Tasks 2/3/6; `TaskModel(title:plannedStages:)` + `run(executable:arguments:runner:)` consistent between Task 3 and `TaskCenter`; `VPhoneCommandBuilder` method names (`createArgs`/`exportArgs`/`importArgs`) and `createStages` match between Task 5 and Tasks 6–8; `AppEnvironment.Services` gains `taskCenter/executable/commandBuilder/variants` in Task 6 and they're used with those exact names in Tasks 7–8; `TaskStatus` cases consistent between Task 3 and the console pill (Task 6).
+
+**Elevation check:** create argv always ends with `--root-popup` (Task 5), so vphone-ws never passes `--sudo-password`; the native dialog is raised by the CLI. ✓
diff --git a/docs/superpowers/plans/2026-08-02-vphone-ws-foundation.md b/docs/superpowers/plans/2026-08-02-vphone-ws-foundation.md
new file mode 100644
index 0000000..6195739
--- /dev/null
+++ b/docs/superpowers/plans/2026-08-02-vphone-ws-foundation.md
@@ -0,0 +1,1056 @@
+# vphone-ws — Plan 1: Foundation & Library View
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Stand up the vphone-ws SwiftPM app and ship a read-only VM library — a sidebar of every VM with live running/stopped status and a detail Overview — by shelling out to `vphone-cli`.
+
+**Architecture:** A testable core library (`VPhoneWSCore`: process layer, CLI client, models, running-state probe, store) plus a thin SwiftUI executable (`vphone-ws`) that binds views to the store. The app never links `vphone-cli` code; it treats `vphone-cli`'s `--json` output and exit codes as the contract. This mirrors the sibling `vphone-cli` repo's `VPhoneCore` (library) + `vphone-cli` (executable) split.
+
+**Tech Stack:** Swift 6, SwiftPM, SwiftUI, swift-testing (`import Testing`). No third-party dependencies. macOS 15+.
+
+## Global Constraints
+
+- Platform: macOS 15+ (Sequoia); Apple Silicon. `Package.swift` pins `.macOS(.v15)`.
+- Language: Swift 6, strict concurrency. `// MARK: -` sections; default (internal) access unless a type is part of the core's public API; minimal comments.
+- Standalone: **no dependency on `vphone-cli` source** (`VPhoneCore`). Talk only to the CLI contract (`vm list --json`, `vm info --json`, exit codes).
+- No third-party SwiftPM dependencies in v1.
+- Test directory is lowercase `tests/` (never `Tests/` — silently ignored on the case-insensitive macOS FS).
+- CLI invocation rules: always pass explicit VM **names**; pass `--json` for machine-readable output; never rely on the interactive picker (it throws off a TTY).
+- The VM library root is `~/.vphone/VMs` (override `$VPHONE_LIBRARY_ROOT`); a directory is a VM iff it contains `config.plist`.
+- Commit convention: `type(scope): imperative summary`, lower case, no trailing period (e.g. `feat(store): add lsof running-state probe`).
+- `vm list --json` emits a JSON **array** of reports; `vm info <name> --json` emits one report **object**. Report keys (camelCase, from `VPhoneBundleReport`): `name`, `cpuCount`, `memoryMB`, `diskSizeBytes`, and optional `restoreInfo` = `{ "ios": {"version","build"}, "cloudOS": {"version","build"} }` (may be absent/null). Skipped-bundle warnings go to **stderr** — read JSON from stdout only.
+
+---
+
+### Task 1: Package scaffold & smoke test
+
+**Files:**
+- Create: `Package.swift`
+- Create: `Sources/VPhoneWSCore/VPhoneWSCore.swift`
+- Create: `Sources/vphone-ws/App.swift`
+- Test: `tests/VPhoneWSCoreTests/SmokeTests.swift`
+
+**Interfaces:**
+- Produces: package targets `VPhoneWSCore` (library), `vphone-ws` (executable), `VPhoneWSCoreTests`; a `VPhoneWSCore.version` string symbol.
+
+- [ ] **Step 1: Write `Package.swift`**
+
+```swift
+// swift-tools-version: 6.0
+import PackageDescription
+
+let package = Package(
+ name: "vphone-ws",
+ platforms: [.macOS(.v15)],
+ targets: [
+ .target(name: "VPhoneWSCore", path: "Sources/VPhoneWSCore"),
+ .executableTarget(
+ name: "vphone-ws",
+ dependencies: ["VPhoneWSCore"],
+ path: "Sources/vphone-ws"),
+ .testTarget(
+ name: "VPhoneWSCoreTests",
+ dependencies: ["VPhoneWSCore"],
+ path: "tests/VPhoneWSCoreTests"),
+ ]
+)
+```
+
+- [ ] **Step 2: Write the failing smoke test**
+
+```swift
+// tests/VPhoneWSCoreTests/SmokeTests.swift
+import Testing
+@testable import VPhoneWSCore
+
+@Test func coreExposesVersion() {
+ #expect(VPhoneWSCore.version == "0.1.0")
+}
+```
+
+- [ ] **Step 3: Run it to verify it fails**
+
+Run: `swift test --filter VPhoneWSCoreTests`
+Expected: FAIL — `VPhoneWSCore` has no member `version` (compile error).
+
+- [ ] **Step 4: Write the minimal core symbol and a placeholder App**
+
+```swift
+// Sources/VPhoneWSCore/VPhoneWSCore.swift
+public enum VPhoneWSCore {
+ public static let version = "0.1.0"
+}
+```
+
+```swift
+// Sources/vphone-ws/App.swift
+import SwiftUI
+
+@main
+struct VPhoneWSApp: App {
+ var body: some Scene {
+ WindowGroup("vphone Workstation") {
+ Text("vphone Workstation")
+ .frame(minWidth: 900, minHeight: 600)
+ }
+ }
+}
+```
+
+- [ ] **Step 5: Run build + test to verify green**
+
+Run: `swift build && swift test --filter VPhoneWSCoreTests`
+Expected: build succeeds; test PASSES.
+
+- [ ] **Step 6: Verify the app window launches (manual)**
+
+Run: `swift run vphone-ws`
+Expected: a window titled "vphone Workstation" appears. Quit it (⌘Q).
+Note: if `swift run` does not surface a window on this macOS build, add an `NSApplication`/`NSApplicationDelegate` entry point (as `vphone-cli`'s `main.swift` does) hosting the SwiftUI root via `NSHostingView`; the SwiftUI models below are unaffected.
+
+- [ ] **Step 7: Add `.gitignore` and commit**
+
+```bash
+printf '.build/\n.swiftpm/\n*.xcodeproj\n' > .gitignore
+git add Package.swift Sources tests .gitignore
+git commit -m "feat(scaffold): SwiftPM package with core lib, app, and smoke test"
+```
+
+---
+
+### Task 2: Process layer — `CLIRunner` protocol, real runner, and fake
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Process/CLIRunner.swift`
+- Create: `Sources/VPhoneWSCore/Process/SystemCLIRunner.swift`
+- Test: `tests/VPhoneWSCoreTests/CLIRunnerTests.swift`
+- Test helper: `tests/VPhoneWSCoreTests/Support/FakeCLIRunner.swift`
+
+**Interfaces:**
+- Produces:
+ - `struct CLIResult: Sendable { let stdout: String; let stderr: String; let exitCode: Int32 }`
+ - `protocol CLIRunner: Sendable { func run(executable: URL, arguments: [String], environment: [String: String]?) async throws -> CLIResult }`
+ - `struct SystemCLIRunner: CLIRunner` (real, over `Foundation.Process`)
+ - `final class FakeCLIRunner: CLIRunner` (test double: canned results keyed by arguments; records calls)
+
+- [ ] **Step 1: Write the failing test for the fake + protocol**
+
+```swift
+// tests/VPhoneWSCoreTests/CLIRunnerTests.swift
+import Testing
+@testable import VPhoneWSCore
+
+@Test func fakeRunnerReturnsStubbedResultAndRecordsCall() async throws {
+ let fake = FakeCLIRunner()
+ fake.stub(arguments: ["vm", "list", "--json"],
+ result: CLIResult(stdout: "[]", stderr: "", exitCode: 0))
+
+ let out = try await fake.run(
+ executable: URL(fileURLWithPath: "/usr/bin/vphone-cli"),
+ arguments: ["vm", "list", "--json"], environment: nil)
+
+ #expect(out.stdout == "[]")
+ #expect(out.exitCode == 0)
+ #expect(fake.calls.count == 1)
+ #expect(fake.calls[0].arguments == ["vm", "list", "--json"])
+}
+
+@Test func systemRunnerCapturesStdoutAndExitCode() async throws {
+ let runner = SystemCLIRunner()
+ let out = try await runner.run(
+ executable: URL(fileURLWithPath: "/bin/echo"),
+ arguments: ["hello"], environment: nil)
+ #expect(out.stdout.trimmingCharacters(in: .whitespacesAndNewlines) == "hello")
+ #expect(out.exitCode == 0)
+}
+```
+
+- [ ] **Step 2: Write the fake helper**
+
+```swift
+// tests/VPhoneWSCoreTests/Support/FakeCLIRunner.swift
+import Foundation
+@testable import VPhoneWSCore
+
+final class FakeCLIRunner: CLIRunner, @unchecked Sendable {
+ struct Call { let executable: URL; let arguments: [String]; let environment: [String: String]? }
+ private(set) var calls: [Call] = []
+ private var stubs: [[String]: CLIResult] = [:]
+
+ func stub(arguments: [String], result: CLIResult) { stubs[arguments] = result }
+
+ func run(executable: URL, arguments: [String], environment: [String: String]?) async throws -> CLIResult {
+ calls.append(Call(executable: executable, arguments: arguments, environment: environment))
+ guard let result = stubs[arguments] else {
+ return CLIResult(stdout: "", stderr: "no stub for \(arguments)", exitCode: 127)
+ }
+ return result
+ }
+}
+```
+
+- [ ] **Step 3: Run it to verify it fails**
+
+Run: `swift test --filter CLIRunnerTests`
+Expected: FAIL — `CLIResult`/`CLIRunner`/`SystemCLIRunner` undefined.
+
+- [ ] **Step 4: Implement the protocol and system runner**
+
+```swift
+// Sources/VPhoneWSCore/Process/CLIRunner.swift
+import Foundation
+
+public struct CLIResult: Sendable {
+ public let stdout: String
+ public let stderr: String
+ public let exitCode: Int32
+ public var succeeded: Bool { exitCode == 0 }
+ public init(stdout: String, stderr: String, exitCode: Int32) {
+ self.stdout = stdout; self.stderr = stderr; self.exitCode = exitCode
+ }
+}
+
+public protocol CLIRunner: Sendable {
+ func run(executable: URL, arguments: [String], environment: [String: String]?) async throws -> CLIResult
+}
+```
+
+```swift
+// Sources/VPhoneWSCore/Process/SystemCLIRunner.swift
+import Foundation
+
+public struct SystemCLIRunner: CLIRunner {
+ public init() {}
+
+ public func run(executable: URL, arguments: [String], environment: [String: String]?) async throws -> CLIResult {
+ try await withCheckedThrowingContinuation { continuation in
+ let process = Process()
+ process.executableURL = executable
+ process.arguments = arguments
+ if let environment { process.environment = environment }
+ let outPipe = Pipe(); let errPipe = Pipe()
+ process.standardOutput = outPipe
+ process.standardError = errPipe
+ process.terminationHandler = { proc in
+ let outData = outPipe.fileHandleForReading.readDataToEndOfFile()
+ let errData = errPipe.fileHandleForReading.readDataToEndOfFile()
+ continuation.resume(returning: CLIResult(
+ stdout: String(decoding: outData, as: UTF8.self),
+ stderr: String(decoding: errData, as: UTF8.self),
+ exitCode: proc.terminationStatus))
+ }
+ do { try process.run() } catch { continuation.resume(throwing: error) }
+ }
+ }
+}
+```
+
+- [ ] **Step 5: Run to verify green**
+
+Run: `swift test --filter CLIRunnerTests`
+Expected: both tests PASS.
+
+- [ ] **Step 6: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/Process tests/VPhoneWSCoreTests
+git commit -m "feat(process): add CLIRunner protocol, system runner, and test fake"
+```
+
+---
+
+### Task 3: VM report models (Codable)
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Models/VMReport.swift`
+- Test: `tests/VPhoneWSCoreTests/VMReportTests.swift`
+
+**Interfaces:**
+- Produces:
+ - `struct OSVersion: Codable, Equatable, Sendable { let version: String; let build: String }`
+ - `struct RestoreInfo: Codable, Equatable, Sendable { let ios: OSVersion; let cloudOS: OSVersion }`
+ - `struct VMReport: Codable, Equatable, Sendable { let name: String; let cpuCount: Int; let memoryMB: Int; let diskSizeBytes: Int64; let restoreInfo: RestoreInfo? }`
+ - Property names match the CLI's JSON keys exactly, so **no `CodingKeys` needed**.
+
+- [ ] **Step 1: Write the failing test (array + null restoreInfo)**
+
+```swift
+// tests/VPhoneWSCoreTests/VMReportTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+@Test func decodesListWithAndWithoutRestoreInfo() throws {
+ let json = """
+ [
+ {"name":"research-jb","cpuCount":8,"memoryMB":8192,"diskSizeBytes":68719476736,
+ "restoreInfo":{"ios":{"version":"27.0","build":"24A5380h"},
+ "cloudOS":{"version":"26.4","build":"23E5207q"}}},
+ {"name":"blank","cpuCount":8,"memoryMB":8192,"diskSizeBytes":68719476736}
+ ]
+ """
+ let reports = try JSONDecoder().decode([VMReport].self, from: Data(json.utf8))
+ #expect(reports.count == 2)
+ #expect(reports[0].name == "research-jb")
+ #expect(reports[0].restoreInfo?.ios.version == "27.0")
+ #expect(reports[0].restoreInfo?.cloudOS.build == "23E5207q")
+ #expect(reports[1].restoreInfo == nil)
+}
+```
+
+- [ ] **Step 2: Run to verify it fails**
+
+Run: `swift test --filter VMReportTests`
+Expected: FAIL — `VMReport` undefined.
+
+- [ ] **Step 3: Implement the models**
+
+```swift
+// Sources/VPhoneWSCore/Models/VMReport.swift
+public struct OSVersion: Codable, Equatable, Sendable {
+ public let version: String
+ public let build: String
+}
+
+public struct RestoreInfo: Codable, Equatable, Sendable {
+ public let ios: OSVersion
+ public let cloudOS: OSVersion
+}
+
+public struct VMReport: Codable, Equatable, Sendable {
+ public let name: String
+ public let cpuCount: Int
+ public let memoryMB: Int
+ public let diskSizeBytes: Int64
+ public let restoreInfo: RestoreInfo?
+}
+```
+
+- [ ] **Step 4: Run to verify green**
+
+Run: `swift test --filter VMReportTests`
+Expected: PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/Models tests/VPhoneWSCoreTests/VMReportTests.swift
+git commit -m "feat(models): add VMReport/RestoreInfo codable models"
+```
+
+---
+
+### Task 4: Locate the `vphone-cli` binary
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/CLI/VPhoneCLILocator.swift`
+- Test: `tests/VPhoneWSCoreTests/VPhoneCLILocatorTests.swift`
+
+**Interfaces:**
+- Produces:
+ - `enum VPhoneCLILocation: Equatable, Sendable { case found(URL); case notFound }`
+ - `struct VPhoneCLILocator { func locate(explicit: String?, pathLookup: (String) -> URL?) -> VPhoneCLILocation }`
+ - Resolution order: `explicit` path (if it exists as passed) → `pathLookup("vphone-cli")` (injected `which`-style lookup) → `.notFound`.
+
+- [ ] **Step 1: Write the failing test**
+
+```swift
+// tests/VPhoneWSCoreTests/VPhoneCLILocatorTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+@Test func prefersExplicitThenPathThenNotFound() {
+ let loc = VPhoneCLILocator()
+ let explicit = URL(fileURLWithPath: "/opt/custom/vphone-cli")
+
+ // explicit wins when provided
+ #expect(loc.locate(explicit: explicit.path, pathLookup: { _ in nil }) == .found(explicit))
+ // falls back to PATH lookup
+ let onPath = URL(fileURLWithPath: "/opt/homebrew/bin/vphone-cli")
+ #expect(loc.locate(explicit: nil, pathLookup: { $0 == "vphone-cli" ? onPath : nil }) == .found(onPath))
+ // nothing found
+ #expect(loc.locate(explicit: nil, pathLookup: { _ in nil }) == .notFound)
+}
+```
+
+- [ ] **Step 2: Run to verify it fails**
+
+Run: `swift test --filter VPhoneCLILocatorTests`
+Expected: FAIL — types undefined.
+
+- [ ] **Step 3: Implement the locator**
+
+```swift
+// Sources/VPhoneWSCore/CLI/VPhoneCLILocator.swift
+import Foundation
+
+public enum VPhoneCLILocation: Equatable, Sendable {
+ case found(URL)
+ case notFound
+}
+
+public struct VPhoneCLILocator: Sendable {
+ public init() {}
+
+ /// `explicit`: a user-chosen path (Preferences). `pathLookup`: resolves a bare
+ /// tool name on `$PATH` (inject `Self.whichLookup` in production).
+ public func locate(explicit: String?, pathLookup: (String) -> URL?) -> VPhoneCLILocation {
+ if let explicit, !explicit.isEmpty {
+ return .found(URL(fileURLWithPath: explicit))
+ }
+ if let onPath = pathLookup("vphone-cli") {
+ return .found(onPath)
+ }
+ return .notFound
+ }
+
+ /// Production `pathLookup`: run `/usr/bin/which <name>`.
+ public static func whichLookup(_ name: String) -> URL? {
+ let process = Process()
+ process.executableURL = URL(fileURLWithPath: "/usr/bin/which")
+ process.arguments = [name]
+ let pipe = Pipe(); process.standardOutput = pipe
+ guard (try? process.run()) != nil else { return nil }
+ process.waitUntilExit()
+ guard process.terminationStatus == 0 else { return nil }
+ let data = pipe.fileHandleForReading.readDataToEndOfFile()
+ let path = String(decoding: data, as: UTF8.self).trimmingCharacters(in: .whitespacesAndNewlines)
+ return path.isEmpty ? nil : URL(fileURLWithPath: path)
+ }
+}
+```
+
+- [ ] **Step 4: Run to verify green**
+
+Run: `swift test --filter VPhoneCLILocatorTests`
+Expected: PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/CLI/VPhoneCLILocator.swift tests/VPhoneWSCoreTests/VPhoneCLILocatorTests.swift
+git commit -m "feat(cli): add vphone-cli binary locator with injectable PATH lookup"
+```
+
+---
+
+### Task 5: `VPhoneCLIClient` — `list` and `info`
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/CLI/VPhoneCLIClient.swift`
+- Test: `tests/VPhoneWSCoreTests/VPhoneCLIClientTests.swift`
+
+**Interfaces:**
+- Consumes: `CLIRunner`, `CLIResult` (Task 2); `VMReport` (Task 3).
+- Produces:
+ - `enum VPhoneCLIError: Error, Equatable { case nonZeroExit(code: Int32, stderr: String); case decodeFailed(String) }`
+ - `struct VPhoneCLIClient { init(executable: URL, libraryRoot: String?, runner: CLIRunner) }`
+ - `func listVMs() async throws -> [VMReport]` → argv `["vm","list","--json"]` (+ `["--library-root", root]` when set)
+ - `func info(name: String) async throws -> VMReport` → argv `["vm","info", name, "--json"]` (+ library-root)
+ - Both decode stdout; on non-zero exit throw `.nonZeroExit`.
+
+- [ ] **Step 1: Write the failing test (argv assembly + decode + error)**
+
+```swift
+// tests/VPhoneWSCoreTests/VPhoneCLIClientTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+private let exe = URL(fileURLWithPath: "/usr/bin/vphone-cli")
+
+@Test func listAssemblesArgvAndDecodes() async throws {
+ let fake = FakeCLIRunner()
+ fake.stub(arguments: ["vm", "list", "--json", "--library-root", "/lib"],
+ result: CLIResult(stdout: "[{\"name\":\"a\",\"cpuCount\":8,\"memoryMB\":8192,\"diskSizeBytes\":1}]",
+ stderr: "", exitCode: 0))
+ let client = VPhoneCLIClient(executable: exe, libraryRoot: "/lib", runner: fake)
+ let vms = try await client.listVMs()
+ #expect(vms.map(\.name) == ["a"])
+ #expect(fake.calls[0].arguments == ["vm", "list", "--json", "--library-root", "/lib"])
+}
+
+@Test func infoAssemblesArgvWithExplicitName() async throws {
+ let fake = FakeCLIRunner()
+ fake.stub(arguments: ["vm", "info", "a", "--json"],
+ result: CLIResult(stdout: "{\"name\":\"a\",\"cpuCount\":8,\"memoryMB\":8192,\"diskSizeBytes\":1}",
+ stderr: "", exitCode: 0))
+ let client = VPhoneCLIClient(executable: exe, libraryRoot: nil, runner: fake)
+ let vm = try await client.info(name: "a")
+ #expect(vm.name == "a")
+}
+
+@Test func nonZeroExitThrows() async throws {
+ let fake = FakeCLIRunner()
+ fake.stub(arguments: ["vm", "list", "--json"],
+ result: CLIResult(stdout: "", stderr: "boom", exitCode: 1))
+ let client = VPhoneCLIClient(executable: exe, libraryRoot: nil, runner: fake)
+ await #expect(throws: VPhoneCLIError.nonZeroExit(code: 1, stderr: "boom")) {
+ _ = try await client.listVMs()
+ }
+}
+```
+
+- [ ] **Step 2: Run to verify it fails**
+
+Run: `swift test --filter VPhoneCLIClientTests`
+Expected: FAIL — `VPhoneCLIClient`/`VPhoneCLIError` undefined.
+
+- [ ] **Step 3: Implement the client**
+
+```swift
+// Sources/VPhoneWSCore/CLI/VPhoneCLIClient.swift
+import Foundation
+
+public enum VPhoneCLIError: Error, Equatable {
+ case nonZeroExit(code: Int32, stderr: String)
+ case decodeFailed(String)
+}
+
+public struct VPhoneCLIClient: Sendable {
+ let executable: URL
+ let libraryRoot: String?
+ let runner: CLIRunner
+
+ public init(executable: URL, libraryRoot: String?, runner: CLIRunner) {
+ self.executable = executable
+ self.libraryRoot = libraryRoot
+ self.runner = runner
+ }
+
+ // MARK: - Read
+
+ public func listVMs() async throws -> [VMReport] {
+ let data = try await runJSON(["vm", "list", "--json"])
+ return try decode([VMReport].self, from: data)
+ }
+
+ public func info(name: String) async throws -> VMReport {
+ let data = try await runJSON(["vm", "info", name, "--json"])
+ return try decode(VMReport.self, from: data)
+ }
+
+ // MARK: - Plumbing
+
+ private func runJSON(_ base: [String]) async throws -> Data {
+ var argv = base
+ if let libraryRoot { argv += ["--library-root", libraryRoot] }
+ let result = try await runner.run(executable: executable, arguments: argv, environment: nil)
+ guard result.succeeded else {
+ throw VPhoneCLIError.nonZeroExit(code: result.exitCode, stderr: result.stderr)
+ }
+ return Data(result.stdout.utf8)
+ }
+
+ private func decode<T: Decodable>(_ type: T.Type, from data: Data) throws -> T {
+ do { return try JSONDecoder().decode(type, from: data) }
+ catch { throw VPhoneCLIError.decodeFailed(String(describing: error)) }
+ }
+}
+```
+
+- [ ] **Step 4: Run to verify green**
+
+Run: `swift test --filter VPhoneCLIClientTests`
+Expected: all three PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/CLI/VPhoneCLIClient.swift tests/VPhoneWSCoreTests/VPhoneCLIClientTests.swift
+git commit -m "feat(cli): add VPhoneCLIClient list/info with json decode"
+```
+
+---
+
+### Task 6: Running-state probe (`lsof`)
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/State/RunningStateProbe.swift`
+- Test: `tests/VPhoneWSCoreTests/RunningStateProbeTests.swift`
+
+**Interfaces:**
+- Consumes: `CLIRunner`, `CLIResult` (Task 2).
+- Produces:
+ - `static func parsePIDs(_ stdout: String) -> [Int32]` (one PID per line; ignores blanks/garbage)
+ - `struct RunningStateProbe { init(runner: CLIRunner); func isRunning(diskImagePath: String) async throws -> Bool }`
+ - argv: `["-t", "--", diskImagePath]` against `/usr/sbin/lsof`; running iff parsed PIDs non-empty. A non-zero exit from `lsof` (no holders) is treated as **not running**, not an error.
+
+- [ ] **Step 1: Write the failing test**
+
+```swift
+// tests/VPhoneWSCoreTests/RunningStateProbeTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+@Test func parsePIDsIgnoresBlankLines() {
+ #expect(RunningStateProbe.parsePIDs("123\n456\n") == [123, 456])
+ #expect(RunningStateProbe.parsePIDs("") == [])
+ #expect(RunningStateProbe.parsePIDs("\n \n789\n") == [789])
+}
+
+@Test func isRunningReflectsPIDPresence() async throws {
+ let disk = "/Users/me/.vphone/VMs/a/Disk.img"
+ let fake = FakeCLIRunner()
+ fake.stub(arguments: ["-t", "--", disk], result: CLIResult(stdout: "4242\n", stderr: "", exitCode: 0))
+ let probe = RunningStateProbe(runner: fake)
+ #expect(try await probe.isRunning(diskImagePath: disk) == true)
+}
+
+@Test func isRunningFalseWhenLsofNonZeroWithNoHolders() async throws {
+ let disk = "/Users/me/.vphone/VMs/b/Disk.img"
+ let fake = FakeCLIRunner()
+ fake.stub(arguments: ["-t", "--", disk], result: CLIResult(stdout: "", stderr: "", exitCode: 1))
+ let probe = RunningStateProbe(runner: fake)
+ #expect(try await probe.isRunning(diskImagePath: disk) == false)
+}
+```
+
+- [ ] **Step 2: Run to verify it fails**
+
+Run: `swift test --filter RunningStateProbeTests`
+Expected: FAIL — `RunningStateProbe` undefined.
+
+- [ ] **Step 3: Implement the probe**
+
+```swift
+// Sources/VPhoneWSCore/State/RunningStateProbe.swift
+import Foundation
+
+public struct RunningStateProbe: Sendable {
+ static let lsof = URL(fileURLWithPath: "/usr/sbin/lsof")
+ let runner: CLIRunner
+
+ public init(runner: CLIRunner) { self.runner = runner }
+
+ public static func parsePIDs(_ stdout: String) -> [Int32] {
+ stdout.split(whereSeparator: \.isNewline)
+ .compactMap { Int32($0.trimmingCharacters(in: .whitespaces)) }
+ }
+
+ /// A VM is running iff some process holds its Disk.img open. `lsof -t` exits
+ /// non-zero when nothing matches — that means "not running", not an error.
+ public func isRunning(diskImagePath: String) async throws -> Bool {
+ let result = try await runner.run(
+ executable: Self.lsof, arguments: ["-t", "--", diskImagePath], environment: nil)
+ return !Self.parsePIDs(result.stdout).isEmpty
+ }
+}
+```
+
+- [ ] **Step 4: Run to verify green**
+
+Run: `swift test --filter RunningStateProbeTests`
+Expected: PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/State tests/VPhoneWSCoreTests/RunningStateProbeTests.swift
+git commit -m "feat(state): add lsof-based running-state probe"
+```
+
+---
+
+### Task 7: `VMStore` — observable library state
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Store/VMRow.swift`
+- Create: `Sources/VPhoneWSCore/Store/VMStore.swift`
+- Test: `tests/VPhoneWSCoreTests/VMStoreTests.swift`
+
+**Interfaces:**
+- Consumes: `VPhoneCLIClient` (Task 5), `RunningStateProbe` (Task 6), `VMReport` (Task 3).
+- Produces:
+ - `struct VMRow: Identifiable, Equatable, Sendable { let report: VMReport; var isRunning: Bool; var id: String { report.name } }` with display helpers `var displayVersions: String` (`"iOS 27.0 · cloudOS 26.4"` or `"—"`).
+ - `@MainActor @Observable final class VMStore` with `init(client:probe:libraryRoot:)`, `var rows: [VMRow]`, `var loadError: String?`, and `func refresh() async`.
+ - `refresh()` calls `client.listVMs()`, then for each report probes `isRunning(diskImagePath: libraryRoot + "/" + name + "/Disk.img")`, and publishes `rows`. On client error it sets `loadError` and leaves `rows` unchanged.
+
+- [ ] **Step 1: Write the failing test for VMRow display**
+
+```swift
+// tests/VPhoneWSCoreTests/VMStoreTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+private func report(_ name: String, restore: RestoreInfo? = nil) -> VMReport {
+ VMReport(name: name, cpuCount: 8, memoryMB: 8192, diskSizeBytes: 1, restoreInfo: restore)
+}
+
+@Test func rowDisplaysVersionsOrDash() {
+ let ri = RestoreInfo(ios: .init(version: "27.0", build: "24A5380h"),
+ cloudOS: .init(version: "26.4", build: "23E5207q"))
+ #expect(VMRow(report: report("a", restore: ri), isRunning: true).displayVersions == "iOS 27.0 · cloudOS 26.4")
+ #expect(VMRow(report: report("b"), isRunning: false).displayVersions == "—")
+}
+
+@MainActor
+@Test func refreshPopulatesRowsWithRunningState() async throws {
+ let listJSON = "[{\"name\":\"a\",\"cpuCount\":8,\"memoryMB\":8192,\"diskSizeBytes\":1}," +
+ "{\"name\":\"b\",\"cpuCount\":8,\"memoryMB\":8192,\"diskSizeBytes\":1}]"
+ let fake = FakeCLIRunner()
+ let exe = URL(fileURLWithPath: "/usr/bin/vphone-cli")
+ fake.stub(arguments: ["vm", "list", "--json", "--library-root", "/lib"],
+ result: CLIResult(stdout: listJSON, stderr: "", exitCode: 0))
+ fake.stub(arguments: ["-t", "--", "/lib/a/Disk.img"], result: CLIResult(stdout: "999\n", stderr: "", exitCode: 0))
+ fake.stub(arguments: ["-t", "--", "/lib/b/Disk.img"], result: CLIResult(stdout: "", stderr: "", exitCode: 1))
+
+ let client = VPhoneCLIClient(executable: exe, libraryRoot: "/lib", runner: fake)
+ let store = VMStore(client: client, probe: RunningStateProbe(runner: fake), libraryRoot: "/lib")
+ await store.refresh()
+
+ #expect(store.rows.map(\.report.name) == ["a", "b"])
+ #expect(store.rows.first(where: { $0.report.name == "a" })?.isRunning == true)
+ #expect(store.rows.first(where: { $0.report.name == "b" })?.isRunning == false)
+ #expect(store.loadError == nil)
+}
+```
+
+- [ ] **Step 2: Run to verify it fails**
+
+Run: `swift test --filter VMStoreTests`
+Expected: FAIL — `VMRow`/`VMStore` undefined.
+
+- [ ] **Step 3: Implement `VMRow`**
+
+```swift
+// Sources/VPhoneWSCore/Store/VMRow.swift
+public struct VMRow: Identifiable, Equatable, Sendable {
+ public let report: VMReport
+ public var isRunning: Bool
+ public var id: String { report.name }
+
+ public init(report: VMReport, isRunning: Bool) {
+ self.report = report; self.isRunning = isRunning
+ }
+
+ public var displayVersions: String {
+ guard let ri = report.restoreInfo else { return "—" }
+ return "iOS \(ri.ios.version) · cloudOS \(ri.cloudOS.version)"
+ }
+}
+```
+
+- [ ] **Step 4: Implement `VMStore`**
+
+```swift
+// Sources/VPhoneWSCore/Store/VMStore.swift
+import Foundation
+import Observation
+
+@MainActor
+@Observable
+public final class VMStore {
+ public private(set) var rows: [VMRow] = []
+ public private(set) var loadError: String?
+
+ private let client: VPhoneCLIClient
+ private let probe: RunningStateProbe
+ private let libraryRoot: String
+
+ public init(client: VPhoneCLIClient, probe: RunningStateProbe, libraryRoot: String) {
+ self.client = client; self.probe = probe; self.libraryRoot = libraryRoot
+ }
+
+ public func refresh() async {
+ do {
+ let reports = try await client.listVMs()
+ var next: [VMRow] = []
+ for report in reports {
+ let disk = "\(libraryRoot)/\(report.name)/Disk.img"
+ let running = (try? await probe.isRunning(diskImagePath: disk)) ?? false
+ next.append(VMRow(report: report, isRunning: running))
+ }
+ rows = next
+ loadError = nil
+ } catch {
+ loadError = String(describing: error)
+ }
+ }
+}
+```
+
+- [ ] **Step 5: Run to verify green**
+
+Run: `swift test --filter VMStoreTests`
+Expected: both PASS.
+
+- [ ] **Step 6: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/Store tests/VPhoneWSCoreTests/VMStoreTests.swift
+git commit -m "feat(store): add VMStore with running-state enrichment"
+```
+
+---
+
+### Task 8: Library UI — sidebar list + detail Overview (read-only)
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Store/AppEnvironment.swift`
+- Modify: `Sources/vphone-ws/App.swift`
+- Create: `Sources/vphone-ws/Views/LibraryView.swift`
+- Create: `Sources/vphone-ws/Views/VMDetailView.swift`
+
+**Interfaces:**
+- Consumes: `VMStore`, `VMRow`, `VPhoneCLIClient`, `VPhoneCLILocator`, `RunningStateProbe`, `SystemCLIRunner`.
+- Produces: `@MainActor func makeVMStore() -> VMStore?` (wires the real runner/locator/library root; returns `nil` when `vphone-cli` isn't found so the UI can show a setup message).
+
+This task is UI; verify by running the app against your real `~/.vphone/VMs`, not by unit test.
+
+- [ ] **Step 1: Add the production wiring helper**
+
+```swift
+// Sources/VPhoneWSCore/Store/AppEnvironment.swift
+import Foundation
+
+public enum AppEnvironment {
+ /// Default library root: $VPHONE_LIBRARY_ROOT or ~/.vphone/VMs.
+ public static func defaultLibraryRoot() -> String {
+ if let override = ProcessInfo.processInfo.environment["VPHONE_LIBRARY_ROOT"], !override.isEmpty {
+ return override
+ }
+ return NSHomeDirectory() + "/.vphone/VMs"
+ }
+
+ /// Build a store against the real vphone-cli, or nil if the binary isn't found.
+ @MainActor
+ public static func makeVMStore(explicitCLIPath: String? = nil) -> VMStore? {
+ let location = VPhoneCLILocator().locate(explicit: explicitCLIPath, pathLookup: VPhoneCLILocator.whichLookup)
+ guard case .found(let exe) = location else { return nil }
+ let runner = SystemCLIRunner()
+ let root = defaultLibraryRoot()
+ let client = VPhoneCLIClient(executable: exe, libraryRoot: root, runner: runner)
+ return VMStore(client: client, probe: RunningStateProbe(runner: runner), libraryRoot: root)
+ }
+}
+```
+
+- [ ] **Step 2: Replace `App.swift` with a store-backed root**
+
+```swift
+// Sources/vphone-ws/App.swift
+import SwiftUI
+import VPhoneWSCore
+
+@main
+struct VPhoneWSApp: App {
+ var body: some Scene {
+ WindowGroup("vphone Workstation") {
+ RootView()
+ .frame(minWidth: 940, minHeight: 640)
+ }
+ }
+}
+
+struct RootView: View {
+ @State private var store = AppEnvironment.makeVMStore()
+
+ var body: some View {
+ if let store {
+ LibraryView(store: store)
+ } else {
+ ContentUnavailableView(
+ "vphone-cli not found",
+ systemImage: "terminal",
+ description: Text("Install vphone-cli (e.g. `brew install zqxwce/tap/vphone-cli`) or set its path in Preferences."))
+ }
+ }
+}
+```
+
+- [ ] **Step 3: Implement `LibraryView` (sidebar + selection)**
+
+```swift
+// Sources/vphone-ws/Views/LibraryView.swift
+import SwiftUI
+import VPhoneWSCore
+
+struct LibraryView: View {
+ @Bindable var store: VMStore
+ @State private var selection: String?
+ @State private var query = ""
+
+ private var filtered: [VMRow] {
+ query.isEmpty ? store.rows
+ : store.rows.filter { $0.report.name.localizedCaseInsensitiveContains(query) }
+ }
+
+ var body: some View {
+ NavigationSplitView {
+ List(filtered, selection: $selection) { row in
+ HStack(spacing: 10) {
+ Circle()
+ .fill(row.isRunning ? Color.green : Color.secondary.opacity(0.5))
+ .frame(width: 8, height: 8)
+ VStack(alignment: .leading, spacing: 2) {
+ Text(row.report.name).fontWeight(.medium)
+ Text(row.displayVersions)
+ .font(.caption).monospaced().foregroundStyle(.secondary)
+ }
+ }
+ .tag(row.report.name)
+ }
+ .searchable(text: $query, placement: .sidebar)
+ .navigationTitle("VMs")
+ } detail: {
+ if let name = selection, let row = store.rows.first(where: { $0.report.name == name }) {
+ VMDetailView(row: row)
+ } else {
+ Text("Select a VM").foregroundStyle(.secondary)
+ }
+ }
+ .task { await store.refresh() }
+ .refreshable { await store.refresh() }
+ .overlay(alignment: .bottom) {
+ if let err = store.loadError {
+ Text(err).font(.caption).padding(6)
+ .background(.red.opacity(0.15)).clipShape(.rect(cornerRadius: 6)).padding()
+ }
+ }
+ }
+}
+```
+
+- [ ] **Step 4: Implement `VMDetailView` (Overview grid)**
+
+```swift
+// Sources/vphone-ws/Views/VMDetailView.swift
+import SwiftUI
+import VPhoneWSCore
+
+struct VMDetailView: View {
+ let row: VMRow
+
+ private var specs: [(String, String)] {
+ let r = row.report
+ return [
+ ("iOS", r.restoreInfo.map { "\($0.ios.version) (\($0.ios.build))" } ?? "—"),
+ ("cloudOS", r.restoreInfo.map { "\($0.cloudOS.version) (\($0.cloudOS.build))" } ?? "—"),
+ ("CPU", "\(r.cpuCount) cores"),
+ ("Memory", "\(r.memoryMB) MB"),
+ ("Disk", "\(r.diskSizeBytes / 1_073_741_824) GB"),
+ ]
+ }
+
+ var body: some View {
+ ScrollView {
+ VStack(alignment: .leading, spacing: 20) {
+ HStack(spacing: 10) {
+ Text(row.report.name).font(.largeTitle.bold())
+ Text(row.isRunning ? "Running" : "Stopped")
+ .font(.caption).fontWeight(.semibold)
+ .padding(.horizontal, 10).padding(.vertical, 4)
+ .background(row.isRunning ? .green.opacity(0.18) : .secondary.opacity(0.15))
+ .clipShape(.capsule)
+ }
+ LazyVGrid(columns: [GridItem(.adaptive(minimum: 150), spacing: 1)], spacing: 1) {
+ ForEach(specs, id: \.0) { key, value in
+ VStack(alignment: .leading, spacing: 4) {
+ Text(key.uppercased()).font(.caption2).foregroundStyle(.secondary)
+ Text(value).fontWeight(.medium)
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(12)
+ .background(.quaternary.opacity(0.4))
+ }
+ }
+ .clipShape(.rect(cornerRadius: 8))
+ Spacer()
+ }
+ .padding(24)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+ }
+}
+```
+
+- [ ] **Step 5: Build and verify against real VMs (manual)**
+
+Run: `swift build && swift run vphone-ws`
+Expected: the window lists the VMs under `~/.vphone/VMs`, each with a green/gray status dot and `iOS … · cloudOS …` subtitle; selecting one shows the Overview with a Running/Stopped pill. Start a VM from the terminal (`vphone-cli vm launch <name>`) and confirm the dot turns green within a refresh (pull-to-refresh or relaunch).
+
+- [ ] **Step 6: Commit**
+
+```bash
+git add Sources
+git commit -m "feat(ui): read-only library view with sidebar status and detail overview"
+```
+
+---
+
+### Task 9: `.app` bundle for a real windowed app
+
+**Files:**
+- Create: `Resources/Info.plist`
+- Create: `scripts/bundle.sh`
+
+**Interfaces:**
+- Produces: `scripts/bundle.sh` building `.build/vphone-ws.app` from the release binary. No entitlements or signing needed (the app holds none; it only spawns `vphone-cli`).
+
+- [ ] **Step 1: Write `Info.plist`**
+
+```xml
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleName</key><string>vphone Workstation</string>
+ <key>CFBundleIdentifier</key><string>com.vphone.ws</string>
+ <key>CFBundleExecutable</key><string>vphone-ws</string>
+ <key>CFBundlePackageType</key><string>APPL</string>
+ <key>CFBundleShortVersionString</key><string>0.1.0</string>
+ <key>CFBundleVersion</key><string>1</string>
+ <key>LSMinimumSystemVersion</key><string>15.0</string>
+ <key>NSHighResolutionCapable</key><true/>
+</dict>
+</plist>
+```
+
+- [ ] **Step 2: Write `scripts/bundle.sh`**
+
+```bash
+#!/bin/zsh
+set -euo pipefail
+cd "${0:a:h}/.."
+swift build -c release
+APP=".build/vphone-ws.app"
+rm -rf "$APP"
+mkdir -p "$APP/Contents/MacOS"
+cp Resources/Info.plist "$APP/Contents/Info.plist"
+cp .build/release/vphone-ws "$APP/Contents/MacOS/vphone-ws"
+echo "built $APP"
+```
+
+- [ ] **Step 3: Build the bundle and launch it (manual)**
+
+Run: `chmod +x scripts/bundle.sh && ./scripts/bundle.sh && open .build/vphone-ws.app`
+Expected: the app opens as a normal Dock app (icon, menu bar) and shows the library.
+
+- [ ] **Step 4: Commit**
+
+```bash
+git add Resources scripts/bundle.sh
+git commit -m "build: add .app bundling script and Info.plist"
+```
+
+---
+
+## Self-Review
+
+**Spec coverage (Plan 1 slice of the design spec §3–§6.1):**
+- Service layer `VPhoneCLIClient` → Tasks 4–5. `VMStore` → Task 7. Process abstraction (extensibility seam) → Task 2. ✓
+- Binary discovery, invoke-in-place, explicit-name rule → Tasks 4–5, 8. ✓
+- Data model: `restoreInfo` iOS+cloudOS from JSON, no plist parsing → Tasks 3, 5. ✓
+- Running state via `lsof` on `Disk.img` → Task 6, wired in Task 7. ✓
+- Main window: sidebar (name, status dot, `iOS · cloudOS` subtitle, search), detail Overview → Task 8. ✓
+- Deferred to later plans (correctly out of Plan 1): Start/Stop/Show-screen & LaunchCoordinator, Settings, clone/rename/delete/export/import, create wizard, task console, host readiness, variant sidecar. Tracked in Plans 2–3.
+
+**Placeholder scan:** none — every step has runnable code/commands.
+
+**Type consistency:** `CLIRunner.run(executable:arguments:environment:)` used identically in Tasks 2/5/6/7; `CLIResult(stdout:stderr:exitCode:)` consistent; `VMReport`/`RestoreInfo`/`OSVersion` field names match the CLI JSON keys and are reused unchanged in Tasks 5/7/8; `VMStore(client:probe:libraryRoot:)` and `VMRow(report:isRunning:)` signatures match between definition (Task 7) and use (Task 8). ✓
+
+**Note on `--library-root`:** the client always appends `--library-root <root>` when set; the store computes `Disk.img` paths from that same root, so list output and probe target stay consistent even under `$VPHONE_LIBRARY_ROOT`.
diff --git a/docs/superpowers/plans/2026-08-02-vphone-ws-lifecycle.md b/docs/superpowers/plans/2026-08-02-vphone-ws-lifecycle.md
new file mode 100644
index 0000000..949c927
--- /dev/null
+++ b/docs/superpowers/plans/2026-08-02-vphone-ws-lifecycle.md
@@ -0,0 +1,697 @@
+# vphone-ws — Plan 2: Lifecycle & Management
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Make the library actionable — start/stop a VM (handing the display to `vphone-cli`), edit its settings, clone/rename/delete it, and check host readiness — building on Plan 1's foundation.
+
+**Architecture:** A `ProcessLauncher` spawns the long-running `vphone-cli vm launch` as a tracked detached child (distinct from Plan 1's capture-to-completion `CLIRunner`). A `LaunchCoordinator` owns launch/stop/show-screen. `VPhoneCLIClient` gains the fast management verbs (config/clone/rename/delete). `HostReadiness` runs prerequisite checks. SwiftUI gains actions, a Settings sheet, and a readiness panel.
+
+**Tech Stack:** Swift 6, SwiftPM, SwiftUI, swift-testing. No third-party dependencies. macOS 15+.
+
+## Global Constraints
+
+- All constraints from Plan 1 apply verbatim (macOS 15+, Swift 6 strict concurrency, no `vphone-cli` source dependency, lowercase `tests/`, explicit VM names, commit convention).
+- Non-interactive CLI rules that this plan depends on: `vm delete` **must** pass `--force`; `vm rename` and `vm clone` **must** pass both names; `vm config` accepts `--cpu`, `--memory`, and (once the CLI supports it) `--network`.
+- `vm config --network` persists the mode but has **no runtime effect** until the VZ backend honors it (main still hardcodes NAT) — the Settings UI must not imply an immediate boot change.
+- Running/stopped truth is always the `lsof` probe from Plan 1 — never assume a spawned launch succeeded; let the next `VMStore.refresh()` confirm.
+
+## File Structure
+
+- `Sources/VPhoneWSCore/Process/ProcessLauncher.swift` — detached spawn protocol + system impl.
+- `Sources/VPhoneWSCore/Lifecycle/LaunchCoordinator.swift` — launch/stop/show-screen.
+- `Sources/VPhoneWSCore/CLI/VPhoneCLIClient+Manage.swift` — config/clone/rename/delete verbs.
+- `Sources/VPhoneWSCore/Host/HostCheck.swift` + `HostReadiness.swift` — readiness model + checks.
+- `Sources/vphone-ws/Views/VMDetailView.swift` (modify) — Start/Stop/Show/Settings actions.
+- `Sources/vphone-ws/Views/SettingsSheet.swift`, `HostReadinessSheet.swift` — new sheets.
+
+---
+
+### Task 1: `ProcessLauncher` — detached child spawn
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Process/ProcessLauncher.swift`
+- Test: `tests/VPhoneWSCoreTests/ProcessLauncherTests.swift`
+- Test helper: `tests/VPhoneWSCoreTests/Support/FakeProcessLauncher.swift`
+
+**Interfaces:**
+- Produces:
+ - `struct LaunchedProcess: Sendable { let pid: Int32 }`
+ - `protocol ProcessLauncher: Sendable { func launch(executable: URL, arguments: [String], environment: [String: String]?) throws -> LaunchedProcess }`
+ - `struct SystemProcessLauncher: ProcessLauncher` — spawns via `Foundation.Process`, returns immediately (does **not** wait), returns the child pid.
+ - `final class FakeProcessLauncher: ProcessLauncher` — records calls, returns a stub pid.
+
+- [ ] **Step 1: Write the failing test**
+
+```swift
+// tests/VPhoneWSCoreTests/ProcessLauncherTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+@Test func fakeLauncherRecordsAndReturnsPID() throws {
+ let fake = FakeProcessLauncher(stubPID: 4242)
+ let p = try fake.launch(executable: URL(fileURLWithPath: "/x"), arguments: ["vm", "launch", "a"], environment: nil)
+ #expect(p.pid == 4242)
+ #expect(fake.calls.count == 1)
+ #expect(fake.calls[0].arguments == ["vm", "launch", "a"])
+}
+
+@Test func systemLauncherStartsProcessWithoutWaiting() throws {
+ let launcher = SystemProcessLauncher()
+ // `/bin/sleep 5` returns a live pid immediately; we don't wait for it.
+ let p = try launcher.launch(executable: URL(fileURLWithPath: "/bin/sleep"), arguments: ["5"], environment: nil)
+ #expect(p.pid > 0)
+ kill(p.pid, SIGTERM) // clean up
+}
+```
+
+- [ ] **Step 2: Write the fake helper**
+
+```swift
+// tests/VPhoneWSCoreTests/Support/FakeProcessLauncher.swift
+import Foundation
+@testable import VPhoneWSCore
+
+final class FakeProcessLauncher: ProcessLauncher, @unchecked Sendable {
+ struct Call { let executable: URL; let arguments: [String]; let environment: [String: String]? }
+ private(set) var calls: [Call] = []
+ let stubPID: Int32
+ init(stubPID: Int32 = 1) { self.stubPID = stubPID }
+
+ func launch(executable: URL, arguments: [String], environment: [String: String]?) throws -> LaunchedProcess {
+ calls.append(Call(executable: executable, arguments: arguments, environment: environment))
+ return LaunchedProcess(pid: stubPID)
+ }
+}
+```
+
+- [ ] **Step 3: Run to verify it fails**
+
+Run: `swift test --filter ProcessLauncherTests`
+Expected: FAIL — types undefined.
+
+- [ ] **Step 4: Implement**
+
+```swift
+// Sources/VPhoneWSCore/Process/ProcessLauncher.swift
+import Foundation
+
+public struct LaunchedProcess: Sendable { public let pid: Int32 }
+
+public protocol ProcessLauncher: Sendable {
+ func launch(executable: URL, arguments: [String], environment: [String: String]?) throws -> LaunchedProcess
+}
+
+public struct SystemProcessLauncher: ProcessLauncher {
+ public init() {}
+ public func launch(executable: URL, arguments: [String], environment: [String: String]?) throws -> LaunchedProcess {
+ let process = Process()
+ process.executableURL = executable
+ process.arguments = arguments
+ if let environment { process.environment = environment }
+ try process.run() // returns immediately; we do not waitUntilExit
+ return LaunchedProcess(pid: process.processIdentifier)
+ }
+}
+```
+
+- [ ] **Step 5: Run to verify green**
+
+Run: `swift test --filter ProcessLauncherTests`
+Expected: PASS.
+
+- [ ] **Step 6: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/Process/ProcessLauncher.swift tests/VPhoneWSCoreTests/ProcessLauncherTests.swift tests/VPhoneWSCoreTests/Support/FakeProcessLauncher.swift
+git commit -m "feat(process): add detached ProcessLauncher and fake"
+```
+
+---
+
+### Task 2: `LaunchCoordinator` — launch / stop / show-screen
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Lifecycle/LaunchCoordinator.swift`
+- Test: `tests/VPhoneWSCoreTests/LaunchCoordinatorTests.swift`
+
+**Interfaces:**
+- Consumes: `ProcessLauncher` (Task 1), `VPhoneCLIClient` (Plan 1).
+- Produces:
+ - `@MainActor final class LaunchCoordinator` with `init(executable: URL, libraryRoot: String?, launcher: ProcessLauncher, client: VPhoneCLIClient)`.
+ - `func launch(name: String) throws` → spawns `vphone-cli vm launch <name>` (+ `--library-root` when set); records pid in `runningPIDs[name]`.
+ - `func stop(name: String) async throws` → runs `vphone-cli vm stop <name>` via the client's runner; clears `runningPIDs[name]`.
+ - `func showScreen(name: String)` → best-effort raise: `NSRunningApplication(processIdentifier:)?.activate()` for the recorded pid.
+ - `var runningPIDs: [String: Int32]` (for show-screen + tests).
+
+- [ ] **Step 1: Write the failing test (argv assembly for launch & stop)**
+
+```swift
+// tests/VPhoneWSCoreTests/LaunchCoordinatorTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+private let exe = URL(fileURLWithPath: "/usr/bin/vphone-cli")
+
+@MainActor
+@Test func launchSpawnsWithExplicitNameAndLibraryRoot() throws {
+ let launcher = FakeProcessLauncher(stubPID: 77)
+ let client = VPhoneCLIClient(executable: exe, libraryRoot: "/lib", runner: FakeCLIRunner())
+ let coord = LaunchCoordinator(executable: exe, libraryRoot: "/lib", launcher: launcher, client: client)
+ try coord.launch(name: "a")
+ #expect(launcher.calls[0].arguments == ["vm", "launch", "a", "--library-root", "/lib"])
+ #expect(coord.runningPIDs["a"] == 77)
+}
+
+@MainActor
+@Test func stopRunsVmStopAndClearsPID() async throws {
+ let runner = FakeCLIRunner()
+ runner.stub(arguments: ["vm", "stop", "a", "--library-root", "/lib"],
+ result: CLIResult(stdout: "a: stopped", stderr: "", exitCode: 0))
+ let client = VPhoneCLIClient(executable: exe, libraryRoot: "/lib", runner: runner)
+ let coord = LaunchCoordinator(executable: exe, libraryRoot: "/lib", launcher: FakeProcessLauncher(), client: client)
+ coord.runningPIDs["a"] = 5
+ try await coord.stop(name: "a")
+ #expect(runner.calls.contains { $0.arguments == ["vm", "stop", "a", "--library-root", "/lib"] })
+ #expect(coord.runningPIDs["a"] == nil)
+}
+```
+
+- [ ] **Step 2: Add a `stop` verb to the client** (needed by the coordinator)
+
+Add to `Sources/VPhoneWSCore/CLI/VPhoneCLIClient.swift`:
+
+```swift
+ /// `vm stop <name>` — quick, returns human text; we only care about exit status.
+ public func stop(name: String) async throws {
+ _ = try await runText(["vm", "stop", name])
+ }
+
+ /// Run a subcommand that prints human text (not JSON); throw on non-zero exit.
+ @discardableResult
+ func runText(_ base: [String]) async throws -> String {
+ var argv = base
+ if let libraryRoot { argv += ["--library-root", libraryRoot] }
+ let result = try await runner.run(executable: executable, arguments: argv, environment: nil)
+ guard result.succeeded else { throw VPhoneCLIError.nonZeroExit(code: result.exitCode, stderr: result.stderr) }
+ return result.stdout
+ }
+```
+
+- [ ] **Step 3: Run to verify it fails**
+
+Run: `swift test --filter LaunchCoordinatorTests`
+Expected: FAIL — `LaunchCoordinator` undefined.
+
+- [ ] **Step 4: Implement the coordinator**
+
+```swift
+// Sources/VPhoneWSCore/Lifecycle/LaunchCoordinator.swift
+import Foundation
+import AppKit
+
+@MainActor
+public final class LaunchCoordinator {
+ public private(set) var runningPIDs: [String: Int32] = [:]
+
+ private let executable: URL
+ private let libraryRoot: String?
+ private let launcher: ProcessLauncher
+ private let client: VPhoneCLIClient
+
+ public init(executable: URL, libraryRoot: String?, launcher: ProcessLauncher, client: VPhoneCLIClient) {
+ self.executable = executable; self.libraryRoot = libraryRoot
+ self.launcher = launcher; self.client = client
+ }
+
+ public func launch(name: String) throws {
+ var argv = ["vm", "launch", name]
+ if let libraryRoot { argv += ["--library-root", libraryRoot] }
+ let p = try launcher.launch(executable: executable, arguments: argv, environment: nil)
+ runningPIDs[name] = p.pid
+ }
+
+ public func stop(name: String) async throws {
+ try await client.stop(name: name)
+ runningPIDs[name] = nil
+ }
+
+ /// Best-effort: bring the vphone-cli VM window forward.
+ public func showScreen(name: String) {
+ guard let pid = runningPIDs[name],
+ let app = NSRunningApplication(processIdentifier: pid) else { return }
+ app.activate(options: [.activateAllWindows])
+ }
+}
+```
+
+- [ ] **Step 5: Run to verify green**
+
+Run: `swift test --filter LaunchCoordinatorTests`
+Expected: PASS.
+
+- [ ] **Step 6: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/Lifecycle Sources/VPhoneWSCore/CLI/VPhoneCLIClient.swift tests/VPhoneWSCoreTests/LaunchCoordinatorTests.swift
+git commit -m "feat(lifecycle): add LaunchCoordinator for launch/stop/show-screen"
+```
+
+---
+
+### Task 3: Management verbs — config / clone / rename / delete
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/CLI/VPhoneCLIClient+Manage.swift`
+- Test: `tests/VPhoneWSCoreTests/VPhoneCLIClientManageTests.swift`
+
+**Interfaces:**
+- Consumes: `VPhoneCLIClient` (Plan 1).
+- Produces (extension methods on `VPhoneCLIClient`):
+ - `func setConfig(name: String, cpu: Int?, memoryMB: Int?, network: String?) async throws` → `vm config <name>` + `--cpu`/`--memory`/`--network` for each non-nil.
+ - `func clone(name: String, to newName: String) async throws` → `vm clone <name> <newName>`.
+ - `func rename(name: String, to newName: String) async throws` → `vm rename <name> <newName>`.
+ - `func delete(name: String) async throws` → `vm delete <name> --force`.
+
+- [ ] **Step 1: Write the failing tests (argv assembly)**
+
+```swift
+// tests/VPhoneWSCoreTests/VPhoneCLIClientManageTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+private let exe = URL(fileURLWithPath: "/usr/bin/vphone-cli")
+
+private func client(_ runner: FakeCLIRunner) -> VPhoneCLIClient {
+ VPhoneCLIClient(executable: exe, libraryRoot: nil, runner: runner)
+}
+
+@Test func setConfigOnlyIncludesGivenFields() async throws {
+ let r = FakeCLIRunner()
+ r.stub(arguments: ["vm", "config", "a", "--cpu", "6", "--network", "bridged"],
+ result: CLIResult(stdout: "updated", stderr: "", exitCode: 0))
+ try await client(r).setConfig(name: "a", cpu: 6, memoryMB: nil, network: "bridged")
+ #expect(r.calls[0].arguments == ["vm", "config", "a", "--cpu", "6", "--network", "bridged"])
+}
+
+@Test func deletePassesForce() async throws {
+ let r = FakeCLIRunner()
+ r.stub(arguments: ["vm", "delete", "a", "--force"], result: CLIResult(stdout: "deleted a", stderr: "", exitCode: 0))
+ try await client(r).delete(name: "a")
+ #expect(r.calls[0].arguments == ["vm", "delete", "a", "--force"])
+}
+
+@Test func cloneAndRenamePassBothNames() async throws {
+ let r = FakeCLIRunner()
+ r.stub(arguments: ["vm", "clone", "a", "b"], result: CLIResult(stdout: "cloned", stderr: "", exitCode: 0))
+ r.stub(arguments: ["vm", "rename", "b", "c"], result: CLIResult(stdout: "renamed", stderr: "", exitCode: 0))
+ try await client(r).clone(name: "a", to: "b")
+ try await client(r).rename(name: "b", to: "c")
+ #expect(r.calls.map(\.arguments) == [["vm","clone","a","b"], ["vm","rename","b","c"]])
+}
+```
+
+- [ ] **Step 2: Run to verify it fails**
+
+Run: `swift test --filter VPhoneCLIClientManageTests`
+Expected: FAIL — methods undefined.
+
+- [ ] **Step 3: Implement the extension**
+
+```swift
+// Sources/VPhoneWSCore/CLI/VPhoneCLIClient+Manage.swift
+import Foundation
+
+extension VPhoneCLIClient {
+ public func setConfig(name: String, cpu: Int?, memoryMB: Int?, network: String?) async throws {
+ var argv = ["vm", "config", name]
+ if let cpu { argv += ["--cpu", String(cpu)] }
+ if let memoryMB { argv += ["--memory", String(memoryMB)] }
+ if let network { argv += ["--network", network] }
+ _ = try await runText(argv)
+ }
+
+ public func clone(name: String, to newName: String) async throws {
+ _ = try await runText(["vm", "clone", name, newName])
+ }
+
+ public func rename(name: String, to newName: String) async throws {
+ _ = try await runText(["vm", "rename", name, newName])
+ }
+
+ public func delete(name: String) async throws {
+ _ = try await runText(["vm", "delete", name, "--force"])
+ }
+}
+```
+
+Note: `runText` was made accessible in Plan 2 Task 2; if it is still `private`, relax it to internal (`func runText`) so this extension in the same module can call it.
+
+- [ ] **Step 4: Run to verify green**
+
+Run: `swift test --filter VPhoneCLIClientManageTests`
+Expected: all PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/CLI/VPhoneCLIClient+Manage.swift tests/VPhoneWSCoreTests/VPhoneCLIClientManageTests.swift
+git commit -m "feat(cli): add config/clone/rename/delete management verbs"
+```
+
+---
+
+### Task 4: Host readiness checks
+
+**Files:**
+- Create: `Sources/VPhoneWSCore/Host/HostCheck.swift`
+- Create: `Sources/VPhoneWSCore/Host/HostReadiness.swift`
+- Test: `tests/VPhoneWSCoreTests/HostReadinessTests.swift`
+
+**Interfaces:**
+- Consumes: `CLIRunner` (Plan 1), `VPhoneCLILocator` (Plan 1).
+- Produces:
+ - `enum CheckStatus: Equatable, Sendable { case ok; case attention }`
+ - `struct HostCheck: Identifiable, Equatable, Sendable { let id: String; let title: String; let status: CheckStatus; let detail: String; let fixCommand: String? }`
+ - Pure evaluators (each takes raw command output, returns a `HostCheck`) — the testable core:
+ - `static func evalNestedVM(hvVmmPresent stdout: String) -> HostCheck` — `kern.hv_vmm_present` sysctl value; `0` ⇒ ok, else attention.
+ - `static func evalMacOS(version: OperatingSystemVersion) -> HostCheck` — major ≥ 15 ⇒ ok.
+ - `static func evalAMFIDont(pgrepOutput stdout: String) -> HostCheck` — non-empty pid list ⇒ ok, else attention with the start command.
+ - `static func evalCLI(_ location: VPhoneCLILocation) -> HostCheck`.
+ - `struct HostReadiness { init(runner: CLIRunner); func runAll() async -> [HostCheck] }` (wires the evaluators to real `sysctl`/`pgrep`/version calls).
+
+- [ ] **Step 1: Write the failing tests for the pure evaluators**
+
+```swift
+// tests/VPhoneWSCoreTests/HostReadinessTests.swift
+import Testing
+import Foundation
+@testable import VPhoneWSCore
+
+@Test func nestedVMEvaluator() {
+ #expect(HostReadiness.evalNestedVM(hvVmmPresent: "0\n").status == .ok)
+ #expect(HostReadiness.evalNestedVM(hvVmmPresent: "1\n").status == .attention)
+}
+
+@Test func macOSEvaluator() {
+ #expect(HostReadiness.evalMacOS(version: .init(majorVersion: 15, minorVersion: 2, patchVersion: 0)).status == .ok)
+ #expect(HostReadiness.evalMacOS(version: .init(majorVersion: 14, minorVersion: 6, patchVersion: 0)).status == .attention)
+}
+
+@Test func amfidontEvaluator() {
+ #expect(HostReadiness.evalAMFIDont(pgrepOutput: "532\n").status == .ok)
+ let miss = HostReadiness.evalAMFIDont(pgrepOutput: "")
+ #expect(miss.status == .attention)
+ #expect(miss.fixCommand != nil)
+}
+
+@Test func cliEvaluator() {
+ #expect(HostReadiness.evalCLI(.found(URL(fileURLWithPath: "/opt/homebrew/bin/vphone-cli"))).status == .ok)
+ #expect(HostReadiness.evalCLI(.notFound).status == .attention)
+}
+```
+
+- [ ] **Step 2: Run to verify it fails**
+
+Run: `swift test --filter HostReadinessTests`
+Expected: FAIL — types undefined.
+
+- [ ] **Step 3: Implement the check model + evaluators**
+
+```swift
+// Sources/VPhoneWSCore/Host/HostCheck.swift
+public enum CheckStatus: Equatable, Sendable { case ok, attention }
+
+public struct HostCheck: Identifiable, Equatable, Sendable {
+ public let id: String
+ public let title: String
+ public let status: CheckStatus
+ public let detail: String
+ public let fixCommand: String?
+ public init(id: String, title: String, status: CheckStatus, detail: String, fixCommand: String? = nil) {
+ self.id = id; self.title = title; self.status = status; self.detail = detail; self.fixCommand = fixCommand
+ }
+}
+```
+
+```swift
+// Sources/VPhoneWSCore/Host/HostReadiness.swift
+import Foundation
+
+public struct HostReadiness: Sendable {
+ let runner: CLIRunner
+ public init(runner: CLIRunner) { self.runner = runner }
+
+ // MARK: - Pure evaluators
+
+ public static func evalNestedVM(hvVmmPresent stdout: String) -> HostCheck {
+ let nested = stdout.trimmingCharacters(in: .whitespacesAndNewlines) != "0"
+ return HostCheck(id: "nested", title: "Not running inside a VM",
+ status: nested ? .attention : .ok,
+ detail: nested ? "kern.hv_vmm_present = 1 — nested PV=3 guests can't boot."
+ : "kern.hv_vmm_present = 0 — good.")
+ }
+
+ public static func evalMacOS(version: OperatingSystemVersion) -> HostCheck {
+ let ok = version.majorVersion >= 15
+ return HostCheck(id: "macos", title: "macOS 15 or newer",
+ status: ok ? .ok : .attention,
+ detail: "macOS \(version.majorVersion).\(version.minorVersion)")
+ }
+
+ public static func evalAMFIDont(pgrepOutput stdout: String) -> HostCheck {
+ let running = !stdout.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
+ return HostCheck(id: "amfidont", title: "AMFI allowlist (amfidont) is running",
+ status: running ? .ok : .attention,
+ detail: running ? "amfidont is active." :
+ "Not running — the signed VM binary is killed on launch without it. It must stay running.",
+ fixCommand: running ? nil : "vphone-amfidont")
+ }
+
+ public static func evalCLI(_ location: VPhoneCLILocation) -> HostCheck {
+ if case .found(let url) = location {
+ return HostCheck(id: "cli", title: "vphone-cli found", status: .ok, detail: url.path)
+ }
+ return HostCheck(id: "cli", title: "vphone-cli found", status: .attention,
+ detail: "Not on PATH.", fixCommand: "brew install zqxwce/tap/vphone-cli")
+ }
+
+ // MARK: - Live runner
+
+ public func runAll() async -> [HostCheck] {
+ async let hv = sysctl("kern.hv_vmm_present")
+ async let amfi = pgrep("amfidont")
+ let cliLoc = VPhoneCLILocator().locate(explicit: nil, pathLookup: VPhoneCLILocator.whichLookup)
+ return [
+ Self.evalCLI(cliLoc),
+ Self.evalMacOS(version: ProcessInfo.processInfo.operatingSystemVersion),
+ Self.evalNestedVM(hvVmmPresent: await hv),
+ Self.evalAMFIDont(pgrepOutput: await amfi),
+ ]
+ }
+
+ private func sysctl(_ key: String) async -> String {
+ (try? await runner.run(executable: URL(fileURLWithPath: "/usr/sbin/sysctl"),
+ arguments: ["-n", key], environment: nil))?.stdout ?? ""
+ }
+
+ private func pgrep(_ name: String) async -> String {
+ (try? await runner.run(executable: URL(fileURLWithPath: "/usr/bin/pgrep"),
+ arguments: ["-x", name], environment: nil))?.stdout ?? ""
+ }
+}
+```
+
+- [ ] **Step 4: Run to verify green**
+
+Run: `swift test --filter HostReadinessTests`
+Expected: PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add Sources/VPhoneWSCore/Host tests/VPhoneWSCoreTests/HostReadinessTests.swift
+git commit -m "feat(host): add host-readiness checks with pure evaluators"
+```
+
+---
+
+### Task 5: Wire actions into the app (Start/Stop/Show/Settings/Clone/Rename/Delete + Readiness)
+
+**Files:**
+- Modify: `Sources/VPhoneWSCore/Store/AppEnvironment.swift`
+- Modify: `Sources/vphone-ws/Views/VMDetailView.swift`
+- Create: `Sources/vphone-ws/Views/SettingsSheet.swift`
+- Create: `Sources/vphone-ws/Views/HostReadinessSheet.swift`
+- Modify: `Sources/vphone-ws/Views/LibraryView.swift`
+
+This task is UI; verify by running the app. Actions call the store/coordinator/client built above.
+
+- [ ] **Step 1: Extend `AppEnvironment` to also build a coordinator + readiness**
+
+Add to `AppEnvironment` (return them alongside the store; expose the resolved `executable`, `libraryRoot`, and `runner` so the app can build a `LaunchCoordinator`, run `setConfig`, and run `HostReadiness`):
+
+```swift
+ public struct Services {
+ public let store: VMStore
+ public let coordinator: LaunchCoordinator
+ public let client: VPhoneCLIClient
+ public let readiness: HostReadiness
+ }
+
+ @MainActor
+ public static func makeServices(explicitCLIPath: String? = nil) -> Services? {
+ let location = VPhoneCLILocator().locate(explicit: explicitCLIPath, pathLookup: VPhoneCLILocator.whichLookup)
+ guard case .found(let exe) = location else { return nil }
+ let runner = SystemCLIRunner()
+ let root = defaultLibraryRoot()
+ let client = VPhoneCLIClient(executable: exe, libraryRoot: root, runner: runner)
+ return Services(
+ store: VMStore(client: client, probe: RunningStateProbe(runner: runner), libraryRoot: root),
+ coordinator: LaunchCoordinator(executable: exe, libraryRoot: root,
+ launcher: SystemProcessLauncher(), client: client),
+ client: client,
+ readiness: HostReadiness(runner: runner))
+ }
+```
+
+Update `RootView` in `App.swift` to build `Services` once (`@State private var services = AppEnvironment.makeServices()`) and pass `services` into `LibraryView`.
+
+- [ ] **Step 2: Add Start/Stop/Show + Settings/Clone/Delete to `VMDetailView`**
+
+Give `VMDetailView` the `Services` and add a toolbar/header action row:
+
+```swift
+// action row (inside VMDetailView.body header HStack)
+if row.isRunning {
+ Button("Stop", role: .destructive) { Task { try? await services.coordinator.stop(name: row.report.name); await services.store.refresh() } }
+ Button("Show screen") { services.coordinator.showScreen(name: row.report.name) }
+} else {
+ Button("Start") { try? services.coordinator.launch(name: row.report.name); Task { await services.store.refresh() } }
+}
+Button("Settings") { showSettings = true }
+Menu("More") {
+ Button("Clone…") { cloneTarget = row.report.name }
+ Button("Delete…", role: .destructive) { confirmDelete = true }
+}
+```
+
+Add `@State` flags (`showSettings`, `confirmDelete`, `cloneTarget`) and a `.confirmationDialog` for delete that calls `services.client.delete(name:)` then `store.refresh()`. Clone prompts for a new name (a small `.alert` with a `TextField`) then calls `services.client.clone(name:to:)`.
+
+- [ ] **Step 3: Implement `SettingsSheet`**
+
+```swift
+// Sources/vphone-ws/Views/SettingsSheet.swift
+import SwiftUI
+import VPhoneWSCore
+
+struct SettingsSheet: View {
+ let row: VMRow
+ let services: AppEnvironment.Services
+ @Environment(\.dismiss) private var dismiss
+ @State private var cpu: Double
+ @State private var memory: Double
+ @State private var network: String
+
+ init(row: VMRow, services: AppEnvironment.Services) {
+ self.row = row; self.services = services
+ _cpu = State(initialValue: Double(row.report.cpuCount))
+ _memory = State(initialValue: Double(row.report.memoryMB))
+ _network = State(initialValue: "nat")
+ }
+
+ var body: some View {
+ Form {
+ Stepper("CPU cores: \(Int(cpu))", value: $cpu, in: 1...32)
+ Stepper("Memory: \(Int(memory)) MB", value: $memory, in: 1024...65536, step: 1024)
+ Picker("Network", selection: $network) {
+ ForEach(["nat", "bridged", "hostOnly", "none"], id: \.self) { Text($0) }
+ }
+ Text("Applies on next boot; the VM must be stopped.")
+ .font(.caption).foregroundStyle(.secondary)
+ }
+ .padding()
+ .frame(width: 380)
+ .toolbar {
+ ToolbarItem(placement: .confirmationAction) {
+ Button("Save") {
+ Task {
+ try? await services.client.setConfig(
+ name: row.report.name, cpu: Int(cpu), memoryMB: Int(memory), network: network)
+ await services.store.refresh(); dismiss()
+ }
+ }
+ .disabled(row.isRunning)
+ }
+ ToolbarItem(placement: .cancellationAction) { Button("Cancel") { dismiss() } }
+ }
+ }
+}
+```
+
+- [ ] **Step 4: Implement `HostReadinessSheet` + toolbar pill**
+
+```swift
+// Sources/vphone-ws/Views/HostReadinessSheet.swift
+import SwiftUI
+import VPhoneWSCore
+
+struct HostReadinessSheet: View {
+ let readiness: HostReadiness
+ @State private var checks: [HostCheck] = []
+
+ var body: some View {
+ List(checks) { check in
+ HStack(alignment: .top, spacing: 12) {
+ Image(systemName: check.status == .ok ? "checkmark.circle.fill" : "exclamationmark.triangle.fill")
+ .foregroundStyle(check.status == .ok ? .green : .orange)
+ VStack(alignment: .leading, spacing: 3) {
+ Text(check.title).fontWeight(.semibold)
+ Text(check.detail).font(.callout).foregroundStyle(.secondary)
+ if let fix = check.fixCommand {
+ Text(fix).font(.caption).monospaced()
+ .textSelection(.enabled).padding(4)
+ .background(.quaternary).clipShape(.rect(cornerRadius: 4))
+ }
+ }
+ }.padding(.vertical, 4)
+ }
+ .frame(width: 520, height: 360)
+ .task { checks = await readiness.runAll() }
+ }
+}
+```
+
+Add a toolbar item to `LibraryView` showing a pill ("Host ready" / "N need attention") that opens this sheet. Compute the summary by running `readiness.runAll()` on appear.
+
+- [ ] **Step 5: Build and verify (manual)**
+
+Run: `swift run vphone-ws`
+Expected: selecting a stopped VM shows **Start**; clicking it launches vphone-cli's window and the dot goes green on refresh. **Stop** stops it. **Settings** opens the sheet (disabled Save while running); saving CPU/memory persists (confirm via `vphone-cli vm info <name>`). **Clone/Delete** work. The toolbar host pill opens the readiness sheet with live checks.
+
+- [ ] **Step 6: Commit**
+
+```bash
+git add Sources
+git commit -m "feat(ui): wire start/stop/show, settings, clone/delete, and host readiness"
+```
+
+---
+
+## Self-Review
+
+**Spec coverage (design spec §6.2, §6.5, §7 lifecycle/management):**
+- Launch handoff (spawn `vm launch`, show-screen) + Stop → Tasks 1–2, 5. ✓
+- Settings edits CPU/memory/network via `vm config`, disabled while running, "next boot" wording, no-runtime-effect caveat → Tasks 3, 5. ✓
+- Clone/Rename/Delete with explicit names + `--force` → Tasks 3, 5. ✓
+- Host readiness (nested VM, macOS, amfidont, cli-found) with fix commands → Tasks 4–5. ✓
+- Running truth stays `lsof`-based (refresh after every action) → Task 5 wiring. ✓
+- Deferred to Plan 3 (correct): create wizard, task console, export/import (long-running, share the streaming engine), variant sidecar.
+
+**Placeholder scan:** none — every step has runnable code/commands.
+
+**Type consistency:** `VPhoneCLIClient` extended consistently (`runText` relaxed to internal in Task 2, reused in Task 3); `LaunchCoordinator(executable:libraryRoot:launcher:client:)` matches definition/use; `AppEnvironment.Services` fields (`store/coordinator/client/readiness`) referenced identically in Task 5 views; `HostCheck`/`CheckStatus` consistent between Task 4 and the sheet in Task 5.
+
+**Rename UI note:** `rename` verb exists (Task 3) but the Plan-2 UI exposes Clone/Delete/Settings in the More menu; wiring a Rename dialog is a trivial repeat of the Clone dialog and is included in Task 5 Step 2's More menu — add a `Button("Rename…")` mirroring Clone, calling `services.client.rename(name:to:)`.
diff --git a/docs/superpowers/specs/2026-07-30-vphone-ws-design.md b/docs/superpowers/specs/2026-07-30-vphone-ws-design.md
new file mode 100644
index 0000000..acb6cc3
--- /dev/null
+++ b/docs/superpowers/specs/2026-07-30-vphone-ws-design.md
@@ -0,0 +1,233 @@
+# vphone Workstation (`vphone-ws`) — Design Spec
+
+**Status:** Approved design, pre-implementation
+**Date:** 2026-07-30
+**Grounded on:** `vphone-cli` `main @ 966bddb` ("setup: Record iOS + cloudOS versions on restore")
+**Location:** `~/dev/vphone-ws` (standalone repo; independent of `vphone-cli`)
+
+---
+
+## 1. Summary
+
+`vphone-ws` ("vphone Workstation") is a native macOS GUI for managing virtual iPhones, in the spirit of UTM / VirtualBox / VMware Workstation but purpose-built for the `vphone-cli` toolchain. It is a **separate, standalone SwiftUI macOS app** that drives everything by shelling out to the existing `vphone-cli` binary. It performs no virtualization itself and therefore needs **none** of the private entitlements `vphone-cli` requires.
+
+The product goal: a **user-friendly, non-threatening** manager for an audience (security researchers) used to a terminal-adjacent workflow — approachable on the surface, precise underneath.
+
+### Goals
+- One window to see every VM, its live status, and its details.
+- Start / stop VMs; the live iPhone screen opens in `vphone-cli`'s own window.
+- Create a VM end-to-end through a guided wizard over the full `vm create` pipeline.
+- Edit the settings the VM config supports (CPU, memory, network).
+- Clone / rename / delete / export / import VMs.
+- Guide the user through host prerequisites so launches don't fail cryptically.
+
+### Non-goals (v1) — see §12
+Embedding the iPhone screen in-app; snapshots; disk resize; in-app device control (tap/type/screenshot).
+
+---
+
+## 2. Key constraints (why the architecture is what it is)
+
+These are verified facts about `vphone-cli` on `main @ 966bddb`; the design follows from them.
+
+1. **The VM, its vsock channel, and its display are owned by one process.** `vphone-cli`'s boot process creates the `VZVirtualMachine`, binds it to a `VZVirtualMachineView`, and opens the vsock control channel — all in-process (`VPhoneAppDelegate.swift:76-96`, `VPhoneWindowController.swift:27-33`). Virtualization.framework can only render a VM living in the same process. **Consequence:** `vphone-ws` cannot render the iPhone screen; it launches `vphone-cli`, which opens its own window. This is also what keeps `vphone-ws` entitlement-free.
+
+2. **Entitlements attach to the `vphone-cli` binary and are validated per-exec.** When `vphone-ws` spawns `vphone-cli`, the child is the signed, entitled process that calls Virtualization.framework; the GUI never holds VZ handles and needs no special signing to *launch* it. Entitlements do not propagate across `exec`.
+
+3. **The VM library is a flat directory model.** VMs live at `~/.vphone/VMs/<name>/` (override `$VPHONE_LIBRARY_ROOT`); a directory is a VM iff it contains `config.plist` (`VPhoneLibrary.swift:44-65`).
+
+4. **`vm list --json` / `vm info --json` are the machine-readable contract.** They emit a `VPhoneBundleReport`: `name`, `cpuCount`, `memoryMB`, `diskSizeBytes`, and (as of `966bddb`) `restoreInfo` (`VPhoneBundleReport.swift:5-16`).
+
+5. **Running/stopped state is not in the JSON.** It is derived by checking who holds the disk image open: `lsof -t -- <bundle>/Disk.img` (non-empty ⇒ running), exactly as `vm stop` does (`VPhoneVMLaunchCLI.swift:106-110`).
+
+6. **iOS + cloudOS versions are persisted; the patch variant is not.** `restore-info.json` at the bundle root records both OS versions and survives `export`; but no field anywhere records the variant (regular/dev/jb/exp/less) — it is a transient `-V` flag only (see §5.3).
+
+7. **Several CLI commands are long-running and/or privileged**, and some default to interactive prompts that hard-fail off a TTY (§5.4, §7). The GUI must always pass explicit names and non-interactive flags.
+
+---
+
+## 3. Architecture
+
+`vphone-ws` is a thin, decoupled GUI over the `vphone-cli` **contract** (its JSON output, exit codes, and documented subcommands). It does **not** link `vphone-cli`'s Swift code (`VPhoneCore`), so a `vphone-cli` internal refactor cannot break the GUI as long as the contract holds.
+
+```
+SwiftUI views ──bound to──▶ Observable models ──use──▶ Services ──exec──▶ vphone-cli
+ (VMStore, …) (CLIClient, TaskEngine, …)
+```
+
+### Service layer
+
+| Service | Responsibility |
+|---|---|
+| `VPhoneCLIClient` | Locate and invoke the `vphone-cli` binary. One typed async method per subcommand. Decodes `--json`. Always passes explicit names + non-interactive flags. |
+| `VMStore` (`@Observable`) | The library: VM list from `vm list --json`, enriched with live running-state (batched `lsof`) and variant (app sidecar). Polls on a timer. |
+| `TaskEngine` / `TaskConsole` | Runs long/privileged commands as tracked child `Process`es. Streams output, parses stage banners, supports cancel, reports success/failure from exit code. |
+| `HostReadiness` | Runs prerequisite checks; maps failures to friendly fix cards. |
+| `LaunchCoordinator` | Start/stop/show-window lifecycle; keeps UI state in sync with `lsof` truth. |
+| `VariantStore` | App-owned sidecar recording the variant a VM was created/patched with (since the CLI doesn't persist it). |
+
+Each service has one job and a clean seam. `VPhoneCLIClient` and `TaskEngine` are the extensibility points: new CLI verbs become new typed methods or new task types without touching the views.
+
+---
+
+## 4. Binary discovery & invocation
+
+- **Locate** `vphone-cli` via, in order: a user-set path (Preferences), `which vphone-cli` / `$PATH` (Homebrew symlink), then a bundle chosen by the user (`…/vphone-cli.app/Contents/MacOS/vphone-cli`).
+- **Invoke in place.** Never copy the bare binary out of its bundle — it self-locates its bundled `Contents/Resources/scripts`, `vphoned.signed`, and tools from its own executable path (`VPhoneResources.swift:19-48`). A copied binary loses those.
+- **Not found / wrong version** → a friendly setup card (part of Host Readiness, §6.5), not a crash.
+- All invocations pass `--library-root` explicitly when the user has chosen a non-default library, and always pass explicit VM **names** (never rely on the interactive picker, which throws off a TTY — `VPhoneVMSelection.swift`).
+
+---
+
+## 5. Data model
+
+### 5.1 VM record (from `vm list --json` → `VPhoneBundleReport`)
+```
+name: String
+cpuCount: Int
+memoryMB: Int
+diskSizeBytes: Int64
+restoreInfo: { ios: {version, build}, cloudOS: {version, build} }? // may be null
+```
+
+### 5.2 Running state (computed, not from JSON)
+Batched `lsof -t -- <bundle>/Disk.img` across all VMs on a ~2s timer while the window is active; a VM is **Running** iff its disk image has an open holder. Correct even for VMs started outside the app.
+
+### 5.3 Versions vs. variant
+- **iOS + cloudOS**: read directly from `restoreInfo`. No plist parsing in `vphone-ws` — the CLI already reads `restore-info.json` (or back-derives from the restore plists) and the file survives `export`. This replaces any reliance on the `*_Restore/` folder.
+- **Variant**: not persisted by the CLI. `VariantStore` records the variant when the **wizard** creates/patches a VM, in an app-owned sidecar (e.g. `~/.vphone/VMs/<name>/.vphone-ws.json`, or an app-scoped store keyed by VM identity). VMs created outside `vphone-ws` display variant **"Unknown."** If upstream later adds `variant` to `restore-info.json`, `VMStore` should prefer that and the sidecar becomes redundant.
+
+### 5.4 Non-interactive invocation rules (contract compliance)
+- Always pass explicit `<name>` (picker throws off a TTY).
+- `vm delete` → `--force` (else it prompts on stdout).
+- `vm rename` / `vm clone` → pass **both** names.
+- Prefer `--json` on `list`/`info`.
+- Long/streamed commands: capture stdout+stderr; success/failure from the child **exit code** (propagated via `ExitCode`), not log scraping.
+
+---
+
+## 6. UI specification
+
+Five surfaces. Visual mockup accompanies this spec (screen gallery). Design language in §10.
+
+### 6.1 Main window — the library
+- **Sidebar:** searchable VM list. Each row: iPhone glyph, name, a status dot (green running / gray stopped), and a mono subtitle `iOS <v> · cloudOS <v>`. Footer "New VM…".
+- **Detail pane:** selected VM's name + status pill + bundle path; a primary action (**Start** when stopped / **Stop** when running) plus **Show screen**, **Settings**, **Clone**, and an overflow (Rename, Export, Show in Finder, Delete).
+- A one-line callout explains that the iPhone screen opens in its own window (sets expectations; prevents hunting for an embedded display).
+- A single **Overview** box: iOS, cloudOS, Variant, CPU, Memory, Disk, Network, Device, UDID.
+- **Toolbar:** New VM; Start/Stop; a **Host status pill** ("Host ready" / "N items need attention") opening Host Readiness (§6.5).
+
+### 6.2 VM settings (sheet)
+- **Editable:** CPU cores, Memory, Network mode (NAT / Bridged / Host-only / None).
+- **Read-only ("Fixed at build time"):** Disk size, Display (native panel resolution), Device model.
+- Editable only while the VM is **stopped**; changes take effect on next boot (the VZ config is assembled fresh each launch). Save writes via `vphone-cli vm config` — the app never edits `config.plist` directly.
+- **Graceful degradation:** if the installed `vphone-cli` lacks `vm config --network` (§9), the Network control is shown disabled with a tooltip ("requires a newer vphone-cli"), while CPU/memory remain editable.
+
+### 6.3 Create-VM wizard (sheet)
+Four steps: **Name → iOS & variant → Resources → Review & create**.
+- **Name:** validated (non-empty, no `/`, no leading `.` — `VPhoneBundleOps.requireValidName`); rejects an existing bundle name up front.
+- **iOS & variant:** variant cards (less/regular/dev/jb/exp) with plain-language descriptions and a security-level meter; two source fields — **iOS (userland)** → `--iphone-source`, **cloudOS (kernel)** → `--cloudos-source` — each offering "download version X" or "choose an .ipsw".
+- **Resources:** CPU / memory / disk size (create-only; `vm new` defaults 8 / 8192 / 64).
+- **Review:** states plainly that it downloads multi-GB IPSWs, will ask for **authentication once** (native dialog, §8), and takes several minutes. Blocks early on a nested-VM host (`kern.hv_vmm_present == 1`), matching the CLI's own guard.
+- **Create** hands off to the Task console running `vphone-cli vm create <name> -V <variant> --iphone-source … --cloudos-source … --elevate gui` and records the chosen variant in `VariantStore`.
+
+### 6.4 Task console
+- One panel for all long/privileged operations (create, restore, cfw install, fw prepare, export, import).
+- Per task: title, status pill, elapsed time, **stage chips** parsed from the CLI's `=== … ===` banners (`VPhoneCreateOrchestrator.swift`), a live terminal log (raw stream, `[*]/[+]/[-]/[!]` markers colorized), and **Cancel** (forwards `SIGINT` to the child; the CLI already handles it).
+- Success/failure from the child's exit code.
+- Recently-finished tasks collapse to a one-line summary.
+
+### 6.5 Host readiness (sheet)
+Front-runs the prerequisites that otherwise cause a cryptic `zsh: killed`. Checks, each with a plain-English explanation and a one-click action or exact command:
+- Apple Silicon + macOS 15+.
+- Not running inside a VM (`sysctl kern.hv_vmm_present == 0`).
+- SIP relaxed for research guests (`csrutil` / `allow-research-guests`).
+- AMFI relaxed **and amfidont running** — with the explicit note that amfidont is a daemon that must **stay running** (never kill it).
+- `vphone-cli` found (+ version).
+
+Checks reuse the CLI's own `boot_host_preflight.sh` where possible, plus direct `sysctl`/`csrutil` reads, so app and CLI never disagree about bootability.
+
+---
+
+## 7. Interaction flows
+
+- **Launch (handoff):** Start → spawn `vphone-cli vm launch <name>` as a tracked child. `vphone-cli` runs its preflight gate, then opens the iPhone in its own window. The `lsof` poll flips the VM to Running. **Show screen** brings that window forward.
+- **Stop:** `vphone-cli vm stop <name>` (SIGINT → wait `--timeout` → SIGKILL). Poll flips to Stopped. Quitting the VM window directly is detected by the same poll.
+- **Create / Restore / CFW / Prepare / Export / Import:** run through the Task console (§6.4). `create` and `cfw install` are privileged (§8).
+- **Clone / Rename / Delete:** map 1:1 to CLI subcommands with explicit names; Delete confirms in-GUI then calls `--force`.
+
+---
+
+## 8. Privilege / elevation model (native authentication)
+
+The one privileged step is the CFW host-mount (`mount_apfs` + `chown 0:0`) inside `cfw_install_host.sh`, reached by `vm create` and `cfw install`.
+
+**Requirement:** authenticate through **macOS's native authentication dialog** (the standard "wants to make changes" system prompt, Touch ID where available). The password must never be typed into `vphone-ws`, placed on any command line, or written to a log.
+
+**Why this is not the existing `--sudo-password`:** that value sits in `vphone-cli`'s argv, readable by any user via `ps`. The current askpass path (`sudo -A` + `SUDO_ASKPASS` + `SUDO_PASSWORD` env — `VPhoneCreateOrchestrator.swift:174-286`) keeps it off *sudo's* argv but still requires the app to hold the password. The native dialog avoids a password entirely.
+
+**Mechanism:** the native dialog is driven by macOS **Authorization Services**, which runs the privileged command **as root itself** and returns no password — so it **replaces** sudo for that step rather than feeding it. `vphone-ws` invokes `vphone-cli … --elevate gui` (§9) and never handles a credential.
+
+- **Live output** is preserved by redirecting the elevated step to a log file that `vphone-ws` tails into the Task console (Authorization Services / `osascript` returns output only on completion; the exit status still propagates).
+- **Ownership restore:** with no `sudo`, there is no `SUDO_USER`; the elevated step must be told the invoking user another way so `cfw_install_host.sh:96-99` can `chown -R` artifacts back (§9).
+
+Heavier alternative (documented, not chosen): an **SMAppService** privileged XPC helper — canonical, streams over XPC, but needs Developer-ID signing/notarization of app + helper. Overkill for v1 in a SIP-relaxed research context; possible v2 upgrade.
+
+---
+
+## 9. Required `vphone-cli` changes (interface contract)
+
+These are **prerequisites in the `vphone-cli` repo**, to be implemented in a **separate session** (this session stays on `vphone-ws`). Documented here as the contract `vphone-ws` codes against; `vphone-ws` degrades gracefully when they are absent.
+
+### 9.1 `--elevate gui` on `vm create` and `cfw install`
+- When set, the CFW host-mount step is elevated via macOS Authorization Services (e.g. `osascript -e 'do shell script "…" with administrator privileges'`) instead of `sudo -A`; shows the native auth dialog; runs the script as root.
+- Mutually exclusive with `--sudo-password`; needs no password.
+- Because there is no `SUDO_USER`, pass the invoking user to the elevated script (env var e.g. `VPHONE_OWNER`, or an arg) so its ownership-restore (`cfw_install_host.sh:96-99`) still runs.
+- Redirect the elevated step's stdout/stderr to a caller-readable log file (the caller tails it); propagate the real exit status.
+
+### 9.2 `vm config --network <nat|bridged|hostOnly|none>` — IMPLEMENTED
+- Updates `networkConfig.mode` in `config.plist` via `VPhoneBundleOps.updateConfig`.
+- A companion `--mac <addr>` was attempted but **removed**: setting a custom MAC broke VM networking. **`--mac` does not currently exist** and is deferred until a fix is found — so vphone-ws Settings edits network *mode* only, never the MAC.
+- The mode persists but has **no runtime effect at boot** until the bridged-networking VZ backend (branch `pr388-rework`, not yet merged to `main`) lands — `main` still hardcodes NAT.
+
+Graceful degradation: both `--root-popup` (§9.1) and `vm config --network` are implemented in `vphone-cli`; if a user has an older build lacking either, vphone-ws surfaces a clear message and disables the dependent control ("requires a newer vphone-cli").
+
+---
+
+## 10. Design language
+
+Inherits the vphone toolchain's flat, precise, dark-neutral identity (per `vphone-cli` `CLAUDE.md` Design System), softened for approachability.
+
+- **Color:** cool near-black ground (`#101216`) biased toward the accent; flat surfaces, 1px borders. One accent — systemBlue (`#5b9bff` dark / `#2f6fe0` light). Semantic status kept **separate** from the accent: green (running/ready), amber (attention), red (critical). Full light + dark themes.
+- **Type:** SF Pro (`-apple-system`) for UI and copy — friendly, native; SF Mono reserved for logs, paths, and technical values — the research-instrument texture. The pairing is the thesis: friendly face, technical soul.
+- **Voice:** plain-English status before technical detail; every privileged/destructive/slow step is explained, never silent; errors say what went wrong and how to fix it.
+
+---
+
+## 11. Error handling & edge cases
+- **Nested-VM host:** block create/launch with an explanation (mirrors CLI's `kern.hv_vmm_present` guard).
+- **Name collision:** wizard validates before running `vm create`.
+- **amfidont not running / killed mid-session:** Host Readiness surfaces it; never offer to kill it.
+- **`vphone-cli` missing / too old:** setup card; disable dependent controls with tooltips.
+- **Malformed bundle:** the CLI reports skipped bundles on stderr (`vm list`); surface these as a non-blocking notice rather than dropping them silently.
+- **Interactive prompt hazards:** avoided by the §5.4 rules; if a command unexpectedly blocks on stdin, the task times out with a clear message.
+
+---
+
+## 12. Out of scope (v1) & roadmap
+- **Embedding the iPhone screen** — impossible without major `vphone-cli` changes (in-process VZ binding). The `vphone.sock` control channel (`~/.vphone/VMs/<name>/vphone.sock`; tap/type/screenshot) is the future door if in-app control is ever wanted; `vphone-mcp` already covers that use case.
+- **Snapshots** — no CLI support.
+- **Disk resize** — create-only; not `vm config`-editable.
+- **In-app device control** (location sim, file browser, IPA install, battery, keys) — these live in `vphone-cli`'s own VM window today.
+
+---
+
+## 13. Testing strategy
+- **Service unit tests:** JSON decoding of `vm list/info --json` (incl. null `restoreInfo`), `lsof` output parsing, stage-banner parsing, variant-sidecar round-trip — all with fixtures, no live VMs.
+- **CLIClient contract tests:** assert exact argv assembled per action (explicit names, `--force`, `--json`, `--elevate gui`), using a fake runner.
+- **Manual / device-verified:** launch handoff, create pipeline end-to-end, native auth dialog, Settings write-through, Host Readiness against a mis-configured host.
+
+---
+
+## 14. Open questions
+None blocking. To revisit during implementation: exact `VariantStore` location (per-bundle sidecar vs. app-scoped store); whether Host Readiness offers a one-click "Start amfidont" (needs the bundled helper path) vs. copy-command only.