Public
a timeline of date markets on manifold.markets
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

WHEN — A Timeline of the Future

A vertical timeline of the future built from Manifold Markets DATE-market forecasts. Live at https://when.val.run.

Architecture

Rendering mermaid diagram...
  • build.ts (cron, every 6 hours) — fetches all Manifold DATE markets, computes probability-weighted expected dates, converts questions to statements, adds emojis, and stores the result in blob key when-timeline-v1. Answer fetches run with concurrency 15; external API calls (statement conversion, emojis) are capped per run and fall back gracefully — caches fill up across runs.
  • logic.ts — the build pipeline: getExpectedDate handles both bucket-style and cumulative threshold-style markets; convertQuestionInternally handles common "When will X…?" phrasings via regex before falling back to an external LLM conversion API.
  • cache.ts — SQLite (per-val DB) caches for question→statement conversions and statement→emojis.
  • index.ts — HTTP val. Serves the React client, /api/timeline-events (cached JSON from blob, instant), and /source.
  • styles.ts — CSS exported as a string.
  • moi.md / images.md — build.moi directory metadata.

Why the cron?

The timeline build takes ~90s (400+ markets, one answers request each, plus external APIs) — far past the HTTP request time limit. Previously the build ran per-request over SSE and got killed mid-stream. Now the HTTP endpoint just reads the pre-built blob.

External dependencies

  • Manifold API (/v0/search-markets?contractType=DATE, /v0/market/:id/answers)
  • texttoemojis.val.run — emoji tagging (dcm31's val)
  • Question→statement conversion API (dcm31's val)

Manual rebuild

Run build.ts from the Val Town UI, or call buildAndStore() from a script.