URL and DOM: a place, and a place inside it

Status: 2026-11-27, v3. Step 1 implemented locally (not published): npm/src/place.ts (the place), npm/src/record.ts (the record in .me), entry this.url/place; tests in npm/tests/. Steps 2-4 not implemented. The four decisions are approved (§7); the URL ↔ me:// contract was corrected first (§1), as the review required.

The use case that sets the bar: I opened the German Shepherd article on Wikipedia, went to the 1990 section, highlighted three lines and tagged two friends. They have to land right there.

Two structures

  URL (this.url) DOM (this.DOM)
Shape a graph: pages and the links between them a tree: what is inside one page
A node a page an element, or a span of text inside it
Navigated by following links (the crawler discovers and indexes) going down branches (section, paragraph, line)
Joined each page has one DOM tree each DOM tree belongs to one page

Cleaker navigates and indexes both; .me keeps the references, the highlights and their audiences.

1. A URL, declared (this.url) — the contract

The structured place is the source of truth; href is its exact, reversible serialization.

place("https://es.wikipedia.org/wiki/Pastor_alemán?oldid=123#Historia") = {
  href:     "https://es.wikipedia.org/wiki/Pastor_alem%C3%A1n?oldid=123#Historia",  // exact; place(href).href === href (normalized by WHATWG URL)
  scheme:   "https",
  host:     "es.wikipedia.org",
  path:     ["wiki", "Pastor_alemán"],         // segments as an array: a "." or "/" inside a segment is never a separator
  query:    [["oldid", "123"]],                // CONTENT address (which revision). Not an NRP selector.
  fragment: "Historia",                        // the page's own fragment, kept as is
}

me:// addresses the RECORD, in the saver’s own tree — never the external host. (v3, replaces the v2 “alter ego”, which turned es.wikipedia.org into a namespace and lost information.)

me://suign.cleaker.me:read/web.pages.page_<32 hex>
        ↓ resolve (the normal NRP read: namespace, disclosure, audience)
{ type: "this.url", version: 1, href, scheme, host, pathname, search, hash }
        ↓ href
https://es.wikipedia.org/wiki/Pastor_alem%C3%A1n?oldid=123#Historia

What moves into this.url from where it lives today (cleaker and GUI then import it; behavior unchanged): cleaker surfaceOf/positionOf; GUI atParam, pagePlaceUrl, placeAfterHost, readArrivalPlace, takeArrival. The question this package owns: when are two places the same (/index.html vs /, a trailing slash, another revision of the same article).

The crawler stays, rebuilt for this: it reads a page’s links resolved against the page’s own URL (new URL(href, page); today /wiki/Algo gets http:// prepended, which is wrong) and returns places + edges. No log files, no media downloads, no shadowing of the global URL; it fetches only where allowed (a server, §5).

2. A place inside the page, declared (this.DOM)

anchor = {
  path: ["body", "#content", "#mw-content-text", "section[2]", "p[3]"],   // segments as an array, like the URL path
  text: { quote: "En 1990 era una de las razas…", prefix: "…", suffix: "…", start: 412, end: 530 }
}

3. The two together, in one address

The page’s own fragment and the DOM anchor are kept apart, so #Historia keeps its meaning. The boundary is the fragment directive delimiter browsers already reserve, :~: (what text fragments use):

https://es.wikipedia.org/wiki/Pastor_alem%C3%A1n?oldid=123#Historia:~:dom=…&text=…
\________________ place.href (exact, with its own #Historia) _______/\__ anchor ___/

A browser that supports fragment directives (the same ones that support text fragments, §4) strips everything from :~: out of location.hash, so the page sees only #Historia; an older one passes #Historia:~:dom=… to the page, which then finds no element with that id and stays at the top. this.url/this.DOM read the directive either way. In the structured form they are simply two fields: { place, anchor }.

4. The invite lands inside the DOM

The card (“Someone shared a place with you”) resolves the shared reference to { place, anchor }, keeps the original address, and offers two ways in:

  1. Go there (the site itself): place.href + a text fragment built from the anchor (#Historia:~:text=En%201990-,era%20una,populares). The browser scrolls to those lines and highlights them (Chrome/Edge, Safari 16.1+, Firefox 131+); where unsupported it still lands on #Historia. A site we do not run cannot be told more than that.
  2. Open in .me (inside the graph): the page is read on the server (§5), parsed by this.DOM, shown as nodes of the .me graph, the anchored span marked and focused.

5. Rendering inside the .me graph

GUI already draws .me as a graph (the LLMS graph: {nodes: [{path, value}], edges}), so URL and DOM become .me paths and the same renderer draws them. Two capabilities, each with its own test: drawing the nodes, and resolving a node back to its exact place/element (a node’s identity is {place, anchor}, not its label).

web.pages.<id>                         <- a page (its this.url record)
web.<…>.links -> …                     <- edges to other pages (crawler)
web.<…>.dom.<anchor path>              <- inside it (this.DOM), the highlight focused

Reading a foreign page needs a server fetch (browsers block cross-site reads). That fetch is a request the server makes on someone’s behalf, so it gets the guard the monad already applies to the mesh bridge: public http(s) only, never loopback/private/metadata addresses, size and time limits, no cookies.

6. Private places: sealed for their audience (implemented locally, this.url/sealed)

The monad answers a read public (everyone) or closed (everyone, the owner too): its “opened with key material” disclosure is not implemented (pathResolver.ts). A .me audience is not a list checked at the door: it is the set of keys that can decrypt. So a private place is sealed on the client (this.me sealAudience, exported for this) and stored as an opaque envelope; resolving its me:// returns the envelope to anyone, and only a member’s key opens it.

The highlight follows the same shape: highlights.<id> sealed for [author, ana, pablo], holding { place, anchor, quote, by, at }.

7. Decisions (approved 2026-11-27)

  1. Path segments are arrays, kept raw. (v3: no longer serialized into a me:// path at all; the record’s address uses our own keys, §1.)
  2. # / :~:: the page’s own fragment and the DOM anchor are kept separately (§3).
  3. The crawler’s index lives in the tree of whoever starts the indexing, private by default. A namespace can keep a shared index only by an explicit operation, with its audience declared. Visiting a URL never publishes browsing history.
  4. ?at= for a highlight is a pointer by default: the author’s namespace + highlights.<id>. Resolving it respects the audience; knowing the link grants nothing. The full anchor in the link is an explicit option for public content only, because a quote in a link travels outside the tree’s restrictions.

Order of work

  1. this.url: place(), the record in .me (random id, dedup index, checked reads), this.url/place, resolution proven through me:// (done locally); the place code from cleaker/GUI copied with parity tests (they switch to importing this.url once it is published); still open: the crawler with relative links resolved.
  2. this.DOM: path as segments + reversible serialization + resolve(); the text anchor + re-anchoring; tested on real pages.
  3. The invite: resolve the pointer (audience-checked), Go there with a text fragment; then Open in .me.
  4. The server fetch with its guard; drawing and resolving in the graph; the highlight record.

See also