@escapeaihq/client-core 0.49.1 → 0.138.0
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/README.md +445 -153
- package/dist/adapters/capabilities.d.ts +20 -3
- package/dist/adapters/capabilities.d.ts.map +1 -1
- package/dist/adapters/directorAdapter.d.ts +5 -4
- package/dist/adapters/directorAdapter.d.ts.map +1 -1
- package/dist/adapters/directorAdapter.js +5 -4
- package/dist/adapters/directorAdapter.js.map +1 -1
- package/dist/adapters/experienceModelCatalog.d.ts +382 -0
- package/dist/adapters/experienceModelCatalog.d.ts.map +1 -0
- package/dist/adapters/experienceModelCatalog.js +401 -0
- package/dist/adapters/experienceModelCatalog.js.map +1 -0
- package/dist/adapters/extractionAdapter.d.ts +81 -0
- package/dist/adapters/extractionAdapter.d.ts.map +1 -0
- package/dist/adapters/extractionAdapter.js +98 -0
- package/dist/adapters/extractionAdapter.js.map +1 -0
- package/dist/adapters/imageAdapter.d.ts +5 -1
- package/dist/adapters/imageAdapter.d.ts.map +1 -1
- package/dist/adapters/imageAdapter.js +5 -1
- package/dist/adapters/imageAdapter.js.map +1 -1
- package/dist/adapters/index.d.ts +54 -16
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +62 -11
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/momentDirective.d.ts +66 -0
- package/dist/adapters/momentDirective.d.ts.map +1 -0
- package/dist/adapters/momentDirective.js +78 -0
- package/dist/adapters/momentDirective.js.map +1 -0
- package/dist/adapters/momentPolicy.d.ts +132 -0
- package/dist/adapters/momentPolicy.d.ts.map +1 -0
- package/dist/adapters/momentPolicy.js +165 -0
- package/dist/adapters/momentPolicy.js.map +1 -0
- package/dist/adapters/registry.d.ts +1 -1
- package/dist/adapters/registry.d.ts.map +1 -1
- package/dist/adapters/videoGenAdapter.d.ts +55 -0
- package/dist/adapters/videoGenAdapter.d.ts.map +1 -0
- package/dist/adapters/videoGenAdapter.js +78 -0
- package/dist/adapters/videoGenAdapter.js.map +1 -0
- package/dist/adapters/worldAdapter.d.ts +132 -11
- package/dist/adapters/worldAdapter.d.ts.map +1 -1
- package/dist/adapters/worldAdapter.js +127 -11
- package/dist/adapters/worldAdapter.js.map +1 -1
- package/dist/adapters/worldModelPreference.d.ts +173 -0
- package/dist/adapters/worldModelPreference.d.ts.map +1 -0
- package/dist/adapters/worldModelPreference.js +209 -0
- package/dist/adapters/worldModelPreference.js.map +1 -0
- package/dist/adapters/worldModelTradeoffs.d.ts +120 -0
- package/dist/adapters/worldModelTradeoffs.d.ts.map +1 -0
- package/dist/adapters/worldModelTradeoffs.js +154 -0
- package/dist/adapters/worldModelTradeoffs.js.map +1 -0
- package/dist/admin.d.ts +545 -0
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js +230 -16
- package/dist/admin.js.map +1 -1
- package/dist/api.d.ts +10281 -2216
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +4174 -1240
- package/dist/api.js.map +1 -1
- package/dist/arcBoardJoin.d.ts +38 -0
- package/dist/arcBoardJoin.d.ts.map +1 -0
- package/dist/arcBoardJoin.js +37 -0
- package/dist/arcBoardJoin.js.map +1 -0
- package/dist/arcPreview.d.ts +49 -0
- package/dist/arcPreview.d.ts.map +1 -0
- package/dist/arcPreview.js +65 -0
- package/dist/arcPreview.js.map +1 -0
- package/dist/audio.d.ts +259 -16
- package/dist/audio.d.ts.map +1 -1
- package/dist/audio.js +605 -114
- package/dist/audio.js.map +1 -1
- package/dist/audioDsp.d.ts +45 -0
- package/dist/audioDsp.d.ts.map +1 -0
- package/dist/audioDsp.js +108 -0
- package/dist/audioDsp.js.map +1 -0
- package/dist/audioProtocol.d.ts +160 -0
- package/dist/audioProtocol.d.ts.map +1 -1
- package/dist/audioProtocol.js +99 -0
- package/dist/audioProtocol.js.map +1 -1
- package/dist/beatTitles.d.ts +33 -0
- package/dist/beatTitles.d.ts.map +1 -0
- package/dist/beatTitles.js +39 -0
- package/dist/beatTitles.js.map +1 -0
- package/dist/castProjection.d.ts +204 -1
- package/dist/castProjection.d.ts.map +1 -1
- package/dist/castProjection.js +202 -0
- package/dist/castProjection.js.map +1 -1
- package/dist/characterGrounding.d.ts +369 -0
- package/dist/characterGrounding.d.ts.map +1 -0
- package/dist/characterGrounding.js +408 -0
- package/dist/characterGrounding.js.map +1 -0
- package/dist/conversation/binding.d.ts +41 -1
- package/dist/conversation/binding.d.ts.map +1 -1
- package/dist/conversation/binding.js +12 -0
- package/dist/conversation/binding.js.map +1 -1
- package/dist/conversation/chatSessionStore.d.ts +178 -0
- package/dist/conversation/chatSessionStore.d.ts.map +1 -0
- package/dist/conversation/chatSessionStore.js +196 -0
- package/dist/conversation/chatSessionStore.js.map +1 -0
- package/dist/conversation/controller.d.ts +60 -0
- package/dist/conversation/controller.d.ts.map +1 -1
- package/dist/conversation/controller.js +104 -3
- package/dist/conversation/controller.js.map +1 -1
- package/dist/conversation/index.d.ts +2 -0
- package/dist/conversation/index.d.ts.map +1 -1
- package/dist/conversation/index.js +2 -0
- package/dist/conversation/index.js.map +1 -1
- package/dist/conversation/participant.d.ts +16 -0
- package/dist/conversation/participant.d.ts.map +1 -1
- package/dist/conversation/readSequencer.d.ts +38 -0
- package/dist/conversation/readSequencer.d.ts.map +1 -0
- package/dist/conversation/readSequencer.js +42 -0
- package/dist/conversation/readSequencer.js.map +1 -0
- package/dist/conversation/roster.d.ts +5 -1
- package/dist/conversation/roster.d.ts.map +1 -1
- package/dist/conversation/roster.js.map +1 -1
- package/dist/conversation/rosterProjection.d.ts +74 -1
- package/dist/conversation/rosterProjection.d.ts.map +1 -1
- package/dist/conversation/rosterProjection.js +135 -1
- package/dist/conversation/rosterProjection.js.map +1 -1
- package/dist/conversation/runtime.d.ts +20 -3
- package/dist/conversation/runtime.d.ts.map +1 -1
- package/dist/conversation/runtime.js +66 -7
- package/dist/conversation/runtime.js.map +1 -1
- package/dist/conversation/types.d.ts +43 -4
- package/dist/conversation/types.d.ts.map +1 -1
- package/dist/conversation/voice.d.ts +290 -13
- package/dist/conversation/voice.d.ts.map +1 -1
- package/dist/conversation/voice.js +565 -42
- package/dist/conversation/voice.js.map +1 -1
- package/dist/creatorCuration.d.ts +134 -0
- package/dist/creatorCuration.d.ts.map +1 -0
- package/dist/creatorCuration.js +228 -0
- package/dist/creatorCuration.js.map +1 -0
- package/dist/creatorDashboard.d.ts +155 -0
- package/dist/creatorDashboard.d.ts.map +1 -0
- package/dist/creatorDashboard.js +237 -0
- package/dist/creatorDashboard.js.map +1 -0
- package/dist/creatorUniverse.d.ts +95 -0
- package/dist/creatorUniverse.d.ts.map +1 -0
- package/dist/creatorUniverse.js +136 -0
- package/dist/creatorUniverse.js.map +1 -0
- package/dist/curationWrite.d.ts +76 -0
- package/dist/curationWrite.d.ts.map +1 -0
- package/dist/curationWrite.js +106 -0
- package/dist/curationWrite.js.map +1 -0
- package/dist/designTokens.d.ts +64 -0
- package/dist/designTokens.d.ts.map +1 -0
- package/dist/designTokens.js +117 -0
- package/dist/designTokens.js.map +1 -0
- package/dist/dialogAttribution.d.ts +79 -0
- package/dist/dialogAttribution.d.ts.map +1 -0
- package/dist/dialogAttribution.js +144 -0
- package/dist/dialogAttribution.js.map +1 -0
- package/dist/dmRunWorldReadiness.d.ts +605 -0
- package/dist/dmRunWorldReadiness.d.ts.map +1 -0
- package/dist/dmRunWorldReadiness.js +775 -0
- package/dist/dmRunWorldReadiness.js.map +1 -0
- package/dist/domains/access.d.ts +32 -0
- package/dist/domains/access.d.ts.map +1 -0
- package/dist/domains/access.js +43 -0
- package/dist/domains/access.js.map +1 -0
- package/dist/domains/adventureDefinitions.d.ts +159 -0
- package/dist/domains/adventureDefinitions.d.ts.map +1 -0
- package/dist/domains/adventureDefinitions.js +168 -0
- package/dist/domains/adventureDefinitions.js.map +1 -0
- package/dist/domains/adventures.d.ts +329 -0
- package/dist/domains/adventures.d.ts.map +1 -0
- package/dist/domains/adventures.js +359 -0
- package/dist/domains/adventures.js.map +1 -0
- package/dist/domains/arcs.d.ts +146 -0
- package/dist/domains/arcs.d.ts.map +1 -0
- package/dist/domains/arcs.js +202 -0
- package/dist/domains/arcs.js.map +1 -0
- package/dist/domains/artifacts.d.ts +259 -0
- package/dist/domains/artifacts.d.ts.map +1 -0
- package/dist/domains/artifacts.js +125 -0
- package/dist/domains/artifacts.js.map +1 -0
- package/dist/domains/chat.d.ts +158 -0
- package/dist/domains/chat.d.ts.map +1 -0
- package/dist/domains/chat.js +224 -0
- package/dist/domains/chat.js.map +1 -0
- package/dist/domains/decisions.d.ts +31 -0
- package/dist/domains/decisions.d.ts.map +1 -0
- package/dist/domains/decisions.js +42 -0
- package/dist/domains/decisions.js.map +1 -0
- package/dist/domains/documents.d.ts +218 -0
- package/dist/domains/documents.d.ts.map +1 -0
- package/dist/domains/documents.js +252 -0
- package/dist/domains/documents.js.map +1 -0
- package/dist/domains/enhancements.d.ts +106 -0
- package/dist/domains/enhancements.d.ts.map +1 -0
- package/dist/domains/enhancements.js +160 -0
- package/dist/domains/enhancements.js.map +1 -0
- package/dist/domains/graph.d.ts +454 -0
- package/dist/domains/graph.d.ts.map +1 -0
- package/dist/domains/graph.js +648 -0
- package/dist/domains/graph.js.map +1 -0
- package/dist/domains/images.d.ts +220 -0
- package/dist/domains/images.d.ts.map +1 -0
- package/dist/domains/images.js +307 -0
- package/dist/domains/images.js.map +1 -0
- package/dist/domains/ingestion.d.ts +312 -0
- package/dist/domains/ingestion.d.ts.map +1 -0
- package/dist/domains/ingestion.js +495 -0
- package/dist/domains/ingestion.js.map +1 -0
- package/dist/domains/me.d.ts +21 -0
- package/dist/domains/me.d.ts.map +1 -0
- package/dist/domains/me.js +23 -0
- package/dist/domains/me.js.map +1 -0
- package/dist/domains/orgs.d.ts +47 -0
- package/dist/domains/orgs.d.ts.map +1 -0
- package/dist/domains/orgs.js +75 -0
- package/dist/domains/orgs.js.map +1 -0
- package/dist/domains/personas.d.ts +135 -0
- package/dist/domains/personas.d.ts.map +1 -0
- package/dist/domains/personas.js +316 -0
- package/dist/domains/personas.js.map +1 -0
- package/dist/domains/projects.d.ts +53 -0
- package/dist/domains/projects.d.ts.map +1 -0
- package/dist/domains/projects.js +94 -0
- package/dist/domains/projects.js.map +1 -0
- package/dist/domains/quests.d.ts +431 -0
- package/dist/domains/quests.d.ts.map +1 -0
- package/dist/domains/quests.js +61 -0
- package/dist/domains/quests.js.map +1 -0
- package/dist/domains/reactor.d.ts +98 -0
- package/dist/domains/reactor.d.ts.map +1 -0
- package/dist/domains/reactor.js +131 -0
- package/dist/domains/reactor.js.map +1 -0
- package/dist/domains/showcase.d.ts +28 -0
- package/dist/domains/showcase.d.ts.map +1 -0
- package/dist/domains/showcase.js +28 -0
- package/dist/domains/showcase.js.map +1 -0
- package/dist/domains/storyboards.d.ts +1253 -0
- package/dist/domains/storyboards.d.ts.map +1 -0
- package/dist/domains/storyboards.js +781 -0
- package/dist/domains/storyboards.js.map +1 -0
- package/dist/domains/studioSettings.d.ts +39 -0
- package/dist/domains/studioSettings.d.ts.map +1 -0
- package/dist/domains/studioSettings.js +80 -0
- package/dist/domains/studioSettings.js.map +1 -0
- package/dist/domains/universes.d.ts +191 -0
- package/dist/domains/universes.d.ts.map +1 -0
- package/dist/domains/universes.js +276 -0
- package/dist/domains/universes.js.map +1 -0
- package/dist/domains/userDefaults.d.ts +18 -0
- package/dist/domains/userDefaults.d.ts.map +1 -0
- package/dist/domains/userDefaults.js +27 -0
- package/dist/domains/userDefaults.js.map +1 -0
- package/dist/domains/visemeBundles.d.ts +262 -0
- package/dist/domains/visemeBundles.d.ts.map +1 -0
- package/dist/domains/visemeBundles.js +373 -0
- package/dist/domains/visemeBundles.js.map +1 -0
- package/dist/domains/workflows.d.ts +142 -0
- package/dist/domains/workflows.d.ts.map +1 -0
- package/dist/domains/workflows.js +245 -0
- package/dist/domains/workflows.js.map +1 -0
- package/dist/enhancementDiff.d.ts +56 -0
- package/dist/enhancementDiff.d.ts.map +1 -0
- package/dist/enhancementDiff.js +110 -0
- package/dist/enhancementDiff.js.map +1 -0
- package/dist/generated/contract.d.ts +372 -0
- package/dist/generated/contract.d.ts.map +1 -0
- package/dist/generated/contract.js +390 -0
- package/dist/generated/contract.js.map +1 -0
- package/dist/graphSchema.d.ts +36 -5
- package/dist/graphSchema.d.ts.map +1 -1
- package/dist/graphSchema.js +88 -2
- package/dist/graphSchema.js.map +1 -1
- package/dist/http.d.ts +70 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +263 -11
- package/dist/http.js.map +1 -1
- package/dist/identity.d.ts +81 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +65 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +118 -0
- package/dist/index.js.map +1 -1
- package/dist/messageContent.d.ts +174 -0
- package/dist/messageContent.d.ts.map +1 -0
- package/dist/messageContent.js +405 -0
- package/dist/messageContent.js.map +1 -0
- package/dist/mutationEpoch.d.ts +83 -0
- package/dist/mutationEpoch.d.ts.map +1 -0
- package/dist/mutationEpoch.js +109 -0
- package/dist/mutationEpoch.js.map +1 -0
- package/dist/obo.d.ts +144 -0
- package/dist/obo.d.ts.map +1 -0
- package/dist/obo.js +135 -0
- package/dist/obo.js.map +1 -0
- package/dist/opusTransport.d.ts +113 -0
- package/dist/opusTransport.d.ts.map +1 -0
- package/dist/opusTransport.js +170 -0
- package/dist/opusTransport.js.map +1 -0
- package/dist/pagination.d.ts +18 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +26 -0
- package/dist/pagination.js.map +1 -0
- package/dist/platformAssistant.d.ts +55 -1
- package/dist/platformAssistant.d.ts.map +1 -1
- package/dist/platformAssistant.js +39 -1
- package/dist/platformAssistant.js.map +1 -1
- package/dist/pollUtils.d.ts +19 -0
- package/dist/pollUtils.d.ts.map +1 -0
- package/dist/pollUtils.js +35 -0
- package/dist/pollUtils.js.map +1 -0
- package/dist/questLog.d.ts +232 -0
- package/dist/questLog.d.ts.map +1 -0
- package/dist/questLog.js +522 -0
- package/dist/questLog.js.map +1 -0
- package/dist/reactor/dmDirectiveToExperience.d.ts +300 -0
- package/dist/reactor/dmDirectiveToExperience.d.ts.map +1 -0
- package/dist/reactor/dmDirectiveToExperience.js +401 -0
- package/dist/reactor/dmDirectiveToExperience.js.map +1 -0
- package/dist/reactor/dmSceneControlPrompt.d.ts +40 -0
- package/dist/reactor/dmSceneControlPrompt.d.ts.map +1 -0
- package/dist/reactor/dmSceneControlPrompt.js +145 -0
- package/dist/reactor/dmSceneControlPrompt.js.map +1 -0
- package/dist/reactor/dmWorldEntry.d.ts +1278 -0
- package/dist/reactor/dmWorldEntry.d.ts.map +1 -0
- package/dist/reactor/dmWorldEntry.js +1396 -0
- package/dist/reactor/dmWorldEntry.js.map +1 -0
- package/dist/reactor/framePromptCompaction.d.ts +223 -0
- package/dist/reactor/framePromptCompaction.d.ts.map +1 -0
- package/dist/reactor/framePromptCompaction.js +393 -0
- package/dist/reactor/framePromptCompaction.js.map +1 -0
- package/dist/reactor/frameWorldBind.d.ts +86 -0
- package/dist/reactor/frameWorldBind.d.ts.map +1 -0
- package/dist/reactor/frameWorldBind.js +79 -0
- package/dist/reactor/frameWorldBind.js.map +1 -0
- package/dist/reactor/happyOysterSeed.d.ts +166 -0
- package/dist/reactor/happyOysterSeed.d.ts.map +1 -0
- package/dist/reactor/happyOysterSeed.js +233 -0
- package/dist/reactor/happyOysterSeed.js.map +1 -0
- package/dist/reactor/happyOysterWalk.d.ts +274 -0
- package/dist/reactor/happyOysterWalk.d.ts.map +1 -0
- package/dist/reactor/happyOysterWalk.js +407 -0
- package/dist/reactor/happyOysterWalk.js.map +1 -0
- package/dist/reactor/happyOysterWorld.d.ts +718 -0
- package/dist/reactor/happyOysterWorld.d.ts.map +1 -0
- package/dist/reactor/happyOysterWorld.js +826 -0
- package/dist/reactor/happyOysterWorld.js.map +1 -0
- package/dist/reactor/heliosCommandDispatcher.d.ts.map +1 -1
- package/dist/reactor/heliosCommandDispatcher.js +5 -2
- package/dist/reactor/heliosCommandDispatcher.js.map +1 -1
- package/dist/reactor/hiddenWorldLifecycle.d.ts +101 -0
- package/dist/reactor/hiddenWorldLifecycle.d.ts.map +1 -0
- package/dist/reactor/hiddenWorldLifecycle.js +119 -0
- package/dist/reactor/hiddenWorldLifecycle.js.map +1 -0
- package/dist/reactor/imageCanvas.d.ts +15 -0
- package/dist/reactor/imageCanvas.d.ts.map +1 -0
- package/dist/reactor/imageCanvas.js +33 -0
- package/dist/reactor/imageCanvas.js.map +1 -0
- package/dist/reactor/index.d.ts +20 -0
- package/dist/reactor/index.d.ts.map +1 -1
- package/dist/reactor/index.js +81 -0
- package/dist/reactor/index.js.map +1 -1
- package/dist/reactor/longLiveCommandDispatcher.d.ts +23 -8
- package/dist/reactor/longLiveCommandDispatcher.d.ts.map +1 -1
- package/dist/reactor/longLiveCommandDispatcher.js +16 -4
- package/dist/reactor/longLiveCommandDispatcher.js.map +1 -1
- package/dist/reactor/longLiveSceneEntry.d.ts +203 -0
- package/dist/reactor/longLiveSceneEntry.d.ts.map +1 -0
- package/dist/reactor/longLiveSceneEntry.js +280 -0
- package/dist/reactor/longLiveSceneEntry.js.map +1 -0
- package/dist/reactor/momentCut.d.ts +153 -0
- package/dist/reactor/momentCut.d.ts.map +1 -0
- package/dist/reactor/momentCut.js +142 -0
- package/dist/reactor/momentCut.js.map +1 -0
- package/dist/reactor/promptAddonRegistry.d.ts +39 -3
- package/dist/reactor/promptAddonRegistry.d.ts.map +1 -1
- package/dist/reactor/promptAddonRegistry.js +44 -5
- package/dist/reactor/promptAddonRegistry.js.map +1 -1
- package/dist/reactor/promptTemplatePreview.d.ts +97 -0
- package/dist/reactor/promptTemplatePreview.d.ts.map +1 -0
- package/dist/reactor/promptTemplatePreview.js +185 -0
- package/dist/reactor/promptTemplatePreview.js.map +1 -0
- package/dist/reactor/reactorAvailability.d.ts +80 -0
- package/dist/reactor/reactorAvailability.d.ts.map +1 -0
- package/dist/reactor/reactorAvailability.js +121 -0
- package/dist/reactor/reactorAvailability.js.map +1 -0
- package/dist/reactor/reactorSessionRefusal.d.ts +125 -0
- package/dist/reactor/reactorSessionRefusal.d.ts.map +1 -0
- package/dist/reactor/reactorSessionRefusal.js +197 -0
- package/dist/reactor/reactorSessionRefusal.js.map +1 -0
- package/dist/reactor/reactorTokenScope.d.ts +47 -0
- package/dist/reactor/reactorTokenScope.d.ts.map +1 -0
- package/dist/reactor/reactorTokenScope.js +64 -0
- package/dist/reactor/reactorTokenScope.js.map +1 -0
- package/dist/reactor/resolveDirectorBeats.d.ts +65 -0
- package/dist/reactor/resolveDirectorBeats.d.ts.map +1 -0
- package/dist/reactor/resolveDirectorBeats.js +86 -0
- package/dist/reactor/resolveDirectorBeats.js.map +1 -0
- package/dist/reactor/sanaLiveEdit.d.ts +117 -0
- package/dist/reactor/sanaLiveEdit.d.ts.map +1 -0
- package/dist/reactor/sanaLiveEdit.js +105 -0
- package/dist/reactor/sanaLiveEdit.js.map +1 -0
- package/dist/reactor/sceneEntry.d.ts +66 -9
- package/dist/reactor/sceneEntry.d.ts.map +1 -1
- package/dist/reactor/sceneEntry.js +59 -66
- package/dist/reactor/sceneEntry.js.map +1 -1
- package/dist/reactor/sceneSeedImage.d.ts +199 -0
- package/dist/reactor/sceneSeedImage.d.ts.map +1 -0
- package/dist/reactor/sceneSeedImage.js +239 -0
- package/dist/reactor/sceneSeedImage.js.map +1 -0
- package/dist/reactor/seedImageOrchestrator.d.ts +70 -3
- package/dist/reactor/seedImageOrchestrator.d.ts.map +1 -1
- package/dist/reactor/seedImageOrchestrator.js +92 -28
- package/dist/reactor/seedImageOrchestrator.js.map +1 -1
- package/dist/reactor/toolPromptAddon.d.ts +37 -28
- package/dist/reactor/toolPromptAddon.d.ts.map +1 -1
- package/dist/reactor/toolPromptAddon.js +63 -101
- package/dist/reactor/toolPromptAddon.js.map +1 -1
- package/dist/reactor/worldMintLoop.d.ts +286 -0
- package/dist/reactor/worldMintLoop.d.ts.map +1 -0
- package/dist/reactor/worldMintLoop.js +381 -0
- package/dist/reactor/worldMintLoop.js.map +1 -0
- package/dist/reactor/worldSteerOutcome.d.ts +98 -0
- package/dist/reactor/worldSteerOutcome.d.ts.map +1 -0
- package/dist/reactor/worldSteerOutcome.js +81 -0
- package/dist/reactor/worldSteerOutcome.js.map +1 -0
- package/dist/retryAfter.d.ts +15 -0
- package/dist/retryAfter.d.ts.map +1 -0
- package/dist/retryAfter.js +75 -0
- package/dist/retryAfter.js.map +1 -0
- package/dist/seriesKey.d.ts +31 -0
- package/dist/seriesKey.d.ts.map +1 -0
- package/dist/seriesKey.js +33 -0
- package/dist/seriesKey.js.map +1 -0
- package/dist/sessionRefresh.d.ts +135 -0
- package/dist/sessionRefresh.d.ts.map +1 -0
- package/dist/sessionRefresh.js +215 -0
- package/dist/sessionRefresh.js.map +1 -0
- package/dist/sharedAudioContext.d.ts +39 -0
- package/dist/sharedAudioContext.d.ts.map +1 -0
- package/dist/sharedAudioContext.js +63 -0
- package/dist/sharedAudioContext.js.map +1 -0
- package/dist/singleFlight.d.ts +51 -0
- package/dist/singleFlight.d.ts.map +1 -0
- package/dist/singleFlight.js +87 -0
- package/dist/singleFlight.js.map +1 -0
- package/dist/storyGraph.d.ts +83 -0
- package/dist/storyGraph.d.ts.map +1 -1
- package/dist/storyGraph.js +169 -4
- package/dist/storyGraph.js.map +1 -1
- package/dist/storyboardMask.d.ts +343 -0
- package/dist/storyboardMask.d.ts.map +1 -0
- package/dist/storyboardMask.js +505 -0
- package/dist/storyboardMask.js.map +1 -0
- package/dist/storyboardTimeline.d.ts +93 -0
- package/dist/storyboardTimeline.d.ts.map +1 -0
- package/dist/storyboardTimeline.js +131 -0
- package/dist/storyboardTimeline.js.map +1 -0
- package/dist/studioAutomation.d.ts +104 -0
- package/dist/studioAutomation.d.ts.map +1 -0
- package/dist/studioAutomation.js +178 -0
- package/dist/studioAutomation.js.map +1 -0
- package/dist/tenantClaim.d.ts +86 -0
- package/dist/tenantClaim.d.ts.map +1 -0
- package/dist/tenantClaim.js +164 -0
- package/dist/tenantClaim.js.map +1 -0
- package/dist/timeFormat.d.ts +25 -0
- package/dist/timeFormat.d.ts.map +1 -1
- package/dist/timeFormat.js +56 -0
- package/dist/timeFormat.js.map +1 -1
- package/dist/toolSchemas.d.ts +53 -10
- package/dist/toolSchemas.d.ts.map +1 -1
- package/dist/toolSchemas.js +36 -9
- package/dist/toolSchemas.js.map +1 -1
- package/dist/transport.d.ts +120 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +282 -0
- package/dist/transport.js.map +1 -0
- package/dist/videoGenFacade.d.ts +63 -0
- package/dist/videoGenFacade.d.ts.map +1 -0
- package/dist/videoGenFacade.js +49 -0
- package/dist/videoGenFacade.js.map +1 -0
- package/dist/visemeScheduler.d.ts +24 -2
- package/dist/visemeScheduler.d.ts.map +1 -1
- package/dist/visemeScheduler.js +31 -2
- package/dist/visemeScheduler.js.map +1 -1
- package/dist/vision/VisionPublisher.d.ts +88 -0
- package/dist/vision/VisionPublisher.d.ts.map +1 -1
- package/dist/vision/VisionPublisher.js +196 -13
- package/dist/vision/VisionPublisher.js.map +1 -1
- package/dist/vision/VisionSourceController.d.ts +67 -1
- package/dist/vision/VisionSourceController.d.ts.map +1 -1
- package/dist/vision/VisionSourceController.js +147 -5
- package/dist/vision/VisionSourceController.js.map +1 -1
- package/dist/vision/index.d.ts +2 -1
- package/dist/vision/index.d.ts.map +1 -1
- package/dist/vision/index.js +2 -1
- package/dist/vision/index.js.map +1 -1
- package/dist/vision/sourceKinds.d.ts +18 -5
- package/dist/vision/sourceKinds.d.ts.map +1 -1
- package/dist/vision/sourceKinds.js +15 -2
- package/dist/vision/sourceKinds.js.map +1 -1
- package/dist/vision/types.d.ts +7 -4
- package/dist/vision/types.d.ts.map +1 -1
- package/dist/vision/visionErrors.d.ts +45 -0
- package/dist/vision/visionErrors.d.ts.map +1 -0
- package/dist/vision/visionErrors.js +66 -0
- package/dist/vision/visionErrors.js.map +1 -0
- package/dist/voiceCloneCaption.d.ts +33 -0
- package/dist/voiceCloneCaption.d.ts.map +1 -0
- package/dist/voiceCloneCaption.js +69 -0
- package/dist/voiceCloneCaption.js.map +1 -0
- package/dist/websocket.d.ts +390 -10
- package/dist/websocket.d.ts.map +1 -1
- package/dist/websocket.js +152 -0
- package/dist/websocket.js.map +1 -1
- package/dist/workflowAuthoring.d.ts +139 -0
- package/dist/workflowAuthoring.d.ts.map +1 -0
- package/dist/workflowAuthoring.js +557 -0
- package/dist/workflowAuthoring.js.map +1 -0
- package/package.json +15 -5
- package/src/__tests__/adapters-director.test.ts +9 -6
- package/src/__tests__/adapters-extraction.test.ts +175 -0
- package/src/__tests__/adapters-image.test.ts +66 -0
- package/src/__tests__/adapters-momentPolicy.test.ts +218 -0
- package/src/__tests__/adapters-platform.test.ts +110 -4
- package/src/__tests__/adapters-videogen.test.ts +53 -0
- package/src/__tests__/adapters-world.test.ts +117 -7
- package/src/__tests__/admin.enhancement-defaults.test.ts +115 -0
- package/src/__tests__/admin.test.ts +282 -0
- package/src/__tests__/adventures-world-state.test.ts +156 -0
- package/src/__tests__/adventures.test.ts +111 -1
- package/src/__tests__/api-pollers.test.ts +113 -23
- package/src/__tests__/api.adventure-definitions.test.ts +312 -0
- package/src/__tests__/api.anchor-beat.test.ts +75 -0
- package/src/__tests__/api.arc-approval.test.ts +171 -0
- package/src/__tests__/api.arc-beats-floor.test.ts +56 -0
- package/src/__tests__/api.arc-generation.test.ts +168 -0
- package/src/__tests__/api.arc-templates.test.ts +78 -0
- package/src/__tests__/api.assignVideoSeries.test.ts +81 -0
- package/src/__tests__/api.cast-frame-choices.test.ts +141 -0
- package/src/__tests__/api.cutscene-registry.test.ts +148 -0
- package/src/__tests__/api.enhancement-addition-actions.test.ts +137 -0
- package/src/__tests__/api.enrichVideo-serialization.test.ts +116 -0
- package/src/__tests__/api.extraction-base.test.ts +87 -0
- package/src/__tests__/api.generateVideo-cutscene.test.ts +148 -0
- package/src/__tests__/api.job-pipeline-stages.test.ts +128 -0
- package/src/__tests__/api.list-images-filters.test.ts +6 -3
- package/src/__tests__/api.quest-curation.test.ts +169 -0
- package/src/__tests__/api.reprocessVideo.test.ts +71 -0
- package/src/__tests__/api.scene-split-merge.test.ts +129 -0
- package/src/__tests__/api.session-quests.test.ts +184 -0
- package/src/__tests__/api.test.ts +122 -0
- package/src/__tests__/api.transferSeries.test.ts +114 -0
- package/src/__tests__/api.unknown-clusters.test.ts +225 -0
- package/src/__tests__/api.uploadVideo-options.test.ts +156 -0
- package/src/__tests__/arcPreview.test.ts +71 -0
- package/src/__tests__/arcStyleProfile.test.ts +204 -0
- package/src/__tests__/artifacts-delete.test.ts +109 -0
- package/src/__tests__/audio.test.ts +864 -5
- package/src/__tests__/audioDsp.test.ts +196 -0
- package/src/__tests__/audioUnavailable.test.ts +43 -0
- package/src/__tests__/cast.test.ts +10 -1
- package/src/__tests__/castCurationProjection.test.ts +84 -0
- package/src/__tests__/castFramePipelinePending.test.ts +171 -0
- package/src/__tests__/castProjection.test.ts +497 -5
- package/src/__tests__/characterGrounding.test.ts +357 -0
- package/src/__tests__/contract.test.ts +97 -0
- package/src/__tests__/conversation/binding.test.ts +53 -0
- package/src/__tests__/conversation/chatSessionStore.test.ts +243 -0
- package/src/__tests__/conversation/controller.test.ts +328 -0
- package/src/__tests__/conversation/readSequencer.test.ts +52 -0
- package/src/__tests__/conversation/rosterProjection.test.ts +204 -3
- package/src/__tests__/conversation/runtime.test.ts +118 -1
- package/src/__tests__/conversation/voice.test.ts +741 -7
- package/src/__tests__/creatorCuration.test.ts +256 -0
- package/src/__tests__/creatorDashboard.test.ts +444 -0
- package/src/__tests__/creatorUniverse.test.ts +138 -0
- package/src/__tests__/curationWrite.test.ts +179 -0
- package/src/__tests__/decisions.test.ts +89 -0
- package/src/__tests__/designTokens.test.ts +72 -0
- package/src/__tests__/dialogAttribution.test.ts +187 -0
- package/src/__tests__/dmDirectiveToExperience.test.ts +198 -0
- package/src/__tests__/dmWorldEntry.test.ts +2102 -0
- package/src/__tests__/enhancementDiff.test.ts +132 -0
- package/src/__tests__/experienceModelCatalog.test.ts +292 -0
- package/src/__tests__/extractionStageState.test.ts +67 -0
- package/src/__tests__/getVideo.test.ts +95 -0
- package/src/__tests__/graphReadAfterWrite.test.ts +211 -0
- package/src/__tests__/graphSchema.test.ts +55 -4
- package/src/__tests__/happyOysterSeed.test.ts +208 -0
- package/src/__tests__/happyOysterWorld.test.ts +1241 -0
- package/src/__tests__/happyOysterWorldRefusal.test.ts +224 -0
- package/src/__tests__/hiddenWorldLifecycle.test.ts +203 -0
- package/src/__tests__/http.session-refresh.test.ts +424 -0
- package/src/__tests__/http.test.ts +316 -0
- package/src/__tests__/identity.test.ts +132 -0
- package/src/__tests__/loadBundleManifest.test.ts +192 -22
- package/src/__tests__/longLiveSceneEntry.test.ts +371 -0
- package/src/__tests__/me.test.ts +74 -0
- package/src/__tests__/messageContent.test.ts +395 -0
- package/src/__tests__/momentCut.test.ts +229 -0
- package/src/__tests__/mutationEpoch.test.ts +218 -0
- package/src/__tests__/obo.test.ts +159 -0
- package/src/__tests__/opusTransport.test.ts +182 -0
- package/src/__tests__/opusTransportLibopus.test.ts +125 -0
- package/src/__tests__/orgs.test.ts +229 -0
- package/src/__tests__/persona-generation.test.ts +187 -1
- package/src/__tests__/platformAssistant.test.ts +140 -0
- package/src/__tests__/projects.test.ts +338 -0
- package/src/__tests__/promptTemplatePreview.test.ts +160 -0
- package/src/__tests__/reactor/__fixtures__/realFramePromptText.ts +23 -0
- package/src/__tests__/reactor/api-reactor.test.ts +60 -21
- package/src/__tests__/reactor/framePromptCompaction.test.ts +300 -0
- package/src/__tests__/reactor/promptAddonRegistry.test.ts +82 -1
- package/src/__tests__/reactor/reactorTokenScope.test.ts +50 -0
- package/src/__tests__/reactor/resolveDirectorBeats.test.ts +156 -0
- package/src/__tests__/reactor/sceneEntry.test.ts +3 -0
- package/src/__tests__/reactor/sceneSeedImage.test.ts +361 -0
- package/src/__tests__/reactor/seedImageOrchestrator.test.ts +43 -5
- package/src/__tests__/reactor/toolPromptAddon.test.ts +34 -42
- package/src/__tests__/reactor-happyOysterWalk.test.ts +294 -0
- package/src/__tests__/reactorAvailability.test.ts +217 -0
- package/src/__tests__/reactorSessionRefusal.test.ts +189 -0
- package/src/__tests__/regeneration.test.ts +9 -9
- package/src/__tests__/reprocessBlockedReason.test.ts +30 -0
- package/src/__tests__/retryAfter.test.ts +65 -0
- package/src/__tests__/roleClaim.test.ts +102 -0
- package/src/__tests__/sanaLiveEdit.test.ts +84 -0
- package/src/__tests__/seriesKey.test.ts +24 -0
- package/src/__tests__/settings-set9.test.ts +238 -0
- package/src/__tests__/singleFlight.test.ts +348 -0
- package/src/__tests__/storyGraph.test.ts +111 -1
- package/src/__tests__/storyboardFrameCutscene.test.ts +115 -0
- package/src/__tests__/storyboardMask.test.ts +527 -0
- package/src/__tests__/storyboardTimeline.test.ts +228 -0
- package/src/__tests__/storyboards.test.ts +639 -0
- package/src/__tests__/studioAutomation.test.ts +325 -0
- package/src/__tests__/toolSchemas.test.ts +11 -18
- package/src/__tests__/transport.test.ts +312 -0
- package/src/__tests__/videoGenFacade.test.ts +141 -0
- package/src/__tests__/videoGraph.test.ts +43 -1
- package/src/__tests__/visemeScheduler.test.ts +55 -1
- package/src/__tests__/visibility.test.ts +143 -0
- package/src/__tests__/voiceCloneCaption.test.ts +80 -0
- package/src/__tests__/voiceFallback.test.ts +55 -0
- package/src/__tests__/websocket-error-turn-ended.test.ts +49 -0
- package/src/__tests__/websocket-session-attach.test.ts +288 -0
- package/src/__tests__/websocket-vision.test.ts +141 -0
- package/src/__tests__/websocket.test.ts +75 -1
- package/src/__tests__/workflowAuthoring.test.ts +187 -0
- package/src/__tests__/workflows.test.ts +640 -0
- package/src/__tests__/worldMintLoop.test.ts +448 -0
- package/src/__tests__/worldModelPreference.test.ts +302 -0
- package/src/__tests__/worldModelTradeoffs.test.ts +89 -0
- package/src/__tests__/worldSteerOutcome.test.ts +62 -0
- package/src/adapters/capabilities.ts +39 -3
- package/src/adapters/directorAdapter.ts +5 -4
- package/src/adapters/experienceModelCatalog.ts +538 -0
- package/src/adapters/extractionAdapter.ts +150 -0
- package/src/adapters/imageAdapter.ts +5 -1
- package/src/adapters/index.ts +104 -17
- package/src/adapters/momentDirective.ts +109 -0
- package/src/adapters/momentPolicy.ts +209 -0
- package/src/adapters/registry.ts +1 -1
- package/src/adapters/videoGenAdapter.ts +124 -0
- package/src/adapters/worldAdapter.ts +221 -16
- package/src/adapters/worldModelPreference.ts +247 -0
- package/src/adapters/worldModelTradeoffs.ts +247 -0
- package/src/admin.ts +842 -16
- package/src/api.ts +12670 -3446
- package/src/arcBoardJoin.ts +46 -0
- package/src/arcPreview.ts +103 -0
- package/src/audio.ts +691 -130
- package/src/audioDsp.ts +132 -0
- package/src/audioProtocol.ts +235 -0
- package/src/beatTitles.ts +51 -0
- package/src/castProjection.ts +311 -0
- package/src/characterGrounding.ts +491 -0
- package/src/conversation/binding.ts +53 -1
- package/src/conversation/chatSessionStore.ts +281 -0
- package/src/conversation/controller.ts +135 -3
- package/src/conversation/index.ts +2 -0
- package/src/conversation/participant.ts +16 -0
- package/src/conversation/readSequencer.ts +55 -0
- package/src/conversation/roster.ts +5 -1
- package/src/conversation/rosterProjection.ts +166 -2
- package/src/conversation/runtime.ts +66 -7
- package/src/conversation/types.ts +43 -4
- package/src/conversation/voice.ts +655 -51
- package/src/creatorCuration.ts +316 -0
- package/src/creatorDashboard.ts +344 -0
- package/src/creatorUniverse.ts +222 -0
- package/src/curationWrite.ts +108 -0
- package/src/designTokens.ts +157 -0
- package/src/dialogAttribution.ts +182 -0
- package/src/dmRunWorldReadiness.ts +1168 -0
- package/src/domains/access.ts +92 -0
- package/src/domains/adventureDefinitions.ts +313 -0
- package/src/domains/adventures.ts +557 -0
- package/src/domains/arcs.ts +350 -0
- package/src/domains/artifacts.ts +349 -0
- package/src/domains/chat.ts +338 -0
- package/src/domains/decisions.ts +62 -0
- package/src/domains/documents.ts +389 -0
- package/src/domains/enhancements.ts +259 -0
- package/src/domains/graph.ts +959 -0
- package/src/domains/images.ts +451 -0
- package/src/domains/ingestion.ts +695 -0
- package/src/domains/me.ts +27 -0
- package/src/domains/orgs.ts +168 -0
- package/src/domains/personas.ts +433 -0
- package/src/domains/projects.ts +177 -0
- package/src/domains/quests.ts +587 -0
- package/src/domains/reactor.ts +163 -0
- package/src/domains/showcase.ts +35 -0
- package/src/domains/storyboards.ts +1698 -0
- package/src/domains/studioSettings.ts +149 -0
- package/src/domains/universes.ts +433 -0
- package/src/domains/userDefaults.ts +37 -0
- package/src/domains/visemeBundles.ts +541 -0
- package/src/domains/workflows.ts +376 -0
- package/src/enhancementDiff.ts +171 -0
- package/src/generated/contract.ts +1011 -0
- package/src/graphSchema.ts +154 -6
- package/src/http.ts +295 -11
- package/src/identity.ts +123 -0
- package/src/index.ts +131 -0
- package/src/messageContent.ts +500 -0
- package/src/mutationEpoch.ts +107 -0
- package/src/obo.ts +201 -0
- package/src/opusTransport.ts +268 -0
- package/src/pagination.ts +29 -0
- package/src/platformAssistant.ts +97 -1
- package/src/pollUtils.ts +35 -0
- package/src/questLog.ts +704 -0
- package/src/reactor/dmDirectiveToExperience.ts +636 -0
- package/src/reactor/dmSceneControlPrompt.ts +152 -0
- package/src/reactor/dmWorldEntry.ts +2226 -0
- package/src/reactor/framePromptCompaction.ts +544 -0
- package/src/reactor/frameWorldBind.ts +133 -0
- package/src/reactor/happyOysterSeed.ts +329 -0
- package/src/reactor/happyOysterWalk.ts +541 -0
- package/src/reactor/happyOysterWorld.ts +1270 -0
- package/src/reactor/heliosCommandDispatcher.ts +5 -1
- package/src/reactor/hiddenWorldLifecycle.ts +182 -0
- package/src/reactor/imageCanvas.ts +38 -0
- package/src/reactor/index.ts +81 -0
- package/src/reactor/longLiveCommandDispatcher.ts +23 -8
- package/src/reactor/longLiveSceneEntry.ts +409 -0
- package/src/reactor/momentCut.ts +219 -0
- package/src/reactor/promptAddonRegistry.ts +83 -5
- package/src/reactor/promptTemplatePreview.ts +240 -0
- package/src/reactor/reactorAvailability.ts +155 -0
- package/src/reactor/reactorSessionRefusal.ts +260 -0
- package/src/reactor/reactorTokenScope.ts +69 -0
- package/src/reactor/resolveDirectorBeats.ts +140 -0
- package/src/reactor/sanaLiveEdit.ts +158 -0
- package/src/reactor/sceneEntry.ts +106 -88
- package/src/reactor/sceneSeedImage.ts +338 -0
- package/src/reactor/seedImageOrchestrator.ts +116 -34
- package/src/reactor/toolPromptAddon.ts +66 -102
- package/src/reactor/worldMintLoop.ts +545 -0
- package/src/reactor/worldSteerOutcome.ts +132 -0
- package/src/retryAfter.ts +71 -0
- package/src/seriesKey.ts +42 -0
- package/src/sessionRefresh.ts +237 -0
- package/src/sharedAudioContext.ts +67 -0
- package/src/singleFlight.ts +91 -0
- package/src/storyGraph.ts +247 -4
- package/src/storyboardMask.ts +756 -0
- package/src/storyboardTimeline.ts +220 -0
- package/src/studioAutomation.ts +208 -0
- package/src/tenantClaim.ts +170 -0
- package/src/timeFormat.ts +51 -0
- package/src/toolSchemas.ts +39 -10
- package/src/transport.ts +327 -0
- package/src/videoGenFacade.ts +90 -0
- package/src/visemeScheduler.ts +36 -3
- package/src/vision/VisionPublisher.ts +204 -14
- package/src/vision/VisionSourceController.ts +187 -6
- package/src/vision/__tests__/VisionPublisher.kvs.test.ts +50 -0
- package/src/vision/__tests__/VisionPublisher.test.ts +291 -0
- package/src/vision/__tests__/VisionSourceController.test.ts +376 -6
- package/src/vision/index.ts +5 -1
- package/src/vision/sourceKinds.ts +19 -5
- package/src/vision/types.ts +7 -4
- package/src/vision/visionErrors.ts +70 -0
- package/src/voiceCloneCaption.ts +77 -0
- package/src/websocket.ts +542 -9
- package/src/workflowAuthoring.ts +664 -0
|
@@ -0,0 +1,1241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the HappyOyster world adapter (§Q SB-W.1).
|
|
3
|
+
*
|
|
4
|
+
* These prove the behaviours client-core owns BECAUSE the vendor SDK does not:
|
|
5
|
+
* the prompt cap it never checks, the {encryptedWorldId, mode} handle it has no
|
|
6
|
+
* type for, the failure vocabulary it leaves as raw codes, and the
|
|
7
|
+
* create-or-reopen sequence. The LIVE model behaviour (a real world created and
|
|
8
|
+
* reopened against staging) is verified separately by
|
|
9
|
+
* `~/.seer-e2e/sbw1-happy-oyster-live.mjs` — see the feature doc.
|
|
10
|
+
*/
|
|
11
|
+
import {
|
|
12
|
+
HAPPY_OYSTER_BUILD_FAST_MS,
|
|
13
|
+
HAPPY_OYSTER_BUILD_OBSERVED_MAX_MS,
|
|
14
|
+
HAPPY_OYSTER_MODES,
|
|
15
|
+
HAPPY_OYSTER_PROMPT_MAX_CHARS,
|
|
16
|
+
HAPPY_OYSTER_RESUME_MEDIA_MAX_MS,
|
|
17
|
+
HAPPY_OYSTER_RESUME_MEDIA_MIN_MS,
|
|
18
|
+
happyOysterVideoIsLive,
|
|
19
|
+
HappyOysterLaunchError,
|
|
20
|
+
classifyHappyOysterError,
|
|
21
|
+
happyOysterPromptIssue,
|
|
22
|
+
happyOysterWorldAdapter,
|
|
23
|
+
happyOysterWorldHandle,
|
|
24
|
+
isHappyOysterWorldHandle,
|
|
25
|
+
launchHappyOysterWorld,
|
|
26
|
+
HAPPY_OYSTER_SESSION_DISCONNECTED,
|
|
27
|
+
HAPPY_OYSTER_SESSION_READY,
|
|
28
|
+
happyOysterConnectStep,
|
|
29
|
+
ensureHappyOysterWorldApiUnlocked,
|
|
30
|
+
happyOysterWorldApiIsLocked,
|
|
31
|
+
isHappyOysterTravelLockError,
|
|
32
|
+
HAPPY_OYSTER_TRAVEL_LOCK_MESSAGE,
|
|
33
|
+
HAPPY_OYSTER_WORLD_PHASE_TRAVELING,
|
|
34
|
+
HAPPY_OYSTER_CREATE_IN_FLIGHT_MESSAGE,
|
|
35
|
+
HAPPY_OYSTER_CREATE_SESSION_REPLACED_MESSAGE,
|
|
36
|
+
HAPPY_OYSTER_REOPEN_IN_FLIGHT_MESSAGE,
|
|
37
|
+
HAPPY_OYSTER_REOPEN_SESSION_REPLACED_MESSAGE,
|
|
38
|
+
type HappyOysterBridge,
|
|
39
|
+
type HappyOysterWorldSnapshot,
|
|
40
|
+
} from '../index';
|
|
41
|
+
import { HAPPY_OYSTER_MODEL_ID } from '../adapters/experienceModelCatalog';
|
|
42
|
+
|
|
43
|
+
const READY: HappyOysterWorldSnapshot = {
|
|
44
|
+
phase: 'ready',
|
|
45
|
+
encrypted_world_id: 'ew-abc123',
|
|
46
|
+
first_frame: 'https://cdn.example/frame.png',
|
|
47
|
+
prompt: 'A misty forest at dawn',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** A bridge that records the calls the launcher makes. */
|
|
51
|
+
function stubBridge(
|
|
52
|
+
overrides: Partial<HappyOysterBridge> = {},
|
|
53
|
+
): HappyOysterBridge & { calls: string[] } {
|
|
54
|
+
const calls: string[] = [];
|
|
55
|
+
return {
|
|
56
|
+
calls,
|
|
57
|
+
connect: async () => {
|
|
58
|
+
calls.push('connect');
|
|
59
|
+
},
|
|
60
|
+
createWorld: async () => {
|
|
61
|
+
calls.push('createWorld');
|
|
62
|
+
return READY;
|
|
63
|
+
},
|
|
64
|
+
attachWorld: async () => {
|
|
65
|
+
calls.push('attachWorld');
|
|
66
|
+
return READY;
|
|
67
|
+
},
|
|
68
|
+
startTravel: async () => {
|
|
69
|
+
calls.push('startTravel');
|
|
70
|
+
return { streaming: true };
|
|
71
|
+
},
|
|
72
|
+
...overrides,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* §Q `DM.77` — a bridge that MODELS THE VENDOR'S SESSION STATUS instead of
|
|
78
|
+
* counting calls.
|
|
79
|
+
*
|
|
80
|
+
* `Reactor.connect` opens with `if (this.status !== 'disconnected') throw new
|
|
81
|
+
* Error('Already connected or connecting')`. `stubBridge`'s `connect` resolves
|
|
82
|
+
* every time, which is exactly why jest was green over the defect: the real
|
|
83
|
+
* failure needs a SECOND connect on a session that is still open, and a
|
|
84
|
+
* call-counting stub can never produce it. This one starts `'disconnected'`,
|
|
85
|
+
* goes `'ready'` on a successful connect, and throws the vendor's own message
|
|
86
|
+
* on any connect from a non-disconnected status.
|
|
87
|
+
*/
|
|
88
|
+
function sessionBridge(
|
|
89
|
+
overrides: Partial<HappyOysterBridge> & {
|
|
90
|
+
failFirstConnect?: boolean;
|
|
91
|
+
/** Hold the first connect open, so a SECOND launch sees `'waiting'` while
|
|
92
|
+
* the first is genuinely still in flight — the ambiguity codex found. */
|
|
93
|
+
gate?: Promise<void>;
|
|
94
|
+
} = {},
|
|
95
|
+
): HappyOysterBridge & { calls: string[]; status: string } {
|
|
96
|
+
const { failFirstConnect = false, gate, ...bridgeOverrides } = overrides;
|
|
97
|
+
const calls: string[] = [];
|
|
98
|
+
let connects = 0;
|
|
99
|
+
/** The SDK's own in-flight de-dupe (`HappyOysterModel.connectPromise`): a
|
|
100
|
+
* connect issued while one is pending JOINS it and never reaches the guard. */
|
|
101
|
+
let inFlight: Promise<void> | null = null;
|
|
102
|
+
const state: HappyOysterBridge & { calls: string[]; status: string } = {
|
|
103
|
+
calls,
|
|
104
|
+
status: HAPPY_OYSTER_SESSION_DISCONNECTED as string,
|
|
105
|
+
connect: async () => {
|
|
106
|
+
calls.push('connect');
|
|
107
|
+
if (inFlight !== null) return inFlight;
|
|
108
|
+
if (state.status !== HAPPY_OYSTER_SESSION_DISCONNECTED) {
|
|
109
|
+
throw new Error('Already connected or connecting');
|
|
110
|
+
}
|
|
111
|
+
connects += 1;
|
|
112
|
+
const attempt = (async () => {
|
|
113
|
+
if (gate !== undefined && connects === 1) {
|
|
114
|
+
state.status = 'waiting';
|
|
115
|
+
await gate;
|
|
116
|
+
}
|
|
117
|
+
if (failFirstConnect && connects === 1) {
|
|
118
|
+
// The SDK does NOT reset its status on a failed connect — it is left
|
|
119
|
+
// wherever the attempt got to. That is the `'reset'` case.
|
|
120
|
+
state.status = 'waiting';
|
|
121
|
+
throw new Error('Connection failed: coordinator unreachable');
|
|
122
|
+
}
|
|
123
|
+
state.status = HAPPY_OYSTER_SESSION_READY;
|
|
124
|
+
})();
|
|
125
|
+
inFlight = attempt.finally(() => {
|
|
126
|
+
inFlight = null;
|
|
127
|
+
});
|
|
128
|
+
return inFlight;
|
|
129
|
+
},
|
|
130
|
+
disconnect: async () => {
|
|
131
|
+
calls.push('disconnect');
|
|
132
|
+
state.status = HAPPY_OYSTER_SESSION_DISCONNECTED;
|
|
133
|
+
},
|
|
134
|
+
sessionStatus: () => state.status,
|
|
135
|
+
createWorld: async () => {
|
|
136
|
+
calls.push('createWorld');
|
|
137
|
+
return READY;
|
|
138
|
+
},
|
|
139
|
+
attachWorld: async () => {
|
|
140
|
+
calls.push('attachWorld');
|
|
141
|
+
return READY;
|
|
142
|
+
},
|
|
143
|
+
startTravel: async () => {
|
|
144
|
+
calls.push('startTravel');
|
|
145
|
+
return { streaming: true };
|
|
146
|
+
},
|
|
147
|
+
...bridgeOverrides,
|
|
148
|
+
};
|
|
149
|
+
return state;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
describe('happyOysterPromptIssue', () => {
|
|
153
|
+
it('accepts a normal prompt', () => {
|
|
154
|
+
expect(happyOysterPromptIssue('A misty forest at dawn')).toBeNull();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('rejects an empty/whitespace prompt', () => {
|
|
158
|
+
expect(happyOysterPromptIssue(' ')).toContain('required');
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it('rejects a prompt over the 2000-character cap the SDK does NOT enforce', () => {
|
|
162
|
+
const tooLong = 'x'.repeat(HAPPY_OYSTER_PROMPT_MAX_CHARS + 1);
|
|
163
|
+
expect(happyOysterPromptIssue(tooLong)).toContain(
|
|
164
|
+
String(HAPPY_OYSTER_PROMPT_MAX_CHARS),
|
|
165
|
+
);
|
|
166
|
+
// Exactly at the cap is fine — the bound is inclusive.
|
|
167
|
+
expect(
|
|
168
|
+
happyOysterPromptIssue('x'.repeat(HAPPY_OYSTER_PROMPT_MAX_CHARS)),
|
|
169
|
+
).toBeNull();
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
describe('HappyOysterWorldHandle', () => {
|
|
174
|
+
it('builds a handle from a ready snapshot', () => {
|
|
175
|
+
expect(happyOysterWorldHandle(READY, 'directing')).toEqual({
|
|
176
|
+
encryptedWorldId: 'ew-abc123',
|
|
177
|
+
mode: 'directing',
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('returns null while the world has no id yet (creating/building)', () => {
|
|
182
|
+
expect(
|
|
183
|
+
happyOysterWorldHandle({ encrypted_world_id: null }, 'directing'),
|
|
184
|
+
).toBeNull();
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('validates a persisted handle, rejecting the deprecated mode spelling', () => {
|
|
188
|
+
expect(
|
|
189
|
+
isHappyOysterWorldHandle({ encryptedWorldId: 'x', mode: 'adventure' }),
|
|
190
|
+
).toBe(true);
|
|
191
|
+
// `director` is the SDK's deprecated alias — two spellings of one mode must
|
|
192
|
+
// never reach persisted handles.
|
|
193
|
+
expect(
|
|
194
|
+
isHappyOysterWorldHandle({ encryptedWorldId: 'x', mode: 'director' }),
|
|
195
|
+
).toBe(false);
|
|
196
|
+
expect(isHappyOysterWorldHandle({ encryptedWorldId: 'x' })).toBe(false);
|
|
197
|
+
expect(isHappyOysterWorldHandle(null)).toBe(false);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('exposes exactly the two canonical modes', () => {
|
|
201
|
+
expect([...HAPPY_OYSTER_MODES]).toEqual(['adventure', 'directing']);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
describe('classifyHappyOysterError', () => {
|
|
206
|
+
it('maps the SDK string gate codes', () => {
|
|
207
|
+
const gate = (code: string) =>
|
|
208
|
+
classifyHappyOysterError(Object.assign(new Error('nope'), { code }))
|
|
209
|
+
.reason;
|
|
210
|
+
expect(gate('MODE_MISMATCH')).toBe('mode_mismatch');
|
|
211
|
+
expect(gate('TRAVELING')).toBe('traveling');
|
|
212
|
+
expect(gate('BUSY')).toBe('traveling');
|
|
213
|
+
expect(gate('WORLD_NOT_READY')).toBe('not_ready');
|
|
214
|
+
expect(gate('NO_WORLD')).toBe('not_ready');
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('maps the upstream numeric codes carried in the message', () => {
|
|
218
|
+
// 403004 content moderation / 403005 copyright — NOT the spec's claimed
|
|
219
|
+
// "image/prompt mismatch"; both collapse to content_rejected.
|
|
220
|
+
expect(classifyHappyOysterError(new Error('upstream 403004')).reason).toBe(
|
|
221
|
+
'content_rejected',
|
|
222
|
+
);
|
|
223
|
+
expect(classifyHappyOysterError(new Error('upstream 403005')).reason).toBe(
|
|
224
|
+
'content_rejected',
|
|
225
|
+
);
|
|
226
|
+
expect(classifyHappyOysterError(new Error('upstream 403001')).reason).toBe(
|
|
227
|
+
'world_not_found',
|
|
228
|
+
);
|
|
229
|
+
expect(classifyHappyOysterError(new Error('upstream 400000')).reason).toBe(
|
|
230
|
+
'invalid_request',
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('falls back to unknown and marks only transient reasons retryable', () => {
|
|
235
|
+
const unknown = classifyHappyOysterError(new Error('socket hang up'));
|
|
236
|
+
expect(unknown.reason).toBe('unknown');
|
|
237
|
+
expect(unknown.retryable).toBe(false);
|
|
238
|
+
expect(
|
|
239
|
+
classifyHappyOysterError(
|
|
240
|
+
Object.assign(new Error('x'), { code: 'TRAVELING' }),
|
|
241
|
+
).retryable,
|
|
242
|
+
).toBe(true);
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
describe('happyOysterConnectStep', () => {
|
|
247
|
+
it('connects only from disconnected, and re-uses a ready session', () => {
|
|
248
|
+
expect(happyOysterConnectStep(HAPPY_OYSTER_SESSION_DISCONNECTED)).toBe(
|
|
249
|
+
'connect',
|
|
250
|
+
);
|
|
251
|
+
expect(happyOysterConnectStep(HAPPY_OYSTER_SESSION_READY)).toBe('reuse');
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it('resets a half-open session — the SDK never resets its own status', () => {
|
|
255
|
+
expect(happyOysterConnectStep('connecting')).toBe('reset');
|
|
256
|
+
expect(happyOysterConnectStep('waiting')).toBe('reset');
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('keeps the pre-DM.77 behaviour when the host reports no status', () => {
|
|
260
|
+
expect(happyOysterConnectStep(null)).toBe('connect');
|
|
261
|
+
expect(happyOysterConnectStep(undefined)).toBe('connect');
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
describe('launchHappyOysterWorld', () => {
|
|
266
|
+
it('creates a world and starts the travel, returning the permanent handle', async () => {
|
|
267
|
+
const bridge = stubBridge();
|
|
268
|
+
const result = await launchHappyOysterWorld(
|
|
269
|
+
{ kind: 'create', prompt: 'A misty forest at dawn' },
|
|
270
|
+
bridge,
|
|
271
|
+
'directing',
|
|
272
|
+
{ jwt: 'jwt-token' },
|
|
273
|
+
);
|
|
274
|
+
expect(bridge.calls).toEqual(['connect', 'createWorld', 'startTravel']);
|
|
275
|
+
expect(result.handle).toEqual({
|
|
276
|
+
encryptedWorldId: 'ew-abc123',
|
|
277
|
+
mode: 'directing',
|
|
278
|
+
});
|
|
279
|
+
expect(result.streaming).toBe(true);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// §Q MOMENT.15 — the mint loop creates and STOPS.
|
|
283
|
+
it('skipTravel creates the world and never opens a stream', async () => {
|
|
284
|
+
const bridge = stubBridge();
|
|
285
|
+
const result = await launchHappyOysterWorld(
|
|
286
|
+
{ kind: 'create', prompt: 'A misty forest at dawn' },
|
|
287
|
+
bridge,
|
|
288
|
+
'adventure',
|
|
289
|
+
{ jwt: 'jwt-token', skipTravel: true },
|
|
290
|
+
);
|
|
291
|
+
expect(bridge.calls).toEqual(['connect', 'createWorld']);
|
|
292
|
+
expect(bridge.calls).not.toContain('startTravel');
|
|
293
|
+
expect(result.handle.encryptedWorldId).toBe('ew-abc123');
|
|
294
|
+
// `streaming: false` is ambiguous on its own (it also means "mock backend"),
|
|
295
|
+
// which is why `traveled` exists — a caller must be able to tell a skipped
|
|
296
|
+
// travel from a travel that produced no video.
|
|
297
|
+
expect(result.streaming).toBe(false);
|
|
298
|
+
expect(result.traveled).toBe(false);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
// §Q MOMENT.15 / §Q DM.77 — the loop's SECOND iteration is where the vendor's
|
|
302
|
+
// "Already connected or connecting" throw lives. This is why the mint loop
|
|
303
|
+
// reuses this launcher instead of getting its own create path.
|
|
304
|
+
it('a second mint through the SAME ready session does not re-connect', async () => {
|
|
305
|
+
let status = HAPPY_OYSTER_SESSION_DISCONNECTED;
|
|
306
|
+
const bridge = stubBridge({
|
|
307
|
+
connect: async () => {
|
|
308
|
+
if (status === HAPPY_OYSTER_SESSION_READY) {
|
|
309
|
+
throw new Error('Already connected or connecting');
|
|
310
|
+
}
|
|
311
|
+
bridge.calls.push('connect');
|
|
312
|
+
status = HAPPY_OYSTER_SESSION_READY;
|
|
313
|
+
},
|
|
314
|
+
sessionStatus: () => status,
|
|
315
|
+
});
|
|
316
|
+
for (const prompt of ['world one', 'world two']) {
|
|
317
|
+
await launchHappyOysterWorld({ kind: 'create', prompt }, bridge, 'adventure', {
|
|
318
|
+
skipTravel: true,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
expect(bridge.calls).toEqual(['connect', 'createWorld', 'createWorld']);
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
it('the DM.43 handle rail still fires when the travel is skipped', async () => {
|
|
325
|
+
const bridge = stubBridge();
|
|
326
|
+
const seen: string[] = [];
|
|
327
|
+
await launchHappyOysterWorld(
|
|
328
|
+
{ kind: 'create', prompt: 'A misty forest at dawn' },
|
|
329
|
+
bridge,
|
|
330
|
+
'adventure',
|
|
331
|
+
{ skipTravel: true, onWorldCreated: handle => void seen.push(handle.encryptedWorldId) },
|
|
332
|
+
);
|
|
333
|
+
expect(seen).toEqual(['ew-abc123']);
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
it('reopens a permanent world via attachWorld', async () => {
|
|
337
|
+
const bridge = stubBridge();
|
|
338
|
+
const result = await launchHappyOysterWorld(
|
|
339
|
+
{
|
|
340
|
+
kind: 'reopen',
|
|
341
|
+
handle: { encryptedWorldId: 'ew-abc123', mode: 'directing' },
|
|
342
|
+
},
|
|
343
|
+
bridge,
|
|
344
|
+
'directing',
|
|
345
|
+
);
|
|
346
|
+
expect(bridge.calls).toEqual(['connect', 'attachWorld', 'startTravel']);
|
|
347
|
+
expect(result.handle.encryptedWorldId).toBe('ew-abc123');
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
it('rejects a mode-mismatched reopen BEFORE opening a session', async () => {
|
|
351
|
+
const bridge = stubBridge();
|
|
352
|
+
await expect(
|
|
353
|
+
launchHappyOysterWorld(
|
|
354
|
+
{
|
|
355
|
+
kind: 'reopen',
|
|
356
|
+
handle: { encryptedWorldId: 'ew-abc123', mode: 'adventure' },
|
|
357
|
+
},
|
|
358
|
+
bridge,
|
|
359
|
+
'directing',
|
|
360
|
+
),
|
|
361
|
+
).rejects.toMatchObject({ reason: 'mode_mismatch', retryable: false });
|
|
362
|
+
// Nothing was connected — the round-trip is saved.
|
|
363
|
+
expect(bridge.calls).toEqual([]);
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
// §Q DM.77 — the re-entry class. Measured live 3/3 runs on staging and on a
|
|
367
|
+
// PR preview (DM.71 #1687): the second world entry in one page load died
|
|
368
|
+
// `unknown / "Already connected or connecting"`, so the dead-stream panel's
|
|
369
|
+
// "Re-enter the world" button had never once worked.
|
|
370
|
+
it('re-uses a READY session on a second entry instead of re-connecting', async () => {
|
|
371
|
+
const bridge = sessionBridge();
|
|
372
|
+
await launchHappyOysterWorld(
|
|
373
|
+
{
|
|
374
|
+
kind: 'reopen',
|
|
375
|
+
handle: { encryptedWorldId: 'ew-abc123', mode: 'directing' },
|
|
376
|
+
},
|
|
377
|
+
bridge,
|
|
378
|
+
'directing',
|
|
379
|
+
);
|
|
380
|
+
expect(bridge.status).toBe(HAPPY_OYSTER_SESSION_READY);
|
|
381
|
+
|
|
382
|
+
// The vendor's own natural stop KEEPS the session open (the world is
|
|
383
|
+
// permanent and must stay attachable), so the re-entry starts here.
|
|
384
|
+
bridge.calls.length = 0;
|
|
385
|
+
const result = await launchHappyOysterWorld(
|
|
386
|
+
{
|
|
387
|
+
kind: 'reopen',
|
|
388
|
+
handle: { encryptedWorldId: 'ew-abc123', mode: 'directing' },
|
|
389
|
+
},
|
|
390
|
+
bridge,
|
|
391
|
+
'directing',
|
|
392
|
+
);
|
|
393
|
+
expect(bridge.calls).toEqual(['attachWorld', 'startTravel']);
|
|
394
|
+
expect(result.handle.encryptedWorldId).toBe('ew-abc123');
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
it('tears down a session left half-open by a FAILED connect before reconnecting', async () => {
|
|
398
|
+
const bridge = sessionBridge({ failFirstConnect: true });
|
|
399
|
+
await expect(
|
|
400
|
+
launchHappyOysterWorld(
|
|
401
|
+
{
|
|
402
|
+
kind: 'reopen',
|
|
403
|
+
handle: { encryptedWorldId: 'ew-abc123', mode: 'directing' },
|
|
404
|
+
},
|
|
405
|
+
bridge,
|
|
406
|
+
'directing',
|
|
407
|
+
),
|
|
408
|
+
).rejects.toBeInstanceOf(HappyOysterLaunchError);
|
|
409
|
+
// The SDK left it at 'waiting' — neither reusable nor connectable.
|
|
410
|
+
expect(bridge.status).toBe('waiting');
|
|
411
|
+
|
|
412
|
+
bridge.calls.length = 0;
|
|
413
|
+
const result = await launchHappyOysterWorld(
|
|
414
|
+
{
|
|
415
|
+
kind: 'reopen',
|
|
416
|
+
handle: { encryptedWorldId: 'ew-abc123', mode: 'directing' },
|
|
417
|
+
},
|
|
418
|
+
bridge,
|
|
419
|
+
'directing',
|
|
420
|
+
);
|
|
421
|
+
// The probe connect comes FIRST and is what proves the attempt is settled
|
|
422
|
+
// (it comes back with the guard); only then is the session torn down.
|
|
423
|
+
expect(bridge.calls).toEqual([
|
|
424
|
+
'connect',
|
|
425
|
+
'disconnect',
|
|
426
|
+
'connect',
|
|
427
|
+
'attachWorld',
|
|
428
|
+
'startTravel',
|
|
429
|
+
]);
|
|
430
|
+
expect(result.handle.encryptedWorldId).toBe('ew-abc123');
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// codex on #1690: `connecting`/`waiting` is ALSO what a healthy connect looks
|
|
434
|
+
// like while it is still in flight. A launcher that disconnected on sight of
|
|
435
|
+
// that status would tear down a live attempt — and close the RTC connection
|
|
436
|
+
// under a mounted video.
|
|
437
|
+
it('JOINS a connect that is still in flight rather than tearing it down', async () => {
|
|
438
|
+
let open = () => {};
|
|
439
|
+
const gate = new Promise<void>((resolve) => {
|
|
440
|
+
open = resolve;
|
|
441
|
+
});
|
|
442
|
+
const bridge = sessionBridge({ gate });
|
|
443
|
+
const first = launchHappyOysterWorld(
|
|
444
|
+
{ kind: 'reopen', handle: { encryptedWorldId: 'ew-abc123', mode: 'directing' } },
|
|
445
|
+
bridge,
|
|
446
|
+
'directing',
|
|
447
|
+
);
|
|
448
|
+
// The first connect is pending and the status now reads 'waiting' — the
|
|
449
|
+
// ambiguous state.
|
|
450
|
+
await Promise.resolve();
|
|
451
|
+
expect(bridge.status).toBe('waiting');
|
|
452
|
+
expect(happyOysterConnectStep(bridge.status)).toBe('reset');
|
|
453
|
+
|
|
454
|
+
// §Q DM.97 — a second launch through the SAME session key is now refused
|
|
455
|
+
// by the launch lock before it reaches `connect` (see the DM.97 suite). The
|
|
456
|
+
// join path still matters for a host whose bridges share no `sessionKey`
|
|
457
|
+
// (a pinned `../Web-App` build): a different bridge object over the same
|
|
458
|
+
// session locks on itself, so it reaches `connect` and must JOIN.
|
|
459
|
+
const second = launchHappyOysterWorld(
|
|
460
|
+
{ kind: 'reopen', handle: { encryptedWorldId: 'ew-abc123', mode: 'directing' } },
|
|
461
|
+
{ ...bridge },
|
|
462
|
+
'directing',
|
|
463
|
+
);
|
|
464
|
+
open();
|
|
465
|
+
await expect(first).resolves.toMatchObject({ streaming: true });
|
|
466
|
+
await expect(second).resolves.toMatchObject({ streaming: true });
|
|
467
|
+
// Nothing was torn down: the second launch joined the pending connect.
|
|
468
|
+
expect(bridge.calls).not.toContain('disconnect');
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
it('keeps the unconditional connect for a bridge that reports no status', async () => {
|
|
472
|
+
// `../Web-App` is pinned to a published client-core; a bridge without
|
|
473
|
+
// `sessionStatus` must behave exactly as it did before DM.77.
|
|
474
|
+
const bridge = stubBridge();
|
|
475
|
+
await launchHappyOysterWorld(
|
|
476
|
+
{ kind: 'create', prompt: 'A misty forest at dawn' },
|
|
477
|
+
bridge,
|
|
478
|
+
'directing',
|
|
479
|
+
);
|
|
480
|
+
expect(bridge.calls).toEqual(['connect', 'createWorld', 'startTravel']);
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
it('rejects an over-long prompt without connecting', async () => {
|
|
484
|
+
const bridge = stubBridge();
|
|
485
|
+
await expect(
|
|
486
|
+
launchHappyOysterWorld(
|
|
487
|
+
{ kind: 'create', prompt: 'x'.repeat(HAPPY_OYSTER_PROMPT_MAX_CHARS + 1) },
|
|
488
|
+
bridge,
|
|
489
|
+
'directing',
|
|
490
|
+
),
|
|
491
|
+
).rejects.toBeInstanceOf(HappyOysterLaunchError);
|
|
492
|
+
expect(bridge.calls).toEqual([]);
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
it('rejects both seed sources at once (the SDK throws a bare Error late)', async () => {
|
|
496
|
+
const bridge = stubBridge();
|
|
497
|
+
await expect(
|
|
498
|
+
launchHappyOysterWorld(
|
|
499
|
+
{
|
|
500
|
+
kind: 'create',
|
|
501
|
+
prompt: 'A misty forest',
|
|
502
|
+
firstFrameImage: new Blob(['x']),
|
|
503
|
+
firstFrameImageUrl: 'https://cdn.example/a.png',
|
|
504
|
+
},
|
|
505
|
+
bridge,
|
|
506
|
+
'directing',
|
|
507
|
+
),
|
|
508
|
+
).rejects.toMatchObject({ reason: 'invalid_request' });
|
|
509
|
+
expect(bridge.calls).toEqual([]);
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
it('classifies an upstream rejection thrown by the bridge', async () => {
|
|
513
|
+
const bridge = stubBridge({
|
|
514
|
+
createWorld: async () => {
|
|
515
|
+
throw Object.assign(new Error('[TRAVELING] world API locked'), {
|
|
516
|
+
code: 'TRAVELING',
|
|
517
|
+
});
|
|
518
|
+
},
|
|
519
|
+
});
|
|
520
|
+
await expect(
|
|
521
|
+
launchHappyOysterWorld(
|
|
522
|
+
{ kind: 'create', prompt: 'A misty forest' },
|
|
523
|
+
bridge,
|
|
524
|
+
'directing',
|
|
525
|
+
),
|
|
526
|
+
).rejects.toMatchObject({ reason: 'traveling', retryable: true });
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
it('carries the CREATED world handle on the error when startTravel fails', async () => {
|
|
530
|
+
// The world is permanent and already billed; HappyOyster has no listing
|
|
531
|
+
// API, so losing the id here orphans it forever.
|
|
532
|
+
const bridge = stubBridge({
|
|
533
|
+
startTravel: async () => {
|
|
534
|
+
throw new Error('stream ready timeout');
|
|
535
|
+
},
|
|
536
|
+
});
|
|
537
|
+
await expect(
|
|
538
|
+
launchHappyOysterWorld(
|
|
539
|
+
{ kind: 'create', prompt: 'A misty forest' },
|
|
540
|
+
bridge,
|
|
541
|
+
'directing',
|
|
542
|
+
),
|
|
543
|
+
).rejects.toMatchObject({
|
|
544
|
+
handle: { encryptedWorldId: 'ew-abc123', mode: 'directing' },
|
|
545
|
+
});
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
it('carries a null handle when the failure precedes world creation', async () => {
|
|
549
|
+
const bridge = stubBridge({
|
|
550
|
+
createWorld: async () => {
|
|
551
|
+
throw new Error('upstream 403004');
|
|
552
|
+
},
|
|
553
|
+
});
|
|
554
|
+
await expect(
|
|
555
|
+
launchHappyOysterWorld(
|
|
556
|
+
{ kind: 'create', prompt: 'A misty forest' },
|
|
557
|
+
bridge,
|
|
558
|
+
'directing',
|
|
559
|
+
),
|
|
560
|
+
).rejects.toMatchObject({ reason: 'content_rejected', handle: null });
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
it('fails as not_ready when the snapshot carries no world id', async () => {
|
|
564
|
+
const bridge = stubBridge({
|
|
565
|
+
createWorld: async () => ({ ...READY, phase: 'building', encrypted_world_id: null }),
|
|
566
|
+
});
|
|
567
|
+
await expect(
|
|
568
|
+
launchHappyOysterWorld(
|
|
569
|
+
{ kind: 'create', prompt: 'A misty forest' },
|
|
570
|
+
bridge,
|
|
571
|
+
'directing',
|
|
572
|
+
),
|
|
573
|
+
).rejects.toMatchObject({ reason: 'not_ready', retryable: true });
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
describe('happyOysterWorldAdapter', () => {
|
|
578
|
+
it('single-sources its id from the catalog and widens no capability union', () => {
|
|
579
|
+
expect(happyOysterWorldAdapter.id).toBe(HAPPY_OYSTER_MODEL_ID);
|
|
580
|
+
expect([...happyOysterWorldAdapter.capabilities]).toEqual([
|
|
581
|
+
'world_stream',
|
|
582
|
+
'set_scene',
|
|
583
|
+
'swap_seed',
|
|
584
|
+
'pause_resume',
|
|
585
|
+
]);
|
|
586
|
+
});
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
describe('happyOysterVideoIsLive (SB-W.2)', () => {
|
|
590
|
+
it('is true only when the element has a paintable frame with real dimensions', () => {
|
|
591
|
+
// The measured STREAMING sample (SB-W.1: readyState 4, 720p).
|
|
592
|
+
expect(
|
|
593
|
+
happyOysterVideoIsLive({
|
|
594
|
+
readyState: 4,
|
|
595
|
+
videoWidth: 1280,
|
|
596
|
+
videoHeight: 720,
|
|
597
|
+
}),
|
|
598
|
+
).toBe(true);
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
it('is false for the PAUSED sample the vendor actually produces', () => {
|
|
602
|
+
// Pause tears the track down — readyState 0, zero dimensions, currentTime
|
|
603
|
+
// reset. This is the sample the "resuming…" state waits on.
|
|
604
|
+
expect(
|
|
605
|
+
happyOysterVideoIsLive({ readyState: 0, videoWidth: 0, videoHeight: 0 }),
|
|
606
|
+
).toBe(false);
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
it('is false while the track is re-attaching but has no frame yet', () => {
|
|
610
|
+
// Metadata can arrive before a frame does; treating either half-state as
|
|
611
|
+
// live would clear the resuming overlay over a still-black pane.
|
|
612
|
+
expect(
|
|
613
|
+
happyOysterVideoIsLive({
|
|
614
|
+
readyState: 1,
|
|
615
|
+
videoWidth: 1280,
|
|
616
|
+
videoHeight: 720,
|
|
617
|
+
}),
|
|
618
|
+
).toBe(false);
|
|
619
|
+
expect(
|
|
620
|
+
happyOysterVideoIsLive({ readyState: 4, videoWidth: 0, videoHeight: 0 }),
|
|
621
|
+
).toBe(false);
|
|
622
|
+
});
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
describe('measured vendor timing constants (SB-W.2)', () => {
|
|
626
|
+
it('records the observed build-time envelope, not a guess', () => {
|
|
627
|
+
expect(HAPPY_OYSTER_BUILD_FAST_MS).toBe(105_000);
|
|
628
|
+
expect(HAPPY_OYSTER_BUILD_OBSERVED_MAX_MS).toBeGreaterThan(
|
|
629
|
+
HAPPY_OYSTER_BUILD_FAST_MS,
|
|
630
|
+
);
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
it('records the resume media-reattach window', () => {
|
|
634
|
+
expect(HAPPY_OYSTER_RESUME_MEDIA_MIN_MS).toBeLessThan(
|
|
635
|
+
HAPPY_OYSTER_RESUME_MEDIA_MAX_MS,
|
|
636
|
+
);
|
|
637
|
+
});
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
/* ==========================================================================
|
|
641
|
+
* §Q WORLD.10 — a live travel must not permanently lock the next world entry
|
|
642
|
+
* ========================================================================== */
|
|
643
|
+
|
|
644
|
+
describe('happyOysterWorldApiIsLocked (§Q WORLD.10)', () => {
|
|
645
|
+
it('KNOWN-BAD ARM: a COMPLETED travel leaves the world phase at `traveling` while the client phase is idle — the shipped guard read `streaming` and saw nothing', () => {
|
|
646
|
+
// This is the GROUND.82 state exactly: the SDK nulls `travelState` and
|
|
647
|
+
// resets the client phase on completion, and never re-reads `world_state`.
|
|
648
|
+
// `streaming` (⇔ clientPhase === 'streaming') is FALSE here, which is why
|
|
649
|
+
// `if (streaming) await endTravelSession()` skipped — and createWorld was
|
|
650
|
+
// refused for the rest of the session.
|
|
651
|
+
expect(
|
|
652
|
+
happyOysterWorldApiIsLocked({
|
|
653
|
+
clientPhase: 'connected',
|
|
654
|
+
worldPhase: HAPPY_OYSTER_WORLD_PHASE_TRAVELING,
|
|
655
|
+
}),
|
|
656
|
+
).toBe(true);
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
it('KNOWN-BAD ARM 2: `starting_stream` locks the world API and is not `streaming` either', () => {
|
|
660
|
+
expect(
|
|
661
|
+
happyOysterWorldApiIsLocked({ clientPhase: 'starting_stream', worldPhase: 'ready' }),
|
|
662
|
+
).toBe(true);
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
it('is true while streaming — the one arm the shipped guard did cover', () => {
|
|
666
|
+
expect(happyOysterWorldApiIsLocked({ clientPhase: 'streaming', worldPhase: 'ready' })).toBe(
|
|
667
|
+
true,
|
|
668
|
+
);
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
it('is false on an idle session with a ready world, and on unknown state', () => {
|
|
672
|
+
expect(happyOysterWorldApiIsLocked({ clientPhase: 'connected', worldPhase: 'ready' })).toBe(
|
|
673
|
+
false,
|
|
674
|
+
);
|
|
675
|
+
expect(happyOysterWorldApiIsLocked({})).toBe(false);
|
|
676
|
+
});
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
describe('isHappyOysterTravelLockError (§Q WORLD.10)', () => {
|
|
680
|
+
it('matches the vendor refusal measured on the GROUND.82 run', () => {
|
|
681
|
+
expect(
|
|
682
|
+
isHappyOysterTravelLockError(
|
|
683
|
+
new Error('createWorld() is locked while a travel is live — end the travel first'),
|
|
684
|
+
),
|
|
685
|
+
).toBe(true);
|
|
686
|
+
expect(HAPPY_OYSTER_TRAVEL_LOCK_MESSAGE).toBe('locked while a travel is live');
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
it('does not claim an unrelated refusal', () => {
|
|
690
|
+
expect(isHappyOysterTravelLockError(new Error('Already connected or connecting'))).toBe(false);
|
|
691
|
+
expect(isHappyOysterTravelLockError(null)).toBe(false);
|
|
692
|
+
});
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
describe('ensureHappyOysterWorldApiUnlocked (§Q WORLD.10)', () => {
|
|
696
|
+
const gateFor = (state: { clientPhase: string; worldPhase: string }) => {
|
|
697
|
+
const calls = { endTravelSession: 0, refreshWorldState: 0 };
|
|
698
|
+
return {
|
|
699
|
+
state,
|
|
700
|
+
calls,
|
|
701
|
+
gate: {
|
|
702
|
+
clientPhase: () => state.clientPhase,
|
|
703
|
+
worldPhase: () => state.worldPhase,
|
|
704
|
+
endTravelSession: async () => {
|
|
705
|
+
calls.endTravelSession += 1;
|
|
706
|
+
// The vendor's own behaviour: the CLIENT phase is reset, and the
|
|
707
|
+
// world snapshot is refreshed ONLY when the SDK still knows the
|
|
708
|
+
// travel id — which after a completion it does not.
|
|
709
|
+
if (state.clientPhase === 'streaming' || state.clientPhase === 'starting_stream') {
|
|
710
|
+
state.clientPhase = 'connected';
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
refreshWorldState: async () => {
|
|
714
|
+
calls.refreshWorldState += 1;
|
|
715
|
+
state.worldPhase = 'ready';
|
|
716
|
+
},
|
|
717
|
+
},
|
|
718
|
+
};
|
|
719
|
+
};
|
|
720
|
+
const noSleep = { sleep: async () => {}, pollMs: 1 };
|
|
721
|
+
|
|
722
|
+
it('does nothing when nothing is locked', async () => {
|
|
723
|
+
const { gate, calls } = gateFor({ clientPhase: 'connected', worldPhase: 'ready' });
|
|
724
|
+
await expect(ensureHappyOysterWorldApiUnlocked(gate, noSleep)).resolves.toBe('unlocked');
|
|
725
|
+
expect(calls.endTravelSession).toBe(0);
|
|
726
|
+
expect(calls.refreshWorldState).toBe(0);
|
|
727
|
+
});
|
|
728
|
+
|
|
729
|
+
it('ends a LIVE travel and stops there', async () => {
|
|
730
|
+
const { gate, calls } = gateFor({ clientPhase: 'streaming', worldPhase: 'ready' });
|
|
731
|
+
await expect(ensureHappyOysterWorldApiUnlocked(gate, noSleep)).resolves.toBe('travel_ended');
|
|
732
|
+
expect(calls.endTravelSession).toBe(1);
|
|
733
|
+
// Nothing to refresh: the world phase was never the arm holding the lock.
|
|
734
|
+
expect(calls.refreshWorldState).toBe(0);
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
it('KNOWN-BAD BUILD: refreshes the STALE world snapshot a completed travel leaves behind — ending the travel alone does not clear it', async () => {
|
|
738
|
+
const { gate, calls, state } = gateFor({
|
|
739
|
+
clientPhase: 'connected',
|
|
740
|
+
worldPhase: HAPPY_OYSTER_WORLD_PHASE_TRAVELING,
|
|
741
|
+
});
|
|
742
|
+
await expect(ensureHappyOysterWorldApiUnlocked(gate, noSleep)).resolves.toBe(
|
|
743
|
+
'state_refreshed',
|
|
744
|
+
);
|
|
745
|
+
expect(calls.endTravelSession).toBe(1);
|
|
746
|
+
expect(calls.refreshWorldState).toBe(1);
|
|
747
|
+
expect(state.worldPhase).toBe('ready');
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
it('reports `still_locked` rather than hanging or inventing a failure', async () => {
|
|
751
|
+
const gate = {
|
|
752
|
+
clientPhase: () => 'connected',
|
|
753
|
+
worldPhase: () => HAPPY_OYSTER_WORLD_PHASE_TRAVELING,
|
|
754
|
+
endTravelSession: async () => {},
|
|
755
|
+
refreshWorldState: async () => {},
|
|
756
|
+
};
|
|
757
|
+
let clock = 0;
|
|
758
|
+
await expect(
|
|
759
|
+
ensureHappyOysterWorldApiUnlocked(gate, {
|
|
760
|
+
waitMs: 10,
|
|
761
|
+
pollMs: 5,
|
|
762
|
+
now: () => clock,
|
|
763
|
+
sleep: async (ms: number) => {
|
|
764
|
+
clock += ms;
|
|
765
|
+
},
|
|
766
|
+
}),
|
|
767
|
+
).resolves.toBe('still_locked');
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
it('a FAILING vendor call leaves the lock instead of taking the entry down with it', async () => {
|
|
771
|
+
// `requestState` is a bare `sendCommand` and rejects on a session that has
|
|
772
|
+
// gone away. A launch that died there would report an unclassified
|
|
773
|
+
// transport error in place of the vendor's own travel-lock refusal — the
|
|
774
|
+
// one message that says what is actually wrong.
|
|
775
|
+
const state = { clientPhase: 'streaming', worldPhase: 'traveling' };
|
|
776
|
+
await expect(
|
|
777
|
+
ensureHappyOysterWorldApiUnlocked(
|
|
778
|
+
{
|
|
779
|
+
clientPhase: () => state.clientPhase,
|
|
780
|
+
worldPhase: () => state.worldPhase,
|
|
781
|
+
endTravelSession: async () => {
|
|
782
|
+
throw new Error('session is gone');
|
|
783
|
+
},
|
|
784
|
+
refreshWorldState: async () => {
|
|
785
|
+
throw new Error('not connected');
|
|
786
|
+
},
|
|
787
|
+
},
|
|
788
|
+
noSleep,
|
|
789
|
+
),
|
|
790
|
+
).resolves.toBe('still_locked');
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
it('a host with no refresh keeps the pre-WORLD.10 behaviour instead of throwing', async () => {
|
|
794
|
+
// `HappyOysterTravelLockGate.refreshWorldState` is optional because
|
|
795
|
+
// ../Web-App is pinned to a published version of this package.
|
|
796
|
+
await expect(
|
|
797
|
+
ensureHappyOysterWorldApiUnlocked({
|
|
798
|
+
clientPhase: () => 'connected',
|
|
799
|
+
worldPhase: () => HAPPY_OYSTER_WORLD_PHASE_TRAVELING,
|
|
800
|
+
endTravelSession: async () => {},
|
|
801
|
+
}),
|
|
802
|
+
).resolves.toBe('still_locked');
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
|
|
806
|
+
// ── §Q DM.78 — the launcher-level create lock ──────────────────────────────
|
|
807
|
+
//
|
|
808
|
+
// THE BUILD THIS GOES RED ON is every build since DM.77: a READY session is
|
|
809
|
+
// re-used, so two concurrent `create` launches on it BOTH reach `createWorld`
|
|
810
|
+
// and mint two permanent, billed worlds (before DM.77 the second died on the
|
|
811
|
+
// vendor's connect guard — by accident). `sessionBridge` models the vendor's
|
|
812
|
+
// session status; `createWorld` is held open with a gate so the second launch
|
|
813
|
+
// genuinely arrives while the first is in flight.
|
|
814
|
+
describe('launchHappyOysterWorld — §Q DM.78 one create per session', () => {
|
|
815
|
+
const CREATE = { kind: 'create' as const, prompt: 'A misty forest at dawn' };
|
|
816
|
+
const REOPEN = {
|
|
817
|
+
kind: 'reopen' as const,
|
|
818
|
+
handle: { encryptedWorldId: 'ew-abc123', mode: 'directing' as const },
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
/** A `createWorld` that resolves only when the test says so. */
|
|
822
|
+
function heldCreate(calls: string[]) {
|
|
823
|
+
let release: () => void = () => {};
|
|
824
|
+
const gate = new Promise<void>((resolve) => {
|
|
825
|
+
release = resolve;
|
|
826
|
+
});
|
|
827
|
+
const createWorld = async () => {
|
|
828
|
+
calls.push('createWorld');
|
|
829
|
+
await gate;
|
|
830
|
+
return READY;
|
|
831
|
+
};
|
|
832
|
+
return { createWorld, release: () => release() };
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/** A READY session whose next create is held open. */
|
|
836
|
+
async function readySession(sessionKey?: object) {
|
|
837
|
+
const bridge = sessionBridge(sessionKey === undefined ? {} : { sessionKey });
|
|
838
|
+
const held = heldCreate(bridge.calls);
|
|
839
|
+
bridge.createWorld = held.createWorld;
|
|
840
|
+
// Open the session the way a prior entry did, so both launches REUSE it.
|
|
841
|
+
await launchHappyOysterWorld(REOPEN, bridge, 'directing');
|
|
842
|
+
expect(bridge.status).toBe(HAPPY_OYSTER_SESSION_READY);
|
|
843
|
+
bridge.calls.length = 0;
|
|
844
|
+
return { bridge, held };
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/** Let an in-flight launch reach its (held) `createWorld`. */
|
|
848
|
+
const flush = async () => {
|
|
849
|
+
for (let i = 0; i < 5; i += 1) await Promise.resolve();
|
|
850
|
+
};
|
|
851
|
+
const creates = (calls: string[]) => calls.filter((c) => c === 'createWorld').length;
|
|
852
|
+
|
|
853
|
+
it('refuses a SECOND concurrent create on a ready session before it reaches createWorld', async () => {
|
|
854
|
+
const { bridge, held } = await readySession();
|
|
855
|
+
const first = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
856
|
+
await flush();
|
|
857
|
+
expect(bridge.calls).toEqual(['createWorld']);
|
|
858
|
+
|
|
859
|
+
// Started, then given every chance to reach the vendor BEFORE it is
|
|
860
|
+
// awaited: an unlocked launcher would be sitting in a second createWorld.
|
|
861
|
+
const second = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
862
|
+
second.catch(() => {});
|
|
863
|
+
await flush();
|
|
864
|
+
// ONE paid world, not two.
|
|
865
|
+
expect(creates(bridge.calls)).toBe(1);
|
|
866
|
+
await expect(second).rejects.toMatchObject({
|
|
867
|
+
name: 'HappyOysterLaunchError',
|
|
868
|
+
reason: 'invalid_request',
|
|
869
|
+
message: HAPPY_OYSTER_CREATE_IN_FLIGHT_MESSAGE,
|
|
870
|
+
// Nothing was created by the refused launch, so nothing is handed back.
|
|
871
|
+
handle: null,
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
held.release();
|
|
875
|
+
await expect(first).resolves.toMatchObject({ streaming: true });
|
|
876
|
+
// The lock is released once the holder settles: the next create runs.
|
|
877
|
+
bridge.createWorld = async () => {
|
|
878
|
+
bridge.calls.push('createWorld');
|
|
879
|
+
return READY;
|
|
880
|
+
};
|
|
881
|
+
await expect(launchHappyOysterWorld(CREATE, bridge, 'directing')).resolves.toMatchObject({
|
|
882
|
+
streaming: true,
|
|
883
|
+
});
|
|
884
|
+
expect(creates(bridge.calls)).toBe(2);
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
it('keys the lock on the SESSION, not the bridge object — a host that rebuilds its bridge every render is still covered', async () => {
|
|
888
|
+
const model = {};
|
|
889
|
+
const { bridge, held } = await readySession(model);
|
|
890
|
+
const first = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
891
|
+
await flush();
|
|
892
|
+
// A different bridge object over the same session (the DM pane's `useMemo`
|
|
893
|
+
// re-creates its bridge on every commit).
|
|
894
|
+
const rebuilt: HappyOysterBridge = { ...bridge, sessionKey: model };
|
|
895
|
+
const second = launchHappyOysterWorld(CREATE, rebuilt, 'directing');
|
|
896
|
+
second.catch(() => {});
|
|
897
|
+
await flush();
|
|
898
|
+
expect(creates(bridge.calls)).toBe(1);
|
|
899
|
+
await expect(second).rejects.toMatchObject({
|
|
900
|
+
message: HAPPY_OYSTER_CREATE_IN_FLIGHT_MESSAGE,
|
|
901
|
+
});
|
|
902
|
+
held.release();
|
|
903
|
+
await first;
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
it('does not serialise creates on DIFFERENT sessions', async () => {
|
|
907
|
+
const a = await readySession({});
|
|
908
|
+
const b = await readySession({});
|
|
909
|
+
const first = launchHappyOysterWorld(CREATE, a.bridge, 'directing');
|
|
910
|
+
const second = launchHappyOysterWorld(CREATE, b.bridge, 'directing');
|
|
911
|
+
await flush();
|
|
912
|
+
expect(a.bridge.calls).toEqual(['createWorld']);
|
|
913
|
+
expect(b.bridge.calls).toEqual(['createWorld']);
|
|
914
|
+
a.held.release();
|
|
915
|
+
b.held.release();
|
|
916
|
+
await expect(Promise.all([first, second])).resolves.toHaveLength(2);
|
|
917
|
+
});
|
|
918
|
+
|
|
919
|
+
it('refuses a REOPEN while a create is in flight — attaching would re-point the session under the create', async () => {
|
|
920
|
+
// `attachWorld` mints nothing, but it re-points the session's CURRENT
|
|
921
|
+
// world, and the create's own `startTravel` would then open the reopened
|
|
922
|
+
// world instead of the one it just paid for (codex on #2141).
|
|
923
|
+
const { bridge, held } = await readySession();
|
|
924
|
+
const first = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
925
|
+
await flush();
|
|
926
|
+
const reopen = launchHappyOysterWorld(REOPEN, bridge, 'directing');
|
|
927
|
+
reopen.catch(() => {});
|
|
928
|
+
await flush();
|
|
929
|
+
expect(bridge.calls).not.toContain('attachWorld');
|
|
930
|
+
await expect(reopen).rejects.toMatchObject({
|
|
931
|
+
message: HAPPY_OYSTER_CREATE_IN_FLIGHT_MESSAGE,
|
|
932
|
+
});
|
|
933
|
+
held.release();
|
|
934
|
+
await first;
|
|
935
|
+
// Once the create settled, a reopen runs as before.
|
|
936
|
+
await expect(launchHappyOysterWorld(REOPEN, bridge, 'directing')).resolves.toMatchObject({
|
|
937
|
+
streaming: true,
|
|
938
|
+
});
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
it('a holder whose SESSION IS GONE no longer holds the lock — and its late settle cannot free the new holder', async () => {
|
|
942
|
+
// §Q WORLD.24 — a create that never settles is ended by the hidden-world
|
|
943
|
+
// lifecycle's disconnect. A lock held forever would refuse every later
|
|
944
|
+
// create on that model for the rest of the page.
|
|
945
|
+
const { bridge, held } = await readySession();
|
|
946
|
+
const hung = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
947
|
+
await flush();
|
|
948
|
+
await bridge.disconnect?.();
|
|
949
|
+
expect(bridge.status).toBe(HAPPY_OYSTER_SESSION_DISCONNECTED);
|
|
950
|
+
|
|
951
|
+
// The next create reconnects and takes the lock.
|
|
952
|
+
const fresh = heldCreate(bridge.calls);
|
|
953
|
+
bridge.createWorld = fresh.createWorld;
|
|
954
|
+
const next = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
955
|
+
await flush();
|
|
956
|
+
expect(bridge.calls).toContain('connect');
|
|
957
|
+
expect(creates(bridge.calls)).toBe(2);
|
|
958
|
+
|
|
959
|
+
// The hung holder finally settles — it must not drive the session the new
|
|
960
|
+
// holder owns (no `startTravel`), it hands its minted world back, and it
|
|
961
|
+
// must not release the NEW holder's lock.
|
|
962
|
+
const travelsBefore = bridge.calls.filter((c) => c === 'startTravel').length;
|
|
963
|
+
held.release();
|
|
964
|
+
await expect(hung).rejects.toMatchObject({
|
|
965
|
+
name: 'HappyOysterLaunchError',
|
|
966
|
+
message: HAPPY_OYSTER_CREATE_SESSION_REPLACED_MESSAGE,
|
|
967
|
+
handle: { encryptedWorldId: READY.encrypted_world_id },
|
|
968
|
+
});
|
|
969
|
+
expect(bridge.calls.filter((c) => c === 'startTravel').length).toBe(travelsBefore);
|
|
970
|
+
const third = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
971
|
+
third.catch(() => {});
|
|
972
|
+
await flush();
|
|
973
|
+
expect(creates(bridge.calls)).toBe(2);
|
|
974
|
+
await expect(third).rejects.toMatchObject({
|
|
975
|
+
message: HAPPY_OYSTER_CREATE_IN_FLIGHT_MESSAGE,
|
|
976
|
+
});
|
|
977
|
+
fresh.release();
|
|
978
|
+
await next;
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
it('a REOPEN of a session whose create holder is gone voids the holder too — it cannot drive the reopened session, and later creates run', async () => {
|
|
982
|
+
// The reopen takes no lock, so it must still CLEAR the dead holder's entry:
|
|
983
|
+
// left in place, the dead holder's late settle would `startTravel` on the
|
|
984
|
+
// session the reopen owns, and once that session reads `ready` the stale
|
|
985
|
+
// entry would refuse every later create for the rest of the page.
|
|
986
|
+
const { bridge, held } = await readySession();
|
|
987
|
+
const hung = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
988
|
+
await flush();
|
|
989
|
+
await bridge.disconnect?.();
|
|
990
|
+
await expect(launchHappyOysterWorld(REOPEN, bridge, 'directing')).resolves.toMatchObject({
|
|
991
|
+
streaming: true,
|
|
992
|
+
});
|
|
993
|
+
const travelsBefore = bridge.calls.filter((c) => c === 'startTravel').length;
|
|
994
|
+
held.release();
|
|
995
|
+
await expect(hung).rejects.toMatchObject({
|
|
996
|
+
name: 'HappyOysterLaunchError',
|
|
997
|
+
handle: { encryptedWorldId: READY.encrypted_world_id },
|
|
998
|
+
});
|
|
999
|
+
expect(bridge.calls.filter((c) => c === 'startTravel').length).toBe(travelsBefore);
|
|
1000
|
+
bridge.createWorld = async () => {
|
|
1001
|
+
bridge.calls.push('createWorld');
|
|
1002
|
+
return READY;
|
|
1003
|
+
};
|
|
1004
|
+
await expect(launchHappyOysterWorld(CREATE, bridge, 'directing')).resolves.toMatchObject({
|
|
1005
|
+
streaming: true,
|
|
1006
|
+
});
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
it('a holder that has NOT CONNECTED yet still holds the lock, although the session reads disconnected', async () => {
|
|
1010
|
+
// Both "the holder's session is gone" and "the holder has not opened one
|
|
1011
|
+
// yet" read `disconnected`; only the first may be taken over.
|
|
1012
|
+
let open: () => void = () => {};
|
|
1013
|
+
const gate = new Promise<void>((resolve) => {
|
|
1014
|
+
open = resolve;
|
|
1015
|
+
});
|
|
1016
|
+
const calls: string[] = [];
|
|
1017
|
+
const bridge = stubBridge({
|
|
1018
|
+
sessionStatus: () => HAPPY_OYSTER_SESSION_DISCONNECTED,
|
|
1019
|
+
connect: async () => {
|
|
1020
|
+
calls.push('connect');
|
|
1021
|
+
await gate;
|
|
1022
|
+
},
|
|
1023
|
+
createWorld: async () => {
|
|
1024
|
+
calls.push('createWorld');
|
|
1025
|
+
return READY;
|
|
1026
|
+
},
|
|
1027
|
+
});
|
|
1028
|
+
const first = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
1029
|
+
await flush();
|
|
1030
|
+
const second = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
1031
|
+
second.catch(() => {});
|
|
1032
|
+
open();
|
|
1033
|
+
await first;
|
|
1034
|
+
await flush();
|
|
1035
|
+
expect(creates(calls)).toBe(1);
|
|
1036
|
+
await expect(second).rejects.toMatchObject({
|
|
1037
|
+
message: HAPPY_OYSTER_CREATE_IN_FLIGHT_MESSAGE,
|
|
1038
|
+
});
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
it('a session WEDGED on a refused connect is named by the vendor refusal, not hidden behind the create lock its hung holder pins', async () => {
|
|
1042
|
+
// Fable review on #2141: the lock refusal ran BEFORE the WORLD.17 wedged
|
|
1043
|
+
// check, so once a create's connect hung on a refusal every later launch
|
|
1044
|
+
// read "a world is still being created" instead of the credits refusal
|
|
1045
|
+
// that actually blocks the session.
|
|
1046
|
+
// The refusal text measured on the 2026-10-09 walk (WORLD.17).
|
|
1047
|
+
const CREDITS_402 =
|
|
1048
|
+
'Connection failed: Error: Failed to create session: 402 {"error":"credits_depleted","message":"Your credits have been depleted. Please add credits to continue.","url":"https://www.reactor.inc/dashboard/account?section=billing"}';
|
|
1049
|
+
let status: string = HAPPY_OYSTER_SESSION_DISCONNECTED;
|
|
1050
|
+
let lastError: { code: string; message: string } | null = null;
|
|
1051
|
+
const calls: string[] = [];
|
|
1052
|
+
const bridge = stubBridge({
|
|
1053
|
+
sessionStatus: () => status,
|
|
1054
|
+
connectionError: () => lastError,
|
|
1055
|
+
connect: () => {
|
|
1056
|
+
calls.push('connect');
|
|
1057
|
+
status = 'connecting';
|
|
1058
|
+
// The SDK never settles a refused connect (WORLD.17).
|
|
1059
|
+
return new Promise<void>(() => {});
|
|
1060
|
+
},
|
|
1061
|
+
});
|
|
1062
|
+
const hung = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
1063
|
+
hung.catch(() => {});
|
|
1064
|
+
await flush();
|
|
1065
|
+
// The refusal lands after the hung holder started connecting.
|
|
1066
|
+
lastError = { code: 'CONNECTION_FAILED', message: CREDITS_402 };
|
|
1067
|
+
|
|
1068
|
+
const second = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
1069
|
+
const err = (await second.catch((e: unknown) => e)) as HappyOysterLaunchError;
|
|
1070
|
+
expect(err).toBeInstanceOf(HappyOysterLaunchError);
|
|
1071
|
+
expect(err.message).toBe(CREDITS_402);
|
|
1072
|
+
expect(err.vendorRefusal?.kind).toBe('credits_depleted');
|
|
1073
|
+
expect(calls).toEqual(['connect']);
|
|
1074
|
+
});
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1077
|
+
// ── §Q DM.97 — the lock covers REOPENS too (DM.78 was one-sided) ───────────
|
|
1078
|
+
//
|
|
1079
|
+
// THE BUILD THIS GOES RED ON is DM.78's: a reopen was refused while a CREATE
|
|
1080
|
+
// held the session, but took no lock itself — so reopen→create and
|
|
1081
|
+
// reopen→reopen both reached the vendor while the first reopen's `attachWorld`
|
|
1082
|
+
// (or its `startTravel`) was still in flight, re-pointing the session's current
|
|
1083
|
+
// world under it. Either launch's `startTravel` could then enter the wrong
|
|
1084
|
+
// world, and the paid create could be minted but never entered.
|
|
1085
|
+
describe('launchHappyOysterWorld — §Q DM.97 one LAUNCH per session', () => {
|
|
1086
|
+
const CREATE = { kind: 'create' as const, prompt: 'A misty forest at dawn' };
|
|
1087
|
+
const REOPEN = {
|
|
1088
|
+
kind: 'reopen' as const,
|
|
1089
|
+
handle: { encryptedWorldId: 'ew-abc123', mode: 'directing' as const },
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
/** A bridge call that resolves only when the test says so. */
|
|
1093
|
+
function held<T>(calls: string[], name: string, value: T) {
|
|
1094
|
+
let release: () => void = () => {};
|
|
1095
|
+
const gate = new Promise<void>((resolve) => {
|
|
1096
|
+
release = resolve;
|
|
1097
|
+
});
|
|
1098
|
+
const call = async () => {
|
|
1099
|
+
calls.push(name);
|
|
1100
|
+
await gate;
|
|
1101
|
+
return value;
|
|
1102
|
+
};
|
|
1103
|
+
return { call, release: () => release() };
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
/** A READY session (opened by a prior, settled entry). */
|
|
1107
|
+
async function readySession() {
|
|
1108
|
+
const bridge = sessionBridge();
|
|
1109
|
+
await launchHappyOysterWorld(REOPEN, bridge, 'directing');
|
|
1110
|
+
expect(bridge.status).toBe(HAPPY_OYSTER_SESSION_READY);
|
|
1111
|
+
bridge.calls.length = 0;
|
|
1112
|
+
return bridge;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
const flush = async () => {
|
|
1116
|
+
for (let i = 0; i < 5; i += 1) await Promise.resolve();
|
|
1117
|
+
};
|
|
1118
|
+
const count = (calls: string[], name: string) => calls.filter((c) => c === name).length;
|
|
1119
|
+
|
|
1120
|
+
it('refuses a CREATE while a reopen is attaching — the paid create never reaches the vendor', async () => {
|
|
1121
|
+
const bridge = await readySession();
|
|
1122
|
+
const attach = held(bridge.calls, 'attachWorld', READY);
|
|
1123
|
+
bridge.attachWorld = attach.call;
|
|
1124
|
+
const reopen = launchHappyOysterWorld(REOPEN, bridge, 'directing');
|
|
1125
|
+
await flush();
|
|
1126
|
+
expect(bridge.calls).toEqual(['attachWorld']);
|
|
1127
|
+
|
|
1128
|
+
const create = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
1129
|
+
create.catch(() => {});
|
|
1130
|
+
await flush();
|
|
1131
|
+
// No paid world is minted under the reopen's in-flight attach.
|
|
1132
|
+
expect(count(bridge.calls, 'createWorld')).toBe(0);
|
|
1133
|
+
await expect(create).rejects.toMatchObject({
|
|
1134
|
+
name: 'HappyOysterLaunchError',
|
|
1135
|
+
reason: 'invalid_request',
|
|
1136
|
+
message: HAPPY_OYSTER_REOPEN_IN_FLIGHT_MESSAGE,
|
|
1137
|
+
handle: null,
|
|
1138
|
+
});
|
|
1139
|
+
|
|
1140
|
+
attach.release();
|
|
1141
|
+
await expect(reopen).resolves.toMatchObject({ streaming: true });
|
|
1142
|
+
// Released once the reopen settled: the create now runs.
|
|
1143
|
+
await expect(launchHappyOysterWorld(CREATE, bridge, 'directing')).resolves.toMatchObject({
|
|
1144
|
+
streaming: true,
|
|
1145
|
+
});
|
|
1146
|
+
expect(count(bridge.calls, 'createWorld')).toBe(1);
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1149
|
+
it('refuses a second REOPEN while the first is attaching', async () => {
|
|
1150
|
+
const bridge = await readySession();
|
|
1151
|
+
const attach = held(bridge.calls, 'attachWorld', READY);
|
|
1152
|
+
bridge.attachWorld = attach.call;
|
|
1153
|
+
const first = launchHappyOysterWorld(REOPEN, bridge, 'directing');
|
|
1154
|
+
await flush();
|
|
1155
|
+
const second = launchHappyOysterWorld(REOPEN, bridge, 'directing');
|
|
1156
|
+
second.catch(() => {});
|
|
1157
|
+
await flush();
|
|
1158
|
+
expect(count(bridge.calls, 'attachWorld')).toBe(1);
|
|
1159
|
+
await expect(second).rejects.toMatchObject({
|
|
1160
|
+
reason: 'invalid_request',
|
|
1161
|
+
message: HAPPY_OYSTER_REOPEN_IN_FLIGHT_MESSAGE,
|
|
1162
|
+
});
|
|
1163
|
+
attach.release();
|
|
1164
|
+
await expect(first).resolves.toMatchObject({ streaming: true });
|
|
1165
|
+
expect(count(bridge.calls, 'startTravel')).toBe(1);
|
|
1166
|
+
});
|
|
1167
|
+
|
|
1168
|
+
it('holds the lock THROUGH startTravel — the vendor travel lock engages only inside it', async () => {
|
|
1169
|
+
const bridge = await readySession();
|
|
1170
|
+
const travel = held(bridge.calls, 'startTravel', { streaming: true });
|
|
1171
|
+
bridge.startTravel = travel.call;
|
|
1172
|
+
const reopen = launchHappyOysterWorld(REOPEN, bridge, 'directing');
|
|
1173
|
+
await flush();
|
|
1174
|
+
expect(bridge.calls).toEqual(['attachWorld', 'startTravel']);
|
|
1175
|
+
|
|
1176
|
+
const create = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
1177
|
+
create.catch(() => {});
|
|
1178
|
+
await flush();
|
|
1179
|
+
expect(count(bridge.calls, 'createWorld')).toBe(0);
|
|
1180
|
+
await expect(create).rejects.toMatchObject({
|
|
1181
|
+
message: HAPPY_OYSTER_REOPEN_IN_FLIGHT_MESSAGE,
|
|
1182
|
+
});
|
|
1183
|
+
travel.release();
|
|
1184
|
+
await reopen;
|
|
1185
|
+
});
|
|
1186
|
+
|
|
1187
|
+
it('a create in flight still refuses a reopen with the CREATE copy (DM.78 unchanged)', async () => {
|
|
1188
|
+
const bridge = await readySession();
|
|
1189
|
+
const mint = held(bridge.calls, 'createWorld', READY);
|
|
1190
|
+
bridge.createWorld = mint.call;
|
|
1191
|
+
const create = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
1192
|
+
await flush();
|
|
1193
|
+
const reopen = launchHappyOysterWorld(REOPEN, bridge, 'directing');
|
|
1194
|
+
reopen.catch(() => {});
|
|
1195
|
+
await flush();
|
|
1196
|
+
expect(count(bridge.calls, 'attachWorld')).toBe(0);
|
|
1197
|
+
await expect(reopen).rejects.toMatchObject({
|
|
1198
|
+
message: HAPPY_OYSTER_CREATE_IN_FLIGHT_MESSAGE,
|
|
1199
|
+
});
|
|
1200
|
+
mint.release();
|
|
1201
|
+
await create;
|
|
1202
|
+
});
|
|
1203
|
+
|
|
1204
|
+
it('a reopen holder whose SESSION IS GONE is voided — its late settle never travels and cannot free the new holder', async () => {
|
|
1205
|
+
const bridge = await readySession();
|
|
1206
|
+
const attach = held(bridge.calls, 'attachWorld', READY);
|
|
1207
|
+
bridge.attachWorld = attach.call;
|
|
1208
|
+
const hung = launchHappyOysterWorld(REOPEN, bridge, 'directing');
|
|
1209
|
+
await flush();
|
|
1210
|
+
// §Q WORLD.24's hidden-world lifecycle ends the session under it.
|
|
1211
|
+
await bridge.disconnect?.();
|
|
1212
|
+
expect(bridge.status).toBe(HAPPY_OYSTER_SESSION_DISCONNECTED);
|
|
1213
|
+
|
|
1214
|
+
// The next create reconnects and takes the lock.
|
|
1215
|
+
const mint = held(bridge.calls, 'createWorld', READY);
|
|
1216
|
+
bridge.createWorld = mint.call;
|
|
1217
|
+
const next = launchHappyOysterWorld(CREATE, bridge, 'directing');
|
|
1218
|
+
await flush();
|
|
1219
|
+
expect(bridge.calls).toContain('connect');
|
|
1220
|
+
expect(count(bridge.calls, 'createWorld')).toBe(1);
|
|
1221
|
+
|
|
1222
|
+
const travelsBefore = count(bridge.calls, 'startTravel');
|
|
1223
|
+
attach.release();
|
|
1224
|
+
await expect(hung).rejects.toMatchObject({
|
|
1225
|
+
name: 'HappyOysterLaunchError',
|
|
1226
|
+
message: HAPPY_OYSTER_REOPEN_SESSION_REPLACED_MESSAGE,
|
|
1227
|
+
handle: { encryptedWorldId: READY.encrypted_world_id, mode: 'directing' },
|
|
1228
|
+
});
|
|
1229
|
+
// The dead reopen did not drive the session the create now owns.
|
|
1230
|
+
expect(count(bridge.calls, 'startTravel')).toBe(travelsBefore);
|
|
1231
|
+
// …and its settle did not release the create's lock.
|
|
1232
|
+
const third = launchHappyOysterWorld(REOPEN, bridge, 'directing');
|
|
1233
|
+
third.catch(() => {});
|
|
1234
|
+
await flush();
|
|
1235
|
+
await expect(third).rejects.toMatchObject({
|
|
1236
|
+
message: HAPPY_OYSTER_CREATE_IN_FLIGHT_MESSAGE,
|
|
1237
|
+
});
|
|
1238
|
+
mint.release();
|
|
1239
|
+
await expect(next).resolves.toMatchObject({ streaming: true });
|
|
1240
|
+
});
|
|
1241
|
+
});
|