Commit graph

4 commits

Author SHA1 Message Date
Nils Reeh
3cf0094559 test(browser-tools): add regression tests for optional sharp lazy-load
Satisfies the CI test requirement for the capture.ts source change.

Two describe blocks:
- Static: verifies the lazy-load pattern is structurally correct in
  source (no top-level import, getSharp helper present, null guard present)
- Behavioral: verifies constrainScreenshot returns the raw buffer
  unchanged when sharp is null (unavailable platform / bunx)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 23:45:01 +02:00
Jeremy McSpadden
45af9f7f9d feat(browser-tools): configurable screenshot resolution, format, and quality (#1152)
Add environment variable overrides for screenshot capture settings so
users can opt into full-resolution output for human review while keeping
the Anthropic vision-optimized defaults:

- SCREENSHOT_MAX_WIDTH (default 1568, set 0 to uncap)
- SCREENSHOT_MAX_HEIGHT (default 8000, set 0 to uncap)
- SCREENSHOT_FORMAT (default jpeg for viewport / png for crops)
- SCREENSHOT_QUALITY (default 80, range 1-100)

Also fixes:
- Integration test viewport/scale mismatch: was 1280x720 scale 1,
  now 1280x800 scale 2 to match production browser context
- Unit test height-limit assertion: test expected <= 1568 but
  MAX_SCREENSHOT_HEIGHT is 8000 — corrected test image and assertions
2026-03-18 08:33:40 -06:00
Tom Boucher
ca299db1c6 feat(browser-tools): add 10 new browser tools (#698)
Implement all features from the browser-tools feature additions proposal:

1. browser_extract — structured data extraction with JSON Schema validation
2. browser_save_state / browser_restore_state — session state persistence
3. browser_generate_test — Playwright test code generation from session
4. browser_mock_route / browser_block_urls / browser_clear_routes — network interception
5. browser_emulate_device — device emulation with 143 Playwright device presets
6. browser_visual_diff — visual regression diffing with baseline management
7. browser_save_pdf — PDF generation (Chromium page.pdf)
8. browser_zoom_region — region capture with upscaling via sharp
9. browser_action_cache — intent→selector caching for repeat visits
10. browser_check_injection — prompt injection detection on page content

Total browser tools: 47 → 60. No new dependencies — uses existing
sharp, ajv, @sinclair/typebox, and Playwright core APIs.
2026-03-16 17:45:11 -04:00
Lex Christopherson
5155d69d55 test(M002/S06): Test coverage
Tasks:
- chore(M002/S06): auto-commit after complete-slice
- chore(M002/S06): auto-commit after complete-slice
- chore(M002/S06/T02): auto-commit after execute-task
- chore(M002/S06/T02): auto-commit after execute-task
- chore(M002/S06/T01): auto-commit after execute-task
- chore(M002/S06/T01): auto-commit after execute-task
- chore(M002/S06): auto-commit after plan-slice
- chore: update state for S06 execution
- docs(S06): add slice plan

Branch: gsd/M002/S06
2026-03-13 08:04:27 -06:00