Repository navigation
Releases
Releases · anymirror-dev/anymirror
v0.7.0
v0.7.0 — anymirror
- 📦 Readers on their own.
@anymirror/coreholds the readers without the map adapters, one entry point per kind of content, so a page bundles only what it reads: 4.4 KB gzipped for a raw file, 6.8 KB for a bundle, 8.5 KB for a ranged file. - 🧭 A router contract.
@anymirror/routeris the router contract as types alone;@anymirror/fisl-routernow depends on it alone and works with any reader. - 🔌 Hints as a plugin. Hints documents are a client option, off unless a page passes
hints(); veritiles keeps them on, and its API is unchanged. - 🏠 A new home. The repository is
anymirror-dev/anymirror, and the packer isanymirror-pack.
Detailed changes
Added
- @anymirror/core: the readers on their own, without the map adapters, each behind its own entry point:
@anymirror/core/file(VerifiedFile, one large file by byte ranges),@anymirror/core/raw(VerifiedRaw, one small file),@anymirror/core/bundle(VerifiedBundle, a MASL bundle) and@anymirror/core/hints(hints()). A page carries only the reader it uses: gzipped, a raw file costs 4.4 KB, a bundle 6.8 KB and a ranged file 8.5 KB, where every page carried 8.4 to 9.2 KB before.assetKind(cid)says which reader an asset anchor needs. - @anymirror/router: the router contract (
Router,FetchContext,Verdict,RouterOption), types alone. It changes only with the contract, so a router depends on nothing else and keeps working across releases. - @anymirror/fisl-router joins the repository and the version line. It depends on the contract alone, no longer on veritiles, so any anymirror reader takes it as its
router; its behavior is unchanged.
Changed
- Hints as a plugin (
SPEC.md§5): hints documents and discovery are a client option, off in anymirror's readers unless a page passeshints(). veritiles keeps them on by default. - veritiles is built on
@anymirror/coreand pins it at the same version. Its API and behavior are unchanged; the map bundle grows by 0.5 KB gzipped (11.7 to 12.2 KB) for the seams between the readers. - The repository is now
anymirror-dev/anymirror, and the spec is the anymirror spec. The packer isanymirror-pack, installed withcargo install --path packer; the TypeScript packer stays in the repository, for the tests.
Fixed
- The MapLibre examples (
packages/veritiles/examples/maplibre.html,hints.html,assets.html) and the README's MapLibre snippet import MapLibre GL's ES module. MapLibre 6 ships nomaplibre-gl.js, so they stopped at a 404 before drawing a tile. They now pin MapLibre GL 6.16.0 and PMTiles 4.5.0. - The OpenLayers example pins OpenLayers 9.2.4: ol-pmtiles 2.0.2's browser bundle throws on the first tile with OpenLayers 10, so the example drew nothing.
Notes
- No format changes: anchors, proofs and bundles packed for 0.6 read as before.
Full Changelog: v0.6.1...v0.7.0
v0.6.1
v0.6.1 — Verified sprites
- 🖼️ Verified sprites.
assetProtocolanswers MapLibre's JSON requests with parsed JSON, so a sprite sheet served from a verified bundle loads its icons.
Detailed changes
Fixed
assetProtocolanswers each request in the form MapLibre asks for: ajsonrequest, such as a sprite index or a style, with the parsed value, astringrequest with the text, any other with the bytes. MapLibre parses nothing a protocol returns, so a sprite sheet in a verified bundle ("sprite": "verified://<anchor>/sprite", as in the README) loaded no icons.
Full Changelog: v0.6.0...v0.6.1
v0.6.0
v0.6.0 — Routers
- 🧭 Routers. A
routeroption onVerifiedSource,VerifiedFileandVerifiedAssetfinds a CID's hosts at runtime, from a content-routing index, a gateway or a table, so a page can ship only its anchor: every byte still verifies against it. - 📡 Routers learn. A router can also carry the requests: it gets each one's verdict,
verified,rejected,failedorunused, and so learns which hosts serve, how fast, and which lie. - 🔁 Smarter failover. A location that fails now moves behind the ones that have not failed until it serves again, and one that serves wrong bytes stays banned for the whole session, for that CID only.
- ⚡ No wait for hints. A page that configures its locations and names a
hintsdocument sends its first requests at once, and fetches the document in the background. - 📦 Bare manifests.
pack assetsalso writes a bundle's manifest block beside its CAR (bundle.car→bundle.masl), the file a router names for a bundle; clients accept it wherever they read a bundle proof.
Detailed changes
Added
- Routers (
SPEC.md§6): every location now comes from a router. The built-in one followssource,proofandhintsas before; arouteroption onVerifiedSource,VerifiedFileandVerifiedAssetreplaces it with your own — a content-routing index, a gateway, a table — so a page can ship only its anchor and find hosts at runtime. A router'slocate(cid, { defaults })yields the URLs of a CID's bytes, best first, and gets the built-in router's locations asdefaults, so its yield order is its strategy: the page's own hosts first, its own first, or whichever answer first. The client reads the stream lazily, taking the next location only when the ones it holds have failed, and asks again once all have. A located URL is where the CID's own bytes are, the rule of FISL: for a ranged file's anchor that is{proof}/root, and the client reads the proof tree beside it. A router may also carry the requests (fetch): each comes with the CID, the location, the client's own fetch, and a verdict —verified,rejected,failedorunused— so a router learns which hosts serve, how fast, and which lie, and can add credentials. Routers are as untrusted as hints documents: every byte still verifies against the anchor. The README shows a router over a FISL index in a few lines. pack assetsalso writes the manifest block alone beside the CAR (bundle.car→bundle.masl): the anchor's own bytes, the file a router names for a bundle. Clients accept a bare manifest block wherever they read a bundle proof: a body that hashes to the anchor is the block, anything else is read as a CAR.
Changed
- A failing location is demoted. A location that fails in transport — a network error, a non-2xx status, a
200to aRangerequest, a missing proof file — now moves behind the ones that have not failed until it serves again, instead of being tried first on every read; a fetch asks the router for a fresh location before going back to it, and gives up after 16 failed locations. A location that serves wrong bytes is still banned, now for the client's whole session (a failed open no longer forgets it), and only for the CID it got wrong: for any other it is demoted. - Explicit hints documents no longer hold up the open. A page that configures its locations and names a
hintsdocument sendsroot, the first proof piece and the first read's range at once, and fetches the document in the background; its URLs still back up the configured ones. - A bundle file that fails verification at a configured base bans that file's URL, not the whole base: the base still serves the bundle's other files.
- The router specification lands in
SPEC.mdas §6 Routers; the previous §6–§9 (Hosts, Publishing, IPFS interoperability, Non-goals) are renumbered §7–§10.
Fixed
- A response body that arrives in one piece is copied before it is verified: a
fetchFn(or a router'sfetch) that reuses its buffers can no longer change bytes after they verified. - A read whose signal aborts stops waiting for a file's open or a bundle's manifest; the open goes on for other reads.
Full Changelog: v0.5.0...v0.6.0
v0.5.0
v0.5.0 — Planet scale
- ⚡ Faster first paint. The client fetches the descriptor, the first proof shard and the first read in one round trip: a cold view of the Protomaps planet shows its first tile in 301–366 ms instead of 764–1,350 ms (plain PMTiles: 201–266 ms; 50 ms RTT, 20 Mbit/s).
- 📦 Smaller downloads. PMTiles packs pick a 16–64 KiB tile group per archive instead of 1 MiB, so a cold view downloads 21% more than plain PMTiles instead of 323% more.
- 🎬 Verified video. The new
mp4profile gives each fragment its own leaf: a YouTube-style stream starts in 247 ms instead of 947 ms (unverified: 265 ms). - 🦀 Rust packer. Packs files of any size, such as the 130 GiB planet, with output byte-identical to the TS packer.
⚠️ Breaking. A descriptor'smapis now the file's BLAKE3 CID: re-pack v0.4 data before moving a page toveritiles@0.5(v0.4 clients cannot read v0.5 packs).
Detailed changes
Added
- Rust packer (
packer/,npm run pack:rs -- …): a port of the repository packer for files the TS packer cannot hold in memory (~2 GiB and up, such as a planet-scale PMTiles). It memory-maps the input, hashes in parallel, and writes the same bytes astools/pack.ts— anchor, proof files, CARs, stdout and stderr — enforced by a differential test (test/pack-diff.test.ts). Local files only; itsverifychecks every byte. Seepacker/README.md. npm run test:diffruns that differential test;npm testno longer does. CI builds the binary and fails, rather than skips, without it.mp4packer profile.--profile autopacks a fragmented MP4 (anftypbox first, then a top-levelmoof) with one leaf per fragment: itsmoofandmdats, with anystyp,emsgorprftboxes that open it. The init section and any boxes after the lastmdat(anmfra) get a leaf each. A player that reads each fragment at the range itssidxlists, as Media Source Extensions players do, downloads exactly that fragment in one round trip instead of the whole 1 MiB leaves around it. Verified playback then keeps pace with an unverified player: a YouTube-style source (video and audio tracks) starts in 247 ms instead of 947 ms at 50 ms RTT and 20 Mbit/s (unverified: 265 ms), downloading 0.49 MB instead of 2.23 MB, and seeks in 453 ms instead of 892 ms (unverified: 451 ms). Audio-only.m4afiles qualify; a regular MP4 still packs asfixed, and--profile mp4forces the profile. Once a file is taken as fragmented MP4, a malformed box, such as a truncated download, fails the pack.
Changed
- Breaking: a descriptor's
mapis the file's raw BLAKE3 CID (BDASL,bafkr4i…) instead of its sha2-256 CID. No client computesmap— it names the file, for content hints — so the packers no longer run the one step that could not be parallelized: a single SHA-256 stream over the whole file. The Rust packer packs a file in memory 2–3.5× faster, and a file larger than RAM is now bound by the disk rather than the hash. Clients reject a sha2-256map, so v0.4 packs must be re-packed, and v0.4 clients reject v0.5 packs. Every hash a client checks — anchors, proof files, leaves, assets — stays sha2-256 (WebCrypto). Hints documents accept raw BLAKE3 CIDs as keys. The TS packer computes BLAKE3 with thehash-wasmdev dependency. - Faster first paint. The client requests the descriptor, the first proof shard (
0) and the first read's range in one round trip, each still verified before use, and requests the proof shards covering a read (after any directory metas) before that read's speculative tile data, so a shard never waits behind tile bytes. With the new tile-group default below, a cold view of the Protomaps planet shows its first tile in 301–366 ms instead of 764–1,350 ms at 50 ms RTT and 20 Mbit/s (plain PMTiles: 201–266 ms); on a terrain archive shaped like Mapterhorn's planet (331 GiB, z0–z12), a cold z12 view in 358 ms instead of 1,081 ms (plain: 228 ms). - PMTiles packs choose their tile group from the archive. Without
--tile-group, the packers use the smallest of 16, 32 and 64 KiB whose shards all fit in the descriptor's top meta, else 64 KiB, so every zoom band is listed there directly whenever the archive allows it. The old 1 MiB default made a reader fetch a whole 1 MiB group around each tile: the Protomaps planet now gets 64 KiB, and a cold view downloads 21% more than plain PMTiles instead of 323% more. The budget used, chosen or explicit, is printed on stderr after theproofs:line (tile group: 65536 bytes). An explicit--tile-group N(including0) is unchanged. - Fragmented MP4s packed with
--profile autonow get themp4profile and new anchors;--chunkon such a file needs--profile fixed. - A zoom band too large for the top meta splits into small subdirectories of at most 399 shards each (child metas of at most 16 KiB), each listed in the top meta, their sizes differing by at most one shard: the first view into such a band waits on one small meta instead of a meta of up to 256 KiB. Only when the top meta has no room for them does the band become one nested subdirectory, as before.
- Packer CLI is strict: unknown flags, flags without a value, extra arguments, an unknown
--profile,--profile pmtileson a non-PMTiles file (previously a silent fixed pack),--chunkwith the pmtiles profile,--tile-groupwith the fixed profile, and--outor--full-carnaming the input file are errors instead of being ignored. The packer also refuses an--outdirectory that contains the input (--out contains the input file) and a--full-carwhose<path>.tmpis the input. - PMTiles directories and metadata may decompress to at most 256 MiB each (larger blocks fail as
PMTiles <codec> decompression failed), and an archive may list at most 2^30 tile entries (PMTiles has more than 2^30 tile entries), so a small hostile archive cannot exhaust memory. - A zstd-compressed PMTiles directory or metadata block must be exactly one complete zstd frame: a truncated frame, a second or skippable frame, or trailing bytes now fail as
PMTiles zstd decompression failed. Node 22 ignored truncation and anything after the first frame, while Node 24 rejects truncation, so the TS packer accepted different archives depending on the Node version. One zstd compression call writes one frame, so ordinary archives are unaffected. - The top meta keeps one slot per remaining zoom band when inlining a band, so archives such as one band of 1,598 shards followed by a small band now pack (the large band moves into subdirectories) instead of failing with
top meta needs … entries. --full-car: the<path>.tmpfile is opened before the proof files are written; an open failure is still reported after them. Any later failure removes<path>.tmpbefore the error is reported.- The packer also refuses an existing output that is the input file itself, reached through a symlink or a hard link (compared by device and inode): a proof file (
--out contains the input file) or<full-car>.tmp(--full-car resolves to the input file). Nothing is written in that case, only the proof directories. pack verifyreads proof files on demand instead of loading the whole--proofsdirectory, so unrelated entries (such as a dangling symlink) no longer fail it.- PMTiles inputs must have tile lengths ≤ 0xffffffff and safe-integer tile ids. Decompression and metadata JSON failures report fixed messages (
PMTiles gzip decompression failed,PMTiles metadata is not valid JSON, …) instead of library text. --full-carwrites blocks in canonical DAG post-order (children left to right, then the parent; each block once), replacing the importer's internal put order. Only files over 174 chunks (> 43.5 MiB) get different CAR bytes; the DAG, its root CID andipfs dag importresults are unchanged. The CAR is written to<path>.tmpand renamed when complete.- The proof directory's
rootis written last, so a presentrootmeans every file it names exists. pack verifyprintsverify OK, drops--reads(fixed at 64 spot reads), and rejects a file whose length differs from the descriptor'smapSize; a trailing byte previously passed.
Fixed
- PMTiles archives whose metadata or leaf directories come after the tile data — the layout of the Protomaps planet builds — failed to pack with
tile leaf at … matches no tile group. Those sections now form a last band of their own. Archives that packed before are unaffected. - The TS packer failed with a stack overflow (
Maximum call stack size exceeded) on a PMTiles leaf directory of more than ~125,000 entries. pack assetsinlined every file up to the 8 MiB CAR section cap, so a typical directory's "proof" carried a complete second copy of the content (a 6.2 MB glyph directory emitted a 6.28 MB CAR for a 32 KB manifest), defeating lazy verification. Inlining is now all-or-nothing under a fixed 256 KiB budget: a directory whose files total at most 256 KiB travels whole in the CAR — one fetch serves the bundle — and anything larger emits the manifest alone, so clients fetch content from{base}/{path}as specified. Anchors are unaffected: the anchor hashes the manifest block alone, so existing published anchors stay valid and only the bag shrinks.examples/assets.htmlpinned a pre-MASL dag-pb fonts anchor thatparseAssetAnchorrejects, so the example failed against its own library. The fixture is regenerated with the shippedpackAssets(the generator previously used a test helper), andnpm testnow runsexamples/build-assets.ts, whose drift guard keeps page and fixture in sync.pack assetswrote one CAR section per file, so identical files produced duplicate sections and the client rejected the bundle. Each distinct block is now written once, and the 256 KiB inline budget counts unique bytes.pack assetstook the extension from the whole path, so ...
v0.4.0
v0.4.0 — Routing hints
Routing hints separate where from what: an untrusted hints.json beside the page (or beside the data) maps CIDs to candidate locations, so hosts can move — or pages can ship anchor-only — without touching a verified byte. The layer is fully optional: a configured client never fetches a hint, wrong hints waste a request at worst, and every byte still verifies against the anchor.
Added
- Routing hints (
SPEC.md§5): an untrustedhints.jsonmaps CIDs to candidate locations, so a page can ship only its anchor and keep host locations in a sibling file that changes on its own cadence. Every byte fetched through a hint is still verified against the anchor exactly as a configured URL is. One new option onVerifiedSource/VerifiedFile/VerifiedAsset:hints(string | string[]) — document URL(s), defaulting to./hints.jsonbeside the page, fetched lazily only when a location is missing. Relative URLs inside a document resolve against the document's own URL — the final URL after redirects — so a copied or redirected hints file is correct on any mirror. Document bodies are bounded to a fixed 1 MiB pre-parse. - Tolerant hints parser: salvages every valid entry and ignores malformed keys, values, and URLs individually; only a non-object body or the size cap rejects a whole document.
- In-directory discovery: the directory holding published artifacts — a proof base, a bundle base, or the directory containing a proof CAR or content file — may publish
hints.json, probed only when a location class is missing (location → document → location, bounded by a 16-document-per-client cap). examples/hints.html— an anchor-only page backed by a siblinghints.json.
Changed
sourceis now optional onVerifiedFile/VerifiedAsset: a hints document may supply the location. Every location option (source,proof,hints) is optional; a fully configured client fetches zero hint documents.- A query-string source no longer requires an explicit
proofwhen an explicit hints document supplies the proof location; the defaulted document never lifts that requirement. - Hints faults are transport-level — they never increment
rejectedand never ban a source; a hinted URL, once merged, is an ordinary source under the existing failover, ban, and speculative-range rules. - The routing-hints specification lands in
SPEC.mdas §5 Routing hints; the previous §5–§8 (Hosts, Publishing, IPFS interoperability, Non-goals) are renumbered §6–§9.
Notes
- No breaking changes: the descriptor, shard-tree, and MASL formats are unchanged, and every existing API keeps its signature and behavior.
Full Changelog: v0.3.1...v0.4.0
v0.3.1
Highlights
- Optional UnixFS/IPFS bridge for
VerifiedFile— pack with--unixfsto embed a standard, reproducible UnixFS root CID (the same layoutipfs add --cid-version 1produces) in the descriptor alongside the existing raw map CID. Combine with--full-car <path>to emit a complete, pinnable CAR of that UnixFS DAG foripfs dag import/ pinning services. This does not change the map CID or the proof tree — it's purely additive. SPEC.mdsignificantly condensed and reorganized — rewritten as a tighter, more DASL/MASL-aligned specification (CIDs restricted to DASL-style raw/dag-cbor, clearer separation of ranged-file vs. asset proof systems, streamlined client-behavior and host-contract sections). No behavioral changes to the existing formats — only the CARv1 framing/section-caps wording and structure were clarified.VerifiedAssetdocs correction — the options list in the README now accurately reflects the shipped API (dropped a straycheckProofCompletenessmention that doesn't exist onVerifiedAsset).- Docs:
README.mdupdated with--unixfs/--full-car/pack assetsusage examples and clarified that the packer is a repository dev tool (clone +npm ci), not part of the published npm package. - Version bump only —
package.json/package-lock.jsonto 0.3.1.
Full Changelog: v0.3.0...v0.3.1
v0.3.0
Highlights
- New
VerifiedFileclient — a general-purpose range-verified file reader (not just PMTiles).VerifiedSourceis now a thin pmtiles adapter over it. - New proof format for range reads — replaces the old CARv1-based map package format with a
dag-cbordescriptor ({proof}/root) plus a tree of binary meta/shard files. The anchor CID codec changes fromdag-pbtodag-cbor, and the oldmetadata.jsonbootstrap manifest is gone entirely. VerifiedSource/VerifiedFileAPI change:rootCid→cid, andsourcenow points directly at the file itself rather than a package directory; proofs default to{source}.proofsinstead of a siblingproofs/directory.VerifiedAssetproof format overhaul (MASL) — the old strict-CARv1/UnixFS DAG-walking proof is replaced with adag-cbormanifest bundle (raw content CIDs + a MASL-style resources map), read as an untrusted "bag of blocks" and verified lazily on first use rather than via a whole-body proof hash.- New
npm run packCLI (tools/pack.ts) — generates the descriptor + proof tree for a file (fixedandpmtilespublisher profiles, with zoom-shaped proof trees for PMTiles archives), plus apack assetssubcommand for MASL bundles. VerifiedAsset.stat()— new method returning{ size, contentType? }for a manifest entry.- Docs:
SPEC.mdfully rewritten around the new descriptor/shard-tree and MASL-CAR proof systems;README.mdupdated with new API examples and host requirements. - Examples and fixtures updated to the new anchor/CID scheme (
MAP_ANCHORinstead ofMAP_ROOT, etc.) — the previously hosted demo package is noted as incompatible with the new format until republished. - Bumped
maplibre-glexample dependency to 6.2.0; added@ipld/dag-cboras a dev dependency.
Breaking changes
VerifiedSource/VerifiedFileanchor CID codec changed (dag-pb→dag-cbor); old map packages and their root CIDs are incompatible.VerifiedAssetDAG/CARv1 proof anchor codec (car) is retired; new anchors userawordag-cbor(MASL manifest).rootCidoption renamed tocidacross the public API.source/proofsemantics changed:sourcenow targets the file directly, not a package base directory.
Full Changelog: v0.2.0...v0.3.0
v0.2.0
Highlights
- Verified whole-file assets — support for verifying single-file downloads (not just PMTiles byte ranges), with new examples added to demonstrate usage.
- Unified
SPEC.md— consolidated the verification spec into a single document for easier reference. - Docs: examples now load
veritilesfrom the CDN by default, making it easier to try out without a local build.
Full Changelog: https://github.com/guillaumemichel/veritiles/commits/v0.2.0