feat(browser): network --filter <fields> for agent-native request discovery#1103
Merged
feat(browser): network --filter <fields> for agent-native request discovery#1103
Conversation
… discovery Agents often know what fields a target request's body should contain but not which captured request carries it. --filter lets them declare the field set and get back only matching entries. Matching is "any-segment": a field matches when it equals any segment name of any inferShape() path (ignoring root $, array indices, and bracket-quoted key syntax). Multiple fields AND together. Case-sensitive. - invalid_filter for empty / commas-only values - invalid_args when combined with --detail (mutually exclusive) - 0 matches is a valid empty result, not an error - persisted cache stays unfiltered so later --detail lookups still resolve Envelope gains `filter` (echo) and `filter_dropped` (count of entries passing the static-resource filter but not --filter). Existing --raw and --all compose normally.
luxiaolei
pushed a commit
to luxiaolei/OpenCLI
that referenced
this pull request
Apr 21, 2026
… discovery (jackwener#1103) Agents often know what fields a target request's body should contain but not which captured request carries it. --filter lets them declare the field set and get back only matching entries. Matching is "any-segment": a field matches when it equals any segment name of any inferShape() path (ignoring root $, array indices, and bracket-quoted key syntax). Multiple fields AND together. Case-sensitive. - invalid_filter for empty / commas-only values - invalid_args when combined with --detail (mutually exclusive) - 0 matches is a valid empty result, not an error - persisted cache stays unfiltered so later --detail lookups still resolve Envelope gains `filter` (echo) and `filter_dropped` (count of entries passing the static-resource filter but not --filter). Existing --raw and --all compose normally. (cherry picked from commit 37020c4)
This was referenced Apr 21, 2026
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
Agents on a page with a wall of network requests know which fields a target request's body should carry (e.g.
author,text,likes) but not which of the captured requests is the one. This addsopencli browser network --filter <fields>so they can narrow the list directly instead of scrolling shapes.opencli browser network --filter author,text,likes # → only entries whose shape has ALL three fields as some path segment[N]are stripped;$[\"nick name\"]unwraps. So$.data.items[0].author.namecontainsdata,items,author,name.,-split, trim, drop empties, dedupe preserving first-seen order.invalid_filterfor\"\"/ whitespace-only /,,,invalid_argswhen combined with--detail(mutually exclusive — one fetches a key, one narrows a list)entries: [],count: 0, exit 0.filter: [...](echo) andfilter_dropped: N(dropped by --filter, separate from the existing static-resourcefiltered_out).--detail <key>resolves requests that --filter hid.--raw/--allcompose normally.Test plan
node node_modules/vitest/vitest.mjs run src/browser/shape-filter.test.ts src/cli.test.ts— 2 files / 68 tests passsrc/browser/shape-filter.tscovers parse, segment extraction (dotted, array indices, bracket keys), AND matching, case sensitivitysrc/cli.test.tscover: AND narrowing, container-segment match, 0-match empty result (not error), case sensitivity,--filter + --raw,--filter + --detail → invalid_args,invalid_filterfor empty / commas-only, and that--detailstill finds keys hidden by --filter (cache stays unfiltered)opencli-adapter-author/references/api-discovery.md,opencli-autofix/SKILL.md) with the new flag