@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
@@ -4,32 +4,56 @@
4
4
  // from the deck's card, then walks into a same-worker neighbour (Sunscar, or Pine Hollow), boosts back into Driftwood and boosts out again, by
5
5
  // real input. Each leg passes with no stop (no 1.5 s under 0.15 m a sample while the key is held), no page reload, and control in the
6
6
  // target cell (the page inside it, gameplay ready, the player moving). It writes time-to-control per leg beside GC1's baseline.
7
- // scripts/browser-lane.sh node scripts/grid-crossing-walk-proof.mjs <app dist stamped with http://127.0.0.1:18799/release.json> <work dir> <key.json> [--engine=chromium|webkit] [--to=sunscar|pine|farreach|nalati] [--workers=2] [--base=<staging url>] [--out=<dir>]
7
+ // scripts/browser-lane.sh node scripts/grid-crossing-walk-proof.mjs <app dist stamped with http://127.0.0.1:18799/release.json> <work dir> <key.json> [--engine=chromium|webkit] [--to=sunscar|pine|farreach|nalati] [--workers=2] [--base=<staging url>] [--out=<dir>] [--layout=phone] [--solo]
8
+ // GRID-CROSSING GC24 (J311): --layout=phone walks at Jake's iPhone layout (402x874, pixel density 3, touch, phone tier), and each
9
+ // leg's control reads the page's memory (JS heap, the grid's resident and playing MB, the owner ledger, the memory warning);
10
+ // --solo then opens both shards' one-shard pages (?chunk=) in fresh profiles for the same read beside it.
8
11
  import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
9
12
  import { join, resolve as absolute } from 'node:path';
10
13
  import { chromium, webkit } from 'playwright';
11
14
  import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
12
15
  import { saveFixture } from './debug-settings.mjs';
16
+ import { pageMemoryAttributionExpression } from './memory-report-snapshot.mjs';
13
17
  import { openRig, WORLD_PORT } from './online-rig.mjs';
14
18
 
15
19
  const [dist = '', relativeWork = '', keyFile = ''] = process.argv.slice(2).filter(arg => !arg.startsWith('--')), work = relativeWork === '' ? '' : absolute(relativeWork);
16
20
  if (dist === '' || work === '' || keyFile === '') throw new Error('usage: grid-crossing-walk-proof.mjs <dist> <work> <key.json> [--engine=chromium|webkit] [--to=sunscar|pine|farreach|nalati] [--out=<dir>]');
17
21
  const engineName = process.argv.find(arg => arg.startsWith('--engine='))?.slice(9) ?? 'chromium', out = absolute(process.argv.find(arg => arg.startsWith('--out='))?.slice(6) ?? join(work, 'shots'));
18
22
  if (engineName !== 'chromium' && engineName !== 'webkit') throw new Error(`No engine ${engineName}`);
23
+ const phone = process.argv.includes('--layout=phone'), solo = process.argv.includes('--solo');
24
+ // GRID-CROSSING GC2: --breach, at the first wall a leg is held at (a neighbour still preparing: the page's loading wall), else when
25
+ // the last leg ends held (a cell on another worker, GC30's Far Reach wall), throws the breach cases at it by real input from where
26
+ // it stands: jump into it, jump along it both ways, and boost-jump into it. A case holds when the page never enters the target
27
+ // while its crossing is unready and the walker stays on the road, standing; entering once the neighbour is ready is the crossing.
28
+ const breach = process.argv.includes('--breach');
29
+ /** The page's memory now: JS heap (Chromium), the grid's resident and playing MB, the owner ledger's totals, the memory warning. */
30
+ const MEMORY_READ = `(() => { const api = window.__wildshard; let ledger = null; try { const mem = ${pageMemoryAttributionExpression}; ledger = mem?.totals ? { gpuMB: Math.round(mem.totals.gpu / 1048576), ramMB: Math.round(mem.totals.ram / 1048576) } : null; } catch {}
31
+ let grid = null; try { const st = api.shard.grid.state(); grid = { inside: st.inside, residentMB: st.residentMB, playingMB: st.playingMB }; } catch {}
32
+ const warning = document.querySelector('.ws-memory-warning');
33
+ return { heapMB: performance.memory ? Math.round(performance.memory.usedJSHeapSize / 1048576) : null, ledger, grid, memoryWarning: warning !== null && warning.getClientRects().length > 0 }; })()`;
34
+ /** @param {import('playwright').Browser} b */
35
+ const newContext = b => b.newContext(phone ? { viewport: { width: 402, height: 874 }, deviceScaleFactor: 3, isMobile: engineName === 'chromium', hasTouch: true,
36
+ userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/27.0.1 Mobile/15E148 Safari/604.1' } : { viewport: { width: 1440, height: 900 } });
19
37
  mkdirSync(out, { recursive: true });
20
38
  /** Driftwood is cell [0, 0]; its same-worker neighbours Pine Hollow [0, 1] (+z, across the island from the spawn at z -194) and Sunscar
21
39
  * [-1, 0] (-x). Far Reach [0, -1] is sky islands: arriving at road height falls below its death floor (GC15b). */
22
40
  // Each edge is a bank from the sea floor (-3.4 m) up to the road (0 m) except its entryway, 8 m wide at the edge's middle
23
41
  // (`sections/world/edge.json`), so a crossing goes through it: `approach` are waypoints in Driftwood's frame, boosted and not scored,
24
42
  // that end in front of it; the legs then walk straight through it.
25
- const NEIGHBOURS = /** @type {Record<string, { slug: string, axis: 'x' | 'z', sign: number, approach: [number, number][] }>} */ ({
26
- pine: { slug: 'pine-hollow', axis: 'z', sign: 1, approach: [[-235, -194], [-235, 235], [0, 235]] }, sunscar: { slug: 'sunscar-dunes', axis: 'x', sign: -1, approach: [[-235, -194], [-235, 0]] },
43
+ const NEIGHBOURS = /** @type {Record<string, { slug: string, axis: 'x' | 'z', sign: number, approach: [number, number][], from?: { slug: string, card: string }, place?: boolean }>} */ ({
44
+ pine: { slug: 'pine-hollow', axis: 'z', sign: 1, approach: [[-235, -194], [-235, 0], [-200, 20], [-200, 235], [0, 235]] }, sunscar: { slug: 'sunscar-dunes', axis: 'x', sign: -1, approach: [[-235, -194], [-235, 0]] },
27
45
  // GC29 (Jake 11-13): his walk off the south dock toward Far Reach, and east into Nalati (staging: another worker).
28
- farreach: { slug: 'far-reach', axis: 'z', sign: -1, approach: [[0, -235]] }, nalati: { slug: 'nalati-grasslands', axis: 'x', sign: 1, approach: [[235, -194], [235, 0]] } });
46
+ farreach: { slug: 'far-reach', axis: 'z', sign: -1, approach: [[0, -235]] }, nalati: { slug: 'nalati-grasslands', axis: 'x', sign: 1, approach: [[235, -194], [235, 0]] },
47
+ // GC23 (J305): Night Market (open-plot-3-0, cell [1, -2]) from its north neighbour Nine Dragon [1, -1], entered by its own card.
48
+ // Nine Dragon's stack has no walkable route to its south entryway, so the approach is placed by the harness pose (not scored);
49
+ // the legs across the line are real input as everywhere else.
50
+ nightmarket: { slug: 'open-plot-3-0', axis: 'z', sign: -1, approach: [[0, -238]], from: { slug: 'nine-dragon-stack', card: 'Nine Dragon Stack' }, place: true } });
29
51
  const toName = process.argv.find(arg => arg.startsWith('--to='))?.slice(5) ?? 'sunscar', to = NEIGHBOURS[toName];
30
52
  if (to === undefined) throw new Error(`No neighbour ${toName}: ${Object.keys(NEIGHBOURS).join(', ')}`);
31
- const HOME = 'driftwood-isle', NEXT = to.slug, STUCK_MS = 1500, LEG_MS = 100_000;
32
- const LEGS = [{ name: `walk-to-${toName}`, target: NEXT, sign: 1, boost: false }, { name: 'boost-to-driftwood', target: HOME, sign: -1, boost: true }, { name: `boost-to-${toName}`, target: NEXT, sign: 1, boost: true }];
53
+ // a placed approach needs the in-page harness (preview or a loopback page): an online page can't place its seat (shell.ts place is idle)
54
+ const placed = to.place === true || process.argv.includes('--place');
55
+ const HOME = to.from?.slug ?? 'driftwood-isle', HOME_CARD = to.from?.card ?? 'Driftwood Isle', NEXT = to.slug, STUCK_MS = 1500, LEG_MS = 100_000;
56
+ const LEGS = [{ name: `walk-to-${toName}`, target: NEXT, sign: 1, boost: false }, { name: `boost-to-${HOME.split('-')[0] ?? HOME}`, target: HOME, sign: -1, boost: true }, { name: `boost-to-${toName}`, target: NEXT, sign: 1, boost: true }];
33
57
  /** @type {{ step: string, ok: boolean, detail?: unknown }[]} */
34
58
  const steps = [];
35
59
  /** @param {string} step @param {boolean} ok @param {unknown} [detail] */
@@ -46,33 +70,45 @@ const rig = served !== '' ? { base: served.replace(/\/$/, ''), close: () => Prom
46
70
  : await openRig({ dist, work, keyFile, pgBin: 'memory:', pgData: '', shard: HOME, more: ['pine-hollow', 'far-reach', 'sunscar-dunes', 'nalati-grasslands'], cells: 'grid', crossing: true, workers });
47
71
  let code = 1, browser = /** @type {import('playwright').Browser | null} */ (null);
48
72
  /** @type {Record<string, unknown>} */
49
- const result = { lane: 'opus-gc15c', engine: engineName, layout: 'desktop 1440x900', site: served !== '' ? served : 'local rig, WORLD_CELLS=grid, WORLD_CROSSING=worker, WORLD_WORKERS=2 (staging: Nalati alone, Driftwood with Pine Hollow, Sunscar and Far Reach)' };
73
+ const result = { lane: 'opus-gc15c', engine: engineName, layout: phone ? 'phone 402x874 touch' : 'desktop 1440x900', site: served !== '' ? served : 'local rig, WORLD_CELLS=grid, WORLD_CROSSING=worker, WORLD_WORKERS=2 (staging: Nalati alone, Driftwood with Pine Hollow, Sunscar and Far Reach)' };
50
74
  try {
51
75
  let open = served !== '' ? { cells: 25 } : null;
52
76
  for (let tries = 0; tries < 300 && open === null; tries++) { open = await fetch(`http://127.0.0.1:${String(WORLD_PORT)}/health`).then(found => found.ok ? found.json() : null).catch(() => null); if (open === null) await sleep(200); }
53
77
  note('the world runs the grid', open !== null && open.cells > 1, served !== '' ? { skipped: 'a served site: not read' } : { cells: open?.cells });
54
78
  if (open === null) throw new Error(`The world did not start: see ${join(work, 'server.log')}`);
55
- browser = await (engineName === 'webkit' ? webkit : chromium).launch({ headless: true, args: engineName === 'chromium' ? [...KEYCHAIN_ARGS, '--mute-audio', '--use-angle=metal', '--ignore-gpu-blocklist'] : [] });
56
- const context = await browser.newContext({ viewport: { width: 1440, height: 900 } }), page = await context.newPage(), errors = /** @type {string[]} */ ([]);
79
+ browser = await (engineName === 'webkit' ? webkit : chromium).launch({ headless: true, args: engineName === 'chromium' ? [...KEYCHAIN_ARGS, '--mute-audio', '--use-angle=metal', '--ignore-gpu-blocklist', '--enable-precise-memory-info'] : [] });
80
+ const context = await newContext(browser), page = await context.newPage(), errors = /** @type {string[]} */ ([]);
81
+ // RP4: every program's first use (three's uniform read after its link, where a link not yet finished blocks the frame),
82
+ // counted so a leg's receipt says how many programs linked on the way (a cell's whole set relinking at its edge was 2.5 s)
83
+ await context.addInitScript(() => {
84
+ const W = /** @type {any} */ (window); W.__programLinks = 0;
85
+ for (const C of [W.WebGL2RenderingContext, W.WebGLRenderingContext]) {
86
+ if (C === undefined) continue;
87
+ const read = C.prototype.getProgramParameter;
88
+ C.prototype.getProgramParameter = function getProgramParameter(/** @type {WebGLProgram} */ program, /** @type {number} */ name) { if (name === this.ACTIVE_UNIFORMS) W.__programLinks++; return read.call(this, program, name); };
89
+ }
90
+ });
57
91
  page.on('pageerror', error => { errors.push(error.message.slice(0, 240)); });
58
92
  let navigations = 0;
59
93
  page.on('framenavigated', frame => { if (frame === page.mainFrame()) navigations++; });
60
94
  await saveFixture(context, { scope: 'device', key: 'firstPlayDone', data: true });
61
95
  await saveFixture(context, { scope: 'device', key: 'devMode', data: true });
96
+ if (phone) await saveFixture(context, { scope: 'global', key: 'settings', merge: true, data: { tier: 'phone', volume: 0 } });
62
97
  await page.goto(`${rig.base}/?mute=1&nolock=1`, { waitUntil: 'load' });
63
98
  await page.locator('.ws-main-select').click({ timeout: 120_000 });
64
99
  if (await page.locator('#ws-name-box input').waitFor({ timeout: 30_000 }).then(() => true).catch(() => false)) { await page.locator('#ws-name-box input').fill('walker'); await page.locator('#ws-name-box button[type=submit]').click(); }
65
100
  await page.locator('.ws-menu-card').first().waitFor({ state: 'visible', timeout: 30_000 });
66
- const index = await page.evaluate(() => [...document.querySelectorAll('.ws-menu-card')].findIndex(row => (row.textContent ?? '').includes('Driftwood Isle')));
67
- if (index < 0) throw new Error('No Driftwood Isle card');
101
+ const index = await page.evaluate(card => [...document.querySelectorAll('.ws-menu-card')].findIndex(row => (row.textContent ?? '').includes(card)), HOME_CARD);
102
+ if (index < 0) throw new Error(`No ${HOME_CARD} card`);
68
103
  await page.locator('.ws-menu-dots i').nth(index).click();
69
104
  const played = Date.now();
70
105
  await page.locator('.ws-menu-play').click();
71
106
  await page.waitForFunction(() => /** @type {any} */ (window).__wildshard?.shard?.grid?.state?.().live?.live?.gameplayReady === true, undefined, { timeout: 180_000, polling: 100 });
72
107
  result.playToReadyMs = Date.now() - played;
73
- note('Driftwood: gameplay ready after Play', true, { ms: result.playToReadyMs });
108
+ note(`${HOME_CARD}: gameplay ready after Play`, true, { ms: result.playToReadyMs });
74
109
  await sleep(2000);
75
110
  await page.getByText('DONE', { exact: true }).click({ timeout: 2000 }).catch(() => undefined);
111
+ result.memoryAtHome = await page.evaluate(MEMORY_READ);
76
112
  const navigationsBefore = navigations;
77
113
  await page.evaluate(() => {
78
114
  const W = /** @type {any} */ (window), q = W.__gc15c = { frames: /** @type {number[][]} */ ([]), samples: /** @type {unknown[]} */ ([]), sentinel: 1 }, t0 = performance.now();
@@ -83,7 +119,7 @@ try {
83
119
  setInterval(() => { try {
84
120
  const st = W.__wildshard.shard.grid.state(), p = W.__wildshard.world.player, lv = st.live, wire = W.__workerClient?.();
85
121
  q.samples.push({ t: Math.round(performance.now() - t0), x: Number(p.position.x.toFixed(2)), y: Number(p.position.y.toFixed(2)), z: Number(p.position.z.toFixed(2)), inside: st.inside, phase: lv?.crossing?.phase, target: lv?.crossing?.target, issue: lv?.crossing?.issue, site: W.__workerClient?.().site,
86
- ready: lv?.live?.gameplayReady, loading: st.cellLoading, closed: st.softWalls?.closed, feet: st.feet, frames: wire?.frames, own: wire?.own });
122
+ ready: lv?.live?.gameplayReady, loading: st.cellLoading, stage: st.cellStage, step: st.cellStep?.step ?? null, closed: st.softWalls?.closed, feet: st.feet, frames: wire?.frames, own: wire?.own });
87
123
  } catch (error) { q.samples.push({ err: String(error).slice(0, 160) }); } }, 100);
88
124
  });
89
125
  await sleep(500);
@@ -101,7 +137,7 @@ try {
101
137
  const toward = async (/** @type {number} */ x, /** @type {number} */ z) => { const at = await sample(); await face(Math.atan2(at.x - x, at.z - z)); return Math.hypot(at.x - x, at.z - z); };
102
138
  const approached = Date.now();
103
139
  await page.keyboard.down('ShiftLeft');
104
- for (const [x, z] of to.approach) {
140
+ for (const [x, z] of placed ? [] : to.approach) {
105
141
  await page.keyboard.down('KeyW');
106
142
  let near = Infinity, stuck = 0, before = await sample();
107
143
  for (const ends = Date.now() + 90_000; Date.now() < ends && near > 3; await sleep(250)) {
@@ -113,6 +149,13 @@ try {
113
149
  await page.keyboard.up('KeyW');
114
150
  note(`the approach reaches (${String(x)}, ${String(z)})`, near <= 3, { near: Math.round(near), at: { x: before.x, z: before.z } });
115
151
  }
152
+ // a placed approach: the in-page harness pose (probe.ts `told`), so the in-page server hears where the walker stands
153
+ if (placed) for (const [x, z] of to.approach) {
154
+ await page.evaluate(([px, pz]) => { const p = /** @type {any} */ (window).__wildshard.world.player; p.spawn(px, pz, p.yaw, 1.5); p.link?.place?.(p.position.x, p.position.y, p.position.z, p.yaw); }, [x, z]);
155
+ await sleep(4000);
156
+ const at = await sample();
157
+ note(`the harness places the walker at (${String(x)}, ${String(z)})`, Math.hypot(at.x - x, at.z - z) <= 3 && at.inside === HOME, { at: { x: at.x, y: at.y, z: at.z }, inside: at.inside });
158
+ }
116
159
  await page.keyboard.up('ShiftLeft'); await sleep(600);
117
160
  result.approachMs = Date.now() - approached;
118
161
  // The yaw that walks toward the neighbour: the page's motor faces atan2(own - target) (ui.ts faceToward), so +z is π and -x is π/2;
@@ -120,6 +163,41 @@ try {
120
163
  let north = to.axis === 'z' ? (to.sign > 0 ? Math.PI : 0) : (to.sign > 0 ? -Math.PI / 2 : Math.PI / 2);
121
164
  { await face(north); const a = await sample(); await page.keyboard.down('KeyW'); await sleep(1200); await page.keyboard.up('KeyW'); await sleep(300); const b = await sample();
122
165
  if ((b[to.axis] - a[to.axis]) * to.sign < 0) north += Math.PI; result.probe = { axis: to.axis, from: a[to.axis], to: b[to.axis], yaw: north }; }
166
+ /** GC2: the breach cases at the wall the walker is held at, by real input, facing `yaw` toward `target`. A case is a breach when
167
+ * the page enters the target while its crossing is still unready (preparing or blocked: the wall was closed), or the walker
168
+ * falls off the road. Run once a walk: at the first leg held at a preparing neighbour (the in-page loading wall), else at the end. */
169
+ const breachCases = async (/** @type {string} */ where, /** @type {number} */ yaw, /** @type {string} */ target) => {
170
+ /** @type {Record<string, unknown>[]} */ const cases = []; result.breach = { where, cases };
171
+ const keys = /** @type {Record<string, string[]>} */ ({ 'jump into it': ['KeyW'], 'jump along it, right': ['KeyW', 'KeyD'], 'jump along it, left': ['KeyW', 'KeyA'], 'boost-jump into it': ['KeyW', 'ShiftLeft'] });
172
+ await face(yaw);
173
+ for (const [name, held_] of Object.entries(keys)) {
174
+ const start = await sample(), sign = target === NEXT ? to.sign : -to.sign;
175
+ // the wall opened under an earlier case (the neighbour got ready): the walker is across, nothing is left to breach
176
+ if (start.inside === target) { cases.push({ name, skipped: 'the wall opened: the walker is in the target' }); note(`breach (${where}): ${name}`, true, { skipped: 'the wall opened' }); continue; }
177
+ let entered = false, breached = false, lowest = Infinity, furthest = -Infinity, last = start, closedSamples = 0, samples = 0;
178
+ for (const key of held_) await page.keyboard.down(key);
179
+ for (let jump = 0; jump < 8; jump++) {
180
+ await page.keyboard.press('Space');
181
+ for (let tick = 0; tick < 3; tick++) {
182
+ await sleep(250);
183
+ const at = await sample();
184
+ if (at === undefined || at.err !== undefined) continue;
185
+ samples++; if (at.phase === 'preparing' || at.phase === 'blocked' || (at.closed ?? 0) > 0) closedSamples++;
186
+ if (at.inside === target && last.inside !== target) { entered = true; breached ||= last.phase === 'preparing' || last.phase === 'blocked'; }
187
+ lowest = Math.min(lowest, at.y); furthest = Math.max(furthest, at[to.axis] * sign); last = at;
188
+ }
189
+ }
190
+ for (const key of held_) await page.keyboard.up(key);
191
+ await sleep(800);
192
+ const end = await sample();
193
+ await page.screenshot({ path: join(out, `${engineName}-breach-${name.replaceAll(/[^a-z]+/gu, '-')}.png`) });
194
+ const row = { name, entered, breached, closedShare: samples === 0 ? null : Number((closedSamples / samples).toFixed(2)), past: Number((furthest - start[to.axis] * sign).toFixed(2)), lowest: Number(lowest.toFixed(2)),
195
+ start: { x: start.x, y: start.y, z: start.z, phase: start.phase, closed: start.closed }, end: { inside: end.inside, x: end.x, y: end.y, z: end.z, phase: end.phase } };
196
+ cases.push(row);
197
+ // entering once the neighbour is ready is the crossing working, not a breach; a held wall must also keep the walker on the road
198
+ note(`breach (${where}): ${name} holds`, !breached && lowest > -2 && (entered || end.inside === null), row);
199
+ }
200
+ };
123
201
  /** @type {Record<string, unknown>[]} */
124
202
  const legs = [];
125
203
  for (const leg of LEGS) {
@@ -128,7 +206,7 @@ try {
128
206
  /** @type {Record<string, unknown>[]} */
129
207
  const events = [];
130
208
  let stuckSince = 0, stuckMs = 0, worstStuck = 0, last = start, enteredAt = 0, controlAt = 0, roadAt = 0, jumps = 0;
131
- const t1 = Date.now(), framesFrom = await page.evaluate(() => /** @type {any} */ (window).__gc15c.frames.length);
209
+ const t1 = Date.now(), samplesFrom = await page.evaluate(() => /** @type {any} */ (window).__gc15c.samples.length), framesFrom = await page.evaluate(() => /** @type {any} */ (window).__gc15c.frames.length), linksFrom = await page.evaluate(() => /** @type {any} */ (window).__programLinks);
132
210
  await face(yaw);
133
211
  await page.keyboard.down('KeyW'); if (leg.boost) await page.keyboard.down('ShiftLeft');
134
212
  while (Date.now() - t1 < LEG_MS) {
@@ -141,8 +219,14 @@ try {
141
219
  if (s.inside === leg.target && enteredAt === 0) enteredAt = at;
142
220
  if (controlAt === 0) {
143
221
  if (moved < 0.15) { stuckSince ||= at; } else { if (stuckSince !== 0) { stuckMs += at - stuckSince; worstStuck = Math.max(worstStuck, at - stuckSince); } stuckSince = 0; }
222
+ if (breach && result.breach === undefined && stuckSince !== 0 && at - stuckSince > STUCK_MS && s.inside !== leg.target && s.phase === 'preparing') {
223
+ await page.keyboard.up('KeyW'); if (leg.boost) await page.keyboard.up('ShiftLeft');
224
+ await breachCases(`${leg.name}, held at ${leg.target} while it prepares`, yaw, leg.target);
225
+ await face(yaw); await page.keyboard.down('KeyW'); if (leg.boost) await page.keyboard.down('ShiftLeft');
226
+ stuckSince = 0; last = await sample(); continue;
227
+ }
144
228
  if (stuckSince !== 0 && at - stuckSince > STUCK_MS && jumps < 4) { if (jumps === 0) { events.push({ at, stuck: true, x: s.x, z: s.z, inside: s.inside, closed: s.closed, phase: s.phase }); await page.screenshot({ path: join(out, `${engineName}-${leg.name}-stuck.png`) }); } await page.keyboard.press('Space'); jumps++; }
145
- if (s.inside === leg.target && s.ready === true && (s.phase === undefined || s.phase === 'settled') && moved > 0.3) { controlAt = at; events.push({ at, control: true, x: s.x, z: s.z }); }
229
+ if (s.inside === leg.target && s.ready === true && (s.phase === undefined || s.phase === 'settled') && moved > 0.3) { controlAt = at; events.push({ at, control: true, x: s.x, z: s.z, memory: await page.evaluate(MEMORY_READ) }); }
146
230
  }
147
231
  last = s;
148
232
  if (controlAt !== 0 && at - controlAt > 2500) break;
@@ -153,17 +237,51 @@ try {
153
237
  await page.keyboard.up('KeyW'); if (leg.boost) await page.keyboard.up('ShiftLeft');
154
238
  const end = await sample(), frames = /** @type {number[][]} */ (await page.evaluate(n => /** @type {any} */ (window).__gc15c.frames.slice(n), framesFrom));
155
239
  await page.screenshot({ path: join(out, `${engineName}-${leg.name}-after.png`) });
156
- const deltas = frames.map(row => row[1] ?? 0), row = { name: leg.name, from, target: leg.target, boost: leg.boost, roadAtMs: roadAt, enteredAtMs: enteredAt, controlAtMs: controlAt,
240
+ const programLinks = await page.evaluate(() => /** @type {any} */ (window).__programLinks) - linksFrom;
241
+ // NET-LAG NL7: the crossing as numbers. From the page's 100 ms samples: the border (the first sample outside the cell the leg
242
+ // left) to the target's gameplay ready, each loading-card row's time on screen, and the longest the feet stood still while the
243
+ // key was held (the stop above, at 250 ms)
244
+ const legSamples = /** @type {any[]} */ (await page.evaluate(n => /** @type {any} */ (window).__gc15c.samples.slice(n), samplesFrom)).filter(entry => entry.err === undefined);
245
+ const border = legSamples.find(entry => entry.inside !== from), ready = legSamples.find(entry => entry.inside === leg.target && entry.ready === true && (entry.phase === undefined || entry.phase === 'settled'));
246
+ /** @type {Record<string, number>} */
247
+ const stages = {};
248
+ for (const [at, entry] of legSamples.entries()) { const next = legSamples[at + 1]; if (next !== undefined && typeof entry.stage === 'string') stages[entry.stage] = (stages[entry.stage] ?? 0) + next.t - entry.t; }
249
+ const deltas = frames.map(row => row[1] ?? 0), row = { name: leg.name, borderToReadyMs: border === undefined || ready === undefined ? null : Math.max(0, ready.t - border.t), stages, programLinks, from, target: leg.target, boost: leg.boost, roadAtMs: roadAt, enteredAtMs: enteredAt, controlAtMs: controlAt,
157
250
  borderToControlMs: enteredAt === 0 || controlAt === 0 ? null : controlAt - enteredAt, worstStopMs: worstStuck, stoppedMs: stuckMs, jumps, frames: deltas.length,
158
- over50: deltas.filter(ms => ms > 50).length, worstFrameMs: Math.max(0, ...deltas), events, end };
251
+ over50: deltas.filter(ms => ms > 50).length, over100: deltas.filter(ms => ms > 100).length, worstFrameMs: Math.max(0, ...deltas), events, end };
159
252
  legs.push(row);
160
253
  note(`${leg.name}: arrives in ${leg.target} with control`, controlAt !== 0, { enteredAt, controlAt, end: { inside: end.inside, z: end.z, ready: end.ready } });
161
254
  note(`${leg.name}: no stop or wall on the way`, worstStuck <= STUCK_MS && jumps === 0, { worstStuck, jumps });
162
255
  }
256
+ if (breach && result.breach === undefined) {
257
+ const held = /** @type {any} */ (legs.at(-1));
258
+ if (held === undefined || held.controlAtMs !== 0) note('breach: a leg is held at a wall', false, { skipped: 'no leg was held at a closed wall: nothing to test' });
259
+ else await breachCases('the last leg, held at a wall', north, NEXT);
260
+ }
163
261
  const sentinel = await page.evaluate(() => /** @type {any} */ (window).__gc15c?.sentinel === 1).catch(() => false);
164
262
  note('no page reload through every crossing', sentinel && navigations === navigationsBefore, { sentinel, navigations: navigations - navigationsBefore });
165
263
  note('no page errors', errors.length === 0, errors.slice(0, 5));
166
264
  result.legs = legs;
265
+ note('no memory warning at home or any control', /** @type {{ memoryWarning?: boolean } | undefined} */ (result.memoryAtHome)?.memoryWarning !== true && !legs.some(row => /** @type {any[]} */ (row.events).some(e => e.memory?.memoryWarning === true)));
266
+ if (solo) {
267
+ // the same two shards' one-shard pages, each in a fresh profile at the same layout, read 10 s after their world boots
268
+ /** @type {Record<string, any>} */ const pages = {}; result.solo = pages;
269
+ for (const slug of [HOME, NEXT]) {
270
+ const alone = await newContext(browser), one = await alone.newPage();
271
+ await saveFixture(alone, { scope: 'device', key: 'firstPlayDone', data: true });
272
+ if (phone) await saveFixture(alone, { scope: 'global', key: 'settings', merge: true, data: { tier: 'phone', volume: 0 } });
273
+ try {
274
+ await one.goto(`${rig.base}/?chunk=${slug}&skipintro=1&mute=1&nolock=1`, { waitUntil: 'load' });
275
+ if (await one.locator('#ws-name-box input').waitFor({ timeout: 20_000 }).then(() => true).catch(() => false)) { await one.locator('#ws-name-box input').fill('walker'); await one.locator('#ws-name-box button[type=submit]').click(); }
276
+ await one.waitForFunction(() => { const W = /** @type {any} */ (window); return typeof W.__workerClient === 'function' && W.__workerClient().frames > 0 && Array.isArray(W.__bootTiming?.entries) && W.__bootTiming.entries.some((/** @type {{ operation: string }} */ row) => row.operation === 'app:loader-complete'); }, undefined, { timeout: 180_000, polling: 250 });
277
+ await sleep(10_000);
278
+ pages[slug] = { url: one.url(), ...await one.evaluate(MEMORY_READ) };
279
+ await one.screenshot({ path: join(out, `${engineName}-solo-${slug}.png`) });
280
+ } catch (error) { pages[slug] = { error: String(error).slice(0, 300) }; }
281
+ note(`one-shard page ${slug} read`, pages[slug].error === undefined, pages[slug]);
282
+ await alone.close();
283
+ }
284
+ }
167
285
  const samples = await page.evaluate(() => /** @type {any} */ (window).__gc15c.samples);
168
286
  writeFileSync(join(out, `${engineName}-samples.json`), JSON.stringify(samples));
169
287
  await context.close();
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  // HOST-RULER HR1 (meta docs/plans/HOST-RULER-PLAN.md): the page and section roots one built product reaches.
3
- // Not a revival of shard-platform.mjs: its roots walked src/shards/ and pre-J122 paths. A product reaches engine code
3
+ // Not a revival of the old census (retired by HR9): its roots walked src/shards/ and pre-J122 paths. A product reaches engine code
4
4
  // only through what it declares: its `client/plan` kinds and its section names. A kind roots the import() targets of
5
5
  // its one CLIENT_FEATURES entry (never the whole table); a section roots its row in SECTION_HOSTS. clientPlan.ts's own
6
6
  // static imports are one shared root, `@client-plan`, reached by every product with a `client/plan`.
@@ -15,7 +15,7 @@ export const CLIENT_PLAN_ROOT = '@client-plan';
15
15
 
16
16
  /** Section name -> the host bindings that execute it, side-first (J122). `@wildshard/format/x` resolves through the
17
17
  * pinned format package's exports map. An empty row is metadata read by another section's host: it roots nothing.
18
- * Moved from shard-platform-hosts.mjs (old `<layer>/<side>/x` selectors -> `src/<side>/<layer>/x.ts`). Fixed there:
18
+ * Moved from the old census's section table (old `<layer>/<side>/x` selectors -> `src/<side>/<layer>/x.ts`). Fixed there:
19
19
  * `game/server/shardfile/items` -> src/shared/game/shardfile/items.ts; `game/shardfile/directorClient` is gone, its
20
20
  * rows run in bindShardfileSim's DirectorStageLane. `client/plan` no longer roots `clientPlan#installClientPhase` (the
21
21
  * whole dispatch table, HA0 a) or `declaredEntry#declaredRuntimeEntry` (gone): it roots `@client-plan` and its kinds. */
@@ -0,0 +1,91 @@
1
+ import type { ClientPlanRoots } from './host-ruler/roots.mjs';
2
+ import type { NativeAssemblyRoots } from './host-ruler/server-roots.mjs';
3
+
4
+ export interface TableRule { readonly static: boolean; readonly dynamic: boolean }
5
+ export declare const TABLES: Readonly<Record<string, TableRule>>;
6
+ export declare const SHELL: '@shell';
7
+ export declare const SHELL_ROOTS: readonly string[];
8
+ export declare const SHELL_CONTROL: readonly string[];
9
+ export declare const FORMAT: '@wildshard/format';
10
+ export interface ModuleFacts {
11
+ readonly lines: number;
12
+ readonly imports: readonly string[];
13
+ readonly dynamic: readonly string[];
14
+ readonly opaque: readonly string[];
15
+ readonly declarations: readonly { readonly names: readonly string[]; readonly lines: number }[];
16
+ }
17
+ export interface FormatPackage {
18
+ readonly dir: string;
19
+ readonly version: string;
20
+ readonly exports: Readonly<Record<string, unknown>>;
21
+ readonly published: (path: string) => boolean;
22
+ }
23
+ export interface TreeReader {
24
+ readonly root: string;
25
+ readonly format: FormatPackage;
26
+ readonly followed: (module: string) => boolean;
27
+ readonly read: (module: string) => ModuleFacts;
28
+ }
29
+ export interface ModuleUse { lines: number; layer: string; users: string[] }
30
+ export interface OneUserTotal { modules: number; lines: number; format: number }
31
+ export interface ProductRootModules {
32
+ readonly slug: string;
33
+ readonly roots: readonly string[];
34
+ readonly rootKeys: readonly string[];
35
+ readonly held: ReadonlySet<string>;
36
+ readonly options: readonly string[];
37
+ readonly unmeasuredOptions: readonly string[];
38
+ readonly unmeasured: readonly { readonly host: string; readonly reason: string }[];
39
+ }
40
+ export interface RulerReport {
41
+ readonly today: string;
42
+ readonly ruled: Ruled;
43
+ readonly options: readonly OptionCharge[];
44
+ readonly totals: ReadonlyMap<string, ShardTotal>;
45
+ readonly products: readonly ProductRootModules[];
46
+ readonly format: string;
47
+ readonly modules: ReadonlyMap<string, ModuleUse>;
48
+ readonly oneUser: ReadonlyMap<string, OneUserTotal>;
49
+ readonly root: string;
50
+ readonly reader: TreeReader;
51
+ readonly tables: { readonly plan: ClientPlanRoots; readonly native: NativeAssemblyRoots };
52
+ readonly register: readonly RegisterRule[];
53
+ }
54
+ export interface MeasureOptions {
55
+ readonly tables?: Readonly<Record<string, TableRule>>;
56
+ readonly shell?: { readonly roots: Iterable<string>; readonly control: readonly string[] };
57
+ }
58
+ export function codeLines(source: string, path?: string): number;
59
+ export function formatPackage(dir: string): FormatPackage;
60
+ export function createTreeReader(options?: { readonly root?: string; readonly format?: boolean; readonly formatDir?: string }): TreeReader;
61
+ export function layerOf(module: string): string;
62
+ export function reach(roots: Iterable<string>, reader: TreeReader, tables?: Readonly<Record<string, TableRule>>, held?: ReadonlySet<string>): Set<string>;
63
+ export function productRootModules(dir: string, tables?: { readonly plan?: ClientPlanRoots; readonly native?: NativeAssemblyRoots }, options?: readonly OptionRow[]): ProductRootModules;
64
+ export function measure(users: readonly { readonly slug: string; readonly roots: Iterable<string>; readonly held?: ReadonlySet<string> }[], reader: TreeReader, options?: MeasureOptions): Map<string, ModuleUse>;
65
+ export function oneUserLines(modules: ReadonlyMap<string, ModuleUse>, slugs: readonly string[]): Map<string, OneUserTotal>;
66
+ export function rule(dirs: readonly string[], options?: { readonly root?: string; readonly today?: string; readonly register?: readonly RegisterRule[] }): RulerReport;
67
+ export function formatTable(report: Pick<RulerReport, 'format' | 'options' | 'products' | 'ruled' | 'today' | 'totals'>): string;
68
+ export declare const STATUSES: readonly ['platform', 'pending', 'no-row', 'charged-back', 'silly'];
69
+ export type Status = (typeof STATUSES)[number];
70
+ export interface RegisterRule { readonly key: string; readonly verdict: string; readonly decision?: string; readonly users: readonly string[]; readonly recheck?: string }
71
+ export interface RuledModule { readonly module: string; readonly user: string; readonly lines: number; readonly layer: string; readonly spans: Readonly<Record<Status, number>>; readonly rows: readonly string[] }
72
+ export interface Ruled {
73
+ readonly modules: ReadonlyMap<string, RuledModule>;
74
+ readonly sillyShared: readonly { readonly module: string; readonly users: readonly string[]; readonly lines: number; readonly key: string }[];
75
+ }
76
+ export type ShardTotal = OneUserTotal & Record<Status | 'option' | 'charged', number>;
77
+ export function applyRegister(modules: ReadonlyMap<string, ModuleUse>, reader: TreeReader, rows: readonly RegisterRule[], options: { readonly today: string }): Ruled;
78
+ export function shardTotals(ruled: Ruled, slugs: readonly string[], options?: readonly { readonly user: string; readonly lines: number }[]): Map<string, ShardTotal>;
79
+ export interface OptionRow {
80
+ readonly kind: string;
81
+ readonly option: string;
82
+ readonly when?: (value: unknown) => boolean;
83
+ readonly from?: string;
84
+ readonly bindings: readonly string[];
85
+ }
86
+ export declare const OPTIONS: readonly OptionRow[];
87
+ export interface OptionCharge { readonly key: string; readonly user: string; readonly option: string; readonly lines: number }
88
+ export function optionCharges(modules: ReadonlyMap<string, ModuleUse>, products: readonly { readonly slug: string; readonly options?: readonly string[]; readonly rootKeys?: readonly string[] }[], reader: TreeReader, options?: readonly OptionRow[]): OptionCharge[];
89
+ export interface InventoryRow { readonly module: string; readonly layer: string; readonly lines: number; readonly users: readonly string[]; readonly register: string; readonly entry: string }
90
+ export function inventory(report: RulerReport, options?: { readonly sharddev?: string }): InventoryRow[];
91
+ export function formatInventory(rows: readonly InventoryRow[]): string;