@aarwitz/tapp 0.27.1 → 0.28.1

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.27.1",
4
+ "version": "0.28.1",
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.27.1",
27
+ "@aarwitz/tapp@0.28.1",
28
28
  "mcp"
29
29
  ],
30
30
  "cwd": "${CLAUDE_PROJECT_DIR}"
package/browser/app.css CHANGED
@@ -594,3 +594,4 @@ dialog::backdrop { background:rgba(0,0,0,.6); }
594
594
  .token-reveal button { font:inherit; font-size:12px; padding:7px 12px; border-radius:8px; cursor:pointer; }
595
595
  .owned-link { text-align:center; margin-top:10px; }
596
596
  .owned-link button { font:inherit; font-size:13px; padding:7px 14px; border-radius:999px; border:1px solid var(--line); background:var(--control); color:inherit; cursor:pointer; }
597
+ .read-only-note { margin:6px 0 14px; font-size:12.5px; line-height:1.5; }
package/browser/app.js CHANGED
@@ -551,7 +551,8 @@ function renderRunDetail(run) {
551
551
  const audit = run.audit;
552
552
  const counts = audit.findingCounts || {};
553
553
  const issues = audit.issues || [];
554
- $("#run-detail").innerHTML = `<div class="run-detail-head"><div><p class="eyebrow">READ-ONLY AUDIT</p><h2>${esc(audit.url)}</h2><small><code>${esc(audit.id)}</code> · ${compactDate(audit.createdAt)} · nothing was clicked</small></div>${evidenceLink(audit.id, "Visual report")}</div><div class="run-stats"><div><strong>${audit.pagesAudited || 0}</strong><small>pages</small></div><div><strong>${issues.length}</strong><small>distinct issues</small></div><div><strong>${counts.high || 0}</strong><small>high</small></div><div><strong>${counts.medium || 0}</strong><small>medium</small></div></div><h3>Issues</h3>${issues.length ? `<ul class="detail-list">${issues.slice(0, 40).map((issue) => `<li><b>${esc(issue.severity)}</b> · ${esc(issue.title)}${issue.pages?.length > 1 ? ` <small>(${issue.pages.length} pages)</small>` : ""}</li>`).join("")}</ul>` : '<p class="muted">Nothing broken was observed. This says the pages are served without structural defects, not that the site works.</p>'}${renderObservations(audit)}${detailLists(audit)}`;
554
+ $("#run-detail").innerHTML = `<div class="run-detail-head"><div><p class="eyebrow">READ-ONLY AUDIT</p><h2>${esc(audit.url)}</h2><small><code>${esc(audit.id)}</code> · ${compactDate(audit.createdAt)} · nothing was clicked</small></div>${evidenceLink(audit.id, "Visual report")}</div>
555
+ <p class="muted read-only-note">This pass only <b>looks</b>: it never presses, types or submits, so a pop-up stays where it is and anything behind a click was not seen.${state.session?.access === "anonymous" ? " Sign in and tapp goes inside instead — it gets past pop-ups, clicks the controls, and asks you for a test account when it meets a sign-in." : " Put a URL in the prompt and tapp goes inside instead."}</p><div class="run-stats"><div><strong>${audit.pagesAudited || 0}</strong><small>pages</small></div><div><strong>${issues.length}</strong><small>distinct issues</small></div><div><strong>${counts.high || 0}</strong><small>high</small></div><div><strong>${counts.medium || 0}</strong><small>medium</small></div></div><h3>Issues</h3>${issues.length ? `<ul class="detail-list">${issues.slice(0, 40).map((issue) => `<li><b>${esc(issue.severity)}</b> · ${esc(issue.title)}${issue.pages?.length > 1 ? ` <small>(${issue.pages.length} pages)</small>` : ""}</li>`).join("")}</ul>` : '<p class="muted">Nothing broken was observed. This says the pages are served without structural defects, not that the site works.</p>'}${renderObservations(audit)}${detailLists(audit)}`;
555
556
  return;
556
557
  }
557
558
  if (run.kind === "explore") {
@@ -15,7 +15,7 @@ import { createRequire } from "module";
15
15
  import {
16
16
  NAV_TIMEOUT_MS, loadPlaywright, webBrowserLaunchOptions, webContextOptions, installWebListenerTracking,
17
17
  waitForWebStability, captureElementEvidence, shouldReportWebRequestFailure, auditStructuralControls,
18
- auditFindingsFromControls, slug,
18
+ auditFindingsFromControls, slug, detectBlockingOverlay, chooseOverlayDismissal,
19
19
  } from "./web-explorer.js";
20
20
  import { buildQaReport } from "./report.js";
21
21
  import { collectPageObservations, observationFindings, OBSERVATION_SCOPE } from "./page-observations.js";
@@ -258,6 +258,18 @@ async function auditOnePage(context, target, { timeoutMs, linkCheckLimit, captur
258
258
  // Things a person would notice and not like — counted and listed apart from defects, so the
259
259
  // issue count never quietly includes opinions. See page-observations.js.
260
260
  const observations = observationFindings(await collectPageObservations(page));
261
+ // A pop-up in front of the page is the first thing a visitor meets, and the read-only pass
262
+ // cannot press it — that is the promise. So say it is there, name it, and name the way out
263
+ // it offers, rather than quietly judging a page that was never visible.
264
+ const overlay = await detectBlockingOverlay(page).catch(() => null);
265
+ if (overlay) {
266
+ const wayOut = chooseOverlayDismissal(overlay.buttons);
267
+ observations.push({
268
+ category: "polish", severity: "medium", type: "blocking_overlay",
269
+ title: `A pop-up covers the page${overlay.heading ? `: “${overlay.heading}”` : ""} — nothing was clicked, so what it covers was not seen${wayOut ? ` (its way out is “${wayOut}”)` : ""}`,
270
+ target: overlay.heading || overlay.buttons[0] || "overlay",
271
+ });
272
+ }
261
273
  const screen = target.pathname + target.search;
262
274
  for (const f of [...findings, ...observations]) { f.screen = screen; if (!f.url) f.url = page.url(); }
263
275
 
@@ -300,6 +312,7 @@ async function auditOnePage(context, target, { timeoutMs, linkCheckLimit, captur
300
312
  // Why the wiring-dependent checks were skipped on this page, if they were.
301
313
  ...(controls.wiringUnverifiable ? { wiringUnverifiable: controls.wiringUnverifiable } : {}),
302
314
  findings,
315
+ ...(overlay ? { blockedByOverlay: true } : {}),
303
316
  ...(statePath ? { screenshot: statePath } : {}),
304
317
  ...(framePath ? { frame: framePath } : {}),
305
318
  links: allowedLinks,
@@ -498,6 +511,7 @@ export async function auditWebSite({
498
511
  await context.close();
499
512
  const findings = results.flatMap((r) => r.findings);
500
513
  const observations = dedupeSiteIssues(results.flatMap((r) => r.observations || []));
514
+ const coveredPages = results.filter((r) => r.blockedByOverlay).length;
501
515
  const issues = dedupeSiteIssues(findings);
502
516
  const bySeverity = { critical: 0, high: 0, medium: 0, low: 0 };
503
517
  for (const f of findings) if (f.severity in bySeverity) bySeverity[f.severity] += 1;
@@ -526,7 +540,12 @@ export async function auditWebSite({
526
540
  observationCount: observations.length,
527
541
  lookedForAlso: OBSERVATION_SCOPE,
528
542
  checkedFor: scope.checkedFor,
529
- notChecked: [...scope.notChecked, ...observationLimits, ...(skippedLinks.size ? ["Potential action/signed links and robots exclusions were not fetched; see skippedLinks."] : [])],
543
+ notChecked: [
544
+ ...scope.notChecked,
545
+ ...(coveredPages ? [`whatever a pop-up covered on ${coveredPages} page(s) — a read-only pass never presses anything, so it was not seen (sign in and tapp gets past it and clicks)`] : []),
546
+ ...observationLimits,
547
+ ...(skippedLinks.size ? ["Potential action/signed links and robots exclusions were not fetched; see skippedLinks."] : []),
548
+ ],
530
549
  pages: results,
531
550
  capture: null,
532
551
  };
@@ -395,13 +395,17 @@ export function webStateSignature(info) {
395
395
  // someone's behalf, so "reject" beats "accept" and "Allow Device Location" is never a candidate
396
396
  // however prominent it is. Then the ordinary ways out of an intake modal. A bare "no" or "close"
397
397
  // is last because it is the most likely to mean something else on a page.
398
+ // Ordered best-first: the way out that grants the least. Each is matched against the whole
399
+ // label and against its opening words, because real buttons say "Not now, thanks" and
400
+ // "Reject all cookies" as often as the bare phrase.
398
401
  const OVERLAY_DISMISSALS = [
399
- /^(reject|decline)( all| cookies| non-essential)?$/i,
400
- /^(necessary|essential) (cookies )?only$/i,
401
- /^(manage |cookie )?(preferences|settings)$/i,
402
- /^(not now|no thanks?|maybe later|later|skip|skip for now)$/i,
403
- /^(dismiss|close|got it|ok|okay|continue without|don't ask again)$/i,
404
- /^(×|✕|✖|x)$/i,
402
+ /^(reject|decline|deny|block)\b( all| cookies| non-essential)?/i,
403
+ /^(necessary|essential|required) (cookies )?only\b/i,
404
+ /^(continue without|use without|browse without|no thanks?|not now|maybe later|later|skip|dismiss)\b/i,
405
+ /^(don'?t ask( me)?( again)?|never|not interested)\b/i,
406
+ /^(manage |cookie )?(preferences|settings)\b/i,
407
+ /^(close|got it|okay|ok|dismiss|understood|no)\b/i,
408
+ /^(×|✕|✖|⨯|x)$/i,
405
409
  ];
406
410
  // Never press these to get past an overlay: each one grants something on the person's behalf.
407
411
  const OVERLAY_NEVER = /allow|accept|enable|agree|subscribe|sign ?up|turn on|share (my )?location|grant/i;
@@ -409,6 +413,8 @@ const OVERLAY_NEVER = /allow|accept|enable|agree|subscribe|sign ?up|turn on|shar
409
413
  export function chooseOverlayDismissal(labels = []) {
410
414
  const cleaned = labels.map((label) => String(label || "").replace(/\s+/g, " ").trim()).filter(Boolean);
411
415
  for (const pattern of OVERLAY_DISMISSALS) {
416
+ // A label that grants something is never a way out, however much it looks like one
417
+ // ("Accept all", "Allow Device Location") — see OVERLAY_NEVER.
412
418
  const match = cleaned.find((label) => pattern.test(label) && !OVERLAY_NEVER.test(label));
413
419
  if (match) return match;
414
420
  }
@@ -424,34 +430,78 @@ export function chooseOverlayDismissal(labels = []) {
424
430
  * undiscovered. Escape closes a well-built dialog and nothing else, so find the dismissal the
425
431
  * overlay itself offers.
426
432
  */
427
- export async function dismissBlockingOverlay(page) {
428
- const choice = await page.evaluate(() => {
429
- const covering = [...document.querySelectorAll("div,section,aside,dialog")].filter((element) => {
433
+ /**
434
+ * Find what is standing in front of the page, without touching it.
435
+ *
436
+ * The read-only audit must not press anything — that is the whole promise — but it can still say
437
+ * a pop-up is there, name it, and name the way out it offers. A visitor meets that pop-up too.
438
+ */
439
+ export async function detectBlockingOverlay(page) {
440
+ // Overlays come in shapes, not one shape. A measured probe of the common ones found that a
441
+ // size-and-position rule written for a big centred modal misses a native <dialog> (absolute by
442
+ // default), a small bottom sheet, a short cookie bar and a corner toast — four of the five
443
+ // things that actually sit in front of real sites. Recognise the KIND of thing instead: a
444
+ // dialog by role, or anything lifted above the page on its own layer.
445
+ const found = await page.evaluate(() => {
446
+ const seen = document.querySelectorAll("[data-tapp-overlay]");
447
+ for (const old of seen) old.removeAttribute("data-tapp-overlay");
448
+ const viewport = { w: window.innerWidth, h: window.innerHeight };
449
+ const visible = (element) => {
450
+ const style = window.getComputedStyle(element);
451
+ if (style.display === "none" || style.visibility === "hidden" || Number(style.opacity) === 0) return false;
452
+ const rect = element.getBoundingClientRect();
453
+ return rect.width >= 80 && rect.height >= 40 && rect.bottom > 0 && rect.right > 0 && rect.top < viewport.h && rect.left < viewport.w;
454
+ };
455
+ const candidates = [];
456
+ for (const element of document.querySelectorAll('dialog[open],[role="dialog"],[role="alertdialog"],[aria-modal="true"],div,section,aside,form')) {
457
+ if (!visible(element)) continue;
430
458
  const style = window.getComputedStyle(element);
431
- if (style.position !== "fixed" && style.position !== "sticky") return false;
432
- if (style.display === "none" || style.visibility === "hidden") return false;
459
+ const dialogish = element.matches('dialog[open],[role="dialog"],[role="alertdialog"],[aria-modal="true"]');
460
+ // Fixed and sticky are overlay layers on their own; absolute only counts when it has been
461
+ // deliberately lifted, or every absolutely-placed card on the page would qualify.
462
+ const lifted = style.position === "fixed" || style.position === "sticky" || (style.position === "absolute" && (Number(style.zIndex) || 0) >= 5);
463
+ if (!dialogish && !lifted) continue;
464
+ // The thing that holds the page is not an overlay, however it is positioned.
465
+ if (element.contains(document.querySelector("main")) && !dialogish) continue;
433
466
  const rect = element.getBoundingClientRect();
434
- return rect.width > window.innerWidth * 0.4 && rect.height > window.innerHeight * 0.2;
467
+ const buttons = [...element.querySelectorAll("button,a,[role=button],input[type=button],input[type=submit]")]
468
+ .map((control) => (control.innerText || control.getAttribute("aria-label") || control.value || "").replace(/\s+/g, " ").trim())
469
+ .filter(Boolean);
470
+ if (!buttons.length) continue;
471
+ candidates.push({ element, dialogish, z: Number(style.zIndex) || 0, area: rect.width * rect.height, buttons: buttons.slice(0, 20) });
472
+ }
473
+ if (!candidates.length) return null;
474
+ // Innermost first: a backdrop and the card inside it are both candidates, and the card is the
475
+ // one carrying the way out. Then the highest layer, then the smallest — a toast beats the
476
+ // page-sized thing it sits on.
477
+ candidates.sort((a, b) => {
478
+ const nested = a.element.contains(b.element) ? 1 : b.element.contains(a.element) ? -1 : 0;
479
+ return nested || b.z - a.z || a.area - b.area;
435
480
  });
436
- if (!covering.length) return null;
437
- const topmost = covering.sort((a, b) => (Number(window.getComputedStyle(b).zIndex) || 0) - (Number(window.getComputedStyle(a).zIndex) || 0))[0];
438
- return [...topmost.querySelectorAll("button,a,[role=button]")]
439
- .map((element) => (element.innerText || element.getAttribute("aria-label") || "").replace(/\s+/g, " ").trim())
440
- .filter(Boolean)
441
- .slice(0, 20);
481
+ const chosen = candidates[0];
482
+ chosen.element.setAttribute("data-tapp-overlay", "1");
483
+ const heading = (chosen.element.querySelector("h1,h2,h3,h4,p,span")?.innerText || "").replace(/\s+/g, " ").trim().slice(0, 90);
484
+ return { buttons: chosen.buttons, heading };
442
485
  }, undefined, { timeout: 2_000 }).catch(() => null);
443
- if (!choice || !choice.length) return null;
444
- const label = chooseOverlayDismissal(choice);
486
+ return found?.buttons?.length ? found : null;
487
+ }
488
+
489
+ /** Find it, then press its own way out — never a way out that grants something. */
490
+ export async function dismissBlockingOverlay(page) {
491
+ const found = await detectBlockingOverlay(page);
492
+ if (!found) return null;
493
+ const label = chooseOverlayDismissal(found.buttons);
445
494
  if (!label) return null;
446
- try {
447
- await page.getByRole("button", { name: label, exact: true }).first().click({ timeout: 2500 });
448
- return label;
449
- } catch {
495
+ const overlay = page.locator('[data-tapp-overlay="1"]');
496
+ // Press it inside the overlay: a page-wide match can find the same words in the page behind.
497
+ for (const candidate of [overlay.getByRole("button", { name: label, exact: true }), overlay.getByText(label, { exact: true }), overlay.getByRole("button", { name: label })]) {
450
498
  try {
451
- await page.getByText(label, { exact: true }).first().click({ timeout: 2000 });
452
- return label;
453
- } catch { return null; }
499
+ await candidate.first().click({ timeout: 2000 });
500
+ await page.waitForTimeout(250);
501
+ return { label, heading: found.heading, asked: found.buttons };
502
+ } catch { /* try the next way of naming it */ }
454
503
  }
504
+ return null;
455
505
  }
456
506
 
457
507
  export function webScreenTitle(info, fallback) {
@@ -1205,7 +1255,12 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
1205
1255
  // makes every control on the page unreachable and the application behind it invisible.
1206
1256
  const greeting = await dismissBlockingOverlay(page).catch(() => null);
1207
1257
  if (greeting) {
1208
- narrate(`Dismissed an overlay with "${greeting}"`, { screen: target });
1258
+ narrate(`Got past ${greeting.heading ? `“${greeting.heading}”` : "an overlay"} with "${greeting.label}"`, { screen: target });
1259
+ // A thing that stands in front of the application is worth telling the owner about: it is
1260
+ // the first thing their visitor meets, too.
1261
+ observation({ type: "blocking_overlay", severity: "low", category: "polish",
1262
+ title: `A pop-up stands in front of the page${greeting.heading ? `: “${greeting.heading}”` : ""} — tapp got past it with “${greeting.label}”`,
1263
+ target: greeting.label }, target);
1209
1264
  await waitForWebStability(page);
1210
1265
  }
1211
1266
  if (nav && typeof nav.status === "function" && nav.status() === 404) {
@@ -1355,7 +1410,7 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
1355
1410
  // clicks into three hundred and forty seconds.
1356
1411
  if (!pageRecoveryHopeless) {
1357
1412
  const dismissed = await dismissBlockingOverlay(page).catch(() => null);
1358
- if (dismissed) narrate(`Dismissed an overlay with "${dismissed}"`, { screen: ob.screen });
1413
+ if (dismissed) narrate(`Got past ${dismissed.heading ? `“${dismissed.heading}”` : "an overlay"} with "${dismissed.label}"`, { screen: ob.screen });
1359
1414
  else await page.keyboard.press("Escape").catch(() => {});
1360
1415
  await waitForWebStability(page, { timeoutMs: 2_000 });
1361
1416
  // Clearing the obstruction is itself a change, so anything compared against the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aarwitz/tapp",
3
- "version": "0.27.1",
3
+ "version": "0.28.1",
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/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/access-jwt.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/access-jwt.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",
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
  }