castle-web-cli 0.4.233 → 0.4.234

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/dist/api.d.ts +11 -0
  2. package/dist/api.js +43 -0
  3. package/dist/bundle.d.ts +64 -0
  4. package/dist/bundle.js +558 -2
  5. package/dist/castle-host/host.d.ts +17 -2
  6. package/dist/castle-host/host.js +793 -36
  7. package/dist/castleJson.d.ts +20 -1
  8. package/dist/castleJson.js +44 -2
  9. package/dist/check.js +9 -2
  10. package/dist/chunkLoader.d.ts +3 -0
  11. package/dist/chunkLoader.js +111 -0
  12. package/dist/devParty.d.ts +26 -0
  13. package/dist/devParty.js +231 -0
  14. package/dist/devSaveStorage.js +4 -0
  15. package/dist/devSessionStorage.js +3 -1
  16. package/dist/devSocial.d.ts +24 -0
  17. package/dist/devSocial.js +70 -0
  18. package/dist/ide.d.ts +2 -0
  19. package/dist/ide.js +119 -15
  20. package/dist/index.js +8 -2
  21. package/dist/init.js +1 -1
  22. package/dist/save-deck.d.ts +20 -1
  23. package/dist/save-deck.js +141 -5
  24. package/dist/serve.js +29 -11
  25. package/dist/shell/assets/{index-BjOxR-lW.js → index-DulbYIJm.js} +97 -97
  26. package/dist/shell/index.html +1 -1
  27. package/dist/vitePlugins.d.ts +2 -1
  28. package/dist/vitePlugins.js +13 -0
  29. package/kits/base/castle.json +1 -1
  30. package/kits/base/sdk/README.md +260 -3
  31. package/kits/base/sdk/castle.d.ts +7 -3
  32. package/kits/base/sdk/castle.js +2 -0
  33. package/kits/base/sdk/commands.d.ts +162 -1
  34. package/kits/base/sdk/commands.js +3 -0
  35. package/kits/base/sdk/display.d.ts +3 -0
  36. package/kits/base/sdk/display.js +9 -3
  37. package/kits/base/sdk/hub.d.ts +33 -6
  38. package/kits/base/sdk/hub.js +50 -4
  39. package/kits/base/sdk/multiplayer.d.ts +7 -1
  40. package/kits/base/sdk/multiplayer.js +140 -40
  41. package/kits/base/sdk/multiplayerProtocol.d.ts +2 -0
  42. package/kits/base/sdk/party.d.ts +23 -0
  43. package/kits/base/sdk/party.js +91 -0
  44. package/kits/base/sdk/reconnectBudget.d.ts +23 -0
  45. package/kits/base/sdk/reconnectBudget.js +96 -0
  46. package/kits/base/sdk/save.d.ts +38 -1
  47. package/kits/base/sdk/save.js +79 -6
  48. package/kits/base/sdk/server/hub.d.ts +31 -1
  49. package/kits/base/sdk/server/hub.js +50 -3
  50. package/kits/base/sdk/server/platformHandle.d.ts +13 -1
  51. package/kits/base/sdk/server/storage.d.ts +4 -0
  52. package/kits/base/sdk/server/storage.js +19 -3
  53. package/kits/base/sdk/server/wrapper.d.ts +7 -1
  54. package/kits/base/sdk/server/wrapper.js +10 -1
  55. package/kits/base/sdk/social.d.ts +9 -0
  56. package/kits/base/sdk/social.js +5 -0
  57. package/kits/hub-game/CLAUDE.md +123 -3
  58. package/kits/hub-game/README.md +63 -0
  59. package/kits/hub-game/castle.json +5 -5
  60. package/kits/hub-game/code/client/act.js +312 -0
  61. package/kits/hub-game/code/client/actionLayout.js +147 -0
  62. package/kits/hub-game/code/client/actionOverflow.js +556 -0
  63. package/kits/hub-game/code/client/arrivalCamera.js +50 -0
  64. package/kits/hub-game/code/client/askSlot.js +117 -0
  65. package/kits/hub-game/code/client/avatar.js +4 -2
  66. package/kits/hub-game/code/client/avatarShare.js +2 -0
  67. package/kits/hub-game/code/client/backVisibility.js +13 -0
  68. package/kits/hub-game/code/client/ballot.js +15 -10
  69. package/kits/hub-game/code/client/build.js +16 -0
  70. package/kits/hub-game/code/client/chat.js +41 -5
  71. package/kits/hub-game/code/client/chatModeration.js +5 -0
  72. package/kits/hub-game/code/client/chrome.js +1148 -258
  73. package/kits/hub-game/code/client/crowdNames.js +241 -0
  74. package/kits/hub-game/code/client/decor.js +10 -4
  75. package/kits/hub-game/code/client/defaultEnvironment.js +194 -0
  76. package/kits/hub-game/code/client/doorErrors.js +39 -0
  77. package/kits/hub-game/code/client/fall.js +18 -0
  78. package/kits/hub-game/code/client/farAvatars.js +233 -0
  79. package/kits/hub-game/code/client/firstJoin.js +9 -2
  80. package/kits/hub-game/code/client/fpsTelemetry.js +50 -0
  81. package/kits/hub-game/code/client/frameBatch.js +5 -0
  82. package/kits/hub-game/code/client/grab.js +31 -11
  83. package/kits/hub-game/code/client/hookLayer.js +87 -8
  84. package/kits/hub-game/code/client/hudCopy.js +51 -0
  85. package/kits/hub-game/code/client/hudRate.js +20 -0
  86. package/kits/hub-game/code/client/idle.js +14 -2
  87. package/kits/hub-game/code/client/invites.js +231 -0
  88. package/kits/hub-game/code/client/joinError.js +9 -0
  89. package/kits/hub-game/code/client/labelsNear.js +31 -2
  90. package/kits/hub-game/code/client/landscapeLayout.js +17 -0
  91. package/kits/hub-game/code/client/layoutCache.js +264 -0
  92. package/kits/hub-game/code/client/loadTelemetry.js +20 -0
  93. package/kits/hub-game/code/client/loadingCover.js +148 -0
  94. package/kits/hub-game/code/client/loadingEntry.js +8 -0
  95. package/kits/hub-game/code/client/menuRows.js +43 -0
  96. package/kits/hub-game/code/client/modelReady.js +7 -0
  97. package/kits/hub-game/code/client/padCueArrival.js +23 -0
  98. package/kits/hub-game/code/client/padCues.js +112 -0
  99. package/kits/hub-game/code/client/padOccupancy.js +88 -0
  100. package/kits/hub-game/code/client/padReadability.js +26 -0
  101. package/kits/hub-game/code/client/padRings.js +69 -0
  102. package/kits/hub-game/code/client/pushVisit.js +14 -0
  103. package/kits/hub-game/code/client/quality.js +205 -0
  104. package/kits/hub-game/code/client/qualityEntry.js +55 -0
  105. package/kits/hub-game/code/client/safeLayout.js +338 -0
  106. package/kits/hub-game/code/client/safeStyle.js +42 -0
  107. package/kits/hub-game/code/client/say.js +12 -3
  108. package/kits/hub-game/code/client/shot.js +64 -10
  109. package/kits/hub-game/code/client/shotFit.js +56 -0
  110. package/kits/hub-game/code/client/signIn.js +28 -0
  111. package/kits/hub-game/code/client/state.js +53 -0
  112. package/kits/hub-game/code/client/talk.js +209 -45
  113. package/kits/hub-game/code/client/tiers.js +68 -66
  114. package/kits/hub-game/code/client/together.js +7 -2
  115. package/kits/hub-game/code/client/weakestLookBake.js +92 -0
  116. package/kits/hub-game/code/client/weakestTier.js +295 -0
  117. package/kits/hub-game/code/client/worldLabels.js +241 -0
  118. package/kits/hub-game/code/client/yours.js +10 -9
  119. package/kits/hub-game/code/npcDisplayText.js +55 -0
  120. package/kits/hub-game/code/server/act.js +124 -0
  121. package/kits/hub-game/code/server/actions.js +6 -1
  122. package/kits/hub-game/code/server/actors.js +2 -1
  123. package/kits/hub-game/code/server/analytics.js +83 -0
  124. package/kits/hub-game/code/server/anonymousEntry.js +49 -0
  125. package/kits/hub-game/code/server/arrivalPose.js +36 -0
  126. package/kits/hub-game/code/server/companion.js +28 -3
  127. package/kits/hub-game/code/server/doorAnalytics.js +52 -0
  128. package/kits/hub-game/code/server/earned.js +22 -5
  129. package/kits/hub-game/code/server/frameBatch.js +183 -0
  130. package/kits/hub-game/code/server/friendsAmong.js +49 -9
  131. package/kits/hub-game/code/server/history.js +2 -0
  132. package/kits/hub-game/code/server/hub.js +1306 -95
  133. package/kits/hub-game/code/server/idle.js +30 -1
  134. package/kits/hub-game/code/server/index.js +26 -4
  135. package/kits/hub-game/code/server/invites.js +19 -0
  136. package/kits/hub-game/code/server/labels.js +9 -1
  137. package/kits/hub-game/code/server/loadAbandon.js +106 -0
  138. package/kits/hub-game/code/server/manifest.js +211 -3
  139. package/kits/hub-game/code/server/menu.js +31 -3
  140. package/kits/hub-game/code/server/npcs.js +226 -64
  141. package/kits/hub-game/code/server/observe.js +408 -0
  142. package/kits/hub-game/code/server/padOccupancy.js +85 -0
  143. package/kits/hub-game/code/server/players.js +9 -1
  144. package/kits/hub-game/code/server/resumePose.js +152 -0
  145. package/kits/hub-game/code/server/say.js +1 -1
  146. package/kits/hub-game/code/server/standing.js +4 -5
  147. package/kits/hub-game/code/server/storageLimit.js +187 -0
  148. package/kits/hub-game/code/server/vis.js +67 -5
  149. package/kits/hub-game/code/shared/act.js +35 -0
  150. package/kits/hub-game/code/shared/danceIdle.js +28 -0
  151. package/kits/hub-game/code/shared/loadStages.js +12 -0
  152. package/kits/hub-game/code/shared/quality.js +74 -0
  153. package/kits/hub-game/code/shared/say.js +2 -0
  154. package/kits/hub-game/code/shared/shot.js +35 -1
  155. package/kits/hub-game/code/systems/hub.js +970 -169
  156. package/kits/hub-game/docs/analytics.md +279 -0
  157. package/kits/hub-game/docs/contract.md +1257 -42
  158. package/kits/hub-game/docs/home-pieces.md +9 -2
  159. package/kits/hub-game/docs/observed-progress.md +252 -0
  160. package/kits/hub-game/main.jsx +2 -0
  161. package/kits/hub-game/package-lock.json +10 -3
  162. package/kits/hub-game/package.json +6 -3
  163. package/kits/hub-game/play/player.js +142 -0
  164. package/kits/hub-game/play/registry.js +47 -0
  165. package/kits/hub-game/play.jsx +37 -0
  166. package/kits/hub-game/scripts/check.mjs +39 -5
  167. package/kits/hub-game/scripts/companion-follower-wire.json +1 -1
  168. package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +11 -0
  169. package/kits/hub-game/scripts/fixtures/decor-keyless.json +5 -5
  170. package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +3 -0
  171. package/kits/hub-game/scripts/fixtures/fake-dom.mjs +19 -3
  172. package/kits/hub-game/scripts/fixtures/interest-legacy.json +3 -3
  173. package/kits/hub-game/scripts/fixtures/vis-shared-wire.json +1 -1
  174. package/kits/hub-game/scripts/pose-storage-fixture.mjs +46 -0
  175. package/kits/hub-game/scripts/test-act-client.mjs +186 -0
  176. package/kits/hub-game/scripts/test-act.mjs +171 -0
  177. package/kits/hub-game/scripts/test-action-layout.mjs +80 -0
  178. package/kits/hub-game/scripts/test-action-observers.mjs +46 -0
  179. package/kits/hub-game/scripts/test-actions-client.mjs +367 -2
  180. package/kits/hub-game/scripts/test-actors.mjs +20 -7
  181. package/kits/hub-game/scripts/test-analytics.mjs +76 -0
  182. package/kits/hub-game/scripts/test-anonymous-entry.mjs +28 -0
  183. package/kits/hub-game/scripts/test-arrival-pose-server.mjs +196 -0
  184. package/kits/hub-game/scripts/test-arrival-pose.mjs +24 -0
  185. package/kits/hub-game/scripts/test-ask-slot.mjs +85 -0
  186. package/kits/hub-game/scripts/test-avatar-wire.mjs +49 -10
  187. package/kits/hub-game/scripts/test-avatar.mjs +44 -0
  188. package/kits/hub-game/scripts/test-back-visibility.mjs +82 -0
  189. package/kits/hub-game/scripts/test-ballot.mjs +11 -4
  190. package/kits/hub-game/scripts/test-ban-join.mjs +121 -13
  191. package/kits/hub-game/scripts/test-build.mjs +20 -2
  192. package/kits/hub-game/scripts/test-chat.mjs +206 -5
  193. package/kits/hub-game/scripts/test-companion-chat.mjs +20 -2
  194. package/kits/hub-game/scripts/test-control-layout-dom.mjs +120 -0
  195. package/kits/hub-game/scripts/test-crowd-names.mjs +205 -0
  196. package/kits/hub-game/scripts/test-decor-client.mjs +45 -4
  197. package/kits/hub-game/scripts/test-decor.mjs +7 -0
  198. package/kits/hub-game/scripts/test-default-environment-root.mjs +95 -0
  199. package/kits/hub-game/scripts/test-default-environment.mjs +267 -0
  200. package/kits/hub-game/scripts/test-door-analytics.mjs +58 -0
  201. package/kits/hub-game/scripts/test-door-jump.mjs +100 -0
  202. package/kits/hub-game/scripts/test-earned.mjs +33 -3
  203. package/kits/hub-game/scripts/test-far-avatars.mjs +340 -0
  204. package/kits/hub-game/scripts/test-fps-telemetry.mjs +112 -0
  205. package/kits/hub-game/scripts/test-frame-batch.mjs +252 -0
  206. package/kits/hub-game/scripts/test-fresh-friends.mjs +118 -0
  207. package/kits/hub-game/scripts/test-grab-orbit.mjs +47 -4
  208. package/kits/hub-game/scripts/test-high-only.mjs +170 -0
  209. package/kits/hub-game/scripts/test-hub-ops.mjs +321 -2
  210. package/kits/hub-game/scripts/test-hub-trip.mjs +879 -11
  211. package/kits/hub-game/scripts/test-hud-clear.mjs +162 -59
  212. package/kits/hub-game/scripts/test-hud-defects-dom.mjs +100 -0
  213. package/kits/hub-game/scripts/test-hud-rate.mjs +224 -0
  214. package/kits/hub-game/scripts/test-hud-safe-visibility-dom.mjs +83 -0
  215. package/kits/hub-game/scripts/test-idle.mjs +66 -0
  216. package/kits/hub-game/scripts/test-interest-cells.mjs +20 -0
  217. package/kits/hub-game/scripts/test-interest.mjs +15 -0
  218. package/kits/hub-game/scripts/test-invites-client.mjs +430 -0
  219. package/kits/hub-game/scripts/test-invites.mjs +109 -0
  220. package/kits/hub-game/scripts/test-labels.mjs +71 -3
  221. package/kits/hub-game/scripts/test-landscape-layout.mjs +194 -0
  222. package/kits/hub-game/scripts/test-list-scroll-dom.mjs +49 -0
  223. package/kits/hub-game/scripts/test-load-abandon.mjs +246 -0
  224. package/kits/hub-game/scripts/test-loading-cover.mjs +162 -0
  225. package/kits/hub-game/scripts/test-manifest.mjs +265 -0
  226. package/kits/hub-game/scripts/test-menu-client.mjs +105 -0
  227. package/kits/hub-game/scripts/test-menu.mjs +23 -0
  228. package/kits/hub-game/scripts/test-npcs.mjs +819 -10
  229. package/kits/hub-game/scripts/test-observed.mjs +745 -0
  230. package/kits/hub-game/scripts/test-pad-cues.mjs +304 -0
  231. package/kits/hub-game/scripts/test-pad-occupancy.mjs +177 -0
  232. package/kits/hub-game/scripts/test-picker.mjs +234 -7
  233. package/kits/hub-game/scripts/test-placement-cache.mjs +690 -0
  234. package/kits/hub-game/scripts/test-progress-reset.mjs +559 -0
  235. package/kits/hub-game/scripts/test-push-visit.mjs +26 -0
  236. package/kits/hub-game/scripts/test-quality.mjs +385 -0
  237. package/kits/hub-game/scripts/test-rehello.mjs +699 -5
  238. package/kits/hub-game/scripts/test-resume-action-order.mjs +598 -0
  239. package/kits/hub-game/scripts/test-resume-held.mjs +239 -0
  240. package/kits/hub-game/scripts/test-resume-pose.mjs +142 -0
  241. package/kits/hub-game/scripts/test-safe-events-dom.mjs +116 -0
  242. package/kits/hub-game/scripts/test-safe-layout.mjs +330 -0
  243. package/kits/hub-game/scripts/test-say.mjs +1 -1
  244. package/kits/hub-game/scripts/test-shot.mjs +145 -0
  245. package/kits/hub-game/scripts/test-signin-client.mjs +45 -0
  246. package/kits/hub-game/scripts/test-soundscape.mjs +22 -17
  247. package/kits/hub-game/scripts/test-standing.mjs +35 -2
  248. package/kits/hub-game/scripts/test-storage-limit.mjs +333 -0
  249. package/kits/hub-game/scripts/test-stuck.mjs +5 -4
  250. package/kits/hub-game/scripts/test-talk-overlay-dom.mjs +130 -0
  251. package/kits/hub-game/scripts/test-tiers-render.mjs +86 -13
  252. package/kits/hub-game/scripts/test-tiers.mjs +7 -8
  253. package/kits/hub-game/scripts/test-vis.mjs +433 -6
  254. package/kits/hub-game/scripts/test-weakest-tier.mjs +924 -0
  255. package/kits/hub-game/scripts/test-world-labels.mjs +367 -0
  256. package/kits/hub-game/scripts/test-yours-chrome.mjs +50 -6
  257. package/kits/hub-game/scripts/test-yours.mjs +39 -8
  258. package/kits/multiplayer-3d/castle.json +5 -5
  259. package/kits/multiplayer-3d/code/client/joinFailure.js +27 -0
  260. package/kits/multiplayer-3d/code/client/resumeGate.js +139 -0
  261. package/kits/multiplayer-3d/code/systems/multiplayer.js +369 -30
  262. package/kits/multiplayer-3d/package-lock.json +8 -1
  263. package/kits/multiplayer-3d/package.json +2 -1
  264. package/kits/multiplayer-3d/scripts/test-join-watchdog.mjs +436 -0
  265. package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +624 -0
  266. package/kits/physics-2d/CLAUDE.md +10 -1
  267. package/kits/physics-2d/castle.json +2 -2
  268. package/kits/physics-2d/engine/frozenActors.js +233 -0
  269. package/kits/physics-2d/engine/scene.js +87 -5
  270. package/kits/physics-2d/eslint.config.js +1 -1
  271. package/kits/physics-2d/play/behaviors/AnalogStick.js +198 -0
  272. package/kits/physics-2d/play/behaviors/Camera.js +40 -0
  273. package/kits/physics-2d/play/behaviors/Collider.js +122 -0
  274. package/kits/physics-2d/play/behaviors/Draggable.js +115 -0
  275. package/kits/physics-2d/play/behaviors/Goal.js +46 -0
  276. package/kits/physics-2d/play/behaviors/Joints.js +126 -0
  277. package/kits/physics-2d/play/behaviors/Layout.js +71 -0
  278. package/kits/physics-2d/play/behaviors/RigidBody.js +57 -0
  279. package/kits/physics-2d/play/behaviors/Slingshot.js +142 -0
  280. package/kits/physics-2d/play/behaviors/SoundPlayer.js +263 -0
  281. package/kits/physics-2d/play/behaviors/Sprite.js +406 -0
  282. package/kits/physics-2d/play/behaviors/Style.js +209 -0
  283. package/kits/physics-2d/play/behaviors/Text.js +85 -0
  284. package/kits/physics-2d/play/behaviors/Video.js +93 -0
  285. package/kits/physics-3d/CLAUDE.md +25 -1651
  286. package/kits/physics-3d/behaviors/Body.jsx +3 -0
  287. package/kits/physics-3d/behaviors/Model.jsx +3 -0
  288. package/kits/physics-3d/behaviors/Player.jsx +35 -18
  289. package/kits/physics-3d/behaviors/Shape.jsx +3 -0
  290. package/kits/physics-3d/behaviors/Solid.jsx +3 -0
  291. package/kits/physics-3d/behaviors/Transform.jsx +3 -0
  292. package/kits/physics-3d/castle.json +3 -3
  293. package/kits/physics-3d/docs/engine-camera.md +542 -0
  294. package/kits/physics-3d/docs/engine-frame-cap.md +136 -0
  295. package/kits/physics-3d/docs/engine-load.md +149 -0
  296. package/kits/physics-3d/docs/engine-look.md +114 -0
  297. package/kits/physics-3d/docs/engine-shadows.md +372 -0
  298. package/kits/physics-3d/docs/engine-skip-work.md +187 -0
  299. package/kits/physics-3d/docs/engine-sky.md +198 -0
  300. package/kits/physics-3d/docs/engine-static-actors.md +226 -0
  301. package/kits/physics-3d/docs/engine-view.md +37 -0
  302. package/kits/physics-3d/docs/pxmodel-format.md +1 -1
  303. package/kits/physics-3d/engine3d/PlayOnly3D.jsx +5 -1
  304. package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +19 -333
  305. package/kits/physics-3d/engine3d/actornode.js +1 -0
  306. package/kits/physics-3d/engine3d/branches.js +3 -13
  307. package/kits/physics-3d/engine3d/cage.js +2 -7
  308. package/kits/physics-3d/engine3d/cageops.js +2 -17
  309. package/kits/physics-3d/engine3d/dataBehaviors.js +12 -0
  310. package/kits/physics-3d/engine3d/framecap.js +4 -1
  311. package/kits/physics-3d/engine3d/frozenphysics.js +140 -0
  312. package/kits/physics-3d/engine3d/frozenstatics.js +273 -0
  313. package/kits/physics-3d/engine3d/gait.js +8 -0
  314. package/kits/physics-3d/engine3d/initialModelFiles.js +18 -0
  315. package/kits/physics-3d/engine3d/look.js +7 -0
  316. package/kits/physics-3d/engine3d/modelFiles.js +3 -17
  317. package/kits/physics-3d/engine3d/modelMath.js +49 -0
  318. package/kits/physics-3d/engine3d/modelready.js +16 -0
  319. package/kits/physics-3d/engine3d/motion.js +3 -3
  320. package/kits/physics-3d/engine3d/nearshadows.js +77 -10
  321. package/kits/physics-3d/engine3d/orbitinput.js +59 -25
  322. package/kits/physics-3d/engine3d/partgeometry.js +1 -16
  323. package/kits/physics-3d/engine3d/paths.js +1 -9
  324. package/kits/physics-3d/engine3d/playTimings.js +50 -0
  325. package/kits/physics-3d/engine3d/playerRun.js +372 -0
  326. package/kits/physics-3d/engine3d/pxmodel.js +3 -3
  327. package/kits/physics-3d/engine3d/rapier.js +27 -0
  328. package/kits/physics-3d/engine3d/scatter.js +1 -11
  329. package/kits/physics-3d/engine3d/shadowfade.js +23 -15
  330. package/kits/physics-3d/engine3d/sky.js +1 -1
  331. package/kits/physics-3d/engine3d/squarefirst.js +177 -0
  332. package/kits/physics-3d/engine3d/stillshadows.js +399 -0
  333. package/kits/physics-3d/engine3d/sweep.js +1 -25
  334. package/kits/physics-3d/engine3d/world3d.js +468 -18
  335. package/kits/physics-3d/eslint.config.js +2 -1
  336. package/kits/physics-3d/main.jsx +6 -3
  337. package/kits/physics-3d/package-lock.json +7 -0
  338. package/kits/physics-3d/package.json +5 -1
  339. package/kits/physics-3d/play/behaviors/Body.js +31 -0
  340. package/kits/physics-3d/play/behaviors/Door.js +37 -0
  341. package/kits/physics-3d/play/behaviors/Lookable.js +16 -0
  342. package/kits/physics-3d/play/behaviors/Model.js +23 -0
  343. package/kits/physics-3d/play/behaviors/Pickup.js +46 -0
  344. package/kits/physics-3d/play/behaviors/Player.js +1204 -0
  345. package/kits/physics-3d/play/behaviors/Shape.js +47 -0
  346. package/kits/physics-3d/play/behaviors/Solid.js +16 -0
  347. package/kits/physics-3d/play/behaviors/Transform.js +29 -0
  348. package/kits/physics-3d/pnpm-lock.yaml +8 -0
  349. package/kits/physics-3d/scripts/bench-shadow-fade.mjs +37 -0
  350. package/kits/physics-3d/scripts/build-rapier-gz.mjs +56 -0
  351. package/kits/physics-3d/scripts/frozen-statics-fixture.mjs +141 -0
  352. package/kits/physics-3d/scripts/test-camera-follow.mjs +5 -1
  353. package/kits/physics-3d/scripts/test-camera-orbit.mjs +52 -4
  354. package/kits/physics-3d/scripts/test-drop-empty-parts.mjs +1 -1
  355. package/kits/physics-3d/scripts/test-empty-gait-hints.mjs +89 -0
  356. package/kits/physics-3d/scripts/test-frame-cap-bob.mjs +6 -3
  357. package/kits/physics-3d/scripts/test-frame-cap.mjs +1 -1
  358. package/kits/physics-3d/scripts/test-frozen-nested.mjs +49 -0
  359. package/kits/physics-3d/scripts/test-frozen-statics-legacy-physics2d.mjs +123 -0
  360. package/kits/physics-3d/scripts/test-frozen-statics.mjs +434 -0
  361. package/kits/physics-3d/scripts/test-look-bake.mjs +1 -1
  362. package/kits/physics-3d/scripts/test-near-shadows.mjs +2 -2
  363. package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +88 -7
  364. package/kits/physics-3d/scripts/test-orbit-shift-lock.mjs +40 -3
  365. package/kits/physics-3d/scripts/test-orbit-shot.mjs +75 -1
  366. package/kits/physics-3d/scripts/test-rapier-gz.mjs +106 -0
  367. package/kits/physics-3d/scripts/test-sky.mjs +1 -1
  368. package/kits/physics-3d/scripts/test-square-first.mjs +921 -0
  369. package/kits/physics-3d/scripts/test-static-actors.mjs +3 -1
  370. package/kits/physics-3d/scripts/test-static-physics.mjs +4 -1
  371. package/kits/physics-3d/scripts/test-static-scenery.mjs +5 -2
  372. package/kits/physics-3d/scripts/test-steady-hover.mjs +5 -2
  373. package/kits/physics-3d/scripts/test-still-shadows.mjs +477 -0
  374. package/kits/physics-3d/systems/physics3d.js +37 -4
  375. package/kits/real-time/castle.json +2 -2
  376. package/kits/real-time/code/client/connection.js +33 -10
  377. package/kits/real-time/code/client/gameHooks.js +2 -0
  378. package/kits/real-time/code/client/joinOverlay.js +9 -4
  379. package/kits/real-time/code/server/session.js +6 -4
  380. package/kits/real-time/package-lock.json +1 -1
  381. package/package.json +2 -2
@@ -19,6 +19,7 @@
19
19
  // or `hub.release` replaces or ends it, which stands them (`tick`).
20
20
 
21
21
  import { warnOnce, isActor } from './actors.js';
22
+ import { danceFloors } from '../shared/danceIdle.js';
22
23
 
23
24
  const DEG = Math.PI / 180;
24
25
 
@@ -56,6 +57,8 @@ export function newIdleState() {
56
57
  sitBudget: new Map(),
57
58
  // actorId -> { file, volume, radius, since }
58
59
  loops: new Map(),
60
+ danceIdle: null,
61
+ danceIdleUsed: false,
59
62
  shotBudget: { tokens: SHOT_BURST, at: null },
60
63
  };
61
64
  }
@@ -226,7 +229,7 @@ function spendSit(h, playerId) {
226
229
  // no. Otherwise the player is held on the seat, facing its way.
227
230
  // Flat distance from a point to a seat's Shape footprint (its box turned by
228
231
  // rotationY, or its circle): the client offers a seat along its whole length.
229
- function footprintDistance(actor, p) {
232
+ export function footprintDistance(actor, p) {
230
233
  const t = actor.components.Transform ?? {};
231
234
  const shape = actor.components.Shape ?? {};
232
235
  const dx = p.x - (t.x ?? 0);
@@ -346,6 +349,7 @@ export function sound(h, actorId, file, options = {}) {
346
349
  }
347
350
  if (file === null || file === undefined) {
348
351
  h.loops.delete(actorId);
352
+ if (h.danceIdle?.actor === actorId) { h.danceIdle = null; }
349
353
  return true;
350
354
  }
351
355
  if (!sounds.includes(file)) {
@@ -363,6 +367,7 @@ export function sound(h, actorId, file, options = {}) {
363
367
  warnOnce(h, 'sound:loops', `hub.sound: at most ${MAX_LOOPS} loops play at once in a place`);
364
368
  return false;
365
369
  }
370
+ if (h.danceIdle?.actor === actorId) { h.danceIdle = null; }
366
371
  h.loops.set(actorId, { file, volume, radius, since: h.sim?.timeMs ?? 0 });
367
372
  return true;
368
373
  }
@@ -372,6 +377,7 @@ export function sound(h, actorId, file, options = {}) {
372
377
  }
373
378
  // Another sound at an actor replaces the loop playing there.
374
379
  h.loops.delete(actorId);
380
+ if (h.danceIdle?.actor === actorId) { h.danceIdle = null; }
375
381
  h.session?.broadcast({ k: 'hub-sound', actor: actorId, file, volume, radius });
376
382
  return true;
377
383
  }
@@ -416,6 +422,7 @@ export function fields(h) {
416
422
  return {};
417
423
  }
418
424
  return {
425
+ ...(h.danceIdleUsed ? { hubDanceIdle: danceIdleNow(h) } : {}),
419
426
  ...(idle.emotes ? { hubEmotes: emotesNow(h) } : {}),
420
427
  ...(idle.emotes ? h.npcs?.emoteFields() : {}),
421
428
  ...(idle.seats ? { hubSeated: seatedNow(h) } : {}),
@@ -423,6 +430,28 @@ export function fields(h) {
423
430
  };
424
431
  }
425
432
 
433
+ // Set once after starting/changing a sound loop. Its epoch is the loop's
434
+ // server clock; latched snapshot deltas send changes, never beat traffic.
435
+ export function danceIdle(h, actorId, options) {
436
+ if (options === null) {
437
+ if (h.danceIdleUsed) {h.danceIdle = null;}
438
+ return true;
439
+ }
440
+ const loop = h.loops.get(actorId);
441
+ const floors = danceFloors(options?.floors);
442
+ const bpm = options?.bpm;
443
+ if (!idleOf(h)?.emotes || !loop || !floors || !Number.isFinite(bpm) || bpm < 30 || bpm > 300) {return false;}
444
+ h.danceIdleUsed = true;
445
+ h.danceIdle = { actor: actorId, file: loop.file, beatAt: loop.since, bpm, floors };
446
+ return true;
447
+ }
448
+
449
+ function danceIdleNow(h) {
450
+ const spec = h.danceIdle;
451
+ const loop = spec && h.loops.get(spec.actor);
452
+ return loop?.file === spec?.file && loop?.since === spec?.beatAt ? spec : null;
453
+ }
454
+
426
455
  export function forget(h, playerId) {
427
456
  h.emotes.delete(playerId);
428
457
  h.emoteAt.delete(playerId);
@@ -12,6 +12,8 @@ import * as World from '@imports/castle.multiplayer-3d/code/server/world.js';
12
12
  import * as Limits from '@imports/castle.multiplayer-3d/code/server/limits.js';
13
13
  import { resolveScenePath } from '@imports/castle.multiplayer-3d/code/server/sceneBodies.js';
14
14
  import * as Hub from './hub.js';
15
+ import { batchFrames } from './frameBatch.js';
16
+ import { limitCallbacks } from './storageLimit.js';
15
17
 
16
18
  // Root-anchored, so these are the deck's files once this kit is imported.
17
19
  const castleJson = Object.values(import.meta.glob('/castle.json', { eager: true, import: 'default' }))[0] ?? {};
@@ -48,17 +50,37 @@ const engine = {
48
50
  };
49
51
  const hub = Hub.layer(castleJson, deckGame, placeHooks, (path) => resolveScenePath(path) === path, sceneGround, devDecks, engine);
50
52
 
51
- export default {
52
- ...makeSession({
53
+ const callbacks = makeSession({
53
54
  label: 'hub',
54
55
  poses: Poses,
55
56
  world: World,
56
57
  players: hubPlayers(hub),
57
58
  ownership: Ownership,
58
59
  game: hub,
59
- }),
60
+ });
61
+ // Preserve real-time's transport bookkeeping, then finish only an opted-in
62
+ // pose-only visit before a same-tick replacement can hide its departure.
63
+ if (hub.departed) {
64
+ const leave = callbacks.onPlayerLeave;
65
+ callbacks.onPlayerLeave = (session, player) => {
66
+ leave?.(session, player);
67
+ hub.departed(session, player);
68
+ };
69
+ }
70
+ // v1.138: load-abandoned telemetry sees every connection start and end, and
71
+ // checks its timeout on every tick, even while the simulation is still building.
72
+ if (hub.transportJoin) {
73
+ const { onPlayerJoin: join, onPlayerLeave: leave, onTick: tick } = callbacks;
74
+ callbacks.onPlayerJoin = (session, player) => { join?.(session, player); hub.transportJoin(session, player); };
75
+ callbacks.onPlayerLeave = (session, player) => { leave?.(session, player); hub.transportLeave(session, player); };
76
+ callbacks.onTick = (session) => { tick?.(session); hub.transportTick(session); };
77
+ }
78
+ // v1.144: every callback sees one session whose storage, hub and character
79
+ // requests queue under the host broker's in-flight cap (storageLimit.js).
80
+ export default limitCallbacks({
81
+ ...batchFrames(callbacks, castleJson.hub?.frameBatch === true),
60
82
  // A place's NPCs answer the shared-character requests of a session the host
61
83
  // brokers the place's characters into (a layer of the place, or a world
62
84
  // joined through its `npcs.route`); the platform calls these only there.
63
85
  ...hub.worldCharacters,
64
- };
86
+ });
@@ -0,0 +1,19 @@
1
+ // v1.95: a place can ask its own player's trusted host for a link. v1.103's
2
+ // optional share flag is presentation intent; no token, destination or text crosses.
3
+ export function request(h, playerId, options = undefined) {
4
+ if (h.place.invite !== true) {throw new TypeError('hub.invite: this place does not declare invite');}
5
+ if (typeof playerId !== 'string') {throw new TypeError('hub.invite: playerId must be a string');}
6
+ if (options !== undefined && (options === null || typeof options !== 'object' ||
7
+ ![Object.prototype, null].includes(Object.getPrototypeOf(options)) ||
8
+ !Reflect.ownKeys(options).every((key) => key === 'share') ||
9
+ (Object.hasOwn(options, 'share') && typeof options.share !== 'boolean'))) {
10
+ throw new TypeError('hub.invite: options must contain only an optional boolean share');
11
+ }
12
+ const p = h.players.get(playerId);
13
+ if (!p?.arrived || p.ended || !h.sim?.players.has(playerId)) {return false;}
14
+ const now = h.sim.timeMs, budget = (h.inviteAt ??= new Map());
15
+ if (now - (budget.get(playerId) ?? -Infinity) < 1000) {return false;}
16
+ budget.set(playerId, now);
17
+ h.session?.send(playerId, { k: 'hub-invite', ...(options?.share === true ? { share: true } : {}) });
18
+ return true;
19
+ }
@@ -17,7 +17,7 @@ const SPEECH_MAX = 240;
17
17
  // the whole metre and only when finite and not negative; `distance: false`
18
18
  // has it show none. Anything else, and any other style, is a label as before.
19
19
  // v1.81: `edge: false` makes a goal a hint, drawn only over its actor.
20
- export function setLabel(h, actorId, text, { style = 'tag', ttlMs, to, about, distanceM, distance, edge } = {}, npc) {
20
+ export function setLabel(h, actorId, text, { style = 'tag', ttlMs, to, about, distanceM, distance, edge, at } = {}, npc) {
21
21
  if (!actorId) {
22
22
  return;
23
23
  }
@@ -31,6 +31,10 @@ export function setLabel(h, actorId, text, { style = 'tag', ttlMs, to, about, di
31
31
  } else if (goal && typeof distanceM === 'number' && Number.isFinite(distanceM) && distanceM >= 0) {
32
32
  shown = { distanceM: Math.round(distanceM) };
33
33
  }
34
+ // Coordinates travel only on a private goal, never in shared actor poses.
35
+ const position = goal && at && ['x', 'y', 'z'].every((key) => Number.isFinite(at[key])) &&
36
+ Math.abs(at.x) <= 200 && Math.abs(at.z) <= 200 && at.y >= -30 && at.y <= 80
37
+ ? { x: at.x, y: at.y, z: at.z } : null;
34
38
  const label = clear
35
39
  ? null
36
40
  : {
@@ -44,6 +48,7 @@ export function setLabel(h, actorId, text, { style = 'tag', ttlMs, to, about, di
44
48
  npc: Boolean(npc && speech),
45
49
  ...(typeof about === 'string' ? { about } : {}),
46
50
  ...shown,
51
+ ...(position ? { at: position } : {}),
47
52
  ...(goal && edge === false ? { edge: false } : {}),
48
53
  };
49
54
  if (!targets) {
@@ -80,6 +85,9 @@ export function wireLabel(label) {
80
85
  if (label.edge === false) {
81
86
  wire.edge = false;
82
87
  }
88
+ if (label.at) {
89
+ wire.at = { ...label.at };
90
+ }
83
91
  return wire;
84
92
  }
85
93
 
@@ -0,0 +1,106 @@
1
+ // v1.138 kind 27 load_abandoned: a town connection that never arrived. Only a
2
+ // main place with analytics, analyticsV111 and loadTelemetry keeps any state.
3
+ // Connections start and end at the transport's own join and leave callbacks
4
+ // (`code/server/index.js`), never by sampling the roster, so a leave and rejoin
5
+ // of one player id between two ticks is two connections. The timeout check runs
6
+ // on every transport tick, before the simulation exists too. A connection emits
7
+ // at most once: closed (it left before arriving) or timeout (still here, not
8
+ // arrived, LOAD_ABANDON_TIMEOUT_MS after it joined). A timeout suppresses the
9
+ // later close; an arrival suppresses both.
10
+ import { LOAD_STAGES, CLIENT_LOAD_STAGES, LOAD_REASONS } from '../shared/loadStages.js';
11
+ export { LOAD_STAGES, CLIENT_LOAD_STAGES, LOAD_REASONS };
12
+
13
+ export const LOAD_ABANDONED_KIND = 27;
14
+ export const LOAD_ABANDON_TIMEOUT_MS = 30000;
15
+ // Ghost refuses a longer value; the timeout fires long before it.
16
+ export const LOAD_ABANDON_MAX_MS = 120000;
17
+ // A browser report sooner than this after the previous one is ignored.
18
+ export const LOAD_REPORT_INTERVAL_MS = 1000;
19
+
20
+ export function enabled(h) {
21
+ return h.place?.analytics === true && h.place.analyticsV111 === true && h.place.loadTelemetry === true && !h.manifest?.house;
22
+ }
23
+
24
+ function loads(h) {
25
+ if (h.loads?.session !== h.session) {h.loads = { session: h.session, players: new Map() };}
26
+ return h.loads.players;
27
+ }
28
+
29
+ function emit(h, playerId, load, result, now) {
30
+ load.done = true;
31
+ const value = Math.max(0, Math.min(LOAD_ABANDON_MAX_MS, Math.round(now - load.at)));
32
+ try {
33
+ const pending = h.session?.hub?.track?.(playerId, { kind: LOAD_ABANDONED_KIND, subject: load.stage, value, result, flags: 0 });
34
+ pending?.catch?.(() => {});
35
+ return pending !== undefined && pending !== false;
36
+ } catch {return false;}
37
+ }
38
+
39
+ // The furthest stage the server can see now; never lowers a recorded one.
40
+ function observe(h, playerId, load) {
41
+ const entry = h.players.get(playerId);
42
+ if (entry?.hello) {load.stage = Math.max(load.stage, LOAD_STAGES.hello);}
43
+ if (entry?.hello && h.sim?.players?.has(playerId)) {load.stage = Math.max(load.stage, LOAD_STAGES.body);}
44
+ }
45
+
46
+ // Transport join: always a new connection. A record the transport never closed
47
+ // belongs to a connection that is gone, so it ends as closed first. A player
48
+ // the place still has arrived (a kept resume) is not loading.
49
+ export function join(h, session, playerId, now = Date.now()) {
50
+ h.session ??= session;
51
+ if (!enabled(h) || typeof playerId !== 'string') {return;}
52
+ const all = loads(h);
53
+ const old = all.get(playerId);
54
+ if (old && !old.done) {emit(h, playerId, old, LOAD_REASONS.closed, now);}
55
+ all.set(playerId, h.players.get(playerId)?.arrived ? { done: true } : { at: now, stage: LOAD_STAGES.connected, done: false });
56
+ }
57
+
58
+ // Transport leave: the connection ends here, whatever the next tick sees.
59
+ export function leave(h, playerId, now = Date.now()) {
60
+ if (!enabled(h) || !h.loads || h.loads.session !== h.session) {return;}
61
+ const all = h.loads.players, load = all.get(playerId);
62
+ if (!load) {return;}
63
+ all.delete(playerId);
64
+ if (load.done) {return;}
65
+ observe(h, playerId, load);
66
+ if (!h.players.get(playerId)?.arrived) {emit(h, playerId, load, LOAD_REASONS.closed, now);}
67
+ }
68
+
69
+ // A hub-hello is a stage the moment it is received, before any reconcile can
70
+ // forget the player.
71
+ export function hello(h, playerId) {
72
+ const load = enabled(h) ? h.loads?.players.get(playerId) : undefined;
73
+ if (load && !load.done && h.loads.session === h.session) {load.stage = Math.max(load.stage, LOAD_STAGES.hello);}
74
+ }
75
+
76
+ // Every transport tick, simulation or not.
77
+ export function tick(h, now = Date.now()) {
78
+ if (!enabled(h)) {
79
+ delete h.loads;
80
+ return;
81
+ }
82
+ for (const [playerId, load] of loads(h)) {
83
+ if (load.done) {continue;}
84
+ if (h.players.get(playerId)?.arrived) {
85
+ load.done = true;
86
+ continue;
87
+ }
88
+ observe(h, playerId, load);
89
+ if (now - load.at >= LOAD_ABANDON_TIMEOUT_MS) {emit(h, playerId, load, LOAD_REASONS.timeout, now);}
90
+ }
91
+ }
92
+
93
+ // `{ k: 'hub-load', stage }` from an authenticated connection. Untrusted: only
94
+ // a client stage, only a raise, rate limited, never text.
95
+ export function message(h, session, player, data, now = Date.now()) {
96
+ const playerId = player?.playerId;
97
+ if (!enabled(h) || !session?.players?.some((p) => p.playerId === playerId) ||
98
+ Object.keys(data).some((key) => key !== 'k' && key !== 'stage') ||
99
+ !CLIENT_LOAD_STAGES.includes(data.stage)) {return false;}
100
+ h.session ??= session;
101
+ const load = h.loads?.session === h.session ? h.loads.players.get(playerId) : undefined;
102
+ if (!load || load.done || data.stage <= load.stage || (load.reportAt !== undefined && now - load.reportAt < LOAD_REPORT_INTERVAL_MS)) {return false;}
103
+ load.reportAt = now;
104
+ load.stage = data.stage;
105
+ return true;
106
+ }
@@ -8,9 +8,10 @@
8
8
  // field filled with its default.
9
9
 
10
10
  import { readUnlocks } from './earned.js';
11
+ import { readQuality } from '../shared/quality.js';
11
12
  import { readDecor } from './decor.js';
12
13
 
13
- // Manifest/wire major stays 1; latest optional contract additions are v1.83.
14
+ // Manifest/wire major stays 1; latest optional contract additions are v1.128.
14
15
  export const CONTRACT_VERSION = 1;
15
16
 
16
17
  export const CONTROLLERS = ['walk'];
@@ -65,6 +66,7 @@ export const BALLOT_LINE_MAX = 40;
65
66
  export const BALLOT_ABOUT = ['face', 'self'];
66
67
 
67
68
  const PLACE_KEYS = [
69
+ 'push',
68
70
  'title',
69
71
  'scene',
70
72
  'minPlayers',
@@ -83,12 +85,27 @@ const PLACE_KEYS = [
83
85
  'hud',
84
86
  'decor',
85
87
  'actions',
88
+ 'anonymousEntry',
89
+ 'invite',
86
90
  'companion',
87
91
  'ask',
88
92
  'menu',
89
93
  'ballot',
90
94
  'resume',
95
+ 'resumeVisibility',
96
+ 'resumePose',
97
+ 'resumeArrivalPose',
98
+ 'houseResume',
99
+ 'freshFriends',
100
+ 'under13Choices',
101
+ 'talkLog',
91
102
  'visibility',
103
+ 'analytics',
104
+ 'analyticsV111',
105
+ 'fpsTelemetry',
106
+ 'loadTelemetry',
107
+
108
+ 'analyticsRounds',
92
109
  ];
93
110
  // `tiers` is the deck's, not a place's: the client's picture on a slow device
94
111
  // (v1.21, `code/client/tiers.js`). The server reads nothing of it.
@@ -113,7 +130,7 @@ export const SOUNDSCAPE_SURFACES = ['grass', 'street', 'wood', 'stone', 'sand',
113
130
  // `unlocks` is the deck's (v1.53): the earned items its places may give
114
131
  // (`earned.js`). The manifest carries it only when declared, so a deck
115
132
  // without it reads as before.
116
- const TOP_KEYS = ['contract', 'places', 'interest', 'tiers', 'companionIdle', 'lowActorBudget', 'lowActorDistance', 'cues', 'stuck', 'yourGames', 'avatarColors', 'labels', 'soundscape', 'unlocks', 'house', ...PLACE_KEYS];
133
+ const TOP_KEYS = ['firstVisit', 'act', 'bringFriend', 'frameBatch', 'defaultEnvironment', 'weakestTier', 'highOnly', 'weakestLookBake', 'pongTimeoutMs', 'contract', 'places', 'interest', 'tiers', 'quality', 'companionIdle', 'lowActorBudget', 'lowActorDistance', 'mergeFarAvatars', 'playOnlyEntry', 'loadTimings', 'loadingCover', 'cues', 'playCards', 'stuck', 'yourGames', 'avatarColors', 'labels', 'safeInsets', 'soundscape', 'unlocks', 'house', 'weeklyCup', ...PLACE_KEYS];
117
134
 
118
135
  const DEFAULT_SCENE = 'scenes/main.scene';
119
136
 
@@ -123,6 +140,9 @@ export function readManifest(castleJson, sceneExists = () => true) {
123
140
  if (!isObject(hub)) {
124
141
  return { errors: ['castle.json has no `hub` block: a hub-game deck declares one.'], manifest: null };
125
142
  }
143
+ if (Object.hasOwn(hub, 'frameBatch') && hub.frameBatch !== true) {
144
+ errors.push('hub.frameBatch must be true or absent.');
145
+ }
126
146
  if (hub.contract !== CONTRACT_VERSION) {
127
147
  errors.push(
128
148
  Number.isInteger(hub.contract) && hub.contract > CONTRACT_VERSION
@@ -131,6 +151,29 @@ export function readManifest(castleJson, sceneExists = () => true) {
131
151
  );
132
152
  }
133
153
  unknownKeys(hub, TOP_KEYS, 'hub', errors);
154
+ if (hub.firstVisit !== undefined) {
155
+ const value = hub.firstVisit;
156
+ if (!isObject(value)) {errors.push('hub.firstVisit must be { live: [...] }.');}
157
+ else {
158
+ unknownKeys(value, ['live'], 'hub.firstVisit', errors);
159
+ if (!Array.isArray(value.live) || !value.live.length || value.live.length > 3 ||
160
+ value.live.some((v) => !['home', 'door', 'npc'].includes(v)) || new Set(value.live).size !== value.live.length) {
161
+ errors.push('hub.firstVisit.live must contain one to three unique variants: home, door, npc.');
162
+ }
163
+ }
164
+ }
165
+ if (Object.hasOwn(hub, 'bringFriend') && (hub.bringFriend !== true || hub.invite !== true)) {
166
+ errors.push('hub.bringFriend must be true or absent and requires hub.invite: true.');
167
+ }
168
+ if (hub.pongTimeoutMs !== undefined && (!Number.isInteger(hub.pongTimeoutMs) || hub.pongTimeoutMs < 0 || hub.pongTimeoutMs > 2_147_483_647)) {
169
+ errors.push('hub.pongTimeoutMs must be an integer from 0 through 2147483647.');
170
+ }
171
+ // Rendering and diagnostics flags are client-only, like the tier keys.
172
+ for (const key of ['defaultEnvironment', 'weakestTier', 'highOnly', 'weakestLookBake', 'mergeFarAvatars', 'playOnlyEntry', 'loadTimings']) {
173
+ if (hub[key] !== undefined && typeof hub[key] !== 'boolean') {
174
+ errors.push(`hub.${key} must be true or false.`);
175
+ }
176
+ }
134
177
  if (hub.lowActorDistance !== undefined && typeof hub.lowActorDistance !== 'boolean') {
135
178
  errors.push('hub.lowActorDistance must be true or false.');
136
179
  }
@@ -140,12 +183,25 @@ export function readManifest(castleJson, sceneExists = () => true) {
140
183
  if (hub.companionIdle !== undefined && typeof hub.companionIdle !== 'boolean') {
141
184
  errors.push('hub.companionIdle must be true or false.');
142
185
  }
186
+ if (hub.safeInsets !== undefined && typeof hub.safeInsets !== 'boolean') {
187
+ errors.push('hub.safeInsets must be true or false.');
188
+ }
143
189
  if (hub.tiers !== undefined && typeof hub.tiers !== 'boolean') {
144
190
  errors.push('hub.tiers must be true or false.');
145
191
  }
192
+ if (hub.highOnly !== undefined && hub.tiers !== true) {
193
+ errors.push('hub.highOnly requires hub.tiers: true.');
194
+ }
195
+ const quality = readQuality(hub.quality, hub.tiers, errors);
146
196
  if (hub.cues !== undefined && typeof hub.cues !== 'boolean') {
147
197
  errors.push('hub.cues must be true or false.');
148
198
  }
199
+ if (hub.loadingCover !== undefined && typeof hub.loadingCover !== 'boolean') {
200
+ errors.push('hub.loadingCover must be true or false.');
201
+ }
202
+ if (hub.playCards !== undefined && typeof hub.playCards !== 'boolean') {
203
+ errors.push('hub.playCards must be true or false.');
204
+ }
149
205
  if (hub.yourGames !== undefined && typeof hub.yourGames !== 'boolean') {
150
206
  errors.push('hub.yourGames must be true or false.');
151
207
  }
@@ -155,6 +211,9 @@ export function readManifest(castleJson, sceneExists = () => true) {
155
211
  if (hub.stuck !== undefined && typeof hub.stuck !== 'boolean') {
156
212
  errors.push('hub.stuck must be true or false.');
157
213
  }
214
+ if (hub.weeklyCup !== undefined && typeof hub.weeklyCup !== 'boolean') {
215
+ errors.push('hub.weeklyCup must be true or false.');
216
+ }
158
217
  if (hub.labels !== undefined && hub.labels !== 'near') {
159
218
  errors.push('hub.labels must be "near" (or left out).');
160
219
  }
@@ -174,6 +233,7 @@ export function readManifest(castleJson, sceneExists = () => true) {
174
233
  }
175
234
  }
176
235
  }
236
+ if (hub.act !== undefined && typeof hub.act !== 'boolean') {errors.push('hub.act must be true or false.');}
177
237
  const soundscape = readSoundscape(hub.soundscape, errors);
178
238
  const unlocks = readUnlocks(hub.unlocks, errors);
179
239
  const defaultScene =
@@ -181,6 +241,7 @@ export function readManifest(castleJson, sceneExists = () => true) {
181
241
  const serverMax = Number.isInteger(castleJson?.server?.maxPlayers) ? castleJson.server.maxPlayers : MAX_PLAYERS_CAP;
182
242
  const destinations = Array.isArray(castleJson?.server?.destinations) ? castleJson.server.destinations : [];
183
243
  const bundle = castleJson?.characterBundle ?? null;
244
+ validateChildAsks(bundle, errors);
184
245
 
185
246
  const places = {};
186
247
  places[MAIN_PLACE] = readPlace(hub, 'hub', defaultScene, serverMax, sceneExists, errors, destinations, bundle, hub.interest);
@@ -206,7 +267,14 @@ export function readManifest(castleJson, sceneExists = () => true) {
206
267
  }
207
268
  }
208
269
  }
209
- return errors.length ? { errors, manifest: null } : { errors, manifest: { contract: CONTRACT_VERSION, cues: hub.cues === true, ...(hub.yourGames === true ? { yourGames: true } : {}), ...(hub.avatarColors === true ? { avatarColors: true } : {}), ...(hub.stuck === true ? { stuck: true } : {}), ...(soundscape ? { soundscape } : {}), ...(unlocks ? { unlocks } : {}), ...(house ? { house } : {}), ...(ballot ? { ballot: true } : {}), places } };
270
+ if (hub.act === true) {
271
+ for (const place of Object.values(places)) {
272
+ place.act = true;
273
+ place.grab ??= { ...GRAB_DEFAULTS };
274
+ place.idle = { emotes: false, sounds: [], ...place.idle, seats: true };
275
+ }
276
+ }
277
+ return errors.length ? { errors, manifest: null } : { errors, manifest: { contract: CONTRACT_VERSION, ...(quality ? { quality } : {}), ...(hub.act === true ? { act: true } : {}), cues: hub.cues === true, ...(hub.yourGames === true ? { yourGames: true } : {}), ...(hub.avatarColors === true ? { avatarColors: true } : {}), ...(hub.stuck === true ? { stuck: true } : {}), ...(hub.weeklyCup === true ? { weeklyCup: true } : {}), ...(soundscape ? { soundscape } : {}), ...(unlocks ? { unlocks } : {}), ...(house ? { house } : {}), ...(ballot ? { ballot: true } : {}), places } };
210
278
  }
211
279
 
212
280
  // `hub.soundscape`: its parts where it is on, null where it is left out or
@@ -343,6 +411,12 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
343
411
  }
344
412
 
345
413
  place.lateJoin = block.lateJoin ?? false;
414
+ if (block.push !== undefined) {
415
+ if (!block.push || typeof block.push !== 'object' || Array.isArray(block.push) ||
416
+ Object.keys(block.push).join(',') !== 'version' || block.push.version !== 1) {
417
+ errors.push(`${where}.push must be { version: 1 } or absent.`);
418
+ } else {place.push = { version: 1 };}
419
+ }
346
420
  if (typeof place.lateJoin !== 'boolean') {
347
421
  errors.push(`${where}.lateJoin must be true or false.`);
348
422
  }
@@ -405,6 +479,32 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
405
479
  if (decor) {
406
480
  place.decor = decor;
407
481
  }
482
+ if (Object.hasOwn(block, 'analytics')) {
483
+ if (block.analytics !== true || where !== 'hub') {errors.push(`${where}.analytics is main-place only and must be true or absent.`);}
484
+ else {place.analytics = true;}
485
+ }
486
+ if (Object.hasOwn(block, 'fpsTelemetry')) {
487
+ const fps = block.fpsTelemetry;
488
+ if (where !== 'hub' || block.analytics !== true || !isObject(fps) ||
489
+ Object.keys(fps).some((key) => !['buildSha', 'scene'].includes(key)) ||
490
+ typeof fps.buildSha !== 'string' || !/^[0-9a-f]{40}$/.test(fps.buildSha) || typeof fps.scene !== 'string' || !/^[a-zA-Z0-9_./-]{1,160}$/.test(fps.scene) || fps.scene !== place.scene) {
491
+ errors.push(`${where}.fpsTelemetry requires analytics, a full buildSha and the main scene.`);
492
+ } else {place.fpsTelemetry = { buildSha: fps.buildSha, scene: fps.scene };}
493
+ }
494
+ if (Object.hasOwn(block, 'analyticsRounds')) {
495
+ if (block.analyticsRounds !== 'authored') {errors.push(`${where}.analyticsRounds must be authored or absent.`);}
496
+ else {place.analyticsRounds = 'authored';}
497
+ }
498
+ if (Object.hasOwn(block, 'analyticsV111')) {
499
+ if (block.analyticsV111 !== true || where !== 'hub') {errors.push(`${where}.analyticsV111 is main-place only and must be true or absent.`);}
500
+ else if (block.analytics !== true) {errors.push(`${where}.analyticsV111 requires analytics: true.`);}
501
+ else {place.analyticsV111 = true;}
502
+ }
503
+ if (Object.hasOwn(block, 'loadTelemetry')) {
504
+ if (block.loadTelemetry !== true || where !== 'hub') {errors.push(`${where}.loadTelemetry is main-place only and must be true or absent.`);}
505
+ else if (block.analytics !== true || block.analyticsV111 !== true) {errors.push(`${where}.loadTelemetry requires analytics: true and analyticsV111: true.`);}
506
+ else {place.loadTelemetry = true;}
507
+ }
408
508
  if (Object.hasOwn(block, 'visibility')) {
409
509
  if (block.visibility !== true) {
410
510
  errors.push(`${where}.visibility must be true or absent.`);
@@ -412,6 +512,13 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
412
512
  place.visibility = true;
413
513
  }
414
514
  }
515
+ if (Object.hasOwn(block, 'anonymousEntry')) {
516
+ if (block.anonymousEntry !== true) {
517
+ errors.push(`${where}.anonymousEntry must be true or absent.`);
518
+ } else {
519
+ place.anonymousEntry = true;
520
+ }
521
+ }
415
522
  if (Object.hasOwn(block, 'actions')) {
416
523
  if (block.actions !== true) {
417
524
  errors.push(`${where}.actions must be true or absent.`);
@@ -419,6 +526,10 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
419
526
  place.actions = true;
420
527
  }
421
528
  }
529
+ if (Object.hasOwn(block, 'invite')) {
530
+ if (block.invite !== true) {errors.push(`${where}.invite must be true or absent.`);}
531
+ else {place.invite = true;}
532
+ }
422
533
  if (Object.hasOwn(block, 'companion')) {
423
534
  if (block.companion === true) {
424
535
  place.companion = true;
@@ -467,6 +578,61 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
467
578
  }
468
579
  }
469
580
  }
581
+ // Private visibility is retained only by the bounded 60-second result-place
582
+ // keep mode. It remains server-only and adds no public place or wire field.
583
+ if (Object.hasOwn(block, 'resumeVisibility')) {
584
+ if (block.resumeVisibility !== true) {
585
+ errors.push(`${where}.resumeVisibility must be true or absent.`);
586
+ } else if (place.resumeKeep !== true) {
587
+ errors.push(`${where}.resumeVisibility requires resume: { keep: true }.`);
588
+ } else {
589
+ place.resumeVisibility = true;
590
+ }
591
+ }
592
+ // v1.98: town pose retention never changes result-place resume semantics.
593
+ if (Object.hasOwn(block, 'resumePose')) {
594
+ if (block.resumePose !== true) {
595
+ errors.push(`${where}.resumePose must be true or absent.`);
596
+ } else if (place.result) {
597
+ errors.push(`${where}.resumePose is only for a place without a result.`);
598
+ } else {
599
+ place.resumePose = true;
600
+ }
601
+ }
602
+ // v1.115: owner-house transport opt-in; Ghost alone grants the owner binding.
603
+ if (Object.hasOwn(block, 'houseResume')) {
604
+ if (block.houseResume !== true) {
605
+ errors.push(`${where}.houseResume must be true or absent.`);
606
+ } else if (place.result) {
607
+ errors.push(`${where}.houseResume is only for a place without a result.`);
608
+ } else {
609
+ place.houseResume = true;
610
+ }
611
+ }
612
+ // v1.99: private relationship freshness is per place and server-only.
613
+ if (Object.hasOwn(block, 'freshFriends')) {
614
+ if (block.freshFriends !== true) {
615
+ errors.push(`${where}.freshFriends must be true or absent.`);
616
+ } else {
617
+ place.freshFriends = true;
618
+ }
619
+ }
620
+ // v1.101: the trusted age stamp only changes opted-in NPC conversations.
621
+ if (Object.hasOwn(block, 'talkLog')) {
622
+ if (block.talkLog !== true) {
623
+ errors.push(`${where}.talkLog must be true or absent.`);
624
+ } else {
625
+ place.talkLog = true;
626
+ }
627
+ }
628
+
629
+ if (Object.hasOwn(block, 'under13Choices')) {
630
+ if (block.under13Choices !== true) {
631
+ errors.push(`${where}.under13Choices must be true or absent.`);
632
+ } else {
633
+ place.under13Choices = true;
634
+ }
635
+ }
470
636
  if (Object.hasOwn(block, 'ask')) {
471
637
  if (block.ask !== true) {
472
638
  errors.push(`${where}.ask must be true or absent.`);
@@ -488,6 +654,18 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
488
654
  place.ballot = ballot;
489
655
  }
490
656
  }
657
+ // v1.117: keep only pose; ordinary leave/arrive own the visit lifecycle.
658
+ if (Object.hasOwn(block, 'resumeArrivalPose')) {
659
+ if (block.resumeArrivalPose !== true) {
660
+ errors.push(`${where}.resumeArrivalPose must be true or absent.`);
661
+ } else if (place.resumeKeep || place.resumePose || place.houseResume) {
662
+ errors.push(`${where}.resumeArrivalPose cannot combine with retained-visit modes.`);
663
+ } else if (place.result && place.resume !== true) {
664
+ errors.push(`${where}.resumeArrivalPose requires resume: true on a result place.`);
665
+ } else {
666
+ place.resumeArrivalPose = true;
667
+ }
668
+ }
491
669
  return place;
492
670
  }
493
671
 
@@ -684,6 +862,29 @@ export function readNpcTurnsAtOnce(value, fallback = 1, where = 'HubNpc.turnsAtO
684
862
  return value;
685
863
  }
686
864
 
865
+ // v1.142: optional published chips; ghost remains the publish authority.
866
+ function validateChildAsks(bundle, errors) {
867
+ for (const [index, character] of (Array.isArray(bundle?.characters) ? bundle.characters : []).entries()) {
868
+ if (character?.childAsks === undefined) {continue;}
869
+ const where = `characterBundle.characters[${index}].childAsks`;
870
+ const asks = character.childAsks;
871
+ if (!Array.isArray(asks) || asks.length < 3 || asks.length > 4) {
872
+ errors.push(`${where} must have 3-4 choices.`);
873
+ continue;
874
+ }
875
+ const ids = new Set();
876
+ for (const ask of asks) {
877
+ if (!isObject(ask) || typeof ask.id !== 'string' || !ask.id.trim() || ids.has(ask.id)
878
+ || typeof ask.label !== 'string' || !ask.label.trim() || ask.label.length > 40
879
+ || typeof ask.prompt !== 'string' || !ask.prompt.trim() || ask.prompt.length > 300) {
880
+ errors.push(`${where} needs unique non-empty ids, labels of 1-40 characters and prompts of 1-300 characters.`);
881
+ break;
882
+ }
883
+ ids.add(ask.id);
884
+ }
885
+ }
886
+ }
887
+
687
888
  // Where a place's NPC minds live (§13): the place itself (every layer talks
688
889
  // to ghost's one place mind), optionally a destination route whose world an
689
890
  // older SDK joins instead, and how much conversation each character takes.
@@ -916,11 +1117,16 @@ export function checkResult(place, value) {
916
1117
  // draws from, and nothing it does not need.
917
1118
  export function publicPlace(id, place) {
918
1119
  return {
1120
+ ...(place.push?.version === 1 ? { push: { version: 1 } } : {}),
919
1121
  contract: CONTRACT_VERSION,
920
1122
  id,
1123
+ ...(place.act === true ? { act: true } : {}),
921
1124
  title: place.title,
922
1125
  scene: place.scene,
923
1126
  controller: place.controller,
1127
+ ...(place.fpsTelemetry ? { fpsTelemetry: { ...place.fpsTelemetry } } : {}),
1128
+ // v1.138: only an opted-in town tells its browsers to report load stages.
1129
+ ...(place.loadTelemetry === true ? { loadTelemetry: true } : {}),
924
1130
  ...(place.interest ? { interest: place.interest, nearestPlayers: place.nearestPlayers } : {}),
925
1131
  maxDurationSec: place.maxDurationSec,
926
1132
  // v1.3: the hub chrome offers Grab only where this is set; a place
@@ -933,6 +1139,8 @@ export function publicPlace(id, place) {
933
1139
  ...(place.decor ? { decor: place.decor } : {}),
934
1140
  ...(place.visibility === true ? { visibility: true } : {}),
935
1141
  ...(place.actions === true ? { actions: true } : {}),
1142
+ ...(place.anonymousEntry === true ? { anonymousEntry: true } : {}),
1143
+ ...(place.invite === true ? { invite: true } : {}),
936
1144
  ...(place.companion === true ? { companion: true } : {}),
937
1145
  ...(place.companionChat ? { companionChat: { name: place.companionChat.name } } : {}),
938
1146
  ...(place.resume === true ? { resume: true } : {}),