@wildshard/engine 0.1.17 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/budgets/shard-size-baseline.json +10 -4
  3. package/index.html +6 -4
  4. package/lint/engine-sides.json +21 -0
  5. package/lint/host-callback-syntax.mjs +2 -1
  6. package/lint/host-callbacks.mjs +3 -3
  7. package/lint/host-files.mjs +5 -4
  8. package/lint/no-base64.mjs +3 -1
  9. package/lint/ratchet.json +0 -68
  10. package/lint/ratchet.mjs +1 -4
  11. package/lint/shard-imports.mjs +6 -7
  12. package/lint/shard-source.d.mts +9 -0
  13. package/lint/shard-source.mjs +91 -0
  14. package/lint/shardfile-boundaries.mjs +10 -8
  15. package/lint/sim-closure.mjs +6 -3
  16. package/lint/wildshard-plugin.d.ts +4 -0
  17. package/lint/wildshard-plugin.js +22 -23
  18. package/package.json +25 -16
  19. package/scripts/agent-sync.mjs +27 -8
  20. package/scripts/app-build/appCook.ts +8 -2
  21. package/scripts/app-build/catalogue.ts +10 -7
  22. package/scripts/app-build/gen.ts +22 -2
  23. package/scripts/app-build/isolation.d.mts +10 -0
  24. package/scripts/app-build/isolation.mjs +47 -0
  25. package/scripts/app-build/outputProducts.d.mts +3 -0
  26. package/scripts/app-build/outputProducts.mjs +35 -0
  27. package/scripts/app-build/previousDeploy.d.mts +2 -0
  28. package/scripts/app-build/previousDeploy.mjs +10 -1
  29. package/scripts/app-build/serviceWorker.ts +10 -3
  30. package/scripts/app-build/splitOutput.mjs +4 -2
  31. package/scripts/app-build/standaloneOutput.d.mts +1 -1
  32. package/scripts/app-build/standaloneOutput.mjs +5 -3
  33. package/scripts/app-build/titlePreloads.d.mts +8 -0
  34. package/scripts/app-build/titlePreloads.mjs +69 -0
  35. package/scripts/app-build/worldMapAtlas.ts +10 -6
  36. package/scripts/app-build-pipeline.mjs +34 -3
  37. package/scripts/built-product.mjs +1 -1
  38. package/scripts/cell-mem-bench.mjs +81 -23
  39. package/scripts/check-custom-sections-zero.mjs +1 -1
  40. package/scripts/check-devserver.mjs +3 -1
  41. package/scripts/check-models.mjs +2 -0
  42. package/scripts/check-paths.allow.json +0 -115
  43. package/scripts/check-paths.mjs +2 -2
  44. package/scripts/check-platform-ratchets.mjs +2 -3
  45. package/scripts/chromium-keychain-check.mjs +4 -2
  46. package/scripts/chromium-keychain.d.mts +1 -1
  47. package/scripts/chromium-keychain.mjs +3 -1
  48. package/scripts/ci-static.sh +1 -1
  49. package/scripts/committed-fast-checks.mjs +0 -2
  50. package/scripts/content-sw-proof.mjs +2 -1
  51. package/scripts/cook-worker.mjs +9 -3
  52. package/scripts/cook.mjs +20 -3
  53. package/scripts/devices.d.mts +4 -0
  54. package/scripts/devices.mjs +39 -0
  55. package/scripts/devserver-client.d.mts +4 -2
  56. package/scripts/devserver-client.mjs +25 -8
  57. package/scripts/docs-inputs-proof.mjs +6 -6
  58. package/scripts/doctor-proof.mjs +1 -1
  59. package/scripts/e2e-faults.mjs +159 -0
  60. package/scripts/e7-voice-staging-proof.mjs +1 -1
  61. package/scripts/gate-related-tests.mjs +1 -1
  62. package/scripts/git-source-view.mjs +1 -1
  63. package/scripts/goldens/capture.mjs +17 -5
  64. package/scripts/grid-crossing-nightly.mjs +59 -0
  65. package/scripts/grid-crossing-qa.mjs +44 -0
  66. package/scripts/grid-crossing-ratchet.d.mts +6 -0
  67. package/scripts/grid-crossing-ratchet.mjs +52 -0
  68. package/scripts/grid-crossing-report.mjs +122 -0
  69. package/scripts/grid-crossing-stages.mjs +47 -0
  70. package/scripts/grid-crossing-tour.mjs +277 -0
  71. package/scripts/grid-crossing-walk-proof.mjs +136 -18
  72. package/scripts/host-ruler/roots.mjs +2 -2
  73. package/scripts/host-ruler.d.mts +91 -0
  74. package/scripts/host-ruler.mjs +565 -0
  75. package/scripts/live-prepush.py +3 -5
  76. package/scripts/loading-flow/benchmax.mjs +3 -1
  77. package/scripts/look-loop/test_look_loop.py +1 -38
  78. package/scripts/memory-proof.mjs +213 -0
  79. package/scripts/mmo-bots.mjs +8 -2
  80. package/scripts/net-lag-proof.mjs +219 -0
  81. package/scripts/night-market-kit-budget.mjs +2 -2
  82. package/scripts/offline-proof-rules.d.mts +5 -3
  83. package/scripts/offline-proof-rules.mjs +34 -7
  84. package/scripts/offline-proof.mjs +88 -18
  85. package/scripts/{shard-platform-output.mjs → output-reader.mjs} +1 -1
  86. package/scripts/page-release/content.d.mts +9 -1
  87. package/scripts/page-release/content.mjs +131 -17
  88. package/scripts/page-release/flow.mjs +36 -10
  89. package/scripts/page-release/stamp-content.mjs +24 -0
  90. package/scripts/page-release.mjs +28 -6
  91. package/scripts/page-size.mjs +2 -1
  92. package/scripts/pin-packs.ts +1 -1
  93. package/scripts/pins.ts +4 -4
  94. package/scripts/precommit-checks.mjs +1 -7
  95. package/scripts/precommit-jobs.mjs +0 -1
  96. package/scripts/precommit-source.py +1 -9
  97. package/scripts/program-discovery.mjs +1 -1
  98. package/scripts/ring-cook.mjs +2 -1
  99. package/scripts/ring-step.ts +1 -1
  100. package/scripts/script-scenario-metrics.mjs +1 -1
  101. package/scripts/shard-output-content.d.mts +1 -1
  102. package/scripts/shard-output-content.mjs +2 -2
  103. package/scripts/shard-outputs.mjs +1 -1
  104. package/scripts/shard-public.mjs +1 -1
  105. package/scripts/shard-wire-meter.mjs +24 -9
  106. package/scripts/side-parity.mjs +4 -2
  107. package/scripts/standalone-smoke.mjs +8 -3
  108. package/scripts/tier-textures-proof.mjs +101 -0
  109. package/scripts/tier-textures.mjs +78 -0
  110. package/scripts/tile-bake-report.mjs +1 -1
  111. package/scripts/tile-bakes.mjs +1 -1
  112. package/scripts/title-assets.generated.json +2 -0
  113. package/scripts/tsconfig.json +1 -2
  114. package/scripts/vendor/basisu/LICENSE +201 -0
  115. package/scripts/vendor/basisu/basis_encoder.cjs +2 -0
  116. package/scripts/vendor/basisu/basis_encoder.wasm +0 -0
  117. package/scripts/vitest-push-guards.config.ts +1 -1
  118. package/scripts/vps/harden-apply.sh +4 -1
  119. package/scripts/vps/harden-prometheus.sh +176 -0
  120. package/scripts/vps/harden.sh +16 -0
  121. package/scripts/vps/rebuild.sh +18 -0
  122. package/scripts/vps/wildshard-config +84 -24
  123. package/scripts/worker-client-play.mjs +7 -2
  124. package/scripts/worker-client-proof.mjs +1 -1
  125. package/scripts/worker-client-slug.mjs +44 -0
  126. package/scripts/worktree-reap.mjs +5 -5
  127. package/src/.oxlintrc.json +3 -182
  128. package/src/client/app/entry.ts +47 -12
  129. package/src/client/engine/boot/bootCache.ts +2 -2
  130. package/src/client/engine/boot/bootTrace.ts +12 -4
  131. package/src/client/engine/boot/browserChunkRecovery.ts +4 -0
  132. package/src/client/engine/boot/clearDownloads.ts +5 -2
  133. package/src/client/engine/boot/contentRead.ts +11 -0
  134. package/src/client/engine/boot/gpuFiles.ts +4 -2
  135. package/src/client/engine/boot/lastEnd.ts +99 -12
  136. package/src/client/engine/boot/parsedPages.ts +127 -58
  137. package/src/client/engine/boot/texturePack.ts +2 -2
  138. package/src/client/engine/build.d.ts +2 -0
  139. package/src/client/engine/core/Game.ts +18 -0
  140. package/src/client/engine/core/bootstrap.ts +4 -1
  141. package/src/client/engine/debug/probe.ts +18 -1
  142. package/src/client/engine/fx/LightPool.ts +41 -1
  143. package/src/client/engine/net/netPlayer.ts +19 -2
  144. package/src/client/engine/net/otherPlayers.ts +55 -8
  145. package/src/client/engine/net/predictor.ts +33 -9
  146. package/src/client/engine/net/redial.ts +29 -6
  147. package/src/client/engine/pwa/cacheNames.ts +58 -1
  148. package/src/client/engine/pwa/sw.js +53 -14
  149. package/src/client/engine/render/dataLook.ts +152 -40
  150. package/src/client/engine/render/families/detail.ts +89 -0
  151. package/src/client/engine/render/families/pbr.ts +7 -1
  152. package/src/client/engine/render/look.ts +6 -0
  153. package/src/client/engine/render/lookLight.ts +103 -11
  154. package/src/client/engine/render/lookRender.ts +105 -0
  155. package/src/client/engine/render/precompile.ts +20 -14
  156. package/src/client/engine/saves/indexed.ts +2 -2
  157. package/src/client/engine/telemetry/browserErrors.ts +28 -4
  158. package/src/client/engine/telemetry/deviceSnapshot.ts +155 -0
  159. package/src/client/engine/telemetry/staleBuildReport.ts +22 -1
  160. package/src/client/engine/ui/debugOptions.ts +1 -1
  161. package/src/client/engine/ui/lookLightOption.ts +10 -6
  162. package/src/client/engine/ui/namePrompt.ts +7 -0
  163. package/src/client/game/boot/audio.generated.ts +114 -216
  164. package/src/client/game/boot/bytes.generated.ts +118 -238
  165. package/src/client/game/boot/placedSpawn.ts +35 -0
  166. package/src/client/game/boot/spawnDownload.ts +25 -6
  167. package/src/client/game/boot/versions.generated.ts +7 -7
  168. package/src/client/game/devScene/hook.ts +291 -0
  169. package/src/client/game/grid/area.ts +38 -0
  170. package/src/client/game/grid/cellLoading.ts +12 -2
  171. package/src/client/game/grid/live.ts +134 -12
  172. package/src/client/game/grid/liveSession.ts +47 -5
  173. package/src/client/game/grid/mapAtlas.ts +18 -4
  174. package/src/client/game/grid/menu.ts +4 -0
  175. package/src/client/game/grid/minimapBlend.ts +15 -5
  176. package/src/client/game/grid/neighbourPanels.ts +10 -1
  177. package/src/client/game/grid/oneWayIn.ts +5 -1
  178. package/src/client/game/grid/placedCards.ts +55 -0
  179. package/src/client/game/grid/placedCells.ts +233 -0
  180. package/src/client/game/grid/placedContent.ts +85 -0
  181. package/src/client/game/grid/prefetch.ts +9 -1
  182. package/src/client/game/grid/productInputs.ts +3 -1
  183. package/src/client/game/grid/productLeases.ts +4 -1
  184. package/src/client/game/grid/products.ts +8 -4
  185. package/src/client/game/grid/regionalRuntime.ts +6 -0
  186. package/src/client/game/grid/regionalWorld.ts +15 -2
  187. package/src/client/game/grid/roadCull.ts +44 -14
  188. package/src/client/game/grid/roadLook.ts +24 -15
  189. package/src/client/game/grid/roadLookPlatform.ts +4 -2
  190. package/src/client/game/grid/roadResources.ts +24 -0
  191. package/src/client/game/grid/roadSign.worker.ts +4 -3
  192. package/src/client/game/grid/roadSignPaint.ts +16 -5
  193. package/src/client/game/grid/roadSignPreparation.ts +4 -3
  194. package/src/client/game/grid/roadSignScale.ts +8 -0
  195. package/src/client/game/grid/roadTileBacking.ts +13 -3
  196. package/src/client/game/grid/roadTileCapture.worker.ts +3 -1
  197. package/src/client/game/grid/roadTileCaptureWorker.ts +2 -1
  198. package/src/client/game/grid/roadTileWrite.worker.ts +4 -2
  199. package/src/client/game/grid/roadTileWriter.ts +2 -1
  200. package/src/client/game/grid/screenReports.ts +39 -0
  201. package/src/client/game/grid/session.ts +29 -4
  202. package/src/client/game/grid/shardfileFar.ts +9 -3
  203. package/src/client/game/grid/softWallLook.ts +25 -8
  204. package/src/client/game/mainMenu.ts +6 -2
  205. package/src/client/game/plugin/context.ts +2 -1
  206. package/src/client/game/plugin/followedMovers.ts +7 -1
  207. package/src/client/game/quest/figures.ts +2 -0
  208. package/src/client/game/session/finish.ts +11 -1
  209. package/src/client/game/shard/titleList.ts +6 -2
  210. package/src/client/game/shardfile/assetCache.ts +4 -4
  211. package/src/client/game/shardfile/client.ts +4 -1
  212. package/src/client/game/shardfile/clientAssets.ts +9 -5
  213. package/src/client/game/shardfile/clientLibrary.ts +1 -1
  214. package/src/client/game/shardfile/clientWater.ts +51 -9
  215. package/src/client/game/shardfile/clientWorker.ts +21 -8
  216. package/src/client/game/shardfile/look.ts +8 -3
  217. package/src/client/game/shardfile/product.ts +34 -7
  218. package/src/client/game/shardfile/productChecks.ts +2 -2
  219. package/src/client/game/shardfile/productCost.ts +2 -2
  220. package/src/client/game/shardfile/readAsset.ts +2 -2
  221. package/src/client/game/shardfile/reflectingWater.ts +73 -0
  222. package/src/client/game/shardfile/seatGrace.ts +9 -0
  223. package/src/client/game/shardfile/skinPlayback.ts +1 -1
  224. package/src/client/game/systems/npc/figureRows.ts +9 -0
  225. package/src/client/game/titleDeck.ts +4 -3
  226. package/src/client/host/online/doctor.ts +2 -0
  227. package/src/client/host/online/linkScreens.ts +30 -4
  228. package/src/client/host/online/shell.ts +14 -0
  229. package/src/client/host/standalone/shell.ts +4 -0
  230. package/src/cook/game/astc6Encode.ts +55 -0
  231. package/src/cook/game/astc6Wasm.ts +176 -0
  232. package/src/cook/game/cookJob.ts +30 -6
  233. package/src/cook/game/cookWorker.ts +38 -11
  234. package/src/cook/game/entryTotals.ts +51 -24
  235. package/src/cook/game/shardCook.ts +67 -9
  236. package/src/cook/game/spawnParts.ts +33 -8
  237. package/src/cook/game/tierTextures.ts +349 -0
  238. package/src/e2e/smoke/game.ts +19 -14
  239. package/src/e2e/smoke/page-globals.d.ts +9 -8
  240. package/src/e2e/smoke/template2.spec.ts +8 -7
  241. package/src/server/engine/ai/bossContenders.ts +27 -3
  242. package/src/server/engine/ai/phases.ts +1 -1
  243. package/src/server/engine/entities/creatureRefill.ts +9 -2
  244. package/src/server/engine/net/ledgerBook.ts +2 -0
  245. package/src/server/engine/net/room.ts +15 -0
  246. package/src/server/engine/sim/respawn.ts +8 -0
  247. package/src/server/game/boss/arenaRoomEntry.ts +5 -1
  248. package/src/server/game/boss/arenaRoomNative.ts +2 -0
  249. package/src/server/game/boss/native.ts +2 -1
  250. package/src/server/game/boss/nativeWake.ts +9 -5
  251. package/src/server/game/boss/openArenaNative.ts +2 -2
  252. package/src/server/game/boss/openArenaRoom.ts +3 -1
  253. package/src/server/game/grid/room.ts +44 -3
  254. package/src/server/game/grid/simulation.ts +23 -0
  255. package/src/server/game/population/mixedRoster.ts +11 -3
  256. package/src/server/game/population/nativeBake.ts +8 -3
  257. package/src/server/game/population/nativeReturns.ts +6 -3
  258. package/src/server/game/population/roster.ts +5 -3
  259. package/src/server/game/quest/eliteDrops.ts +15 -4
  260. package/src/server/game/quest/nativeChapter.ts +1 -1
  261. package/src/server/game/quest/nativeComposition.ts +5 -1
  262. package/src/server/game/riding/nativeTaming.ts +10 -6
  263. package/src/server/game/riding/wildRefill.ts +3 -2
  264. package/src/server/game/shardfile/bossRow.ts +4 -2
  265. package/src/server/game/shardfile/homeKeeper.ts +4 -2
  266. package/src/server/host/bake/headlessWorker.ts +1 -1
  267. package/src/server/host/dedicated/cellHost.ts +98 -16
  268. package/src/server/host/dedicated/cellProtocol.ts +16 -1
  269. package/src/server/host/dedicated/cellWorker.ts +8 -5
  270. package/src/server/host/dedicated/dedicatedRoom.ts +16 -6
  271. package/src/server/host/dedicated/gridCells.ts +15 -6
  272. package/src/server/host/dedicated/loopLag.ts +21 -0
  273. package/src/server/host/dedicated/main.ts +13 -5
  274. package/src/server/host/dedicated/packReader.ts +3 -3
  275. package/src/server/host/dedicated/placementFile.ts +4 -19
  276. package/src/server/host/dedicated/roadRoom.ts +34 -4
  277. package/src/server/host/dedicated/serverMetrics.ts +126 -0
  278. package/src/server/host/dedicated/socketPump.ts +21 -4
  279. package/src/server/host/dedicated/socketTransport.ts +2 -1
  280. package/src/server/host/dedicated/workerTable.ts +15 -4
  281. package/src/server/host/dedicated/world.ts +95 -8
  282. package/src/server/host/headless.ts +1 -1
  283. package/src/server/host/headlessRuntime.ts +1 -1
  284. package/src/server/host/standalone/roadWorld.ts +15 -3
  285. package/src/server/host/standalone/serverHost.ts +4 -1
  286. package/src/server/host/standalone/serverProduct.ts +41 -11
  287. package/src/shared/engine/ai/BossBrain.ts +8 -0
  288. package/src/shared/engine/net/deviceWord.ts +138 -0
  289. package/src/shared/engine/net/socketFrames.ts +7 -4
  290. package/src/shared/game/boss/wake.ts +6 -0
  291. package/src/shared/game/devColliders.ts +47 -0
  292. package/src/shared/game/eliteSystem.ts +8 -0
  293. package/src/shared/game/grid/allocator.ts +3 -0
  294. package/src/shared/game/grid/catalogueSlot.ts +7 -0
  295. package/src/shared/game/grid/placementRows.ts +36 -0
  296. package/src/shared/game/plugin/bossRecord.ts +3 -2
  297. package/src/shared/game/shardfile/ktx2Targets.ts +23 -3
  298. package/src/shared/game/shardfile/outputDescriptor.ts +9 -5
  299. package/src/shared/game/shardfile/packReads.ts +28 -3
  300. package/src/shared/game/shardfile/serverPack.ts +9 -0
  301. package/src/shared/game/systems/looks/trampleField.ts +2 -0
  302. package/src/shared/host/formatJsonSchema.ts +2 -2
  303. package/src/tsconfig.json +1 -27
  304. package/lint/host-reviews.json +0 -14
  305. package/lint/listed-view-code.json +0 -13
  306. package/lint/platform-pending-users.json +0 -2520
  307. package/lint/platform-pending-users.md +0 -18
  308. package/scripts/cell-mem/metrics-preload.mjs +0 -65
  309. package/scripts/check-closed-components.d.mts +0 -7
  310. package/scripts/check-closed-components.mjs +0 -87
  311. package/scripts/g571-hosts.d.mts +0 -3
  312. package/scripts/g571-hosts.mjs +0 -54
  313. package/scripts/host-ruler/register-migrate.mjs +0 -242
  314. package/scripts/listed-view-code.d.mts +0 -7
  315. package/scripts/listed-view-code.mjs +0 -93
  316. package/scripts/look-loop/fit-lut.py +0 -142
  317. package/scripts/look-loop/palette-delta.py +0 -183
  318. package/scripts/look-loop/regions/driftwood-isle.json +0 -25
  319. package/scripts/look-loop/regions/far-reach.json +0 -225
  320. package/scripts/look-loop/regions/open-plot-night-market.json +0 -855
  321. package/scripts/look-loop/regions/pine-hollow.json +0 -22
  322. package/scripts/look-loop/regions/sunscar-dunes.json +0 -281
  323. package/scripts/platform-chargebacks.d.mts +0 -9
  324. package/scripts/platform-chargebacks.mjs +0 -135
  325. package/scripts/shard-component-spans.d.mts +0 -15
  326. package/scripts/shard-component-spans.mjs +0 -18
  327. package/scripts/shard-components.d.mts +0 -16
  328. package/scripts/shard-components.mjs +0 -363
  329. package/scripts/shard-platform-hosts.d.mts +0 -2
  330. package/scripts/shard-platform-hosts.mjs +0 -93
  331. package/scripts/shard-platform-sections.d.mts +0 -2
  332. package/scripts/shard-platform-sections.mjs +0 -9
  333. package/scripts/shard-platform.d.mts +0 -76
  334. package/scripts/shard-platform.mjs +0 -1072
  335. package/src/.oxfmtrc.json +0 -48
  336. package/src/scripts/ask-new.sh +0 -29
  337. package/src/scripts/asks.mjs +0 -142
  338. package/src/scripts/herdr-prompt.sh +0 -34
  339. package/src/scripts/herdr-question-open.sh +0 -67
  340. package/src/scripts/md-wrap.mjs +0 -229
  341. /package/scripts/{shard-platform-format.d.mts → node-format.d.mts} +0 -0
  342. /package/scripts/{shard-platform-format.mjs → node-format.mjs} +0 -0
  343. /package/scripts/{shard-platform-output.d.mts → output-reader.d.mts} +0 -0
@@ -30,8 +30,20 @@ export const PREDICTION_SNAP = 3;
30
30
  const RIDE_ROOM = 64;
31
31
  /** One saved move. */
32
32
  const SAVED_WORDS: number = MOTION_WORDS + RIDE_ROOM;
33
- /** Seconds the camera takes to lose about two thirds of a correction. */
34
- const SMOOTH_TIME = 0.1;
33
+ /**
34
+ * NET-LAG NL12 (b): a correction glides at a steady pace over a time scaled to its size, never as a step. At 150 to 200 ms
35
+ * (J282) corrections are routine, and an exponential glide moved the drawn feet most in its first frame: a third of a 0.3 m
36
+ * correction in one 30 fps frame. Metres a second the glide adds on top of the feet's own motion, under half a walk.
37
+ */
38
+ export const GLIDE_SPEED = 2;
39
+ /** The shortest glide: 4 frames at 30 fps, 8 at 60. */
40
+ export const GLIDE_MIN_S: number = 4 / 30;
41
+ /** The longest: a correction near the snap distance still settles within half a second. */
42
+ export const GLIDE_MAX_S = 0.5;
43
+ /** The pace that glides `distance` away: its own size over GLIDE_SPEED, held between the shortest and longest glide. */
44
+ function glidePace(distance: number): number {
45
+ return distance / Math.min(GLIDE_MAX_S, Math.max(GLIDE_MIN_S, distance / GLIDE_SPEED));
46
+ }
35
47
 
36
48
  /** What a predictor drives. */
37
49
  export interface PredictedBody {
@@ -105,6 +117,8 @@ export class Predictor {
105
117
  private resets: number | null = null;
106
118
  /** The newest frame has this body on a ride. */
107
119
  private aboard = false;
120
+ /** Metres a second the render offset loses now (NL12 b). */
121
+ private glide = 0;
108
122
  constructor(body: PredictedBody, columns: readonly NetColumn<never>[], corrected?: (row:Omit<NetCorrection,'kind'|'session'>)=>void) {
109
123
  this.corrected=corrected;
110
124
  this.body = body; this.columns = columns; this.table = ownerTable(columns);
@@ -154,6 +168,8 @@ export class Predictor {
154
168
  const saved = offset >= 0 && offset < count, slot = (head + offset) % PREDICTION_RING, at = slot * SAVED_WORDS; // else older than the ring, or nothing saved
155
169
  if (saved) { this.head = (slot + 1) % PREDICTION_RING; this.count = count - offset - 1; }
156
170
  if (!forced && (!saved || this.matches(slot, owner, ridden))) return false;
171
+ // NL12 (c): the write below can take feet under a deck only if the server's world lacks the deck; NL5 gave the room the same
172
+ // rope planks (`server/host/ropeDecks.ts`), and `test/net-predict-deck.test.ts` replays a correction 0.3 to 1 m low back onto them
157
173
  const s = body.motionState, { ride } = body, feet = ride?.feet ?? s.position, x = feet.x + body.renderOffset.x, y = feet.y + body.renderOffset.y, z = feet.z + body.renderOffset.z, { yaw } = s;
158
174
  if (saved) restoreMotion(s, body.motor, states, at);
159
175
  if (saved && this.rode[slot] === 1) ride?.restore(states, at + MOTION_WORDS);
@@ -169,13 +185,14 @@ export class Predictor {
169
185
  if (!led && !boarded) this.corrections++;
170
186
  const offsetX = x - feet.x, offsetY = y - feet.y, offsetZ = z - feet.z, far = offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ > PREDICTION_SNAP * PREDICTION_SNAP;
171
187
  body.renderOffset.set(far ? 0 : offsetX, far ? 0 : offsetY, far ? 0 : offsetZ);
188
+ this.glide = glidePace(body.renderOffset.length());
172
189
  if(!led&&!boarded)this.corrected?.({tick:tick??s.tick,mode:ride!==null?'ride':s.board.on?'board':s.swim.on?'swim':'foot',offset:Math.hypot(offsetX,offsetY,offsetZ),snapped:far});
173
190
  return !led && !boarded;
174
191
  }
175
192
 
176
193
  /** A session's first frame: this body stands where the server says, with nothing to compare it to. */
177
- adopt(lastSeq: number, owner: ArrayLike<number>, tick?: number, ridden: ArrayLike<number> | null = null): void {
178
- const { body, table } = this, s = body.motionState, { yaw } = s;
194
+ adopt(lastSeq: number, owner: ArrayLike<number>, tick?: number, ridden: ArrayLike<number> | null = null, glide = false): void {
195
+ const { body, table } = this, s = body.motionState, { yaw } = s, was = { x: s.position.x, y: s.position.y, z: s.position.z };
179
196
  if (tick !== undefined) s.tick = tick;
180
197
  this.acked = lastSeq; this.led = this.flag(table.led, owner) === 1; this.resets = this.value(table.resets, owner); this.aboard = ridden !== null;
181
198
  this.head = 0; this.count = 0;
@@ -185,14 +202,21 @@ export class Predictor {
185
202
  this.write(s, owner); // the reset cleared the ground the owner block had just landed
186
203
  if (ridden !== null) body.ride?.adopt(ridden);
187
204
  body.renderOffset.set(0, 0, 0);
205
+ // OFFLINE OF10: a page that played unseated glides onto its seat when it is near, as a correction does; a far seat snaps
206
+ if (glide) {
207
+ const dx = was.x - s.position.x, dy = was.y - s.position.y, dz = was.z - s.position.z;
208
+ if (Math.hypot(dx, dy, dz) < PREDICTION_SNAP) body.renderOffset.set(dx, dy, dz);
209
+ }
210
+ this.glide = glidePace(body.renderOffset.length());
188
211
  }
189
212
 
190
- /** Each render frame: the camera glides back onto the predicted feet. */
213
+ /** Each render frame: the camera glides back onto the predicted feet at the correction's steady pace (NL12 b). */
191
214
  update(dt: number): void {
192
- const { renderOffset } = this.body;
193
- if (renderOffset.x === 0 && renderOffset.y === 0 && renderOffset.z === 0) return;
194
- renderOffset.multiplyScalar(Math.exp(-dt / SMOOTH_TIME));
195
- if (renderOffset.lengthSq() < 1e-8) renderOffset.set(0, 0, 0);
215
+ const { renderOffset } = this.body, left = renderOffset.length();
216
+ if (left === 0) return;
217
+ const step = (this.glide > 0 ? this.glide : glidePace(left)) * dt;
218
+ if (step >= left || left - step < 1e-4) renderOffset.set(0, 0, 0);
219
+ else renderOffset.multiplyScalar((left - step) / left);
196
220
  }
197
221
 
198
222
  private matches(slot: number, owner: ArrayLike<number>, ridden: ArrayLike<number> | null): boolean {
@@ -8,8 +8,8 @@ import type { NetClient } from './client';
8
8
  export type LinkState = 'live' | 'reconnecting' | 'resuming' | 'lost' | 'full' | 'ended';
9
9
  /** Why a link is down, as far as a browser can tell (meta MMO-FAILURE-MODES-PLAN FM4): `silent` stopped carrying frames (a half-open
10
10
  * socket), `closed` was closed with no word (1006, a reset), `restart` was closed by a restarting server, `hidden` went quiet while the
11
- * page was out of view. It rides `onState`'s reason for `reconnecting` and `resuming`. */
12
- export type LinkCause = 'silent' | 'closed' | 'restart' | 'hidden' | 'updating';
11
+ * page was out of view, `offline` is a device that says it has no network (FM4b mode 2). It rides `onState`'s reason for `reconnecting` and `resuming`. */
12
+ export type LinkCause = 'silent' | 'closed' | 'restart' | 'hidden' | 'updating' | 'offline';
13
13
  /** Where the dial is, for a screen that shows it: dials so far, the wait to the next (null while one is out), and how long it's been down. */
14
14
  export interface LinkProgress { readonly dials: number; readonly nextDialMs: number | null; readonly downMs: number }
15
15
 
@@ -51,7 +51,10 @@ export interface RedialOptions {
51
51
  readonly onCut?: (reason: string) => void;
52
52
  readonly now?: () => number;
53
53
  readonly random?: () => number;
54
+ /** FM4b mode 2: does the device say it has a network? Default `navigator.onLine`; a browser with no answer counts as online. */
55
+ readonly online?: () => boolean;
54
56
  }
57
+ const browserOnline = (): boolean => typeof navigator === 'undefined' || (navigator as { onLine?: boolean }).onLine !== false;
55
58
 
56
59
  /**
57
60
  * E7.1: one client's link, kept up. It watches for frames, and a link that stops carrying them is closed and dialled again on a
@@ -62,6 +65,7 @@ export class Redial {
62
65
  private readonly scope = new Scope('net.redial');
63
66
  private readonly now: () => number;
64
67
  private readonly random: () => number;
68
+ private readonly online: () => boolean;
65
69
  private readonly offFrame: () => void;
66
70
  private transport: Transport;
67
71
  private offClose: () => void;
@@ -75,8 +79,10 @@ export class Redial {
75
79
  private dialled: number | null = null;
76
80
  private waitingForSeat = false;
77
81
  private cause: LinkCause = 'closed';
82
+ /** When the device last said it went offline while the link was down; null while it has a network. */
83
+ private offlineAt: number | null = null;
78
84
  constructor(options: RedialOptions) {
79
- this.options = options; this.transport = options.transport; this.now = options.now ?? diagnosticNow; this.random = options.random ?? jitterFrom(this.now());
85
+ this.options = options; this.transport = options.transport; this.now = options.now ?? diagnosticNow; this.random = options.random ?? jitterFrom(this.now()); this.online = options.online ?? browserOnline;
80
86
  this.offFrame = options.client.onFrame(() => { this.heard(); });
81
87
  this.offClose = this.watchClose(options.transport);
82
88
  this.scope.interval(WATCH_MS, () => { this.watch(); });
@@ -112,7 +118,7 @@ export class Redial {
112
118
  private heard(): void {
113
119
  const now = this.now(), wasDown = this.phase === 'down';
114
120
  this.heardAt = now;
115
- if (wasDown) { this.phase = 'up'; this.dialled = null; this.dials = 0; this.waitingForSeat = false; }
121
+ if (wasDown) { this.phase = 'up'; this.dialled = null; this.dials = 0; this.waitingForSeat = false; this.offlineAt = null; }
116
122
  this.show('live');
117
123
  }
118
124
  private watch(): void {
@@ -120,18 +126,35 @@ export class Redial {
120
126
  if (this.phase === 'up') {
121
127
  if (this.heardAt === null) return;
122
128
  const silent = now - this.heardAt;
123
- if (silent >= STRIP_MS && this.state === 'live') this.because('silent');
129
+ if (silent >= STRIP_MS && this.state === 'live') this.because(this.online() ? 'silent' : 'offline');
124
130
  if (silent >= DROP_MS) this.lose(now); else if (silent >= STRIP_MS) this.show('reconnecting');
125
131
  } else if (this.phase === 'down') this.redial(now);
126
132
  }
127
133
  private redial(now: number): void {
128
134
  if (this.waitingForSeat) { if (this.dialled === null && now >= this.dialAt) this.dial(now); else if (this.dialled !== null && now - this.dialled >= DROP_MS) { this.failedDial(now); this.drop(); } return; }
135
+ if (this.offline(now)) { if (this.dialled !== null && now - this.dialled >= DROP_MS) { this.failedDial(now); this.drop(); } return; }
129
136
  const out = now - this.lostAt;
130
137
  if (out >= GIVE_UP_MS) { this.stop(); this.show('lost'); return; }
131
138
  if (out >= RESUMING_MS) this.show('resuming');
132
139
  if (this.dialled !== null) { if (now - this.dialled >= DROP_MS) { this.failedDial(now); this.drop(); } return; }
133
140
  if (now >= this.dialAt) this.dial(now);
134
141
  }
142
+ /**
143
+ * FM4b mode 2: a device with no network is not dialled (each dial would only fail) and its give-up clock stands still, so a
144
+ * phone in a tunnel never reaches `lost` while it waits; the world's own hold on the seat (J114) is the server's and goes on.
145
+ * The network back: the clock goes on from where it stopped and the dial goes out at once. True while offline.
146
+ */
147
+ private offline(now: number): boolean {
148
+ if (!this.online()) {
149
+ this.offlineAt ??= now;
150
+ this.because('offline');
151
+ return true;
152
+ }
153
+ if (this.offlineAt === null) return false;
154
+ this.lostAt += now - this.offlineAt; this.offlineAt = null; this.dialAt = now;
155
+ this.because('closed');
156
+ return false;
157
+ }
135
158
  private dial(now: number): void {
136
159
  const transport = this.options.dial();
137
160
  this.offClose(); this.transport = transport; this.dialled = now; this.dials++;
@@ -154,7 +177,7 @@ export class Redial {
154
177
  if (reason === 'retry' || cut) this.because('updating');
155
178
  if (cut) this.options.onCut?.(reason);
156
179
  if (reason === 'full') { this.phase = 'down'; this.waitingForSeat = true; this.dialled = null; this.dialAt = now + FULL_RETRY_MS; this.show('full'); return; }
157
- if (this.phase === 'up') { if (this.cause !== 'updating') this.because(reason === 'restart' ? 'restart' : 'closed'); this.lose(now, false); }
180
+ if (this.phase === 'up') { if (this.cause !== 'updating') this.because(reason === 'restart' ? 'restart' : this.online() ? 'closed' : 'offline'); this.lose(now, false); }
158
181
  else if (this.phase === 'down') { if (reason === 'restart') this.because('restart'); this.failedDial(now); }
159
182
  }
160
183
  /** The link is gone or no use: from now it is dialled, and a player's 35 s count from the last frame. */
@@ -1,2 +1,59 @@
1
- /** MF1/MF4: immutable code, content and versioned metadata, keyed by exact absolute URL. */
1
+ /** MF1/MF4: immutable code, content and versioned metadata, keyed by exact absolute URL. Production's name; the other
2
+ * channels' names carry the channel (`cacheName`). */
2
3
  export const ASSET_CACHE_NAME = 'ws-assets-v1';
4
+
5
+ /** OFFLINE OF12 (J298, Jake 2026-11-12: "The preview build should have a different cache"): every Cache Storage name a
6
+ * build writes carries its channel, so preview and staging on one origin (a local proof, any later shared host) keep
7
+ * disjoint caches and neither's activate deletes the other's. One bundle serves every channel and the deploy stamps
8
+ * `__WS_WORLD__` into the document, so the channel is read at run time, as `homeIconChannel` (app-build/homeIcons.mjs)
9
+ * reads it: no world is preview, a world whose release file is production's is production, any other world is staging.
10
+ * Production keeps the names it always had (renaming them would cold-start every player's cache); preview and staging
11
+ * put the channel after `ws-` (`ws-preview-assets-v1`, `ws-staging-shell-v3-<build>`), so production's prefix tests
12
+ * (`ws-shell-`) never match another channel's caches. */
13
+ export type CacheChannel = 'production' | 'staging' | 'preview';
14
+ export const CACHE_CHANNELS: readonly CacheChannel[] = ['production', 'staging', 'preview'];
15
+
16
+ /** The channel of a build stamp (`__WS_WORLD__`, or undefined on a build with no world). */
17
+ export function cacheChannel(world: unknown): CacheChannel {
18
+ if (typeof world !== 'object' || world === null) return 'preview';
19
+ const release: unknown = Reflect.get(world, 'release');
20
+ return typeof release === 'string' && /\/releases\/production\.json(?:[?#]|$)/u.test(release) ? 'production' : 'staging';
21
+ }
22
+
23
+ /** One cache name for a channel: production's as given; another channel's with the channel after `ws-`. */
24
+ export function cacheName(base: string, channel: CacheChannel): string {
25
+ if (channel === 'production') return base;
26
+ return base.startsWith('ws-') ? `ws-${channel}-${base.slice(3)}` : `${base}-${channel}`;
27
+ }
28
+
29
+ /** Whether a Cache Storage name is this channel's own (production's are the `ws-` names no other channel prefixes). */
30
+ export function ownsCache(name: string, channel: CacheChannel): boolean {
31
+ if (channel !== 'production') return name.startsWith(`ws-${channel}-`);
32
+ return name.startsWith('ws-') && !CACHE_CHANNELS.some(other => other !== 'production' && name.startsWith(`ws-${other}-`));
33
+ }
34
+
35
+ /** A dedicated worker has no document stamp: the page that starts it hands it the channel (`setCacheChannel`). */
36
+ let given: CacheChannel | undefined;
37
+ export function setCacheChannel(channel: unknown): void {
38
+ if (typeof channel === 'string' && (CACHE_CHANNELS as readonly string[]).includes(channel)) given = channel as CacheChannel;
39
+ }
40
+
41
+ /** This page's (or this worker's, once told) channel. */
42
+ export function pageCacheChannel(): CacheChannel {
43
+ return given ?? cacheChannel((globalThis as { __WS_WORLD__?: unknown }).__WS_WORLD__);
44
+ }
45
+
46
+ /** The cross-build asset cache of this page's channel. */
47
+ export function assetCacheName(): string { return cacheName(ASSET_CACHE_NAME, pageCacheChannel()); }
48
+
49
+ /** A production worker opens this empty cache, so another channel's worker on the same origin can tell production's
50
+ * caches (kept) from its own channel's from before OF12, which used production's names (deleted once, see `isForeign`). */
51
+ export const PRODUCTION_MARK = 'ws-production-mark';
52
+
53
+ /** Whether a cache belongs to another channel that is on this origin, which this channel must never delete. Production's
54
+ * names are another channel's only where a production worker has run (`productionHere`, its mark); elsewhere they are
55
+ * this origin's own caches from before the channel names, a one-time cold start's leftovers. */
56
+ export function isForeign(name: string, channel: CacheChannel, productionHere: boolean): boolean {
57
+ if (ownsCache(name, channel) || !name.startsWith('ws-')) return false;
58
+ return channel === 'production' || !ownsCache(name, 'production') || productionHere;
59
+ }
@@ -1,16 +1,38 @@
1
1
  import { workerScope } from '../app/workerScope.js';
2
2
  import { diagnosticNow } from '../../../shared/engine/core/clock';
3
+ import { cacheChannel, cacheName, ownsCache, PRODUCTION_MARK } from './cacheNames';
3
4
  /* MF1: one URL cache, one build shell, and one previous generation of code.
4
5
  * No fetched-body reconstruction, checksums, receipts, packs, retries or work timers. */
5
6
  const BUILD = '__BUILD_ID__';
6
7
  const DOCUMENT = '__DOCUMENT__';
7
- const ASSETS = '__ASSET_CACHE__';
8
- const BOOKS = 'ws-builds-v1';
9
- const SHELL_PREFIX = 'ws-shell-v3-';
10
- const SHELL = `${SHELL_PREFIX}${BUILD}`;
8
+ // PZ12 (J274): the page origin's COOP and COEP for the baked document (empty on a channel that is not isolated)
9
+ const DOCUMENT_HEADERS = (baked => baked.startsWith('{') ? JSON.parse(baked) : {})('__DOCUMENT_HEADERS__');
10
+ const ISOLATED = Object.keys(DOCUMENT_HEADERS).length > 0;
11
+ /** PZ12: a dedicated worker in an isolated page starts only if its own script carries COEP. A worker chunk whose name did
12
+ * not change across the switch is held here (or in the HTTP cache) with the headers it was first fetched with, so on an
13
+ * isolated channel every worker script this worker answers wears the document's headers. */
14
+ async function isolatedWorkerScript(pending) {
15
+ const response = await pending;
16
+ if (response.type === 'opaque' || response.type === 'opaqueredirect') return response;
17
+ const headers = new Headers(response.headers);
18
+ for (const [name, value] of Object.entries(DOCUMENT_HEADERS)) headers.set(name, value);
19
+ return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
20
+ }
21
+ const answer = (event, request, pending) => { event.respondWith(ISOLATED && request.destination === 'worker' ? isolatedWorkerScript(pending) : pending); };
11
22
  /** OFFLINE OF5 (J298): a world build (its document stamped with `__WS_WORLD__`; play, staging) never runs the in-page solo
12
23
  * server, so it never precaches the solo server's code or its server book. Read at run time: a deploy stamps the document. */
13
24
  const WORLD = /\bglobalThis\.__WS_WORLD__=/u.test(DOCUMENT);
25
+ /** OFFLINE OF12: every cache this worker opens carries its channel (cacheNames.ts), read from the same stamp, so preview and
26
+ * staging on one origin keep disjoint caches. Production's names are the ones it always had. */
27
+ const CHANNEL = cacheChannel((() => {
28
+ const stamp = /\bglobalThis\.__WS_WORLD__=(\{[^;]+\});/u.exec(DOCUMENT)?.[1];
29
+ try { return stamp === undefined ? undefined : JSON.parse(stamp); } catch { return {}; }
30
+ })());
31
+ const ASSETS = cacheName('__ASSET_CACHE__', CHANNEL);
32
+ const BOOKS = cacheName('ws-builds-v1', CHANNEL);
33
+ const SHELL_FAMILY = cacheName('ws-shell-', CHANNEL);
34
+ const SHELL_PREFIX = cacheName('ws-shell-v3-', CHANNEL);
35
+ const SHELL = `${SHELL_PREFIX}${BUILD}`;
14
36
  const SOLO_ONLY = /\/standalone\/(?:serverWorker|serverRuntime)-[^/]+\.js$|\/assets\/spawn\/server-[^/]+\.json$/u;
15
37
  const FILES = JSON.parse('__FILES__');
16
38
  /** What this build precaches and records as its generation: its files, less the solo server's on a world build. */
@@ -37,7 +59,7 @@ const isHtml = response => /\btext\/html\b/i.test(response.headers.get('content-
37
59
  const { base: CONTENT_BASE, files: CONTENT_FILES } = JSON.parse('__CONTENT__');
38
60
  /** OF5: the server book on the content base is solo-only too (a URL there, its path under the base's folder). */
39
61
  const CONTENT_PRECACHE = CONTENT_FILES.filter(href => !WORLD || !SOLO_ONLY.test(new URL(href).pathname));
40
- const CONTENT_CACHE = 'ws-content-v1';
62
+ const CONTENT_CACHE = cacheName('ws-content-v1', CHANNEL);
41
63
  const CONTENT_URL = CONTENT_BASE === '' ? undefined : new URL(CONTENT_BASE);
42
64
  /** A base on the page's own origin (contentBase.ts allows one) owns its folder only; the rest of the origin is the page's. */
43
65
  const SAME_ORIGIN_BASE = CONTENT_URL?.origin === self.location.origin;
@@ -114,6 +136,8 @@ workerScope.listen(self, 'install', event => {
114
136
  ]) : undefined;
115
137
  event.waitUntil((async () => {
116
138
  await routes;
139
+ // OF12: production marks the origin, so another channel's worker here keeps production's caches
140
+ if (CHANNEL === 'production') await caches.open(PRODUCTION_MARK);
117
141
  const [assets, shell, books] = await Promise.all([store(ASSETS), store(SHELL), caches.open(BOOKS)]);
118
142
  await importPrevious(assets, books);
119
143
  const namedShell = SHELL_FILES.filter(path => immutable(new URL(abs(path))));
@@ -140,15 +164,24 @@ const inflight = new Set(), controlled = new Set(), loading = new Set(), nonLoad
140
164
  const isDoctorDocument = url => url.origin === self.location.origin
141
165
  && (url.pathname === '/doctor' || url.pathname === '/doctor/' || url.pathname === '/doctor/index.html'
142
166
  || (url.pathname === '/' || url.pathname === '/index.html') && url.searchParams.has('doctor'));
167
+ // OF6: only a page we can see loads. A client `clients.get` doesn't list (a dedicated worker some browsers don't) is not one.
143
168
  function isNonLoadingClient(id) {
144
169
  if (typeof self.clients?.get !== 'function') return Promise.resolve(false);
145
170
  let known = nonLoadingClients.get(id);
146
- if (known === undefined) { known = self.clients.get(id).then(client => client?.type === 'worker'
147
- || client?.type === 'window' && isDoctorDocument(new URL(client.url)), () => false); nonLoadingClients.set(id, known); }
171
+ if (known === undefined) {
172
+ known = self.clients.get(id).then(client => {
173
+ // unseen now may be a page a browser lists late: not kept, so its next read asks again
174
+ if (client === undefined) { nonLoadingClients.delete(id); return true; }
175
+ return client.type === 'worker' || client.type === 'sharedworker' || client.type === 'window' && isDoctorDocument(new URL(client.url));
176
+ }, () => false);
177
+ nonLoadingClients.set(id, known);
178
+ }
148
179
  return known;
149
180
  }
181
+ // OF6: a read with no client id (a worker's own script) is no loading page; a navigation pauses through its own branch. Before,
182
+ // such reads paused the precache and aborted its fetches on every read, so a page's workers held it paused while they read.
150
183
  async function pauseForClient(id) {
151
- if (typeof id === 'string' && id !== '' && await isNonLoadingClient(id)) return;
184
+ if (typeof id !== 'string' || id === '' || await isNonLoadingClient(id)) return;
152
185
  pausePrecache(id);
153
186
  }
154
187
  function pausePrecache(client) {
@@ -260,9 +293,15 @@ workerScope.listen(self, 'activate', event => {
260
293
  await books.delete(key);
261
294
  }
262
295
  await carryNetworkFirst().catch(() => undefined);
296
+ // OF12: only this channel's older shells (and production's legacy caches) go. Another channel's worker on this origin
297
+ // also drops every cache under production's names (its own from before OF12, and the legacy ws-content-v0) on each
298
+ // activate, unless production runs here too; nothing on this channel writes them again, so in effect it happens once.
299
+ const productionHere = CHANNEL !== 'production' && await caches.has(PRODUCTION_MARK);
263
300
  for (const name of await caches.keys()) {
264
- if (name === SHELL) continue;
265
- if (name.startsWith('ws-shell-') || name.startsWith('ws-static-') || name === 'ws-immutable') await caches.delete(name);
301
+ if (name === SHELL || name === PRODUCTION_MARK) continue;
302
+ const legacy = CHANNEL === 'production' && (name.startsWith('ws-static-') || name === 'ws-immutable');
303
+ if (name.startsWith(SHELL_FAMILY) || legacy) await caches.delete(name);
304
+ else if (CHANNEL !== 'production' && !productionHere && ownsCache(name, 'production')) await caches.delete(name);
266
305
  }
267
306
  })());
268
307
  });
@@ -390,7 +429,7 @@ workerScope.listen(self, 'fetch', event => {
390
429
  if (url.pathname === '/version.json' || url.pathname === '/sw.js' || url.pathname.startsWith('/api/')) return;
391
430
  if (request.mode === 'navigate' || url.pathname === '/' || url.pathname === '/index.html') {
392
431
  const received=diagnosticNow();
393
- event.respondWith(new Response(DOCUMENT, { headers: { 'content-type': 'text/html;charset=utf-8', 'cache-control': 'no-store' } }));
432
+ event.respondWith(new Response(DOCUMENT, { headers: { ...DOCUMENT_HEADERS, 'content-type': 'text/html;charset=utf-8', 'cache-control': 'no-store' } }));
394
433
  bootPublish(event,[{operation:'sw:navigation-handler-and-delivery',url:request.url,start:received,end:diagnosticNow(),result:'complete'}]);
395
434
  return;
396
435
  }
@@ -399,12 +438,12 @@ workerScope.listen(self, 'fetch', event => {
399
438
  return;
400
439
  }
401
440
  if (immutable(url)) {
402
- event.respondWith(cached(request, ASSETS, event));
441
+ answer(event, request, cached(request, ASSETS, event));
403
442
  return;
404
443
  }
405
444
  if (/^\/(?:assets|basis|fonts)\//.test(url.pathname) || url.pathname === '/manifest.webmanifest') {
406
- event.respondWith(cached(request, SHELL, event));
407
- } else if (NETWORK_FIRST.test(url.pathname)) event.respondWith(networkFirst(request, SHELL, event));
445
+ answer(event, request, cached(request, SHELL, event));
446
+ } else if (NETWORK_FIRST.test(url.pathname)) answer(event, request, networkFirst(request, SHELL, event));
408
447
  });
409
448
 
410
449
  workerScope.listen(self, 'message', event => {