Skip to content
Zen-cronicPublic

About

ExactCue — current-state-bound actions for browser agents

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ExactCue

Current-state-bound actions for browser agents. The exact action. Your cue.

ExactCue is a WebMCP reference implementation for a consequential browser-agent boundary: the page exposes the actions valid right now, binds read-back to the exact current proposal, and commits only while the authoritative record still matches. The interface makes that custody visible as one animated Exact Cue moving from intent to review, current-record check, and receipt. A synthetic prescription refill is the proof case, not a claim of clinical deployment.

Meet Marcus, the synthetic demo user. He's blind. Today, refilling his prescriptions means fighting a form built for a mouse. With ExactCue he says, "refill my cholesterol and blood-pressure meds for pickup at Marmora" — hears exactly what's about to happen — and confirms.

Why WebMCP — the honest version

We are not claiming a general browser agent can't operate a web page. Computer-use agents (ChatGPT's browser, Comet, Copilot in Edge) already drive authenticated sessions through the accessibility tree or raw pixels. So why WebMCP?

Because for someone who can't see the screen, "probably clicked the right thing" is not good enough. A DOM/pixel agent infers what a control does and can silently mis-click — and the user can't visually catch it. WebMCP changes the guarantee:

  • The page publishes named, typed tools with descriptions (document.modelContext.registerTool), so the agent invokes a known action — submit_refill — not a guessed-at button.
  • The tools are scoped to the current step (via AbortController): on the prescriptions step the agent can set_prescription; only on review can it submit_refill. The page keeps the agent on-rails.
  • The committing action is reached only after an on-demand spoken or screen-reader read-back plus explicit confirmation bound to an ExactCueSnapshot, and the authoritative commit runs server-side with an ETag compare-and-swap — so if the record changed underneath (a refill already processed, a dose updated), the submit fails closed with an actionable message instead of doing the wrong thing quietly.

That reliability floor — the page declares the exact action, binds the read-back to the current proposal, and refuses a stale commit — is what a scrape-the-DOM agent cannot obtain from control labels alone. Human confirmation remains the browser agent's responsibility; ExactCue proves payload binding and freshness rather than pretending it can infer spoken assent. That is the load-bearing role of WebMCP here.

Scope note (read this before calling it a mock)

WebMCP requires the page to expose the tools, so this demo runs on our own pharmacy app. That's the point, not a dodge: the WebMCP layer is a small typed adapter a site adds over the app it already has (src/webmcp/exactCueTools.ts is that layer here). We deliberately built one deep, real flow — real state, server-authorized submit, a real stale-record fail-closed on camera — rather than a wide set of shallow fakes.

How it maps to the judging rubric

  • WebMCP Leverage — real document.modelContext tools are the only control plane for the agent; the tool set changes with task state, visible live in the app and the Model Context Tool Inspector; the server-side ETag CAS is genuine, not simulated.
  • Execution — a complete, coherent product: a fully usable human UI, plus empty / unsupported-browser / ineligible-prescription / reduced-motion / stale-record / success states.
  • Potential Impact — a specific audience and costly failure mode: a non-sighted user cannot visually catch a wrong or stale transactional action. The demo is synthetic and claims a reusable safety pattern, not clinical deployment or completed user research.
  • Creativity & Ambition — accessibility as a shared action-custody journey, not an accessibility audit. The same cue drives motion, speech, UI, WebMCP output, and the server receipt.

How WebMCP is implemented

  • src/webmcp/modelContext.ts — typings + helpers for the experimental imperative API.
  • src/domain/refill.ts — the pure, tested state machine (steps, eligibility, validation, submit).
  • src/domain/exactCue.ts — the reviewed cue, spoken transcript, record binding, and safe public projection used by both people and agents.
  • src/store.ts — one shared order that both the React UI and the tool handlers read/mutate, so the page and the agent always look at the same uncommitted review state.
  • src/webmcp/exactCueTools.ts — the typed WebMCP adapter. Every execution returns readable MCP content plus machine-readable structuredContent; always-on tools describe and recover; navigation and action tools register and retire with the current step. At review, go_to_next_step disappears and only the read-back + explicit-confirmation submit path can reach authoritative completion.
  • src/server/orderService.ts — validates the proposed refill against the current authoritative catalog and makes the ETag/version compare-and-swap decision.
  • src/server/netlifyBlobOrderRepository.ts — strong Blob reads plus the production onlyIfMatch conditional write. A stale or replayed token returns the current record and never commits the proposal.
  • src/api/demoSession.ts — bounded, path-safe synthetic run IDs. The run ID is visible in the URL and proof bar; it is not a credential or an authorization boundary.
  • netlify/functions/order.ts — web-standard GET /api/order and POST /api/order Function.
  • src/App.tsx — the accessibility-led intent → cue → check → receipt journey, user-triggered speech, Motion transitions, compact proof disclosure, and the built-in stale-tab rehearsal.

Run it

pnpm install
pnpm dev        # http://localhost:5820 (headers + labeled local proof server)
pnpm test       # domain, CAS, replay, and HTTP contract tests
pnpm build      # typecheck + production build to dist/
pnpm preview    # built artifact + labeled local proof server on :5820
pnpm smoke:ui   # WebMCP-executed refill + stale-write/recovery proof
pnpm capture:demo # real hosted conflict-to-recovery insert
pnpm scan:secrets

The deterministic receipt currently covers 23 unit tests and nine axe-audited UI states with zero detected violations, including 350px and reduced-motion captures. The test suite covers the domain state machine, cue binding, HTTP contract, conditional commit, stale requests, and replay rejection.

The capture command drives the public deployment through native WebMCP and writes its MP4 outside the product repository at ../submission/exactcue/video/exactcue-proof.mp4. Judge-facing demo and upload materials live alongside that artifact and are deliberately not tracked here.

To see the agent drive it, open the app in Chrome 149+ with chrome://flags/#enable-webmcp-testing enabled (plus the Model Context Tool Inspector extension). This Chrome path has been manually verified. Without WebMCP the page runs in fully usable manual mode and says so; other compatible WebMCP clients can use the same page-declared tool surface.

Deploy (Netlify)

netlify.toml sets the required headers (Origin-Agent-Cluster: ?1, Permissions-Policy: tools=(self)), publishes dist/, and bundles netlify/functions/ on Node 22.12+. On Netlify the Function opens the site-wide exactcue-orders Blob store. First read creates the synthetic aggregate with onlyIfNew; submit performs a strong read followed by setJSON(..., { onlyIfMatch: etag }). A losing writer receives HTTP 409 with the current record. Each browser run receives a validated demo-<uuid> session in the URL and an isolated key under sessions/<session>/marcus-refill, so a judge can start a fresh synthetic demo without deleting a prior receipt. Malformed/path-like IDs are rejected before storage is opened.

Every order response includes X-ExactCue-Request-Id, X-ExactCue-Storage, and Server-Timing receipts. The hosted Function logs only that request ID, method, status, duration, and storage mode; it deliberately excludes URL/session IDs, ETags, request/response bodies, and patient/order fields.

Live product: https://exactcue-webmcp.netlify.app/

Reproducible stale-record journey: https://exactcue-webmcp.netlify.app/?judge=1

In judge mode, build and review the cue, then choose Rehearse stale tab. ExactCue sends two real conditional requests: the competing request commits first, the original cue receives 409 with noWrite: true, and recovery reveals the current authoritative receipt.

Local Vite dev/preview serves the same HTTP handler and service logic over an in-memory adapter, visibly labeled LOCAL PROOF SERVER. That makes offline tests and deterministic conflict rehearsal cheap, but it is not presented as hosted Blobs proof. The public preview has separately returned X-ExactCue-Storage: netlify-blobs and passed a real hosted matching commit, stale 409/no-write, replay rejection, recovery, session-isolation, and anonymous reachability check.

Current Netlify implementation references: Blobs conditional writes and web-standard Functions.

Scope & safety

ExactCue is a coordination/reference implementation. It gives no medical advice and makes no clinical judgement. All people, prescriptions, pharmacies, and records are synthetic. No real pharmacy integration or blind/motor-impaired participant study is claimed.

License

MIT — see LICENSE.

About

ExactCue — current-state-bound actions for browser agents

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages