Repository navigation
Description
Parent: #14
Dependencies
- feat(wasm): establish threaded sketch build, import validation, and lifecycle substrate #15 — threaded sketch build, import validation, and lifecycle substrate
- feat(wasm): add generated async kernel ABI and generation-safe resources #16 — generated async kernel ABI and generation-safe resources
- feat(wasm): add bounded opaque blobs and exact-output file capability #17 — bounded opaque blobs and exact-output file capability
- feat(tauri): add a private async capture-only webview capability #18 — private async capture-only webview capability
Purpose
Add the private cross-platform screenshot layer required by #14. Tauri/Wry lacks a portable Rust screenshot operation, so kernal-api owns three native asynchronous adapters and returns an opaque, quota-accounted snapshot resource.
Scope
- Implement a private semantic operation equivalent to
async fn capture_visible_png(view: WebviewHandle) -> Result<SnapshotHandle, WebviewError>. - Capture rendered page viewport only: no OS window chrome, native device scale, PNG output, fixed logical fixture viewport later for comparable tests.
- Use private native APIs: Windows WebView2
ICoreWebView2::CapturePreview; macOSWKWebView::takeSnapshot; Linuxwebkit_web_view_get_snapshotthrough Tauri/Wry's WebKitGTK platform handle. - Bridge native completion callbacks through feat(wasm): add generated async kernel ABI and generation-safe resources #16's kernel-owned async operation system.
- Enforce configured pixel and encoded-byte limits; register successful results as feat(wasm): add bounded opaque blobs and exact-output file capability #17 opaque quota-accounted blobs. Never pass platform images or full PNG
Vec<u8>values through the guest ABI. - Clean up native image/blob state on success, error, timeout, cancellation, trap, close, and teardown.
- Document the absent portable Tauri/Wry API and why the three private adapters are owned here.
Non-goals
No desktop/window/monitor capture fallback, WebDriver/DevTools/browser automation, JavaScript canvas/injected capture, public WebView2/Cocoa/WebKitGTK/Wry/Tauri image types, or output-file writing.
Implementation shape
WebviewHandle
-> UI-thread private platform handle
-> native async viewport capture
-> checked PNG/blob resource
-> opaque SnapshotHandle
Pin any direct platform binding/FFI layer to the exact Tauri minor version required by its native-handle escape hatch.
RED → GREEN acceptance criteria
- RED: checked-in documentation and a focused test establish that Tauri/Wry supplies no portable screenshot operation for this contract.
- GREEN: Windows uses
CapturePreview, macOStakeSnapshot, Linuxwebkit_web_view_get_snapshot; all complete through the kernel async path. - GREEN: each adapter produces a decodable PNG of page content excluding window chrome.
- GREEN: pixel/encoded-byte bounds produce typed errors before unaccounted storage escapes; successful snapshots are quota-accounted opaque resources.
- GREEN: PNG bytes never cross the guest ABI as a serialized whole value.
- GREEN: cancellation, capture failure, stale/cross-instance view handles, and teardown release all native/image/blob resources.
- GREEN: public kernal-api APIs expose no backend/native types.
Platform concerns
This is intentionally three implementations. Linux must work under Tauri's WebKitGTK 4.1 configuration and xvfb; do not substitute desktop capture. Device scale/rendering varies, so later tests use tolerant regions rather than byte-identical hashes.
Deliverables
Private Windows/macOS/Linux adapter modules, platform-focused tests, exact pins, and a short adapter-ownership/resource-bounds note.
Activity
zackees commentedon Sep 14, 2026
Completed by PR #153 (merge fddd176). Private WebView2/WKWebView/WebKitGTK viewport-PNG adapters, quota-accounted opaque results, lifecycle cleanup, and native six-target evidence landed. Run 34801708129 passed all native screenshot lanes.