Files
rea/docs/specs/agent-environments/manifest-view/spec.md
T
291059adb4 feat(analysis-view): project an environment manifest from web network captures (#4954)
* feat(analysis-view): project an environment manifest from web network captures

Add the environment-manifest view kind to inspect_analysis_view for retained
HAR Evidence: the primary origin's recorded request lines become a
deterministic tool surface (names, path templates, parameters with their
rule and basis, observed query names, value-free body shapes, record
pointers), with excluded groups, three fixed unknowns and the shared
projection budget. The four format rules always apply; after-uid-literal,
opaque-token and sibling-variance are opt-in and labelled, and literal
fold-in never touches a format-rule parameter. The api-surface accumulator
moves onto shared route, media-type and budget helpers without behaviour
change.

Refs morluto/rea#4933

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* test(web-network): check the manifest refusal text like the api-surface refusal

The real-capture verifier stringified the whole MCP result for the
environment-manifest refusal, so a declared "[" literal matched the result
envelope itself; compare the parsed refusal as the api-surface branch does.

Refs morluto/rea#4933

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* docs(specs): record the hosted web-network lane run for the manifest view

Refs morluto/rea#4933

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* docs(specs): reconcile the manifest view verification scope note with the hosted run

Refs morluto/rea#4933

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(analysis-view): bound body, route and name work in the environment manifest

Addresses the automated review findings on the PR: read request bodies at the
top level only instead of walking nested values; admit every literal route
part before materializing it; compare at most 32 segments in sibling-variance
and say so; keep stop words literal after a uid literal; keep the next
collision suffix per tool-name base; preserve a templated exclusion when two
groups print the same row.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(analysis-view): keep manifest folding, naming and media-type reads linear

Addresses the second automated review round: fold literal siblings through
set membership, key collision suffixes by the truncated name they share, and
charge a request media type before it is scanned.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(analysis-view): charge the manifest group key before building it

Addresses the third automated review round: the composite key copies the
method, origin, template and rules, so that copy is reserved before the key
is stringified.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(analysis-view): accept a +json suffix only on application media types

Addresses the fourth automated review round: `image/example+json` or
`text/example+json` no longer counts as JSON for origin selection, exclusion
or body shapes, matching the documented `application/json` and
`application/*+json` contract.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(analysis-view): require the capture parent's exact subject for a manifest

Addresses the fifth automated review round: the manifest cites the report
path and digest, so a parent whose subject is absent or names another path or
SHA-256 is refused at admission, as the capture view already does; the
api-surface view keeps its existing admission.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(analysis-view): share truncated suffix allocation work

Track suffix progress by the actual truncated prefix and suffix width. Distinct full names can collide only after suffix truncation; sharing that progress prevents quadratic rescanning while preserving shorter free names and existing allocation order.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>

* fix(analysis-view): merge only identifier-like siblings under sibling-variance

Addresses the sixth automated review finding: a bucket merged whenever one
literal carried a digit, folding plain words such as `mine` into the
parameter. The rule now partitions the bucket, merges the identifier-like
siblings and leaves the other literals as their own tools.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(analysis-view): combine qualifying sibling cohorts

Keep coded identifiers and a qualifying plural hyphenated cohort in one eligibility Set before checking the minimum merge size. Read each literal once and reuse the same membership at the consumer, preserving non-identifier routes and the three-hyphen minimum.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>

* docs(analysis-view): clarify opt-in sibling folding

State the additional sibling-variance selection in the guide, acceptance specification and MCP parameter description. Preserve the existing single-rule behavior and caller-selected inference rules.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-19 07:07:37 +08:00

3.4 KiB

Environment manifest view from web network captures

Issue: https://github.com/morluto/rea/issues/4933

Outcome

inspect_analysis_view accepts view: {"kind": "environment-manifest"} for retained HAR Evidence and projects the primary origin's recorded request lines into a replayable tool surface: deterministic tool names, path templates, parameters, observed query names, value-free body shapes, status and content-type sets and record pointers, with excluded groups, three fixed unknowns and the shared projection representation budget. This increment adds the view kind only; serving and exporting an agent environment from the manifest are later increments.

Requirements

  • Accept only inspect_web_network_capture HAR parents; refuse native mitmproxy, SAZ and qlog parents, and parents whose Evidence does not record sensitive_value_count: 0, with the same typed unsupported errors as the api-surface view.
  • Without opt-in rules, every tool template must equal the api-surface template of the same group; the four format rules always apply with basis: inferred.
  • Apply after-uid-literal, opaque-token and sibling-variance only when listed, each at most once, in that order. With sibling-variance selected, fold literal siblings within its comparison scope into existing opt-in parameters unless they are stop words, whichever was recorded first. With only opaque-token, a non-opaque literal remains a separate tool. Never fold a literal into a format-rule parameter or template a stop word; sibling-variance compares routes of at most 32 segments and the manifest states when a route exceeded that.
  • Derive tool names from the method and route literals deterministically, at most 60 characters, unique within one manifest.
  • Derive body_shape for POST, PUT and PATCH from the tool's earliest record when it carries a JSON-typed request body, as top-level key types only without walking nested values; copy no header, cookie, query or body value anywhere in the result.
  • List records as pointers (ordinal, method, path, status, content_type) and excluded groups with reason other-origin, ui-page-or-asset or non-json.
  • Mark the Evidence inferred whenever any tool or excluded group is templated, derived otherwise; keep the parent's authority.
  • Admit the capture clone, the inline envelope, every retained pointer, group, route part, observed value, query name and body-shape key before allocation, and charge body parsing as temporary bytes, within the existing 96 MiB budget.

Acceptance and limits

A source-owned Grafana-shaped HAR fixture (28 recorded exchanges on two origins) drives domain, service, MCP, CLI and acceptance coverage. Without rules the templates equal the api-surface grouping; with all three rules the fixture yields /api/dashboards/uid/{uid}, /api/folders/{uid} folding general, /api/plugins/{plugin_id}/settings and /api/datasources/uid/{uid}/health. A published contract example is reproduced byte-for-byte from fixture bytes through the real decoder and view service. The view performs no network activity and replays nothing; it does not establish handler identity, schemas, authorization or state transitions.

Deferred issue criteria

Serving a manifest over streamable HTTP, exporting an agent environment from a manifest and the hosted verification lane are later independent increments of #4933. This PR must reference rather than close the whole issue.