@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,418 @@
|
|
|
1
|
+
/* Videos are the dirs in videos/ (and in the dirs passed with --videos).
|
|
2
|
+
Stage and next come from `omnivideo.py status --json`, beat times from
|
|
3
|
+
tools/timing.mjs: the studio does not redo the tools' math. The rest is read
|
|
4
|
+
from the video's files, which are the source of truth. */
|
|
5
|
+
|
|
6
|
+
import { readdirSync, existsSync, statSync, realpathSync } from "node:fs";
|
|
7
|
+
import { join, relative, resolve, basename } from "node:path";
|
|
8
|
+
import { ROOT, TOOLS_DIR, PYTHON, run, readJson, readText } from "./root";
|
|
9
|
+
import { listTickets, type Ticket, type Queue } from "./queue";
|
|
10
|
+
import { loadVideo, beatTime } from "../../../tools/timing.mjs";
|
|
11
|
+
import { scenesApprovalOf, scriptApprovalOf } from "./approval";
|
|
12
|
+
import { deliverables, narration, carouselSummary, carouselDetail } from "./carousel";
|
|
13
|
+
|
|
14
|
+
type FileEntry = { path: string; size: number; mtime: number };
|
|
15
|
+
|
|
16
|
+
export const videoRoots: string[] = [];
|
|
17
|
+
|
|
18
|
+
/* real path: the queue records the video dir with links resolved (on macOS,
|
|
19
|
+
/tmp is /private/tmp), and that is how the UI ties a task to a video */
|
|
20
|
+
export function addVideoRoot(dir: string) {
|
|
21
|
+
const abs = resolve(dir);
|
|
22
|
+
videoRoots.push(existsSync(abs) ? realpathSync(abs) : abs);
|
|
23
|
+
}
|
|
24
|
+
addVideoRoot(join(ROOT, "videos"));
|
|
25
|
+
|
|
26
|
+
/* slug → dir. A content dir is one with scenes.json, brief.md or script.md,
|
|
27
|
+
the source/request.md of a UI request, content.json or a carousel */
|
|
28
|
+
export function videoDirs(): Map<string, string> {
|
|
29
|
+
const found = new Map<string, string>();
|
|
30
|
+
for (const root of videoRoots) {
|
|
31
|
+
let names: string[];
|
|
32
|
+
try {
|
|
33
|
+
names = readdirSync(root).sort();
|
|
34
|
+
} catch {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
for (const name of names) {
|
|
38
|
+
const dir = join(root, name);
|
|
39
|
+
if (name.startsWith(".") || found.has(name)) continue;
|
|
40
|
+
if (
|
|
41
|
+
["scenes.json", "brief.md", "script.md", "source/request.md", "content.json", "carousel/carousel.json"].some(
|
|
42
|
+
f => existsSync(join(dir, f)),
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
found.set(name, dir);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return found;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* --- status ------------------------------------------------------------------
|
|
52
|
+
One `status --json` per video, cached until one of its files changes. If it
|
|
53
|
+
changes in the middle of a read, reads again when that one ends. */
|
|
54
|
+
type PipelineStatus = {
|
|
55
|
+
stages: { id: string; number: string; name: string; ok: boolean; detail: string | null }[];
|
|
56
|
+
next: { id: string; name: string } | null;
|
|
57
|
+
ready: boolean;
|
|
58
|
+
total_duration: number | null;
|
|
59
|
+
warnings: string[];
|
|
60
|
+
};
|
|
61
|
+
type StatusEntry = { data?: PipelineStatus; error?: string; reading?: Promise<void>; dirty?: boolean };
|
|
62
|
+
const statuses = new Map<string, StatusEntry>();
|
|
63
|
+
|
|
64
|
+
let inUse = 0;
|
|
65
|
+
const waitList: (() => void)[] = [];
|
|
66
|
+
async function limitConcurrency<T>(fn: () => Promise<T>): Promise<T> {
|
|
67
|
+
/* three at a time: each status opens a Python and one ffprobe per scene */
|
|
68
|
+
if (inUse >= 3) await new Promise<void>(r => waitList.push(r));
|
|
69
|
+
inUse++;
|
|
70
|
+
try {
|
|
71
|
+
return await fn();
|
|
72
|
+
} finally {
|
|
73
|
+
inUse--;
|
|
74
|
+
waitList.shift()?.();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function refreshStatus(slug: string): Promise<void> {
|
|
79
|
+
const e = statuses.get(slug) ?? {};
|
|
80
|
+
statuses.set(slug, e);
|
|
81
|
+
if (e.reading) {
|
|
82
|
+
e.dirty = true;
|
|
83
|
+
return e.reading;
|
|
84
|
+
}
|
|
85
|
+
e.reading = (async () => {
|
|
86
|
+
do {
|
|
87
|
+
e.dirty = false;
|
|
88
|
+
const dir = videoDirs().get(slug);
|
|
89
|
+
if (!dir) {
|
|
90
|
+
statuses.delete(slug);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const r = await limitConcurrency(() => run([PYTHON, join(TOOLS_DIR, "omnivideo.py"), "status", dir, "--json"]));
|
|
94
|
+
if (r.code === 0) {
|
|
95
|
+
e.data = JSON.parse(r.stdout);
|
|
96
|
+
e.error = undefined;
|
|
97
|
+
} else e.error = r.stderr.trim() || `status saiu com ${r.code}`;
|
|
98
|
+
} while (e.dirty);
|
|
99
|
+
})().finally(() => {
|
|
100
|
+
e.reading = undefined;
|
|
101
|
+
});
|
|
102
|
+
return e.reading;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function status(slug: string) {
|
|
106
|
+
const e = statuses.get(slug);
|
|
107
|
+
if (!e?.data && !e?.error) await refreshStatus(slug);
|
|
108
|
+
return statuses.get(slug);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* --- reference swap --------------------------------------------------------
|
|
112
|
+
Requested from the UI (api/services/create.ts). Applied when motion.md was rewritten
|
|
113
|
+
after the request and the scenes.json `references` are already the new ones. */
|
|
114
|
+
function referenceSwap(dir: string, scenes: any) {
|
|
115
|
+
const t = readJson<{ from: string[]; to: string | null; note: string | null; requested_at: string }>(
|
|
116
|
+
join(dir, "motion", "reference-swap.json"),
|
|
117
|
+
);
|
|
118
|
+
if (!t) return null;
|
|
119
|
+
let rewritten = false;
|
|
120
|
+
try {
|
|
121
|
+
rewritten = statSync(join(dir, "motion.md")).mtimeMs > Date.parse(t.requested_at);
|
|
122
|
+
} catch {
|
|
123
|
+
/* no motion.md */
|
|
124
|
+
}
|
|
125
|
+
const refs: string[] = scenes?.references ?? [];
|
|
126
|
+
const isNew = t.to ? refs.includes(t.to) : refs.join() !== t.from.join();
|
|
127
|
+
return { ...t, applied: rewritten && isNew };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* --- summary and detail --------------------------------------------------------- */
|
|
131
|
+
function titleOf(dir: string, scenes: any): string | null {
|
|
132
|
+
if (scenes?.title) return scenes.title;
|
|
133
|
+
const fromCarousel = readJson<{ title?: string }>(join(dir, "carousel", "carousel.json"))?.title;
|
|
134
|
+
if (fromCarousel && !existsSync(join(dir, "script.md"))) return fromCarousel;
|
|
135
|
+
const script = readText(join(dir, "script.md"));
|
|
136
|
+
const h1 =
|
|
137
|
+
script?.match(/^#\s+(?:Roteiro\s*·\s*)?(.+)$/m) ??
|
|
138
|
+
readText(join(dir, "source", "request.md"))?.match(/^#\s+(.+)$/m);
|
|
139
|
+
return h1?.[1]?.trim() ?? null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* the still of the first scene, for the list */
|
|
143
|
+
function coverOf(dir: string, scenes: any) {
|
|
144
|
+
const id = scenes?.scenes?.[0]?.id;
|
|
145
|
+
if (!id) return null;
|
|
146
|
+
const path = `motion/stills/${id}.png`;
|
|
147
|
+
try {
|
|
148
|
+
return { path, size: 0, mtime: Math.round(statSync(join(dir, path)).mtimeMs) };
|
|
149
|
+
} catch {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function chosenThumbnail(dir: string) {
|
|
155
|
+
if (!readJson<any>(join(dir, "thumbnail", "thumbnail.json"))?.selected) return null;
|
|
156
|
+
const path = "thumbnail/thumbnail.png";
|
|
157
|
+
try {
|
|
158
|
+
return { path, size: 0, mtime: Math.round(statSync(join(dir, path)).mtimeMs) };
|
|
159
|
+
} catch {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function lastModified(dir: string): number {
|
|
165
|
+
let t = 0;
|
|
166
|
+
for (const f of [
|
|
167
|
+
"scenes.json",
|
|
168
|
+
"script.md",
|
|
169
|
+
"motion.md",
|
|
170
|
+
"brief.md",
|
|
171
|
+
"source/request.md",
|
|
172
|
+
"captions.srt",
|
|
173
|
+
"premiere.json",
|
|
174
|
+
"export/assembly.json",
|
|
175
|
+
"publication.json",
|
|
176
|
+
"script-approval.json",
|
|
177
|
+
"motion/approval.json",
|
|
178
|
+
"motion/reference-swap.json",
|
|
179
|
+
/* Instagram omnichat: the rule and the record, which the agent writes when it replies to someone */
|
|
180
|
+
"omnichat.json",
|
|
181
|
+
"omnichat-record.json",
|
|
182
|
+
/* the content's carousel */
|
|
183
|
+
"content.json",
|
|
184
|
+
"carousel/carousel.json",
|
|
185
|
+
"carousel/build.json",
|
|
186
|
+
"carousel/publication.json",
|
|
187
|
+
"carousel/export/export.json",
|
|
188
|
+
"carousel/omnichat.json",
|
|
189
|
+
"carousel/omnichat-record.json",
|
|
190
|
+
]) {
|
|
191
|
+
try {
|
|
192
|
+
t = Math.max(t, statSync(join(dir, f)).mtimeMs);
|
|
193
|
+
} catch {
|
|
194
|
+
/* does not exist yet */
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return t;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* when the video was created: the dir's creation (on macOS, the birth time) */
|
|
201
|
+
function createdAt(dir: string): number {
|
|
202
|
+
try {
|
|
203
|
+
const st = statSync(dir);
|
|
204
|
+
return Math.round(st.birthtimeMs || st.mtimeMs);
|
|
205
|
+
} catch {
|
|
206
|
+
return 0;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export async function videoSummary(slug: string, dir: string, q: Queue) {
|
|
211
|
+
const st = await status(slug);
|
|
212
|
+
const scenes = readJson(join(dir, "scenes.json"));
|
|
213
|
+
const mine = (s: Ticket) => s.dir === dir;
|
|
214
|
+
const carousel = carouselSummary(dir);
|
|
215
|
+
return {
|
|
216
|
+
slug,
|
|
217
|
+
dir,
|
|
218
|
+
/* what this content delivers: video, carousel or both (api/services/carousel.ts) */
|
|
219
|
+
deliverables: deliverables(dir),
|
|
220
|
+
narration: narration(dir),
|
|
221
|
+
carousel,
|
|
222
|
+
title: titleOf(dir, scenes) ?? slug,
|
|
223
|
+
format: scenes?.format ?? null,
|
|
224
|
+
status: st?.data ?? null,
|
|
225
|
+
statusError: st?.error ?? null,
|
|
226
|
+
/* approval of the motion script scenes; an expired deadline is applied on this read */
|
|
227
|
+
scenes_approval: scenesApprovalOf(dir),
|
|
228
|
+
/* approval of the content script, the same way */
|
|
229
|
+
script_approval: scriptApprovalOf(dir),
|
|
230
|
+
reference_swap: referenceSwap(dir, scenes),
|
|
231
|
+
/* without video, the cover is the carousel's first slide */
|
|
232
|
+
cover: coverOf(dir, scenes) ?? (carousel && "cover" in carousel ? carousel.cover : null),
|
|
233
|
+
/* the selected thumbnail: the cover the publication sends (the schedule shows it) */
|
|
234
|
+
thumbnail: chosenThumbnail(dir),
|
|
235
|
+
created: createdAt(dir),
|
|
236
|
+
updated: lastModified(dir),
|
|
237
|
+
publication: readJson(join(dir, "publication.json")),
|
|
238
|
+
/* when it was archived (archived.json, api/services/archive.ts); null in the work list */
|
|
239
|
+
archived: readJson<{ at?: string }>(join(dir, "archived.json"))?.at ?? null,
|
|
240
|
+
tasks: {
|
|
241
|
+
running: q.running.filter(mine),
|
|
242
|
+
waiting: q.waiting.filter(mine).map(s => ({ ...s, position: q.waiting.indexOf(s) + 1 })),
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/* Times as the build will use them: beat resolved by line or word, line
|
|
248
|
+
positioned (or estimated, if the voice does not exist yet) */
|
|
249
|
+
function resolveTimings(dir: string) {
|
|
250
|
+
const v = loadVideo(dir);
|
|
251
|
+
return {
|
|
252
|
+
provisional: v.provisional,
|
|
253
|
+
total_duration: v.total_duration,
|
|
254
|
+
scenes: v.scenes.map((c: any) => ({
|
|
255
|
+
id: c.id,
|
|
256
|
+
start: c.start,
|
|
257
|
+
duration: c.duration,
|
|
258
|
+
beats: (c.beats ?? []).map((b: any) => {
|
|
259
|
+
try {
|
|
260
|
+
return { element: b.element, t: beatTime(c, b) };
|
|
261
|
+
} catch (e: any) {
|
|
262
|
+
return { element: b.element, error: e.message };
|
|
263
|
+
}
|
|
264
|
+
}),
|
|
265
|
+
lines: (c.lines ?? []).map((l: any) => ({ id: l.id, start: l.start, end: l.end })),
|
|
266
|
+
})),
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* thumbnail/request.json: the random ones and the manual version; the old
|
|
271
|
+
shape ({ at, request }, before that { em, pedido }) was a single request, the one for the three */
|
|
272
|
+
function thumbnailRequestOf(p: any) {
|
|
273
|
+
if (!p) return null;
|
|
274
|
+
if ("at" in p || "em" in p) return { random: { at: p.at ?? p.em }, manual: null, changes: {} };
|
|
275
|
+
return { random: p.random ?? null, manual: p.manual ?? null, changes: p.changes ?? {} };
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* export/assembly.json: an old file may still carry the lineId → clips map in `lines` */
|
|
279
|
+
function assemblyOf(a: any) {
|
|
280
|
+
if (a && a.lines && typeof a.lines === "object") {
|
|
281
|
+
a.line_clips ??= a.lines;
|
|
282
|
+
a.lines = Object.keys(a.lines).length;
|
|
283
|
+
}
|
|
284
|
+
return a;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* media the UI shows, with mtime so the URL changes when the file changes */
|
|
288
|
+
const MEDIA = /\.(png|jpe?g|webp|mp4|mov|webm|wav|mp3|m4a)$/i;
|
|
289
|
+
function mediaFiles(dir: string) {
|
|
290
|
+
const list: FileEntry[] = [];
|
|
291
|
+
const walk = (sub: string, deep: boolean) => {
|
|
292
|
+
let names: string[];
|
|
293
|
+
try {
|
|
294
|
+
names = readdirSync(join(dir, sub));
|
|
295
|
+
} catch {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
for (const name of names.sort()) {
|
|
299
|
+
const rel = sub ? `${sub}/${name}` : name;
|
|
300
|
+
let st: ReturnType<typeof statSync>;
|
|
301
|
+
try {
|
|
302
|
+
st = statSync(join(dir, rel));
|
|
303
|
+
} catch {
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (st.isDirectory()) {
|
|
307
|
+
if (deep) walk(rel, false);
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (MEDIA.test(name)) list.push({ path: rel, size: st.size, mtime: Math.round(st.mtimeMs) });
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
for (const sub of ["motion", "voice", "export", "check", "sound", "thumbnail"]) walk(sub, sub === "motion");
|
|
314
|
+
return list.filter(a => !a.path.startsWith("motion/src/"));
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/* Previous versions the tools kept (tools/history.*), in
|
|
318
|
+
history/<stage>/[<key>/]<stamp>/. The stamp is the time of the original
|
|
319
|
+
result: it is how the UI finds the queue run that produced it. */
|
|
320
|
+
const STAMP_RE = /^(\d{4}-\d{2}-\d{2})T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z$/;
|
|
321
|
+
function historyOf(dir: string) {
|
|
322
|
+
const versions: {
|
|
323
|
+
stage: string;
|
|
324
|
+
key: string | null;
|
|
325
|
+
at: string;
|
|
326
|
+
files: FileEntry[];
|
|
327
|
+
data: Record<string, unknown>;
|
|
328
|
+
}[] = [];
|
|
329
|
+
const names = (d: string) => {
|
|
330
|
+
try {
|
|
331
|
+
return readdirSync(d)
|
|
332
|
+
.filter(n => !n.startsWith("."))
|
|
333
|
+
.sort();
|
|
334
|
+
} catch {
|
|
335
|
+
return [];
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
const read = (stage: string, key: string | null, d: string) => {
|
|
339
|
+
for (const name of names(d)) {
|
|
340
|
+
const m = STAMP_RE.exec(name);
|
|
341
|
+
if (!m) {
|
|
342
|
+
if (key === null) read(stage, name, join(d, name));
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
const vdir = join(d, name);
|
|
346
|
+
const files: FileEntry[] = names(vdir).flatMap(n => {
|
|
347
|
+
try {
|
|
348
|
+
const st = statSync(join(vdir, n));
|
|
349
|
+
return [{ path: relative(dir, join(vdir, n)), size: st.size, mtime: Math.round(st.mtimeMs) }];
|
|
350
|
+
} catch {
|
|
351
|
+
return [];
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
const data = Object.fromEntries(
|
|
355
|
+
files
|
|
356
|
+
.filter(a => a.path.endsWith(".json") && a.size < 65_536)
|
|
357
|
+
.map(a => [basename(a.path), readJson(join(dir, a.path))]),
|
|
358
|
+
);
|
|
359
|
+
versions.push({ stage, key, at: `${m[1]}T${m[2]}:${m[3]}:${m[4]}.${m[5]}Z`, files, data });
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
/* history/preview/ is from the preview stage that no longer exists: nothing shows it */
|
|
363
|
+
for (const stage of names(join(dir, "history")).filter(n => n !== "preview"))
|
|
364
|
+
read(stage, null, join(dir, "history", stage));
|
|
365
|
+
return versions.sort((a, b) => b.at.localeCompare(a.at));
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export async function videoDetail(slug: string, q: Queue) {
|
|
369
|
+
const dir = videoDirs().get(slug);
|
|
370
|
+
if (!dir) return null;
|
|
371
|
+
const base = await videoSummary(slug, dir, q);
|
|
372
|
+
const scenes = readJson(join(dir, "scenes.json"));
|
|
373
|
+
let resolved = null;
|
|
374
|
+
let resolvedError = null;
|
|
375
|
+
if (scenes) {
|
|
376
|
+
try {
|
|
377
|
+
resolved = resolveTimings(dir);
|
|
378
|
+
} catch (e: any) {
|
|
379
|
+
resolvedError = e.message;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
const renders = Object.fromEntries(
|
|
383
|
+
(scenes?.scenes ?? []).map((c: any) => [c.id, readJson(join(dir, "motion", `${c.id}.render.json`))]),
|
|
384
|
+
);
|
|
385
|
+
return {
|
|
386
|
+
...base,
|
|
387
|
+
root: relative(ROOT, dir).startsWith("..") ? dir : relative(ROOT, dir),
|
|
388
|
+
scenes,
|
|
389
|
+
resolved,
|
|
390
|
+
resolvedError,
|
|
391
|
+
texts: {
|
|
392
|
+
script: readText(join(dir, "script.md")),
|
|
393
|
+
motion: readText(join(dir, "motion.md")),
|
|
394
|
+
brief: readText(join(dir, "brief.md")),
|
|
395
|
+
captions: readText(join(dir, "captions.srt")),
|
|
396
|
+
},
|
|
397
|
+
files: mediaFiles(dir),
|
|
398
|
+
history: historyOf(dir),
|
|
399
|
+
/* every queue run of this video, including those already out of the recent list */
|
|
400
|
+
runs: listTickets()
|
|
401
|
+
.filter(s => s.dir === dir)
|
|
402
|
+
.sort((a, b) => b.arrived_at.localeCompare(a.arrived_at)),
|
|
403
|
+
premiere: readJson(join(dir, "premiere.json")),
|
|
404
|
+
assembly: assemblyOf(readJson(join(dir, "export", "assembly.json"))),
|
|
405
|
+
/* thumbnail on request (tools/thumbnail.mjs): the versions and the request still pending */
|
|
406
|
+
thumbnail: readJson(join(dir, "thumbnail", "thumbnail.json")),
|
|
407
|
+
thumbnailRequest: thumbnailRequestOf(readJson(join(dir, "thumbnail", "request.json"))),
|
|
408
|
+
sound: readJson(join(dir, "sound", "plan.json")),
|
|
409
|
+
renders,
|
|
410
|
+
carousel: carouselDetail(dir),
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export async function listVideos(q: Queue) {
|
|
415
|
+
const all = await Promise.all([...videoDirs()].map(([slug, dir]) => videoSummary(slug, dir, q)));
|
|
416
|
+
/* newest first, by creation; the slug (which starts with the date) breaks ties */
|
|
417
|
+
return all.sort((a, b) => b.created - a.created || b.slug.localeCompare(a.slug));
|
|
418
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/* Changing a voice from the UI pauses what comes after it. Whoever changes a voice (generates
|
|
2
|
+
another line, picks a version, edits the text, changes the video's model) wants the
|
|
3
|
+
video with the new voice: render, sound, captions and assembly running or
|
|
4
|
+
waiting for this video are no longer useful. So:
|
|
5
|
+
|
|
6
|
+
- they are interrupted (the whole tree: the render's Chrome, ffmpeg);
|
|
7
|
+
- the video's Claude session stops, if running, so it doesn't go on by itself;
|
|
8
|
+
- voice-pause.json in the video dir holds everything: job_queue.py and job-queue.mjs refuse
|
|
9
|
+
those tools, and the status shows the voice "being chosen".
|
|
10
|
+
|
|
11
|
+
The pause accumulates while the user changes more voices and only lifts through "Seguir com
|
|
12
|
+
estas vozes" in the Voice stage (voices.ts, `proceedWithVoices`), which resumes Claude. The voices
|
|
13
|
+
the user requests keep generating: voice is not "after the voice". */
|
|
14
|
+
|
|
15
|
+
import { writeFileSync, renameSync, existsSync } from "node:fs";
|
|
16
|
+
import { join, basename } from "node:path";
|
|
17
|
+
import { readJson } from "./root";
|
|
18
|
+
import { getQueue } from "./queue";
|
|
19
|
+
import { latestSessionFor, stopSession } from "./sessions";
|
|
20
|
+
|
|
21
|
+
export const PAUSE_FILE = "voice-pause.json";
|
|
22
|
+
/* the same set as tools/job_queue.py and tools/job-queue.mjs */
|
|
23
|
+
const AFTER_VOICE = new Set([
|
|
24
|
+
"render",
|
|
25
|
+
"sound",
|
|
26
|
+
"captions",
|
|
27
|
+
"assembly",
|
|
28
|
+
"premiere-assemble",
|
|
29
|
+
"premiere-check",
|
|
30
|
+
"premiere-export",
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
/* `removed`: lines the user took out of the narration during the pause; "Seguir" takes them to Claude */
|
|
34
|
+
export type VoicePause = {
|
|
35
|
+
since: string;
|
|
36
|
+
lines: string[];
|
|
37
|
+
interrupted: string[];
|
|
38
|
+
claude_stopped: boolean;
|
|
39
|
+
removed?: string[];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const readPause = (dir: string) => readJson<VoicePause>(join(dir, PAUSE_FILE));
|
|
43
|
+
export const isPaused = (dir: string) => existsSync(join(dir, PAUSE_FILE));
|
|
44
|
+
|
|
45
|
+
/* the process and all its children (render opens Chromes; assembly, ffmpeg) */
|
|
46
|
+
function killTree(pid: number) {
|
|
47
|
+
const children = Bun.spawnSync(["pgrep", "-P", String(pid)])
|
|
48
|
+
.stdout.toString()
|
|
49
|
+
.split("\n")
|
|
50
|
+
.filter(Boolean)
|
|
51
|
+
.map(Number);
|
|
52
|
+
for (const c of children) killTree(c);
|
|
53
|
+
try {
|
|
54
|
+
process.kill(pid, "SIGTERM");
|
|
55
|
+
} catch {
|
|
56
|
+
/* already gone */
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* stops what comes after this video's voice (and the Claude session), without writing the pause */
|
|
61
|
+
export function interruptAfterVoice(dir: string) {
|
|
62
|
+
const q = getQueue();
|
|
63
|
+
const interrupted: string[] = [];
|
|
64
|
+
for (const s of [...q.running, ...q.waiting]) {
|
|
65
|
+
if (s.dir !== dir || !AFTER_VOICE.has(s.tool)) continue;
|
|
66
|
+
killTree(s.pid);
|
|
67
|
+
interrupted.push(s.tool);
|
|
68
|
+
}
|
|
69
|
+
const session = latestSessionFor("video", basename(dir));
|
|
70
|
+
const claude = session?.state === "running" ? stopSession(session.id).ok : false;
|
|
71
|
+
return { interrupted, claude };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* `lines`: what changed (line ids, or "video-voice" when the model changes) */
|
|
75
|
+
export function pauseAfterVoice(dir: string, lines: string[], removed: string[] = []): VoicePause {
|
|
76
|
+
const { interrupted, claude } = interruptAfterVoice(dir);
|
|
77
|
+
|
|
78
|
+
const before = readPause(dir);
|
|
79
|
+
const out = [...new Set([...(before?.removed ?? []), ...removed])];
|
|
80
|
+
const pause: VoicePause = {
|
|
81
|
+
since: before?.since ?? new Date().toISOString(),
|
|
82
|
+
lines: [...new Set([...(before?.lines ?? []), ...lines])].filter(l => !out.includes(l)),
|
|
83
|
+
interrupted: [...new Set([...(before?.interrupted ?? []), ...interrupted])],
|
|
84
|
+
claude_stopped: !!before?.claude_stopped || claude,
|
|
85
|
+
...(out.length ? { removed: out } : {}),
|
|
86
|
+
};
|
|
87
|
+
const file = join(dir, PAUSE_FILE);
|
|
88
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
89
|
+
writeFileSync(tmp, JSON.stringify(pause, null, 2) + "\n");
|
|
90
|
+
renameSync(tmp, file);
|
|
91
|
+
return pause;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* what the response tells the user about the pause */
|
|
95
|
+
export function pauseNotice(p: VoicePause) {
|
|
96
|
+
const stopped = [...p.interrupted, ...(p.claude_stopped ? ["o Claude"] : [])];
|
|
97
|
+
return `${stopped.length ? `parei ${stopped.join(", ")}; ` : ""}o vídeo espera você terminar as vozes ("Seguir com estas vozes" na etapa Voz)`;
|
|
98
|
+
}
|