feat(browser): versioned screenshot geometry and safe visual-target resolution for Dewee vision

Aperta
#29 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
8/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Start with docs/connected-browser-relay-contract.md and src/browser/adapters/cdp/screenshot.ts, where fitScreenshot and quadsToRects compute the encoded image and mask rectangles, then read src/browser/{protocol,snapshot,executor}.ts for the grant and generation checks. Done means the screenshot result gains optional, versioned geometry metadata while v1 callers still work, and the metadata is validated against a bound capture. Scope spans the extension and Dewee's schemas, so confirm the split with maintainers before coding.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Goal

Extend the connected-browser screenshot protocol so a separately authorized Dewee visual-decision provider can safely localize a target in a captured image without mis-clicks, leaked pixels, stale screenshot reuse or any extension-side TypeSafe credentials.

This is the extension-owned half of https://github.com/nextlevelbuilder/dewee/issues/1364, not a new agent/model inside the extension.

Verified current implementation

  • main@1296da7, docs/connected-browser-relay-contract.md v1: the extension is an executor only; screenshot requires advanced capability and returns {tab,url,mime:"image/jpeg",data_base64}, ≤1.5 MiB, with owner/grant bindings. Actions operate on ephemeral element ref + generation.
  • src/browser/adapters/cdp/screenshot.ts: fitScreenshot chooses JPEG quality and scaling; quadsToRects computes mask rectangles in image pixels. Current result does not expose the final scale/geometry metadata required for trustworthy server-side box mapping.
  • src/browser/{protocol,snapshot,executor,approvals,policy,sensitive}.ts: existing strict command allowlist, generation checks, redaction, approvals and trust boundaries.
  • Existing issue #25 redacts sensitive contenteditable snapshots; do not duplicate or weaken that work.
  • Dewee Browser Use policy/evals: https://github.com/nextlevelbuilder/dewee/issues/1224 and /1225; preview model gates: /1363.

Work

  1. Versioned screenshot metadata contract: keep v1 response backward-compatible; optionally return capture ID/digest, capture time, tab/session/grant binding, DOM/snapshot generation, trusted origin, source PNG image dimensions and final encoded JPEG dimensions, encoding scale/crop, viewport dimensions, devicePixelRatio, browser/page zoom and scroll offsets where reliably measured. Do not assert geometry that was not measured. No raw Chrome tab IDs to agent.
  2. Privacy and provenance: keep existing masking before external inference; complete sensitive editable/redaction hardening (#25) before enabling. Identify which rectangles are masked without revealing confidential values. Never upload screenshots without runtime's user/tenant consent; never store screenshot persistently. Ensure frame-origins are still grant-bound.
  3. Safe visual resolution (optional protocol extension): a returned normalized bounding-box hint is untrusted. Convert to local image pixels using exact capture metadata and validate finite ordered edges in [0,1]. Only resolve to an existing, currently granted semantic element ref when a trusted local DOM/accessibility hit-test verifies target is interactable. Revalidate capture generation, current tab/origin, viewport, scroll and permissions immediately before interact.
  4. Keep executor narrow: do NOT add arbitrary click(x,y), remote JavaScript, CDP commands, selectors or code execution. Do not let a model change grants, approval policy, target tab, origin or use 'managed' as hidden fallback.
  5. Approval and recovery: high-risk submit/publish/delete/payment still requires existing human review; ambiguous/multiple targets, hidden/covered elements, missing target and stale geometry return an explicit typed refusal or resnapshot suggestion. Fail closed if snapshot metadata is missing on a new visual-control request.
  6. Cross-repo protocol coordination: update extension docs/connected-browser-relay-contract.md and Dewee's ADR/transport schemas together. Version/capability negotiate so existing extension builds work without sending new fields; old Gateway safely ignores optional metadata but MUST NOT claim it supports visual actions.
  7. Diagnostics/tests: unit + E2E tests for Retina/non-Retina DPR, zoom, viewport resize, scroll, screenshot downscale, masking alignment, out-of-range/NaN boxes, overlapping objects, tab navigation races, revoked grants, malicious page content, race with local human input and no duplicate side-effect on reconnect.

Acceptance

  • Existing v1 connected browser read/interact flows remain compatible and maintain current protections.
  • Captured and encoded pixel coordinate spaces map consistently under all supported scaling/zoom conditions, with exact validation against a bound capture.
  • A stale, ambiguous, unsupported or origin-mismatched hint can NEVER become an interaction.
  • No TypeSafe key, model-selection or authority logic in the extension; all external image-model calls remain Dewee runtime-owned behind explicit egress consent.
  • Automated and human-approval paths remain unchanged absent a fresh, verified semantic target.
  • Pausing/stopping/revoking the device/grant during localization immediately blocks further action.

Dependencies and non-duplication

  • Requires Dewee #1364 (visual inference + policy) and #1363 (opt-in Jev 1.14 capability).
  • Related existing #25 (redact sensitive contenteditable), Dewee #1224/#1225/#1355.
  • TypeSafe Box returns a box even for absent objects, so presence validation belongs to Dewee; extension's job is geometry, proof and safe execution only.
  • Release background: https://typesafe.ai/blog/jev-1-14
Lingua principale
TypeScript
Stelle
2
Fork
1
Merge medio
2g 5h
PR unite (30g)
4

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nextlevelbuilder/dewee-chrome-ext

Tutte le issue di nextlevelbuilder/dewee-chrome-ext

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.