@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
package/src/obo.ts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MT9 OBO (on-behalf-of) account-linking conventions — the CARRY side only.
|
|
3
|
+
*
|
|
4
|
+
* The escape `../Web-App` federates its users into seer via a per-user
|
|
5
|
+
* on-behalf-of actor claim (MT spec `specs/2026-06-15-multi-tenant-rbac.md`
|
|
6
|
+
* §8 / §8.1 — the authoritative wire contract): the Web-App's SERVER mints a
|
|
7
|
+
* short-lived, signed assertion carrying the Web-App `User._id`, and seer's
|
|
8
|
+
* middleware (future MT9-build, owner-gated) accepts it as "the trusted
|
|
9
|
+
* service principal acting on behalf of `webapp:<mongoId>`".
|
|
10
|
+
*
|
|
11
|
+
* Division of responsibility (owner-ratified, MT spec §0.1 R3):
|
|
12
|
+
*
|
|
13
|
+
* - **Minting is SERVER-SIDE ONLY.** It requires a signing secret, and
|
|
14
|
+
* client-core is a published, secret-free package. Nothing in this module
|
|
15
|
+
* signs, verifies, or decodes an assertion — the assertion is an OPAQUE
|
|
16
|
+
* string to every client-core consumer.
|
|
17
|
+
* - **Carrying lives HERE (once).** Both consumers of `@escapeaihq/client-core`
|
|
18
|
+
* (seer's `web/` and the Vue `../Web-App`) reach seer through the shared
|
|
19
|
+
* `ApiClient`, so the header convention is defined in exactly one place:
|
|
20
|
+
* `ApiClient.setOboAssertion(...)` attaches {@link OBO_ASSERTION_HEADER} to
|
|
21
|
+
* every JSON request. Duplicating the header name in either app is a bug.
|
|
22
|
+
*
|
|
23
|
+
* Everything here is additive and inert: no export changes behavior unless a
|
|
24
|
+
* caller explicitly sets an assertion, and seer's backend does not read the
|
|
25
|
+
* header until the owner-gated MT9-build phase lands (until then it is
|
|
26
|
+
* ignored by the API, byte-identical behavior).
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* HTTP header that carries the server-minted OBO assertion (a compact JWS),
|
|
31
|
+
* sent ALONGSIDE the existing `Authorization: Bearer <service key>` — the
|
|
32
|
+
* service key remains the trust anchor; the assertion only narrows WHO the
|
|
33
|
+
* service is acting for. Never carried in a query string (logs/referrers).
|
|
34
|
+
*/
|
|
35
|
+
export const OBO_ASSERTION_HEADER = 'X-Seer-OBO-Assertion';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* `aud` the minter MUST set and the seer verifier MUST require — scopes the
|
|
39
|
+
* assertion to seer so a leaked token is useless against any other audience.
|
|
40
|
+
*/
|
|
41
|
+
export const OBO_AUDIENCE_SEER = 'seer-agent';
|
|
42
|
+
|
|
43
|
+
/** `iss` for assertions minted by the escape `../Web-App` Nitro server. */
|
|
44
|
+
export const OBO_ISSUER_WEBAPP = 'escape-web-app';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Maximum assertion lifetime (`exp - iat`) the seer verifier will accept.
|
|
48
|
+
* Assertions are minted per REQUEST (or per short burst) by the proxy, so a
|
|
49
|
+
* tight TTL bounds replay without any server-side revocation state.
|
|
50
|
+
*/
|
|
51
|
+
export const OBO_MAX_TTL_SECONDS = 120;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Namespace prefix for federated Web-App user ids inside seer. A federated
|
|
55
|
+
* caller resolves to `request.state.user_id === 'webapp:<mongoObjectId>'` —
|
|
56
|
+
* the prefix guarantees it can never collide with a Descope `sub` or with
|
|
57
|
+
* the service principal id itself (MT spec §8).
|
|
58
|
+
*/
|
|
59
|
+
export const FEDERATED_USER_ID_PREFIX = 'webapp:';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The §8.1 v1 contract pins `act.sub` to `webapp:<mongoObjectId>` — a Mongo
|
|
63
|
+
* ObjectId is exactly 24 hex chars. Enforced here because the resulting id
|
|
64
|
+
* becomes `ownerUserId`/`tenantId`, is stamped into S3 object metadata and
|
|
65
|
+
* used as a DynamoDB key: an unvalidated suffix (slashes, colons, spaces)
|
|
66
|
+
* would flow into those sinks unchecked. (2026-07-05 security-panel fold.)
|
|
67
|
+
*/
|
|
68
|
+
const MONGO_OBJECT_ID_RE = /^[0-9a-fA-F]{24}$/;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Build the namespaced seer user id for a Web-App `User._id`. Throws when the
|
|
72
|
+
* id is not a Mongo ObjectId (24 hex chars) — the §8.1 v1 shape.
|
|
73
|
+
*/
|
|
74
|
+
export function toFederatedUserId(webAppUserId: string): string {
|
|
75
|
+
const trimmed = webAppUserId.trim();
|
|
76
|
+
if (!MONGO_OBJECT_ID_RE.test(trimmed)) {
|
|
77
|
+
throw new Error(
|
|
78
|
+
'toFederatedUserId: webAppUserId must be a Mongo ObjectId (24 hex chars)',
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
return `${FEDERATED_USER_ID_PREFIX}${trimmed}`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Whether a seer user id denotes a federated Web-App user. */
|
|
85
|
+
export function isFederatedUserId(userId: string): boolean {
|
|
86
|
+
return userId.startsWith(FEDERATED_USER_ID_PREFIX);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Extract the raw Web-App `User._id` from a namespaced seer user id, or
|
|
91
|
+
* `undefined` when the id is not federated (or the suffix is empty).
|
|
92
|
+
*/
|
|
93
|
+
export function parseFederatedUserId(userId: string): string | undefined {
|
|
94
|
+
if (!isFederatedUserId(userId)) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
const raw = userId.slice(FEDERATED_USER_ID_PREFIX.length);
|
|
98
|
+
return raw.length > 0 ? raw : undefined;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* RFC 8693 §4.1 actor claim: `act.sub` names the party the service principal
|
|
103
|
+
* is acting on behalf of — always a {@link FEDERATED_USER_ID_PREFIX}-prefixed
|
|
104
|
+
* id at this hop. (The same primitive is reused for the gateway→Tools hop,
|
|
105
|
+
* tech-debt #364, where `act.sub` is a Descope `sub` instead.)
|
|
106
|
+
*/
|
|
107
|
+
export interface OboActorClaim {
|
|
108
|
+
sub: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Claim shape of the server-minted OBO assertion (MT spec §8.1). Client-core
|
|
113
|
+
* ships this as a TYPE for the two servers that mint/verify — client code
|
|
114
|
+
* never constructs or inspects one (the assertion stays opaque in transit).
|
|
115
|
+
*/
|
|
116
|
+
export interface OboAssertionClaims {
|
|
117
|
+
/** Minting surface, e.g. {@link OBO_ISSUER_WEBAPP}. */
|
|
118
|
+
iss: string;
|
|
119
|
+
/** MUST be {@link OBO_AUDIENCE_SEER} for the Web-App→seer hop. */
|
|
120
|
+
aud: string;
|
|
121
|
+
/** The SERVICE principal doing the acting (e.g. `gateway-service`). */
|
|
122
|
+
sub: string;
|
|
123
|
+
/** Who the service is acting for (RFC 8693 actor claim). */
|
|
124
|
+
act: OboActorClaim;
|
|
125
|
+
/**
|
|
126
|
+
* Seer-native roles, ALREADY boundary-mapped by the minter via
|
|
127
|
+
* {@link mapWebAppRole} — seer never sees raw Web-App enum values.
|
|
128
|
+
*/
|
|
129
|
+
roles?: SeerRole[];
|
|
130
|
+
/** Optional grant capabilities carried with the roles (MT spec §2.2c). */
|
|
131
|
+
capabilities?: SeerCapability[];
|
|
132
|
+
/** Pay tier, federated from the Web-App's billing (MT spec §6). */
|
|
133
|
+
tier?: string;
|
|
134
|
+
/** Issued-at (seconds since epoch). */
|
|
135
|
+
iat: number;
|
|
136
|
+
/** Expiry; `exp - iat` MUST NOT exceed {@link OBO_MAX_TTL_SECONDS}. */
|
|
137
|
+
exp: number;
|
|
138
|
+
/** Unique token id (replay tracing in logs; no server-side store). */
|
|
139
|
+
jti?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Seer-native role lattice (MT spec §2.2 — a SET, unlike the Web-App scalar). */
|
|
143
|
+
export type SeerRole = 'owner' | 'admin' | 'creator' | 'viewer';
|
|
144
|
+
|
|
145
|
+
/** Capabilities orthogonal to roles (grants/flags, MT spec §2.2c). */
|
|
146
|
+
export type SeerCapability = 'blessed_creator_grant' | 'assistant_principal';
|
|
147
|
+
|
|
148
|
+
/** Result of mapping ONE Web-App role scalar across the federation boundary. */
|
|
149
|
+
export interface SeerRoleMapping {
|
|
150
|
+
roles: SeerRole[];
|
|
151
|
+
capabilities: SeerCapability[];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const VIEWER_ONLY: SeerRoleMapping = { roles: ['viewer'], capabilities: [] };
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The §2.2 federation boundary map — the ONE place Web-App `UserRoleType`
|
|
158
|
+
* values translate into seer's native lattice, so Web-App enum churn is
|
|
159
|
+
* absorbed here instead of leaking into seer's authorizer:
|
|
160
|
+
*
|
|
161
|
+
* - `creator` / `producer` → seer `creator`
|
|
162
|
+
* - `default` → seer `viewer`
|
|
163
|
+
* - `editorial_contributor` → seer `viewer` + `blessed_creator_grant`
|
|
164
|
+
* (a capability, NOT a role — MT spec §2.2c)
|
|
165
|
+
* - `admin` → seer `admin` (the Web-App expresses admin outside its
|
|
166
|
+
* `UserRoleType` enum; the minter normalizes whatever signal it uses to
|
|
167
|
+
* the literal `'admin'` before mapping). NOTE the §8.1 trust CEILING: a
|
|
168
|
+
* federated `admin` role feeds the RBAC lattice only — seer's admin
|
|
169
|
+
* control plane (`require_admin`) additionally requires the seer-side
|
|
170
|
+
* admin gate to allowlist the `webapp:<id>` principal, and `owner` is
|
|
171
|
+
* never grantable via federation.
|
|
172
|
+
*
|
|
173
|
+
* Keys are the Web-App's literal enum values (`User.model.ts:13-18`) plus
|
|
174
|
+
* `admin`. Unknown values intentionally fall to viewer-only (least
|
|
175
|
+
* privilege) via {@link mapWebAppRole} — never throw at the boundary.
|
|
176
|
+
*/
|
|
177
|
+
export const WEBAPP_ROLE_TO_SEER: Readonly<Record<string, SeerRoleMapping>> = {
|
|
178
|
+
admin: { roles: ['admin'], capabilities: [] },
|
|
179
|
+
creator: { roles: ['creator'], capabilities: [] },
|
|
180
|
+
producer: { roles: ['creator'], capabilities: [] },
|
|
181
|
+
default: VIEWER_ONLY,
|
|
182
|
+
editorial_contributor: {
|
|
183
|
+
roles: ['viewer'],
|
|
184
|
+
capabilities: ['blessed_creator_grant'],
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Map a Web-App role scalar to seer's lattice, tolerantly: case/whitespace
|
|
190
|
+
* normalized; unknown or empty values yield viewer-only (fail to LEAST
|
|
191
|
+
* privilege — a new Web-App role must be added to the map deliberately
|
|
192
|
+
* before it grants anything in seer).
|
|
193
|
+
*/
|
|
194
|
+
export function mapWebAppRole(webAppRole: string | null | undefined): SeerRoleMapping {
|
|
195
|
+
const key = (webAppRole ?? '').trim().toLowerCase();
|
|
196
|
+
const mapped = WEBAPP_ROLE_TO_SEER[key];
|
|
197
|
+
if (!mapped) {
|
|
198
|
+
return { roles: [...VIEWER_ONLY.roles], capabilities: [] };
|
|
199
|
+
}
|
|
200
|
+
return { roles: [...mapped.roles], capabilities: [...mapped.capabilities] };
|
|
201
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AU.4 slice 4 — browser-side Opus transport legs (libopus-wasm).
|
|
3
|
+
*
|
|
4
|
+
* Wraps the `libopus-wasm` package (an OPTIONAL peer dependency, loaded via
|
|
5
|
+
* dynamic `import()` exactly like the KVS WebRTC SDK in `vision/`) into the
|
|
6
|
+
* two codec legs the Opus-over-WS transport needs:
|
|
7
|
+
*
|
|
8
|
+
* - **Mic leg (encode):** the tagged PCM16 frames `MicrophoneRecorder`
|
|
9
|
+
* already emits (TAG_MIC + 320 samples @16 kHz mono, 20 ms) are
|
|
10
|
+
* re-encoded into TAG_MIC_OPUS wire frames (1-byte tag + one raw RFC 6716
|
|
11
|
+
* Opus packet ≤1275 B) matching the backend's `validate_opus_frame`.
|
|
12
|
+
* - **TTS leg (decode):** variable-length TAG_AI_OPUS server frames are
|
|
13
|
+
* decoded back to 16 kHz PCM16 and re-framed as LEGACY TAG_AI wire frames,
|
|
14
|
+
* so the entire downstream pipeline (`AudioFramePlayer`, jitter buffer,
|
|
15
|
+
* viseme anchoring, playback tracker) is codec-agnostic and unchanged.
|
|
16
|
+
*
|
|
17
|
+
* Consumers never construct these directly — `VoiceSession` owns the
|
|
18
|
+
* lifecycle (preload before the hello offer, free on teardown). Kept
|
|
19
|
+
* framework-agnostic: no React/Vue imports, no DOM audio dependency.
|
|
20
|
+
*
|
|
21
|
+
* Bundle note: `libopus-wasm` is a single-file ES module (~200 KiB gzipped,
|
|
22
|
+
* wasm embedded — no second `.wasm` asset request, no `locateFile` hook, so
|
|
23
|
+
* none of the worklet-style public-asset serving problems). The dynamic
|
|
24
|
+
* import means consumers that never opt into Opus load ZERO extra bytes.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import {
|
|
28
|
+
CHANNELS,
|
|
29
|
+
SAMPLE_RATE,
|
|
30
|
+
SAMPLES_PER_FRAME,
|
|
31
|
+
TAG_AI,
|
|
32
|
+
TAG_MIC_OPUS,
|
|
33
|
+
WIRE_FRAME_BYTES,
|
|
34
|
+
decodeOpusFrame,
|
|
35
|
+
encodeAudioFrame,
|
|
36
|
+
encodeOpusFrame,
|
|
37
|
+
} from './audioProtocol';
|
|
38
|
+
|
|
39
|
+
// Minimal STRUCTURAL types for the slice of the libopus-wasm surface we use.
|
|
40
|
+
// Deliberately local (not `import type … from 'libopus-wasm'`) so the emitted
|
|
41
|
+
// .d.ts never references the optional peer dep — a published consumer that
|
|
42
|
+
// does not install it must still type-check (same posture as the KVS SDK's
|
|
43
|
+
// `unknown`-narrowing in `vision/VisionPublisher.ts`). Exported so an
|
|
44
|
+
// alternative codec engine (e.g. a future WebCodecs leg) can plug into the
|
|
45
|
+
// same wrappers.
|
|
46
|
+
export type OpusEncoderHandle = {
|
|
47
|
+
encode(pcm: Int16Array): Uint8Array;
|
|
48
|
+
free(): void;
|
|
49
|
+
};
|
|
50
|
+
export type OpusDecoderHandle = {
|
|
51
|
+
decode(packet: Uint8Array): Int16Array;
|
|
52
|
+
free(): void;
|
|
53
|
+
};
|
|
54
|
+
export type LibopusModule = {
|
|
55
|
+
Application: { readonly Voip: number };
|
|
56
|
+
createEncoder(options?: {
|
|
57
|
+
sampleRate?: number;
|
|
58
|
+
channels?: number;
|
|
59
|
+
application?: number;
|
|
60
|
+
bitrate?: number;
|
|
61
|
+
}): Promise<OpusEncoderHandle>;
|
|
62
|
+
createDecoder(options?: {
|
|
63
|
+
sampleRate?: number;
|
|
64
|
+
channels?: number;
|
|
65
|
+
}): Promise<OpusDecoderHandle>;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** Opus encoder bitrate for the mic leg (bps). Matches the backend TTS leg's
|
|
69
|
+
* `OPUS_TTS_BITRATE` posture (32 kbps VoIP — the spec-K Phase 0.5 target,
|
|
70
|
+
* ~8x smaller than the 256 kbps PCM16 wire). */
|
|
71
|
+
export const OPUS_MIC_BITRATE = 32_000;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Mic-leg encoder: tagged PCM16 mic frame in, TAG_MIC_OPUS wire frame out.
|
|
75
|
+
*/
|
|
76
|
+
export interface MicOpusEncoder {
|
|
77
|
+
/**
|
|
78
|
+
* Encode one tagged PCM16 mic frame (TAG byte + 640 B PCM16LE, exactly as
|
|
79
|
+
* produced by `encodeAudioFrame(TAG_MIC, …)`) into a TAG_MIC_OPUS wire
|
|
80
|
+
* frame ready for `ChatWebSocket.sendAudioFrame`.
|
|
81
|
+
*/
|
|
82
|
+
encodePcmFrame(taggedPcmFrame: Uint8Array): Uint8Array;
|
|
83
|
+
/** Release the wasm codec state. Idempotent. */
|
|
84
|
+
free(): void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* TTS-leg decoder: TAG_AI_OPUS wire frame in, legacy TAG_AI PCM16 wire
|
|
89
|
+
* frames out (zero or more — decoded samples are re-framed at the fixed
|
|
90
|
+
* 20 ms/320-sample legacy frame size; a remainder is buffered for the next
|
|
91
|
+
* packet, mirroring the backend encoder's sub-frame buffering).
|
|
92
|
+
*/
|
|
93
|
+
export interface TtsOpusDecoder {
|
|
94
|
+
/**
|
|
95
|
+
* Decode one TAG_AI_OPUS wire frame. Returns the decoded audio re-framed
|
|
96
|
+
* as legacy TAG_AI PCM16 wire frames (each exactly WIRE_FRAME_BYTES, ready
|
|
97
|
+
* for `AudioPipeline.handleBinaryFrame`). Throws on a malformed wire frame
|
|
98
|
+
* or a corrupt packet — callers drop the packet and keep the session (the
|
|
99
|
+
* backend mirrors this posture: corrupt packets never kill a session).
|
|
100
|
+
*/
|
|
101
|
+
decodeWireFrame(data: ArrayBuffer): ArrayBuffer[];
|
|
102
|
+
/** Release the wasm codec state. Idempotent. */
|
|
103
|
+
free(): void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** The paired codec legs for one negotiated-Opus voice session. */
|
|
107
|
+
export interface OpusTransportCodecs {
|
|
108
|
+
micEncoder: MicOpusEncoder;
|
|
109
|
+
ttsDecoder: TtsOpusDecoder;
|
|
110
|
+
/** Free BOTH legs. Idempotent. */
|
|
111
|
+
free(): void;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
class LibopusMicEncoder implements MicOpusEncoder {
|
|
115
|
+
private freed = false;
|
|
116
|
+
|
|
117
|
+
constructor(private readonly handle: OpusEncoderHandle) {}
|
|
118
|
+
|
|
119
|
+
encodePcmFrame(taggedPcmFrame: Uint8Array): Uint8Array {
|
|
120
|
+
if (this.freed) {
|
|
121
|
+
throw new Error('MicOpusEncoder used after free()');
|
|
122
|
+
}
|
|
123
|
+
if (taggedPcmFrame.byteLength !== WIRE_FRAME_BYTES) {
|
|
124
|
+
throw new Error(
|
|
125
|
+
`Invalid mic frame size: expected ${WIRE_FRAME_BYTES} bytes, got ${taggedPcmFrame.byteLength}`,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
// Strip the 1-byte tag; the payload is 320 aligned PCM16LE samples.
|
|
129
|
+
// Int16Array views require 2-byte alignment — the tag offset breaks it,
|
|
130
|
+
// so copy into an aligned buffer (one small fixed-size copy per 20 ms).
|
|
131
|
+
const pcmBytes = taggedPcmFrame.slice(1);
|
|
132
|
+
const pcm = new Int16Array(pcmBytes.buffer, 0, SAMPLES_PER_FRAME);
|
|
133
|
+
const packet = this.handle.encode(pcm);
|
|
134
|
+
return encodeOpusFrame(TAG_MIC_OPUS, packet);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
free(): void {
|
|
138
|
+
if (this.freed) return;
|
|
139
|
+
this.freed = true;
|
|
140
|
+
this.handle.free();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
class LibopusTtsDecoder implements TtsOpusDecoder {
|
|
145
|
+
private freed = false;
|
|
146
|
+
|
|
147
|
+
/** Decoded-but-unframed PCM tail (samples), carried to the next packet. */
|
|
148
|
+
private remainder: Int16Array = new Int16Array(0);
|
|
149
|
+
|
|
150
|
+
constructor(private readonly handle: OpusDecoderHandle) {}
|
|
151
|
+
|
|
152
|
+
decodeWireFrame(data: ArrayBuffer): ArrayBuffer[] {
|
|
153
|
+
if (this.freed) {
|
|
154
|
+
throw new Error('TtsOpusDecoder used after free()');
|
|
155
|
+
}
|
|
156
|
+
const { packet } = decodeOpusFrame(data);
|
|
157
|
+
const decoded = this.handle.decode(packet);
|
|
158
|
+
|
|
159
|
+
// Join the carried remainder with the fresh samples, then emit
|
|
160
|
+
// fixed-size legacy frames. The backend encodes exact 20 ms packets, so
|
|
161
|
+
// in practice each packet decodes to exactly SAMPLES_PER_FRAME and the
|
|
162
|
+
// remainder stays empty — the buffering is protocol-robustness for any
|
|
163
|
+
// conformant Opus packet duration (2.5–60 ms).
|
|
164
|
+
let samples: Int16Array;
|
|
165
|
+
if (this.remainder.length > 0) {
|
|
166
|
+
samples = new Int16Array(this.remainder.length + decoded.length);
|
|
167
|
+
samples.set(this.remainder);
|
|
168
|
+
samples.set(decoded, this.remainder.length);
|
|
169
|
+
} else {
|
|
170
|
+
samples = decoded;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const frames: ArrayBuffer[] = [];
|
|
174
|
+
let offset = 0;
|
|
175
|
+
while (samples.length - offset >= SAMPLES_PER_FRAME) {
|
|
176
|
+
const frameSamples = samples.slice(offset, offset + SAMPLES_PER_FRAME);
|
|
177
|
+
// Re-frame as a legacy TAG_AI wire frame; copy into a standalone
|
|
178
|
+
// ArrayBuffer (the pipeline queues ArrayBuffers as-is).
|
|
179
|
+
const tagged = encodeAudioFrame(TAG_AI, frameSamples);
|
|
180
|
+
frames.push(
|
|
181
|
+
tagged.buffer.slice(
|
|
182
|
+
tagged.byteOffset,
|
|
183
|
+
tagged.byteOffset + tagged.byteLength,
|
|
184
|
+
) as ArrayBuffer,
|
|
185
|
+
);
|
|
186
|
+
offset += SAMPLES_PER_FRAME;
|
|
187
|
+
}
|
|
188
|
+
this.remainder = offset < samples.length ? samples.slice(offset) : new Int16Array(0);
|
|
189
|
+
return frames;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
free(): void {
|
|
193
|
+
if (this.freed) return;
|
|
194
|
+
this.freed = true;
|
|
195
|
+
this.handle.free();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Load libopus-wasm and construct BOTH codec legs for one voice session
|
|
201
|
+
* (16 kHz mono, 20 ms frames, VoIP application @32 kbps — the exact wire
|
|
202
|
+
* profile `shared/audio_protocol.py` pins). Rejects when the optional peer
|
|
203
|
+
* dependency is not installed or the wasm fails to compile — callers treat
|
|
204
|
+
* a rejection as "Opus unavailable" and stay on the PCM16 wire.
|
|
205
|
+
*/
|
|
206
|
+
export async function createOpusTransportCodecs(): Promise<OpusTransportCodecs> {
|
|
207
|
+
// Dynamic import: the optional-peer pattern (see `vision/`'s KVS SDK —
|
|
208
|
+
// literal specifier so bundlers can statically discover the chunk; hosts
|
|
209
|
+
// resolve it via their own install + Turbopack resolveAlias entry).
|
|
210
|
+
// Consumers that never offer Opus load none of the wasm.
|
|
211
|
+
const libopus = (await import(
|
|
212
|
+
/* webpackChunkName: "libopus-wasm" */
|
|
213
|
+
// @ts-ignore — optional peer dep; types/module may be unresolvable
|
|
214
|
+
// from client-core's realpath in a host's web-rooted install
|
|
215
|
+
'libopus-wasm'
|
|
216
|
+
)) as LibopusModule;
|
|
217
|
+
return createOpusTransportCodecsFromModule(libopus);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Construct the codec legs from an ALREADY-LOADED libopus-wasm module (the
|
|
222
|
+
* single place the 16 kHz/mono/VoIP/32 kbps wire profile is applied).
|
|
223
|
+
* `createOpusTransportCodecs` delegates here after its dynamic import; tests
|
|
224
|
+
* (and hosts that bundle the module themselves) can inject it directly.
|
|
225
|
+
*/
|
|
226
|
+
export async function createOpusTransportCodecsFromModule(
|
|
227
|
+
libopus: LibopusModule,
|
|
228
|
+
): Promise<OpusTransportCodecs> {
|
|
229
|
+
const encoderHandle = await libopus.createEncoder({
|
|
230
|
+
sampleRate: SAMPLE_RATE,
|
|
231
|
+
channels: CHANNELS,
|
|
232
|
+
application: libopus.Application.Voip,
|
|
233
|
+
bitrate: OPUS_MIC_BITRATE,
|
|
234
|
+
});
|
|
235
|
+
let decoderHandle: OpusDecoderHandle;
|
|
236
|
+
try {
|
|
237
|
+
decoderHandle = await libopus.createDecoder({
|
|
238
|
+
sampleRate: SAMPLE_RATE,
|
|
239
|
+
channels: CHANNELS,
|
|
240
|
+
});
|
|
241
|
+
} catch (err) {
|
|
242
|
+
encoderHandle.free();
|
|
243
|
+
throw err;
|
|
244
|
+
}
|
|
245
|
+
return pairOpusTransportCodecs(encoderHandle, decoderHandle);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Pair raw codec handles into the {@link OpusTransportCodecs} legs. The
|
|
250
|
+
* seam `createOpusTransportCodecs` builds on — exported so tests (and any
|
|
251
|
+
* future non-libopus engine) can drive the framing/re-framing logic with
|
|
252
|
+
* their own handles.
|
|
253
|
+
*/
|
|
254
|
+
export function pairOpusTransportCodecs(
|
|
255
|
+
encoderHandle: OpusEncoderHandle,
|
|
256
|
+
decoderHandle: OpusDecoderHandle,
|
|
257
|
+
): OpusTransportCodecs {
|
|
258
|
+
const micEncoder = new LibopusMicEncoder(encoderHandle);
|
|
259
|
+
const ttsDecoder = new LibopusTtsDecoder(decoderHandle);
|
|
260
|
+
return {
|
|
261
|
+
micEncoder,
|
|
262
|
+
ttsDecoder,
|
|
263
|
+
free(): void {
|
|
264
|
+
micEncoder.free();
|
|
265
|
+
ttsDecoder.free();
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pagination — the shared bounded page-walk every creator-surface loader uses
|
|
3
|
+
* (single source of truth; the walk was previously copy-pasted per page).
|
|
4
|
+
* Framework-agnostic + additive, like every client-core export.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Ceiling on pages walked — a runaway nextToken chain must not hang a UI. */
|
|
8
|
+
export const MAX_PAGE_WALK = 10;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Walk a token-paginated endpoint to exhaustion (bounded by
|
|
12
|
+
* {@link MAX_PAGE_WALK}). `fetchPage` receives the previous page's
|
|
13
|
+
* continuation token (undefined on the first call) and returns the page's
|
|
14
|
+
* items plus the next token (null/undefined ends the walk).
|
|
15
|
+
*/
|
|
16
|
+
export async function walkPages<T>(
|
|
17
|
+
fetchPage: (token: string | undefined) => Promise<{ items: T[]; nextToken?: string | null }>,
|
|
18
|
+
maxPages: number = MAX_PAGE_WALK,
|
|
19
|
+
): Promise<T[]> {
|
|
20
|
+
const all: T[] = [];
|
|
21
|
+
let token: string | undefined;
|
|
22
|
+
for (let page = 0; page < maxPages; page++) {
|
|
23
|
+
const { items, nextToken } = await fetchPage(token);
|
|
24
|
+
all.push(...items);
|
|
25
|
+
if (!nextToken) break;
|
|
26
|
+
token = nextToken;
|
|
27
|
+
}
|
|
28
|
+
return all;
|
|
29
|
+
}
|
package/src/platformAssistant.ts
CHANGED
|
@@ -22,10 +22,13 @@
|
|
|
22
22
|
|
|
23
23
|
import type {
|
|
24
24
|
ApiClient,
|
|
25
|
+
AssistantActionPreview,
|
|
25
26
|
AssistantRouteContext,
|
|
26
27
|
AssistantStreamEvent,
|
|
27
28
|
ChatMessage,
|
|
29
|
+
WorkflowProposalTemplate,
|
|
28
30
|
} from './api';
|
|
31
|
+
import { isAbortError } from './reactor/abortUtils';
|
|
29
32
|
|
|
30
33
|
/** Conversation roles the assistant history carries (derived from the single
|
|
31
34
|
* source of truth — `ChatMessage['role']` — so it cannot drift). */
|
|
@@ -46,6 +49,47 @@ export interface PlatformAssistantSuggestion {
|
|
|
46
49
|
rationale?: string;
|
|
47
50
|
}
|
|
48
51
|
|
|
52
|
+
/**
|
|
53
|
+
* A `workflow_proposal` (§Q L.3) surfaced to the host. Mirrors the
|
|
54
|
+
* `workflow_proposal` variant of `AssistantStreamEvent` (the wire contract
|
|
55
|
+
* shared with `api/assistant`), re-exported as a named type so the host
|
|
56
|
+
* overlay imports it verbatim rather than re-deriving the `Extract<…>` — same
|
|
57
|
+
* convention as {@link PlatformAssistantSuggestion}.
|
|
58
|
+
*/
|
|
59
|
+
export interface PlatformAssistantWorkflowProposal {
|
|
60
|
+
/** The draft workflow template the assistant proposes (no minted identity). */
|
|
61
|
+
template: WorkflowProposalTemplate;
|
|
62
|
+
/** Optional short design rationale from the model (mirrors suggestions). */
|
|
63
|
+
rationale?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* An `action_proposal` (§Q AA.5) surfaced to the host. Mirrors the
|
|
68
|
+
* `action_proposal` variant of `AssistantStreamEvent` (the wire contract
|
|
69
|
+
* shared with `api/assistant`), re-exported as a named type — same convention
|
|
70
|
+
* as {@link PlatformAssistantSuggestion}. The host renders a preview card
|
|
71
|
+
* (server preview + the honest `reversibility` verdict + the rationale
|
|
72
|
+
* visibly model-authored) with Apply/Dismiss: Apply passes `proposalToken`
|
|
73
|
+
* VERBATIM to `ApiClient.executeAssistantAction`; Dismiss simply discards it
|
|
74
|
+
* (the token expires at `expiresAt`). The controller performs NO mutation.
|
|
75
|
+
*/
|
|
76
|
+
export interface PlatformAssistantActionProposal {
|
|
77
|
+
/** Registry action id (v1: 'merge_entities'). */
|
|
78
|
+
actionId: string;
|
|
79
|
+
/** The validated action params the token binds (display only). */
|
|
80
|
+
params: Record<string, unknown>;
|
|
81
|
+
/** The SERVER-computed preview the human confirms. */
|
|
82
|
+
preview: AssistantActionPreview;
|
|
83
|
+
/** Honest RC-3 verdict (v1 merge: 'irreversible after apply'). */
|
|
84
|
+
reversibility: string;
|
|
85
|
+
/** The model's rationale — render visibly model-authored. */
|
|
86
|
+
rationale?: string;
|
|
87
|
+
/** Signed HMAC proposal token for `executeAssistantAction`. */
|
|
88
|
+
proposalToken: string;
|
|
89
|
+
/** Unix epoch seconds when the proposal expires. */
|
|
90
|
+
expiresAt: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
49
93
|
/**
|
|
50
94
|
* Host callbacks the controller invokes as the corresponding
|
|
51
95
|
* `AssistantStreamEvent` variants arrive. All optional — a host wires only the
|
|
@@ -59,6 +103,21 @@ export interface PlatformAssistantCallbacks {
|
|
|
59
103
|
onTextDelta?: (text: string) => void;
|
|
60
104
|
/** A `propose_form_fields` suggestion the host maps onto its own form. */
|
|
61
105
|
onSuggestion?: (suggestion: PlatformAssistantSuggestion) => void;
|
|
106
|
+
/**
|
|
107
|
+
* §Q L.3 — a `workflow_proposal` draft workflow template the host reviews
|
|
108
|
+
* and, if confirmed, persists via `ApiClient.createWorkflowTemplate`.
|
|
109
|
+
* Unwired hosts silently drop the event (documented behavior, mirrors every
|
|
110
|
+
* other optional callback here) — the controller performs no mutation.
|
|
111
|
+
*/
|
|
112
|
+
onWorkflowProposal?: (proposal: PlatformAssistantWorkflowProposal) => void;
|
|
113
|
+
/**
|
|
114
|
+
* §Q AA.5 — an assistant write-action proposal the host renders as a
|
|
115
|
+
* confirm card; Apply calls `ApiClient.executeAssistantAction` with the
|
|
116
|
+
* proposal's token. Unwired hosts silently drop the event (the same
|
|
117
|
+
* documented behavior as every other optional callback) — the controller
|
|
118
|
+
* performs no mutation.
|
|
119
|
+
*/
|
|
120
|
+
onActionProposal?: (proposal: PlatformAssistantActionProposal) => void;
|
|
62
121
|
/** A streamed error message (the turn failed server-side). */
|
|
63
122
|
onError?: (message: string) => void;
|
|
64
123
|
/**
|
|
@@ -200,7 +259,7 @@ export class PlatformAssistantController {
|
|
|
200
259
|
// — the SAME channel SSE `error` frames use, so a consumer has ONE error
|
|
201
260
|
// channel and ask() NEVER rejects (the framework-agnostic seam: a
|
|
202
261
|
// Vue/PlayCanvas caller need not wrap ask() in try/catch).
|
|
203
|
-
if (err
|
|
262
|
+
if (isAbortError(err)) {
|
|
204
263
|
this.callbacks.onDone?.();
|
|
205
264
|
} else {
|
|
206
265
|
this.callbacks.onError?.(err instanceof Error ? err.message : String(err));
|
|
@@ -336,6 +395,43 @@ export class PlatformAssistantController {
|
|
|
336
395
|
...(event.rationale !== undefined ? { rationale: event.rationale } : {}),
|
|
337
396
|
});
|
|
338
397
|
return;
|
|
398
|
+
case 'workflow_proposal':
|
|
399
|
+
// Defensive-copy the draft template (and its step array) the same way
|
|
400
|
+
// the 'suggestion' case above copies `fields` — the decoded event is a
|
|
401
|
+
// fresh `JSON.parse` object per frame, but copying keeps the host's
|
|
402
|
+
// retained proposal independent of any future mutation of the raw
|
|
403
|
+
// parsed frame. If the host never wires `onWorkflowProposal`, the
|
|
404
|
+
// optional-chained call below is a no-op and the event is silently
|
|
405
|
+
// dropped — same documented behavior as every other optional callback.
|
|
406
|
+
this.callbacks.onWorkflowProposal?.({
|
|
407
|
+
template: {
|
|
408
|
+
name: event.template.name,
|
|
409
|
+
...(event.template.description !== undefined
|
|
410
|
+
? { description: event.template.description }
|
|
411
|
+
: {}),
|
|
412
|
+
steps: event.template.steps.map((step) => ({ ...step })),
|
|
413
|
+
},
|
|
414
|
+
...(event.rationale != null ? { rationale: event.rationale } : {}),
|
|
415
|
+
});
|
|
416
|
+
return;
|
|
417
|
+
case 'action_proposal':
|
|
418
|
+
// Defensive-copy the parsed frame's objects (the 'suggestion' /
|
|
419
|
+
// 'workflow_proposal' discipline) so the host's retained proposal is
|
|
420
|
+
// independent of the raw parsed frame. The token is passed through
|
|
421
|
+
// VERBATIM — it is an opaque signed handle.
|
|
422
|
+
this.callbacks.onActionProposal?.({
|
|
423
|
+
actionId: event.actionId,
|
|
424
|
+
params: { ...(event.params ?? {}) },
|
|
425
|
+
preview: {
|
|
426
|
+
summary: event.preview?.summary ?? '',
|
|
427
|
+
details: { ...(event.preview?.details ?? {}) },
|
|
428
|
+
},
|
|
429
|
+
reversibility: event.reversibility,
|
|
430
|
+
...(event.rationale != null ? { rationale: event.rationale } : {}),
|
|
431
|
+
proposalToken: event.proposalToken,
|
|
432
|
+
expiresAt: event.expiresAt,
|
|
433
|
+
});
|
|
434
|
+
return;
|
|
339
435
|
case 'error':
|
|
340
436
|
this.callbacks.onError?.(event.message);
|
|
341
437
|
return;
|
package/src/pollUtils.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared polling helper (§A9.2). Extracted from `api.ts` unchanged so it can
|
|
3
|
+
* be imported by both `ApiClient` (methods not yet split into a domain
|
|
4
|
+
* module) and the domain modules under `./domains/` that implement a
|
|
5
|
+
* poll-until-terminal-state loop (images, viseme bundles, workflows, …).
|
|
6
|
+
*
|
|
7
|
+
* INTERNAL — not re-exported from `index.ts` (mirrors `transport.ts`'s
|
|
8
|
+
* not-part-of-the-published-surface convention); the published contract is
|
|
9
|
+
* unaffected by this move.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Resolves after `ms` milliseconds, or rejects with an AbortError if the
|
|
14
|
+
* optional `signal` fires before the timer expires.
|
|
15
|
+
*
|
|
16
|
+
* Listener hygiene: the abort listener is removed explicitly on the normal
|
|
17
|
+
* (timer) path so it does not linger on the signal after resolution.
|
|
18
|
+
*/
|
|
19
|
+
export function abortableSleep(ms: number, signal?: AbortSignal): Promise<void> {
|
|
20
|
+
return new Promise<void>((resolve, reject) => {
|
|
21
|
+
// Declare `timer` with `let` first so `onAbort` can reference it in the
|
|
22
|
+
// closure without a use-before-define lint error (the closure is only
|
|
23
|
+
// invoked after `timer` is assigned below).
|
|
24
|
+
let timer: ReturnType<typeof setTimeout>;
|
|
25
|
+
const onAbort = () => {
|
|
26
|
+
clearTimeout(timer);
|
|
27
|
+
reject(new DOMException('Polling aborted', 'AbortError'));
|
|
28
|
+
};
|
|
29
|
+
timer = setTimeout(() => {
|
|
30
|
+
signal?.removeEventListener('abort', onAbort);
|
|
31
|
+
resolve();
|
|
32
|
+
}, ms);
|
|
33
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
34
|
+
});
|
|
35
|
+
}
|