@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
@@ -1,6 +1,7 @@
1
1
  // P1-E5.3 I6 (J126), E6: every page runs the real Game and Player against the real server in its worker: the Player predicts and
2
2
  // reconciles, and every creature is an interpolated row drawn by the real views.
3
3
  import type { Scope } from '@wildshard/engine/app/scope';
4
+ import type { DevBox } from '@wildshard/engine/game/devColliders';
4
5
  import type { LiveGridWire } from '../grid/liveSession';
5
6
  import { chosenCell, gotoHosted, pageGoto } from '../../../shared/game/grid/pageMode';
6
7
  import type { SystemSpec } from '@wildshard/engine/app/systems';
@@ -8,6 +9,7 @@ import type { Player } from '@wildshard/engine/player/Player';
8
9
  import { Vector3, type Object3D } from 'three';
9
10
  import { appIdentity } from '@wildshard/engine/app/identity';
10
11
  import { bootMark, bootTask } from '@wildshard/engine/boot/timing';
12
+ import { SEAT_GRACE_MS, seatedInTime } from './seatGrace';
11
13
  import { importPageSaves, openIndexedSaves, serverSaveDatabase, serverStopsForImport, type IndexedSaves } from '@wildshard/engine/saves/indexed';
12
14
  import { saveEnvironment } from '@wildshard/engine/saves/environment';
13
15
  import { jsonSlot } from '@wildshard/engine/saves/slots';
@@ -21,7 +23,7 @@ import type { NetClient } from '@wildshard/engine/net/client';
21
23
  import type { NetCombatEvent } from '@wildshard/engine/net/messages';
22
24
  import type { DeathCause } from '@wildshard/engine/combat/pipeline';
23
25
  import { deviceIdentity, heldName, type NetIdentity } from '@wildshard/engine/net/identity';
24
- import { askNameOnce } from '@wildshard/engine/ui/namePrompt';
26
+ import { askNameToJoin } from '@wildshard/engine/ui/namePrompt';
25
27
  import { NetPlayer, type NetWeapons } from '@wildshard/engine/net/netPlayer';
26
28
  import type { PredictedRow } from '@wildshard/engine/net/predictionWorld';
27
29
  import { ANIMAL_CLASS } from '@wildshard/engine/net/netSchemas';
@@ -127,7 +129,7 @@ function releaseKeep(): ReleaseKeep {
127
129
  }
128
130
  /** E7.2d: the page's seat in the one world, in a shell of the same shape. */
129
131
  interface OnlineModule { readonly startOnline: (config: BuildWorld & { keep: ReleaseKeep; loaded: string; build: string; identity: (name?: string) => NetIdentity; grid?: { readonly cell: string; readonly cells: readonly string[]; readonly placed: (cell: string, at: { readonly x: number; readonly y: number; readonly z: number; readonly yaw: number }) => void; readonly reenter: (cell: string) => void; readonly goto?: boolean } }) => Promise<Shell> }
130
- interface Shell { readonly redials?: true; pause: () => void; hold: (on: boolean) => void; bossGod: () => void; raise: (flag: string) => void; join: (id: string, x: number, y: number, z: number) => { readonly client: NetClient; readonly move: (x: number, y: number, z: number) => void }; readonly client: NetClient; readonly booted: Promise<{ readonly restored: boolean }>; place: (x: number, y: number, z: number, yaw: number) => void; hardHits: (by: number) => void; ready: () => void; leave?: () => Promise<void>; save: () => Promise<{ readonly tick: number; readonly ok: boolean }>; probe: () => Promise<{ readonly tickMs: number }>; dispose: () => void }
132
+ interface Shell { readonly redials?: true; devColliders?: (name: string, boxes: readonly DevBox[]) => void; pause: () => void; hold: (on: boolean) => void; bossGod: () => void; raise: (flag: string) => void; join: (id: string, x: number, y: number, z: number) => { readonly client: NetClient; readonly move: (x: number, y: number, z: number) => void }; readonly client: NetClient; readonly booted: Promise<{ readonly restored: boolean }>; place: (x: number, y: number, z: number, yaw: number) => void; hardHits: (by: number) => void; ready: () => void; leave?: () => Promise<void>; save: () => Promise<{ readonly tick: number; readonly ok: boolean }>; probe: () => Promise<{ readonly tickMs: number }>; dispose: () => void }
131
133
 
132
134
  const SAVE_EVERY_MS = 30_000;
133
135
  /** How long the card waits for the server's first rows, and how often it looks. A server that has booted says them in a tick. */
@@ -165,7 +167,7 @@ export interface WorkerClientReport {
165
167
  }
166
168
  /** A fight as a proof reads it: its row, where its body stands and the server's name for it. */
167
169
  export type WorkerClientFight = EncounterRow & { readonly at: { readonly x: number; readonly y: number; readonly z: number } | null; readonly name: string | null };
168
- declare global { interface Window { __onlinePlayers?: () => OtherPlayers['shown']; __workerClientFights?: () => readonly WorkerClientFight[]; __workerClientHits?: (by: number) => void; __workerClientTravel?: (to: ShardSlug) => void;__workerClientSky?: (name: string) => void; __workerClientTime?: (pick: OptionValue<'time'>) => void; __workerClientRow?: (name: string) => number | undefined; __workerClientFlag?: (flag: string) => void; __workerClientRows?: (kind: string) => readonly { readonly x: number; readonly y: number; readonly z: number }[]; __workerClientGate?: (flag: string) => boolean; __workerClientBot?: (id: string, x: number, y: number, z: number) => { readonly move: (x: number, y: number, z: number) => void; readonly press: (id: string) => void; readonly end: () => void }; __workerClient?: () => WorkerClientReport; __workerClientSave?: () => Promise<void> } }
170
+ declare global { interface Window { __onlinePlayers?: () => OtherPlayers['shown']; __workerClientFights?: () => readonly WorkerClientFight[]; __workerClientHits?: (by: number) => void; __workerClientTravel?: (to: ShardSlug) => void;__workerClientSky?: (name: string) => void; __workerClientTime?: (pick: OptionValue<'time'>) => void; __workerClientRow?: (name: string) => number | undefined; __workerClientFlag?: (flag: string) => void; __workerClientDevColliders?: (name: string, boxes: readonly DevBox[]) => void; __workerClientRows?: (kind: string) => readonly { readonly x: number; readonly y: number; readonly z: number }[]; __workerClientGate?: (flag: string) => boolean; __workerClientBot?: (id: string, x: number, y: number, z: number) => { readonly move: (x: number, y: number, z: number) => void; readonly press: (id: string) => void; readonly end: () => void }; __workerClient?: () => WorkerClientReport; __workerClientSave?: () => Promise<void> } }
169
171
 
170
172
  /** The page's pose inputs, as acts short enough to go. */
171
173
  function poseActs(names: ReadonlySet<string>): readonly string[] {
@@ -345,7 +347,7 @@ async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<type
345
347
  const online = async (world: BuildWorld, storage: SaveStorage): Promise<Shell> => {
346
348
  const { startOnline } = await onlineModule();
347
349
  // MP2.4: a page that came in without the title's PLAY (a link, a reload) asks for the Name here, once per device, before it joins
348
- const answered = await askNameOnce(scope, { parent: document.body, doctor: () => { document.dispatchEvent(new CustomEvent('ws:doctor', { detail: 'join' })); } });
350
+ const answered = await askNameToJoin(scope, { parent: document.body, doctor: () => { document.dispatchEvent(new CustomEvent('ws:doctor', { detail: 'join' })); } });
349
351
  // a page that left while it asked never joins (Codex review): a cancelled load must not take the device's seat
350
352
  if (!answered || scope.disposed) throw new Error('The page left before it joined the world');
351
353
  const { grid } = ports, booted = grid?.booted;
@@ -433,7 +435,8 @@ async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<type
433
435
  let opened: number | undefined, renderTick = 0;
434
436
  if (grid === null) net.inCell = cell => (opened ??= cell) === cell;
435
437
  else {
436
- grid.bindWire({ site: () => { const cell = client.latest?.cell; return cell === undefined ? undefined : siteOf(cell); }, rebound: next => { net.world.rebind(next); }, rows: netNeighbourRegion(client, () => renderTick) });
438
+ grid.bindWire({ site: () => { const cell = client.latest?.cell; return cell === undefined ? undefined : siteOf(cell); }, rebound: next => { net.world.rebind(next); }, rows: netNeighbourRegion(client, () => renderTick),
439
+ flags: () => [...client.phased, ...client.flags()] });
437
440
  net.inCell = cell => siteOf(cell) === grid.frame();
438
441
  }
439
442
  scope.onDispose(() => { player.link = null; ports.weapons.bindWire(null); net.dispose(); });
@@ -450,13 +453,20 @@ async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<type
450
453
  net.bindWeapons(ports.weapons, slotsOf(items));
451
454
  const day = ports.day(); if (day !== null) wirePage.dayPassed(day);
452
455
  });
453
- const { restored } = await bootTask('server:await-booted', () => shell.booted);
456
+ // OF9: a world build (the online shell redials) opens the world without its seat once the grace is up; the shell keeps dialling,
457
+ // the link screens say why, and the seat, when it comes, places the player (GO5). A server in this page boots with it, as before.
458
+ const unseated = shell.redials === true
459
+ && !await seatedInTime(shell.booted, SEAT_GRACE_MS, navigator.onLine, ms => new Promise<void>(resolve => { scope.timeout(ms, resolve); }));
460
+ const { restored } = unseated ? { restored: false } : await bootTask('server:await-booted', () => shell.booted);
461
+ // OF10: unseated, the page plays its own input for the predictor's ring, then holds until the seat
462
+ if (unseated) { bootMark('server:unseated'); net.playUnseated(); }
454
463
  // E7.6: only a world has anyone else in it.
455
464
  let others: OtherPlayers | null = null;
456
465
  if (shell.redials === true) others = new (await import('@wildshard/engine/net/otherPlayers')).OtherPlayers(client, ports.scene, scope, player.position);
457
466
  if (new URLSearchParams(location.search).has('bossGod')) shell.bossGod();
458
467
  bootMark('server:ready-send'); shell.ready();
459
468
  const started = diagnosticNow(), report: WorkerClientReport = { drawn: wirePage.drawn, frames: 0, framesPerSecond: 0, ticksPerSecond: 0, correctionsPerMinute: 0, corrections: 0, retired: {}, spawnMs: {}, missed: net.predictor.missed, misses: net.predictor.misses, worstOffset: 0, queue: 0, replaysPerFrame: 0, delayMs: 0, jitterMs: 0, interpHeld: 0, interpStarved: 0, mainMsP95: 0, workerTickMs: 0, rows: 0, attacks: 0, hits: 0, kills: 0, refused: 0, held: 0, dropped: 0, hp: 0, falls: 0, closed: null, x: 0, z: 0, cell: 0, serverX: 0, serverZ: 0, restored, savedTick: -1, savedOk: false, receipts: [], quests: {}, flags: [], paid: 0, fights: [], owned: {}, sky: null, day: null, clawed: false, own: null, movers: 0, posed: 0, sand: 0 };
469
+ if (unseated) void shell.booted.then(answer => { report.restored = answer.restored; bootMark('server:seated-late'); return undefined; }, () => undefined);
460
470
  scope.onDispose(client.onLedger(receipt => { report.receipts.push(`${receipt.grant}:${receipt.name}`); }));
461
471
  const contacts: NetCombatEvent[] = [];
462
472
  scope.onDispose(client.onTravel(() => { contacts.length = 0; }));
@@ -571,6 +581,8 @@ async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<type
571
581
  window.__onlinePlayers = () => others?.shown ?? [];
572
582
  window.__workerClientHits = by => { shell.hardHits(by); };
573
583
  window.__workerClientFlag = flag => { shell.raise(flag); };
584
+ // SHARD-SOURCE AP5: the dev hook's `swapColliders` reaches the in-page server here (DEVSERVER only: the define folds it away)
585
+ if (typeof __DEVSERVER__ === 'boolean' && __DEVSERVER__) window.__workerClientDevColliders = (name, boxes) => { shell.devColliders?.(name, boxes); };
574
586
  window.__workerClientTravel = to => { travel({ to, mode: 'enter' }); };
575
587
  window.__workerClientSky = name => { wirePage.climate({ op: 'force', name, at: 0.1 }); };
576
588
  window.__workerClientTime = pick => { saveSetting('time', pick); };
@@ -612,7 +624,8 @@ async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<type
612
624
  const off = scope.capture('disposers', resolve);
613
625
  scope.timeout(FIRST_ROWS_POLL_MS, () => { off(); resolve(); });
614
626
  });
615
- const firstBy = diagnosticNow() + FIRST_ROWS_MS;
627
+ // OF9: an unseated page has no rows to wait for: the world opens now
628
+ const firstBy = unseated ? 0 : diagnosticNow() + FIRST_ROWS_MS;
616
629
  while (client.latest === null && diagnosticNow() < firstBy && !scope.disposed && !scope.disposing) await poll();
617
630
  if (scope.disposed || scope.disposing) return;
618
631
  net.reconcile(false);
@@ -621,7 +634,7 @@ async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<type
621
634
  if (ports.linkBodies === undefined) { bootMark('server:launch-complete'); return; }
622
635
  bootMark('server:first-body-preparation-start');
623
636
  let first = -1;
624
- const until = diagnosticNow() + FIRST_ROWS_MS;
637
+ const until = unseated ? 0 : diagnosticNow() + FIRST_ROWS_MS;
625
638
  while (diagnosticNow() < until) {
626
639
  renderTick = client.present();
627
640
  if (first === -1 && client.latest !== null) first = client.latest.tick;
@@ -3,6 +3,7 @@ import type { LookStrategy } from '@wildshard/engine/render/look';
3
3
  import type { Shardfile } from '@wildshard/format/shardSchema';
4
4
  import { lookLightManifest } from '@wildshard/engine/render/lookLight';
5
5
  import { lookLightOn } from '@wildshard/engine/ui/lookLightOption';
6
+ import { TIER } from '@wildshard/engine/core/tier';
6
7
 
7
8
  /**
8
9
  * A shardfile's file reference → its URL: products sit beside the page that embeds `shard.json` (the SDK build writes
@@ -17,7 +18,11 @@ export function shardfileFileUrl(ref: string): string { return `./${ref.replace(
17
18
  export function shardfileLook(look: Shardfile['look'], assets?: ReadonlyMap<string, Uint8Array>, light: boolean = lookLightOn()): LookStrategy {
18
19
  const lut = look.grade.lut === null ? null : assets?.get(look.grade.lut) ?? shardfileFileUrl(look.grade.lut);
19
20
  if (assets !== undefined && look.grade.lut !== null && !assets.has(look.grade.lut)) throw new Error('Missing admitted look LUT');
20
- const resolved = lookLightManifest(look, light);
21
- return dataLook({ day: look.day ?? DATA_LOOK_DAY, dayOverride: look.dayOverride, keys: look.keys, lut,
22
- light: { rim: resolved.rim, pools: resolved.pools, heightFogDensity: resolved.atmosphere.fogHeightDensity } });
21
+ const resolved = lookLightManifest(look, light, TIER);
22
+ // B2: `grade.tone` is a grade choice, not a light setting: it holds on every tier, with or without the row (so do M4.7's
23
+ // exposure and vignette); the bloom radius rides the bloom, which the row and the tier gate
24
+ return dataLook({ day: look.day ?? DATA_LOOK_DAY, dayOverride: look.dayOverride, keys: look.keys, lut, neutral: look.grade.tone === 'neutral', aces: look.grade.tone === 'aces',
25
+ exposure: look.grade.exposure, vignette: look.grade.vignette ?? null, bloomRadius: resolved.bloom.radius,
26
+ light: { rim: resolved.rim, pools: resolved.pools, heightFogDensity: resolved.atmosphere.fogHeightDensity, lamps: resolved.lamps, bounce: resolved.bounce, environment: resolved.environment,
27
+ shadow: resolved.shadow, motes: resolved.motes } });
23
28
  }
@@ -14,10 +14,10 @@ import { isOutputIndex } from '@wildshard/format/outputAddress';
14
14
  import { builtIndexHash } from '@wildshard/format/builtIndexes';
15
15
 
16
16
  import { acceptValidatedCost } from '@wildshard/format/deviceMemoryCost';
17
- import { ASSET_CACHE_NAME } from '@wildshard/engine/pwa/cacheNames';
17
+ import { assetCacheName } from '@wildshard/engine/pwa/cacheNames';
18
18
  import { saves } from '@wildshard/engine/saves/runtime';
19
19
  import { contentHash } from '../../../shared/game/shardfile/contentHash';
20
- import { packReads } from '../../../shared/game/shardfile/packReads';
20
+ import { packOrLoose, packReads } from '../../../shared/game/shardfile/packReads';
21
21
  import { productResourceRole } from '../../../shared/game/shardfile/resourceRole';
22
22
  import { preflightProduct } from './productPreflight';
23
23
 
@@ -107,6 +107,10 @@ export interface ProductOptions {
107
107
  memory?: MemoryAdmission;
108
108
  /** Trusted residency owner reserves parsed source and immutable transport before any asset-cache read or owned copy. */
109
109
  reserve?: (source: Shardfile) => void | Promise<void>;
110
+ /** GC9: files the trusted owner releases straight after admission (a grid neighbour's runtime-only wires, read back
111
+ * from cache or network by its inputs). A first-party read leaves them unread instead of fetching and dropping them;
112
+ * checked admission still reads every file. */
113
+ deferred?: (source: Shardfile) => Promise<readonly string[]>;
110
114
  /** Trusted presentation observer; it does not participate in admission decisions. */
111
115
  progress?: (progress: ProductProgress) => void;
112
116
  /** Trusted presentation scheduling between complete checks; validation never skips work. */
@@ -144,6 +148,8 @@ export interface AdmittedProduct {
144
148
  releasePreparedTransport?: (refs: Iterable<string>, reread?: 'cache-or-fetch') => Promise<readonly string[]>;
145
149
  /** Complete verified offline storage after control, without retaining the distant files on the page. */
146
150
  completeCache?: (scope: Scope) => Promise<void>;
151
+ /** GC9: selected files a first-party read left unread (`ProductOptions.deferred`): still this product's inputs, read back on demand. */
152
+ unread?: readonly string[];
147
153
  }
148
154
 
149
155
  // Construct outside admission's decoding context: the owner must not retain the temporary hash/transport maps.
@@ -388,7 +394,9 @@ async function readBuiltProduct(input:unknown,options:ProductOptions,read:NonNul
388
394
  if(!isBuildValidatedOutput(source))throw new Error('First-party reader did not assemble its build output');
389
395
  await options.reserve?.(source);
390
396
  const selected=options.tier===undefined?source.files:await tierProductFilesPaced(source,options.tier,options.pause,options.splatTier);
391
- const initial=options.tier==='phone'?controlFiles(await playLibrarySourcePaced(source,options.pause),selected):selected;
397
+ const control=options.tier==='phone'?controlFiles(await playLibrarySourcePaced(source,options.pause),selected):selected;
398
+ const deferred=options.deferred===undefined?undefined:new Set(await options.deferred(source));
399
+ const initial=deferred===undefined?control:control.filter(file=>!deferred.has(file.hash));
392
400
  const base=new URL('.',options.base).href,assets=new Map<string,Uint8Array>();
393
401
  const refs=[...initial.map(file=>({ref:file.hash,bytes:file.compressed})),...source.requires.commons.map(hash=>({ref:`commons:${hash}`,bytes:source.requires.commonsWire[hash]??0}))];
394
402
  const unique=new Map(refs.map(row=>[row.ref.replace(/^commons:/u,''),row]));
@@ -411,7 +419,21 @@ async function readBuiltProduct(input:unknown,options:ProductOptions,read:NonNul
411
419
  wires.set(row.ref.replace(/^commons:/u,''),result.bytes);
412
420
  }
413
421
  for(const row of refs){const bytes=wires.get(row.ref.replace(/^commons:/u,''));if(bytes===undefined)throw new Error('Missing built file bytes');assets.set(row.ref,bytes);}
414
- return {source,assets,cached:false,releaseTransport:transportRelease(source,assets,options),releasePreparedTransport:transportRelease(source,assets,options,true)};
422
+ const unread=deferred===undefined?[]:control.filter(file=>deferred.has(file.hash));
423
+ // GC9: the files left unread are fetched once more in the background, low priority and unhashed, so the entry's own
424
+ // verified reads of them find the HTTP cache warm (Pine's scene libraries read them one by one at entry); only after a read
425
+ // that succeeded
426
+ const warm=options.backgroundFetch;
427
+ if(unread.length>0&&warm!==undefined)void warmTransport(unread.map(file=>outputBlobUrl(source,file.hash,base)),warm);
428
+ return {source,assets,cached:false,...(deferred===undefined?{}:{unread:unread.map(file=>file.hash)}),releaseTransport:transportRelease(source,assets,options),releasePreparedTransport:transportRelease(source,assets,options,true)};
429
+ }
430
+ /** GC9: fetch immutable product files into the HTTP cache, eight at a time, ignoring failures (a later verified read fetches again). */
431
+ async function warmTransport(urls:readonly string[],fetchLow:NonNullable<ProductOptions['backgroundFetch']>):Promise<void>{
432
+ let next=0;
433
+ const worker=async():Promise<void>=>{
434
+ while(next<urls.length){const url=urls[next++];if(url===undefined)return;try{await (await fetchLow(url)).arrayBuffer();}catch{/* the entry's verified read fetches it */}}
435
+ };
436
+ await Promise.all(Array.from({length:Math.min(8,urls.length)},worker));
415
437
  }
416
438
  /** Drain a bounded window before refusal or publication; cache operations keep their authored error order. */
417
439
  async function cacheRows<T>(rows: readonly T[], batch: boolean, work: (row: T) => Promise<void>): Promise<void> {
@@ -565,8 +587,13 @@ async function admitProductWork(input: unknown, options: ProductOptions, trace?:
565
587
  if (bytes === null || bytes === undefined) {
566
588
  if (options.offline) throw new Error('Visited shardfile has an incomplete offline cache');
567
589
  progress('assets', `Fetching ${role}`, url);
568
- if (inPack && packed !== undefined) { bytes = await waitFor(`Pack member · ${role}`, packed.read(hash), 'file', url); bytesRead += bytes.length; }
569
- else bytes = await boundedResponse(await options.fetch(url), cap, (size) => { bytesRead += size; progress('assets', `Reading ${role}`, url); });
590
+ const loose = async (): Promise<Uint8Array> => boundedResponse(await options.fetch(url), cap, (size) => { bytesRead += size; progress('assets', `Reading ${role}`, url); });
591
+ // PZ7: a pack that is not published (or fails) falls back to the member's loose blob
592
+ if (inPack && packed !== undefined) {
593
+ let fromPack = true;
594
+ bytes = await waitFor(`Pack member · ${role}`, packOrLoose(() => packed.read(hash), () => { fromPack = false; return loose(); }), 'file', url);
595
+ if (fromPack) bytesRead += bytes.length;
596
+ } else bytes = await loose();
570
597
  } else { bytesRead += bytes.length; progress('assets', `Cached ${role}`, url); }
571
598
  if (bytes.length !== cap) throw new Error('Shardfile asset wire size differs from declaration');
572
599
  progress('hash', `Verifying ${role}`, url);
@@ -686,7 +713,7 @@ async function admitProductWork(input: unknown, options: ProductOptions, trace?:
686
713
  * browser reads use native fetch, without a page index, leases or worker. */
687
714
  export function browserProductCache(storage: Pick<CacheStorage, 'open'>,
688
715
  preparation: Pick<ProductOptions, 'pause' | 'parseJson'> = {}): ProductCache {
689
- const open = () => storage.open(ASSET_CACHE_NAME);
716
+ const open = () => storage.open(assetCacheName());
690
717
  const productUrl = (base: string) => new URL('__visited_shardfile__', base).href;
691
718
  const assetUrl = (base: string, hash: string): string => {
692
719
  if (!HASH.test(hash)) throw new Error('Invalid content hash');
@@ -17,7 +17,7 @@ export async function prepareCheckedProduct(source: Shardfile): Promise<boolean>
17
17
  if (!isBuildValidatedOutput(source)) throw new Error('Shardfile needs server validation before client admission');
18
18
  return false;
19
19
  }
20
- const checked = await import('@wildshard/format/product');
20
+ const checked = await import('@wildshard/format/shardfileAssets');
21
21
  await checked.prepareAssetDecoders();
22
22
  checked.preflightAssetGraph(source);
23
23
  return true;
@@ -33,7 +33,7 @@ export async function checkedProductCosts(source: Shardfile, memory: MemoryAdmis
33
33
  export async function validateCheckedProductAssets(source: Shardfile, assets: ReadonlyMap<string, Uint8Array>, hash: (bytes: Uint8Array) => string,
34
34
  memory: MemoryAdmission | undefined, textures: TextureTranscodeSupport | undefined, sections: ReadonlyMap<string, unknown> | undefined, decodersReady: boolean): Promise<void> {
35
35
  if (!(import.meta.env?.SSR ?? true)) throw new Error('Shardfile needs server validation before client admission');
36
- if (!decodersReady) await (await import('@wildshard/format/product')).prepareAssetDecoders();
36
+ if (!decodersReady) await (await import('@wildshard/format/shardfileAssets')).prepareAssetDecoders();
37
37
  const { validateShardfileAssets } = await import('@wildshard/format/assetAdmission');
38
38
  const { scriptAdmissionRows } = await import('@wildshard/format/scriptContract');
39
39
  validateShardfileAssets(source, assets, hash, memory, textures, scriptAdmissionRows(sections));
@@ -14,7 +14,7 @@ import { preflightShardfile, preflightShardfileSteps } from '@wildshard/format/p
14
14
  import { jsonDataHeapBytes } from '@wildshard/format/json';
15
15
  import { outputDescriptor, isBuildValidatedOutput } from '../../../shared/game/shardfile/outputDescriptor';
16
16
  import { otherTierSplatFiles } from '../../../shared/game/shardfile/wholeInputs';
17
- import {builtProductPostCost} from '@wildshard/format/validationReceipt';
17
+ import {builtShardfilePostCost} from '@wildshard/format/validationReceipt';
18
18
  import {postStackCost,type PostStackCost} from '@wildshard/format/postStack';
19
19
  import { isPlatformDataSection } from '@wildshard/format/outputFields';
20
20
  import { parseWorldScenes } from '@wildshard/format/worldScenes';
@@ -306,7 +306,7 @@ export function jsonResidentBytes(input: unknown): number {
306
306
  export function productPostCost(source:Shardfile,bytes:(hash:string)=>Uint8Array|undefined):PostStackCost{
307
307
  const descriptor=outputDescriptor(source);
308
308
  if(descriptor?.built===true){
309
- const cost=builtProductPostCost(descriptor.index.build.sourceHash);
309
+ const cost=builtShardfilePostCost(descriptor.index.build.sourceHash);
310
310
  if(cost===undefined)throw new Error('Build must publish post cost');
311
311
  return cost;
312
312
  }
@@ -1,5 +1,5 @@
1
1
  import { readContent, type ContentReadOptions } from '@wildshard/engine/boot/contentRead';
2
- import { ASSET_CACHE_NAME } from '@wildshard/engine/pwa/cacheNames';
2
+ import { assetCacheName } from '@wildshard/engine/pwa/cacheNames';
3
3
  import { SHARDFILE_ADMISSION_LIMITS as limits } from '@wildshard/format/admissionLimits';
4
4
 
5
5
  interface AssetStorePort { open: (name: string) => Promise<Pick<Cache, 'put'>> }
@@ -36,7 +36,7 @@ export async function readAsset(url: string, bytes: number | undefined, options:
36
36
  } });
37
37
  options.signal?.throwIfAborted();
38
38
  if (copy !== undefined && publication !== undefined) {
39
- try { await (await publication.open(ASSET_CACHE_NAME)).put(url, copy); }
39
+ try { await (await publication.open(assetCacheName())).put(url, copy); }
40
40
  catch { /* Disk denial never rejects complete online bytes. */ }
41
41
  }
42
42
  return result;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * A pool's declared surface (meta TEMPLATES-CLEANROOM M4.1/M4.6, `@wildshard/format/pool-surface`): how its water draws.
3
+ *
4
+ * - `reflect: 'planar'` on the desktop tier: a mirror of the scene (three's `Reflector`, one extra scene draw per frame
5
+ * while the pool is in view, at `resolution` texels, 512 absent), its UVs rippled in world space, a Fresnel blend of the
6
+ * reflection over the deep `tint` (face-on `fresnel[0]`, rising by the power `fresnel[1]` toward grazing).
7
+ * - `reflect: 'sky'`, and `planar` on the phone tier: the engine's default water surface (`defaultWaterMaterial`), opaque
8
+ * in `tint` with the surface's Fresnel and ripple: the look's sky and sun reflected, no second scene draw.
9
+ *
10
+ * The cleanroom pond this ports (mossgate-cleanroom `src/main.js`) is a 1024² reflector, tint `#3a3458`, Fresnel 0.35 +
11
+ * 0.65·(1 − v·y)³; the milky pond it replaces was the default surface's 0.7 alpha over a fog-coloured sky.
12
+ */
13
+ import { CircleGeometry, Color, Shape, ShapeGeometry, Vector2, type BufferGeometry, type Mesh, type ShaderMaterial } from 'three';
14
+ import { Reflector } from 'three/examples/jsm/objects/Reflector.js';
15
+ import type { PoolSurface } from '@wildshard/format/pool-surface';
16
+
17
+ /** the mirror's texels on a side when the surface names none */
18
+ export const DEFAULT_MIRROR_TEXELS = 512;
19
+ /** how far the mirror's clip plane sits under the water (metres): keeps the bank's foot out of its own reflection */
20
+ const CLIP_BIAS = 0.003;
21
+
22
+ /** A pool's outline in its own x / y plane (z negated, so a −90° turn about x lays it on the ground as declared). */
23
+ export function poolPlane(shape: { readonly kind: 'circle'; readonly x: number; readonly z: number; readonly radius: number } | { readonly kind: 'polygon'; readonly points: readonly (readonly [number, number])[] }): BufferGeometry {
24
+ if (shape.kind === 'circle') return new CircleGeometry(shape.radius, 32).translate(shape.x, -shape.z, 0);
25
+ return new ShapeGeometry(new Shape(shape.points.map(([x, z]) => new Vector2(x, -z))), 12);
26
+ }
27
+
28
+ const VERTEX = /* glsl */`
29
+ uniform mat4 textureMatrix;
30
+ varying vec4 vMirror; varying vec3 vWorld;
31
+ void main() {
32
+ vMirror = textureMatrix * vec4(position, 1.0);
33
+ vWorld = (modelMatrix * vec4(position, 1.0)).xyz;
34
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
35
+ }`;
36
+ // linear out (the composer tone-maps): the rippled mirror over the tint, by Fresnel
37
+ const FRAGMENT = /* glsl */`
38
+ uniform sampler2D tDiffuse; uniform vec3 color; uniform float uTime; uniform vec3 uTint; uniform vec2 uFresnel; uniform vec3 uRipple;
39
+ varying vec4 vMirror; varying vec3 vWorld;
40
+ void main() {
41
+ vec2 w = vWorld.xz * uRipple.x, t = vec2(uTime * uRipple.z);
42
+ vec2 d = vec2(sin(w.x * 1.03 + t.x * 1.3) + sin(w.y * 0.77 - t.x * 0.9), cos(w.y * 1.23 + t.x * 1.1) + sin(w.x * 0.57 + w.y * 0.7 + t.x)) * uRipple.y;
43
+ vec4 uv = vMirror; uv.xy += d * uv.w;
44
+ vec3 mirror = texture2DProj(tDiffuse, uv).rgb * color;
45
+ vec3 v = normalize(cameraPosition - vWorld);
46
+ float fresnel = uFresnel.x + (1.0 - uFresnel.x) * pow(1.0 - max(v.y, 0.0), uFresnel.y);
47
+ gl_FragColor = vec4(mix(uTint, mirror, fresnel), 1.0);
48
+ }`;
49
+
50
+ /** A planar-reflecting pool: a `Reflector` laid on the ground at `level`; `tick(dt)` runs its ripples on the game clock. */
51
+ export function mirrorPool(shape: Parameters<typeof poolPlane>[0], level: number, surface: PoolSurface): { mesh: Mesh; tick: (dt: number) => void; dispose: () => void } {
52
+ const texels = surface.resolution ?? DEFAULT_MIRROR_TEXELS;
53
+ const mirror = new Reflector(poolPlane(shape), {
54
+ textureWidth: texels, textureHeight: texels, clipBias: CLIP_BIAS, multisample: 0,
55
+ // a faint cool cast on the mirror, as the cleanroom's (0.82, 0.76, 0.84)
56
+ color: new Color(0.82, 0.78, 0.86),
57
+ shader: {
58
+ name: 'engine.water.mirror',
59
+ uniforms: { color: { value: null }, tDiffuse: { value: null }, textureMatrix: { value: null }, uTime: { value: 0 },
60
+ uTint: { value: new Color().setRGB(surface.tint[0], surface.tint[1], surface.tint[2]) },
61
+ uFresnel: { value: new Vector2(surface.fresnel[0], surface.fresnel[1]) },
62
+ uRipple: { value: [surface.ripple.scale, surface.ripple.amplitude, surface.ripple.speed] } },
63
+ vertexShader: VERTEX, fragmentShader: FRAGMENT,
64
+ },
65
+ });
66
+ mirror.rotation.x = -Math.PI / 2;
67
+ mirror.position.y = level;
68
+ mirror.updateMatrixWorld();
69
+ const material = mirror.material as ShaderMaterial, time = material.uniforms['uTime'];
70
+ let clock = 0;
71
+ const tick = (dt: number): void => { clock += dt; if (time !== undefined) time.value = clock; };
72
+ return { mesh: mirror, tick, dispose: () => { mirror.dispose(); mirror.geometry.dispose(); } };
73
+ }
@@ -0,0 +1,9 @@
1
+ /** OFFLINE OF9 (J298, Jake 2026-11-12: "Load into the world. And then have a really hard time moving around"): how long a world
2
+ * build's load waits for its seat before it opens the world without one. A seat in time keeps QA row 29's reveal at the saved place;
3
+ * a page that knows it is offline doesn't wait at all. */
4
+ export const SEAT_GRACE_MS = 1500;
5
+ /** OF9: whether the seat comes within `graceMs` (the page's link known down: no wait). A pure race, so a test pins it. */
6
+ export function seatedInTime(booted: Promise<unknown>, graceMs: number, online: boolean, wait: (ms: number) => Promise<void>): Promise<boolean> {
7
+ if (!online) return Promise.resolve(false);
8
+ return Promise.race([booted.then(() => true, () => true), wait(graceMs).then(() => false)]);
9
+ }
@@ -14,7 +14,7 @@ import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js
14
14
  import { bindRig, prepareRigLoader, type ClipName, type RigInstance } from '@wildshard/engine/anim/rig';
15
15
  import { AnimMachine } from '@wildshard/engine/anim/machine';
16
16
  import type { Scope } from '@wildshard/engine/app/scope';
17
- import type { AssetCost } from '@wildshard/format/product';
17
+ import type { AssetCost } from '@wildshard/format/shardfileAssets';
18
18
  import { parseGlbData, prepareGlbCost } from '@wildshard/format/glbCost';
19
19
  import { skinLayerDecoded } from '@wildshard/format/skinLayers';
20
20
  import { parseSkinBindings, type SkinRow, type SkinBinding } from '@wildshard/format/skinData';
@@ -14,6 +14,7 @@ import { standingFigure, type FigureSkinState } from './standingFigure';
14
14
  import { skinEnvelope } from '../../grid/skinEnvelope';
15
15
 
16
16
  const skins = new FigureSkins();
17
+ const rootAt = new THREE.Vector3();
17
18
  const entered = new WeakMap<Scope, Map<string, Set<FigureRows>>>();
18
19
  function sourceId(ref: ScenePointRef): string {
19
20
  if (!('part' in ref)) throw new Error('Figure object requires a scene part');
@@ -139,6 +140,14 @@ export class FigureRows {
139
140
  private refreshPoint(): void {
140
141
  this.group.updateWorldMatrix(true, false);
141
142
  this.talkPoint.set(0, this.row.talkHeight, 0).applyMatrix4(this.group.matrixWorld);
143
+ // A figure on a borrowed root is placed after it is built (a kit figure's group goes to its feet once made): its body
144
+ // stands where the root is now, so a registry piece that follows the root holds it at the feet, not at the origin
145
+ // (SERVER-PARITY SS10b, Driftwood's Wendell). A standing person keeps its own collider (`update`).
146
+ if (this.person === undefined) {
147
+ const at = rootAt.setFromMatrixPosition(this.group.matrixWorld), box = this.row.collider;
148
+ this.collider.x = at.x; this.collider.z = at.z;
149
+ this.collider.yTop = at.y + (box?.kind === 'box' ? box.top : 0); this.collider.yBottom = at.y - (box?.kind === 'box' ? box.bottom : 0);
150
+ }
142
151
  }
143
152
  /** Refresh a borrowed pivot figure's world prompt without advancing its law. */
144
153
  syncAnchors(): void { if (this.live) this.refreshPoint(); }
@@ -36,7 +36,7 @@ import { readSummary, summaryView } from './summary';
36
36
  import { GAME_STRINGS } from '../../shared/game/strings';
37
37
  import { menuMode, selectEnters, selectExplores, type MenuMode } from './grid/menu';
38
38
  import { pageShardRefusals, refusalReason, type ShardRefusal } from './grid/refusal';
39
- import { autoPlaced, playerHidden, titleStatus } from '../../shared/game/grid/catalogueSlot';
39
+ import { autoPlaced, placedByFile, playerHidden, titleStatus } from '../../shared/game/grid/catalogueSlot';
40
40
  import { worldOpens } from './grid/oneWayIn';
41
41
  import './summary.css';
42
42
  import './upgrade.css';
@@ -82,8 +82,9 @@ const buildWorld = (): OpensShard => worldOpens((globalThis as { __WS_WORLD__?:
82
82
  export function titleCards(showHidden: boolean = isDev(), upgradeNeeded: UpgradeNeeded = noUpgrades, refused: RefusedShard = sessionRefusals, opens: OpensShard = buildWorld()): readonly TitleCard[] {
83
83
  // a `_` prototype stays Developer only unless its catalogue placement opens it (J313: Mossgate)
84
84
  const hidden = (m: TitleManifest): boolean => playerHidden(m);
85
- // SA34 (Q12): an auto-placed shard has no card, even for Developer: you cross in from a neighbour
86
- const ordinary = titleManifests().filter(m => m.shardSelect !== false && !autoPlaced(m));
85
+ // SA34 (Q12): an auto-placed shard has no card, even for Developer: you cross in from a neighbour. A cell the page learned from its
86
+ // channel's placement file (`placedCells.ts`) has one: with crossing off, its card and `?chunk=` are the only ways in
87
+ const ordinary = titleManifests().filter(m => (m.shardSelect !== false && !autoPlaced(m)) || placedByFile(m));
87
88
  const visible = ordinary.filter((m) => !hidden(m));
88
89
  const manifests = showHidden ? [...visible, ...ordinary.filter(hidden)] : visible;
89
90
  return manifests.map((m): TitleCard => titleCard(m, upgradeNeeded, refused, opens));
@@ -173,6 +173,8 @@ async function checkServer(learned: Learned, ms: number): Promise<Outcome> {
173
173
  // D7: behind Cloudflare the rooms address keeps /health private (404, no CORS), so the opaque answer is all a page gets.
174
174
  return pass(`${new URL(url).host} reachable · health is private`);
175
175
  } catch {
176
+ // PZ12 (J274): an isolated page (COEP require-corp) is refused the opaque answer itself, so a failure proves nothing
177
+ if (globalThis.crossOriginIsolated) return warn(`${new URL(url).host}: health is private`, `This page is cross-origin isolated, so it cannot read ${new URL(url).host}'s private health answer. If play fails, tell Jake.`);
176
178
  return fail(`${new URL(url).host}: no answer`, `Server unreachable: ${new URL(url).host} is down, its TLS is failing, or the server is stopped. Tell Jake.`);
177
179
  }
178
180
  }
@@ -169,7 +169,7 @@ export function linkScreens(scope: Scope, hooks: LinkScreenHooks, parent: HTMLEl
169
169
  parent.append(banner, deploy);
170
170
 
171
171
  let state: LinkState = 'live', reason: string | undefined, wasDown = false, quietUntil = 0, deployLeft = 0, deployTicking = false;
172
- let open: { scope: Scope; root: HTMLElement; kind: 'hold' | 'stop'; paint: () => void; what?: string; chat?: boolean; key?: string } | null = null;
172
+ let open: { scope: Scope; root: HTMLElement; kind: 'hold' | 'stop' | 'offline'; paint: () => void; what?: string; chat?: boolean; key?: string } | null = null;
173
173
  const held: { text: string; send: (text: string) => void; drop: () => void }[] = [];
174
174
  const down = (): boolean => state === 'reconnecting' || state === 'resuming';
175
175
 
@@ -180,10 +180,11 @@ export function linkScreens(scope: Scope, hooks: LinkScreenHooks, parent: HTMLEl
180
180
  // a card takes the pointer back from the game (desktop pointer lock), so its buttons can be clicked
181
181
  const freePointer = (): void => { if ('exitPointerLock' in document && document.pointerLockElement instanceof Element) document.exitPointerLock(); };
182
182
  const paintBanner = (): void => {
183
- const shown = down();
183
+ // offline, the card is the screen (FM4b mode 2): no banner under it
184
+ const shown = down() && hooks.why() !== 'offline';
184
185
  banner.hidden = !shown;
185
186
  // a link that is down takes the top band from the deploy countdown; the countdown comes back with the link
186
- deploy.hidden = shown || deployLeft <= 0;
187
+ deploy.hidden = down() || deployLeft <= 0;
187
188
  if (!shown) return;
188
189
  const said = bannerFor(state, hooks.why(), hooks.progress().dials);
189
190
  banner.dataset['failmode'] = said.ids; banner.dataset['tone'] = said.tone; banner.dataset['state'] = state;
@@ -201,7 +202,8 @@ export function linkScreens(scope: Scope, hooks: LinkScreenHooks, parent: HTMLEl
201
202
  };
202
203
  /** The hold card: the banner opened up, on a tap it can't carry. It repaints each second from the dial's progress. */
203
204
  const hold = (what: string, chat: boolean): void => {
204
- if (open?.kind === 'stop') return;
205
+ // the offline card already says why nothing goes out; a held chat line still waits for the link
206
+ if (open?.kind === 'stop' || open?.kind === 'offline') return;
205
207
  remember(); open?.scope.dispose(); open = null;
206
208
  const own = scope.child('online.hold'), said = bannerFor(state, hooks.why(), hooks.progress().dials);
207
209
  const title = chat ? 'Your message will send when you\'re back' : state === 'resuming' ? 'Still reconnecting' : hooks.why() === 'restart' ? 'The world is restarting' : 'Not connected yet';
@@ -248,6 +250,28 @@ export function linkScreens(scope: Scope, hooks: LinkScreenHooks, parent: HTMLEl
248
250
  root.querySelector('button')?.focus();
249
251
  };
250
252
  const doctor = (from: string): { label: string; busy: string; act: () => void }[] => hooks.doctor === undefined ? [] : [{ label: 'Check connection', busy: 'Opening…', act: () => { hooks.doctor?.(from); } }];
253
+ /**
254
+ * FM4b mode 2 (`offline-play`): the device says it has no network. Play waits under the card, the dial waits for the network
255
+ * (Redial's `offline`), and the card closes by itself when the network is back (the banner takes over) or the link is.
256
+ * J229: no seat-hold or save time is claimed, only what this page measured.
257
+ */
258
+ const offlineCard = (): void => {
259
+ if (open?.kind === 'offline') return;
260
+ remember(); open?.scope.dispose(); open = null;
261
+ const own = scope.child('online.offline'), { root, box } = card(own, 'offline-play', 'warn', 'Connection dropped', 'You\'re offline');
262
+ box.append(make('p', 'ws-link-body', 'This device lost its internet connection. The world needs it to carry on.'));
263
+ const status = make('ul', 'ws-link-facts'), waiting = make('li');
264
+ status.setAttribute('role', 'status'); status.append(waiting);
265
+ const paint = (): void => { waiting.replaceChildren(ring(), `Down for ${String(Math.floor(hooks.progress().downMs / 1000))} s`); };
266
+ paint(); own.interval(1000, paint);
267
+ box.append(status, make('p', 'ws-link-auto', 'We\'ll connect again by ourselves as soon as the network is back. Nothing is sent while you\'re offline.'));
268
+ const actions = doctor('offline-play');
269
+ if (actions.length > 0) box.append(buttons(own, actions));
270
+ const details = make('details'); details.append(make('summary', '', 'Details'), make('p', '', 'navigator.onLine is false · dialling waits for "online"')); box.append(details);
271
+ parent.append(root); freePointer();
272
+ open = { scope: own, root, kind: 'offline', paint };
273
+ root.querySelector('button')?.focus();
274
+ };
251
275
 
252
276
  const link = (next: LinkState, why?: string): void => {
253
277
  state = next; reason = why;
@@ -256,6 +280,8 @@ export function linkScreens(scope: Scope, hooks: LinkScreenHooks, parent: HTMLEl
256
280
  if (down()) {
257
281
  wasDown = true; unnotice();
258
282
  if (open?.kind === 'stop') close();
283
+ if (hooks.why() === 'offline') { offlineCard(); return; }
284
+ if (open?.kind === 'offline') close();
259
285
  // a hold card follows its banner: a new cause (silent to restart) or 35 s down redraws it, else it just ticks
260
286
  if (open?.kind === 'hold' && open.key !== `${state}:${hooks.why()}` && open.what !== undefined) hold(open.what, open.chat === true); else open?.paint();
261
287
  return;
@@ -7,6 +7,7 @@ import { NetClient } from '@wildshard/engine/net/client';
7
7
  import type { NetIdentity } from '@wildshard/engine/net/identity';
8
8
  import { Redial, type LinkCause, type LinkProgress, type LinkState } from '@wildshard/engine/net/redial';
9
9
  import { decodeCountdown, type Countdown } from '@wildshard/engine/net/socketFrames';
10
+ import { encodeDeviceWord, worldReadsDevice } from '@wildshard/engine/net/deviceWord';
10
11
  import { WebSocketTransport } from '@wildshard/engine/net/webSocketTransport';
11
12
  import {NetRecords} from '@wildshard/engine/net/netRecord';
12
13
  import {onlineTelemetry} from '@wildshard/engine/telemetry/runtime';
@@ -90,6 +91,17 @@ export interface OnlineShell {
90
91
  dispose: () => void;
91
92
  }
92
93
 
94
+ /** DT3: how long a socket's device word waits for the renderer to name its GPU before it goes without it. */
95
+ const DEVICE_GPU_WAIT_MS = 10_000;
96
+ /** DT3: this page's device snapshot on `transport` (a closed one drops it). Telemetry: never throws, never holds the link. */
97
+ function sendDevice(transport: WebSocketTransport, build: string): void {
98
+ const send = async (): Promise<void> => {
99
+ const { deviceSnapshot } = await import('@wildshard/engine/telemetry/deviceSnapshot');
100
+ transport.control('device', encodeDeviceWord({ ...await deviceSnapshot(DEVICE_GPU_WAIT_MS), build }));
101
+ };
102
+ void send().catch(() => undefined);
103
+ }
104
+
93
105
  /** The link alone, with no page around it. `startOnline` is this with the strips. */
94
106
  export function connectOnline(config: OnlineConfig, view: OnlineView): OnlineShell {
95
107
  let playtest=false;
@@ -103,6 +115,8 @@ export function connectOnline(config: OnlineConfig, view: OnlineView): OnlineShe
103
115
  transport.onClose(() => { if (link === transport) down = true; });
104
116
  transport.onControl((control, bytes) => {
105
117
  if(control==='playtest'){playtest=true;return;}
118
+ // DEVICE-TELEMETRY DT3: a door whose first word says it reads the device word hears this page's snapshot, once per socket
119
+ if (control === 'world') { if (worldReadsDevice(bytes)) sendDevice(transport, config.build); return; }
106
120
  if (control === 'voice') {
107
121
  let word: VoiceHeard;
108
122
  try { word = JSON.parse(decoder.decode(bytes)) as VoiceHeard; } catch { return; }
@@ -12,6 +12,7 @@ import type { SaveStorage } from '@wildshard/engine/saves/store';
12
12
  import { ServerMessageSchema, ShellMessageSchema, type ProbedRow, type ServerMessage, type ShellMessage } from '@wildshard/format/standaloneControl';
13
13
  import { answerHeldReads, type HeldRead } from '../../../shared/host/standalone/heldReads';
14
14
  import type { HarnessFlag, HarnessGod, HarnessHits, HarnessJoin, HarnessMove, HarnessPlace } from '../../../shared/host/standalone/harnessPlace';
15
+ import type { DevBox, DevCollidersMessage } from '@wildshard/engine/game/devColliders';
15
16
  import type { ServerWorkerStart } from '../../../server/host/standalone/serverRuntime';
16
17
  import { WorkerLoopback } from '../../../shared/host/standalone/workerLoopback';
17
18
 
@@ -66,6 +67,8 @@ export interface StandaloneShell {
66
67
  raise: (flag: string) => void;
67
68
  /** A proof's second client, a real one on its own link: it stands at this point in this cell, and `move` puts its body elsewhere. */
68
69
  join: (id: string, x: number, y: number, z: number) => { readonly client: NetClient; readonly move: (x: number, y: number, z: number) => void };
70
+ /** SHARD-SOURCE AP5: a watched part's solid boxes for the server's world (DEVSERVER pages only; elsewhere it does nothing). */
71
+ devColliders: (name: string, boxes: readonly DevBox[]) => void;
69
72
  dispose: () => void;
70
73
  }
71
74
 
@@ -136,6 +139,7 @@ export function connectStandalone(config: StandaloneConfig, control: MessagePort
136
139
  hardHits: by => { harness?.postMessage({ hits: by } satisfies HarnessHits, []); },
137
140
  bossGod: () => { harness?.postMessage({ god: true } satisfies HarnessGod, []); },
138
141
  raise: flag => { harness?.postMessage({ flag } satisfies HarnessFlag, []); },
142
+ devColliders: (name, boxes) => { if (typeof __DEVSERVER__ === 'boolean' && __DEVSERVER__) harness?.postMessage({ wildshardDevColliders: name, boxes } satisfies DevCollidersMessage, []); },
139
143
  join: (id, x, y, z) => {
140
144
  const line = new MessageChannel(), second = new NetClient(new WorkerLoopback(line.port1));
141
145
  harness?.postMessage({ join: id, x, y, z } satisfies HarnessJoin, [line.port2]);