@aarwitz/tapp 0.20.0 → 0.20.2

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.20.0",
4
+ "version": "0.20.2",
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.20.0",
27
+ "@aarwitz/tapp@0.20.2",
28
28
  "mcp"
29
29
  ],
30
30
  "cwd": "${CLAUDE_PROJECT_DIR}"
package/bin/tapp.js CHANGED
@@ -138,8 +138,16 @@ function looksLikeCapture(value) {
138
138
  const raw = String(value || "").trim();
139
139
  if (!raw || raw.startsWith("-") || /^https?:\/\//i.test(raw)) return false;
140
140
  if (raw === "latest") return true;
141
- const marked = (dir) => { try { return fs.existsSync(path.join(dir, "ocqa-markers.txt")); } catch { return false; } };
142
- return marked(path.resolve(raw)) || marked(path.join(tappHome, "captures", raw));
141
+ // Markers, or a recording: a replayed Flow writes video and no markers, and reading it back is
142
+ // exactly what this is for.
143
+ const RECORDINGS = ["exploration.webm", "replay.webm", "exploration.mp4", "replay.mp4", "exploration.mov"];
144
+ const readable = (dir) => {
145
+ try {
146
+ if (fs.existsSync(path.join(dir, "ocqa-markers.txt"))) return true;
147
+ return RECORDINGS.some((name) => fs.existsSync(path.join(dir, name)));
148
+ } catch { return false; }
149
+ };
150
+ return readable(path.resolve(raw)) || readable(path.join(tappHome, "captures", raw));
143
151
  }
144
152
 
145
153
  function artifactKind(file) {
package/browser/app.js CHANGED
@@ -224,6 +224,16 @@ function renderLiveSession() {
224
224
  const hasFrame = !!$("#live-frame-image").getAttribute("src");
225
225
  $("#live-frame-loading").classList.toggle("hidden", hasFrame || !frameSource());
226
226
  $("#device-placeholder").classList.toggle("hidden", hasFrame);
227
+ // While a run is starting there is genuinely nothing to show yet — a browser is launching —
228
+ // but telling someone to "run a release check" while their run is already going reads as
229
+ // though nothing happened. Say what is actually true.
230
+ const waiting = !!state.activeJob && !hasFrame;
231
+ const title = $("#device-placeholder-title");
232
+ const detail = $("#device-placeholder-detail");
233
+ if (title) title.textContent = waiting ? "Opening the browser…" : "No live feed yet";
234
+ if (detail) detail.textContent = waiting
235
+ ? "The first screen appears here as soon as the page is rendered."
236
+ : "Run a release check or open a live session to see the real application here.";
227
237
  if (!state.activeJob) $("#live-screen-title").textContent = hasFrame ? $("#live-screen-title").textContent : "—";
228
238
  renderDeviceChrome();
229
239
  return;
@@ -416,10 +426,13 @@ async function finishTranscript(name, job) {
416
426
  const files = await api(`/api/captures/${encodeURIComponent(id)}/files`);
417
427
  if (files.shots?.length) {
418
428
  pushLine({ kind: "shots", shots: files.shots.slice(0, 3).map((shot) => ({ src: captureUrl(id, shot.src), href: captureUrl(id, shot.src), caption: shot.caption })) });
419
- // The stage keeps the run's final screen until something newer replaces it.
420
- if (!state.live?.active) {
429
+ // The stage keeps the run's final screen until something newer replaces it — but only
430
+ // when the run never put a live frame there. Evidence screenshots are full-page, so a
431
+ // long marketing page becomes a tall sliver once it is fitted to the stage; the viewport
432
+ // frame the run was already showing is the better picture of where it ended.
433
+ const image = $("#live-frame-image");
434
+ if (!state.live?.active && !image.getAttribute("src")) {
421
435
  const last = files.shots.at(-1);
422
- const image = $("#live-frame-image");
423
436
  image.onload = () => { $("#live-frame-loading").classList.add("hidden"); $("#device-placeholder").classList.add("hidden"); };
424
437
  image.src = captureUrl(id, last.src);
425
438
  $("#live-screen-title").textContent = last.caption || "";
@@ -111,7 +111,7 @@
111
111
  <div class="device-screen">
112
112
  <img id="live-frame-image" alt="Current application screen">
113
113
  <div id="live-frame-loading" class="hidden">Capturing live application…</div>
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>
114
+ <div class="device-placeholder" id="device-placeholder"><div><strong id="device-placeholder-title">No live feed yet</strong><span id="device-placeholder-detail">Run a release check or open a live session to see the real application here.</span></div></div>
115
115
  </div>
116
116
  </div>
117
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>
@@ -837,7 +837,7 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
837
837
  // Hand the page's screenshot to the progress channel: the Studio's device stage polls
838
838
  // the job's latest frame, and without this an audit watches an empty panel for its
839
839
  // whole run while the real screenshots sit in the capture.
840
- onPage: (page, n) => progress({ phase: "explore", text: `Audited ${page.url} — ${page.findings.length} finding(s)`, current: n, total: pages, ...(page.screenshot ? { screenshot: page.screenshot } : {}) }),
840
+ onPage: (page, n) => progress({ phase: "explore", text: `Audited ${page.url} — ${page.findings.length} finding(s)`, current: n, total: pages, ...(page.frame || page.screenshot ? { screenshot: page.frame || page.screenshot } : {}) }),
841
841
  });
842
842
  logUsage("audit.done", {
843
843
  visitor: (visitorId || "operator").slice(0, 8), host: safeHost(target.href),
@@ -29,13 +29,17 @@ export function resolveCapture(target = "") {
29
29
  try { entries = fs.readdirSync(root, { withFileTypes: true }).filter((e) => e.isDirectory()); } catch { return null; }
30
30
  const newest = entries
31
31
  .map((e) => ({ dir: path.join(root, e.name), at: fs.statSync(path.join(root, e.name)).mtimeMs }))
32
- .sort((a, b) => b.at - a.at)[0];
32
+ .sort((a, b) => b.at - a.at)
33
+ .find(({ dir }) => fs.existsSync(path.join(dir, "ocqa-markers.txt")) || !!findRecording(dir));
33
34
  return newest ? newest.dir : null;
34
35
  }
36
+ // A replayed Flow records video but writes no markers, so "has markers" was too narrow a test
37
+ // and `look` refused to open the very recordings it exists to read.
38
+ const readable = (dir) => fs.existsSync(path.join(dir, "ocqa-markers.txt")) || !!findRecording(dir);
35
39
  const direct = path.resolve(value);
36
- if (fs.existsSync(path.join(direct, "ocqa-markers.txt"))) return direct;
40
+ if (readable(direct)) return direct;
37
41
  const byId = path.join(root, value);
38
- if (fs.existsSync(path.join(byId, "ocqa-markers.txt"))) return byId;
42
+ if (readable(byId)) return byId;
39
43
  return null;
40
44
  }
41
45
 
@@ -260,11 +260,17 @@ async function auditOnePage(context, target, { timeoutMs, linkCheckLimit, captur
260
260
  // Where this page's screenshot landed, so a live viewer can show the page being audited
261
261
  // instead of an empty panel. Absolute, because that is what the progress channel forwards.
262
262
  let statePath = "";
263
+ let framePath = "";
263
264
  if (capture) {
264
265
  capture.states += 1;
265
266
  const stateName = `state_${capture.states}_${slug(target.pathname === "/" ? (controls.title || "home") : target.pathname)}.png`;
266
267
  statePath = path.join(capture.dir, stateName);
267
268
  await page.screenshot({ path: statePath, fullPage: true }).catch(() => page.screenshot({ path: statePath }).catch(() => {}));
269
+ // Evidence wants the whole page; a live viewer wants what a person would be looking at. A
270
+ // full-page shot of a long marketing page is a tall sliver once it is fitted into a
271
+ // device stage, so write a viewport-shaped frame alongside it for anything watching.
272
+ framePath = path.join(capture.dir, `frame_${capture.states}.png`);
273
+ await page.screenshot({ path: framePath }).catch(() => { framePath = statePath; });
268
274
  capture.emit("STATE", { screen, url: page.url(), elements: controls.controlCount, role: "page", controls: controls.dead.map((d) => d.label).filter(Boolean).slice(0, 40), inputs: [], settled: true, screenshot: stateName });
269
275
  for (const f of findings) {
270
276
  if (f.selector) {
@@ -290,6 +296,7 @@ async function auditOnePage(context, target, { timeoutMs, linkCheckLimit, captur
290
296
  ...(controls.wiringUnverifiable ? { wiringUnverifiable: controls.wiringUnverifiable } : {}),
291
297
  findings,
292
298
  ...(statePath ? { screenshot: statePath } : {}),
299
+ ...(framePath ? { frame: framePath } : {}),
293
300
  links: allowedLinks,
294
301
  };
295
302
  } finally {
@@ -304,7 +304,14 @@ export async function runWebFlow({ flow, url, logPath, screenshotDir, recordVide
304
304
  const pw = playwright || await loadPlaywright();
305
305
  const { webBrowserLaunchOptions } = await import("./web-explorer.js");
306
306
  const browser = await pw.chromium.launch(webBrowserLaunchOptions());
307
- const context = await browser.newContext({...webContextOptions({ device, viewport, devices: pw.devices }),...(recordVideoDir ? {recordVideo:{dir:recordVideoDir}} : {})});
307
+ const contextOptions = webContextOptions({ device, viewport, devices: pw.devices });
308
+ // Without an explicit size Playwright fits the recording into 800px, so a replay filmed at a
309
+ // desktop viewport came out small and soft however large the window was. Film at the size the
310
+ // run is actually rendered at, which is what exploration already does.
311
+ const context = await browser.newContext({
312
+ ...contextOptions,
313
+ ...(recordVideoDir ? { recordVideo: { dir: recordVideoDir, ...(contextOptions.viewport ? { size: contextOptions.viewport } : {}) } } : {}),
314
+ });
308
315
  const page = await context.newPage();
309
316
  const timeout = Number(flow.timeoutMs ?? flow.timeout) || DEFAULT_TIMEOUT;
310
317
  page.setDefaultTimeout(timeout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aarwitz/tapp",
3
- "version": "0.20.0",
3
+ "version": "0.20.2",
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",