@aarwitz/tapp 0.27.1 → 0.28.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.27.1",
4
+ "version": "0.28.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.27.1",
27
+ "@aarwitz/tapp@0.28.0",
28
28
  "mcp"
29
29
  ],
30
30
  "cwd": "${CLAUDE_PROJECT_DIR}"
@@ -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
  }
@@ -425,33 +431,65 @@ export function chooseOverlayDismissal(labels = []) {
425
431
  * overlay itself offers.
426
432
  */
427
433
  export async function dismissBlockingOverlay(page) {
428
- const choice = await page.evaluate(() => {
429
- const covering = [...document.querySelectorAll("div,section,aside,dialog")].filter((element) => {
434
+ // Overlays come in shapes, not one shape. A measured probe of the common ones found that a
435
+ // size-and-position rule written for a big centred modal misses a native <dialog> (absolute by
436
+ // default), a small bottom sheet, a short cookie bar and a corner toast — four of the five
437
+ // things that actually sit in front of real sites. Recognise the KIND of thing instead: a
438
+ // dialog by role, or anything lifted above the page on its own layer.
439
+ const found = await page.evaluate(() => {
440
+ const seen = document.querySelectorAll("[data-tapp-overlay]");
441
+ for (const old of seen) old.removeAttribute("data-tapp-overlay");
442
+ const viewport = { w: window.innerWidth, h: window.innerHeight };
443
+ const visible = (element) => {
444
+ const style = window.getComputedStyle(element);
445
+ if (style.display === "none" || style.visibility === "hidden" || Number(style.opacity) === 0) return false;
446
+ const rect = element.getBoundingClientRect();
447
+ return rect.width >= 80 && rect.height >= 40 && rect.bottom > 0 && rect.right > 0 && rect.top < viewport.h && rect.left < viewport.w;
448
+ };
449
+ const candidates = [];
450
+ for (const element of document.querySelectorAll('dialog[open],[role="dialog"],[role="alertdialog"],[aria-modal="true"],div,section,aside,form')) {
451
+ if (!visible(element)) continue;
430
452
  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;
453
+ const dialogish = element.matches('dialog[open],[role="dialog"],[role="alertdialog"],[aria-modal="true"]');
454
+ // Fixed and sticky are overlay layers on their own; absolute only counts when it has been
455
+ // deliberately lifted, or every absolutely-placed card on the page would qualify.
456
+ const lifted = style.position === "fixed" || style.position === "sticky" || (style.position === "absolute" && (Number(style.zIndex) || 0) >= 5);
457
+ if (!dialogish && !lifted) continue;
458
+ // The thing that holds the page is not an overlay, however it is positioned.
459
+ if (element.contains(document.querySelector("main")) && !dialogish) continue;
433
460
  const rect = element.getBoundingClientRect();
434
- return rect.width > window.innerWidth * 0.4 && rect.height > window.innerHeight * 0.2;
461
+ const buttons = [...element.querySelectorAll("button,a,[role=button],input[type=button],input[type=submit]")]
462
+ .map((control) => (control.innerText || control.getAttribute("aria-label") || control.value || "").replace(/\s+/g, " ").trim())
463
+ .filter(Boolean);
464
+ if (!buttons.length) continue;
465
+ candidates.push({ element, dialogish, z: Number(style.zIndex) || 0, area: rect.width * rect.height, buttons: buttons.slice(0, 20) });
466
+ }
467
+ if (!candidates.length) return null;
468
+ // Innermost first: a backdrop and the card inside it are both candidates, and the card is the
469
+ // one carrying the way out. Then the highest layer, then the smallest — a toast beats the
470
+ // page-sized thing it sits on.
471
+ candidates.sort((a, b) => {
472
+ const nested = a.element.contains(b.element) ? 1 : b.element.contains(a.element) ? -1 : 0;
473
+ return nested || b.z - a.z || a.area - b.area;
435
474
  });
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);
475
+ const chosen = candidates[0];
476
+ chosen.element.setAttribute("data-tapp-overlay", "1");
477
+ const heading = (chosen.element.querySelector("h1,h2,h3,h4,p,span")?.innerText || "").replace(/\s+/g, " ").trim().slice(0, 90);
478
+ return { buttons: chosen.buttons, heading };
442
479
  }, undefined, { timeout: 2_000 }).catch(() => null);
443
- if (!choice || !choice.length) return null;
444
- const label = chooseOverlayDismissal(choice);
480
+ if (!found?.buttons?.length) return null;
481
+ const label = chooseOverlayDismissal(found.buttons);
445
482
  if (!label) return null;
446
- try {
447
- await page.getByRole("button", { name: label, exact: true }).first().click({ timeout: 2500 });
448
- return label;
449
- } catch {
483
+ const overlay = page.locator('[data-tapp-overlay="1"]');
484
+ // Press it inside the overlay: a page-wide match can find the same words in the page behind.
485
+ for (const candidate of [overlay.getByRole("button", { name: label, exact: true }), overlay.getByText(label, { exact: true }), overlay.getByRole("button", { name: label })]) {
450
486
  try {
451
- await page.getByText(label, { exact: true }).first().click({ timeout: 2000 });
452
- return label;
453
- } catch { return null; }
487
+ await candidate.first().click({ timeout: 2000 });
488
+ await page.waitForTimeout(250);
489
+ return { label, heading: found.heading, asked: found.buttons };
490
+ } catch { /* try the next way of naming it */ }
454
491
  }
492
+ return null;
455
493
  }
456
494
 
457
495
  export function webScreenTitle(info, fallback) {
@@ -1205,7 +1243,12 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
1205
1243
  // makes every control on the page unreachable and the application behind it invisible.
1206
1244
  const greeting = await dismissBlockingOverlay(page).catch(() => null);
1207
1245
  if (greeting) {
1208
- narrate(`Dismissed an overlay with "${greeting}"`, { screen: target });
1246
+ narrate(`Got past ${greeting.heading ? `“${greeting.heading}”` : "an overlay"} with "${greeting.label}"`, { screen: target });
1247
+ // A thing that stands in front of the application is worth telling the owner about: it is
1248
+ // the first thing their visitor meets, too.
1249
+ observation({ type: "blocking_overlay", severity: "low", category: "polish",
1250
+ title: `A pop-up stands in front of the page${greeting.heading ? `: “${greeting.heading}”` : ""} — tapp got past it with “${greeting.label}”`,
1251
+ target: greeting.label }, target);
1209
1252
  await waitForWebStability(page);
1210
1253
  }
1211
1254
  if (nav && typeof nav.status === "function" && nav.status() === 404) {
@@ -1355,7 +1398,7 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
1355
1398
  // clicks into three hundred and forty seconds.
1356
1399
  if (!pageRecoveryHopeless) {
1357
1400
  const dismissed = await dismissBlockingOverlay(page).catch(() => null);
1358
- if (dismissed) narrate(`Dismissed an overlay with "${dismissed}"`, { screen: ob.screen });
1401
+ if (dismissed) narrate(`Got past ${dismissed.heading ? `“${dismissed.heading}”` : "an overlay"} with "${dismissed.label}"`, { screen: ob.screen });
1359
1402
  else await page.keyboard.press("Escape").catch(() => {});
1360
1403
  await waitForWebStability(page, { timeoutMs: 2_000 });
1361
1404
  // 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.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-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
  }