@escapeaihq/client-core 0.52.0 → 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 +13 -0
- package/dist/conversation/binding.d.ts.map +1 -1
- 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 +44 -0
- package/dist/conversation/controller.d.ts.map +1 -1
- package/dist/conversation/controller.js +82 -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.map +1 -1
- package/dist/reactor/dmSceneControlPrompt.js +64 -2
- package/dist/reactor/dmSceneControlPrompt.js.map +1 -1
- 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 +19 -0
- package/dist/reactor/index.d.ts.map +1 -1
- package/dist/reactor/index.js +78 -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 +42 -3
- 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.map +1 -1
- package/dist/reactor/toolPromptAddon.js +16 -2
- 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 +273 -10
- package/dist/websocket.d.ts.map +1 -1
- package/dist/websocket.js +79 -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/chatSessionStore.test.ts +243 -0
- package/src/__tests__/conversation/controller.test.ts +211 -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 +79 -0
- 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-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-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 +13 -0
- package/src/conversation/chatSessionStore.ts +281 -0
- package/src/conversation/controller.ts +96 -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 +69 -2
- 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 +78 -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 +81 -3
- 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 +16 -2
- 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 +361 -12
- package/src/workflowAuthoring.ts +664 -0
|
@@ -0,0 +1,1698 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual-storyboard domain module (§Q SB-U.1, spec slice S1 —
|
|
3
|
+
* `specs/2026-07-24-storyboard-generator.md` §4.1/§4.5).
|
|
4
|
+
*
|
|
5
|
+
* Wire-type MIRROR of `shared/storyboard_models.py` (frozen by §Q SB.1,
|
|
6
|
+
* PR #1464) plus the §4.5 request surface. The BACKEND module is the single
|
|
7
|
+
* source of truth for this vocabulary: every union here is mirrored, never
|
|
8
|
+
* re-derived, and no consumer hard-codes a raw status/mode string. Additive-
|
|
9
|
+
* only, framework-agnostic (no React/Vue imports) — the `quests.ts`/
|
|
10
|
+
* `artifacts.ts` posture.
|
|
11
|
+
*
|
|
12
|
+
* Three shape decisions SB.1 PINNED, honoured here rather than re-litigated:
|
|
13
|
+
*
|
|
14
|
+
* 1. **Ordering lives ONLY in {@link Storyboard.frameIds}.** There is no
|
|
15
|
+
* per-frame `order` field and this module does not add one — a reorder is
|
|
16
|
+
* the single idempotent list patch
|
|
17
|
+
* {@link StoryboardsApi.reorderStoryboardFrames}, and
|
|
18
|
+
* {@link orderStoryboardFrames} is the ONE resolver that turns the id list
|
|
19
|
+
* into a rendered sequence.
|
|
20
|
+
* 2. **Frame status is DERIVED, never stored.** The backend computes it
|
|
21
|
+
* (`StoryboardFrame.status`, a pydantic `computed_field`) so it DOES ride
|
|
22
|
+
* the wire read-only; {@link deriveFrameStatus} mirrors the same rule for
|
|
23
|
+
* optimistic UI. Nothing client-side ever SENDS a frame status.
|
|
24
|
+
* 3. **Master frame is `1664×936` at exactly `16:9`**
|
|
25
|
+
* ({@link STORYBOARD_MASTER_FRAME_WIDTH}/{@link STORYBOARD_MASTER_FRAME_HEIGHT}/
|
|
26
|
+
* {@link STORYBOARD_MASTER_ASPECT_RATIO}). The old contradictory 1664×960
|
|
27
|
+
* appears nowhere — `StyleProfile` is REJECTED server-side when the declared
|
|
28
|
+
* ratio and the declared pixels disagree.
|
|
29
|
+
*
|
|
30
|
+
* `txnVer` is the store-owned optimistic-lock value. Clients never mint it:
|
|
31
|
+
* they read it off a frame and echo it back on the version-guarded writes
|
|
32
|
+
* ({@link StoryboardsApi.patchStoryboardFrame} /
|
|
33
|
+
* {@link StoryboardsApi.selectStoryboardFrameVariant}). Omitting it makes those
|
|
34
|
+
* calls last-writer-wins.
|
|
35
|
+
*
|
|
36
|
+
* Land-dark: the whole backend surface 404s until `SEER_STORYBOARD_ENABLED` is
|
|
37
|
+
* set server-side (SB.4 ships the routes; SB.15 flips staging). As of this
|
|
38
|
+
* slice NO storyboard route exists yet — this module is the contract every
|
|
39
|
+
* SB-U row builds against.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
import type { Transport } from '../transport';
|
|
43
|
+
import type { CameraPose } from '../storyboardMask';
|
|
44
|
+
import type { GateExpr } from './quests';
|
|
45
|
+
import type { HappyOysterMode } from '../reactor/happyOysterWorld';
|
|
46
|
+
|
|
47
|
+
// ------------------------------------------------------------------- enums
|
|
48
|
+
|
|
49
|
+
/** Board lifecycle (mirrors backend `StoryboardStatus`). */
|
|
50
|
+
export type StoryboardStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
51
|
+
|
|
52
|
+
/** Statuses no transition may leave (mirrors `STORYBOARD_TERMINAL_STATUSES`). */
|
|
53
|
+
export const STORYBOARD_TERMINAL_STATUSES: readonly StoryboardStatus[] = [
|
|
54
|
+
'succeeded',
|
|
55
|
+
'failed',
|
|
56
|
+
'cancelled',
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
/** Poll predicate for the 202-create flow — prefer this over raw comparisons. */
|
|
60
|
+
export function isStoryboardTerminal(status: StoryboardStatus): boolean {
|
|
61
|
+
return STORYBOARD_TERMINAL_STATUSES.includes(status);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Whether the board matches the source film or restyles it (`StyleMode`). */
|
|
65
|
+
export type StoryboardStyleMode = 'original_similar' | 'restyled';
|
|
66
|
+
|
|
67
|
+
/** How a frame enters — compiles to LongLive `set_shot` vs `scene_cut`. */
|
|
68
|
+
export type ShotTransition = 'soft_shot' | 'hard_cut';
|
|
69
|
+
|
|
70
|
+
/** One generation attempt's outcome (`VariantStatus`). */
|
|
71
|
+
export type FrameVariantStatus = 'pending' | 'succeeded' | 'failed';
|
|
72
|
+
|
|
73
|
+
/** Which surface produced a variant (`VariantOrigin`). */
|
|
74
|
+
export type FrameVariantOrigin = 'generate' | 'regenerate' | 'region_edit';
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* DERIVED frame state (`FrameStatus`) — computed from the variant list by
|
|
78
|
+
* {@link deriveFrameStatus}, never authored by a client.
|
|
79
|
+
*/
|
|
80
|
+
export type StoryboardFrameStatus = 'pending' | 'running' | 'succeeded' | 'failed';
|
|
81
|
+
|
|
82
|
+
// --------------------------------------------------------------- constants
|
|
83
|
+
|
|
84
|
+
/** Canonical master-frame width in pixels (`MASTER_FRAME_WIDTH`). */
|
|
85
|
+
export const STORYBOARD_MASTER_FRAME_WIDTH = 1664;
|
|
86
|
+
/** Canonical master-frame height — 1664 × 9/16, exactly 16:9 (`MASTER_FRAME_HEIGHT`). */
|
|
87
|
+
export const STORYBOARD_MASTER_FRAME_HEIGHT = 936;
|
|
88
|
+
/** The ONE aspect ratio v1 boards render at, `"W:H"` (`MASTER_ASPECT_RATIO`). */
|
|
89
|
+
export const STORYBOARD_MASTER_ASPECT_RATIO = '16:9';
|
|
90
|
+
|
|
91
|
+
/** Max frames one board may hold (`MAX_FRAMES_PER_BOARD`). */
|
|
92
|
+
export const MAX_FRAMES_PER_BOARD = 24;
|
|
93
|
+
/** Variant history kept per frame (`VARIANT_HISTORY_CAP`); overflow evicts the
|
|
94
|
+
* oldest NON-SELECTED variant server-side. */
|
|
95
|
+
export const FRAME_VARIANT_HISTORY_CAP = 8;
|
|
96
|
+
/** Marble multi-view degrees cap — ≤8 in reconstruction mode
|
|
97
|
+
* (`MULTI_VIEW_AZIMUTH_CAP`). */
|
|
98
|
+
export const MULTI_VIEW_AZIMUTH_CAP = 8;
|
|
99
|
+
|
|
100
|
+
/** Per-frame clip length; Veo 3.1's documented set is the binding constraint. */
|
|
101
|
+
export type FrameDurationSeconds = 4 | 6 | 8;
|
|
102
|
+
/** The same set as data, for pickers and validation messages
|
|
103
|
+
* (`FRAME_DURATION_CHOICES`). */
|
|
104
|
+
export const FRAME_DURATION_CHOICES: readonly FrameDurationSeconds[] = [4, 6, 8];
|
|
105
|
+
/** Our default when the composer does not choose (`DEFAULT_FRAME_DURATION_SECONDS`). */
|
|
106
|
+
export const DEFAULT_FRAME_DURATION_SECONDS: FrameDurationSeconds = 6;
|
|
107
|
+
|
|
108
|
+
/** Per-tag length cap (`STYLE_TAG_MAX_LEN`) — the editor's own bound. */
|
|
109
|
+
export const STORYBOARD_STYLE_TAG_MAX_LEN = 64;
|
|
110
|
+
/** Style-tag count cap (`STYLE_TAGS_MAX`). */
|
|
111
|
+
export const STORYBOARD_STYLE_TAGS_MAX = 12;
|
|
112
|
+
/** Free-text prompt-field cap (`PROMPT_TEXT_MAX_LEN`). */
|
|
113
|
+
export const STORYBOARD_PROMPT_TEXT_MAX_LEN = 2000;
|
|
114
|
+
/** Dialogue-line count cap (`DIALOG_LINES_MAX`). */
|
|
115
|
+
export const STORYBOARD_DIALOG_LINES_MAX = 12;
|
|
116
|
+
/** Per-list reference cap for `characterRefs`/`settingRefs` (`FRAME_REFS_MAX`). */
|
|
117
|
+
export const STORYBOARD_FRAME_REFS_MAX = 12;
|
|
118
|
+
|
|
119
|
+
// ------------------------------------------------------------- spend preview
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* What generating a board from one arc variant will actually SPEND, in the only
|
|
123
|
+
* unit this product can state honestly: images.
|
|
124
|
+
*
|
|
125
|
+
* §Q `SB.22` — generation is PAID and irreversible, so no surface may fire it
|
|
126
|
+
* without first telling the creator how much work it commits. There is no
|
|
127
|
+
* per-image price anywhere in the catalogue (`shared/image_model_registry.py`
|
|
128
|
+
* carries capabilities, not dollars) and `Storyboard.costUsd` is written by the
|
|
129
|
+
* worker AFTER the fact, so a dollar figure here would be invented. The FRAME
|
|
130
|
+
* COUNT is not invented: it is exactly what the planner will draw.
|
|
131
|
+
*/
|
|
132
|
+
export interface StoryboardFrameBudget {
|
|
133
|
+
/** Beats + endings the plan will walk — one candidate frame each. */
|
|
134
|
+
nodeCount: number;
|
|
135
|
+
/** Images that will actually be generated (`nodeCount` under the cap). */
|
|
136
|
+
frameCount: number;
|
|
137
|
+
/** True when {@link MAX_FRAMES_PER_BOARD} truncated the plan. */
|
|
138
|
+
capped: boolean;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The frame budget an arc variant would generate — mirror of the backend's
|
|
143
|
+
* frame planner (`services/storyboard/worker.py` `_plan_frames`), which walks
|
|
144
|
+
* `topological_node_order(variant)` (beats then endings — EVERY beat and EVERY
|
|
145
|
+
* ending, in a stable order) and stops at {@link MAX_FRAMES_PER_BOARD}.
|
|
146
|
+
*
|
|
147
|
+
* Only the COUNT is mirrored, never the ordering: the count is order-invariant,
|
|
148
|
+
* so this cannot drift from the planner the way a re-implemented topological
|
|
149
|
+
* sort would. Structurally typed rather than taking `ArcVariant` so the
|
|
150
|
+
* storyboard module keeps its one-way dependency (arcs types live in `api.ts`,
|
|
151
|
+
* which imports this module).
|
|
152
|
+
*/
|
|
153
|
+
export function storyboardFrameBudget(variant: {
|
|
154
|
+
beats: readonly unknown[];
|
|
155
|
+
endings: readonly unknown[];
|
|
156
|
+
}): StoryboardFrameBudget {
|
|
157
|
+
const nodeCount = variant.beats.length + variant.endings.length;
|
|
158
|
+
return {
|
|
159
|
+
nodeCount,
|
|
160
|
+
frameCount: Math.min(nodeCount, MAX_FRAMES_PER_BOARD),
|
|
161
|
+
capped: nodeCount > MAX_FRAMES_PER_BOARD,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ------------------------------------------------------------------ shapes
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Board-wide look + the master geometry every frame is generated at (mirrors
|
|
169
|
+
* backend `StyleProfile`). The backend REJECTS a profile whose
|
|
170
|
+
* {@link StyleProfile.aspectRatio} disagrees with the master pixels, so a UI
|
|
171
|
+
* that offers a custom master must keep the two in step.
|
|
172
|
+
*/
|
|
173
|
+
export interface StyleProfile {
|
|
174
|
+
mode: StoryboardStyleMode;
|
|
175
|
+
/** Short look descriptors folded into every frame prompt. */
|
|
176
|
+
styleTags: string[];
|
|
177
|
+
/** Free-text art direction applied board-wide. */
|
|
178
|
+
styleDirection?: string | null;
|
|
179
|
+
/** Frame aspect as `"W:H"` — must agree with the master pixels. */
|
|
180
|
+
aspectRatio: string;
|
|
181
|
+
masterWidth: number;
|
|
182
|
+
masterHeight: number;
|
|
183
|
+
/** Board-wide generation seed — the consistency-v1 anchor. */
|
|
184
|
+
boardSeed?: number | null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// --------------------------------------------------------- board-style pick
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* What a creator picked on an arc-generate surface (§Q `BOARD.5`).
|
|
191
|
+
*
|
|
192
|
+
* The UI holds tags and direction across a mode flip so a mis-click does not
|
|
193
|
+
* erase typing; {@link buildArcStyleProfile} is what decides they are only
|
|
194
|
+
* SENT on the restyled arm.
|
|
195
|
+
*/
|
|
196
|
+
export interface ArcStyleSelection {
|
|
197
|
+
mode: StoryboardStyleMode;
|
|
198
|
+
/** Look descriptors, as typed — unnormalized. */
|
|
199
|
+
styleTags?: readonly string[];
|
|
200
|
+
/** Free-text art direction, as typed. */
|
|
201
|
+
styleDirection?: string | null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** The default a surface starts on — identical to what the backend assumes. */
|
|
205
|
+
export const DEFAULT_ARC_STYLE_SELECTION: ArcStyleSelection = {
|
|
206
|
+
mode: 'original_similar',
|
|
207
|
+
styleTags: [],
|
|
208
|
+
styleDirection: '',
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Trim, drop blanks, and de-duplicate style tags, preserving typed order.
|
|
213
|
+
*
|
|
214
|
+
* De-duplication is case-SENSITIVE on purpose: the backend folds tags into
|
|
215
|
+
* frame prompts verbatim, so `"Noir"` and `"noir"` are two different words to
|
|
216
|
+
* the image model and collapsing them would silently edit the creator's look.
|
|
217
|
+
* It only removes an exact repeat, which is always a typo.
|
|
218
|
+
*/
|
|
219
|
+
export function normalizeArcStyleTags(tags: readonly string[] | undefined): string[] {
|
|
220
|
+
const seen = new Set<string>();
|
|
221
|
+
const out: string[] = [];
|
|
222
|
+
for (const raw of tags ?? []) {
|
|
223
|
+
const tag = String(raw ?? '').trim();
|
|
224
|
+
if (tag === '' || seen.has(tag)) continue;
|
|
225
|
+
seen.add(tag);
|
|
226
|
+
out.push(tag);
|
|
227
|
+
}
|
|
228
|
+
return out;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Length in CODE POINTS, which is what the backend counts.
|
|
233
|
+
*
|
|
234
|
+
* `String.length` counts UTF-16 code units, so a 64-emoji tag measures 128 here
|
|
235
|
+
* and 64 in pydantic — the client would reject a value the server accepts. The
|
|
236
|
+
* error direction is safe (a false block, not a false send) and it is still a
|
|
237
|
+
* false gate on a creator's own text (codex, this PR).
|
|
238
|
+
*/
|
|
239
|
+
function codePointLength(text: string): number {
|
|
240
|
+
return [...text].length;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Why this selection would 422, or `null` when it is sendable.
|
|
245
|
+
*
|
|
246
|
+
* The caps are the backend's (`STYLE_TAGS_MAX`, `STYLE_TAG_MAX_LEN`,
|
|
247
|
+
* `PROMPT_TEXT_MAX_LEN`) and they are checked HERE rather than left to the
|
|
248
|
+
* server because `StyleProfile` validation happens at ARC GENERATION — a 422
|
|
249
|
+
* there loses the whole request, not just the style.
|
|
250
|
+
*
|
|
251
|
+
* The `original_similar` arm never fails: {@link buildArcStyleProfile} sends
|
|
252
|
+
* nothing on it, so an over-cap tag the creator typed and then abandoned
|
|
253
|
+
* cannot block a generate.
|
|
254
|
+
*/
|
|
255
|
+
export function arcStyleSelectionError(selection: ArcStyleSelection): string | null {
|
|
256
|
+
if (selection.mode === 'original_similar') return null;
|
|
257
|
+
const tags = normalizeArcStyleTags(selection.styleTags);
|
|
258
|
+
if (tags.length > STORYBOARD_STYLE_TAGS_MAX) {
|
|
259
|
+
return `Use at most ${STORYBOARD_STYLE_TAGS_MAX} style tags (you have ${tags.length}).`;
|
|
260
|
+
}
|
|
261
|
+
const tooLong = tags.find((tag) => codePointLength(tag) > STORYBOARD_STYLE_TAG_MAX_LEN);
|
|
262
|
+
if (tooLong !== undefined) {
|
|
263
|
+
return `Each style tag must be ${STORYBOARD_STYLE_TAG_MAX_LEN} characters or fewer — "${tooLong.slice(0, 24)}…" is ${codePointLength(tooLong)}.`;
|
|
264
|
+
}
|
|
265
|
+
const direction = (selection.styleDirection ?? '').trim();
|
|
266
|
+
if (codePointLength(direction) > STORYBOARD_PROMPT_TEXT_MAX_LEN) {
|
|
267
|
+
return `Art direction must be ${STORYBOARD_PROMPT_TEXT_MAX_LEN} characters or fewer (you have ${codePointLength(direction)}).`;
|
|
268
|
+
}
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The `styleProfile` partial to put on a `GenerateArcRequest`, or `undefined`
|
|
274
|
+
* to OMIT the key entirely (§Q `BOARD.5`).
|
|
275
|
+
*
|
|
276
|
+
* ⛔ **THE DEFAULT ARM RETURNS `undefined`, NOT A NEUTRAL PROFILE.** Every
|
|
277
|
+
* arc-generate surface omitted the key before this row, and the backend's
|
|
278
|
+
* `StyleProfile()` defaults ARE `original_similar` with no tags — so omitting
|
|
279
|
+
* keeps an unstyled generate byte-identical to what shipped, which is the
|
|
280
|
+
* only way to be sure this row changed nothing for a creator who ignores it.
|
|
281
|
+
* ⚠ The reason is NOT that a sent key would 422: `styleProfile` is a declared
|
|
282
|
+
* optional field and `{}` validates straight through to those same defaults
|
|
283
|
+
* (codex corrected an earlier claim here that blamed `extra="forbid"`; that
|
|
284
|
+
* setting rejects UNDECLARED keys, which this is not). The reason is that a
|
|
285
|
+
* proposal recording an explicit profile and one recording "the creator did
|
|
286
|
+
* not choose" are different facts, and only the second is true here.
|
|
287
|
+
*
|
|
288
|
+
* ⛔ **THE `original_similar` ARM DROPS TAGS AND DIRECTION.** The backend's
|
|
289
|
+
* `sheet_style_recipe` treats a profile as STYLIZED when it carries tags or
|
|
290
|
+
* direction *regardless of mode*, so forwarding text a creator typed and then
|
|
291
|
+
* switched away from would quietly buy a stylized board they de-selected.
|
|
292
|
+
*
|
|
293
|
+
* ⛔ **GEOMETRY IS NEVER SENT.** `aspectRatio`/`masterWidth`/`masterHeight`
|
|
294
|
+
* must agree with each other or the backend 422s the ARC REQUEST (not the
|
|
295
|
+
* board), and this surface offers no master control — so the server's own
|
|
296
|
+
* defaults are the only correct source. `boardSeed` is likewise not a
|
|
297
|
+
* creator-facing choice here.
|
|
298
|
+
*
|
|
299
|
+
* A restyled pick with neither tags nor direction still sends `{mode}`: mode
|
|
300
|
+
* alone is meaningful to `sheet_style_recipe`, not a no-op.
|
|
301
|
+
*/
|
|
302
|
+
export function buildArcStyleProfile(
|
|
303
|
+
selection: ArcStyleSelection,
|
|
304
|
+
): Partial<StyleProfile> | undefined {
|
|
305
|
+
if (selection.mode !== 'restyled') return undefined;
|
|
306
|
+
const styleTags = normalizeArcStyleTags(selection.styleTags);
|
|
307
|
+
const styleDirection = (selection.styleDirection ?? '').trim();
|
|
308
|
+
return {
|
|
309
|
+
mode: 'restyled',
|
|
310
|
+
...(styleTags.length > 0 ? { styleTags } : {}),
|
|
311
|
+
...(styleDirection !== '' ? { styleDirection } : {}),
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* The `styleProfile` key spread straight into a `GenerateArcRequest` literal —
|
|
317
|
+
* `{}` on the default arm, so the request object is byte-identical to the
|
|
318
|
+
* pre-`BOARD.5` payload. One helper so no surface re-derives the omit rule.
|
|
319
|
+
*/
|
|
320
|
+
export function arcStyleProfileField(
|
|
321
|
+
selection: ArcStyleSelection,
|
|
322
|
+
): { styleProfile?: Partial<StyleProfile> } {
|
|
323
|
+
const profile = buildArcStyleProfile(selection);
|
|
324
|
+
return profile === undefined ? {} : { styleProfile: profile };
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* The structured prompt (mirrors backend `FramePrompt`) — self-sufficient
|
|
329
|
+
* because LongLive takes TEXT ONLY. The flattener `compiled_text()` stays
|
|
330
|
+
* SERVER-SIDE by design (it is the single source of the string every adapter
|
|
331
|
+
* and export target sends); the compiled result reaches the client as
|
|
332
|
+
* {@link StoryboardFrameVariant.promptText} provenance.
|
|
333
|
+
*/
|
|
334
|
+
export interface FramePrompt {
|
|
335
|
+
sceneDescription: string;
|
|
336
|
+
/** Cast described IN WORDS (identity survives text-only targets). */
|
|
337
|
+
charactersInWords: string[];
|
|
338
|
+
action: string;
|
|
339
|
+
/** The camera leg every live target actually reads (SB-U.2's prose). */
|
|
340
|
+
cameraProse: string;
|
|
341
|
+
styleTags: string[];
|
|
342
|
+
dialogLines: string[];
|
|
343
|
+
negative?: string | null;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** One reference image fed to a multi-reference adapter (`FrameRef`). */
|
|
347
|
+
export interface StoryboardFrameRef {
|
|
348
|
+
/** Cast member or setting name. */
|
|
349
|
+
entity: string;
|
|
350
|
+
imageId: string;
|
|
351
|
+
/** Stylized companion — Seedance rejects photoreal-face references. */
|
|
352
|
+
stylizedImageId?: string | null;
|
|
353
|
+
/** 1-based `@ImageN` address; null ⇒ the ref is unaddressed. */
|
|
354
|
+
imageSlot?: number | null;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** One generation ATTEMPT and its provenance (`FrameVariant`, history cap 8). */
|
|
358
|
+
export interface StoryboardFrameVariant {
|
|
359
|
+
variantId: string;
|
|
360
|
+
status: FrameVariantStatus;
|
|
361
|
+
origin: FrameVariantOrigin;
|
|
362
|
+
/** S3 key (`shared.s3_keys.storyboard_frame_key`) — not directly fetchable. */
|
|
363
|
+
imageKey?: string | null;
|
|
364
|
+
/** S3 key of the region-edit mask, when `origin` is `region_edit`. */
|
|
365
|
+
maskKey?: string | null;
|
|
366
|
+
modelId?: string | null;
|
|
367
|
+
seed?: number | null;
|
|
368
|
+
/** The compiled prompt actually sent — regeneration provenance. */
|
|
369
|
+
promptText?: string | null;
|
|
370
|
+
error?: string | null;
|
|
371
|
+
/** ISO-8601. */
|
|
372
|
+
createdAt: string;
|
|
373
|
+
completedAt?: string | null;
|
|
374
|
+
/**
|
|
375
|
+
* Presigned URL for {@link StoryboardFrameVariant.imageKey}, attached by the
|
|
376
|
+
* DETAIL read only (spec §4.5 "detail + presigned frame URLs"); it is not a
|
|
377
|
+
* stored field and never rides a write. Absent until SB.4 ships the route.
|
|
378
|
+
*/
|
|
379
|
+
imageUrl?: string | null;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/** Per-target extras the lowest-common-denominator frame cannot carry (§5). */
|
|
383
|
+
export interface FrameExtensions {
|
|
384
|
+
lastFrameImageKey?: string | null;
|
|
385
|
+
/** Helios seed adherence, `[0, 1]`. */
|
|
386
|
+
imageStrength?: number | null;
|
|
387
|
+
/** Marble multi-view degrees (≤{@link MULTI_VIEW_AZIMUTH_CAP}). */
|
|
388
|
+
multiViewAzimuths: number[];
|
|
389
|
+
/** SAM-3D per-object lift requested. Wire key is `lift3D` (backend
|
|
390
|
+
* `lift_3d` through pydantic `to_camel`) — note the capital D. */
|
|
391
|
+
lift3D: boolean;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* One board frame (mirrors backend `StoryboardFrame`). Carries NO `videoId`/
|
|
396
|
+
* `historyScopeId` — those live on the board. There is deliberately **no
|
|
397
|
+
* `order` field**: position is this frame's index in
|
|
398
|
+
* {@link Storyboard.frameIds} (use {@link orderStoryboardFrames}).
|
|
399
|
+
*/
|
|
400
|
+
export interface StoryboardFrame {
|
|
401
|
+
storyboardId: string;
|
|
402
|
+
frameId: string;
|
|
403
|
+
/**
|
|
404
|
+
* Join key → the PlotBeat node id, which is also the quests'
|
|
405
|
+
* `sourceBeatId` — this is what makes the quest view a JOIN rather than a
|
|
406
|
+
* second projection (spec §4.5).
|
|
407
|
+
*/
|
|
408
|
+
beatId?: string | null;
|
|
409
|
+
/**
|
|
410
|
+
* The `PlotBeat` id this frame's beat carries IN THE GRAPH (§Q SB.92 /
|
|
411
|
+
* DM.105) — the id a cutscene for this frame posts as `beatId`, with the
|
|
412
|
+
* detail read's {@link StoryboardDetailResponse.graphStoryId} as `storyId`.
|
|
413
|
+
*
|
|
414
|
+
* ⛔ NOT {@link StoryboardFrame.beatId}: that id is hashed in the BOARD's
|
|
415
|
+
* scope (the video), which on a fork-approved arc is not where the arc's
|
|
416
|
+
* nodes live — every cutscene posted with it 404'd "PlotBeat not found"
|
|
417
|
+
* (measured 2026-10-19, 0 of 42 frames on three stories). Served only by a
|
|
418
|
+
* detail read whose {@link StoryboardDetailResponse.graphResolution} is
|
|
419
|
+
* `resolved`; `null`/absent otherwise.
|
|
420
|
+
*/
|
|
421
|
+
graphBeatId?: string | null;
|
|
422
|
+
anchorSceneId?: string | null;
|
|
423
|
+
/** Scene grouping — a change implies a cut. */
|
|
424
|
+
sequenceId?: string | null;
|
|
425
|
+
shotTransition: ShotTransition;
|
|
426
|
+
durationSeconds: FrameDurationSeconds;
|
|
427
|
+
prompt: FramePrompt;
|
|
428
|
+
/**
|
|
429
|
+
* The parametric camera leg — the SAME shape as client-core's
|
|
430
|
+
* {@link CameraPose} (`storyboardMask.ts`), reused rather than redefined.
|
|
431
|
+
* Authoring intent only: no live target consumes a 6-DoF pose today, it
|
|
432
|
+
* compiles to {@link FramePrompt.cameraProse}.
|
|
433
|
+
*/
|
|
434
|
+
cameraPose?: CameraPose | null;
|
|
435
|
+
characterRefs: StoryboardFrameRef[];
|
|
436
|
+
settingRefs: StoryboardFrameRef[];
|
|
437
|
+
/**
|
|
438
|
+
* The cast names this frame ASKED for, in roster order (§Q SB.41).
|
|
439
|
+
*
|
|
440
|
+
* With {@link StoryboardFrame.characterRefs} and
|
|
441
|
+
* {@link StoryboardFrame.unresolvedCast} it makes cast coverage answerable —
|
|
442
|
+
* "3 of 4 cast resolved, and here is the one that is missing".
|
|
443
|
+
*/
|
|
444
|
+
requestedCast?: string[];
|
|
445
|
+
/**
|
|
446
|
+
* Requested cast members that resolved to NO reference image (§Q SB.41).
|
|
447
|
+
*
|
|
448
|
+
* A missing FIRST-BILLED character used to be invisible: on the `star-wars`
|
|
449
|
+
* board every beat named "Jedi Orin", every frame shipped without him, and
|
|
450
|
+
* the board reported success. Surface this — a frame that silently omits the
|
|
451
|
+
* character its beat is about is the defect, not the reporting.
|
|
452
|
+
*
|
|
453
|
+
* Absent on frames written before SB.41; treat that as UNKNOWN coverage
|
|
454
|
+
* rather than "nothing was missing".
|
|
455
|
+
*/
|
|
456
|
+
unresolvedCast?: string[];
|
|
457
|
+
variants: StoryboardFrameVariant[];
|
|
458
|
+
selectedVariantId?: string | null;
|
|
459
|
+
extensions: FrameExtensions;
|
|
460
|
+
seed?: number | null;
|
|
461
|
+
audioEnabled: boolean;
|
|
462
|
+
/** Persisted HappyOyster `encrypted_world_id` once a world exists (SB-W.*). */
|
|
463
|
+
worldId?: string | null;
|
|
464
|
+
/**
|
|
465
|
+
* The mode-fixed HappyOyster model that OWNS {@link StoryboardFrame.worldId}
|
|
466
|
+
* (§Q DM.30). Required to reopen the world — `attachWorld` rejects the other
|
|
467
|
+
* mode's worlds with `MODE_MISMATCH`, so a bare id is not a usable handle.
|
|
468
|
+
*
|
|
469
|
+
* `null`/absent on frames bound before DM.30, and a reader must treat that as
|
|
470
|
+
* UNKNOWN rather than assume its own mode: assuming is exactly how the
|
|
471
|
+
* pre-flight in `launchHappyOysterWorld` was made unreachable.
|
|
472
|
+
*/
|
|
473
|
+
worldMode?: HappyOysterMode | null;
|
|
474
|
+
/**
|
|
475
|
+
* §Q MOMENT.8 — permanent worlds this frame USED to open into, oldest first.
|
|
476
|
+
*
|
|
477
|
+
* A HappyOyster world cannot be reseeded and cannot be deleted, so
|
|
478
|
+
* "regenerate this world" means REPLACEMENT: the new id becomes
|
|
479
|
+
* {@link StoryboardFrame.worldId} and the old one moves here. Every id in the
|
|
480
|
+
* list is still billed and still reachable via `attachWorld` — the ledger is
|
|
481
|
+
* what keeps it so, which is why nothing drops one.
|
|
482
|
+
*
|
|
483
|
+
* Absent on frames written before MOMENT.8; treat that as "never superseded".
|
|
484
|
+
*/
|
|
485
|
+
supersededWorldIds?: string[];
|
|
486
|
+
createdAt: string;
|
|
487
|
+
updatedAt?: string | null;
|
|
488
|
+
editedAt?: string | null;
|
|
489
|
+
editedBy?: string | null;
|
|
490
|
+
/**
|
|
491
|
+
* SERVER-DERIVED from {@link StoryboardFrame.variants} — never stored and
|
|
492
|
+
* never sent by a client. {@link deriveFrameStatus} is the same rule for
|
|
493
|
+
* optimistic rendering between a write and its refetch.
|
|
494
|
+
*/
|
|
495
|
+
readonly status: StoryboardFrameStatus;
|
|
496
|
+
/**
|
|
497
|
+
* Store-owned optimistic-lock value. Echo it back on
|
|
498
|
+
* {@link StoryboardsApi.patchStoryboardFrame} /
|
|
499
|
+
* {@link StoryboardsApi.selectStoryboardFrameVariant}; never mint it.
|
|
500
|
+
*/
|
|
501
|
+
txnVer?: number | null;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* One board — the `META` item (mirrors backend `Storyboard`). List reads
|
|
506
|
+
* return exactly this (no frames); {@link Storyboard.frameIds} is the ordering
|
|
507
|
+
* source of truth AND the frame count.
|
|
508
|
+
*/
|
|
509
|
+
export interface Storyboard {
|
|
510
|
+
storyboardId: string;
|
|
511
|
+
/** Owning story — `storyId` IS `videoId`. */
|
|
512
|
+
videoId: string;
|
|
513
|
+
/** Source arc proposal. */
|
|
514
|
+
proposalId?: string | null;
|
|
515
|
+
/** Source arc variant. */
|
|
516
|
+
variantId?: string | null;
|
|
517
|
+
status: StoryboardStatus;
|
|
518
|
+
styleProfile: StyleProfile;
|
|
519
|
+
/** ORDERING SOURCE OF TRUTH — a reorder is a list patch here (≤24). */
|
|
520
|
+
frameIds: string[];
|
|
521
|
+
modelId?: string | null;
|
|
522
|
+
/**
|
|
523
|
+
* EVERY composition model the board generates against, in the order the
|
|
524
|
+
* creator asked for (§Q SB.54). `modelId` is the PRIMARY — `modelIds[0]`.
|
|
525
|
+
*
|
|
526
|
+
* Absent or empty on every board created before SB.54, which is exactly the
|
|
527
|
+
* single-model case: read it as `modelIds?.length ? modelIds : [modelId]`.
|
|
528
|
+
*/
|
|
529
|
+
modelIds?: string[] | null;
|
|
530
|
+
fallbackModelId?: string | null;
|
|
531
|
+
costUsd: number;
|
|
532
|
+
error?: string | null;
|
|
533
|
+
createdAt: string;
|
|
534
|
+
updatedAt?: string | null;
|
|
535
|
+
completedAt?: string | null;
|
|
536
|
+
createdBy?: string | null;
|
|
537
|
+
tenantId?: string | null;
|
|
538
|
+
historyScopeId?: string | null;
|
|
539
|
+
/** Store-owned optimistic-lock value. */
|
|
540
|
+
txnVer?: number | null;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// -------------------------------------------------------------- projections
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* The ONE place the ordering SSOT is applied: resolve
|
|
547
|
+
* {@link Storyboard.frameIds} against a detail read's frames, in board order.
|
|
548
|
+
*
|
|
549
|
+
* Ids with no loaded frame are skipped, and frames the board no longer lists
|
|
550
|
+
* are dropped — so a mid-reorder read renders a coherent (possibly short)
|
|
551
|
+
* board instead of a duplicated or mis-ordered one. Every SB-U board surface
|
|
552
|
+
* calls this rather than sorting frames itself.
|
|
553
|
+
*/
|
|
554
|
+
export function orderStoryboardFrames(
|
|
555
|
+
frameIds: readonly string[],
|
|
556
|
+
frames: readonly StoryboardFrame[],
|
|
557
|
+
): StoryboardFrame[] {
|
|
558
|
+
const byId = new Map(frames.map(frame => [frame.frameId, frame]));
|
|
559
|
+
const ordered: StoryboardFrame[] = [];
|
|
560
|
+
for (const frameId of frameIds) {
|
|
561
|
+
const frame = byId.get(frameId);
|
|
562
|
+
if (frame) ordered.push(frame);
|
|
563
|
+
}
|
|
564
|
+
return ordered;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Mirror of the backend's derived `StoryboardFrame.status` — in-flight wins
|
|
569
|
+
* (a regenerate on a succeeded frame reads `running`, so the board shows work
|
|
570
|
+
* happening), then any success, then all-failed, then empty ⇒ `pending`.
|
|
571
|
+
*
|
|
572
|
+
* The server value on {@link StoryboardFrame.status} is authoritative; this is
|
|
573
|
+
* for the optimistic window between appending a pending variant locally and
|
|
574
|
+
* the next poll.
|
|
575
|
+
*/
|
|
576
|
+
export function deriveFrameStatus(
|
|
577
|
+
variants: readonly StoryboardFrameVariant[],
|
|
578
|
+
): StoryboardFrameStatus {
|
|
579
|
+
if (variants.some(variant => variant.status === 'pending')) return 'running';
|
|
580
|
+
if (variants.some(variant => variant.status === 'succeeded')) return 'succeeded';
|
|
581
|
+
if (variants.length > 0) return 'failed';
|
|
582
|
+
return 'pending';
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* The variant {@link StoryboardFrame.selectedVariantId} names, if it is still
|
|
587
|
+
* held in the capped history (mirrors the backend's `selected_variant()`).
|
|
588
|
+
*/
|
|
589
|
+
export function selectedFrameVariant(
|
|
590
|
+
frame: StoryboardFrame,
|
|
591
|
+
): StoryboardFrameVariant | undefined {
|
|
592
|
+
if (!frame.selectedVariantId) return undefined;
|
|
593
|
+
return frame.variants.find(variant => variant.variantId === frame.selectedVariantId);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Does this variant actually carry IMAGE BYTES a surface could render?
|
|
598
|
+
*
|
|
599
|
+
* ⛔ **"Has bytes" is `imageKey` OR `imageUrl`, and the `imageKey` half is the
|
|
600
|
+
* load-bearing one** — that is the durable field, and the one the
|
|
601
|
+
* select-variant route tests. `imageUrl` is only the detail read's presigned
|
|
602
|
+
* VIEW of it, so keying on the URL alone would call a genuinely rendered
|
|
603
|
+
* variant empty the moment presigning fails or the frame arrives from a read
|
|
604
|
+
* that does not presign.
|
|
605
|
+
*
|
|
606
|
+
* THE single definition, because two rules in this file disagreed about it and
|
|
607
|
+
* the disagreement was the §Q SB.71 defect (see {@link displayFrameVariant}).
|
|
608
|
+
*/
|
|
609
|
+
export function variantHasBytes(variant: StoryboardFrameVariant): boolean {
|
|
610
|
+
return (variant.imageKey ?? '') !== '' || (variant.imageUrl ?? '') !== '';
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* The variant a surface should SHOW for a frame (§Q SB-U.4): the explicitly
|
|
615
|
+
* selected one when it is present, succeeded AND carries bytes, otherwise the
|
|
616
|
+
* newest such variant, otherwise nothing.
|
|
617
|
+
*
|
|
618
|
+
* Distinct from {@link selectedFrameVariant}, which answers only "what does
|
|
619
|
+
* `selectedVariantId` point at" and is deliberately undefined before a
|
|
620
|
+
* selection exists. A freshly generated frame has no `selectedVariantId` yet,
|
|
621
|
+
* so a board keyed on that alone would render a rendered frame as blank; and a
|
|
622
|
+
* selection pointing at a `pending`/`failed` variant must not blank out the
|
|
623
|
+
* image the creator can already see. Variants are appended in generation
|
|
624
|
+
* order, so "newest succeeded" is the last succeeded entry.
|
|
625
|
+
*
|
|
626
|
+
* **§Q SB.71 — the bytes clause is new, and its absence BLANKED THE BOARD.**
|
|
627
|
+
* The rule was succeeded-only, so a variant marked `succeeded` while carrying
|
|
628
|
+
* no `imageKey` was honoured as the display variant: {@link frameImageUrl} then
|
|
629
|
+
* returned `null` and every surface rendered NOTHING while the frame claimed an
|
|
630
|
+
* image. Silent by construction — the frame looks healthy, and the older
|
|
631
|
+
* variant that DOES have bytes is sitting right there in the same history,
|
|
632
|
+
* never reached because the walk stopped at the keyless one.
|
|
633
|
+
*
|
|
634
|
+
* Two things make this the right shape rather than a patch. The server mirror
|
|
635
|
+
* (`shared/storyboard_store._display_variant`) has ALWAYS required an
|
|
636
|
+
* `image_key` and says so; the client was the half that drifted, on a docstring
|
|
637
|
+
* claiming the client "needs no such clause" because it reads `imageUrl`. And
|
|
638
|
+
* {@link buildFrameVariantStrip} in this same file already refused to promote a
|
|
639
|
+
* keyless variant (`no-image`) — so one file held both rules and they
|
|
640
|
+
* contradicted each other. They now share {@link variantHasBytes}.
|
|
641
|
+
*/
|
|
642
|
+
export function displayFrameVariant(
|
|
643
|
+
frame: StoryboardFrame,
|
|
644
|
+
): StoryboardFrameVariant | undefined {
|
|
645
|
+
const renderable = (variant: StoryboardFrameVariant | undefined): boolean =>
|
|
646
|
+
variant?.status === 'succeeded' && variantHasBytes(variant);
|
|
647
|
+
const selected = selectedFrameVariant(frame);
|
|
648
|
+
if (renderable(selected)) return selected;
|
|
649
|
+
for (let i = frame.variants.length - 1; i >= 0; i -= 1) {
|
|
650
|
+
if (renderable(frame.variants[i])) return frame.variants[i];
|
|
651
|
+
}
|
|
652
|
+
return undefined;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* The presigned image URL a surface should render for a frame, or `null`.
|
|
657
|
+
*
|
|
658
|
+
* One line over {@link displayFrameVariant}, but kept here so every surface that
|
|
659
|
+
* only wants the URL (the timeline clip, the large preview, a future thumbnail)
|
|
660
|
+
* reads it from one place rather than repeating the `?.imageUrl ?? null` tail.
|
|
661
|
+
* `imageUrl` rides the DETAIL read only, so a list-shaped frame yields `null`.
|
|
662
|
+
*/
|
|
663
|
+
export function frameImageUrl(frame: StoryboardFrame): string | null {
|
|
664
|
+
return displayFrameVariant(frame)?.imageUrl ?? null;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* §Q `SB.34` — the variant a surface should read a frame's PROMPT from, which is
|
|
669
|
+
* deliberately NOT {@link displayFrameVariant}.
|
|
670
|
+
*
|
|
671
|
+
* `displayFrameVariant` is succeeded-only and must stay that way: it answers
|
|
672
|
+
* "which IMAGE do I show", and its rule defends a real invariant — a selection
|
|
673
|
+
* pointing at a `pending`/`failed` variant must not blank out the image the
|
|
674
|
+
* creator can already see. Reading the prompt through it, though, made a FAILED
|
|
675
|
+
* frame indistinguishable from a frame that does not exist: the DM world-entry
|
|
676
|
+
* path got `undefined` and reported "no world for this beat" on a beat that was
|
|
677
|
+
* fully storyboarded and merely refused by the image model.
|
|
678
|
+
*
|
|
679
|
+
* The prompt is a different kind of fact from the image. It is COMPOSED BEFORE
|
|
680
|
+
* the image call and is not itself what failed, and §Q `SB.38` (#1575) made the
|
|
681
|
+
* backend persist it on all four failure arms — so a failed variant carries the
|
|
682
|
+
* text of the beat it meant to draw. This accessor is what lets that text be
|
|
683
|
+
* read without touching the image rule.
|
|
684
|
+
*
|
|
685
|
+
* Order: the displayed (succeeded) variant when it carries prompt text — a
|
|
686
|
+
* rendered frame's own provenance always wins — then the newest variant of ANY
|
|
687
|
+
* status that carries some. Variants are appended in generation order, so
|
|
688
|
+
* "newest" is the last entry. `undefined` when no variant carries prompt text at
|
|
689
|
+
* all (including boards generated before `SB.38`, whose failed variants were
|
|
690
|
+
* written with an empty string).
|
|
691
|
+
*/
|
|
692
|
+
export function promptFrameVariant(
|
|
693
|
+
frame: StoryboardFrame,
|
|
694
|
+
): StoryboardFrameVariant | undefined {
|
|
695
|
+
const displayed = displayFrameVariant(frame);
|
|
696
|
+
if (hasPromptText(displayed)) return displayed;
|
|
697
|
+
for (let i = frame.variants.length - 1; i >= 0; i -= 1) {
|
|
698
|
+
if (hasPromptText(frame.variants[i])) return frame.variants[i];
|
|
699
|
+
}
|
|
700
|
+
return undefined;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
function hasPromptText(variant: StoryboardFrameVariant | undefined): boolean {
|
|
704
|
+
return (variant?.promptText?.trim() ?? '') !== '';
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* §Q `SB.34` — why a frame's render FAILED, or `null` when it did not fail.
|
|
709
|
+
*
|
|
710
|
+
* A frame with no image can be in two completely different situations: still
|
|
711
|
+
* generating, or refused/errored and never coming back on its own. Both used to
|
|
712
|
+
* read as "not rendered yet", which told the owner to wait for something that
|
|
713
|
+
* was never going to happen. This is the ONE place that tells them apart, so no
|
|
714
|
+
* surface re-derives the distinction from raw variant statuses.
|
|
715
|
+
*
|
|
716
|
+
* Derived from the variants via {@link deriveFrameStatus} rather than the
|
|
717
|
+
* server's {@link StoryboardFrame.status} so it stays correct in the optimistic
|
|
718
|
+
* window between a regenerate and its refetch — the same reason
|
|
719
|
+
* `deriveFrameStatus` exists.
|
|
720
|
+
*
|
|
721
|
+
* Returns the newest failed variant's `error` — for a content-policy refusal
|
|
722
|
+
* that is `SB.36`'s classified message, which is the actionable half. Falls back
|
|
723
|
+
* to `null` text only if the backend recorded none; callers pair this with their
|
|
724
|
+
* own copy, so an empty reason still reads as "failed", never as "pending".
|
|
725
|
+
*/
|
|
726
|
+
export function frameRenderFailure(frame: StoryboardFrame): string | null {
|
|
727
|
+
if (deriveFrameStatus(frame.variants) !== 'failed') return null;
|
|
728
|
+
for (let i = frame.variants.length - 1; i >= 0; i -= 1) {
|
|
729
|
+
const variant = frame.variants[i];
|
|
730
|
+
if (variant.status !== 'failed') continue;
|
|
731
|
+
const error = variant.error?.trim() ?? '';
|
|
732
|
+
if (error !== '') return error;
|
|
733
|
+
}
|
|
734
|
+
return null;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Whether a frame's render failed at all — {@link frameRenderFailure} answers
|
|
739
|
+
* "why", this answers "did it", and a failure the backend recorded no message
|
|
740
|
+
* for is still a failure. Kept beside it so the two can never disagree.
|
|
741
|
+
*/
|
|
742
|
+
export function frameRenderFailed(frame: StoryboardFrame): boolean {
|
|
743
|
+
return deriveFrameStatus(frame.variants) === 'failed';
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/** Why a variant cannot be promoted to be the frame's image ({@link FrameVariantChip}). */
|
|
747
|
+
export type VariantPromoteBlock = 'pending' | 'failed' | 'no-image' | 'already-current';
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* One attempt as the compare strip renders it (§Q SB-U.6) — every fact the chip
|
|
751
|
+
* shows and every decision the chip makes, decided HERE so `web/` and
|
|
752
|
+
* `../Web-App` cannot disagree about which attempt is current or which one may
|
|
753
|
+
* be promoted.
|
|
754
|
+
*/
|
|
755
|
+
export interface FrameVariantChip {
|
|
756
|
+
variantId: string;
|
|
757
|
+
status: FrameVariantStatus;
|
|
758
|
+
origin: FrameVariantOrigin;
|
|
759
|
+
/** Which model produced this attempt — the compare axis of §Q SB.53. */
|
|
760
|
+
modelId: string | null;
|
|
761
|
+
seed: number | null;
|
|
762
|
+
imageUrl: string | null;
|
|
763
|
+
createdAt: string;
|
|
764
|
+
/** This attempt's failure message, when it failed. */
|
|
765
|
+
error: string | null;
|
|
766
|
+
/** {@link StoryboardFrame.selectedVariantId} points HERE. */
|
|
767
|
+
selected: boolean;
|
|
768
|
+
/** This is the attempt {@link displayFrameVariant} actually renders. */
|
|
769
|
+
displayed: boolean;
|
|
770
|
+
/** A version-guarded select-variant on this id would be accepted. */
|
|
771
|
+
promotable: boolean;
|
|
772
|
+
/** Why not, when {@link FrameVariantChip.promotable} is false. */
|
|
773
|
+
promoteBlock: VariantPromoteBlock | null;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/** The compare strip for one frame ({@link buildFrameVariantStrip}). */
|
|
777
|
+
export interface FrameVariantStrip {
|
|
778
|
+
chips: FrameVariantChip[];
|
|
779
|
+
/**
|
|
780
|
+
* TRUE when {@link StoryboardFrame.selectedVariantId} names something that is
|
|
781
|
+
* NOT A RENDERABLE ATTEMPT — so what the frame CLAIMS is its image and what
|
|
782
|
+
* the board actually shows cannot agree.
|
|
783
|
+
*
|
|
784
|
+
* Two reachable states, both of which the server permits on a frame the WORKER
|
|
785
|
+
* wrote, and they do DIFFERENT harm:
|
|
786
|
+
*
|
|
787
|
+
* - **the selection was EVICTED from the capped history** — nothing addresses
|
|
788
|
+
* it any more (select-variant 404s), and the board silently renders a
|
|
789
|
+
* DIFFERENT attempt than the one the creator chose;
|
|
790
|
+
* - **the selection is `succeeded` with NO rendered bytes** — the codex P2
|
|
791
|
+
* §Q SB.56 closed on the WRITE path only. {@link displayFrameVariant}
|
|
792
|
+
* honours it (it is succeeded), so the board renders NOTHING AT ALL while
|
|
793
|
+
* the frame still claims a selection, and the export 422s on the same
|
|
794
|
+
* frame. That is the state this flag exists to stop being invisible.
|
|
795
|
+
*/
|
|
796
|
+
selectionAdrift: boolean;
|
|
797
|
+
/** How many attempts the history still has room for before it evicts. */
|
|
798
|
+
remainingSlots: number;
|
|
799
|
+
/**
|
|
800
|
+
* TRUE when the next attempt will EVICT the oldest one. Surfaced honestly per
|
|
801
|
+
* the row rather than discovered when a chip disappears: `append_variant`
|
|
802
|
+
* drops the oldest non-selected entry at
|
|
803
|
+
* {@link FRAME_VARIANT_HISTORY_CAP}, and an evicted variant can never be
|
|
804
|
+
* promoted again (select-variant 404s on it).
|
|
805
|
+
*/
|
|
806
|
+
evictionImminent: boolean;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* §Q SB-U.6 — the variant compare strip for one frame, as pure data.
|
|
811
|
+
*
|
|
812
|
+
* Chips are in GENERATION ORDER (oldest first), which is the order
|
|
813
|
+
* `append_variant` writes them and therefore the order eviction removes them —
|
|
814
|
+
* so left-to-right is also "closest to being evicted" first.
|
|
815
|
+
*
|
|
816
|
+
* `promotable` encodes the SERVER's rule rather than a looser client guess: the
|
|
817
|
+
* select-variant route accepts a variant only when it is `succeeded` AND carries
|
|
818
|
+
* rendered bytes, and 422s otherwise — so those chips are disabled with a reason
|
|
819
|
+
* instead of offering a click that fails.
|
|
820
|
+
*
|
|
821
|
+
* ⚠ **`already-current` is the one block that is NOT a server rejection.**
|
|
822
|
+
* Re-selecting the variant a frame already holds is accepted (200, idempotent);
|
|
823
|
+
* the chip hides the control because the click would be a no-op, not because it
|
|
824
|
+
* would fail. Do not read the four blocks as "the server would 422".
|
|
825
|
+
*
|
|
826
|
+
* ⛔ **"Has bytes" is {@link variantHasBytes}** — `imageKey` OR `imageUrl`, with
|
|
827
|
+
* the `imageKey` half load-bearing. §Q SB.71: this rule and
|
|
828
|
+
* {@link displayFrameVariant} used to disagree inside this one file, which is
|
|
829
|
+
* how a keyless variant could be refused promotion here and still be chosen as
|
|
830
|
+
* the thing to render.
|
|
831
|
+
*/
|
|
832
|
+
export function buildFrameVariantStrip(frame: StoryboardFrame): FrameVariantStrip {
|
|
833
|
+
const displayed = displayFrameVariant(frame);
|
|
834
|
+
const chips: FrameVariantChip[] = frame.variants.map(variant => {
|
|
835
|
+
const selected = frame.selectedVariantId === variant.variantId;
|
|
836
|
+
const isDisplayed = displayed?.variantId === variant.variantId;
|
|
837
|
+
const hasBytes = variantHasBytes(variant);
|
|
838
|
+
let promoteBlock: VariantPromoteBlock | null = null;
|
|
839
|
+
if (variant.status === 'pending') promoteBlock = 'pending';
|
|
840
|
+
else if (variant.status === 'failed') promoteBlock = 'failed';
|
|
841
|
+
else if (!hasBytes) promoteBlock = 'no-image';
|
|
842
|
+
else if (selected) promoteBlock = 'already-current';
|
|
843
|
+
return {
|
|
844
|
+
variantId: variant.variantId,
|
|
845
|
+
status: variant.status,
|
|
846
|
+
origin: variant.origin,
|
|
847
|
+
modelId: variant.modelId ?? null,
|
|
848
|
+
seed: variant.seed ?? null,
|
|
849
|
+
imageUrl: variant.imageUrl ?? null,
|
|
850
|
+
createdAt: variant.createdAt,
|
|
851
|
+
error: variant.error ?? null,
|
|
852
|
+
selected,
|
|
853
|
+
displayed: isDisplayed,
|
|
854
|
+
promotable: promoteBlock === null,
|
|
855
|
+
promoteBlock,
|
|
856
|
+
};
|
|
857
|
+
});
|
|
858
|
+
// A selection is adrift unless it names a chip that is itself PROMOTABLE-shaped
|
|
859
|
+
// (succeeded with bytes) — the same rule the select-variant route enforces on
|
|
860
|
+
// the write, applied to what is already stored. Deliberately NOT
|
|
861
|
+
// `displayed?.variantId !== selectedVariantId`: `displayFrameVariant` honours a
|
|
862
|
+
// succeeded-but-keyless selection, so that comparison reads "in agreement" on
|
|
863
|
+
// the exact frame whose board renders nothing.
|
|
864
|
+
const selectedChip = chips.find(chip => chip.variantId === frame.selectedVariantId);
|
|
865
|
+
const selectionAdrift =
|
|
866
|
+
(frame.selectedVariantId ?? '') !== '' &&
|
|
867
|
+
(selectedChip === undefined ||
|
|
868
|
+
selectedChip.promoteBlock === 'pending' ||
|
|
869
|
+
selectedChip.promoteBlock === 'failed' ||
|
|
870
|
+
selectedChip.promoteBlock === 'no-image');
|
|
871
|
+
const remainingSlots = Math.max(0, FRAME_VARIANT_HISTORY_CAP - frame.variants.length);
|
|
872
|
+
return {
|
|
873
|
+
chips,
|
|
874
|
+
selectionAdrift,
|
|
875
|
+
remainingSlots,
|
|
876
|
+
evictionImminent: remainingSlots === 0,
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// --------------------------------------------------------------- wire: read
|
|
881
|
+
|
|
882
|
+
/** Which projection a detail read returns (spec §4.5 `?view=`). */
|
|
883
|
+
export type StoryboardView = 'arc' | 'quests';
|
|
884
|
+
|
|
885
|
+
/** Runtime enumeration of {@link StoryboardView} for view pickers. */
|
|
886
|
+
export const STORYBOARD_VIEWS: readonly StoryboardView[] = ['arc', 'quests'];
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* The quest-view join, COMPUTED per request and never stored (spec §4.5):
|
|
890
|
+
* quest definitions indexed by `sourceBeatId`, joined on
|
|
891
|
+
* {@link StoryboardFrame.beatId}. The client RENDERS {@link GateExpr}; it never
|
|
892
|
+
* evaluates one.
|
|
893
|
+
*/
|
|
894
|
+
export interface StoryboardFrameQuestAnnotation {
|
|
895
|
+
frameId: string;
|
|
896
|
+
questId: string;
|
|
897
|
+
/** Serialized `GATED_BY` expression, or null for an ungated quest. */
|
|
898
|
+
gate?: GateExpr | null;
|
|
899
|
+
prereqQuestIds: string[];
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/** `GET …/storyboards` — board summaries (META items only, no frames). */
|
|
903
|
+
export interface ListStoryboardsResponse {
|
|
904
|
+
traceId: string;
|
|
905
|
+
storyboards: Storyboard[];
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* `GET …/storyboards/{id}?view=arc|quests` — board + its frames, with
|
|
910
|
+
* presigned URLs on each variant. `questAnnotations` is populated only for
|
|
911
|
+
* `view=quests`.
|
|
912
|
+
*/
|
|
913
|
+
export interface StoryboardDetailResponse {
|
|
914
|
+
traceId: string;
|
|
915
|
+
storyboard: Storyboard;
|
|
916
|
+
frames: StoryboardFrame[];
|
|
917
|
+
questAnnotations?: StoryboardFrameQuestAnnotation[] | null;
|
|
918
|
+
/**
|
|
919
|
+
* §Q DM.105 — the story scope the board's PlotBeats live in (the fork story
|
|
920
|
+
* on a fork-approved arc, the video otherwise). A cutscene for a frame posts
|
|
921
|
+
* this as `storyId`. `null` when the arc is not approved.
|
|
922
|
+
*/
|
|
923
|
+
graphStoryId?: string | null;
|
|
924
|
+
/** §Q DM.105 — whether the frames' graph beat ids were checked. Absent on
|
|
925
|
+
* reads from before DM.105: read that as not resolved. */
|
|
926
|
+
graphResolution?: BoardGraphResolution;
|
|
927
|
+
/** §Q DM.105 — frames of a `resolved` board whose beat is no PlotBeat in the
|
|
928
|
+
* graph; a cutscene cannot be grounded on them. */
|
|
929
|
+
unresolvedGraphFrameIds?: string[];
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* §Q DM.105 — whether a board's frames resolved to graph `PlotBeat` ids
|
|
934
|
+
* (mirrors backend `services/storyboard/beat_scope.py::BoardGraphResolution`).
|
|
935
|
+
* Compare against these, never a raw literal.
|
|
936
|
+
*/
|
|
937
|
+
export const BOARD_GRAPH_RESOLUTION = {
|
|
938
|
+
/** Every frame was checked; the unresolved ones are named. */
|
|
939
|
+
RESOLVED: 'resolved',
|
|
940
|
+
/** The board's arc variant is not the approved one — no PlotBeat of it exists. */
|
|
941
|
+
ARC_NOT_APPROVED: 'arc_not_approved',
|
|
942
|
+
/** The graph holds no node of the arc yet, could not be read, or the board is still generating. */
|
|
943
|
+
UNVERIFIED: 'unverified',
|
|
944
|
+
/** §Q SB.93 — the board's source arc is gone (deleted, another video's, or
|
|
945
|
+
* re-generated without the board's variant). PERMANENT: no later read resolves it. */
|
|
946
|
+
ARC_GONE: 'arc_gone',
|
|
947
|
+
} as const;
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* {@link BOARD_GRAPH_RESOLUTION}'s values, OPEN for forward compatibility: the
|
|
951
|
+
* backend may add one (e.g. an arc that is gone), and a reader must treat any
|
|
952
|
+
* value it does not know as NOT resolved rather than fail.
|
|
953
|
+
*/
|
|
954
|
+
export type BoardGraphResolution =
|
|
955
|
+
| (typeof BOARD_GRAPH_RESOLUTION)[keyof typeof BOARD_GRAPH_RESOLUTION]
|
|
956
|
+
| (string & {});
|
|
957
|
+
|
|
958
|
+
/** Why a frame cannot ground a cutscene (§Q UX.38). */
|
|
959
|
+
export const FRAME_CUTSCENE_BLOCK = {
|
|
960
|
+
/** The board's arc is not approved, so none of its beats is in the graph. */
|
|
961
|
+
ARC_NOT_APPROVED: 'arc_not_approved',
|
|
962
|
+
/** The graph has not (yet) confirmed this board's beats — or answered a resolution this client does not know. */
|
|
963
|
+
GRAPH_UNVERIFIED: 'graph_unverified',
|
|
964
|
+
/** This frame's beat is no PlotBeat in the graph. */
|
|
965
|
+
FRAME_UNRESOLVED: 'frame_unresolved',
|
|
966
|
+
/** The board's source arc is gone — permanent, unlike {@link FRAME_CUTSCENE_BLOCK.GRAPH_UNVERIFIED}. */
|
|
967
|
+
ARC_GONE: 'arc_gone',
|
|
968
|
+
} as const;
|
|
969
|
+
export type FrameCutsceneBlock = (typeof FRAME_CUTSCENE_BLOCK)[keyof typeof FRAME_CUTSCENE_BLOCK];
|
|
970
|
+
|
|
971
|
+
/** What a cutscene for one frame posts, or why it cannot (§Q UX.38). */
|
|
972
|
+
export type FrameCutsceneTarget =
|
|
973
|
+
| { status: 'ready'; storyId: string; beatId: string }
|
|
974
|
+
| { status: 'blocked'; reason: FrameCutsceneBlock };
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* §Q UX.38 — the `{storyId, beatId}` a "cutscene from this frame" posts to
|
|
978
|
+
* `POST /api/v1/videos/generate`, from the board detail read's DM.105 overlay.
|
|
979
|
+
*
|
|
980
|
+
* The ONE place the rule lives: the GRAPH ids (`graphStoryId` +
|
|
981
|
+
* `graphBeatId`), never the frame's board-scoped `beatId` (the measured 404
|
|
982
|
+
* class); and only on a `resolved` board for a frame it did not name as
|
|
983
|
+
* unresolved. Every other state is `blocked` with its reason — including a
|
|
984
|
+
* resolution value this client does not know.
|
|
985
|
+
*/
|
|
986
|
+
export function storyboardFrameCutsceneTarget(
|
|
987
|
+
detail: Pick<StoryboardDetailResponse, 'graphStoryId' | 'graphResolution' | 'unresolvedGraphFrameIds'>,
|
|
988
|
+
frame: Pick<StoryboardFrame, 'frameId' | 'graphBeatId'>,
|
|
989
|
+
): FrameCutsceneTarget {
|
|
990
|
+
if (detail.graphResolution === BOARD_GRAPH_RESOLUTION.ARC_NOT_APPROVED) {
|
|
991
|
+
return { status: 'blocked', reason: FRAME_CUTSCENE_BLOCK.ARC_NOT_APPROVED };
|
|
992
|
+
}
|
|
993
|
+
if (detail.graphResolution === BOARD_GRAPH_RESOLUTION.ARC_GONE) {
|
|
994
|
+
return { status: 'blocked', reason: FRAME_CUTSCENE_BLOCK.ARC_GONE };
|
|
995
|
+
}
|
|
996
|
+
const storyId = detail.graphStoryId?.trim() ?? '';
|
|
997
|
+
if (detail.graphResolution !== BOARD_GRAPH_RESOLUTION.RESOLVED || storyId === '') {
|
|
998
|
+
return { status: 'blocked', reason: FRAME_CUTSCENE_BLOCK.GRAPH_UNVERIFIED };
|
|
999
|
+
}
|
|
1000
|
+
const beatId = frame.graphBeatId?.trim() ?? '';
|
|
1001
|
+
if (beatId === '' || (detail.unresolvedGraphFrameIds ?? []).includes(frame.frameId)) {
|
|
1002
|
+
return { status: 'blocked', reason: FRAME_CUTSCENE_BLOCK.FRAME_UNRESOLVED };
|
|
1003
|
+
}
|
|
1004
|
+
return { status: 'ready', storyId, beatId };
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// -------------------------------------------------------------- wire: write
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* `POST …/storyboards` body. `styleProfile` is a PARTIAL — every field the
|
|
1011
|
+
* backend `StyleProfile` declares has a default, so omitted fields take the
|
|
1012
|
+
* pinned master geometry.
|
|
1013
|
+
*/
|
|
1014
|
+
export interface CreateStoryboardRequest {
|
|
1015
|
+
proposalId: string;
|
|
1016
|
+
variantId: string;
|
|
1017
|
+
styleProfile?: Partial<StyleProfile>;
|
|
1018
|
+
modelId?: string;
|
|
1019
|
+
/**
|
|
1020
|
+
* Generate one variant per model per frame, in this order (§Q SB.54) — the
|
|
1021
|
+
* general form of which `modelId` is the singleton case.
|
|
1022
|
+
*
|
|
1023
|
+
* Send ONE of the two, never both: naming both is a 422 rather than a
|
|
1024
|
+
* precedence rule, because silently preferring one would let a creator pay
|
|
1025
|
+
* for a board generated against a model they did not pick. Every id must
|
|
1026
|
+
* declare `multi_reference` and there is a hard cap of TWO (a wall-clock
|
|
1027
|
+
* bound — a maxed 24-frame board already runs 10–15 min at two arms).
|
|
1028
|
+
*/
|
|
1029
|
+
modelIds?: string[];
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* `POST …/storyboards/{storyboardId}/frames/{frameId}/retry` body — OPTIONAL
|
|
1034
|
+
* (§Q SB.55). The route has accepted a body-less POST since §Q SB.35 and still
|
|
1035
|
+
* does; this exists to carry ONE thing.
|
|
1036
|
+
*/
|
|
1037
|
+
export interface RetryStoryboardFrameRequest {
|
|
1038
|
+
/**
|
|
1039
|
+
* Re-compose this attempt with a DIFFERENT model than the board's. Omitted ⇒
|
|
1040
|
+
* the board's primary model.
|
|
1041
|
+
*
|
|
1042
|
+
* This is the one untried lever for a content-blocked frame: every Gemini
|
|
1043
|
+
* tier shares a single safety stack (§Q SB.32 measured `gemini-3-pro-image`
|
|
1044
|
+
* returning the identical block at twice the price), so a genuine second
|
|
1045
|
+
* opinion needs a second VENDOR. Capability-gated exactly as create is — an
|
|
1046
|
+
* incapable id is a 422 before anything is billed.
|
|
1047
|
+
*/
|
|
1048
|
+
modelId?: string;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/** 202 envelope from `POST …/storyboards` — poll the detail read until
|
|
1052
|
+
* {@link isStoryboardTerminal}. */
|
|
1053
|
+
export interface CreateStoryboardResponse {
|
|
1054
|
+
traceId: string;
|
|
1055
|
+
storyboard: Storyboard;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* `PATCH …/frames/{frameId}` body — every field optional, absent = unchanged.
|
|
1060
|
+
* `prompt`/`extensions` merge per-field. `cameraPose: null` clears the pose.
|
|
1061
|
+
* There is no `status` and no `order` here by design.
|
|
1062
|
+
*/
|
|
1063
|
+
export interface PatchStoryboardFrameRequest {
|
|
1064
|
+
prompt?: Partial<FramePrompt>;
|
|
1065
|
+
durationSeconds?: FrameDurationSeconds;
|
|
1066
|
+
shotTransition?: ShotTransition;
|
|
1067
|
+
sequenceId?: string | null;
|
|
1068
|
+
cameraPose?: CameraPose | null;
|
|
1069
|
+
characterRefs?: StoryboardFrameRef[];
|
|
1070
|
+
settingRefs?: StoryboardFrameRef[];
|
|
1071
|
+
extensions?: Partial<FrameExtensions>;
|
|
1072
|
+
seed?: number | null;
|
|
1073
|
+
audioEnabled?: boolean;
|
|
1074
|
+
/** Version guard — the {@link StoryboardFrame.txnVer} the edit was based on. */
|
|
1075
|
+
txnVer?: number;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* `POST …/frames/{frameId}/region-edit` body. A mask routes to a
|
|
1080
|
+
* `mask_inpaint`-capable adapter; no mask routes to `semantic_edit`.
|
|
1081
|
+
*/
|
|
1082
|
+
export interface RegionEditFrameRequest {
|
|
1083
|
+
instruction: string;
|
|
1084
|
+
/**
|
|
1085
|
+
* Base64 PNG mask, white = edit / black = keep — exactly what client-core's
|
|
1086
|
+
* `renderMaskToCanvas` (`storyboardMask.ts`, SB-U.2) produces.
|
|
1087
|
+
*/
|
|
1088
|
+
maskImageBase64?: string;
|
|
1089
|
+
/** Prefer an identity-preserving adapter for this edit. */
|
|
1090
|
+
keepIdentity?: boolean;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* `PUT …/frames/{frameId}/world` body — bind the HappyOyster world this frame
|
|
1095
|
+
* opens into (§Q DM.1; owner ruling Q2: ONE permanent world per frame).
|
|
1096
|
+
*
|
|
1097
|
+
* NOT version-guarded, deliberately. A HappyOyster world is paid, permanent and
|
|
1098
|
+
* unlistable, and `worldId` is the only handle that can ever reach it again —
|
|
1099
|
+
* so the persist must not be able to fail because an unrelated regenerate moved
|
|
1100
|
+
* the frame's `txnVer` since it was read. The server write is a first-writer-
|
|
1101
|
+
* wins claim instead: re-sending the SAME id succeeds (retry the persist freely
|
|
1102
|
+
* after a dropped response), a DIFFERENT id **409s** and the error carries the
|
|
1103
|
+
* id the frame already owns so the caller reopens that world rather than
|
|
1104
|
+
* stranding it.
|
|
1105
|
+
*
|
|
1106
|
+
* §Q DM.30 — the MODE is part of this contract, and this doc used to say the
|
|
1107
|
+
* opposite ("the client knows the mode it launched with; `attachWorld`
|
|
1108
|
+
* pre-flights a mismatch on reopen"). A reopen rebuilds the handle from the
|
|
1109
|
+
* STORED frame, so that pre-flight was comparing the session's mode with itself
|
|
1110
|
+
* and could never fire; a World-Explorer (`directing`) world reattached from the
|
|
1111
|
+
* adventure-mode DM reached the vendor and returned `[MODE_MISMATCH]` — after
|
|
1112
|
+
* the world was paid for.
|
|
1113
|
+
*
|
|
1114
|
+
* `worldMode` is optional only so a bind that follows a PAID `createWorld` can
|
|
1115
|
+
* never be rejected outright (losing a billed, unlistable world is worse than
|
|
1116
|
+
* recording an under-described one). Always send it.
|
|
1117
|
+
*/
|
|
1118
|
+
export interface SetFrameWorldRequest {
|
|
1119
|
+
/** The `encryptedWorldId` returned by `createWorld`. */
|
|
1120
|
+
worldId: string;
|
|
1121
|
+
/** The mode-fixed model that owns the world — required to reopen it. */
|
|
1122
|
+
worldMode?: HappyOysterMode;
|
|
1123
|
+
/**
|
|
1124
|
+
* §Q `WORLD.11` — the {@link PreparedWorldBeatEntry.leaseToken} this beat's
|
|
1125
|
+
* `pending` entry came back with. It is what CONSUMES the reservation: the
|
|
1126
|
+
* ledger append and the lease delete ride one transaction fenced on this exact
|
|
1127
|
+
* token, so a mint against a lapsed authorisation can no longer consume a
|
|
1128
|
+
* NEWER caller's lease for the same frame — which left that caller holding a
|
|
1129
|
+
* phantom authorisation while the one-beat race re-opened underneath it.
|
|
1130
|
+
*
|
|
1131
|
+
* Omit it for a bind with no prepared authorisation (the DM's own world entry,
|
|
1132
|
+
* a legacy client): the world is still recorded and still counted against the
|
|
1133
|
+
* cap, and no lease is touched.
|
|
1134
|
+
*/
|
|
1135
|
+
leaseToken?: string;
|
|
1136
|
+
/**
|
|
1137
|
+
* §Q MOMENT.8 — REQUIRED with `?supersede=true`, rejected without it (422
|
|
1138
|
+
* either way). The world id you READ off the frame: the replacement write is
|
|
1139
|
+
* fenced on it, so a frame that has meanwhile moved to some other world 409s
|
|
1140
|
+
* instead of being overwritten. The superseded id lands in
|
|
1141
|
+
* {@link StoryboardFrame.supersededWorldIds} and stays reachable.
|
|
1142
|
+
*/
|
|
1143
|
+
supersedesWorldId?: string;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
/** One beat's outcome from `POST …/worlds/prepare` (§Q MOMENT.6a). */
|
|
1147
|
+
export type PreparedWorldDisposition =
|
|
1148
|
+
/** The beat's anchor frame already owns a world — skipped, nothing to pay. */
|
|
1149
|
+
| 'bound'
|
|
1150
|
+
/** AUTHORISED to mint. Mint it, then bind it with `setStoryboardFrameWorld`. */
|
|
1151
|
+
| 'pending'
|
|
1152
|
+
/** Refused — the story is at its permanent-world cap. */
|
|
1153
|
+
| 'capped'
|
|
1154
|
+
/** Unseedable: the anchor frame has no rendered image. */
|
|
1155
|
+
| 'blocked'
|
|
1156
|
+
/**
|
|
1157
|
+
* §Q MOMENT.13 — a DIFFERENT authorisation for this beat is outstanding and
|
|
1158
|
+
* has not been minted or lapsed yet. NOT `capped`: the story has slots free,
|
|
1159
|
+
* and two live authorisations for one anchor frame would mean two permanent
|
|
1160
|
+
* worlds billed and one of them refused by the bind. Mint the outstanding
|
|
1161
|
+
* one, or re-run after `leaseExpiresAt`.
|
|
1162
|
+
*/
|
|
1163
|
+
| 'held';
|
|
1164
|
+
|
|
1165
|
+
export interface PreparedWorldBeatEntry {
|
|
1166
|
+
beatId: string;
|
|
1167
|
+
frameId: string;
|
|
1168
|
+
disposition: PreparedWorldDisposition;
|
|
1169
|
+
/** The world the frame already owns (`bound`), or — under `supersede` — the
|
|
1170
|
+
* one this beat's new mint replaces, to echo back as `supersedesWorldId`. */
|
|
1171
|
+
worldId?: string | null;
|
|
1172
|
+
worldMode?: HappyOysterMode | null;
|
|
1173
|
+
/** Why, for the `capped`/`blocked`/`held` arms. */
|
|
1174
|
+
reason?: string | null;
|
|
1175
|
+
/**
|
|
1176
|
+
* §Q MOMENT.13 — the authorisation LEASE this mint is covered by, on
|
|
1177
|
+
* `pending` only. A permanent-world slot is RESERVED against the story the
|
|
1178
|
+
* moment it is issued, and binding the world consumes it.
|
|
1179
|
+
*/
|
|
1180
|
+
leaseToken?: string | null;
|
|
1181
|
+
/**
|
|
1182
|
+
* Unix epoch seconds the lease lapses at. On `pending` it is the deadline for
|
|
1183
|
+
* minting; on `held` it is when the beat frees up.
|
|
1184
|
+
*/
|
|
1185
|
+
leaseExpiresAt?: number | null;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
/**
|
|
1189
|
+
* One permanent world a story has paid for (§Q WORLD.9).
|
|
1190
|
+
*
|
|
1191
|
+
* HappyOyster worlds are billed once, exist forever, and **cannot be listed
|
|
1192
|
+
* vendor-side** — the id is the only path back to one. Recording it on the
|
|
1193
|
+
* frame alone meant deleting the frame or the board destroyed the sole copy, so
|
|
1194
|
+
* these rows live in a story-level ledger no board delete touches.
|
|
1195
|
+
* `storyboardId`/`frameId` are PROVENANCE and may name rows that no longer
|
|
1196
|
+
* exist; that is the point of the ledger, not a stale reference.
|
|
1197
|
+
*/
|
|
1198
|
+
export interface StoryWorldHandle {
|
|
1199
|
+
worldId: string;
|
|
1200
|
+
worldMode?: HappyOysterMode | null;
|
|
1201
|
+
storyboardId?: string | null;
|
|
1202
|
+
frameId?: string | null;
|
|
1203
|
+
recordedAt?: string | null;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* `POST …/storyboards/{storyboardId}/worlds/prepare` (§Q MOMENT.6a).
|
|
1208
|
+
*
|
|
1209
|
+
* ⚠ **The route AUTHORISES spend; it does not spend.** There is no server-side
|
|
1210
|
+
* `createWorld` — the browser mints. So `pendingCount` is the number of
|
|
1211
|
+
* PERMANENT, BILLED, undeletable worlds this caller is being cleared to create,
|
|
1212
|
+
* and it is the number to show a human before anything happens.
|
|
1213
|
+
*/
|
|
1214
|
+
export interface PrepareStoryboardWorldsResponse {
|
|
1215
|
+
traceId: string;
|
|
1216
|
+
beats: PreparedWorldBeatEntry[];
|
|
1217
|
+
/** The per-STORY ceiling in force. */
|
|
1218
|
+
cap: number;
|
|
1219
|
+
/**
|
|
1220
|
+
* Distinct permanent worlds the story already owns, superseded ones included.
|
|
1221
|
+
* Read from the DURABLE story ledger (§Q MOMENT.14), so deleting a board no
|
|
1222
|
+
* longer makes the worlds it paid for vanish from the accounting.
|
|
1223
|
+
*/
|
|
1224
|
+
storyWorldCount: number;
|
|
1225
|
+
/** Mints AUTHORISED by this call. THE SPEND NUMBER. */
|
|
1226
|
+
pendingCount: number;
|
|
1227
|
+
skippedCount: number;
|
|
1228
|
+
cappedCount: number;
|
|
1229
|
+
blockedCount: number;
|
|
1230
|
+
/** §Q MOMENT.13 — beats another live authorisation already covers. */
|
|
1231
|
+
heldCount?: number;
|
|
1232
|
+
/**
|
|
1233
|
+
* Slots reserved by authorisations nobody has minted yet. Without it, a
|
|
1234
|
+
* refusal on a story owning 8 of 10 reads as a bug rather than as two
|
|
1235
|
+
* authorisations still outstanding.
|
|
1236
|
+
*/
|
|
1237
|
+
outstandingAuthorizations?: number;
|
|
1238
|
+
/**
|
|
1239
|
+
* §Q WORLD.9 — every permanent world this story has paid for. HappyOyster
|
|
1240
|
+
* exposes no listing, so this is the only enumeration that exists anywhere.
|
|
1241
|
+
*/
|
|
1242
|
+
permanentWorlds?: StoryWorldHandle[];
|
|
1243
|
+
/**
|
|
1244
|
+
* §Q `WORLD.14a` — permanent worlds this story PAID for that no surviving shot
|
|
1245
|
+
* of any of its boards opens. Always a subset of {@link permanentWorlds}, and
|
|
1246
|
+
* they still count against {@link cap}: the vendor has no delete, so nothing
|
|
1247
|
+
* reclaims them and surfacing them IS the remedy. A non-empty list is the
|
|
1248
|
+
* reading behind "my cap is consumed and I cannot see by what".
|
|
1249
|
+
*/
|
|
1250
|
+
unopenedWorldIds?: string[];
|
|
1251
|
+
supersede: boolean;
|
|
1252
|
+
/** The mode every authorised mint must be created in — always `adventure`. */
|
|
1253
|
+
worldMode: HappyOysterMode;
|
|
1254
|
+
/**
|
|
1255
|
+
* §Q WORLD.29 — `true` on the spend PREVIEW (`GET`): nothing was reserved,
|
|
1256
|
+
* `pending` entries carry no `leaseToken`, and `pendingCount` is what a
|
|
1257
|
+
* confirm WOULD authorise. `false`/absent on the leasing confirm (`POST`).
|
|
1258
|
+
*/
|
|
1259
|
+
preview?: boolean;
|
|
1260
|
+
/**
|
|
1261
|
+
* §Q WORLD.29 — `true` only on a PREVIEW of a story whose pre-ledger worlds
|
|
1262
|
+
* span more boards than one migration window: `storyWorldCount` (and
|
|
1263
|
+
* `permanentWorlds`) is then a LOWER BOUND, and the confirm refuses until its
|
|
1264
|
+
* migration has walked the rest. Always `false` on the leasing confirm.
|
|
1265
|
+
*/
|
|
1266
|
+
storyWorldCountIsFloor?: boolean;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
/** One authorisation a client is handing back (§Q WORLD.44). */
|
|
1270
|
+
export interface WorldLeaseHandle {
|
|
1271
|
+
frameId: string;
|
|
1272
|
+
/** The `leaseToken` the confirm returned on this frame's `pending` entry.
|
|
1273
|
+
* The release is fenced on it: a lease re-issued to another caller is never
|
|
1274
|
+
* released by this one. */
|
|
1275
|
+
leaseToken: string;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
/** `POST …/storyboards/{storyboardId}/worlds/release` body (§Q WORLD.44). */
|
|
1279
|
+
export interface ReleaseStoryboardWorldsRequest {
|
|
1280
|
+
leases: WorldLeaseHandle[];
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* What the release door actually released (§Q WORLD.44). `notReleased` is not
|
|
1285
|
+
* an error: the lease was already consumed by a bind, already lapsed and swept,
|
|
1286
|
+
* or carries another token.
|
|
1287
|
+
*/
|
|
1288
|
+
export interface ReleaseStoryboardWorldsResponse {
|
|
1289
|
+
traceId: string;
|
|
1290
|
+
released: string[];
|
|
1291
|
+
notReleased: string[];
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
/**
|
|
1295
|
+
* The leases a CONFIRM issued — every `pending` entry carrying a `leaseToken`
|
|
1296
|
+
* (§Q WORLD.44). What a client hands back through
|
|
1297
|
+
* {@link StoryboardsApi.releaseStoryboardWorlds} when it will not spend them. A
|
|
1298
|
+
* preview's entries carry no token, so this is empty for a preview.
|
|
1299
|
+
*/
|
|
1300
|
+
export function worldLeasesOf(
|
|
1301
|
+
beats: readonly Pick<PreparedWorldBeatEntry, 'frameId' | 'disposition' | 'leaseToken'>[],
|
|
1302
|
+
): WorldLeaseHandle[] {
|
|
1303
|
+
return beats.flatMap(beat =>
|
|
1304
|
+
beat.disposition === 'pending' && typeof beat.leaseToken === 'string' && beat.leaseToken !== ''
|
|
1305
|
+
? [{ frameId: beat.frameId, leaseToken: beat.leaseToken }]
|
|
1306
|
+
: [],
|
|
1307
|
+
);
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
/** `POST …/frames/{frameId}/select-variant` body — version-guarded. */
|
|
1311
|
+
export interface SelectFrameVariantRequest {
|
|
1312
|
+
variantId: string;
|
|
1313
|
+
/** Version guard — the {@link StoryboardFrame.txnVer} the choice was based on. */
|
|
1314
|
+
txnVer?: number;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
/** Every frame-scoped write returns the refreshed frame. */
|
|
1318
|
+
export interface StoryboardFrameResponse {
|
|
1319
|
+
traceId: string;
|
|
1320
|
+
frame: StoryboardFrame;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
/**
|
|
1324
|
+
* `PATCH …/storyboards/{id}/order` body — FULL-LIST replace, idempotent. The
|
|
1325
|
+
* list must be a permutation of the board's current `frameIds`.
|
|
1326
|
+
*/
|
|
1327
|
+
export interface ReorderStoryboardFramesRequest {
|
|
1328
|
+
frameIds: string[];
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
/** Board-scoped writes return the refreshed META item. */
|
|
1332
|
+
export interface StoryboardResponse {
|
|
1333
|
+
traceId: string;
|
|
1334
|
+
storyboard: Storyboard;
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
/** Export v1 targets (spec §4.6). */
|
|
1338
|
+
export type StoryboardExportTarget = 'longlive' | 'seedance' | 'bundle';
|
|
1339
|
+
|
|
1340
|
+
/** Runtime enumeration of {@link StoryboardExportTarget}. */
|
|
1341
|
+
export const STORYBOARD_EXPORT_TARGETS: readonly StoryboardExportTarget[] = [
|
|
1342
|
+
'longlive',
|
|
1343
|
+
'seedance',
|
|
1344
|
+
'bundle',
|
|
1345
|
+
];
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* `GET …/storyboards/{id}/export/{target}`. `payload` is the target-shaped
|
|
1349
|
+
* document (a LongLive shot script, a Seedance request payload, or the JSON
|
|
1350
|
+
* bundle) — deliberately untyped here because SB.8 owns those three shapes;
|
|
1351
|
+
* the export UI (SB-U.9) narrows it per target.
|
|
1352
|
+
*/
|
|
1353
|
+
export interface ExportStoryboardResponse {
|
|
1354
|
+
traceId: string;
|
|
1355
|
+
target: StoryboardExportTarget;
|
|
1356
|
+
filename: string;
|
|
1357
|
+
payload: Record<string, unknown>;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
// -------------------------------------------------------------------- api
|
|
1361
|
+
|
|
1362
|
+
/**
|
|
1363
|
+
* The visual-storyboard surface (spec §4.5), mounted on the STORIES app
|
|
1364
|
+
* alongside arcs — so every call goes to `transport.baseUrl`. Land-dark: 404s
|
|
1365
|
+
* until `SEER_STORYBOARD_ENABLED` is set server-side.
|
|
1366
|
+
*
|
|
1367
|
+
* Board creation is async (the arcs envelope): create returns **202** with a
|
|
1368
|
+
* QUEUED board, then poll {@link StoryboardsApi.getStoryboard} until
|
|
1369
|
+
* {@link isStoryboardTerminal}. `regenerate` and `region-edit` are likewise
|
|
1370
|
+
* 202 — they append a PENDING variant, which makes the frame read `running`.
|
|
1371
|
+
*/
|
|
1372
|
+
export class StoryboardsApi {
|
|
1373
|
+
constructor(private readonly transport: Transport) {}
|
|
1374
|
+
|
|
1375
|
+
private boardsPath(storyId: string): string {
|
|
1376
|
+
return `/api/v1/stories/${encodeURIComponent(storyId)}/storyboards`;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
private framePath(storyId: string, storyboardId: string, frameId: string): string {
|
|
1380
|
+
return `${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}/frames/${encodeURIComponent(frameId)}`;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* Generate a board from an approved arc variant. `POST
|
|
1385
|
+
* /api/v1/stories/{storyId}/storyboards` → **202** + `Location` + the QUEUED
|
|
1386
|
+
* board; frames fill in as the worker completes them.
|
|
1387
|
+
*/
|
|
1388
|
+
async createStoryboard(
|
|
1389
|
+
storyId: string,
|
|
1390
|
+
req: CreateStoryboardRequest,
|
|
1391
|
+
): Promise<CreateStoryboardResponse> {
|
|
1392
|
+
return this.transport.requestJson<CreateStoryboardResponse>(
|
|
1393
|
+
this.transport.baseUrl,
|
|
1394
|
+
this.boardsPath(storyId),
|
|
1395
|
+
{ method: 'POST', body: JSON.stringify(req) },
|
|
1396
|
+
);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* List a story's boards newest-first (summaries — no frames). `GET
|
|
1401
|
+
* /api/v1/stories/{storyId}/storyboards`.
|
|
1402
|
+
*/
|
|
1403
|
+
async listStoryboards(storyId: string): Promise<ListStoryboardsResponse> {
|
|
1404
|
+
return this.transport.requestJson<ListStoryboardsResponse>(
|
|
1405
|
+
this.transport.baseUrl,
|
|
1406
|
+
this.boardsPath(storyId),
|
|
1407
|
+
);
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Read one board in full — frames + presigned variant URLs, and (with
|
|
1412
|
+
* `view: 'quests'`) the computed quest join. `GET
|
|
1413
|
+
* /api/v1/stories/{storyId}/storyboards/{storyboardId}?view=…&sessionId=…`.
|
|
1414
|
+
* This is also the 202-create poll target.
|
|
1415
|
+
*
|
|
1416
|
+
* `sessionId` (§Q SEC.44, additive): the caller's OWN play session. The
|
|
1417
|
+
* storyboard reads take the fork-material grade, so a definition's player who
|
|
1418
|
+
* is not a member of the story's owner reads the board their run plays only
|
|
1419
|
+
* by naming that session — and only at the default `arc` view. A caller the
|
|
1420
|
+
* grade already admits is unaffected by it.
|
|
1421
|
+
*/
|
|
1422
|
+
async getStoryboard(
|
|
1423
|
+
storyId: string,
|
|
1424
|
+
storyboardId: string,
|
|
1425
|
+
params?: { view?: StoryboardView; sessionId?: string },
|
|
1426
|
+
): Promise<StoryboardDetailResponse> {
|
|
1427
|
+
const search = new URLSearchParams();
|
|
1428
|
+
if (params?.view) search.set('view', params.view);
|
|
1429
|
+
if (params?.sessionId) search.set('sessionId', params.sessionId);
|
|
1430
|
+
const encoded = search.toString();
|
|
1431
|
+
const query = encoded ? `?${encoded}` : '';
|
|
1432
|
+
return this.transport.requestJson<StoryboardDetailResponse>(
|
|
1433
|
+
this.transport.baseUrl,
|
|
1434
|
+
`${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}${query}`,
|
|
1435
|
+
);
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
/**
|
|
1439
|
+
* Partial edit of ONE frame — prompt fields, duration, transition, camera,
|
|
1440
|
+
* refs, extensions. Absent fields are unchanged; pass the frame's `txnVer`
|
|
1441
|
+
* to make the write version-guarded (409 on a stale base). `PATCH
|
|
1442
|
+
* /api/v1/stories/{storyId}/storyboards/{storyboardId}/frames/{frameId}`.
|
|
1443
|
+
*/
|
|
1444
|
+
async patchStoryboardFrame(
|
|
1445
|
+
storyId: string,
|
|
1446
|
+
storyboardId: string,
|
|
1447
|
+
frameId: string,
|
|
1448
|
+
body: PatchStoryboardFrameRequest,
|
|
1449
|
+
): Promise<StoryboardFrameResponse> {
|
|
1450
|
+
return this.transport.requestJson<StoryboardFrameResponse>(
|
|
1451
|
+
this.transport.baseUrl,
|
|
1452
|
+
this.framePath(storyId, storyboardId, frameId),
|
|
1453
|
+
{ method: 'PATCH', body: JSON.stringify(body) },
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
/**
|
|
1458
|
+
* @deprecated Use {@link StoryboardsApi.retryStoryboardFrame} — it is the same
|
|
1459
|
+
* operation under the name the server actually implements, and it accepts the
|
|
1460
|
+
* `{modelId}` body this signature cannot express (§Q SB.55).
|
|
1461
|
+
*
|
|
1462
|
+
* Re-run generation for ONE frame with its CURRENT prompt (patch it first with
|
|
1463
|
+
* {@link StoryboardsApi.patchStoryboardFrame} to change it) → **202** + the
|
|
1464
|
+
* frame as it stands; poll the detail read for the appended variant.
|
|
1465
|
+
*
|
|
1466
|
+
* **§Q SB.70 — this used to POST `…/frames/{frameId}/regenerate`, a route that
|
|
1467
|
+
* never existed, so every call 404'd.** It was published by SB-U.1 (#1472)
|
|
1468
|
+
* against a planned endpoint and shipped ahead of it; `SB-U.6`'s row was
|
|
1469
|
+
* written against this method, hit the 404, and had to be rebuilt on `/retry`.
|
|
1470
|
+
* It now targets `/retry`, which has done exactly this job since §Q SB.35.
|
|
1471
|
+
*
|
|
1472
|
+
* Retargeting rather than removing is deliberate: client-core is a contract
|
|
1473
|
+
* with two consumers, one of them a pinned app outside this repo, so the
|
|
1474
|
+
* method must keep existing. Two behaviours you inherit from the real route
|
|
1475
|
+
* and should know about — it **409s a board that is not terminal** (a running
|
|
1476
|
+
* generation already owns the frame), and a retry of an ALREADY-SUCCEEDED
|
|
1477
|
+
* frame is allowed and is a PAID re-roll.
|
|
1478
|
+
*/
|
|
1479
|
+
async regenerateStoryboardFrame(
|
|
1480
|
+
storyId: string,
|
|
1481
|
+
storyboardId: string,
|
|
1482
|
+
frameId: string,
|
|
1483
|
+
): Promise<StoryboardFrameResponse> {
|
|
1484
|
+
return this.retryStoryboardFrame(storyId, storyboardId, frameId);
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* Edit a REGION of one frame — with a mask (inpaint) or without (semantic
|
|
1489
|
+
* edit). `POST …/frames/{frameId}/region-edit` → **202** + the frame with a
|
|
1490
|
+
* PENDING `region_edit` variant appended.
|
|
1491
|
+
*/
|
|
1492
|
+
async regionEditStoryboardFrame(
|
|
1493
|
+
storyId: string,
|
|
1494
|
+
storyboardId: string,
|
|
1495
|
+
frameId: string,
|
|
1496
|
+
body: RegionEditFrameRequest,
|
|
1497
|
+
): Promise<StoryboardFrameResponse> {
|
|
1498
|
+
return this.transport.requestJson<StoryboardFrameResponse>(
|
|
1499
|
+
this.transport.baseUrl,
|
|
1500
|
+
`${this.framePath(storyId, storyboardId, frameId)}/region-edit`,
|
|
1501
|
+
{ method: 'POST', body: JSON.stringify(body) },
|
|
1502
|
+
);
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
/**
|
|
1506
|
+
* Choose which variant is the frame's image — SYNCHRONOUS and
|
|
1507
|
+
* version-guarded (echo the frame's `txnVer`; a stale value 409s rather than
|
|
1508
|
+
* clobbering a concurrent edit). `POST …/frames/{frameId}/select-variant`.
|
|
1509
|
+
*/
|
|
1510
|
+
async selectStoryboardFrameVariant(
|
|
1511
|
+
storyId: string,
|
|
1512
|
+
storyboardId: string,
|
|
1513
|
+
frameId: string,
|
|
1514
|
+
body: SelectFrameVariantRequest,
|
|
1515
|
+
): Promise<StoryboardFrameResponse> {
|
|
1516
|
+
return this.transport.requestJson<StoryboardFrameResponse>(
|
|
1517
|
+
this.transport.baseUrl,
|
|
1518
|
+
`${this.framePath(storyId, storyboardId, frameId)}/select-variant`,
|
|
1519
|
+
{ method: 'POST', body: JSON.stringify(body) },
|
|
1520
|
+
);
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
/**
|
|
1524
|
+
* Regenerate ONE frame of a terminal board — 202, the board stays terminal
|
|
1525
|
+
* (§Q SB.35, `POST
|
|
1526
|
+
* /api/v1/stories/{storyId}/storyboards/{storyboardId}/frames/{frameId}/retry`).
|
|
1527
|
+
*
|
|
1528
|
+
* The recovery action for a PARTIALLY failed board: without it the only way
|
|
1529
|
+
* to repair one blocked frame is regenerating the whole storyboard, which
|
|
1530
|
+
* re-pays for every frame that already rendered. Pass
|
|
1531
|
+
* {@link RetryStoryboardFrameRequest.modelId} to re-compose with a different
|
|
1532
|
+
* model (§Q SB.55); omit the body entirely to use the board's own.
|
|
1533
|
+
*
|
|
1534
|
+
* **It is asynchronous and PAID.** The response carries the frame as it
|
|
1535
|
+
* stands NOW — poll {@link StoryboardsApi.getStoryboard} for the appended
|
|
1536
|
+
* variant. Two dispatches for the same frame are refused: the second gets a
|
|
1537
|
+
* **409** rather than composing a second billed image (§Q SB.44), so a UI
|
|
1538
|
+
* should disable the control while one is outstanding and treat a 409 as
|
|
1539
|
+
* "already running", not as an error to surface.
|
|
1540
|
+
*
|
|
1541
|
+
* ⚠ **The 202 returns the frame UNCHANGED — no pending variant is appended**
|
|
1542
|
+
* (the worker appends it asynchronously). So the response is a receipt, not
|
|
1543
|
+
* new state: a caller cannot tell from it that the retry is in flight, and
|
|
1544
|
+
* must keep its own outstanding flag and watch the detail read for a variant
|
|
1545
|
+
* id it did not already hold. Watching the variant COUNT does not work at
|
|
1546
|
+
* {@link FRAME_VARIANT_HISTORY_CAP} — `append_variant` evicts one to add one,
|
|
1547
|
+
* so the length does not change (§Q SB-U.6).
|
|
1548
|
+
*/
|
|
1549
|
+
async retryStoryboardFrame(
|
|
1550
|
+
storyId: string,
|
|
1551
|
+
storyboardId: string,
|
|
1552
|
+
frameId: string,
|
|
1553
|
+
body: RetryStoryboardFrameRequest = {},
|
|
1554
|
+
): Promise<StoryboardFrameResponse> {
|
|
1555
|
+
return this.transport.requestJson<StoryboardFrameResponse>(
|
|
1556
|
+
this.transport.baseUrl,
|
|
1557
|
+
`${this.framePath(storyId, storyboardId, frameId)}/retry`,
|
|
1558
|
+
{ method: 'POST', body: JSON.stringify(body) },
|
|
1559
|
+
);
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* Persist the HappyOyster world this frame opens into — the DM world-entry
|
|
1564
|
+
* write (§Q DM.1). `PUT
|
|
1565
|
+
* /api/v1/stories/{storyId}/storyboards/{storyboardId}/frames/{frameId}/world`.
|
|
1566
|
+
*
|
|
1567
|
+
* Call it IMMEDIATELY after `createWorld` resolves, and also from
|
|
1568
|
+
* `HappyOysterLaunchError.handle` when `startTravel` failed on a world that
|
|
1569
|
+
* was nonetheless created — that world is already billed, and this call is the
|
|
1570
|
+
* only thing that keeps it findable. Idempotent: safe to retry with the same
|
|
1571
|
+
* id. See {@link SetFrameWorldRequest} for the 409 semantics.
|
|
1572
|
+
*/
|
|
1573
|
+
async setStoryboardFrameWorld(
|
|
1574
|
+
storyId: string,
|
|
1575
|
+
storyboardId: string,
|
|
1576
|
+
frameId: string,
|
|
1577
|
+
body: SetFrameWorldRequest,
|
|
1578
|
+
options: { supersede?: boolean } = {},
|
|
1579
|
+
): Promise<StoryboardFrameResponse> {
|
|
1580
|
+
// §Q MOMENT.8 — the flag and `body.supersedesWorldId` are ONE decision and
|
|
1581
|
+
// the server 422s on either half alone. Sending the flag only when a fence
|
|
1582
|
+
// is present is what keeps a plain DM-side bind on the first-writer-wins
|
|
1583
|
+
// path: a supersede is creator-only and must never be reachable by default.
|
|
1584
|
+
const supersede = options.supersede === true ? '?supersede=true' : '';
|
|
1585
|
+
return this.transport.requestJson<StoryboardFrameResponse>(
|
|
1586
|
+
this.transport.baseUrl,
|
|
1587
|
+
`${this.framePath(storyId, storyboardId, frameId)}/world${supersede}`,
|
|
1588
|
+
{ method: 'PUT', body: JSON.stringify(body) },
|
|
1589
|
+
);
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Plan pre-minting one adventure world per BEAT (§Q MOMENT.6a) —
|
|
1594
|
+
* `/api/v1/stories/{storyId}/storyboards/{storyboardId}/worlds/prepare`.
|
|
1595
|
+
*
|
|
1596
|
+
* **§Q WORLD.29 — two arms, and the DEFAULT reserves nothing.** Without
|
|
1597
|
+
* `confirm` this is the spend PREVIEW (`GET`): the same plan with
|
|
1598
|
+
* `preview: true`, no lease taken, no cap slot consumed — so a preview a
|
|
1599
|
+
* creator abandons blocks no board/video delete. With `confirm: true` it is
|
|
1600
|
+
* the creator's CONFIRM (`POST`): every `pending` entry is LEASED (a story
|
|
1601
|
+
* cap slot reserved for an hour) and carries the `leaseToken` the bind must
|
|
1602
|
+
* echo. Only an explicit "mint" click may pass `confirm` — the owner ruled
|
|
1603
|
+
* leases are taken only on confirm. The confirm answers a 409
|
|
1604
|
+
* `reactor_disabled` while the admin Reactor switch is off (§Q WORLD.30).
|
|
1605
|
+
*
|
|
1606
|
+
* ⚠ **CREATOR-INVOKED ONLY, and the confirm authorises SPEND.** `pendingCount`
|
|
1607
|
+
* is a count of permanent, billed, undeletable worlds — show it before
|
|
1608
|
+
* minting. Then, for each `pending` entry of the CONFIRM, `createWorld` from
|
|
1609
|
+
* that frame's image + compiled prompt and persist the result with
|
|
1610
|
+
* {@link StoryboardsApi.setStoryboardFrameWorld}. Nothing is minted server-side.
|
|
1611
|
+
*
|
|
1612
|
+
* `supersede` (§Q MOMENT.8) re-opens already-bound beats for replacement
|
|
1613
|
+
* instead of skipping them; each authorised entry carries the `worldId` to
|
|
1614
|
+
* echo back as `supersedesWorldId`.
|
|
1615
|
+
*
|
|
1616
|
+
* **§Q WORLD.44 — `frameIds` SCOPES the confirm.** Pass the anchor frames the
|
|
1617
|
+
* run will actually mint (the `frameId` of each confirmed target): only those
|
|
1618
|
+
* beats are leased, and the response reports only them. A confirm without it
|
|
1619
|
+
* leases EVERY pending beat for an hour, holding board and video DELETE at 409
|
|
1620
|
+
* over beats nobody mints. Ignored on the preview. Leases the run then will
|
|
1621
|
+
* not spend go back through {@link StoryboardsApi.releaseStoryboardWorlds}.
|
|
1622
|
+
*/
|
|
1623
|
+
async prepareStoryboardWorlds(
|
|
1624
|
+
storyId: string,
|
|
1625
|
+
storyboardId: string,
|
|
1626
|
+
options: {
|
|
1627
|
+
supersede?: boolean;
|
|
1628
|
+
confirm?: boolean;
|
|
1629
|
+
frameIds?: readonly string[];
|
|
1630
|
+
} = {},
|
|
1631
|
+
): Promise<PrepareStoryboardWorldsResponse> {
|
|
1632
|
+
const supersede = options.supersede === true ? '?supersede=true' : '';
|
|
1633
|
+
const confirm = options.confirm === true;
|
|
1634
|
+
return this.transport.requestJson<PrepareStoryboardWorldsResponse>(
|
|
1635
|
+
this.transport.baseUrl,
|
|
1636
|
+
`${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}/worlds/prepare${supersede}`,
|
|
1637
|
+
confirm && options.frameIds !== undefined
|
|
1638
|
+
? { method: 'POST', body: JSON.stringify({ frameIds: [...options.frameIds] }) }
|
|
1639
|
+
: { method: confirm ? 'POST' : 'GET' },
|
|
1640
|
+
);
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
/**
|
|
1644
|
+
* Hand back world-mint authorisations this client will not spend (§Q
|
|
1645
|
+
* WORLD.44) — `POST
|
|
1646
|
+
* /api/v1/stories/{storyId}/storyboards/{storyboardId}/worlds/release`.
|
|
1647
|
+
*
|
|
1648
|
+
* Call it for a confirm the drift check refused, and for targets a run never
|
|
1649
|
+
* reached or skipped before `createWorld`. ⛔ NEVER for a target whose mint may
|
|
1650
|
+
* have been billed — a release frees the slot for another prepare while that
|
|
1651
|
+
* world is still unrecorded. Token-fenced and idempotent; not Reactor-gated.
|
|
1652
|
+
*/
|
|
1653
|
+
async releaseStoryboardWorlds(
|
|
1654
|
+
storyId: string,
|
|
1655
|
+
storyboardId: string,
|
|
1656
|
+
body: ReleaseStoryboardWorldsRequest,
|
|
1657
|
+
): Promise<ReleaseStoryboardWorldsResponse> {
|
|
1658
|
+
return this.transport.requestJson<ReleaseStoryboardWorldsResponse>(
|
|
1659
|
+
this.transport.baseUrl,
|
|
1660
|
+
`${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}/worlds/release`,
|
|
1661
|
+
{ method: 'POST', body: JSON.stringify(body) },
|
|
1662
|
+
);
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
/**
|
|
1666
|
+
* Reorder the board — a FULL-LIST replace of {@link Storyboard.frameIds},
|
|
1667
|
+
* which is the ONE ordering source of truth, so this is idempotent and
|
|
1668
|
+
* cannot diverge from a per-frame order. `PATCH
|
|
1669
|
+
* /api/v1/stories/{storyId}/storyboards/{storyboardId}/order`.
|
|
1670
|
+
*/
|
|
1671
|
+
async reorderStoryboardFrames(
|
|
1672
|
+
storyId: string,
|
|
1673
|
+
storyboardId: string,
|
|
1674
|
+
body: ReorderStoryboardFramesRequest,
|
|
1675
|
+
): Promise<StoryboardResponse> {
|
|
1676
|
+
return this.transport.requestJson<StoryboardResponse>(
|
|
1677
|
+
this.transport.baseUrl,
|
|
1678
|
+
`${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}/order`,
|
|
1679
|
+
{ method: 'PATCH', body: JSON.stringify(body) },
|
|
1680
|
+
);
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* Export the board to one of the v1 targets (`longlive` / `seedance` /
|
|
1685
|
+
* `bundle`). `GET
|
|
1686
|
+
* /api/v1/stories/{storyId}/storyboards/{storyboardId}/export/{target}`.
|
|
1687
|
+
*/
|
|
1688
|
+
async exportStoryboard(
|
|
1689
|
+
storyId: string,
|
|
1690
|
+
storyboardId: string,
|
|
1691
|
+
target: StoryboardExportTarget,
|
|
1692
|
+
): Promise<ExportStoryboardResponse> {
|
|
1693
|
+
return this.transport.requestJson<ExportStoryboardResponse>(
|
|
1694
|
+
this.transport.baseUrl,
|
|
1695
|
+
`${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}/export/${encodeURIComponent(target)}`,
|
|
1696
|
+
);
|
|
1697
|
+
}
|
|
1698
|
+
}
|