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
package/dist/castle-host/host.js
CHANGED
|
@@ -41,10 +41,27 @@ const COMMAND_NAMES = [
|
|
|
41
41
|
"portal.open",
|
|
42
42
|
"portal.prefetch",
|
|
43
43
|
"portal.info",
|
|
44
|
+
"social.friends",
|
|
45
|
+
"social.presence",
|
|
46
|
+
"party.current",
|
|
47
|
+
"party.create",
|
|
48
|
+
"party.invite",
|
|
49
|
+
"party.respond",
|
|
50
|
+
"party.members",
|
|
51
|
+
"party.leave",
|
|
52
|
+
"party.messages",
|
|
53
|
+
"party.say",
|
|
44
54
|
"hub.go",
|
|
45
55
|
"hub.back",
|
|
46
56
|
"hub.doors",
|
|
47
57
|
"hub.friends",
|
|
58
|
+
"hub.invite",
|
|
59
|
+
"hub.canInvite",
|
|
60
|
+
"hub.inviteArrival",
|
|
61
|
+
"hub.undoInvite",
|
|
62
|
+
"hub.hearts",
|
|
63
|
+
"hub.setHearts",
|
|
64
|
+
"hub.signIn",
|
|
48
65
|
"hub.jump",
|
|
49
66
|
"hub.report",
|
|
50
67
|
"hub.chat",
|
|
@@ -71,6 +88,8 @@ const COMMAND_NAMES = [
|
|
|
71
88
|
"cauldronStorage.transaction",
|
|
72
89
|
"cauldronStorage.claim",
|
|
73
90
|
"cauldronStorage.initialize",
|
|
91
|
+
"cauldronStorage.conditionalWrite",
|
|
92
|
+
"cauldronStorage.recentOperations",
|
|
74
93
|
"cauldronStorage.get",
|
|
75
94
|
"cauldronStorage.set",
|
|
76
95
|
"cauldronStorage.delete",
|
|
@@ -153,7 +172,8 @@ export async function executeCommand(ctx, command, params, capabilities, options
|
|
|
153
172
|
};
|
|
154
173
|
}
|
|
155
174
|
try {
|
|
156
|
-
const data = await
|
|
175
|
+
const data = await dispatchCommand(ctx, command, (params ?? {}), capabilities, options);
|
|
176
|
+
capabilities.hub?.assertActive?.();
|
|
157
177
|
noteAcquiredSession(ctx, command, data, capabilities);
|
|
158
178
|
return { ok: true, data };
|
|
159
179
|
}
|
|
@@ -161,6 +181,12 @@ export async function executeCommand(ctx, command, params, capabilities, options
|
|
|
161
181
|
return { ok: false, error: toSerializedError(error, command) };
|
|
162
182
|
}
|
|
163
183
|
}
|
|
184
|
+
function dispatchCommand(ctx, command, params, caps, options) {
|
|
185
|
+
if (isTrustedDataCommand(command)) {
|
|
186
|
+
return runTrustedDataCommand(ctx, command, params, caps.graphqlFetch);
|
|
187
|
+
}
|
|
188
|
+
return runCommand(ctx, command, params, caps, options);
|
|
189
|
+
}
|
|
164
190
|
// A door's source is the session the deck last acquired in its place.
|
|
165
191
|
function noteAcquiredSession(ctx, command, data, caps) {
|
|
166
192
|
if (!caps.hub?.sessionAcquired ||
|
|
@@ -172,6 +198,26 @@ function noteAcquiredSession(ctx, command, data, caps) {
|
|
|
172
198
|
caps.hub.sessionAcquired(result.sessionId, ctx);
|
|
173
199
|
}
|
|
174
200
|
}
|
|
201
|
+
const HUB_VISIT_COMMANDS = new Set([
|
|
202
|
+
"hub.go",
|
|
203
|
+
"hub.back",
|
|
204
|
+
"hub.doors",
|
|
205
|
+
"hub.friends",
|
|
206
|
+
"hub.invite",
|
|
207
|
+
"hub.canInvite",
|
|
208
|
+
"hub.inviteArrival",
|
|
209
|
+
"hub.undoInvite",
|
|
210
|
+
"hub.jump",
|
|
211
|
+
"hub.report",
|
|
212
|
+
"hub.chat",
|
|
213
|
+
"hub.say",
|
|
214
|
+
"hub.reportChat",
|
|
215
|
+
"hub.commit",
|
|
216
|
+
"hub.cancel",
|
|
217
|
+
]);
|
|
218
|
+
function isHubVisitCommand(command) {
|
|
219
|
+
return HUB_VISIT_COMMANDS.has(command);
|
|
220
|
+
}
|
|
175
221
|
function runCommand(ctx, command, params, caps, options) {
|
|
176
222
|
if (command === "multiplayer.getSession" && caps.getMultiplayerSession) {
|
|
177
223
|
return caps.getMultiplayerSession(multiplayerSessionRequest(params), ctx);
|
|
@@ -183,9 +229,17 @@ function runCommand(ctx, command, params, caps, options) {
|
|
|
183
229
|
}
|
|
184
230
|
return caps.joinMultiplayerDestination(request, ctx, options.signal);
|
|
185
231
|
}
|
|
232
|
+
if (command === "hub.signIn") {
|
|
233
|
+
const reason = asBoundedText(params.reason, "reason", command, 200, 512);
|
|
234
|
+
return caps.hubSignIn
|
|
235
|
+
? caps.hubSignIn(reason, ctx, options.signal)
|
|
236
|
+
: Promise.resolve({ status: "unavailable" });
|
|
237
|
+
}
|
|
186
238
|
if (isPlatformCommand(command)) {
|
|
187
239
|
return runPlatformCommand(ctx, command, params, caps);
|
|
188
240
|
}
|
|
241
|
+
if (isHubVisitCommand(command))
|
|
242
|
+
return runHubCommand(ctx, command, params, caps, options.signal);
|
|
189
243
|
const gql = caps.graphqlFetch;
|
|
190
244
|
switch (command) {
|
|
191
245
|
case "agent.chat":
|
|
@@ -214,25 +268,13 @@ function runCommand(ctx, command, params, caps, options) {
|
|
|
214
268
|
return userGet(params, gql);
|
|
215
269
|
case "experiments.get":
|
|
216
270
|
return Promise.resolve(experimentsGet(ctx));
|
|
217
|
-
case "portal.info":
|
|
218
|
-
return portalInfo(params, gql);
|
|
219
|
-
// Dormant `unavailable` on a host without `caps.hub`.
|
|
220
|
-
case "hub.go":
|
|
221
|
-
case "hub.back":
|
|
222
|
-
case "hub.doors":
|
|
223
|
-
case "hub.friends":
|
|
224
|
-
case "hub.jump":
|
|
225
|
-
case "hub.report":
|
|
226
|
-
case "hub.chat":
|
|
227
|
-
case "hub.say":
|
|
228
|
-
case "hub.reportChat":
|
|
229
|
-
case "hub.commit":
|
|
230
|
-
case "hub.cancel":
|
|
231
|
-
return runHubCommand(ctx, command, params, caps, options.signal);
|
|
232
271
|
case "time.getServerTime":
|
|
233
272
|
return timeGetServerTime(gql);
|
|
234
273
|
case "pass.has":
|
|
235
274
|
return passHas(ctx, params, caps);
|
|
275
|
+
case "hub.hearts":
|
|
276
|
+
case "hub.setHearts":
|
|
277
|
+
return hubHearts(ctx, command, params, caps);
|
|
236
278
|
case "avatar.get":
|
|
237
279
|
return avatarGet(gql);
|
|
238
280
|
case "avatar.set":
|
|
@@ -266,6 +308,8 @@ function runCommand(ctx, command, params, caps, options) {
|
|
|
266
308
|
case "cauldronStorage.transaction":
|
|
267
309
|
case "cauldronStorage.claim":
|
|
268
310
|
case "cauldronStorage.initialize":
|
|
311
|
+
case "cauldronStorage.conditionalWrite":
|
|
312
|
+
case "cauldronStorage.recentOperations":
|
|
269
313
|
return cauldronSave(ctx, command, params, gql);
|
|
270
314
|
case "cauldronStorage.get":
|
|
271
315
|
return cauldronStorageGet(ctx, params, gql);
|
|
@@ -296,23 +340,56 @@ function runCommand(ctx, command, params, caps, options) {
|
|
|
296
340
|
return runPlatformCommand(ctx, command, params, caps);
|
|
297
341
|
}
|
|
298
342
|
}
|
|
343
|
+
function isTrustedDataCommand(command) {
|
|
344
|
+
return (command === "portal.info" || command.startsWith("social.") || command.startsWith("party."));
|
|
345
|
+
}
|
|
346
|
+
function runTrustedDataCommand(ctx, command, params, gql) {
|
|
347
|
+
switch (command) {
|
|
348
|
+
case "portal.info":
|
|
349
|
+
return portalInfo(params, gql);
|
|
350
|
+
case "social.friends":
|
|
351
|
+
return socialFriends(gql);
|
|
352
|
+
case "social.presence":
|
|
353
|
+
return socialPresence(ctx, gql);
|
|
354
|
+
case "party.current":
|
|
355
|
+
return partyCurrent(ctx, gql);
|
|
356
|
+
case "party.create":
|
|
357
|
+
return partyCreate(ctx, params, gql);
|
|
358
|
+
case "party.invite":
|
|
359
|
+
return partyInvite(params, gql);
|
|
360
|
+
case "party.respond":
|
|
361
|
+
return partyRespond(params, gql);
|
|
362
|
+
case "party.members":
|
|
363
|
+
return partyMembers(params, gql);
|
|
364
|
+
case "party.leave":
|
|
365
|
+
return partyLeave(params, gql);
|
|
366
|
+
case "party.messages":
|
|
367
|
+
return partyMessages(params, gql);
|
|
368
|
+
case "party.say":
|
|
369
|
+
return partySay(params, gql);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
299
372
|
async function multiplayerGetSession(ctx, params, caps) {
|
|
300
373
|
const request = multiplayerSessionRequest(params);
|
|
301
374
|
const deckId = requireDeckId(ctx, "multiplayer.getSession");
|
|
302
375
|
const hintedSessionId = multiplayerHintedSessionId(ctx, deckId);
|
|
376
|
+
if (request.mode === "public")
|
|
377
|
+
await caps.hub?.prepareInvite?.(ctx);
|
|
378
|
+
const inviteHint = request.mode === "public" ? caps.hub?.inviteJoinHint?.(ctx) : null;
|
|
303
379
|
// Which shared session a play belongs to is the host's call, not the deck's,
|
|
304
380
|
// the way `shared.cpp` reads the party off the engine rather than the scene.
|
|
305
381
|
// A play that arrived through a party stays inside it unless trusted host
|
|
306
382
|
// chrome is sending this public join to the room where a friend is playing.
|
|
307
|
-
const mode = request.mode === "public" && ctx.partyId && !hintedSessionId
|
|
383
|
+
const mode = request.mode === "public" && ctx.partyId && !hintedSessionId && !inviteHint
|
|
308
384
|
? "party"
|
|
309
385
|
: request.mode;
|
|
310
|
-
const data = await graphql(caps.graphqlFetch, CAULDRON_MULTIPLAYER_SESSION_QUERY, {
|
|
386
|
+
const data = await graphql(caps.graphqlFetch, inviteHint ? CAULDRON_INVITE_SESSION_QUERY : CAULDRON_MULTIPLAYER_SESSION_QUERY, {
|
|
311
387
|
deckId,
|
|
312
388
|
mode,
|
|
313
389
|
key: request.key ?? null,
|
|
314
390
|
sessionId: request.mode === "public" ? hintedSessionId : null,
|
|
315
|
-
partyId: ctx.partyId ?? null,
|
|
391
|
+
partyId: inviteHint ? null : ctx.partyId ?? null,
|
|
392
|
+
...(inviteHint ? { hubInviteToken: inviteHint.token, env: inviteHint.env } : {}),
|
|
316
393
|
}, "multiplayer.getSession");
|
|
317
394
|
return multiplayerSessionResult(data.getCauldronMultiplayerSession);
|
|
318
395
|
}
|
|
@@ -477,16 +554,54 @@ async function passHas(ctx, params, caps) {
|
|
|
477
554
|
const match = (data.passesForDeck ?? []).find((p) => p?.passId === passId);
|
|
478
555
|
return { hasPass: match?.isActive === true };
|
|
479
556
|
}
|
|
557
|
+
// Account-wide hub hearts use the same trusted GraphQL seam as avatars.
|
|
558
|
+
const HEARTS_QUERY = `query CastleHubHearts { cauldronHubHearts }`;
|
|
559
|
+
const SET_HEARTS_MUTATION = `mutation CastleSetHubHearts($deckId: ID!, $doorIds: [String!]!) {
|
|
560
|
+
setCauldronHubHearts(deckId: $deckId, doorIds: $doorIds)
|
|
561
|
+
}`;
|
|
562
|
+
async function hubHearts(ctx, command, params, caps) {
|
|
563
|
+
const unavailable = { status: "unavailable", hearts: [] };
|
|
564
|
+
const ids = params.doorIds;
|
|
565
|
+
const setting = command === "hub.setHearts";
|
|
566
|
+
if (setting && (!Array.isArray(ids) || ids.length > 8 ||
|
|
567
|
+
ids.some((id) => typeof id !== "string" || !id.length || id.length > 64) ||
|
|
568
|
+
new Set(ids).size !== ids.length)) {
|
|
569
|
+
throw new HostCommandError("INVALID_ARGUMENT", "doorIds must be at most eight distinct door ids.", command);
|
|
570
|
+
}
|
|
571
|
+
if (!ctx.userId || ctx.isAnonymous === true || ctx.username?.toLowerCase().startsWith("anonymous-user-"))
|
|
572
|
+
return unavailable;
|
|
573
|
+
if (caps.localHubHearts) {
|
|
574
|
+
if (setting)
|
|
575
|
+
caps.localHubHearts.set(ctx.userId, [...ids]);
|
|
576
|
+
return { status: "ok", hearts: [...(caps.localHubHearts.get(ctx.userId) ?? [])] };
|
|
577
|
+
}
|
|
578
|
+
if (setting && !ctx.deckId)
|
|
579
|
+
return unavailable;
|
|
580
|
+
try {
|
|
581
|
+
const data = await graphql(caps.graphqlFetch, setting ? SET_HEARTS_MUTATION : HEARTS_QUERY, setting ? { deckId: ctx.deckId, doorIds: ids } : {}, command);
|
|
582
|
+
const hearts = data[setting ? "setCauldronHubHearts" : "cauldronHubHearts"];
|
|
583
|
+
return Array.isArray(hearts) && hearts.length <= 8 && hearts.every((id) => typeof id === "string")
|
|
584
|
+
? { status: "ok", hearts: [...hearts] } : unavailable;
|
|
585
|
+
}
|
|
586
|
+
catch (error) {
|
|
587
|
+
if (error instanceof HostCommandError && ["LOGIN_REQUIRED", "CAULDRON_HUB_HEARTS_NOT_A_PLACE"].includes(error.code))
|
|
588
|
+
return unavailable;
|
|
589
|
+
throw error;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
480
592
|
// The platform avatar: ghost keeps it per account (anonymous accounts too), so
|
|
481
593
|
// these are plain GraphQL with the player's own auth. A signed-out visitor has
|
|
482
594
|
// no account to keep one on, which is `unavailable`, not an error: the deck
|
|
483
595
|
// picks its own. Only a curated hub place may change it: the host names the
|
|
484
596
|
// place the player is in (ctx.deckId, never the deck's word) and ghost refuses
|
|
485
597
|
// any other deck, which is `unavailable` too.
|
|
486
|
-
|
|
598
|
+
// Ghost serves `color` (e6be5eef); a host's answer carries it, which is how
|
|
599
|
+
// the hub-game kit knows colour picks will stick.
|
|
600
|
+
const AVATAR_QUERY = `query CastleAvatar { cauldronHubAvatar { avatar chosen color } }`;
|
|
487
601
|
const SET_AVATAR_MUTATION = `mutation CastleSetAvatar($deckId: ID!, $avatar: Int!) {
|
|
488
602
|
setCauldronHubAvatar(deckId: $deckId, avatar: $avatar) { avatar chosen }
|
|
489
603
|
}`;
|
|
604
|
+
const SET_AVATAR_COLOR_MUTATION = `mutation CastleSetAvatarColor($deckId: ID!, $avatar: Int!, $color: Int) { setCauldronHubAvatar(deckId: $deckId, avatar: $avatar, color: $color) { avatar chosen color } }`;
|
|
490
605
|
const AVATAR_UNAVAILABLE_CODES = new Set([
|
|
491
606
|
"LOGIN_REQUIRED",
|
|
492
607
|
"CAULDRON_HUB_AVATAR_NOT_A_PLACE",
|
|
@@ -496,7 +611,7 @@ const AVATAR_MAX = 255;
|
|
|
496
611
|
function avatarResult(raw) {
|
|
497
612
|
const avatar = raw?.avatar;
|
|
498
613
|
return typeof avatar === "number" && Number.isInteger(avatar) && avatar >= 0
|
|
499
|
-
? { status: "ok", avatar, chosen: raw?.chosen === true }
|
|
614
|
+
? { status: "ok", avatar, chosen: raw?.chosen === true, ...(typeof raw?.color === "number" && Number.isInteger(raw.color) && raw.color >= 0 ? { color: raw.color } : {}) }
|
|
500
615
|
: unavailableAvatar();
|
|
501
616
|
}
|
|
502
617
|
function unavailableAvatar() {
|
|
@@ -519,10 +634,15 @@ async function avatarSet(ctx, params, gql) {
|
|
|
519
634
|
if (typeof avatar !== "number" || !Number.isInteger(avatar) || avatar < 0 || avatar > AVATAR_MAX) {
|
|
520
635
|
throw new HostCommandError("INVALID_ARGUMENT", "avatar must be a template index.", "avatar.set");
|
|
521
636
|
}
|
|
637
|
+
const hasColor = Object.hasOwn(params, "color");
|
|
638
|
+
const color = params.color;
|
|
639
|
+
if (hasColor && (typeof color !== "number" || !Number.isInteger(color) || color < 0 || color > AVATAR_MAX)) {
|
|
640
|
+
throw new HostCommandError("INVALID_ARGUMENT", "color must be an integer from 0 to 255.", "avatar.set");
|
|
641
|
+
}
|
|
522
642
|
if (!ctx.deckId)
|
|
523
643
|
return unavailableAvatar();
|
|
524
644
|
try {
|
|
525
|
-
const data = await graphql(gql, SET_AVATAR_MUTATION, { deckId: ctx.deckId, avatar }, "avatar.set");
|
|
645
|
+
const data = await graphql(gql, hasColor ? SET_AVATAR_COLOR_MUTATION : SET_AVATAR_MUTATION, hasColor ? { deckId: ctx.deckId, avatar, color } : { deckId: ctx.deckId, avatar }, "avatar.set");
|
|
526
646
|
return avatarResult(data.setCauldronHubAvatar);
|
|
527
647
|
}
|
|
528
648
|
catch (error) {
|
|
@@ -2625,6 +2745,10 @@ const CAULDRON_MULTIPLAYER_SESSION_QUERY = `
|
|
|
2625
2745
|
}
|
|
2626
2746
|
}
|
|
2627
2747
|
`;
|
|
2748
|
+
// Keep the default query byte-for-byte unchanged for hosts without invite opt-in.
|
|
2749
|
+
const CAULDRON_INVITE_SESSION_QUERY = CAULDRON_MULTIPLAYER_SESSION_QUERY
|
|
2750
|
+
.replace("$partyId: ID", "$partyId: ID\n $hubInviteToken: String\n $env: String")
|
|
2751
|
+
.replace("partyId: $partyId", "partyId: $partyId\n hubInviteToken: $hubInviteToken\n env: $env");
|
|
2628
2752
|
const CAULDRON_MULTIPLAYER_DESTINATION_DESCRIPTION_QUERY = `
|
|
2629
2753
|
query CastleCauldronMultiplayerDestinationDescription($deckId: ID!, $routeId: String!) {
|
|
2630
2754
|
describeCauldronMultiplayerDestination(deckId: $deckId, routeId: $routeId) {
|
|
@@ -2657,6 +2781,18 @@ const CAULDRON_MULTIPLAYER_DESTINATION_SESSION_QUERY = `
|
|
|
2657
2781
|
`;
|
|
2658
2782
|
const CLIENT_SAVE_REQUEST_MAX_BYTES = 512 * 1024;
|
|
2659
2783
|
const CAULDRON_SAVE_DOCUMENTS = {
|
|
2784
|
+
"cauldronStorage.conditionalWrite": {
|
|
2785
|
+
field: "cauldronStorageConditionalWrite",
|
|
2786
|
+
query: `mutation CastleCauldronStorageConditionalWrite($deckId: ID!, $input: Json!) {
|
|
2787
|
+
cauldronStorageConditionalWrite(deckId: $deckId, input: $input)
|
|
2788
|
+
}`,
|
|
2789
|
+
},
|
|
2790
|
+
"cauldronStorage.recentOperations": {
|
|
2791
|
+
field: "cauldronStorageRecentOperations",
|
|
2792
|
+
query: `query CastleCauldronStorageRecentOperations($deckId: ID!, $input: Json!) {
|
|
2793
|
+
cauldronStorageRecentOperations(deckId: $deckId, input: $input)
|
|
2794
|
+
}`,
|
|
2795
|
+
},
|
|
2660
2796
|
"cauldronStorage.snapshot": {
|
|
2661
2797
|
field: "cauldronStorageSnapshot",
|
|
2662
2798
|
query: `
|
|
@@ -2842,6 +2978,342 @@ const CAULDRON_STORAGE_BOARD_GET_QUERY = `
|
|
|
2842
2978
|
}
|
|
2843
2979
|
}
|
|
2844
2980
|
`;
|
|
2981
|
+
// ---------------------------------------------------------------------------
|
|
2982
|
+
// Social friends, same-deck presence, and Castle parties. These are ordinary
|
|
2983
|
+
// host data commands: the host's GraphQL transport supplies the signed-in
|
|
2984
|
+
// player, while trusted HostContext supplies the current deck and launch party.
|
|
2985
|
+
const SOCIAL_FRIENDS_QUERY = `query CastleSocialFriends {
|
|
2986
|
+
cauldronMutualFriends(limit: 20) {
|
|
2987
|
+
userId
|
|
2988
|
+
username
|
|
2989
|
+
photo { smallAvatarUrl }
|
|
2990
|
+
}
|
|
2991
|
+
}`;
|
|
2992
|
+
const SOCIAL_PRESENCE_QUERY = `query CastleSocialPresence($deckId: ID!) {
|
|
2993
|
+
deck(deckId: $deckId) {
|
|
2994
|
+
friendsPlaying {
|
|
2995
|
+
userId
|
|
2996
|
+
username
|
|
2997
|
+
photo { smallAvatarUrl }
|
|
2998
|
+
nowPlaying { deckId sessionId routeId slot updatedAt }
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
}`;
|
|
3002
|
+
const PARTY_SUMMARY_FIELDS = `
|
|
3003
|
+
partyId
|
|
3004
|
+
name
|
|
3005
|
+
status
|
|
3006
|
+
chatChannel { hasUnreadMessages }
|
|
3007
|
+
`;
|
|
3008
|
+
const PARTY_CURRENT_QUERY = `query CastlePartyCurrent($partyId: ID!) {
|
|
3009
|
+
party(partyId: $partyId) { ${PARTY_SUMMARY_FIELDS} }
|
|
3010
|
+
}`;
|
|
3011
|
+
const PARTY_CREATE_MUTATION = `mutation CastlePartyCreate($userIds: [ID]!) {
|
|
3012
|
+
createParty(userIds: $userIds) { ${PARTY_SUMMARY_FIELDS} }
|
|
3013
|
+
}`;
|
|
3014
|
+
const PARTY_INVITE_MUTATION = `mutation CastlePartyInvite($partyId: ID!, $userIds: [ID]!) {
|
|
3015
|
+
inviteToParty(partyId: $partyId, userIds: $userIds)
|
|
3016
|
+
}`;
|
|
3017
|
+
const PARTY_ACCEPT_MUTATION = `mutation CastlePartyAccept($partyId: ID!) {
|
|
3018
|
+
acceptPartyInvite(partyId: $partyId)
|
|
3019
|
+
}`;
|
|
3020
|
+
const PARTY_REJECT_MUTATION = `mutation CastlePartyReject($partyId: ID!) {
|
|
3021
|
+
rejectPartyInvite(partyId: $partyId)
|
|
3022
|
+
}`;
|
|
3023
|
+
const PARTY_MEMBERS_QUERY = `query CastlePartyMembers($partyId: ID!) {
|
|
3024
|
+
usersForParty(partyId: $partyId) {
|
|
3025
|
+
user { userId username photo { smallAvatarUrl } }
|
|
3026
|
+
status
|
|
3027
|
+
role
|
|
3028
|
+
}
|
|
3029
|
+
}`;
|
|
3030
|
+
const PARTY_LEAVE_MUTATION = `mutation CastlePartyLeave($partyId: ID!) {
|
|
3031
|
+
leaveParty(partyId: $partyId)
|
|
3032
|
+
}`;
|
|
3033
|
+
const PARTY_MESSAGES_QUERY = `query CastlePartyMessages(
|
|
3034
|
+
$chatChannelId: ID!
|
|
3035
|
+
$paginateToken: String
|
|
3036
|
+
) {
|
|
3037
|
+
chatMessages(chatChannelId: $chatChannelId, limit: 20, paginateToken: $paginateToken) {
|
|
3038
|
+
chatMessages {
|
|
3039
|
+
chatMessageId
|
|
3040
|
+
fromUserId
|
|
3041
|
+
fromUser { username }
|
|
3042
|
+
body
|
|
3043
|
+
createdTime
|
|
3044
|
+
}
|
|
3045
|
+
paginateToken
|
|
3046
|
+
}
|
|
3047
|
+
}`;
|
|
3048
|
+
const PARTY_SAY_MUTATION = `mutation CastlePartySay($chatChannelId: ID!, $message: String!) {
|
|
3049
|
+
sendChatMessage(chatChannelId: $chatChannelId, message: $message) {
|
|
3050
|
+
chatMessageId
|
|
3051
|
+
fromUserId
|
|
3052
|
+
fromUser { username }
|
|
3053
|
+
body
|
|
3054
|
+
createdTime
|
|
3055
|
+
}
|
|
3056
|
+
}`;
|
|
3057
|
+
const SOCIAL_FRIENDS_MAX = 20;
|
|
3058
|
+
const PARTY_USERS_MAX = 32;
|
|
3059
|
+
const PARTY_MESSAGES_MAX = 20;
|
|
3060
|
+
const PARTY_ID_MAX = 128;
|
|
3061
|
+
const PARTY_CURSOR_MAX = 512;
|
|
3062
|
+
const PARTY_TEXT_MAX = 1_000;
|
|
3063
|
+
const PARTY_BODY_MAX_BYTES = 64 * 1024;
|
|
3064
|
+
const PARTY_STATUSES = new Set([
|
|
3065
|
+
"invited",
|
|
3066
|
+
"joined",
|
|
3067
|
+
"rejected",
|
|
3068
|
+
"left",
|
|
3069
|
+
"party_closed",
|
|
3070
|
+
"banned",
|
|
3071
|
+
]);
|
|
3072
|
+
const PARTY_ROLES = new Set(["member", "host", "owner"]);
|
|
3073
|
+
async function socialFriends(gql) {
|
|
3074
|
+
const data = await graphql(gql, SOCIAL_FRIENDS_QUERY, {}, "social.friends");
|
|
3075
|
+
const rows = Array.isArray(data.cauldronMutualFriends) ? data.cauldronMutualFriends : [];
|
|
3076
|
+
return rows.flatMap(publicSocialFriend).slice(0, SOCIAL_FRIENDS_MAX);
|
|
3077
|
+
}
|
|
3078
|
+
async function socialPresence(ctx, gql) {
|
|
3079
|
+
// Unsaved decks and a gated/null field have no observable presence. Older
|
|
3080
|
+
// GraphQL surfaces and transport failures also fail closed, but a coded
|
|
3081
|
+
// Castle refusal (LOGIN_REQUIRED, permission codes, and so on) remains a
|
|
3082
|
+
// CastleError with its server code.
|
|
3083
|
+
if (!ctx.deckId)
|
|
3084
|
+
return [];
|
|
3085
|
+
try {
|
|
3086
|
+
const data = await graphql(gql, SOCIAL_PRESENCE_QUERY, { deckId: ctx.deckId }, "social.presence");
|
|
3087
|
+
const rows = Array.isArray(data.deck?.friendsPlaying) ? data.deck.friendsPlaying : [];
|
|
3088
|
+
return rows
|
|
3089
|
+
.flatMap((row) => publicSocialPresence(row, ctx.deckId))
|
|
3090
|
+
.slice(0, SOCIAL_FRIENDS_MAX);
|
|
3091
|
+
}
|
|
3092
|
+
catch (error) {
|
|
3093
|
+
if (error instanceof HostCommandError &&
|
|
3094
|
+
error.code !== "GRAPHQL_ERROR" &&
|
|
3095
|
+
error.code !== "GRAPHQL_NO_DATA") {
|
|
3096
|
+
throw error;
|
|
3097
|
+
}
|
|
3098
|
+
return [];
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
async function partyCurrent(ctx, gql) {
|
|
3102
|
+
if (!ctx.partyId)
|
|
3103
|
+
return null;
|
|
3104
|
+
const data = await graphql(gql, PARTY_CURRENT_QUERY, { partyId: ctx.partyId }, "party.current");
|
|
3105
|
+
return publicPartySummary(data.party);
|
|
3106
|
+
}
|
|
3107
|
+
async function partyCreate(ctx, params, gql) {
|
|
3108
|
+
const currentUserId = requireUserId(ctx, "party.create");
|
|
3109
|
+
const requested = partyUserIds(params.userIds, "party.create").filter((userId) => userId !== currentUserId);
|
|
3110
|
+
if (requested.length >= PARTY_USERS_MAX) {
|
|
3111
|
+
throw invalidPartyArgument("party.create", `requires room for the signed-in player within ${PARTY_USERS_MAX} user ids.`);
|
|
3112
|
+
}
|
|
3113
|
+
// Deliberately no initialDeckId: creating a party does not retarget the play's
|
|
3114
|
+
// trusted ctx.partyId, which Multiplayer.join({ mode: "party" }) still uses.
|
|
3115
|
+
const userIds = [...requested, currentUserId];
|
|
3116
|
+
const data = await graphql(gql, PARTY_CREATE_MUTATION, { userIds }, "party.create");
|
|
3117
|
+
return requirePartySummary(data.createParty, "party.create");
|
|
3118
|
+
}
|
|
3119
|
+
async function partyInvite(params, gql) {
|
|
3120
|
+
const partyId = partyIdParam(params.partyId, "party.invite");
|
|
3121
|
+
const userIds = partyUserIds(params.userIds, "party.invite");
|
|
3122
|
+
await graphql(gql, PARTY_INVITE_MUTATION, { partyId, userIds }, "party.invite");
|
|
3123
|
+
return { ok: true };
|
|
3124
|
+
}
|
|
3125
|
+
async function partyRespond(params, gql) {
|
|
3126
|
+
const partyId = partyIdParam(params.partyId, "party.respond");
|
|
3127
|
+
if (typeof params.accept !== "boolean") {
|
|
3128
|
+
throw invalidPartyArgument("party.respond", "requires accept to be a boolean.");
|
|
3129
|
+
}
|
|
3130
|
+
await graphql(gql, params.accept ? PARTY_ACCEPT_MUTATION : PARTY_REJECT_MUTATION, { partyId }, "party.respond");
|
|
3131
|
+
return { ok: true };
|
|
3132
|
+
}
|
|
3133
|
+
async function partyMembers(params, gql) {
|
|
3134
|
+
const partyId = partyIdParam(params.partyId, "party.members");
|
|
3135
|
+
const data = await graphql(gql, PARTY_MEMBERS_QUERY, { partyId }, "party.members");
|
|
3136
|
+
const rows = Array.isArray(data.usersForParty) ? data.usersForParty : [];
|
|
3137
|
+
return rows.flatMap(publicPartyMember).slice(0, PARTY_USERS_MAX);
|
|
3138
|
+
}
|
|
3139
|
+
async function partyLeave(params, gql) {
|
|
3140
|
+
const partyId = partyIdParam(params.partyId, "party.leave");
|
|
3141
|
+
await graphql(gql, PARTY_LEAVE_MUTATION, { partyId }, "party.leave");
|
|
3142
|
+
return { ok: true };
|
|
3143
|
+
}
|
|
3144
|
+
async function partyMessages(params, gql) {
|
|
3145
|
+
const partyId = partyIdParam(params.partyId, "party.messages");
|
|
3146
|
+
const paginateToken = optionalBoundedPartyText(params.cursor, "cursor", "party.messages", PARTY_CURSOR_MAX);
|
|
3147
|
+
const data = await graphql(gql, PARTY_MESSAGES_QUERY, { chatChannelId: `party-${partyId}`, paginateToken }, "party.messages");
|
|
3148
|
+
const rows = Array.isArray(data.chatMessages?.chatMessages)
|
|
3149
|
+
? data.chatMessages.chatMessages
|
|
3150
|
+
: [];
|
|
3151
|
+
return {
|
|
3152
|
+
messages: rows.flatMap(publicPartyMessage).slice(0, PARTY_MESSAGES_MAX),
|
|
3153
|
+
cursor: asOptionalString(data.chatMessages?.paginateToken),
|
|
3154
|
+
};
|
|
3155
|
+
}
|
|
3156
|
+
async function partySay(params, gql) {
|
|
3157
|
+
const partyId = partyIdParam(params.partyId, "party.say");
|
|
3158
|
+
const text = asString(params.text, "text", "party.say").trim().slice(0, PARTY_TEXT_MAX);
|
|
3159
|
+
if (!text)
|
|
3160
|
+
throw invalidPartyArgument("party.say", "requires non-empty text.");
|
|
3161
|
+
const data = await graphql(gql, PARTY_SAY_MUTATION, { chatChannelId: `party-${partyId}`, message: text }, "party.say");
|
|
3162
|
+
const message = publicPartyMessage(data.sendChatMessage)[0];
|
|
3163
|
+
if (!message) {
|
|
3164
|
+
throw new HostCommandError("GRAPHQL_INVALID_RESPONSE", "Castle returned an invalid party message.", "party.say");
|
|
3165
|
+
}
|
|
3166
|
+
return message;
|
|
3167
|
+
}
|
|
3168
|
+
function publicSocialFriend(raw) {
|
|
3169
|
+
if (typeof raw !== "object" || raw === null)
|
|
3170
|
+
return [];
|
|
3171
|
+
const record = raw;
|
|
3172
|
+
const userId = asOptionalString(record.userId);
|
|
3173
|
+
const username = asOptionalString(record.username);
|
|
3174
|
+
if (!userId || !username)
|
|
3175
|
+
return [];
|
|
3176
|
+
const photo = record.photo;
|
|
3177
|
+
const photoUrl = asOptionalString(photo?.smallAvatarUrl);
|
|
3178
|
+
return [{ userId, username, ...(photoUrl ? { photoUrl } : {}) }];
|
|
3179
|
+
}
|
|
3180
|
+
function publicSocialPresence(raw, deckId) {
|
|
3181
|
+
const friend = publicSocialFriend(raw)[0];
|
|
3182
|
+
if (!friend || typeof raw !== "object" || raw === null)
|
|
3183
|
+
return [];
|
|
3184
|
+
const nowPlaying = raw.nowPlaying;
|
|
3185
|
+
if (typeof nowPlaying !== "object" || nowPlaying === null)
|
|
3186
|
+
return [];
|
|
3187
|
+
const presence = nowPlaying;
|
|
3188
|
+
const presenceDeckId = asOptionalString(presence.deckId);
|
|
3189
|
+
const sessionId = asOptionalString(presence.sessionId);
|
|
3190
|
+
const updatedAt = asOptionalString(presence.updatedAt);
|
|
3191
|
+
if (presenceDeckId !== deckId || !sessionId || !updatedAt)
|
|
3192
|
+
return [];
|
|
3193
|
+
const routeId = asOptionalString(presence.routeId);
|
|
3194
|
+
const slot = asOptionalString(presence.slot);
|
|
3195
|
+
return [
|
|
3196
|
+
{
|
|
3197
|
+
...friend,
|
|
3198
|
+
sessionId,
|
|
3199
|
+
...(routeId ? { routeId } : {}),
|
|
3200
|
+
...(slot ? { slot } : {}),
|
|
3201
|
+
updatedAt,
|
|
3202
|
+
},
|
|
3203
|
+
];
|
|
3204
|
+
}
|
|
3205
|
+
function publicPartySummary(raw) {
|
|
3206
|
+
if (typeof raw !== "object" || raw === null)
|
|
3207
|
+
return null;
|
|
3208
|
+
const record = raw;
|
|
3209
|
+
const partyId = asOptionalString(record.partyId);
|
|
3210
|
+
const name = asOptionalString(record.name);
|
|
3211
|
+
const status = partyStatus(record.status);
|
|
3212
|
+
if (!partyId || !name || !status)
|
|
3213
|
+
return null;
|
|
3214
|
+
const chatChannel = record.chatChannel;
|
|
3215
|
+
return {
|
|
3216
|
+
partyId,
|
|
3217
|
+
name,
|
|
3218
|
+
status,
|
|
3219
|
+
hasUnreadMessages: chatChannel?.hasUnreadMessages === true,
|
|
3220
|
+
};
|
|
3221
|
+
}
|
|
3222
|
+
function requirePartySummary(raw, command) {
|
|
3223
|
+
const summary = publicPartySummary(raw);
|
|
3224
|
+
if (summary)
|
|
3225
|
+
return summary;
|
|
3226
|
+
throw new HostCommandError("GRAPHQL_INVALID_RESPONSE", "Castle returned an invalid party.", command);
|
|
3227
|
+
}
|
|
3228
|
+
function publicPartyMember(raw) {
|
|
3229
|
+
if (typeof raw !== "object" || raw === null)
|
|
3230
|
+
return [];
|
|
3231
|
+
const record = raw;
|
|
3232
|
+
const friend = publicSocialFriend(record.user)[0];
|
|
3233
|
+
const status = partyStatus(record.status);
|
|
3234
|
+
const role = typeof record.role === "string" && PARTY_ROLES.has(record.role)
|
|
3235
|
+
? record.role
|
|
3236
|
+
: null;
|
|
3237
|
+
return friend && status && role ? [{ ...friend, status, role }] : [];
|
|
3238
|
+
}
|
|
3239
|
+
function publicPartyMessage(raw) {
|
|
3240
|
+
if (typeof raw !== "object" || raw === null)
|
|
3241
|
+
return [];
|
|
3242
|
+
const record = raw;
|
|
3243
|
+
const id = asOptionalString(record.chatMessageId);
|
|
3244
|
+
const fromUserId = asOptionalString(record.fromUserId);
|
|
3245
|
+
const createdAt = asOptionalString(record.createdTime);
|
|
3246
|
+
const body = publicPartyBody(record.body);
|
|
3247
|
+
if (!id || !fromUserId || !createdAt || body === undefined)
|
|
3248
|
+
return [];
|
|
3249
|
+
const fromUser = record.fromUser;
|
|
3250
|
+
return [
|
|
3251
|
+
{
|
|
3252
|
+
id,
|
|
3253
|
+
fromUserId,
|
|
3254
|
+
fromUsername: asOptionalString(fromUser?.username),
|
|
3255
|
+
body,
|
|
3256
|
+
text: plainPartyText(body),
|
|
3257
|
+
createdAt,
|
|
3258
|
+
},
|
|
3259
|
+
];
|
|
3260
|
+
}
|
|
3261
|
+
function publicPartyBody(raw) {
|
|
3262
|
+
try {
|
|
3263
|
+
const encoded = JSON.stringify(raw);
|
|
3264
|
+
if (encoded === undefined ||
|
|
3265
|
+
new TextEncoder().encode(encoded).length > PARTY_BODY_MAX_BYTES) {
|
|
3266
|
+
return undefined;
|
|
3267
|
+
}
|
|
3268
|
+
return JSON.parse(encoded);
|
|
3269
|
+
}
|
|
3270
|
+
catch {
|
|
3271
|
+
return undefined;
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
function plainPartyText(body) {
|
|
3275
|
+
if (typeof body !== "object" || body === null || Array.isArray(body))
|
|
3276
|
+
return null;
|
|
3277
|
+
const message = body.message;
|
|
3278
|
+
if (!Array.isArray(message) || message.length === 0)
|
|
3279
|
+
return null;
|
|
3280
|
+
const pieces = [];
|
|
3281
|
+
for (const part of message) {
|
|
3282
|
+
if (typeof part !== "object" || part === null || Array.isArray(part))
|
|
3283
|
+
return null;
|
|
3284
|
+
const keys = Object.keys(part);
|
|
3285
|
+
if (keys.length !== 1 || keys[0] !== "text" || typeof part.text !== "string")
|
|
3286
|
+
return null;
|
|
3287
|
+
pieces.push(part.text);
|
|
3288
|
+
}
|
|
3289
|
+
return pieces.join("");
|
|
3290
|
+
}
|
|
3291
|
+
function partyStatus(raw) {
|
|
3292
|
+
return typeof raw === "string" && PARTY_STATUSES.has(raw)
|
|
3293
|
+
? raw
|
|
3294
|
+
: null;
|
|
3295
|
+
}
|
|
3296
|
+
function partyIdParam(raw, command) {
|
|
3297
|
+
return boundedPartyText(raw, "partyId", command, PARTY_ID_MAX);
|
|
3298
|
+
}
|
|
3299
|
+
function partyUserIds(raw, command) {
|
|
3300
|
+
if (!Array.isArray(raw) || raw.length > PARTY_USERS_MAX) {
|
|
3301
|
+
throw invalidPartyArgument(command, `requires at most ${PARTY_USERS_MAX} user ids.`);
|
|
3302
|
+
}
|
|
3303
|
+
const ids = raw.map((value) => boundedPartyText(value, "userId", command, PARTY_ID_MAX));
|
|
3304
|
+
return [...new Set(ids)];
|
|
3305
|
+
}
|
|
3306
|
+
function boundedPartyText(raw, field, command, max) {
|
|
3307
|
+
return asBoundedText(raw, field, command, max, max * 4);
|
|
3308
|
+
}
|
|
3309
|
+
function optionalBoundedPartyText(raw, field, command, max) {
|
|
3310
|
+
if (raw === undefined || raw === null)
|
|
3311
|
+
return null;
|
|
3312
|
+
return boundedPartyText(raw, field, command, max);
|
|
3313
|
+
}
|
|
3314
|
+
function invalidPartyArgument(command, detail) {
|
|
3315
|
+
return new HostCommandError("INVALID_ARGUMENT", `Castle command ${command} ${detail}`, command);
|
|
3316
|
+
}
|
|
2845
3317
|
// What a host posts to the deck (web: postMessage to the iframe; mobile:
|
|
2846
3318
|
// window.__castleSdkHost.receive) when the player presses its Back control.
|
|
2847
3319
|
export function hubBackEnvelope() {
|
|
@@ -2866,6 +3338,7 @@ const HUB_CLASSIC_COMMIT_DEADLINE_MS = 20_000;
|
|
|
2866
3338
|
const HUB_CLASSIC_ANSWER_DEADLINE_MS = 28_000;
|
|
2867
3339
|
const HUB_DOOR_ID_PATTERN = /^[A-Za-z0-9_.:-]{1,64}$/;
|
|
2868
3340
|
const HUB_USER_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
|
|
3341
|
+
const HUB_OWNER_ID_PATTERN = /^[1-9]\d{0,9}$/;
|
|
2869
3342
|
const HUB_HANDOFF_FIELDS = "status kind deckId url nonce sessionId bundleHash contentUrl transitionId arrivalDoorId";
|
|
2870
3343
|
const CAULDRON_HUB_DOORS_QUERY = `query CastleHubDoors($deckId: ID!, $env: String) {
|
|
2871
3344
|
cauldronHubDoors(deckId: $deckId, env: $env) {
|
|
@@ -2883,11 +3356,19 @@ const CAULDRON_HUB_DOORS_QUERY = `query CastleHubDoors($deckId: ID!, $env: Strin
|
|
|
2883
3356
|
const CAULDRON_HUB_GO_MUTATION = `mutation CastleHubGo($fromDeckId: ID!, $fromSessionId: ID!, $doorId: String!, $partyId: ID, $env: String) {
|
|
2884
3357
|
acquireCauldronHubDoor(fromDeckId: $fromDeckId, fromSessionId: $fromSessionId, doorId: $doorId, partyId: $partyId, env: $env) { ${HUB_HANDOFF_FIELDS} }
|
|
2885
3358
|
}`;
|
|
3359
|
+
const CAULDRON_INVITE_GO_MUTATION = CAULDRON_HUB_GO_MUTATION
|
|
3360
|
+
.replace("$env: String)", "$env: String, $ownerUserId: ID, $hubInviteToken: String)")
|
|
3361
|
+
.replace("env: $env)", "env: $env, ownerUserId: $ownerUserId, hubInviteToken: $hubInviteToken)");
|
|
3362
|
+
// A friend's House from the People list: ghost checks the follow and that the
|
|
3363
|
+
// owner is home (ownerVisitRequiredAsync).
|
|
3364
|
+
const CAULDRON_OWNER_GO_MUTATION = CAULDRON_HUB_GO_MUTATION
|
|
3365
|
+
.replace("$env: String)", "$env: String, $ownerUserId: ID)")
|
|
3366
|
+
.replace("env: $env)", "env: $env, ownerUserId: $ownerUserId)");
|
|
2886
3367
|
const CAULDRON_HUB_BACK_MUTATION = `mutation CastleHubBack($fromDeckId: ID!, $partyId: ID, $env: String) {
|
|
2887
3368
|
acquireCauldronHubReturn(fromDeckId: $fromDeckId, partyId: $partyId, env: $env) { ${HUB_HANDOFF_FIELDS} }
|
|
2888
3369
|
}`;
|
|
2889
3370
|
const CAULDRON_HUB_FRIENDS_QUERY = `query CastleHubFriends($deckId: ID!, $sessionId: ID, $env: String) {
|
|
2890
|
-
cauldronHubFriends(deckId: $deckId, sessionId: $sessionId, env: $env, behindDoors: true) { userId username here door }
|
|
3371
|
+
cauldronHubFriends(deckId: $deckId, sessionId: $sessionId, env: $env, behindDoors: true) { userId username here door home ownerUserId }
|
|
2891
3372
|
}`;
|
|
2892
3373
|
const CAULDRON_HUB_JUMP_MUTATION = `mutation CastleHubJump($fromDeckId: ID!, $fromSessionId: ID!, $friendUserId: ID!, $partyId: ID, $env: String) {
|
|
2893
3374
|
acquireCauldronHubFriend(fromDeckId: $fromDeckId, fromSessionId: $fromSessionId, friendUserId: $friendUserId, partyId: $partyId, env: $env) { ${HUB_HANDOFF_FIELDS} }
|
|
@@ -2908,6 +3389,8 @@ const CAULDRON_HUB_SAY_MUTATION = `mutation CastleHubSay($deckId: ID!, $sessionI
|
|
|
2908
3389
|
const CAULDRON_HUB_REPORT_CHAT_MUTATION = `mutation CastleHubReportChat($deckId: ID!, $sessionId: ID!, $messageId: ID!, $env: String) {
|
|
2909
3390
|
reportCauldronHubChatMessage(deckId: $deckId, sessionId: $sessionId, messageId: $messageId, env: $env)
|
|
2910
3391
|
}`;
|
|
3392
|
+
const CAULDRON_HUB_REPORT_AND_BLOCK_CHAT_MUTATION = CAULDRON_HUB_REPORT_CHAT_MUTATION
|
|
3393
|
+
.replace("env: $env)", "env: $env, block: true)");
|
|
2911
3394
|
// Ghost's own limits, held here too so a wrong answer cannot flood a deck.
|
|
2912
3395
|
const HUB_CHAT_TEXT_MAX = 200;
|
|
2913
3396
|
const HUB_CHAT_MESSAGES_MAX = 50;
|
|
@@ -2953,15 +3436,40 @@ function defaultHubSleep(ms, signal) {
|
|
|
2953
3436
|
export function createGhostHubVisit(options) {
|
|
2954
3437
|
const visit = new GhostHubVisitImpl(options);
|
|
2955
3438
|
return {
|
|
2956
|
-
|
|
3439
|
+
dispose: () => visit.dispose(),
|
|
3440
|
+
assertActive: () => visit.assertActive(),
|
|
3441
|
+
allowInvites: (userId) => {
|
|
3442
|
+
visit.assertActive();
|
|
3443
|
+
if (options.invite === true || options.inviteToken || !userId)
|
|
3444
|
+
return;
|
|
3445
|
+
options.invite = true;
|
|
3446
|
+
options.inviteUserId = userId;
|
|
3447
|
+
},
|
|
3448
|
+
go: (doorId, ctx, signal, ownerUserId) => visit.go(doorId, ctx, signal, ownerUserId),
|
|
2957
3449
|
back: (ctx, signal) => visit.back(ctx, signal),
|
|
2958
3450
|
doors: () => visit.doors(),
|
|
2959
3451
|
friends: () => visit.friends(),
|
|
3452
|
+
prepareInvite: (ctx) => visit.prepareInvite(ctx),
|
|
3453
|
+
invite: (crew, _ctx, signal) => visit.invite(crew, signal),
|
|
3454
|
+
canInvite: (ctx) => {
|
|
3455
|
+
visit.assertActive();
|
|
3456
|
+
const userId = options.invite === true ? options.inviteUserId ?? ctx.userId : null;
|
|
3457
|
+
return Promise.resolve(userId
|
|
3458
|
+
? { status: "ok", canInvite: true, userId: String(userId) }
|
|
3459
|
+
: { status: "ok", canInvite: options.invite === true });
|
|
3460
|
+
},
|
|
3461
|
+
inviteArrival: (_ctx, signal) => visit.inviteArrival(signal),
|
|
3462
|
+
undoInvite: (userId) => visit.undoInvite(userId),
|
|
3463
|
+
inviteJoinHint: (ctx) => {
|
|
3464
|
+
visit.assertActive();
|
|
3465
|
+
return options.invite === true && ctx.deckId === options.homeDeckId && options.inviteToken
|
|
3466
|
+
? { token: options.inviteToken, env: options.env ?? null } : null;
|
|
3467
|
+
},
|
|
2960
3468
|
jump: (userId, ctx, signal) => visit.jump(userId, ctx, signal),
|
|
2961
3469
|
report: (userId, reason) => visit.report(userId, reason),
|
|
2962
3470
|
chat: (after) => visit.chat(after),
|
|
2963
3471
|
say: (text) => visit.say(text),
|
|
2964
|
-
reportChat: (messageId) => visit.reportChat(messageId),
|
|
3472
|
+
reportChat: (messageId, _ctx, block, confirmBlock, signal) => visit.reportChat(messageId, block, confirmBlock, signal),
|
|
2965
3473
|
commit: (nonce) => visit.commit(nonce),
|
|
2966
3474
|
cancel: (nonce) => visit.cancel(nonce),
|
|
2967
3475
|
sessionAcquired: (sessionId) => visit.sessionAcquired(sessionId),
|
|
@@ -2969,12 +3477,81 @@ export function createGhostHubVisit(options) {
|
|
|
2969
3477
|
state: () => visit.state(),
|
|
2970
3478
|
};
|
|
2971
3479
|
}
|
|
3480
|
+
const HUB_INVITE_TOKEN = /^[A-Za-z0-9_-]{43}$/;
|
|
3481
|
+
export function hubInviteTokenFromUri(uri) {
|
|
3482
|
+
if (!uri)
|
|
3483
|
+
return null;
|
|
3484
|
+
try {
|
|
3485
|
+
const url = new URL(uri);
|
|
3486
|
+
if (url.protocol !== "https:" || !["castle.xyz", "www.castle.xyz"].includes(url.hostname) || !url.pathname.startsWith("/d/"))
|
|
3487
|
+
return null;
|
|
3488
|
+
const token = url.searchParams.get("hubInvite");
|
|
3489
|
+
return token === null ? null : HUB_INVITE_TOKEN.test(token) && url.searchParams.getAll("hubInvite").length === 1 ? token : "invalid";
|
|
3490
|
+
}
|
|
3491
|
+
catch {
|
|
3492
|
+
return null;
|
|
3493
|
+
}
|
|
3494
|
+
}
|
|
3495
|
+
const HUB_INVITE_CREATE = `mutation CastleHubInvite($deckId: ID!, $sourceDeckId: ID, $sessionId: ID!, $cap: Int, $env: String) {
|
|
3496
|
+
createCauldronHubInvite(deckId: $deckId, sourceDeckId: $sourceDeckId, sessionId: $sessionId, cap: $cap, env: $env)
|
|
3497
|
+
}`;
|
|
3498
|
+
const HUB_INVITE_RESOLVE = `mutation CastleHubInviteResolve($token: String!, $env: String) {
|
|
3499
|
+
resolveCauldronHubInvite(token: $token, env: $env)
|
|
3500
|
+
}`;
|
|
3501
|
+
const HUB_INVITE_COMPLETE = `mutation CastleHubInviteArrival($token: String!, $deckId: ID, $sessionId: ID!, $env: String) {
|
|
3502
|
+
completeCauldronHubInvite(token: $token, deckId: $deckId, sessionId: $sessionId, env: $env)
|
|
3503
|
+
}`;
|
|
3504
|
+
const HUB_INVITE_UNDO = `mutation CastleHubInviteUndo($token: String!, $userId: ID!, $env: String) {
|
|
3505
|
+
undoCauldronHubInvitePair(token: $token, userId: $userId, env: $env)
|
|
3506
|
+
}`;
|
|
3507
|
+
/** Resolve only in the signed-in trusted host, before the first multiplayer join. */
|
|
3508
|
+
export async function resolveGhostHubInvite(options) {
|
|
3509
|
+
if (!HUB_INVITE_TOKEN.test(options.token))
|
|
3510
|
+
return { status: "unavailable" };
|
|
3511
|
+
const data = await graphql(options.graphqlFetch, HUB_INVITE_RESOLVE, { token: options.token, env: options.env ?? null }, "hub.inviteArrival");
|
|
3512
|
+
const arrival = publicInviteArrival(data.resolveCauldronHubInvite);
|
|
3513
|
+
if (arrival.destination?.hub.townDeckId !== options.townDeckId)
|
|
3514
|
+
return { status: "unavailable" };
|
|
3515
|
+
const house = data.resolveCauldronHubInvite?.house;
|
|
3516
|
+
const run = data.resolveCauldronHubInvite?.run;
|
|
3517
|
+
return { ...arrival, ...(!house && typeof run?.doorId === "string" && HUB_DOOR_ID_PATTERN.test(run.doorId)
|
|
3518
|
+
? { run: { doorId: run.doorId } } : {}), ...(typeof house?.doorId === "string" && HUB_DOOR_ID_PATTERN.test(house.doorId) &&
|
|
3519
|
+
typeof house.ownerUserId === "string" && house.ownerUserId === arrival.destination.hub.target.id
|
|
3520
|
+
? { house: { doorId: house.doorId, ownerUserId: house.ownerUserId } } : {}) };
|
|
3521
|
+
}
|
|
3522
|
+
function publicInviteArrival(value) {
|
|
3523
|
+
const raw = value;
|
|
3524
|
+
const hub = raw?.destination?.hub;
|
|
3525
|
+
if (raw?.status !== "ok" || hub?.version !== 1 || typeof hub.townDeckId !== "string" ||
|
|
3526
|
+
hub.target?.kind !== "player" || !/^[1-9]\d{0,9}$/.test(hub.target.id))
|
|
3527
|
+
return { status: "unavailable" };
|
|
3528
|
+
const friends = Array.isArray(raw.friends) ? raw.friends.slice(0, 5).flatMap((friend) => {
|
|
3529
|
+
const f = friend;
|
|
3530
|
+
return typeof f?.userId === "string" && /^[1-9]\d{0,9}$/.test(f.userId) && typeof f.username === "string"
|
|
3531
|
+
? [{ userId: f.userId, username: f.username.slice(0, 64) }] : [];
|
|
3532
|
+
}) : [];
|
|
3533
|
+
return { status: "ok", destination: { hub: { version: 1, townDeckId: hub.townDeckId, target: { kind: "player", id: hub.target.id } } }, friends };
|
|
3534
|
+
}
|
|
2972
3535
|
// Every operation that reads or moves the visit runs one at a time, in the
|
|
2973
3536
|
// order the deck asked, so a slow acquisition or commit can never land on top of
|
|
2974
3537
|
// a newer one. Only a cancel reaches past the queue, to stop an acquisition
|
|
2975
3538
|
// still in flight (one waiting out the roster lag can take 15 s).
|
|
3539
|
+
// Ghost's own answer about this link or this account. Anything else (a lost
|
|
3540
|
+
// response, a failed gate lookup, a server error) may pass, so it is retried.
|
|
3541
|
+
function definitiveInviteRefusal(error) {
|
|
3542
|
+
if (!(error instanceof HostCommandError))
|
|
3543
|
+
return false;
|
|
3544
|
+
const code = error.code;
|
|
3545
|
+
return (code.startsWith("CAULDRON_HUB_INVITE_") && code !== "CAULDRON_HUB_INVITE_NOT_IN_SESSION") ||
|
|
3546
|
+
code === "CAULDRON_HUB_FORBIDDEN" || code === "ACCOUNT_REQUIRED" || code === "LOGIN_REQUIRED";
|
|
3547
|
+
}
|
|
2976
3548
|
class GhostHubVisitImpl {
|
|
2977
3549
|
options;
|
|
3550
|
+
disposed = false;
|
|
3551
|
+
invitePreparation = null;
|
|
3552
|
+
inviteFailures = 0;
|
|
3553
|
+
inviteRetryAt = 0;
|
|
3554
|
+
inviteDestinationVisited = false;
|
|
2978
3555
|
place;
|
|
2979
3556
|
gql;
|
|
2980
3557
|
env;
|
|
@@ -2984,6 +3561,9 @@ class GhostHubVisitImpl {
|
|
|
2984
3561
|
arrivalDoorId = null;
|
|
2985
3562
|
placeKind = "place";
|
|
2986
3563
|
session = null;
|
|
3564
|
+
chatSenders = new Map();
|
|
3565
|
+
chatBlockPending = null;
|
|
3566
|
+
chatBlockNextAt = 0;
|
|
2987
3567
|
pending = null;
|
|
2988
3568
|
queue = Promise.resolve();
|
|
2989
3569
|
inFlight = new Set();
|
|
@@ -2992,12 +3572,26 @@ class GhostHubVisitImpl {
|
|
|
2992
3572
|
rows = null;
|
|
2993
3573
|
constructor(options) {
|
|
2994
3574
|
this.options = options;
|
|
2995
|
-
this.gql =
|
|
3575
|
+
this.gql = async (query, variables) => {
|
|
3576
|
+
this.assertActive();
|
|
3577
|
+
const result = await options.graphqlFetch(query, variables);
|
|
3578
|
+
this.assertActive();
|
|
3579
|
+
return result;
|
|
3580
|
+
};
|
|
2996
3581
|
this.env = options.env ?? null;
|
|
2997
3582
|
this.now = options.now ?? (() => Date.now());
|
|
2998
3583
|
this.sleep = options.sleep ?? defaultHubSleep;
|
|
2999
3584
|
this.place = options.homeDeckId;
|
|
3000
3585
|
}
|
|
3586
|
+
assertActive(signal) {
|
|
3587
|
+
if (this.disposed || signal?.aborted)
|
|
3588
|
+
throw new HostCommandError("CANCELLED", "This hub visit ended.", "hub.inviteArrival");
|
|
3589
|
+
}
|
|
3590
|
+
dispose() {
|
|
3591
|
+
this.disposed = true;
|
|
3592
|
+
for (const controller of this.inFlight)
|
|
3593
|
+
controller.abort();
|
|
3594
|
+
}
|
|
3001
3595
|
state() {
|
|
3002
3596
|
const pending = this.pending;
|
|
3003
3597
|
return {
|
|
@@ -3011,13 +3605,16 @@ class GhostHubVisitImpl {
|
|
|
3011
3605
|
};
|
|
3012
3606
|
}
|
|
3013
3607
|
sessionAcquired(sessionId) {
|
|
3608
|
+
this.assertActive();
|
|
3609
|
+
this.chatBlockPending?.abort();
|
|
3610
|
+
this.chatSenders.clear();
|
|
3014
3611
|
this.session = { sessionId, at: this.now() };
|
|
3015
3612
|
}
|
|
3016
|
-
go(doorId, ctx, signal) {
|
|
3613
|
+
go(doorId, ctx, signal, ownerUserId) {
|
|
3017
3614
|
if (!HUB_DOOR_ID_PATTERN.test(doorId))
|
|
3018
3615
|
return Promise.resolve(hubFailure("not_found"));
|
|
3019
3616
|
const asked = this.now();
|
|
3020
|
-
return this.acquisition(signal, (abort) => this.goNow(doorId, ctx, abort, asked));
|
|
3617
|
+
return this.acquisition(signal, (abort) => this.goNow(doorId, ctx, abort, asked, ownerUserId));
|
|
3021
3618
|
}
|
|
3022
3619
|
back(ctx, signal) {
|
|
3023
3620
|
return this.acquisition(signal, (abort) => this.backNow(ctx, abort));
|
|
@@ -3035,6 +3632,121 @@ class GhostHubVisitImpl {
|
|
|
3035
3632
|
const raw = Array.isArray(data.cauldronHubFriends) ? data.cauldronHubFriends : [];
|
|
3036
3633
|
return { status: "ok", friends: raw.flatMap(publicHubFriend) };
|
|
3037
3634
|
}
|
|
3635
|
+
async invite(crew, signal) {
|
|
3636
|
+
this.assertActive(signal);
|
|
3637
|
+
const source = this.session;
|
|
3638
|
+
if (this.options.invite !== true || !source)
|
|
3639
|
+
return { status: "unavailable" };
|
|
3640
|
+
const started = this.now();
|
|
3641
|
+
let data;
|
|
3642
|
+
for (;;) {
|
|
3643
|
+
this.assertActive(signal);
|
|
3644
|
+
if (this.session !== source)
|
|
3645
|
+
return { status: "unavailable" };
|
|
3646
|
+
try {
|
|
3647
|
+
data = await graphql(this.gql, HUB_INVITE_CREATE, { deckId: this.options.homeDeckId, sourceDeckId: this.place, sessionId: source.sessionId, cap: crew ? 5 : 1, env: this.env }, "hub.invite");
|
|
3648
|
+
break;
|
|
3649
|
+
}
|
|
3650
|
+
catch (error) {
|
|
3651
|
+
if (!(error instanceof HostCommandError) || error.code !== "CAULDRON_HUB_INVITE_NOT_IN_SESSION" ||
|
|
3652
|
+
this.session !== source || this.now() - started >= HUB_ROSTER_LAG_MS)
|
|
3653
|
+
throw error;
|
|
3654
|
+
await this.sleep(HUB_FORBIDDEN_RETRY_MS, signal);
|
|
3655
|
+
}
|
|
3656
|
+
}
|
|
3657
|
+
if (this.session !== source)
|
|
3658
|
+
return { status: "unavailable" };
|
|
3659
|
+
const raw = data.createCauldronHubInvite;
|
|
3660
|
+
if (raw?.status !== "ok" || typeof raw.url !== "string" || !raw.url.startsWith("https://castle.xyz/d/") ||
|
|
3661
|
+
typeof raw.expiresAt !== "string")
|
|
3662
|
+
return { status: "unavailable" };
|
|
3663
|
+
this.assertActive(signal);
|
|
3664
|
+
try {
|
|
3665
|
+
await this.options.onInviteLink?.(raw.url);
|
|
3666
|
+
}
|
|
3667
|
+
catch { /* Dismissing share keeps the link usable. */ }
|
|
3668
|
+
return { status: "ok", url: raw.url, expiresAt: raw.expiresAt };
|
|
3669
|
+
}
|
|
3670
|
+
prepareInvite(ctx) {
|
|
3671
|
+
this.assertActive();
|
|
3672
|
+
if (this.options.invite !== true || !this.options.inviteToken || ctx.deckId !== this.options.homeDeckId)
|
|
3673
|
+
return Promise.resolve();
|
|
3674
|
+
// A guest arrives like any over-13 player; ghost decides. Only a player with no
|
|
3675
|
+
// Castle account (the dev serve's) cannot carry an invite.
|
|
3676
|
+
if (!(this.options.inviteUserId ?? ctx.userId)) {
|
|
3677
|
+
this.dropInvite();
|
|
3678
|
+
return Promise.resolve();
|
|
3679
|
+
}
|
|
3680
|
+
return this.invitePreparation ??= (async () => {
|
|
3681
|
+
const wait = this.inviteRetryAt - this.now();
|
|
3682
|
+
if (wait > 0) {
|
|
3683
|
+
await this.sleep(wait);
|
|
3684
|
+
this.assertActive();
|
|
3685
|
+
}
|
|
3686
|
+
const resolved = await resolveGhostHubInvite({ graphqlFetch: this.gql, token: this.options.inviteToken, townDeckId: this.options.homeDeckId, env: this.env });
|
|
3687
|
+
if (resolved.status !== "ok") {
|
|
3688
|
+
this.dropInvite();
|
|
3689
|
+
return;
|
|
3690
|
+
}
|
|
3691
|
+
this.options.inviteHouse = resolved.house;
|
|
3692
|
+
this.options.inviteRun = resolved.run;
|
|
3693
|
+
})().catch((error) => {
|
|
3694
|
+
this.assertActive();
|
|
3695
|
+
if (error instanceof HostCommandError && error.code === "CANCELLED") {
|
|
3696
|
+
this.invitePreparation = null;
|
|
3697
|
+
throw error;
|
|
3698
|
+
}
|
|
3699
|
+
if (definitiveInviteRefusal(error) || ++this.inviteFailures >= 5) {
|
|
3700
|
+
this.dropInvite();
|
|
3701
|
+
return;
|
|
3702
|
+
}
|
|
3703
|
+
this.inviteRetryAt = this.now() + 1_000 * 2 ** (this.inviteFailures - 1);
|
|
3704
|
+
this.invitePreparation = null;
|
|
3705
|
+
throw error;
|
|
3706
|
+
});
|
|
3707
|
+
}
|
|
3708
|
+
dropInvite() {
|
|
3709
|
+
this.options.inviteToken = undefined;
|
|
3710
|
+
this.options.inviteHouse = undefined;
|
|
3711
|
+
this.options.inviteRun = undefined;
|
|
3712
|
+
}
|
|
3713
|
+
async inviteArrival(signal) {
|
|
3714
|
+
this.assertActive(signal);
|
|
3715
|
+
const token = this.options.inviteToken;
|
|
3716
|
+
const source = this.session;
|
|
3717
|
+
if (this.options.invite !== true || !token || !HUB_INVITE_TOKEN.test(token) || !source)
|
|
3718
|
+
return { status: "unavailable" };
|
|
3719
|
+
const inviteDoor = this.options.inviteHouse?.doorId ?? this.options.inviteRun?.doorId;
|
|
3720
|
+
if (inviteDoor && !this.inviteDestinationVisited && this.place === this.options.homeDeckId) {
|
|
3721
|
+
return { status: "route", doorId: inviteDoor };
|
|
3722
|
+
}
|
|
3723
|
+
const started = this.now();
|
|
3724
|
+
for (;;) {
|
|
3725
|
+
this.assertActive(signal);
|
|
3726
|
+
try {
|
|
3727
|
+
const data = await graphql(this.gql, HUB_INVITE_COMPLETE, { token, deckId: this.place, sessionId: source.sessionId, env: this.env }, "hub.inviteArrival");
|
|
3728
|
+
if (this.session !== source)
|
|
3729
|
+
return { status: "unavailable" };
|
|
3730
|
+
const result = publicInviteArrival(data.completeCauldronHubInvite);
|
|
3731
|
+
if (result.status === "ok" && this.place !== this.options.homeDeckId)
|
|
3732
|
+
this.inviteDestinationVisited = true;
|
|
3733
|
+
return result;
|
|
3734
|
+
}
|
|
3735
|
+
catch (error) {
|
|
3736
|
+
if (!(error instanceof HostCommandError) || error.code !== "CAULDRON_HUB_INVITE_NOT_IN_SESSION" ||
|
|
3737
|
+
this.session !== source || this.now() - started >= HUB_ROSTER_LAG_MS)
|
|
3738
|
+
throw error;
|
|
3739
|
+
await this.sleep(HUB_FORBIDDEN_RETRY_MS, signal);
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
}
|
|
3743
|
+
async undoInvite(userId) {
|
|
3744
|
+
const token = this.options.inviteToken;
|
|
3745
|
+
if (this.options.invite !== true || !token || !HUB_INVITE_TOKEN.test(token) || !/^[1-9]\d{0,9}$/.test(userId))
|
|
3746
|
+
return { status: "unavailable" };
|
|
3747
|
+
const data = await graphql(this.gql, HUB_INVITE_UNDO, { token, userId, env: this.env }, "hub.undoInvite");
|
|
3748
|
+
return { status: data.undoCauldronHubInvitePair?.status === "ok" ? "ok" : "unavailable" };
|
|
3749
|
+
}
|
|
3038
3750
|
jump(userId, ctx, signal) {
|
|
3039
3751
|
if (!HUB_USER_ID_PATTERN.test(userId))
|
|
3040
3752
|
return Promise.resolve(hubFailure("not_found"));
|
|
@@ -3062,7 +3774,16 @@ class GhostHubVisitImpl {
|
|
|
3062
3774
|
after: after && after.length <= HUB_CHAT_TOKEN_MAX ? after : null,
|
|
3063
3775
|
env: this.env,
|
|
3064
3776
|
}, "hub.chat");
|
|
3065
|
-
|
|
3777
|
+
const result = publicHubChat(data.cauldronHubChat);
|
|
3778
|
+
if (this.session === session && result.status === "ok") {
|
|
3779
|
+
for (const message of result.messages) {
|
|
3780
|
+
this.chatSenders.set(message.id, { session, target: { userId: message.fromUserId, username: message.fromUsername } });
|
|
3781
|
+
}
|
|
3782
|
+
// Bound identities retained across cursor polls for this session.
|
|
3783
|
+
while (this.chatSenders.size > 200)
|
|
3784
|
+
this.chatSenders.delete(this.chatSenders.keys().next().value);
|
|
3785
|
+
}
|
|
3786
|
+
return result;
|
|
3066
3787
|
}
|
|
3067
3788
|
async say(text) {
|
|
3068
3789
|
const session = this.session;
|
|
@@ -3074,12 +3795,70 @@ class GhostHubVisitImpl {
|
|
|
3074
3795
|
const data = await graphql(this.gql, CAULDRON_HUB_SAY_MUTATION, { deckId: this.place, sessionId: session.sessionId, text: said, env: this.env }, "hub.say");
|
|
3075
3796
|
return publicHubSay(data.sendCauldronHubChat);
|
|
3076
3797
|
}
|
|
3077
|
-
async reportChat(messageId) {
|
|
3798
|
+
async reportChat(messageId, block = false, confirmBlock, signal) {
|
|
3078
3799
|
const session = this.session;
|
|
3079
|
-
|
|
3800
|
+
const place = this.place;
|
|
3801
|
+
if (!session || messageId.length > HUB_CHAT_TOKEN_MAX || signal?.aborted)
|
|
3080
3802
|
return { status: "unavailable" };
|
|
3081
|
-
|
|
3082
|
-
|
|
3803
|
+
if (block) {
|
|
3804
|
+
const entry = this.chatSenders.get(messageId);
|
|
3805
|
+
const target = entry?.session === session ? entry.target : null;
|
|
3806
|
+
// A deck can request a block, but only trusted host UI can authorize it.
|
|
3807
|
+
// No UI or no host-read identity retains the old report-only behavior.
|
|
3808
|
+
block = false;
|
|
3809
|
+
if (target && confirmBlock) {
|
|
3810
|
+
if (this.chatBlockPending)
|
|
3811
|
+
return { status: "unavailable" };
|
|
3812
|
+
if (this.now() >= this.chatBlockNextAt) {
|
|
3813
|
+
this.chatBlockNextAt = this.now() + 60_000;
|
|
3814
|
+
block = await this.confirmChatBlock(target, confirmBlock, signal);
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
if (this.disposed || signal?.aborted || this.session !== session || this.place !== place)
|
|
3818
|
+
return { status: "unavailable" };
|
|
3819
|
+
}
|
|
3820
|
+
const report = () => graphql(this.gql, block ? CAULDRON_HUB_REPORT_AND_BLOCK_CHAT_MUTATION : CAULDRON_HUB_REPORT_CHAT_MUTATION, { deckId: place, sessionId: session.sessionId, messageId, env: this.env }, "hub.reportChat");
|
|
3821
|
+
let data;
|
|
3822
|
+
try {
|
|
3823
|
+
data = await report();
|
|
3824
|
+
}
|
|
3825
|
+
catch (error) {
|
|
3826
|
+
// A host can arrive before Ghost's additive schema deploy. Preserve the
|
|
3827
|
+
// report against that schema; an unaccepted block is never confirmed.
|
|
3828
|
+
if (!block || !(error instanceof Error) || !/Unknown argument ["']?block["']?/i.test(error.message))
|
|
3829
|
+
throw error;
|
|
3830
|
+
if (this.disposed || signal?.aborted || this.session !== session || this.place !== place)
|
|
3831
|
+
return { status: "unavailable" };
|
|
3832
|
+
block = false;
|
|
3833
|
+
data = await report();
|
|
3834
|
+
}
|
|
3835
|
+
return data.reportCauldronHubChatMessage === true
|
|
3836
|
+
? { status: "ok", ...(block ? { blocked: true } : {}) }
|
|
3837
|
+
: { status: "unavailable" };
|
|
3838
|
+
}
|
|
3839
|
+
async confirmChatBlock(target, confirm, signal) {
|
|
3840
|
+
const controller = new AbortController();
|
|
3841
|
+
const forward = () => controller.abort();
|
|
3842
|
+
this.chatBlockPending = controller;
|
|
3843
|
+
this.inFlight.add(controller);
|
|
3844
|
+
signal?.addEventListener("abort", forward, { once: true });
|
|
3845
|
+
try {
|
|
3846
|
+
return await new Promise((resolve) => {
|
|
3847
|
+
controller.signal.addEventListener("abort", () => resolve(false), { once: true });
|
|
3848
|
+
if (signal?.aborted)
|
|
3849
|
+
controller.abort();
|
|
3850
|
+
if (!controller.signal.aborted) {
|
|
3851
|
+
Promise.resolve().then(() => controller.signal.aborted ? false : confirm({ ...target }, controller.signal))
|
|
3852
|
+
.then((accepted) => resolve(accepted === true), () => resolve(false));
|
|
3853
|
+
}
|
|
3854
|
+
});
|
|
3855
|
+
}
|
|
3856
|
+
finally {
|
|
3857
|
+
signal?.removeEventListener("abort", forward);
|
|
3858
|
+
this.inFlight.delete(controller);
|
|
3859
|
+
if (this.chatBlockPending === controller)
|
|
3860
|
+
this.chatBlockPending = null;
|
|
3861
|
+
}
|
|
3083
3862
|
}
|
|
3084
3863
|
commit(nonce) {
|
|
3085
3864
|
return this.serial(() => this.commitNow(nonce));
|
|
@@ -3108,19 +3887,25 @@ class GhostHubVisitImpl {
|
|
|
3108
3887
|
signal?.removeEventListener("abort", forward);
|
|
3109
3888
|
});
|
|
3110
3889
|
}
|
|
3111
|
-
async goNow(doorId, ctx, signal, asked) {
|
|
3890
|
+
async goNow(doorId, ctx, signal, asked, ownerUserId) {
|
|
3112
3891
|
for (;;) {
|
|
3113
3892
|
if (signal.aborted)
|
|
3114
3893
|
return hubFailure("cancelled");
|
|
3115
3894
|
const source = this.session;
|
|
3116
3895
|
if (!source)
|
|
3117
3896
|
return hubFailure("forbidden");
|
|
3118
|
-
const
|
|
3897
|
+
const invitedRoute = this.options.invite === true && this.options.inviteToken &&
|
|
3898
|
+
(this.options.inviteHouse?.doorId ?? this.options.inviteRun?.doorId) === doorId &&
|
|
3899
|
+
this.place === this.options.homeDeckId;
|
|
3900
|
+
const data = await graphql(this.gql, invitedRoute ? CAULDRON_INVITE_GO_MUTATION : ownerUserId ? CAULDRON_OWNER_GO_MUTATION : CAULDRON_HUB_GO_MUTATION, {
|
|
3119
3901
|
fromDeckId: this.place,
|
|
3120
3902
|
fromSessionId: source.sessionId,
|
|
3121
3903
|
doorId,
|
|
3122
3904
|
partyId: ctx.partyId ?? null,
|
|
3123
3905
|
env: this.env,
|
|
3906
|
+
...(invitedRoute ? { hubInviteToken: this.options.inviteToken,
|
|
3907
|
+
...(this.options.inviteHouse ? { ownerUserId: this.options.inviteHouse.ownerUserId } : {}) }
|
|
3908
|
+
: ownerUserId ? { ownerUserId } : {}),
|
|
3124
3909
|
}, "hub.go");
|
|
3125
3910
|
const raw = data.acquireCauldronHubDoor;
|
|
3126
3911
|
// Just arrived: ghost has not seen this player in the session yet.
|
|
@@ -3229,6 +4014,7 @@ class GhostHubVisitImpl {
|
|
|
3229
4014
|
this.place = trip.toDeckId;
|
|
3230
4015
|
this.placeKind = trip.classic ? "classic" : "place";
|
|
3231
4016
|
this.arrivalDoorId = trip.arrivalDoorId;
|
|
4017
|
+
this.chatBlockPending?.abort();
|
|
3232
4018
|
this.session = trip.sessionId ? { sessionId: trip.sessionId, at: this.now() } : null;
|
|
3233
4019
|
}
|
|
3234
4020
|
changed() {
|
|
@@ -3401,13 +4187,18 @@ function publicHubFriend(raw) {
|
|
|
3401
4187
|
if (!userId)
|
|
3402
4188
|
return [];
|
|
3403
4189
|
// A door is one of this place's own ids, or nothing.
|
|
3404
|
-
const
|
|
4190
|
+
const named = asOptionalString(record.door);
|
|
4191
|
+
const door = named && HUB_DOOR_ID_PATTERN.test(named) ? named : null;
|
|
4192
|
+
// A friend at home in their House behind that door: the owner to visit.
|
|
4193
|
+
const owner = asOptionalString(record.ownerUserId);
|
|
4194
|
+
const home = door && record.home === true && owner && HUB_OWNER_ID_PATTERN.test(owner);
|
|
3405
4195
|
return [
|
|
3406
4196
|
{
|
|
3407
4197
|
userId,
|
|
3408
4198
|
username: asOptionalString(record.username),
|
|
3409
4199
|
here: record.here === true,
|
|
3410
|
-
door
|
|
4200
|
+
door,
|
|
4201
|
+
...(home ? { home: true, ownerUserId: owner } : {}),
|
|
3411
4202
|
},
|
|
3412
4203
|
];
|
|
3413
4204
|
}
|
|
@@ -3462,7 +4253,11 @@ function runHubCommand(ctx, command, params, caps, signal) {
|
|
|
3462
4253
|
switch (command) {
|
|
3463
4254
|
case "hub.go": {
|
|
3464
4255
|
const doorId = asString(params.doorId, "doorId", command);
|
|
3465
|
-
|
|
4256
|
+
// A House owner to visit; anything but a user id is ignored, as hosts
|
|
4257
|
+
// before it ignored the field, and the player's own House is acquired.
|
|
4258
|
+
const owner = asOptionalString(params.ownerUserId);
|
|
4259
|
+
const ownerUserId = owner && HUB_OWNER_ID_PATTERN.test(owner) ? owner : undefined;
|
|
4260
|
+
return hub ? hub.go(doorId, ctx, signal, ownerUserId) : Promise.resolve(unavailableHubHandoff());
|
|
3466
4261
|
}
|
|
3467
4262
|
case "hub.back":
|
|
3468
4263
|
return hub ? hub.back(ctx, signal) : Promise.resolve(unavailableHubHandoff());
|
|
@@ -3472,6 +4267,16 @@ function runHubCommand(ctx, command, params, caps, signal) {
|
|
|
3472
4267
|
return hub?.friends
|
|
3473
4268
|
? hub.friends(ctx)
|
|
3474
4269
|
: Promise.resolve({ status: "unavailable", friends: null });
|
|
4270
|
+
case "hub.invite":
|
|
4271
|
+
if (params.crew !== undefined && typeof params.crew !== "boolean")
|
|
4272
|
+
throw invalidPartyArgument("hub.invite", "requires a boolean crew option.");
|
|
4273
|
+
return hub?.invite ? hub.invite(params.crew === true, ctx, signal) : Promise.resolve({ status: "unavailable" });
|
|
4274
|
+
case "hub.canInvite":
|
|
4275
|
+
return hub?.canInvite ? hub.canInvite(ctx) : Promise.resolve({ status: "unavailable", canInvite: false });
|
|
4276
|
+
case "hub.inviteArrival":
|
|
4277
|
+
return hub?.inviteArrival ? hub.inviteArrival(ctx, signal) : Promise.resolve({ status: "unavailable" });
|
|
4278
|
+
case "hub.undoInvite":
|
|
4279
|
+
return hub?.undoInvite ? hub.undoInvite(asString(params.userId, "userId", command), ctx) : Promise.resolve({ status: "unavailable" });
|
|
3475
4280
|
case "hub.jump": {
|
|
3476
4281
|
const userId = asString(params.userId, "userId", command);
|
|
3477
4282
|
return hub?.jump ? hub.jump(userId, ctx, signal) : Promise.resolve(unavailableHubHandoff());
|
|
@@ -3494,7 +4299,7 @@ function runHubCommand(ctx, command, params, caps, signal) {
|
|
|
3494
4299
|
case "hub.reportChat": {
|
|
3495
4300
|
const messageId = asString(params.messageId, "messageId", command);
|
|
3496
4301
|
return hub?.reportChat
|
|
3497
|
-
? hub.reportChat(messageId, ctx)
|
|
4302
|
+
? hub.reportChat(messageId, ctx, params.block === true && !!caps.confirmHubChatBlock, caps.confirmHubChatBlock ? (target, abort) => caps.confirmHubChatBlock(target, ctx, abort) : undefined, signal)
|
|
3498
4303
|
: Promise.resolve({ status: "unavailable" });
|
|
3499
4304
|
}
|
|
3500
4305
|
case "hub.commit": {
|