@wildshard/engine 0.1.15 → 0.1.17

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 (207) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/index.html +157 -11
  3. package/lint/engine-sides.json +16 -0
  4. package/lint/host-register.json +496 -0
  5. package/lint/ratchet.json +2 -2
  6. package/lint/shard-imports.d.mts +1 -0
  7. package/lint/shard-imports.mjs +56 -8
  8. package/lint/wildshard-plugin.js +22 -4
  9. package/package.json +16 -5
  10. package/scripts/app-build/buildIdentity.d.mts +3 -1
  11. package/scripts/app-build/buildIdentity.mjs +25 -5
  12. package/scripts/app-build/builtAt.d.mts +4 -0
  13. package/scripts/app-build/builtAt.mjs +21 -0
  14. package/scripts/app-build/serviceWorker.ts +16 -2
  15. package/scripts/app-build/versionFiles.ts +2 -1
  16. package/scripts/app-build-pipeline.mjs +4 -1
  17. package/scripts/audio-download-proof.mjs +843 -0
  18. package/scripts/build-app.mjs +4 -0
  19. package/scripts/build-mirror.d.mts +2 -0
  20. package/scripts/build-mirror.mjs +5 -4
  21. package/scripts/built-product.mjs +3 -3
  22. package/scripts/cell-mem/metrics-preload.mjs +65 -0
  23. package/scripts/cell-mem-bench.mjs +130 -0
  24. package/scripts/check-chunks.mjs +2 -1
  25. package/scripts/devserver-client.d.mts +5 -0
  26. package/scripts/devserver-client.mjs +68 -0
  27. package/scripts/engine-ci-budget.ts +7 -1
  28. package/scripts/format-lock.mjs +20 -11
  29. package/scripts/generate-title-launch.mjs +3 -2
  30. package/scripts/grid-crossing-walk-proof.mjs +16 -8
  31. package/scripts/heavy-lane.py +25 -1
  32. package/scripts/host-ruler/register-migrate.mjs +242 -0
  33. package/scripts/host-ruler/register.d.mts +36 -0
  34. package/scripts/host-ruler/register.mjs +116 -0
  35. package/scripts/host-ruler/roots.d.mts +29 -0
  36. package/scripts/host-ruler/roots.mjs +333 -0
  37. package/scripts/host-ruler/server-roots.d.mts +23 -0
  38. package/scripts/host-ruler/server-roots.mjs +272 -0
  39. package/scripts/main-watch.d.mts +1 -1
  40. package/scripts/main-watch.mjs +10 -6
  41. package/scripts/map-hash.mjs +3 -6
  42. package/scripts/mmo-bots.mjs +2 -2
  43. package/scripts/offline-proof-rules.d.mts +1 -0
  44. package/scripts/offline-proof-rules.mjs +22 -1
  45. package/scripts/online-rig.mjs +4 -4
  46. package/scripts/page-release/flow.d.mts +1 -0
  47. package/scripts/page-release/flow.mjs +6 -2
  48. package/scripts/page-release.mjs +5 -1
  49. package/scripts/physics-route.json +0 -71
  50. package/scripts/pins-catalogue.ts +103 -0
  51. package/scripts/pins-reuse.mjs +3 -1
  52. package/scripts/pins.ts +22 -14
  53. package/scripts/preview-grid.ts +203 -0
  54. package/scripts/road-preload-proof.mjs +167 -0
  55. package/scripts/server-release/publish.mjs +2 -2
  56. package/scripts/server-release/served-slug.d.mts +2 -0
  57. package/scripts/server-release/served-slug.mjs +10 -0
  58. package/scripts/server-release/sign.d.mts +1 -0
  59. package/scripts/server-release/sign.mjs +3 -7
  60. package/scripts/shard-components.mjs +0 -2
  61. package/scripts/shard-outputs.d.mts +8 -0
  62. package/scripts/shard-outputs.mjs +45 -11
  63. package/scripts/side-parity.d.mts +2 -1
  64. package/scripts/side-parity.mjs +25 -4
  65. package/scripts/test-amber.d.mts +1 -0
  66. package/scripts/test-amber.mjs +10 -0
  67. package/scripts/test-products.json +3 -3
  68. package/scripts/tracked-public.d.mts +1 -0
  69. package/scripts/tracked-public.mjs +17 -0
  70. package/src/cli/engine.mjs +8 -0
  71. package/src/client/app/bootRoute.ts +4 -1
  72. package/src/client/app/dropModal.ts +15 -2
  73. package/src/client/app/entry.ts +67 -11
  74. package/src/client/app/slugPath.ts +5 -0
  75. package/src/client/engine/audio/Audio.ts +20 -2
  76. package/src/client/engine/boot/bakedTextures.ts +3 -2
  77. package/src/client/engine/boot/bootTrace.ts +6 -1
  78. package/src/client/engine/boot/bytes.ts +4 -3
  79. package/src/client/engine/boot/clearDownloads.ts +1 -1
  80. package/src/client/engine/boot/contentRead.ts +4 -0
  81. package/src/client/engine/boot/dropNotice.ts +20 -6
  82. package/src/client/engine/boot/gpuFiles.ts +25 -2
  83. package/src/client/engine/boot/lastEnd.ts +8 -2
  84. package/src/client/engine/boot/shardPrefetch.ts +7 -1
  85. package/src/client/engine/boot/sw.ts +19 -0
  86. package/src/client/engine/core/Game.ts +11 -3
  87. package/src/client/engine/core/GpuRecovery.ts +7 -0
  88. package/src/client/engine/core/Volumetrics.ts +5 -0
  89. package/src/client/engine/core/assets.ts +27 -20
  90. package/src/client/engine/core/bootstrap.ts +1 -2
  91. package/src/client/engine/core/ktx2.ts +84 -11
  92. package/src/client/engine/explore/Compare.ts +2 -2
  93. package/src/client/engine/explore/TouchFly.ts +3 -5
  94. package/src/client/engine/input/dom.ts +12 -0
  95. package/src/client/engine/net/predictor.ts +6 -2
  96. package/src/client/engine/player/Player.ts +10 -2
  97. package/src/client/engine/player/TouchControls.ts +12 -4
  98. package/src/client/engine/pwa/sw.js +47 -8
  99. package/src/client/engine/render/drawCheck.ts +96 -0
  100. package/src/client/engine/saves/staleBuildNote.ts +46 -0
  101. package/src/client/engine/telemetry/browserErrors.ts +157 -20
  102. package/src/client/engine/telemetry/screenOutbox.ts +61 -0
  103. package/src/client/engine/telemetry/staleBuildReport.ts +12 -0
  104. package/src/client/engine/ui/DeathFade.ts +99 -11
  105. package/src/client/engine/ui/ErrorModal.ts +13 -6
  106. package/src/client/engine/ui/Feedback.ts +2 -1
  107. package/src/client/engine/ui/Loading.ts +10 -6
  108. package/src/client/engine/ui/Map.ts +2 -1
  109. package/src/client/engine/ui/WeaponStrip.ts +2 -1
  110. package/src/client/engine/ui/backGuard.ts +104 -0
  111. package/src/client/engine/ui/hudAdapters.ts +30 -4
  112. package/src/client/engine/ui/loading.css +17 -0
  113. package/src/client/engine/ui/namePrompt.ts +6 -5
  114. package/src/client/engine/ui/styles/combat.css +12 -0
  115. package/src/client/engine/ui/styles/namePrompt.css +4 -2
  116. package/src/client/game/boot/audio.generated.ts +0 -294
  117. package/src/client/game/boot/bytes.generated.ts +0 -11
  118. package/src/client/game/boot/versions.generated.ts +0 -11
  119. package/src/client/game/compendium/keepsakes.ts +16 -6
  120. package/src/client/game/grapple/tool.ts +10 -7
  121. package/src/client/game/grid/cellLoading.ts +23 -12
  122. package/src/client/game/grid/cellScreens.ts +39 -74
  123. package/src/client/game/grid/liveSession.ts +40 -7
  124. package/src/client/game/grid/nearPlaceholderPlan.ts +8 -0
  125. package/src/client/game/grid/nearPlaceholderView.ts +9 -3
  126. package/src/client/game/grid/oneWayIn.ts +92 -27
  127. package/src/client/game/grid/pageEntry.ts +19 -0
  128. package/src/client/game/grid/pageShell.ts +1 -1
  129. package/src/client/game/grid/plotAudio.ts +114 -0
  130. package/src/client/game/grid/products.ts +55 -5
  131. package/src/client/game/grid/roadLookPlatform.ts +2 -2
  132. package/src/client/game/grid/session.ts +38 -22
  133. package/src/client/game/grid/spawnGround.ts +68 -0
  134. package/src/client/game/grid/voidLook.ts +29 -23
  135. package/src/client/game/loot/runtime.ts +3 -1
  136. package/src/client/game/mainMenu.ts +14 -6
  137. package/src/client/game/riding/hud.ts +6 -4
  138. package/src/client/game/session/finish.ts +17 -3
  139. package/src/client/game/session/play.ts +8 -2
  140. package/src/client/game/session/session.ts +4 -1
  141. package/src/client/game/shardfile/clientWorker.ts +41 -12
  142. package/src/client/game/shardfile/serverRoute.ts +10 -22
  143. package/src/client/game/slugPage.css +11 -0
  144. package/src/client/game/slugPage.ts +84 -0
  145. package/src/client/game/systems/viewmodel/heldView.ts +6 -3
  146. package/src/client/game/titleDeck.ts +55 -32
  147. package/src/client/host/online/doctor.ts +7 -6
  148. package/src/client/host/online/linkScreens.ts +16 -0
  149. package/src/client/host/online/release.ts +51 -5
  150. package/src/client/host/online/shell.ts +48 -27
  151. package/src/client/host/standalone/shell.ts +7 -3
  152. package/src/cook/game/audioReport.ts +57 -0
  153. package/src/cook/game/entryTotals.ts +26 -6
  154. package/src/cook/game/installedRuntimeReads.ts +3 -0
  155. package/src/server/engine/sim/respawn.ts +6 -1
  156. package/src/server/engine/sim.ts +3 -0
  157. package/src/server/game/grid/simulation.ts +35 -0
  158. package/src/server/game/loot/harvest.ts +2 -0
  159. package/src/server/game/loot/keepsakeProgression.ts +40 -0
  160. package/src/server/game/loot/playerOwned.ts +5 -1
  161. package/src/server/game/plugin/simulation.ts +4 -0
  162. package/src/server/game/population/nativeBake.ts +2 -1
  163. package/src/server/game/quest/chapterRecords.ts +2 -0
  164. package/src/server/game/quest/serverChapters.ts +4 -0
  165. package/src/server/game/quest/serverDoors.ts +11 -5
  166. package/src/server/game/roomRespawn.ts +4 -0
  167. package/src/server/game/shardfile/installedSides.ts +18 -0
  168. package/src/server/game/shardfile/nativeAssemblyHosts.ts +19 -10
  169. package/src/server/game/shardfile/nativeAssemblyInput.ts +1 -4
  170. package/src/server/host/bake/headlessWorker.ts +5 -1
  171. package/src/server/host/dedicated/cellHost.ts +98 -29
  172. package/src/server/host/dedicated/cellProtocol.ts +11 -1
  173. package/src/server/host/dedicated/cellWorker.ts +9 -3
  174. package/src/server/host/dedicated/crossing.ts +6 -2
  175. package/src/server/host/dedicated/dedicatedRoom.ts +21 -8
  176. package/src/server/host/dedicated/gridCells.ts +52 -9
  177. package/src/server/host/dedicated/main.ts +31 -12
  178. package/src/server/host/dedicated/placementFile.ts +72 -0
  179. package/src/server/host/dedicated/releaseFile.ts +17 -10
  180. package/src/server/host/dedicated/roadRoom.ts +21 -5
  181. package/src/server/host/dedicated/workerTable.ts +13 -1
  182. package/src/server/host/dedicated/world.ts +81 -9
  183. package/src/server/host/headlessRuntime.ts +10 -5
  184. package/src/server/host/installers.ts +62 -0
  185. package/src/server/host/openWorld.ts +59 -0
  186. package/src/server/host/ropeDecks.ts +2 -0
  187. package/src/server/host/standalone/cellWorld.ts +25 -19
  188. package/src/server/host/standalone/fallFloor.ts +2 -2
  189. package/src/server/host/standalone/gridServer.ts +7 -4
  190. package/src/server/host/standalone/roadWorld.ts +41 -4
  191. package/src/shared/engine/audio/bootAudio.ts +33 -0
  192. package/src/shared/engine/level/spec.ts +3 -3
  193. package/src/shared/engine/net/acts.ts +3 -0
  194. package/src/shared/engine/physics/query.ts +27 -0
  195. package/src/shared/engine/physics/terrain.ts +19 -28
  196. package/src/shared/engine/saves/saves.lock.json +15 -0
  197. package/src/shared/engine/sim/actRoutes.ts +2 -0
  198. package/src/shared/game/compendium/keepsakeProgression.ts +24 -0
  199. package/src/shared/game/grid/catalogue.ts +12 -5
  200. package/src/shared/game/grid/catalogueSlot.ts +11 -0
  201. package/src/shared/game/grid/farProxy.ts +6 -5
  202. package/src/shared/game/grid/pageMode.ts +1 -1
  203. package/src/shared/game/grid/roadLayout.ts +26 -3
  204. package/src/shared/game/grid/singleplayer.json +0 -13
  205. package/src/shared/game/grid/voidFloor.ts +122 -0
  206. package/src/shared/game/strings.ts +15 -0
  207. package/src/shared/host/standalone/netInput.ts +2 -1
package/lint/ratchet.json CHANGED
@@ -32,8 +32,8 @@
32
32
  "shardfile/sim-in-runtime": {}
33
33
  },
34
34
  "budgets": {
35
- "js/title/raw": 350000,
36
- "js/title/gzip": 110000,
35
+ "js/title/raw": 500000,
36
+ "js/title/gzip": 160000,
37
37
  "js/grid-session/raw": 300000,
38
38
  "js/grid-session/gzip": 100000,
39
39
  "js/session/raw": 4400000,
@@ -2,4 +2,5 @@
2
2
  export function shardGameImport(filename: string, source: string | undefined): boolean;
3
3
  export function gamePluginImportViolation(filename: string, source: string | undefined, exports: Readonly<Record<string, unknown>>): string | null;
4
4
  export function shardEngineImport(filename: string, source: string | undefined): boolean;
5
+ export function sharddevRuntimeImport(filename: string, source: string | undefined): boolean;
5
6
  export function generatorImportViolation(filename: string, source: string | undefined): string | null;
@@ -1,10 +1,26 @@
1
1
  import { dirname, isAbsolute, resolve } from 'node:path';
2
+ import { fileURLToPath, pathToFileURL } from 'node:url';
3
+
4
+ /** The file Node loads for relative `source` (a URL resolve, query and hash dropped), without a trailing slash; null when it cannot. */
5
+ const nodePath = (filename, source) => {
6
+ try {
7
+ return fileURLToPath(new URL(source, pathToFileURL(resolve(filename)))).replaceAll('\\', '/').replace(/(?<=.)\/$/u, '');
8
+ } catch { return null; }
9
+ };
10
+ /** Both readings of relative `source`: path.resolve's, and Node's URL resolve (`%2e%2e` is `..`, `\\` is `/`). */
11
+ const relativeTargets = (filename, source) => !source.startsWith('.') ? []
12
+ : [resolve(dirname(filename), source).replaceAll('\\', '/'), nodePath(filename, source)].filter(path => path !== null);
13
+ /** Whether either reading of a relative `source` lands under `src/<side>/<folder>` (a hidden boundary is still one). */
14
+ const relativeReach = (filename, source, folder) => {
15
+ const pattern = new RegExp(`/src/(?:client|cook|server|shared)/${folder}(?:/|$)`, 'u');
16
+ return relativeTargets(filename, source).some(path => pattern.test(path));
17
+ };
2
18
 
3
19
  /** Resolve source syntax to the game boundary; relative imports cannot bypass the author-package rule. */
4
20
  export function shardGameImport(filename, source) {
5
21
  if (typeof source !== 'string') return false;
6
- if (/^@wildshard\/(?:engine\/)?game(?:\/|$)/u.test(source)) return true;
7
- return source.startsWith('.') && /\/src\/(?:client|cook|server|shared)\/game(?:\/|$)/u.test(resolve(dirname(filename), source).replaceAll('\\', '/'));
22
+ if (/^@wildshard\/(?:engine\/)?game(?:[/?#]|$)/u.test(source)) return true;
23
+ return relativeReach(filename, source, 'game');
8
24
  }
9
25
 
10
26
  /** G307: a game's exports map is its plugin surface, never a parallel SDK facade allowlist. */
@@ -22,15 +38,47 @@ export function gamePluginImportViolation(filename, source, exports) {
22
38
  /** Identify an engine boundary without letting relative imports bypass the shrink-only migration count. */
23
39
  export function shardEngineImport(filename, source) {
24
40
  if (typeof source !== 'string') return false;
25
- if (/^@wildshard\/engine(?:\/(?!host\/|game\/)|$)/u.test(source)) return true;
26
- return source.startsWith('.') && /\/src\/(?:client|cook|server|shared)\/engine(?:\/|$)/u.test(resolve(dirname(filename), source).replaceAll('\\', '/'));
41
+ if (/^@wildshard\/engine(?:\/(?!host\/|game\/)|[?#]|$)/u.test(source)) return true;
42
+ return relativeReach(filename, source, 'engine');
43
+ }
44
+
45
+ /** Whether either reading of relative `source` (path.resolve's or Node's) lands in the trusted SDK runtime. */
46
+ export function sharddevRuntimeImport(filename, source) {
47
+ return typeof source === 'string' && relativeTargets(filename, source).some(path => /\/src\/sharddev\/runtime(?:\/|$)/u.test(path));
48
+ }
49
+
50
+ const PLAINLY = 'the import path names one file to Node (a URL) and another to path.resolve; '
51
+ + 'no percent-escape, backslash, tab, newline or edge space in an import path, write the path plainly';
52
+
53
+ /** `rawSource` without its ?query or #hash, which are no part of the file. Node keeps a bare specifier's `?` in the
54
+ * subpath, so for one the stripped path is only ever the stricter read. */
55
+ const pathPart = rawSource => {
56
+ const postfix = rawSource.slice(1).search(/[?#]/u) + 1;
57
+ return postfix > 0 ? rawSource.slice(0, postfix) : rawSource;
58
+ };
59
+
60
+ /** Why `rawSource` names one file to Node and another to path.resolve (or to Vite), or null when they agree. */
61
+ function encodedImportViolation(filename, rawSource) {
62
+ const source = pathPart(rawSource);
63
+ // Node resolves a relative path as a URL (`./%2e%2e/` is `..`, `\\` is `/`, tabs and newlines drop out, `%2f` is
64
+ // refused) and Vite decodes nothing, while path.resolve keeps them all as folder names: the lint and build disagree.
65
+ if (/%[0-9a-f]{2}|[\\\t\n\r]/iu.test(source)) return PLAINLY;
66
+ // The catch-all for a rewrite not listed above: the path must name the same file as a URL (how Node loads it).
67
+ if (source.startsWith('.') && nodePath(filename, source) !== resolve(dirname(filename), source).replaceAll('\\', '/')) return PLAINLY;
68
+ return null;
27
69
  }
28
70
 
29
- /** DS0.3 author folders use three, the authoring SDK, commons, and their own shard files only. */
30
- export function generatorImportViolation(filename, source) {
71
+ /** DS0.3 author folders use three, the authoring SDK, commons, and their own shard files only. Every other shard file
72
+ * (bake commands, Blender sources, declarations) imports by a plain relative path or a package name: an escaped,
73
+ * absolute or file: path would slip past the layer rules, which read it with path.resolve. */
74
+ export function generatorImportViolation(filename, rawSource) {
31
75
  const path=resolve(filename).replaceAll('\\','/'), match=/(?:^|\/)src\/shards\/([^/]+)\/(.+)$/u.exec(path);
32
- if(match===null || !(/^(?:generators|data|quests)\//u.test(match[2]) || match[2]==='shard.config.ts')) return null;
33
- if(typeof source!=='string')return null;
76
+ if(match===null || typeof rawSource!=='string')return null;
77
+ const encoded=encodedImportViolation(filename,rawSource);
78
+ if(encoded!==null)return encoded;
79
+ const source=pathPart(rawSource);
80
+ if(!(/^(?:generators|data|quests)\//u.test(match[2]) || match[2]==='shard.config.ts'))
81
+ return isAbsolute(source) || source.startsWith('file:') ? 'shard files import by relative path or package name, never an absolute path or file: URL' : null;
34
82
  // Test runners and Node fixture tools never become producer imports.
35
83
  if(path.endsWith('.test.ts') && source!=='<computed>' && !source.startsWith('.')
36
84
  && !isAbsolute(source) && !source.startsWith('@wildshard/')) return null;
@@ -28,7 +28,7 @@ import { fileURLToPath } from 'node:url';
28
28
  import { simClosure, simRoot } from './sim-closure.mjs';
29
29
  import { authoredHtmlSites } from './authored-html.mjs';
30
30
  import { runtimePerformanceViolations } from './runtime-performance.mjs';
31
- import { shardGameImport, shardEngineImport, generatorImportViolation } from './shard-imports.mjs';
31
+ import { shardGameImport, shardEngineImport, sharddevRuntimeImport, generatorImportViolation } from './shard-imports.mjs';
32
32
  import { shardfileBoundaryVisitors } from './shardfile-boundaries.mjs';
33
33
  import { hostCallbackSites } from './host-callback-syntax.mjs';
34
34
  import { hostPlayFile } from './host-files.mjs';
@@ -545,6 +545,24 @@ const noRendererType = rule('Renderer types stay inside rendering (E357)', (cont
545
545
  if (/^src\/(?:client|cook|server|shared)\/engine\/(?:render\/|core\/(?:Game|bootstrap)\.ts$)/u.test(pathOf(context))) return {};
546
546
  return { Identifier(node) { if (node.name === 'WebGLRenderer') report(context, node, 'Renderer types belong in engine/render'); } };
547
547
  });
548
+ // J326 (Jake, 2026-11-13): "Let's only do WebGL renderer. Let's not do any WebGPU renderer." Nothing imports three's
549
+ // WebGPU or TSL builds, names WebGPURenderer, or asks the browser for a WebGPU adapter; renderer.ts makes the one
550
+ // WebGLRenderer on a WebGL2 context (core/webglStartup.ts).
551
+ const WEBGPU_SOURCE = /^three\/(?:webgpu|tsl)(?:$|\/)|^three\/(?:examples\/jsm|addons)\/(?:renderers\/webgpu|nodes|tsl)(?:$|\/)|^three\/(?:examples\/jsm|addons)\/capabilities\/WebGPU(?:\.js)?$|three\.webgpu/u;
552
+ const WEBGPU_MESSAGE = 'WebGL renderer only, no WebGPU (J326)';
553
+ const isNavigator = (node) => { const x = unwrap(node); return (x?.type === 'Identifier' && x.name === 'navigator') || (x?.type === 'MemberExpression' && propName(x) === 'navigator'); };
554
+ const noWebgpu = rule('WebGL renderer only, no WebGPU (J326)', (context) => ({
555
+ ...importsVisitor((node) => { const source = importPrefix(node.source); if (typeof source === 'string' && WEBGPU_SOURCE.test(source)) report(context, node, WEBGPU_MESSAGE); }),
556
+ Identifier(node) { if (node.name === 'WebGPURenderer') report(context, node, WEBGPU_MESSAGE); },
557
+ MemberExpression(node) {
558
+ if ((propName(node) === 'gpu' || stringOf(node.property) === 'gpu') && isNavigator(node.object)) report(context, node, WEBGPU_MESSAGE);
559
+ else if (propName(node) === 'requestAdapter') report(context, node, WEBGPU_MESSAGE);
560
+ },
561
+ BinaryExpression(node) { if (node.operator === 'in' && stringOf(node.left) === 'gpu' && isNavigator(node.right)) report(context, node, WEBGPU_MESSAGE); },
562
+ VariableDeclarator(node) {
563
+ if (node.id?.type === 'ObjectPattern' && isNavigator(node.init) && node.id.properties.some((p) => p.type === 'Property' && (p.key?.name === 'gpu' || stringOf(p.key) === 'gpu'))) report(context, node, WEBGPU_MESSAGE);
564
+ },
565
+ }));
548
566
  const SHADER_HOOKS = new Set(['onBeforeCompile', 'customProgramCacheKey']);
549
567
  const noRawShaderPatch = rule('Shader patches go through the one registry (E357 X6)', (context) => {
550
568
  if (pathOf(context).startsWith('src/client/engine/render/')) return {};
@@ -1010,8 +1028,8 @@ const noShardRuntime = rule('Primary shards contain authoring and declarations o
1010
1028
  report(context, node, 'Primary shard runtime source is forbidden; use generators/, registered Blender sources or erased declarations; shard.config.ts must be declaration-only');
1011
1029
  },
1012
1030
  ...boundaryVisitors((node, source) => {
1013
- if (typeof source === 'string' && (/^@wildshard\/sharddev\/runtime(?:\/|$)/u.test(source)
1014
- || modulePath(context.filename, source).startsWith('src/sharddev/runtime/')))
1031
+ if (typeof source === 'string' && (/^@wildshard\/sharddev\/runtime(?:[/?#]|$)/u.test(source)
1032
+ || modulePath(context.filename, source).startsWith('src/sharddev/runtime/') || sharddevRuntimeImport(context.filename, source)))
1015
1033
  report(context, node, 'Primary shards cannot import trusted SDK runtime; emit admitted data or WASM instead');
1016
1034
  }),
1017
1035
  };
@@ -1165,7 +1183,7 @@ const plugin = {
1165
1183
  'runtime-performance': runtimePerformance,
1166
1184
  'no-url-switch': noUrlSwitch, layer, 'public-index': publicIndex, 'engine-words': engineWordsRule, 'no-shard-branch': noShardBranch, 'no-raw-save': noRawSave,
1167
1185
  'no-raw-random-time': noRawRandomTime, 'no-raw-input': noRawInput,
1168
- 'no-renderer-type': noRendererType, 'no-raw-shader-patch': noRawShaderPatch, 'sim-no-render': simNoRender,
1186
+ 'no-renderer-type': noRendererType, 'no-webgpu': noWebgpu, 'no-raw-shader-patch': noRawShaderPatch, 'sim-no-render': simNoRender,
1169
1187
  'no-runtime-generator': noRuntimeGenerator,
1170
1188
  'no-hook-chain': noHookChain,
1171
1189
  'no-active-singleton': noActiveSingleton, 'no-active-chunk': noActiveChunk,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildshard/engine",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "The Wildshard engine: one repo with shared, client, server and cook code and three build targets (client, dedicated server, standalone listen server), shaped like Unreal or Source.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "type": "module",
14
14
  "bin": {
15
- "engine": "./src/cli/main.ts"
15
+ "engine": "./src/cli/engine.mjs"
16
16
  },
17
17
  "engines": {
18
18
  "node": ">=24.18.0"
@@ -65,8 +65,8 @@
65
65
  "@sentry/browser": "11.0.0",
66
66
  "@sentry/core": "11.0.0",
67
67
  "@valibot/to-json-schema": "1.8.0",
68
- "@wildshard/format": "github:project-wildshard/shard-format#v0.4.4",
69
- "@wildshard/wire": "github:project-wildshard/shard-format#203e4fa89f0c5f3804b6b254363d7597008a9389&path:/packages/wire",
68
+ "@wildshard/format": "npm:@wildshard/shard-format@^0.4.9",
69
+ "@wildshard/wire": "^0.1.0",
70
70
  "ajv": "6.15.0",
71
71
  "fflate": "0.8.3",
72
72
  "hono": "4.13.13",
@@ -80,9 +80,15 @@
80
80
  "ws": "8.22.0"
81
81
  },
82
82
  "peerDependencies": {
83
- "sharp": "0.35.5"
83
+ "@types/three": "*",
84
+ "@typescript/typescript6": "6.0.2",
85
+ "sharp": "0.35.5",
86
+ "vite": "8.3.0"
84
87
  },
85
88
  "peerDependenciesMeta": {
89
+ "@types/three": {
90
+ "optional": true
91
+ },
86
92
  "sharp": {
87
93
  "optional": true
88
94
  }
@@ -574,6 +580,7 @@
574
580
  "./saves/store": "./src/shared/engine/saves/store.ts",
575
581
  "./saves/shape": "./src/shared/engine/saves/shape.ts",
576
582
  "./strings": "./src/shared/engine/strings.ts",
583
+ "./ui/backGuard": "./src/client/engine/ui/backGuard.ts",
577
584
  "./ui/BossBar": "./src/client/engine/ui/BossBar.ts",
578
585
  "./ui/namePrompt": "./src/client/engine/ui/namePrompt.ts",
579
586
  "./ui/offlineDownload": "./src/client/engine/ui/offlineDownload.ts",
@@ -879,6 +886,7 @@
879
886
  "./game/ambient/flock": "./src/shared/game/ambient/flock.ts",
880
887
  "./game/grid/pageMode": "./src/shared/game/grid/pageMode.ts",
881
888
  "./game/grid/gridCollision": "./src/shared/game/grid/gridCollision.ts",
889
+ "./game/grid/voidFloor": "./src/shared/game/grid/voidFloor.ts",
882
890
  "./game/grid/assembly": "./src/shared/game/grid/assembly.ts",
883
891
  "./game/grid/catalogueSlot": "./src/shared/game/grid/catalogueSlot.ts",
884
892
  "./game/grid/catalogueDocument": "./src/shared/game/grid/catalogueDocument.ts",
@@ -928,6 +936,7 @@
928
936
  "./game/quest/serverPlaces": "./src/server/game/quest/serverPlaces.ts",
929
937
  "./game/loadout/itemCatalogue": "./src/shared/game/loadout/itemCatalogue.ts",
930
938
  "./game/shardfile/nativePlan": "./src/server/game/shardfile/nativePlan.ts",
939
+ "./game/shardfile/installedSides": "./src/server/game/shardfile/installedSides.ts",
931
940
  "./game/shardfile/worldTargets": "./src/shared/game/shardfile/worldTargets.ts",
932
941
  "./game/shardfile/decisions": "./src/server/game/shardfile/decisions.ts",
933
942
  "./game/shardfile/outputDescriptor": "./src/shared/game/shardfile/outputDescriptor.ts",
@@ -1153,6 +1162,7 @@
1153
1162
  "./game/models/binarySource": "./src/client/game/models/binarySource.ts",
1154
1163
  "./game/plugin/clientChannelView": "./src/client/game/plugin/clientChannelView.ts",
1155
1164
  "./game/mainMenu": "./src/client/game/mainMenu.ts",
1165
+ "./game/slugPage": "./src/client/game/slugPage.ts",
1156
1166
  "./game/systems/species/install": "./src/client/game/systems/species/install.ts",
1157
1167
  "./game/icons": "./src/client/game/icons.ts",
1158
1168
  "./game/models/interact": "./src/client/game/models/interact.ts",
@@ -1179,6 +1189,7 @@
1179
1189
  "./host/headlessJourney": "./src/shared/host/headlessJourney.ts",
1180
1190
  "./host/headlessTape": "./src/shared/host/headlessTape.ts",
1181
1191
  "./host/headlessRuntime": "./src/server/host/headlessRuntime.ts",
1192
+ "./host/openWorld": "./src/server/host/openWorld.ts",
1182
1193
  "./host/immutable": "./src/shared/host/immutable.ts",
1183
1194
  "./host/tickProtocol": "./src/shared/host/tickProtocol.ts",
1184
1195
  "./host/tickWorkerHost": "./src/server/host/tickWorkerHost.ts",
@@ -2,7 +2,9 @@
2
2
  export const BUILD_ID_EXPRESSION: string;
3
3
  export const VALIDATOR_EXPRESSION: string;
4
4
  export const VERDICTS_EXPRESSION: string;
5
- export interface DocumentAdmissionFacts { readonly validator: string; readonly verdicts: readonly unknown[] }
5
+ export interface DocumentAdmissionFacts { readonly validator: string; readonly verdicts: readonly unknown[]; readonly world?: { readonly release: string; readonly key: string; readonly recordTag?: string }; readonly label?: string; readonly builtAt?: number }
6
+ /** The build pill's words (buildCheck.ts buildLabel): git describe, else "v<version> · <short sha>". */
7
+ export function buildLabelOf(build: string, release: { readonly version: string; readonly describe?: string }): string;
6
8
  /** A new build's id: WS_BUILD_ID, else short git sha + build time. */
7
9
  export function newBuildId(): string;
8
10
  /** A known source's build id: short sha + build time (for exported trees, passed as WS_BUILD_ID). */
@@ -37,9 +37,20 @@ export const codeDirectory = (build) => `b/${build}`;
37
37
  * in its own folder, and the deploy carries the old builds' graphs (MF2, J79) as before. */
38
38
  export const SHARED_CODE_DIRECTORY = 'b/c';
39
39
 
40
- /** Stamp before executable module scripts, without changing the bundle's URLs.
40
+ /** The build pill's words for a build (src/client/engine/ui/buildCheck.ts buildLabel, which test/build-identity.test.ts
41
+ * keeps equal): its `git describe`, else "v0.1.5 · a8144a5", either half alone when the other is unknown.
42
+ * @param {string} build @param {{version: string, describe?: string}} release */
43
+ export function buildLabelOf(build, { version, describe = '' }) {
44
+ if (describe !== '' && /^[\w .·+-]{1,80}$/u.test(describe)) return describe; // an odd tag never fails a build over a label
45
+ const [gitSha = '', stamp = ''] = build.split('-');
46
+ const short = /^[0-9a-f]{7,40}$/iu.test(gitSha) ? gitSha.slice(0, 7) : gitSha.length >= 7 ? gitSha : stamp;
47
+ return [version === '' ? '' : `v${version}`, short].filter(part => part !== '').join(' · ');
48
+ }
49
+
50
+ /** Stamp before executable module scripts, without changing the bundle's URLs. `label` (QA 11-13) is the build pill's
51
+ * words, which index.html's static title shows before any bundle runs.
41
52
  * @param {string} html @param {string} build
42
- * @param {{validator: string, verdicts: readonly unknown[], world?: {release: string, key: string,recordTag?:string}}} [facts] */
53
+ * @param {{validator: string, verdicts: readonly unknown[], world?: {release: string, key: string,recordTag?:string}, label?: string, builtAt?: number}} [facts] */
43
54
  export function stampBuildHtml(html, build, facts) {
44
55
  if (build.length === 0 || !/^[\w.-]+$/u.test(build)) throw new Error('Invalid document build identity');
45
56
  if (html.includes('globalThis.__WS_BUILD_ID__=')) throw new Error('Duplicate document build identity');
@@ -53,19 +64,28 @@ export function stampBuildHtml(html, build, facts) {
53
64
  if (facts !== undefined && (!/^[a-f0-9]{64}$/u.test(facts.validator) || !Array.isArray(facts.verdicts))) throw new Error('Invalid document admission facts');
54
65
  const admission = facts === undefined ? '' : `globalThis.__WS_SHARDFILE_VALIDATOR__=${JSON.stringify(facts.validator)};globalThis.__WS_SHARDFILE_VERDICTS__=${JSON.stringify(facts.verdicts).replaceAll('<', String.raw`\u003c`)};`;
55
66
  const world = facts?.world === undefined ? '' : `globalThis.__WS_WORLD__=${JSON.stringify(facts.world).replaceAll('<', String.raw`\u003c`)};`;
56
- return `${source.slice(0, end)}<script>globalThis.__WS_BUILD_ID__=${JSON.stringify(build)};${admission}${world}</script>${source.slice(end)}`;
67
+ if (facts?.label !== undefined && !/^[\w .·+-]{1,80}$/u.test(facts.label)) throw new Error('Invalid document build label');
68
+ const label = facts?.label === undefined ? '' : `globalThis.__WS_BUILD_LABEL__=${JSON.stringify(facts.label)};`;
69
+ // STALE-BUILD SB1 (J321): the build time, as a meta a person can read and a number index.html's data-stale-build reads
70
+ const at = facts?.builtAt;
71
+ if (at !== undefined && !(Number.isSafeInteger(at) && at > 0)) throw new Error('Invalid document build time');
72
+ const built = at === undefined ? ['', ''] : [`<meta name="ws-built-at" content="${new Date(at).toISOString()}">`, `globalThis.__WS_BUILT_AT__=${at};`];
73
+ return `${source.slice(0, end)}${built[0]}<script>globalThis.__WS_BUILD_ID__=${JSON.stringify(build)};${built[1]}${admission}${world}${label}</script>${source.slice(end)}`;
57
74
  }
58
75
 
59
76
  /** Plain post-bundle step, before the service worker hashes the final HTML.
60
77
  * Every document entry gets the same version.json identity, including native
61
78
  * index.html and the calibration entry. No new Vite plugin or fetched module.
62
79
  * @param {string} directory
63
- * @param {{validator: string, verdicts: readonly unknown[]}} [facts] */
80
+ * @param {{validator: string, verdicts: readonly unknown[], world?: {release: string, key: string,recordTag?:string}, label?: string}} [facts] */
64
81
  export function stampBuildDocuments(directory, facts) {
65
82
  /** @type {unknown} */
66
83
  const version = JSON.parse(readFileSync(resolve(directory, 'version.json'), 'utf8'));
67
84
  if (typeof version !== 'object' || version === null || !('build' in version) || typeof version.build !== 'string') throw new Error('Missing document build identity');
68
85
  if (version.rendererRevision !== undefined && (typeof version.rendererRevision !== 'string' || !/^[a-f0-9]{64}$/u.test(version.rendererRevision))) throw new Error('Invalid renderer identity');
86
+ // STALE-BUILD SB1: version.json's `time` is the build's one time (build-app's WS_BUILT_AT)
87
+ const time = 'time' in version && typeof version.time === 'string' ? Date.parse(version.time) : Number.NaN;
88
+ const builtAt = Number.isFinite(time) ? time : undefined;
69
89
  const documents = new Set(['index.html']);
70
90
  // E7.5 prep: the Connection doctor's page is built on its own (doctorOutput.mjs), so no manifest names it
71
91
  if (existsSync(resolve(directory, 'doctor/index.html'))) documents.add('doctor/index.html');
@@ -83,7 +103,7 @@ export function stampBuildDocuments(directory, facts) {
83
103
  }
84
104
  for (const name of documents) {
85
105
  const path = resolve(directory, name);
86
- const html=stampBuildHtml(readFileSync(path, 'utf8'), version.build, facts);
106
+ const html=stampBuildHtml(readFileSync(path, 'utf8'), version.build, builtAt === undefined ? facts : { ...facts, builtAt });
87
107
  writeFileSync(path, version.rendererRevision === undefined ? html : html.replace('<script>globalThis.__WS_BUILD_ID__=',`<script>globalThis.__WS_RENDERER_REVISION__=${JSON.stringify(version.rendererRevision)};globalThis.__WS_BUILD_ID__=`));
88
108
  }
89
109
  }
@@ -0,0 +1,4 @@
1
+ /** STALE-BUILD SB1: the build's one time, ms (WS_BUILT_AT, else now). */
2
+ export function builtAtOf(requested: string | undefined, now?: number): string;
3
+ /** STALE-BUILD SB3: the page entry's first statement, its build time and the age check; '' off build-app. */
4
+ export function entryStamp(builtAt: string | undefined): string;
@@ -0,0 +1,21 @@
1
+ /** STALE-BUILD SB1 (J321, Jake 2026-11-13: "we must stamp in the actual date and time of that code, in both the HTML and
2
+ * the JavaScript"): the one build time, in ms, every stamp of a build carries. build-app fixes it once in WS_BUILT_AT, so
3
+ * version.json, the documents, the page's entry and sw.js agree to the millisecond.
4
+ * @param {string | undefined} requested @param {number} [now] */
5
+ export function builtAtOf(requested, now = Date.now()) {
6
+ if (requested === undefined || requested === '') return String(now);
7
+ if (!/^\d{12,14}$/u.test(requested)) throw new Error('Invalid WS_BUILT_AT (ms since 1970)');
8
+ return requested;
9
+ }
10
+
11
+ /** STALE-BUILD SB3: the first statement of the page's own entry (`b/<build>/main-*.js`, a file per build, so no shared
12
+ * chunk's bytes move): its build time, then the check. With strictExecutionOrder every module body waits for the entry's
13
+ * call, so this runs before any of them. A stamp unlike the document's is marked; over 21 days, index.html's
14
+ * `data-stale-build` screen takes the page (it may let a build through when the server says the device clock is wrong)
15
+ * and the throw stops every module: no menu, no game. Off build-app (dev, tests) there is no stamp and no banner.
16
+ * @param {string | undefined} builtAt WS_BUILT_AT */
17
+ export function entryStamp(builtAt) {
18
+ if (builtAt === undefined || !/^\d{12,14}$/u.test(builtAt)) return '';
19
+ return `globalThis.__WS_ENTRY_BUILT_AT__=${builtAt};if(globalThis.__WS_BUILT_AT__!==${builtAt})document.documentElement.dataset.stampMismatch=String(globalThis.__WS_BUILT_AT__);`
20
+ + `if(globalThis.__wsStaleBuild?.(${builtAt})===true){document.documentElement.dataset.booted="";throw new Error("STALE-BUILD: this build is over 21 days old; only the forced update runs")}`;
21
+ }
@@ -34,6 +34,13 @@ function shellFiles(html: string, root: string, sources: ReadonlyMap<string, str
34
34
  const fonts = join(publicRoot, 'fonts');
35
35
  // S2: the title's bytes. Only the Latin faces the game's text uses wait in the shell; the rest load if a glyph asks.
36
36
  if (existsSync(fonts)) for (const file of readdirSync(fonts)) if (file.endsWith('-latin.woff2')) add(`/fonts/${file}`);
37
+ // AUDIO AU3: the title's music comes with the shell (play never streams it). Piano is the one style left (AU16, J304);
38
+ // its `title` slot names the file. A build with a content base moves it to the content list, as it does the title art.
39
+ const music = join(publicRoot, 'assets/music/piano/music.json');
40
+ if (existsSync(music)) {
41
+ const full: unknown = Reflect.get(Reflect.get(Reflect.get(JSON.parse(readFileSync(music, 'utf8')) as object, 'slots') ?? {}, 'title') ?? {}, 'full');
42
+ if (typeof full === 'string') add(`/assets/music/piano/${full}`);
43
+ }
37
44
  // S2: iOS reads the launch image itself, once, when the app is added; no page or worker route ever serves it.
38
45
  return [...files].filter(url => !url.startsWith('/assets/title/launch-')).sort();
39
46
  }
@@ -111,7 +118,7 @@ export function refreshServiceWorker(outDir: string, before: string): void {
111
118
  const core = held.split(document).join(JSON.stringify(html)).replaceAll(old, `${buildId}-${digest}`), scripts = workerScripts(core);
112
119
  mkdirSync(dirname(join(outDir, scripts.fileName)), { recursive: true });
113
120
  writeFileSync(join(outDir, scripts.fileName), core);
114
- writeFileSync(join(outDir, 'sw.js'), scripts.bootstrap);
121
+ writeFileSync(join(outDir, 'sw.js'), stampWorker(scripts.bootstrap, outDir));
115
122
  console.log(`sw.js refreshed (${buildId}-${digest})`);
116
123
  }
117
124
 
@@ -129,6 +136,13 @@ function splitBundle(outDir: string, bundle: Record<string, EmittedFile>): Recor
129
136
  return joined;
130
137
  }
131
138
 
139
+ /** STALE-BUILD SB1 (J321): sw.js opens with its build's time (version.json `time`), as the page and its entry do. */
140
+ function stampWorker(bootstrap: string, outDir: string): string {
141
+ const { time } = JSON.parse(readFileSync(join(outDir, 'version.json'), 'utf8')) as { time?: unknown };
142
+ const at = typeof time === 'string' ? Date.parse(time) : Number.NaN;
143
+ return Number.isFinite(at) ? `// built ${new Date(at).toISOString()}\nself.__WS_BUILT_AT__=${at};\n${bootstrap}` : bootstrap;
144
+ }
145
+
132
146
  /** Called after ordinary bundling; previous-deploy chunks are carried by MF2 afterwards. */
133
147
  export async function writeServiceWorker(outDir: string, root: string): Promise<void> {
134
148
  const { build: buildId } = JSON.parse(readFileSync(join(outDir, 'version.json'), 'utf8')) as { build: string };
@@ -140,6 +154,6 @@ export async function writeServiceWorker(outDir: string, root: string): Promise<
140
154
  const { core, build, hashed } = await serviceWorkerCore(splitBundle(outDir, writtenBundle(outDir, root)), root, buildId, book(serverPackBookPath(buildId)), book(packsBookPath(buildId))), scripts = workerScripts(core);
141
155
  mkdirSync(dirname(join(outDir, scripts.fileName)), { recursive: true });
142
156
  writeFileSync(join(outDir, scripts.fileName), core);
143
- writeFileSync(join(outDir, 'sw.js'), scripts.bootstrap);
157
+ writeFileSync(join(outDir, 'sw.js'), stampWorker(scripts.bootstrap, outDir));
144
158
  console.log(`sw.js written (${build}; ${ASSET_CACHE_NAME}; ${hashed.length} precached files)`);
145
159
  }
@@ -5,6 +5,7 @@ import { assetIndex } from './gen';
5
5
  import { WILDSHARD_IDENTITY } from '../../src/client/game/identity';
6
6
  import { rendererRevision } from '../renderer-revision.mjs';
7
7
  import { gitDescribe } from '../changelog.mjs';
8
+ import { builtAtOf } from './builtAt.mjs';
8
9
 
9
10
  /** version.json (the build id, written into each document by build-app and never into content-hashed runtime modules, so
10
11
  * the app can tell when the server has a newer build: iOS home-screen PWAs have no address bar, so the title screen
@@ -14,7 +15,7 @@ export function writeVersionFiles(outDir: string, build: string): void {
14
15
  const {WILDSHARD_PREPARATION_ONLY} = process.env;
15
16
  const epoch: unknown = JSON.parse(readFileSync('save-epoch.json', 'utf8'));
16
17
  if (typeof epoch !== 'object' || epoch === null || !('saveEpoch' in epoch) || epoch.saveEpoch !== WILDSHARD_IDENTITY.saveEpoch) throw new Error('Save epoch metadata must match game identity');
17
- writeFileSync(join(outDir, 'version.json'), JSON.stringify({ build, saveEpoch: epoch.saveEpoch, rendererRevision: rendererRevision(), preparationOnly: WILDSHARD_PREPARATION_ONLY === '1', time: new Date().toISOString(), describe: gitDescribe(process.cwd()) }));
18
+ writeFileSync(join(outDir, 'version.json'), JSON.stringify({ build, saveEpoch: epoch.saveEpoch, rendererRevision: rendererRevision(), preparationOnly: WILDSHARD_PREPARATION_ONLY === '1', time: new Date(Number(builtAtOf(process.env.WS_BUILT_AT))).toISOString(), describe: gitDescribe(process.cwd()) }));
18
19
  writeFileSync(join(outDir, 'asset-index.json'), assetIndex());
19
20
  writeFileSync(join(outDir, 'asset-manifest.json'), JSON.stringify(hashTree('assets')));
20
21
  }
@@ -18,7 +18,8 @@ import {
18
18
  copyDeferredPublic,
19
19
  pruneLooseCopies,
20
20
  } from "./app-build/outputProducts.mjs";
21
- import { stampBuildDocuments } from "./app-build/buildIdentity.mjs";
21
+ import { buildLabelOf, stampBuildDocuments } from "./app-build/buildIdentity.mjs";
22
+ import { engineRelease } from "./changelog.mjs";
22
23
  import { homeIconChannel, writeHomeIcons } from "./app-build/homeIcons.mjs";
23
24
  import { carryPreviousDeploy, channelOrigin, previousDeployOptional } from "./app-build/previousDeploy.mjs";
24
25
  import { assertAssetLimits, describeAssetLimits } from "./app-build/assetLimits.mjs";
@@ -183,6 +184,8 @@ export async function finishAppBuild({ outDir, buildId, mode, deferPublic }) {
183
184
  validator,
184
185
  verdicts: buildValidationReceipts(validator),
185
186
  ...(world === undefined ? {} : { world }),
187
+ // QA 11-13: the static title's build pill, before any bundle (index.html data-launch-progress)
188
+ label: buildLabelOf(buildId, engineRelease(process.cwd())),
186
189
  });
187
190
  // J236: production plain, staging the S, the solo build the P; before the worker reads the final document.
188
191
  writeHomeIcons(outDir, homeIconChannel(world));