universal_browser_cdp 0.2.0
universal_browser_cdp: ^0.2.0 copied to clipboard
Pure-Dart Chrome DevTools Protocol (CDP) client: discovery, WebSocket JSON-RPC, accessibility snapshots, input synthesis, screenshots, and a fake CDP server for tests. No Flutter, no Node.
Changelog #
0.2.0 #
- Surface action registry (ADR-0017 invoke tier):
CdpDriverimplementsAutomationActionCatalogover the page'swindow.__mcpActionsconvention — any web surface (Jaspr, plain JS, Flutter web) publishes named{description, schema, invoke(args)}handlers and the driver lists and invokes them; async handlers are awaited, JS rejections surface asProtocolException. NewCdpPage.evaluateAsyncawaits Promise results withexceptionDetailssurfaced. - Behavior dynamics lowering (ADR 0044):
BehavioralCdpDriver(capabilities.behaviorDynamics) with the client-side scheduler — planned-timestamp stamping on every dispatch, serialized awaited sends, navigation-gated truncation with typedBehaviorOutcomeverdicts; reaction-floor enforcement against the last observation; loudDriverUnsupportedExceptionfor session pacing the lowering cannot honor yet. Receipt pair writer (CdpBehaviorReceiptWriter) mirroring the screencast recording contract. - Navigate correctness:
Page.navigatefailures surface asProtocolExceptionvia the response'serrorTextinstead of hanging the wait; the wait matches the navigation'sloaderIdand ignores subframe events; the timeout is a parameter (default 30s). - Hit-checked input resolution:
CdpPage.resolveRectscrolls the element into view and verifies the center point hits the element (or a descendant) before any dispatch — occluded elements refuse loudly instead of missing silently. - Borrowed-lease teardown:
CdpPage.detach/CdpBrowserSession.detachclose only the client socket, leaving adopted targets alive. CdpDriverdeclares an explicit capability set (no longer reusesDriverCapabilities.full); plain drivers keepbehaviorDynamics: false.- Auto-wait:
NavigateWaitenum onnavigate(commit/load/domContentLoaded/networkIdle— networkIdle rides the new network log); actionability polling (attached → visible → stable → hittable) insideclick/type/resolveRectwithtimeoutandforceparameters;clickAt(x, y)explicit-point dispatch. - Network observation:
CdpPage.network(CdpNetworkLog) — request lifecycle entries with redirect folding, statuses, in-flight counting,responseBody(id),waitIdle(). - Multi-tab:
CdpBrowserover the browser-level socket —openPage/attachTarget/attachFirstPage/pages/closePagevia CDP flat sessions (CdpFlatSession);Target.targetDestroyedmarks pages closed;close()only drops the client socket (borrowed-lease discipline).CdpPagenow speaks theCdpTransportsurface (dedicated socket or flat session). - Semantic locators: snapshots keep
backendDOMNodeIdinattributes['cdp.backendDOMNodeId'];ClickAction(role:, name:)resolves through the semantic index (DOM.resolveNode+ hit-checked coordinates) — no more "css selector required" refusal. - Depends on
universal_automation_interface^0.2.0.