castle-web-cli 0.4.233 → 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/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 +17 -2
- package/dist/castle-host/host.js +793 -36
- package/dist/castleJson.d.ts +20 -1
- package/dist/castleJson.js +44 -2
- package/dist/check.js +9 -2
- 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 +3 -1
- 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/index.js +8 -2
- package/dist/init.js +1 -1
- package/dist/save-deck.d.ts +20 -1
- package/dist/save-deck.js +141 -5
- package/dist/serve.js +29 -11
- package/dist/shell/assets/{index-BjOxR-lW.js → index-DulbYIJm.js} +97 -97
- package/dist/shell/index.html +1 -1
- package/dist/vitePlugins.d.ts +2 -1
- package/dist/vitePlugins.js +13 -0
- package/kits/base/castle.json +1 -1
- package/kits/base/sdk/README.md +260 -3
- package/kits/base/sdk/castle.d.ts +7 -3
- package/kits/base/sdk/castle.js +2 -0
- package/kits/base/sdk/commands.d.ts +162 -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 +33 -6
- package/kits/base/sdk/hub.js +50 -4
- package/kits/base/sdk/multiplayer.d.ts +7 -1
- package/kits/base/sdk/multiplayer.js +140 -40
- 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 +79 -6
- package/kits/base/sdk/server/hub.d.ts +31 -1
- package/kits/base/sdk/server/hub.js +50 -3
- package/kits/base/sdk/server/platformHandle.d.ts +13 -1
- package/kits/base/sdk/server/storage.d.ts +4 -0
- package/kits/base/sdk/server/storage.js +19 -3
- package/kits/base/sdk/server/wrapper.d.ts +7 -1
- package/kits/base/sdk/server/wrapper.js +10 -1
- package/kits/base/sdk/social.d.ts +9 -0
- package/kits/base/sdk/social.js +5 -0
- package/kits/hub-game/CLAUDE.md +123 -3
- package/kits/hub-game/README.md +63 -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/arrivalCamera.js +50 -0
- package/kits/hub-game/code/client/askSlot.js +117 -0
- package/kits/hub-game/code/client/avatar.js +4 -2
- package/kits/hub-game/code/client/avatarShare.js +2 -0
- package/kits/hub-game/code/client/backVisibility.js +13 -0
- package/kits/hub-game/code/client/ballot.js +15 -10
- package/kits/hub-game/code/client/build.js +16 -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 +1148 -258
- package/kits/hub-game/code/client/crowdNames.js +241 -0
- package/kits/hub-game/code/client/decor.js +10 -4
- 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/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 +31 -11
- package/kits/hub-game/code/client/hookLayer.js +87 -8
- 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 +14 -2
- 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/labelsNear.js +31 -2
- 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/menuRows.js +43 -0
- package/kits/hub-game/code/client/modelReady.js +7 -0
- 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/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 +64 -10
- 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/state.js +53 -0
- package/kits/hub-game/code/client/talk.js +209 -45
- package/kits/hub-game/code/client/tiers.js +68 -66
- package/kits/hub-game/code/client/together.js +7 -2
- 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/worldLabels.js +241 -0
- package/kits/hub-game/code/client/yours.js +10 -9
- package/kits/hub-game/code/npcDisplayText.js +55 -0
- package/kits/hub-game/code/server/act.js +124 -0
- package/kits/hub-game/code/server/actions.js +6 -1
- package/kits/hub-game/code/server/actors.js +2 -1
- 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/companion.js +28 -3
- package/kits/hub-game/code/server/doorAnalytics.js +52 -0
- package/kits/hub-game/code/server/earned.js +22 -5
- package/kits/hub-game/code/server/frameBatch.js +183 -0
- package/kits/hub-game/code/server/friendsAmong.js +49 -9
- package/kits/hub-game/code/server/history.js +2 -0
- package/kits/hub-game/code/server/hub.js +1306 -95
- package/kits/hub-game/code/server/idle.js +30 -1
- package/kits/hub-game/code/server/index.js +26 -4
- package/kits/hub-game/code/server/invites.js +19 -0
- package/kits/hub-game/code/server/labels.js +9 -1
- package/kits/hub-game/code/server/loadAbandon.js +106 -0
- package/kits/hub-game/code/server/manifest.js +211 -3
- package/kits/hub-game/code/server/menu.js +31 -3
- package/kits/hub-game/code/server/npcs.js +226 -64
- 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/players.js +9 -1
- 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/standing.js +4 -5
- package/kits/hub-game/code/server/storageLimit.js +187 -0
- package/kits/hub-game/code/server/vis.js +67 -5
- package/kits/hub-game/code/shared/act.js +35 -0
- package/kits/hub-game/code/shared/danceIdle.js +28 -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 +35 -1
- package/kits/hub-game/code/systems/hub.js +970 -169
- package/kits/hub-game/docs/analytics.md +279 -0
- package/kits/hub-game/docs/contract.md +1257 -42
- package/kits/hub-game/docs/home-pieces.md +9 -2
- package/kits/hub-game/docs/observed-progress.md +252 -0
- package/kits/hub-game/main.jsx +2 -0
- package/kits/hub-game/package-lock.json +10 -3
- package/kits/hub-game/package.json +6 -3
- 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 +39 -5
- package/kits/hub-game/scripts/companion-follower-wire.json +1 -1
- package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +11 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless.json +5 -5
- package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +3 -0
- package/kits/hub-game/scripts/fixtures/fake-dom.mjs +19 -3
- package/kits/hub-game/scripts/fixtures/interest-legacy.json +3 -3
- package/kits/hub-game/scripts/fixtures/vis-shared-wire.json +1 -1
- package/kits/hub-game/scripts/pose-storage-fixture.mjs +46 -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 +367 -2
- package/kits/hub-game/scripts/test-actors.mjs +20 -7
- 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-slot.mjs +85 -0
- package/kits/hub-game/scripts/test-avatar-wire.mjs +49 -10
- package/kits/hub-game/scripts/test-avatar.mjs +44 -0
- package/kits/hub-game/scripts/test-back-visibility.mjs +82 -0
- package/kits/hub-game/scripts/test-ballot.mjs +11 -4
- package/kits/hub-game/scripts/test-ban-join.mjs +121 -13
- package/kits/hub-game/scripts/test-build.mjs +20 -2
- package/kits/hub-game/scripts/test-chat.mjs +206 -5
- package/kits/hub-game/scripts/test-companion-chat.mjs +20 -2
- 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 +45 -4
- package/kits/hub-game/scripts/test-decor.mjs +7 -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.mjs +33 -3
- 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-grab-orbit.mjs +47 -4
- package/kits/hub-game/scripts/test-high-only.mjs +170 -0
- package/kits/hub-game/scripts/test-hub-ops.mjs +321 -2
- package/kits/hub-game/scripts/test-hub-trip.mjs +879 -11
- package/kits/hub-game/scripts/test-hud-clear.mjs +162 -59
- 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 +66 -0
- package/kits/hub-game/scripts/test-interest-cells.mjs +20 -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-labels.mjs +71 -3
- 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 +265 -0
- package/kits/hub-game/scripts/test-menu-client.mjs +105 -0
- package/kits/hub-game/scripts/test-menu.mjs +23 -0
- package/kits/hub-game/scripts/test-npcs.mjs +819 -10
- package/kits/hub-game/scripts/test-observed.mjs +745 -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 +234 -7
- 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 +699 -5
- 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 +145 -0
- package/kits/hub-game/scripts/test-signin-client.mjs +45 -0
- package/kits/hub-game/scripts/test-soundscape.mjs +22 -17
- package/kits/hub-game/scripts/test-standing.mjs +35 -2
- package/kits/hub-game/scripts/test-storage-limit.mjs +333 -0
- package/kits/hub-game/scripts/test-stuck.mjs +5 -4
- package/kits/hub-game/scripts/test-talk-overlay-dom.mjs +130 -0
- package/kits/hub-game/scripts/test-tiers-render.mjs +86 -13
- package/kits/hub-game/scripts/test-tiers.mjs +7 -8
- package/kits/hub-game/scripts/test-vis.mjs +433 -6
- 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 +50 -6
- package/kits/hub-game/scripts/test-yours.mjs +39 -8
- package/kits/multiplayer-3d/castle.json +5 -5
- package/kits/multiplayer-3d/code/client/joinFailure.js +27 -0
- package/kits/multiplayer-3d/code/client/resumeGate.js +139 -0
- package/kits/multiplayer-3d/code/systems/multiplayer.js +369 -30
- package/kits/multiplayer-3d/package-lock.json +8 -1
- package/kits/multiplayer-3d/package.json +2 -1
- package/kits/multiplayer-3d/scripts/test-join-watchdog.mjs +436 -0
- package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +624 -0
- package/kits/physics-2d/CLAUDE.md +10 -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 +87 -5
- 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-3d/CLAUDE.md +25 -1651
- 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 +35 -18
- 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 +1 -1
- package/kits/physics-3d/engine3d/PlayOnly3D.jsx +5 -1
- package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +19 -333
- package/kits/physics-3d/engine3d/actornode.js +1 -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/framecap.js +4 -1
- 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 +8 -0
- package/kits/physics-3d/engine3d/initialModelFiles.js +18 -0
- package/kits/physics-3d/engine3d/look.js +7 -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 +3 -3
- package/kits/physics-3d/engine3d/nearshadows.js +77 -10
- package/kits/physics-3d/engine3d/orbitinput.js +59 -25
- 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 +3 -3
- 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 +23 -15
- package/kits/physics-3d/engine3d/sky.js +1 -1
- 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/world3d.js +468 -18
- package/kits/physics-3d/eslint.config.js +2 -1
- package/kits/physics-3d/main.jsx +6 -3
- 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/test-camera-follow.mjs +5 -1
- package/kits/physics-3d/scripts/test-camera-orbit.mjs +52 -4
- package/kits/physics-3d/scripts/test-drop-empty-parts.mjs +1 -1
- package/kits/physics-3d/scripts/test-empty-gait-hints.mjs +89 -0
- package/kits/physics-3d/scripts/test-frame-cap-bob.mjs +6 -3
- package/kits/physics-3d/scripts/test-frame-cap.mjs +1 -1
- 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-look-bake.mjs +1 -1
- package/kits/physics-3d/scripts/test-near-shadows.mjs +2 -2
- package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +88 -7
- package/kits/physics-3d/scripts/test-orbit-shift-lock.mjs +40 -3
- package/kits/physics-3d/scripts/test-orbit-shot.mjs +75 -1
- package/kits/physics-3d/scripts/test-rapier-gz.mjs +106 -0
- package/kits/physics-3d/scripts/test-sky.mjs +1 -1
- package/kits/physics-3d/scripts/test-square-first.mjs +921 -0
- package/kits/physics-3d/scripts/test-static-actors.mjs +3 -1
- package/kits/physics-3d/scripts/test-static-physics.mjs +4 -1
- package/kits/physics-3d/scripts/test-static-scenery.mjs +5 -2
- package/kits/physics-3d/scripts/test-steady-hover.mjs +5 -2
- package/kits/physics-3d/scripts/test-still-shadows.mjs +477 -0
- package/kits/physics-3d/systems/physics3d.js +37 -4
- 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/session.js +6 -4
- package/kits/real-time/package-lock.json +1 -1
- package/package.json +2 -2
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
// A player Castle has barred from the hub (CastleError CAULDRON_HUB_BANNED)
|
|
2
2
|
// is not joined again by multiplayer-3d's join loop: neither after a first
|
|
3
3
|
// join refused that way nor after a connection whose recovery was refused that
|
|
4
|
-
// way.
|
|
5
|
-
//
|
|
4
|
+
// way. Invite refusals are also final; other failures retry with backoff.
|
|
5
|
+
// A hub join whose connection closes before the session placed the
|
|
6
6
|
// player reads 'lost'; no other join ever does. Everything multiplayer.js
|
|
7
7
|
// imports but the join loop is stubbed.
|
|
8
8
|
// `npm run check` runs it; it needs nothing installed.
|
|
9
9
|
|
|
10
10
|
import assert from 'node:assert/strict';
|
|
11
11
|
import { register } from 'node:module';
|
|
12
|
+
import { makeLoadingCover } from '../code/client/loadingCover.js';
|
|
13
|
+
import { BANNED_TEXT, joinErrorText } from '../code/client/joinError.js';
|
|
14
|
+
|
|
15
|
+
let pageMs = 1000;
|
|
16
|
+
const realPerformance = globalThis.performance;
|
|
17
|
+
Object.defineProperty(globalThis, 'performance', { value: { now: () => pageMs }, configurable: true });
|
|
12
18
|
|
|
13
19
|
const noop = (names) => names.map((name) => `export const ${name} = () => ({ actors: new Map() });`).join(' ');
|
|
14
20
|
const realTime = new URL('../../real-time/code/client/', import.meta.url).href;
|
|
@@ -67,37 +73,136 @@ console.log = () => {};
|
|
|
67
73
|
|
|
68
74
|
let n = 0;
|
|
69
75
|
|
|
70
|
-
//
|
|
71
|
-
|
|
76
|
+
// Terminal refusals stop joining and release both covers after a world draw.
|
|
77
|
+
for (const code of ['CAULDRON_HUB_BANNED', 'CAULDRON_HUB_INVITE_FORBIDDEN', 'CAULDRON_HUB_INVITE_EXPIRED',
|
|
78
|
+
'CAULDRON_HUB_INVITE_EXHAUSTED', 'CAULDRON_HUB_INVITE_INVALID']) {
|
|
72
79
|
const system = make();
|
|
73
80
|
attempts = 0;
|
|
74
|
-
answer = () => Promise.reject(castleError(
|
|
81
|
+
answer = () => Promise.reject(castleError(code));
|
|
75
82
|
for (let i = 0; i < 5; i += 1) {
|
|
76
83
|
system.afterBehaviors(scene, 0.016);
|
|
77
84
|
await flush();
|
|
85
|
+
pageMs += 60000;
|
|
78
86
|
}
|
|
79
87
|
assert.equal(attempts, 1);
|
|
80
|
-
assert.equal(system.joinError,
|
|
88
|
+
assert.equal(system.joinError, code);
|
|
89
|
+
assert.equal(system.joinFailed, true);
|
|
90
|
+
assert.equal(system.joiningOverlayWanted(), false);
|
|
91
|
+
assert.equal(joinErrorText(code), code === 'CAULDRON_HUB_BANNED' ? BANNED_TEXT : 'This invite is unavailable.');
|
|
92
|
+
system.away(pageMs);
|
|
81
93
|
assert.equal(system.joiningOverlayWanted(), false);
|
|
94
|
+
|
|
95
|
+
const element = () => ({
|
|
96
|
+
children: [], attrs: {}, setAttribute(k, v) { this.attrs[k] = v; }, removeAttribute(k) { delete this.attrs[k]; },
|
|
97
|
+
append(...children) { for (const child of children) { child.remove(); child.parent = this; this.children.push(child); } },
|
|
98
|
+
remove() { if (this.parent) this.parent.children = this.parent.children.filter(child => child !== this); this.parent = null; },
|
|
99
|
+
});
|
|
100
|
+
const doc = { head: element(), body: element(), documentElement: element(), createElement: element,
|
|
101
|
+
addEventListener() {}, removeEventListener() {} };
|
|
102
|
+
const cover = makeLoadingCover({ enabled: true, title: 'Town', document: doc });
|
|
103
|
+
const renderer = { info: { render: { frame: 0 } }, getContext: () => ({ isContextLost: () => false }) };
|
|
104
|
+
const composer = { render() { renderer.info.render.frame++; } };
|
|
105
|
+
// joinError alone is terminal, even if a stale transport still says reconnecting.
|
|
106
|
+
const coverScene = { three: { renderer, composer }, multiplayer: {
|
|
107
|
+
joinError: code, net: { status: () => ({ state: 'reconnecting' }) },
|
|
108
|
+
} };
|
|
109
|
+
cover.sync(coverScene);
|
|
110
|
+
assert.ok('data-hub-loading' in doc.documentElement.attrs);
|
|
111
|
+
composer.render();
|
|
112
|
+
assert.equal('data-hub-loading' in doc.documentElement.attrs, false);
|
|
113
|
+
assert.equal(doc.body.children.length, 0);
|
|
114
|
+
cover.sync(coverScene);
|
|
115
|
+
assert.equal('data-hub-loading' in doc.documentElement.attrs, false, 'terminal refusal cannot restore the spinner');
|
|
116
|
+
cover.dispose();
|
|
82
117
|
n += 1;
|
|
83
118
|
}
|
|
84
119
|
|
|
85
|
-
//
|
|
86
|
-
|
|
120
|
+
// Transient public failures retry at the deadline while frames keep stepping,
|
|
121
|
+
// stop after three attempts, and reset their count only after placement.
|
|
122
|
+
for (const code of ['MULTIPLAYER_UNAVAILABLE', 'CAULDRON_HUB_INVITE_NOT_IN_SESSION']) {
|
|
87
123
|
const system = make();
|
|
88
124
|
attempts = 0;
|
|
89
|
-
answer = () => Promise.reject(castleError(
|
|
90
|
-
|
|
125
|
+
answer = () => Promise.reject(castleError(code));
|
|
126
|
+
assert.equal(joinErrorText(code), null);
|
|
127
|
+
// A frame gap over STALL_MS now clears backoff as a visible return. These
|
|
128
|
+
// checks exercise ordinary backoff, so the page must keep stepping.
|
|
129
|
+
const advance = async (ms) => {
|
|
130
|
+
const until = pageMs + ms;
|
|
131
|
+
while (pageMs < until) {
|
|
132
|
+
pageMs = Math.min(until, pageMs + 250);
|
|
133
|
+
system.afterBehaviors(scene, 0.016);
|
|
134
|
+
await flush();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
system.afterBehaviors(scene, 0.016);
|
|
138
|
+
await flush();
|
|
139
|
+
for (const delay of [1000, 2000]) {
|
|
140
|
+
const before = attempts;
|
|
141
|
+
for (let i = 0; i < 5; i++) {
|
|
142
|
+
system.afterBehaviors(scene, 0.016);
|
|
143
|
+
await flush();
|
|
144
|
+
}
|
|
145
|
+
assert.equal(attempts, before, 'frames cannot bypass backoff');
|
|
146
|
+
await advance(delay - 1);
|
|
147
|
+
assert.equal(attempts, before);
|
|
148
|
+
pageMs++;
|
|
91
149
|
system.afterBehaviors(scene, 0.016);
|
|
92
150
|
await flush();
|
|
151
|
+
assert.equal(attempts, before + 1);
|
|
93
152
|
}
|
|
94
|
-
assert.ok(attempts > 1);
|
|
95
153
|
assert.equal(system.joinError, null);
|
|
154
|
+
assert.equal(system.joinFailed, true, 'three transient failures need an explicit retry');
|
|
155
|
+
assert.equal(system.joinFailures, 3);
|
|
156
|
+
await advance(30000);
|
|
157
|
+
const net = {
|
|
158
|
+
close() {},
|
|
159
|
+
status: () => ({ state: 'connected', solo: false }),
|
|
160
|
+
selfId: () => 'self',
|
|
161
|
+
drain: () => [{ k: 'w', t: pageMs, localMs: pageMs, ps: [], os: [], own: [] }],
|
|
162
|
+
};
|
|
163
|
+
answer = () => Promise.resolve(net);
|
|
164
|
+
await system.start(scene);
|
|
165
|
+
assert.equal(attempts, 3, 'network recovery alone cannot restart a given-up join');
|
|
166
|
+
assert.equal(system.net, null);
|
|
167
|
+
|
|
168
|
+
// A fresh session still permits an immediate attempt and clears backoff.
|
|
169
|
+
system.reset = () => {};
|
|
170
|
+
system.switchSession(scene, { mode: 'public' });
|
|
171
|
+
assert.equal(system.joinFailures, 0);
|
|
172
|
+
assert.equal(system.joinRetryAt, 0);
|
|
173
|
+
answer = () => Promise.reject(castleError(code));
|
|
174
|
+
const before = attempts;
|
|
175
|
+
await system.start(scene);
|
|
176
|
+
assert.equal(attempts, before + 1, 'switchSession permits an immediate first attempt');
|
|
177
|
+
pageMs += 1000;
|
|
178
|
+
answer = () => Promise.resolve(net);
|
|
179
|
+
await system.start(scene);
|
|
180
|
+
assert.equal(system.net, net, 'a fresh join recovers when the network returns');
|
|
181
|
+
assert.equal(system.joinFailures, 1, 'connecting alone does not reset failures');
|
|
182
|
+
assert.equal(system.joinRetryAt, 0);
|
|
183
|
+
system.net = null;
|
|
184
|
+
system.starting = false;
|
|
185
|
+
answer = () => Promise.reject(castleError(code));
|
|
186
|
+
await system.start(scene);
|
|
187
|
+
assert.equal(system.joinRetryAt - pageMs, 2000, 'an unplaced connection retains the next backoff');
|
|
188
|
+
|
|
189
|
+
pageMs += 2000;
|
|
190
|
+
answer = () => Promise.resolve(net);
|
|
191
|
+
await system.start(scene);
|
|
192
|
+
assert.equal(system.joinFailures, 2, 'a second unplaced connection still retains both failures');
|
|
193
|
+
system.receive(scene);
|
|
194
|
+
assert.equal(system.joined, true);
|
|
195
|
+
assert.equal(system.joinFailures, 0, 'placement resets consecutive failures');
|
|
196
|
+
system.net = null;
|
|
197
|
+
system.starting = false;
|
|
198
|
+
answer = () => Promise.reject(castleError(code));
|
|
199
|
+
await system.start(scene);
|
|
200
|
+
assert.equal(system.joinRetryAt - pageMs, 1000, 'placement resets the next backoff');
|
|
96
201
|
n += 1;
|
|
97
202
|
}
|
|
98
203
|
|
|
99
204
|
// A connection closed because its recovery was refused as barred: not joined again.
|
|
100
|
-
for (const [closeCode, rejoins] of [['CAULDRON_HUB_BANNED', false], ['MULTIPLAYER_CONNECTION_LOST', true], [null, true]]) {
|
|
205
|
+
for (const [closeCode, rejoins] of [['CAULDRON_HUB_BANNED', false], ['CAULDRON_HUB_INVITE_FORBIDDEN', false], ['MULTIPLAYER_CONNECTION_LOST', true], [null, true]]) {
|
|
101
206
|
const system = make();
|
|
102
207
|
attempts = 0;
|
|
103
208
|
let closed = false;
|
|
@@ -114,12 +219,13 @@ for (const [closeCode, rejoins] of [['CAULDRON_HUB_BANNED', false], ['MULTIPLAYE
|
|
|
114
219
|
closed = true;
|
|
115
220
|
system.reset = () => {};
|
|
116
221
|
system.afterBehaviors(scene, 0.016);
|
|
222
|
+
if (rejoins) { pageMs += 1000; } // pre-placement closes now count as a failed attempt
|
|
117
223
|
for (let i = 0; i < 3; i += 1) {
|
|
118
224
|
system.afterBehaviors(scene, 0.016);
|
|
119
225
|
await flush();
|
|
120
226
|
}
|
|
121
227
|
assert.equal(attempts > 1, rejoins, `closed on ${closeCode}`);
|
|
122
|
-
assert.equal(system.joinError, rejoins ? null :
|
|
228
|
+
assert.equal(system.joinError, rejoins ? null : closeCode);
|
|
123
229
|
n += 1;
|
|
124
230
|
}
|
|
125
231
|
|
|
@@ -152,6 +258,7 @@ for (const [target, placedFirst, state, rejoins] of [
|
|
|
152
258
|
closed = true;
|
|
153
259
|
system.afterBehaviors(scene, 0.016);
|
|
154
260
|
assert.equal(system.joinState(), state, `${target.mode} placed=${placedFirst}`);
|
|
261
|
+
if (rejoins) { pageMs += 1000; } // pre-placement closes now count as a failed attempt
|
|
155
262
|
for (let i = 0; i < 3; i += 1) {
|
|
156
263
|
system.afterBehaviors(scene, 0.016);
|
|
157
264
|
await flush();
|
|
@@ -191,4 +298,5 @@ for (const [target, placedFirst, state, rejoins] of [
|
|
|
191
298
|
}
|
|
192
299
|
|
|
193
300
|
console.log = log;
|
|
301
|
+
Object.defineProperty(globalThis, 'performance', { value: realPerformance, configurable: true });
|
|
194
302
|
console.log(`test-ban-join: ${n} ok`);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// The build stamp QA reads off the page as `__hub.build`.
|
|
3
3
|
import assert from 'node:assert/strict';
|
|
4
4
|
import fs from 'node:fs';
|
|
5
|
-
import { buildStamp } from '../code/client/build.js';
|
|
5
|
+
import { buildStamp, showBuildStamp } from '../code/client/build.js';
|
|
6
6
|
|
|
7
7
|
const sha = '0123456789abcdef0123456789abcdef01234567';
|
|
8
8
|
const savedAt = '2026-10-07T20:00:00Z';
|
|
@@ -25,7 +25,25 @@ for (const bad of [undefined, null, 'x', 7, [], {}, { sha }, { savedAt }, { sha:
|
|
|
25
25
|
|
|
26
26
|
// A deck without the file keeps the handle it had: no `build` key at all.
|
|
27
27
|
const read = (file) => fs.readFileSync(new URL(`../code/${file}`, import.meta.url), 'utf8');
|
|
28
|
-
assert.match(read('systems/hub.js'), /globalThis\.__hub = \{ scene, system: this, state: Hub\.hub, \.\.\.\(Hub\.deck\.build \? \{ build: Hub\.deck\.build \} : \{\}\) \};/);
|
|
28
|
+
assert.match(read('systems/hub.js'), /globalThis\.__hub = \{ scene, system: this, state: Hub\.hub, \.\.\.\(Hub\.deck\.build \? \{ build: Hub\.deck\.build, serverBuild \} : \{\}\) \};/);
|
|
29
29
|
assert.match(read('client/hookLayer.js'), /deck\.build = buildStamp\(Object\.values\(import\.meta\.glob\('\/build\.json', \{ eager: true, import: 'default' \}\)\)\[0\]\);/);
|
|
30
30
|
assert.match(read('client/state.js'), /\n {2}build: null,\n/);
|
|
31
31
|
console.log('test-build: ok');
|
|
32
|
+
|
|
33
|
+
// No stamp does not create a node; a stamped deck reuses its hidden evidence.
|
|
34
|
+
const nodes = new Map();
|
|
35
|
+
const doc = {
|
|
36
|
+
body: { appendChild(node) { nodes.set(node.id, node); } },
|
|
37
|
+
getElementById(id) { return nodes.get(id); },
|
|
38
|
+
createElement() { return {}; },
|
|
39
|
+
};
|
|
40
|
+
showBuildStamp(null, doc);
|
|
41
|
+
assert.equal(nodes.size, 0);
|
|
42
|
+
showBuildStamp(buildStamp({ sha, savedAt }), doc);
|
|
43
|
+
const node = nodes.get('hub-build-stamp');
|
|
44
|
+
assert.equal(node.hidden, true);
|
|
45
|
+
assert.equal(node.type, 'application/json');
|
|
46
|
+
assert.deepEqual(JSON.parse(node.textContent), { sha, savedAt });
|
|
47
|
+
showBuildStamp(buildStamp({ sha, savedAt, bundle: 'b-18' }), doc);
|
|
48
|
+
assert.equal(nodes.size, 1);
|
|
49
|
+
assert.equal(JSON.parse(node.textContent).bundle, 'b-18');
|
|
@@ -127,9 +127,11 @@ let n = 0;
|
|
|
127
127
|
n += 1;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
// v1.46: NPC chips return after a reply, and a refused inspect is retried
|
|
130
|
+
// v1.46: NPC chips return after a reply, and a refused inspect is retried
|
|
131
|
+
// once its backoff has passed.
|
|
131
132
|
{
|
|
132
|
-
const { makeTalk } = await import('../code/client/talk.js');
|
|
133
|
+
const { makeTalk, READ_RETRY_MS } = await import('../code/client/talk.js');
|
|
134
|
+
const backoffs = [];
|
|
133
135
|
const { hub } = await import('../code/client/state.js');
|
|
134
136
|
const polls = [];
|
|
135
137
|
const later = globalThis.setTimeout;
|
|
@@ -138,6 +140,11 @@ let n = 0;
|
|
|
138
140
|
let clock = 0;
|
|
139
141
|
Object.defineProperty(performance, 'now', { configurable: true, value: () => clock });
|
|
140
142
|
globalThis.setTimeout = (fn, ms, ...args) => {
|
|
143
|
+
if (ms === READ_RETRY_MS) {
|
|
144
|
+
const timer = { fn, cancelled: false };
|
|
145
|
+
backoffs.push(timer);
|
|
146
|
+
return timer;
|
|
147
|
+
}
|
|
141
148
|
if (ms !== 1200) {
|
|
142
149
|
return later(fn, ms, ...args);
|
|
143
150
|
}
|
|
@@ -237,7 +244,11 @@ let n = 0;
|
|
|
237
244
|
assert.equal(canType, false);
|
|
238
245
|
handlers.end();
|
|
239
246
|
open();
|
|
240
|
-
assert.equal(inspections,
|
|
247
|
+
assert.equal(inspections, 1, 'a refusal holds the next read back');
|
|
248
|
+
handlers.end();
|
|
249
|
+
backoffs.shift().fn();
|
|
250
|
+
open();
|
|
251
|
+
assert.equal(inspections, 2, 'and is retried on an open after its backoff');
|
|
241
252
|
inspectResolve({ participantId: 'p-a' });
|
|
242
253
|
await settle();
|
|
243
254
|
assert.equal(canType, true);
|
|
@@ -476,7 +487,10 @@ let n = 0;
|
|
|
476
487
|
|
|
477
488
|
// v1.47: the Chat prompt reads ahead, but never retries a refusal each frame.
|
|
478
489
|
{
|
|
479
|
-
const { makeTalk } = await import('../code/client/talk.js');
|
|
490
|
+
const { makeTalk, READ_RETRY_MS } = await import('../code/client/talk.js');
|
|
491
|
+
const later = globalThis.setTimeout;
|
|
492
|
+
const backoffs = [];
|
|
493
|
+
globalThis.setTimeout = (fn, ms, ...args) => (ms === READ_RETRY_MS ? backoffs.push(fn) : later(fn, ms, ...args));
|
|
480
494
|
const { hub } = await import('../code/client/state.js');
|
|
481
495
|
const settle = () => new Promise((resolve) => setImmediate(resolve));
|
|
482
496
|
let handlers;
|
|
@@ -522,7 +536,11 @@ let n = 0;
|
|
|
522
536
|
frame();
|
|
523
537
|
assert.equal(inspections, 1, 'a refused approach is not polled');
|
|
524
538
|
open();
|
|
525
|
-
assert.equal(inspections,
|
|
539
|
+
assert.equal(inspections, 1, 'nor read again on an open inside its backoff');
|
|
540
|
+
handlers.end();
|
|
541
|
+
backoffs.shift()();
|
|
542
|
+
open();
|
|
543
|
+
assert.equal(inspections, 2, 'an open after it retries');
|
|
526
544
|
inspectResolve({ participantId: 'p-a' });
|
|
527
545
|
await settle();
|
|
528
546
|
assert.equal(canType, true);
|
|
@@ -541,6 +559,7 @@ let n = 0;
|
|
|
541
559
|
assert.equal(canType, true, 'a completed approach read permits typing at once');
|
|
542
560
|
handlers.end();
|
|
543
561
|
hub.npcEvents.length = 0;
|
|
562
|
+
globalThis.setTimeout = later;
|
|
544
563
|
n += 1;
|
|
545
564
|
}
|
|
546
565
|
|
|
@@ -592,6 +611,8 @@ let n = 0;
|
|
|
592
611
|
handlers.send('hello?');
|
|
593
612
|
assert.equal(turns, 0, 'nothing is sent from a closed panel');
|
|
594
613
|
open();
|
|
614
|
+
// The new session registers its player before it may type.
|
|
615
|
+
await settle();
|
|
595
616
|
refuse = 'HUB_NPC_NOT_TALKING';
|
|
596
617
|
handlers.send('are you there?');
|
|
597
618
|
await settle();
|
|
@@ -669,6 +690,101 @@ let n = 0;
|
|
|
669
690
|
}
|
|
670
691
|
}
|
|
671
692
|
|
|
693
|
+
// The real chrome: an under-13 speaker's plain line sits under the talk
|
|
694
|
+
// panel's log (the opening), above the field, until it is taken away or the
|
|
695
|
+
// panel closes; the say card's field takes a part's words and gives them back
|
|
696
|
+
// in place, and a part that names none reads 'Message…'.
|
|
697
|
+
{
|
|
698
|
+
const { makeChrome } = await import('../code/client/chrome.js');
|
|
699
|
+
const { under13Talk } = await import('../code/client/talk.js');
|
|
700
|
+
// Fixture words for a chat part that names its own.
|
|
701
|
+
const PART = 'Friends only';
|
|
702
|
+
const oldDocument = globalThis.document;
|
|
703
|
+
const nodes = [];
|
|
704
|
+
const element = (tag) => {
|
|
705
|
+
const node = {
|
|
706
|
+
tag, style: {}, dataset: {}, children: [], textContent: '', parentNode: null, attributes: new Map(),
|
|
707
|
+
scrollHeight: 0, scrollTop: 0, clientHeight: 0, offsetTop: 0,
|
|
708
|
+
get childElementCount() { return this.children.length; },
|
|
709
|
+
get isConnected() { return Boolean(this.parentNode); },
|
|
710
|
+
appendChild(child) { child.remove(); child.parentNode = this; this.children.push(child); return child; },
|
|
711
|
+
insertBefore(child, before) {
|
|
712
|
+
child.remove();
|
|
713
|
+
child.parentNode = this;
|
|
714
|
+
const index = this.children.indexOf(before);
|
|
715
|
+
this.children.splice(index < 0 ? this.children.length : index, 0, child);
|
|
716
|
+
},
|
|
717
|
+
replaceChildren() { this.children = []; },
|
|
718
|
+
remove() { if (this.parentNode) { this.parentNode.children = this.parentNode.children.filter((child) => child !== this); this.parentNode = null; } },
|
|
719
|
+
addEventListener() {}, removeEventListener() {}, focus() {}, blur() {},
|
|
720
|
+
setAttribute(name, value) { this.attributes.set(name, String(value)); },
|
|
721
|
+
removeAttribute(name) { this.attributes.delete(name); },
|
|
722
|
+
getAttribute(name) { return this.attributes.get(name) ?? null; },
|
|
723
|
+
};
|
|
724
|
+
nodes.push(node);
|
|
725
|
+
return node;
|
|
726
|
+
};
|
|
727
|
+
globalThis.document = { body: element('body'), createElement: element, activeElement: null };
|
|
728
|
+
let chrome;
|
|
729
|
+
try {
|
|
730
|
+
chrome = makeChrome({ onBack() {}, onAvatar() {}, avatarCount: 4 });
|
|
731
|
+
const words = under13Talk('Rowan');
|
|
732
|
+
const shown = () => nodes.filter((node) => node.textContent === words && node.parentNode);
|
|
733
|
+
chrome.talkHint(words);
|
|
734
|
+
assert.equal(shown().length, 0, 'nothing while no panel is open');
|
|
735
|
+
chrome.openTalk('Rowan, the baker', { mind: true, canType: false });
|
|
736
|
+
chrome.talkLine('them', 'Hi there.');
|
|
737
|
+
const opening = nodes.find((node) => node.textContent === 'Hi there.');
|
|
738
|
+
chrome.talkHint(words);
|
|
739
|
+
const [hint] = shown();
|
|
740
|
+
assert.ok(hint, 'shown');
|
|
741
|
+
const panel = opening.parentNode.parentNode;
|
|
742
|
+
const form = nodes.find((node) => node.name === 'say').parentNode;
|
|
743
|
+
assert.equal(hint.parentNode, panel);
|
|
744
|
+
const order = panel.children;
|
|
745
|
+
assert.ok(order.indexOf(opening.parentNode) < order.indexOf(hint) && order.indexOf(hint) < order.indexOf(form), 'under the opening, above the field');
|
|
746
|
+
assert.equal(hint.children.length, 0, 'plain words: no button or chip');
|
|
747
|
+
assert.notEqual(hint.tag, 'button');
|
|
748
|
+
chrome.talkHint(words);
|
|
749
|
+
assert.equal(shown().length, 1, 'the same words again change nothing');
|
|
750
|
+
assert.equal(shown()[0], hint);
|
|
751
|
+
chrome.talkHint(null);
|
|
752
|
+
assert.equal(shown().length, 0, 'null takes it away');
|
|
753
|
+
chrome.talkHint(words);
|
|
754
|
+
chrome.closeTalk();
|
|
755
|
+
assert.equal(shown().length, 0, 'closing takes it away');
|
|
756
|
+
chrome.openTalk('Rowan', { mind: true, canType: false });
|
|
757
|
+
assert.equal(shown().length, 0, 'a new panel starts without it');
|
|
758
|
+
chrome.closeTalk();
|
|
759
|
+
|
|
760
|
+
// The say card's field: built with a part's words, then given back.
|
|
761
|
+
const say = (chat) => chrome.setSay({ reactions: [], phrases: [], chat });
|
|
762
|
+
say({ input: false, note: PART, placeholder: PART, label: PART });
|
|
763
|
+
const field = () => nodes.findLast((node) => node.name === 'message');
|
|
764
|
+
assert.equal(field().placeholder, PART);
|
|
765
|
+
assert.equal(field().disabled, true);
|
|
766
|
+
assert.equal(field().getAttribute('aria-label'), PART);
|
|
767
|
+
assert.ok(nodes.some((node) => node.parentNode && node.textContent === PART), 'the note');
|
|
768
|
+
const built = field();
|
|
769
|
+
say({ input: false, note: "Chat isn't available on this account" });
|
|
770
|
+
assert.equal(field(), built, 'rewritten in place');
|
|
771
|
+
assert.equal(built.placeholder, 'Message…', 'a part that names none reads Message…');
|
|
772
|
+
assert.equal(built.getAttribute('aria-label'), null);
|
|
773
|
+
say({ input: false, note: PART, placeholder: PART, label: PART });
|
|
774
|
+
assert.equal(field(), built);
|
|
775
|
+
assert.equal(built.placeholder, PART, 'and back, in place');
|
|
776
|
+
assert.equal(built.getAttribute('aria-label'), PART);
|
|
777
|
+
n += 1;
|
|
778
|
+
} finally {
|
|
779
|
+
chrome?.dispose();
|
|
780
|
+
if (oldDocument === undefined) {
|
|
781
|
+
delete globalThis.document;
|
|
782
|
+
} else {
|
|
783
|
+
globalThis.document = oldDocument;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
|
|
672
788
|
// v1.76: approach consumes private greeting hooks, without opening a panel.
|
|
673
789
|
{
|
|
674
790
|
const { makeTalk } = await import('../code/client/talk.js');
|
|
@@ -790,3 +906,88 @@ console.log(`test-chat: ${n} passed`);
|
|
|
790
906
|
hub.npcEvents.push({ k: 'hub-npc-preferred', npc: null }); frame();
|
|
791
907
|
assert.equal(prompt, 'Vela');
|
|
792
908
|
}
|
|
909
|
+
|
|
910
|
+
// Marker-gated report and block: old hosts never confirm it; confirmed blocks
|
|
911
|
+
// clear waiting messages and discard polls already in flight.
|
|
912
|
+
{
|
|
913
|
+
const { chatModerationEnabled } = await import('../code/client/chatModeration.js');
|
|
914
|
+
const scene = (value) => ({ getActor: (id) => id === 'hub-chat-moderation' ? { components: { HubChatModeration: value } } : null });
|
|
915
|
+
assert.equal(chatModerationEnabled(scene({ v: 1 })), true);
|
|
916
|
+
for (const value of [null, {}, { v: 2 }, { v: 1, extra: true }]) assert.equal(chatModerationEnabled(scene(value)), false);
|
|
917
|
+
assert.equal(chatModerationEnabled({}), false);
|
|
918
|
+
let poll;
|
|
919
|
+
let result = { status: 'ok' };
|
|
920
|
+
const calls = [];
|
|
921
|
+
globalThis.__chatHub = {
|
|
922
|
+
chat: () => new Promise((resolve) => { poll = resolve; }), say() {},
|
|
923
|
+
reportChat: async (...args) => { calls.push(args); return result; },
|
|
924
|
+
};
|
|
925
|
+
const c = makeChat();
|
|
926
|
+
c.peers = ['102', '103'];
|
|
927
|
+
c.incoming.push({ fromUserId: '102', text: 'waiting' });
|
|
928
|
+
let ok;
|
|
929
|
+
c.reportAndBlock('m1', '102', (value) => { ok = value; }); await flush();
|
|
930
|
+
assert.equal(ok, false, 'report-only hosts do not confirm a block');
|
|
931
|
+
assert.equal(c.incoming.length, 1);
|
|
932
|
+
c.frame(true, 1000);
|
|
933
|
+
result = { status: 'ok', blocked: true };
|
|
934
|
+
c.reportAndBlock('m1', '102', (value) => { ok = value; }); await flush();
|
|
935
|
+
assert.equal(ok, true);
|
|
936
|
+
assert.deepEqual(calls.at(-1), ['m1', { block: true }]);
|
|
937
|
+
assert.deepEqual(c.incoming, []);
|
|
938
|
+
assert.deepEqual(c.peers, ['103']);
|
|
939
|
+
poll({ status: 'ok', peers: [], messages: [{ fromUserId: '102', text: 'in flight' }], cursor: 'c' }); await flush();
|
|
940
|
+
assert.deepEqual(c.incoming, [], 'a poll started before the block cannot restore messages');
|
|
941
|
+
const { makeSay } = await import('../code/client/say.js');
|
|
942
|
+
const say = makeSay();
|
|
943
|
+
say.chat(1, 'p2', 'bo', { id: 'm1', fromUserId: '102', text: 'hide me' }, 6000);
|
|
944
|
+
say.chat(1, 'p3', 'other', { id: 'm2', fromUserId: '103', text: 'keep me' }, 6000);
|
|
945
|
+
say.hideUser('102');
|
|
946
|
+
assert.deepEqual(say.feed(), [{ id: 'm2', userId: '103', text: 'other: keep me' }]);
|
|
947
|
+
const labels = say.labels({ multiplayer: { avatars: { actors: new Map([['p2','a2'],['p3','a3']]) } }, getActor: () => ({ components: { Transform: { x: 0, y: 0, z: 0 } } }) }, null, null, null, () => ({ x: 1, y: 1 }), 'me');
|
|
948
|
+
assert.deepEqual(labels.map((l) => l.text), ['keep me']);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
// Exercise the actual chrome event handlers: the marker controls the new
|
|
952
|
+
// action, and clicking it carries the original line without choosing a target.
|
|
953
|
+
{
|
|
954
|
+
const { makeChrome } = await import('../code/client/chrome.js');
|
|
955
|
+
const previous = globalThis.document;
|
|
956
|
+
const nodes = [];
|
|
957
|
+
const element = () => {
|
|
958
|
+
const node = {
|
|
959
|
+
style: {}, dataset: {}, children: [], textContent: '', parentNode: null, handlers: new Map(),
|
|
960
|
+
get childElementCount() { return this.children.length; },
|
|
961
|
+
appendChild(child) { child.parentNode = this; this.children.push(child); return child; },
|
|
962
|
+
insertBefore(child, before) { child.remove(); child.parentNode = this; const at = this.children.indexOf(before); this.children.splice(at < 0 ? this.children.length : at, 0, child); },
|
|
963
|
+
replaceChildren() { this.children = []; },
|
|
964
|
+
remove() { if (this.parentNode) this.parentNode.children = this.parentNode.children.filter((c) => c !== this); },
|
|
965
|
+
addEventListener(type, fn) { this.handlers.set(type, fn); }, removeEventListener() {}, setAttribute() {}, focus() {}, blur() {},
|
|
966
|
+
};
|
|
967
|
+
nodes.push(node);
|
|
968
|
+
return node;
|
|
969
|
+
};
|
|
970
|
+
globalThis.document = { body: element(), createElement: element, activeElement: null };
|
|
971
|
+
const blocked = [];
|
|
972
|
+
let chrome;
|
|
973
|
+
const tap = (node) => node.handlers.get('pointerdown')({ stopPropagation() {} });
|
|
974
|
+
try {
|
|
975
|
+
chrome = makeChrome({ onBack() {}, onAvatar() {}, avatarCount: 4, onBlockChat: (line) => blocked.push(line) });
|
|
976
|
+
const line = { text: 'bo: hello', id: 'm1', userId: '102' };
|
|
977
|
+
chrome.setChatModeration(false);
|
|
978
|
+
chrome.setFeed([line]);
|
|
979
|
+
tap(nodes.findLast((node) => node.textContent === line.text));
|
|
980
|
+
assert.equal(nodes.some((node) => node.textContent === 'Report & block'), false);
|
|
981
|
+
chrome.setChatModeration(true);
|
|
982
|
+
chrome.setFeed([line]);
|
|
983
|
+
tap(nodes.findLast((node) => node.textContent === line.text));
|
|
984
|
+
const button = nodes.findLast((node) => node.textContent === 'Report & block');
|
|
985
|
+
assert.ok(button);
|
|
986
|
+
tap(button);
|
|
987
|
+
assert.deepEqual(blocked, [line]);
|
|
988
|
+
assert.equal(button.parentNode.style.flexWrap, 'wrap', 'controls wrap on narrow screens');
|
|
989
|
+
} finally {
|
|
990
|
+
chrome?.dispose();
|
|
991
|
+
if (previous === undefined) delete globalThis.document; else globalThis.document = previous;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
@@ -147,11 +147,13 @@ await test('idle/gone end; leave/prune drop record, met, turns and in-flight adm
|
|
|
147
147
|
await r.npcs.onRead(read('p1', { type: 'status', operationId: 'late' }, { status: 'completed', response: secret('late') })); assert.equal(r.sent.length, count);
|
|
148
148
|
r.message('p1', 'hub-npc-open'); r.h.sim.players.delete('p1'); r.tick(); assert.equal(r.npcs.handle('companion:p1'), null); assert.equal(r.sent.at(-1)[1].why, 'left'); r.privateOnly();
|
|
149
149
|
});
|
|
150
|
-
function hubRig(companion = declaration, implementation = layer, mind = true) {
|
|
150
|
+
function hubRig(companion = declaration, implementation = layer, mind = true, childAsks) {
|
|
151
151
|
const sent = []; let hub;
|
|
152
152
|
globalThis.__companionChatActors = [{ id: 'player', components: { Player: {}, Transform: { x: 0, y: 1, z: 0 } } }];
|
|
153
153
|
const hooks = { ready(ctx) { hub = ctx; }, npcOpening(_ctx, _npc, id) { return secret('opening', id); }, npcLine(_ctx, _npc, id, info) { return secret(info.why, id); } };
|
|
154
|
-
const
|
|
154
|
+
const config = json(companion);
|
|
155
|
+
if (childAsks) {config.characterBundle = { ...bundle, characters: [{ id: 'companion', childAsks }] };}
|
|
156
|
+
const server = implementation(config, hooks, {}, () => true, () => null, null, { createBody() { return { setEnabled() {}, setNextKinematicTranslation() {}, setNextKinematicRotation() {} }; } });
|
|
155
157
|
const session = { sessionId: 'dev', players: [...players], characters: mind ? {} : null, send(id, msg) { sent.push([id, structuredClone(msg)]); }, broadcast(msg) { sent.push(['all', structuredClone(msg)]); } };
|
|
156
158
|
const world = { timeMs: 0, scenePath: 'scenes/main.scene', objects: new Map(), bodies: new Map(), players: new Map(players.map((p) => [p.playerId, { at: { x: 0, y: 1, z: 0 }, facing: 0, body: { setTranslation() {} } }])) };
|
|
157
159
|
server.sceneFor(session); server.ready(world);
|
|
@@ -183,6 +185,22 @@ await test('real hub mind open, pending refusal and host status reply send only
|
|
|
183
185
|
assert(r.sent.some(([, msg]) => msg.text === secret('busy'))); assert(r.sent.some(([, msg]) => msg.text === secret('budget')));
|
|
184
186
|
for (const state of [r.server.join(), r.server.delta()]) assert(!JSON.stringify(state).includes('private:'));
|
|
185
187
|
});
|
|
188
|
+
await test('v1.142: real hub reads published childAsks without projecting prompts', async () => {
|
|
189
|
+
const asks = Object.fromEntries(JSON.parse(readFileSync(new URL('../../../experiments/hub-town/castle.json', import.meta.url), 'utf8')).characterBundle.characters.filter((c) => c.childAsks).map((c) => [c.id, c.childAsks])).greeter;
|
|
190
|
+
const r = hubRig(declaration, layer, true, asks);
|
|
191
|
+
r.session.players = r.session.players.map((p) => ({ ...p, under13: p.playerId === 'p1' }));
|
|
192
|
+
r.hub.companion('p1', { look: 'bird' }); r.tick();
|
|
193
|
+
r.say('p1', { k: 'hub-npc-open', npc: 'companion:p1' });
|
|
194
|
+
const opened = r.sent.find(([id, msg]) => id === 'p1' && msg.open === true)[1];
|
|
195
|
+
assert.deepEqual(opened.choices, asks.map(({ id, label }) => ({ id, label })));
|
|
196
|
+
assert.equal(opened.opening.text, 'Tap a question to talk with Chirp.');
|
|
197
|
+
const t = turn('p1', 'child', { input: 'choice:hi' });
|
|
198
|
+
await r.server.worldCharacters.onWorldCharacterTurn(r.session, t);
|
|
199
|
+
assert(t.sent); assert.equal(t.args, undefined);
|
|
200
|
+
for (const state of [r.server.join(), r.server.delta(), r.sent]) {
|
|
201
|
+
assert(!JSON.stringify(state).includes(asks[0].prompt));
|
|
202
|
+
}
|
|
203
|
+
});
|
|
186
204
|
await test('follower-only true is byte-identical to the captured wire before this task', () => {
|
|
187
205
|
const trace = (implementation, dress) => {
|
|
188
206
|
const r = hubRig(true, implementation); const states = [r.server.join(), r.server.delta()];
|