castle-web-cli 0.4.232 → 0.4.234
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.
- package/dist/agent-failures.d.ts +8 -0
- package/dist/agent-failures.js +19 -2
- package/dist/agent-prompts.d.ts +1 -1
- package/dist/agent-prompts.js +10 -3
- package/dist/agent.d.ts +64 -3
- package/dist/agent.js +170 -81
- package/dist/api.d.ts +11 -0
- package/dist/api.js +43 -0
- package/dist/bundle.d.ts +64 -0
- package/dist/bundle.js +558 -2
- package/dist/castle-host/host.d.ts +18 -2
- package/dist/castle-host/host.js +844 -39
- package/dist/castleJson.d.ts +23 -2
- package/dist/castleJson.js +46 -2
- package/dist/check.d.ts +3 -1
- package/dist/check.js +20 -3
- package/dist/chunkLoader.d.ts +3 -0
- package/dist/chunkLoader.js +111 -0
- package/dist/devParty.d.ts +26 -0
- package/dist/devParty.js +231 -0
- package/dist/devSaveStorage.js +4 -0
- package/dist/devSessionStorage.js +50 -2
- package/dist/devSocial.d.ts +24 -0
- package/dist/devSocial.js +70 -0
- package/dist/ide.d.ts +2 -0
- package/dist/ide.js +119 -15
- package/dist/importPinMismatch.d.ts +22 -0
- package/dist/importPinMismatch.js +77 -0
- package/dist/importRegression.js +3 -15
- package/dist/imports.d.ts +10 -3
- package/dist/imports.js +88 -20
- package/dist/index.js +11 -4
- package/dist/init.js +1 -1
- package/dist/platformDoc.js +22 -0
- package/dist/routerFences.d.ts +5 -0
- package/dist/routerFences.js +12 -2
- package/dist/save-deck.d.ts +25 -1
- package/dist/save-deck.js +178 -9
- package/dist/serve.js +32 -11
- package/dist/shell/assets/{index-D2tWM896.js → index-DulbYIJm.js} +97 -97
- package/dist/shell/assets/index-MVLfNYd9.css +1 -0
- package/dist/shell/index.html +2 -2
- package/dist/taskSteer.d.ts +13 -0
- package/dist/taskSteer.js +22 -2
- package/dist/vitePlugins.d.ts +2 -1
- package/dist/vitePlugins.js +13 -0
- package/kits/base/castle.json +1 -1
- package/kits/base/package-lock.json +1 -1
- package/kits/base/sdk/README.md +339 -5
- package/kits/base/sdk/avatar.d.ts +6 -2
- package/kits/base/sdk/avatar.js +12 -4
- package/kits/base/sdk/castle.d.ts +7 -3
- package/kits/base/sdk/castle.js +2 -0
- package/kits/base/sdk/commands.d.ts +176 -1
- package/kits/base/sdk/commands.js +3 -0
- package/kits/base/sdk/display.d.ts +3 -0
- package/kits/base/sdk/display.js +9 -3
- package/kits/base/sdk/hub.d.ts +37 -6
- package/kits/base/sdk/hub.js +63 -4
- package/kits/base/sdk/multiplayer.d.ts +7 -1
- package/kits/base/sdk/multiplayer.js +148 -32
- package/kits/base/sdk/multiplayerProtocol.d.ts +2 -0
- package/kits/base/sdk/party.d.ts +23 -0
- package/kits/base/sdk/party.js +91 -0
- package/kits/base/sdk/reconnectBudget.d.ts +23 -0
- package/kits/base/sdk/reconnectBudget.js +96 -0
- package/kits/base/sdk/save.d.ts +38 -1
- package/kits/base/sdk/save.js +81 -7
- package/kits/base/sdk/server/hub.d.ts +117 -0
- package/kits/base/sdk/server/hub.js +119 -2
- package/kits/base/sdk/server/platformHandle.d.ts +43 -1
- package/kits/base/sdk/server/storage.d.ts +17 -0
- package/kits/base/sdk/server/storage.js +65 -3
- package/kits/base/sdk/server/wrapper.d.ts +43 -6
- package/kits/base/sdk/server/wrapper.js +93 -9
- package/kits/base/sdk/social.d.ts +9 -0
- package/kits/base/sdk/social.js +5 -0
- package/kits/hub-game/CLAUDE.md +451 -13
- package/kits/hub-game/README.md +63 -0
- package/kits/hub-game/blueprints/avatar-10.scene +28 -0
- package/kits/hub-game/blueprints/avatar-11.scene +28 -0
- package/kits/hub-game/blueprints/avatar-12.scene +28 -0
- package/kits/hub-game/blueprints/avatar-13.scene +28 -0
- package/kits/hub-game/blueprints/avatar-14.scene +28 -0
- package/kits/hub-game/blueprints/avatar-15.scene +28 -0
- package/kits/hub-game/blueprints/avatar-4.scene +28 -0
- package/kits/hub-game/blueprints/avatar-5.scene +28 -0
- package/kits/hub-game/blueprints/avatar-6.scene +28 -0
- package/kits/hub-game/blueprints/avatar-7.scene +28 -0
- package/kits/hub-game/blueprints/avatar-8.scene +28 -0
- package/kits/hub-game/blueprints/avatar-9.scene +28 -0
- package/kits/hub-game/castle.json +5 -5
- package/kits/hub-game/code/client/act.js +312 -0
- package/kits/hub-game/code/client/actionLayout.js +147 -0
- package/kits/hub-game/code/client/actionOverflow.js +556 -0
- package/kits/hub-game/code/client/actorBudget.js +47 -0
- package/kits/hub-game/code/client/arrivalCamera.js +50 -0
- package/kits/hub-game/code/client/askSlot.js +117 -0
- package/kits/hub-game/code/client/attention.js +11 -2
- package/kits/hub-game/code/client/avatar.js +311 -35
- package/kits/hub-game/code/client/avatarCap.js +228 -0
- package/kits/hub-game/code/client/avatarColors.js +70 -0
- package/kits/hub-game/code/client/avatarFaces.js +21 -0
- package/kits/hub-game/code/client/avatarShare.js +253 -0
- package/kits/hub-game/code/client/backVisibility.js +13 -0
- package/kits/hub-game/code/client/ballot.js +472 -0
- package/kits/hub-game/code/client/build.js +38 -0
- package/kits/hub-game/code/client/chat.js +41 -5
- package/kits/hub-game/code/client/chatModeration.js +5 -0
- package/kits/hub-game/code/client/chrome.js +2144 -160
- package/kits/hub-game/code/client/companion.js +716 -0
- package/kits/hub-game/code/client/companionDress.js +99 -0
- package/kits/hub-game/code/client/crowdNames.js +241 -0
- package/kits/hub-game/code/client/decor.js +515 -0
- package/kits/hub-game/code/client/defaultEnvironment.js +194 -0
- package/kits/hub-game/code/client/doorErrors.js +39 -0
- package/kits/hub-game/code/client/earned.js +131 -0
- package/kits/hub-game/code/client/emoteBubble.js +75 -0
- package/kits/hub-game/code/client/fall.js +18 -0
- package/kits/hub-game/code/client/farAvatars.js +233 -0
- package/kits/hub-game/code/client/firstJoin.js +9 -2
- package/kits/hub-game/code/client/fpsTelemetry.js +50 -0
- package/kits/hub-game/code/client/frameBatch.js +5 -0
- package/kits/hub-game/code/client/grab.js +368 -29
- package/kits/hub-game/code/client/hookLayer.js +385 -20
- package/kits/hub-game/code/client/hudCopy.js +51 -0
- package/kits/hub-game/code/client/hudRate.js +20 -0
- package/kits/hub-game/code/client/idle.js +177 -24
- package/kits/hub-game/code/client/interestCap.js +81 -0
- package/kits/hub-game/code/client/invites.js +231 -0
- package/kits/hub-game/code/client/joinError.js +9 -0
- package/kits/hub-game/code/client/keys.js +36 -0
- package/kits/hub-game/code/client/labelsNear.js +234 -0
- package/kits/hub-game/code/client/landscapeLayout.js +17 -0
- package/kits/hub-game/code/client/layoutCache.js +264 -0
- package/kits/hub-game/code/client/loadTelemetry.js +20 -0
- package/kits/hub-game/code/client/loadingCover.js +148 -0
- package/kits/hub-game/code/client/loadingEntry.js +8 -0
- package/kits/hub-game/code/client/menuIcons.js +34 -0
- package/kits/hub-game/code/client/menuRows.js +43 -0
- package/kits/hub-game/code/client/modelReady.js +7 -0
- package/kits/hub-game/code/client/pack.js +6 -2
- package/kits/hub-game/code/client/packFormat.js +3 -3
- package/kits/hub-game/code/client/padCueArrival.js +23 -0
- package/kits/hub-game/code/client/padCues.js +112 -0
- package/kits/hub-game/code/client/padOccupancy.js +88 -0
- package/kits/hub-game/code/client/padReadability.js +26 -0
- package/kits/hub-game/code/client/padRings.js +69 -0
- package/kits/hub-game/code/client/pushVisit.js +14 -0
- package/kits/hub-game/code/client/quality.js +205 -0
- package/kits/hub-game/code/client/qualityEntry.js +55 -0
- package/kits/hub-game/code/client/rehello.js +167 -0
- package/kits/hub-game/code/client/safeLayout.js +338 -0
- package/kits/hub-game/code/client/safeStyle.js +42 -0
- package/kits/hub-game/code/client/say.js +12 -3
- package/kits/hub-game/code/client/shot.js +146 -0
- package/kits/hub-game/code/client/shotFit.js +56 -0
- package/kits/hub-game/code/client/signIn.js +28 -0
- package/kits/hub-game/code/client/sound.js +63 -8
- package/kits/hub-game/code/client/soundscape.js +1151 -0
- package/kits/hub-game/code/client/soundscapeActions.js +99 -0
- package/kits/hub-game/code/client/soundscapeAmbience.js +453 -0
- package/kits/hub-game/code/client/soundscapeBaked.js +143 -0
- package/kits/hub-game/code/client/soundscapeBusker.js +217 -0
- package/kits/hub-game/code/client/soundscapeCourt.js +200 -0
- package/kits/hub-game/code/client/soundscapeCrowd.js +331 -0
- package/kits/hub-game/code/client/soundscapeCues.js +362 -0
- package/kits/hub-game/code/client/soundscapeMap.js +181 -0
- package/kits/hub-game/code/client/soundscapeMarket.js +176 -0
- package/kits/hub-game/code/client/soundscapeMusic.js +126 -0
- package/kits/hub-game/code/client/soundscapeMusicEngine.js +460 -0
- package/kits/hub-game/code/client/soundscapeSimlish.js +737 -0
- package/kits/hub-game/code/client/soundscapeSongs.js +127 -0
- package/kits/hub-game/code/client/soundscapeSongsRound3.js +63 -0
- package/kits/hub-game/code/client/soundscapeSynthesis.js +168 -0
- package/kits/hub-game/code/client/soundscapeUi.js +211 -0
- package/kits/hub-game/code/client/soundscapeVoice.js +1209 -0
- package/kits/hub-game/code/client/soundscapeWaves.js +206 -0
- package/kits/hub-game/code/client/spin.js +101 -0
- package/kits/hub-game/code/client/state.js +162 -1
- package/kits/hub-game/code/client/stuck.js +259 -0
- package/kits/hub-game/code/client/talk.js +714 -59
- package/kits/hub-game/code/client/tiers.js +543 -52
- package/kits/hub-game/code/client/toastBand.js +37 -0
- package/kits/hub-game/code/client/together.js +39 -2
- package/kits/hub-game/code/client/visibility.js +43 -0
- package/kits/hub-game/code/client/weakestLookBake.js +92 -0
- package/kits/hub-game/code/client/weakestTier.js +295 -0
- package/kits/hub-game/code/client/wear.js +461 -170
- package/kits/hub-game/code/client/worldLabels.js +241 -0
- package/kits/hub-game/code/client/yours.js +200 -0
- package/kits/hub-game/code/companionSpec.js +45 -0
- package/kits/hub-game/code/npcDisplayText.js +55 -0
- package/kits/hub-game/code/privateText.js +7 -0
- package/kits/hub-game/code/server/act.js +124 -0
- package/kits/hub-game/code/server/actions.js +138 -0
- package/kits/hub-game/code/server/actors.js +11 -2
- package/kits/hub-game/code/server/analytics.js +83 -0
- package/kits/hub-game/code/server/anonymousEntry.js +49 -0
- package/kits/hub-game/code/server/arrivalPose.js +36 -0
- package/kits/hub-game/code/server/ask.js +155 -0
- package/kits/hub-game/code/server/ballot.js +539 -0
- package/kits/hub-game/code/server/cells.js +100 -0
- package/kits/hub-game/code/server/companion.js +107 -0
- package/kits/hub-game/code/server/cues.js +70 -0
- package/kits/hub-game/code/server/decor.js +269 -0
- package/kits/hub-game/code/server/doorAnalytics.js +52 -0
- package/kits/hub-game/code/server/earned.js +478 -0
- package/kits/hub-game/code/server/frameBatch.js +183 -0
- package/kits/hub-game/code/server/friendBests.js +166 -0
- package/kits/hub-game/code/server/friendsAmong.js +272 -0
- package/kits/hub-game/code/server/history.js +7 -0
- package/kits/hub-game/code/server/hub.js +2510 -95
- package/kits/hub-game/code/server/idle.js +60 -12
- package/kits/hub-game/code/server/index.js +28 -6
- package/kits/hub-game/code/server/invites.js +19 -0
- package/kits/hub-game/code/server/labels.js +36 -2
- package/kits/hub-game/code/server/loadAbandon.js +106 -0
- package/kits/hub-game/code/server/manifest.js +586 -7
- package/kits/hub-game/code/server/menu.js +161 -0
- package/kits/hub-game/code/server/npcs.js +1025 -113
- package/kits/hub-game/code/server/observe.js +408 -0
- package/kits/hub-game/code/server/padOccupancy.js +85 -0
- package/kits/hub-game/code/server/party.js +2 -2
- package/kits/hub-game/code/server/players.js +30 -0
- package/kits/hub-game/code/server/resumePose.js +152 -0
- package/kits/hub-game/code/server/say.js +1 -1
- package/kits/hub-game/code/server/shot.js +110 -0
- package/kits/hub-game/code/server/standing.js +123 -0
- package/kits/hub-game/code/server/storageLimit.js +187 -0
- package/kits/hub-game/code/server/vis.js +175 -0
- package/kits/hub-game/code/server/wear.js +12 -0
- package/kits/hub-game/code/server/yours.js +59 -0
- package/kits/hub-game/code/shared/act.js +35 -0
- package/kits/hub-game/code/shared/cues.js +9 -0
- package/kits/hub-game/code/shared/danceIdle.js +28 -0
- package/kits/hub-game/code/shared/decor.js +41 -0
- package/kits/hub-game/code/shared/loadStages.js +12 -0
- package/kits/hub-game/code/shared/quality.js +74 -0
- package/kits/hub-game/code/shared/say.js +2 -0
- package/kits/hub-game/code/shared/shot.js +53 -0
- package/kits/hub-game/code/shared/spin.js +57 -0
- package/kits/hub-game/code/systems/hub.js +1753 -202
- package/kits/hub-game/docs/analytics.md +279 -0
- package/kits/hub-game/docs/content-pack.md +1 -1
- package/kits/hub-game/docs/contract.md +3475 -77
- package/kits/hub-game/docs/home-pieces.md +71 -0
- package/kits/hub-game/docs/observed-progress.md +252 -0
- package/kits/hub-game/main.jsx +2 -0
- package/kits/hub-game/models/avatar-10.pxmodel +28 -0
- package/kits/hub-game/models/avatar-11.pxmodel +28 -0
- package/kits/hub-game/models/avatar-12.pxmodel +27 -0
- package/kits/hub-game/models/avatar-13.pxmodel +24 -0
- package/kits/hub-game/models/avatar-14.pxmodel +29 -0
- package/kits/hub-game/models/avatar-15.pxmodel +24 -0
- package/kits/hub-game/models/avatar-4.pxmodel +29 -0
- package/kits/hub-game/models/avatar-5.pxmodel +27 -0
- package/kits/hub-game/models/avatar-6.pxmodel +26 -0
- package/kits/hub-game/models/avatar-7.pxmodel +25 -0
- package/kits/hub-game/models/avatar-8.pxmodel +24 -0
- package/kits/hub-game/models/avatar-9.pxmodel +30 -0
- package/kits/hub-game/models/earned/badge-round.pxmodel +100 -0
- package/kits/hub-game/models/earned/badge-shield.pxmodel +117 -0
- package/kits/hub-game/models/earned/badge-star.pxmodel +87 -0
- package/kits/hub-game/models/earned/belt-plain.pxmodel +72 -0
- package/kits/hub-game/models/earned/held-ball.pxmodel +43 -0
- package/kits/hub-game/models/earned/held-lantern.pxmodel +85 -0
- package/kits/hub-game/models/earned/held-net.pxmodel +57 -0
- package/kits/hub-game/models/earned/held-trophy.pxmodel +109 -0
- package/kits/hub-game/models/earned/pin-round.pxmodel +62 -0
- package/kits/hub-game/models/earned/sash-plain.pxmodel +66 -0
- package/kits/hub-game/models/earned/square/belt-plain.pxmodel +104 -0
- package/kits/hub-game/models/earned/square/sash-plain.pxmodel +98 -0
- package/kits/hub-game/models/hats/bat-clip.pxmodel +206 -0
- package/kits/hub-game/models/hats/beekeeper.pxmodel +149 -0
- package/kits/hub-game/models/hats/cap.pxmodel +162 -0
- package/kits/hub-game/models/hats/captain.pxmodel +178 -0
- package/kits/hub-game/models/hats/crooked-top.pxmodel +172 -0
- package/kits/hub-game/models/hats/flower-crown.pxmodel +451 -0
- package/kits/hub-game/models/hats/foam-crown.pxmodel +179 -0
- package/kits/hub-game/models/hats/lantern.pxmodel +230 -0
- package/kits/hub-game/models/hats/laurel.pxmodel +533 -0
- package/kits/hub-game/models/hats/lighthouse.pxmodel +96 -0
- package/kits/hub-game/models/hats/sailor.pxmodel +141 -0
- package/kits/hub-game/models/hats/souwester.pxmodel +131 -0
- package/kits/hub-game/models/hats/straw.pxmodel +139 -0
- package/kits/hub-game/models/hats/sunflower.pxmodel +406 -0
- package/kits/hub-game/models/hats/sweatband.pxmodel +112 -0
- package/kits/hub-game/models/hats/witch.pxmodel +147 -0
- package/kits/hub-game/package-lock.json +10 -1
- package/kits/hub-game/package.json +6 -2
- package/kits/hub-game/play/player.js +142 -0
- package/kits/hub-game/play/registry.js +47 -0
- package/kits/hub-game/play.jsx +37 -0
- package/kits/hub-game/scripts/check.mjs +117 -16
- package/kits/hub-game/scripts/companion-follower-wire.json +1 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +132 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless.json +293 -0
- package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +26 -0
- package/kits/hub-game/scripts/fixtures/fake-dom.mjs +123 -0
- package/kits/hub-game/scripts/fixtures/interest-legacy.json +385 -0
- package/kits/hub-game/scripts/fixtures/npc-notes-v1.77.jsonl +4 -0
- package/kits/hub-game/scripts/fixtures/vis-shared-wire.json +1 -0
- package/kits/hub-game/scripts/gen-avatars.mjs +933 -16
- package/kits/hub-game/scripts/gen-earned.mjs +285 -0
- package/kits/hub-game/scripts/gen-hats.mjs +827 -0
- package/kits/hub-game/scripts/grab.before-orbit.mjs +400 -0
- package/kits/hub-game/scripts/pose-storage-fixture.mjs +46 -0
- package/kits/hub-game/scripts/soundscape-wave-analysis.mjs +125 -0
- package/kits/hub-game/scripts/test-act-client.mjs +186 -0
- package/kits/hub-game/scripts/test-act.mjs +171 -0
- package/kits/hub-game/scripts/test-action-layout.mjs +80 -0
- package/kits/hub-game/scripts/test-action-observers.mjs +46 -0
- package/kits/hub-game/scripts/test-actions-client.mjs +853 -0
- package/kits/hub-game/scripts/test-actions.mjs +298 -0
- package/kits/hub-game/scripts/test-actor-budget.mjs +44 -0
- package/kits/hub-game/scripts/test-actors.mjs +38 -23
- package/kits/hub-game/scripts/test-analytics.mjs +76 -0
- package/kits/hub-game/scripts/test-anonymous-entry.mjs +28 -0
- package/kits/hub-game/scripts/test-arrival-pose-server.mjs +196 -0
- package/kits/hub-game/scripts/test-arrival-pose.mjs +24 -0
- package/kits/hub-game/scripts/test-ask-client.mjs +358 -0
- package/kits/hub-game/scripts/test-ask-slot.mjs +85 -0
- package/kits/hub-game/scripts/test-ask.mjs +269 -0
- package/kits/hub-game/scripts/test-attention.mjs +10 -1
- package/kits/hub-game/scripts/test-avatar-cap.mjs +379 -0
- package/kits/hub-game/scripts/test-avatar-colors.mjs +72 -0
- package/kits/hub-game/scripts/test-avatar-models.mjs +181 -0
- package/kits/hub-game/scripts/test-avatar-share.mjs +318 -0
- package/kits/hub-game/scripts/test-avatar-wire.mjs +792 -0
- package/kits/hub-game/scripts/test-avatar.mjs +584 -7
- package/kits/hub-game/scripts/test-back-visibility.mjs +82 -0
- package/kits/hub-game/scripts/test-ballot.mjs +1008 -0
- package/kits/hub-game/scripts/test-ban-join.mjs +121 -13
- package/kits/hub-game/scripts/test-build.mjs +49 -0
- package/kits/hub-game/scripts/test-cells.mjs +71 -0
- package/kits/hub-game/scripts/test-chat.mjs +863 -0
- package/kits/hub-game/scripts/test-classic.mjs +2 -0
- package/kits/hub-game/scripts/test-companion-chat.mjs +216 -0
- package/kits/hub-game/scripts/test-companion-client.mjs +1167 -0
- package/kits/hub-game/scripts/test-companion.mjs +259 -0
- package/kits/hub-game/scripts/test-control-layout-dom.mjs +120 -0
- package/kits/hub-game/scripts/test-crowd-names.mjs +205 -0
- package/kits/hub-game/scripts/test-decor-client.mjs +344 -0
- package/kits/hub-game/scripts/test-decor.mjs +464 -0
- package/kits/hub-game/scripts/test-default-environment-root.mjs +95 -0
- package/kits/hub-game/scripts/test-default-environment.mjs +267 -0
- package/kits/hub-game/scripts/test-door-analytics.mjs +58 -0
- package/kits/hub-game/scripts/test-door-jump.mjs +100 -0
- package/kits/hub-game/scripts/test-earned-client.mjs +459 -0
- package/kits/hub-game/scripts/test-earned.mjs +1224 -0
- package/kits/hub-game/scripts/test-emote-bubble.mjs +110 -0
- package/kits/hub-game/scripts/test-far-avatars.mjs +340 -0
- package/kits/hub-game/scripts/test-fps-telemetry.mjs +112 -0
- package/kits/hub-game/scripts/test-frame-batch.mjs +252 -0
- package/kits/hub-game/scripts/test-fresh-friends.mjs +118 -0
- package/kits/hub-game/scripts/test-friend-bests.mjs +435 -0
- package/kits/hub-game/scripts/test-grab-orbit.mjs +961 -0
- package/kits/hub-game/scripts/test-grab.mjs +7 -0
- package/kits/hub-game/scripts/test-hats.mjs +422 -168
- package/kits/hub-game/scripts/test-high-only.mjs +170 -0
- package/kits/hub-game/scripts/test-hub-leaving.mjs +203 -0
- package/kits/hub-game/scripts/test-hub-ops.mjs +758 -2
- package/kits/hub-game/scripts/test-hub-trip.mjs +1594 -12
- package/kits/hub-game/scripts/test-hud-clear.mjs +484 -57
- package/kits/hub-game/scripts/test-hud-defects-dom.mjs +100 -0
- package/kits/hub-game/scripts/test-hud-rate.mjs +224 -0
- package/kits/hub-game/scripts/test-hud-safe-visibility-dom.mjs +83 -0
- package/kits/hub-game/scripts/test-idle.mjs +427 -1
- package/kits/hub-game/scripts/test-interest-cap.mjs +36 -0
- package/kits/hub-game/scripts/test-interest-cells.mjs +513 -0
- package/kits/hub-game/scripts/test-interest-client.mjs +118 -0
- package/kits/hub-game/scripts/test-interest.mjs +15 -0
- package/kits/hub-game/scripts/test-invites-client.mjs +430 -0
- package/kits/hub-game/scripts/test-invites.mjs +109 -0
- package/kits/hub-game/scripts/test-keys.mjs +46 -1
- package/kits/hub-game/scripts/test-labels.mjs +664 -0
- package/kits/hub-game/scripts/test-landscape-layout.mjs +194 -0
- package/kits/hub-game/scripts/test-list-scroll-dom.mjs +49 -0
- package/kits/hub-game/scripts/test-load-abandon.mjs +246 -0
- package/kits/hub-game/scripts/test-loading-cover.mjs +162 -0
- package/kits/hub-game/scripts/test-manifest.mjs +472 -0
- package/kits/hub-game/scripts/test-menu-client.mjs +585 -0
- package/kits/hub-game/scripts/test-menu.mjs +319 -0
- package/kits/hub-game/scripts/test-npcs.mjs +2528 -13
- package/kits/hub-game/scripts/test-object-entry.mjs +76 -0
- package/kits/hub-game/scripts/test-observed.mjs +745 -0
- package/kits/hub-game/scripts/test-pack.mjs +7 -0
- package/kits/hub-game/scripts/test-pad-cues.mjs +304 -0
- package/kits/hub-game/scripts/test-pad-occupancy.mjs +177 -0
- package/kits/hub-game/scripts/test-picker.mjs +541 -0
- package/kits/hub-game/scripts/test-placement-cache.mjs +690 -0
- package/kits/hub-game/scripts/test-progress-reset.mjs +559 -0
- package/kits/hub-game/scripts/test-push-visit.mjs +26 -0
- package/kits/hub-game/scripts/test-quality.mjs +385 -0
- package/kits/hub-game/scripts/test-rehello.mjs +1733 -0
- package/kits/hub-game/scripts/test-relations-among.mjs +222 -0
- package/kits/hub-game/scripts/test-relations-refresh.mjs +188 -0
- package/kits/hub-game/scripts/test-resume-action-order.mjs +598 -0
- package/kits/hub-game/scripts/test-resume-held.mjs +239 -0
- package/kits/hub-game/scripts/test-resume-pose.mjs +142 -0
- package/kits/hub-game/scripts/test-safe-events-dom.mjs +116 -0
- package/kits/hub-game/scripts/test-safe-layout.mjs +330 -0
- package/kits/hub-game/scripts/test-say.mjs +1 -1
- package/kits/hub-game/scripts/test-shot.mjs +901 -0
- package/kits/hub-game/scripts/test-signin-client.mjs +45 -0
- package/kits/hub-game/scripts/test-soundscape.mjs +5437 -0
- package/kits/hub-game/scripts/test-spin.mjs +314 -0
- package/kits/hub-game/scripts/test-standing.mjs +449 -0
- package/kits/hub-game/scripts/test-storage-limit.mjs +333 -0
- package/kits/hub-game/scripts/test-stuck.mjs +1904 -0
- package/kits/hub-game/scripts/test-talk-overlay-dom.mjs +130 -0
- package/kits/hub-game/scripts/test-tier-cells.mjs +706 -0
- package/kits/hub-game/scripts/test-tiers-render.mjs +412 -0
- package/kits/hub-game/scripts/test-tiers.mjs +476 -2
- package/kits/hub-game/scripts/test-toast-band.mjs +61 -0
- package/kits/hub-game/scripts/test-try-on.mjs +22 -22
- package/kits/hub-game/scripts/test-vis.mjs +770 -0
- package/kits/hub-game/scripts/test-visibility.mjs +134 -0
- package/kits/hub-game/scripts/test-weakest-tier.mjs +924 -0
- package/kits/hub-game/scripts/test-world-labels.mjs +367 -0
- package/kits/hub-game/scripts/test-yours-chrome.mjs +210 -0
- package/kits/hub-game/scripts/test-yours.mjs +403 -0
- package/kits/multiplayer-3d/CLAUDE.md +50 -0
- package/kits/multiplayer-3d/castle.json +5 -5
- package/kits/multiplayer-3d/code/client/avatars.js +7 -0
- package/kits/multiplayer-3d/code/client/gait.js +65 -0
- package/kits/multiplayer-3d/code/client/joinFailure.js +27 -0
- package/kits/multiplayer-3d/code/client/nameTags.js +59 -4
- package/kits/multiplayer-3d/code/client/resumeGate.js +139 -0
- package/kits/multiplayer-3d/code/options.js +5 -0
- package/kits/multiplayer-3d/code/server/ownership.js +10 -2
- package/kits/multiplayer-3d/code/server/sceneBodies.js +12 -0
- package/kits/multiplayer-3d/code/server/world.js +7 -0
- package/kits/multiplayer-3d/code/systems/multiplayer.js +443 -34
- package/kits/multiplayer-3d/package-lock.json +8 -1
- package/kits/multiplayer-3d/package.json +3 -1
- package/kits/multiplayer-3d/scripts/fixtures/README.md +11 -0
- package/kits/multiplayer-3d/scripts/fixtures/ownership-legacy.json +2 -0
- package/kits/multiplayer-3d/scripts/ownership-harness.mjs +102 -0
- package/kits/multiplayer-3d/scripts/ownership-loader.mjs +46 -0
- package/kits/multiplayer-3d/scripts/ownership-worker.mjs +15 -0
- package/kits/multiplayer-3d/scripts/record-ownership-session.mjs +98 -0
- package/kits/multiplayer-3d/scripts/test-eligible-claims.mjs +167 -0
- package/kits/multiplayer-3d/scripts/test-join-watchdog.mjs +436 -0
- package/kits/multiplayer-3d/scripts/test-own-name-tag.mjs +247 -0
- package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +624 -0
- package/kits/physics-2d/CLAUDE.md +19 -1
- package/kits/physics-2d/castle.json +2 -2
- package/kits/physics-2d/engine/frozenActors.js +233 -0
- package/kits/physics-2d/engine/scene.js +337 -3
- package/kits/physics-2d/engine/skyKey.js +129 -0
- package/kits/physics-2d/engine/stillClock.js +106 -0
- package/kits/physics-2d/engine/updateBudget.js +21 -0
- package/kits/physics-2d/eslint.config.js +1 -1
- package/kits/physics-2d/play/behaviors/AnalogStick.js +198 -0
- package/kits/physics-2d/play/behaviors/Camera.js +40 -0
- package/kits/physics-2d/play/behaviors/Collider.js +122 -0
- package/kits/physics-2d/play/behaviors/Draggable.js +115 -0
- package/kits/physics-2d/play/behaviors/Goal.js +46 -0
- package/kits/physics-2d/play/behaviors/Joints.js +126 -0
- package/kits/physics-2d/play/behaviors/Layout.js +71 -0
- package/kits/physics-2d/play/behaviors/RigidBody.js +57 -0
- package/kits/physics-2d/play/behaviors/Slingshot.js +142 -0
- package/kits/physics-2d/play/behaviors/SoundPlayer.js +263 -0
- package/kits/physics-2d/play/behaviors/Sprite.js +406 -0
- package/kits/physics-2d/play/behaviors/Style.js +209 -0
- package/kits/physics-2d/play/behaviors/Text.js +85 -0
- package/kits/physics-2d/play/behaviors/Video.js +93 -0
- package/kits/physics-2d/scripts/test-skip-unchanged.mjs +326 -1
- package/kits/physics-3d/CLAUDE.md +42 -529
- package/kits/physics-3d/behaviors/Body.jsx +3 -0
- package/kits/physics-3d/behaviors/Model.jsx +3 -0
- package/kits/physics-3d/behaviors/Player.jsx +661 -87
- package/kits/physics-3d/behaviors/Shape.jsx +3 -0
- package/kits/physics-3d/behaviors/Solid.jsx +3 -0
- package/kits/physics-3d/behaviors/Transform.jsx +3 -0
- package/kits/physics-3d/castle.json +3 -3
- package/kits/physics-3d/docs/engine-camera.md +542 -0
- package/kits/physics-3d/docs/engine-frame-cap.md +136 -0
- package/kits/physics-3d/docs/engine-load.md +149 -0
- package/kits/physics-3d/docs/engine-look.md +114 -0
- package/kits/physics-3d/docs/engine-shadows.md +372 -0
- package/kits/physics-3d/docs/engine-skip-work.md +187 -0
- package/kits/physics-3d/docs/engine-sky.md +198 -0
- package/kits/physics-3d/docs/engine-static-actors.md +226 -0
- package/kits/physics-3d/docs/engine-view.md +37 -0
- package/kits/physics-3d/docs/pxmodel-format.md +9 -1
- package/kits/physics-3d/engine3d/PlayOnly3D.jsx +5 -1
- package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +19 -277
- package/kits/physics-3d/engine3d/actornode.js +87 -0
- package/kits/physics-3d/engine3d/animationBudget.js +23 -0
- package/kits/physics-3d/engine3d/branches.js +3 -13
- package/kits/physics-3d/engine3d/cage.js +2 -7
- package/kits/physics-3d/engine3d/cageops.js +2 -17
- package/kits/physics-3d/engine3d/dataBehaviors.js +12 -0
- package/kits/physics-3d/engine3d/editorWorld.js +6 -0
- package/kits/physics-3d/engine3d/emptynodes.js +232 -0
- package/kits/physics-3d/engine3d/framecap.js +99 -0
- package/kits/physics-3d/engine3d/frozenphysics.js +140 -0
- package/kits/physics-3d/engine3d/frozenstatics.js +273 -0
- package/kits/physics-3d/engine3d/gait.js +126 -0
- package/kits/physics-3d/engine3d/initialModelFiles.js +18 -0
- package/kits/physics-3d/engine3d/kithooks.js +47 -0
- package/kits/physics-3d/engine3d/look.js +514 -48
- package/kits/physics-3d/engine3d/lookbake.js +208 -0
- package/kits/physics-3d/engine3d/materialpresets.js +2 -0
- package/kits/physics-3d/engine3d/modelFiles.js +3 -17
- package/kits/physics-3d/engine3d/modelMath.js +49 -0
- package/kits/physics-3d/engine3d/modelready.js +16 -0
- package/kits/physics-3d/engine3d/motion.js +39 -10
- package/kits/physics-3d/engine3d/nearshadows.js +106 -21
- package/kits/physics-3d/engine3d/optimize.js +9 -5
- package/kits/physics-3d/engine3d/orbitinput.js +522 -10
- package/kits/physics-3d/engine3d/orbitlens.js +48 -0
- package/kits/physics-3d/engine3d/ownmodel.js +213 -0
- package/kits/physics-3d/engine3d/partgeometry.js +1 -16
- package/kits/physics-3d/engine3d/paths.js +1 -9
- package/kits/physics-3d/engine3d/playTimings.js +50 -0
- package/kits/physics-3d/engine3d/playerRun.js +372 -0
- package/kits/physics-3d/engine3d/pxmodel.js +42 -11
- package/kits/physics-3d/engine3d/rapier.js +27 -0
- package/kits/physics-3d/engine3d/scatter.js +1 -11
- package/kits/physics-3d/engine3d/shadowfade.js +890 -0
- package/kits/physics-3d/engine3d/sky.js +547 -0
- package/kits/physics-3d/engine3d/skylife.js +306 -0
- package/kits/physics-3d/engine3d/squarefirst.js +177 -0
- package/kits/physics-3d/engine3d/stillshadows.js +399 -0
- package/kits/physics-3d/engine3d/sweep.js +1 -25
- package/kits/physics-3d/engine3d/unchanged.js +11 -0
- package/kits/physics-3d/engine3d/viewrange.js +52 -0
- package/kits/physics-3d/engine3d/world3d.js +1253 -76
- package/kits/physics-3d/eslint.config.js +2 -1
- package/kits/physics-3d/main.jsx +10 -2
- package/kits/physics-3d/package-lock.json +7 -0
- package/kits/physics-3d/package.json +5 -1
- package/kits/physics-3d/play/behaviors/Body.js +31 -0
- package/kits/physics-3d/play/behaviors/Door.js +37 -0
- package/kits/physics-3d/play/behaviors/Lookable.js +16 -0
- package/kits/physics-3d/play/behaviors/Model.js +23 -0
- package/kits/physics-3d/play/behaviors/Pickup.js +46 -0
- package/kits/physics-3d/play/behaviors/Player.js +1204 -0
- package/kits/physics-3d/play/behaviors/Shape.js +47 -0
- package/kits/physics-3d/play/behaviors/Solid.js +16 -0
- package/kits/physics-3d/play/behaviors/Transform.js +29 -0
- package/kits/physics-3d/pnpm-lock.yaml +8 -0
- package/kits/physics-3d/scripts/bench-shadow-fade.mjs +37 -0
- package/kits/physics-3d/scripts/build-rapier-gz.mjs +56 -0
- package/kits/physics-3d/scripts/frozen-statics-fixture.mjs +141 -0
- package/kits/physics-3d/scripts/look-baseline.mjs +155 -0
- package/kits/physics-3d/scripts/test-camera-follow.mjs +5 -1
- package/kits/physics-3d/scripts/test-camera-orbit.mjs +2613 -82
- package/kits/physics-3d/scripts/test-drop-empty-parts.mjs +2 -2
- package/kits/physics-3d/scripts/test-empty-gait-hints.mjs +89 -0
- package/kits/physics-3d/scripts/test-frame-cap-bob.mjs +438 -0
- package/kits/physics-3d/scripts/test-frame-cap.mjs +452 -0
- package/kits/physics-3d/scripts/test-frozen-nested.mjs +49 -0
- package/kits/physics-3d/scripts/test-frozen-statics-legacy-physics2d.mjs +123 -0
- package/kits/physics-3d/scripts/test-frozen-statics.mjs +434 -0
- package/kits/physics-3d/scripts/test-gait.mjs +387 -0
- package/kits/physics-3d/scripts/test-look-bake.mjs +1056 -0
- package/kits/physics-3d/scripts/test-model-parse-cache.mjs +92 -0
- package/kits/physics-3d/scripts/test-near-shadows.mjs +5 -2
- package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +2001 -0
- package/kits/physics-3d/scripts/test-orbit-shift-lock.mjs +582 -0
- package/kits/physics-3d/scripts/test-orbit-shot.mjs +657 -0
- package/kits/physics-3d/scripts/test-orbit-view.mjs +230 -0
- package/kits/physics-3d/scripts/test-rapier-gz.mjs +106 -0
- package/kits/physics-3d/scripts/test-skip-empty-nodes.mjs +845 -0
- package/kits/physics-3d/scripts/test-sky.mjs +2470 -0
- package/kits/physics-3d/scripts/test-square-first.mjs +921 -0
- package/kits/physics-3d/scripts/test-static-actors.mjs +10 -1
- package/kits/physics-3d/scripts/test-static-physics.mjs +4 -1
- package/kits/physics-3d/scripts/test-static-scenery.mjs +2174 -0
- package/kits/physics-3d/scripts/test-steady-hover.mjs +7 -2
- package/kits/physics-3d/scripts/test-still-shadows.mjs +477 -0
- package/kits/physics-3d/scripts/test-view-range.mjs +260 -0
- package/kits/physics-3d/systems/physics3d.js +419 -9
- package/kits/real-time/castle.json +2 -2
- package/kits/real-time/code/client/connection.js +33 -10
- package/kits/real-time/code/client/gameHooks.js +2 -0
- package/kits/real-time/code/client/joinOverlay.js +9 -4
- package/kits/real-time/code/server/gameHooks.js +7 -0
- package/kits/real-time/code/server/session.js +102 -22
- package/kits/real-time/package-lock.json +1 -1
- package/package.json +2 -2
- package/dist/shell/assets/index-Cf61cNfT.css +0 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { fakeDom } from './fixtures/fake-dom.mjs';
|
|
4
|
+
import { landscapeViewport, watchViewport } from '../code/client/landscapeLayout.js';
|
|
5
|
+
import { makeChrome } from '../code/client/chrome.js';
|
|
6
|
+
import { makeBallot } from '../code/client/ballot.js';
|
|
7
|
+
|
|
8
|
+
function eventWindow(width, height) {
|
|
9
|
+
const handlers = new Map();
|
|
10
|
+
Object.assign(window, {
|
|
11
|
+
innerWidth: width, innerHeight: height,
|
|
12
|
+
addEventListener(type, fn, options) {
|
|
13
|
+
const list = handlers.get(type) ?? new Set();
|
|
14
|
+
list.add(fn); handlers.set(type, list);
|
|
15
|
+
options?.signal?.addEventListener('abort', () => list.delete(fn), { once: true });
|
|
16
|
+
},
|
|
17
|
+
removeEventListener(type, fn) { handlers.get(type)?.delete(fn); },
|
|
18
|
+
});
|
|
19
|
+
window.emit = (type) => { for (const fn of handlers.get(type) ?? []) fn(); };
|
|
20
|
+
window.count = (type) => handlers.get(type)?.size ?? 0;
|
|
21
|
+
return window;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const styles = (node) => Object.fromEntries(Object.entries(node.styles).filter(([, value]) => value !== ''));
|
|
25
|
+
const byText = (dom, text) => dom.made.find((node) => node.textContent === text);
|
|
26
|
+
|
|
27
|
+
// Run the system's real chrome setup against the DOM fixture. A legacy town
|
|
28
|
+
// without companionChat must discover Shift lock too, before drawing controls.
|
|
29
|
+
const systemSource = readFileSync(new URL('../code/systems/hub.js', import.meta.url), 'utf8');
|
|
30
|
+
const setupSource = systemSource.slice(systemSource.indexOf(' this.chrome.setWorldLabelFocus'), systemSource.indexOf(' Avatar.load(scene);'));
|
|
31
|
+
const setupChrome = new Function('Hub', 'scene', 'worldLabelFocus', setupSource);
|
|
32
|
+
for (const [width, height] of [[844, 390], [667, 375], [932, 430], [1440, 900]]) {
|
|
33
|
+
const dom = fakeDom({ viewW: width, viewH: height });
|
|
34
|
+
eventWindow(width, height);
|
|
35
|
+
const chrome = makeChrome({ avatarCount: 4, onBack() {}, onAvatar() {} });
|
|
36
|
+
chrome.showPicker(true, 0);
|
|
37
|
+
chrome.setEmotes([['wave', '👋']]);
|
|
38
|
+
chrome.setSay({ reactions: [], phrases: [] });
|
|
39
|
+
const lock = document.createElement('button');
|
|
40
|
+
lock.rect = { left: width - 60, right: width - 16, top: height - 60, bottom: height - 16 };
|
|
41
|
+
const scene = { persistent: {}, three: { renderer: { domElement: { parentElement: { querySelector: () => lock } } } } };
|
|
42
|
+
const hub = { deck: {}, hub: {} }; // no safeInsets, Act or companion
|
|
43
|
+
setupChrome.call({ chrome }, hub, scene, () => false);
|
|
44
|
+
const controls = [byText(dom, 'Character').parent,
|
|
45
|
+
dom.made.find(node => node.attrs['aria-label'] === 'Emote'),
|
|
46
|
+
dom.made.find(node => node.attrs['aria-label'] === 'Quick chat')];
|
|
47
|
+
assert.match(controls[0].style.bottom, /62px/, `${width}x${height}: engine clearance without Chirp`);
|
|
48
|
+
// Prompt setters may relayout the rail later in the same frame.
|
|
49
|
+
chrome.grabPrompt(null); chrome.sitPrompt(null); chrome.talkPrompt(null);
|
|
50
|
+
assert.match(controls[0].style.bottom, /62px/, 'clearance survives later prompt setters');
|
|
51
|
+
setupChrome.call({ chrome }, hub, scene, () => false);
|
|
52
|
+
assert.match(controls[0].style.bottom, /62px/, 'repeated frames do not accumulate clearance');
|
|
53
|
+
lock.style.display = 'none';
|
|
54
|
+
setupChrome.call({ chrome }, hub, scene, () => false);
|
|
55
|
+
assert.match(controls[0].style.bottom, /max\(10px/, 'hidden engine control releases clearance');
|
|
56
|
+
lock.style.display = '';
|
|
57
|
+
setupChrome.call({ chrome }, hub, scene, () => false);
|
|
58
|
+
assert.match(controls[0].style.bottom, /62px/, 'engine control can reappear');
|
|
59
|
+
chrome.dispose();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
for (const [w, h, expected] of [[740, 360, true], [851, 393, true], [1180, 820, true], [360, 740, false], [500, 500, false]]) {
|
|
63
|
+
assert.equal(landscapeViewport({ innerWidth: w, innerHeight: h }), expected, `${w}x${h}`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
{
|
|
67
|
+
fakeDom({ viewW: 360, viewH: 740 });
|
|
68
|
+
const view = eventWindow(360, 740);
|
|
69
|
+
let changes = 0;
|
|
70
|
+
const unwatch = watchViewport(() => { changes += 1; }, view);
|
|
71
|
+
view.emit('resize'); view.emit('orientationchange'); assert.equal(changes, 2);
|
|
72
|
+
unwatch(); view.emit('resize'); view.emit('orientationchange'); assert.equal(changes, 2);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
{
|
|
76
|
+
const dom = fakeDom({ viewW: 360, viewH: 740 });
|
|
77
|
+
const view = eventWindow(360, 740);
|
|
78
|
+
const chrome = makeChrome({ avatarCount: 4, onBack() {}, onAvatar() {} });
|
|
79
|
+
const root = dom.body.children[0];
|
|
80
|
+
const back = byText(dom, '‹ Town');
|
|
81
|
+
const hud = root.children.find((node) => node.style.textShadow?.includes('rgba(0,0,0,0.95)'));
|
|
82
|
+
const toast = dom.made.find((node) => node.dataset.hub === 'toast');
|
|
83
|
+
const dock = byText(dom, 'Doors').parent;
|
|
84
|
+
chrome.showPicker(true, 0); chrome.grabPrompt('Grab');
|
|
85
|
+
chrome.setEmotes([['wave', '👋']]); chrome.setSay({ reactions: [], phrases: [] });
|
|
86
|
+
chrome.sitPrompt('Sit'); chrome.talkPrompt('Innes'); chrome.nearPrompt('Invite Ada', () => {});
|
|
87
|
+
const emote = dom.made.find((node) => node.attrs['aria-label'] === 'Emote');
|
|
88
|
+
const say = dom.made.find((node) => node.attrs['aria-label'] === 'Quick chat');
|
|
89
|
+
const emoteRow = dom.made.find((node) => node.style.borderRadius === '28px' && node.style.right === '80px');
|
|
90
|
+
const sayCard = dom.made.find((node) => node.style.width === 'min(70vw, 236px)');
|
|
91
|
+
const panel = dom.made.find((node) => node.style.width === 'min(92vw, 420px)');
|
|
92
|
+
const pickerCard = dom.made.find((node) => node.style.maxWidth === 'calc(100vw - 20px)');
|
|
93
|
+
const pickerGrid = pickerCard.children.find((node) => node.style.display === 'grid');
|
|
94
|
+
const rail = [byText(dom, 'Character').parent, byText(dom, 'Grab'), emote, say, byText(dom, 'Sit'), byText(dom, 'Talk to Innes'), byText(dom, 'Invite Ada')];
|
|
95
|
+
const baselineNodes = [back, hud, toast, dock, ...rail, emoteRow, sayCard, panel];
|
|
96
|
+
const baseline = new Map(baselineNodes.map((node) => [node, styles(node)]));
|
|
97
|
+
|
|
98
|
+
for (const [width, height, signal] of [[740, 360, 'resize'], [851, 393, 'orientationchange'], [1180, 820, 'resize']]) {
|
|
99
|
+
view.innerWidth = width; view.innerHeight = height; view.emit(signal);
|
|
100
|
+
assert.equal(back.style.left, '76px');
|
|
101
|
+
assert.equal(back.style.top, 'max(12px, env(safe-area-inset-top))');
|
|
102
|
+
assert.equal(hud.style.left, '50%'); assert.equal(toast.style.left, '50%');
|
|
103
|
+
assert.equal(dock.style.bottom, ''); assert.match(dock.style.top, /safe-area-inset-top/);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
view.innerWidth = 740; view.innerHeight = 360; view.emit('resize');
|
|
107
|
+
byText(dom, 'Character').handlers.pointerdown({ stopPropagation() {} });
|
|
108
|
+
assert.equal(pickerGrid.style.gridTemplateColumns, 'repeat(4, 64px)');
|
|
109
|
+
assert.equal(pickerCard.style.maxHeight, 'calc(100dvh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom))', 'the sheet is capped to what is over its button');
|
|
110
|
+
assert.ok(4 * 64 + 3 * 6 + 16 <= view.innerWidth - 344, 'picker outer box clears both 172px side reserves');
|
|
111
|
+
byText(dom, 'Character').handlers.pointerdown({ stopPropagation() {} });
|
|
112
|
+
const places = new Set(rail.map((node) => `${node.style.right}/${node.style.bottom}`));
|
|
113
|
+
assert.equal(places.size, rail.length, 'dense action rail wraps without overlap');
|
|
114
|
+
for (const node of rail) { assert.match(node.style.bottom, /safe-area-inset-bottom/); }
|
|
115
|
+
const shiftLock = document.createElement('button');
|
|
116
|
+
shiftLock.rect = { left: 680, right: 724, top: 306, bottom: 350 };
|
|
117
|
+
chrome.layoutCompanion({ querySelector: () => shiftLock });
|
|
118
|
+
assert.match(rail[0].style.bottom, /62px/, 'rail clears the 44px Shift lock plus its 8px gap');
|
|
119
|
+
assert.equal(pickerCard.style.maxHeight, 'calc(100dvh - 132px - env(safe-area-inset-top) - env(safe-area-inset-bottom))', 'and to what is over the lifted button');
|
|
120
|
+
chrome.grabPrompt('Grab'); chrome.sitPrompt('Sit'); chrome.talkPrompt('Innes');
|
|
121
|
+
assert.match(rail[0].style.bottom, /62px/, 'repeated prompt setters retain the Shift-lock lift');
|
|
122
|
+
emote.handlers.pointerdown({ stopPropagation() {}, preventDefault() {} });
|
|
123
|
+
assert.equal(emoteRow.style.display, 'flex'); assert.equal(emoteRow.style.bottom, emote.style.bottom);
|
|
124
|
+
assert.ok(parseFloat(emoteRow.style.right) >= 184, 'open emotes clear the complete action lane');
|
|
125
|
+
say.handlers.pointerdown({ stopPropagation() {}, preventDefault() {} });
|
|
126
|
+
assert.equal(emoteRow.style.display, 'none'); assert.equal(sayCard.style.display, 'flex');
|
|
127
|
+
assert.equal(sayCard.style.bottom, say.style.bottom); assert.match(sayCard.style.maxHeight, /100dvh/);
|
|
128
|
+
assert.ok(parseFloat(sayCard.style.right) >= 184, 'quick chat clears the complete action lane');
|
|
129
|
+
view.innerWidth = 851; view.innerHeight = 393; view.emit('orientationchange');
|
|
130
|
+
assert.equal(sayCard.style.bottom, say.style.bottom, 'open card follows its button on resize');
|
|
131
|
+
say.handlers.pointerdown({ stopPropagation() {}, preventDefault() {} });
|
|
132
|
+
chrome.openTalk('Innes');
|
|
133
|
+
assert.match(panel.style.maxHeight, /100dvh/); assert.equal(panel.style.overflow, 'hidden');
|
|
134
|
+
assert.equal(panel.style.boxSizing, 'border-box', 'talk dimensions include its padding');
|
|
135
|
+
chrome.closeTalk(); chrome.talkPrompt('Innes');
|
|
136
|
+
chrome.layoutCompanion({ querySelector: () => null });
|
|
137
|
+
|
|
138
|
+
view.innerWidth = 360; view.innerHeight = 740; view.emit('resize');
|
|
139
|
+
for (const [node, before] of baseline) assert.deepEqual(styles(node), before, `${node.id} portrait restored`);
|
|
140
|
+
chrome.dispose();
|
|
141
|
+
assert.equal(view.count('resize'), 0); assert.equal(view.count('orientationchange'), 0);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
{
|
|
145
|
+
const dom = fakeDom({ viewW: 740, viewH: 360 });
|
|
146
|
+
eventWindow(740, 360);
|
|
147
|
+
const ballot = makeBallot({ send() {} });
|
|
148
|
+
ballot.frame({
|
|
149
|
+
v: 1, mode: 'vote', title: 'Pick a route', text: 'Where should town go next?',
|
|
150
|
+
faces: [{ id: 'p1' }, { id: 'p2' }, { id: 'p3' }, { id: 'p4' }],
|
|
151
|
+
options: [{ id: 'river', text: 'River' }, { id: 'sunny', text: 'Sunny' }],
|
|
152
|
+
lines: [], feed: [], who: { p1: { name: 'Ada', avatar: 0 }, p2: { name: 'Bo', avatar: 1 } },
|
|
153
|
+
}, [], 'p1', 0, 0);
|
|
154
|
+
const root = dom.made.find((node) => node.dataset.hub === 'ballot');
|
|
155
|
+
const sheet = root.children[0];
|
|
156
|
+
const left = dom.made.find((node) => node.style.flex === '1 1 56%');
|
|
157
|
+
const right = dom.made.find((node) => node.style.flex === '1 1 44%');
|
|
158
|
+
const rightBody = right.children[0];
|
|
159
|
+
const vote = right.children.find((node) => node.textContent === 'Vote');
|
|
160
|
+
assert.equal(sheet.style.height, '216px');
|
|
161
|
+
assert.equal(sheet.style.boxSizing, 'border-box');
|
|
162
|
+
assert.equal(left.style.minHeight, '0'); assert.equal(left.style.overflowY, 'auto');
|
|
163
|
+
assert.equal(right.style.minHeight, '0'); assert.equal(right.style.overflowY, 'hidden');
|
|
164
|
+
assert.equal(rightBody.style.minHeight, '0'); assert.equal(rightBody.style.overflowY, 'auto');
|
|
165
|
+
assert.equal(vote.parent, right, 'Vote stays outside the scrolling option body');
|
|
166
|
+
ballot.dispose();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
console.log('landscape layout tests passed');
|
|
170
|
+
|
|
171
|
+
// Doors owns the bottom navigation area while open, including after a HUD
|
|
172
|
+
// refresh. Closing it restores the latest prompt without replaying old copy.
|
|
173
|
+
for (const [width, height] of [[844, 390], [1440, 900], [412, 870]]) {
|
|
174
|
+
const dom = fakeDom({ viewW: width, viewH: height });
|
|
175
|
+
eventWindow(width, height);
|
|
176
|
+
const chrome = makeChrome({ avatarCount: 4, onBack() {}, onAvatar() {} });
|
|
177
|
+
chrome.setDoors([{ id: 'race', title: 'Foot Race' }]);
|
|
178
|
+
chrome.setHud({ text: 'Follow the arrow home.' }, null);
|
|
179
|
+
const prompt = byText(dom, 'Follow the arrow home.');
|
|
180
|
+
const doors = byText(dom, 'Doors');
|
|
181
|
+
assert.equal(prompt.style.display, 'block');
|
|
182
|
+
doors.handlers.pointerdown({ stopPropagation() {} });
|
|
183
|
+
assert.equal(prompt.style.display, 'none', `${width}: open Doors yields prompt`);
|
|
184
|
+
chrome.setHud({ text: 'Follow the arrow to Color Call.' }, null);
|
|
185
|
+
assert.equal(prompt.style.display, 'none', 'frame updates cannot cover Go');
|
|
186
|
+
doors.handlers.pointerdown({ stopPropagation() {} });
|
|
187
|
+
assert.equal(prompt.style.display, 'block');
|
|
188
|
+
assert.equal(prompt.textContent, 'Follow the arrow to Color Call.');
|
|
189
|
+
doors.handlers.pointerdown({ stopPropagation() {} });
|
|
190
|
+
chrome.setHud(null, null);
|
|
191
|
+
doors.handlers.pointerdown({ stopPropagation() {} });
|
|
192
|
+
assert.equal(prompt.style.display, 'none', 'closing does not resurrect cleared HUD');
|
|
193
|
+
chrome.dispose();
|
|
194
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { build } from 'vite';
|
|
3
|
+
import { chromium } from 'playwright-core';
|
|
4
|
+
import { launchChromium, logRenderer } from '../../../experiments/hub-town/qa/launch.mjs';
|
|
5
|
+
|
|
6
|
+
// Exercise the real chrome and browser layout, with enough rows to overflow.
|
|
7
|
+
const bundle = await build({ configFile: false, logLevel: 'silent', build: {
|
|
8
|
+
write: false, lib: { entry: new URL('../code/client/chrome.js', import.meta.url).pathname, name: 'HubChrome', formats: ['iife'] },
|
|
9
|
+
} });
|
|
10
|
+
const browser = await launchChromium(chromium, { executablePath: process.env.CHROME });
|
|
11
|
+
try {
|
|
12
|
+
const page = await browser.newPage({ viewport: { width: 844, height: 390 } });
|
|
13
|
+
await page.setContent('<style>body{margin:0}</style>');
|
|
14
|
+
await logRenderer(page);
|
|
15
|
+
await page.addScriptTag({ content: (Array.isArray(bundle) ? bundle[0] : bundle).output[0].code });
|
|
16
|
+
await page.evaluate(() => {
|
|
17
|
+
globalThis.chrome = HubChrome.makeChrome({ avatarCount: 4 });
|
|
18
|
+
const doors = Array.from({ length: 64 }, (_, i) => ({ id: `door-${i}`, title: `Door ${i}`, solo: true }));
|
|
19
|
+
chrome.setDoors(doors, 'Go', null, { rows: doors.slice(0, 5).map(d => ({ door: d.id, title: d.title, line: 'Best 5 points' })), hearts: [] });
|
|
20
|
+
chrome.setPeople(Array.from({ length: 50 }, (_, i) => ({ key: `p${i}`, username: `Player ${i}`, actions: [] })));
|
|
21
|
+
chrome.setFeed([{ text: 'Feed must clear when list opens' }]);
|
|
22
|
+
});
|
|
23
|
+
for (const view of [{ width: 844, height: 390 }, { width: 390, height: 844 }, { width: 1440, height: 900 }, { width: 740, height: 360 }]) {
|
|
24
|
+
await page.setViewportSize(view);
|
|
25
|
+
for (const label of ['Doors', 'People']) {
|
|
26
|
+
await page.getByRole('button', { name: label === 'People' ? /^People ·/ : label, exact: true }).dispatchEvent('pointerdown');
|
|
27
|
+
// Feed is fed every frame in a running town.
|
|
28
|
+
const result = await page.evaluate(() => {
|
|
29
|
+
chrome.setFeed([{ text: 'Feed must clear when list opens' }]);
|
|
30
|
+
const list = [...document.querySelectorAll('div')].find(n => n.style.overflowY === 'auto' && n.style.touchAction === 'pan-y' && n.style.display === 'flex');
|
|
31
|
+
list.scrollTop = list.scrollHeight;
|
|
32
|
+
const rect = list.getBoundingClientRect();
|
|
33
|
+
const last = list.firstElementChild.lastElementChild.getBoundingClientRect();
|
|
34
|
+
const lastButton = list.firstElementChild.lastElementChild.querySelector('button');
|
|
35
|
+
const target = lastButton?.getBoundingClientRect();
|
|
36
|
+
const hit = target ? document.elementFromPoint(target.x + target.width / 2, target.y + target.height / 2) === lastButton : true;
|
|
37
|
+
return { top: rect.top, bottom: rect.bottom, lastTop: last.top, lastBottom: last.bottom, gap: rect.bottom - last.bottom, client: list.clientHeight, scroll: list.scrollHeight, hit, feed: document.body.textContent.includes('Feed must clear') };
|
|
38
|
+
});
|
|
39
|
+
assert.ok(result.scroll > result.client, `${label} really scrolls`);
|
|
40
|
+
assert.ok(result.top >= 0 && result.bottom <= view.height - 10, `${label} inside ${JSON.stringify(view)}: ${JSON.stringify(result)}`);
|
|
41
|
+
assert.ok(result.lastTop >= result.top && result.lastBottom <= result.bottom - 8, `${label} last row reachable with padding: ${JSON.stringify(result)}`);
|
|
42
|
+
assert.ok(result.hit, `${label} last button hit target`);
|
|
43
|
+
assert.equal(result.feed, false, 'feed clears under open list');
|
|
44
|
+
await page.getByRole('button', { name: label === 'People' ? /^People ·/ : label, exact: true }).dispatchEvent('pointerdown');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
await page.evaluate(() => chrome.dispose());
|
|
48
|
+
console.log('list DOM scroll tests passed: desktop, portrait, two landscape sizes, last-row hit targets and feed');
|
|
49
|
+
} finally { await browser.close(); }
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// v1.138 kind 27 load_abandoned: close before arrival, one timeout, nothing
|
|
2
|
+
// after arrival, no double emission, untrusted client stages, and opt-in.
|
|
3
|
+
import assert from 'node:assert/strict';
|
|
4
|
+
import { register } from 'node:module';
|
|
5
|
+
import * as L from '../code/server/loadAbandon.js';
|
|
6
|
+
import { readManifest, publicPlace } from '../code/server/manifest.js';
|
|
7
|
+
import { setLoadTelemetry, loadTelemetryFor, reportLoadStage } from '../code/client/loadTelemetry.js';
|
|
8
|
+
|
|
9
|
+
const T0 = 1_000_000;
|
|
10
|
+
const { LOAD_STAGES: S, LOAD_REASONS: R, LOAD_ABANDONED_KIND: KIND, LOAD_ABANDON_TIMEOUT_MS: TIMEOUT } = L;
|
|
11
|
+
const ON = { analytics: true, analyticsV111: true, loadTelemetry: true };
|
|
12
|
+
// A transport stand-in: join and leave call the hooks as index.js wires them.
|
|
13
|
+
function world(ids, place = ON, now = T0) {
|
|
14
|
+
const calls = [];
|
|
15
|
+
const roster = [];
|
|
16
|
+
const h = { place: { ...place }, manifest: {}, players: new Map(), sim: { players: new Map() },
|
|
17
|
+
session: { players: roster, hub: { track: (id, event) => { calls.push([id, event]); return Promise.resolve(true); } } } };
|
|
18
|
+
const join = (id, at = now) => { roster.push({ playerId: id }); L.join(h, h.session, id, at); };
|
|
19
|
+
const leave = (id, at) => { roster.splice(roster.findIndex((p) => p.playerId === id), 1); L.leave(h, id, at); };
|
|
20
|
+
for (const id of ids) {join(id);}
|
|
21
|
+
return { h, calls, roster, join, leave };
|
|
22
|
+
}
|
|
23
|
+
const event = (subject, value, result) => ({ kind: KIND, subject, value, result, flags: 0 });
|
|
24
|
+
|
|
25
|
+
{ // closed before arrival, at the furthest server stage, exactly once
|
|
26
|
+
const { h, calls, leave } = world(['p']);
|
|
27
|
+
L.tick(h, T0);
|
|
28
|
+
h.players.set('p', { hello: true });
|
|
29
|
+
L.tick(h, T0 + 100);
|
|
30
|
+
h.sim.players.set('p', {});
|
|
31
|
+
L.tick(h, T0 + 200);
|
|
32
|
+
leave('p', T0 + 500);
|
|
33
|
+
L.tick(h, T0 + 600);
|
|
34
|
+
assert.deepEqual(calls, [['p', event(S.body, 500, R.closed)]]);
|
|
35
|
+
assert.equal(h.loads.players.size, 0, 'a departed connection keeps no state');
|
|
36
|
+
}
|
|
37
|
+
{ // a timeout fires once and suppresses the later close
|
|
38
|
+
const { h, calls, leave } = world(['p']);
|
|
39
|
+
L.tick(h, T0 + TIMEOUT - 1);
|
|
40
|
+
assert.equal(calls.length, 0);
|
|
41
|
+
L.tick(h, T0 + TIMEOUT);
|
|
42
|
+
L.tick(h, T0 + TIMEOUT * 2);
|
|
43
|
+
leave('p', T0 + TIMEOUT * 3);
|
|
44
|
+
L.tick(h, T0 + TIMEOUT * 3);
|
|
45
|
+
assert.deepEqual(calls, [['p', event(S.connected, TIMEOUT, R.timeout)]]);
|
|
46
|
+
}
|
|
47
|
+
{ // a leave and rejoin of one id between ticks is two connections (review P2 1)
|
|
48
|
+
const { h, calls, join, leave } = world(['p']);
|
|
49
|
+
L.tick(h, T0 + TIMEOUT);
|
|
50
|
+
assert.deepEqual(calls, [['p', event(S.connected, TIMEOUT, R.timeout)]]);
|
|
51
|
+
const back = T0 + TIMEOUT + 10;
|
|
52
|
+
leave('p', back); join('p', back);
|
|
53
|
+
L.tick(h, back + TIMEOUT - 1);
|
|
54
|
+
assert.equal(calls.length, 1, 'the new connection has its own clock');
|
|
55
|
+
leave('p', back + 2000); join('p', back + 2000);
|
|
56
|
+
assert.deepEqual(calls[1], ['p', event(S.connected, 2000, R.closed)], 'the new connection is not suppressed by the old timeout');
|
|
57
|
+
L.tick(h, back + 2000 + TIMEOUT);
|
|
58
|
+
assert.deepEqual(calls[2], ['p', event(S.connected, TIMEOUT, R.timeout)]);
|
|
59
|
+
// A join the transport never closed ends the stale record as closed.
|
|
60
|
+
const { h: h2, calls: c2 } = world(['q']);
|
|
61
|
+
L.join(h2, h2.session, 'q', T0 + 50);
|
|
62
|
+
assert.deepEqual(c2, [['q', event(S.connected, 50, R.closed)]]);
|
|
63
|
+
}
|
|
64
|
+
{ // no simulation yet: the timeout and the close still report (review P2 2)
|
|
65
|
+
const { h, calls, leave } = world(['p', 'q']);
|
|
66
|
+
delete h.sim;
|
|
67
|
+
L.tick(h, T0 + TIMEOUT);
|
|
68
|
+
leave('q', T0 + TIMEOUT + 5);
|
|
69
|
+
assert.deepEqual(calls.map(([id, e]) => [id, e.result]), [['p', R.timeout], ['q', R.timeout]]);
|
|
70
|
+
const { h: h2, calls: c2, leave: leave2 } = world(['r']);
|
|
71
|
+
delete h2.sim;
|
|
72
|
+
leave2('r', T0 + 300);
|
|
73
|
+
assert.deepEqual(c2, [['r', event(S.connected, 300, R.closed)]]);
|
|
74
|
+
}
|
|
75
|
+
{ // hello then a close inside one tick reports hello, even if reconcile forgot the entry (review P2 3)
|
|
76
|
+
const { h, calls, leave } = world(['p']);
|
|
77
|
+
L.tick(h, T0);
|
|
78
|
+
L.hello(h, 'p');
|
|
79
|
+
h.players.delete('p');
|
|
80
|
+
leave('p', T0 + 40);
|
|
81
|
+
assert.deepEqual(calls, [['p', event(S.hello, 40, R.closed)]]);
|
|
82
|
+
}
|
|
83
|
+
{ // nothing after arrival: neither timeout nor close; an arrived first sight is never a load
|
|
84
|
+
const { h, calls, join, leave } = world(['p']);
|
|
85
|
+
h.players.set('kept', { hello: true, arrived: true });
|
|
86
|
+
join('kept');
|
|
87
|
+
L.tick(h, T0);
|
|
88
|
+
h.players.set('p', { hello: true, arrived: true });
|
|
89
|
+
L.tick(h, T0 + 10);
|
|
90
|
+
L.tick(h, T0 + TIMEOUT * 2);
|
|
91
|
+
leave('p', T0 + TIMEOUT * 3); leave('kept', T0 + TIMEOUT * 3);
|
|
92
|
+
L.tick(h, T0 + TIMEOUT * 3);
|
|
93
|
+
assert.equal(calls.length, 0);
|
|
94
|
+
}
|
|
95
|
+
{ // client stages: only an allowed stage, only upward, never text or extra keys
|
|
96
|
+
const { h, calls, leave } = world(['p', 'q']);
|
|
97
|
+
const s = h.session;
|
|
98
|
+
L.tick(h, T0);
|
|
99
|
+
for (const data of [{ k: 'hub-load', stage: S.hello }, { k: 'hub-load', stage: S.body }, { k: 'hub-load', stage: String(S.placed) },
|
|
100
|
+
{ k: 'hub-load', stage: S.placed + 1 }, { k: 'hub-load', stage: S.placed, text: 'hi' }, { k: 'hub-load' }]) {
|
|
101
|
+
assert.equal(L.message(h, s, { playerId: 'p' }, data, T0 + 1), false, JSON.stringify(data));
|
|
102
|
+
}
|
|
103
|
+
assert.equal(L.message(h, s, { playerId: 'stranger' }, { k: 'hub-load', stage: S.placed }, T0 + 1), false, 'sender must be in the roster');
|
|
104
|
+
assert.equal(L.message(h, s, { playerId: 'p' }, { k: 'hub-load', stage: S.placed }, T0 + 2), true);
|
|
105
|
+
assert.equal(L.message(h, s, { playerId: 'p' }, { k: 'hub-load', stage: S.placed }, T0 + 5000), false, 'only a raise');
|
|
106
|
+
h.players.set('p', { hello: true });
|
|
107
|
+
h.sim.players.set('p', {});
|
|
108
|
+
L.hello(h, 'p');
|
|
109
|
+
L.tick(h, T0 + 3000);
|
|
110
|
+
assert.equal(h.loads.players.get('p').stage, S.placed, 'server stages never lower a client stage');
|
|
111
|
+
leave('p', T0 + 4000);
|
|
112
|
+
assert.deepEqual(calls, [['p', event(S.placed, 4000, R.closed)]]);
|
|
113
|
+
// A report after arrival is ignored.
|
|
114
|
+
h.players.set('q', { hello: true, arrived: true });
|
|
115
|
+
L.tick(h, T0 + 4001);
|
|
116
|
+
assert.equal(L.message(h, s, { playerId: 'q' }, { k: 'hub-load', stage: S.placed }, T0 + 4002), false);
|
|
117
|
+
}
|
|
118
|
+
{ // value is clamped to Ghost's bound when ticks stall
|
|
119
|
+
const { h, calls, leave } = world(['p']);
|
|
120
|
+
leave('p', T0 + L.LOAD_ABANDON_MAX_MS * 2);
|
|
121
|
+
assert.deepEqual(calls, [['p', event(S.connected, L.LOAD_ABANDON_MAX_MS, R.closed)]]);
|
|
122
|
+
}
|
|
123
|
+
{ // a new session starts afresh; a throwing host never throws
|
|
124
|
+
const { h, calls } = world(['p']);
|
|
125
|
+
h.session = { players: [], hub: { track: () => { throw new Error('host'); } } };
|
|
126
|
+
L.tick(h, T0 + 1);
|
|
127
|
+
L.leave(h, 'p', T0 + 2);
|
|
128
|
+
assert.equal(calls.length, 0, 'the old session\'s connections are not abandoned by a place switch');
|
|
129
|
+
L.join(h, h.session, 'x', T0 + 2);
|
|
130
|
+
assert.doesNotThrow(() => L.leave(h, 'x', T0 + 3));
|
|
131
|
+
}
|
|
132
|
+
{ // analytics off, v1.111 off, loadTelemetry off, or a house: no state, no events, no messages
|
|
133
|
+
for (const [place, manifest] of [[{ ...ON, analytics: undefined }, {}], [{ ...ON, analyticsV111: undefined }, {}],
|
|
134
|
+
[{ ...ON, loadTelemetry: undefined }, {}], [ON, { house: {} }]]) {
|
|
135
|
+
const calls = [], roster = [{ playerId: 'p' }];
|
|
136
|
+
const h = { place: { ...place }, manifest, players: new Map(), sim: { players: new Map() },
|
|
137
|
+
session: { players: roster, hub: { track: (id, e) => { calls.push([id, e]); return true; } } } };
|
|
138
|
+
L.join(h, h.session, 'p', T0);
|
|
139
|
+
L.hello(h, 'p');
|
|
140
|
+
assert.equal(L.message(h, h.session, { playerId: 'p' }, { k: 'hub-load', stage: S.placed }, T0), false);
|
|
141
|
+
L.tick(h, T0 + TIMEOUT);
|
|
142
|
+
L.leave(h, 'p', T0 + TIMEOUT + 1);
|
|
143
|
+
assert.equal(calls.length, 0);
|
|
144
|
+
assert.equal(h.loads, undefined);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
console.log('load abandonment: close, timeout once, arrival, stages, clamp and opt-in: passed');
|
|
148
|
+
|
|
149
|
+
// Manifest: main place only, requires analytics and analyticsV111, adds a wire field only when on.
|
|
150
|
+
const castle = (hub = {}) => ({ hub: { contract: 1, title: 'Town', ...hub } });
|
|
151
|
+
const v111 = readManifest(castle({ analytics: true, analyticsV111: true })).manifest.places.main;
|
|
152
|
+
const on = readManifest(castle(ON));
|
|
153
|
+
assert.deepEqual(on.errors, []);
|
|
154
|
+
assert.equal(on.manifest.places.main.loadTelemetry, true);
|
|
155
|
+
assert.deepEqual(publicPlace('main', on.manifest.places.main), { ...publicPlace('main', v111), loadTelemetry: true });
|
|
156
|
+
assert.equal(Object.hasOwn(publicPlace('main', v111), 'loadTelemetry'), false);
|
|
157
|
+
for (const hub of [{ loadTelemetry: true }, { analytics: true, loadTelemetry: true }, { ...ON, loadTelemetry: 1 }, { ...ON, loadTelemetry: false }]) {
|
|
158
|
+
assert(readManifest(castle(hub)).errors.some((e) => e.includes('loadTelemetry')), JSON.stringify(hub));
|
|
159
|
+
}
|
|
160
|
+
assert(readManifest(castle({ ...ON, loadTelemetry: undefined, places: { race: { title: 'Race', loadTelemetry: true } } }))
|
|
161
|
+
.errors.some((e) => e.includes('loadTelemetry')));
|
|
162
|
+
console.log('load telemetry manifest: passed');
|
|
163
|
+
|
|
164
|
+
// Browser: one placed report per opted-in transport, nothing for others.
|
|
165
|
+
{
|
|
166
|
+
const sent = [], net = { send: (m) => sent.push(m) }, other = { send: (m) => sent.push(['other', m]) };
|
|
167
|
+
assert.equal(loadTelemetryFor(net), false);
|
|
168
|
+
assert.equal(reportLoadStage(net, S.placed), false);
|
|
169
|
+
setLoadTelemetry(net, true);
|
|
170
|
+
setLoadTelemetry(other, undefined);
|
|
171
|
+
assert.equal(reportLoadStage(net, S.hello), false, 'server stages are not the client\'s to claim');
|
|
172
|
+
assert.equal(reportLoadStage(net, S.placed), true);
|
|
173
|
+
assert.equal(reportLoadStage(net, S.placed), false);
|
|
174
|
+
setLoadTelemetry(net, true);
|
|
175
|
+
assert.equal(reportLoadStage(net, S.placed), false, 'a repeated snapshot does not reset the transport');
|
|
176
|
+
assert.equal(reportLoadStage(other, S.placed), false);
|
|
177
|
+
assert.deepEqual(sent, [{ k: 'hub-load', stage: S.placed }]);
|
|
178
|
+
setLoadTelemetry(net, false);
|
|
179
|
+
assert.equal(loadTelemetryFor(net), false);
|
|
180
|
+
}
|
|
181
|
+
console.log('load telemetry client: passed');
|
|
182
|
+
|
|
183
|
+
// Through the real server layer: a never-hello connection that closes, and an arrival that does not.
|
|
184
|
+
const sceneStub = 'export const readScene = () => [{ id: "spawn", components: { Player: {}, Transform: { x: 0, y: 1, z: 0 } } }];';
|
|
185
|
+
register(`data:text/javascript,${encodeURIComponent(`
|
|
186
|
+
export async function resolve(specifier, context, next) {
|
|
187
|
+
if (specifier === '@imports/castle.multiplayer-3d/code/server/sceneBodies.js') {
|
|
188
|
+
return { url: 'data:text/javascript,${encodeURIComponent(sceneStub)}', shortCircuit: true };
|
|
189
|
+
}
|
|
190
|
+
return next(specifier, context);
|
|
191
|
+
}
|
|
192
|
+
`)}`);
|
|
193
|
+
const { layer } = await import('../code/server/hub.js');
|
|
194
|
+
function townServer() {
|
|
195
|
+
const tracked = [], sent = [];
|
|
196
|
+
const roster = [];
|
|
197
|
+
const session = { sessionId: 's-1', place: null, players: roster, send: (id, d) => sent.push([id, d]), broadcast() {},
|
|
198
|
+
hub: { place: 'main', title: 'Town', result: null, arrival: () => null,
|
|
199
|
+
async readResults() { return { players: {}, boards: {} }; },
|
|
200
|
+
track: (id, e) => { tracked.push([id, e]); return Promise.resolve(true); } } };
|
|
201
|
+
const h = layer({ server: { maxPlayers: 8 }, hub: { contract: 1, title: 'Town', ...ON } }, { arrive() {} }, {}, (s) => s === 'scenes/main.scene', () => null);
|
|
202
|
+
h.sceneFor(session);
|
|
203
|
+
const join = (playerId, userId) => { roster.push({ playerId, userId, username: playerId, isAnonymous: false }); h.transportJoin(session, { playerId }); };
|
|
204
|
+
const leave = (playerId) => { roster.splice(roster.findIndex((p) => p.playerId === playerId), 1); h.transportLeave(session, { playerId }); };
|
|
205
|
+
return { h, session, roster, tracked, sent, join, leave, loads: () => tracked.filter(([, e]) => e.kind === KIND) };
|
|
206
|
+
}
|
|
207
|
+
assert.equal(layer({ hub: { contract: 1, title: 'Town', analytics: true } }, {}, {}, () => true, () => null).transportJoin, undefined,
|
|
208
|
+
'a deck without loadTelemetry adds no transport hooks');
|
|
209
|
+
{
|
|
210
|
+
const t = townServer();
|
|
211
|
+
t.join('p1', '101'); t.join('p2', '102');
|
|
212
|
+
const players = new Map(t.roster.map(({ playerId }) => [playerId, { at: { x: 0, y: 1, z: 0 }, facing: 0, body: { setTranslation() {} } }]));
|
|
213
|
+
const sim = { timeMs: 0, players, bodies: new Map(), scenePath: 'scenes/main.scene' };
|
|
214
|
+
t.h.ready(sim);
|
|
215
|
+
assert.equal(t.h.join().hubPlace.loadTelemetry, true);
|
|
216
|
+
t.h.message(t.session, { playerId: 'p1' }, { k: 'hub-hello', avatar: 1, from: null, party: 1 });
|
|
217
|
+
for (let i = 0; i < 5; i++) { t.h.place(sim); t.h.transportTick(t.session); await new Promise((r) => setImmediate(r)); }
|
|
218
|
+
assert(t.sent.some(([id, d]) => id === 'p1' && d.k === 'hub-arrived'), 'p1 arrived');
|
|
219
|
+
t.h.message(t.session, { playerId: 'p1' }, { k: 'hub-load', stage: S.placed });
|
|
220
|
+
// p2 says hello and closes before the next tick: the hello counts, and its
|
|
221
|
+
// body is still in the simulation when the transport reports the leave.
|
|
222
|
+
t.h.message(t.session, { playerId: 'p2' }, { k: 'hub-hello', avatar: 1, from: null, party: 1 });
|
|
223
|
+
t.leave('p1'); t.leave('p2');
|
|
224
|
+
players.clear();
|
|
225
|
+
t.h.place(sim); t.h.transportTick(t.session);
|
|
226
|
+
assert.equal(t.loads().length, 1, 'only the connection that never arrived');
|
|
227
|
+
assert.equal(t.loads()[0][0], 'p2');
|
|
228
|
+
assert.equal(t.loads()[0][1].subject, S.body);
|
|
229
|
+
assert.equal(t.loads()[0][1].result, R.closed);
|
|
230
|
+
assert(t.tracked.some(([id, e]) => id === 'p1' && e.kind === 1), 'the arrival is still kind 1');
|
|
231
|
+
}
|
|
232
|
+
{ // The world never finishes building: no place tick ever runs, yet the transport reports.
|
|
233
|
+
const t = townServer();
|
|
234
|
+
t.join('p1', '101');
|
|
235
|
+
t.h.message(t.session, { playerId: 'p1' }, { k: 'hub-hello', avatar: 1, from: null, party: 1 });
|
|
236
|
+
t.leave('p1');
|
|
237
|
+
assert.deepEqual(t.loads().map(([id, e]) => [id, e.subject, e.result]), [['p1', S.hello, R.closed]]);
|
|
238
|
+
t.join('p2', '102');
|
|
239
|
+
const realNow = Date.now;
|
|
240
|
+
try {
|
|
241
|
+
Date.now = () => realNow() + TIMEOUT;
|
|
242
|
+
t.h.transportTick(t.session);
|
|
243
|
+
} finally { Date.now = realNow; }
|
|
244
|
+
assert.deepEqual(t.loads().map(([id, e]) => [id, e.result]), [['p1', R.closed], ['p2', R.timeout]]);
|
|
245
|
+
}
|
|
246
|
+
console.log('load abandonment through the server layer and transport hooks: passed');
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { makeLoadingCover } from '../code/client/loadingCover.js';
|
|
3
|
+
|
|
4
|
+
function documentFixture() {
|
|
5
|
+
function element() {
|
|
6
|
+
return {
|
|
7
|
+
attributes: new Map(), children: [],
|
|
8
|
+
setAttribute(k, v) { this.attributes.set(k, v); },
|
|
9
|
+
removeAttribute(k) { this.attributes.delete(k); },
|
|
10
|
+
append(...children) {
|
|
11
|
+
for (const child of children) { child.remove(); child.parent = this; this.children.push(child); }
|
|
12
|
+
},
|
|
13
|
+
remove() {
|
|
14
|
+
if (this.parent) this.parent.children = this.parent.children.filter(child => child !== this);
|
|
15
|
+
this.parent = null;
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const listeners = new Map(), observers = new Set();
|
|
20
|
+
const viewListeners = new Map();
|
|
21
|
+
let time = 0;
|
|
22
|
+
const defaultView = {
|
|
23
|
+
performance: { now: () => time },
|
|
24
|
+
addEventListener(k, fn) { viewListeners.set(k, fn); },
|
|
25
|
+
removeEventListener(k, fn) { if (viewListeners.get(k) === fn) viewListeners.delete(k); },
|
|
26
|
+
MutationObserver: class {
|
|
27
|
+
constructor(callback) { this.callback = callback; observers.add(this); }
|
|
28
|
+
observe() { this.live = true; }
|
|
29
|
+
disconnect() { this.live = false; }
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
defaultView, head: element(), body: element(), documentElement: element(), hidden: false,
|
|
34
|
+
createElement: element,
|
|
35
|
+
addEventListener(k, fn) { listeners.set(k, fn); },
|
|
36
|
+
removeEventListener(k, fn) { if (listeners.get(k) === fn) listeners.delete(k); },
|
|
37
|
+
advance(ms) { time += ms; },
|
|
38
|
+
visibility(hidden) { this.hidden = hidden; listeners.get('visibilitychange')?.(); },
|
|
39
|
+
listeners,
|
|
40
|
+
recovery() {
|
|
41
|
+
for (const observer of observers) if (observer.live) observer.callback([
|
|
42
|
+
{ addedNodes: [{ nodeType: 1, style: { zIndex: '2147483000' } }] },
|
|
43
|
+
]);
|
|
44
|
+
},
|
|
45
|
+
observing: () => [...observers].some(observer => observer.live),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// Absent/false/nonboolean flags cause no DOM reads or resources.
|
|
49
|
+
for (const enabled of [undefined, false, 1, 'true', null]) {
|
|
50
|
+
assert.equal(makeLoadingCover({ enabled, document: new Proxy({}, { get() { throw Error('DOM touched'); } }) }), null);
|
|
51
|
+
}
|
|
52
|
+
const doc = documentFixture();
|
|
53
|
+
const cover = makeLoadingCover({ enabled: true, title: '<Town>', document: doc });
|
|
54
|
+
const covered = () => doc.documentElement.attributes.has('data-hub-loading');
|
|
55
|
+
assert(covered());
|
|
56
|
+
assert(doc.observing());
|
|
57
|
+
// Startup/update errors caught by the engine never reach composer.render.
|
|
58
|
+
doc.recovery();
|
|
59
|
+
assert.equal(doc.body.children.length, 0);
|
|
60
|
+
assert(!doc.observing());
|
|
61
|
+
cover.sync({}); // a restarted attempt restores the loading cover.
|
|
62
|
+
assert(covered());
|
|
63
|
+
assert.equal(doc.body.children[0].children[0].textContent, '<Town>');
|
|
64
|
+
assert.equal(doc.body.children[0].attributes.get('role'), 'progressbar');
|
|
65
|
+
let draws = 0, fail = false, connected = false, placed = false, contextLost = false, noop = false;
|
|
66
|
+
const renderer = { info: { render: { frame: 0 } }, getContext: () => ({ isContextLost: () => contextLost }) };
|
|
67
|
+
const composer = { render(...args) {
|
|
68
|
+
assert.equal(this, composer);
|
|
69
|
+
assert.deepEqual(args, [0.2]);
|
|
70
|
+
// Startup/reconnect cover is released only after the output pass.
|
|
71
|
+
draws++;
|
|
72
|
+
if (fail) throw Error('draw failed');
|
|
73
|
+
if (!noop) renderer.info.render.frame++;
|
|
74
|
+
return 42;
|
|
75
|
+
} };
|
|
76
|
+
const original = composer.render;
|
|
77
|
+
const scene = { three: { composer, renderer }, multiplayer: {
|
|
78
|
+
net: { status: () => ({ state: connected ? 'connected' : 'reconnecting' }) },
|
|
79
|
+
placed: () => placed,
|
|
80
|
+
} };
|
|
81
|
+
scene.multiplayer.starting = true; // this is latched after a real successful join.
|
|
82
|
+
cover.sync(scene);
|
|
83
|
+
const wrapped = composer.render;
|
|
84
|
+
cover.sync(scene);
|
|
85
|
+
assert.equal(composer.render, wrapped); // no wrapper stacking each frame.
|
|
86
|
+
fail = true;
|
|
87
|
+
assert.throws(() => composer.render(0.2), /draw failed/);
|
|
88
|
+
assert(covered());
|
|
89
|
+
fail = false;
|
|
90
|
+
assert.equal(doc.body.children.length, 0); // recovery UI is no longer covered.
|
|
91
|
+
cover.sync(scene); // engine Restart starts a new drawing attempt.
|
|
92
|
+
noop = true;
|
|
93
|
+
composer.render(0.2);
|
|
94
|
+
assert(covered()); // no-op output cannot release the cover.
|
|
95
|
+
noop = false; contextLost = true;
|
|
96
|
+
composer.render(0.2);
|
|
97
|
+
assert(covered()); // context loss may return without throwing.
|
|
98
|
+
contextLost = false;
|
|
99
|
+
composer.render(0.2);
|
|
100
|
+
assert(covered()); // a pre-join render cannot create an uncovered acquisition gap.
|
|
101
|
+
connected = true;
|
|
102
|
+
composer.render(0.2);
|
|
103
|
+
assert(covered()); // connected but not placed is still loading.
|
|
104
|
+
placed = true;
|
|
105
|
+
assert.equal(composer.render(0.2), 42);
|
|
106
|
+
assert(!covered());
|
|
107
|
+
assert.equal(doc.body.children.length, 0);
|
|
108
|
+
cover.sync(scene);
|
|
109
|
+
assert(!covered()); // connected + latched starting must not reinsert the cover.
|
|
110
|
+
// Short connected switches do not hide HUD or insert a black hub cover.
|
|
111
|
+
doc.visibility(true);
|
|
112
|
+
assert(!covered());
|
|
113
|
+
doc.advance(500);
|
|
114
|
+
doc.visibility(false);
|
|
115
|
+
assert(!covered());
|
|
116
|
+
composer.render(0.2);
|
|
117
|
+
assert(!covered());
|
|
118
|
+
// A long absence still covers before the first foreground draw.
|
|
119
|
+
doc.visibility(true);
|
|
120
|
+
doc.advance(30_000);
|
|
121
|
+
doc.visibility(false);
|
|
122
|
+
assert(covered());
|
|
123
|
+
connected = false;
|
|
124
|
+
composer.render(0.2);
|
|
125
|
+
assert(covered());
|
|
126
|
+
connected = true; placed = false;
|
|
127
|
+
composer.render(0.2);
|
|
128
|
+
assert(covered());
|
|
129
|
+
placed = true;
|
|
130
|
+
composer.render(0.2);
|
|
131
|
+
assert(!covered());
|
|
132
|
+
// A foreground transport reconnect uses the same cover and rendered gate.
|
|
133
|
+
connected = false;
|
|
134
|
+
cover.sync(scene);
|
|
135
|
+
assert(covered());
|
|
136
|
+
connected = true;
|
|
137
|
+
composer.render(0.2);
|
|
138
|
+
assert(!covered());
|
|
139
|
+
// Scene disposal gives back the composer; a replacement binds independently.
|
|
140
|
+
cover.detach();
|
|
141
|
+
assert.equal(composer.render, original);
|
|
142
|
+
doc.visibility(true);
|
|
143
|
+
const next = { render() { assert(covered()); renderer.info.render.frame++; } };
|
|
144
|
+
cover.sync({ ...scene, three: { composer: next, renderer } });
|
|
145
|
+
doc.visibility(false);
|
|
146
|
+
next.render();
|
|
147
|
+
assert(!covered());
|
|
148
|
+
// An intentional classic exit does not re-cover a successfully drawn scene.
|
|
149
|
+
scene.multiplayer.net = null;
|
|
150
|
+
scene.multiplayer.joinFailed = true;
|
|
151
|
+
cover.sync(scene);
|
|
152
|
+
assert(!covered());
|
|
153
|
+
doc.visibility(true);
|
|
154
|
+
doc.visibility(false);
|
|
155
|
+
composer.render(0.2);
|
|
156
|
+
assert(!covered()); // native/dev Back remains accessible after backgrounding away.
|
|
157
|
+
cover.dispose();
|
|
158
|
+
assert.equal(doc.head.children.length, 0);
|
|
159
|
+
assert.equal(doc.listeners.size, 0);
|
|
160
|
+
assert(!doc.observing());
|
|
161
|
+
assert(draws > 0);
|
|
162
|
+
console.log('loading cover: disabled parity, completed/failed render, hidden resume, reconnect and cleanup passed');
|