@crievo/omni 0.0.0-stage → 0.1.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/.env.example +41 -0
- package/README.md +2 -2
- package/bin/omni.mjs +14 -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.test.tsx +30 -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,162 @@
|
|
|
1
|
+
/* Omni, the voice agent (AgentPage): its config and voices, the session token, the tools Grok calls
|
|
2
|
+
through the browser, the confirmation of a staged publish and the measurement log. */
|
|
3
|
+
|
|
4
|
+
import { json } from "../lib/validate";
|
|
5
|
+
import { router } from "../lib/hono";
|
|
6
|
+
import { fail, result, shaped } from "../lib/result";
|
|
7
|
+
import { notFound, notFoundResponse } from "../lib/errors";
|
|
8
|
+
import { noTimeout } from "../middleware/no-timeout";
|
|
9
|
+
import {
|
|
10
|
+
agentConfig,
|
|
11
|
+
agentStats,
|
|
12
|
+
checkHotword,
|
|
13
|
+
engineMismatch,
|
|
14
|
+
HotwordLimit,
|
|
15
|
+
logEvent,
|
|
16
|
+
logResolved,
|
|
17
|
+
OMNI_OFF,
|
|
18
|
+
QuotaError,
|
|
19
|
+
startSession,
|
|
20
|
+
transcribe,
|
|
21
|
+
voiceRemainingSeconds,
|
|
22
|
+
voiceSample,
|
|
23
|
+
} from "../services/agent";
|
|
24
|
+
import { askClaude, claudeReply } from "../services/agent-claude";
|
|
25
|
+
import { readEnvKeys } from "../services/services";
|
|
26
|
+
import {
|
|
27
|
+
cancelAction,
|
|
28
|
+
cancelSessionActions,
|
|
29
|
+
confirmAction,
|
|
30
|
+
isLoggedTool,
|
|
31
|
+
noteHeard,
|
|
32
|
+
pendingAction,
|
|
33
|
+
runTool,
|
|
34
|
+
} from "../services/agent-tools";
|
|
35
|
+
import { setAgentAvatar, setAgentGender } from "../services/settings";
|
|
36
|
+
import { emptyBody, messageBody } from "../../shared/schemas/common";
|
|
37
|
+
import {
|
|
38
|
+
agentAvatarBody,
|
|
39
|
+
agentHotwordBody,
|
|
40
|
+
agentLogBody,
|
|
41
|
+
agentSessionBody,
|
|
42
|
+
agentSttBody,
|
|
43
|
+
agentToolBody,
|
|
44
|
+
agentVoiceBody,
|
|
45
|
+
} from "../../shared/schemas/agent";
|
|
46
|
+
import type { AgentClaudeReply, AgentInfo, AgentSessionStart } from "../../shared/types/api";
|
|
47
|
+
|
|
48
|
+
export const agent = router()
|
|
49
|
+
.get("/agent", c => {
|
|
50
|
+
const error = readEnvKeys().XAI_API_KEY ? null : "falta XAI_API_KEY no .env";
|
|
51
|
+
const config = agentConfig();
|
|
52
|
+
return c.json(
|
|
53
|
+
shaped<AgentInfo>({
|
|
54
|
+
config,
|
|
55
|
+
stats: agentStats(),
|
|
56
|
+
error,
|
|
57
|
+
voice_left_s: Math.floor(voiceRemainingSeconds(config)),
|
|
58
|
+
}),
|
|
59
|
+
);
|
|
60
|
+
})
|
|
61
|
+
.post("/agent/voice", json(agentVoiceBody), c => result(c, setAgentGender(c.req.valid("json").gender)))
|
|
62
|
+
.post("/agent/avatar", json(agentAvatarBody), c => result(c, setAgentAvatar(c.req.valid("json").avatar)))
|
|
63
|
+
.get("/agent/voices/:gender/sample", async c => {
|
|
64
|
+
try {
|
|
65
|
+
const file = await voiceSample(c.req.param("gender"), c.req.query("clip") ?? "greeting");
|
|
66
|
+
return new Response(Bun.file(file), { headers: { "content-type": "audio/mpeg" } });
|
|
67
|
+
} catch {
|
|
68
|
+
return notFoundResponse();
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
.post("/agent/session", json(agentSessionBody), async c => {
|
|
72
|
+
try {
|
|
73
|
+
return c.json(shaped<AgentSessionStart>({ ok: true, ...(await startSession(c.req.valid("json").resume)) }));
|
|
74
|
+
} catch (e) {
|
|
75
|
+
return c.json(
|
|
76
|
+
{ ok: false as const, error: String((e as Error)?.message ?? e), quota: e instanceof QuotaError },
|
|
77
|
+
400,
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
/* Claude mode: the page's recording → text, then the text → the user's Claude */
|
|
82
|
+
.post("/agent/stt", noTimeout, json(agentSttBody), async c => {
|
|
83
|
+
const b = c.req.valid("json");
|
|
84
|
+
try {
|
|
85
|
+
return c.json({ ok: true as const, ...(await transcribe(b.audio, b.session)) });
|
|
86
|
+
} catch (e) {
|
|
87
|
+
return fail(c, String((e as Error)?.message ?? e));
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
/* "Oi, Omni" with the panel closed: does the start of this utterance call Omni? `limit`: stop for the day */
|
|
91
|
+
.post("/agent/hotword", noTimeout, json(agentHotwordBody), async c => {
|
|
92
|
+
try {
|
|
93
|
+
return c.json({ ok: true as const, ...(await checkHotword(c.req.valid("json").audio)) });
|
|
94
|
+
} catch (e) {
|
|
95
|
+
return c.json(
|
|
96
|
+
{ ok: false as const, error: String((e as Error)?.message ?? e), limit: e instanceof HotwordLimit },
|
|
97
|
+
400,
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
.post("/agent/claude", json(messageBody), c => result(c, askClaude(c.req.valid("json").message ?? "")))
|
|
102
|
+
.get("/agent/claude/:id", c => {
|
|
103
|
+
const r = claudeReply(c.req.param("id"));
|
|
104
|
+
if (!r) throw notFound();
|
|
105
|
+
return c.json(shaped<AgentClaudeReply>(r));
|
|
106
|
+
})
|
|
107
|
+
/* inspect_content and the actions can take seconds */
|
|
108
|
+
.post("/agent/tools", noTimeout, json(agentToolBody), async c => {
|
|
109
|
+
const b = c.req.valid("json");
|
|
110
|
+
const t0 = performance.now();
|
|
111
|
+
/* Grok's tools: the admin switching Omni off (or off Grok) stops them too */
|
|
112
|
+
const cfg = agentConfig();
|
|
113
|
+
const off = !cfg.enabled ? OMNI_OFF : cfg.engine !== "grok" ? engineMismatch(cfg.engine) : null;
|
|
114
|
+
if (b.heard !== undefined) noteHeard(b.session, b.heard);
|
|
115
|
+
const output = off ? { error: off } : await runTool(b.session, b.name, b.arguments);
|
|
116
|
+
const ms = Math.round(performance.now() - t0);
|
|
117
|
+
logEvent({
|
|
118
|
+
session: b.session,
|
|
119
|
+
type: "tool",
|
|
120
|
+
name: b.name,
|
|
121
|
+
ms,
|
|
122
|
+
error: typeof output.error === "string" ? output.error : undefined,
|
|
123
|
+
cost_usd: typeof output.cost_usd === "number" ? output.cost_usd : undefined,
|
|
124
|
+
model: typeof output.model === "string" ? output.model : undefined,
|
|
125
|
+
/* audit: what each staged action asked for */
|
|
126
|
+
args: isLoggedTool(b.name) ? b.arguments.slice(0, 2000) : undefined,
|
|
127
|
+
});
|
|
128
|
+
logResolved(b.session, output);
|
|
129
|
+
return c.json({ ok: true as const, call_id: b.call_id, output, ms });
|
|
130
|
+
})
|
|
131
|
+
.post("/agent/actions/:id/confirm", noTimeout, json(emptyBody), async c => {
|
|
132
|
+
const id = c.req.param("id");
|
|
133
|
+
const action = pendingAction(id);
|
|
134
|
+
const r = await confirmAction(id);
|
|
135
|
+
if (action)
|
|
136
|
+
logEvent({
|
|
137
|
+
session: action.session,
|
|
138
|
+
type: "action",
|
|
139
|
+
kind: action.kind,
|
|
140
|
+
slug: action.slug,
|
|
141
|
+
summary: action.summary,
|
|
142
|
+
ok: r.ok,
|
|
143
|
+
error: r.ok ? undefined : r.error,
|
|
144
|
+
});
|
|
145
|
+
return result(c, r);
|
|
146
|
+
})
|
|
147
|
+
.post("/agent/actions/:id/cancel", json(emptyBody), c => {
|
|
148
|
+
const action = pendingAction(c.req.param("id"));
|
|
149
|
+
if (action)
|
|
150
|
+
logEvent({ session: action.session, type: "action", kind: action.kind, slug: action.slug, canceled: true });
|
|
151
|
+
return result(c, cancelAction(c.req.param("id")));
|
|
152
|
+
})
|
|
153
|
+
.post("/agent/sessions/:id/log", json(agentLogBody), c => {
|
|
154
|
+
const id = c.req.param("id");
|
|
155
|
+
const b = c.req.valid("json");
|
|
156
|
+
logEvent({ session: id, ...b });
|
|
157
|
+
/* the call ended: what it left waiting for Confirmar is canceled (not when it only went to sleep) */
|
|
158
|
+
if (b.type === "end" && b.reason !== "wait")
|
|
159
|
+
for (const a of cancelSessionActions(id))
|
|
160
|
+
logEvent({ session: id, type: "action", kind: a.kind, slug: a.slug, canceled: true, reason: "hangup" });
|
|
161
|
+
return c.json({ ok: true as const });
|
|
162
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Analytics (AnalyticsPage): Reel metrics (tools/metrics.mjs), collect now, the metrics agent and
|
|
2
|
+
Claude's analysis. Metrics reading is a cloud candidate. */
|
|
3
|
+
|
|
4
|
+
import { json } from "../lib/validate";
|
|
5
|
+
import { router } from "../lib/hono";
|
|
6
|
+
import { result, shaped } from "../lib/result";
|
|
7
|
+
import { notFound } from "../lib/errors";
|
|
8
|
+
import { noTimeout } from "../middleware/no-timeout";
|
|
9
|
+
import {
|
|
10
|
+
chatAnalysis,
|
|
11
|
+
collectMetrics,
|
|
12
|
+
getAnalytics,
|
|
13
|
+
getReel,
|
|
14
|
+
requestAnalysis,
|
|
15
|
+
setMetricsAgent,
|
|
16
|
+
} from "../services/analytics";
|
|
17
|
+
import { emptyBody, enableBody, messageBody } from "../../shared/schemas/common";
|
|
18
|
+
import { analyzeBody } from "../../shared/schemas/analytics";
|
|
19
|
+
import type { Analytics, ReelDetail } from "../../shared/types/api";
|
|
20
|
+
|
|
21
|
+
export const analytics = router()
|
|
22
|
+
.get("/analytics", async c => c.json(shaped<Analytics>(await getAnalytics())))
|
|
23
|
+
.get("/analytics/reels/:slug", async c => {
|
|
24
|
+
const r = shaped<ReelDetail | null>(await getReel(c.req.param("slug")));
|
|
25
|
+
if (!r) throw notFound();
|
|
26
|
+
return c.json(r);
|
|
27
|
+
})
|
|
28
|
+
.post("/analytics/collect", noTimeout, json(emptyBody), async c => result(c, await collectMetrics()))
|
|
29
|
+
.post("/analytics/agent", json(enableBody), async c => result(c, await setMetricsAgent(c.req.valid("json").enable)))
|
|
30
|
+
.post("/analytics/analyze", json(analyzeBody), c => result(c, requestAnalysis(c.req.valid("json"))))
|
|
31
|
+
.post("/analytics/claude", json(messageBody), c => result(c, chatAnalysis(c.req.valid("json").message)));
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* Script and scene approval (ScriptApprovalPanel, ScenesApprovalPanel): decide, approve the pending
|
|
2
|
+
scenes, save the script edit (which approves), or pause/resume the auto countdown while editing. */
|
|
3
|
+
|
|
4
|
+
import { json } from "../lib/validate";
|
|
5
|
+
import { router } from "../lib/hono";
|
|
6
|
+
import { result } from "../lib/result";
|
|
7
|
+
import { videoDir } from "../lib/video";
|
|
8
|
+
import { decideScenes, decideScript, resumeAfterApproval } from "../services/approval";
|
|
9
|
+
import { refreshStatus } from "../services/videos";
|
|
10
|
+
import { emptyBody } from "../../shared/schemas/common";
|
|
11
|
+
import { sceneDecisionBody, scriptDecisionBody, scriptEditBody } from "../../shared/schemas/approval";
|
|
12
|
+
|
|
13
|
+
type Decision = { ok: boolean; output?: string; error?: string };
|
|
14
|
+
type SceneAction = Parameters<typeof decideScenes>[1];
|
|
15
|
+
type ScriptAction = Parameters<typeof decideScript>[1];
|
|
16
|
+
|
|
17
|
+
/* on ok: refresh the status and resume the session if the round ended (its note joins the output) */
|
|
18
|
+
async function decided(slug: string, dir: string, kind: "scenes" | "script", r: Decision) {
|
|
19
|
+
if (r.ok) {
|
|
20
|
+
await refreshStatus(slug);
|
|
21
|
+
r.output += resumeAfterApproval(slug, dir, kind);
|
|
22
|
+
}
|
|
23
|
+
return r;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function scenes(slug: string, action: SceneAction, body: Parameters<typeof decideScenes>[2]) {
|
|
27
|
+
const dir = videoDir(slug);
|
|
28
|
+
return decided(slug, dir, "scenes", decideScenes(dir, action, body));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function script(slug: string, action: ScriptAction, body: Parameters<typeof decideScript>[2]) {
|
|
32
|
+
const dir = videoDir(slug);
|
|
33
|
+
return decided(slug, dir, "script", decideScript(dir, action, body));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const approval = router()
|
|
37
|
+
.post("/videos/:slug/scenes/decide", json(sceneDecisionBody), async c =>
|
|
38
|
+
result(c, await scenes(c.req.param("slug"), "decide", c.req.valid("json"))),
|
|
39
|
+
)
|
|
40
|
+
.post("/videos/:slug/scenes/approve-all", json(emptyBody), async c =>
|
|
41
|
+
result(c, await scenes(c.req.param("slug"), "approve-all", {})),
|
|
42
|
+
)
|
|
43
|
+
.post("/videos/:slug/scenes/pause", json(emptyBody), async c =>
|
|
44
|
+
result(c, await scenes(c.req.param("slug"), "pause", {})),
|
|
45
|
+
)
|
|
46
|
+
.post("/videos/:slug/scenes/resume", json(emptyBody), async c =>
|
|
47
|
+
result(c, await scenes(c.req.param("slug"), "resume", {})),
|
|
48
|
+
)
|
|
49
|
+
.post("/videos/:slug/script/decide", json(scriptDecisionBody), async c =>
|
|
50
|
+
result(c, await script(c.req.param("slug"), "decide", c.req.valid("json"))),
|
|
51
|
+
)
|
|
52
|
+
.post("/videos/:slug/script/edit", json(scriptEditBody), async c =>
|
|
53
|
+
result(c, await script(c.req.param("slug"), "edit", c.req.valid("json"))),
|
|
54
|
+
)
|
|
55
|
+
.post("/videos/:slug/script/pause", json(emptyBody), async c =>
|
|
56
|
+
result(c, await script(c.req.param("slug"), "pause", {})),
|
|
57
|
+
)
|
|
58
|
+
.post("/videos/:slug/script/resume", json(emptyBody), async c =>
|
|
59
|
+
result(c, await script(c.req.param("slug"), "resume", {})),
|
|
60
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* Archive and unarchive (VideoRow). */
|
|
2
|
+
|
|
3
|
+
import { json } from "../lib/validate";
|
|
4
|
+
import { router } from "../lib/hono";
|
|
5
|
+
import { result } from "../lib/result";
|
|
6
|
+
import { videoDir } from "../lib/video";
|
|
7
|
+
import { archiveVideo } from "../services/archive";
|
|
8
|
+
import { archiveBody } from "../../shared/schemas/videos";
|
|
9
|
+
|
|
10
|
+
export const archive = router().post("/videos/:slug/archive", json(archiveBody), c =>
|
|
11
|
+
result(c, archiveVideo(videoDir(c.req.param("slug")), c.req.valid("json").archive !== false)),
|
|
12
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* Captions stage (CaptionPositionEditor): data, the preview page and frame, position and text. */
|
|
2
|
+
|
|
3
|
+
import { json, query } from "../lib/validate";
|
|
4
|
+
import { router } from "../lib/hono";
|
|
5
|
+
import { result } from "../lib/result";
|
|
6
|
+
import { videoDir } from "../lib/video";
|
|
7
|
+
import { captionsPage, frameAt, getCaptionsData, saveCaptionPosition, saveCaptionText } from "../services/captions";
|
|
8
|
+
import { captionPositionBody, captionTextBody, frameQuery } from "../../shared/schemas/captions";
|
|
9
|
+
|
|
10
|
+
export const captions = router()
|
|
11
|
+
.get("/videos/:slug/captions", c => {
|
|
12
|
+
const dir = videoDir(c.req.param("slug"));
|
|
13
|
+
try {
|
|
14
|
+
return c.json(getCaptionsData(dir), 200);
|
|
15
|
+
} catch (e) {
|
|
16
|
+
return c.json({ error: (e as Error).message }, 400);
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
.get("/videos/:slug/captions/page", c => captionsPage(videoDir(c.req.param("slug"))))
|
|
20
|
+
.get("/videos/:slug/captions/frame", query(frameQuery), c =>
|
|
21
|
+
frameAt(videoDir(c.req.param("slug")), Number(c.req.valid("query").t ?? 0)),
|
|
22
|
+
)
|
|
23
|
+
.post("/videos/:slug/captions/position", json(captionPositionBody), c =>
|
|
24
|
+
result(c, saveCaptionPosition(videoDir(c.req.param("slug")), c.req.valid("json"))),
|
|
25
|
+
)
|
|
26
|
+
.post("/videos/:slug/captions/text", json(captionTextBody), c =>
|
|
27
|
+
result(c, saveCaptionText(videoDir(c.req.param("slug")), c.req.valid("json"))),
|
|
28
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* The content's carousel (CarouselCreate, CarouselChangeRequest, CarouselPublishStage): create and
|
|
2
|
+
adjust go to the content's session; caption saves the post text; publish uploads to Instagram
|
|
3
|
+
(minutes, no timeout). */
|
|
4
|
+
|
|
5
|
+
import { json } from "../lib/validate";
|
|
6
|
+
import { router } from "../lib/hono";
|
|
7
|
+
import { result } from "../lib/result";
|
|
8
|
+
import { videoDir } from "../lib/video";
|
|
9
|
+
import { noTimeout } from "../middleware/no-timeout";
|
|
10
|
+
import { adjustCarousel, createCarousel, publishCarousel, saveCaption } from "../services/carousel";
|
|
11
|
+
import { refreshStatus } from "../services/videos";
|
|
12
|
+
import {
|
|
13
|
+
carouselAdjustBody,
|
|
14
|
+
carouselCaptionBody,
|
|
15
|
+
carouselCreateBody,
|
|
16
|
+
carouselPublishBody,
|
|
17
|
+
} from "../../shared/schemas/carousel";
|
|
18
|
+
|
|
19
|
+
export const carousel = router()
|
|
20
|
+
.post("/videos/:slug/carousel/create", json(carouselCreateBody), async c => {
|
|
21
|
+
const slug = c.req.param("slug");
|
|
22
|
+
const r = createCarousel(slug, videoDir(slug), slug, c.req.valid("json").note ?? "");
|
|
23
|
+
if (r.ok) await refreshStatus(slug);
|
|
24
|
+
return result(c, r);
|
|
25
|
+
})
|
|
26
|
+
.post("/videos/:slug/carousel/adjust", json(carouselAdjustBody), c => {
|
|
27
|
+
const slug = c.req.param("slug");
|
|
28
|
+
return result(c, adjustCarousel(slug, videoDir(slug), slug, c.req.valid("json")));
|
|
29
|
+
})
|
|
30
|
+
.post("/videos/:slug/carousel/caption", json(carouselCaptionBody), c =>
|
|
31
|
+
result(c, saveCaption(videoDir(c.req.param("slug")), c.req.valid("json").caption)),
|
|
32
|
+
)
|
|
33
|
+
.post("/videos/:slug/carousel/publish", noTimeout, json(carouselPublishBody), async c => {
|
|
34
|
+
const slug = c.req.param("slug");
|
|
35
|
+
const r = await publishCarousel(videoDir(slug), c.req.valid("json"));
|
|
36
|
+
await refreshStatus(slug);
|
|
37
|
+
return result(c, r);
|
|
38
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* Voice cloning (CloneVoiceDialog, ProviderDetail): the reading phrases, the account's plan, a
|
|
2
|
+
profile's stored recording, clone, recreate on one provider and redo the whole voice (minutes). */
|
|
3
|
+
|
|
4
|
+
import { json } from "../lib/validate";
|
|
5
|
+
import { router } from "../lib/hono";
|
|
6
|
+
import { result } from "../lib/result";
|
|
7
|
+
import { serveWav } from "../lib/files";
|
|
8
|
+
import { noTimeout } from "../middleware/no-timeout";
|
|
9
|
+
import { cloneVoice, getClonePlan, profileRecording, recreateClone, redoVoice } from "../services/clone";
|
|
10
|
+
import { CLONE_CONTEXTS } from "../services/clone-phrases";
|
|
11
|
+
import { originalWavFile } from "../services/media";
|
|
12
|
+
import { cloneBody, recreateCloneBody, redoVoiceBody } from "../../shared/schemas/clone";
|
|
13
|
+
|
|
14
|
+
export const clone = router()
|
|
15
|
+
.get("/settings/clone/phrases", c => c.json(CLONE_CONTEXTS))
|
|
16
|
+
.get("/settings/clone/plan", async c => c.json(await getClonePlan()))
|
|
17
|
+
.get("/settings/clone/recording/:profile", async c => c.json(await profileRecording(c.req.param("profile"))))
|
|
18
|
+
.get("/voice-original/:clone", c => serveWav(originalWavFile(c.req.param("clone"))))
|
|
19
|
+
.post("/settings/clone", noTimeout, json(cloneBody), async c => result(c, await cloneVoice(c.req.valid("json"))))
|
|
20
|
+
/* create or recreate the clone of a voice on a single provider (Editar voz → Configurar) */
|
|
21
|
+
.post("/settings/clone/recreate", noTimeout, json(recreateCloneBody), async c =>
|
|
22
|
+
result(c, await recreateClone(c.req.valid("json"))),
|
|
23
|
+
)
|
|
24
|
+
/* redo the whole voice, on all its providers (Editar voz → Refazer voz) */
|
|
25
|
+
.post("/settings/clone/redo", noTimeout, json(redoVoiceBody), async c =>
|
|
26
|
+
result(c, await redoVoice(c.req.valid("json"))),
|
|
27
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* New content and new references (NewVideoPage, NewReferenceForm, including the video upload). */
|
|
2
|
+
|
|
3
|
+
import { json } from "../lib/validate";
|
|
4
|
+
import { router } from "../lib/hono";
|
|
5
|
+
import { result } from "../lib/result";
|
|
6
|
+
import { noTimeout } from "../middleware/no-timeout";
|
|
7
|
+
import { createReference, createVideo, storeUpload } from "../services/create";
|
|
8
|
+
import { createVideoBody } from "../../shared/schemas/videos";
|
|
9
|
+
import { createReferenceBody } from "../../shared/schemas/references";
|
|
10
|
+
|
|
11
|
+
/* the upload takes the raw body with the name in x-file-name (the local-only guard checks it) */
|
|
12
|
+
export const UPLOAD_PATH = "/api/references/upload";
|
|
13
|
+
|
|
14
|
+
export const create = router()
|
|
15
|
+
.post("/videos", json(createVideoBody), async c => result(c, await createVideo(c.req.valid("json"))))
|
|
16
|
+
.post("/references", json(createReferenceBody), c => result(c, createReference(c.req.valid("json"))))
|
|
17
|
+
.post("/references/upload", noTimeout, async c =>
|
|
18
|
+
result(c, await storeUpload(c.req.header("x-file-name") ?? "", c.req.raw.body)),
|
|
19
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* The SSE stream the whole UI listens to (lib/sse.ts): queue, services, sessions and change notices. */
|
|
2
|
+
|
|
3
|
+
import { router } from "../lib/hono";
|
|
4
|
+
import { HttpError } from "../lib/errors";
|
|
5
|
+
import { eventsStream } from "../services/events";
|
|
6
|
+
|
|
7
|
+
export const events = router().get("/events", c => {
|
|
8
|
+
const server = c.env?.server;
|
|
9
|
+
if (!server) throw new HttpError(500, "o stream precisa do servidor do Bun");
|
|
10
|
+
return eventsStream(c.req.raw, server);
|
|
11
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* Export (ReExport): assemble again; it waits in the queue. */
|
|
2
|
+
|
|
3
|
+
import { json } from "../lib/validate";
|
|
4
|
+
import { router } from "../lib/hono";
|
|
5
|
+
import { result } from "../lib/result";
|
|
6
|
+
import { videoDir } from "../lib/video";
|
|
7
|
+
import { reassemble } from "../services/sound";
|
|
8
|
+
import { emptyBody } from "../../shared/schemas/common";
|
|
9
|
+
|
|
10
|
+
export const exportRoutes = router()
|
|
11
|
+
/* export again (assemble.mjs) after captions, scenes, voice or motion changed */
|
|
12
|
+
.post("/videos/:slug/assemble", json(emptyBody), async c =>
|
|
13
|
+
result(c, await reassemble(videoDir(c.req.param("slug")))),
|
|
14
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* Files the UI shows as they are: a video's media (/media), a reference's files (/ref), the sound
|
|
2
|
+
timeline's draft WAVs (/sound-draft) and kit MP3s (/kit), and the guide's images (/docs). */
|
|
3
|
+
|
|
4
|
+
import { router } from "../lib/hono";
|
|
5
|
+
import { pathSegments, serveFile } from "../lib/files";
|
|
6
|
+
import { referenceMediaFile, videoMediaFile } from "../services/media";
|
|
7
|
+
import { draftFile, kitFile } from "../services/sound";
|
|
8
|
+
import { docFile } from "../services/onboarding";
|
|
9
|
+
|
|
10
|
+
/* /<prefix>/<first>/<rest…>: the first segment and the rest joined, decoded */
|
|
11
|
+
const split = (url: string) => {
|
|
12
|
+
const [first = "", ...rest] = pathSegments(url);
|
|
13
|
+
return [first, rest.join("/")] as const;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const media = router()
|
|
17
|
+
.get("/media/:slug/*", c => {
|
|
18
|
+
const [slug, rel] = split(c.req.url);
|
|
19
|
+
return serveFile(videoMediaFile(slug, rel), c.req.url);
|
|
20
|
+
})
|
|
21
|
+
.get("/ref/:name/*", c => {
|
|
22
|
+
const [name, rel] = split(c.req.url);
|
|
23
|
+
return serveFile(referenceMediaFile(name, rel), c.req.url);
|
|
24
|
+
})
|
|
25
|
+
.get("/sound-draft/:slug/*", c => {
|
|
26
|
+
const [slug, rel] = split(c.req.url);
|
|
27
|
+
return serveFile(draftFile(slug, rel), c.req.url);
|
|
28
|
+
})
|
|
29
|
+
.get("/kit/:name", c => serveFile(kitFile(pathSegments(c.req.url)[0] ?? ""), c.req.url))
|
|
30
|
+
.get("/docs/*", c => serveFile(docFile(pathSegments(c.req.url, 2).join("/")), c.req.url));
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/* Omnichat on Instagram comments (OmnichatPage, OmnichatRulePanel, MissingDmsPanel,
|
|
2
|
+
VideoOmnichatPanel, settings Publicação). The same rule routes serve a video's Reel, its
|
|
3
|
+
carousel and an outside post. Cloud candidate. */
|
|
4
|
+
|
|
5
|
+
import type { Context } from "hono";
|
|
6
|
+
import { json, query } from "../lib/validate";
|
|
7
|
+
import { router } from "../lib/hono";
|
|
8
|
+
import { result, shaped } from "../lib/result";
|
|
9
|
+
import { notFound } from "../lib/errors";
|
|
10
|
+
import { noTimeout } from "../middleware/no-timeout";
|
|
11
|
+
import {
|
|
12
|
+
carouselTarget,
|
|
13
|
+
createRuleFromLink,
|
|
14
|
+
deleteComments,
|
|
15
|
+
dryRunRule,
|
|
16
|
+
enableRule,
|
|
17
|
+
enableRuleWithTerm,
|
|
18
|
+
getOmnichatState,
|
|
19
|
+
getRuleDetail,
|
|
20
|
+
listMissingDms,
|
|
21
|
+
postTarget,
|
|
22
|
+
retryFailed,
|
|
23
|
+
saveRule,
|
|
24
|
+
sendManual,
|
|
25
|
+
setOmnichatAgent,
|
|
26
|
+
videoTarget,
|
|
27
|
+
type RuleTarget,
|
|
28
|
+
} from "../services/omnichat";
|
|
29
|
+
import { emptyBody, enableBody } from "../../shared/schemas/common";
|
|
30
|
+
import {
|
|
31
|
+
deleteCommentsBody,
|
|
32
|
+
manualSendBody,
|
|
33
|
+
omnichatQuery,
|
|
34
|
+
ruleBody,
|
|
35
|
+
ruleFromLinkBody,
|
|
36
|
+
ruleTermBody,
|
|
37
|
+
} from "../../shared/schemas/omnichat";
|
|
38
|
+
import type {
|
|
39
|
+
DeletedComment,
|
|
40
|
+
MissingDmList,
|
|
41
|
+
ManualSend,
|
|
42
|
+
OmnichatRuleDetail,
|
|
43
|
+
OmnichatState,
|
|
44
|
+
} from "../../shared/types/api";
|
|
45
|
+
|
|
46
|
+
type FindTarget = (params: Record<string, string>) => RuleTarget | null;
|
|
47
|
+
|
|
48
|
+
function targetOf(c: Context, find: FindTarget): RuleTarget {
|
|
49
|
+
const t = find(c.req.param());
|
|
50
|
+
if (!t) throw notFound();
|
|
51
|
+
return t;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* GET the rule and the log, POST saves the rule; enable, term, retry, dry-run and comments (read the
|
|
55
|
+
API) and send (the chosen comments, at the agent's pace) */
|
|
56
|
+
const ruleRoutes = (find: FindTarget) =>
|
|
57
|
+
router()
|
|
58
|
+
.get("/", async c => {
|
|
59
|
+
const detail = shaped<OmnichatRuleDetail>(await getRuleDetail(targetOf(c, find)));
|
|
60
|
+
return c.json(detail);
|
|
61
|
+
})
|
|
62
|
+
.post("/", json(ruleBody), async c => result(c, await saveRule(targetOf(c, find), c.req.valid("json"))))
|
|
63
|
+
.post("/enable", json(enableBody), async c =>
|
|
64
|
+
result(c, await enableRule(targetOf(c, find), c.req.valid("json").enable)),
|
|
65
|
+
)
|
|
66
|
+
/* the Publish stage: saves the term and enables right away, no second click */
|
|
67
|
+
.post("/term", json(ruleTermBody), async c =>
|
|
68
|
+
result(c, await enableRuleWithTerm(targetOf(c, find), c.req.valid("json").term)),
|
|
69
|
+
)
|
|
70
|
+
.post("/retry", json(emptyBody), async c => result(c, await retryFailed(targetOf(c, find))))
|
|
71
|
+
/* reads the Reel's comments through the API: seconds */
|
|
72
|
+
.post("/dry-run", noTimeout, json(emptyBody), async c => result(c, await dryRunRule(targetOf(c, find))))
|
|
73
|
+
/* by hand: who got no DM (reads the API) and the send to the chosen ones */
|
|
74
|
+
.post("/comments", noTimeout, json(emptyBody), async c => {
|
|
75
|
+
const r = await listMissingDms(targetOf(c, find));
|
|
76
|
+
return result(c, shaped<typeof r & { list?: MissingDmList }>(r));
|
|
77
|
+
})
|
|
78
|
+
/* Apagar: deletes comments on the post (outside, no way back; the UI asks twice) */
|
|
79
|
+
.post("/comments/delete", noTimeout, json(deleteCommentsBody), async c => {
|
|
80
|
+
const r = await deleteComments(targetOf(c, find), c.req.valid("json").ids);
|
|
81
|
+
return result(c, shaped<typeof r & { results?: DeletedComment[] }>(r));
|
|
82
|
+
})
|
|
83
|
+
.post("/send", noTimeout, json(manualSendBody), async c => {
|
|
84
|
+
const r = await sendManual(targetOf(c, find), c.req.valid("json"));
|
|
85
|
+
return result(c, shaped<typeof r & { results?: ManualSend[] }>(r));
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export const omnichat = router()
|
|
89
|
+
/* account, comments permission, agent and pause (the API part is cached for 2 min; ?refresh asks
|
|
90
|
+
again); ?rules=0 leaves the rule list out */
|
|
91
|
+
.get("/omnichat", query(omnichatQuery), async c => {
|
|
92
|
+
const q = c.req.valid("query");
|
|
93
|
+
const state = shaped<OmnichatState>(await getOmnichatState(q.refresh !== undefined, q.rules !== "0"));
|
|
94
|
+
return c.json(state);
|
|
95
|
+
})
|
|
96
|
+
.post("/omnichat/agent", json(enableBody), async c => result(c, await setOmnichatAgent(c.req.valid("json").enable)))
|
|
97
|
+
/* a post already live: finds it by link among the account's posts, seconds */
|
|
98
|
+
.post("/omnichat/post", noTimeout, json(ruleFromLinkBody), async c =>
|
|
99
|
+
result(c, await createRuleFromLink(c.req.valid("json"))),
|
|
100
|
+
)
|
|
101
|
+
.route(
|
|
102
|
+
"/omnichat/posts/:code",
|
|
103
|
+
ruleRoutes(p => postTarget(p.code ?? "")),
|
|
104
|
+
)
|
|
105
|
+
/* the content's carousel is another post, with its own rule (videos/<slug>/carousel) */
|
|
106
|
+
.route(
|
|
107
|
+
"/videos/:slug/carousel/omnichat",
|
|
108
|
+
ruleRoutes(p => carouselTarget(p.slug ?? "")),
|
|
109
|
+
)
|
|
110
|
+
.route(
|
|
111
|
+
"/videos/:slug/omnichat",
|
|
112
|
+
ruleRoutes(p => videoTarget(p.slug ?? "")),
|
|
113
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* Getting started (GettingStartedPage, the menu's setup hint): the docs/onboarding.md guide with the
|
|
2
|
+
machine check; ?fresh=1 checks again. */
|
|
3
|
+
|
|
4
|
+
import { query } from "../lib/validate";
|
|
5
|
+
import { router } from "../lib/hono";
|
|
6
|
+
import { shaped } from "../lib/result";
|
|
7
|
+
import { getOnboarding } from "../services/onboarding";
|
|
8
|
+
import { onboardingQuery } from "../../shared/schemas/onboarding";
|
|
9
|
+
import type { Onboarding } from "../../shared/types/api";
|
|
10
|
+
|
|
11
|
+
export const onboarding = router().get("/onboarding", query(onboardingQuery), async c => {
|
|
12
|
+
const o = shaped<Onboarding>(await getOnboarding(c.req.valid("query").fresh !== undefined));
|
|
13
|
+
return c.json(o);
|
|
14
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* Publishing a video (PublishForm, settings Publicação): the text from the script, the upload, the
|
|
2
|
+
connected accounts and the platform login. Cloud candidate: keeps to its own services. */
|
|
3
|
+
|
|
4
|
+
import { json, query } from "../lib/validate";
|
|
5
|
+
import { router } from "../lib/hono";
|
|
6
|
+
import { result, shaped } from "../lib/result";
|
|
7
|
+
import { videoDir } from "../lib/video";
|
|
8
|
+
import { noTimeout } from "../middleware/no-timeout";
|
|
9
|
+
import { connectPlatform, connectionStatus, generatePublishText, getAccounts, publishVideo } from "../services/publish";
|
|
10
|
+
import { refreshStatus } from "../services/videos";
|
|
11
|
+
import { accountsQuery, connectBody, connectQuery, publishBody, publishTextBody } from "../../shared/schemas/publish";
|
|
12
|
+
import type { PlatformAccounts } from "../../shared/types/api";
|
|
13
|
+
|
|
14
|
+
export const publish = router()
|
|
15
|
+
/* title, description and caption from the script: Claude takes a few seconds */
|
|
16
|
+
.post("/videos/:slug/publish/text", noTimeout, json(publishTextBody), async c => {
|
|
17
|
+
const slug = c.req.param("slug");
|
|
18
|
+
const r = await generatePublishText(videoDir(slug), c.req.valid("json").redo === true);
|
|
19
|
+
if (r.ok) await refreshStatus(slug);
|
|
20
|
+
return result(c, r);
|
|
21
|
+
})
|
|
22
|
+
/* uploads and waits for Instagram and TikTok to process: minutes */
|
|
23
|
+
.post("/videos/:slug/publish", noTimeout, json(publishBody), async c => {
|
|
24
|
+
const slug = c.req.param("slug");
|
|
25
|
+
const r = await publishVideo(videoDir(slug), c.req.valid("json"));
|
|
26
|
+
if (r.ok) await refreshStatus(slug);
|
|
27
|
+
return result(c, r);
|
|
28
|
+
})
|
|
29
|
+
.get("/publish/accounts", query(accountsQuery), async c => {
|
|
30
|
+
const accounts = shaped<PlatformAccounts>(await getAccounts(c.req.valid("query").refresh !== undefined));
|
|
31
|
+
return c.json(accounts);
|
|
32
|
+
})
|
|
33
|
+
/* the YouTube or TikTok login in progress: waiting (with the link), ok or error */
|
|
34
|
+
.get("/settings/publish/connect", query(connectQuery), c =>
|
|
35
|
+
c.json(connectionStatus(c.req.valid("query").platform ?? "youtube")),
|
|
36
|
+
)
|
|
37
|
+
.post("/settings/publish/connect", noTimeout, json(connectBody), async c => {
|
|
38
|
+
const b = c.req.valid("json");
|
|
39
|
+
return result(c, await connectPlatform(b.platform, b.token, b.mode));
|
|
40
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* The machine queue (QueuePage, LogStream): the recent tickets and a ticket's live log. */
|
|
2
|
+
|
|
3
|
+
import { router } from "../lib/hono";
|
|
4
|
+
import { shaped } from "../lib/result";
|
|
5
|
+
import { noTimeout } from "../middleware/no-timeout";
|
|
6
|
+
import { getQueue, streamTicketLog } from "../services/queue";
|
|
7
|
+
import type { Queue } from "../../shared/types/api";
|
|
8
|
+
|
|
9
|
+
export const queue = router()
|
|
10
|
+
.get("/queue", c => {
|
|
11
|
+
const q = shaped<Queue>(getQueue(30));
|
|
12
|
+
return c.json(q);
|
|
13
|
+
})
|
|
14
|
+
.get("/queue/:id/log", noTimeout, c => streamTicketLog(c.req.param("id"), c.req.raw));
|