@aarwitz/tapp 0.33.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tapp",
3
3
  "description": "Give Claude hands and eyes on iOS, Android, and web apps, with exploration, replayable flows, evidence, and deterministic CI gates.",
4
- "version": "0.33.0",
4
+ "version": "0.34.0",
5
5
  "author": {
6
6
  "name": "Aaron Horowitz",
7
7
  "url": "https://github.com/aarwitz"
@@ -24,7 +24,7 @@
24
24
  "command": "npx",
25
25
  "args": [
26
26
  "-y",
27
- "@aarwitz/tapp@0.33.0",
27
+ "@aarwitz/tapp@0.34.0",
28
28
  "mcp"
29
29
  ],
30
30
  "cwd": "${CLAUDE_PROJECT_DIR}"
package/bin/tapp.js CHANGED
@@ -262,6 +262,28 @@ function repeatedFlagValues(argv, name) {
262
262
  return values;
263
263
  }
264
264
 
265
+ // `--platform windows` used to be indistinguishable from `--platform wbe`: both got
266
+ // "must be ios|android|web", which tells someone who read runtapp.com's Windows card that they
267
+ // typed it wrong. They did not — tapp has no driver for it yet. Say which of the two it is.
268
+ const DRIVEN_PLATFORMS = ["ios", "android", "web"];
269
+ const DECLARED_WITHOUT_DRIVER = {
270
+ windows: "Windows desktop applications (WPF, WinForms, WinUI)",
271
+ macos: "macOS desktop applications",
272
+ mac: "macOS desktop applications",
273
+ desktop: "desktop applications",
274
+ };
275
+ function refusePlatform(platform) {
276
+ const described = DECLARED_WITHOUT_DRIVER[String(platform || "").toLowerCase()];
277
+ if (described) {
278
+ console.error(`❌ tapp has no driver for ${described} yet, so there is nothing to run here.`);
279
+ console.error(" Early runs are set up with us while the driver lands: hello@runtapp.com");
280
+ console.error(" Today tapp drives: web (anywhere), iOS (macOS + Xcode), Android (adb).");
281
+ } else {
282
+ console.error("❌ --platform must be ios|android|web");
283
+ }
284
+ process.exit(2);
285
+ }
286
+
265
287
  function iosLaunchOptions(flags, argv) {
266
288
  const appLaunchArgs = repeatedFlagValues(argv, "launch-arg");
267
289
  let appLaunchEnv;
@@ -835,7 +857,7 @@ switch (command) {
835
857
  process.exit(2);
836
858
  }
837
859
  }
838
- if (!["ios", "android", "web"].includes(platform)) { console.error("❌ --platform must be ios|android|web"); process.exit(2); }
860
+ if (!DRIVEN_PLATFORMS.includes(platform)) refusePlatform(platform);
839
861
  const engine = await engineImport();
840
862
  let started = null;
841
863
  try {
@@ -997,10 +1019,7 @@ switch (command) {
997
1019
  }
998
1020
  }
999
1021
  const platform = requestedPlatform(flags, target);
1000
- if (!["ios", "android", "web"].includes(platform)) {
1001
- console.error("❌ --platform must be ios|android|web");
1002
- process.exit(2);
1003
- }
1022
+ if (!DRIVEN_PLATFORMS.includes(platform)) refusePlatform(platform);
1004
1023
  if (platform === "ios") requireMacFor("iOS testing");
1005
1024
  if (flags.watch === true && platform !== "web") {
1006
1025
  console.error("❌ --watch is currently available for web exploration only");
@@ -1341,7 +1360,7 @@ switch (command) {
1341
1360
  catch (error) { console.error(`❌ ${error.message}`); process.exit(2); }
1342
1361
  const platform = typeof flags.platform === "string" ? flags.platform.toLowerCase()
1343
1362
  : verb === "run" ? (typeof flags.url === "string" ? "web" : typeof flags["app-id"] === "string" || typeof flags.apk === "string" ? "android" : "ios") : "";
1344
- if (platform && !["ios", "android", "web"].includes(platform)) { console.error("❌ --platform must be ios|android|web"); process.exit(2); }
1363
+ if (platform && !DRIVEN_PLATFORMS.includes(platform)) refusePlatform(platform);
1345
1364
  let grounding = { errors: [], warnings: [] };
1346
1365
  let groundingMap = null;
1347
1366
  let groundingMapPath = null;
@@ -1588,7 +1607,7 @@ switch (command) {
1588
1607
  try { contract = await loadReleaseContractFile(contractPath); }
1589
1608
  catch (error) { console.error(`❌ ${error.message}`); process.exit(2); }
1590
1609
  const platform = String(flags.platform || (contract.platforms.length === 1 ? contract.platforms[0] : "")).toLowerCase();
1591
- if (platform && !["ios", "android", "web"].includes(platform)) { console.error("❌ --platform must be ios|android|web"); process.exit(2); }
1610
+ if (platform && !DRIVEN_PLATFORMS.includes(platform)) refusePlatform(platform);
1592
1611
  let grounding = { errors: [], warnings: [] };
1593
1612
  let groundingMap = null;
1594
1613
  let groundingMapPath = "";
@@ -1753,7 +1772,7 @@ switch (command) {
1753
1772
  }
1754
1773
  const platform = String(flags.platform || "ios").toLowerCase();
1755
1774
  if (!["ios", "android", "web"].includes(platform)) {
1756
- console.error("❌ --platform must be ios|android|web");
1775
+ refusePlatform(platform);
1757
1776
  process.exit(2);
1758
1777
  }
1759
1778
  const out = path.resolve(typeof flags.out === "string" ? flags.out : path.join(".tapp", "ui-map.json"));
package/browser/app.css CHANGED
@@ -606,3 +606,28 @@ dialog::backdrop { background:rgba(0,0,0,.6); }
606
606
  .signin-or::before, .signin-or::after { content:""; flex:1; height:1px; background:var(--line); }
607
607
  .run-stats .bad strong { color:#f87171; }
608
608
  #admin-body .actor-row { grid-template-columns: 1.5fr 1fr 1fr; }
609
+
610
+ /* Platforms — what tapp drives, and what this machine can start (ADR-0010).
611
+ Three states, and the "no driver yet" one must never look like a configuration problem the
612
+ reader could fix by installing something. */
613
+ .platform-strip { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:14px 0 0; justify-content:center; }
614
+ .platform-chip { display:inline-flex; align-items:center; gap:7px; padding:5px 11px; border-radius:999px; font-size:12px;
615
+ border:1px solid var(--tapp-border); color:var(--tapp-text-soft); background:var(--tapp-panel); }
616
+ .platform-chip i { width:7px; height:7px; border-radius:50%; background:currentColor; flex:none; }
617
+ .platform-chip.ready { color:var(--tapp-green); border-color:rgba(63,185,80,.38); }
618
+ .platform-chip.needs-machine { color:var(--tapp-amber-soft); border-color:rgba(210,153,34,.38); }
619
+ .platform-chip.pilot { color:var(--tapp-text-faint); }
620
+ .platform-more { font-size:12px; }
621
+
622
+ #platform-list { display:grid; gap:14px; grid-template-columns:repeat(auto-fit, minmax(320px, 1fr)); }
623
+ .platform-card .platform-summary { margin:0 0 6px; }
624
+ .platform-card .platform-how { margin:0 0 10px; color:var(--tapp-text-soft); font-size:13px; }
625
+ .platform-command { margin:0 0 10px; padding:9px 11px; border-radius:8px; background:var(--tapp-panel-2);
626
+ border:1px solid var(--tapp-border); overflow-x:auto; font-size:12.5px; }
627
+ .platform-state { font-size:11px; letter-spacing:.04em; text-transform:uppercase; padding:3px 9px; border-radius:999px;
628
+ border:1px solid var(--tapp-border); color:var(--tapp-text-soft); white-space:nowrap; }
629
+ .platform-state.ready { color:var(--tapp-green); border-color:rgba(63,185,80,.38); }
630
+ .platform-state.needs-machine { color:var(--tapp-amber-soft); border-color:rgba(210,153,34,.38); }
631
+
632
+ /* A suggestion this Studio cannot start is dimmed, not deleted: pressing it still answers. */
633
+ .prompt-suggestions [data-kind].elsewhere { opacity:.62; }
package/browser/app.js CHANGED
@@ -79,6 +79,61 @@ function operationPayload(extra = {}) {
79
79
  };
80
80
  }
81
81
 
82
+ // ——— Platforms ————————————————————————————————————————————————————————————————————————
83
+ // tapp drives websites, iOS simulators and Android devices, and the Studio is the same program
84
+ // wherever it runs. A hosted Studio on a Linux box cannot start an iOS run, which is a fact
85
+ // about that machine, not about the product — so say both, and give the command that fixes it.
86
+ // The states come from the server, computed from the machine it is on (mcp-server/src/platforms.js).
87
+ const PLATFORM_STATE_LABEL = { ready: "Ready here", "needs-machine": "Needs your machine", pilot: "No driver yet" };
88
+
89
+ function platformsFromSession() {
90
+ return Array.isArray(state.session?.platforms) ? state.session.platforms : [];
91
+ }
92
+
93
+ // A compact answer to "what does this thing drive?", on the first screen anyone sees.
94
+ function renderPlatformStrip() {
95
+ const strip = $("#platform-strip");
96
+ if (!strip) return;
97
+ const platforms = platformsFromSession();
98
+ strip.hidden = platforms.length === 0;
99
+ if (!platforms.length) return;
100
+ strip.innerHTML = `${platforms.map((platform) => `
101
+ <span class="platform-chip ${esc(platform.state)}" title="${esc(platform.summary)}">
102
+ <i></i>${esc(platform.label)}
103
+ </span>`).join("")}
104
+ <button type="button" class="quiet platform-more" data-platforms-open>What tapp can drive →</button>`;
105
+ }
106
+
107
+ function renderPlatforms() {
108
+ const node = $("#platform-list");
109
+ if (!node) return;
110
+ const platforms = platformsFromSession();
111
+ if (!platforms.length) { node.innerHTML = `<div class="empty">Checking this machine…</div>`; return; }
112
+ node.innerHTML = platforms.map((platform) => `
113
+ <article class="panel platform-card ${esc(platform.state)}">
114
+ <div class="section-heading compact">
115
+ <div><p class="eyebrow">${esc(platform.give)}</p><h2>${esc(platform.label)}</h2></div>
116
+ <span class="platform-state ${esc(platform.state)}">${esc(PLATFORM_STATE_LABEL[platform.state] || platform.state)}</span>
117
+ </div>
118
+ <p class="platform-summary">${esc(platform.summary)}</p>
119
+ <p class="platform-how">${esc(platform.how)}</p>
120
+ ${platform.command ? `<pre class="platform-command"><code>${esc(platform.command)}</code></pre>` : ""}
121
+ ${platform.state === "ready" ? ""
122
+ : platform.state === "pilot"
123
+ // No driver: the ask is "we would like one", and the honest reply is a conversation.
124
+ ? `<button type="button" class="quiet" data-platform-interest="${esc(platform.id)}">Tell us about your ${esc(platform.label.replace(/ app$/, ""))} app</button>`
125
+ // A driver exists; what is missing is a machine. The ask is "run it for me".
126
+ : `<button type="button" class="quiet" data-platform-interest="${esc(platform.id)}">I want tapp to run this for me</button>`}
127
+ </article>`).join("");
128
+ }
129
+
130
+ async function registerPlatformInterest(id) {
131
+ try {
132
+ await api("/api/platforms/interest", { method:"POST", body: JSON.stringify({ platform: id }) });
133
+ toast("Noted. That is the signal we use to decide what to build next.");
134
+ } catch (error) { toast(error.message, true); }
135
+ }
136
+
82
137
  function activateView(view) {
83
138
  if (!customerProductContract.views.some((item) => item.id === view)) view = "overview";
84
139
  state.activeView = view;
@@ -147,16 +202,25 @@ async function signOut() {
147
202
  function applyAccessMode() {
148
203
  const session = state.session || {};
149
204
  renderAccount();
205
+ // Before the early return below: a local Studio has a platform surface too, and it is the
206
+ // one where most of it says "ready".
207
+ renderPlatformStrip();
208
+ renderPlatforms();
150
209
  if (session.access !== "anonymous" && session.access !== "account") return;
151
210
  const signedIn = session.access === "account";
152
211
  const accepts = new Set(session.accepts || ["url"]);
212
+ // A target this Studio cannot START is still a thing tapp does. It used to be deleted from
213
+ // the screen, which is how a cross-platform product came to look like a website checker: the
214
+ // hosted Studio erased every mention of iOS, Android and folders. Keep them, mark them, and
215
+ // let the answer be "here is where that runs" (ADR-0010).
153
216
  for (const button of document.querySelectorAll("[data-kind]")) {
154
217
  const kind = button.dataset.kind;
155
218
  const usable = kind === "url" ? accepts.has("url") : accepts.has(kind);
156
- button.closest("li")?.classList.toggle("hidden", !usable);
219
+ button.closest("li")?.classList.remove("hidden");
220
+ button.classList.toggle("elsewhere", !usable);
157
221
  }
158
222
  const input = $("#prompt-input");
159
- if (input) input.placeholder = "A website URL…";
223
+ if (input) input.placeholder = accepts.has("path") ? input.placeholder : "A website URL — or an .app, .apk or repo to be told where it runs…";
160
224
  // Everything that only means something against a source repository: a target to build, a
161
225
  // runner, a release gate, a decision. A hosted visitor auditing a URL has none of them, and
162
226
  // showing the empty frames makes a working run look like a broken one.
@@ -169,8 +233,8 @@ function applyAccessMode() {
169
233
  if (!state.headingOwnedByRun) setHeading("tapp", signedIn ? "Give it a website. If there is a sign-in, I will ask you for a test account and remember it." : "Give it a public website and it will audit the pages read-only.");
170
234
  const note = $("#privacy-note-detail");
171
235
  if (note) note.textContent = signedIn
172
- ? "Websites are explored in the cloud. Test accounts you give tapp are kept encrypted, used only to sign in, and never shown again. iOS, Android and folders on your own machine need tapp there: npx -y @aarwitz/tapp@latest app"
173
- : "Websites are audited read-only in the cloud; nothing is clicked. Sign in to go inside a site. iOS, Android and folders on your own machine need tapp there: npx -y @aarwitz/tapp@latest app";
236
+ ? "Websites are explored in the cloud. Test accounts you give tapp are kept encrypted, used only to sign in, and never shown again. iOS, Android and folders on your own machine run the same Studio there: npx -y @aarwitz/tapp@latest app"
237
+ : "Websites are audited read-only in the cloud; nothing is clicked. Sign in to go inside a site. iOS, Android and folders on your own machine run the same Studio there: npx -y @aarwitz/tapp@latest app";
174
238
  $("#actors-panel")?.classList.toggle("hidden", !signedIn);
175
239
  $("#journeys-panel")?.classList.toggle("hidden", !signedIn);
176
240
  $("#agent-panel")?.classList.toggle("hidden", !signedIn);
@@ -271,6 +335,11 @@ function renderAdmin() {
271
335
  ${activity.people.length ? activity.people.map((p) => `<div class="actor-row"><span><strong>${p.kind === "account" ? "account" : "visitor"} ${esc(p.id.split(":")[1])}</strong><br><small>first seen ${esc(compactDate(p.first))} · last ${esc(compactDate(p.last))}</small></span><span><small>${esc(Object.entries(p.events).map(([k, v]) => `${k.replace(/\./g, " ")} ×${v}`).join(" · ").slice(0, 90) || "—")}</small></span><span><small>${esc(p.hosts.join(", ") || "—")}</small></span></div>`).join("") : '<div class="empty">Nobody yet. Activity is recorded from the release that introduced this log.</div>'}
272
336
  </section>
273
337
 
338
+ <section class="panel section">
339
+ <div class="section-heading compact"><div><p class="eyebrow">Demand</p><h2>What people wanted that this Studio could not do</h2><p>“Turned away” is somebody who actually pointed tapp at a target it could not start here — the stronger signal, because they tried. “Asked for” is somebody pressing the button on the Platforms page.</p></div></div>
340
+ ${(data.demand || []).length ? (data.demand).map((platform) => `<div class="actor-row"><span><strong>${esc(platform.label)}</strong><br><small>${esc(PLATFORM_STATE_LABEL[platform.state] || platform.state)}</small></span><span><small>${esc(String(platform.turnedAway))} turned away</small></span><span><small>${esc(String(platform.askedFor))} asked for</small></span></div>`).join("") : '<div class="empty">Nothing recorded yet.</div>'}
341
+ </section>
342
+
274
343
  <section class="panel section">
275
344
  <div class="section-heading compact"><div><p class="eyebrow">Accounts</p><h2>People with a tapp account <i class="zero">${data.accounts.length}</i></h2><p>Test accounts are counted, never shown — tapp cannot show them.</p></div></div>
276
345
  ${data.accounts.length ? data.accounts.map((account) => `<div class="actor-row"><span><strong>${esc(account.email)}</strong>${owner(account.email) ? ' <small class="journey-status passing">owner</small>' : ""}<br><small>joined ${esc(compactDate(account.createdAt))}${account.lastSeenAt ? ` · last seen ${esc(compactDate(account.lastSeenAt))}` : ""}</small></span><span><small>${account.journeys} journey${account.journeys === 1 ? "" : "s"}${account.failing ? ` · <b class="journey-status failing">${account.failing} failing</b>` : ""}${account.neverRun ? ` · ${account.neverRun} never run` : ""}</small></span><span><small>${account.testAccounts} test account${account.testAccounts === 1 ? "" : "s"} · ${account.tokens} token${account.tokens === 1 ? "" : "s"}</small></span></div>`).join("") : '<div class="empty">Nobody has signed in yet.</div>'}
@@ -1086,6 +1155,10 @@ async function auditWebsite(url) {
1086
1155
  document.addEventListener("click", (event) => {
1087
1156
  const viewButton = event.target.closest("[data-view]");
1088
1157
  if (viewButton && $("#product-shell").contains(viewButton)) activateView(viewButton.dataset.view);
1158
+ // "What tapp can drive" is reachable from the first screen, before there is any project.
1159
+ if (event.target.closest("[data-platforms-open]")) { showProduct(); activateView("platforms"); renderPlatforms(); }
1160
+ const interest = event.target.closest("[data-platform-interest]");
1161
+ if (interest) registerPlatformInterest(interest.dataset.platformInterest);
1089
1162
  const targetButton = event.target.closest("[data-target-id]");
1090
1163
  if (targetButton) {
1091
1164
  state.selectedTargetId = targetButton.dataset.targetId;
@@ -56,6 +56,7 @@
56
56
  <label class="prompt-field"><span class="sr-only">Website, repository, folder, or build</span><input id="prompt-input" name="input" placeholder="A website URL, a GitHub repo, a folder on this Mac, a bundle id, an .app or .apk…" spellcheck="false" required></label>
57
57
  <button class="primary prompt-go" type="submit" id="prompt-start" aria-label="Start">→</button>
58
58
  </form>
59
+ <div class="platform-strip" id="platform-strip" hidden></div>
59
60
  <ul class="prompt-suggestions" aria-label="Examples">
60
61
  <li><button type="button" data-kind="url" data-prompt="https://example.com"><span>⌁</span><b>https://example.com</b><small>audit a website read-only — safe on production, nothing is clicked</small></button></li>
61
62
  <li><button type="button" data-kind="path" data-prompt="~/code/my-app"><span>⌘</span><b>~/code/my-app</b><small>open a repo folder on this Mac — detects iOS, Android and web targets, builds locally</small></button></li>
@@ -89,6 +90,7 @@
89
90
  <nav class="primary-nav" aria-label="Product navigation">
90
91
  <button data-view="overview" class="active"><span><svg><use href="#i-grid"/></svg></span>Overview</button>
91
92
  <button data-view="runs"><span><svg><use href="#i-play"/></svg></span>Runs <i id="run-count" class="zero">0</i></button>
93
+ <button data-view="platforms"><span><svg><use href="#i-grid"/></svg></span>Platforms</button>
92
94
  <button data-view="admin" id="admin-nav" class="hidden"><span><svg><use href="#i-grid"/></svg></span>Admin</button>
93
95
  </nav>
94
96
  <div class="sidebar-project">
@@ -166,6 +168,10 @@
166
168
  </section>
167
169
  </section>
168
170
 
171
+ <section class="workspace-view" data-view-panel="platforms">
172
+ <div class="view-heading simple"><div><p class="eyebrow">Platforms</p><h1>What tapp can drive</h1><p>tapp is one engine with a driver per platform. This page says what this Studio can start right now, and where the rest runs.</p></div></div>
173
+ <div id="platform-list"><div class="empty">Checking this machine…</div></div>
174
+ </section>
169
175
  <section class="workspace-view" data-view-panel="admin">
170
176
  <div class="command-bar"><div><h1>Admin</h1><p>Everything this deployment knows about itself. Never a credential — those are encrypted and are not decrypted to be looked at.</p></div></div>
171
177
  <div id="admin-body"><div class="empty">Loading…</div></div>
@@ -6,6 +6,9 @@ export const customerProductContract = Object.freeze({
6
6
  schemaVersion: 2,
7
7
  product: "Tapp",
8
8
  interface: "customer-browser",
9
+ // What tapp has a driver for. macOS and Windows desktop applications are shown in the
10
+ // Studio's Platforms view as having no driver yet — declared honestly, never counted here,
11
+ // because this list is what the engine can actually drive (ADR-0010).
9
12
  targetPlatforms: ["ios", "android", "web"],
10
13
  // A repository is opened by path (`tapp app /path/to/repo`); a website by URL in the Studio.
11
14
  repositorySources: ["local-path", "github"],
@@ -15,7 +18,9 @@ export const customerProductContract = Object.freeze({
15
18
  { id: "runs", label: "Runs", capabilities: ["run-history", "run-detail", "evidence-page", "website-audit"] },
16
19
  // Only an owner of this deployment ever sees this one (TAPP_ADMIN_EMAILS); to anybody else
17
20
  // the nav item is absent and the route is a 404.
18
- { id: "admin", label: "Admin", capabilities: ["deployment-usage", "account-list"] },
21
+ // Says what tapp drives, what THIS Studio can start, and what to do about the difference.
22
+ { id: "platforms", label: "Platforms", capabilities: ["platform-matrix", "self-host-command", "platform-interest"] },
23
+ { id: "admin", label: "Admin", capabilities: ["deployment-usage", "account-list", "platform-demand"] },
19
24
  ],
20
25
  operations: ["initialize", "session-start", "session-act", "session-save-flow", "session-end", "gate", "audit"],
21
26
  invariants: [
@@ -25,5 +30,6 @@ export const customerProductContract = Object.freeze({
25
30
  "Repositories are opened from the machine the Studio runs on; nothing is uploaded or cloned by the Studio.",
26
31
  "Deterministic replay and ordinary merge decisions are keyless.",
27
32
  "The admin view reports counts about this deployment; credentials are encrypted and are never decrypted to be shown.",
33
+ "The Platforms view states what this machine can start, computed from the machine; a platform with no driver says so in those words and is never described as needing different hardware.",
28
34
  ],
29
35
  });
@@ -24,6 +24,7 @@ import { accessConfig, createAccessVerifier } from "./access-jwt.js";
24
24
  import { oauthProviders, oauthAuthorizeUrl, oauthEmailFromCode, isOauthProvider } from "./oauth.js";
25
25
  import { journeyFromCapture, JourneyStore, slugify } from "./journeys.js";
26
26
  import { AlertStore, alertForChange, alertMessage, deliverAlert } from "./alerts.js";
27
+ import { platformStates, selfHostAnswer, PLATFORM_TARGETS, hostToolchain } from "./platforms.js";
27
28
 
28
29
  const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
29
30
  const assetRoot = path.join(packageRoot, "browser");
@@ -134,6 +135,7 @@ const OAUTH_STATE_COOKIE = "tapp_oauth_state";
134
135
  function anonymousAllows(method, pathname) {
135
136
  if (method === "GET") {
136
137
  if (pathname === "/" || pathname === "/admin" || pathname === "/api/version" || pathname === "/api/session" || pathname === "/api/audits") return true;
138
+ if (pathname === "/api/platforms") return true;
137
139
  if (pathname.startsWith("/assets/")) return true;
138
140
  if (/^\/api\/captures\/[A-Za-z0-9._-]{1,128}\/files$/.test(pathname)) return true;
139
141
  if (/^\/evidence\/captures\//.test(pathname)) return true;
@@ -150,6 +152,9 @@ function anonymousAllows(method, pathname) {
150
152
  // repo into the landing page, which is how five of its six examples used to dead-end.
151
153
  // `explore` is listed so a visitor receives the honest "run this on your own machine" answer
152
154
  // from the handler, rather than a bare 401 that reads as broken.
155
+ // Saying "I would use this for Android" is the one piece of demand a stranger can give us,
156
+ // and the reason to ask is strongest exactly when the answer was "not from here".
157
+ if (method === "POST" && pathname === "/api/platforms/interest") return true;
153
158
  return method === "POST" && ["/api/operations/audit", "/api/operations/open", "/api/operations/explore-build", "/api/operations/explore"].includes(pathname);
154
159
  }
155
160
 
@@ -461,9 +466,9 @@ function runnerSummary({ hosted = false } = {}) {
461
466
  { id:"managed-android", platform:"android", label:"Managed Android runner", status:"unavailable", remediation:"The hosted customer adapter is not yet connected to a lease-backed Android runner." },
462
467
  { id:"hosted-web", platform:"web", label:"Hosted Chromium", status:"needs-check", remediation:"Tapp verifies the isolated Chromium runtime when the selected web target starts." },
463
468
  ];
464
- const executable = (name) => String(process.env.PATH || "").split(path.delimiter).some((dir) => dir && fs.existsSync(path.join(dir, name)));
465
- const ios = process.platform === "darwin" && (fs.existsSync("/usr/bin/xcodebuild") || executable("xcodebuild"));
466
- const android = executable(process.platform === "win32" ? "adb.exe" : "adb") || !!process.env.ANDROID_SDK_ROOT || !!process.env.ANDROID_HOME;
469
+ // One probe for the whole product, so the runner list and the platform surface can never
470
+ // disagree about whether this machine has Xcode or adb (mcp-server/src/platforms.js).
471
+ const { ios, android } = hostToolchain();
467
472
  return [
468
473
  { id: "local-ios", platform: "ios", label: "Local Xcode simulator", status: ios ? "available" : "unavailable", remediation: ios ? "" : "Use a macOS runner with Xcode for iOS." },
469
474
  { id: "local-android", platform: "android", label: "Local Android runtime", status: android ? "available" : "needs-check", remediation: android ? "Start or connect an emulator/device." : "Install Android SDK platform-tools or connect a managed Android runner." },
@@ -1194,6 +1199,17 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
1194
1199
  },
1195
1200
  recentRuns: runs.slice(0, 40),
1196
1201
  totalRuns: runs.length,
1202
+ // What people wanted that this deployment could not do. "Asked for" is someone
1203
+ // pressing "tell me when tapp can run this"; "turned away" is someone who actually
1204
+ // pointed tapp at a target it could not start here. The second is the stronger
1205
+ // signal, because they tried.
1206
+ demand: PLATFORM_TARGETS.map((target) => ({
1207
+ id: target.id,
1208
+ label: target.label,
1209
+ state: platformStates({ hosted }).find((entry) => entry.id === target.id)?.state || "unknown",
1210
+ askedFor: events.filter((entry) => entry.event === "platform.asked" && entry.platform === target.id).length,
1211
+ turnedAway: events.filter((entry) => entry.event === "self-host.answered" && entry.platform === target.id).length,
1212
+ })),
1197
1213
  });
1198
1214
  return;
1199
1215
  }
@@ -1246,6 +1262,28 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
1246
1262
  json(response, 200, { ok: accounts.revokeToken(account.id, revokeTokenMatch[1]) });
1247
1263
  return;
1248
1264
  }
1265
+ // What tapp drives, and what this particular Studio can start. Public, because the honest
1266
+ // answer to "does this do iOS?" is yes-but-not-from-here, and a visitor who cannot see
1267
+ // that concludes tapp is a website checker (ADR-0010).
1268
+ if (request.method === "GET" && url.pathname === "/api/platforms") {
1269
+ json(response, 200, { hosted, platforms: platformStates({ hosted }) });
1270
+ return;
1271
+ }
1272
+ // "I would use this for Android." The only demand signal a stranger can give us, and it
1273
+ // matters most at the moment the answer was "not from here". No contact details are taken:
1274
+ // this is a counter, not a lead form, and the usage journal keeps no handle.
1275
+ if (request.method === "POST" && url.pathname === "/api/platforms/interest") {
1276
+ guardMutation(request);
1277
+ const asked = await readJsonBody(request);
1278
+ const wanted = String(asked?.platform || "");
1279
+ if (!PLATFORM_TARGETS.some((target) => target.id === wanted)) {
1280
+ json(response, 400, { error: `Unknown platform '${wanted}'` });
1281
+ return;
1282
+ }
1283
+ logUsage("platform.asked", { platform: wanted, ...(account ? { account: account.id.slice(0, 8) } : { visitor: String(visitorId || "").slice(0, 8) }) });
1284
+ json(response, 200, { ok: true, platform: wanted });
1285
+ return;
1286
+ }
1249
1287
  if (request.method === "GET" && url.pathname === "/api/session") {
1250
1288
  if (account) {
1251
1289
  json(response, 200, {
@@ -1254,6 +1292,10 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
1254
1292
  access: "account", email: account.email, signInProvider, signInOptions, viaToken, admin: isAdmin(account),
1255
1293
  accepts: ["url"],
1256
1294
  selfHostOnly: ["path", "github", "bundle", "app", "apk"],
1295
+ // What tapp drives, and what THIS machine can start. The Studio shows all of it:
1296
+ // hiding iOS and Android is what made a cross-platform product look like a website
1297
+ // checker (ADR-0010).
1298
+ platforms: platformStates({ hosted: true }),
1257
1299
  });
1258
1300
  return;
1259
1301
  }
@@ -1262,15 +1304,18 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
1262
1304
  csrfToken, mode: "public", product: "Tapp", root: null, repository: null, repositories: [],
1263
1305
  contract: customerProductContract, supportedPlatforms: ["web"], runners: [],
1264
1306
  access: "anonymous", signInProvider, signInOptions,
1265
- // The prompt screen offers folders, bundle ids and builds. None of them can work in
1266
- // a hosted Studio — there is no Mac, no simulator and no access to the visitor's
1267
- // disk — so say so here rather than letting the UI offer them.
1307
+ // The prompt screen offers folders, bundle ids and builds. None of them can be
1308
+ // STARTED in a hosted Studio — there is no Mac, no simulator and no access to the
1309
+ // visitor's disk. `accepts` says what can start here; `platforms` says what tapp
1310
+ // drives and where, because a visitor deserves to know the product does phones
1311
+ // even when this deployment cannot (ADR-0010).
1268
1312
  accepts: ["url"],
1269
1313
  selfHostOnly: ["path", "github", "bundle", "app", "apk"],
1314
+ platforms: platformStates({ hosted: true }),
1270
1315
  });
1271
1316
  return;
1272
1317
  }
1273
- json(response, 200, { csrfToken, mode: hosted ? "managed" : "local", product: "Tapp", root: hosted ? null : registry.currentRoot(), repository: hosted ? hostedRepository(registry.current()) : registry.current(), repositories: hosted ? registry.list().map(hostedRepository) : registry.list(), contract: customerProductContract, supportedPlatforms: customerProductContract.targetPlatforms, runners: runnerSummary({ hosted }) });
1318
+ json(response, 200, { csrfToken, mode: hosted ? "managed" : "local", product: "Tapp", root: hosted ? null : registry.currentRoot(), repository: hosted ? hostedRepository(registry.current()) : registry.current(), repositories: hosted ? registry.list().map(hostedRepository) : registry.list(), contract: customerProductContract, supportedPlatforms: customerProductContract.targetPlatforms, runners: runnerSummary({ hosted }), platforms: platformStates({ hosted }) });
1274
1319
  return;
1275
1320
  }
1276
1321
  if (request.method === "GET" && url.pathname === "/api/repositories") { json(response, 200, hosted ? { current:hostedRepository(registry.current()), repositories:registry.list().map(hostedRepository) } : { current: registry.current(), repositories: registry.list() }); return; }
@@ -1413,13 +1458,21 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
1413
1458
  if (operation === "explore-build") {
1414
1459
  if (anonymous) {
1415
1460
  const asked = classifyPrompt(body.input);
1416
- logUsage("self-host.answered", { visitor: visitorId.slice(0, 8), kind: asked.kind });
1417
- const where = asked.kind === "apk" ? "an Android device or emulator" : "a Mac with an iOS simulator";
1418
- json(response, 200, { kind: "self-host", target: asked.value, command: "npx -y @aarwitz/tapp@latest app",
1419
- message: `Running ${asked.value || "a build"} needs ${where}, which the cloud does not have. Start the Studio on that machine: npx -y @aarwitz/tapp@latest app` });
1461
+ const wanted = asked.kind === "apk" ? "android" : "ios";
1462
+ logUsage("self-host.answered", { visitor: visitorId.slice(0, 8), kind: asked.kind, platform: wanted });
1463
+ json(response, 200, selfHostAnswer(wanted, asked.value, { hosted: true }));
1464
+ return;
1465
+ }
1466
+ if (hosted) {
1467
+ // A signed-in account used to get a bare 400 here, which reads as "tapp is broken"
1468
+ // rather than "tapp does this, just not on a machine without a simulator". Give the
1469
+ // same structured answer a visitor gets: where it runs, and the command to get there.
1470
+ const asked = classifyPrompt(body.input);
1471
+ const wanted = asked.kind === "apk" ? "android" : "ios";
1472
+ logUsage("self-host.answered", { account: account?.id?.slice(0, 8), kind: asked.kind, platform: wanted });
1473
+ json(response, 200, selfHostAnswer(wanted, asked.value, { hosted: true }));
1420
1474
  return;
1421
1475
  }
1422
- if (hosted) throw Object.assign(new Error("Builds are explored on the machine that has the simulator; run the Studio locally"), { statusCode: 400 });
1423
1476
  const prompt = classifyPrompt(body.input);
1424
1477
  if (!["bundle", "app", "apk"].includes(prompt.kind)) throw Object.assign(new Error("Give a bundle id (com.company.app), a simulator .app, or an .apk"), { statusCode: 400 });
1425
1478
  const job = startJob(operation, async (progress) => {
@@ -3206,7 +3206,11 @@ async function handleTool(name, args = {}) {
3206
3206
  : { code: 1, stdout: "", stderr: "Xcode not found" };
3207
3207
  const bootedLine = (simctl.stdout || "").split("\n").find((l) => /\(Booted\)/.test(l));
3208
3208
  const bootedName = bootedLine ? bootedLine.trim().replace(/\s*\(.*$/, "") : null;
3209
- const adb = await runCommand("adb", ["devices"]);
3209
+ // The SDK is commonly an unlinked Homebrew cask with ANDROID_HOME unset, so a bare `adb`
3210
+ // reports "not found" on machines where `tapp explore --platform android` works. Use the
3211
+ // driver's own resolver, which is what the run will use (resolveAdbPath).
3212
+ const { resolveAdbPath } = await import("./android-driver.js");
3213
+ const adb = await runCommand(resolveAdbPath() || "adb", ["devices"]);
3210
3214
  const androidDevice = adb.code === 0
3211
3215
  ? (adb.stdout || "").split("\n").find((line) => /\tdevice\s*$/.test(line))
3212
3216
  : null;
@@ -0,0 +1,158 @@
1
+ // Every surface tapp aims at, and whether THIS Studio can drive it.
2
+ //
3
+ // tapp is not a web tool. The engine drives websites, iOS simulators and Android devices, and the
4
+ // Studio in `browser/` is the same program wherever it runs — on a laptop it can start an iOS run,
5
+ // and on a Linux box in a data centre it cannot, because there is no Mac attached to it.
6
+ //
7
+ // The product used to leave that implicit: the hosted Studio answered an .app with a bare 400,
8
+ // and nothing anywhere said that tapp drives phones at all. Someone arriving at app.runtapp.com
9
+ // reasonably concluded it was a website checker.
10
+ //
11
+ // So this module is the one place that answers, for a given host: what can tapp drive, what does
12
+ // each one need, and what should this person do next. Every state below is computed from the
13
+ // machine the Studio is on — never declared — and a platform with no driver says so in those
14
+ // words. Nothing here may describe a capability that does not exist.
15
+ import fs from "node:fs";
16
+ import path from "node:path";
17
+
18
+ import { resolveAdbPath } from "./android-driver.js";
19
+
20
+ /**
21
+ * The states a platform can be in, worst-named-first so nobody mistakes one for another:
22
+ *
23
+ * ready — this Studio can start a run now.
24
+ * needs-machine — tapp drives it, but not from this host. There is an exact command for the
25
+ * machine that can, because self-hosting is the same product, not a lesser one.
26
+ * pilot — tapp does NOT drive it yet. No driver exists. Early work is done with a
27
+ * person while the driver lands (owner decision, 2026-09-14, for Windows).
28
+ */
29
+ export const PLATFORM_STATES = Object.freeze(["ready", "needs-machine", "pilot"]);
30
+
31
+ /** What tapp aims at, in the order a person should see them. */
32
+ export const PLATFORM_TARGETS = Object.freeze([
33
+ {
34
+ id: "web", label: "Web", give: "A website URL",
35
+ driver: "playwright", needs: "Playwright and Chromium, which tapp installs",
36
+ machine: "any machine",
37
+ },
38
+ {
39
+ id: "ios", label: "iOS", give: "A simulator .app or a bundle id",
40
+ driver: "xcuitest", needs: "macOS with Xcode",
41
+ machine: "a Mac with Xcode",
42
+ },
43
+ {
44
+ id: "android", label: "Android", give: "An .apk or a connected device",
45
+ driver: "adb", needs: "the Android SDK and adb",
46
+ machine: "a machine with the Android SDK",
47
+ },
48
+ {
49
+ id: "macos", label: "macOS app", give: "A .app on your Mac",
50
+ driver: null, needs: "macOS",
51
+ machine: "a Mac",
52
+ },
53
+ {
54
+ id: "windows", label: "Windows app", give: "A WPF, WinForms or WinUI app",
55
+ driver: null, needs: "Windows",
56
+ machine: "a Windows machine",
57
+ },
58
+ ]);
59
+
60
+ // "A simulator .app" mid-sentence, without lowercasing the file extension or the brand.
61
+ const lower = (text) => String(text).replace(/^(An?|The) /, (word) => word.toLowerCase());
62
+
63
+ const onPath = (name, env) => String(env.PATH || "").split(path.delimiter).some((dir) => dir && fs.existsSync(path.join(dir, name)));
64
+
65
+ /**
66
+ * What this machine actually has. The same checks `runnerSummary` used, in one place, so the
67
+ * Studio and the runner list can never disagree about whether Xcode is installed.
68
+ */
69
+ export function hostToolchain({ env = process.env, platform = process.platform } = {}) {
70
+ return {
71
+ ios: platform === "darwin" && (fs.existsSync("/usr/bin/xcodebuild") || onPath("xcodebuild", env)),
72
+ // The driver's own resolver, not a PATH guess: the SDK is commonly an unlinked Homebrew
73
+ // cask with ANDROID_HOME unset, and the Studio must not say "no Android" about a machine
74
+ // where `tapp explore` would happily find adb.
75
+ android: platform === "linux" || platform === "darwin" || platform === "win32" ? Boolean(resolveAdbPath(env)) : false,
76
+ // Chromium is fetched on demand, so web is reachable from any host; whether this particular
77
+ // one has it unpacked is checked when the run starts, which is where the error belongs.
78
+ web: true,
79
+ };
80
+ }
81
+
82
+ /** The command that opens this same Studio on a machine that can do the work. */
83
+ export const SELF_HOST_COMMAND = "npx -y @aarwitz/tapp@latest app";
84
+
85
+ /**
86
+ * The honest state of every platform for one host.
87
+ *
88
+ * @param {object} options
89
+ * @param {boolean} options.hosted true for app.runtapp.com, false for `tapp app` on a laptop
90
+ */
91
+ export function platformStates({ hosted = false, env = process.env, platform = process.platform, toolchain = null } = {}) {
92
+ const has = toolchain || hostToolchain({ env, platform });
93
+ return PLATFORM_TARGETS.map((target) => {
94
+ // No driver is no driver, on any host. This must never read as "you need a different machine",
95
+ // because buying the machine would not help.
96
+ if (!target.driver) {
97
+ return {
98
+ ...target,
99
+ state: "pilot",
100
+ summary: `tapp has no ${target.label} driver yet.`,
101
+ how: `Early ${target.label} work is done with us while the driver lands. Tell us about yours and we will run it with you.`,
102
+ command: "",
103
+ };
104
+ }
105
+ // A public Studio starts website runs and nothing else, whatever the machine under it
106
+ // happens to own (ADR-0008). Saying "ready" because this particular host has Xcode would
107
+ // promise a run the server then refuses — so the deployment has a say, not just the disk.
108
+ const exposed = hosted ? target.id === "web" : true;
109
+ if (has[target.id] && exposed) {
110
+ return {
111
+ ...target,
112
+ state: "ready", because: "",
113
+ summary: hosted ? `Ready here. ${target.give}.` : `Ready on this machine. ${target.give}.`,
114
+ how: `Paste ${lower(target.give)} in the box above.`,
115
+ command: "",
116
+ };
117
+ }
118
+ const because = has[target.id] && !exposed ? "not-exposed" : "no-toolchain";
119
+ return {
120
+ ...target,
121
+ state: "needs-machine", because,
122
+ summary: because === "not-exposed"
123
+ ? `tapp drives ${target.label}, and this machine could — but a public Studio only starts website runs.`
124
+ : `tapp drives ${target.label}, but this Studio is not on ${target.machine}.`,
125
+ // Self-host is the same product without the hosting, so the answer is a command, not an
126
+ // apology (ADR-0006).
127
+ how: `Run this Studio on ${target.machine} and give it ${lower(target.give)} there:`,
128
+ command: SELF_HOST_COMMAND,
129
+ };
130
+ });
131
+ }
132
+
133
+ /** One platform's state, by id. */
134
+ export function platformState(id, options = {}) {
135
+ return platformStates(options).find((entry) => entry.id === String(id)) || null;
136
+ }
137
+
138
+ /** The platforms this Studio can start a run on right now. */
139
+ export function readyPlatforms(options = {}) {
140
+ return platformStates(options).filter((entry) => entry.state === "ready").map((entry) => entry.id);
141
+ }
142
+
143
+ /**
144
+ * The answer to "I gave you an .app and you are a Linux box": where it runs, and how to get there.
145
+ * Shaped like every other self-host answer the Studio already knows how to show.
146
+ */
147
+ export function selfHostAnswer(platformId, target = "", options = {}) {
148
+ const entry = platformState(platformId, options);
149
+ if (!entry) return null;
150
+ const what = target ? `“${target}”` : `a ${entry.label} target`;
151
+ if (entry.state === "pilot") {
152
+ return { kind: "self-host", platform: entry.id, state: entry.state, target,
153
+ message: `${what} is a ${entry.label} target, and tapp has no ${entry.label} driver yet. ${entry.how}`, command: "" };
154
+ }
155
+ return { kind: "self-host", platform: entry.id, state: entry.state, target,
156
+ message: `Running ${what} needs ${entry.machine}, which this Studio is not on. Start the Studio there: ${SELF_HOST_COMMAND}`,
157
+ command: SELF_HOST_COMMAND };
158
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aarwitz/tapp",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "mcpName": "io.github.aarwitz/tapp",
5
5
  "description": "Let coding agents verify UI changes on real iOS, Android, and web surfaces, then enforce reviewed proof in deterministic CI.",
6
6
  "license": "MIT",
@@ -96,7 +96,7 @@
96
96
  "mobile"
97
97
  ],
98
98
  "scripts": {
99
- "test": "node --test tests/report.test.js tests/regression.test.js tests/engine.test.js tests/project-config.test.js tests/application-model.test.js tests/ui-map.test.js tests/focused-navigation.test.js tests/task-runtime.test.js tests/release-contract.test.js tests/pr-selection.test.js tests/flow-runtime.test.js tests/web-explorer.test.js tests/web-session.test.js tests/web-link-audit.test.js tests/web-overlay.test.js tests/web-audit.test.js tests/page-observations.test.js tests/capture-provenance.test.js tests/capture-frames.test.js tests/actor-store.test.js tests/account-store.test.js tests/alerts.test.js tests/access-jwt.test.js tests/oauth.test.js tests/studio-client.test.js tests/journeys.test.js tests/ios-crash-attribution.test.js tests/ios-simulator-selection.test.js tests/ios-recording-stop.test.js tests/web-flow.test.js tests/scenario-runtime.test.js tests/android-driver.test.js tests/android-explorer.test.js tests/android-flow.test.js tests/android-primitives-protocol.test.js tests/managed-web.test.js tests/product-operations.test.js tests/job-lanes.test.js tests/browser-product.test.js tests/browser-chat-narration.test.js tests/browser-onboarding.test.js tests/managed-operation.test.js tests/ci-setup.test.js tests/ci-install.test.js tests/cli.test.js tests/mcp-workspace.test.js tests/action.test.js tests/package-surface.test.js tests/agent-surface.test.js tests/presentation-contract.test.js tests/landing-brand.test.js tests/ci-gate.test.js tests/ci-report.test.js tests/desktop-protocol.test.js tests/ios-flow-protocol.test.js tests/feedback-triage-0919.test.js vscode-extension/test/bridge.test.js",
99
+ "test": "node --test tests/report.test.js tests/regression.test.js tests/engine.test.js tests/project-config.test.js tests/application-model.test.js tests/ui-map.test.js tests/focused-navigation.test.js tests/task-runtime.test.js tests/release-contract.test.js tests/pr-selection.test.js tests/flow-runtime.test.js tests/web-explorer.test.js tests/web-session.test.js tests/web-link-audit.test.js tests/web-overlay.test.js tests/web-audit.test.js tests/page-observations.test.js tests/capture-provenance.test.js tests/capture-frames.test.js tests/actor-store.test.js tests/account-store.test.js tests/alerts.test.js tests/access-jwt.test.js tests/oauth.test.js tests/studio-client.test.js tests/journeys.test.js tests/ios-crash-attribution.test.js tests/ios-simulator-selection.test.js tests/ios-recording-stop.test.js tests/web-flow.test.js tests/sign-in.test.js tests/scenario-runtime.test.js tests/android-driver.test.js tests/android-explorer.test.js tests/android-flow.test.js tests/android-primitives-protocol.test.js tests/managed-web.test.js tests/product-operations.test.js tests/job-lanes.test.js tests/browser-product.test.js tests/browser-chat-narration.test.js tests/browser-onboarding.test.js tests/managed-operation.test.js tests/ci-setup.test.js tests/ci-install.test.js tests/cli.test.js tests/mcp-workspace.test.js tests/action.test.js tests/package-surface.test.js tests/agent-surface.test.js tests/platforms.test.js tests/presentation-contract.test.js tests/landing-brand.test.js tests/ci-gate.test.js tests/ci-report.test.js tests/desktop-protocol.test.js tests/ios-flow-protocol.test.js tests/feedback-triage-0919.test.js vscode-extension/test/bridge.test.js",
100
100
  "test:browser-journey": "node --test tests/browser-journey.test.js",
101
101
  "test:browser-native": "TAPP_RUN_NATIVE_BROWSER=1 node --test tests/browser-native-journey.test.js"
102
102
  }