@wildshard/engine 0.1.21 → 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 (57) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lint/engine-sides.json +3 -0
  3. package/lint/shardfile-boundaries.mjs +4 -2
  4. package/lint/wildshard-plugin.js +1 -1
  5. package/package.json +2 -1
  6. package/scripts/audio-download-proof.mjs +1 -1
  7. package/scripts/check-spelled-paths.mjs +6 -3
  8. package/scripts/committed-fast-checks.mjs +2 -2
  9. package/scripts/failmode-cases.mjs +1 -1
  10. package/scripts/failmode-proof.mjs +35 -11
  11. package/scripts/grid-crossing-walk-proof.mjs +3 -3
  12. package/scripts/hover-speed-probe.mjs +2 -2
  13. package/scripts/mmo-bots.mjs +7 -3
  14. package/scripts/net-lag-proof.mjs +1 -1
  15. package/scripts/online-rig.mjs +7 -7
  16. package/scripts/parity/boot-smoke.mjs +1 -1
  17. package/scripts/release-cook.mjs +6 -2
  18. package/scripts/test-products.json +0 -21
  19. package/scripts/vps/cook-follow.d.mts +6 -0
  20. package/scripts/vps/cook-follow.mjs +45 -0
  21. package/scripts/vps/harden-apply.sh +10 -1
  22. package/scripts/vps/rebuild.sh +104 -36
  23. package/scripts/vps/wildshard-config +0 -2
  24. package/src/client/app/entry.ts +2 -3
  25. package/src/client/engine/boot/contentRead.ts +24 -4
  26. package/src/client/engine/boot/downloadGiveUp.ts +34 -0
  27. package/src/client/engine/combat/EquipmentService.ts +2 -0
  28. package/src/client/engine/core/Game.ts +6 -2
  29. package/src/client/engine/ui/downloadFailed.ts +54 -0
  30. package/src/client/game/boot/spawnDownload.ts +12 -1
  31. package/src/client/game/grid/copyPrompts.ts +3 -4
  32. package/src/client/game/grid/dataCellKit.ts +91 -0
  33. package/src/client/game/grid/enteredEquipment.ts +11 -2
  34. package/src/client/game/grid/live.ts +9 -299
  35. package/src/client/game/grid/liveSession.ts +31 -8
  36. package/src/client/game/grid/neighbourLife.ts +50 -32
  37. package/src/client/game/grid/reveal.ts +7 -2
  38. package/src/client/game/grid/session.ts +4 -70
  39. package/src/client/game/plugin/weaponFamily.ts +6 -0
  40. package/src/client/game/shardfile/clientWorker.ts +13 -3
  41. package/src/client/host/online/shell.ts +37 -13
  42. package/src/server/game/grid/room.ts +2 -38
  43. package/src/server/game/shardfile/declaredKitItems.ts +8 -2
  44. package/src/server/host/dedicated/cellHost.ts +2 -2
  45. package/src/server/host/dedicated/cellProtocol.ts +1 -1
  46. package/src/server/host/dedicated/cellWorker.ts +1 -1
  47. package/src/server/host/dedicated/dedicatedRoom.ts +8 -3
  48. package/src/server/host/dedicated/gridCells.ts +5 -3
  49. package/src/server/host/dedicated/main.ts +6 -4
  50. package/src/server/host/dedicated/workerTable.ts +0 -10
  51. package/src/server/host/dedicated/world.ts +39 -5
  52. package/src/server/host/standalone/cellWorld.ts +1 -1
  53. package/src/shared/engine/saves/shape.ts +17 -2
  54. package/src/shared/engine/strings.ts +10 -0
  55. package/src/shared/game/grid/placementRows.ts +4 -3
  56. package/src/client/game/grid/cellLoading.ts +0 -110
  57. package/src/client/game/grid/cellScreens.ts +0 -48
@@ -14,7 +14,7 @@
14
14
  # is signed, so a host that still holds OpenClaw, Coolify, clawdbot or Ollama state is refused in both modes.
15
15
  # Port 443 and `rooms.wildshard.io` are Jake's, after VPS-HARDENING VH16 (J179): Caddy is installed and left off.
16
16
  set -euo pipefail
17
- CHECK=0 COOK_ONLY=0
17
+ CHECK=0 COOK_ONLY=0 PHASE2=0
18
18
  if [ "$#" = 1 ] && [ "$1" = --check ]; then CHECK=1
19
19
  elif [ "$#" = 1 ] && [ "$1" = --cook ]; then COOK_ONLY=1
20
20
  elif [ "$#" != 0 ]; then printf 'stop Expected no arguments, --check or --cook\n'; exit 1; fi
@@ -22,7 +22,8 @@ HERE=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
22
22
  ETC=/etc/wildshard HOME_DIR=/var/lib/wildshard SYSTEMD=/etc/systemd/system
23
23
  PG_VERSION=16 NODE=/usr/bin/node NODE_MAJOR=24 PNPM=pnpm@10.34.9
24
24
  KEY_DIR=/home/raynos/wildshard-e7 KEY_FILE=/home/raynos/wildshard-e7/release-public-key.hex
25
- COOK_ENV=/etc/wildshard/cook.env COOK_HOME=/var/lib/wildshard-cook COOK_SRC=/opt/wildshard/engine COOK_LIB=/usr/local/lib/wildshard-cook
25
+ COOK_ENV=/etc/wildshard/cook.env COOK_STATE=/etc/wildshard/cook-release.env COOK_HOME=/var/lib/wildshard-cook COOK_SRC=/opt/wildshard/engine COOK_LIB=/usr/local/lib/wildshard-cook
26
+ COOK_PNPM_STORE=/var/lib/wildshard-pnpm-store
26
27
  COOK_GROUP=wildshard-cook
27
28
  COOK_SETTINGS=/etc/wildshard/cook.settings
28
29
  # 8790 and 8791 are the game's loopback ports; the cook worker's own default was 8791 too.
@@ -84,14 +85,16 @@ env_value() { sed -n "s/^$2=//p" "$1" 2>/dev/null | tail -n 1; }
84
85
  # The cook worker starts only once its env file names a build, an API, a token and one store (R2's four rows or a folder).
85
86
  cook_env_complete() {
86
87
  local file=$1 name
87
- for name in COOK_ENGINE_REF WILDSHARD_BUILD WILDSHARD_API_URL COOK_NOTIFY_TOKEN; do [ -n "$(cook_value "$file" "$name")" ] || return 1; done
88
- if [ -n "$(cook_value "$file" COOK_STORE_DIR)" ]; then return 0; fi
89
- for name in R2_ACCOUNT_ID R2_BUCKET_PACKS R2_PACKS_ACCESS_KEY_ID R2_PACKS_SECRET_ACCESS_KEY; do [ -n "$(cook_value "$file" "$name")" ] || return 1; done
88
+ # The signed staging release supplies the ref and build. cook.env has credentials only.
89
+ for name in COOK_NOTIFY_TOKEN; do [ -n "$(env_value "$file" "$name")" ] || return 1; done
90
+ if [ -n "$(env_value "$file" COOK_STORE_DIR)" ]; then return 0; fi
91
+ for name in R2_ACCOUNT_ID R2_BUCKET_PACKS R2_PACKS_ACCESS_KEY_ID R2_PACKS_SECRET_ACCESS_KEY; do [ -n "$(env_value "$file" "$name")" ] || return 1; done
90
92
  }
91
- # AUTO-RELEASE AR3 (J355): `wildshard-config cook <tag>` writes COOK_ENGINE_REF and WILDSHARD_BUILD to cook.settings, which
92
- # the unit reads after cook.env. A key there wins, blank too, exactly as systemd reads the two files; otherwise cook.env's.
93
+ # AUTO-RELEASE AR3 (J355) writes an explicit tag and build to cook.settings. It wins over staging's signed follow state,
94
+ # which wins over legacy cook.env values, exactly as the service's EnvironmentFile order does.
93
95
  cook_value() {
94
- if [ -n "${COOK_SETTINGS:-}" ] && [ -r "$COOK_SETTINGS" ] && grep -q "^$2=" "$COOK_SETTINGS"; then env_value "$COOK_SETTINGS" "$2"
96
+ if [ -r "$COOK_SETTINGS" ] && grep -q "^$2=" "$COOK_SETTINGS"; then env_value "$COOK_SETTINGS" "$2"
97
+ elif [ -r "$COOK_STATE" ] && grep -q "^$2=" "$COOK_STATE"; then env_value "$COOK_STATE" "$2"
95
98
  else env_value "$1" "$2"; fi
96
99
  }
97
100
  # Caddy's package ships a page on port 80. Only that file, byte for byte as dpkg recorded it, or this script's own
@@ -119,12 +122,17 @@ if [ "$CHECK" = 0 ] && [ "$(id -u)" != 0 ]; then say stop 'Run with sudo, or pas
119
122
  # AUTO-RELEASE AR3: one rebuild at a time, whichever way it was started (a full run, --cook from wildshard-config cook,
120
123
  # wildshard-apply <tag> rebuild), so two never move the cook's checkout or install into it at once.
121
124
  if [ "$CHECK" = 0 ]; then exec 9>/run/wildshard-rebuild.lock; flock 9; fi
122
- for name in setup.sh setup-state.mjs pull.mjs dump.sh restore-check.sh uptime.sh health-stub.mjs wildshard-config wildshard-apply.mjs wildshard-agent.pub; do
125
+ REQUIRED=(setup.sh setup-state.mjs pull.mjs dump.sh restore-check.sh uptime.sh health-stub.mjs wildshard-config wildshard-apply.mjs wildshard-agent.pub)
126
+ if [ "$COOK_ONLY" = 1 ]; then REQUIRED=(cook-follow.mjs); fi
127
+ for name in "${REQUIRED[@]}"; do
123
128
  if [ ! -f "$HERE/$name" ]; then say stop "$name must sit beside rebuild.sh"; exit 1; fi
124
129
  done
125
130
  # The one trusted public key lives in setup.sh; this stages a copy of it, never another.
126
- EXPECTED_KEY=$(sed -n 's/^EXPECTED_RELEASE_PUBLIC_KEY=\([0-9a-f]*\)$/\1/p' "$HERE/setup.sh")
127
- if ! [[ "$EXPECTED_KEY" =~ ^302a300506032b6570032100[0-9a-f]{64}$ ]]; then say stop 'Cannot read the release public key from setup.sh'; exit 1; fi
131
+ EXPECTED_KEY=''
132
+ if [ "$COOK_ONLY" = 0 ]; then
133
+ EXPECTED_KEY=$(sed -n 's/^EXPECTED_RELEASE_PUBLIC_KEY=\([0-9a-f]*\)$/\1/p' "$HERE/setup.sh")
134
+ if ! [[ "$EXPECTED_KEY" =~ ^302a300506032b6570032100[0-9a-f]{64}$ ]]; then say stop 'Cannot read the release public key from setup.sh'; exit 1; fi
135
+ fi
128
136
  # shellcheck source=/dev/null
129
137
  . /etc/os-release
130
138
  if [ "${VERSION_CODENAME:-}" != noble ]; then say stop "Written for Ubuntu 24.04 (noble), and this is ${PRETTY_NAME:-unknown}"; exit 1; fi
@@ -135,7 +143,6 @@ CPUS=$(nproc) SHARED_CPUS='AllowedCPUs=13-15'
135
143
  if [ "$CPUS" -lt 16 ]; then say warn "The units' AllowedCPUs assume 16 cores, and this has $CPUS"; SHARED_CPUS="# AllowedCPUs=13-15 needs 16 cores; this box has $CPUS"; fi
136
144
 
137
145
  # AUTO-RELEASE AR3: --cook is step 4 alone; the box already has what steps 1 to 3 make.
138
- PHASE2=0
139
146
  if [ "$COOK_ONLY" = 0 ]; then
140
147
  # --- 1. Packages
141
148
  APT_UPDATED=0
@@ -379,7 +386,6 @@ if [ -f "$HERE/harden.sh" ]; then
379
386
  else say skip 'harden.sh is not written yet (VPS-HARDENING-PLAN); it must pass VH16 before port 443'; fi
380
387
 
381
388
  # --- 3. Phase 2, once the box is on the tailnet
382
- PHASE2=0
383
389
  if ! tailnet_up; then
384
390
  if [ "$CHECK" = 1 ] && [ ! -x "$NODE" ]; then say would 'run setup.sh once Tailscale is installed and up'
385
391
  else wait_for 'Tailscale is not logged in: run `sudo tailscale up --ssh`, then run rebuild.sh again (Phase 2 needs the node name)'; fi
@@ -401,14 +407,24 @@ COOK_FOLDERS=("$COOK_HOME" "$COOK_HOME/scratch" "$COOK_HOME/server" "$COOK_HOME/
401
407
  have_cook_folders() { local path; for path in "${COOK_FOLDERS[@]}"; do [ -d "$path" ] && metadata_ok "$path" 750 wildshard-cook:wildshard-cook || return 1; done; }
402
408
  make_cook_folders() { install -d -m 750 -o wildshard-cook -g wildshard-cook "${COOK_FOLDERS[@]}"; }
403
409
  step 'cook folders' have_cook_folders make_cook_folders
410
+ # GVS G9: pnpm must not choose /root's store (hidden by ProtectHome), and the
411
+ # cook account must only read the packages root installed. Keep the whole tree
412
+ # below a root-owned parent so the worker cannot replace a path the installer uses.
413
+ cook_store_unreadable() {
414
+ find "$COOK_PNPM_STORE" ! -type l \( ! -user root -o ! -group "$COOK_GROUP" -o ! -perm -g+r -o -perm -g+w -o -perm -o+w \
415
+ -o \( -type d ! -perm -g+x \) \) -print -quit
416
+ }
417
+ have_cook_store() { [ -d "$COOK_PNPM_STORE" ] && [ -z "$(cook_store_unreadable)" ]; }
418
+ make_cook_store() {
419
+ install -d -m 750 -o root -g "$COOK_GROUP" "$COOK_PNPM_STORE"
420
+ find "$COOK_PNPM_STORE" ! -type l -exec chown root:"$COOK_GROUP" {} +
421
+ find "$COOK_PNPM_STORE" ! -type l -exec chmod g+rX,g-w,o-w {} +
422
+ }
423
+ step "cook pnpm store $COOK_PNPM_STORE" have_cook_store make_cook_store
404
424
  if [ "$(id -u)" != 0 ] && [ -d "$ETC" ] && [ ! -x "$ETC" ]; then say 'cannot verify' "$COOK_ENV (needs sudo)"
405
425
  elif put_once "$COOK_ENV" 600 root:root <<'EOF'
406
- # C4: the cook worker. It starts once the rows below are filled; then run rebuild.sh again.
407
- # The engine tag it runs, and that build's id: the same build production serves (its version.json `build`).
408
- COOK_ENGINE_REF=
409
- WILDSHARD_BUILD=
410
- # Where it lists the catalogue and downloads shardfiles
411
- WILDSHARD_API_URL=https://api.wildshard.io
426
+ # C4: the cook worker. Its signed staging release chooses its engine tag and build.
427
+ # Only credentials belong here; run rebuild.sh again after filling them.
412
428
  # The bearer token api-server's notify call sends (J30). The same value goes in api-server's settings.
413
429
  COOK_NOTIFY_TOKEN=
414
430
  # Where packs go: the four R2 rows, or, on a scratch box only, COOK_STORE_DIR (a folder under /var/lib/wildshard-cook).
@@ -442,10 +458,22 @@ EOF
442
458
  then if [ "$CHECK" = 0 ]; then apparmor_parser -r /etc/apparmor.d/wildshard-cook-unshare; fi; fi
443
459
  else say ok 'unprivileged user namespaces are not restricted here; no AppArmor profile needed'; fi
444
460
 
445
- COOK_REF='' COOK_READY=0
446
- if [ -r "$COOK_ENV" ] && cook_env_complete "$COOK_ENV"; then COOK_READY=1; COOK_REF=$(cook_value "$COOK_ENV" COOK_ENGINE_REF); fi
461
+ COOK_REF='' COOK_BUILD='' COOK_READY=0
462
+ cook_follow() {
463
+ if [ "$CHECK" = 1 ]; then "$NODE" "$HERE/cook-follow.mjs" --check --env "$ETC/staging.env" --state "$COOK_STATE"
464
+ else "$NODE" "$HERE/cook-follow.mjs" --env "$ETC/staging.env" --state "$COOK_STATE"; fi
465
+ }
466
+ if [ -r "$COOK_ENV" ] && cook_env_complete "$COOK_ENV"; then
467
+ if cook_follow; then
468
+ COOK_REF=$(cook_value "$COOK_ENV" COOK_ENGINE_REF)
469
+ COOK_BUILD=$(cook_value "$COOK_ENV" WILDSHARD_BUILD)
470
+ [ -n "$COOK_REF" ] && [ -n "$COOK_BUILD" ] && COOK_READY=1
471
+ else
472
+ wait_for 'The signed staging release did not supply a usable cook ref and build; the cook stays off'
473
+ fi
474
+ fi
447
475
  if [ "$COOK_READY" = 0 ]; then
448
- if [ -r "$COOK_ENV" ] || [ "$CHECK" = 0 ]; then wait_for "Fill $COOK_ENV (engine tag, build, notify token, and R2 or a folder), then run rebuild.sh again"
476
+ if [ -r "$COOK_ENV" ] || [ "$CHECK" = 0 ]; then wait_for "Fill $COOK_ENV (notify token and R2 or a folder), then run rebuild.sh again"
449
477
  elif [ "$(id -u)" = 0 ]; then say would "wait for $COOK_ENV to be filled"
450
478
  else say 'cannot verify' "$COOK_ENV (needs sudo)"; fi
451
479
  fi
@@ -456,8 +484,9 @@ org_git() { env GIT_CONFIG_COUNT=2 GIT_CONFIG_KEY_0=url.https://github.com/proje
456
484
  GIT_CONFIG_KEY_1=url.https://github.com/project-wildshard/.insteadof GIT_CONFIG_VALUE_1=ssh://git@github.com/project-wildshard/ "$@"; }
457
485
  cook_commit() { git -c safe.directory="$COOK_SRC" -C "$COOK_SRC" rev-parse HEAD 2>/dev/null; }
458
486
  have_cook_source() {
459
- [ -f "$COOK_SRC/.wildshard-installed" ] && [ "$(cat "$COOK_SRC/.wildshard-installed")" = "$COOK_REF $(cook_commit)" ] \
460
- && [ "$(git -c safe.directory="$COOK_SRC" -C "$COOK_SRC" rev-parse "$COOK_REF^{commit}" 2>/dev/null)" = "$(cook_commit)" ]
487
+ [ -f "$COOK_SRC/.wildshard-installed" ] && [ "$(cat "$COOK_SRC/.wildshard-installed")" = "$COOK_REF $COOK_BUILD" ] \
488
+ && [ "$(cook_commit)" = "$COOK_BUILD" ] \
489
+ && [ "$(git -c safe.directory="$COOK_SRC" -C "$COOK_SRC" rev-parse "$COOK_REF^{commit}" 2>/dev/null)" = "$COOK_BUILD" ]
461
490
  }
462
491
  make_cook_source() {
463
492
  install -d -m 755 -o root -g root "$(dirname "$COOK_SRC")"
@@ -466,14 +495,12 @@ make_cook_source() {
466
495
  git -C "$COOK_SRC" sparse-checkout set --no-cone '/*' '!/progress/' '!/art/' '!/sources/'
467
496
  fi
468
497
  git -c safe.directory="$COOK_SRC" -C "$COOK_SRC" fetch --quiet --tags origin
469
- git -c safe.directory="$COOK_SRC" -C "$COOK_SRC" checkout --quiet --force --detach "$COOK_REF^{commit}"
470
- # --cook (AR3): the tag must still be the build wildshard-config verified, or the worker would run other code than it reports.
471
- if [ "$COOK_ONLY" = 1 ] && [ "$(cook_commit)" != "$(cook_value "$COOK_ENV" WILDSHARD_BUILD)" ]; then
472
- say stop "$COOK_REF is $(cook_commit) on GitHub now, not the verified WILDSHARD_BUILD"; exit 1
473
- fi
498
+ if [ "$(git -c safe.directory="$COOK_SRC" -C "$COOK_SRC" rev-parse "$COOK_REF^{commit}" 2>/dev/null)" != "$COOK_BUILD" ]; then say stop "The signed release's $COOK_REF does not resolve to $COOK_BUILD"; exit 1; fi
474
499
  rm -f "$COOK_SRC/.wildshard-installed"
475
- (cd "$COOK_SRC" && org_git env CI=1 HOME=/root COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack "$PNPM" install --frozen-lockfile --ignore-scripts --config.confirmModulesPurge=false)
476
- printf '%s %s\n' "$COOK_REF" "$(cook_commit)" > "$COOK_SRC/.wildshard-installed"
500
+ git -c safe.directory="$COOK_SRC" -C "$COOK_SRC" checkout --quiet --force --detach "$COOK_BUILD"
501
+ (cd "$COOK_SRC" && org_git env CI=1 HOME=/root COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack "$PNPM" install --frozen-lockfile --ignore-scripts --config.confirmModulesPurge=false --config.ci=false --store-dir "$COOK_PNPM_STORE" --virtual-store-dir "$COOK_PNPM_STORE/links")
502
+ (cd "$COOK_SRC" && "$NODE" scripts/assert-store-layout.mjs)
503
+ printf '%s %s\n' "$COOK_REF" "$COOK_BUILD" > "$COOK_SRC/.wildshard-installed"
477
504
  chmod -R go-w "$COOK_SRC"
478
505
  }
479
506
  # MMO-SERVER MS2.4b: root clones under the box's umask 027, so the checkout came out 750 root:root and the cook, its own user,
@@ -494,11 +521,16 @@ if [ "$COOK_READY" = 1 ]; then
494
521
  step "cook source $COOK_SRC at $COOK_REF" have_cook_source make_cook_source
495
522
  if [ "$CHECK" = 0 ] && ! have_cook_read; then COOK_SOURCE_CHANGED=1; fi
496
523
  step "cook source readable by $COOK_GROUP" have_cook_read make_cook_read
524
+ step "cook pnpm store readable by $COOK_GROUP" have_cook_store make_cook_store
497
525
  fi
498
- # What the running worker last read of cook.env and cook.settings, as a hash in its root-owned checkout: a changed file
499
- # restarts it. With no cook.settings the hash is cook.env's alone, as it was before AR3.
526
+ # What the running worker last read of cook.env, signed follow state and cook.settings, as a hash in its root-owned checkout.
527
+ # A changed value restarts it; absent optional files preserve the legacy cook.env-only hash.
500
528
  cook_env_hash() {
501
- { cat "$COOK_ENV"; cat "$COOK_SETTINGS" 2>/dev/null || true; } | sha256sum | cut -d' ' -f1
529
+ {
530
+ cat "$COOK_ENV"
531
+ if [ -r "${COOK_STATE:-}" ]; then cat "$COOK_STATE"; fi
532
+ if [ -r "${COOK_SETTINGS:-}" ]; then cat "$COOK_SETTINGS"; fi
533
+ } | sha256sum | cut -d' ' -f1
502
534
  }
503
535
 
504
536
  if put "$SYSTEMD/wildshard-cook.service" 644 root:root <<EOF
@@ -514,8 +546,11 @@ User=wildshard-cook
514
546
  Group=wildshard-cook
515
547
  WorkingDirectory=$COOK_SRC
516
548
  EnvironmentFile=$COOK_ENV
517
- # AUTO-RELEASE AR3: the engine tag and build wildshard-config cook sets, read after the secrets so they win. Optional.
549
+ EnvironmentFile=$COOK_STATE
550
+ # AUTO-RELEASE AR3: explicit engine ref/build read after signed state and credentials, so they win. Optional.
518
551
  EnvironmentFile=-$COOK_SETTINGS
552
+ # The catalogue is public configuration, not cook.env state.
553
+ Environment=WILDSHARD_API_URL=https://api.wildshard.io
519
554
  # MS2.4b: the checkout is root's and the worker runs git in it as wildshard-cook, which git refuses ("dubious ownership")
520
555
  # unless the path is a safe.directory. Set here, not in a gitconfig the worker's home would have to hold.
521
556
  Environment=GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.directory GIT_CONFIG_VALUE_0=$COOK_SRC
@@ -548,8 +583,41 @@ WantedBy=multi-user.target
548
583
  EOF
549
584
  then COOK_UNIT_CHANGED=1; else COOK_UNIT_CHANGED=0; fi
550
585
 
586
+ if put "$SYSTEMD/wildshard-cook-follow.service" 644 root:root <<EOF
587
+ [Unit]
588
+ Description=Follow staging's signed release for the Wildshard cook
589
+ After=network-online.target
590
+ Wants=network-online.target
591
+ ConditionPathExists=$COOK_ENV
592
+
593
+ [Service]
594
+ Type=oneshot
595
+ User=root
596
+ ExecStart=/usr/bin/bash $COOK_LIB/rebuild.sh --cook
597
+ EOF
598
+ then COOK_FOLLOW_UNIT_CHANGED=1; else COOK_FOLLOW_UNIT_CHANGED=0; fi
599
+ if put "$SYSTEMD/wildshard-cook-follow.timer" 644 root:root <<'EOF'
600
+ [Unit]
601
+ Description=Check staging's signed release for the Wildshard cook every five minutes
602
+
603
+ [Timer]
604
+ OnBootSec=2min
605
+ OnUnitActiveSec=5min
606
+ Persistent=true
607
+
608
+ [Install]
609
+ WantedBy=timers.target
610
+ EOF
611
+ then COOK_TIMER_CHANGED=1; else COOK_TIMER_CHANGED=0; fi
612
+
551
613
  if [ "$CHECK" = 0 ]; then
614
+ install -d -m 755 -o root -g root "$COOK_LIB"
615
+ if [ "$HERE" != "$COOK_LIB" ]; then
616
+ install -m 750 -o root -g root "$HERE/rebuild.sh" "$COOK_LIB/rebuild.sh"
617
+ install -m 750 -o root -g root "$HERE/cook-follow.mjs" "$COOK_LIB/cook-follow.mjs"
618
+ fi
552
619
  systemctl daemon-reload
620
+ systemctl enable --quiet wildshard-cook-follow.timer
553
621
  if [ "$COOK_READY" = 1 ]; then
554
622
  if systemctl is-active --quiet wildshard-cook.service && [ "$COOK_UNIT_CHANGED" = 0 ] && [ "$COOK_SOURCE_CHANGED" = 0 ] \
555
623
  && [ "$(cat "$COOK_SRC/.wildshard-env" 2>/dev/null)" = "$(cook_env_hash)" ]; then say ok 'cook worker running'
@@ -572,4 +640,4 @@ if [ "$PHASE2" = 1 ] && [ "$CHECK" = 0 ]; then
572
640
  fi
573
641
  if [ "${#WAITING[@]}" != 0 ]; then say waiting "${#WAITING[@]} input(s) above; everything else is done"; exit 2; fi
574
642
  if [ "$CHECK" = 1 ]; then say check 'Read-only pass complete'; exit 0; fi
575
- say 'done' 'Rebuild complete: Phase 1, Phase 2 and the cook worker'
643
+ if [ "$COOK_ONLY" = 1 ]; then say done 'Cook follow complete'; else say done 'Rebuild complete: Phase 1, Phase 2 and the cook worker'; fi
@@ -45,7 +45,6 @@ SETTINGS = {
45
45
  'RECORD_TAG': lambda value, channel: re.fullmatch(r'[A-Za-z0-9._-]{0,64}', value) is not None,
46
46
  'ALLOWED_ORIGINS': lambda value, channel: (set(value.split(',')) <= set(GAME_HOSTS) and len(set(value.split(','))) == len(value.split(','))
47
47
  and GAME_HOSTS[CHANNELS[channel]['host']] in value.split(',')),
48
- 'WORLD_CROSSING': lambda value, channel: value in ('off', 'worker'),
49
48
  'PLACEMENT_URL': lambda value, channel: value in ('', placements(channel)),
50
49
  'PLACEMENT_PUBLIC_KEY': lambda value, channel: value in ('', PLACEMENT_PUBLIC_KEY),
51
50
  # SC2: the channel's own port, which the box's Prometheus scrapes, or blank (off). The server binds it on 127.0.0.1 only.
@@ -56,7 +55,6 @@ RULES = {'WORLD_CELLS': "'grid' or comma-separated cell names (a-z, 0-9, -), non
56
55
  'WORLD_SEATS': 'a whole number from 1 to 2000', 'RECORD_TAG': 'up to 64 of A-Z a-z 0-9 . _ -',
57
56
  'ALLOWED_ORIGINS': "comma-separated, none twice, from https://play.wildshard.io, https://staging.wildshard.io and "
58
57
  "https://preview.wildshard.io, keeping the channel's own (production play, staging staging)",
59
- 'WORLD_CROSSING': 'off or worker',
60
58
  'PLACEMENT_URL': "https://packs.wildshard.io/releases/<channel>-placements.json for this channel, or blank",
61
59
  'PLACEMENT_PUBLIC_KEY': f'the API placement key {PLACEMENT_PUBLIC_KEY}, or blank',
62
60
  'METRICS_PORT': "the channel's own metrics port (production 9790, staging 9791), or blank (off)"}
@@ -437,7 +437,7 @@ async function startSelected(): Promise<void> {
437
437
  const imports = prepareBootImports(bootAwait('app:common-service-imports', Promise.all([speciesModule, iconsModule, pickupsModule, pickupRowsModule, propsModule,
438
438
  starterModule, hoverboardModule, voicesModule, boarModule, familiesModule, sourceModule, runtimeModule,
439
439
  gridEntryModule, pathsModule, prefetchModule])));
440
- const [{ sharedWeaponVoices, declaredWeaponVoices }, { BOAR_LOOK }, { declaredKitItemFamilies },
440
+ const [{ sharedWeaponVoices, declaredWeaponVoices }, { BOAR_LOOK }, { declaredKitItemFamilies, declaredItemIcon },
441
441
  { configuredShardfile, installShardfileProduct, installManifestShardfile, preparePageResidency }, { browserShardfileOptions },
442
442
  { pageGridRecovery }, { loadingPath }, { gridPrefetchStatus }] = await Promise.all([
443
443
  voicesModule, boarModule, familiesModule, sourceModule, runtimeModule, gridEntryModule, pathsModule,
@@ -475,12 +475,11 @@ async function startSelected(): Promise<void> {
475
475
  if (path === 'grid') modules('grid');
476
476
  // Hybrid shardfile entries retain real TypeScript stages until their page is data-only.
477
477
  loading.setPath(loadingPath(path, game.shard.boot?.steps, path === 'shardfile' && source === null && game.shard.shardfile === undefined));
478
- const declaredIcons = ['lock', 'check', 'poi', 'you', 'map', 'pack', 'star', 'book', 'heart', 'pin', 'laurel', 'sword', 'glyph', 'coin', 'purse', 'crossbow', 'rifle', 'lever', 'longbow', 'grapple', 'horse'] as const;
479
478
  const bindings: Parameters<typeof installShardfileProduct>[2] = {
480
479
  imageOwner,
481
480
  instance: page.instance ?? (source === null ? 'template-solo' : `standalone-${source.identity.slug}`), catalogue: [], items: declaredKitItemFamilies(), voices: declaredWeaponVoices,
482
481
  ...(page.residency === undefined ? {} : { residency: page.residency }),
483
- icon: (name) => { const id = declaredIcons.find((entry) => entry === name); if (id === undefined) throw new Error(`Unknown catalogue item icon ${name}`); return id; },
482
+ icon: declaredItemIcon,
484
483
  recipes: new Map([['kit.look.boar', (row, species) => { if (row.animation.recipe !== 'kit.pose.quadruped') throw new Error('Unknown boar pose recipe'); return { ...BOAR_LOOK, id: row.id, species: species.id, kind: species.kind }; }]]),
485
484
  };
486
485
  imports.check();
@@ -4,6 +4,7 @@ import { beginLoadingWait, finishLoadingWait } from '../../../shared/engine/boot
4
4
  import { currentLoadingTimeline } from '../../../shared/engine/boot/timeline';
5
5
  import { bootProgress } from '../../../shared/engine/boot/timing';
6
6
  import { diagnosticNow } from '../../../shared/engine/core/clock';
7
+ import { clearDownloadGiveUp, downloadGiveUp, onDownloadGiveUp, type DownloadGiveUp } from './downloadGiveUp';
7
8
 
8
9
  /** A missing or interrupted transport, never a parsed-content or admission refusal. */
9
10
  export class ContentReadError extends Error {
@@ -140,7 +141,10 @@ function reportStall(target: Document, error: ContentReadError, step: string | n
140
141
  try { captureBrowserError(error, engineScreenTags('loading-stall', 'content-read', step ?? 'loading', { url: error.url })); }
141
142
  catch { /* a report never holds the retry */ }
142
143
  }
143
- async function retryFromCard(error: ContentReadError, signal?: AbortSignal): Promise<void> {
144
+ /** FM6 mode 36: how long a read may wait on RETRY, with nothing left that reads again by itself, before its line becomes the
145
+ * download-failed page. The line (modes 33 to 35) is the pause; the page says the download stopped, with what to do. */
146
+ export const DOWNLOAD_GIVE_UP_MS = 30_000;
147
+ async function retryFromCard(error: ContentReadError, signal?: AbortSignal, reads = 2): Promise<void> {
144
148
  if (typeof document === 'undefined') throw error;
145
149
  const target = document, timeline = currentLoadingTimeline(), scope = new Scope('content-read-button');
146
150
  let group = retryGroups.get(target);
@@ -157,6 +161,18 @@ async function retryFromCard(error: ContentReadError, signal?: AbortSignal): Pro
157
161
  owner: timeline?.waitOwner ?? null, step: timeline?.snapshot().current ?? null,
158
162
  retry: () => {for (const retry of pending) retry();}, retryNavigation: false, ...contentFailure(error) });
159
163
  shellRetry(scope, error, () => {for (const retry of pending) retry();});
164
+ // FM6 mode 36: the download gave up (before or while this read waits), so nothing more arrives by itself: the page says so
165
+ const page = (given: DownloadGiveUp): void => { void (async () => {
166
+ const { downloadFailedPage } = await import('../ui/downloadFailed');
167
+ if (!scope.disposed) downloadFailedPage(scope, given, `${error.url} · ${error.message}`, () => {for (const retry of pending) retry();});
168
+ })(); };
169
+ // or this read itself has waited DOWNLOAD_GIVE_UP_MS with every read it makes by itself spent (RETRY adds no new counter)
170
+ const given = downloadGiveUp();
171
+ if (given !== null) page(given);
172
+ else {
173
+ scope.onDispose(onDownloadGiveUp(page));
174
+ scope.timeout(DOWNLOAD_GIVE_UP_MS, () => { page({ attempts: reads, status: error.status, detail: error.url }); });
175
+ }
160
176
  });
161
177
  } finally {
162
178
  if (id !== undefined) finishLoadingWait(id);
@@ -186,14 +202,18 @@ async function busyWait(error: ContentReadError, ms: number, signal?: AbortSigna
186
202
  export async function readContent(url: string, maximum: number, options: ContentReadOptions): Promise<Uint8Array<ArrayBuffer>> {
187
203
  if (!Number.isSafeInteger(maximum) || maximum < 0 || maximum > 25_000_000) throw new Error('Invalid content wire cap');
188
204
  if (options.expectedBytes !== undefined && (!Number.isSafeInteger(options.expectedBytes) || options.expectedBytes < 0 || options.expectedBytes > maximum)) throw new Error('Invalid expected content length');
189
- let retried = false;
205
+ let retried = false, reads = 0;
190
206
  for (;;) {
191
207
  options.signal?.throwIfAborted();
208
+ reads++;
192
209
  try {
193
210
  let response: Response;
194
211
  try { response = await options.fetch(url, { ...(retried ? { cache: 'reload' } : {}), ...(options.signal === undefined ? {} : { signal: options.signal }) }); }
195
212
  catch (error) { options.signal?.throwIfAborted(); throw new ContentReadError(url, 'connection unavailable', error); }
196
- return await body(response, url, maximum, options.read, options.expectedBytes, options.response);
213
+ const bytes = await body(response, url, maximum, options.read, options.expectedBytes, options.response);
214
+ // FM6 mode 36: a read that waited on RETRY now arrives, so the download works again: a later stall shows the card's line first
215
+ if (reads > 2) clearDownloadGiveUp();
216
+ return bytes;
197
217
  } catch (error) {
198
218
  options.signal?.throwIfAborted();
199
219
  if (!(error instanceof ContentReadError)) throw error;
@@ -208,7 +228,7 @@ export async function readContent(url: string, maximum: number, options: Content
208
228
  // Instead of RETRY forever, the page reloads past its worker into the live build (once per build and tab).
209
229
  if (options.retry === undefined && error.missing && typeof document !== 'undefined'
210
230
  && await (await import('./browserChunkRecovery')).reloadIfStaleBuild()) await new Promise<void>(() => { /* never settles: the page is navigating */ });
211
- await (options.retry === undefined ? retryFromCard(error, options.signal) : options.retry(error)); retried = false;
231
+ await (options.retry === undefined ? retryFromCard(error, options.signal, reads) : options.retry(error)); retried = false;
212
232
  }
213
233
  }
214
234
  }
@@ -0,0 +1,34 @@
1
+ // FM6 mode 36 (meta docs/plans/MMO-FAILURE-MODES-PLAN.md): the world's download gave up. The spawn download is the load's one bounded
2
+ // operation: each part gets its reads (spawnDownload.ts PART_READS), then the job refuses and its waits fall through to the
3
+ // network. When a read that falls through then waits on the card's RETRY too, nothing more will arrive by itself, so the card's
4
+ // line (modes 33 to 35) becomes the `download-failed` page (contentRead.ts). A read that waits on RETRY for
5
+ // DOWNLOAD_GIVE_UP_MS (the spawn manifest's own read, say) gives up the same way. Dependency-free, so the spawn download and the content
6
+ // read share it without either pulling the other in. One page document holds one load's fact.
7
+
8
+ /** What was measured when the download gave up, never a guess. The address and status are for Details and Copy diagnostics only. */
9
+ export interface DownloadGiveUp {
10
+ /** reads of the file or part that refused, its last one included (a RETRY round's reads add to the same count) */
11
+ readonly attempts: number;
12
+ /** the last HTTP status the part answered, null for no HTTP response */
13
+ readonly status: number | null;
14
+ /** what failed, with its address */
15
+ readonly detail: string;
16
+ }
17
+
18
+ let fact: DownloadGiveUp | null = null;
19
+ const listeners = new Set<(given: DownloadGiveUp) => void>();
20
+
21
+ /** The spawn download's job refused (not a cancel). Every read waiting on the card hears it. */
22
+ export function noteDownloadGiveUp(given: DownloadGiveUp): void {
23
+ fact = given;
24
+ for (const listen of listeners) listen(given);
25
+ }
26
+ /** A new download starts: the last one's refusal is over. */
27
+ export function clearDownloadGiveUp(): void { fact = null; }
28
+ /** The refusal of this page's download, if it gave up. */
29
+ export function downloadGiveUp(): DownloadGiveUp | null { return fact; }
30
+ /** Hear a refusal from now on; returns the unsubscribe. */
31
+ export function onDownloadGiveUp(listen: (given: DownloadGiveUp) => void): () => void {
32
+ listeners.add(listen);
33
+ return () => { listeners.delete(listen); };
34
+ }
@@ -355,6 +355,8 @@ export class EquipmentService implements WeaponHooks {
355
355
  get reach(): number | undefined { return this.current.reach; }
356
356
 
357
357
  /** Give every weapon its line to the server (P1-E5.3-E1). */
358
+ /** The server's weapon wire this page's kit is bound to (TC-E1b: an entered data cell's kit takes the road's). */
359
+ get boundWire(): WeaponWire | null { return this.serverWire; }
358
360
  bindWire(wire: WeaponWire | null): void { this.serverWire = wire; for (const w of this.list) w.wire = wire; wire?.equip(this.current.row.id); }
359
361
  /** A named interaction the server must judge: nothing, where no server owns the player. */
360
362
  interact(id: string): void { this.serverWire?.interact(id); }
@@ -360,6 +360,7 @@ export class Game {
360
360
  * they hold) go with their row; a re-registered id starts a fresh record. */
361
361
  private readonly faultSystems = new WeakMap<object, GameSystem<(dt: number, t: number) => void>>();
362
362
  private anonymous = 0;
363
+ private observers = 0;
363
364
  /** E357 F2: list order is the execution order; observation never registers a system. */
364
365
  systemLabels(): Record<'input' | 'fixed.pre' | 'fixed.step' | 'fixed.post' | 'update' | 'late', string[]> {
365
366
  const phases = this.app.systemsByPhase();
@@ -904,10 +905,13 @@ export class Game {
904
905
  onUpdate(fn: (dt: number, t: number) => void, label?: string, core = false): void { this.register('update', fn, label, core); }
905
906
  /** One player-owned callback survives world-frame changes and ends with the original player scope. */
906
907
  onPlayerUpdate(fn: (dt: number, t: number) => void, label: string): void { this.register('update', fn, label, false, this.playerScope, false); }
907
- /** E357 F2: a temporary harness observer of simulation frames, removed when its walk finishes. */
908
+ /**
909
+ * E357 F2: a temporary harness observer of simulation frames, removed when its walk finishes. Each has its own system id:
910
+ * the dev hook holds several at once (its ground sweep, each part's lamps and water), and one shared id threw on the second.
911
+ */
908
912
  watchFrames(fn: (dt: number) => void): () => void {
909
913
  const scope = this.levelScope.child('observer');
910
- this.register('update', fn, 'harness.walk', false, scope, false);
914
+ this.register('update', fn, `harness.walk.${String(this.observers++)}`, false, scope, false);
911
915
  return () => { scope.dispose(); };
912
916
  }
913
917
  /** First in the frame: read controls into intents the fixed steps consume (the player's move, a queued jump). */
@@ -0,0 +1,54 @@
1
+ // FM6 mode 36 (meta docs/plans/MMO-FAILURE-MODES-PLAN.md): "The world didn't download". A page (the plan's first style) over the
2
+ // loading card, shown while a read the given-up download fell through to waits on RETRY. Try again is that same RETRY (the existing
3
+ // recovery path, no new counter); the downloaded files are kept, so it is quicker. It closes when the wait it belongs to settles.
4
+ // Primary copy has no address or status: Details and Copy diagnostics hold them.
5
+ import type { Scope } from '../../../shared/engine/app/scope';
6
+ import type { DownloadGiveUp } from '../boot/downloadGiveUp';
7
+ import { copyText, diagnosticsSource } from './diagnosticsCopy';
8
+ import { mountUi } from './ownership';
9
+ import { engineString } from '../../../shared/engine/strings';
10
+
11
+ const PAGE = 'position:fixed;inset:0;z-index:2147482600;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(4,9,14,.86);color:#e6f2f8;font:12px/1.5 "JetBrains Mono",Menlo,monospace';
12
+ const BOX = 'width:min(440px,100%);padding:22px 18px 16px;background:rgba(13,27,38,.92);border:1px solid rgba(255,120,120,.45);border-top:2px solid #ff7878;display:flex;flex-direction:column;gap:10px';
13
+ const BUTTON = 'min-height:48px;padding:13px 16px;cursor:pointer;font:700 12px/1 "JetBrains Mono",Menlo,monospace;letter-spacing:.22em;text-transform:uppercase;border:1px solid rgba(143,227,255,.35);background:rgba(13,27,38,.6);color:#e6f2f8';
14
+
15
+ /** The one page on screen: a second waiting read shares it, and takes it over if the first read's wait ends alone (a cancel). */
16
+ let open: Scope | null = null;
17
+ const queued: (() => void)[] = [];
18
+
19
+ /** Show the page for `owner`'s wait (its disposal closes it). `retry` is the card's RETRY; `measured` is the read's own failure. */
20
+ export function downloadFailedPage(owner: Scope, given: DownloadGiveUp, measured: string, retry: () => void): void {
21
+ if (open !== null && !open.disposed) {
22
+ const again = (): void => { if (!owner.disposed) downloadFailedPage(owner, given, measured, retry); };
23
+ queued.push(again);
24
+ owner.onDispose(() => { const at = queued.indexOf(again); if (at !== -1) queued.splice(at, 1); });
25
+ return;
26
+ }
27
+ const page = owner.child('download-failed');
28
+ open = page;
29
+ const root = document.createElement('div'), box = document.createElement('div'), tag = document.createElement('p'), title = document.createElement('h1'), body = document.createElement('p');
30
+ const again = document.createElement('button'), check = document.createElement('button'), copy = document.createElement('button');
31
+ const details = document.createElement('details'), summary = document.createElement('summary'), fact = document.createElement('p');
32
+ root.dataset['failmode'] = 'download-failed'; root.dataset['tone'] = 'bad'; root.setAttribute('role', 'alertdialog'); root.setAttribute('aria-modal', 'true');
33
+ root.setAttribute('aria-label', engineString('s_download_failed_title')); root.style.cssText = PAGE; box.style.cssText = BOX;
34
+ tag.textContent = engineString('s_download_failed_tag'); tag.style.cssText = 'margin:0;font-size:10.5px;letter-spacing:.3em;text-transform:uppercase;color:#ff9a9a';
35
+ title.textContent = engineString('s_download_failed_title'); title.style.cssText = 'margin:0;font:700 24px/1.1 Rajdhani,Bahnschrift,sans-serif;letter-spacing:.1em;text-transform:uppercase;color:#fff';
36
+ body.textContent = engineString('s_download_failed_body', [given.attempts]);
37
+ body.style.margin = '0';
38
+ again.type = 'button'; again.className = 'go'; again.textContent = engineString('s_download_failed_retry'); again.style.cssText = `${BUTTON};border-color:#8fe3ff;background:rgba(143,227,255,.18)`;
39
+ check.type = 'button'; check.textContent = engineString('s_download_failed_check'); check.style.cssText = BUTTON;
40
+ copy.type = 'button'; copy.textContent = engineString('s_download_failed_copy'); copy.style.cssText = BUTTON;
41
+ const said = `${given.detail}${given.status === null ? ' · no HTTP response' : ` · HTTP ${String(given.status)}`} × ${String(given.attempts)}; then ${measured}`;
42
+ summary.textContent = engineString('s_download_failed_details'); fact.textContent = said; fact.style.cssText = 'margin:8px 0 0;opacity:.6;overflow-wrap:anywhere';
43
+ details.append(summary, fact);
44
+ page.listen(again, 'click', () => { again.disabled = true; again.textContent = engineString('s_download_failed_trying'); retry(); });
45
+ page.listen(check, 'click', () => { document.dispatchEvent(new CustomEvent('ws:doctor', { detail: 'download-failed' })); });
46
+ page.listen(copy, 'click', () => {
47
+ const report = diagnosticsSource();
48
+ void (async () => { copy.textContent = await copyText(`${said}\n\n${report === null ? '' : report()}`) ? engineString('s_download_failed_copied') : engineString('s_download_failed_refused'); })();
49
+ });
50
+ page.onDispose(() => { root.remove(); if (open === page) open = null; queued.shift()?.(); });
51
+ box.append(tag, title, body, again, check, copy, details); root.append(box);
52
+ mountUi(root, page, document.body);
53
+ again.focus();
54
+ }
@@ -6,6 +6,7 @@ import { beginLoadingWait, finishLoadingWait } from '@wildshard/engine/boot/load
6
6
  import { diagnosticNow } from '@wildshard/engine/core/clock';
7
7
  import { Scope } from '@wildshard/engine/app/scope';
8
8
  import {contentBase, contentURL, isContentOrigin, pageURL} from '@wildshard/engine/boot/contentBase';
9
+ import { clearDownloadGiveUp, noteDownloadGiveUp } from '@wildshard/engine/boot/downloadGiveUp';
9
10
  import {bareSlug} from '../../../shared/game/grid/catalogueSlot';
10
11
  import {placedLoose, placedSpawn} from './placedSpawn';
11
12
 
@@ -389,6 +390,9 @@ export function downloadSpawnManifest(address: SpawnManifestAddress, ports: Spaw
389
390
  let markListed = (): void => undefined, markStopped = (_reason: unknown): void => undefined;
390
391
  const listedOnly = new Promise<void>(resolve => { markListed = resolve; });
391
392
  const stopped = new Promise<never>((_resolve, reject) => { markStopped = reject; });
393
+ // FM6 mode 36: a part that ran out of reads, and the last status a part answered (no HTTP response: null)
394
+ const exhausted: { fact: { readonly status: number | null; readonly detail: string } | null } = { fact: null };
395
+ clearDownloadGiveUp();
392
396
  const work = (async () => {
393
397
  try {
394
398
  // OVERNIGHT 6e: the manifest and its code list, read together. The list is the build's own, read from the content base
@@ -606,9 +610,13 @@ export function downloadSpawnManifest(address: SpawnManifestAddress, ports: Spaw
606
610
  const file = files[index]; if (file === undefined) continue;
607
611
  members.set(file.url, new Promise(resolve => {settle.set(index, resolve); memberSettles.add(resolve);}));
608
612
  }
613
+ // FM6 mode 36: this part's last failed HTTP status (null: no response, or a body that broke)
614
+ let status: number | null = null;
609
615
  // One read of the part. A read after a failure starts over and skips what landed, so no member counts twice.
610
616
  const read = async (init: RequestInit | undefined): Promise<void> => {
617
+ status = null;
611
618
  const response = await ports.fetch(onPacks(part.url, packs), controller.signal, init);
619
+ if (!response.ok) status = response.status;
612
620
  if (!response.ok || response.body === null) throw new Error(`Spawn part unavailable: ${part.url}`);
613
621
  const body = new Uint8Array(part.bytes), reader = response.body.getReader();
614
622
  let at = 0, next = 0;
@@ -650,7 +658,7 @@ export function downloadSpawnManifest(address: SpawnManifestAddress, ports: Spaw
650
658
  const last = attempt >= PART_READS || controller.signal.aborted;
651
659
  if (last) for (const [index] of order) { const file = files[index]; if (file !== undefined) landed(file.url); }
652
660
  controller.signal.throwIfAborted();
653
- if (attempt >= PART_READS) throw failure; // the job's failure answers every read still waiting
661
+ if (attempt >= PART_READS) { exhausted.fact ??= { status, detail: failure instanceof Error ? failure.message : String(failure) }; throw failure; } // the job's failure answers every read still waiting
654
662
  if (attempt > 1) { await partPause(); controller.signal.throwIfAborted(); }
655
663
  }
656
664
  }
@@ -689,6 +697,9 @@ export function downloadSpawnManifest(address: SpawnManifestAddress, ports: Spaw
689
697
  } catch (failure) {
690
698
  // A read waiting on a file this download will not store falls through to the network.
691
699
  releaseWaits();
700
+ // FM6 mode 36: a part out of reads refused the job (a cancel is no refusal); a read that falls through and fails too shows
701
+ // the download-failed page, not RETRY's line alone (contentRead.ts)
702
+ if (!controller.signal.aborted && exhausted.fact !== null) noteDownloadGiveUp({ attempts: PART_READS, ...exhausted.fact });
692
703
  error = failure instanceof Error ? failure.message : String(failure); publish(); controller.abort(); nudge(); throw failure;
693
704
  }
694
705
  })();
@@ -6,8 +6,8 @@
6
6
  * which runs the scene. The page offers them only while the feet stand in the entered copy (`enteredCopy`), and they go
7
7
  * with the region (built at admission, dropped at its disposal).
8
8
  *
9
- * Not here: an item scene (`targets.itemActions`, the template's lantern toggle / refill) is the held item's own action;
10
- * a template cell holds its empty equipment (bare hands, G68), so no prompt can reach an item runtime there.
9
+ * An item scene's prompt (`targets.itemActions`: Brasscap's rack) is offered too (TEMPLATE-E2E TC-E1b): an entered copy holds
10
+ * its declared kit (`dataCellKit.ts`), and the server runs the scene on the held item, as it does a standalone page's.
11
11
  */
12
12
  import { Vector3 } from 'three';
13
13
  import type { ShardRuntime } from '../../../shared/game/shard/runtime';
@@ -17,8 +17,7 @@ type Interactable = ShardRuntime['interactables'][number];
17
17
 
18
18
  /** The copy's declared interactions as frame-local prompts the server answers. */
19
19
  export function copyPrompts(source: Pick<Shardfile, 'targets'>): Interactable[] {
20
- const items = new Set((source.targets.itemActions ?? []).map((row) => row.scene));
21
- return source.targets.interactions.filter((row) => !items.has(row.scene)).map((row) => ({
20
+ return source.targets.interactions.map((row) => ({
22
21
  position: new Vector3(...row.at), radius: row.radius, label: row.label, wireId: row.id, onInteract: () => undefined,
23
22
  }));
24
23
  }