Commit Graph
20 Commits
Author SHA1 Message Date
Edgar ArakelyanandClaude Opus 5.5 82556cd550 fix(environment): answer unfiltered lists from their own parent; describe served writes
An unfiltered list call chose the first paging-only line of the tool
whatever its path arguments named, so with /api/orgs/1/books?limit=50
and /api/orgs/2/books?limit=50 behind one tool, a call for org 2 got
org 1's books. The line must now be of the collection the call's path
arguments name (matched as item calls match, chosen as replay chooses);
a parent with no such line answers from its recording.

The serving guide and the evidence-workflow reference still said state
mode leaves write tools out and that no write has an effect; they now
describe confirmed write tools being served and what a served write
does not model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 12:56:51 -07:00
Edgar ArakelyanandClaude Opus 5.5 862c88c6bd chore: merge environment state coverage (f6c756aa) into environment state writes
The contract text conflicted only because both sides carry the coverage sentence; this branch's adds the write sentence beside it, so it is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 12:44:52 -07:00
Edgar ArakelyanandClaude Opus 5.5 61c8e3e91d chore: merge environment state serve (c00fde41) into environment state writes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 12:44:02 -07:00
Edgar ArakelyanandClaude Opus 5.5 c00fde41b9 fix(environment): keep room for refusals and framing in the reply budget
The response budget counted accepted replies only: a budget error that
replaced a reply, and a batch's brackets and commas, were not charged,
so near 64 MiB later refusals pushed the body past the advertised
limit. Every reply still to come now keeps room for its own budget
error, and a batch keeps room for its framing, so a refusal always fits
and the body never passes the budget. Reply ids and which messages are
answered come from one place shared by the replies and the reserve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 12:43:10 -07:00
Edgar ArakelyanandClaude Opus 5.5 f6c756aafc fix(environment): quote captured names in response summaries
Field and member names from a capture were joined raw into tool
descriptions that use ", " and "; " themselves, so a key such as
"x; recorded statuses 500" made a description claim a status the tool
never recorded, and "id, name" read as two fields. Names are now
written as JSON strings; a name too long for a sample is still refused
by the sample without being copied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 11:37:17 -07:00
Edgar Arakelyan 0864bacbaa Merge remote-tracking branch 'fork/feat/environment-state-coverage' into feat/environment-state-writes
# Conflicts:
#	docs/web-network-captures.md
#	src/contracts/analysisViewToolContracts.ts
2026-10-20 10:21:21 -07:00
Edgar Arakelyan a0b3c55425 Merge remote-tracking branch 'fork/feat/environment-state-serve' into feat/environment-state-writes 2026-10-20 10:20:00 -07:00
Edgar ArakelyanandClaude Opus 5.5 84291a05d7 fix(environment): count only applied writes and serve writes the held entities can answer
A refused call no longer advances the served clock, the write counter or a
sequence: values are reserved while a call is answered and committed with its
mutation, and deletes and document writes advance the clock like the others.
Updated entities cite no records, so data/get output loads back unchanged.
The gate withholds an update or delete that answers with the entity when no
initial entity holds every field its recorded answer shows, which would
answer only for entities the environment created (incomplete-entities). A
create whose template keeps a path value is tied to its collection like a
constant, and a delimited token is found after an overlapping undelimited one.

Documents write plans, the gate and served writes in the environment-state
and serving guides, the CLI help, the analysis-view contract and the bundle
README, and records the replay card the response summaries now produce.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 09:58:12 -07:00
Edgar ArakelyanandClaude Opus 5.5 5a61853a69 fix(environment): release batch replies as they are encoded; judge exact numbers by value
answerBatch kept every settled reply in its pending array until the
batch ended, so a batch alternating data/add and data/get held each
loaded state alive; each reply now leaves the queue as it is encoded.

The exact-number policy judged a number by its recorded spelling, so a
state loaded with 1e20 came back from data/get as
100000000000000000000, which data/add refused, breaking the promise
that data/get output loads back unchanged. A number is exact only when
both its recorded spelling and the one serialization writes are safe,
so integers from 2^53 below 1e21 are refused in any spelling; replay
keeps such bodies as recorded text. A domain test checks that every
accepted number is accepted again once written back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 08:55:51 -07:00
Edgar ArakelyanandClaude Opus 5.5 ef49dca6d7 fix(environment): keep changed documents out of the state; mark OPTIONS and TRACE safe
Every non-entity GET read became a document from its latest initial
recording, bounded only by writes under related roots, so GET /api/me
read before and after POST /api/orders published the post-write value
as initial state (entities already leave such a type recorded). A
document whose value changed between two of its line's reads across
any recorded write is now recorded as fields-differ; an unchanged
value is still a document.

MCP hints treated OPTIONS and TRACE as non-idempotent writes, so a CORS
preflight tool fell to the destructive default. The RFC 9110 safe
methods (GET, HEAD, OPTIONS, TRACE) are read-only and idempotent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 08:37:47 -07:00
Edgar ArakelyanandClaude Opus 5.5 bf0dd9262d chore: merge environment state coverage into the state writes branch
Combines the state-serving branch and the coverage branch so write effects
build on both: the catalog takes the source with the data-plane options, tool
descriptions keep the response summaries, and two tests follow the documents
the coverage branch now extracts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 08:25:05 -07:00
Edgar ArakelyanandClaude Opus 5.5 57b11681c2 fix(environment): measure data-plane replies before building them
83fcc739 bounded one /agentenv response to 64 MiB, but it still
serialized each reply whole before measuring it, so a batch of data/get
calls on a large state built every refused reply in full only to drop
it. Each reply is now measured in bounded JSON parts (the shared
jsonParts encoder), its parts kept only while it fits; a reply past the
budget is counted for its exact reply_bytes but never assembled. A test
checks that a refused read is never handed to JSON.stringify whole and
that its reply_bytes is exact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 08:01:49 -07:00
Edgar ArakelyanandClaude Opus 5.5 83fcc739f7 fix(environment): bound data-plane replies, keep batch order, cancel intake on stop
- One /agentenv response is held to 64 MiB: replies are measured as they
  are produced and one past the budget becomes a -32000 error stating it.
- Every message of a batch enters the arrival-order queue on arrival, so
  another request's reset never lands between them.
- Stopping the server, or a caller leaving, cancels the active download
  and answers queued calls `cancelled` without running them.
- file:// URIs name only this host: another host or a network share is
  refused before anything is opened.
- A loaded view value may not give an entity another identity.
- List answers refuse a member lacking a field every recording carried,
  as item answers do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 00:11:25 -07:00
Edgar ArakelyanandClaude Opus 5.5 6676582675 feat(environment)!: serve the environment state by default
environment-serve derives the environment state at startup by running the
environment-state view in-process on the capture with the manifest's
template rules, so an environment comes with its state and a user supplies
nothing extra. The derived Evidence is the same one inspect-analysis-view
produces by hand. --state is removed; --replay-only serves exactly the
stateless replay of main. When the state cannot be derived, or its catalog
does not fit the discovery budget, the server starts in replay mode, logs
the reason and reports it in the stop summary's `state`. Exported bundles
serve the state by default too: export derives it the same way, so the
verifier's tool count and checked answer match what is served, and the
README describes the served mode.

BREAKING CHANGE: environment-serve answers read tools from the derived
state and does not serve write tools unless --replay-only is given; the
stop summary reports `state` instead of `state_evidence_id`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 23:29:29 -07:00
Edgar ArakelyanandClaude Opus 5.5 35aee7c051 feat(environment): render more read tools from the state and describe responses
The environment-state view now holds every non-entity GET read with one
initial request line as a read-only document, infers identity from an
`...Id`/`..._id` field every listed item carries distinctly when no fixed
identity name does, and locates single entities wrapped in a one-element
array (`{"posts":[{...}]}`). Served tool descriptions say what each tool
returns, from its own recorded exchanges, and tools carry MCP annotations
(read-only, destructive, idempotent, closed world). On 44 recorded captures
the state renders 1,016 of 1,258 read tools, up from 710.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 20:54:52 -07:00
Edgar ArakelyanandClaude Opus 5.5 2bd0b3cc16 feat(environment): serve tool calls from the environment state
`environment-serve --state <state.json>` serves an environment from the
initial state an environment-state view extracted. Read tools whose views
are state-backed answer from a live state store: item views render the held
entity into the recorded envelope, list views render the collection or the
recorded members, and document views return the held value; a missing entity
or one lacking a required field is refused, and requests the state cannot
answer fall back to their recordings with the reason. The /agentenv data
plane implements data/reset, data/add (a rea-state/v1 document as a data
part, base64 bytes, a file:// path or an https URL, validated and replaced
atomically) and data/get, and the card advertises those operations and an
intake declaration. Stage 1 is read-only: write tools are not served in
state mode. Without --state nothing changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 20:54:50 -07:00
Edgar ArakelyanandClaude Opus 5.5 ad439bd2f2 feat(environment): extract the initial state a capture's reads observed
Add the environment-state analysis view. From the parents the environment
manifest accepts, it extracts the data the capture's reads observed before
the first related write: entity types with an identity field (proved by a
path parameter or inferred from an identity name), entities with their
recorded values and provenance, documents for written non-entity paths, and
a render plan per read tool that is kept only when it reproduces the tool's
latest initial recordings from the state; every other read tool is a
recorded view with the reason. The Evidence is always inferred.

Response-body decoding moves to a domain owner shared with replay, exact
JSON parsing moves to the owner of the exact-number policy, the manifest and
state views share parent admission and record grouping, and
projectAnalysisView takes its accumulators as one object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:29:37 -07:00
bf1eeee94f feat(environment): build environments from browser scenario captures (#5182)
Build an agent environment directly from retained capture_browser_scenario Evidence through the existing manifest, serve and export commands. Preserve request ordinals, source pointers, redaction markers, unavailable bodies, provenance and the default stdio MCP transport.

Followups admit copied/transformed text before body validation or decoding, avoid request-text allocation in replay, normalize portable file inventories, select dependent CI lanes, retain the author's redaction/body-budget corrections, and count body coverage over represented requests.

Validation: full pinned-toolchain static gate, source and public CLI/MCP regressions, canonical catalog checks, actual Chromium interactive and live GitHub API captures with exact HTTP replay and stdio parity, the generated non-root Docker image, and its smoke task through real agent-env 0.9.1334. Verification scopes, resource measurements and platform limits are recorded in the PR and feature verification document.

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 06:07:15 +08:00
7a0c47bfa4 feat(environment): export an environment manifest as an agent environment bundle (#4999)
Export an authenticated capture and environment manifest as a pinned agentenv bundle with provenance, a replay verifier and smoke task.

Followups preserve immutable input ownership, bounded discovery, caller paths and numeric values; bind bundle writes and package copying to retained filesystem owners; verify POSIX modes; retain cleanup authority; and verify framework/npm executable selection. Default MCP remains stdio.

Validation: pinned Linux toolchain, typecheck/build/lint/format/docs/knip, 452 focused tests, ten product-catalog cases, real GitHub response replay in the generated non-root Docker image, and the real pinned agentenv framework smoke workflow. Platform and resource-measurement limits are recorded in the feature verification document.

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-20 05:29:43 +08:00
10f1994fe1 feat(environment): serve an environment manifest as a replay environment (#4975)
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>
2026-10-20 03:06:29 +08:00