@aarwitz/tapp 0.18.2 → 0.18.4

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.
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <meta name="description" content="Tapp Studio: run Tapp against a repository target or a website, watch it live, and open the evidence.">
6
+ <meta name="description" content="Tapp Studio: point Tapp at a website, a repository or a build, watch it run on a real device, and open the evidence.">
7
7
  <meta name="tapp-api-base" content="">
8
8
  <meta name="tapp-login-url" content="">
9
9
  <title>Tapp</title>
@@ -21,44 +21,49 @@
21
21
  <symbol id="i-app" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="2" width="10" height="12" rx="2"/><path d="M6.5 12h3"/></symbol>
22
22
  </svg>
23
23
 
24
- <main class="source-onboarding hidden" id="source-onboarding">
24
+ <main class="prompt-screen hidden" id="source-onboarding">
25
25
  <header class="onboarding-topbar">
26
26
  <button class="brand" data-brand-home aria-label="Tapp overview">tapp<span class="brand-mark"></span><small>ship with proof</small></button>
27
27
  <span class="mode-pill" id="onboarding-mode-pill">Self-host · this machine</span>
28
28
  </header>
29
- <section class="welcome-copy">
30
- <p class="eyebrow">Run viewer</p>
31
- <h1>Point Tapp at something real.</h1>
32
- <p>A repository on this machine gets built, explored and gated; a website gets a read-only audit. Either way the evidence is what the engine wrote — screenshots, findings, a report page — not a summary written afterwards.</p>
33
- <div class="platform-row" aria-label="Supported target platforms">
34
- <span>iOS</span><span>Android</span><span>Web</span>
29
+
30
+ <section class="prompt-hero" aria-hidden="true">
31
+ <!-- A device being driven: a cursor moves across screens, each screen gets its check. The
32
+ loop is the product in eight seconds; it respects prefers-reduced-motion. -->
33
+ <div class="hero-stage">
34
+ <div class="hero-device">
35
+ <span class="hero-notch"></span>
36
+ <div class="hero-screen">
37
+ <div class="hero-page hero-page-1"><span class="hero-bar"></span><span class="hero-line w60"></span><span class="hero-line w80"></span><span class="hero-tile"></span><span class="hero-btn">Add to cart</span></div>
38
+ <div class="hero-page hero-page-2"><span class="hero-bar"></span><span class="hero-line w40"></span><span class="hero-row"></span><span class="hero-row"></span><span class="hero-btn">Checkout</span></div>
39
+ <div class="hero-page hero-page-3"><span class="hero-bar"></span><span class="hero-check">✓</span><span class="hero-line w60 center"></span><span class="hero-line w40 center"></span></div>
40
+ </div>
41
+ <span class="hero-cursor">👆</span>
42
+ </div>
43
+ <ul class="hero-log">
44
+ <li class="hero-log-1">📱 Launching the app</li>
45
+ <li class="hero-log-2">👆 Tapping “Add to cart”</li>
46
+ <li class="hero-log-3">👆 Tapping “Checkout”</li>
47
+ <li class="hero-log-4">📸 Screenshotting · <b>✓ Order confirmed</b></li>
48
+ </ul>
35
49
  </div>
36
50
  </section>
37
51
 
38
- <section class="source-choices" aria-label="Open a repository or audit a website">
39
- <article class="source-card">
40
- <span class="source-layer">Repository</span>
41
- <div class="source-icon">⌘</div>
42
- <p class="eyebrow">This machine</p>
43
- <h2>Open a checkout</h2>
44
- <p>Start the Studio from the repository you want to test. Tapp detects its iOS, Android and web targets, builds with your local toolchain, and never uploads source.</p>
45
- <pre class="command"><code>npx -y @aarwitz/tapp@latest app /path/to/repo</code></pre>
46
- <small>Already have a terminal in the repository? <code>tapp app .</code> does the same.</small>
47
- </article>
48
- <article class="source-card website-card">
49
- <span class="source-layer">Website</span>
50
- <div class="source-icon">⌁</div>
51
- <p class="eyebrow">No source code</p>
52
- <h2>Audit a website</h2>
53
- <p>Read-only: Tapp renders up to six pages and reports what is broken as served — dead controls, broken images and links, failed requests, layout that scrolls sideways on a phone. Nothing is clicked, typed or submitted, so it is safe on production or a site you do not own. No release verdict without source.</p>
54
- <form class="audit-form" id="onboarding-audit-form">
55
- <label class="field"><span>Website URL</span><input id="onboarding-audit-url" name="url" type="url" inputmode="url" placeholder="https://example.com" required autocomplete="off"></label>
56
- <button class="primary" type="submit" id="onboarding-audit-start">Audit read-only</button>
57
- </form>
58
- </article>
52
+ <section class="prompt-block">
53
+ <h1>What should tapp test?</h1>
54
+ <form class="prompt-form" id="prompt-form" autocomplete="off">
55
+ <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>
56
+ <button class="primary prompt-go" type="submit" id="prompt-start" aria-label="Start">→</button>
57
+ </form>
58
+ <ul class="prompt-suggestions" aria-label="Examples">
59
+ <li><button type="button" 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>
60
+ <li><button type="button" 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>
61
+ <li><button type="button" data-prompt="owner/repo"><span>🐙</span><b>owner/repo</b><small>clone from GitHub into an isolated workspace, then the same</small></button></li>
62
+ <li><button type="button" data-prompt="com.company.app"><span>📱</span><b>com.company.app</b><small>explore a build already on the booted simulator (or give a .app / .apk)</small></button></li>
63
+ </ul>
64
+ <p class="prompt-note" id="privacy-note-detail">Everything runs on this machine. Exploration, replay and merge decisions are deterministic and need no API key.</p>
65
+ <span class="sr-only" id="privacy-note-title">Your code stays on this machine.</span>
59
66
  </section>
60
-
61
- <div class="privacy-note"><strong id="privacy-note-title">Your code stays on this machine.</strong><span id="privacy-note-detail">Exploration, replay and merge decisions are deterministic and need no API key. This machine must stay open while a run is in progress.</span></div>
62
67
  </main>
63
68
 
64
69
  <div class="product-shell hidden" id="product-shell">
@@ -82,7 +87,7 @@
82
87
  <span class="mode-pill" id="mode-pill">Self-host · this machine</span>
83
88
  </div>
84
89
  <div class="sidebar-footer">
85
- <button class="quiet" id="change-source">⌁ Audit a website</button>
90
+ <button class="quiet" id="change-source">+ Test something else</button>
86
91
  <button class="quiet hidden" id="refresh-project">Refresh</button>
87
92
  </div>
88
93
  </aside>
@@ -90,19 +95,17 @@
90
95
  <main class="workspace">
91
96
  <section class="workspace-view active" data-view-panel="overview" id="overview">
92
97
  <div class="command-bar">
93
- <div><h1>Release check</h1><p><span id="app-name">Your project</span> · <span id="app-summary">Inspecting the repository for targets.</span></p></div>
98
+ <div><h1 id="app-name">Your project</h1><p id="app-summary">Inspecting the repository for targets.</p></div>
94
99
  <div class="command-actions">
95
100
  <span class="phase-pill hidden" id="phase-pill"><span class="spinner"></span><span id="phase-pill-text">Working…</span></span>
101
+ <div class="idle-badges" id="idle-badges"></div>
96
102
  <button class="primary" id="command-run">Run release check</button>
97
103
  </div>
98
104
  </div>
99
105
  <div class="run-progress hidden" id="run-progress"><span class="progress-track"><span id="run-progress-bar"></span></span><span id="run-progress-text">Starting…</span></div>
100
- <div class="idle-badges" id="idle-badges"></div>
101
- <hr class="command-divider">
102
106
 
103
- <section class="evidence-section">
104
- <div class="device-panel">
105
- <p class="feed-label" id="device-feed-label">Live feed</p>
107
+ <section class="stage" id="stage">
108
+ <div class="device-stage">
106
109
  <div class="device-frame" id="device-frame">
107
110
  <span class="notch"></span>
108
111
  <div class="device-screen">
@@ -111,23 +114,19 @@
111
114
  <div class="device-placeholder" id="device-placeholder"><div><strong>No live feed yet</strong>Run a release check or open a live session to see the real application here.</div></div>
112
115
  </div>
113
116
  </div>
114
- <div class="device-meta">
115
- <div><span>Device</span><strong id="device-meta-device">—</strong></div>
116
- <div><span>Screen</span><strong id="live-screen-title">—</strong></div>
117
- </div>
117
+ <div class="device-meta"><span id="device-feed-label">Live feed</span><span id="device-meta-device">—</span><span id="live-screen-title">—</span></div>
118
118
  </div>
119
- <span class="vrule"></span>
120
- <div class="chat-panel">
121
- <div class="chat-head"><div><h2>tapp chat</h2><p>The engine's own progress log: screens, actions and findings as they happen</p></div></div>
119
+
120
+ <aside class="chat-float" id="chat-float" aria-label="tapp chat">
121
+ <button class="chat-head" id="chat-toggle" aria-expanded="true" aria-controls="chat-transcript">
122
+ <span class="chat-avatar">💬</span>
123
+ <span class="chat-title">tapp<small id="chat-status">ready</small></span>
124
+ <span class="chat-caret" aria-hidden="true">▾</span>
125
+ </button>
122
126
  <div class="chat-transcript" id="chat-transcript"></div>
123
- <div class="chat-footer">Nothing here is generated after the fact.</div>
124
- </div>
127
+ </aside>
125
128
  </section>
126
129
 
127
- <div class="view-heading" style="margin-top:20px">
128
- <div class="decision-card neutral" id="decision-card"><span class="decision-label">CURRENT DECISION</span><strong id="decision-title">Not evaluated</strong><span id="decision-detail">Run a conclusive release gate to establish evidence.</span></div>
129
- </div>
130
-
131
130
  <section class="panel section" id="target-stage">
132
131
  <div class="section-heading"><div><p class="eyebrow">Build & run</p><h2>Choose the product target</h2><p>Tapp detected these targets from source. With more than one, you choose; nothing builds until you do.</p></div><span class="status-chip" id="target-status">No target selected</span></div>
133
132
  <div class="target-choice-callout hidden" id="target-choice-callout"><span>1</span><div><strong>Choose what Tapp should test</strong><small>Nothing will build until you select a target. Tapp never guesses when a repository contains multiple applications.</small></div></div>
@@ -140,7 +139,7 @@
140
139
  </section>
141
140
 
142
141
  <section class="panel section live-session-panel hidden" id="live-session-panel">
143
- <div class="section-heading"><div><p class="eyebrow">Live application</p><h2>Drive the running target</h2><p>The device feed above is the real application. Semantic controls refresh after every action; successful actions are recorded as a Flow you can save.</p></div><div class="button-row"><span class="status-chip" id="live-platform">Target</span><span class="status-chip" id="live-recorded-steps">0 recorded steps</span><button class="quiet" id="refresh-live-session">Refresh</button><button class="secondary" id="end-session">End session</button></div></div>
142
+ <div class="section-heading"><div><p class="eyebrow">Live application</p><h2>Drive the running target</h2><p>The device above is the real application. Semantic controls refresh after every action; successful actions are recorded as a Flow you can save.</p></div><div class="button-row"><span class="status-chip" id="live-platform">Target</span><span class="status-chip" id="live-recorded-steps">0 recorded steps</span><button class="quiet" id="refresh-live-session">Refresh</button><button class="secondary" id="end-session">End session</button></div></div>
144
143
  <div class="live-layout">
145
144
  <aside class="live-controls"><div class="live-controls-heading"><div><strong>Semantic controls</strong><small id="live-control-count">0 available</small></div></div><div id="live-control-list"><div class="empty">Controls appear when the session starts.</div></div><div class="manual-action"><label><span>Target or field</span><input id="live-action-target" placeholder="Accessibility id or visible label"></label><label><span>Text <i>for type/wait</i></span><input id="live-action-text" autocomplete="off"></label><div class="button-row"><button class="secondary" id="live-tap">Tap</button><button class="secondary" id="live-type">Type</button><button class="quiet" id="live-back">Back</button><button class="quiet" id="live-swipe">Swipe up</button></div></div></aside>
146
145
  <div class="flow-recorder-panel"><div class="flow-recorder-head"><div><strong>Keep this journey as a deterministic Flow</strong><small>Saved Flows replay without AI; promote them into the gate from the repository.</small></div></div><div class="flow-recorder"><label><span>Flow name</span><input id="live-flow-name" placeholder="Checkout smoke"></label><button class="primary" id="save-live-flow">Save Flow</button></div></div>
@@ -148,12 +147,12 @@
148
147
  </section>
149
148
 
150
149
  <section class="overview-grid">
151
- <article class="panel summary-panel"><div class="section-heading compact"><div><p class="eyebrow">Latest evidence</p><h2>What the last run proved</h2></div><button class="quiet" data-view="runs">All runs</button></div><div id="overview-evidence"><div class="empty">No run yet.</div></div></article>
150
+ <article class="panel summary-panel"><div class="section-heading compact"><div><p class="eyebrow">Latest evidence</p><h2>What the last run proved</h2></div><button class="quiet" data-view="runs">All runs</button></div><div class="decision-card neutral" id="decision-card"><span class="decision-label">CURRENT DECISION</span><strong id="decision-title">Not evaluated</strong><span id="decision-detail">Run a conclusive release gate to establish evidence.</span></div><div id="overview-evidence"><div class="empty">No run yet.</div></div></article>
152
151
  </section>
153
152
  </section>
154
153
 
155
154
  <section class="workspace-view" data-view-panel="runs">
156
- <div class="view-heading simple"><div><p class="eyebrow">Runs</p><h1>Every run, with its evidence</h1><p>Release checks on this repository and read-only website audits. Each opens the report page the engine wrote.</p></div><button class="primary" id="run-gate">Run release gate</button></div>
155
+ <div class="view-heading simple"><div><p class="eyebrow">Runs</p><h1>Every run, with its evidence</h1><p>Release checks, explorations and read-only website audits. Each opens the report page the engine wrote.</p></div><button class="primary" id="run-gate">Run release gate</button></div>
157
156
  <section class="panel section audit-panel">
158
157
  <div class="section-heading compact"><div><p class="eyebrow">Website</p><h2>Audit a website — read-only</h2><p>Up to six pages, nothing clicked. Safe on production or a site you do not own; no release verdict without source.</p></div></div>
159
158
  <form class="audit-form" id="runs-audit-form">
@@ -8,7 +8,7 @@ export const customerProductContract = Object.freeze({
8
8
  interface: "customer-browser",
9
9
  targetPlatforms: ["ios", "android", "web"],
10
10
  // A repository is opened by path (`tapp app /path/to/repo`); a website by URL in the Studio.
11
- repositorySources: ["local-path"],
11
+ repositorySources: ["local-path", "github"],
12
12
  entryLayers: ["repository", "website"],
13
13
  views: [
14
14
  { id: "overview", label: "Overview", capabilities: ["target-selection", "release-check", "live-feed", "progress-transcript", "live-session", "flow-recording", "latest-evidence"] },
@@ -14,3 +14,90 @@ export function productJourneyFlags({ status = {}, hasTarget = false, hasEvidenc
14
14
  export function operationIsPending(status) {
15
15
  return ["queued", "claimed", "running"].includes(String(status || ""));
16
16
  }
17
+
18
+ // What a person typed into "What should tapp test?" — classified the same way on the server.
19
+ // Order matters: a GitHub URL is a URL, so it is checked before the generic http(s) rule.
20
+ export function classifyPrompt(raw) {
21
+ const input = String(raw || "").trim();
22
+ if (!input) return { kind: "empty", value: "" };
23
+ const github = input.match(/^(?:https?:\/\/)?(?:www\.)?github\.com\/([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+?)(?:\.git)?(?:\/.*)?$/i) || input.match(/^([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)$/);
24
+ if (github && !/^https?:\/\/(?!(?:www\.)?github\.com)/i.test(input) && !input.startsWith("/") && !input.startsWith("~")) {
25
+ return { kind: "github", value: github[1].replace(/\.git$/, "") };
26
+ }
27
+ if (/^https?:\/\//i.test(input)) return { kind: "url", value: input };
28
+ if (/\.apk$/i.test(input)) return { kind: "apk", value: input };
29
+ if (/\.app\/?$/i.test(input) && /[\/~]/.test(input)) return { kind: "app", value: input.replace(/\/$/, "") };
30
+ // Reverse-DNS reads as a bundle id (com.company.app); a hostname puts the TLD last (company.com).
31
+ if (/^(?:com|org|net|io|co|dev|app|ai|me|us|uk|de|fr|se|edu|gov)\.[A-Za-z][A-Za-z0-9-]*(?:\.[A-Za-z0-9-]+)+$/i.test(input)) return { kind: "bundle", value: input };
32
+ if (/^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$/.test(input)) return { kind: "url", value: `https://${input}` };
33
+ if (input.startsWith("/") || input.startsWith("~") || input.startsWith("./") || input.startsWith("../")) return { kind: "path", value: input };
34
+ return { kind: "business", value: input };
35
+ }
36
+
37
+ // Renders one engine progress line as a chat line: an emoji and the engine's own words. The
38
+ // text is never rewritten beyond trimming; the icon is derived from what the engine said.
39
+ const RULES = [
40
+ [/^(?:Opened|Open(?:ing)?) /i, "📍"],
41
+ [/^(?:Reached|Navigated to|Now on) /i, "🧭"],
42
+ [/^(?:Tapped|Tap(?:ping)?|Clicked|Pressed) /i, "👆"],
43
+ [/^(?:Typed|Filled|Entered|Type) /i, "⌨️"],
44
+ [/^(?:Swiped|Swiping|Edge-swiping|Scrolled|Scrolling)/i, "↕️"],
45
+ [/^(?:Went back|Back|Finished with .* going back|Going back)/i, "◀️"],
46
+ [/^(?:Probing|Looking for|Checking)/i, "🔎"],
47
+ [/^(?:Switching to|Switched to)/i, "🗂️"],
48
+ [/sign(?:ed|ing)? in|login|logged in|credentials/i, "🔐"],
49
+ [/screenshot|captured frame|snapshot/i, "📸"],
50
+ [/^(?:Building|Compiling|Build )/i, "🔨"],
51
+ [/^(?:Installing|Installed|Install )/i, "📦"],
52
+ [/^(?:Launching|Launched|Booting|Booted|Starting the app|Opening the)/i, "📱"],
53
+ [/^(?:Cloning|Connected |Cloned)/i, "🐙"],
54
+ [/^(?:Inspecting|Detected|Found \d+ target|Reading the repository)/i, "🔎"],
55
+ [/^(?:Audited|Auditing|Opening .* read-only)/i, "🔍"],
56
+ [/^(?:Exploring|Explore )/i, "🧭"],
57
+ [/^(?:Replaying|Replay |Running flow|Flow )/i, "▶️"],
58
+ [/^(?:Gate|Release gate|Evaluating)/i, "⚖️"],
59
+ [/^\d+\/\d+ actions/i, "⏳"],
60
+ [/waiting|waited|settling/i, "⏳"],
61
+ [/^(?:Timed out|Failed|Error|Could not)/i, "⚠️"],
62
+ ];
63
+
64
+ export function narrate(entry = {}, { platform = "" } = {}) {
65
+ const text = String(entry.text || "").trim().replace(/\s+/g, " ");
66
+ if (!text) return null;
67
+ const progress = text.match(/^(\d+)\/(\d+) actions(?: · (\d+) (?:states?|pages?|screens?)[^·]*)?/i);
68
+ if (progress) return { kind: "progress", icon: "⏳", text, current: Number(progress[1]), total: Number(progress[2]), states: progress[3] ? Number(progress[3]) : null };
69
+ for (const [pattern, icon] of RULES) {
70
+ if (pattern.test(text)) {
71
+ const kind = /^(?:Timed out|Failed|Error|Could not)/i.test(text) ? "warning" : "step";
72
+ const deviceIcon = icon === "📱" ? (platform === "web" ? "🌐" : platform === "android" ? "🤖" : "📱") : icon;
73
+ return { kind, icon: deviceIcon, text };
74
+ }
75
+ }
76
+ return { kind: entry.phase && !["explore", "runtime"].includes(entry.phase) ? "phase" : "step", icon: entry.phase === "runtime" ? "⚙️" : "•", text };
77
+ }
78
+
79
+ export function narrateFinding(finding = {}) {
80
+ const severity = String(finding.severity || "info").toLowerCase();
81
+ const icon = { critical: "🔴", high: "🟠", medium: "🟡", low: "⚪️" }[severity] || "•";
82
+ const where = finding.screen ? ` on ${finding.screen}` : "";
83
+ return { kind: "finding", severity, icon, text: `${finding.title || finding.message || finding.type || "Finding"}${where}` };
84
+ }
85
+
86
+ // The summary card at the end of a run: the gate's outcome when there is one, otherwise what the
87
+ // engine's headline says it observed. Never a score.
88
+ export function summarize(name, result = {}) {
89
+ const report = result?.report || result;
90
+ const gateOutcome = report?.gate?.outcome || (report?.gate?.failed === true ? "fail" : report?.gate ? "pass" : null);
91
+ if (name === "audit") {
92
+ const issues = result.issueCount || 0;
93
+ return { tone: issues ? "caution" : "ready", pill: issues ? `${issues} issue${issues === 1 ? "" : "s"} found` : "✓ Nothing broken observed", text: `${result.pagesAudited || 0} page(s) rendered read-only — nothing was clicked. ${issues ? "Each issue is listed in the run detail with the pages it appears on." : "This says the pages are served without structural defects, not that the site works."}` };
94
+ }
95
+ if (gateOutcome) {
96
+ const tone = { pass: "ready", fail: "blocked", inconclusive: "caution" }[gateOutcome] || "caution";
97
+ const pill = { pass: "✓ Ready to merge", fail: "× Do not merge", inconclusive: "◐ Inconclusive" }[gateOutcome];
98
+ return { tone, pill, text: (report.gate?.reasons || [report.headline || "Release gate completed."]).join(" · ") };
99
+ }
100
+ if (report?.inconclusive) return { tone: "caution", pill: "◐ Inconclusive", text: report.headline || "Exploration could not see enough to conclude." };
101
+ if (report?.headline) return { tone: "neutral", pill: `${report.screensExplored || 0} screens · ${report.actionsPerformed || 0} actions · ${(report.findings || []).length} findings`, text: /not a release decision/i.test(report.headline) ? report.headline : `${report.headline} An observation, not a release decision.` };
102
+ return { tone: "neutral", pill: "Done", text: `${name} completed.` };
103
+ }
@@ -1,7 +1,7 @@
1
1
  # Browser Studio
2
2
 
3
- Status: current product contract as of 2026-10-15 (ADR-0006, owner decision). Supersedes the
4
- "desktop-parity Command Center" framing of 2026-10-14.
3
+ Status: current product contract as of 2026-10-19 (ADR-0006, owner decision, amended). Supersedes
4
+ the "desktop-parity Command Center" framing of 2026-10-14.
5
5
 
6
6
  The Studio in `browser/` is the one browser surface. It is a **run viewer**: point Tapp at a
7
7
  repository target or a website, watch the run live, open its evidence. It never scores or judges
@@ -12,22 +12,38 @@ embeds these same assets at build time.
12
12
  ## Start locally
13
13
 
14
14
  ```bash
15
- npx -y @aarwitz/tapp@latest app /path/to/repo # a repository on this machine
16
- npx -y @aarwitz/tapp@latest app # no repository: website audits only
15
+ npx -y @aarwitz/tapp@latest app # opens on the prompt
16
+ npx -y @aarwitz/tapp@latest app /path/to/repo # opens straight onto that repository
17
17
  ```
18
18
 
19
19
  Tapp prints an authenticated one-time launch URL and opens it in the default browser (`--no-open`
20
- to copy it by hand, `--port 4317` for a fixed loopback port). A repository is opened from the
21
- machine the Studio runs on; the Studio does not upload or clone source. Everything runs on this
22
- machine with its own toolchain (Xcode for iOS, JDK/SDK + `adb` for Android, Playwright Chromium
23
- for web), which must stay open while a run is in progress.
20
+ to copy it by hand, `--port 4317` for a fixed loopback port). Everything runs on this machine
21
+ with its own toolchain (Xcode for iOS, JDK/SDK + `adb` for Android, Playwright Chromium for
22
+ web), which must stay open while a run is in progress. Nothing is uploaded anywhere.
23
+
24
+ ## The prompt
25
+
26
+ With nothing open, the Studio shows one field — **What should tapp test?** — above a short
27
+ looping animation of a device being driven (launch, tap, tap, screenshot, ✓). It accepts:
28
+
29
+ | You type | What happens |
30
+ |---|---|
31
+ | `https://example.com` (or `example.com`) | A read-only website audit; the stage takes a browser's shape. |
32
+ | `~/code/my-app`, `/path/to/repo` | That folder becomes the project: targets are detected, nothing builds until one is chosen. Local Studio only. |
33
+ | `owner/repo`, `github.com/owner/repo` | Cloned with `gh` into an isolated workspace under `TAPP_HOME`, then the same. |
34
+ | `com.company.app` | Explored on the booted iOS simulator as it is (no build). |
35
+ | `/path/to/Demo.app`, `~/Downloads/app.apk` | Installed on the booted simulator / connected device, then explored. |
36
+ | a business name | Answered honestly: nothing discovers surfaces from a name yet; paste its URL. |
37
+
38
+ The server classifies the input again (`classifyPrompt` in `browser/view-model.js` is shared) and
39
+ refuses what the mode cannot do: a hosted Studio cannot open a path or a build on your machine.
24
40
 
25
41
  ## What is on the page
26
42
 
27
43
  | View | What it shows | Operations |
28
44
  |---|---|---|
29
- | Overview | The detected targets (an explicit choice when there are several), the live device feed, "tapp chat" (the engine's own progress log — nothing is generated after the fact), the current decision from the last gate, the latest evidence | `initialize` (inspect, then build + explore), live session `start / act / save-flow / end`, release check |
30
- | Runs | Every run on this repository and every read-only website audit, newest first; each opens its evidence page. A URL field runs an audit from here. | `gate`, `audit` |
45
+ | Overview | The **stage**: the device as large as the window allows, in its platform's aspect ratio (phone portrait for iOS and Android, browser landscape for web), showing the live frame or the newest screenshot the run wrote. The **chat** floats over its corner on a translucent ground, collapses to a pill, and narrates the engine's own progress log one emoji-led line at a time (👆 Tapped, ⌨️ Typed, 🔐 Signed in, 📍 Opened, 🧭 Reached, 📸 screenshots inline), then attaches the recording and `report.html` and ends with a pill — `✓ Ready to merge`, `× Do not merge`, `◐ Inconclusive`, or for an exploration its counts — and the headline. Nothing is generated after the fact and nothing is a score. Below the stage: the detected targets (an explicit choice when there are several), the live-session controls, and the current decision from the last gate. | `open`, `initialize` (inspect, then build + explore), `explore-build`, live session `start / act / save-flow / end`, release check |
46
+ | Runs | Every run on this repository, every exploration started from the prompt, and every read-only website audit, newest first; each opens its evidence page. A URL field runs an audit from here. | `gate`, `audit` |
31
47
 
32
48
  A **website audit** is `explore --read-only`: up to six same-origin pages are rendered and read —
33
49
  dead controls, broken images/assets/links, failed requests, JS exceptions, mixed content,
@@ -51,7 +67,8 @@ run happens, driving it by hand, and reading evidence.
51
67
  target choice, exploration, a live session that records a Flow, the gate, and the runs list.
52
68
  `tests/browser-onboarding.test.js` covers the no-repository start and a read-only website audit;
53
69
  `tests/browser-product.test.js` covers authentication, CSRF, the audit operation and the removed
54
- endpoints answering 404.
70
+ endpoints answering 404. `tests/browser-chat-narration.test.js` covers prompt classification and
71
+ the chat's narration and summary without a browser.
55
72
 
56
73
  ## Hosted relationship
57
74
 
@@ -14,6 +14,8 @@ import { BrowserWorkspaceRegistry } from "./browser-workspaces.js";
14
14
  import { selectApplicationTarget } from "./ci-setup.js";
15
15
  import { initializeProductProject, prepareProductTarget, readProductProject, runProductGate } from "./product-operations.js";
16
16
  import { readCaptureProvenance } from "./capture-provenance.js";
17
+ import { collectShots } from "./html-report.js";
18
+ import { classifyPrompt } from "../../browser/view-model.js";
17
19
 
18
20
  const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
19
21
  const assetRoot = path.join(packageRoot, "browser");
@@ -131,6 +133,32 @@ function listAudits(limit = 50) {
131
133
  return audits.sort((a, b) => b.createdAt.localeCompare(a.createdAt)).slice(0, limit);
132
134
  }
133
135
 
136
+ // Everything the Studio can show for one capture, as paths relative to /evidence/captures/<id>/.
137
+ function captureFiles(captureId) {
138
+ const root = capturePath(captureId, ".");
139
+ if (!root || !fs.existsSync(root)) return null;
140
+ const shots = collectShots(root).slice(0, 24);
141
+ const recording = ["exploration.webm", "exploration.mov", "exploration.mp4"].find((name) => fs.existsSync(path.join(root, name))) || null;
142
+ return { id: captureId, shots, recording, report: fs.existsSync(path.join(root, "report.html")) ? "report.html" : null, provenance: readCaptureProvenance(root) };
143
+ }
144
+
145
+ // Explorations started from the prompt (a bundle id, an .app or .apk) have no repository to list
146
+ // them under; they are listed from their captures like audits are.
147
+ function listBuildExplores(limit = 50) {
148
+ const root = captureRoot();
149
+ let names;
150
+ try { names = fs.readdirSync(root); } catch { return []; }
151
+ const runs = [];
152
+ for (const name of names) {
153
+ const provenance = readCaptureProvenance(path.join(root, name));
154
+ if (!provenance || provenance.kind !== "explore" || provenance.origin !== "studio-prompt") continue;
155
+ let report = null;
156
+ try { report = JSON.parse(fs.readFileSync(path.join(root, name, "report.json"), "utf8")); } catch { /* older capture */ }
157
+ runs.push({ id: name, createdAt: provenance.createdAt, platform: provenance.platform, target: provenance.target, report });
158
+ }
159
+ return runs.sort((a, b) => b.createdAt.localeCompare(a.createdAt)).slice(0, limit);
160
+ }
161
+
134
162
  function openBrowser(url) {
135
163
  const invocation = process.platform === "darwin" ? ["open", [url]]
136
164
  : process.platform === "win32" ? ["cmd", ["/c", "start", "", url]]
@@ -142,7 +170,7 @@ function openBrowser(url) {
142
170
  function publicJob(job, { hosted = false } = {}) {
143
171
  return {
144
172
  id: job.id, operation: job.operation, status: job.status, repositoryId: job.repositoryId || null,
145
- createdAt: job.createdAt, completedAt: job.completedAt || null, progress: job.progress.slice(-80), frame: !!job.latestFrame,
173
+ createdAt: job.createdAt, completedAt: job.completedAt || null, progress: job.progress.slice(-80), frame: !!job.latestFrame || !!job.liveSimulator, platform: job.platform || null,
146
174
  result: hosted ? hostedPayload(job.result) : job.result || null,
147
175
  error: job.error || null,
148
176
  };
@@ -430,7 +458,14 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
430
458
  return;
431
459
  }
432
460
  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; }
433
- if (request.method === "GET" && url.pathname === "/api/audits") { json(response, 200, { audits: hosted ? hostedPayload(listAudits()) : listAudits() }); return; }
461
+ if (request.method === "GET" && url.pathname === "/api/audits") { json(response, 200, { audits: hosted ? hostedPayload(listAudits()) : listAudits(), explores: hosted ? hostedPayload(listBuildExplores()) : listBuildExplores() }); return; }
462
+ const filesMatch = url.pathname.match(/^\/api\/captures\/([A-Za-z0-9._-]{1,128})\/files$/);
463
+ if (request.method === "GET" && filesMatch) {
464
+ const files = captureFiles(filesMatch[1]);
465
+ if (!files) { json(response, 404, { error: "No such capture" }); return; }
466
+ json(response, 200, files);
467
+ return;
468
+ }
434
469
  if (request.method === "GET" && url.pathname === "/api/project") { json(response, 200, hosted ? hostedPayload(projectSnapshot(registry)) : projectSnapshot(registry)); return; }
435
470
  if (request.method === "GET" && url.pathname === "/api/live-session") { json(response, 200, liveSession || { active:false }); return; }
436
471
  if (request.method === "GET" && url.pathname === "/api/live-session/frame") {
@@ -454,6 +489,17 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
454
489
  const jobFrameMatch = url.pathname.match(/^\/api\/jobs\/([a-f0-9]{20})\/frame$/);
455
490
  if (request.method === "GET" && jobFrameMatch) {
456
491
  const job = jobs.get(jobFrameMatch[1]);
492
+ if (job && !job.latestFrame && job.liveSimulator && job.status === "running") {
493
+ // An iOS exploration drives the booted simulator; photograph it (throttled) the way a
494
+ // live session does, so the stage shows the device while the run happens.
495
+ const engine = await import("./index.js");
496
+ const frame = await engine.captureScreenshotImage(1000);
497
+ if (frame?.error) { json(response, 404, { error: frame.error }); return; }
498
+ const data = Buffer.from(frame.data, "base64");
499
+ response.writeHead(200, { "content-type": frame.mimeType || "image/jpeg", "content-length": data.length, "cache-control": "no-store", "x-content-type-options": "nosniff" });
500
+ response.end(data);
501
+ return;
502
+ }
457
503
  if (!job?.latestFrame || !fs.existsSync(job.latestFrame)) { json(response, 404, { error: "No exploration frame yet" }); return; }
458
504
  const data = fs.readFileSync(job.latestFrame);
459
505
  response.writeHead(200, { "content-type": job.latestFrame.endsWith(".jpg") || job.latestFrame.endsWith(".jpeg") ? "image/jpeg" : "image/png", "content-length": data.length, "cache-control": "no-store", "x-content-type-options": "nosniff" });
@@ -482,6 +528,73 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
482
528
  requireMutationAuth(request, hosted ? publicOrigins : origin, csrfToken);
483
529
  const body = await readJsonBody(request);
484
530
  const operation = url.pathname.slice("/api/operations/".length);
531
+ // "What should tapp test?" — a repository on this machine or on GitHub becomes the current
532
+ // project; a build is explored directly; a URL goes to `audit`; a business name is not
533
+ // something Tapp can resolve yet, and says so instead of guessing.
534
+ if (operation === "open") {
535
+ const prompt = classifyPrompt(body.input);
536
+ if (liveSession?.active) throw Object.assign(new Error("End the active live session before opening another project"), { statusCode: 409 });
537
+ if (prompt.kind === "path") {
538
+ if (hosted) throw Object.assign(new Error("A hosted Studio cannot open a path on your machine; run `tapp app /path/to/repo` locally"), { statusCode: 400 });
539
+ const resolved = prompt.value.startsWith("~") ? path.join(os.homedir(), prompt.value.slice(1)) : path.resolve(prompt.value);
540
+ if (!fs.existsSync(resolved) || !fs.statSync(resolved).isDirectory()) throw Object.assign(new Error(`No folder at ${resolved}`), { statusCode: 400 });
541
+ const repository = registry.addExisting(resolved);
542
+ json(response, 200, { kind: "repository", repository: hosted ? hostedRepository(repository) : repository });
543
+ return;
544
+ }
545
+ if (prompt.kind === "github") {
546
+ const job = startJob(operation, async (progress) => ({ kind: "repository", repository: await registry.cloneGithub(prompt.value, progress) }), null);
547
+ json(response, 202, { job: publicJob(job, { hosted }) });
548
+ return;
549
+ }
550
+ if (prompt.kind === "business") {
551
+ json(response, 200, { kind: "business", message: `I can't find a business's website or app from a name yet — paste its URL and I'll audit it read-only, or open its repository.` });
552
+ return;
553
+ }
554
+ json(response, 200, { kind: prompt.kind, value: prompt.value });
555
+ return;
556
+ }
557
+ if (operation === "explore-build") {
558
+ if (hosted) throw Object.assign(new Error("Builds are explored on the machine that has the simulator; run the Studio locally"), { statusCode: 400 });
559
+ const prompt = classifyPrompt(body.input);
560
+ 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 });
561
+ const job = startJob(operation, async (progress) => {
562
+ const engine = await import("./index.js");
563
+ job.platform = prompt.kind === "apk" ? "android" : "ios";
564
+ job.liveSimulator = job.platform === "ios";
565
+ const forward = (entry) => progress({ phase: "explore", text: entry.narrative || `${entry.action || 0}/${entry.max || 0} actions · ${entry.states || 0} states`, ...(entry.action ? { current: entry.action, total: entry.max } : {}), ...(entry.screen ? { screen: entry.screen } : {}), ...(entry.screenshot ? { screenshot: entry.screenshot } : {}) });
566
+ let result;
567
+ if (prompt.kind === "apk") {
568
+ progress({ phase: "runtime", text: `Installing ${path.basename(prompt.value)} on the connected Android device` });
569
+ result = await engine.runQaAndroid({ apkPath: prompt.value, appId: String(body.appId || ""), maxActions: Number(body.maxActions) || 40, timeout: Number(body.timeout) || 600, onProgress: forward });
570
+ } else {
571
+ let bundleId = prompt.value;
572
+ if (prompt.kind === "app") {
573
+ progress({ phase: "runtime", text: `Installing ${path.basename(prompt.value)} on the booted simulator` });
574
+ const installed = await engine.installAppOnBootedSim(prompt.value, { onStatus: (text) => progress({ phase: "runtime", text }) });
575
+ if (installed?.error) throw new Error(installed.error);
576
+ bundleId = installed.bundleId;
577
+ }
578
+ progress({ phase: "runtime", text: `Launching ${bundleId} on the booted simulator` });
579
+ result = await engine.runQaIos({ bundleId, maxActions: Number(body.maxActions) || 40, timeout: Number(body.timeout) || 600, device: String(body.device || ""), onProgress: forward });
580
+ }
581
+ if (result?.error) throw Object.assign(new Error(result.error), { details: result.details || {} });
582
+ const structured = result.structured;
583
+ // Mark the capture as prompt-started so the Studio lists it without a repository.
584
+ try {
585
+ const captureDir = structured?.capture?.path;
586
+ if (captureDir) {
587
+ const provenancePath = path.join(captureDir, "provenance.json");
588
+ const provenance = JSON.parse(fs.readFileSync(provenancePath, "utf8"));
589
+ fs.writeFileSync(provenancePath, JSON.stringify({ ...provenance, origin: "studio-prompt" }, null, 2));
590
+ fs.writeFileSync(path.join(captureDir, "report.json"), JSON.stringify({ headline: structured.headline, inconclusive: structured.inconclusive, screensExplored: structured.screensExplored, actionsPerformed: structured.actionsPerformed, findingCounts: structured.findingCounts, findings: structured.findings, checkedFor: structured.checkedFor, notChecked: structured.notChecked, platform: structured.platform, target: structured.target }, null, 2));
591
+ }
592
+ } catch { /* listing is a convenience; the capture is the evidence */ }
593
+ return structured;
594
+ }, null);
595
+ json(response, 202, { job: publicJob(job, { hosted }) });
596
+ return;
597
+ }
485
598
  // A website audit needs no repository: it is read-only against a URL and writes a capture.
486
599
  if (operation === "audit") {
487
600
  let target;
@@ -33,7 +33,7 @@ export function capturePlatform(captureDir) {
33
33
  // Two capture layouts exist: web runs write state_*.png at the capture root; iOS runs
34
34
  // export XCUITest attachments into screenshots/ as UUID files with a manifest carrying
35
35
  // the human-readable state_N_<Screen> names.
36
- function collectShots(captureDir) {
36
+ export function collectShots(captureDir) {
37
37
  const root = fs
38
38
  .readdirSync(captureDir)
39
39
  .filter((f) => f.endsWith(".png") && f.startsWith("state_"))
@@ -2274,6 +2274,10 @@ export async function runInitExploration({
2274
2274
  },
2275
2275
  mapDiff: previous ? diffUiMaps(previous, observed, { comparableFullSweep: false }) : null,
2276
2276
  inconclusive: qa.structured.inconclusive === true,
2277
+ headline: qa.structured.headline || "",
2278
+ screensExplored: qa.structured.screensExplored ?? 0,
2279
+ actionsPerformed: qa.structured.actionsPerformed ?? 0,
2280
+ findingCounts: qa.structured.findingCounts || null,
2277
2281
  findings: qa.structured.findings || [],
2278
2282
  capture: qa.structured.capture,
2279
2283
  reportHtml: qa.structured.reportHtml || null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aarwitz/tapp",
3
- "version": "0.18.2",
3
+ "version": "0.18.4",
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-audit.test.js tests/capture-provenance.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/browser-product.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-audit.test.js tests/capture-provenance.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/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",
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
  }