@wildshard/engine 0.1.15 → 0.1.18

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 (262) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/index.html +157 -11
  3. package/lint/engine-sides.json +23 -0
  4. package/lint/host-callback-syntax.mjs +2 -1
  5. package/lint/host-callbacks.mjs +3 -3
  6. package/lint/host-files.mjs +5 -4
  7. package/lint/host-register.json +496 -0
  8. package/lint/no-base64.mjs +3 -1
  9. package/lint/ratchet.json +2 -2
  10. package/lint/shard-imports.d.mts +1 -0
  11. package/lint/shard-imports.mjs +60 -13
  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 +44 -27
  18. package/package.json +24 -6
  19. package/scripts/app-build/buildIdentity.d.mts +3 -1
  20. package/scripts/app-build/buildIdentity.mjs +25 -5
  21. package/scripts/app-build/builtAt.d.mts +4 -0
  22. package/scripts/app-build/builtAt.mjs +21 -0
  23. package/scripts/app-build/outputProducts.d.mts +3 -0
  24. package/scripts/app-build/outputProducts.mjs +31 -0
  25. package/scripts/app-build/serviceWorker.ts +16 -2
  26. package/scripts/app-build/versionFiles.ts +2 -1
  27. package/scripts/app-build-pipeline.mjs +7 -1
  28. package/scripts/audio-download-proof.mjs +843 -0
  29. package/scripts/build-app.mjs +4 -0
  30. package/scripts/build-mirror.d.mts +2 -0
  31. package/scripts/build-mirror.mjs +5 -4
  32. package/scripts/built-product.mjs +3 -3
  33. package/scripts/cell-mem/metrics-preload.mjs +65 -0
  34. package/scripts/cell-mem-bench.mjs +130 -0
  35. package/scripts/check-chunks.mjs +2 -1
  36. package/scripts/check-devserver.mjs +1 -1
  37. package/scripts/chromium-keychain-check.mjs +4 -2
  38. package/scripts/chromium-keychain.mjs +3 -1
  39. package/scripts/cook.mjs +7 -3
  40. package/scripts/devices.d.mts +4 -0
  41. package/scripts/devices.mjs +39 -0
  42. package/scripts/devserver-client.d.mts +7 -0
  43. package/scripts/devserver-client.mjs +85 -0
  44. package/scripts/doctor-proof.mjs +1 -1
  45. package/scripts/e2e-faults.mjs +159 -0
  46. package/scripts/engine-ci-budget.ts +7 -1
  47. package/scripts/format-lock.mjs +20 -11
  48. package/scripts/generate-title-launch.mjs +3 -2
  49. package/scripts/grid-crossing-walk-proof.mjs +30 -11
  50. package/scripts/heavy-lane.py +25 -1
  51. package/scripts/host-ruler/register-migrate.mjs +242 -0
  52. package/scripts/host-ruler/register.d.mts +36 -0
  53. package/scripts/host-ruler/register.mjs +116 -0
  54. package/scripts/host-ruler/roots.d.mts +29 -0
  55. package/scripts/host-ruler/roots.mjs +333 -0
  56. package/scripts/host-ruler/server-roots.d.mts +23 -0
  57. package/scripts/host-ruler/server-roots.mjs +272 -0
  58. package/scripts/main-watch.d.mts +1 -1
  59. package/scripts/main-watch.mjs +10 -6
  60. package/scripts/map-hash.mjs +3 -6
  61. package/scripts/memory-proof.mjs +158 -0
  62. package/scripts/mmo-bots.mjs +2 -2
  63. package/scripts/offline-proof-rules.d.mts +5 -2
  64. package/scripts/offline-proof-rules.mjs +43 -6
  65. package/scripts/offline-proof.mjs +15 -6
  66. package/scripts/online-rig.mjs +4 -4
  67. package/scripts/page-release/flow.d.mts +1 -0
  68. package/scripts/page-release/flow.mjs +6 -2
  69. package/scripts/page-release.mjs +5 -1
  70. package/scripts/physics-route.json +0 -71
  71. package/scripts/pins-catalogue.ts +103 -0
  72. package/scripts/pins-reuse.mjs +3 -1
  73. package/scripts/pins.ts +22 -14
  74. package/scripts/preview-grid.ts +203 -0
  75. package/scripts/road-preload-proof.mjs +167 -0
  76. package/scripts/server-release/publish.mjs +2 -2
  77. package/scripts/server-release/served-slug.d.mts +2 -0
  78. package/scripts/server-release/served-slug.mjs +10 -0
  79. package/scripts/server-release/sign.d.mts +1 -0
  80. package/scripts/server-release/sign.mjs +3 -7
  81. package/scripts/shard-components.mjs +0 -2
  82. package/scripts/shard-outputs.d.mts +8 -0
  83. package/scripts/shard-outputs.mjs +45 -11
  84. package/scripts/side-parity.d.mts +2 -1
  85. package/scripts/side-parity.mjs +25 -4
  86. package/scripts/test-amber.d.mts +1 -0
  87. package/scripts/test-amber.mjs +10 -0
  88. package/scripts/test-products.json +3 -3
  89. package/scripts/tier-textures-proof.mjs +101 -0
  90. package/scripts/tier-textures.mjs +60 -0
  91. package/scripts/tracked-public.d.mts +1 -0
  92. package/scripts/tracked-public.mjs +17 -0
  93. package/scripts/tsconfig.json +1 -0
  94. package/scripts/vps/wildshard-config +79 -23
  95. package/scripts/worker-client-play.mjs +1 -0
  96. package/scripts/worker-client-proof.mjs +1 -1
  97. package/scripts/worker-client-slug.mjs +44 -0
  98. package/src/cli/engine.mjs +8 -0
  99. package/src/client/app/bootRoute.ts +4 -1
  100. package/src/client/app/dropModal.ts +15 -2
  101. package/src/client/app/entry.ts +96 -13
  102. package/src/client/app/slugPath.ts +5 -0
  103. package/src/client/engine/audio/Audio.ts +20 -2
  104. package/src/client/engine/boot/bakedTextures.ts +3 -2
  105. package/src/client/engine/boot/bootTrace.ts +6 -1
  106. package/src/client/engine/boot/bytes.ts +4 -3
  107. package/src/client/engine/boot/clearDownloads.ts +1 -1
  108. package/src/client/engine/boot/contentRead.ts +4 -0
  109. package/src/client/engine/boot/dropNotice.ts +20 -6
  110. package/src/client/engine/boot/gpuFiles.ts +25 -2
  111. package/src/client/engine/boot/lastEnd.ts +8 -2
  112. package/src/client/engine/boot/parsedPages.ts +127 -58
  113. package/src/client/engine/boot/shardPrefetch.ts +7 -1
  114. package/src/client/engine/boot/sw.ts +19 -0
  115. package/src/client/engine/build.d.ts +2 -0
  116. package/src/client/engine/core/Game.ts +29 -3
  117. package/src/client/engine/core/GpuRecovery.ts +7 -0
  118. package/src/client/engine/core/Volumetrics.ts +5 -0
  119. package/src/client/engine/core/assets.ts +27 -20
  120. package/src/client/engine/core/bootstrap.ts +5 -3
  121. package/src/client/engine/core/ktx2.ts +84 -11
  122. package/src/client/engine/debug/probe.ts +18 -1
  123. package/src/client/engine/explore/Compare.ts +2 -2
  124. package/src/client/engine/explore/TouchFly.ts +3 -5
  125. package/src/client/engine/fx/LightPool.ts +41 -1
  126. package/src/client/engine/input/dom.ts +12 -0
  127. package/src/client/engine/net/predictor.ts +6 -2
  128. package/src/client/engine/player/Player.ts +10 -2
  129. package/src/client/engine/player/TouchControls.ts +12 -4
  130. package/src/client/engine/pwa/sw.js +59 -11
  131. package/src/client/engine/render/drawCheck.ts +96 -0
  132. package/src/client/engine/render/precompile.ts +20 -14
  133. package/src/client/engine/saves/staleBuildNote.ts +46 -0
  134. package/src/client/engine/telemetry/browserErrors.ts +161 -21
  135. package/src/client/engine/telemetry/deviceSnapshot.ts +155 -0
  136. package/src/client/engine/telemetry/screenOutbox.ts +61 -0
  137. package/src/client/engine/telemetry/staleBuildReport.ts +12 -0
  138. package/src/client/engine/ui/DeathFade.ts +99 -11
  139. package/src/client/engine/ui/ErrorModal.ts +13 -6
  140. package/src/client/engine/ui/Feedback.ts +2 -1
  141. package/src/client/engine/ui/Loading.ts +10 -6
  142. package/src/client/engine/ui/Map.ts +2 -1
  143. package/src/client/engine/ui/WeaponStrip.ts +2 -1
  144. package/src/client/engine/ui/backGuard.ts +104 -0
  145. package/src/client/engine/ui/hudAdapters.ts +30 -4
  146. package/src/client/engine/ui/loading.css +17 -0
  147. package/src/client/engine/ui/namePrompt.ts +6 -5
  148. package/src/client/engine/ui/styles/combat.css +12 -0
  149. package/src/client/engine/ui/styles/namePrompt.css +4 -2
  150. package/src/client/game/boot/audio.generated.ts +0 -396
  151. package/src/client/game/boot/bytes.generated.ts +42 -71
  152. package/src/client/game/boot/versions.generated.ts +0 -13
  153. package/src/client/game/compendium/keepsakes.ts +16 -6
  154. package/src/client/game/grapple/tool.ts +10 -7
  155. package/src/client/game/grid/area.ts +38 -0
  156. package/src/client/game/grid/cellLoading.ts +23 -12
  157. package/src/client/game/grid/cellScreens.ts +39 -74
  158. package/src/client/game/grid/live.ts +28 -2
  159. package/src/client/game/grid/liveSession.ts +54 -10
  160. package/src/client/game/grid/menu.ts +4 -0
  161. package/src/client/game/grid/nearPlaceholderPlan.ts +8 -0
  162. package/src/client/game/grid/nearPlaceholderView.ts +9 -3
  163. package/src/client/game/grid/neighbourPanels.ts +10 -1
  164. package/src/client/game/grid/oneWayIn.ts +92 -27
  165. package/src/client/game/grid/pageEntry.ts +19 -0
  166. package/src/client/game/grid/pageShell.ts +1 -1
  167. package/src/client/game/grid/placedCards.ts +55 -0
  168. package/src/client/game/grid/placedCells.ts +131 -0
  169. package/src/client/game/grid/plotAudio.ts +114 -0
  170. package/src/client/game/grid/products.ts +55 -5
  171. package/src/client/game/grid/regionalRuntime.ts +6 -0
  172. package/src/client/game/grid/regionalWorld.ts +15 -2
  173. package/src/client/game/grid/roadCull.ts +44 -14
  174. package/src/client/game/grid/roadLookPlatform.ts +2 -2
  175. package/src/client/game/grid/roadTileBacking.ts +13 -3
  176. package/src/client/game/grid/session.ts +47 -22
  177. package/src/client/game/grid/shardfileFar.ts +9 -3
  178. package/src/client/game/grid/spawnGround.ts +68 -0
  179. package/src/client/game/grid/voidLook.ts +29 -23
  180. package/src/client/game/loot/runtime.ts +3 -1
  181. package/src/client/game/mainMenu.ts +14 -6
  182. package/src/client/game/riding/hud.ts +6 -4
  183. package/src/client/game/session/finish.ts +22 -4
  184. package/src/client/game/session/play.ts +8 -2
  185. package/src/client/game/session/session.ts +4 -1
  186. package/src/client/game/shard/titleList.ts +6 -2
  187. package/src/client/game/shardfile/clientWorker.ts +43 -13
  188. package/src/client/game/shardfile/serverRoute.ts +10 -22
  189. package/src/client/game/slugPage.css +11 -0
  190. package/src/client/game/slugPage.ts +84 -0
  191. package/src/client/game/systems/viewmodel/heldView.ts +6 -3
  192. package/src/client/game/titleDeck.ts +56 -32
  193. package/src/client/host/online/doctor.ts +7 -6
  194. package/src/client/host/online/linkScreens.ts +16 -0
  195. package/src/client/host/online/release.ts +51 -5
  196. package/src/client/host/online/shell.ts +62 -27
  197. package/src/client/host/standalone/shell.ts +7 -3
  198. package/src/cook/game/audioReport.ts +57 -0
  199. package/src/cook/game/entryTotals.ts +26 -6
  200. package/src/cook/game/installedRuntimeReads.ts +3 -0
  201. package/src/cook/game/shardCook.ts +38 -8
  202. package/src/cook/game/tierTextures.ts +276 -0
  203. package/src/e2e/smoke/game.ts +19 -14
  204. package/src/e2e/smoke/page-globals.d.ts +9 -8
  205. package/src/e2e/smoke/template2.spec.ts +8 -7
  206. package/src/server/engine/sim/respawn.ts +6 -1
  207. package/src/server/engine/sim.ts +3 -0
  208. package/src/server/game/grid/simulation.ts +35 -0
  209. package/src/server/game/loot/harvest.ts +2 -0
  210. package/src/server/game/loot/keepsakeProgression.ts +40 -0
  211. package/src/server/game/loot/playerOwned.ts +5 -1
  212. package/src/server/game/plugin/simulation.ts +4 -0
  213. package/src/server/game/population/nativeBake.ts +2 -1
  214. package/src/server/game/quest/chapterRecords.ts +2 -0
  215. package/src/server/game/quest/serverChapters.ts +4 -0
  216. package/src/server/game/quest/serverDoors.ts +11 -5
  217. package/src/server/game/roomRespawn.ts +4 -0
  218. package/src/server/game/shardfile/installedSides.ts +18 -0
  219. package/src/server/game/shardfile/nativeAssemblyHosts.ts +19 -10
  220. package/src/server/game/shardfile/nativeAssemblyInput.ts +1 -4
  221. package/src/server/host/bake/headlessWorker.ts +5 -1
  222. package/src/server/host/dedicated/cellHost.ts +98 -29
  223. package/src/server/host/dedicated/cellProtocol.ts +11 -1
  224. package/src/server/host/dedicated/cellWorker.ts +9 -3
  225. package/src/server/host/dedicated/crossing.ts +6 -2
  226. package/src/server/host/dedicated/dedicatedRoom.ts +21 -8
  227. package/src/server/host/dedicated/gridCells.ts +52 -9
  228. package/src/server/host/dedicated/main.ts +31 -12
  229. package/src/server/host/dedicated/placementFile.ts +56 -0
  230. package/src/server/host/dedicated/releaseFile.ts +17 -10
  231. package/src/server/host/dedicated/roadRoom.ts +21 -5
  232. package/src/server/host/dedicated/socketTransport.ts +2 -1
  233. package/src/server/host/dedicated/workerTable.ts +13 -1
  234. package/src/server/host/dedicated/world.ts +111 -10
  235. package/src/server/host/headlessRuntime.ts +10 -5
  236. package/src/server/host/installers.ts +62 -0
  237. package/src/server/host/openWorld.ts +59 -0
  238. package/src/server/host/ropeDecks.ts +2 -0
  239. package/src/server/host/standalone/cellWorld.ts +25 -19
  240. package/src/server/host/standalone/fallFloor.ts +2 -2
  241. package/src/server/host/standalone/gridServer.ts +7 -4
  242. package/src/server/host/standalone/roadWorld.ts +41 -4
  243. package/src/shared/engine/audio/bootAudio.ts +33 -0
  244. package/src/shared/engine/level/spec.ts +3 -3
  245. package/src/shared/engine/net/acts.ts +3 -0
  246. package/src/shared/engine/net/deviceWord.ts +138 -0
  247. package/src/shared/engine/net/socketFrames.ts +7 -4
  248. package/src/shared/engine/physics/query.ts +27 -0
  249. package/src/shared/engine/physics/terrain.ts +19 -28
  250. package/src/shared/engine/saves/saves.lock.json +15 -0
  251. package/src/shared/engine/sim/actRoutes.ts +2 -0
  252. package/src/shared/game/compendium/keepsakeProgression.ts +24 -0
  253. package/src/shared/game/grid/catalogue.ts +12 -5
  254. package/src/shared/game/grid/catalogueSlot.ts +18 -0
  255. package/src/shared/game/grid/farProxy.ts +6 -5
  256. package/src/shared/game/grid/pageMode.ts +1 -1
  257. package/src/shared/game/grid/placementRows.ts +33 -0
  258. package/src/shared/game/grid/roadLayout.ts +26 -3
  259. package/src/shared/game/grid/singleplayer.json +0 -13
  260. package/src/shared/game/grid/voidFloor.ts +122 -0
  261. package/src/shared/game/strings.ts +15 -0
  262. package/src/shared/host/standalone/netInput.ts +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildshard/engine",
3
- "version": "0.1.15",
3
+ "version": "0.1.18",
4
4
  "description": "The Wildshard engine: one repo with shared, client, server and cook code and three build targets (client, dedicated server, standalone listen server), shaped like Unreal or Source.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "type": "module",
14
14
  "bin": {
15
- "engine": "./src/cli/main.ts"
15
+ "engine": "./src/cli/engine.mjs"
16
16
  },
17
17
  "engines": {
18
18
  "node": ">=24.18.0"
@@ -29,6 +29,7 @@
29
29
  "format:check": "npr oxfmt -c src/.oxfmtrc.json --check src/cli src/tools src/e2e src/scripts",
30
30
  "test": "pnpm test:kit && pnpm test:fast",
31
31
  "test:e2e": "playwright test --config src/e2e/playwright.config.ts",
32
+ "test:e2e:faults": "node scripts/e2e-faults.mjs",
32
33
  "check:sides": "node src/scripts/check-sides.mjs && node scripts/check-engine-sides.mjs",
33
34
  "check:asks": "node src/scripts/asks.mjs check",
34
35
  "check:agents": "node .githooks/agents-md.mjs lint",
@@ -56,7 +57,7 @@
56
57
  "ring:1": "bash scripts/ring1.sh all",
57
58
  "lint:typed": "node scripts/lint-all.mjs",
58
59
  "test:checks": "pnpm gen && node scripts/check-graph.mjs --source-only && node scripts/check-engine-sides.mjs && node scripts/check-sim-players.mjs",
59
- "build:game": "python3 scripts/heavy-lane.py build -- bash -c 'node scripts/pins.ts install && node scripts/gen.mjs --inputs-only && npr tsc -b tsconfig.layers.json --builders 1 && WILDSHARD_CATALOGUE=test/pins/catalogue.json node scripts/build-app.mjs && node scripts/check-devserver.mjs dist && node scripts/app-build/splitOutput.mjs dist && node scripts/page-size.mjs dist --gate'",
60
+ "build:game": "python3 scripts/heavy-lane.py build -- bash -c 'node scripts/pins.ts install && node scripts/gen.mjs --inputs-only && npr tsc -b tsconfig.layers.json --builders 1 && WILDSHARD_CATALOGUE=\"${WILDSHARD_CATALOGUE:-test/pins/catalogue.json}\" node scripts/build-app.mjs && node scripts/check-devserver.mjs dist && node scripts/app-build/splitOutput.mjs dist && node scripts/page-size.mjs dist --gate'",
60
61
  "tools:install": "npr install --frozen"
61
62
  },
62
63
  "dependencies": {
@@ -65,8 +66,8 @@
65
66
  "@sentry/browser": "11.0.0",
66
67
  "@sentry/core": "11.0.0",
67
68
  "@valibot/to-json-schema": "1.8.0",
68
- "@wildshard/format": "github:project-wildshard/shard-format#v0.4.4",
69
- "@wildshard/wire": "github:project-wildshard/shard-format#203e4fa89f0c5f3804b6b254363d7597008a9389&path:/packages/wire",
69
+ "@wildshard/format": "npm:@wildshard/shard-format@^0.4.9",
70
+ "@wildshard/wire": "^0.1.0",
70
71
  "ajv": "6.15.0",
71
72
  "fflate": "0.8.3",
72
73
  "hono": "4.13.13",
@@ -80,9 +81,15 @@
80
81
  "ws": "8.22.0"
81
82
  },
82
83
  "peerDependencies": {
83
- "sharp": "0.35.5"
84
+ "@types/three": "*",
85
+ "@typescript/typescript6": "6.0.2",
86
+ "sharp": "0.35.5",
87
+ "vite": "8.3.0"
84
88
  },
85
89
  "peerDependenciesMeta": {
90
+ "@types/three": {
91
+ "optional": true
92
+ },
86
93
  "sharp": {
87
94
  "optional": true
88
95
  }
@@ -239,6 +246,7 @@
239
246
  "./ai/director": "./src/shared/engine/ai/director.ts",
240
247
  "./fx/effectField": "./src/client/engine/fx/effectField.ts",
241
248
  "./core/deflate": "./src/client/engine/core/deflate.ts",
249
+ "./core/apiOrigin": "./src/client/engine/core/apiOrigin.ts",
242
250
  "./world/weatherContinuation": "./src/shared/engine/world/weatherContinuation.ts",
243
251
  "./audio/declaredAmbience": "./src/client/engine/audio/declaredAmbience.ts",
244
252
  "./audio/declaredBank": "./src/client/engine/audio/declaredBank.ts",
@@ -574,6 +582,7 @@
574
582
  "./saves/store": "./src/shared/engine/saves/store.ts",
575
583
  "./saves/shape": "./src/shared/engine/saves/shape.ts",
576
584
  "./strings": "./src/shared/engine/strings.ts",
585
+ "./ui/backGuard": "./src/client/engine/ui/backGuard.ts",
577
586
  "./ui/BossBar": "./src/client/engine/ui/BossBar.ts",
578
587
  "./ui/namePrompt": "./src/client/engine/ui/namePrompt.ts",
579
588
  "./ui/offlineDownload": "./src/client/engine/ui/offlineDownload.ts",
@@ -785,6 +794,7 @@
785
794
  "./ui/StartTitle": "./src/client/engine/ui/StartTitle.ts",
786
795
  "./telemetry/browserErrors": "./src/client/engine/telemetry/browserErrors.ts",
787
796
  "./telemetry/runtime": "./src/client/engine/telemetry/runtime.ts",
797
+ "./telemetry/deviceSnapshot": "./src/client/engine/telemetry/deviceSnapshot.ts",
788
798
  "./practice/TrainingDummy": "./src/client/engine/practice/TrainingDummy.ts",
789
799
  "./practice/DummyMotion": "./src/client/engine/practice/DummyMotion.ts",
790
800
  "./practice/DummyClips": "./src/client/engine/practice/DummyClips.ts",
@@ -879,8 +889,12 @@
879
889
  "./game/ambient/flock": "./src/shared/game/ambient/flock.ts",
880
890
  "./game/grid/pageMode": "./src/shared/game/grid/pageMode.ts",
881
891
  "./game/grid/gridCollision": "./src/shared/game/grid/gridCollision.ts",
892
+ "./game/grid/voidFloor": "./src/shared/game/grid/voidFloor.ts",
882
893
  "./game/grid/assembly": "./src/shared/game/grid/assembly.ts",
883
894
  "./game/grid/catalogueSlot": "./src/shared/game/grid/catalogueSlot.ts",
895
+ "./game/grid/placedCells": "./src/client/game/grid/placedCells.ts",
896
+ "./game/grid/placedCards": "./src/client/game/grid/placedCards.ts",
897
+ "./game/grid/placementRows": "./src/shared/game/grid/placementRows.ts",
884
898
  "./game/grid/catalogueDocument": "./src/shared/game/grid/catalogueDocument.ts",
885
899
  "./game/grid/room": "./src/server/game/grid/room.ts",
886
900
  "./game/grid/roomNet": "./src/server/game/grid/roomNet.ts",
@@ -928,6 +942,7 @@
928
942
  "./game/quest/serverPlaces": "./src/server/game/quest/serverPlaces.ts",
929
943
  "./game/loadout/itemCatalogue": "./src/shared/game/loadout/itemCatalogue.ts",
930
944
  "./game/shardfile/nativePlan": "./src/server/game/shardfile/nativePlan.ts",
945
+ "./game/shardfile/installedSides": "./src/server/game/shardfile/installedSides.ts",
931
946
  "./game/shardfile/worldTargets": "./src/shared/game/shardfile/worldTargets.ts",
932
947
  "./game/shardfile/decisions": "./src/server/game/shardfile/decisions.ts",
933
948
  "./game/shardfile/outputDescriptor": "./src/shared/game/shardfile/outputDescriptor.ts",
@@ -1153,6 +1168,7 @@
1153
1168
  "./game/models/binarySource": "./src/client/game/models/binarySource.ts",
1154
1169
  "./game/plugin/clientChannelView": "./src/client/game/plugin/clientChannelView.ts",
1155
1170
  "./game/mainMenu": "./src/client/game/mainMenu.ts",
1171
+ "./game/slugPage": "./src/client/game/slugPage.ts",
1156
1172
  "./game/systems/species/install": "./src/client/game/systems/species/install.ts",
1157
1173
  "./game/icons": "./src/client/game/icons.ts",
1158
1174
  "./game/models/interact": "./src/client/game/models/interact.ts",
@@ -1179,6 +1195,7 @@
1179
1195
  "./host/headlessJourney": "./src/shared/host/headlessJourney.ts",
1180
1196
  "./host/headlessTape": "./src/shared/host/headlessTape.ts",
1181
1197
  "./host/headlessRuntime": "./src/server/host/headlessRuntime.ts",
1198
+ "./host/openWorld": "./src/server/host/openWorld.ts",
1182
1199
  "./host/immutable": "./src/shared/host/immutable.ts",
1183
1200
  "./host/tickProtocol": "./src/shared/host/tickProtocol.ts",
1184
1201
  "./host/tickWorkerHost": "./src/server/host/tickWorkerHost.ts",
@@ -1266,6 +1283,7 @@
1266
1283
  "./net/chatFilter": "./src/shared/engine/net/chatFilter.ts",
1267
1284
  "./net/redial": "./src/client/engine/net/redial.ts",
1268
1285
  "./net/socketFrames": "./src/shared/engine/net/socketFrames.ts",
1286
+ "./net/deviceWord": "./src/shared/engine/net/deviceWord.ts",
1269
1287
  "./net/webSocketTransport": "./src/client/engine/net/webSocketTransport.ts",
1270
1288
  "./net/otherPlayers": "./src/client/engine/net/otherPlayers.ts",
1271
1289
  "./net/hurtOther": "./src/client/engine/net/hurtOther.ts",
@@ -2,7 +2,9 @@
2
2
  export const BUILD_ID_EXPRESSION: string;
3
3
  export const VALIDATOR_EXPRESSION: string;
4
4
  export const VERDICTS_EXPRESSION: string;
5
- export interface DocumentAdmissionFacts { readonly validator: string; readonly verdicts: readonly unknown[] }
5
+ export interface DocumentAdmissionFacts { readonly validator: string; readonly verdicts: readonly unknown[]; readonly world?: { readonly release: string; readonly key: string; readonly recordTag?: string }; readonly label?: string; readonly builtAt?: number }
6
+ /** The build pill's words (buildCheck.ts buildLabel): git describe, else "v<version> · <short sha>". */
7
+ export function buildLabelOf(build: string, release: { readonly version: string; readonly describe?: string }): string;
6
8
  /** A new build's id: WS_BUILD_ID, else short git sha + build time. */
7
9
  export function newBuildId(): string;
8
10
  /** A known source's build id: short sha + build time (for exported trees, passed as WS_BUILD_ID). */
@@ -37,9 +37,20 @@ export const codeDirectory = (build) => `b/${build}`;
37
37
  * in its own folder, and the deploy carries the old builds' graphs (MF2, J79) as before. */
38
38
  export const SHARED_CODE_DIRECTORY = 'b/c';
39
39
 
40
- /** Stamp before executable module scripts, without changing the bundle's URLs.
40
+ /** The build pill's words for a build (src/client/engine/ui/buildCheck.ts buildLabel, which test/build-identity.test.ts
41
+ * keeps equal): its `git describe`, else "v0.1.5 · a8144a5", either half alone when the other is unknown.
42
+ * @param {string} build @param {{version: string, describe?: string}} release */
43
+ export function buildLabelOf(build, { version, describe = '' }) {
44
+ if (describe !== '' && /^[\w .·+-]{1,80}$/u.test(describe)) return describe; // an odd tag never fails a build over a label
45
+ const [gitSha = '', stamp = ''] = build.split('-');
46
+ const short = /^[0-9a-f]{7,40}$/iu.test(gitSha) ? gitSha.slice(0, 7) : gitSha.length >= 7 ? gitSha : stamp;
47
+ return [version === '' ? '' : `v${version}`, short].filter(part => part !== '').join(' · ');
48
+ }
49
+
50
+ /** Stamp before executable module scripts, without changing the bundle's URLs. `label` (QA 11-13) is the build pill's
51
+ * words, which index.html's static title shows before any bundle runs.
41
52
  * @param {string} html @param {string} build
42
- * @param {{validator: string, verdicts: readonly unknown[], world?: {release: string, key: string,recordTag?:string}}} [facts] */
53
+ * @param {{validator: string, verdicts: readonly unknown[], world?: {release: string, key: string,recordTag?:string}, label?: string, builtAt?: number}} [facts] */
43
54
  export function stampBuildHtml(html, build, facts) {
44
55
  if (build.length === 0 || !/^[\w.-]+$/u.test(build)) throw new Error('Invalid document build identity');
45
56
  if (html.includes('globalThis.__WS_BUILD_ID__=')) throw new Error('Duplicate document build identity');
@@ -53,19 +64,28 @@ export function stampBuildHtml(html, build, facts) {
53
64
  if (facts !== undefined && (!/^[a-f0-9]{64}$/u.test(facts.validator) || !Array.isArray(facts.verdicts))) throw new Error('Invalid document admission facts');
54
65
  const admission = facts === undefined ? '' : `globalThis.__WS_SHARDFILE_VALIDATOR__=${JSON.stringify(facts.validator)};globalThis.__WS_SHARDFILE_VERDICTS__=${JSON.stringify(facts.verdicts).replaceAll('<', String.raw`\u003c`)};`;
55
66
  const world = facts?.world === undefined ? '' : `globalThis.__WS_WORLD__=${JSON.stringify(facts.world).replaceAll('<', String.raw`\u003c`)};`;
56
- return `${source.slice(0, end)}<script>globalThis.__WS_BUILD_ID__=${JSON.stringify(build)};${admission}${world}</script>${source.slice(end)}`;
67
+ if (facts?.label !== undefined && !/^[\w .·+-]{1,80}$/u.test(facts.label)) throw new Error('Invalid document build label');
68
+ const label = facts?.label === undefined ? '' : `globalThis.__WS_BUILD_LABEL__=${JSON.stringify(facts.label)};`;
69
+ // STALE-BUILD SB1 (J321): the build time, as a meta a person can read and a number index.html's data-stale-build reads
70
+ const at = facts?.builtAt;
71
+ if (at !== undefined && !(Number.isSafeInteger(at) && at > 0)) throw new Error('Invalid document build time');
72
+ const built = at === undefined ? ['', ''] : [`<meta name="ws-built-at" content="${new Date(at).toISOString()}">`, `globalThis.__WS_BUILT_AT__=${at};`];
73
+ return `${source.slice(0, end)}${built[0]}<script>globalThis.__WS_BUILD_ID__=${JSON.stringify(build)};${built[1]}${admission}${world}${label}</script>${source.slice(end)}`;
57
74
  }
58
75
 
59
76
  /** Plain post-bundle step, before the service worker hashes the final HTML.
60
77
  * Every document entry gets the same version.json identity, including native
61
78
  * index.html and the calibration entry. No new Vite plugin or fetched module.
62
79
  * @param {string} directory
63
- * @param {{validator: string, verdicts: readonly unknown[]}} [facts] */
80
+ * @param {{validator: string, verdicts: readonly unknown[], world?: {release: string, key: string,recordTag?:string}, label?: string}} [facts] */
64
81
  export function stampBuildDocuments(directory, facts) {
65
82
  /** @type {unknown} */
66
83
  const version = JSON.parse(readFileSync(resolve(directory, 'version.json'), 'utf8'));
67
84
  if (typeof version !== 'object' || version === null || !('build' in version) || typeof version.build !== 'string') throw new Error('Missing document build identity');
68
85
  if (version.rendererRevision !== undefined && (typeof version.rendererRevision !== 'string' || !/^[a-f0-9]{64}$/u.test(version.rendererRevision))) throw new Error('Invalid renderer identity');
86
+ // STALE-BUILD SB1: version.json's `time` is the build's one time (build-app's WS_BUILT_AT)
87
+ const time = 'time' in version && typeof version.time === 'string' ? Date.parse(version.time) : Number.NaN;
88
+ const builtAt = Number.isFinite(time) ? time : undefined;
69
89
  const documents = new Set(['index.html']);
70
90
  // E7.5 prep: the Connection doctor's page is built on its own (doctorOutput.mjs), so no manifest names it
71
91
  if (existsSync(resolve(directory, 'doctor/index.html'))) documents.add('doctor/index.html');
@@ -83,7 +103,7 @@ export function stampBuildDocuments(directory, facts) {
83
103
  }
84
104
  for (const name of documents) {
85
105
  const path = resolve(directory, name);
86
- const html=stampBuildHtml(readFileSync(path, 'utf8'), version.build, facts);
106
+ const html=stampBuildHtml(readFileSync(path, 'utf8'), version.build, builtAt === undefined ? facts : { ...facts, builtAt });
87
107
  writeFileSync(path, version.rendererRevision === undefined ? html : html.replace('<script>globalThis.__WS_BUILD_ID__=',`<script>globalThis.__WS_RENDERER_REVISION__=${JSON.stringify(version.rendererRevision)};globalThis.__WS_BUILD_ID__=`));
88
108
  }
89
109
  }
@@ -0,0 +1,4 @@
1
+ /** STALE-BUILD SB1: the build's one time, ms (WS_BUILT_AT, else now). */
2
+ export function builtAtOf(requested: string | undefined, now?: number): string;
3
+ /** STALE-BUILD SB3: the page entry's first statement, its build time and the age check; '' off build-app. */
4
+ export function entryStamp(builtAt: string | undefined): string;
@@ -0,0 +1,21 @@
1
+ /** STALE-BUILD SB1 (J321, Jake 2026-11-13: "we must stamp in the actual date and time of that code, in both the HTML and
2
+ * the JavaScript"): the one build time, in ms, every stamp of a build carries. build-app fixes it once in WS_BUILT_AT, so
3
+ * version.json, the documents, the page's entry and sw.js agree to the millisecond.
4
+ * @param {string | undefined} requested @param {number} [now] */
5
+ export function builtAtOf(requested, now = Date.now()) {
6
+ if (requested === undefined || requested === '') return String(now);
7
+ if (!/^\d{12,14}$/u.test(requested)) throw new Error('Invalid WS_BUILT_AT (ms since 1970)');
8
+ return requested;
9
+ }
10
+
11
+ /** STALE-BUILD SB3: the first statement of the page's own entry (`b/<build>/main-*.js`, a file per build, so no shared
12
+ * chunk's bytes move): its build time, then the check. With strictExecutionOrder every module body waits for the entry's
13
+ * call, so this runs before any of them. A stamp unlike the document's is marked; over 21 days, index.html's
14
+ * `data-stale-build` screen takes the page (it may let a build through when the server says the device clock is wrong)
15
+ * and the throw stops every module: no menu, no game. Off build-app (dev, tests) there is no stamp and no banner.
16
+ * @param {string | undefined} builtAt WS_BUILT_AT */
17
+ export function entryStamp(builtAt) {
18
+ if (builtAt === undefined || !/^\d{12,14}$/u.test(builtAt)) return '';
19
+ return `globalThis.__WS_ENTRY_BUILT_AT__=${builtAt};if(globalThis.__WS_BUILT_AT__!==${builtAt})document.documentElement.dataset.stampMismatch=String(globalThis.__WS_BUILT_AT__);`
20
+ + `if(globalThis.__wsStaleBuild?.(${builtAt})===true){document.documentElement.dataset.booted="";throw new Error("STALE-BUILD: this build is over 21 days old; only the forced update runs")}`;
21
+ }
@@ -1,6 +1,9 @@
1
1
  /** The app publishes its data products, never their temporary TypeScript sources. */
2
2
  export function copyOutputProducts(root: string, outDir: string): void;
3
3
 
4
+ /** Refuse a public/ copy of a product mount whose bytes differ from the product's; returns the mounts checked. */
5
+ export function checkPublishedMounts(root: string): number;
6
+
4
7
  /** DL20: drop the loose files only a part needs to hold; a default manifest's files stay. */
5
8
  export function pruneLooseCopies(outDir: string): { files: number; bytes: number };
6
9
 
@@ -1,3 +1,4 @@
1
+ import { createHash } from 'node:crypto';
1
2
  import { copyFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync } from 'node:fs';
2
3
  import { basename, isAbsolute, join, relative, resolve, sep } from 'node:path';
3
4
 
@@ -24,6 +25,36 @@ export function copyOutputProducts(root, outDir) {
24
25
  }
25
26
  }
26
27
 
28
+ /** A product's mounts serve from `public/` (`pins.ts install` publishes them), so a product dropped into `out/` by hand keeps
29
+ * whatever an older head left there. AUDIO AU7 re-encodes a recording under its old URL, so a new revision and its
30
+ * predecessor share URLs with different bytes: a preparation preview then serves the old head's audio, its manifests
31
+ * name the old hashes, and `wildshard prepare` records no audio in the new head's fence (meta QA 2026-11-13 row 34).
32
+ * Refuse a build whose `public/` copy of a product's mount differs from the product's own bytes; a missing copy is the
33
+ * cook's to refuse. Under 0.5 s over every pinned product.
34
+ * @param {string} root @returns {number} the mounts checked */
35
+ export function checkPublishedMounts(root) {
36
+ const products = resolve(root, 'out'), stale = [];
37
+ if (!existsSync(products)) return 0;
38
+ let checked = 0;
39
+ for (const entry of readdirSync(products, { withFileTypes: true })) {
40
+ const cook = resolve(products, entry.name, 'cook.json');
41
+ if (!entry.isDirectory() || entry.name.startsWith('.') || !existsSync(cook)) continue;
42
+ let parsed;
43
+ try { parsed = JSON.parse(readFileSync(cook, 'utf8')); } catch (error) { throw new Error(`out/${entry.name}/cook.json does not parse`, { cause: error }); }
44
+ const { mounts } = /** @type {{mounts?: {url: string, hash: string}[]}} */ (parsed);
45
+ for (const row of mounts ?? []) {
46
+ const copy = resolve(root, `public${row.url}`);
47
+ if (!/^\/(?:assets|programs)\/(?!.*(?:^|\/)\.\.(?:\/|$))/u.test(row.url) || !existsSync(copy)) continue;
48
+ checked++;
49
+ if (createHash('sha256').update(readFileSync(copy)).digest('hex') !== row.hash) stale.push(`${entry.name} ${row.url}`);
50
+ }
51
+ }
52
+ if (stale.length > 0) throw new Error(`public/ holds ${stale.length} ${stale.length === 1 ? 'mount' : 'mounts'} with other bytes than their product in out/ `
53
+ + `(${stale.slice(0, 3).join(', ')}): publish that product's mounts (node scripts/pins.ts install for a pin, or copy a candidate's `
54
+ + 'mounts/ into public/), or remove its out/ folder if nothing pins it any more, and build again');
55
+ return checked;
56
+ }
57
+
27
58
  /** DL20: a level file leaves the deploy when a part holds it and nothing reads its URL directly. Every default manifest's file
28
59
  * stays: a neighbour's rings and a road crossing read those by URL (G828, G1011; through parts each would cost a whole part),
29
60
  * a title's `<img>` reads its art, and the harness's shardfile arm reads the same set. What goes is the rest of a whole-level
@@ -34,6 +34,13 @@ function shellFiles(html: string, root: string, sources: ReadonlyMap<string, str
34
34
  const fonts = join(publicRoot, 'fonts');
35
35
  // S2: the title's bytes. Only the Latin faces the game's text uses wait in the shell; the rest load if a glyph asks.
36
36
  if (existsSync(fonts)) for (const file of readdirSync(fonts)) if (file.endsWith('-latin.woff2')) add(`/fonts/${file}`);
37
+ // AUDIO AU3: the title's music comes with the shell (play never streams it). Piano is the one style left (AU16, J304);
38
+ // its `title` slot names the file. A build with a content base moves it to the content list, as it does the title art.
39
+ const music = join(publicRoot, 'assets/music/piano/music.json');
40
+ if (existsSync(music)) {
41
+ const full: unknown = Reflect.get(Reflect.get(Reflect.get(JSON.parse(readFileSync(music, 'utf8')) as object, 'slots') ?? {}, 'title') ?? {}, 'full');
42
+ if (typeof full === 'string') add(`/assets/music/piano/${full}`);
43
+ }
37
44
  // S2: iOS reads the launch image itself, once, when the app is added; no page or worker route ever serves it.
38
45
  return [...files].filter(url => !url.startsWith('/assets/title/launch-')).sort();
39
46
  }
@@ -111,7 +118,7 @@ export function refreshServiceWorker(outDir: string, before: string): void {
111
118
  const core = held.split(document).join(JSON.stringify(html)).replaceAll(old, `${buildId}-${digest}`), scripts = workerScripts(core);
112
119
  mkdirSync(dirname(join(outDir, scripts.fileName)), { recursive: true });
113
120
  writeFileSync(join(outDir, scripts.fileName), core);
114
- writeFileSync(join(outDir, 'sw.js'), scripts.bootstrap);
121
+ writeFileSync(join(outDir, 'sw.js'), stampWorker(scripts.bootstrap, outDir));
115
122
  console.log(`sw.js refreshed (${buildId}-${digest})`);
116
123
  }
117
124
 
@@ -129,6 +136,13 @@ function splitBundle(outDir: string, bundle: Record<string, EmittedFile>): Recor
129
136
  return joined;
130
137
  }
131
138
 
139
+ /** STALE-BUILD SB1 (J321): sw.js opens with its build's time (version.json `time`), as the page and its entry do. */
140
+ function stampWorker(bootstrap: string, outDir: string): string {
141
+ const { time } = JSON.parse(readFileSync(join(outDir, 'version.json'), 'utf8')) as { time?: unknown };
142
+ const at = typeof time === 'string' ? Date.parse(time) : Number.NaN;
143
+ return Number.isFinite(at) ? `// built ${new Date(at).toISOString()}\nself.__WS_BUILT_AT__=${at};\n${bootstrap}` : bootstrap;
144
+ }
145
+
132
146
  /** Called after ordinary bundling; previous-deploy chunks are carried by MF2 afterwards. */
133
147
  export async function writeServiceWorker(outDir: string, root: string): Promise<void> {
134
148
  const { build: buildId } = JSON.parse(readFileSync(join(outDir, 'version.json'), 'utf8')) as { build: string };
@@ -140,6 +154,6 @@ export async function writeServiceWorker(outDir: string, root: string): Promise<
140
154
  const { core, build, hashed } = await serviceWorkerCore(splitBundle(outDir, writtenBundle(outDir, root)), root, buildId, book(serverPackBookPath(buildId)), book(packsBookPath(buildId))), scripts = workerScripts(core);
141
155
  mkdirSync(dirname(join(outDir, scripts.fileName)), { recursive: true });
142
156
  writeFileSync(join(outDir, scripts.fileName), core);
143
- writeFileSync(join(outDir, 'sw.js'), scripts.bootstrap);
157
+ writeFileSync(join(outDir, 'sw.js'), stampWorker(scripts.bootstrap, outDir));
144
158
  console.log(`sw.js written (${build}; ${ASSET_CACHE_NAME}; ${hashed.length} precached files)`);
145
159
  }
@@ -5,6 +5,7 @@ import { assetIndex } from './gen';
5
5
  import { WILDSHARD_IDENTITY } from '../../src/client/game/identity';
6
6
  import { rendererRevision } from '../renderer-revision.mjs';
7
7
  import { gitDescribe } from '../changelog.mjs';
8
+ import { builtAtOf } from './builtAt.mjs';
8
9
 
9
10
  /** version.json (the build id, written into each document by build-app and never into content-hashed runtime modules, so
10
11
  * the app can tell when the server has a newer build: iOS home-screen PWAs have no address bar, so the title screen
@@ -14,7 +15,7 @@ export function writeVersionFiles(outDir: string, build: string): void {
14
15
  const {WILDSHARD_PREPARATION_ONLY} = process.env;
15
16
  const epoch: unknown = JSON.parse(readFileSync('save-epoch.json', 'utf8'));
16
17
  if (typeof epoch !== 'object' || epoch === null || !('saveEpoch' in epoch) || epoch.saveEpoch !== WILDSHARD_IDENTITY.saveEpoch) throw new Error('Save epoch metadata must match game identity');
17
- writeFileSync(join(outDir, 'version.json'), JSON.stringify({ build, saveEpoch: epoch.saveEpoch, rendererRevision: rendererRevision(), preparationOnly: WILDSHARD_PREPARATION_ONLY === '1', time: new Date().toISOString(), describe: gitDescribe(process.cwd()) }));
18
+ writeFileSync(join(outDir, 'version.json'), JSON.stringify({ build, saveEpoch: epoch.saveEpoch, rendererRevision: rendererRevision(), preparationOnly: WILDSHARD_PREPARATION_ONLY === '1', time: new Date(Number(builtAtOf(process.env.WS_BUILT_AT))).toISOString(), describe: gitDescribe(process.cwd()) }));
18
19
  writeFileSync(join(outDir, 'asset-index.json'), assetIndex());
19
20
  writeFileSync(join(outDir, 'asset-manifest.json'), JSON.stringify(hashTree('assets')));
20
21
  }
@@ -15,10 +15,12 @@ import { nameChunksByFinalBytes } from "./app-build/finalChunkNames.mjs";
15
15
  import { writeTitleAssets } from "./title-assets.mjs";
16
16
  import {
17
17
  copyOutputProducts,
18
+ checkPublishedMounts,
18
19
  copyDeferredPublic,
19
20
  pruneLooseCopies,
20
21
  } from "./app-build/outputProducts.mjs";
21
- import { stampBuildDocuments } from "./app-build/buildIdentity.mjs";
22
+ import { buildLabelOf, stampBuildDocuments } from "./app-build/buildIdentity.mjs";
23
+ import { engineRelease } from "./changelog.mjs";
22
24
  import { homeIconChannel, writeHomeIcons } from "./app-build/homeIcons.mjs";
23
25
  import { carryPreviousDeploy, channelOrigin, previousDeployOptional } from "./app-build/previousDeploy.mjs";
24
26
  import { assertAssetLimits, describeAssetLimits } from "./app-build/assetLimits.mjs";
@@ -54,6 +56,8 @@ export function prepareAppBuild() {
54
56
  // C3: a tree with no shard source (the lifted engine) has no list or bake to run; it builds from a catalogue and its packs.
55
57
  const shardSource = existsSync("src/shards");
56
58
  checkBakedTextures(process.cwd(), resolve("public"));
59
+ // A shard-source tree rebuilds out/ from public/ below; only a tree that builds from placed products can hold a stale copy.
60
+ if (!shardSource) checkPublishedMounts(process.cwd());
57
61
  if (shardSource) {
58
62
  step(["scripts/gen-shards.mjs"]);
59
63
  for (const baker of ["bake-chunk", "bake-sky"]) {
@@ -183,6 +187,8 @@ export async function finishAppBuild({ outDir, buildId, mode, deferPublic }) {
183
187
  validator,
184
188
  verdicts: buildValidationReceipts(validator),
185
189
  ...(world === undefined ? {} : { world }),
190
+ // QA 11-13: the static title's build pill, before any bundle (index.html data-launch-progress)
191
+ label: buildLabelOf(buildId, engineRelease(process.cwd())),
186
192
  });
187
193
  // J236: production plain, staging the S, the solo build the P; before the worker reads the final document.
188
194
  writeHomeIcons(outDir, homeIconChannel(world));