aien-sovereign-core
Autonomous sovereign intelligence engine and runtime core for NVIDIA DGX Spark
Brought by drakestapleton
aien-sovereign-core / crates / spark-cockpit-rs / static / sw.js
| 1 | const CACHE_NAME = "aien-cockpit-v1"; |
| 2 | const ASSETS = [ |
| 3 | "/", |
| 4 | "/manifest.json", |
| 5 | "/icon-192.png", |
| 6 | "/icon-512.png" |
| 7 | ]; |
| 8 | |
| 9 | self.addEventListener("install", (e) => { |
| 10 | e.waitUntil( |
| 11 | caches.open(CACHE_NAME).then((cache) => cache.addAll(ASSETS)) |
| 12 | ); |
| 13 | self.skipWaiting(); |
| 14 | }); |
| 15 | |
| 16 | self.addEventListener("activate", (e) => { |
| 17 | e.waitUntil(self.clients.claim()); |
| 18 | }); |
| 19 | |
| 20 | self.addEventListener("fetch", (e) => { |
| 21 | // Pass dynamic API and stream calls directly through |
| 22 | if (e.request.url.includes("/api/")) { |
| 23 | return; |
| 24 | } |
| 25 | e.respondWith( |
| 26 | caches.match(e.request).then((res) => res || fetch(e.request)) |
| 27 | ); |
| 28 | }); |