Skip to content

About

The In-Browser Self-Healing Web Runtime. Real-time 60 FPS DOM containment, W3C LoAF/INP diagnostics, and SLSA v1.0 provenance via Safe Rust WASM & WebMCP.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Anastatica

Anastatica

WebMCP unsafe_code Panics Rust Tests First flight License

A self-healing web performance runtime powered by in-browser AI agents. Anastatica lets AI agents β€” speaking the open W3C WebMCP standard β€” detect and fix rendering bottlenecks (layout reflows, INP spikes) through reversible CSS containment and bounded work scheduling, then hash the resulting DOM state into an in-toto SLSA v1.2 statement.

Built for the OpenAI WebMCP Challenge (Devpost 2026)


Overview

Anastatica is a full-lifecycle web performance runtime that an in-browser AI agent can operate as a system engineer rather than advise as a consultant. It covers all three phases in which a web application degrades β€” and a defect in any one of them is invisible to tooling aimed at the other two:

Phase What degrades What Anastatica does
1 Β· Network Render-blocking resources delay first paint Ranks the critical path from real Resource Timing entries and proposes a preload manifest; the optional reference server separately demonstrates genuine 103 Early Hints
2 Β· Hydration Server markup and client state diverge; handlers silently never bind Compares the live DOM against the server's recorded baseline and re-synchronises the drifted subtree in place, without a reload
3 Β· Runtime Long frames, INP spikes, layout thrashing Detects the anomaly from PerformanceObserver telemetry, attributes it to a real culprit subtree, and applies CSS containment with a computed contain-intrinsic-size

Every browser mutation is checked against a local fail-closed selector allow-list before it is applied, then sealed with a two-tier hash (XXH3 gating BLAKE3) and recorded as an in-toto SLSA v1.2-shaped statement. When the optional server is configured, submitted statements receive the authoritative Biscuit Datalog policy check. The static demo does not claim that its digest is a digital signature.

The diagnostic and healing loop runs locally in the browser in a 100% Safe Rust WebAssembly build. anastatica-server exists for provenance replication and for serving the tiered client; the healing loop does not depend on it.

Anastatica owns no part of the host page. It ships as an in-page DevTools overlay that injects itself into a shadow root it creates, reads and measures the page around it, and binds to nothing the page has to provide. One <script src> or a bookmarklet puts it on any site β€” see Run the DevTools on your own site. demo-app/ is a separate enterprise portal that carries zero Anastatica hooks and knows nothing about the runtime measuring it; a test fails if that stops being true (ADR-0019, and see The Demo).


Architecture

+--------------------------------------------------------------------------------------+
|                              CLIENT BROWSER (V8 / DOM)                              |
|                                                                                      |
|   [ HOST PAGE (any site) ]  <-- (real CSS Containment Patch) --  [ anastatica-ui ]   |
|                              |                        (own shadow-root overlay)        |
|                    (real PerformanceObserver telemetry)           |                    |
|                              v                                   |                    |
|  +----------------------------------------------------------------------------+      |
|  |         ANASTATICA WASM CORE (anastatica-core, linked into anastatica-ui) |      |
|  |                                                                            |      |
|  |  [ Welford baseline ] -> [ 2-sided CUSUM ] -> [ Token budgeter (<=1024) ]  |      |
|  |                              |                              |              |      |
|  |  [ In-Toto SLSA v1.2 ] <- [ Two-tier hashing ] <- [ Biscuit policy check ] |      |
|  |          ^                   |         ^                    |              |      |
|  |          |                   v         |                    v              |      |
|  |          +----------- [ WebMCP gateway / document.modelContext bridge ] --+      |
|  +----------------------------------------------------------------------------+      |
+-------------------------------|-----------------------------------------------------+
                                | (Provenance + telemetry over JSON-RPC 2.0 / Zstd)
                                v
+---------------------------------------------------------------------------------------+
|                  SERVER & STORAGE (anastatica-server)                              |
|                                                                                     |
|   Axum HTTP + jsonrpsee RPC + Tower middleware + OTel telemetry                    |
|   /_console  loopback-gated operator console (off by default)                      |
|                                                                                     |
|   +----------------------------------------------------------------------------+   |
|   |         MULTI-TIER STORAGE ENGINE (anastatica-storage)                    |   |
|   |  [ L1: Moka in-memory ] --> [ L2: Redb ACID ] --> [ L3: Fjall LSM + Zstd ] |   |
|   +----------------------------------------------------------------------------+   |
+---------------------------------------------------------------------------------------+

Quick Start

Build the Rust workspace (100% Safe Rust, zero-unsafe, zero-panic):

cargo build --workspace

Run the full test & lint gate:

cargo test --workspace
cargo clippy --workspace --all-targets

Three suites, because the code runs in three places:

cargo test --workspace                      # everything reachable on the host
cd demo-app && npm test                     # the portal's TypeScript, in jsdom
cd demo-app && npm run test:e2e             # the overlay and closed loop, in Chromium

The browser suite serves demo-app/dist, so run npm run build first. It is the only way to reach anastatica-boot, the overlay's DOM wiring and the lifecycle end to end β€” a wasm import compiles fine on the host and only fails when it is called.

Measured coverage (reported, never a gate):

cargo llvm-cov --workspace --summary-only   # 59.44% line coverage
cargo llvm-cov --workspace --html           # per-file, for the gaps

The figure excludes everything only Chromium can execute, which llvm-cov cannot observe. ISSUES.md names every file it does not cover and why.

Tests are written to fail with return Err(…) rather than assert!: the workspace forbids panic, and panic_in_result_fn makes an assertion inside a -> Result test a compile error. See ISSUES.md for the four defects this suite found.

Run the CI locally, before pushing, with act:

scripts/act-ci.sh          # every job act can run
scripts/act-ci.sh lint     # just one
scripts/act-ci.sh -n       # dry run: resolve every step, execute nothing

The runner image and the local artifact/cache servers are configured in .actrc. One limit is worth knowing: act runs Linux containers, so the test job's windows-latest and macos-latest legs cannot be executed locally β€” the script pins the matrix to the Ubuntu leg and says so rather than failing confusingly.

Build the client tiers and the demo portal:

cd demo-app
npm install
npm run build      # runs scripts/build-wasm.sh, typechecks, then Vite builds dist/

scripts/build-wasm.sh compiles both WASM artifacts (boot, engine) to wasm32-unknown-unknown, runs wasm-bindgen --target web and wasm-opt -Oz, and fails the build if Tier 0 exceeds the 14,336 B initcwnd budget measured at brotli -q 11. It requires wasm-bindgen-cli at the exact version pinned in Cargo.lock:

cargo install wasm-bindgen-cli --version <version from Cargo.lock> --locked

Preview the static production build:

npm run preview

Deploy to Cloudflare Pages:

cp .env.example .env && $EDITOR .env   # Cloudflare token + account id
terraform -chdir=terraform apply       # creates the Pages project, once
scripts/cf-deploy.sh                   # builds and uploads demo-app/dist

Terraform owns the project, wrangler owns the bytes β€” Pages has no Terraform resource for a deployment, and state should describe infrastructure rather than build output. What is uploaded is a directory of prebuilt files, not a zip and not a container image; Pages has no runtime that could execute one. Run terraform -chdir=terraform output production_url after the first apply to print the canonical live URL. Terraform state, Wrangler caches, and .env are local-only and must never be committed.

The static deployment is self-contained: it makes no /rpc or /ingest requests, because the client defaults to TransportConfig::local_only().

One distinction worth keeping straight, because the two targets differ: the real 103 Early Hints comes from anastatica-server, which writes it to the socket ahead of the response. Cloudflare Pages never runs that binary. What Pages serves is the Link: rel=preload header that vite.config.ts writes into dist/_headers β€” browsers honour it from the final response, and Cloudflare promotes it to a 103 only where the zone has Early Hints enabled, which on *.pages.dev is Cloudflare's setting rather than yours.

Optional reference server (Axum + jsonrpsee, provenance replication and real 103 Early Hints):

cargo run -p anastatica-server            # from the repository root

Then open http://127.0.0.1:8080/. See Testing instructions for the browser flags a WebMCP host requires.

With TLS (optional; enables Early Hints over HTTPS on both protocols):

ANASTATICA_TLS_CERT=cert.pem ANASTATICA_TLS_KEY=key.pem \
  cargo run -p anastatica-server --features tls

πŸ” Run the DevTools on your own site

Anastatica is not a demo with a runtime attached β€” it is a runtime that happens to ship with a demo. The overlay injects itself into a shadow root and binds to nothing on your page, so it runs on a page that has never heard of it (ADR-0019).

One script tag:

<script src="https://your-host/devtools/anastatica-devtools.js"></script>

Or a bookmarklet, for a site you do not control β€” save this as the URL of a new bookmark, then click it on any page:

javascript:(()=>{const s=document.createElement('script');s.src='https://your-host/devtools/anastatica-devtools.js';document.body.appendChild(s);})()

Build the bundle with npm run build (or npm run build-devtools alone); it lands in demo-app/dist/devtools/ alongside the engine at stable, unhashed names, so a third-party page can pin the URL.

Ctrl + Shift + A toggles the panel. It is draggable, resizable, clamped inside the viewport, and remembers where you left it. Minimised it becomes a circle that never disappears β€” hover it for Optimise and Open, or click it to reopen the panel. Hovering any control explains what it does.

Panel What it shows
Vitals LCP / INP / CLS / FPS, live, with sparklines
Network The critical path ranked from Resource Timing, plus the Link: preload set a server would emit as a real 103 Early Hints
Hydration Server/client attribute drift against the SSR baseline β€” read-only until you ask it to repair
Runtime Anomalies carrying the z-score the CUSUM detector computed, plus containment / rollback / auto-heal
Tools The seven WebMCP tools, their effect annotations, and whether an agent host is connected
Provenance The SLSA statement, digests before and after, and the capability policy

What it will and will not do on a page you do not own. Observation always works. Mutation is gated by LocalGuard, which grants contain and hydrate only on an explicit allow-list and refuses #login-form, #payment-details and #checkout-form outright. On an arbitrary page the mutating tools are therefore refused, and the Provenance panel states that rather than failing obscurely. A performance tool has no business rewriting a checkout form.

The droppable bundle never phones home. It is the one thing the page must not be able to change. globalThis.ANASTATICA_SERVER configures an outbound transport, and on a page you are inspecting the page controls that global β€” so a hostile site could point the runtime's own output at an origin of its choosing. The standalone entry point therefore boots with the transport pinned to local-only, before anything can connect. A site that wants replication embeds the runtime as a module instead, which is what the demo does. See ADR-0019 Β§Threat model; there were two channels, and the first fix only closed one.


πŸ–₯ The node console

The server has a loopback-gated operator console. It is off by default:

ANASTATICA_CONSOLE=1 cargo run -p anastatica-server

Then open http://127.0.0.1:8080/_console.

Panel What it shows
Storage tiers Per-tier entry counts, mean read latency, sample counts, and CUSUM change-point state
Attestations Every sealed SLSA statement on the node, with its BLAKE3 digest and patch id
Delivery The static root, the 103 preload actually advertised, and the L4 peer
Operations Flush L1 β†’ L2, and reset a tier's latency baseline

It exists because those numbers had no reader. stats(), latency_stats() and flush_l1_to_l2() had zero callers anywhere in the workspace β€” the metrics ran on every read and reached nothing but a log line past 4Οƒ. That is also how a real bug survived: L3 was never timed at all, so its latency was structurally zero, and nothing noticed because nothing looked. A number nobody reads cannot be observed to be wrong.

A tier with no samples reads no data, not steady. Colouring an unmeasured tier green is the same class of mistake.

Access. Two gates, because they fail differently. ANASTATICA_CONSOLE stops the routes existing on a host that never wanted them β€” disabled, /_console is a 404, not a 403. The peer check stops them answering anyone but this machine, enforced from the address the accept loop sees, and a request with no peer address is refused rather than assumed local. There is deliberately no token: a secret in a config file is one that ends up committed or left at its default, and loopback has no such failure mode. A reverse proxy in front of the server would make every request look local β€” which is why the env var still gates it.


Workspace Structure

The workspace is a Rust edition 2024 monorepo. demo-app is now a thin Vite host shell around the real anastatica-ui Rust/WASM crate (see docs/ADRs/ADR-0013-rust-wasm-ui.typ), not an independent implementation.

Crate Description
anastatica-protocol SLSA v1.2 schemas, In-Toto statement models, and JSON-RPC 2.0 types
anastatica-adapter Anti-corruption layer (ana:: alias): hashing, tokenization, compression, HTTP/TLS adapters, the browser LocalGuard, and optional server-side Biscuit policy
anastatica-api Runtime trait, DTOs, and the WebMCP tool catalog
anastatica-telemetry Welford statistics, 2-sided CUSUM detector, and the token budgeter
anastatica-core Real PerformanceObserver telemetry, real DOM remediation, the headless engine, and the real document.modelContext bridge
anastatica-ui Tier-1 runtime β€” the in-page DevTools overlay: injects itself into a shadow root on any page, six panels over real telemetry, and real WebMCP tool dispatch
anastatica-storage 4-tier engine: L1 Moka (RAM), L2 Redb (ACID), L3 Fjall (LSM + Zstd), optional L4 peer/TiKV replication
anastatica-server Axum + jsonrpsee RPC server with Tower middleware
demo-app Thin Vite host shell loading anastatica-ui's compiled WASM

Technical Highlights

  • 100% Safe Rust β€” #![forbid(unsafe_code)] enforced across every workspace crate at the compiler level.
  • Zero panics β€” no unwrap, no expect, no panic!, no slice indexing ([i]), no raw as casts. All fallible paths return Result/Option and are handled with checked arithmetic.
  • Aerospace-grade lints β€” clippy::pedantic + clippy::nursery denied (deny, not forbid, on the two lint groups and unused_qualifications specifically β€” both conflict with code generated by serde/biscuit-auth macros; see docs/prompt.md); indexing_slicing, integer_division, as_conversions, unwrap_used, and more forbidden outright.
  • Real telemetry β€” PerformanceObserver handles long-animation-frame, event, and layout-shift; each metric family owns an independent Welford/CUSUM state, while severe Web Vital values remain actionable during warm-up.
  • Real DOM remediation β€” real geometry pre-flight (child bounding-box overflow check downgrades contain: layout paint to layout-only), real contain-intrinsic-size measurement, real CSS mutation via CssStyleDeclaration, and a real undo journal that restores the exact prior cssText.
  • Fail-closed browser policy β€” the static client allow-lists #catalog-grid operations and denies sensitive or unknown selectors. The optional server applies the injection-tested Biscuit Datalog policy when an attestation is submitted.
  • Two-tier cryptographic hashing β€” XXH3 dirty-checking gates whether BLAKE3 (256-bit) recomputes a state digest at all.
  • SLSA v1.2 attestation of real state β€” every statement digests the actual DOM subtree (outerHTML) when a real DOM backend is present, and reports the real applied containment evidence, not a placeholder.
  • Real Rust/WASM Web console, zero-VDOM β€” no React, Vue, Svelte, or virtual DOM; plain web-sys DOM construction (see ADR-0013).
  • Runs on any site β€” the DevTools overlay mounts into a shadow root it creates, so a host page's global CSS reset cannot reach it and its own stylesheet cannot leak out. Verified on a third-party page with * { box-sizing: content-box } and its own button styling (ADR-0019).
  • Real stress + measurement β€” 50,000 real DOM rows are inserted in adaptive requestAnimationFrame slices, so the page remains interactive while FPS degrades visibly instead of freezing. A legacy filter then provokes a measured long layout task. Evidence-gated containment activates a healthy loading budget and cancellable 128-row filter batches; the browser acceptance run returned the filter handler in ~1 ms. Row text is lowercased once at load rather than per keystroke, so the healed path does no per-row string work.
  • 4-tier server storage β€” a quick_cache hot front cache in tandem with a TTL'd Moka cache (L1), Redb (L2), an XXH3-checksummed Fjall journal (L3), and optional peer/TiKV replication (L4); L1 is correctly invalidated on delete, and a corrupted L3 record is detected on read rather than served.
  • Tiny RPC transport β€” JSON-RPC 2.0 footprint under 1 KB.

Measured delivery (brotli -q 11 and zstd, on demo-app/dist)

Tier Contents Size
Tier 0 β€” first TCP flight dist/index.html (shell + inlined critical CSS + tool catalog) + entry chunk + boot_bg.wasm 7,369 B brotli / 8,533 B zstd (budget 14,336)
Tier 0.5 β€” after the first flight console.css (deferred stylesheet) + portal.js (the demo app's own JS) 1,463 B + 1,868 B
Tier 1 β€” after paint engine.wasm: telemetry, CUSUM, containment, hashing, and the whole DevTools overlay 149,499 B

Both encodings are reported because which one a visitor gets is not ours to choose: Cloudflare's Free plan negotiates Zstandard, Pro and Business negotiate Brotli. scripts/tier0-budget.sh enforces the budget on both, and Tier 0 now fits at every compression level either codec offers β€” 8,645 B at brotli q4, 9,007 B at zstd -3 β€” so the figure does not depend on a CDN choosing maximum compression.

Two things carry that headroom, and one of them is bookkeeping rather than a saving. The demo portal's own JavaScript was in the first flight because main.ts imported it statically; it is now a deferred chunk, because the shell is pre-rendered and nothing about the portal is needed to paint. Those bytes still reach the visitor, one round trip later. The genuine reduction is in boot_bg.wasm, which fell from 15,607 to 2,676 bytes raw when hydrate() stopped calling js_sys::global().

"Critical CSS" is meant literally: the inlined block carries only what paints above the fold, and the rest arrives in a stylesheet fetched with media="print" and promoted on load β€” the one way to request a stylesheet without blocking render.

Note what Tier 0.5 no longer contains. Before ADR-0019 it carried the HUD and the lifecycle card; those are now built by the runtime inside its own shadow root, so the host page ships neither their markup nor their styles. Tier 0 got smaller as the product got larger β€” the overlay's skeleton and stylesheet are include_str!-ed into the deferred engine, off the critical path entirely.

The page paints from HTML alone, with zero JS and zero WASM on the critical path. scripts/build-wasm.sh fails the build if Tier 0 exceeds the initcwnd = 10 budget, so the number above is enforced, not aspirational β€” and it is measured on demo-app/dist, the artifacts a browser is actually served. An earlier version of the gate weighed the sources instead and under-reported the real first flight by ~1,800 B; see ISSUES.md.

ADR-0012 originally found a sub-40 KB WASM client "physically unfeasible". That finding held for a monolith with the crypto stack embedded; it was amended, not silently dropped, once the Biscuit/P-256 subtree moved server-side β€” see ADR-0016.


🌐 Protocol Support Matrix

Anastatica Server terminates HTTP/1.1 and HTTP/2 β€” cleartext and, with the optional tls feature, over TLS with ALPN β€” and emits an authentic, in-band 103 Early Hints on every one of them.

The two protocols cannot share a mechanism, and that is the interesting part. HTTP/1.1 gets a byte preamble written to the stream before hyper sees the request. HTTP/2 cannot: its headers are HPACK-compressed against a dynamic table owned by the encoder, so injected bytes would desynchronise it and corrupt the connection. HTTP/2 instead sends a real informational HEADERS frame via the h2 crate's send_informational.

Transport 103 How Verified
HTTP/1.1 Β· cleartext βœ… byte preamble ahead of hyper curl --http1.1
HTTP/1.1 Β· TLS βœ… same preamble, written to the decrypted stream; rustls encrypts it curl -k --http1.1
HTTP/2 Β· h2c (prior knowledge) βœ… informational HEADERS frame (h2::SendResponse::send_informational) curl --http2-prior-knowledge, plus decoded frames in e2e_h2_early_hints.rs
HTTP/2 Β· TLS (ALPN h2) βœ… same frame, ALPN-routed curl -k --http2
HTTP/1.0 βœ— by design RFC 9110 forbids sending 1xx to an HTTP/1.0 client, which would read it as the final response negative test
HTTP/3 (QUIC) edge not terminated in-process β€” see below β€”

A Link: rel=preload header also rides the final response on every transport, covering HTTP/1.0 clients and any intermediary that drops informational responses.

TLS is behind an off-by-default tls cargo feature: it needs certificates to be useful, and ring puts non-Rust code in the server tree. The browser dependency graph stays C-free either way.

HTTP/3 (QUIC) is deliberately omitted from the in-process binary to avoid pulling unfinalized pre-1.0 UDP userland dependencies β€” h3 is at 0.0.8 and quinn at 0.11.11 β€” and is designated for edge proxy termination in production.


πŸ“’ Milestone Announcement: Native HTTP/3 (QUIC) Engine

  • Target Release: Anastatica v0.2.0 (Enterprise Protocol Tier)
  • Roadmap Status: In-process UDP socket multiplexing via quinn and the Tokio h3 stack is scheduled once upstream h3 reaches v1.0 API stability. The DistributedTier-style seam already used for L4 is the model: one transport trait, backends added without touching callers.
  • Production Status Today: Deploying Anastatica behind a QUIC-terminating edge (Cloudflare Pages, Fastly, nginx-quic) gives clients HTTP/3 end-to-end today β€” the edge terminates QUIC with 0-RTT handshakes and forwards to this origin over HTTP/2 or HTTP/1.1, both of which emit real 103 Early Hints natively. To be precise about who does what: HTTP/3 is terminated at the edge, not by Anastatica. The origin stays small and free of pre-1.0 UDP dependencies β€” which is the point of the omission rather than a limitation of it.

The Demo

Live deployment: anastatica.pages.dev

demo-app/ is Northwind Analytics, an enterprise inventory portal with three planted defects β€” one per lifecycle phase. Portal code never imports or calls the runtime; after a standards-based containment patch it observes the computed CSS state and switches its legacy filter to bounded batches.

Phase Planted defect Where it lives
1 Β· Network Render-blocking cross-origin font stylesheet, no preconnect, no preload β€” two TLS handshakes before text can paint demo-app/index.html <head>
2 Β· Hydration The timestamp is re-rendered in the browser's local timezone, so data-tz drifts from the server's UTC baseline and the Export action never binds β€” no error, no console warning demo-app/src/portal.ts
3 Β· Runtime A legacy filter walks 50,000 rows and performs periodic geometry reads after style writes, producing a reproducible long layout task demo-app/src/portal.ts

The agent's path through them:

  1. Load the full catalog. All 50,000 DOM rows arrive in adaptive frame slices: progress remains visible, the page keeps accepting input, and the overlay shows frame rate degrade rather than disappearing behind a frozen main thread. A keystroke on the uncontained filter remains the deliberate synchronous layout-thrashing defect.
  2. audit_network_critical_path ranks the blocking font request from real Resource Timing entries and proposes a preload set.
  3. repair_hydration_boundary compares the live DOM against data-anastatica-ssr and restores the drifted attributes β€” the Export button comes back with no reload and nothing the user typed is lost.
  4. inspect_rendering_bottlenecks attributes the long frames to a real culprit subtree from the live telemetry buffer.
  5. auto_heal_pipeline applies nothing unless the report contains a matching selector. With evidence, the local allow-list and geometry pre-flight permit contain: layout paint; the portal then filters in cancellable 128-row animation-frame batches.
  6. attest_runtime_state digests the real post-mutation outerHTML and emits an in-toto SLSA v1.2 statement.

No WebMCP host? The overlay's title bar says so plainly and its Runtime panel keeps the same tools callable through the embedded gateway β€” the same code path, a different caller. No success is scripted: a diagnosis without matching evidence returns no_action and leaves the DOM untouched.

Every step above is also visible without an agent: the overlay's Network, Hydration and Runtime panels each drive the corresponding tool directly, which is how a judge in a plain browser can walk all three lifecycle phases by hand.

Testing instructions

For ChatGPT Desktop, install the latest app, choose GPT-5.6 Sol or Terra, enable Settings β†’ Browser β†’ Permissions β†’ Enable site tools, and open the live Cloudflare Pages URL in ChatGPT's built-in browser. Open Site Tools in the address bar and confirm seven tools. See the official OpenAI WebMCP instructions. Suggested prompt:

Load the full catalog and reproduce the slow filter. Inspect this page's site tools and rendering telemetry. Only if the diagnosis identifies the catalog, run auto-heal, repeat the filter, and return before/after evidence plus the attestation. Otherwise leave the page unchanged.

Chrome 149+ can be used with chrome://flags/#enable-webmcp-testing. For the optional Early Hints server, run cargo run -p anastatica-server and verify:

curl --http1.1 -v            http://127.0.0.1:8080/  -o /dev/null   # HTTP/1.1 103 Early Hints
curl --http2-prior-knowledge -v http://127.0.0.1:8080/ -o /dev/null # HTTP/2 103
curl -k --http1.1 -v         https://127.0.0.1:8080/ -o /dev/null   # HTTP/1.1 103 over TLS
curl -k --http2 -v           https://127.0.0.1:8080/ -o /dev/null   # HTTP/2 103 over TLS

Every one carries Link: </assets/engine_bg-<hash>.wasm>; rel=preload; as=fetch ahead of the final response. HTTP/1.1 sends it as a byte preamble on the socket; HTTP/2 sends it as an informational HEADERS frame via h2's send_informational, since the two protocols cannot share a mechanism.


Why WebMCP, and what it unlocks

Why this use case fits WebMCP. Web performance debugging is the rare problem where the agent needs live, structured, privileged access to a running page β€” not a screenshot, not the HTML source. The signals that matter (LoAF entries, Resource Timing, layout-shift sources, the divergence between server markup and client state) exist only in the browser, only at runtime, and only for a few hundred milliseconds. An agent driving a UI cannot see them at all. WebMCP is what makes them addressable: seven typed tools over document.modelContext, each returning structured JSON inside a token budget.

How it improves the experience. The defects here are the ones that waste the most engineering time precisely because they are silent. A hydration mismatch does not throw β€” a button simply stops working. A render-blocking font does not error β€” the page is just slow. Today, finding these means a human reading flame charts in DevTools. Here, the page reports its own pathology in structured form and the agent repairs it in place, while the user keeps typing.

What people and agents can do together that was hard before. An agent can now change a running page's rendering behaviour and leave a verifiable record of having done so. Before WebMCP, an agent's options were to describe a fix in prose or to puppet the UI blindly. It could not apply CSS containment to a specific subtree after a geometry pre-flight, re-synchronise a drifted hydration boundary without discarding user input, or produce a digested statement of exactly which DOM subtree it mutated and under what authority. The capability check and the SLSA attestation are what make agent-applied mutations auditable rather than merely possible β€” which is the difference between a demo and something you would run on a production site.

How WebMCP is implemented. The top-level host script is the single owner of seven awaited document.modelContext.registerTool calls. Each closure captures its tool name, and every inputSchema is a real object generated from the Rust DTO by cargo run -p xtask and inlined into the first response. Tier-1 owns dispatch only, so lazy loading cannot duplicate registrations. Each invocation loads the engine on demand and forwards structured arguments to the same Rust gateway used by the fallback controls.

Tool Phase
audit_network_critical_path 1 Β· Network
repair_hydration_boundary 2 Β· Hydration
inspect_rendering_bottlenecks 3 Β· Runtime
apply_runtime_containment 3 Β· Runtime
attest_runtime_state provenance
rollback_runtime_patch provenance
auto_heal_pipeline closes 3 β†’ provenance in one call

Built With

  • Rust 2024 β€” edition-2024 workspace, Safe Rust subset, wasm32-unknown-unknown target
  • anastatica-ui β€” zero-VDOM Rust/WASM runtime attached to the host page (see ADR-0013)
  • wasm-bindgen + wasm-opt + zstd β€” the real build pipeline in scripts/build-wasm.sh
  • Vite β€” dev server and host shell for the compiled WASM module
  • biscuit-auth β€” optional server-side Datalog verification for submitted attestations
  • Axum + jsonrpsee β€” server-side HTTP and JSON-RPC 2.0 transport

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

The In-Browser Self-Healing Web Runtime. Real-time 60 FPS DOM containment, W3C LoAF/INP diagnostics, and SLSA v1.0 provenance via Safe Rust WASM & WebMCP.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages