@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,27 +1,69 @@
1
1
  #!/usr/bin/env node
2
2
  // SERVER-CELLS (draft, opus-cellmem): what one dedicated server costs per resident cell, dormant (nobody in it) and with one bot in
3
3
  // each. It runs a kept `mmo-bots.mjs replica --keep` folder's release bundle on loopback with production's shape (4 workers), once per
4
- // cell count, and reads it through scripts/cell-mem/metrics-preload.mjs (Prometheus text on a loopback port): RSS, CPU, heap and
5
- // external per thread, event-loop lag per thread, and the workers' own tick readings. Nothing leaves this Mac but the book GET.
4
+ // cell count, and reads the server's own `/metrics` (SC1: Prometheus text on 127.0.0.1:METRICS_PORT): RSS, CPU, heap and external per
5
+ // thread, event-loop lag per thread, and the workers' own tick readings. Nothing leaves this Mac but the book GET. A bundle from before
6
+ // SC1 serves no `/metrics`: build the kept run from engine main.
6
7
  // node scripts/mmo-bots.mjs replica --bots 1 --seconds 15 --cells grid --keep (once: bundle, bots tree, pack cache)
7
8
  // (cd tmp/mmo-bots/<stamp>/src && node scripts/build-server.mjs --build <build> --out ../cmbuild --entry cellMemBots=test/fixtures/dedicated/cellMemBotsEntry.ts)
8
9
  // node scripts/cell-mem-bench.mjs --from tmp/mmo-bots/<stamp> [--counts 1,2,8,16,25] [--dormant 30] [--active 40] [--workers 4]
9
- // The report goes to <from>/cell-mem-w<workers>.json.
10
+ // The report goes to <from>/cell-mem-w<workers>.json (`--remote`: cell-mem-<host>-w<workers>.json).
11
+ // SC7 (`--remote wildshard-agent [--cpus 9-13] [--bot-cpus 14-15]`): the same phases on the box, as `mmo-bots.mjs replica --remote
12
+ // --bots-on-host` runs there: the kept bundle and the bots' build go over ssh into ~/cell-mem/<stamp>, the replica runs pinned to
13
+ // `--cpus` (staging's, so production's players keep theirs) on the box's loopback only, the bots pinned to `--bot-cpus` dial it there,
14
+ // and each scrape is a loopback curl over ssh (the agent account forwards no ports). Memory is RSS (Linux has no `footprint`). The
15
+ // box fetches its own packs from R2 into the run's cache, kept across counts. The directory goes when the run ends, however it ends.
16
+ // SC4: each count also says `arrivalTickMax`, the worst tick in the worker readings heard in the 20 s after the bots arrived.
10
17
  import { execFileSync, spawn } from 'node:child_process';
18
+ import { once } from 'node:events';
11
19
  import { generateKeyPairSync, randomBytes, sign } from 'node:crypto';
12
20
  import { readFileSync, rmSync, writeFileSync } from 'node:fs';
13
21
  import { join, resolve as absolute } from 'node:path';
14
22
  import { pathToFileURL } from 'node:url';
15
23
  import { parseArgs } from 'node:util';
16
24
 
17
- const ROOT = absolute(import.meta.dirname, '..');
18
25
  const { values } = parseArgs({ options: { from: { type: 'string' }, counts: { type: 'string', default: '1,2,8,16,25' }, dormant: { type: 'string', default: '30' }, active: { type: 'string', default: '40' },
19
- workers: { type: 'string', default: '4' }, port: { type: 'string', default: '18896' }, origin: { type: 'string', default: 'https://packs.wildshard.io' } } });
26
+ workers: { type: 'string', default: '4' }, port: { type: 'string', default: '18896' }, origin: { type: 'string', default: 'https://packs.wildshard.io' },
27
+ remote: { type: 'string' }, cpus: { type: 'string', default: '9-13' }, 'bot-cpus': { type: 'string', default: '14-15' } } });
20
28
  if (values.from === undefined) throw new Error('--from <kept mmo-bots folder>');
21
29
  const from = absolute(values.from), server = join(from, 'server'), bots = join(from, 'cmbuild', 'cellMemBots.mjs'), port = Number(values.port), metricsPort = port + 1;
22
30
  const signed = JSON.parse(readFileSync(join(from, 'release.json'), 'utf8')), release = JSON.parse(signed.body);
23
31
  const sleep = (/** @type {number} */ ms) => new Promise(resolve => { setTimeout(resolve, ms); });
24
32
  const note = (/** @type {Record<string, unknown>} */ row) => { console.info(JSON.stringify({ at: 'cell-mem', ...row })); };
33
+ // SC7: every value that reaches the box's shell is a checked host, taskset list, number or fixed path.
34
+ const remote = values.remote;
35
+ if (remote !== undefined && !/^[\w.@-]+$/u.test(remote)) throw new Error('--remote is an ssh host');
36
+ if (!/^https?:\/\/[\w.:/-]+$/u.test(values.origin)) throw new Error('--origin is a plain http(s) URL');
37
+ if (!/^[\d,-]+$/u.test(values.cpus) || !/^[\d,-]+$/u.test(values['bot-cpus']) || !/^\d{1,3}$/u.test(values.workers) || !/^\d{4,5}$/u.test(values.port)) throw new Error('--cpus and --bot-cpus are taskset lists; --workers and --port are numbers');
38
+ const ALIVE = ['-o', 'BatchMode=yes', '-o', 'ServerAliveInterval=15', '-o', 'ServerAliveCountMax=8'];
39
+ const away = `cell-mem/${new Date().toISOString().replaceAll(/[-:]/gu, '').replace(/\..*/u, 'Z')}`;
40
+ /** One command's output text, without blocking the loop (the replica's and bots' pipes keep draining meanwhile). */
41
+ const execAsync = async (/** @type {string} */ file, /** @type {string[]} */ args, /** @type {number} */ timeout) => {
42
+ const child = spawn(file, args, { stdio: ['ignore', 'pipe', 'inherit'], timeout }), chunks = /** @type {Buffer[]} */ ([]);
43
+ child.stdout.on('data', (/** @type {Buffer} */ chunk) => { chunks.push(chunk); });
44
+ const [code] = await once(child, 'close');
45
+ if (code !== 0) throw new Error(`${file} exited ${String(code)}`);
46
+ return Buffer.concat(chunks).toString();
47
+ };
48
+ /**
49
+ * One command on the box, its output as text.
50
+ * @param {string} command
51
+ * @param {Buffer | string} [input]
52
+ */
53
+ const box = (command, input) => {
54
+ if (remote === undefined) throw new Error('Not remote');
55
+ if (input === undefined) return execAsync('ssh', [...ALIVE, remote, command], 120_000);
56
+ return execFileSync('ssh', [...ALIVE, remote, command], { input, maxBuffer: 1 << 26, timeout: 300_000 }).toString();
57
+ };
58
+ /** The box's replica and bots, ended by their own paths, and the run's directory, removed. */
59
+ const boxStop = async () => { if (remote !== undefined) try { await box(`pkill -TERM -f '[/]${away}/' ; sleep 3; pkill -KILL -f '[/]${away}/'; rm -rf ${away}`); } catch { /* already gone */ } };
60
+ if (remote !== undefined) {
61
+ for (const [signal, code] of /** @type {const} */ ([['SIGINT', 130], ['SIGHUP', 129], ['SIGTERM', 143]])) process.once(signal, () => { void boxStop().finally(() => { process.exit(code); }); });
62
+ // The kept bundle and the bots' one file go over once.
63
+ await box(`mkdir -p ${away}/server ${away}/bots && tar -x -C ${away}/server`, execFileSync('tar', ['-c', '-C', server, '.'], { maxBuffer: 1 << 30 }));
64
+ await box(`cat > ${away}/bots/cellMemBots.mjs`, readFileSync(bots));
65
+ note({ step: 'remote', host: remote, cpus: values.cpus, botCpus: values['bot-cpus'], dir: `~/${away}`, node: (await box('node --version')).trim(), nproc: (await box('nproc')).trim() });
66
+ }
25
67
 
26
68
  /** The grid's cells in the order `WORLD_CELLS=grid` opens them, read off the kept run's own log. */
27
69
  const order = /** @type {string[]} */ (readFileSync(join(from, 'server.jsonl'), 'utf8').split('\n').map(line => { try { return JSON.parse(line); } catch { return null; } }).find(row => row?.at === 'server.listening')?.cells ?? []);
@@ -29,12 +71,14 @@ if (order.length === 0) throw new Error('The kept run never listened');
29
71
 
30
72
  /** @returns {Promise<Record<string, number>>} The scrape, flattened to `name{labels}` → value. */
31
73
  async function scrape() {
32
- const text = await (await fetch(`http://127.0.0.1:${String(metricsPort)}/metrics`)).text(), rows = /** @type {Record<string, number>} */ ({});
74
+ const text = remote === undefined ? await (await fetch(`http://127.0.0.1:${String(metricsPort)}/metrics`)).text() : await box(`curl -s -m 10 127.0.0.1:${String(metricsPort)}/metrics`), rows = /** @type {Record<string, number>} */ ({});
33
75
  for (const line of text.split('\n')) { if (line === '' || line.startsWith('#')) continue; const at = line.lastIndexOf(' '); rows[line.slice(0, at)] = Number(line.slice(at + 1)); }
34
76
  return rows;
35
77
  }
36
78
  const sum = (/** @type {Record<string, number>} */ rows, /** @type {string} */ prefix) => Object.entries(rows).filter(([name]) => name.startsWith(prefix)).reduce((total, [, value]) => total + value, 0);
37
79
  const most = (/** @type {Record<string, number>} */ rows, /** @type {RegExp} */ match) => Math.max(0, ...Object.entries(rows).filter(([name]) => match.test(name)).map(([, value]) => value));
80
+ /** One thread-memory kind summed over every thread (the server's `wildshard_thread_memory_bytes{thread,kind}`). */
81
+ const threads = (/** @type {Record<string, number>} */ rows, /** @type {RegExp} */ kind) => Object.entries(rows).filter(([name]) => name.startsWith('wildshard_thread_memory_bytes{') && kind.test(name)).reduce((total, [, value]) => total + value, 0);
38
82
  const median = (/** @type {number[]} */ list) => { const sorted = list.slice().sort((a, b) => a - b); return sorted[Math.floor(sorted.length / 2)] ?? 0; };
39
83
 
40
84
  /** macOS RSS drops as the kernel compresses a quiet process's pages; `footprint` counts those too, as Activity Monitor's Memory does. Elsewhere, RSS. */
@@ -50,19 +94,22 @@ async function phase(/** @type {number} */ seconds, /** @type {string[]} */ work
50
94
  while (performance.now() - started < seconds * 1000) { await sleep(5_000); samples.push(await scrape()); const mb = footprint(pid); if (mb !== null) footprints.push(mb); }
51
95
  const last = samples.at(-1) ?? first, wall = (performance.now() - started) / 1000;
52
96
  const ticks = workerLines.slice(linesBefore).map(line => JSON.parse(line));
97
+ // SC4: the readings heard in the 20 s after the phase began cover each worker's first 10 s window after an arrival.
98
+ const arrival = ticks.filter(row => row.heardAt !== undefined && row.heardAt - started <= 20_000);
53
99
  const mb = (/** @type {number} */ bytes) => Math.round(bytes / 1048576);
54
100
  return {
55
101
  footprintMB: footprints.length === 0 ? null : Math.round(median(footprints)), footprintMaxMB: footprints.length === 0 ? null : Math.round(Math.max(...footprints)),
56
102
  rssMB: mb(median(samples.map(row => row.process_resident_memory_bytes ?? 0))), rssMaxMB: mb(Math.max(...samples.map(row => row.process_resident_memory_bytes ?? 0))),
57
- heapMB: mb(median(samples.map(row => sum(row, 'nodejs_heap_used_bytes')))), externalMB: mb(median(samples.map(row => sum(row, 'nodejs_external_bytes')))), arrayBuffersMB: mb(median(samples.map(row => sum(row, 'nodejs_array_buffers_bytes')))),
103
+ heapMB: mb(median(samples.map(row => threads(row, /kind="heap"/u)))), externalMB: mb(median(samples.map(row => threads(row, /kind="external"/u)))), arrayBuffersMB: mb(median(samples.map(row => threads(row, /kind="arrayBuffers"/u)))),
58
104
  cpuCores: Number((((last.process_cpu_seconds_total ?? 0) - (first.process_cpu_seconds_total ?? 0)) / wall).toFixed(3)),
59
- mainLagP50: Number(median(samples.map(row => row['nodejs_eventloop_lag_seconds{thread="main",quantile="0.5"}'] ?? 0)).toFixed(5)) * 1000,
60
- mainLagP99: Number(Math.max(...samples.map(row => row['nodejs_eventloop_lag_seconds{thread="main",quantile="0.99"}'] ?? 0)).toFixed(5)) * 1000,
61
- workerLagP99: Number(Math.max(...samples.map(row => most(row, /^nodejs_eventloop_lag_seconds\{thread="\d+",quantile="0.99"\}/u))).toFixed(5)) * 1000,
105
+ mainLagP50: Number(median(samples.map(row => row['wildshard_eventloop_lag_seconds{thread="main",quantile="0.5"}'] ?? 0)).toFixed(5)) * 1000,
106
+ mainLagP99: Number(Math.max(...samples.map(row => row['wildshard_eventloop_lag_seconds{thread="main",quantile="0.99"}'] ?? 0)).toFixed(5)) * 1000,
107
+ workerLagP99: Number(Math.max(...samples.map(row => most(row, /^wildshard_eventloop_lag_seconds\{thread="worker-\d+",quantile="0.99"\}/u))).toFixed(5)) * 1000,
108
+ arrivalTickMax: Math.max(0, ...arrival.map(row => row.max)),
62
109
  tickP50: Math.max(0, ...ticks.map(row => row.p50)), tickP95: Math.max(0, ...ticks.map(row => row.p95)), tickP99: Math.max(0, ...ticks.map(row => row.p99)), tickMax: Math.max(0, ...ticks.map(row => row.max)),
63
110
  drops: ticks.reduce((total, row) => total + row.drops, 0), minTicksPerSecond: Math.min(60, ...ticks.map(row => row.ticksPerSecond)),
64
111
  awake: Math.max(0, ...samples.map(row => sum(row, 'wildshard_cells_awake'))), players: Math.max(0, ...samples.map(row => sum(row, 'wildshard_players'))),
65
- perThreadHeapMB: Object.fromEntries(Object.entries(last).filter(([name]) => name.startsWith('nodejs_heap_used_bytes')).map(([name, value]) => [name.slice(name.indexOf('{')), mb(value)])),
112
+ perThreadHeapMB: Object.fromEntries(Object.entries(last).filter(([name]) => name.startsWith('wildshard_thread_memory_bytes') && name.includes('kind="heap"')).map(([name, value]) => [/thread="([^"]+)"/u.exec(name)?.[1] ?? name, mb(value)])),
66
113
  };
67
114
  }
68
115
 
@@ -71,11 +118,15 @@ async function run(/** @type {number} */ count) {
71
118
  const cells = order.slice(0, count), { publicKey, privateKey } = generateKeyPairSync('ed25519');
72
119
  const body = JSON.stringify({ ...release, serial: 1 }), file = join(from, `cell-mem-release.json`);
73
120
  writeFileSync(file, JSON.stringify({ body, signature: sign(null, Buffer.from(body), privateKey).toString('hex') }));
121
+ if (remote !== undefined) await box(`cat > ${away}/release.json`, readFileSync(file));
74
122
  const env = { PATH: process.env.PATH ?? '', HOME: process.env.HOME ?? '', PACK_ORIGIN: values.origin, PACK_CACHE: join(from, 'packs'), DATABASE_URL: 'memory:', SEAT_SECRET: randomBytes(32).toString('hex'),
75
123
  HOST: '127.0.0.1', PORT: String(port), RELEASE_CHANNEL: 'production', RELEASE_URL: pathToFileURL(file).href, RELEASE_PUBLIC_KEY: publicKey.export({ type: 'spki', format: 'der' }).toString('hex'),
76
124
  WORLD_CELLS: cells.join(','), WORLD_WORKERS: values.workers, WORLD_SEATS: '64', TELEMETRY_URL: '', ERRORS_URL: '', SENTRY_DSN: '', RECORD_TAG: '', METRICS_PORT: String(metricsPort) };
77
125
  const began = performance.now(), workerLines = /** @type {string[]} */ ([]), booted = /** @type {Record<string, number>} */ ({});
78
- const child = spawn(process.execPath, ['--import', pathToFileURL(join(ROOT, 'scripts/cell-mem/metrics-preload.mjs')).href, join(server, 'main.mjs')], { cwd: server, env, stdio: ['ignore', 'pipe', 'pipe'] });
126
+ const there = { ...env, PACK_CACHE: `$HOME/${away}/packs`, RELEASE_URL: `file://$HOME/${away}/release.json` };
127
+ const words = Object.entries(there).filter(([name]) => name !== 'PATH' && name !== 'HOME').map(([name, value]) => `${name}="${value}"`).join(' ');
128
+ const child = remote === undefined ? spawn(process.execPath, [join(server, 'main.mjs')], { cwd: server, env, stdio: ['ignore', 'pipe', 'pipe'] })
129
+ : spawn('ssh', [...ALIVE, remote, `cd ${away}/server && exec env ${words} taskset -c ${values.cpus} node "$HOME/${away}/server/main.mjs"`], { stdio: ['ignore', 'pipe', 'pipe'] });
79
130
  /** Set by the log reader as lines arrive. */
80
131
  const seen = { listening: 0 };
81
132
  let buffer = '';
@@ -83,7 +134,7 @@ async function run(/** @type {number} */ count) {
83
134
  buffer += chunk.toString();
84
135
  for (let end = buffer.indexOf('\n'); end >= 0; end = buffer.indexOf('\n')) {
85
136
  const line = buffer.slice(0, end); buffer = buffer.slice(end + 1);
86
- if (line.startsWith('{"at":"worker"')) workerLines.push(line);
137
+ if (line.startsWith('{"at":"worker"')) workerLines.push(`${line.slice(0, -1)},"heardAt":${String(performance.now())}}`);
87
138
  else if (line.startsWith('{"at":"server.listening"')) seen.listening = performance.now() - began;
88
139
  else if (line.startsWith('{"at":"cell.booted"')) { const row = JSON.parse(line); booted[row.slug] = Math.round(row.ms); }
89
140
  }
@@ -96,24 +147,29 @@ async function run(/** @type {number} */ count) {
96
147
  if (seen.listening === 0) throw new Error(`${String(count)} cells never listened`);
97
148
  // The first worker readings come 10 s after boot: let the boot's own garbage settle before the dormant read.
98
149
  while (workerLines.length === 0 && performance.now() - began < 300_000) await sleep(500);
99
- const dormant = await phase(Number(values.dormant), workerLines, child.pid);
150
+ const dormant = await phase(Number(values.dormant), workerLines, remote === undefined ? child.pid : undefined);
100
151
  note({ count, phase: 'dormant', ...dormant });
101
152
  const result = join(from, `cell-mem-bots-${String(count)}.json`);
102
153
  rmSync(result, { force: true });
103
- const players = spawn(process.execPath, [bots, `ws://127.0.0.1:${String(port)}/`, release.engineBuild, cells.join(','), String(Number(values.active) + 10), 'cm', result], { stdio: ['ignore', 'pipe', 'inherit'] });
154
+ const botArgs = [`ws://127.0.0.1:${String(port)}/`, release.engineBuild, cells.join(','), String(Number(values.active) + 10), 'cm'];
155
+ const players = remote === undefined ? spawn(process.execPath, [bots, ...botArgs, result], { stdio: ['ignore', 'pipe', 'inherit'] })
156
+ : spawn('ssh', [...ALIVE, remote, `cd ${away}/bots && exec taskset -c ${values['bot-cpus']} node "$HOME/${away}/bots/cellMemBots.mjs" ${botArgs.join(' ')} "$HOME/${away}/bots-${String(count)}.json"`], { stdio: ['ignore', 'pipe', 'inherit'] });
104
157
  bot = players;
105
158
  const arrival = { at: 0 };
106
159
  players.stdout.on('data', (/** @type {Buffer} */ chunk) => { if (chunk.toString().includes('cellmem.arrived')) arrival.at = performance.now(); });
107
160
  while (arrival.at === 0 && players.exitCode === null) await sleep(250);
108
161
  if (arrival.at === 0) throw new Error(`${String(count)} cells: the bots ended before they were seated`);
109
- const active = await phase(Number(values.active), workerLines, child.pid);
162
+ const active = await phase(Number(values.active), workerLines, remote === undefined ? child.pid : undefined);
110
163
  await new Promise(resolve => { if (players.exitCode !== null) resolve(null); else players.once('exit', resolve); });
164
+ if (remote !== undefined) writeFileSync(result, await box(`cat ${away}/bots-${String(count)}.json`));
111
165
  const report = JSON.parse(readFileSync(result, 'utf8')), rtts = report.rows.map((/** @type {{ rttP50: number | null }} */ row) => row.rttP50).filter((/** @type {number | null} */ value) => value !== null);
112
166
  const row = { count, cells, bootMs: Math.round(seen.listening), cellBootMs: booted, dormant, active: { ...active, seated: report.seated, inTheirCell: report.inTheirCell, rttP50: median(rtts), rttMax: Math.max(0, ...report.rows.map((/** @type {{ rttMax: number | null }} */ seat) => seat.rttMax ?? 0)), joinMsMax: Math.max(0, ...report.rows.map((/** @type {{ joinedMs: number | null }} */ seat) => seat.joinedMs ?? 0)) } };
113
167
  note({ count, phase: 'active', ...row.active });
114
168
  return row;
115
169
  } finally {
116
170
  if (bot !== null && bot.exitCode === null) bot.kill('SIGTERM');
171
+ // On the box the ssh client's signal never reaches the server: it is told there, by its own path.
172
+ if (remote !== undefined) try { await box(`pkill -TERM -f '[/]${away}/bots/' ; pkill -TERM -f '[/]${away}/server/main.mjs'`); } catch { /* already gone */ }
117
173
  child.kill('SIGTERM');
118
174
  const gone = new Promise(resolve => { if (child.exitCode !== null) resolve(null); else child.once('exit', resolve); });
119
175
  await Promise.race([gone, sleep(15_000)]);
@@ -121,10 +177,12 @@ async function run(/** @type {number} */ count) {
121
177
  }
122
178
  }
123
179
 
124
- const rows = [];
125
- for (const count of values.counts.split(',').map(Number)) {
126
- if (!Number.isInteger(count) || count < 1 || count > order.length) { note({ count, skipped: `the grid opens ${String(order.length)} cells` }); continue; }
127
- rows.push(await run(count));
128
- writeFileSync(join(from, `cell-mem-w${values.workers}.json`), `${JSON.stringify({ build: release.engineBuild, workers: Number(values.workers), node: process.version, rows }, null, 2)}\n`);
129
- }
130
- note({ done: join(from, `cell-mem-w${values.workers}.json`) });
180
+ const rows = [], report = join(from, `cell-mem-${remote === undefined ? '' : `${remote}-`}w${values.workers}.json`);
181
+ try {
182
+ for (const count of values.counts.split(',').map(Number)) {
183
+ if (!Number.isInteger(count) || count < 1 || count > order.length) { note({ count, skipped: `the grid opens ${String(order.length)} cells` }); continue; }
184
+ rows.push(await run(count));
185
+ writeFileSync(report, `${JSON.stringify({ build: release.engineBuild, workers: Number(values.workers), node: process.version, ...(remote === undefined ? {} : { remote, cpus: values.cpus, botCpus: values['bot-cpus'] }), rows }, null, 2)}\n`);
186
+ }
187
+ } finally { await boxStop(); }
188
+ note({ done: report });
@@ -31,7 +31,7 @@ if(import.meta.url===pathToFileURL(process.argv[1]??'').href){
31
31
  const root=resolve(process.argv[2]??process.cwd());
32
32
  // Enumerate declared canonical projects/products rather than existing out/
33
33
  // directories: missing products refuse through the verified reader.
34
- const {outputSections}=await import('./shard-platform-output.mjs');
34
+ const {outputSections}=await import('./output-reader.mjs');
35
35
  const {execFileSync}=await import('node:child_process');
36
36
  const names=execFileSync('git',['ls-tree','-r','--name-only','HEAD','--','src/shards'],{cwd:root,encoding:'utf8'})
37
37
  .split('\n').flatMap(path=>/^src\/shards\/([^/]+)\/shard.config.ts$/u.exec(path)?.slice(1)??[]);
@@ -16,7 +16,9 @@ export function assertProductionBuild(directory) {
16
16
  if (file.isDirectory()) walk(full);
17
17
  else if (file.name.endsWith('.js')) {
18
18
  const code = readFileSync(full, 'utf8');
19
- if (code.includes('__DEVSERVER__')) throw new Error('Production bundle contains an unsubstituted DEVSERVER define');
19
+ if (code.includes('__DEVSERVER__') || code.includes('__PREPARATION_ONLY__')) throw new Error('Production bundle contains an unsubstituted DEVSERVER or PREPARATION_ONLY define');
20
+ // SHARD-SOURCE AP5 (J347): the dev hook (src/client/game/devScene/hook.ts) and its server half are DEVSERVER-only.
21
+ for (const marker of ['__wildshardDevHook', 'wildshardDevColliders']) if (code.includes(marker)) throw new Error(`Production bundle ${file.name} contains the dev hook (${marker})`);
20
22
  }
21
23
  }
22
24
  };
@@ -77,6 +77,7 @@ export const DONE = {
77
77
  'shared (src/world, src/player, src/entities, …)': {
78
78
  'src/client/engine/render/scatterInstances.ts': { why: '2d917c567c: the existing bounded scatter draw moved from Nalati dressing; authored placements and collision remain data', counts: { InstancedMesh: 1 } },
79
79
  'src/client/game/ambient/wingField.ts': { why: '2d917c567c: the former two ambient wing draws share one row-owned allocation site; creatures remain model-owned', counts: { InstancedMesh: 1 } },
80
+ 'src/client/game/devScene/hook.ts': { why: 'SHARD-SOURCE AP5 (J347): the DEVSERVER-only dev hook `wildshard watch` drives; it redraws an author\'s three.js parts as the author wrote them, never in a production bundle (check-devserver.mjs)', counts: { InstancedMesh: 1 } },
80
81
  'src/client/game/boss/arenaFire.ts': { why: 'f524ad70dc: the existing flame and smoke effect draws moved from stormTitanLook with their original ceiling', counts: { InstancedMesh: 2 } },
81
82
  'src/client/game/boss/encounterView.ts': { why: 'Moved from Nalati: a cloud body\'s puffs (one row-sized draw) and an encounter site\'s empty stand-in for a variant no site wears; the sites themselves are placed through place()', counts: { InstancedMesh: 2 } },
82
83
  'src/client/game/practice/course.ts': { why: 'The existing riding and grapple practice rooms share one row-owned registration; no shard world content', counts: { 'registry add with object': 1 } },
@@ -87,6 +88,7 @@ export const DONE = {
87
88
  'src/client/engine/player/firstPersonArms.ts': { why: "the player's own first-person arms, merged into one geometry: the player, not a thing in the world", counts: { mergeGeometries: 1 } },
88
89
  'src/client/engine/render/graph/glslMaterial.ts': { why: "an instanced mesh's outline hull, mirroring the mesh it outlines: a material effect, never a new world thing", counts: { InstancedMesh: 1 } },
89
90
  'src/client/engine/render/lookLight.ts': { why: 'look.light pools of light (85944cce, behind Debug): an effect', counts: { InstancedMesh: 1 } },
91
+ 'src/client/engine/render/lookRender.ts': { why: 'meta SHARD-SOURCE M4.8 lamp halos: one additive billboard per declared lamp, an effect', counts: { InstancedMesh: 1 } },
90
92
  'src/client/game/ambient/crowdDraw.ts': { why: 'the ambient crowd draw from admitted rows: a population, like the flock in posedInstances', counts: { InstancedMesh: 1 } },
91
93
  'src/client/game/ambient/foragerDraw.ts': { why: 'the native forager population, one draw over its owner rows: a population, not placed world', counts: { InstancedMesh: 1 } },
92
94
  'src/client/game/loot/CoinMotion.ts': { why: 'loot coins in flight to the player: an effect, like CoinBurst', counts: { InstancedMesh: 1 } },
@@ -299,16 +299,6 @@
299
299
  "file": "scripts/shard-coupling.mjs",
300
300
  "why": "Immutable reviewed weapon transfer bootstrap; the transfer list is empty and its historical destination is retired. The shrink-only comparator still checks any restored transfer against this identity."
301
301
  },
302
- {
303
- "path": "src/engine/models/glbNodes.ts",
304
- "file": "scripts/platform-chargebacks.mjs",
305
- "why": "G520 retired-module identity: an exact comparison prevents an obsolete pending-user ledger row from earning credit. This selector deliberately names the deleted host; no file is loaded."
306
- },
307
- {
308
- "path": "src/game/shardfile/buildingAssembly.ts",
309
- "file": "scripts/platform-chargebacks.mjs",
310
- "why": "G520 retired-module identity: an exact comparison prevents an obsolete pending-user ledger row from earning credit. This selector deliberately names the deleted host; no file is loaded."
311
- },
312
302
  {
313
303
  "path": "src/engine/sim.ts",
314
304
  "file": "test/sort-sides.test.ts",
@@ -359,21 +349,6 @@
359
349
  "file": "scripts/generated-source.mjs",
360
350
  "why": "build-sdk.mjs's gitignored package output: the generated-source check names the folder to skip, so it exists only in a tree that built the SDK and never in a clean CI checkout."
361
351
  },
362
- {
363
- "path": "src/server/game/population/pageGroups.ts",
364
- "file": "test/platform-chargebacks.test.ts",
365
- "why": "A retired path kept on purpose: this test feeds it as a synthetic module name, and it must stay unclaimed."
366
- },
367
- {
368
- "path": "src/server/game/ambient/crowdPage.ts",
369
- "file": "test/platform-chargebacks.test.ts",
370
- "why": "A retired path kept on purpose: this test feeds it as a synthetic module name, and it must stay unclaimed."
371
- },
372
- {
373
- "path": "src/server/game/population/pageGroups.ts",
374
- "file": "test/shard-component-spans.test.ts",
375
- "why": "A retired path kept on purpose: this test feeds it as a synthetic module name, and it must stay unclaimed."
376
- },
377
352
  {
378
353
  "path": "src/shards/*/bake/**/*.mjs",
379
354
  "file": ".oxlintrc.json",
@@ -409,11 +384,6 @@
409
384
  "file": "scripts/built-product.mjs",
410
385
  "why": "Left with sharddev or a shard at P3"
411
386
  },
412
- {
413
- "path": "src/shards",
414
- "file": "scripts/check-closed-components.mjs",
415
- "why": "Left with sharddev or a shard at P3"
416
- },
417
387
  {
418
388
  "path": "src/shards",
419
389
  "file": "scripts/check-custom-sections-zero.mjs",
@@ -504,11 +474,6 @@
504
474
  "file": "scripts/json-declarations.mjs",
505
475
  "why": "Left with sharddev or a shard at P3"
506
476
  },
507
- {
508
- "path": "src/shards/",
509
- "file": "scripts/listed-view-code.mjs",
510
- "why": "Left with sharddev or a shard at P3"
511
- },
512
477
  {
513
478
  "path": "test/manifest-declarations.test.ts",
514
479
  "file": "scripts/live-prepush.py",
@@ -584,66 +549,6 @@
584
549
  "file": "scripts/record-fence-reads.mjs",
585
550
  "why": "Left with sharddev or a shard at P3"
586
551
  },
587
- {
588
- "path": "src/sharddev/crowds.ts",
589
- "file": "scripts/shard-components.mjs",
590
- "why": "Left with sharddev or a shard at P3"
591
- },
592
- {
593
- "path": "src/sharddev/phasedBoss.ts",
594
- "file": "scripts/shard-components.mjs",
595
- "why": "Left with sharddev or a shard at P3"
596
- },
597
- {
598
- "path": "src/sharddev/kit/bakedGeometry.ts",
599
- "file": "scripts/shard-components.mjs",
600
- "why": "Left with sharddev or a shard at P3"
601
- },
602
- {
603
- "path": "src/sharddev/kit/geometryPack.ts",
604
- "file": "scripts/shard-components.mjs",
605
- "why": "Left with sharddev or a shard at P3"
606
- },
607
- {
608
- "path": "src/sharddev/assets.ts",
609
- "file": "scripts/shard-components.mjs",
610
- "why": "Left with sharddev or a shard at P3"
611
- },
612
- {
613
- "path": "src/sharddev/buildBehaviour.ts",
614
- "file": "scripts/shard-components.mjs",
615
- "why": "Left with sharddev or a shard at P3"
616
- },
617
- {
618
- "path": "src/sharddev/questGraph.ts",
619
- "file": "scripts/shard-components.mjs",
620
- "why": "Left with sharddev or a shard at P3"
621
- },
622
- {
623
- "path": "src/sharddev/bake/texture.ts",
624
- "file": "scripts/shard-components.mjs",
625
- "why": "Left with sharddev or a shard at P3"
626
- },
627
- {
628
- "path": "src/shards/driftwood-isle/shard.config.ts",
629
- "file": "scripts/shard-components.mjs",
630
- "why": "Left with sharddev or a shard at P3"
631
- },
632
- {
633
- "path": "src/sharddev/bake/rig.ts",
634
- "file": "scripts/shard-components.mjs",
635
- "why": "Left with sharddev or a shard at P3"
636
- },
637
- {
638
- "path": "src/sharddev/phasedBoss.ts#RoamingBossRow",
639
- "file": "scripts/shard-components.mjs",
640
- "why": "Left with sharddev or a shard at P3"
641
- },
642
- {
643
- "path": "src/sharddev/interactions.ts#interactionRules",
644
- "file": "scripts/shard-components.mjs",
645
- "why": "Left with sharddev or a shard at P3"
646
- },
647
552
  {
648
553
  "path": "src/engine/",
649
554
  "file": "scripts/shard-coupling.mjs",
@@ -659,26 +564,6 @@
659
564
  "file": "scripts/shard-outputs.mjs",
660
565
  "why": "Left with sharddev or a shard at P3"
661
566
  },
662
- {
663
- "path": "src/shards",
664
- "file": "scripts/shard-platform.mjs",
665
- "why": "Left with sharddev or a shard at P3"
666
- },
667
- {
668
- "path": "test/shard-headless.test.ts",
669
- "file": "scripts/shard-platform.mjs",
670
- "why": "Left with sharddev or a shard at P3"
671
- },
672
- {
673
- "path": "src/server/host/package.json",
674
- "file": "scripts/shard-platform.mjs",
675
- "why": "Left with sharddev or a shard at P3"
676
- },
677
- {
678
- "path": "src/shards/",
679
- "file": "scripts/shard-platform.mjs",
680
- "why": "Left with sharddev or a shard at P3"
681
- },
682
567
  {
683
568
  "path": "src/shards",
684
569
  "file": "scripts/shard-public.mjs",
@@ -48,8 +48,8 @@ function strings(text) {
48
48
  /** @param {string} file @param {string} text @param {string} path @param {number} index @param {string} [folder] */
49
49
  function check(file, text, path, index, folder = ROOT) {
50
50
  if (allowed.has(`${file}\0${path}`)) return;
51
- // Component ownership keys append a declaration name to an existing module.
52
- const target = file === 'scripts/shard-components.mjs' ? path.split('#')[0] : path;
51
+ // Ownership keys may append a declaration name (`path#name`) to an existing module.
52
+ const target = path.split('#')[0] ?? path;
53
53
  // Censuses and G571 approvals keep format's logical src/format/x.ts labels (format-package.mjs): check where they live.
54
54
  const at = onDisk(folder, target.replace(/^\.\//u, ''));
55
55
  const found = GLOB.test(path) ? globSync(at).some((p) => statSync(p).isFile()) : existsSync(at);
@@ -7,7 +7,6 @@ import { pathToFileURL } from 'node:url';
7
7
  import { runtimePerformanceSites } from '../lint/runtime-performance.mjs';
8
8
  import { compareRuntimeFiles, RUNTIME_FILES_LIST } from '../lint/runtime-files.mjs';
9
9
  import { zeroPolicyFailures } from './check-custom-sections-zero.mjs';
10
- import { compareClosedComponents } from './check-closed-components.mjs';
11
10
  import { SIDE_EDGES_LIST, compareSideEdges } from '../lint/engine-sides.mjs';
12
11
 
13
12
  export const PLATFORM_LISTS = ['lint/row-functions.json', 'lint/edge-exemptions.json', 'lint/shard-platform.json', 'lint/ratchet.json', 'lint/sim-closure.json', 'lint/sim-schema-leaves.json', 'lint/shard-coupling.json', WEAPON_TRANSFER_LIST, CLASS_MOVE_LIST, 'lint/runtime-performance.json', RUNTIME_FILES_LIST, SIDE_EDGES_LIST];
@@ -152,8 +151,8 @@ export function comparePlatformList(list, baselineFile, candidateFile, trees, so
152
151
  if (list === 'lint/ratchet.json') {
153
152
  const read=file=>existsSync(file)?JSON.parse(readFileSync(file,'utf8')):undefined;
154
153
  const fromSource=reader=>{const text=reader('lint/ratchet.json');return text===undefined?undefined:JSON.parse(text);};
155
- const before=sources===undefined?read(baselineFile):fromSource(sources.before),after=sources===undefined?read(candidateFile):fromSource(sources.after);
156
- return zeroPolicyFailures(after?.budgets??{}).concat(compareClosedComponents(before?.closedComponents,after?.closedComponents));
154
+ const after=sources===undefined?read(candidateFile):fromSource(sources.after);
155
+ return zeroPolicyFailures(after?.budgets??{});
157
156
  }
158
157
  if (list === SIDE_EDGES_LIST) {
159
158
  // P1-E2: the engine-side edge counts only fall; the first commit seeds them.
@@ -1,4 +1,6 @@
1
1
  // Conservative source guard for Chromium launchers, without a parser dependency.
2
+ import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
3
+
2
4
  const childMethods = ['spawn', 'spawnSync', 'execFile', 'execFileSync', 'exec', 'execSync'];
3
5
  const browserBinary = /chrom(?:e|ium)|executablePath\s*\(/iu;
4
6
 
@@ -11,7 +13,7 @@ function shellProblems(/** @type {string} */ text) {
11
13
  if (!command || command[1].startsWith('#') || command[1].includes('=')) return [];
12
14
  const program = command[1].replaceAll(/\$\{?(\w+)\}?/gu, (_all, name) => variables.get(name) ?? name);
13
15
  if (!browserBinary.test(program)) return [];
14
- return ['--use-mock-keychain', '--password-store=basic'].every(flag => command[2].includes(flag)) ? [] : ['bare Chromium shell executable'];
16
+ return KEYCHAIN_ARGS.every(flag => command[2].includes(flag)) ? [] : ['bare Chromium shell executable'];
15
17
  });
16
18
  }
17
19
 
@@ -96,7 +98,7 @@ export function keychainProblems(/** @type {string} */ text) {
96
98
  return expanded;
97
99
  };
98
100
  const safe = (/** @type {string} */ value) => /\.\.\.\s*KEYCHAIN_ARGS\b/u.test(expand(value))
99
- || ['--use-mock-keychain', '--password-store=basic'].every(flag => expand(value).includes(flag));
101
+ || KEYCHAIN_ARGS.every(flag => expand(value).includes(flag));
100
102
  const names = [...childMethods];
101
103
  const namespaces = new Set([...text.matchAll(/import\s+\*\s+as\s+(\w+)\s+from\s+['"](?:node:)?child_process['"]/gu)].map(match => match[1]));
102
104
  for (const match of text.matchAll(/import\s+(\w+)\s+from\s+['"](?:node:)?child_process['"]/gu)) namespaces.add(match[1]);
@@ -1 +1 @@
1
- export const KEYCHAIN_ARGS: readonly ['--use-mock-keychain', '--password-store=basic'];
1
+ export const KEYCHAIN_ARGS: readonly ['--use-mock-keychain', '--password-store=basic', '--mute-audio'];
@@ -2,4 +2,6 @@
2
2
  // keychain for "Chrome for Testing Safe Storage" and a dialog lands on the desktop at each launch. Playwright adds them
3
3
  // by default, but a raw `spawn` of the executable skips its defaults, so every launch site spreads them explicitly and
4
4
  // test/tooling/chrome-keychain.test.mjs refuses a launch file that does not.
5
- export const KEYCHAIN_ARGS = Object.freeze(['--use-mock-keychain', '--password-store=basic']);
5
+ // `--mute-audio` rides along (Jake, 2026-11-13: "headless chromium with volume off"), so a launch that forgets it
6
+ // still cannot play a game's sound out of Jake's speakers.
7
+ export const KEYCHAIN_ARGS = Object.freeze(['--use-mock-keychain', '--password-store=basic', '--mute-audio']);
@@ -37,7 +37,7 @@ if [ "$mode" = code ]; then
37
37
  check native-item-frame proof sim-node-loader.mjs test/ci/native-item-frame.proof.mjs
38
38
  check declared-input bash -c 'node scripts/pins.ts install nine-dragon-stack && node --import ./scripts/bake-loader.mjs --experimental-transform-types --test test/ci/declared-input.proof.mjs'
39
39
  fi
40
- check asks node src/scripts/asks.mjs check --all
40
+ check asks node kit/scripts/asks.mjs check --all
41
41
  if [ "$mode" = docs ]; then
42
42
  check parity pnpm check:parity
43
43
  # Space-separated repo paths from scripts/ci-selection.mjs. A file the config excludes (lift-pending, quarantine)
@@ -159,11 +159,9 @@ export async function committedFastChecks(root,base,tip,phase,paths) {
159
159
  const {deletedReferences}=/** @type {typeof import('./push-checks.mjs')} */(await module('scripts/push-checks.mjs'));
160
160
  failures.push(...deletedReferences(root,paths));
161
161
  } else if(phase==='guards') {
162
- const {closedComponentSources}=/** @type {typeof import('./check-closed-components.mjs')} */(await module('scripts/check-closed-components.mjs'));
163
162
  const {comparePlatformList,PLATFORM_LISTS}=/** @type {typeof import('./check-platform-ratchets.mjs')} */(await module('scripts/check-platform-ratchets.mjs'));
164
163
  const {ratchetApprovalFailures}=/** @type {typeof import('./ratchet-approval.mjs')} */(await module('scripts/ratchet-approval.mjs'));
165
164
  const policy=json(view,'lint/ratchet.json');
166
- failures.push(...closedComponentSources(root,policy.closedComponents));
167
165
  if(view.files.has('scripts/check-spelled-paths.mjs')) {
168
166
  const {spelledPathFailures}=/** @type {typeof import('./check-spelled-paths.mjs')} */(await module('scripts/check-spelled-paths.mjs'));
169
167
  view.prime([...view.files.keys()].filter(path=>/^src\/(?:engine|game)\/isolated-[^/]+\.test\.ts$|^scripts\/.*\.[cm]?[jt]s$|^src\/shards\/[^/]+\/(?:data|look)\/map\.json$/u.test(path)));
@@ -109,7 +109,8 @@ const booted = page => page.waitForFunction(() => {
109
109
  return typeof window.__workerClient === 'function' && window.__workerClient().frames > 0 && Array.isArray(timing?.entries) && timing.entries.some(/** @param {{operation: string}} row */ row => row.operation === 'app:loader-complete');
110
110
  }, undefined, { timeout });
111
111
  /** @param {import('playwright').Page} page */
112
- const contentKeys = page => page.evaluate(async () => (await caches.keys()).includes('ws-content-v1') ? (await (await caches.open('ws-content-v1')).keys()).map(request => request.url) : []);
112
+ // OFFLINE OF12: the channel sits in the name (`ws-preview-content-v1` on a build with no world; production keeps `ws-content-v1`)
113
+ const contentKeys = page => page.evaluate(async () => { const name = (await caches.keys()).find(key => /^ws-(?:[a-z]+-)?content-v1$/u.test(key)); return name === undefined ? [] : (await (await caches.open(name)).keys()).map(request => request.url); });
113
114
  /** @param {import('playwright').Page} page @param {() => Promise<boolean>} test @param {string} what */
114
115
  async function until(page, test, what) {
115
116
  const end = Date.now() + timeout;
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // C4 (J28, J29, J30): the cook worker.
3
3
  // node --import ./scripts/bake-loader.mjs scripts/cook-worker.mjs serve notify endpoint; lists the catalogue at boot
4
+ // (production, preview and staging heads: MS2.4, a new author's `upload --channel staging` is a staging head only)
4
5
  // node --import ./scripts/bake-loader.mjs scripts/cook-worker.mjs recook every live and preview head, then exit; a deploy's step
5
6
  // node --import ./scripts/bake-loader.mjs scripts/cook-worker.mjs bake <dist> <origin> the live heads this build cooked, onto its built client
6
7
  // node --import ./scripts/bake-loader.mjs scripts/cook-worker.mjs gc <build>... keep those builds and every build a channel's
@@ -20,6 +21,7 @@ const { addStoredShards } = await import('./app-build/catalogue.ts');
20
21
  const { refreshServiceWorker } = await import('./app-build/serviceWorker.ts');
21
22
  const { folderStore, r2Store } = await import('../src/cook/game/packStore.ts');
22
23
  const { rendererRevision } = await import('./renderer-revision.mjs');
24
+ const { shardfileValidationRevision } = await import('./shardfile-validation-revision.mjs');
23
25
  const { liveDeployBuilds } = await import('./app-build/previousDeploy.mjs');
24
26
 
25
27
  const env = process.env;
@@ -33,9 +35,13 @@ const root = fileURLToPath(new URL('..', import.meta.url));
33
35
  const maxBytes = Number(env.COOK_MAX_SHARDFILE_BYTES ?? MAX_SHARDFILE_BYTES);
34
36
  /** J262: the jobs can't compute it under `--permission`; a host that can't either cooks every preparation as stale. */
35
37
  const renderer = (() => { try { return rendererRevision(root); } catch { return undefined; } })();
38
+ /** SA48: the validator each job validates with; an index stamped with it lets a page of the same validator admit the shard. */
39
+ const validator = (() => { try { return shardfileValidationRevision(root); } catch { return undefined; } })();
40
+ if (validator === undefined) console.warn('cook-worker: no shardfile validator revision, so no index carries a verdict and no page enters a placed slug from it (SA48)');
36
41
  const worker = () => createCookWorker({
37
42
  build: need('WILDSHARD_BUILD'), store, source: apiSource(need('WILDSHARD_API_URL'), fetch, maxBytes), log: line => { console.log(line); },
38
43
  serverPacks: resolve(env.COOK_SERVER_PACKS ?? 'tmp/cook/server'), scratch: resolve(env.COOK_SCRATCH ?? 'tmp/cook/scratch'),
44
+ ...(validator === undefined ? {} : { validator }),
39
45
  launcher: {
40
46
  root, execPath: process.execPath, loader: fileURLToPath(new URL('bake-loader.mjs', import.meta.url)), script: fileURLToPath(new URL('cook-job.mjs', import.meta.url)),
41
47
  wrap: JSON.parse(env.COOK_JOB_WRAP ?? '[]'), ...(renderer === undefined ? {} : { renderer }),
@@ -48,12 +54,12 @@ if (command === 'serve') {
48
54
  const cook = worker(), port = Number(env.COOK_PORT ?? 8792), host = env.COOK_HOST ?? '127.0.0.1';
49
55
  notifyServer(cook, need('COOK_NOTIFY_TOKEN')).listen(port, host, () => { console.log(`cook worker on ${host}:${port}`); });
50
56
  // J30: what a missed notice left behind. A catalogue that can't be read waits for the next notice.
51
- try { await cook.recook(['live', 'preview']); } catch (error) { console.error(`boot list failed: ${String(error)}`); }
57
+ try { await cook.recook(['live', 'preview', 'staging']); } catch (error) { console.error(`boot list failed: ${String(error)}`); }
52
58
  } else if (command === 'recook') {
53
- const cook = worker(), rows = await cook.recook(['live']), preview = await cook.recook(['preview']);
59
+ const cook = worker(), rows = await cook.recook(['live']), preview = await cook.recook(['preview', 'staging']);
54
60
  console.log(JSON.stringify([...rows, ...preview]));
55
61
  // J29: a build takes no traffic with a live shard it couldn't cook. A refused head is already live, so it stops a deploy
56
- // too. A preview head has players on no build, so its verdict is the author's and stops nothing.
62
+ // too. A preview or staging head's verdict is the author's and stops nothing (MS2.4: staging is where a new author uploads).
57
63
  process.exit(rows.every(row => row.state === 'cooked' || row.state === 'present') ? 0 : 1);
58
64
  } else if (command === 'bake') {
59
65
  // A deploy's step after `recook`: a page reads each head's packs from the store (J138), with no client rebuild.
package/scripts/cook.mjs CHANGED
@@ -1,19 +1,36 @@
1
1
  #!/usr/bin/env node
2
2
  // C1 (J28): `cook <shardfile.tar> <out>`, a shard's packs from its tarball alone: no bundle, no src/shards, no public/.
3
- // node --import ./scripts/bake-loader.mjs scripts/cook.mjs <shardfile.tar> <out>
3
+ // node --import ./scripts/bake-loader.mjs scripts/cook.mjs <shardfile.tar> <out> [--no-phone-tier | --phone-textures | --phone-astc6]
4
4
  // `out` receives `assets/spawn/parts/<hash>.pack.br`, one manifest per tier and set, and what no part may hold at its URL.
5
+ // By default (S12d) each phone row of the KTX2 table is cooked from its desktop master as ASTC 6×6 by basisu's
6
+ // WebAssembly build (`wasmAstc6`), cached in $WILDSHARD_ASTC6_CACHE (default ~/.cache/wildshard/gen/astc6-wasm/1).
7
+ // --no-phone-tier: phones read the rows as authored (before S12b). --phone-textures (S12b): trimmed to the phone size only.
8
+ // --phone-astc6 (S12c): the 6×6 encode by the basisu CLI (`basisuAstc6`), cached in ~/.cache/wildshard/gen/astc6/1.
9
+ // The encode counts go to stderr.
5
10
  import { readFileSync } from 'node:fs';
6
11
  import { homedir } from 'node:os';
7
12
  import { resolve } from 'node:path';
8
13
  import { BrotliSizeCache } from '../src/cook/game/brotliSizeCache.mjs';
9
14
 
10
15
  const { cookShard, servedAsIs } = await import('../src/cook/game/shardCook.ts');
11
- const [tarball, out] = process.argv.slice(2);
12
- if (tarball === undefined || out === undefined) throw new Error('usage: cook <shardfile.tar> <out>');
16
+ const FLAGS = new Set(['--no-phone-tier', '--phone-textures', '--phone-astc6']);
17
+ const flags = process.argv.slice(2).filter(arg => arg.startsWith('--')), unknown = flags.find(flag => !FLAGS.has(flag));
18
+ if (unknown !== undefined) throw new Error(`cook: unknown flag ${unknown}`);
19
+ const [tarball, out] = process.argv.slice(2).filter(arg => !arg.startsWith('--'));
20
+ if (tarball === undefined || out === undefined || flags.length > 1) throw new Error('usage: cook <shardfile.tar> <out> [--no-phone-tier | --phone-textures | --phone-astc6]');
13
21
  const served = new BrotliSizeCache(process.env.WILDSHARD_WIRE_SIZE_CACHE ?? resolve(homedir(), '.cache/wildshard/gen/served-bytes/1'));
22
+ const wasm = flags.length === 0
23
+ ? await (await import('../src/cook/game/astc6Wasm.ts')).wasmAstc6({ cacheDir: process.env.WILDSHARD_ASTC6_CACHE ?? resolve(homedir(), '.cache/wildshard/gen/astc6-wasm/1') })
24
+ : undefined;
25
+ const astc6 = flags.includes('--phone-astc6')
26
+ ? (await import('../src/cook/game/astc6Encode.ts')).basisuAstc6(process.env.WILDSHARD_ASTC6_CACHE ?? resolve(homedir(), '.cache/wildshard/gen/astc6/1'))
27
+ : wasm;
28
+ const tiers = flags.includes('--no-phone-tier') ? {} : { phone: true, ...(astc6 === undefined ? {} : { encode: astc6.encode }), ...(wasm === undefined ? {} : { prepare: wasm }) };
14
29
  const report = await cookShard(readFileSync(tarball), resolve(out), {
15
30
  now: () => performance.now(),
16
31
  wireBytes: (url, bytes) => servedAsIs(url, bytes) ? bytes.length : served.bytes(bytes),
17
32
  warn: line => { console.warn(`warning: ${line}`); },
33
+ tiers,
18
34
  });
35
+ if (astc6 !== undefined) console.warn(`astc6: ${astc6.stats.encoded} encoded, ${astc6.stats.reused} reused, ${astc6.stats.failed} failed`);
19
36
  console.log(JSON.stringify(report));
@@ -0,0 +1,4 @@
1
+ /** The `client.device` lines in a journal's text, oldest first. */
2
+ export function deviceLines(text: string): Record<string, unknown>[];
3
+ /** The lines as a fixed-width table. */
4
+ export function deviceTable(lines: readonly Record<string, unknown>[]): string;