SIGN IN SIGN UP

feat(examples): add a self-modifying harness (#2207)

* feat(examples): add self-modifying harness

* feat(self-modifying-harness): serve the UI over the WebSockets capability

Replace the HTTP operator API with a WebSocket protocol on the WebSockets
capability: an object snapshot on connect, subscribe to replay-then-tail
a turn's Streams log, and submit, write_source, activate, and restore
commands. Turn and revision changes broadcast to every connection.

The client connects with useAgent from agents/react through a
useHarnessSession hook and uses the same Kumo chat layout as the other
harness examples, with tool cards per turn and an inspector for the
active revision's code, revision history with restore, and the journal.
The worker routes with routeAgentRequest.

Tests drive the test object over RPC instead of the removed HTTP adapter.
Drop the dev-time journal column migration and the duplicated file list
from the snapshot.

Claude-Session: https://claude.ai/code/session_01KEFnjoMnZBMewsuD9qxGrL

* chore(self-modifying-harness): rename the worker and pin a dev inspector port

Deploy as self-modifying-harness-example, give the Vite dev server its own
inspector port so it can run beside the other harness examples, and note
CLOUDFLARE_ACCOUNT_ID for logins with several accounts.

* fix(self-modifying-harness): dedupe React so the client renders

agents/react resolved a second React copy from the agents package, which
broke every hook call in the browser.

* chore(self-modifying-harness): shorten the UI copy

* fix(self-modifying-harness): stop the snapshot and subscribe loop in the client

A closed stream ends as soon as it is replayed, and every stream end
asked for a snapshot that resubscribed to every turn, so the page kept
re-rendering and scrolling to the bottom. Subscribe to each turn once per
connection, refresh only after a live tail ends, and scroll only when
content is added.

* chore(self-modifying-harness): align the inspector header with the chat header

* fix(self-modifying-harness): settle harness failures inside the Tasks step

Catching around step.do turned retry suspensions, cancellation, and
superseded attempts into terminal turn failures. Capture harness errors
inside the step callback instead so Tasks control signals keep propagating.
Note in the README that the demo has no authentication.

* chore(examples): format the next examples table
M
Matt committed
94485788607298d1bbbb31db6f21305a333f151e
Parent: 4e25485
Committed by GitHub <noreply@github.com> on 9/8/2026, 4:56:39 PM