Commit Graph
6 Commits
Author SHA1 Message Date
Edgar ArakelyanandClaude Opus 5.5 5e242c1359 fix(environment): prefer verbatim path matches and validate data-plane messages
Replay ranks a record whose path segment equals the argument as written
above one that matches only after percent-decoding, so two recorded
spellings that decode alike no longer resolve by manifest order.

The /agentenv data plane answers -32600 for an id that is not a string,
number or null and for params that are not an object or array, and
refuses a batch of more than 100 messages before building any reply.

The environment MCP server now extends RequestTrackingMcpServer, which
the HTTP owner requires since the streamable-HTTP change it builds on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 08:53:11 -07:00
Edgar ArakelyanandClaude Opus 5.5 da920d4726 fix(environment): honour the JSON-RPC envelope on the data plane and limit base64 bodies by their bytes
- The data plane treated a batch or a notification as one call and
  replied to everything. Notifications now get 202 with no body, a batch
  gets one reply per request in it, and an empty batch or a message that
  is not a JSON-RPC request gets -32600 invalid request.
- The replay limit applied to a base64 body's spelling, so a binary body
  under 256 KiB was truncated because its base64 is a third longer. The
  limit now applies to the recorded bytes, and a cut keeps whole base64
  groups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 21:11:46 -07:00
Edgar ArakelyanandClaude Opus 5.5 9196cf7302 fix(environment): mark every replay result, warn about the captured catalog and bound base64 decoding
- A transport wrapper marks every tools/call result as target content,
  including the argument errors the SDK returns before a replay runs.
- The server's instructions add that tool names, descriptions, parameter
  names and observed values come from the capture too, so the catalog is
  treated as data like the replies.
- Strict UTF-8 decoding keeps a leading byte-order mark instead of
  dropping it from the recorded text.
- A large retained base64 body is decoded only as far as the 256 KiB a
  reply can carry, and the replay reports it truncated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 20:58:38 -07:00
Edgar ArakelyanandClaude Opus 5.5 d8d53713e3 fix(environment): advertise untrusted-content instructions and keep non-UTF-8 bodies as base64
The replay MCP server serves names, descriptions and replies taken from a
captured application but advertised no instructions, so clients that
rely on server instructions had no warning not to follow target text. It
now carries the same untrusted-content instructions as REA's own server,
moved next to the target-content result marker so both import it.

Retained HAR base64 bodies were decoded as UTF-8 even when the bytes were
not UTF-8, inventing replacement characters. They are now decoded
strictly; other bytes are returned exactly as base64 with
body_encoding: "base64".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 20:38:54 -07:00
Edgar ArakelyanandClaude Opus 5.5 124adf945c fix(environment): keep every tool input addressable, flag unrecorded bodies and bound truncation
Path parameters, query parameters and the write body share one argument
object, so a query named like a path parameter or 'body' could not be
supplied, and query names such as 'constructor' were dropped as already
taken. One argument map, used by both the schema and the replay scorer,
now renames a colliding query to query_<name> and a colliding body to
request_body, and is built without inherited keys. Replay results gain
body_recorded, so a body the capture did not keep is not passed off as a
recorded null, and truncation encodes only the 256 KiB prefix instead of
the whole body.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 20:27:06 -07:00
Edgar ArakelyanandClaude Fable 5.1 fe55c94e66 feat(environment): serve an environment manifest as a replay environment
Add rea environment-serve <manifest.json> --evidence <capture.json>
[--host] [--port]: it loads an environment-manifest view and the capture
Evidence it was projected from, refuses a manifest whose parent evidence id
does not match the capture, builds one MCP tool per manifest tool and serves
them over streamable HTTP beside an environment card at
/.well-known/agent-env.json and a data plane at /agentenv that refuses every
method. Each tool call replays the retained record whose path and query
values best match the arguments, cites the record ordinal and evidence id,
marks replayed content as untrusted target content, and truncates bodies
over 256 KiB with a flag. Nothing executes the captured application.

Refs morluto/rea#4933

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-18 19:43:09 -07:00