Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ JSON.parse(found);
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, in that order: **Perceive** (read-only — replaces screenshots), **Navigate** (camera only) and **Act** (writes page state; only `plan_route` calls an external service).
Three layers, in that order: **Perceive** (read-only — replaces screenshots), **Navigate** (camera only) and **Act** (writes page state; only routing calls an external service).

| Tool | What it does |
|---|---|
Expand Down Expand Up @@ -96,12 +96,14 @@ The map is shared state, not a private channel for the agent.
![The page as it opens: a plain map with no agent chrome — search box, Draw/Note/Share buttons, Places tray and a small "also readable by AI agents" hint.](docs/media/landing.jpg)

- The page opens as a plain map. The first live tool call wakes the inspector and activity feed into view, and a human can open or close that view by hand at any time (a share link that carries agent state opens with that view already up).
- Human draws, agent reads: a shape drawn by hand appears with `source: "user"` and is immediately queryable with `find_features({ within: "drawing:<n>" })`.
- Agent draws or annotates, human sees and edits: the shape or note renders at once with an "agent" or "user" provenance tag and a ✕ to remove it — no confirmation dialog on either side.
- **Two WebMCP APIs, one state.** The pin-note field is a plain `<form toolname="add_note">` — no JavaScript registration — and `SubmitEvent.agentInvoked` decides whether the note is stored as `agent` or `user`.
- **Who did what.** Every shape and note carries `source: "agent"` or `"user"` — the tag a human sees on the mark, and the same field an agent reads back from `get_map_state`. A shape drawn by hand appears with `source: "user"` and is immediately queryable with `find_features({ within: "drawing:<n>" })`; a shape or note an agent draws or annotates renders at once with its own tag and a ✕ to remove it — no confirmation dialog on either side. `remove_from_map` takes off only the marks tagged `agent`; a human's it refuses, by id, with the reason.
- **On the record — on screen.** Every tool call lands on the activity feed as a row — the tool, a one-line summary, success or error, when, and the ids it touched — the last 50 kept, its sequence number still counting past that. A human's own actions write no row: their trail is the tag on the mark, not a line in the feed.
- **Two WebMCP APIs, one state.** The pin-note field is a plain `<form toolname="add_note">` — no JavaScript registration — and `SubmitEvent.agentInvoked`, the browser's own signal rather than a guess the page makes, decides whether the note is stored as `agent` or `user`.
- A search box lets a human find a place, calling no tool; a Places tray loads any of 18 OpenStreetMap categories, up to 3 painted at once — a fourth tap evicts the oldest and says so.
- With the Note popover open, a click on the map places the pin there — a second click moves it, `Escape` cancels — and with no click, the note pins at the map centre.
- A Route pill: click a start and an end, and the same walking-route service `plan_route` uses draws the walk as a `source: "user"` line, labelled with its distance and time (`walking route · 3.8 km · 47 min`) — a mark `remove_from_map` refuses like any other of the human's.
- Every tool call plays a brief effect on the map, capped at 2 seconds — teal for the agent, rose for a human action. `?fx=off` turns it off, and it honours `prefers-reduced-motion`.
- The address bar holds a link that restores this exact map — camera, selection, drawings and notes — for whoever opens it.
- The address bar holds a link that restores this exact map — camera, selection, drawings and notes, each still tagged `agent` or `user` — for whoever opens it.

## Data
Six bundled Taipei datasets are always in memory — 109 MRT stations, 12 districts, 865 parks, 445 schools, 607 supermarkets and 25 sample listings (fictional, not from OSM) — 2,063 features total. 18 more OpenStreetMap point-of-interest categories (31,069 features) load lazily, one at a time, the moment a category is named; an answer that didn't search one lists it under `unsearched_categories`. Full provenance and tag mapping: [`public/data/README.md`](./public/data/README.md).
Expand All @@ -111,7 +113,7 @@ Six bundled Taipei datasets are always in memory — 109 MRT stations, 12 distri
- Code: [MIT](./LICENSE).

## How it is built
A single Next.js app on Vercel — **no backend, no database, no API keys, no login**. [MapLibre GL JS](https://maplibre.org/) renders [OpenFreeMap](https://openfreemap.org/) vector tiles; [Turf.js](https://turfjs.org/) runs every spatial query in the browser; [Zustand](https://zustand.docs.pmnd.rs/) holds map state. Tools in `src/lib/map-tools/` talk to the map only through a `MapToolStore` interface, so they are unit-tested against an in-memory store. `src/lib/webmcp/register.ts` registers on both `document.modelContext` and `navigator.modelContext`, cancellable via `AbortSignal`. The one external service is `plan_route`, which asks the keyless FOSSGIS OSRM instance for walking routes, throttled to its 1 request/second policy; when the service is unreachable the tool returns an error and leaves the map unchanged.
A single Next.js app on Vercel — **no backend, no database, no API keys, no login**. [MapLibre GL JS](https://maplibre.org/) renders [OpenFreeMap](https://openfreemap.org/) vector tiles; [Turf.js](https://turfjs.org/) runs every spatial query in the browser; [Zustand](https://zustand.docs.pmnd.rs/) holds map state. Tools in `src/lib/map-tools/` talk to the map only through a `MapToolStore` interface, so they are unit-tested against an in-memory store. `src/lib/webmcp/register.ts` registers on both `document.modelContext` and `navigator.modelContext`, cancellable via `AbortSignal`. The one external service is the keyless FOSSGIS OSRM instance that plans walking routes, asked by `plan_route` and by the human Route pill through one shared throttle that keeps its 1 request/second policy; when the service is unreachable the tool returns an error, the pill says so, and the map is left unchanged.

```bash
pnpm install
Expand All @@ -121,4 +123,4 @@ pnpm test:e2e # Playwright, via document.modelContext
pnpm build
```

CI runs `pnpm check`, `pnpm build` and `pnpm test:e2e` on every code PR: 1,436 unit tests across 60 files. Node 22. Branching, worktrees, commit and PR conventions: [CONTRIBUTING.md](./CONTRIBUTING.md).
CI runs `pnpm check`, `pnpm build` and `pnpm test:e2e` on every code PR: 1,461 unit tests across 63 files. Node 22. Branching, worktrees, commit and PR conventions: [CONTRIBUTING.md](./CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion docs/TASKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Deadline: 2026-09-03 13:00 PDT. Must-have tools: `get_map_state`, `list_features
| ID | Task | Owner | Status | Notes |
|---|---|---|---|---|
| T-105 | README shows the map before it explains it: 251 → 124 lines, describes only shipped behaviour; hero and landing images; two GIFs of the same ask card run by a screenshot agent and by a WebMCP agent; `docs/details.md` keeps the cut prose | docs-writer → review → docs-writer → review | done | Owner asked 2026-09-02 for: no unshipped work in the README, a 2–3 scenario comparison recording, images, and a condensed pitch judged adversarially. Two scenarios recorded (Playwright headless Chromium, scripted replays, WebMCP arm on `?shim=1`; the README says all of this); a third, human–agent collaboration, was not recorded — the "One map, two hands" section carries it in text. Recording the first arm surfaced T-104. Two review rounds: nine false or unsupported claims corrected before merge |
| T-111 | README says who did what: a "Who did what" passage in "One map, two hands" — provenance on every mark, visible to both sides; every tool call on the activity feed with its outcome and the ids it touched (the last 50, errors included); an agent cannot remove a human's mark; a share link keeps provenance — plus one bullet each for the two new human gestures (T-106 note placement, T-110 route). Owner asked 2026-09-02 for the separation of agent and human trails to be stated; wording stays at "a legible record", never audit/verify/tamper-proof, because the feed is session-only and capped | docs-writer → review | doing | Ships after T-110 so the README never describes an unshipped gesture |
| T-111 | README says who did what: a "Who did what" passage in "One map, two hands" — provenance on every mark, visible to both sides; every tool call on the activity feed with its outcome and the ids it touched (the last 50, errors included); an agent cannot remove a human's mark; a share link keeps provenance — plus one bullet each for the two new human gestures (T-106 note placement, T-110 route). Owner asked 2026-09-02 for the separation of agent and human trails to be stated; wording stays at "a legible record", never audit/verify/tamper-proof, because the feed is session-only and capped | docs-writer → review | done | Shipped after T-110 (#99) so the README never describes an unshipped gesture; also widened the two "only `plan_route` calls an external service" sentences to routing's two callers (T-110 review S1) and refreshed the test count |

## 2026-08-29 … 2026-09-02 · shipped rounds · all `done`; detail in [`docs/TASKS-archive.md`](./TASKS-archive.md)

Expand Down
Loading