✨ Finalize agent-friendly visual context - #345
Open
Robdel12 wants to merge 2 commits into
Open
Conversation
Consume the API-owned compact context contract for both human and agent flows. Add opaque cursor paging, bounded schema checks, local-provider parity, and lossless raw/full drill-downs.
Preserve typed API recovery signals, bind local cursors to snapshot contents, keep local and cloud compact shapes aligned, and enforce payload bounds after adding follow-up commands.
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.
Why
Visual context was still doing too much work in the CLI. It downloaded full payloads for human output, ranked and paged agent evidence locally, and filled gaps in API facts with client-side guesses. That made compact output large, made pagination drift as builds changed, and let the human and agent paths disagree.
Approach
Build and comparison context now consume one bounded provider contract for both human output and agent JSON. Evidence order, review facts, history streams, omission metadata, and opaque cursors stay provider-owned. The CLI handles presentation, source-pinned follow-up commands, shell-safe arguments, and fail-closed schema and final-output size checks. Raw JSON and explicit full context remain lossless.
Local workspace context follows the same compact shape. Its cursors are bound to the complete snapshot contents, target, stream, detail mode, and page size, while summary pages omit raw geometry unless
--include diffsis requested. Structured provider error codes survive the HTTP boundary, so stale cursors and oversized pages remain actionable to agents.Human output uses concrete labels such as Attention, Evidence, Images, Similar history, and Recent history. Both history streams are visible, and missing facts stay unknown or unavailable instead of becoming false zeroes or success states.
Evidence
The full suite passes 2,025 tests with no failures; six X11-only visual checks are skipped in this environment. Boundary coverage exercises human and agent output, raw/full preservation, independent history paging, snapshot invalidation, source authority, typed API errors, partial responses, final emitted payload bounds, malformed compact responses, and local/cloud shape parity. Lint, formatting, published type checks, the production build, and direct runs through the built binary also pass.