diff options
| author | Tianren Dong <tianrendong.dtr@gmail.com> | 2026-05-13 01:48:36 -0400 |
|---|---|---|
| committer | Tianren Dong <tianrendong.dtr@gmail.com> | 2026-05-13 01:48:36 -0400 |
| commit | 066f50b9cdb60ad3d4f61ba0598ac9683d8ae446 (patch) | |
| tree | bdd4372b365651a7ebc36bc6920ac2e0ed44c4ae /extensions/chrome-profile-bridge/index.ts | |
| parent | 07cf31df3cd47d18d8a067c45a667632fb3b8925 (diff) | |
pi-chrome 0.11.1: chrome_tap (CDP touch), smoother trustedScroll, cdp auto-recover
- chrome_tap tool: real browser-trusted touchstart/touchend via
Input.dispatchTouchEvent for sites that gate on TouchEvent (mobile-
first PWAs, swipe carousels). Always uses CDP; banner appears.
- trustedScroll: per-step delta capped at ~80px, n=6..60 steps with a
bell-shaped weight curve, 22-52ms sleep between events so IntersectionObserver and rAF samples get gradient updates (fixes
intersection-visibility / smooth-scroll tests).
- cdp() wrapper auto-detects stale debugger sessions (tab nav,
DevTools toggle, manual cancel) and re-attaches+retries once
instead of throwing 'Debugger is not attached'. Fixes intermittent
failures during automated test sweeps.
Diffstat (limited to 'extensions/chrome-profile-bridge/index.ts')
| -rw-r--r-- | extensions/chrome-profile-bridge/index.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/extensions/chrome-profile-bridge/index.ts b/extensions/chrome-profile-bridge/index.ts index 5eee401..fc1b6c5 100644 --- a/extensions/chrome-profile-bridge/index.ts +++ b/extensions/chrome-profile-bridge/index.ts @@ -1166,6 +1166,29 @@ Usage rules: }); pi.registerTool({ + name: "chrome_tap", + label: "Chrome Tap (Touch)", + description: + "Dispatch a real browser-trusted touchstart/touchend tap via chrome.debugger (CDP Input.dispatchTouchEvent). Use for sites that gate on TouchEvent rather than MouseEvent (mobile-first PWAs, swipe carousels). Always uses the trusted CDP path — the yellow debugger banner appears.", + promptSnippet: "Tap (real touch) a Chrome element by snapshot uid, selector, or coordinate.", + parameters: Type.Object({ + uid: Type.Optional(Type.String()), + selector: Type.Optional(Type.String()), + x: Type.Optional(Type.Number()), + y: Type.Optional(Type.Number()), + targetId: Type.Optional(Type.String()), + urlIncludes: Type.Optional(Type.String()), + titleIncludes: Type.Optional(Type.String()), + background: Type.Optional(Type.Boolean()), + }), + async execute(_id, params): Promise<ToolTextResult> { + const result = await bridge.send("page.tap", withBackground(params), DEFAULT_TIMEOUT_MS); + const target = params.uid ?? params.selector ?? `${params.x},${params.y}`; + return { content: [{ type: "text", text: `Tapped ${target} (touch)` }], details: { result: result as Json } }; + }, + }); + + pi.registerTool({ name: "chrome_scroll", label: "Chrome Scroll", description: "Scroll the page or a specific scrollable element by dispatching real wheel events with momentum-shaped deltas, then applying the scroll. Positive deltaY scrolls down. Pass uid/selector to scroll within a container, otherwise the document scrolls.", |
