feat(browser): uid-addressable AX snapshots; prompt-cache break-even gate - #237
Merged
Conversation
…gate Two final caveman-family adoptions: Accessibility snapshots (internal/a11y + Browser tool): - Compresses Chrome's real accessibility tree (CDP getFullAXTree) into a compact indented tree where actionable nodes (button/link/textbox/ checkbox/menuitem/tab/...) carry stable uid handles; layout containers are dropped, iframes render as leaves under site isolation. - Query mode ranks actionable nodes against the query and keeps at most 12 matches plus ancestor chains, pruning whole non-matching branches via subtree-containment marking. - Fail-closed per caveman-browse issue #140: when compression does not actually shrink the representation the raw tree is NEVER dumped — the previous uid map stays valid and an error explains why. Ignored nodes never leak; raw canonical payload is retained for recovery. - New ax_snapshot action; click/type accept uid (resolved through CDP DOM.resolveNode + Runtime.callFunctionOn: scrollIntoView+click / focus+execCommand insertText with direct-value fallback) alongside the legacy selector path. Non-wait actions report settled:false and ask for a confirming re-snapshot. Prompt-cache break-even gate (internal/engine/cache_gate.go): - Provider-native caching now follows measured economics instead of a hardcoded provider check: enabled only for anthropic when the stable prefix (system prompt + serialized tool catalog) reaches ~8 KiB (~2k tokens), the point where one reuse beats paying the write premium twice. Below break-even caching stays OFF. Full segment planning and key-sharding remain future eyrie work. Existing BuildOptions test updated to the break-even contract. Verification: new suites green (a11y 6, cache gate 5); tool/engine suites pass; golangci-lint 0 issues; go build clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The final two caveman-family adoptions, completing the approved set.
A. Accessibility snapshots —
internal/a11y+ Browser toolgetFullAXTree) into a compact indented tree; actionable roles carry stable uid handles, layout containers drop, iframes render as leaves under site isolation.ax_snapshotaction;click/typeacceptuid(CDPDOM.resolveNode→Runtime.callFunctionOn: scrollIntoView+click / focus+execCommand-insertText with direct-value fallback) alongside legacy selectors; non-wait actions reportsettled:false.B-lite. Prompt-cache break-even gate —
internal/engine/cache_gate.goTesting