@wildshard/engine 0.1.18 → 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 (293) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/budgets/shard-size-baseline.json +10 -4
  3. package/index.html +6 -4
  4. package/lint/engine-sides.json +14 -0
  5. package/lint/ratchet.json +0 -68
  6. package/lint/ratchet.mjs +1 -4
  7. package/package.json +17 -15
  8. package/scripts/agent-sync.mjs +27 -8
  9. package/scripts/app-build/appCook.ts +8 -2
  10. package/scripts/app-build/catalogue.ts +10 -7
  11. package/scripts/app-build/gen.ts +22 -2
  12. package/scripts/app-build/isolation.d.mts +10 -0
  13. package/scripts/app-build/isolation.mjs +47 -0
  14. package/scripts/app-build/outputProducts.mjs +4 -0
  15. package/scripts/app-build/previousDeploy.d.mts +2 -0
  16. package/scripts/app-build/previousDeploy.mjs +10 -1
  17. package/scripts/app-build/serviceWorker.ts +10 -3
  18. package/scripts/app-build/splitOutput.mjs +4 -2
  19. package/scripts/app-build/standaloneOutput.d.mts +1 -1
  20. package/scripts/app-build/standaloneOutput.mjs +5 -3
  21. package/scripts/app-build/titlePreloads.d.mts +8 -0
  22. package/scripts/app-build/titlePreloads.mjs +69 -0
  23. package/scripts/app-build/worldMapAtlas.ts +10 -6
  24. package/scripts/app-build-pipeline.mjs +31 -3
  25. package/scripts/built-product.mjs +1 -1
  26. package/scripts/cell-mem-bench.mjs +81 -23
  27. package/scripts/check-custom-sections-zero.mjs +1 -1
  28. package/scripts/check-devserver.mjs +2 -0
  29. package/scripts/check-models.mjs +2 -0
  30. package/scripts/check-paths.allow.json +0 -115
  31. package/scripts/check-paths.mjs +2 -2
  32. package/scripts/check-platform-ratchets.mjs +2 -3
  33. package/scripts/chromium-keychain.d.mts +1 -1
  34. package/scripts/ci-static.sh +1 -1
  35. package/scripts/committed-fast-checks.mjs +0 -2
  36. package/scripts/content-sw-proof.mjs +2 -1
  37. package/scripts/cook-worker.mjs +9 -3
  38. package/scripts/cook.mjs +18 -5
  39. package/scripts/docs-inputs-proof.mjs +6 -6
  40. package/scripts/e7-voice-staging-proof.mjs +1 -1
  41. package/scripts/gate-related-tests.mjs +1 -1
  42. package/scripts/git-source-view.mjs +1 -1
  43. package/scripts/goldens/capture.mjs +17 -5
  44. package/scripts/grid-crossing-nightly.mjs +59 -0
  45. package/scripts/grid-crossing-qa.mjs +44 -0
  46. package/scripts/grid-crossing-ratchet.d.mts +6 -0
  47. package/scripts/grid-crossing-ratchet.mjs +52 -0
  48. package/scripts/grid-crossing-report.mjs +122 -0
  49. package/scripts/grid-crossing-stages.mjs +47 -0
  50. package/scripts/grid-crossing-tour.mjs +277 -0
  51. package/scripts/grid-crossing-walk-proof.mjs +124 -17
  52. package/scripts/host-ruler/roots.mjs +2 -2
  53. package/scripts/host-ruler.d.mts +91 -0
  54. package/scripts/host-ruler.mjs +565 -0
  55. package/scripts/live-prepush.py +3 -5
  56. package/scripts/loading-flow/benchmax.mjs +3 -1
  57. package/scripts/look-loop/test_look_loop.py +1 -38
  58. package/scripts/memory-proof.mjs +61 -6
  59. package/scripts/mmo-bots.mjs +8 -2
  60. package/scripts/net-lag-proof.mjs +219 -0
  61. package/scripts/night-market-kit-budget.mjs +2 -2
  62. package/scripts/offline-proof-rules.d.mts +2 -2
  63. package/scripts/offline-proof-rules.mjs +15 -4
  64. package/scripts/offline-proof.mjs +74 -13
  65. package/scripts/{shard-platform-output.mjs → output-reader.mjs} +1 -1
  66. package/scripts/page-release/content.d.mts +9 -1
  67. package/scripts/page-release/content.mjs +131 -17
  68. package/scripts/page-release/flow.mjs +36 -10
  69. package/scripts/page-release/stamp-content.mjs +24 -0
  70. package/scripts/page-release.mjs +28 -6
  71. package/scripts/page-size.mjs +2 -1
  72. package/scripts/pin-packs.ts +1 -1
  73. package/scripts/pins.ts +4 -4
  74. package/scripts/precommit-checks.mjs +1 -7
  75. package/scripts/precommit-jobs.mjs +0 -1
  76. package/scripts/precommit-source.py +1 -9
  77. package/scripts/program-discovery.mjs +1 -1
  78. package/scripts/ring-cook.mjs +2 -1
  79. package/scripts/ring-step.ts +1 -1
  80. package/scripts/script-scenario-metrics.mjs +1 -1
  81. package/scripts/shard-output-content.d.mts +1 -1
  82. package/scripts/shard-output-content.mjs +2 -2
  83. package/scripts/shard-outputs.mjs +1 -1
  84. package/scripts/shard-public.mjs +1 -1
  85. package/scripts/shard-wire-meter.mjs +24 -9
  86. package/scripts/side-parity.mjs +4 -2
  87. package/scripts/standalone-smoke.mjs +8 -3
  88. package/scripts/tier-textures.mjs +22 -4
  89. package/scripts/tile-bake-report.mjs +1 -1
  90. package/scripts/tile-bakes.mjs +1 -1
  91. package/scripts/title-assets.generated.json +2 -0
  92. package/scripts/tsconfig.json +0 -2
  93. package/scripts/vendor/basisu/LICENSE +201 -0
  94. package/scripts/vendor/basisu/basis_encoder.cjs +2 -0
  95. package/scripts/vendor/basisu/basis_encoder.wasm +0 -0
  96. package/scripts/vitest-push-guards.config.ts +1 -1
  97. package/scripts/vps/harden-apply.sh +4 -1
  98. package/scripts/vps/harden-prometheus.sh +176 -0
  99. package/scripts/vps/harden.sh +16 -0
  100. package/scripts/vps/rebuild.sh +18 -0
  101. package/scripts/vps/wildshard-config +6 -2
  102. package/scripts/worker-client-play.mjs +6 -2
  103. package/scripts/worktree-reap.mjs +5 -5
  104. package/src/.oxlintrc.json +3 -182
  105. package/src/client/app/entry.ts +10 -2
  106. package/src/client/engine/boot/bootCache.ts +2 -2
  107. package/src/client/engine/boot/bootTrace.ts +12 -4
  108. package/src/client/engine/boot/browserChunkRecovery.ts +4 -0
  109. package/src/client/engine/boot/clearDownloads.ts +5 -2
  110. package/src/client/engine/boot/contentRead.ts +11 -0
  111. package/src/client/engine/boot/gpuFiles.ts +4 -2
  112. package/src/client/engine/boot/lastEnd.ts +99 -12
  113. package/src/client/engine/boot/texturePack.ts +2 -2
  114. package/src/client/engine/net/netPlayer.ts +19 -2
  115. package/src/client/engine/net/otherPlayers.ts +55 -8
  116. package/src/client/engine/net/predictor.ts +33 -9
  117. package/src/client/engine/net/redial.ts +29 -6
  118. package/src/client/engine/pwa/cacheNames.ts +58 -1
  119. package/src/client/engine/pwa/sw.js +41 -11
  120. package/src/client/engine/render/dataLook.ts +152 -40
  121. package/src/client/engine/render/families/detail.ts +89 -0
  122. package/src/client/engine/render/families/pbr.ts +7 -1
  123. package/src/client/engine/render/look.ts +6 -0
  124. package/src/client/engine/render/lookLight.ts +103 -11
  125. package/src/client/engine/render/lookRender.ts +105 -0
  126. package/src/client/engine/saves/indexed.ts +2 -2
  127. package/src/client/engine/telemetry/browserErrors.ts +24 -3
  128. package/src/client/engine/telemetry/staleBuildReport.ts +22 -1
  129. package/src/client/engine/ui/debugOptions.ts +1 -1
  130. package/src/client/engine/ui/lookLightOption.ts +10 -6
  131. package/src/client/engine/ui/namePrompt.ts +7 -0
  132. package/src/client/game/boot/audio.generated.ts +114 -114
  133. package/src/client/game/boot/bytes.generated.ts +118 -220
  134. package/src/client/game/boot/placedSpawn.ts +35 -0
  135. package/src/client/game/boot/spawnDownload.ts +25 -6
  136. package/src/client/game/boot/versions.generated.ts +7 -5
  137. package/src/client/game/devScene/hook.ts +291 -0
  138. package/src/client/game/grid/cellLoading.ts +12 -2
  139. package/src/client/game/grid/live.ts +112 -16
  140. package/src/client/game/grid/liveSession.ts +33 -2
  141. package/src/client/game/grid/mapAtlas.ts +18 -4
  142. package/src/client/game/grid/minimapBlend.ts +15 -5
  143. package/src/client/game/grid/oneWayIn.ts +5 -1
  144. package/src/client/game/grid/placedCells.ts +114 -12
  145. package/src/client/game/grid/placedContent.ts +85 -0
  146. package/src/client/game/grid/prefetch.ts +9 -1
  147. package/src/client/game/grid/productInputs.ts +3 -1
  148. package/src/client/game/grid/productLeases.ts +4 -1
  149. package/src/client/game/grid/products.ts +8 -4
  150. package/src/client/game/grid/roadLook.ts +24 -15
  151. package/src/client/game/grid/roadLookPlatform.ts +4 -2
  152. package/src/client/game/grid/roadResources.ts +24 -0
  153. package/src/client/game/grid/roadSign.worker.ts +4 -3
  154. package/src/client/game/grid/roadSignPaint.ts +16 -5
  155. package/src/client/game/grid/roadSignPreparation.ts +4 -3
  156. package/src/client/game/grid/roadSignScale.ts +8 -0
  157. package/src/client/game/grid/roadTileCapture.worker.ts +3 -1
  158. package/src/client/game/grid/roadTileCaptureWorker.ts +2 -1
  159. package/src/client/game/grid/roadTileWrite.worker.ts +4 -2
  160. package/src/client/game/grid/roadTileWriter.ts +2 -1
  161. package/src/client/game/grid/screenReports.ts +39 -0
  162. package/src/client/game/grid/session.ts +20 -4
  163. package/src/client/game/grid/softWallLook.ts +25 -8
  164. package/src/client/game/mainMenu.ts +6 -2
  165. package/src/client/game/plugin/context.ts +2 -1
  166. package/src/client/game/plugin/followedMovers.ts +7 -1
  167. package/src/client/game/quest/figures.ts +2 -0
  168. package/src/client/game/session/finish.ts +6 -0
  169. package/src/client/game/shardfile/assetCache.ts +4 -4
  170. package/src/client/game/shardfile/client.ts +4 -1
  171. package/src/client/game/shardfile/clientAssets.ts +9 -5
  172. package/src/client/game/shardfile/clientLibrary.ts +1 -1
  173. package/src/client/game/shardfile/clientWater.ts +51 -9
  174. package/src/client/game/shardfile/clientWorker.ts +19 -7
  175. package/src/client/game/shardfile/look.ts +8 -3
  176. package/src/client/game/shardfile/product.ts +34 -7
  177. package/src/client/game/shardfile/productChecks.ts +2 -2
  178. package/src/client/game/shardfile/productCost.ts +2 -2
  179. package/src/client/game/shardfile/readAsset.ts +2 -2
  180. package/src/client/game/shardfile/reflectingWater.ts +73 -0
  181. package/src/client/game/shardfile/seatGrace.ts +9 -0
  182. package/src/client/game/shardfile/skinPlayback.ts +1 -1
  183. package/src/client/game/systems/npc/figureRows.ts +9 -0
  184. package/src/client/host/online/doctor.ts +2 -0
  185. package/src/client/host/online/linkScreens.ts +30 -4
  186. package/src/client/host/standalone/shell.ts +4 -0
  187. package/src/cook/game/astc6Encode.ts +55 -0
  188. package/src/cook/game/astc6Wasm.ts +176 -0
  189. package/src/cook/game/cookJob.ts +30 -6
  190. package/src/cook/game/cookWorker.ts +38 -11
  191. package/src/cook/game/entryTotals.ts +51 -24
  192. package/src/cook/game/shardCook.ts +35 -7
  193. package/src/cook/game/spawnParts.ts +33 -8
  194. package/src/cook/game/tierTextures.ts +87 -14
  195. package/src/server/engine/ai/bossContenders.ts +27 -3
  196. package/src/server/engine/ai/phases.ts +1 -1
  197. package/src/server/engine/entities/creatureRefill.ts +9 -2
  198. package/src/server/engine/net/ledgerBook.ts +2 -0
  199. package/src/server/engine/net/room.ts +15 -0
  200. package/src/server/engine/sim/respawn.ts +8 -0
  201. package/src/server/game/boss/arenaRoomEntry.ts +5 -1
  202. package/src/server/game/boss/arenaRoomNative.ts +2 -0
  203. package/src/server/game/boss/native.ts +2 -1
  204. package/src/server/game/boss/nativeWake.ts +9 -5
  205. package/src/server/game/boss/openArenaNative.ts +2 -2
  206. package/src/server/game/boss/openArenaRoom.ts +3 -1
  207. package/src/server/game/grid/room.ts +44 -3
  208. package/src/server/game/grid/simulation.ts +23 -0
  209. package/src/server/game/population/mixedRoster.ts +11 -3
  210. package/src/server/game/population/nativeBake.ts +8 -3
  211. package/src/server/game/population/nativeReturns.ts +6 -3
  212. package/src/server/game/population/roster.ts +5 -3
  213. package/src/server/game/quest/eliteDrops.ts +15 -4
  214. package/src/server/game/quest/nativeChapter.ts +1 -1
  215. package/src/server/game/quest/nativeComposition.ts +5 -1
  216. package/src/server/game/riding/nativeTaming.ts +10 -6
  217. package/src/server/game/riding/wildRefill.ts +3 -2
  218. package/src/server/game/shardfile/bossRow.ts +4 -2
  219. package/src/server/game/shardfile/homeKeeper.ts +4 -2
  220. package/src/server/host/bake/headlessWorker.ts +1 -1
  221. package/src/server/host/dedicated/cellHost.ts +98 -16
  222. package/src/server/host/dedicated/cellProtocol.ts +16 -1
  223. package/src/server/host/dedicated/cellWorker.ts +8 -5
  224. package/src/server/host/dedicated/dedicatedRoom.ts +16 -6
  225. package/src/server/host/dedicated/gridCells.ts +15 -6
  226. package/src/server/host/dedicated/loopLag.ts +21 -0
  227. package/src/server/host/dedicated/main.ts +13 -5
  228. package/src/server/host/dedicated/packReader.ts +3 -3
  229. package/src/server/host/dedicated/placementFile.ts +3 -2
  230. package/src/server/host/dedicated/roadRoom.ts +34 -4
  231. package/src/server/host/dedicated/serverMetrics.ts +126 -0
  232. package/src/server/host/dedicated/socketPump.ts +21 -4
  233. package/src/server/host/dedicated/workerTable.ts +15 -4
  234. package/src/server/host/dedicated/world.ts +65 -7
  235. package/src/server/host/headless.ts +1 -1
  236. package/src/server/host/headlessRuntime.ts +1 -1
  237. package/src/server/host/standalone/roadWorld.ts +15 -3
  238. package/src/server/host/standalone/serverHost.ts +4 -1
  239. package/src/server/host/standalone/serverProduct.ts +41 -11
  240. package/src/shared/engine/ai/BossBrain.ts +8 -0
  241. package/src/shared/game/boss/wake.ts +6 -0
  242. package/src/shared/game/devColliders.ts +47 -0
  243. package/src/shared/game/eliteSystem.ts +8 -0
  244. package/src/shared/game/grid/allocator.ts +3 -0
  245. package/src/shared/game/grid/placementRows.ts +5 -2
  246. package/src/shared/game/plugin/bossRecord.ts +3 -2
  247. package/src/shared/game/shardfile/ktx2Targets.ts +23 -3
  248. package/src/shared/game/shardfile/outputDescriptor.ts +9 -5
  249. package/src/shared/game/shardfile/packReads.ts +28 -3
  250. package/src/shared/game/shardfile/serverPack.ts +9 -0
  251. package/src/shared/game/systems/looks/trampleField.ts +2 -0
  252. package/src/shared/host/formatJsonSchema.ts +2 -2
  253. package/src/tsconfig.json +1 -27
  254. package/lint/host-reviews.json +0 -14
  255. package/lint/listed-view-code.json +0 -13
  256. package/lint/platform-pending-users.json +0 -2520
  257. package/lint/platform-pending-users.md +0 -18
  258. package/scripts/cell-mem/metrics-preload.mjs +0 -65
  259. package/scripts/check-closed-components.d.mts +0 -7
  260. package/scripts/check-closed-components.mjs +0 -87
  261. package/scripts/g571-hosts.d.mts +0 -3
  262. package/scripts/g571-hosts.mjs +0 -54
  263. package/scripts/host-ruler/register-migrate.mjs +0 -242
  264. package/scripts/listed-view-code.d.mts +0 -7
  265. package/scripts/listed-view-code.mjs +0 -93
  266. package/scripts/look-loop/fit-lut.py +0 -142
  267. package/scripts/look-loop/palette-delta.py +0 -183
  268. package/scripts/look-loop/regions/driftwood-isle.json +0 -25
  269. package/scripts/look-loop/regions/far-reach.json +0 -225
  270. package/scripts/look-loop/regions/open-plot-night-market.json +0 -855
  271. package/scripts/look-loop/regions/pine-hollow.json +0 -22
  272. package/scripts/look-loop/regions/sunscar-dunes.json +0 -281
  273. package/scripts/platform-chargebacks.d.mts +0 -9
  274. package/scripts/platform-chargebacks.mjs +0 -135
  275. package/scripts/shard-component-spans.d.mts +0 -15
  276. package/scripts/shard-component-spans.mjs +0 -18
  277. package/scripts/shard-components.d.mts +0 -16
  278. package/scripts/shard-components.mjs +0 -363
  279. package/scripts/shard-platform-hosts.d.mts +0 -2
  280. package/scripts/shard-platform-hosts.mjs +0 -93
  281. package/scripts/shard-platform-sections.d.mts +0 -2
  282. package/scripts/shard-platform-sections.mjs +0 -9
  283. package/scripts/shard-platform.d.mts +0 -76
  284. package/scripts/shard-platform.mjs +0 -1072
  285. package/src/.oxfmtrc.json +0 -48
  286. package/src/scripts/ask-new.sh +0 -29
  287. package/src/scripts/asks.mjs +0 -142
  288. package/src/scripts/herdr-prompt.sh +0 -34
  289. package/src/scripts/herdr-question-open.sh +0 -67
  290. package/src/scripts/md-wrap.mjs +0 -229
  291. /package/scripts/{shard-platform-format.d.mts → node-format.d.mts} +0 -0
  292. /package/scripts/{shard-platform-format.mjs → node-format.mjs} +0 -0
  293. /package/scripts/{shard-platform-output.d.mts → output-reader.d.mts} +0 -0
@@ -10,21 +10,27 @@
10
10
  // --dry-run print every step and read the live gate; build, upload and alias nothing
11
11
  // --wait=<minutes> check: how long to wait for the signed serial and /health (default 45)
12
12
  // --after-staging-proofs production go-live: the strict staging proofs passed on this exact build
13
- // --content upload: publish the page's content set to packs.wildshard.io first (PAGE-SIZE PZ2,
14
- // page-release/content.mjs); off until PZ4 and PZ6 stamp contentBase into the page
13
+ // --content build: stamp the content set's base into dist/ and keep the split (PZ6); upload: publish
14
+ // dist-content/ to packs.wildshard.io first (PAGE-SIZE PZ2,
15
+ // page-release/content.mjs); preview.yml passes it (PZ6), staging and production with PZ8
15
16
  // --catalogue=<file> preview build: bake this catalogue, the grid borrowed from staging (SHARD-AUTHORING SA35,
16
17
  // scripts/preview-grid.ts); default test/pins/catalogue.json. Refused on staging and production
17
18
  //
19
+ // node scripts/page-release.mjs --print-env <preview|staging|production> [--root=<dir>] [--catalogue=<file>]
20
+ // print the channel's build environment for the root's HEAD (--catalogue on preview only),
21
+ // one sorted KEY=value a line, and run nothing (PAGE-SIZE PZ6: the three channels' builds
22
+ // differ only in named keys)
23
+ //
18
24
  // The flow and its gates are scripts/page-release/flow.mjs; the page hosts are scripts/page-release/hosts/*.mjs.
19
25
  // Phase results go to <root>/tmp/page-release/<channel>-<sha>.json, which the next phase reads.
20
26
  import {execFileSync} from 'node:child_process';
21
27
  import {setTimeout as delay} from 'node:timers/promises';
22
28
  import {existsSync, mkdirSync, readFileSync, writeFileSync} from 'node:fs';
23
29
  import {join, resolve} from 'node:path';
24
- import {RefusedError, runPhase} from './page-release/flow.mjs';
30
+ import {CHANNELS, RefusedError, buildEnv, runPhase} from './page-release/flow.mjs';
25
31
  import {workersHost} from './page-release/hosts/workers.mjs';
26
32
  import {r2Packs} from './page-release/packs.mjs';
27
- import {publishContent, r2Content} from './page-release/content.mjs';
33
+ import {publishContent, r2Content, r2Copies} from './page-release/content.mjs';
28
34
 
29
35
  const args = process.argv.slice(2);
30
36
  const flag = (/** @type {string} */ name) => args.find(arg => arg === `--${name}` || arg.startsWith(`--${name}=`));
@@ -32,6 +38,19 @@ const value = (/** @type {string} */ name) => flag(name)?.split('=').slice(1).jo
32
38
  /** Every channel is on Cloudflare Workers (OFF-VERCEL OV6 preview, OV7 staging, OV8 production), so `--host` has one value. */
33
39
  const [channel, phaseList] = args.filter(arg => !arg.startsWith('--'));
34
40
  const hostName = value('host') ?? 'workers';
41
+ if (flag('print-env') !== undefined) {
42
+ const config = channel !== undefined && Object.hasOwn(CHANNELS, channel) ? Reflect.get(CHANNELS, channel) : undefined;
43
+ const catalogue = value('catalogue');
44
+ if (config === undefined || phaseList !== undefined || (catalogue !== undefined && !config.solo)) {
45
+ console.error('usage: node scripts/page-release.mjs --print-env <preview|staging|production> [--root=<dir>] [--catalogue=<file>, preview only]');
46
+ process.exit(2);
47
+ }
48
+ const cwd = resolve(value('root') ?? '.');
49
+ const head = execFileSync('git', ['rev-parse', 'HEAD'], {cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe']}).trim();
50
+ const env = buildEnv(config, /** @type {any} */ ({build: head, ...(catalogue === undefined ? {} : {catalogue: resolve(catalogue)})}));
51
+ for (const name of Object.keys(env).sort()) console.log(`${name}=${env[name]}`);
52
+ process.exit(0);
53
+ }
35
54
  if (channel === undefined || phaseList === undefined || hostName !== 'workers') {
36
55
  console.error('usage: node scripts/page-release.mjs <preview|staging|production> <build|upload|check|go-live>[,...] [--host=workers] [--root=<dir>] [--dry-run] [--wait=<minutes>] [--after-staging-proofs] [--content] [--catalogue=<file>]');
37
56
  process.exit(2);
@@ -56,6 +75,9 @@ async function fetch200(url) {
56
75
  }
57
76
 
58
77
  const host = workersHost({token: () => cloudflareToken, log});
78
+ // PZ6: a content publish copies unchanged files from an older set on R2 when the bucket's S3 keys are in the environment
79
+ const contentCopies = flag('content') === undefined ? undefined : r2Copies(process.env);
80
+ if (contentCopies !== undefined) secrets.push(...contentCopies.secrets);
59
81
 
60
82
  let phase = '';
61
83
  try {
@@ -65,7 +87,7 @@ try {
65
87
  packs: r2Packs({log}),
66
88
  ...(flag('content') === undefined ? {} : {content: {
67
89
  publish: ({dir, cors, dryRun}) => publishContent({dir, origin: cors, dryRun, log,
68
- scratch: join(root, 'tmp/page-release/content'), store: r2Content({root, scratch: join(root, 'tmp/page-release/content'), token: cloudflareToken})}),
90
+ scratch: join(root, 'tmp/page-release/content'), store: r2Content({root, scratch: join(root, 'tmp/page-release/content'), token: cloudflareToken, copies: contentCopies})}),
69
91
  }}),
70
92
  run: (file, argv, env) => { execFileSync(file, argv, {cwd: root, env: {...process.env, ...env}, stdio: 'inherit'}); },
71
93
  fetchJSON: async url => (await fetch200(url)).json(),
@@ -102,4 +124,4 @@ try {
102
124
  console.error(redact(error instanceof RefusedError ? error.message : `${channel} ${phase} failed: ${error instanceof Error ? error.message : String(error)}`));
103
125
  console.error('the alias did not move unless an ALIAS MOVED line is above');
104
126
  process.exitCode = 1;
105
- }
127
+ } finally { contentCopies?.close(); }
@@ -152,7 +152,8 @@ export const PAGE_LIMITS = Object.freeze({files: 1000, bytes: 100e6});
152
152
  export function gatePage(report, limits = PAGE_LIMITS) {
153
153
  const errors = [], zero = tally(), maps = report.kinds.maps ?? zero;
154
154
  const content = [report.kinds['shard content'] ?? zero, report.kinds['engine art'] ?? zero];
155
- const contentFiles = content.reduce((sum, row) => sum + row.files, 0), contentBytes = content.reduce((sum, row) => sum + row.bytes, 0);
155
+ // a kept build's content stays on the page until it ages out (splitOutput): only this build's content is refused
156
+ const contentFiles = content.reduce((sum, row) => sum + row.files - row.carriedFiles, 0), contentBytes = content.reduce((sum, row) => sum + row.bytes - row.carriedBytes, 0);
156
157
  if (contentFiles > 0) errors.push(`page-size gate: dist/ holds ${n(contentFiles)} content files (${mb(contentBytes)} MB); shard content and engine art go to dist-content/ (node scripts/app-build/splitOutput.mjs)`);
157
158
  const pageFiles = report.total.files - maps.files, bytes = report.total.bytes - maps.bytes;
158
159
  if (pageFiles > limits.files) errors.push(`page-size gate: the page holds ${n(pageFiles)} files, past the ${n(limits.files)} a page may hold (PAGE-SIZE D1)`);
@@ -1,6 +1,6 @@
1
1
  // C0: a tarball leaves its packs out, because every member keeps its own path. Whoever serves a product rebuilds them, and a
2
2
  // pinned tree serves its products to the page and to the grid bake.
3
- import { packFromMembers } from '@wildshard/format/product-reads';
3
+ import { packFromMembers } from '@wildshard/format/shardfile-reads';
4
4
 
5
5
  type Members = Parameters<typeof packFromMembers>[1];
6
6
  type Pack = Parameters<typeof packFromMembers>[0];
package/scripts/pins.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  //
16
16
  // `install` is what a build runs first. For each pin, in order:
17
17
  // 1. The tarball comes from the cache, the mirror or the API, and its sha256 has to be the pin.
18
- // 2. This tree's format validator admits it: files, hashes, schemas, budgets (`validateShardfileProduct`).
18
+ // 2. This tree's format validator admits it: files, hashes, schemas, budgets (`validateShardfileFolder`).
19
19
  // 3. Its product goes to `out/<folder>`, with any pack a tarball left out rebuilt from its members, so a page and the
20
20
  // grid bake read what they would from a build. Its receipt is issued under this tree's validator revision, by this file, only
21
21
  // after step 2 passed, as `productVerdict` earns one for a head a build never made. The cost numbers stay the
@@ -237,8 +237,8 @@ async function installLocked(only: readonly string[], source: 'pins' | 'format'
237
237
  // The validator hashes most members already; the manifest reuses those digests rather than hashing twice.
238
238
  const digests = new WeakMap<Uint8Array, string>();
239
239
  const digest = (bytes: Uint8Array): string => { let held = digests.get(bytes); if (held === undefined) { held = sha256(bytes); digests.set(bytes, held); } return held; };
240
- const { prepareAssetDecoders } = await import('@wildshard/format/product');
241
- const { validateShardfileProduct } = await import('@wildshard/format/productValidation');
240
+ const { prepareAssetDecoders } = await import('@wildshard/format/shardfileAssets');
241
+ const { validateShardfileFolder } = await import('@wildshard/format/shardfileValidation');
242
242
  const { readTar } = await import('@wildshard/format/tar');
243
243
  const { restorePacks } = await import('./pin-packs.ts');
244
244
  await prepareAssetDecoders();
@@ -286,7 +286,7 @@ async function installLocked(only: readonly string[], source: 'pins' | 'format'
286
286
  const started = performance.now(), files = readTar(bytes);
287
287
  const fileNamed = (path: string): Uint8Array => { const body = files.get(path); if (body === undefined) throw new Error(`${pin.slug}: no ${path}`); return body; };
288
288
  try {
289
- const { warnings } = validateShardfileProduct(
289
+ const { warnings } = validateShardfileFolder(
290
290
  { read: (path, maximum) => { const body = fileNamed(path); if (body.length > maximum) throw new Error(`${path} is over its cap`); return body; }, paths: () => files.keys() },
291
291
  { hash: digest },
292
292
  );
@@ -72,7 +72,7 @@ export async function stagedRatchet(files, executable, repository) {
72
72
  if (repository === undefined) throw new Error('Missing HEAD repository for staged ratchet comparison');
73
73
  const head = resolve('.commit-head');
74
74
  const prepared = spawnSync('python3', [resolve(import.meta.dirname, 'precommit-source.py'), repository, head,
75
- String(Date.now() / 1000 + 5), 'HEAD', JSON.stringify({ files: missing, guards: [], closed: false, deleted: false })],
75
+ String(Date.now() / 1000 + 5), 'HEAD', JSON.stringify({ files: missing, guards: [], deleted: false })],
76
76
  { encoding: 'utf8', maxBuffer: 1 << 30 });
77
77
  if (prepared.error !== undefined) throw prepared.error;
78
78
  if (prepared.status !== 0) throw new Error(`HEAD ratchet source failed: ${prepared.stderr}`);
@@ -104,12 +104,6 @@ if (import.meta.main) {
104
104
  const { deletedReferences } = await import('./push-checks.mjs');
105
105
  const errors = deletedReferences(process.cwd(), JSON.parse(readFileSync('.commit-deleted.json', 'utf8')));
106
106
  if (errors.length > 0) throw new Error(errors.join('\n'));
107
- } else if (mode === 'closed') {
108
- if (!existsSync('lint/ratchet.json')) throw new Error('Missing staged closed-component policy');
109
- const policy = JSON.parse(readFileSync('lint/ratchet.json', 'utf8'));
110
- const { closedComponentSources } = await import('./check-closed-components.mjs');
111
- const errors = closedComponentSources(process.cwd(), policy.closedComponents);
112
- if (errors.length > 0) throw new Error(errors.join('\n'));
113
107
  } else throw new Error('Unknown pre-commit guard');
114
108
  } catch (error) { console.error(error instanceof Error ? error.message : String(error)); process.exitCode = 1; }
115
109
  }
@@ -69,7 +69,6 @@ export function commitGuards(changed) {
69
69
  ...(touches(/^src\/(?:format|sdk|sharddev)\//u) ? ['test/schema-reference.test.ts'] : []),
70
70
  ...(touches(/^(?:lint\/(?:host-callbacks\.mjs|wildshard-plugin\.js)|scripts\/gen-host-catalogue\.mjs|test\/host-callbacks\.test\.ts)$/u) ? ['test/host-callbacks.test.ts'] : []),
71
71
  ...(touches(/^(?:lint\/(?:shardfile-boundaries\.mjs|wildshard-plugin\.js)|test\/shardfile-boundaries\.test\.ts)$/u) ? ['test/shardfile-boundaries.test.ts'] : []),
72
- ...(touches(/^(?:src\/(?:engine|game|format|sdk|sharddev)\/|scripts\/(?:platform-chargebacks|inline-platform|host-approvals|g571-hosts|shard-components|shard-platform)[^/]*\.|docs\/HOST-BAR\.md$|test\/platform-chargebacks\.test\.ts$)/u) ? ['test/platform-chargebacks.test.ts'] : []),
73
72
  ...(touches(/^(?:src\/shards\/(?:nalati-grasslands|nine-dragon-stack)\/|src\/(?:client|cook|server|shared)\/game\/shard\/manifest\.ts$|scripts\/(?:authored-manifest|manifest-declaration)\.|test\/(?:manifest-declarations\.test\.ts|fixtures\/manifest-declarations\.json)$)/u) ? ['test/manifest-declarations.test.ts'] : []),
74
73
  ];
75
74
  }
@@ -160,14 +160,6 @@ def required_sources(blobs, specification, tree=None, executable=None, staged_pa
160
160
  if specification.get('deleted'):
161
161
  # Every active tracked reader is an input to the deleted-path grep.
162
162
  selected.update(name for name in blobs if name.split('/')[0] in ROOTS)
163
- if specification.get('closed'):
164
- for name in blobs:
165
- path = PurePosixPath(name)
166
- if len(path.parts) > 3 and path.parts[:2] == ('src', 'shards') and not path.parts[2].endswith('-legacy'):
167
- if path.suffix in {'.ts', '.tsx', '.glsl'} and '/generators/' not in name and not re.search(r'\.d\.ts$|\.(?:test|spec)\.tsx?$|/test/', name):
168
- selected.add(name)
169
- selected.update(name for name in blobs if re.search(r'/(?:generators/)?bake-[^/]+\.(?:mjs|ts)$', name))
170
- selected.add('scripts/source-generation-outputs.json')
171
163
  if 'test/schema-reference.test.ts' in specification.get('guards', []):
172
164
  for layer in ['sdk', 'sharddev']:
173
165
  manifest = json.loads(blobs.get(f'src/{layer}/package.json', b'{}'))
@@ -212,7 +204,7 @@ def required_sources(blobs, specification, tree=None, executable=None, staged_pa
212
204
  data = blobs[name] if name in blobs else (tree / name).read_bytes()
213
205
  if PurePosixPath(name).suffix not in {'.ts', '.tsx', '.mts', '.js', '.mjs', '.cjs', '.json'}:
214
206
  continue
215
- if name.endswith('.json') and name != 'lint/platform-pending-users.json':
207
+ if name.endswith('.json'):
216
208
  continue
217
209
  text = data.decode('utf8')
218
210
  imported = set() if name.endswith('.json') else imports(name, text)
@@ -3,7 +3,7 @@ import { resolve } from 'node:path';
3
3
  import { createHash } from 'node:crypto';
4
4
  import * as v from 'valibot';
5
5
  import { readBuiltShardfile } from './built-product.mjs';
6
- import { discoveryFormat, outputFormat } from './shard-platform-format.mjs';
6
+ import { discoveryFormat, outputFormat } from './node-format.mjs';
7
7
  import { encodeCanonicalJson } from '@wildshard/engine/host/immutable';
8
8
 
9
9
  /** @param {unknown} value @returns {value is Record<string, unknown>} */
@@ -11,6 +11,7 @@ const { createCookWorker, indexKey } = await import('../src/cook/game/cookWorker
11
11
  const { folderStore } = await import('../src/cook/game/packStore.ts');
12
12
  const { cookRevision } = await import('./cook-revision.ts');
13
13
  const { rendererRevision } = await import('./renderer-revision.mjs');
14
+ const { shardfileValidationRevision } = await import('./shardfile-validation-revision.mjs');
14
15
  const { values } = parseArgs({ options: { out: {type:'string',default:'tmp/ring-cook'}, build: {type:'string',default:'ring-local'},
15
16
  only: {type:'string'}, ring2: {type:'boolean',default:false}, 'timeout-ms': {type:'string',default:'120000'} } });
16
17
  const timeout = Number(values['timeout-ms']);
@@ -31,7 +32,7 @@ const heads = selected.map(slug => {
31
32
  });
32
33
  const store = folderStore(join(out,'store'));
33
34
  // A fresh run owns its empty cache. At least its first product always encodes cold.
34
- const worker = createCookWorker({ build: values.build, store, serverPacks: join(out,'server'), scratch: join(out,'jobs'),
35
+ const worker = createCookWorker({ build: values.build, store, serverPacks: join(out,'server'), scratch: join(out,'jobs'), validator: shardfileValidationRevision(root),
35
36
  source: { heads: () => Promise.resolve(heads.map(row => ({...row, revision:1}))), download: hash => Promise.resolve(readFileSync(join(cache,`${hash}.tar`))) },
36
37
  launcher: { root, execPath: process.execPath, loader:join(root,'scripts/bake-loader.mjs'), script:join(root,'scripts/cook-job.mjs'),
37
38
  wrap:[], limits:{seconds:timeout/1000,memoryMB:4096,heapMB:2048}, renderer: rendererRevision(root) } });
@@ -27,7 +27,7 @@ const sha256 = (text: string): string => createHash('sha256').update(text).diges
27
27
  const line = (tick: number): HeadlessCommand => ({ kind: 'player', moveX: 0.3 * Math.sin(tick / 90), moveZ: -1, yaw: 0, ...(tick % 47 === 0 ? { jump: true as const } : {}), ...(tick % 97 === 0 ? { dodge: true as const } : {}) });
28
28
  const only = option('only')?.split(',');
29
29
 
30
- const { prepareAssetDecoders } = await import('@wildshard/format/product');
30
+ const { prepareAssetDecoders } = await import('@wildshard/format/shardfileAssets');
31
31
  const { loadRapier } = await import('../src/shared/engine/physics/rapier.ts');
32
32
  const { loadHeadlessProduct } = await import('../src/server/host/headlessProduct.ts');
33
33
  const { createTrustedHeadlessResident } = await import('../src/server/host/headlessRuntime.ts');
@@ -4,7 +4,7 @@ import {existsSync,readdirSync,readFileSync,statSync} from 'node:fs';
4
4
  import {relative,resolve} from 'node:path';
5
5
  import {createHash} from 'node:crypto';
6
6
  import * as v from 'valibot';
7
- import {outputFormat} from './shard-platform-format.mjs';
7
+ import {outputFormat} from './node-format.mjs';
8
8
  import {formatSource} from './format-package.mjs';
9
9
 
10
10
  const hash=v.pipe(v.string(),v.regex(/^[a-f0-9]{64}$/u)),natural=v.pipe(v.number(),v.safeInteger(),v.minValue(0));
@@ -1,4 +1,4 @@
1
- import type {OutputReader} from './shard-platform-output.mjs';
1
+ import type {OutputReader} from './output-reader.mjs';
2
2
 
3
3
  export interface OutputContent {status:'built';product:string;privateBinaries:string[];privateBinaryBytes:number;tiles:{total:number;l0:number;l1:number};gate:{enforcement:'report-only';status:'candidate'|'incomplete';issues:string[]}}
4
4
  export function outputContent(root:string,slug:string,products:string,reader?:OutputReader):OutputContent;
@@ -1,12 +1,12 @@
1
1
  // P4 structural columns use only the emitted index and verified sections.
2
2
  import {relative,resolve} from 'node:path';
3
- import {createOutputReader} from './shard-platform-output.mjs';
3
+ import {createOutputReader} from './output-reader.mjs';
4
4
  import {representativeProduct} from './shard-outputs.mjs';
5
5
 
6
6
  /** Private binaries are opaque bin blobs without a platform decoder declaration.
7
7
  * This is structural evidence, never a visual/behaviour compatibility verdict.
8
8
  * @param {string} root @param {string} slug @param {string} products
9
- * @param {import('./shard-platform-output.mjs').OutputReader} reader */
9
+ * @param {import('./output-reader.mjs').OutputReader} reader */
10
10
  export function outputContent(root,slug,products,reader=createOutputReader(root,products)) {
11
11
  const output=reader.sections(slug);
12
12
  const indexPath=relative(root,resolve(products,representativeProduct(root,slug),'shard.json')).replaceAll('\\','/');
@@ -92,7 +92,7 @@ export function productFolder(root, slug) {
92
92
  }
93
93
  /** The built product that stands for a source shard in per-shard measures: a folder that emits several outputs (all from
94
94
  * one source, sharing its structure and scripts) is read through its first output; any other folder is its own product.
95
- * Section inventories union every output (scripts/shard-platform-output.mjs). @param {string} root @param {string} slug */
95
+ * Section inventories union every output (scripts/output-reader.mjs). @param {string} root @param {string} slug */
96
96
  export function representativeProduct(root, slug) {
97
97
  return (/^[a-z0-9_-]+$/u.test(slug) ? shardOutputs(root, slug)?.[0]?.slug : undefined) ?? slug;
98
98
  }
@@ -12,7 +12,7 @@ export const GATHERED_SHARDS = Object.freeze(['_template', 'blender-template', '
12
12
  * it, so point the tool at assets/public first. targets.json outputs count: check-model-sources needs them on disk.
13
13
  * 2. Move every tracked file there, add the slug here and `/public/assets/<slug>/` to .gitignore, one shard per commit.
14
14
  * 3. Prove it from an archive with no aliases: gen, every product by SHA-256 against the parent, and the full
15
- * check-closed-components with docs and art present. Scripts and tests read the alias, so their paths don't change.
15
+ * the guards with docs and art present. Scripts and tests read the alias, so their paths don't change.
16
16
  * gen only copies: a file deleted here leaves its alias until the folder is cleared. */
17
17
  export const PUBLIC_TREES = Object.freeze(['sunscar-dunes', 'driftwood-isle']);
18
18
 
@@ -8,18 +8,20 @@
8
8
  // [--flow select|grid] [--upstream https://play.wildshard.io] [--settle ms] [--timeout ms] [--shot file.jpg]
9
9
  // [--last <slug>] a returning player whose last pick was <slug>, with nothing stored yet
10
10
  // [--dwell ms] time on the title before the tap
11
+ // [--card n] enter the deck's nth card instead of --shard's benchmark card (PAGE-SIZE PZ7 meters every card)
12
+ // byClass splits S1 shardfiles into `S1-packs` (blobs/pack/) and `S1-loose` (the other blobs) for PZ7. The browser
13
+ // profile lives in the root's tmp/wire-meter, never the system temp folder.
11
14
  import { spawn } from 'node:child_process';
12
15
  import { createRequire } from 'node:module';
13
- import { mkdtempSync, writeFileSync, rmSync } from 'node:fs';
16
+ import { mkdirSync, mkdtempSync, writeFileSync, rmSync } from 'node:fs';
14
17
  import http from 'node:http';
15
18
  import https from 'node:https';
16
- import { tmpdir } from 'node:os';
17
19
  import { join } from 'node:path';
18
20
  import { pathToFileURL } from 'node:url';
19
21
  import { parseArgs } from 'node:util';
20
22
  import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
21
23
 
22
- const { values: o } = parseArgs({ options: { root: { type: 'string' }, shard: { type: 'string' }, tier: { type: 'string', default: 'phone' }, flow: { type: 'string', default: 'select' },
24
+ const { values: o } = parseArgs({ options: { root: { type: 'string' }, shard: { type: 'string' }, card: { type: 'string' }, tier: { type: 'string', default: 'phone' }, flow: { type: 'string', default: 'select' },
23
25
  out: { type: 'string' }, upstream: { type: 'string' }, settle: { type: 'string', default: '20000' }, timeout: { type: 'string', default: '420000' }, shot: { type: 'string' }, last: { type: 'string' }, dwell: { type: 'string', default: '3000' } } });
24
26
  const require = createRequire(join(o.root, 'package.json'));
25
27
  const { chromium, devices } = require('playwright');
@@ -54,7 +56,8 @@ const port = await free();
54
56
  await new Promise(resolve => { proxy.listen(port, '127.0.0.1', resolve); });
55
57
  const url = `http://127.0.0.1:${port}/`;
56
58
 
57
- const profile = mkdtempSync(join(tmpdir(), 'wire-'));
59
+ mkdirSync(join(o.root, 'tmp/wire-meter'), { recursive: true });
60
+ const profile = mkdtempSync(join(o.root, 'tmp/wire-meter/profile-'));
58
61
  const context = await chromium.launchPersistentContext(profile, { headless: true, args: [...KEYCHAIN_ARGS, ...process.platform === 'darwin' ? ['--use-angle=metal'] : [], '--ignore-gpu-blocklist', '--mute-audio'],
59
62
  ...(o.tier === 'phone' ? devices['iPhone 16 Pro'] : { viewport: { width: 1440, height: 900 } }) });
60
63
  await developerSettings(context, { volume: 0, music: 0, tier: o.tier, holdLoading: true });
@@ -66,7 +69,8 @@ page.on('pageerror', e => errors.push(e.message.slice(0, 200)));
66
69
  const result = { shard: o.shard, tier: o.tier, url: upstream, build: null, fact: null, bar: null, stoppedOn: null };
67
70
  const summary = () => {
68
71
  const sum = list => list.reduce((n, r) => n + r.wire, 0), byStage = {}, byClass = {};
69
- const klass = u => u.startsWith('/assets/spawn/parts/') ? 'spawn-parts' : /\/shardfiles\//.test(u) ? 'shardfiles' : /\/assets\/packs\//.test(u) ? 'legacy-packs'
72
+ const klass = u => u.startsWith('/assets/spawn/parts/') ? 'spawn-parts' : /\/shardfiles\/[^/]+\/blobs\/pack\//.test(u) ? 'S1-packs'
73
+ : /\/shardfiles\/[^/]+\/blobs\//.test(u) ? 'S1-loose' : /\/shardfiles\//.test(u) ? 'shardfiles' : /\/assets\/packs\//.test(u) ? 'legacy-packs'
70
74
  : u.startsWith('/assets/spawn/') ? 'manifests' : u.startsWith('/b/') || /\.(?:js|mjs|css|html)(?:\?|$)/.test(u) || u === '/' ? 'app' : /\/assets\//.test(u) ? 'assets' : 'other';
71
75
  for (const r of rows) { byStage[r.stage] = (byStage[r.stage] ?? 0) + r.wire; const k = klass(r.url); byClass[k] = (byClass[k] ?? 0) + r.wire; }
72
76
  return { requests: rows.length, wireBytes: sum(rows), byStage, byClass };
@@ -76,14 +80,25 @@ try {
76
80
  result.build = await page.evaluate(() => fetch('/version.json').then(r => r.json()).then(v => v.build ?? v.sha ?? null)).catch(() => null);
77
81
  await page.locator('.ws-main-select').waitFor({ timeout });
78
82
  await page.waitForTimeout(Number(o.dwell));
79
- if (o.flow === 'grid') { stage = 'entry'; await page.locator('.ws-main-grid').click({ timeout }); }
83
+ // a first visit names its player before the deck or the grid opens
84
+ const named = async () => {
85
+ if (await page.locator('#ws-name-box input').waitFor({ timeout: 15_000 }).then(() => true).catch(() => false)) {
86
+ await page.locator('#ws-name-box input').fill('wiremeter'); await page.locator('#ws-name-box button[type=submit]').click();
87
+ }
88
+ };
89
+ if (o.flow === 'grid') { stage = 'entry'; await page.locator('.ws-main-grid').click({ timeout }); await named(); }
80
90
  else {
81
91
  await page.locator('.ws-main-select').click({ timeout });
92
+ await named();
82
93
  await page.locator('.ws-menu-card').first().waitFor({ timeout });
83
- const { loadingCardIndex } = await import(pathToFileURL(join(o.root, 'scripts/loading-benchmark/catalogue.mjs')).href);
84
94
  const titles = await page.locator('.ws-menu-card b').allTextContents();
85
- const index = loadingCardIndex(titles, o.shard);
86
- await page.locator(`.ws-menu-dots i[data-i="${index}"]`).click();
95
+ let index;
96
+ if (o.card !== undefined) index = Number(o.card);
97
+ else { const { loadingCardIndex } = await import(pathToFileURL(join(o.root, 'scripts/loading-benchmark/catalogue.mjs')).href); index = loadingCardIndex(titles, o.shard); }
98
+ if (!Number.isInteger(index) || index < 0 || index >= titles.length) throw new Error(`No deck card ${String(o.card ?? o.shard)} (index ${index} of ${titles.length})`);
99
+ result.card = { index, title: titles[index] ?? null, of: titles.length };
100
+ // the dots are positional (no data-i on them since the deck redesign); the card keeps its data-i
101
+ await page.locator('.ws-menu-dots i').nth(index).click();
87
102
  await page.locator(`.ws-menu-card.selected[data-i="${index}"]`).waitFor({ timeout });
88
103
  stage = 'entry';
89
104
  const explicit = page.locator('.ws-menu-shardfile');
@@ -69,14 +69,16 @@ export function colliderInventory(physics) {
69
69
 
70
70
  /**
71
71
  * One name per owner on both sides: a streamed tile keeps its authored owner with an 8 × 8 tile suffix (`pier.c3`), the server's
72
- * bake prefixes its pieces (`piece:pier`, `string:platform.grid`), a streamed tree keeps its tile (`.trunks.t3`). An owner
72
+ * bake prefixes its pieces (`piece:pier`, `string:platform.grid`), a streamed tree keeps its tile (`.trunks.t3`), and a placed
73
+ * piece keeps its placement after its model id (`nalati-grasslands/corral.camp.16`: Nalati's bake names it by the model). An owner
73
74
  * object with no string id, or a creature's numeric id, is an actor (the player, a creature, a loose body): an entity the wire
74
75
  * carries, grouped as `actor`.
75
76
  */
76
77
  export function ownerGroup(owner) {
77
78
  if (owner === null) return '(untagged)';
78
79
  if (owner.startsWith('(object') || owner === '(number)') return 'actor';
79
- return owner.replace(/^(?:piece|string):/u, '').replace(/\.c(?:[0-9]|[1-5][0-9]|6[0-3])$/u, '').replace(/\.trunks\.t\d+$/u, '');
80
+ return owner.replace(/^(?:piece|string):/u, '').replace(/\.c(?:[0-9]|[1-5][0-9]|6[0-3])$/u, '').replace(/\.trunks\.t\d+$/u, '')
81
+ .replace(/^([^/.]+\/[^/.]+)\.[a-z0-9-]+(?:\.\d+)?$/u, '$1');
80
82
  }
81
83
 
82
84
  /** A body of flesh is a creature, a person or a player on either side, whatever its owner: an actor. */
@@ -16,6 +16,7 @@ import { codeDirectory, stampBuildHtml } from './app-build/buildIdentity.mjs';
16
16
  import { standaloneDirectory, writeStandaloneOutput } from './app-build/standaloneOutput.mjs';
17
17
  import { readBuiltShardfile } from './built-product.mjs';
18
18
  import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
19
+ import { documentIsolation } from './app-build/isolation.mjs';
19
20
 
20
21
  const ROOT = resolveFile(import.meta.dirname, '..'), OUT = join(ROOT, 'tmp', 'standalone-smoke'), EMITTED = join(OUT, 'emitted');
21
22
  const option = (name, fallback) => process.argv.find(arg => arg.startsWith(`--${name}=`))?.slice(name.length + 3) ?? fallback;
@@ -46,16 +47,20 @@ const resolvePath = path => {
46
47
  };
47
48
  const declaredCreatures = join(unpacked !== '' || dist === '' ? resolveFile(product) : join(output, 'shardfiles', slug), 'sections/actors/creatures.json');
48
49
  const declaresCreatures = !existsSync(declaredCreatures) || JSON.parse(readFileSync(declaredCreatures, 'utf8')).creatures?.spawns?.length !== 0;
50
+ // PZ12 (J274): the build's own isolation (its `_headers` `/*` rule, dist/ only), on every answer, as its host sends it
51
+ const isolation = dist === '' || !existsSync(join(output, '_headers')) ? {} : documentIsolation(readFileSync(join(output, '_headers'), 'utf8'));
52
+ const isolatedBuild = isolation['cross-origin-embedder-policy'] === 'require-corp' && isolation['cross-origin-opener-policy'] === 'same-origin';
49
53
  const server = createServer((request, response) => {
50
54
  const path = new URL(request.url ?? '/', 'http://localhost').pathname;
51
55
  // The uncached pointer (J57): only these two responses say which build is live.
52
- if (path === '/') { response.writeHead(200, { 'content-type': 'text/html', 'cache-control': 'no-store' }).end(stampBuildHtml(html, pointer)); return; }
56
+ if (path === '/') { response.writeHead(200, { ...isolation, 'content-type': 'text/html', 'cache-control': 'no-store' }).end(stampBuildHtml(html, pointer)); return; }
53
57
  if (path === '/version.json') { response.writeHead(200, { 'content-type': 'application/json', 'cache-control': 'no-store' }).end(JSON.stringify({ build: pointer })); return; }
54
58
  // WebKit asks for the page's service worker over the pointer's reload, and a build has one. This smoke's has nothing to cache.
55
59
  if (path === '/sw.js') { response.writeHead(200, { 'content-type': 'text/javascript' }).end(); return; }
56
60
  const file = resolvePath(path);
57
61
  if (file === null || !existsSync(file) || !statSync(file).isFile()) { response.writeHead(404).end(); return; }
58
- response.writeHead(200, { 'content-type': TYPES[extname(file)] ?? 'application/octet-stream', ...file.endsWith('.pack.br') ? { 'content-encoding': 'br' } : {} }); // no COOP / COEP (J59 Q8)
62
+ // J59 Q8: the loopback needs no SharedArrayBuffer; an isolated channel's build (PZ12) sends its COOP / COEP on every file
63
+ response.writeHead(200, { ...isolation, 'content-type': TYPES[extname(file)] ?? 'application/octet-stream', ...file.endsWith('.pack.br') ? { 'content-encoding': 'br' } : {} });
59
64
  createReadStream(file).pipe(response);
60
65
  });
61
66
  await new Promise(resolve => { server.listen(0, '127.0.0.1', resolve); });
@@ -96,7 +101,7 @@ try {
96
101
  // A shard that declares no creature has no row to walk to (Nine's spawns are empty): the check holds for every shard that declares one.
97
102
  check('rows checked against the worker', report.probes >= seconds * 2 && (report.matched > 0 || !declaresCreatures), report);
98
103
  check('rows within one quantisation step', report.worstError <= report.step, { worst: report.worstError, step: report.step });
99
- check('no cross-origin isolation', !report.crossOriginIsolated, report.crossOriginIsolated);
104
+ check(isolatedBuild ? 'cross-origin isolated, as its channel (PZ12)' : 'no cross-origin isolation', report.crossOriginIsolated === isolatedBuild, report.crossOriginIsolated);
100
105
  check('commands reached the worker', report.positionMoved > 5, report.positionMoved);
101
106
  check('save durable', saved.ok && stored > 0, { saved, stored });
102
107
  check('save survives the reload', second.restored && second.tick === saved.tick, { second, saved });
@@ -7,14 +7,18 @@
7
7
  // phone file trimmed to --max. Bytes are file bytes; GPU is `ktx2GpuBytes`, mips included. --out writes the trimmed
8
8
  // phone files at their URL paths, for a browser to load.
9
9
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
10
+ import { homedir } from 'node:os';
10
11
  import { dirname, join, resolve } from 'node:path';
11
12
 
12
- const { glbImages, isKtx2, ktx2GpuBytes, tierGlb, trimKtx2 } = await import('../src/cook/game/tierTextures.ts');
13
+ const { glbImages, isKtx2, ktx2GpuBytes, masterOf, phoneTier, tierGlb, trimKtx2 } = await import('../src/cook/game/tierTextures.ts');
13
14
 
14
15
  const args = process.argv.slice(2), flag = (/** @type {string} */ name) => args.find(arg => arg.startsWith(`--${name}=`))?.slice(name.length + 3);
15
16
  const product = args.find(arg => !arg.startsWith('--'));
16
17
  if (product === undefined) throw new Error('usage: tier-textures <product-dir> [--max=512] [--out=dir]');
17
18
  const max = Number(flag('max') ?? 512), out = flag('out');
19
+ // --astc6 (S12c): a fourth column, the masters trimmed and re-encoded as ASTC 6×6 by the cook's encoder (`basisuAstc6`), as
20
+ // `phoneTier` cooks them with an encoder; its cache is the cook's, so a second run encodes nothing.
21
+ const astc6 = args.includes('--astc6') ? (await import('../src/cook/game/astc6Encode.ts')).basisuAstc6(process.env.WILDSHARD_ASTC6_CACHE ?? resolve(homedir(), '.cache/wildshard/gen/astc6/1')) : undefined;
18
22
  const slug = product.replace(/\/$/u, '').split('/').pop() ?? '';
19
23
  const discovery = JSON.parse(readFileSync(join(product, 'mounts/shardfiles', slug, 'discovery.json'), 'utf8'));
20
24
  /** @type {{phone: Record<string, string>, desktop: Record<string, string>}} */
@@ -31,10 +35,10 @@ const gpu = (url, bytes) => {
31
35
  };
32
36
  /** The desktop master of a phone source: the same source, or its name without the `.phone` / `-phone` mark. */
33
37
  /** @param {string} source @returns {string | undefined} */
34
- const master = source => table.desktop[source] ?? table.desktop[source.replace(/\.phone\./u, '.')] ?? table.desktop[source.replace(/-phone\./u, '.')];
38
+ const master = source => masterOf(table.desktop, source);
35
39
 
36
40
  /** @type {Record<string, [number, number]>} */
37
- const sum = { today: [0, 0], master: [0, 0], cooked: [0, 0], trimmed: [0, 0] };
41
+ const sum = { today: [0, 0], master: [0, 0], cooked: [0, 0], trimmed: [0, 0], astc6: [0, 0] };
38
42
  let rows = 0, missing = 0, mastered = 0;
39
43
  for (const [source, phoneUrl] of Object.entries(table.phone)) {
40
44
  if (!/\.(?:glb|ktx2)$/u.test(phoneUrl)) continue;
@@ -51,10 +55,24 @@ for (const [source, phoneUrl] of Object.entries(table.phone)) {
51
55
  add('master', masterUrl ?? phoneUrl, masterBytes ?? phone);
52
56
  add('cooked', masterUrl ?? phoneUrl, cooked);
53
57
  add('trimmed', phoneUrl, trimmed);
58
+
54
59
  if (out !== undefined) { const path = resolve(out, `.${phoneUrl}`); mkdirSync(dirname(path), { recursive: true }); writeFileSync(path, trimmed); }
55
60
  }
61
+ // --astc6: what `phoneTier` ships with the encoder, row by row: its cooked file, or today's where it keeps one (a `#layer` or horizon row).
62
+ if (astc6 !== undefined) {
63
+ const tier = phoneTier(new TextEncoder().encode(JSON.stringify(discovery)), read, undefined, astc6.encode);
64
+ const cookedTable = tier === undefined ? table : JSON.parse(new TextDecoder().decode(tier.discovery)).native.ktx2.args[0].shard;
65
+ const made = new Map([...(tier?.files.values() ?? [])].flat().map(file => [file.url, file.bytes]));
66
+ for (const url of Object.values(cookedTable.phone)) {
67
+ if (!/\.(?:glb|ktx2)$/u.test(url)) continue;
68
+ const bytes = made.get(url) ?? read(url);
69
+ if (bytes === undefined) continue;
70
+ const row = sum.astc6 ?? [0, 0]; row[0] += bytes.length; row[1] += gpu(url, bytes); sum.astc6 = row;
71
+ }
72
+ }
56
73
  const mb = (/** @type {number} */ n) => (n / 1e6).toFixed(2);
57
74
  console.log(`${slug} phone table: ${rows} KTX2/GLB rows (${mastered} with a desktop master, ${missing} not in the product), --max=${max}`);
58
- for (const [key, label] of [['today', 'phone today'], ['master', 'desktop masters'], ['cooked', `masters trimmed to ${max}`], ['trimmed', `phone today trimmed to ${max}`]]) {
75
+ for (const [key, label] of [['today', 'phone today'], ['master', 'desktop masters'], ['cooked', `masters trimmed to ${max}`], ['trimmed', `phone today trimmed to ${max}`], ...(astc6 === undefined ? [] : [['astc6', "the cook's phone table, 6x6"]])]) {
59
76
  console.log(`${label.padEnd(28)} file ${mb(sum[key]?.[0] ?? 0).padStart(7)} MB GPU ${mb(sum[key]?.[1] ?? 0).padStart(7)} MB`);
60
77
  }
78
+ if (astc6 !== undefined) console.log(`astc6: ${astc6.stats.encoded} encoded, ${astc6.stats.reused} reused, ${astc6.stats.failed} failed`);
@@ -4,7 +4,7 @@ import {createHash} from 'node:crypto';
4
4
  import {existsSync,readFileSync} from 'node:fs';
5
5
  import {resolve} from 'node:path';
6
6
  import * as v from 'valibot';
7
- import {outputFormat} from './shard-platform-format.mjs';
7
+ import {outputFormat} from './node-format.mjs';
8
8
 
9
9
  const {TilesSchema,SpawnSchema}=await import('@wildshard/format/shardSections');
10
10
  const {EntrywaysSchema}=await import('@wildshard/format/entryways');
@@ -3,7 +3,7 @@ import { createHash } from 'node:crypto';
3
3
  import { readFileSync } from 'node:fs';
4
4
  import { resolve } from 'node:path';
5
5
  import * as v from 'valibot';
6
- import { outputFormat } from './shard-platform-format.mjs';
6
+ import { outputFormat } from './node-format.mjs';
7
7
  import { parseTileBakePolicy, TILE_BAKE_POLICY } from './tile-bake-policy.mjs';
8
8
 
9
9
  const { CONTENT_CAPS: caps } = await import('@wildshard/format/contentBounds');
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "/assets/title/driftwood-isle-portrait.jpg": "/assets/title/driftwood-isle-portrait-e9d5c9aedd5c5920.jpg",
3
3
  "/assets/title/launch-1206x2622-6afc7dd7eee8.png": "/assets/title/launch-1206x2622-6afc7dd7eee8.png",
4
+ "/assets/title/main-crossroads-landscape-first.jpg": "/assets/title/main-crossroads-landscape-first-f3f196486b3476a0.jpg",
4
5
  "/assets/title/main-crossroads-landscape.jpg": "/assets/title/main-crossroads-landscape-9437ac10c599548a.jpg",
6
+ "/assets/title/main-crossroads-square-first.jpg": "/assets/title/main-crossroads-square-first-98ef65b2b3433656.jpg",
5
7
  "/assets/title/main-crossroads-square.jpg": "/assets/title/main-crossroads-square-24abf23d2606ae3f.jpg",
6
8
  "/assets/title/nalati-grasslands-portrait.jpg": "/assets/title/nalati-grasslands-portrait-5ac0c2e430a5a22b.jpg",
7
9
  "/assets/title/nine-dragon-stack-portrait.jpg": "/assets/title/nine-dragon-stack-portrait-d92d65e333c1ccba.jpg",
@@ -347,9 +347,7 @@
347
347
  "../test/pine-native-story-admission.test.ts",
348
348
  "../test/pine-posed-tier-loading.test.ts",
349
349
  "../test/pine-product-reads.test.ts",
350
- "../test/platform-build-tools.test.ts",
351
350
  "../test/platform-file-families.test.ts",
352
- "../test/platform-namespace-reach.test.ts",
353
351
  "../test/platform-output-reader.test.ts",
354
352
  "../test/platform-runtime-closure.test.ts",
355
353
  "../test/polearm-decision.test.ts",