@wildshard/engine 0.1.20 → 0.1.22

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 (94) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lint/engine-sides.json +4 -0
  3. package/lint/shardfile-boundaries.mjs +4 -2
  4. package/lint/wildshard-plugin.js +1 -1
  5. package/package.json +3 -1
  6. package/scripts/audio-download-proof.mjs +1 -1
  7. package/scripts/chaos-proxy-core.mjs +14 -1
  8. package/scripts/chaos-proxy-proof.mjs +22 -0
  9. package/scripts/check-spelled-paths.mjs +6 -3
  10. package/scripts/committed-fast-checks.mjs +2 -2
  11. package/scripts/failmode-cases.d.mts +8 -0
  12. package/scripts/failmode-cases.mjs +97 -0
  13. package/scripts/failmode-proof.mjs +556 -0
  14. package/scripts/grid-crossing-nightly.mjs +5 -4
  15. package/scripts/grid-crossing-report.mjs +5 -2
  16. package/scripts/grid-crossing-tour.mjs +25 -8
  17. package/scripts/grid-crossing-walk-proof.mjs +3 -3
  18. package/scripts/hover-speed-probe.mjs +136 -0
  19. package/scripts/mmo-bots.mjs +7 -3
  20. package/scripts/net-lag-proof.mjs +4 -3
  21. package/scripts/online-rig.mjs +11 -9
  22. package/scripts/parity/boot-smoke.mjs +1 -1
  23. package/scripts/release-cook.mjs +113 -0
  24. package/scripts/test-products.json +0 -21
  25. package/scripts/vps/cook-follow.d.mts +6 -0
  26. package/scripts/vps/cook-follow.mjs +45 -0
  27. package/scripts/vps/harden-apply.sh +10 -1
  28. package/scripts/vps/rebuild.sh +120 -26
  29. package/scripts/vps/wildshard-apply.mjs +5 -1
  30. package/scripts/vps/wildshard-config +117 -3
  31. package/src/client/app/entry.ts +2 -3
  32. package/src/client/engine/boot/contentRead.ts +78 -9
  33. package/src/client/engine/boot/downloadGiveUp.ts +34 -0
  34. package/src/client/engine/boot/gpuFiles.ts +3 -3
  35. package/src/client/engine/boot/leaveAfterPaint.ts +4 -1
  36. package/src/client/engine/combat/EquipmentService.ts +2 -0
  37. package/src/client/engine/core/Game.ts +6 -2
  38. package/src/client/engine/core/shadowLayer.ts +18 -0
  39. package/src/client/engine/explore/pick.ts +13 -1
  40. package/src/client/engine/net/predictor.ts +12 -4
  41. package/src/client/engine/player/TouchControls.ts +3 -2
  42. package/src/client/engine/render/families/sceneSurface.ts +3 -1
  43. package/src/client/engine/telemetry/browserErrors.ts +3 -1
  44. package/src/client/engine/ui/ErrorModal.ts +1 -1
  45. package/src/client/engine/ui/Loading.ts +14 -2
  46. package/src/client/engine/ui/downloadFailed.ts +54 -0
  47. package/src/client/engine/ui/errorScreen.ts +51 -9
  48. package/src/client/engine/ui/hoverBoost.ts +31 -4
  49. package/src/client/engine/ui/styles/touch.css +6 -0
  50. package/src/client/game/boot/spawnDownload.ts +56 -7
  51. package/src/client/game/grid/copyPrompts.ts +3 -4
  52. package/src/client/game/grid/dataCellKit.ts +91 -0
  53. package/src/client/game/grid/enteredEquipment.ts +11 -2
  54. package/src/client/game/grid/live.ts +11 -301
  55. package/src/client/game/grid/liveSession.ts +33 -10
  56. package/src/client/game/grid/neighbourLife.ts +50 -32
  57. package/src/client/game/grid/reveal.ts +7 -2
  58. package/src/client/game/grid/session.ts +6 -70
  59. package/src/client/game/grid/shardfileFar.ts +13 -2
  60. package/src/client/game/plugin/weaponFamily.ts +6 -0
  61. package/src/client/game/shardfile/clientSource.ts +7 -3
  62. package/src/client/game/shardfile/clientWorker.ts +17 -7
  63. package/src/client/game/shardfile/groundMerge.ts +5 -3
  64. package/src/client/host/online/linkScreens.ts +12 -6
  65. package/src/client/host/online/reconnectStrip.ts +3 -2
  66. package/src/client/host/online/release.ts +87 -16
  67. package/src/client/host/online/releaseScreens.ts +108 -0
  68. package/src/client/host/online/shell.ts +46 -12
  69. package/src/client/host/online/voice.ts +45 -1
  70. package/src/client/host/online/voiceUi.ts +24 -6
  71. package/src/server/engine/sim/playerSim.ts +1 -1
  72. package/src/server/game/grid/room.ts +2 -38
  73. package/src/server/game/grid/simulation.ts +12 -6
  74. package/src/server/game/shardfile/declaredKitItems.ts +8 -2
  75. package/src/server/host/dedicated/cellHost.ts +9 -2
  76. package/src/server/host/dedicated/cellProtocol.ts +1 -1
  77. package/src/server/host/dedicated/cellWorker.ts +2 -2
  78. package/src/server/host/dedicated/dedicatedRoom.ts +22 -4
  79. package/src/server/host/dedicated/gridCells.ts +5 -3
  80. package/src/server/host/dedicated/main.ts +6 -4
  81. package/src/server/host/dedicated/roadRoom.ts +3 -0
  82. package/src/server/host/dedicated/workerTable.ts +0 -10
  83. package/src/server/host/dedicated/world.ts +39 -5
  84. package/src/server/host/standalone/cellWorld.ts +1 -1
  85. package/src/server/host/standalone/gridServer.ts +1 -1
  86. package/src/shared/engine/boot/loadingWaits.ts +10 -2
  87. package/src/shared/engine/core/config.ts +3 -0
  88. package/src/shared/engine/player/hoverSpeed.ts +3 -3
  89. package/src/shared/engine/saves/shape.ts +17 -2
  90. package/src/shared/engine/strings.ts +22 -1
  91. package/src/shared/game/grid/placementRows.ts +4 -3
  92. package/src/shared/game/grid/rules.ts +12 -0
  93. package/src/client/game/grid/cellLoading.ts +0 -110
  94. package/src/client/game/grid/cellScreens.ts +0 -48
package/CHANGELOG.md CHANGED
@@ -9,6 +9,22 @@ run `../repo-kit/release.sh vX.Y.Z --prepare` and `--finish` as before (the help
9
9
  `scripts/changelog.mjs` checks the format; the pre-push hook and CI refuse a push whose `package.json` version has no
10
10
  valid section, and a `vX.Y.Z` tag whose commit has none.
11
11
 
12
+ ## v0.1.22 (2026-11-15)
13
+
14
+ - Brasscap Mesa: you walk in with the lever-action in hand, its rack restocks your rounds, and every bandit and beast in the cell is drawn.
15
+ - A shard placed on the grid after a release keeps its road speed limit on the server too.
16
+ - When the world's files fail to download, the game says so and offers Try again instead of waiting forever.
17
+ - Reloading for a new version brings you back into the game rather than to the title.
18
+ - Behind the scenes: the server swaps out a stuck or drained worker without dropping players, and the cook follows staging by itself.
19
+
20
+ ## v0.1.21 (2026-11-15)
21
+
22
+ - The hoverboard is faster online too: 14 m/s in a shard and 30 on the road, and boost is four times that (56 and 120).
23
+ - The HOVER tab says BOOST while boost is on.
24
+ - When something fails, the game says why and retries by itself: release reads, paused downloads and voice, which has Try again.
25
+ - Moving between shards is steadier on phones, and the grid waits for room before it loads a neighbour.
26
+ - Behind the scenes: agents now move the server's cook to each new release themselves, so a release needs no hands from Jake.
27
+
12
28
  ## v0.1.20 (2026-11-14)
13
29
 
14
30
  - Big desktop screens stay smoother: the game drops its render sharpness a step when frames run slow and raises it again when there is room.
@@ -76,6 +76,7 @@
76
76
  "src/client/engine/boot/contentBase.ts": "client",
77
77
  "src/client/engine/boot/contentRead.ts": "client",
78
78
  "src/client/engine/boot/download.ts": "client",
79
+ "src/client/engine/boot/downloadGiveUp.ts": "client",
79
80
  "src/client/engine/boot/dropNotice.ts": "client",
80
81
  "src/client/engine/boot/earlyPrograms.ts": "client",
81
82
  "src/client/engine/boot/extras.ts": "client",
@@ -433,6 +434,7 @@
433
434
  "src/client/engine/ui/authoredDebugRows.ts": "client",
434
435
  "src/client/engine/ui/BootSettings.ts": "client",
435
436
  "src/client/engine/ui/backGuard.ts": "client",
437
+ "src/client/engine/ui/downloadFailed.ts": "client",
436
438
  "src/client/engine/ui/graphicsBlock.ts": "client",
437
439
  "src/client/engine/ui/BossBar.ts": "client",
438
440
  "src/client/engine/ui/buildCheck.ts": "client",
@@ -633,6 +635,7 @@
633
635
  "src/client/game/grid/copyIdentity.ts": "client",
634
636
  "src/client/game/grid/copyLayout.ts": "client",
635
637
  "src/client/game/grid/copyPrompts.ts": "client",
638
+ "src/client/game/grid/dataCellKit.ts": "client",
636
639
  "src/client/game/grid/edgeSources.ts": "client",
637
640
  "src/client/game/grid/enteredEquipment.ts": "client",
638
641
  "src/client/game/grid/enteredInteract.ts": "client",
@@ -1099,6 +1102,7 @@
1099
1102
  "src/client/host/online/doctorPage.ts": "client",
1100
1103
  "src/client/host/online/doctorView.ts": "client",
1101
1104
  "src/client/host/online/linkScreens.ts": "client",
1105
+ "src/client/host/online/releaseScreens.ts": "client",
1102
1106
  "src/client/host/online/reconnectStrip.ts": "client",
1103
1107
  "src/client/host/online/release.ts": "client",
1104
1108
  "src/client/host/online/shell.ts": "client",
@@ -18,9 +18,11 @@ const packages = new Map();
18
18
 
19
19
  function publicPackage(root, source) {
20
20
  if (source === 'three' || source.startsWith('three/') || source === 'valibot') return true;
21
- const pkg = /^@wildshard\/(engine|game|sdk|sharddev|format)(?:\/(.+))?$/u.exec(source);
21
+ const pkg = /^@wildshard\/(engine|game|sdk|format)(?:\/(.+))?$/u.exec(source);
22
22
  if (pkg === null) return false;
23
- const file = resolve(root, 'src', pkg[1], 'package.json');
23
+ const file = pkg[1] === 'engine'
24
+ ? resolve(root, 'package.json')
25
+ : resolve(root, 'node_modules', '@wildshard', pkg[1], 'package.json');
24
26
  if (!packages.has(file)) packages.set(file, existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')).exports ?? {} : {});
25
27
  const sub = pkg.at(2);
26
28
  return Object.hasOwn(packages.get(file), sub === undefined ? '.' : `./${sub}`);
@@ -1140,7 +1140,7 @@ export const TEST_DOMAIN_RUNTIME_RULES = [
1140
1140
  'runtime-performance', 'no-raw-random-time', 'no-runtime-generator',
1141
1141
  ];
1142
1142
  /** @param {string} path */
1143
- const testFixtures = path => /^src\/(?:engine|game|sdk|sharddev)\/test\//u.test(path);
1143
+ const testFixtures = path => /^(?:src\/(?:test\/(?:engine|game|sdk)|(?:engine|game|sdk|sharddev)\/test)|@wildshard\/(?:engine|game|sdk|sharddev)\/test)\//u.test(path);
1144
1144
  /** @param {string} path */
1145
1145
  const testModule = path => path.endsWith('.test.ts') || testFixtures(path);
1146
1146
  const testDomain = context => testModule(pathOf(context));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildshard/engine",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
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": {
@@ -730,6 +730,7 @@
730
730
  "./boot/prefetchQuota": "./src/client/engine/boot/prefetchQuota.ts",
731
731
  "./boot/readContentResponse": "./src/client/engine/boot/readContentResponse.ts",
732
732
  "./boot/contentRead": "./src/client/engine/boot/contentRead.ts",
733
+ "./boot/downloadGiveUp": "./src/client/engine/boot/downloadGiveUp.ts",
733
734
  "./sim/readiness": "./src/shared/engine/sim/readiness.ts",
734
735
  "./sim/shore": "./src/shared/engine/sim/shore.ts",
735
736
  "./physics/readinessWalls": "./src/shared/engine/physics/readinessWalls.ts",
@@ -893,6 +894,7 @@
893
894
  "./game/grid/gridCollision": "./src/shared/game/grid/gridCollision.ts",
894
895
  "./game/grid/voidFloor": "./src/shared/game/grid/voidFloor.ts",
895
896
  "./game/grid/assembly": "./src/shared/game/grid/assembly.ts",
897
+ "./game/grid/rules": "./src/shared/game/grid/rules.ts",
896
898
  "./game/devColliders": "./src/shared/game/devColliders.ts",
897
899
  "./game/devGameplay": "./src/shared/game/devGameplay.ts",
898
900
  "./game/grid/catalogueSlot": "./src/shared/game/grid/catalogueSlot.ts",
@@ -10,7 +10,7 @@
10
10
  // card, so they take `client`. The warm visit must fetch its route's own phone manifest; a later visit may read it from the
11
11
  // page's store and fetch none, so it is judged against the manifest its warm visit fetched.
12
12
  // `cross` (preview only) is a player's way into an Open Plot: Shard select, its deck neighbour (CROSS_IN), ENTER WORLD, then a
13
- // walk across the road into the plot through the in-page server. Staging can't cross (`WORLD_CROSSING` is unset there) and the
13
+ // walk across the road into the plot through the in-page server. The production path now uses zone entry; this historical
14
14
  // local build's world door refuses it, so only preview runs it. Its sound window is the first 10 s after the crossing, and the
15
15
  // plot's own score must become the music's score in it; its manifest is the neighbour's grid one.
16
16
  //
@@ -195,6 +195,8 @@ export async function openChaosProxy(options) {
195
195
  droppedBytes: 0,
196
196
  forwardedMessages: 0,
197
197
  droppedMessages: 0,
198
+ /** FM3: socket upgrades the proxy carried on to the world (a refused one is a `socket` match instead) */
199
+ upgrades: 0,
198
200
  metadataOverflow: 0,
199
201
  queueOverflow: 0,
200
202
  }
@@ -749,7 +751,16 @@ export async function openChaosProxy(options) {
749
751
  socket.destroy()
750
752
  return
751
753
  }
752
- if (request.url !== '/') {
754
+ // FM3: the world door is `/`; a page Shard select sent to a grid cell names it (`/?chunk=<cell>`, shell.ts gotoSocket), and
755
+ // only that one bounded query passes on to the upstream
756
+ const asked = new URL(request.url ?? '', 'http://127.0.0.1'),
757
+ cell = asked.searchParams.get('chunk')
758
+ if (
759
+ asked.pathname !== '/' ||
760
+ [...asked.searchParams.keys()].some(name => name !== 'chunk') ||
761
+ asked.searchParams.getAll('chunk').length > 1 ||
762
+ (cell !== null && !/^[a-z0-9][a-z0-9-]{0,63}$/u.test(cell))
763
+ ) {
753
764
  socket.end(
754
765
  'HTTP/1.1 404 Not Found\r\nConnection: close\r\nContent-Length: 0\r\n\r\n',
755
766
  )
@@ -778,8 +789,10 @@ export async function openChaosProxy(options) {
778
789
  )
779
790
  return
780
791
  }
792
+ counters.upgrades++
781
793
  const address = new URL(worldTarget)
782
794
  address.protocol = 'ws:'
795
+ if (cell !== null) address.searchParams.set('chunk', cell)
783
796
  const offered = request.headers['sec-websocket-protocol']
784
797
  /** @type {WebSocket} */
785
798
  let remote
@@ -955,6 +955,28 @@ await test('shared pressure heals both native sending directions', async () => {
955
955
  await fixture.close()
956
956
  }
957
957
  })
958
+ await test('a grid cell query reaches the world door, and nothing else does', async () => {
959
+ const fixture = await nativeFixture()
960
+ /** @type {string[]} */ const seen = []
961
+ fixture.wss.on('connection', (_peer, request) => {
962
+ seen.push(request.url ?? '')
963
+ })
964
+ try {
965
+ const world = fixture.proxy.ready.worldOrigin
966
+ const cell = new WebSocket(`${world.replace('http:', 'ws:')}/?chunk=driftwood-isle`)
967
+ await once(cell, 'open')
968
+ cell.close()
969
+ await once(cell, 'close')
970
+ assert.deepEqual(seen, ['/?chunk=driftwood-isle'])
971
+ const state = await (await fixture.proxy.control()).json()
972
+ assert.equal(state.counters.upgrades, 1)
973
+ for (const path of ['/?chunk=a&other=1', '/?chunk=a&chunk=b', '/?chunk=..%2F', '/x?chunk=a', '/?other=1'])
974
+ assert.equal((/** @type {{status:number}} */ (await rawRequest(world, path, { connection: 'Upgrade', upgrade: 'websocket', 'sec-websocket-key': 'YWJjZGVmZ2hpamtsbW5vcA==', 'sec-websocket-version': '13' }))).status, 404, path)
975
+ assert.equal(seen.length, 1)
976
+ } finally {
977
+ await fixture.close()
978
+ }
979
+ })
958
980
  await test('zero-length delayed messages have a count bound', async () => {
959
981
  const fixture = await nativeFixture(),
960
982
  client = await socket(fixture.proxy.ready.worldOrigin)
@@ -20,9 +20,12 @@ export function spelledPathFailures(files, read) {
20
20
  const failures = [], paths = [...files.keys()], folders = new Set(['src']);
21
21
  for (const path of paths) for (let at = path.indexOf('/'); at !== -1; at = path.indexOf('/', at + 1)) folders.add(path.slice(0, at));
22
22
  for (const file of paths) {
23
- const isolated = /^src\/(engine|game)\/isolated-[^/]+\.test\.ts$/u.exec(file)?.[1];
24
- if (isolated !== undefined) for (const [, rel] of read(file).matchAll(ROOTED))
25
- if (!exists(files, folders, `src/${isolated}/${rel}`)) failures.push(`${file}: no module at src/${isolated}/${rel}: the isolated test spells a side the file left`);
23
+ const isolated = /^src\/(client|cook|server|shared)\/(engine|game)\/isolated-[^/]+\.test\.ts$/u.exec(file);
24
+ if (isolated !== null) for (const [, rel] of read(file).matchAll(ROOTED)) {
25
+ const [side, ...rest] = rel.split('/');
26
+ const target = side === undefined || rest.length === 0 ? `src/${isolated[1]}/${isolated[2]}/${rel}` : `src/${side}/${isolated[2]}/${rest.join('/')}`;
27
+ if (!exists(files, folders, target)) failures.push(`${file}: no module at ${target}: the isolated test spells a side the file left`);
28
+ }
26
29
  if (/^scripts\/.*\.[cm]?[jt]s$/u.test(file) && !file.includes('.test.')) for (const match of read(file).matchAll(EMITTED))
27
30
  if (!exists(files, folders, `src/${match[2]}/${match[3]}`.replace(/[./]+$/u, ''))) failures.push(`${file}: no module at src/${match[2]}/${match[3]}: an emitted import spells a side the file left`);
28
31
  if (MAP_FILE.test(file)) for (const input of JSON.parse(read(file)).inputs ?? []) {
@@ -164,7 +164,7 @@ export async function committedFastChecks(root,base,tip,phase,paths) {
164
164
  const policy=json(view,'lint/ratchet.json');
165
165
  if(view.files.has('scripts/check-spelled-paths.mjs')) {
166
166
  const {spelledPathFailures}=/** @type {typeof import('./check-spelled-paths.mjs')} */(await module('scripts/check-spelled-paths.mjs'));
167
- view.prime([...view.files.keys()].filter(path=>/^src\/(?:engine|game)\/isolated-[^/]+\.test\.ts$|^scripts\/.*\.[cm]?[jt]s$|^src\/shards\/[^/]+\/(?:data|look)\/map\.json$/u.test(path)));
167
+ view.prime([...view.files.keys()].filter(path=>/^src\/(?:client|cook|server|shared)\/(?:engine|game)\/isolated-[^/]+\.test\.ts$|^scripts\/.*\.[cm]?[jt]s$|^src\/shards\/[^/]+\/(?:data|look)\/map\.json$/u.test(path)));
168
168
  failures.push(...spelledPathFailures(view.files,path=>view.read(path).toString('utf8')));
169
169
  }
170
170
  // The folder rule of check-paths, over committed paths: a new file in a shard's root needs the layout's word.
@@ -237,7 +237,7 @@ export async function committedFastChecks(root,base,tip,phase,paths) {
237
237
  } else if(phase==='census') {
238
238
  // The census ratchets of CI's prepare job, over the tip's blobs, last so they spend only what the budget leaves.
239
239
  // One that runs out of time is CI's, not a verdict.
240
- if(view.files.has('scripts/sort-sides.mjs')&&view.files.has('scripts/check-sim-players.mjs')&&paths.some(path=>/^(?:src\/(?:engine|game|sdk|sharddev)|lint)\//u.test(path))) {
240
+ if(view.files.has('scripts/sort-sides.mjs')&&view.files.has('scripts/check-sim-players.mjs')&&paths.some(path=>/^(?:src\/(?:client|cook|server|shared)\/(?:engine|game|host)|lint)\//u.test(path))) {
241
241
  const census=async(/** @type {string} */ script)=>{
242
242
  const child=spawn(process.execPath,[resolve(root,'scripts/sort-sides.mjs'),'--view',tip,script],{cwd:root,timeout:25_000,stdio:['ignore','pipe','pipe']});
243
243
  const closed=once(child,'close'),[stdout,stderr]=await Promise.all([text(child.stdout),text(child.stderr)]);
@@ -0,0 +1,8 @@
1
+ export type Phase = 'boot' | 'load' | 'play' | 'title' | 'doctor';
2
+ export type Outcome = 'pass' | 'ui-fail' | 'blocked-dependency' | 'unsupported' | 'harness-fail';
3
+ export interface Case { mode: string; id: string; owner: string; phase: Phase; screen: string; inject: string; recover: string; run?: string; blocked?: string; chromiumOnly?: boolean; parent?: string }
4
+ export const CASES: readonly Case[];
5
+ export function selectCases(asked: string): Case[];
6
+ export function verdict(rows: readonly { outcome: Outcome }[]): 0 | 1 | 2;
7
+ export function names(attribute: string | null, id: string): boolean;
8
+ export function rawLeak(text: string): string | null;
@@ -0,0 +1,97 @@
1
+ // FM3 (meta docs/plans/MMO-FAILURE-MODES-PLAN.md): the case manifest of the failure proof. Every one of the catalogue's 46 modes has a
2
+ // stable scenario name, its runtime owner row, the phase it happens in, how failmode-proof.mjs injects it, the screen a player must see
3
+ // (`data-failmode`, which may carry several ids: `drop reset`) and how it recovers. A `b` hold card and too-old's banner/page variant sit
4
+ // under their parent; they are not new numeric modes. `run` names the proof's runner; a case with no runner records why (`blocked`:
5
+ // its runtime row or contract isn't built; `unsupported`: this engine or harness can't produce the fault honestly). Neither is a pass.
6
+
7
+ /** @typedef {'boot' | 'load' | 'play' | 'title' | 'doctor'} Phase */
8
+ /** @typedef {'pass' | 'ui-fail' | 'blocked-dependency' | 'unsupported' | 'harness-fail'} Outcome */
9
+ /** @typedef {{ mode: string, id: string, owner: string, phase: Phase, screen: string, inject: string, recover: string, run?: string,
10
+ * blocked?: string, chromiumOnly?: boolean, parent?: string }} Case */
11
+
12
+ /** @type {readonly Case[]} */
13
+ export const CASES = Object.freeze([
14
+ // J298 amends mode 1: a world build holding a cached world loads it from cache and shows mode 2's card; mode 1's page is only for a page
15
+ // with nothing cached, which can't render its own screen (the browser's offline page). So a warmed world must show `offline-play`.
16
+ { mode: '1', id: 'offline-launch', owner: 'FM5', phase: 'boot', screen: 'offline-play', inject: 'warm the service worker in the world, then setOffline and reload', recover: 'online: a frame, no card', run: 'offlineLaunch' },
17
+ { mode: '2', id: 'offline-play', owner: 'FM4b', phase: 'play', screen: 'offline-play', inject: 'context.setOffline(true) in the world', recover: 'online: a frame, no card', run: 'offlinePlay' },
18
+ { mode: '3', id: 'background-short', owner: 'FM4', phase: 'play', screen: 'background-short', inject: 'CDP freeze 4 s (server stalls the socket at 3 s)', recover: 'first frame: reconnected', run: 'freeze', chromiumOnly: true },
19
+ { mode: '3b', id: 'background-short/blocked', parent: 'background-short', owner: 'FM4', phase: 'play', screen: 'background-short-blocked', inject: 'Interact while 3 shows', recover: 'closes on the first frame', blocked: 'the harness drives no in-world tap under a banner yet (test/net-strip-browser.test.ts covers the tap on a real room)' },
20
+ { mode: '4', id: 'background-long', owner: 'FM4b', phase: 'play', screen: 'background-long', inject: 'CDP hidden 35 s (visibility changes)', recover: 'seated again: no card', run: 'freeze', chromiumOnly: true },
21
+ { mode: '5', id: 'unreachable', owner: 'FM4b', phase: 'play', screen: 'unreachable', inject: 'refuse-upgrade 503 from the first dial', recover: 'heal: seated', blocked: 'mode 5 waits on a design call (FM4b: no readable /health; limit to a link that never heard a frame, or a public /health)' },
22
+ { mode: '6', id: 'dns', owner: 'FM4b', phase: 'play', screen: 'unreachable', inject: '.invalid socket', recover: 'as 5', blocked: 'shares mode 5\'s screen (design call)' },
23
+ { mode: '7', id: 'tls', owner: 'FM4b', phase: 'play', screen: 'unreachable', inject: 'self-signed 18793 listener', recover: 'as 5', blocked: 'shares mode 5\'s screen (design call)' },
24
+ { mode: '8', id: 'upgrade-refused', owner: 'FM4b', phase: 'play', screen: 'unreachable', inject: 'refuse-upgrade 502', recover: 'as 5', blocked: 'shares mode 5\'s screen (design call)' },
25
+ { mode: '9', id: 'restart', owner: 'FM4', phase: 'play', screen: 'restart', inject: 'socket close 4005 on every connection for 4 s', recover: 'heal: reconnected', run: 'socketDown' },
26
+ { mode: '9b', id: 'restart/blocked', parent: 'restart', owner: 'FM4', phase: 'title', screen: 'restart-blocked', inject: 'Play on the title while 9 shows', recover: 'joins by itself', blocked: 'FM4 left: no link exists on the title yet' },
27
+ { mode: '10', id: 'deploy', owner: 'FM4', phase: 'play', screen: 'deploy', inject: 'a newer signed release (needs a second build)', recover: 'the move lands', blocked: 'needs a second build of the same stamp; online-proof.mjs --next proves the countdown' },
28
+ { mode: '10b', id: 'deploy/blocked', parent: 'deploy', owner: 'FM4', phase: 'title', screen: 'deploy-blocked', inject: 'Enter world in the last 15 s', recover: 'joins after the move', blocked: 'FM4 left: no link exists on the title yet' },
29
+ { mode: '11', id: 'release-5xx', owner: 'FM5', phase: 'boot', screen: 'release-5xx', inject: 'release status 503 before navigation', recover: 'heal: the world loads by itself', run: 'releaseFault' },
30
+ { mode: '12', id: 'release-429', owner: 'FM5', phase: 'boot', screen: 'release-429', inject: 'release status 429, Retry-After 3', recover: 'heal: the world loads after Retry-After', run: 'releaseFault' },
31
+ { mode: '13', id: 'version-http', owner: 'FM5', phase: 'play', screen: 'version-http', inject: 'version.json status 503 (Developer on)', recover: 'heal: the next poll clears it', blocked: 'the next poll comes at the next foreground, at most every 5 min: the harness has no honest trigger yet' },
32
+ { mode: '14', id: 'doctor-http', owner: 'FM8', phase: 'doctor', screen: 'doctor-http', inject: 'doctor status 503, then Check connection in the world', recover: 'heal, Try again: the doctor opens', run: 'doctorHttp' },
33
+ { mode: '15', id: 'drop', owner: 'FM4', phase: 'play', screen: 'drop', inject: 'socket drop-after 0 (terminated: 1006), then refuse-upgrade for 2 s', recover: 'heal: reconnected chip', run: 'socketDown' },
34
+ { mode: '15b', id: 'drop/blocked', parent: 'drop', owner: 'FM4', phase: 'play', screen: 'drop-blocked', inject: 'Talk while 15 shows', recover: 'closes on the first frame', blocked: 'the harness drives no in-world tap under a banner yet (test/net-strip-browser.test.ts covers the tap on a real room)' },
35
+ { mode: '16', id: 'reset', owner: 'FM4', phase: 'play', screen: 'drop', inject: 'socket drop-after 0 (a reset is a 1006 to the page)', recover: 'heal: reconnected chip', run: 'socketDown' },
36
+ { mode: '16b', id: 'reset/blocked', parent: 'reset', owner: 'FM4', phase: 'play', screen: 'reset-blocked', inject: 'Send in chat while 16 shows', recover: 'the held line sends once', run: 'heldChat' },
37
+ { mode: '17', id: 'half-open', owner: 'FM4', phase: 'play', screen: 'half-open', inject: 'socket half-open (no downstream frames or pongs)', recover: 'heal: reconnected chip', run: 'socketDown' },
38
+ { mode: '17b', id: 'half-open/blocked', parent: 'half-open', owner: 'FM4', phase: 'play', screen: 'half-open-blocked', inject: 'Pick up while 17 shows', recover: 'closes on the first frame', blocked: 'the harness drives no in-world tap under a banner yet' },
39
+ { mode: '18', id: 'reconnected', owner: 'FM4', phase: 'play', screen: 'reconnected', inject: 'a 2 s drop', recover: 'the chip goes by itself', run: 'socketDown' },
40
+ { mode: '19', id: 'resuming', owner: 'FM4', phase: 'play', screen: 'resuming', inject: 'drop, then refuse-upgrade 503 for 37 s', recover: 'heal: reconnected', run: 'socketDown' },
41
+ { mode: '19b', id: 'resuming/blocked', parent: 'resuming', owner: 'FM4', phase: 'play', screen: 'resuming-blocked', inject: 'an action after 35 s down', recover: 'closes on the first frame', blocked: 'the harness drives no in-world tap under a banner yet' },
42
+ { mode: '20', id: 'lost', owner: 'FM4', phase: 'play', screen: 'lost', inject: 'drop, then refuse-upgrade 503 for 122 s', recover: 'heal, Try again: seated', run: 'socketDown' },
43
+ { mode: '21', id: 'slow', owner: 'FM4b', phase: 'play', screen: 'slow', inject: 'delay-frames 160 ms both ways (RTT over 250 ms)', recover: 'heal: clears after 10 good seconds', run: 'linkQuality' },
44
+ { mode: '22', id: 'lossy', owner: 'FM4b', phase: 'play', screen: 'lossy', inject: 'downstream delay-frames swinging 20 ms / 420 ms every 2.5 s (RTT span over 250 ms)', recover: 'heal: clears after 10 good seconds', run: 'linkQuality' },
45
+ { mode: '23', id: 'version-skew', owner: 'FM5', phase: 'play', screen: 'version-skew', inject: 'socket close 4000 (reload) on every connection', recover: 'one reload, then the page', run: 'socketDown' },
46
+ { mode: '24', id: 'too-old', owner: 'FM5b', phase: 'play', screen: 'too-old-warning', inject: 'verified retention metadata excluding this build', recover: 'next load: too-old page', blocked: 'FM7 retention metadata not built' },
47
+ { mode: '25', id: 'full', owner: 'FM4', phase: 'play', screen: 'full', inject: 'socket close 4002 on every connection for 3 s (FM7b queue numbers not built)', recover: 'heal: seated on the next 30 s retry', run: 'socketDown' },
48
+ { mode: '26', id: 'replaced', owner: 'FM4', phase: 'play', screen: 'replaced', inject: 'a second tab of the same device takes the seat', recover: 'Play here: seated', run: 'replaced' },
49
+ { mode: '27', id: 'auth-expired', owner: 'FM8b', phase: 'play', screen: 'auth-expired', inject: 'local provider expiry', recover: 'sign in: rejoins', blocked: 'FM8b / MP2.2 login contract not built' },
50
+ { mode: '28', id: 'auth-failed', owner: 'FM8b', phase: 'title', screen: 'auth-failed', inject: 'provider callback error', recover: 'other ways to sign in', blocked: 'FM8b / MP2.2 login contract not built' },
51
+ { mode: '29', id: 'api-5xx', owner: 'FM8b', phase: 'title', screen: 'api-5xx', inject: 'api status 503', recover: 'retry', blocked: 'FM8b / MP2.2 login contract not built' },
52
+ { mode: '30', id: 'save-slow', owner: 'FM8s', phase: 'play', screen: 'save-slow', inject: 'owned persistence delay', recover: 'durable ack', blocked: 'FM7b live save status not built' },
53
+ { mode: '30b', id: 'save-slow/blocked', parent: 'save-slow', owner: 'FM8s', phase: 'play', screen: 'save-slow-blocked', inject: 'Leave while 30 shows', recover: 'leave on the ack', blocked: 'FM7b live save status not built' },
54
+ { mode: '31', id: 'save-failed', owner: 'FM8s', phase: 'play', screen: 'save-failed', inject: 'owned persistence failure', recover: 'durable ack', blocked: 'FM7b live save status not built' },
55
+ { mode: '32', id: 'voice-failed', owner: 'FM8', phase: 'play', screen: 'voice-failed', inject: 'two peers, exhausted ICE', recover: 'linked or voice off', blocked: 'screen built (chat-corner.test.ts); the rig has no two-peer voice harness' },
56
+ { mode: '32b', id: 'voice-failed/blocked', parent: 'voice-failed', owner: 'FM8', phase: 'play', screen: 'voice-failed-blocked', inject: 'talk while 32 shows', recover: 'Try again', blocked: 'screen built (chat-corner.test.ts); the rig has no two-peer voice harness' },
57
+ { mode: '33', id: 'packs-5xx', owner: 'FM6', phase: 'load', screen: 'packs-5xx', inject: 'packs status 503 before navigation, healed after 6 s', recover: 'the world loads', run: 'packsFault' },
58
+ { mode: '34', id: 'packs-429', owner: 'FM6', phase: 'load', screen: 'packs-429', inject: 'packs status 429, Retry-After 3, healed after 6 s', recover: 'the world loads', run: 'packsFault' },
59
+ { mode: '35', id: 'book-5xx', owner: 'FM6', phase: 'load', screen: 'book-5xx', inject: 'book status 503 before navigation, healed after 6 s', recover: 'the world loads', run: 'packsFault' },
60
+ { mode: '36', id: 'download-failed', owner: 'FM6', phase: 'load', screen: 'download-failed', inject: 'packs status 503 until the operation refuses', recover: 'heal, Retry: the world loads', run: 'packsFault' },
61
+ { mode: '37', id: 'release-404', owner: 'FM5', phase: 'boot', screen: 'release-404', inject: 'release status 404', recover: 'heal, Try again: the world loads', run: 'releaseFault' },
62
+ { mode: '38', id: 'captive-portal', owner: 'FM5', phase: 'boot', screen: 'captive-portal', inject: 'release body: an HTML sign-in page', recover: 'heal, Try again: the world loads', run: 'releaseFault' },
63
+ { mode: '39', id: 'release-unsigned', owner: 'FM5', phase: 'boot', screen: 'release-unsigned', inject: 'release body: a file with a bad signature', recover: 'heal, Try again: the world loads; no dial while bad', run: 'releaseFault' },
64
+ { mode: '40', id: 'refused', owner: 'FM4', phase: 'play', screen: 'refused', inject: 'socket close 4001 on every connection', recover: 'heal, Play again: seated', run: 'socketDown' },
65
+ { mode: '41', id: 'banned', owner: 'FM8m', phase: 'play', screen: 'banned', inject: 'coded terminal close', recover: 'none: no redial', blocked: 'FM7b terminal-reason contract not built' },
66
+ { mode: '42', id: 'clock-skew', owner: 'FM4b', phase: 'doctor', screen: 'clock-skew', inject: 'the page clock 2 min ahead, socket refused', recover: 'Run again with the clock right', run: 'clockSkew' },
67
+ { mode: '43', id: 'storage-full', owner: 'FM6', phase: 'load', screen: 'storage-full', inject: 'Cache API put throws QuotaExceededError (labelled injection)', recover: 'plays on from memory', run: 'storageFull' },
68
+ { mode: '44', id: 'pack-broken', owner: 'FM6', phase: 'load', screen: 'packs-5xx', inject: 'packs truncate 64 bytes, healed after 6 s', recover: 'the world loads with verified bytes', run: 'packsFault' },
69
+ { mode: '45', id: 'sleep-wake', owner: 'FM4b', phase: 'play', screen: 'background-long', inject: 'CDP freeze 35 s with no visibility change', recover: 'seated again: no card', run: 'freeze', chromiumOnly: true },
70
+ { mode: '46', id: 'staging', owner: 'FM5', phase: 'boot', screen: 'staging', inject: 'the fixture release signed with channel staging (loopback only)', recover: 'stays for the session', run: 'staging' },
71
+ ]);
72
+
73
+ /** The cases a `--scenario=` asks for: `all`, or a comma list of ids (a parent id brings its `b` case too). Unknown ids throw. @param {string} asked */
74
+ export function selectCases(asked) {
75
+ if (asked === 'all') return [...CASES];
76
+ const ids = asked.split(',').map(word => word.trim()).filter(word => word !== '');
77
+ const unknown = ids.filter(id => !CASES.some(item => item.id === id));
78
+ if (ids.length === 0 || unknown.length > 0) throw new Error(`--scenario names no case: ${unknown.join(', ') || '(empty)'}`);
79
+ return CASES.filter(item => ids.includes(item.id) || (item.parent !== undefined && ids.includes(item.parent)));
80
+ }
81
+
82
+ /** The proof's exit: 0 when every selected case passed; 2 when the harness itself failed (an injection with no match, setup, cleanup or a
83
+ * guard), whatever else happened; else 1 (a screen missing, a dependency blocked, an engine that can't produce the fault). `--baseline`
84
+ * collects every case either way; it never changes this verdict. @param {readonly { outcome: Outcome }[]} rows */
85
+ export function verdict(rows) {
86
+ if (rows.some(row => row.outcome === 'harness-fail')) return 2;
87
+ return rows.length > 0 && rows.every(row => row.outcome === 'pass') ? 0 : 1;
88
+ }
89
+
90
+ /** Whether a `data-failmode` attribute (space-separated ids) names `id`. @param {string | null} attribute @param {string} id */
91
+ export const names = (attribute, id) => attribute !== null && attribute.split(/\s+/u).includes(id);
92
+
93
+ /** Primary copy a player reads may not carry a raw exception, a status line or an address: those belong in Details. @param {string} text */
94
+ export function rawLeak(text) {
95
+ const found = /\b(?:TypeError|Error:|Failed to fetch|NetworkError|undefined|null)\b|https?:\/\/|\bws:\/\/|\b[45]\d\d\b(?!\s*ms)/u.exec(text);
96
+ return found === null ? null : found[0];
97
+ }