@crievo/omni 0.0.0-stage → 0.1.1
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/.env.example +41 -0
- package/README.md +2 -2
- package/bin/omni.mjs +18 -0
- package/docs/onboarding/clone-voice.png +0 -0
- package/docs/onboarding/getting-started.png +0 -0
- package/docs/onboarding/new-video.png +0 -0
- package/docs/onboarding/providers.png +0 -0
- package/docs/onboarding/publish.png +0 -0
- package/docs/onboarding/references.png +0 -0
- package/docs/onboarding.md +212 -0
- package/omnivideo.config.example.json +437 -0
- package/package.json +40 -4
- package/reference/captions.md +156 -0
- package/reference/carousel-contract.md +91 -0
- package/reference/cloud.md +96 -0
- package/reference/learnings.md +792 -0
- package/reference/omnichat.md +305 -0
- package/reference/premiere-mcp.md +91 -0
- package/reference/publish.md +305 -0
- package/reference/scenes-contract.md +109 -0
- package/reference/studio.md +666 -0
- package/reference/voicestudio.md +81 -0
- package/reference/writing-for-voice.md +67 -0
- package/requirements.txt +3 -0
- package/studio/api/app.ts +87 -0
- package/studio/api/lib/errors.ts +33 -0
- package/studio/api/lib/files.ts +41 -0
- package/studio/api/lib/hono.ts +9 -0
- package/studio/api/lib/result.ts +14 -0
- package/studio/api/lib/validate.ts +31 -0
- package/studio/api/lib/video.ts +10 -0
- package/studio/api/middleware/json-charset.ts +11 -0
- package/studio/api/middleware/local-only.ts +32 -0
- package/studio/api/middleware/no-timeout.ts +10 -0
- package/studio/api/routes/admin.ts +18 -0
- package/studio/api/routes/agent-cascade.ts +100 -0
- package/studio/api/routes/agent-history.ts +23 -0
- package/studio/api/routes/agent.ts +162 -0
- package/studio/api/routes/analytics.ts +31 -0
- package/studio/api/routes/approval.ts +60 -0
- package/studio/api/routes/archive.ts +12 -0
- package/studio/api/routes/captions.ts +28 -0
- package/studio/api/routes/carousel.ts +38 -0
- package/studio/api/routes/clone.ts +27 -0
- package/studio/api/routes/create.ts +19 -0
- package/studio/api/routes/events.ts +11 -0
- package/studio/api/routes/export.ts +14 -0
- package/studio/api/routes/media.ts +30 -0
- package/studio/api/routes/omnichat.ts +113 -0
- package/studio/api/routes/onboarding.ts +14 -0
- package/studio/api/routes/publish.ts +40 -0
- package/studio/api/routes/queue.ts +14 -0
- package/studio/api/routes/references.ts +40 -0
- package/studio/api/routes/runner.ts +17 -0
- package/studio/api/routes/schedule.ts +47 -0
- package/studio/api/routes/services.ts +11 -0
- package/studio/api/routes/sessions.ts +27 -0
- package/studio/api/routes/settings.ts +102 -0
- package/studio/api/routes/sound.ts +45 -0
- package/studio/api/routes/thumbnail.ts +18 -0
- package/studio/api/routes/usage.ts +13 -0
- package/studio/api/routes/videos.ts +41 -0
- package/studio/api/routes/voices.ts +71 -0
- package/studio/api/services/admin.ts +113 -0
- package/studio/api/services/agent-cascade.ts +975 -0
- package/studio/api/services/agent-claude.ts +47 -0
- package/studio/api/services/agent-history.ts +103 -0
- package/studio/api/services/agent-persona.ts +77 -0
- package/studio/api/services/agent-tools.ts +2237 -0
- package/studio/api/services/agent-ui-tools.ts +259 -0
- package/studio/api/services/agent-wait.ts +32 -0
- package/studio/api/services/agent.ts +553 -0
- package/studio/api/services/analytics.ts +92 -0
- package/studio/api/services/approval.ts +134 -0
- package/studio/api/services/archive.ts +38 -0
- package/studio/api/services/captions.ts +268 -0
- package/studio/api/services/carousel.ts +206 -0
- package/studio/api/services/classify.ts +196 -0
- package/studio/api/services/clone-phrases.ts +75 -0
- package/studio/api/services/clone.ts +722 -0
- package/studio/api/services/create.ts +421 -0
- package/studio/api/services/events.ts +215 -0
- package/studio/api/services/media.ts +32 -0
- package/studio/api/services/omnichat.ts +624 -0
- package/studio/api/services/onboarding.ts +77 -0
- package/studio/api/services/publish.ts +287 -0
- package/studio/api/services/queue.ts +150 -0
- package/studio/api/services/references.ts +269 -0
- package/studio/api/services/root.ts +60 -0
- package/studio/api/services/services.ts +114 -0
- package/studio/api/services/sessions.ts +1007 -0
- package/studio/api/services/settings.ts +983 -0
- package/studio/api/services/sound.ts +311 -0
- package/studio/api/services/thumbnail.ts +133 -0
- package/studio/api/services/usage.ts +27 -0
- package/studio/api/services/videos.ts +418 -0
- package/studio/api/services/voice-pause.ts +98 -0
- package/studio/api/services/voices.ts +324 -0
- package/studio/runner/runner.ts +244 -0
- package/studio/shared/omni-actions.ts +68 -0
- package/studio/shared/omni-admin.ts +52 -0
- package/studio/shared/omni-farewell.ts +48 -0
- package/studio/shared/omni-hotword.ts +20 -0
- package/studio/shared/omni-screens.ts +228 -0
- package/studio/shared/schemas/admin.ts +15 -0
- package/studio/shared/schemas/agent-cascade.ts +58 -0
- package/studio/shared/schemas/agent-history.ts +73 -0
- package/studio/shared/schemas/agent.ts +50 -0
- package/studio/shared/schemas/analytics.ts +6 -0
- package/studio/shared/schemas/approval.ts +22 -0
- package/studio/shared/schemas/captions.ts +19 -0
- package/studio/shared/schemas/carousel.ts +26 -0
- package/studio/shared/schemas/clone.ts +40 -0
- package/studio/shared/schemas/common.ts +16 -0
- package/studio/shared/schemas/omnichat.ts +54 -0
- package/studio/shared/schemas/onboarding.ts +5 -0
- package/studio/shared/schemas/publish.ts +45 -0
- package/studio/shared/schemas/references.ts +20 -0
- package/studio/shared/schemas/settings.ts +82 -0
- package/studio/shared/schemas/sound.ts +22 -0
- package/studio/shared/schemas/videos.ts +38 -0
- package/studio/shared/schemas/voices.ts +23 -0
- package/studio/shared/types/api.ts +1290 -0
- package/studio/studio.ts +148 -0
- package/studio/tsconfig.json +15 -0
- package/studio/web/assets/logos/cartesia.svg +4 -0
- package/studio/web/assets/logos/elevenlabs.svg +12 -0
- package/studio/web/assets/logos/fish.svg +24 -0
- package/studio/web/assets/logos/omni-black.png +0 -0
- package/studio/web/assets/logos/omni-white.png +0 -0
- package/studio/web/assets/logos/voicestudio.svg +21 -0
- package/studio/web/components/AgentMark.tsx +7 -0
- package/studio/web/components/AgentWalking.tsx +11 -0
- package/studio/web/components/ApiKeyField.tsx +104 -0
- package/studio/web/components/AppShell.tsx +64 -0
- package/studio/web/components/ApprovalNotice.tsx +65 -0
- package/studio/web/components/AvatarGroupIcon.tsx +22 -0
- package/studio/web/components/AvatarNameField.tsx +86 -0
- package/studio/web/components/AvatarPicker.tsx +84 -0
- package/studio/web/components/BrandLogo.tsx +16 -0
- package/studio/web/components/CartesiaPlanSetting.tsx +90 -0
- package/studio/web/components/ClaudeWalking.tsx +32 -0
- package/studio/web/components/CloneVoiceDialog/GuidedScript.tsx +39 -0
- package/studio/web/components/CloneVoiceDialog/LanguageBar.tsx +37 -0
- package/studio/web/components/CloneVoiceDialog/LevelMeter.tsx +31 -0
- package/studio/web/components/CloneVoiceDialog/ProviderChoice.tsx +81 -0
- package/studio/web/components/CloneVoiceDialog/QualityPanel.tsx +62 -0
- package/studio/web/components/CloneVoiceDialog/RecordStep.tsx +50 -0
- package/studio/web/components/CloneVoiceDialog/RecorderBar.tsx +79 -0
- package/studio/web/components/CloneVoiceDialog/RedoSummary.tsx +54 -0
- package/studio/web/components/CloneVoiceDialog/SaveStep.tsx +91 -0
- package/studio/web/components/CloneVoiceDialog/SourceBar.tsx +30 -0
- package/studio/web/components/CloneVoiceDialog/index.tsx +141 -0
- package/studio/web/components/CloneVoiceDialog/types.ts +28 -0
- package/studio/web/components/CloneVoiceDialog/useCloneVoice.ts +528 -0
- package/studio/web/components/ConnectionSignals.tsx +51 -0
- package/studio/web/components/EditVoiceDialog/EditVoiceFooter.tsx +72 -0
- package/studio/web/components/EditVoiceDialog/ProviderCards.tsx +81 -0
- package/studio/web/components/EditVoiceDialog/index.tsx +256 -0
- package/studio/web/components/ErrorBanner.tsx +115 -0
- package/studio/web/components/FinishedTask.tsx +41 -0
- package/studio/web/components/FishModelSetting.tsx +69 -0
- package/studio/web/components/FishPriceSetting.tsx +44 -0
- package/studio/web/components/HumanBanner.tsx +64 -0
- package/studio/web/components/Lightbox.tsx +41 -0
- package/studio/web/components/LogStream.tsx +42 -0
- package/studio/web/components/Markdown.tsx +21 -0
- package/studio/web/components/MissingDmsPanel/BatchSend.tsx +137 -0
- package/studio/web/components/MissingDmsPanel/CommentCard.tsx +168 -0
- package/studio/web/components/MissingDmsPanel/CommentFeed.tsx +45 -0
- package/studio/web/components/MissingDmsPanel/DmBubble.tsx +38 -0
- package/studio/web/components/MissingDmsPanel/ReplyComposer.tsx +63 -0
- package/studio/web/components/MissingDmsPanel/index.tsx +98 -0
- package/studio/web/components/NotFound.tsx +48 -0
- package/studio/web/components/Omni/OmniAvatarPicker.tsx +92 -0
- package/studio/web/components/Omni/OmniCards.tsx +202 -0
- package/studio/web/components/Omni/OmniGlow.tsx +183 -0
- package/studio/web/components/Omni/OmniHistory.tsx +119 -0
- package/studio/web/components/Omni/OmniHotword.tsx +40 -0
- package/studio/web/components/Omni/OmniMicSelect.tsx +92 -0
- package/studio/web/components/Omni/OmniVoiceSample.tsx +81 -0
- package/studio/web/components/Omni/OmniWidget.tsx +743 -0
- package/studio/web/components/Omni/PendingActions.tsx +200 -0
- package/studio/web/components/Omni/Transcript.tsx +127 -0
- package/studio/web/components/OmnichatAccountStatus.tsx +87 -0
- package/studio/web/components/OmnichatRulePanel/RuleConfig.tsx +150 -0
- package/studio/web/components/OmnichatRulePanel/RuleDryRun.tsx +15 -0
- package/studio/web/components/OmnichatRulePanel/RuleEnableConfirm.tsx +42 -0
- package/studio/web/components/OmnichatRulePanel/RuleSkeleton.tsx +18 -0
- package/studio/web/components/OmnichatRulePanel/RuleStatus.tsx +55 -0
- package/studio/web/components/OmnichatRulePanel/index.tsx +115 -0
- package/studio/web/components/OmnichatRulePanel/rule-steps.ts +67 -0
- package/studio/web/components/OmnichatRulePanel/steps/MessageStep.tsx +91 -0
- package/studio/web/components/OmnichatRulePanel/steps/RepliesStep.tsx +201 -0
- package/studio/web/components/OmnichatRulePanel/steps/TriggerStep.tsx +76 -0
- package/studio/web/components/OmnichatRulePanel/steps/types.ts +11 -0
- package/studio/web/components/Palette.tsx +17 -0
- package/studio/web/components/PlatformCard.tsx +109 -0
- package/studio/web/components/PlatformIcon.tsx +19 -0
- package/studio/web/components/ProviderCard.tsx +80 -0
- package/studio/web/components/ProviderDetail.tsx +367 -0
- package/studio/web/components/ProviderLogo.tsx +20 -0
- package/studio/web/components/QueuePanel.tsx +77 -0
- package/studio/web/components/ReferenceActions.tsx +89 -0
- package/studio/web/components/ReferencePicker.tsx +136 -0
- package/studio/web/components/ResultMessage.tsx +7 -0
- package/studio/web/components/RuleForm.tsx +138 -0
- package/studio/web/components/RuleLog.tsx +151 -0
- package/studio/web/components/RunningTask.tsx +23 -0
- package/studio/web/components/SampleList.tsx +55 -0
- package/studio/web/components/SessionPanel.tsx +352 -0
- package/studio/web/components/SettingRow.tsx +14 -0
- package/studio/web/components/SettingsCategorySkeleton.tsx +25 -0
- package/studio/web/components/SidePanel.tsx +77 -0
- package/studio/web/components/Sidebar.tsx +289 -0
- package/studio/web/components/StageStepper.tsx +87 -0
- package/studio/web/components/StudioOffline.tsx +80 -0
- package/studio/web/components/TaskName.tsx +17 -0
- package/studio/web/components/TopBanners.tsx +30 -0
- package/studio/web/components/VideoOmnichatPanel.tsx +287 -0
- package/studio/web/components/VoiceAvatar.tsx +33 -0
- package/studio/web/components/VoiceCarousel.tsx +196 -0
- package/studio/web/components/VoiceCategory.tsx +9 -0
- package/studio/web/components/VoiceModal.tsx +39 -0
- package/studio/web/components/VoiceProfileCard.tsx +75 -0
- package/studio/web/components/VoiceProfilePicker.tsx +107 -0
- package/studio/web/components/VoiceProfilesSettings.tsx +150 -0
- package/studio/web/components/VoiceProviderCard.tsx +118 -0
- package/studio/web/components/VoiceProvidersCard.tsx +26 -0
- package/studio/web/components/WaitList.tsx +21 -0
- package/studio/web/components/icons.tsx +247 -0
- package/studio/web/components/ui/accordion.tsx +47 -0
- package/studio/web/components/ui/badge.tsx +18 -0
- package/studio/web/components/ui/calendar.tsx +43 -0
- package/studio/web/components/ui/chart.tsx +229 -0
- package/studio/web/components/ui/checkbox.tsx +26 -0
- package/studio/web/components/ui/cx.ts +2 -0
- package/studio/web/components/ui/date-time-picker.tsx +84 -0
- package/studio/web/components/ui/panel.tsx +23 -0
- package/studio/web/components/ui/picker.tsx +58 -0
- package/studio/web/components/ui/popover.tsx +24 -0
- package/studio/web/components/ui/select.tsx +89 -0
- package/studio/web/components/ui/skeleton.tsx +10 -0
- package/studio/web/components/ui/slider.tsx +68 -0
- package/studio/web/components/ui/switch.tsx +13 -0
- package/studio/web/components/ui/tooltip.tsx +59 -0
- package/studio/web/hooks/useAccounts.ts +27 -0
- package/studio/web/hooks/useAdmin.ts +12 -0
- package/studio/web/hooks/useAnalytics.ts +21 -0
- package/studio/web/hooks/useAvatarAudioReactive.ts +87 -0
- package/studio/web/hooks/useBrowserConnect.ts +48 -0
- package/studio/web/hooks/useClonePlan.ts +14 -0
- package/studio/web/hooks/useConnected.ts +7 -0
- package/studio/web/hooks/useLiveQuery.ts +29 -0
- package/studio/web/hooks/useMenuCollapsed.ts +32 -0
- package/studio/web/hooks/useMicDevices.ts +53 -0
- package/studio/web/hooks/useMissingDms.ts +211 -0
- package/studio/web/hooks/useMissingSetupSteps.ts +26 -0
- package/studio/web/hooks/useNow.ts +11 -0
- package/studio/web/hooks/useOmniAgent.ts +278 -0
- package/studio/web/hooks/useOmniClaude.ts +124 -0
- package/studio/web/hooks/useOmniDock.ts +142 -0
- package/studio/web/hooks/useOmniGreeting.ts +60 -0
- package/studio/web/hooks/useOmniHotword.ts +128 -0
- package/studio/web/hooks/useOmnichat.ts +26 -0
- package/studio/web/hooks/useOnboarding.ts +27 -0
- package/studio/web/hooks/usePost.ts +23 -0
- package/studio/web/hooks/useQueue.ts +10 -0
- package/studio/web/hooks/useReferences.ts +20 -0
- package/studio/web/hooks/useRuleEditor.ts +101 -0
- package/studio/web/hooks/useRunner.ts +24 -0
- package/studio/web/hooks/useSaveAction.ts +23 -0
- package/studio/web/hooks/useSchedule.ts +11 -0
- package/studio/web/hooks/useServices.ts +10 -0
- package/studio/web/hooks/useSessions.ts +15 -0
- package/studio/web/hooks/useSettings.ts +11 -0
- package/studio/web/hooks/useSettingsSection.ts +30 -0
- package/studio/web/hooks/useSidePanel.ts +23 -0
- package/studio/web/hooks/useSound.ts +30 -0
- package/studio/web/hooks/useUsage.ts +11 -0
- package/studio/web/hooks/useVideoVoice.ts +36 -0
- package/studio/web/hooks/useVideos.ts +21 -0
- package/studio/web/hooks/useVoiceProfilePreview.ts +52 -0
- package/studio/web/hooks/useVoiceProfiles.ts +7 -0
- package/studio/web/hooks/useVoiceRunning.ts +10 -0
- package/studio/web/hooks/useVoiceStudioClosed.ts +8 -0
- package/studio/web/index.html +19 -0
- package/studio/web/lib/agent.ts +7 -0
- package/studio/web/lib/alerts.ts +210 -0
- package/studio/web/lib/analytics-metrics.ts +351 -0
- package/studio/web/lib/api.ts +70 -0
- package/studio/web/lib/audio.ts +39 -0
- package/studio/web/lib/avatars.ts +41 -0
- package/studio/web/lib/calendar.ts +218 -0
- package/studio/web/lib/caption-position.ts +249 -0
- package/studio/web/lib/carousel.ts +24 -0
- package/studio/web/lib/chime.ts +42 -0
- package/studio/web/lib/clone-voice.ts +55 -0
- package/studio/web/lib/export.ts +11 -0
- package/studio/web/lib/files.ts +8 -0
- package/studio/web/lib/format.ts +93 -0
- package/studio/web/lib/media.ts +29 -0
- package/studio/web/lib/mic-device.ts +72 -0
- package/studio/web/lib/missing-dms.ts +70 -0
- package/studio/web/lib/omni-cards.ts +42 -0
- package/studio/web/lib/omni-cascade.ts +1067 -0
- package/studio/web/lib/omni-greeting-audio.ts +24 -0
- package/studio/web/lib/omni-hotword.ts +231 -0
- package/studio/web/lib/omni-panel.ts +67 -0
- package/studio/web/lib/omni-realtime.ts +811 -0
- package/studio/web/lib/omni-ui.ts +402 -0
- package/studio/web/lib/omni-wait.ts +174 -0
- package/studio/web/lib/omnichat-api.ts +44 -0
- package/studio/web/lib/orb.ts +270 -0
- package/studio/web/lib/pcm-recorder.ts +115 -0
- package/studio/web/lib/platforms.ts +17 -0
- package/studio/web/lib/providers.ts +27 -0
- package/studio/web/lib/publish-draft.ts +52 -0
- package/studio/web/lib/publish-settings.ts +81 -0
- package/studio/web/lib/query-client.ts +122 -0
- package/studio/web/lib/references.ts +13 -0
- package/studio/web/lib/services.ts +40 -0
- package/studio/web/lib/sessions.ts +103 -0
- package/studio/web/lib/settings-categories.ts +58 -0
- package/studio/web/lib/sound-audio.ts +33 -0
- package/studio/web/lib/sound-timeline.ts +291 -0
- package/studio/web/lib/sse.ts +86 -0
- package/studio/web/lib/stage-history.ts +141 -0
- package/studio/web/lib/stages.ts +344 -0
- package/studio/web/lib/studio-offline.ts +60 -0
- package/studio/web/lib/upload.ts +24 -0
- package/studio/web/lib/video-tabs.ts +118 -0
- package/studio/web/lib/voice-profile-draft.ts +34 -0
- package/studio/web/lib/voice-profiles.ts +3 -0
- package/studio/web/main.tsx +14 -0
- package/studio/web/pages/AdminPage/index.tsx +123 -0
- package/studio/web/pages/AgentPage/components/Measurements.tsx +102 -0
- package/studio/web/pages/AgentPage/index.tsx +28 -0
- package/studio/web/pages/AnalyticsPage/components/About.tsx +52 -0
- package/studio/web/pages/AnalyticsPage/components/ChannelCards.tsx +106 -0
- package/studio/web/pages/AnalyticsPage/components/ChannelView.tsx +137 -0
- package/studio/web/pages/AnalyticsPage/components/CollectionStatus.tsx +46 -0
- package/studio/web/pages/AnalyticsPage/components/Comparison.tsx +68 -0
- package/studio/web/pages/AnalyticsPage/components/Diagnosis.tsx +50 -0
- package/studio/web/pages/AnalyticsPage/components/Highlights.tsx +49 -0
- package/studio/web/pages/AnalyticsPage/components/Hint.tsx +11 -0
- package/studio/web/pages/AnalyticsPage/components/HookVsBody.tsx +100 -0
- package/studio/web/pages/AnalyticsPage/components/HourlyWave.tsx +133 -0
- package/studio/web/pages/AnalyticsPage/components/Insights.tsx +70 -0
- package/studio/web/pages/AnalyticsPage/components/MetricCard.tsx +46 -0
- package/studio/web/pages/AnalyticsPage/components/PlanSection.tsx +40 -0
- package/studio/web/pages/AnalyticsPage/components/ProgressionChart.tsx +155 -0
- package/studio/web/pages/AnalyticsPage/components/ReelBarsChart.tsx +154 -0
- package/studio/web/pages/AnalyticsPage/components/ReelThumb.tsx +19 -0
- package/studio/web/pages/AnalyticsPage/components/ReelView.tsx +290 -0
- package/studio/web/pages/AnalyticsPage/components/ReelsTable.tsx +269 -0
- package/studio/web/pages/AnalyticsPage/components/RequestWithFocus.tsx +38 -0
- package/studio/web/pages/AnalyticsPage/components/SegmentedControl.tsx +35 -0
- package/studio/web/pages/AnalyticsPage/components/VsMedian.tsx +31 -0
- package/studio/web/pages/AnalyticsPage/index.tsx +17 -0
- package/studio/web/pages/GettingStartedPage/index.tsx +174 -0
- package/studio/web/pages/NewVideoPage/components/DeliverablesPicker.tsx +62 -0
- package/studio/web/pages/NewVideoPage/components/FormatPicker.tsx +33 -0
- package/studio/web/pages/NewVideoPage/index.tsx +133 -0
- package/studio/web/pages/NotFoundPage/index.tsx +9 -0
- package/studio/web/pages/OmnichatPage/components/NewFromLink.tsx +59 -0
- package/studio/web/pages/OmnichatPage/components/RuleListItem.tsx +64 -0
- package/studio/web/pages/OmnichatPage/components/RulePreview.tsx +14 -0
- package/studio/web/pages/OmnichatPage/components/RuleView.tsx +88 -0
- package/studio/web/pages/OmnichatPage/index.tsx +153 -0
- package/studio/web/pages/QueuePage/index.tsx +22 -0
- package/studio/web/pages/ReferencePage/components/ReferenceTexts.tsx +131 -0
- package/studio/web/pages/ReferencePage/index.tsx +216 -0
- package/studio/web/pages/ReferencesPage/components/NewReferenceForm.tsx +150 -0
- package/studio/web/pages/ReferencesPage/components/ReferenceCard.tsx +42 -0
- package/studio/web/pages/ReferencesPage/components/ReferenceGridSkeleton.tsx +31 -0
- package/studio/web/pages/ReferencesPage/index.tsx +67 -0
- package/studio/web/pages/SchedulePage/components/CalendarSkeleton.tsx +18 -0
- package/studio/web/pages/SchedulePage/components/DayView.tsx +177 -0
- package/studio/web/pages/SchedulePage/components/HourPicker.tsx +103 -0
- package/studio/web/pages/SchedulePage/components/MonthDayCell.tsx +111 -0
- package/studio/web/pages/SchedulePage/components/MonthView.tsx +47 -0
- package/studio/web/pages/SchedulePage/components/PlatformIcons.tsx +12 -0
- package/studio/web/pages/SchedulePage/components/PostThumb.tsx +15 -0
- package/studio/web/pages/SchedulePage/components/WeekColumn.tsx +75 -0
- package/studio/web/pages/SchedulePage/components/WeekView.tsx +35 -0
- package/studio/web/pages/SchedulePage/index.tsx +285 -0
- package/studio/web/pages/SettingsPage/components/AgentAccounts.tsx +263 -0
- package/studio/web/pages/SettingsPage/components/AgentCategory.tsx +20 -0
- package/studio/web/pages/SettingsPage/components/ModelPicker.tsx +49 -0
- package/studio/web/pages/SettingsPage/components/ModelsSettings.tsx +138 -0
- package/studio/web/pages/SettingsPage/components/PlatformsCategory.tsx +23 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/AccountStatus.tsx +29 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/AutoPublishPanel.tsx +90 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/BrowserConnect.tsx +62 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/CheckField.tsx +19 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/InstagramPanel.tsx +113 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/OmnichatSettingsPanel.tsx +146 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SaveBar.tsx +33 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SchedulePanel.tsx +132 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SettingsCard.tsx +47 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SettingsCardGroup.tsx +19 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/TextPanel.tsx +55 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/TiktokPanel.tsx +123 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/YoutubePanel.tsx +100 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/badges.tsx +15 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/index.tsx +40 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/types.ts +10 -0
- package/studio/web/pages/SettingsPage/components/UsageCategory.tsx +389 -0
- package/studio/web/pages/SettingsPage/components/VoiceProvidersCategory.tsx +97 -0
- package/studio/web/pages/SettingsPage/index.tsx +85 -0
- package/studio/web/pages/VideoPage/components/AudioPlayer.tsx +113 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/AxisField.tsx +50 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionList.tsx +56 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionListItem.tsx +92 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionMargins.tsx +57 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionStyleFields.tsx +70 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionTextForm.tsx +87 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/ColorField.tsx +37 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/MarginField.tsx +59 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/NumberField.tsx +57 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/PositionControls.tsx +140 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/captionEditor.ts +215 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/useCaptionPosition.ts +154 -0
- package/studio/web/pages/VideoPage/components/CarouselChangeRequest.tsx +72 -0
- package/studio/web/pages/VideoPage/components/CarouselCompositionStage.tsx +80 -0
- package/studio/web/pages/VideoPage/components/CarouselCreate.tsx +63 -0
- package/studio/web/pages/VideoPage/components/CarouselMissing.tsx +19 -0
- package/studio/web/pages/VideoPage/components/CarouselPublishStage.tsx +173 -0
- package/studio/web/pages/VideoPage/components/CarouselScriptStage.tsx +82 -0
- package/studio/web/pages/VideoPage/components/CarouselSlideCard.tsx +49 -0
- package/studio/web/pages/VideoPage/components/CarouselViewer.tsx +55 -0
- package/studio/web/pages/VideoPage/components/ChangedVoices.tsx +53 -0
- package/studio/web/pages/VideoPage/components/CompositionStage.tsx +78 -0
- package/studio/web/pages/VideoPage/components/CoverPicker.tsx +32 -0
- package/studio/web/pages/VideoPage/components/EditorStage.tsx +53 -0
- package/studio/web/pages/VideoPage/components/LineTakes.tsx +160 -0
- package/studio/web/pages/VideoPage/components/LineTextEditor.tsx +124 -0
- package/studio/web/pages/VideoPage/components/LineVoicePicker.tsx +37 -0
- package/studio/web/pages/VideoPage/components/MediaImage.tsx +25 -0
- package/studio/web/pages/VideoPage/components/MotionScriptStage.tsx +39 -0
- package/studio/web/pages/VideoPage/components/NarrationStage.tsx +70 -0
- package/studio/web/pages/VideoPage/components/PublishForm.tsx +387 -0
- package/studio/web/pages/VideoPage/components/PublishStage.tsx +76 -0
- package/studio/web/pages/VideoPage/components/PublishText.tsx +149 -0
- package/studio/web/pages/VideoPage/components/ScenesApprovalPanel.tsx +278 -0
- package/studio/web/pages/VideoPage/components/ScheduledInfo.tsx +72 -0
- package/studio/web/pages/VideoPage/components/ScriptApprovalPanel.tsx +189 -0
- package/studio/web/pages/VideoPage/components/ScriptStage.tsx +17 -0
- package/studio/web/pages/VideoPage/components/SequencePlayer.tsx +146 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/AddSound.tsx +117 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/AreaSelection.tsx +74 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/BedPanel.tsx +94 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/BedRow.tsx +45 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CaptionOverlay.tsx +44 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CaptionSaveBar.tsx +32 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CaptionsPanel.tsx +22 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/ClipBlock.tsx +111 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/ClipPanel.tsx +76 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CutsPanel.tsx +44 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EditorTabBar.tsx +73 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectChoice.tsx +46 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectItem.tsx +89 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectPanel.tsx +232 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectsRow.tsx +21 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/Lane.tsx +39 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/MarkerRow.tsx +40 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/MuteButton.tsx +36 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/NumberInput.tsx +37 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/PlanWarnings.tsx +19 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/PlayerResizeHandle.tsx +50 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/PreviewControls.tsx +51 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SceneRow.tsx +54 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SettingsPanel.tsx +65 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SoundLibrary.tsx +99 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SoundPreview.tsx +82 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SpeedPanel.tsx +128 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineDock.tsx +56 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineFooter.tsx +26 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineSkeleton.tsx +21 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineToolbar.tsx +160 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineTracks.tsx +121 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TrackSidebar.tsx +30 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/VoiceRow.tsx +53 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/Waveform.tsx +97 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/clipActions.ts +50 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/effectActions.ts +161 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/index.tsx +161 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/timelineGeometry.ts +45 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/types.ts +43 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useAutosave.ts +107 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useEditorShortcuts.ts +168 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useFitHeight.ts +40 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useFollowPlayhead.ts +21 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useListenMix.ts +43 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/usePlayback.ts +231 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/usePlayerWidth.ts +27 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useSoundData.ts +124 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useSoundTimeline.ts +511 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/CompareVersions.tsx +111 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/VersionCard.tsx +81 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/VersionMedia.tsx +24 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/VersionText.tsx +15 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/index.tsx +109 -0
- package/studio/web/pages/VideoPage/components/StageProcess.tsx +126 -0
- package/studio/web/pages/VideoPage/components/StageResult.tsx +69 -0
- package/studio/web/pages/VideoPage/components/SwapReference.tsx +92 -0
- package/studio/web/pages/VideoPage/components/ThumbnailPanel.tsx +252 -0
- package/studio/web/pages/VideoPage/components/TimingPanel.tsx +89 -0
- package/studio/web/pages/VideoPage/components/VideoPlayer.tsx +18 -0
- package/studio/web/pages/VideoPage/components/VideoSkeleton.tsx +50 -0
- package/studio/web/pages/VideoPage/components/VideoVoiceInfo.tsx +33 -0
- package/studio/web/pages/VideoPage/components/VideoVoicePicker.tsx +165 -0
- package/studio/web/pages/VideoPage/components/VoicePauseBanner.tsx +56 -0
- package/studio/web/pages/VideoPage/components/WithLogo.tsx +10 -0
- package/studio/web/pages/VideoPage/index.tsx +295 -0
- package/studio/web/pages/VideosPage/components/PublishedOn.tsx +85 -0
- package/studio/web/pages/VideosPage/components/ServicesPanel.tsx +81 -0
- package/studio/web/pages/VideosPage/components/SessionsPanel.tsx +62 -0
- package/studio/web/pages/VideosPage/components/VideoListSkeleton.tsx +25 -0
- package/studio/web/pages/VideosPage/components/VideoRow.tsx +122 -0
- package/studio/web/pages/VideosPage/index.tsx +134 -0
- package/studio/web/pages/VoicePage/index.tsx +28 -0
- package/studio/web/router.tsx +201 -0
- package/studio/web/styles/base/elements.css +55 -0
- package/studio/web/styles/base/utilities.css +25 -0
- package/studio/web/styles/components/badge.css +33 -0
- package/studio/web/styles/components/claude-running.css +27 -0
- package/studio/web/styles/components/claude-session.css +212 -0
- package/studio/web/styles/components/claude-walking.css +92 -0
- package/studio/web/styles/components/clone-voice-save.css +136 -0
- package/studio/web/styles/components/clone-voice.css +379 -0
- package/studio/web/styles/components/controls.css +70 -0
- package/studio/web/styles/components/data-and-image.css +54 -0
- package/studio/web/styles/components/forms.css +132 -0
- package/studio/web/styles/components/human-banner.css +99 -0
- package/studio/web/styles/components/lightbox.css +50 -0
- package/studio/web/styles/components/markdown.css +68 -0
- package/studio/web/styles/components/modal.css +70 -0
- package/studio/web/styles/components/omni-cards.css +105 -0
- package/studio/web/styles/components/omni.css +859 -0
- package/studio/web/styles/components/omnichat.css +538 -0
- package/studio/web/styles/components/panel.css +115 -0
- package/studio/web/styles/components/platform-card.css +140 -0
- package/studio/web/styles/components/provider-card.css +132 -0
- package/studio/web/styles/components/queue.css +185 -0
- package/studio/web/styles/components/reference-actions.css +133 -0
- package/studio/web/styles/components/reference-picker.css +146 -0
- package/studio/web/styles/components/results-drawer.css +224 -0
- package/studio/web/styles/components/segmented.css +115 -0
- package/studio/web/styles/components/side-panel-tab.css +23 -0
- package/studio/web/styles/components/status-signals.css +66 -0
- package/studio/web/styles/components/stepper.css +208 -0
- package/studio/web/styles/components/table.css +19 -0
- package/studio/web/styles/components/tabs.css +24 -0
- package/studio/web/styles/components/ui/accordion.css +71 -0
- package/studio/web/styles/components/ui/chart.css +162 -0
- package/studio/web/styles/components/ui/checkbox.css +37 -0
- package/studio/web/styles/components/ui/date-picker.css +153 -0
- package/studio/web/styles/components/ui/select.css +110 -0
- package/studio/web/styles/components/ui/skeleton.css +25 -0
- package/studio/web/styles/components/ui/slider.css +81 -0
- package/studio/web/styles/components/ui/switch.css +41 -0
- package/studio/web/styles/components/ui/tooltip.css +24 -0
- package/studio/web/styles/components/voice-carousel.css +255 -0
- package/studio/web/styles/components/voice-editor.css +179 -0
- package/studio/web/styles/components/voice-grid.css +56 -0
- package/studio/web/styles/components/voice-profiles.css +192 -0
- package/studio/web/styles/design-system.md +136 -0
- package/studio/web/styles/index.css +116 -0
- package/studio/web/styles/layout/page.css +41 -0
- package/studio/web/styles/layout/sidebar-groups.css +39 -0
- package/studio/web/styles/layout/sidebar.css +111 -0
- package/studio/web/styles/pages/agent.css +26 -0
- package/studio/web/styles/pages/analytics/dashboard.css +614 -0
- package/studio/web/styles/pages/analytics/insights.css +48 -0
- package/studio/web/styles/pages/getting-started.css +166 -0
- package/studio/web/styles/pages/new-video/form.css +32 -0
- package/studio/web/styles/pages/not-found.css +59 -0
- package/studio/web/styles/pages/references.css +204 -0
- package/studio/web/styles/pages/schedule/calendar.css +541 -0
- package/studio/web/styles/pages/schedule/chip-states.css +60 -0
- package/studio/web/styles/pages/settings/models.css +72 -0
- package/studio/web/styles/pages/settings/shell.css +361 -0
- package/studio/web/styles/pages/settings/usage.css +63 -0
- package/studio/web/styles/pages/studio-offline.css +105 -0
- package/studio/web/styles/pages/video/caption-controls.css +194 -0
- package/studio/web/styles/pages/video/captions-grid.css +70 -0
- package/studio/web/styles/pages/video/captions.css +79 -0
- package/studio/web/styles/pages/video/editor-chat.css +103 -0
- package/studio/web/styles/pages/video/export.css +50 -0
- package/studio/web/styles/pages/video/frames.css +29 -0
- package/studio/web/styles/pages/video/fullscreen-stage.css +400 -0
- package/studio/web/styles/pages/video/instagram-carousel.css +309 -0
- package/studio/web/styles/pages/video/layout.css +285 -0
- package/studio/web/styles/pages/video/narration.css +138 -0
- package/studio/web/styles/pages/video/preview-overview.css +11 -0
- package/studio/web/styles/pages/video/processing-notice.css +34 -0
- package/studio/web/styles/pages/video/publish-when.css +76 -0
- package/studio/web/styles/pages/video/publish.css +97 -0
- package/studio/web/styles/pages/video/result.css +96 -0
- package/studio/web/styles/pages/video/scenes.css +167 -0
- package/studio/web/styles/pages/video/sound-timeline.css +672 -0
- package/studio/web/styles/pages/video/sound-toolbar.css +149 -0
- package/studio/web/styles/pages/video/take-player.css +100 -0
- package/studio/web/styles/pages/video/thumbnail.css +157 -0
- package/studio/web/styles/pages/video/timeline.css +117 -0
- package/studio/web/styles/pages/video/voice-picker.css +14 -0
- package/studio/web/styles/pages/video-list/active-row.css +27 -0
- package/studio/web/styles/pages/video-list/card-link.css +49 -0
- package/studio/web/styles/pages/video-list/list.css +86 -0
- package/studio/web/styles/theme/identity/details.css +204 -0
- package/studio/web/styles/theme/identity/shell.css +249 -0
- package/studio/web/styles/theme/identity/surfaces.css +183 -0
- package/studio/web/styles/theme/identity/titles-and-buttons.css +120 -0
- package/studio/web/styles/theme/no-borders/blocks.css +208 -0
- package/studio/web/styles/theme/no-borders/controls.css +256 -0
- package/studio/web/styles/tokens.css +245 -0
- package/studio/web/types/api.ts +2 -0
- package/studio/web/types/assets.d.ts +9 -0
- package/templates/brief.md +27 -0
- package/templates/captions.html +204 -0
- package/templates/carousel-composition.md +47 -0
- package/templates/carousel-script.md +60 -0
- package/templates/components/voiceavatar/README.md +87 -0
- package/templates/components/voiceavatar/demo.html +50 -0
- package/templates/components/voiceavatar/voiceavatar.js +415 -0
- package/templates/motion.md +80 -0
- package/templates/playbook.md +43 -0
- package/templates/reference.md +123 -0
- package/templates/scene.html +112 -0
- package/templates/scenes.example.json +96 -0
- package/templates/script.md +63 -0
- package/templates/slide.html +71 -0
- package/templates/wireframe.html +91 -0
- package/tools/analysis.mjs +300 -0
- package/tools/approval.mjs +442 -0
- package/tools/assemble.mjs +942 -0
- package/tools/build-motion.mjs +437 -0
- package/tools/captions.mjs +246 -0
- package/tools/carousel.mjs +558 -0
- package/tools/compose.mjs +307 -0
- package/tools/cuts.mjs +74 -0
- package/tools/editor.mjs +419 -0
- package/tools/epidemic-capture.js +54 -0
- package/tools/fanout.mjs +69 -0
- package/tools/history.mjs +70 -0
- package/tools/history.py +61 -0
- package/tools/job-queue.mjs +180 -0
- package/tools/job_queue.py +430 -0
- package/tools/lib/agents.mjs +412 -0
- package/tools/lib/channel.mjs +399 -0
- package/tools/lib/claude-settings.mjs +67 -0
- package/tools/lib/cli.mjs +9 -0
- package/tools/lib/fanout.mjs +234 -0
- package/tools/lib/http.mjs +94 -0
- package/tools/lib/index.js +14 -0
- package/tools/lib/mcp-server.mjs +69 -0
- package/tools/lib/metrics/metrics.mjs +204 -0
- package/tools/lib/narration.mjs +15 -0
- package/tools/lib/oauth-client.mjs +295 -0
- package/tools/lib/omnichat/config.mjs +139 -0
- package/tools/lib/omnichat/errors.mjs +42 -0
- package/tools/lib/omnichat/extract.mjs +82 -0
- package/tools/lib/omnichat/gate.mjs +151 -0
- package/tools/lib/omnichat/manual.mjs +166 -0
- package/tools/lib/omnichat/match.mjs +78 -0
- package/tools/lib/omnichat/pass.mjs +393 -0
- package/tools/lib/omnichat/record.mjs +208 -0
- package/tools/lib/omnichat/text.mjs +315 -0
- package/tools/lib/omnichat/webhook.mjs +166 -0
- package/tools/lib/pairing.mjs +99 -0
- package/tools/lib/paths.mjs +41 -0
- package/tools/lib/platforms/instagram.mjs +469 -0
- package/tools/lib/platforms/tiktok.mjs +343 -0
- package/tools/lib/platforms/youtube.mjs +228 -0
- package/tools/lib/publish/publish.mjs +244 -0
- package/tools/lib/schedule/schedule.mjs +191 -0
- package/tools/lib/service.mjs +134 -0
- package/tools/lib/skill-client.mjs +126 -0
- package/tools/lib/skills-release.mjs +196 -0
- package/tools/lib/testing.mjs +52 -0
- package/tools/lib/up.mjs +187 -0
- package/tools/metrics.mjs +415 -0
- package/tools/models.mjs +134 -0
- package/tools/narrate.mjs +257 -0
- package/tools/omni.mjs +298 -0
- package/tools/omni_paths.py +12 -0
- package/tools/omnichat.mjs +1577 -0
- package/tools/omnivideo.py +1122 -0
- package/tools/package.mjs +130 -0
- package/tools/platforms.mjs +236 -0
- package/tools/premiere.mjs +533 -0
- package/tools/publish.mjs +1496 -0
- package/tools/reference.mjs +1408 -0
- package/tools/render.mjs +426 -0
- package/tools/runner.mjs +156 -0
- package/tools/setup.mjs +466 -0
- package/tools/skills-release.mjs +93 -0
- package/tools/sound.mjs +1323 -0
- package/tools/soundtrack.mjs +217 -0
- package/tools/thumbnail.mjs +271 -0
- package/tools/timing.mjs +108 -0
- package/tools/usage.py +628 -0
- package/tools/voice-envelope.mjs +185 -0
- package/tools/voice.py +448 -0
- package/tools/voice_sample.py +75 -0
- package/tools/wireframe.mjs +230 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/* The voice avatars' renderer. Every avatar on the page is a 2D <canvas>; they all share ONE WebGL
|
|
2
|
+
context (a page shows more than fifteen at once, and browsers cap the contexts), drawn by the same
|
|
3
|
+
painter the video scenes use (templates/components/voiceavatar). Each frame an avatar gets its
|
|
4
|
+
orb drawn into the shared canvas and copied into its own.
|
|
5
|
+
|
|
6
|
+
Idle avatars flow at 30 fps, the ones reacting to a voice at 60, the ones off screen not at all.
|
|
7
|
+
With reduced motion, or `still`, an avatar is drawn once. Without WebGL2 it is a flat gradient. */
|
|
8
|
+
|
|
9
|
+
import { orbPalette, randomSeed, seedOf } from "./avatars";
|
|
10
|
+
import voiceAvatar from "../../../templates/components/voiceavatar/voiceavatar.js";
|
|
11
|
+
|
|
12
|
+
/* low, mid, high and all-spectrum levels of the voice, each 0..1 (what voice-envelope.mjs measures) */
|
|
13
|
+
export type Levels = { low: number; mid: number; high: number; all: number };
|
|
14
|
+
|
|
15
|
+
type Painter = {
|
|
16
|
+
texture(palette: string[], seed: number): WebGLTexture;
|
|
17
|
+
deleteTexture(texture: WebGLTexture): void;
|
|
18
|
+
draw(o: {
|
|
19
|
+
texture: WebGLTexture;
|
|
20
|
+
time: number;
|
|
21
|
+
audio: number[];
|
|
22
|
+
cum: number[];
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
fill?: boolean;
|
|
26
|
+
}): void;
|
|
27
|
+
};
|
|
28
|
+
/* the video scenes' orb component (templates/components/voiceavatar), as a module */
|
|
29
|
+
const core = voiceAvatar as unknown as {
|
|
30
|
+
createPainter(gl: WebGL2RenderingContext): Painter;
|
|
31
|
+
config: { timeScale: number; avgLerp: number; cumLerp: number; overallSound: number };
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type Orb = {
|
|
35
|
+
canvas: HTMLCanvasElement;
|
|
36
|
+
ctx: CanvasRenderingContext2D;
|
|
37
|
+
seed: string;
|
|
38
|
+
fill: boolean;
|
|
39
|
+
still: boolean;
|
|
40
|
+
phase: number /* seconds: each voice flows from a different point */;
|
|
41
|
+
raw: number[] /* low, mid, high, all as last set */;
|
|
42
|
+
avg: number[];
|
|
43
|
+
cum: number[];
|
|
44
|
+
reactiveUntil: number;
|
|
45
|
+
lastDraw: number;
|
|
46
|
+
visible: boolean;
|
|
47
|
+
w: number;
|
|
48
|
+
h: number;
|
|
49
|
+
texture: WebGLTexture | null;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const MAX_SIDE = 640;
|
|
53
|
+
const IDLE_MS = 1000 / 30;
|
|
54
|
+
const REACT_MS = 1000 / 60;
|
|
55
|
+
const orbs = new Map<HTMLCanvasElement, Orb>();
|
|
56
|
+
const textures = new Map<string, { texture: WebGLTexture; refs: number }>();
|
|
57
|
+
let glCanvas: HTMLCanvasElement | null = null;
|
|
58
|
+
let painter: Painter | null = null;
|
|
59
|
+
let broken = false;
|
|
60
|
+
let raf = 0;
|
|
61
|
+
|
|
62
|
+
const reducedMotion = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
63
|
+
|
|
64
|
+
function ensurePainter(): Painter | null {
|
|
65
|
+
if (painter || broken) return painter;
|
|
66
|
+
try {
|
|
67
|
+
glCanvas = document.createElement("canvas");
|
|
68
|
+
glCanvas.width = glCanvas.height = 128;
|
|
69
|
+
const gl = glCanvas.getContext("webgl2", { alpha: true, premultipliedAlpha: true, antialias: false });
|
|
70
|
+
if (!gl) throw new Error("WebGL2 indisponível");
|
|
71
|
+
glCanvas.addEventListener("webglcontextlost", e => {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
painter = null;
|
|
74
|
+
textures.clear();
|
|
75
|
+
orbs.forEach(o => {
|
|
76
|
+
o.texture = null;
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
glCanvas.addEventListener("webglcontextrestored", () => {
|
|
80
|
+
ensurePainter();
|
|
81
|
+
orbs.forEach(o => {
|
|
82
|
+
acquireTexture(o);
|
|
83
|
+
drawOrb(o, performance.now());
|
|
84
|
+
});
|
|
85
|
+
kick();
|
|
86
|
+
});
|
|
87
|
+
painter = core.createPainter(gl);
|
|
88
|
+
} catch {
|
|
89
|
+
broken = true;
|
|
90
|
+
painter = null;
|
|
91
|
+
}
|
|
92
|
+
return painter;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function acquireTexture(o: Orb) {
|
|
96
|
+
const p = ensurePainter();
|
|
97
|
+
if (!p) return;
|
|
98
|
+
let entry = textures.get(o.seed);
|
|
99
|
+
if (!entry) {
|
|
100
|
+
entry = { texture: p.texture(orbPalette(o.seed), seedOf(o.seed)), refs: 0 };
|
|
101
|
+
textures.set(o.seed, entry);
|
|
102
|
+
}
|
|
103
|
+
entry.refs++;
|
|
104
|
+
o.texture = entry.texture;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function releaseTexture(o: Orb) {
|
|
108
|
+
const entry = textures.get(o.seed);
|
|
109
|
+
if (!entry || !o.texture) return;
|
|
110
|
+
if (--entry.refs <= 0) {
|
|
111
|
+
painter?.deleteTexture(entry.texture);
|
|
112
|
+
textures.delete(o.seed);
|
|
113
|
+
}
|
|
114
|
+
o.texture = null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function drawFlat(o: Orb) {
|
|
118
|
+
const { ctx, w, h } = o;
|
|
119
|
+
const [a, b] = orbPalette(o.seed);
|
|
120
|
+
const g = ctx.createLinearGradient(0, 0, w, h);
|
|
121
|
+
g.addColorStop(0, a);
|
|
122
|
+
g.addColorStop(1, b);
|
|
123
|
+
ctx.clearRect(0, 0, w, h);
|
|
124
|
+
ctx.fillStyle = g;
|
|
125
|
+
if (o.fill) ctx.fillRect(0, 0, w, h);
|
|
126
|
+
else {
|
|
127
|
+
ctx.beginPath();
|
|
128
|
+
ctx.arc(w / 2, h / 2, Math.min(w, h) / 2, 0, Math.PI * 2);
|
|
129
|
+
ctx.fill();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function drawOrb(o: Orb, now: number) {
|
|
134
|
+
if (!o.w || !o.h) return;
|
|
135
|
+
const p = ensurePainter();
|
|
136
|
+
if (!p || !glCanvas || !o.texture) {
|
|
137
|
+
drawFlat(o);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (glCanvas.width < o.w || glCanvas.height < o.h) {
|
|
141
|
+
glCanvas.width = Math.max(glCanvas.width, o.w);
|
|
142
|
+
glCanvas.height = Math.max(glCanvas.height, o.h);
|
|
143
|
+
}
|
|
144
|
+
p.draw({
|
|
145
|
+
texture: o.texture,
|
|
146
|
+
time: now / 1000 + o.phase,
|
|
147
|
+
audio: o.avg,
|
|
148
|
+
cum: o.cum,
|
|
149
|
+
width: o.w,
|
|
150
|
+
height: o.h,
|
|
151
|
+
fill: o.fill,
|
|
152
|
+
});
|
|
153
|
+
o.ctx.clearRect(0, 0, o.w, o.h);
|
|
154
|
+
/* GL's origin is the bottom-left: the viewport we drew into is the BOTTOM o.h rows of the canvas */
|
|
155
|
+
o.ctx.drawImage(glCanvas, 0, glCanvas.height - o.h, o.w, o.h, 0, 0, o.w, o.h);
|
|
156
|
+
o.lastDraw = now;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* the live orb's smoothing, as per-frame lerps (here scaled by the real elapsed frames) */
|
|
160
|
+
function advance(o: Orb, frames: number) {
|
|
161
|
+
const { avgLerp, cumLerp, timeScale, overallSound } = core.config;
|
|
162
|
+
const a = 1 - (1 - avgLerp) ** frames;
|
|
163
|
+
for (let k = 0; k < 4; k++) {
|
|
164
|
+
const level = o.raw[k] * overallSound; /* how hard the voice drives the orb */
|
|
165
|
+
o.avg[k] += a * (level - o.avg[k]);
|
|
166
|
+
o.cum[k] += cumLerp * level * timeScale * frames;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function step(now: number) {
|
|
171
|
+
raf = 0;
|
|
172
|
+
let running = false;
|
|
173
|
+
orbs.forEach(o => {
|
|
174
|
+
if (o.still || !o.visible) return;
|
|
175
|
+
running = true;
|
|
176
|
+
const every = now < o.reactiveUntil ? REACT_MS : IDLE_MS;
|
|
177
|
+
if (now - o.lastDraw < every - 1) return;
|
|
178
|
+
advance(o, Math.min(6, (now - (o.lastDraw || now - 1000 / 60)) / (1000 / 60)));
|
|
179
|
+
drawOrb(o, now);
|
|
180
|
+
});
|
|
181
|
+
if (running) raf = requestAnimationFrame(step);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function kick() {
|
|
185
|
+
if (!raf && !reducedMotion()) raf = requestAnimationFrame(step);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function measure(o: Orb) {
|
|
189
|
+
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
190
|
+
const w = Math.min(MAX_SIDE, Math.round(o.canvas.clientWidth * dpr));
|
|
191
|
+
const h = Math.min(MAX_SIDE, Math.round(o.canvas.clientHeight * dpr));
|
|
192
|
+
if (w === o.w && h === o.h) return;
|
|
193
|
+
o.w = o.canvas.width = w;
|
|
194
|
+
o.h = o.canvas.height = h;
|
|
195
|
+
drawOrb(o, performance.now());
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Starts drawing an avatar into `canvas` (sized by CSS). Returns the cleanup. */
|
|
199
|
+
export function attachOrb(canvas: HTMLCanvasElement, opts: { seed: string; fill?: boolean; still?: boolean }) {
|
|
200
|
+
const ctx = canvas.getContext("2d");
|
|
201
|
+
if (!ctx) return;
|
|
202
|
+
const rnd = randomSeed(seedOf(`${opts.seed}:phase`));
|
|
203
|
+
const o: Orb = {
|
|
204
|
+
canvas,
|
|
205
|
+
ctx,
|
|
206
|
+
seed: opts.seed,
|
|
207
|
+
fill: !!opts.fill,
|
|
208
|
+
still: !!opts.still || reducedMotion(),
|
|
209
|
+
phase: rnd() * 600,
|
|
210
|
+
raw: [0, 0, 0, 0],
|
|
211
|
+
avg: [0, 0, 0, 0],
|
|
212
|
+
cum: [0, 0, 0, 0],
|
|
213
|
+
reactiveUntil: 0,
|
|
214
|
+
lastDraw: 0,
|
|
215
|
+
visible: true,
|
|
216
|
+
w: 0,
|
|
217
|
+
h: 0,
|
|
218
|
+
texture: null,
|
|
219
|
+
};
|
|
220
|
+
orbs.set(canvas, o);
|
|
221
|
+
acquireTexture(o);
|
|
222
|
+
const resize = new ResizeObserver(() => measure(o));
|
|
223
|
+
resize.observe(canvas);
|
|
224
|
+
const seen = new IntersectionObserver(entries => {
|
|
225
|
+
o.visible = entries[entries.length - 1]?.isIntersecting ?? true;
|
|
226
|
+
if (o.visible) kick();
|
|
227
|
+
});
|
|
228
|
+
seen.observe(canvas);
|
|
229
|
+
measure(o);
|
|
230
|
+
kick();
|
|
231
|
+
return () => {
|
|
232
|
+
resize.disconnect();
|
|
233
|
+
seen.disconnect();
|
|
234
|
+
releaseTexture(o);
|
|
235
|
+
orbs.delete(canvas);
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* Feeds the voice into an avatar (null = silence). While it is not null, the avatar draws at 60 fps. */
|
|
240
|
+
export function setOrbLevels(canvas: Element, levels: Levels | null) {
|
|
241
|
+
const o = orbs.get(canvas as HTMLCanvasElement);
|
|
242
|
+
if (!o) return false;
|
|
243
|
+
o.raw = levels ? [levels.low, levels.mid, levels.high, levels.all] : [0, 0, 0, 0];
|
|
244
|
+
if (levels) o.reactiveUntil = performance.now() + 250;
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* Levels of an AnalyserNode, the way voice-envelope.mjs reads a file: low 0-200 Hz, mid 200-2000 Hz,
|
|
249
|
+
high 2-20 kHz, and the average of the whole spectrum. */
|
|
250
|
+
export function analyserLevels(an: AnalyserNode, bytes: Uint8Array<ArrayBuffer>): Levels {
|
|
251
|
+
an.getByteFrequencyData(bytes);
|
|
252
|
+
const hzPerBin = an.context.sampleRate / 2 / bytes.length;
|
|
253
|
+
const avg = (fromHz: number, toHz: number) => {
|
|
254
|
+
const from = Math.min(bytes.length - 1, Math.round(fromHz / hzPerBin));
|
|
255
|
+
const to = Math.min(bytes.length - 1, Math.max(from, Math.round(toHz / hzPerBin)));
|
|
256
|
+
let sum = 0;
|
|
257
|
+
for (let i = from; i <= to; i++) sum += bytes[i];
|
|
258
|
+
return sum / (to - from + 1) / 255;
|
|
259
|
+
};
|
|
260
|
+
return { low: avg(0, 200), mid: avg(200, 2000), high: avg(2000, 20000), all: avg(0, 1e9) };
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/* How the avatar breathes with a voice, as a CSS scale: "up" grows with the sound wave (the agent
|
|
264
|
+
speaks), "down" shrinks (the agent listens). `wave` is the smoothed level, 0..1; silence is 1. */
|
|
265
|
+
export const SWELL = 0.05;
|
|
266
|
+
export const SHRINK = 0.1;
|
|
267
|
+
export function breathScale(direction: "up" | "down", wave: number) {
|
|
268
|
+
const w = Math.max(0, Math.min(1, wave));
|
|
269
|
+
return 1 + (direction === "up" ? SWELL : -SHRINK) * w;
|
|
270
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/* One spoken message for Omni's Claude mode: the microphone as PCM16 mono 24 kHz (what the xAI
|
|
2
|
+
transcription takes raw), stopped by the user or by itself after a pause once speech started.
|
|
3
|
+
No audio leaves the page until the recording ends. */
|
|
4
|
+
|
|
5
|
+
import { openMic } from "./mic-device";
|
|
6
|
+
|
|
7
|
+
const RATE = 24000;
|
|
8
|
+
const CHUNK = 2400; /* 100 ms */
|
|
9
|
+
const WORKLET = `
|
|
10
|
+
class Capture extends AudioWorkletProcessor {
|
|
11
|
+
constructor() { super(); this.buf = new Float32Array(${CHUNK}); this.n = 0; }
|
|
12
|
+
process(inputs) {
|
|
13
|
+
const ch = inputs[0] && inputs[0][0];
|
|
14
|
+
if (ch) for (let i = 0; i < ch.length; i++) {
|
|
15
|
+
this.buf[this.n++] = ch[i];
|
|
16
|
+
if (this.n === this.buf.length) { this.port.postMessage(this.buf.buffer, [this.buf.buffer]); this.buf = new Float32Array(${CHUNK}); this.n = 0; }
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
registerProcessor("omni-record", Capture);
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
/* speech: RMS above SPEAK for 2 chunks; end: below QUIET for `pauseMs` after that */
|
|
25
|
+
const SPEAK = 0.03;
|
|
26
|
+
const QUIET = 0.015;
|
|
27
|
+
|
|
28
|
+
export class PcmRecorder {
|
|
29
|
+
readonly analyser: AnalyserNode;
|
|
30
|
+
private ctx: AudioContext;
|
|
31
|
+
private stream: MediaStream | null = null;
|
|
32
|
+
private node: AudioWorkletNode | null = null;
|
|
33
|
+
private chunks: Int16Array[] = [];
|
|
34
|
+
private loud = 0;
|
|
35
|
+
private spoke = false;
|
|
36
|
+
private quietMs = 0;
|
|
37
|
+
private done: ((pcm: Int16Array | null) => void) | null = null;
|
|
38
|
+
|
|
39
|
+
constructor(private opts: { pauseMs?: number; maxMs?: number } = {}) {
|
|
40
|
+
this.ctx = new AudioContext({ sampleRate: RATE });
|
|
41
|
+
this.analyser = this.ctx.createAnalyser();
|
|
42
|
+
this.analyser.fftSize = 1024;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* resolves with the recording when it ends (null: nothing was said) */
|
|
46
|
+
async record(): Promise<Int16Array | null> {
|
|
47
|
+
await this.ctx.resume();
|
|
48
|
+
this.stream = await openMic();
|
|
49
|
+
const url = URL.createObjectURL(new Blob([WORKLET], { type: "application/javascript" }));
|
|
50
|
+
await this.ctx.audioWorklet.addModule(url);
|
|
51
|
+
URL.revokeObjectURL(url);
|
|
52
|
+
const source = this.ctx.createMediaStreamSource(this.stream);
|
|
53
|
+
this.node = new AudioWorkletNode(this.ctx, "omni-record");
|
|
54
|
+
this.node.port.onmessage = (e: MessageEvent<ArrayBuffer>) => this.onChunk(new Float32Array(e.data));
|
|
55
|
+
source.connect(this.node);
|
|
56
|
+
source.connect(this.analyser);
|
|
57
|
+
return new Promise(resolve => {
|
|
58
|
+
this.done = resolve;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private onChunk(f: Float32Array) {
|
|
63
|
+
let sum = 0;
|
|
64
|
+
const pcm = new Int16Array(f.length);
|
|
65
|
+
for (let i = 0; i < f.length; i++) {
|
|
66
|
+
const s = Math.max(-1, Math.min(1, f[i]));
|
|
67
|
+
sum += s * s;
|
|
68
|
+
pcm[i] = s < 0 ? s * 0x8000 : s * 0x7fff;
|
|
69
|
+
}
|
|
70
|
+
this.chunks.push(pcm);
|
|
71
|
+
const rms = Math.sqrt(sum / f.length);
|
|
72
|
+
const ms = (f.length / RATE) * 1000;
|
|
73
|
+
if (rms > SPEAK) {
|
|
74
|
+
if (++this.loud >= 2) this.spoke = true;
|
|
75
|
+
this.quietMs = 0;
|
|
76
|
+
} else {
|
|
77
|
+
this.loud = 0;
|
|
78
|
+
if (this.spoke && rms < QUIET) this.quietMs += ms;
|
|
79
|
+
}
|
|
80
|
+
const total = this.chunks.length * ms;
|
|
81
|
+
if ((this.spoke && this.quietMs >= (this.opts.pauseMs ?? 1500)) || total >= (this.opts.maxMs ?? 60_000))
|
|
82
|
+
this.stop();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* ends the recording now (the user tapped) */
|
|
86
|
+
stop() {
|
|
87
|
+
if (!this.done) return;
|
|
88
|
+
const done = this.done;
|
|
89
|
+
this.done = null;
|
|
90
|
+
this.node?.disconnect();
|
|
91
|
+
this.stream?.getTracks().forEach(t => t.stop());
|
|
92
|
+
void this.ctx.close();
|
|
93
|
+
if (!this.spoke) return done(null);
|
|
94
|
+
const length = this.chunks.reduce((n, c) => n + c.length, 0);
|
|
95
|
+
const all = new Int16Array(length);
|
|
96
|
+
let at = 0;
|
|
97
|
+
for (const c of this.chunks) {
|
|
98
|
+
all.set(c, at);
|
|
99
|
+
at += c.length;
|
|
100
|
+
}
|
|
101
|
+
done(all);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
cancel() {
|
|
105
|
+
this.spoke = false;
|
|
106
|
+
this.stop();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function pcmToBase64(pcm: Int16Array): string {
|
|
111
|
+
const bytes = new Uint8Array(pcm.buffer, pcm.byteOffset, pcm.byteLength);
|
|
112
|
+
let s = "";
|
|
113
|
+
for (let i = 0; i < bytes.length; i += 0x8000) s += String.fromCharCode(...bytes.subarray(i, i + 0x8000));
|
|
114
|
+
return btoa(s);
|
|
115
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* The publishing platforms (YouTube, Instagram, TikTok). */
|
|
2
|
+
|
|
3
|
+
export type PlatformId = "youtube" | "instagram" | "tiktok";
|
|
4
|
+
|
|
5
|
+
export const PLATFORMS: { id: PlatformId; name: string }[] = [
|
|
6
|
+
{ id: "youtube", name: "YouTube" },
|
|
7
|
+
{ id: "instagram", name: "Instagram" },
|
|
8
|
+
{ id: "tiktok", name: "TikTok" },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export const platformName = (id: string) => PLATFORMS.find(p => p.id === id)?.name ?? id;
|
|
12
|
+
|
|
13
|
+
/* "no YouTube, no Instagram e no TikTok" */
|
|
14
|
+
export const formatPlatformList = (ids: string[]) => {
|
|
15
|
+
const names = ids.map(id => `no ${platformName(id)}`);
|
|
16
|
+
return names.length <= 1 ? names.join("") : `${names.slice(0, -1).join(", ")} e ${names.at(-1)}`;
|
|
17
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* The voice providers: ids, display names, where to open an account, and whether a key is set. */
|
|
2
|
+
|
|
3
|
+
import type { Settings, VoiceProfile } from "../types/api";
|
|
4
|
+
|
|
5
|
+
export type VoiceProviderId = "fish" | "cartesia" | "voicestudio" | "elevenlabs";
|
|
6
|
+
export const ALL_VOICE_PROVIDERS: VoiceProviderId[] = ["elevenlabs", "fish", "cartesia", "voicestudio"];
|
|
7
|
+
|
|
8
|
+
export const PROVIDER_NAME: Record<string, string> = {
|
|
9
|
+
elevenlabs: "ElevenLabs",
|
|
10
|
+
fish: "Fish Audio",
|
|
11
|
+
cartesia: "Cartesia",
|
|
12
|
+
voicestudio: "VoiceStudio",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/* where to create each provider's account; the key goes in Configurações → Voz */
|
|
16
|
+
export const PROVIDER_ACCOUNT_URL: Record<string, string> = {
|
|
17
|
+
fish: "https://fish.audio",
|
|
18
|
+
cartesia: "https://play.cartesia.ai",
|
|
19
|
+
elevenlabs: "https://elevenlabs.io",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/* VoiceStudio is local: no key */
|
|
23
|
+
export const hasProviderKey = (settings: Settings, p: VoiceProviderId) =>
|
|
24
|
+
p === "voicestudio" ? true : !!(settings.voice[p].key.masked || settings.voice[p].key.in_env);
|
|
25
|
+
|
|
26
|
+
/* a voice profile's providers, in try order, by display name */
|
|
27
|
+
export const providerNamesOf = (p: VoiceProfile) => p.order.map(id => PROVIDER_NAME[id] ?? id);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* What the Publish stage had on screen when "Agendar" went to the Schedule: text, platforms,
|
|
2
|
+
privacy and the chosen day. Kept in this tab's sessionStorage, one per video, and back to the
|
|
3
|
+
Publish stage once the day and time are picked in the Schedule.
|
|
4
|
+
`picking`: the Schedule is waiting for this video's day. */
|
|
5
|
+
|
|
6
|
+
export type PublishDraft = {
|
|
7
|
+
slug: string;
|
|
8
|
+
title: string;
|
|
9
|
+
text: { title: string; description: string; caption: string };
|
|
10
|
+
checked: Record<string, boolean>;
|
|
11
|
+
/* platforms freed to publish again ("Republicar") */
|
|
12
|
+
released?: Record<string, boolean>;
|
|
13
|
+
privacy: string | null;
|
|
14
|
+
privacyTiktok: string | null;
|
|
15
|
+
/* YYYY-MM-DDTHH:mm, this Mac's time */
|
|
16
|
+
when: string | null;
|
|
17
|
+
picking: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const STORAGE_KEY = "omnivideo.publish-draft";
|
|
21
|
+
|
|
22
|
+
function all(): Record<string, PublishDraft> {
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(sessionStorage.getItem(STORAGE_KEY) ?? "{}") ?? {};
|
|
25
|
+
} catch {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function saveAll(r: Record<string, PublishDraft>) {
|
|
31
|
+
try {
|
|
32
|
+
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(r));
|
|
33
|
+
} catch {
|
|
34
|
+
/* no storage: the draft lives only on screen */
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const readPublishDraft = (slug: string): PublishDraft | null => all()[slug] ?? null;
|
|
39
|
+
|
|
40
|
+
/* the video whose day the Schedule is waiting for (the most recent, if more than one) */
|
|
41
|
+
export const pickingPublishDraft = (): PublishDraft | null => Object.values(all()).find(r => r.picking) ?? null;
|
|
42
|
+
|
|
43
|
+
export function savePublishDraft(r: PublishDraft) {
|
|
44
|
+
/* only one video picks a day at a time */
|
|
45
|
+
const rest = Object.fromEntries(Object.entries(all()).map(([k, x]) => [k, r.picking ? { ...x, picking: false } : x]));
|
|
46
|
+
saveAll({ ...rest, [r.slug]: r });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function deletePublishDraft(slug: string) {
|
|
50
|
+
const { [slug]: _, ...rest } = all();
|
|
51
|
+
saveAll(rest);
|
|
52
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* Pure pieces of Configurações → Publicação (pages/SettingsPage/components/PublishingCategory):
|
|
2
|
+
the option lists, the text ↔ value conversions of the form fields and the outcome of a
|
|
3
|
+
browser login. */
|
|
4
|
+
|
|
5
|
+
import type { ActionResult } from "./api";
|
|
6
|
+
|
|
7
|
+
/* --- YouTube ---------------------------------------------------------------------- */
|
|
8
|
+
export const YT_CATEGORIES: [string, string][] = [
|
|
9
|
+
["1", "Cinema e animação"],
|
|
10
|
+
["2", "Automóveis"],
|
|
11
|
+
["10", "Música"],
|
|
12
|
+
["15", "Animais"],
|
|
13
|
+
["17", "Esportes"],
|
|
14
|
+
["19", "Viagens"],
|
|
15
|
+
["20", "Games"],
|
|
16
|
+
["22", "Pessoas e blogs"],
|
|
17
|
+
["23", "Comédia"],
|
|
18
|
+
["24", "Entretenimento"],
|
|
19
|
+
["25", "Notícias e política"],
|
|
20
|
+
["26", "Como fazer e estilo"],
|
|
21
|
+
["27", "Educação"],
|
|
22
|
+
["28", "Ciência e tecnologia"],
|
|
23
|
+
];
|
|
24
|
+
export const PRIVACY_OPTIONS: [string, string][] = [
|
|
25
|
+
["private", "Privado"],
|
|
26
|
+
["unlisted", "Não listado"],
|
|
27
|
+
["public", "Público"],
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
/* the category picker's options: an id outside the list stays as the first option */
|
|
31
|
+
export const youtubeCategoryOptions = (current: string) => [
|
|
32
|
+
...(YT_CATEGORIES.some(([k]) => k === current) ? [] : [{ value: current, label: current }]),
|
|
33
|
+
...YT_CATEGORIES.map(([k, name]) => ({ value: k, label: name })),
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
/* --- TikTok ---------------------------------------------------------------------- */
|
|
37
|
+
export const TIKTOK_PRIVACY_OPTIONS: [string, string][] = [
|
|
38
|
+
["SELF_ONLY", "Só eu"],
|
|
39
|
+
["MUTUAL_FOLLOW_FRIENDS", "Amigos"],
|
|
40
|
+
["FOLLOWER_OF_CREATOR", "Seguidores"],
|
|
41
|
+
["PUBLIC_TO_EVERYONE", "Todo mundo"],
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
/* --- schedule ---------------------------------------------------------------------- */
|
|
45
|
+
export const STATE_LABEL: Record<string, string> = {
|
|
46
|
+
scheduled: "Agendado",
|
|
47
|
+
publishing: "Publicando",
|
|
48
|
+
failed: "Falhou",
|
|
49
|
+
missed: "Passou da hora",
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/* --- field conversions ------------------------------------------------------------- */
|
|
53
|
+
/* the cover becomes text on screen and goes back to a number (or null) on save */
|
|
54
|
+
export const coverToText = (v: number | null) => (v == null ? "" : String(v));
|
|
55
|
+
export const coverToNumber = (v: string) => (v.trim() === "" ? null : v.trim().replace(",", "."));
|
|
56
|
+
|
|
57
|
+
/* the hashtags as one line on screen, back to a list on save */
|
|
58
|
+
export const hashtagsToText = (hashtags: string[]) => hashtags.map(h => `#${h}`).join(" ");
|
|
59
|
+
export const hashtagsToList = (text: string) => text.split(/[\s,]+/).filter(Boolean);
|
|
60
|
+
|
|
61
|
+
/* a number field typed with a comma or a dot */
|
|
62
|
+
export const decimalOf = (value: string) => Number(value.replace(",", "."));
|
|
63
|
+
|
|
64
|
+
/* a platform checked or unchecked in a list, without repeats */
|
|
65
|
+
export const togglePlatform = (platforms: string[], id: string, yes: boolean) =>
|
|
66
|
+
yes ? [...new Set([...platforms, id])] : platforms.filter(x => x !== id);
|
|
67
|
+
|
|
68
|
+
/* --- browser login (YouTube and TikTok) ---------------------------------------------- */
|
|
69
|
+
export type Connection = { state: "waiting" | "ok" | "error"; url: string | null; output: string; at: number } | null;
|
|
70
|
+
|
|
71
|
+
/* a finished login's message: the output's last line that isn't the link */
|
|
72
|
+
export function connectionResult(c: NonNullable<Connection>): ActionResult {
|
|
73
|
+
const last =
|
|
74
|
+
c.output
|
|
75
|
+
.split("\n")
|
|
76
|
+
.filter(l => !l.startsWith("url: "))
|
|
77
|
+
.pop() ?? "";
|
|
78
|
+
return c.state === "ok"
|
|
79
|
+
? { ok: true, output: last || "conectado" }
|
|
80
|
+
: { ok: false, error: last || "O login não terminou" };
|
|
81
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/* The TanStack Query client and the bridge from the SSE stream to its cache.
|
|
2
|
+
Pushed resources (queue, services, sessions) are written with setQueryData; "changed"
|
|
3
|
+
notices (video, reference, omnichat, analytics) invalidate their keys, debounced 150 ms
|
|
4
|
+
so a burst of file writes refetches once. Data never goes stale on its own: the stream
|
|
5
|
+
is what refreshes it. */
|
|
6
|
+
|
|
7
|
+
import { QueryClient, type QueryKey } from "@tanstack/react-query";
|
|
8
|
+
import { onReconnect, subscribe } from "./sse";
|
|
9
|
+
|
|
10
|
+
export const queryClient = new QueryClient({
|
|
11
|
+
defaultOptions: {
|
|
12
|
+
queries: {
|
|
13
|
+
staleTime: Infinity,
|
|
14
|
+
gcTime: 5 * 60_000,
|
|
15
|
+
retry: false,
|
|
16
|
+
refetchOnWindowFocus: false,
|
|
17
|
+
refetchOnReconnect: false,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
/* query keys (GLOSSARY §10.1); hooks and invalidations use only these */
|
|
23
|
+
export const queryKeys = {
|
|
24
|
+
videos: ["videos"] as const,
|
|
25
|
+
video: (slug: string) => ["video", slug] as const,
|
|
26
|
+
queue: ["queue"] as const,
|
|
27
|
+
services: ["services"] as const,
|
|
28
|
+
sessions: ["sessions"] as const,
|
|
29
|
+
session: (id: string) => ["session", id] as const,
|
|
30
|
+
references: ["references"] as const,
|
|
31
|
+
reference: (name: string) => ["reference", name] as const,
|
|
32
|
+
/* rules = false: GET /api/omnichat?rules=0 */
|
|
33
|
+
omnichat: (rules = true) => ["omnichat", rules ? "rules" : "no-rules"] as const,
|
|
34
|
+
omnichatRule: (apiBase: string) => ["omnichat-rule", apiBase] as const,
|
|
35
|
+
analytics: ["analytics"] as const,
|
|
36
|
+
reel: (slug: string) => ["reel", slug] as const,
|
|
37
|
+
settings: ["settings"] as const,
|
|
38
|
+
usage: ["usage"] as const,
|
|
39
|
+
accounts: ["accounts"] as const,
|
|
40
|
+
schedule: ["schedule"] as const,
|
|
41
|
+
onboarding: ["onboarding"] as const,
|
|
42
|
+
agent: ["agent"] as const,
|
|
43
|
+
admin: ["admin"] as const,
|
|
44
|
+
agentConversations: ["agent-conversations"] as const,
|
|
45
|
+
runner: ["runner"] as const,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/* the omnichat rule API of a video, of a content's carousel or of an outside post */
|
|
49
|
+
export const videoOmnichatApi = (slug: string) => `/api/videos/${encodeURIComponent(slug)}/omnichat`;
|
|
50
|
+
export const carouselOmnichatApi = (slug: string) => `/api/videos/${encodeURIComponent(slug)}/carousel/omnichat`;
|
|
51
|
+
export const postOmnichatApi = (code: string) => `/api/omnichat/posts/${encodeURIComponent(code)}`;
|
|
52
|
+
|
|
53
|
+
const timers = new Map<string, ReturnType<typeof setTimeout>>();
|
|
54
|
+
|
|
55
|
+
/* invalidate (prefix match) after 150 ms of quiet for that key */
|
|
56
|
+
export function invalidateSoon(key: QueryKey) {
|
|
57
|
+
const id = JSON.stringify(key);
|
|
58
|
+
clearTimeout(timers.get(id));
|
|
59
|
+
timers.set(
|
|
60
|
+
id,
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
timers.delete(id);
|
|
63
|
+
queryClient.invalidateQueries({ queryKey: key });
|
|
64
|
+
}, 150),
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* invalidate now, e.g. after a POST that changed the data */
|
|
69
|
+
export function invalidate(...keys: QueryKey[]) {
|
|
70
|
+
return Promise.all(keys.map(queryKey => queryClient.invalidateQueries({ queryKey })));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
let bridged = false;
|
|
74
|
+
|
|
75
|
+
/* wire the SSE stream into the cache; called once by main.tsx */
|
|
76
|
+
export function connectSseToQueries() {
|
|
77
|
+
if (bridged) return;
|
|
78
|
+
bridged = true;
|
|
79
|
+
onReconnect(() => void queryClient.invalidateQueries());
|
|
80
|
+
subscribe((event, data) => {
|
|
81
|
+
switch (event) {
|
|
82
|
+
case "queue":
|
|
83
|
+
queryClient.setQueryData(queryKeys.queue, data);
|
|
84
|
+
break;
|
|
85
|
+
case "services":
|
|
86
|
+
queryClient.setQueryData(queryKeys.services, data);
|
|
87
|
+
break;
|
|
88
|
+
case "sessions":
|
|
89
|
+
queryClient.setQueryData(queryKeys.sessions, data);
|
|
90
|
+
invalidateSoon(["session"]);
|
|
91
|
+
break;
|
|
92
|
+
case "video":
|
|
93
|
+
invalidateSoon(queryKeys.videos);
|
|
94
|
+
invalidateSoon(queryKeys.schedule);
|
|
95
|
+
if (data?.slug) invalidateSoon(queryKeys.video(data.slug));
|
|
96
|
+
break;
|
|
97
|
+
case "reference":
|
|
98
|
+
invalidateSoon(queryKeys.references);
|
|
99
|
+
if (data?.name) invalidateSoon(queryKeys.reference(data.name));
|
|
100
|
+
break;
|
|
101
|
+
case "omnichat":
|
|
102
|
+
/* { slug } a video's (or its carousel's) rule/record/publication changed, { code } an outside post's, {} the account pause */
|
|
103
|
+
invalidateSoon(["omnichat"]);
|
|
104
|
+
if (data?.slug) {
|
|
105
|
+
invalidateSoon(queryKeys.omnichatRule(videoOmnichatApi(data.slug)));
|
|
106
|
+
invalidateSoon(queryKeys.omnichatRule(carouselOmnichatApi(data.slug)));
|
|
107
|
+
}
|
|
108
|
+
if (data?.code) invalidateSoon(queryKeys.omnichatRule(postOmnichatApi(data.code)));
|
|
109
|
+
break;
|
|
110
|
+
case "agent":
|
|
111
|
+
/* the admin changed Omni (admin panel): on, engine, voice, models */
|
|
112
|
+
invalidateSoon(queryKeys.agent);
|
|
113
|
+
invalidateSoon(queryKeys.admin);
|
|
114
|
+
break;
|
|
115
|
+
case "analytics":
|
|
116
|
+
/* metrics, a Reel's analysis, the account snapshot or channel/ (playbook and analyses) */
|
|
117
|
+
invalidateSoon(queryKeys.analytics);
|
|
118
|
+
invalidateSoon(["reel"]);
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|