Offline support (chaipat.cc)
The offline support of chaipat.cc is a service worker in sw.js. Deterministic entity/resource lookup and local graph/wiki answers run in the browser, so caching the page, its complete module dependencies and the knowledge graph keeps those paths working without a connection. Optional model augmentation still needs the network.
- Pages, the graph and the wiki are fetched from the network first, so updates arrive at once, with the cached copy used when offline or slow.
- Scripts and styles are also network first, so a new page never runs with old scripts after a deploy.
- Every wiki article is cached once the service worker is active, so any wiki page reads in full offline.
- API requests for model augmentation, logging, votes and mail need the network and are never cached. Typing a question can still use the local answer path while offline; opening an external product or repository requires access to that site.
The offline shell includes src/resources.js as well as the graph files, ontology and data/wiki/search.json. The graph supplies the authoritative runtime catalog, while the search snapshot preserves article passages and generated entity metadata. Adding a startup import requires both adding it to the precache list and bumping the service-worker cache version, so an existing installation installs the new dependency and retires its old cache. The graph and index use network-first requests with cached fallback, including when opened through a previously unvisited wiki route.