mirror of
https://github.com/morluto/rea.git
synced 2026-10-27 18:05:45 +00:00
Serve retained capture Evidence as a bounded MCP replay environment with discovery. Preserve default stdio, caller-selected facts and complete source Evidence. Fix numeric fidelity, argument identity, startup cancellation and bounded discovery, query/path matching and output metadata. Verify real recorded API data and public CLI/MCP workflows; preserve explicit gaps for Windows and third-party hosts. Co-authored-by: Edgar Arakelyan <edgar.arakelyan@scale.com> Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2.3 KiB
2.3 KiB
Implementation plan
- Add
src/application/environment/environmentSource.tsto authenticate the two Evidence files, require the manifest view kind and the capture operation, refuse a parent mismatch, and reduce every cited record to its request line, status, content type and retained response text through the slice-1 request-line reader, so the server holds only what replay returns. - Add
environmentTools.tsto map manifest tools to MCP tool definitions with one hand-built JSON Schema per tool that bothregisterTool(through the SDK'sfromJsonSchema) and the card consume, and to build the card in the echo example's key order. - Add
environmentReplay.tsto score cited records by path-segment matches, then query matches, keep manifest order on ties, and shape the replay result with JSON-like parsing, UTF-8-safe truncation and the replay provenance block; export the slice-1 JSON-like predicate instead of restating it. - Add
src/server/environment/serveEnvironment.tsto build theMcpServerwhose handlers attach REA's target-content_meta, the card and/agentenvroutes (the latter reading its body through the SDK's bounded reader), and to serve them through the slice-2serveStreamableHttpwith itsroutesandonerrorseams; addsrc/config/environmentName.tsforENVIRONMENT_NAME. - Add
src/cli/environmentCommands.tsregisteringenvironment-servethroughwithCommandCancellationandlogCliCommand, resolving host and port with the slice-2 endpoint parser, reading files throughparseCliJsonInput, importing the listener lazily, awaiting the cancellation signal or a listener failure and returning onestoppeddocument or a typed error; register the name inCLI_COMMANDSand the lazy module in the startup import probe. - Share the fixture pair through
tests/fixtures/environmentServe.tsand the listener spawn through a generalisedstartListeningProcess; add services, adapters, mcp-boundary, cli-boundary and process-boundary tests. - Document the command in
docs/cli.md, adddocs/agent-environments.mdwith its sidebar and index entries, and record the spec.
No new dependency is introduced. REA's tool contracts, catalog digests and the stdio transport are unchanged; the CLI inventory gains one command.