diff --git a/.gitignore b/.gitignore index 84d70a4..11700be 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,9 @@ CLAUDE.local.md # generated by scripts/copy-maplibre-worker.mjs at dev/build time /public/maplibre/ + +# Recording harness outputs (scripts/media) +scripts/media/node_modules/ +scripts/media/*.gif +scripts/media/*.raw.json +scripts/media/package-lock.json diff --git a/README.md b/README.md index 25bd382..7ad2fde 100644 --- a/README.md +++ b/README.md @@ -6,23 +6,23 @@ Live: **https://glassmap.clyeh.xyz** · **15 WebMCP tools, no backend, no API ke  ## Why "Glass" -To an agent, every station, park and pin on a web map is just pixels. A screenshot can't read an unlabeled green polygon, a click stops working the moment the zoom changes, and drawing a shape, measuring a distance or selecting every park in view is essentially impossible from a picture. WebMCP exposes the map's state, features and actions as tools instead, so an agent never has to guess from pixels — the black box becomes **glass**. Every web map has this problem — property search, delivery planning, travel — and the fix is a tool contract, not a bigger screenshot model. For someone who cannot see the map at all, the same read-only tools double as agent-mediated map access — not a WCAG or accessibility-compliance claim. +To an agent, every station, park and pin on a web map is just pixels. A screenshot can't read an unlabeled green polygon, a click stops working the moment the zoom changes, and drawing a shape, measuring a distance or selecting every park in view is essentially impossible from a picture. WebMCP exposes the map's state, features and actions as tools instead, so an agent never has to guess from pixels — the black box becomes **glass**. Every web map has this problem — property search, delivery planning, travel — and the fix is a tool contract, not a bigger screenshot model. For someone who cannot see the map at all, the same read-only tools double as agent-mediated map access. ## The same task, two ways -Both arms were asked: *"Show every park within a 10-minute walk of Daan Station."* — the first "Try asking" card on the page. Open the live site and say it verbatim. +Both agents get the same sentence — *"Show every park within a 10-minute walk of Daan Station."*, the first "Try asking" card on the page. Open the live site and say it verbatim. **Screenshot agent**  -19 UI actions · 8 screenshots → finds 2 of 7 parks. The 800 m "circle" is an 8-vertex polygon whose radius is a guess (the page shows a screenshot agent no scale bar and no zoom readout). The other 5 were never found: each one is another click-and-read-the-card round trip, and nothing on screen says how many are left. The search box needs two tries — "Daan Station" has no match, "Daan" does. +19 UI actions · 8 screenshots → 2 of 7 parks. The 800 m "circle" is an eight-vertex polygon with a guessed radius — the page shows no scale bar and no zoom readout — and the other five parks are never found: each one costs another click-and-read round trip, and nothing on screen says how many are left. **WebMCP agent**  5 tool calls · 2.9 KB returned · 82 ms of tool time · 0 screenshots → all 7 parks inside an exact 800 m circle, each with an id, a distance and a compass direction — two of them parks OpenStreetMap never named: `set_map_view({ place: "Daan Station" })` → `draw_shape({ type: "circle", center: "Daan Station", radius_m: 800, label: "10-minute walk" })` → `set_map_view({ fit: "drawing:1" })` → `find_features({ near: "Daan Station", radius_m: 800, categories: ["park"] })` → `select_features({ ids: [...] })`. -Both clips are scripted replays recorded on 2026-09-02 with Playwright's headless Chromium against a local production build of this repository — not a live model. The screenshot arm was allowed only what a generic computer-use agent has: a search box, clicks, keys, mouse wheel, screenshots. The WebMCP arm calls `document.modelContext.executeTool` through the page's own dev shim (`?shim=1`), because headless Chromium has no native WebMCP; the tool code and its output are identical to what Chrome's native surface exposes. The measured, live-model comparison is the table below. +Both clips are scripted replays in Playwright's headless Chromium, not a live model; the scripts that record them, and count every action, screenshot, call and byte in the captions, are in [`scripts/media/`](./scripts/media/). The screenshot agent gets only what a computer-use agent has — a search box, clicks, keys, the mouse wheel and screenshots. The WebMCP agent calls `document.modelContext.executeTool`, the same call a native agent makes, through the page's own `?shim=1` surface, since headless Chromium has no WebMCP of its own. -One run per arm per task, measured 2026-08-28 against that date's production build, before the page had a human search box (one response below has since grown a field); full method and every caveat: [`docs/comparison.md`](./docs/comparison.md). +Three other tasks, with a live model ([method and caveats](./docs/comparison.md)): | Task | Screenshot agent | WebMCP | |---|---|---| @@ -42,6 +42,8 @@ One run per arm per task, measured 2026-08-28 against that date's production bui - "How big is Daan Forest Park?" → `find_features` · `measure` - "What is the phone number and address of the post office nearest Daan Station?" → `find_features` · `get_place_details` +**ChatGPT desktop app:** with *Enable site tools* on, open its built-in browser on the live site and ask the same sentences — it finds the page's tools with no Chrome flag. + Or call the tools directly from DevTools: ```js @@ -56,10 +58,10 @@ const found = await document.modelContext.executeTool(byName.find_features, { JSON.parse(found); ``` -Any browser works with `?shim=1` appended to the URL: the shim installs `document.modelContext` only when no native implementation exists, and it is already on in development builds. +Any other browser works with `?shim=1` appended to the URL: the page installs `document.modelContext` itself when the browser has none. Development builds do this by default. ## Fifteen tools -Three layers, listed in that order: **Perceive** (read-only, replaces screenshots), **Navigate** (camera only) and **Act** (writes page state; only `plan_route` leaves the page). +Three layers, in that order: **Perceive** (read-only — replaces screenshots), **Navigate** (camera only) and **Act** (writes page state; only `plan_route` calls an external service). | Tool | What it does | |---|---| @@ -69,7 +71,7 @@ Three layers, listed in that order: **Perceive** (read-only, replaces screenshot | `describe_surroundings` | Describes what's around a point out loud: the district, then nearby features by compass direction. | | `measure` | Measures a drawing's or feature's area, perimeter or length. | | `compare_areas` | Compares two places' per-category counts and nearest match, in one call. | -| `get_place_details` | Returns everything known about one place: address, phone, website, hours, `wheelchair` (an OSM tag, not a verified accessibility claim). | +| `get_place_details` | Returns everything known about one place: address, phone, website, hours and `wheelchair`, as tagged in OpenStreetMap. | | `get_share_link` | Builds a URL that restores this exact map — camera, selection, drawings, notes — for whoever opens it. | | `set_map_view` | Moves the camera by place name, feature id, `fit` (frame a drawing or feature whole), or exact center/zoom/bearing/pitch. | | `select_features` | Highlights features on the map and in the inspector, by id or the same filter `find_features` accepts. | @@ -79,17 +81,15 @@ Three layers, listed in that order: **Perceive** (read-only, replaces screenshot | `remove_from_map` | Removes the agent's own drawings, notes or a selection entry; refuses to touch what a human drew. | | `add_note` (`