videobook 0.0.0-stage → 0.2.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/CHANGELOG.md +54 -0
- package/LICENSE +21 -0
- package/README.md +195 -2
- package/bin/videobook.js +7 -0
- package/dist/acestep/client.js +203 -0
- package/dist/acestep/config.js +62 -0
- package/dist/acestep/errors.js +8 -0
- package/dist/acestep/process.js +175 -0
- package/dist/alive-captions/analyze.js +117 -0
- package/dist/alive-captions/audio.js +179 -0
- package/dist/alive-captions/frames.js +59 -0
- package/dist/alive-captions/model.js +37 -0
- package/dist/alive-captions/schema.js +49 -0
- package/dist/alive-captions/track.js +9 -0
- package/dist/api-key.js +33 -0
- package/dist/app-state.js +56 -0
- package/dist/app.js +257 -0
- package/dist/archive-b2.js +332 -0
- package/dist/archive-store.js +169 -0
- package/dist/artifact-label.js +36 -0
- package/dist/artifact-refs.js +49 -0
- package/dist/asset-tag-extraction.js +169 -0
- package/dist/asset-tags.js +228 -0
- package/dist/asset-usage.js +23 -0
- package/dist/audio-cue.js +71 -0
- package/dist/audio-encoding.js +32 -0
- package/dist/audio-sync-request.js +1 -0
- package/dist/audio-sync.js +223 -0
- package/dist/audio-trim-range.js +31 -0
- package/dist/book-context.js +31 -0
- package/dist/book-manager.js +374 -0
- package/dist/catalog-gc.js +26 -0
- package/dist/chain-executor.js +815 -0
- package/dist/chain-generation.js +115 -0
- package/dist/chain-plan.js +746 -0
- package/dist/chain-step-review.js +60 -0
- package/dist/character-name.js +25 -0
- package/dist/chat-generation-routing.js +73 -0
- package/dist/chat-generation-settings.js +78 -0
- package/dist/chat-models.js +44 -0
- package/dist/chat-prompt-rewrite.js +67 -0
- package/dist/chat-router.js +628 -0
- package/dist/chat-view-actions.js +49 -0
- package/dist/cli/args.js +242 -0
- package/dist/cli/config-command.js +103 -0
- package/dist/cli/doctor-command.js +289 -0
- package/dist/cli/entry.js +2 -0
- package/dist/cli/key-report.js +16 -0
- package/dist/cli/main.js +104 -0
- package/dist/cli/mcp-command.js +88 -0
- package/dist/cli/mcp-relay.js +51 -0
- package/dist/cli/open-browser.js +14 -0
- package/dist/cli/run-command.js +231 -0
- package/dist/cli/serve-command.js +62 -0
- package/dist/cli/setup-command.js +60 -0
- package/dist/cli/stdio-guard.js +8 -0
- package/dist/cold-open-model.js +7 -0
- package/dist/cold-open.js +79 -0
- package/dist/command-reference.js +95 -0
- package/dist/content-store.js +74 -0
- package/dist/cost.js +8 -0
- package/dist/crop-geometry.js +23 -0
- package/dist/dancing-workflow.js +447 -0
- package/dist/data-home.js +44 -0
- package/dist/diagnostics.js +109 -0
- package/dist/dialog-quality.js +34 -0
- package/dist/downloads-dest.js +56 -0
- package/dist/editing-moments.js +194 -0
- package/dist/elevenlabs-audio-extension.js +66 -0
- package/dist/engine.js +54 -0
- package/dist/env-file.js +91 -0
- package/dist/env-secrets.js +148 -0
- package/dist/ffmpeg-binary.js +12 -0
- package/dist/ffmpeg.js +425 -0
- package/dist/ffprobe-binary.js +77 -0
- package/dist/forget-asset.js +216 -0
- package/dist/frame-utils.js +27 -0
- package/dist/generation-credit-error.js +11 -0
- package/dist/generation-input-mentions.js +117 -0
- package/dist/generation-input-policy.js +68 -0
- package/dist/generation-reference-mentions.js +97 -0
- package/dist/goal-characters.js +49 -0
- package/dist/goal-plan-v3.js +273 -0
- package/dist/goal-plan.js +220 -0
- package/dist/goal-planner-prompt.js +28 -0
- package/dist/goal-prompt-budget.js +4 -0
- package/dist/goal-reference-images.js +25 -0
- package/dist/goal-state.js +261 -0
- package/dist/goal-stills.js +153 -0
- package/dist/goal-store.js +144 -0
- package/dist/goal-styles.js +144 -0
- package/dist/goal-v3-runtime.js +157 -0
- package/dist/guides/character_schema_guide.md +70 -0
- package/dist/guides/gpt_image_2_5_prompting_guide.md +21 -0
- package/dist/guides/grok_imagine_prompting_guide.md +72 -0
- package/dist/guides/image_reproduction_guide.md +84 -0
- package/dist/guides/kling_3_0_prompting_guide.md +136 -0
- package/dist/guides/nano_banana_pro_prompting_guide.md +28 -0
- package/dist/guides/seedance_2_prompting_guide.md +172 -0
- package/dist/http-access.js +49 -0
- package/dist/http-byte-range.js +31 -0
- package/dist/hydration.js +56 -0
- package/dist/image-compress.js +77 -0
- package/dist/image-edit-default.js +1 -0
- package/dist/image-edit-models.js +41 -0
- package/dist/image-edit-settings.js +11 -0
- package/dist/image-region-edit.js +32 -0
- package/dist/image-subject-map.js +523 -0
- package/dist/image.js +46 -0
- package/dist/index.js +12 -0
- package/dist/job-deadline.js +60 -0
- package/dist/jobs/_alibaba-upload.js +30 -0
- package/dist/jobs/_audio-chunks.js +31 -0
- package/dist/jobs/_download-into-asset.js +15 -0
- package/dist/jobs/_fal-shared.js +22 -0
- package/dist/jobs/_fal-upload.js +35 -0
- package/dist/jobs/_image-edit-adapter.js +213 -0
- package/dist/jobs/_kie-poll.js +119 -0
- package/dist/jobs/_kie-upload.js +32 -0
- package/dist/jobs/_lease.js +163 -0
- package/dist/jobs/_persist-output.js +19 -0
- package/dist/jobs/_storage-retry.js +21 -0
- package/dist/jobs/_transcribe.js +245 -0
- package/dist/jobs/_translate-transcript.js +270 -0
- package/dist/jobs/analyze-alive-captions.js +10 -0
- package/dist/jobs/analyze-editing-moments.js +104 -0
- package/dist/jobs/analyze-jokes.js +143 -0
- package/dist/jobs/analyze-keyword-placement.js +155 -0
- package/dist/jobs/analyze-music.js +14 -0
- package/dist/jobs/analyze-video.js +282 -0
- package/dist/jobs/apply-cuts.js +83 -0
- package/dist/jobs/apply-sfx.js +107 -0
- package/dist/jobs/archive-clip.js +458 -0
- package/dist/jobs/assemble-goal.js +98 -0
- package/dist/jobs/audio-boost.js +71 -0
- package/dist/jobs/audio-mix.js +161 -0
- package/dist/jobs/backfill-asset-tags.js +144 -0
- package/dist/jobs/burn-watermark.js +316 -0
- package/dist/jobs/change-video-speed.js +176 -0
- package/dist/jobs/clean-video-audio.js +207 -0
- package/dist/jobs/cold-open.js +166 -0
- package/dist/jobs/combine-goal.js +108 -0
- package/dist/jobs/complete-provider-task.js +185 -0
- package/dist/jobs/copy-library-asset.js +33 -0
- package/dist/jobs/cost-estimate-assessment.js +113 -0
- package/dist/jobs/crop-image.js +47 -0
- package/dist/jobs/crop-video.js +71 -0
- package/dist/jobs/describe-image.js +181 -0
- package/dist/jobs/detect-scenes.js +33 -0
- package/dist/jobs/doctor-fix.js +100 -0
- package/dist/jobs/download-video.js +427 -0
- package/dist/jobs/enqueue-search-index.js +24 -0
- package/dist/jobs/even-split.js +122 -0
- package/dist/jobs/export-sequence.js +365 -0
- package/dist/jobs/extend-audio.js +229 -0
- package/dist/jobs/extract-audio.js +72 -0
- package/dist/jobs/extract-frame.js +58 -0
- package/dist/jobs/extract-notebook-audio.js +82 -0
- package/dist/jobs/extract-notebook-frame.js +93 -0
- package/dist/jobs/extract-video-clip.js +8 -0
- package/dist/jobs/extract-video-poster.js +55 -0
- package/dist/jobs/extract-waveform.js +25 -0
- package/dist/jobs/finish-goal.js +255 -0
- package/dist/jobs/forget-asset.js +11 -0
- package/dist/jobs/generate-acestep-cover.js +219 -0
- package/dist/jobs/generate-media.js +70 -0
- package/dist/jobs/image-subjects.js +1059 -0
- package/dist/jobs/index.js +18 -0
- package/dist/jobs/inject-first-frame.js +175 -0
- package/dist/jobs/isolate-vocals.js +69 -0
- package/dist/jobs/kie-paygate.js +177 -0
- package/dist/jobs/label-music-sections.js +5 -0
- package/dist/jobs/osg-placement.js +135 -0
- package/dist/jobs/pad-video.js +72 -0
- package/dist/jobs/plan-goal.js +97 -0
- package/dist/jobs/post-record.js +21 -0
- package/dist/jobs/post-to-x.js +21 -0
- package/dist/jobs/prepare-search-reference.js +190 -0
- package/dist/jobs/prepare-temporal-search.js +16 -0
- package/dist/jobs/process-audio.js +67 -0
- package/dist/jobs/process-image.js +58 -0
- package/dist/jobs/process-upload.js +166 -0
- package/dist/jobs/process-video.js +438 -0
- package/dist/jobs/register-all.js +161 -0
- package/dist/jobs/relayout-notebook.js +78 -0
- package/dist/jobs/remove-sound.js +299 -0
- package/dist/jobs/render-project.js +380 -0
- package/dist/jobs/render-qr-outro.js +138 -0
- package/dist/jobs/render-timeline.js +283 -0
- package/dist/jobs/repair-search-indexes.js +42 -0
- package/dist/jobs/replace-video-audio.js +64 -0
- package/dist/jobs/restore-archive-clip.js +53 -0
- package/dist/jobs/reverse-video.js +53 -0
- package/dist/jobs/rewrite-script.js +173 -0
- package/dist/jobs/run-notebook.js +3335 -0
- package/dist/jobs/semantic-index.js +797 -0
- package/dist/jobs/smooth-scene-concat.js +257 -0
- package/dist/jobs/splice-video.js +280 -0
- package/dist/jobs/split-video.js +127 -0
- package/dist/jobs/suggest-cuts.js +149 -0
- package/dist/jobs/suggest-sfx.js +135 -0
- package/dist/jobs/sync-video-to-audio.js +329 -0
- package/dist/jobs/tag-asset.js +266 -0
- package/dist/jobs/task-failure.js +16 -0
- package/dist/jobs/timewarp-video.js +152 -0
- package/dist/jobs/transcribe-video-audio.js +117 -0
- package/dist/jobs/transcribe.js +35 -0
- package/dist/jobs/translate-transcript.js +55 -0
- package/dist/jobs/trim-audio.js +133 -0
- package/dist/jobs/trim-video.js +291 -0
- package/dist/jobs/xai-paygate.js +26 -0
- package/dist/keyword-placement-cache.js +74 -0
- package/dist/lazy-render.js +142 -0
- package/dist/library-browse.js +78 -0
- package/dist/lightning-defaults.js +206 -0
- package/dist/load-env.js +12 -0
- package/dist/local-search-models.js +206 -0
- package/dist/local-upload.js +318 -0
- package/dist/logger.js +69 -0
- package/dist/media/adapters/alibaba.js +20 -0
- package/dist/media/adapters/elevenlabs.js +58 -0
- package/dist/media/adapters/fal.js +45 -0
- package/dist/media/adapters/index.js +26 -0
- package/dist/media/adapters/kie.js +120 -0
- package/dist/media/adapters/pending.js +21 -0
- package/dist/media/adapters/types.js +5 -0
- package/dist/media/adapters/xai.js +18 -0
- package/dist/media/catalog.js +236 -0
- package/dist/media/complete.js +191 -0
- package/dist/media/cost.js +45 -0
- package/dist/media/descriptor.js +157 -0
- package/dist/media/endpoints.js +11 -0
- package/dist/media/frame-options.js +18 -0
- package/dist/media/insert-video-timing.js +17 -0
- package/dist/media/json-schema.js +75 -0
- package/dist/media/legacy-task-types.js +129 -0
- package/dist/media/listing.js +24 -0
- package/dist/media/model-id.js +14 -0
- package/dist/media/preview.js +86 -0
- package/dist/media/prompt-dialects.js +65 -0
- package/dist/media/ref-fields.js +106 -0
- package/dist/media/refs.js +131 -0
- package/dist/media/request.js +188 -0
- package/dist/media/types.js +6 -0
- package/dist/media/wire.js +161 -0
- package/dist/media-library.js +535 -0
- package/dist/media-output-path.js +33 -0
- package/dist/multyculty-workflow.js +757 -0
- package/dist/notebook-action-catalog.js +608 -0
- package/dist/notebook-cell-outputs.js +726 -0
- package/dist/notebook-credit-retry.js +45 -0
- package/dist/notebook-fixtures.js +8 -0
- package/dist/notebook-generation-contract.js +77 -0
- package/dist/notebook-generation-controls.js +145 -0
- package/dist/notebook-goal-layout.js +40 -0
- package/dist/notebook-graph.js +37 -0
- package/dist/notebook-image-edit.js +84 -0
- package/dist/notebook-initial-generation-prompt.js +222 -0
- package/dist/notebook-live-analysis.js +941 -0
- package/dist/notebook-media-ops.js +579 -0
- package/dist/notebook-mutations.js +20 -0
- package/dist/notebook-placement.js +41 -0
- package/dist/notebook-provider-failure.js +87 -0
- package/dist/notebook-published-post.js +26 -0
- package/dist/notebook-reference-resolver.js +227 -0
- package/dist/notebook-relayout.js +270 -0
- package/dist/notebook-run-plan.js +519 -0
- package/dist/notebook-shots.js +162 -0
- package/dist/notebook-workflow.js +856 -0
- package/dist/one-password.js +200 -0
- package/dist/openai-intelligence.js +99 -0
- package/dist/original-media-file.js +12 -0
- package/dist/osg-assets.js +36 -0
- package/dist/osg-placement-cache.js +64 -0
- package/dist/osg-settings.js +27 -0
- package/dist/paid-tools.js +22 -0
- package/dist/platform-guidance.js +26 -0
- package/dist/posts/dropbox-auth.js +91 -0
- package/dist/posts/dropbox-upload.js +132 -0
- package/dist/posts/icloud-drive.js +134 -0
- package/dist/posts/icloud-status.js +64 -0
- package/dist/posts/post-contract.js +2 -0
- package/dist/posts/post-copy-format.js +43 -0
- package/dist/posts/post-copy.js +193 -0
- package/dist/posts/post-folder.js +18 -0
- package/dist/posts/post-metrics.js +119 -0
- package/dist/posts/post-store.js +340 -0
- package/dist/posts/x-post-target.js +43 -0
- package/dist/preview-payload.js +90 -0
- package/dist/prompt-surfaces.js +22 -0
- package/dist/provider-prompt-transform.js +77 -0
- package/dist/provider-status-link.js +21 -0
- package/dist/provider-task-record.js +78 -0
- package/dist/provider-task-status.js +47 -0
- package/dist/provider-usage.js +294 -0
- package/dist/queue.js +810 -0
- package/dist/reference-video-duration.js +17 -0
- package/dist/remotion/BlurFillVideo.js +51 -0
- package/dist/remotion/KeywordGraphicsOverlay.js +68 -0
- package/dist/remotion/OsgOverlay.js +30 -0
- package/dist/remotion/QrOutroComposition.js +47 -0
- package/dist/remotion/RenderComposition.js +11 -0
- package/dist/remotion/browser.js +59 -0
- package/dist/remotion/constants.js +35 -0
- package/dist/remotion/index.js +66 -0
- package/dist/remotion/keyword-graphics.js +151 -0
- package/dist/remotion/keyword-placement.js +182 -0
- package/dist/remotion/osg-spec.js +198 -0
- package/dist/remotion/public/qr-outro-impact.wav +0 -0
- package/dist/remotion/qr-outro-audio.js +1 -0
- package/dist/remotion/qr-outro-spec.js +211 -0
- package/dist/remotion/shared-bundle.js +37 -0
- package/dist/remotion/subtitles/AliveCaptions.js +83 -0
- package/dist/remotion/subtitles/Highlight.js +58 -0
- package/dist/remotion/subtitles/Impact.js +67 -0
- package/dist/remotion/subtitles/SubtitleOverlay.js +9 -0
- package/dist/remotion/subtitles/alive-layout.js +321 -0
- package/dist/remotion/subtitles/alive-types.js +17 -0
- package/dist/remotion/subtitles/chunker.js +68 -0
- package/dist/remotion/subtitles/segments.js +42 -0
- package/dist/remotion/subtitles/styles.js +4 -0
- package/dist/remotion/subtitles/types.js +1 -0
- package/dist/remotion/util.js +18 -0
- package/dist/remotion-cancellation.js +15 -0
- package/dist/rename-helpers.js +204 -0
- package/dist/rhythm/analyze.js +128 -0
- package/dist/rhythm/contract.js +14 -0
- package/dist/rhythm/draft-model.js +19 -0
- package/dist/rhythm/energy.js +133 -0
- package/dist/rhythm/fft.js +44 -0
- package/dist/rhythm/model.js +71 -0
- package/dist/rhythm/music-analysis.js +124 -0
- package/dist/rhythm/music-draft.js +261 -0
- package/dist/rhythm/onset.js +101 -0
- package/dist/rhythm/run-worker.js +51 -0
- package/dist/rhythm/score.js +47 -0
- package/dist/rhythm/section-labels.js +168 -0
- package/dist/rhythm/sequence-rhythm.js +67 -0
- package/dist/rhythm/synthesize.js +103 -0
- package/dist/rhythm/timing.js +98 -0
- package/dist/rhythm/track.js +320 -0
- package/dist/rhythm/visual-fit.js +4 -0
- package/dist/rhythm/worker.js +25 -0
- package/dist/scene-detect.js +200 -0
- package/dist/scene-transition.js +12 -0
- package/dist/scheduled-posts.js +200 -0
- package/dist/search-index-coverage.js +13 -0
- package/dist/search-index-media.js +71 -0
- package/dist/search-reference-store.js +60 -0
- package/dist/search-scoring.js +17 -0
- package/dist/serve.js +125 -0
- package/dist/server-lock.js +143 -0
- package/dist/server.js +42 -0
- package/dist/srt.js +16 -0
- package/dist/tag-backfill-state.js +121 -0
- package/dist/tag-settings.js +30 -0
- package/dist/tag-vocabulary.js +237 -0
- package/dist/test-queue-cleanup.js +1 -0
- package/dist/time-parse.js +50 -0
- package/dist/timeline-helpers.js +554 -0
- package/dist/timewarp.js +87 -0
- package/dist/tools/_image-inputs.js +9 -0
- package/dist/tools/_media-refs.js +84 -0
- package/dist/tools/_shared.js +59 -0
- package/dist/tools/_suggest-shared.js +279 -0
- package/dist/tools/add-timeline-audio.js +73 -0
- package/dist/tools/alive-captions.js +157 -0
- package/dist/tools/analyze-jokes.js +56 -0
- package/dist/tools/analyze-video.js +66 -0
- package/dist/tools/animate-keywords.js +217 -0
- package/dist/tools/api-status.js +42 -0
- package/dist/tools/application-commands.js +34 -0
- package/dist/tools/apply-cuts.js +112 -0
- package/dist/tools/apply-sfx.js +152 -0
- package/dist/tools/apply-watermark.js +670 -0
- package/dist/tools/archive-clip.js +74 -0
- package/dist/tools/asset-history.js +61 -0
- package/dist/tools/asset-manifest.js +24 -0
- package/dist/tools/asset-tags.js +151 -0
- package/dist/tools/assign-slot.js +97 -0
- package/dist/tools/audio-boost.js +107 -0
- package/dist/tools/audio-mix.js +121 -0
- package/dist/tools/book-usage.js +16 -0
- package/dist/tools/chain.js +136 -0
- package/dist/tools/change-video-speed.js +105 -0
- package/dist/tools/chat-history.js +5 -0
- package/dist/tools/chat.js +848 -0
- package/dist/tools/clean-video-audio.js +97 -0
- package/dist/tools/clear-failed-tasks.js +66 -0
- package/dist/tools/cold-open.js +114 -0
- package/dist/tools/command-plan.js +1680 -0
- package/dist/tools/commands.js +1666 -0
- package/dist/tools/concat-images.js +236 -0
- package/dist/tools/connect-service.js +55 -0
- package/dist/tools/copy-file-to-clipboard.js +58 -0
- package/dist/tools/create-character.js +114 -0
- package/dist/tools/create-qart.js +253 -0
- package/dist/tools/create-qr-outro.js +149 -0
- package/dist/tools/create-qrbtf.js +215 -0
- package/dist/tools/create-watermark.js +97 -0
- package/dist/tools/crop-asset.js +18 -0
- package/dist/tools/crop-image.js +120 -0
- package/dist/tools/crop-video.js +97 -0
- package/dist/tools/delete-asset.js +104 -0
- package/dist/tools/describe-image.js +69 -0
- package/dist/tools/detect-scenes.js +44 -0
- package/dist/tools/doctor.js +126 -0
- package/dist/tools/download-video.js +114 -0
- package/dist/tools/duplicate-asset.js +184 -0
- package/dist/tools/edit-timeline.js +59 -0
- package/dist/tools/editing-moments.js +105 -0
- package/dist/tools/estimate-cost.js +171 -0
- package/dist/tools/even-split.js +295 -0
- package/dist/tools/export-asset-file.js +22 -0
- package/dist/tools/export-asset.js +140 -0
- package/dist/tools/export-sequence.js +250 -0
- package/dist/tools/export-to-downloads.js +54 -0
- package/dist/tools/export-transcript-srt.js +79 -0
- package/dist/tools/extend-audio.js +100 -0
- package/dist/tools/extract-audio.js +174 -0
- package/dist/tools/extract-frame.js +108 -0
- package/dist/tools/extract-notebook-audio.js +173 -0
- package/dist/tools/extract-notebook-frame.js +160 -0
- package/dist/tools/extract-video-clip.js +101 -0
- package/dist/tools/generate-media.js +157 -0
- package/dist/tools/generation-payload.js +48 -0
- package/dist/tools/get-timeline.js +12 -0
- package/dist/tools/get-watermark-config.js +38 -0
- package/dist/tools/goal.js +644 -0
- package/dist/tools/image-subjects.js +711 -0
- package/dist/tools/index.js +323 -0
- package/dist/tools/inject-first-frame.js +154 -0
- package/dist/tools/invert-image.js +70 -0
- package/dist/tools/isolate-vocals.js +66 -0
- package/dist/tools/list-assets.js +98 -0
- package/dist/tools/list-cell-generations.js +225 -0
- package/dist/tools/list-elevenlabs-voices.js +163 -0
- package/dist/tools/log-wrapper.js +29 -0
- package/dist/tools/make-cover-song.js +95 -0
- package/dist/tools/mark-asset-seen.js +23 -0
- package/dist/tools/media-library.js +245 -0
- package/dist/tools/move-timeline-audio.js +35 -0
- package/dist/tools/music-analysis.js +60 -0
- package/dist/tools/music-draft.js +29 -0
- package/dist/tools/pad-video.js +87 -0
- package/dist/tools/post-record.js +83 -0
- package/dist/tools/post.js +168 -0
- package/dist/tools/prompt-history.js +164 -0
- package/dist/tools/provider-key-status.js +248 -0
- package/dist/tools/qrbtf-render.js +849 -0
- package/dist/tools/read-asset-metadata.js +26 -0
- package/dist/tools/read-file-at-commit.js +29 -0
- package/dist/tools/read-transcript.js +41 -0
- package/dist/tools/reconcile-project-work.js +1452 -0
- package/dist/tools/recover-asset.js +28 -0
- package/dist/tools/remove-sound.js +72 -0
- package/dist/tools/remove-timeline-audio.js +34 -0
- package/dist/tools/remove-timeline-slot.js +40 -0
- package/dist/tools/rename-all.js +434 -0
- package/dist/tools/rename-asset.js +34 -0
- package/dist/tools/render-settings.js +47 -0
- package/dist/tools/render-timeline.js +120 -0
- package/dist/tools/render.js +384 -0
- package/dist/tools/reorder-character-images.js +45 -0
- package/dist/tools/replace-video-audio.js +133 -0
- package/dist/tools/restore-archive-clips.js +209 -0
- package/dist/tools/restore-asset-version.js +37 -0
- package/dist/tools/retry-generation.js +54 -0
- package/dist/tools/reverse-video.js +74 -0
- package/dist/tools/rewrite-prompt.js +388 -0
- package/dist/tools/rewrite-script.js +67 -0
- package/dist/tools/schema-from-apicity.js +66 -0
- package/dist/tools/search-archive.js +150 -0
- package/dist/tools/semantic-search.js +1214 -0
- package/dist/tools/sequence-rhythm.js +43 -0
- package/dist/tools/set-character-metadata.js +84 -0
- package/dist/tools/set-env-secret.js +40 -0
- package/dist/tools/set-osg.js +143 -0
- package/dist/tools/show-folder.js +37 -0
- package/dist/tools/smooth-scene-concat.js +122 -0
- package/dist/tools/splice-video.js +149 -0
- package/dist/tools/split-video.js +202 -0
- package/dist/tools/suggest-cuts.js +45 -0
- package/dist/tools/suggest-sfx.js +43 -0
- package/dist/tools/sync-video-to-audio.js +115 -0
- package/dist/tools/tag-backfill.js +177 -0
- package/dist/tools/timewarp-video.js +85 -0
- package/dist/tools/tool-def.js +1 -0
- package/dist/tools/tool-json-schema.js +116 -0
- package/dist/tools/transcribe.js +90 -0
- package/dist/tools/translate-subtitles.js +59 -0
- package/dist/tools/trim-audio.js +139 -0
- package/dist/tools/trim-video.js +168 -0
- package/dist/tools/update-script.js +25 -0
- package/dist/tools/update-timeline-audio.js +40 -0
- package/dist/tools/upload-file.js +41 -0
- package/dist/tools/verify-x-mentions.js +141 -0
- package/dist/tools/video-editing-command-contract.js +291 -0
- package/dist/tools/video-source-reference.js +30 -0
- package/dist/tools/video-time-input.js +18 -0
- package/dist/tools/videobook-domain.js +2021 -0
- package/dist/tools/wait-for-asset-ready.js +143 -0
- package/dist/tools/workspace-actions.js +54 -0
- package/dist/transcript-projection.js +202 -0
- package/dist/transcript-srt.js +33 -0
- package/dist/upload.js +76 -0
- package/dist/usage-providers.js +25 -0
- package/dist/video-analysis-projection.js +46 -0
- package/dist/video-poster.js +33 -0
- package/dist/video-proxy.js +99 -0
- package/dist/vision-regions.js +111 -0
- package/dist/voice-actions.js +90 -0
- package/dist/voice-audio.js +55 -0
- package/dist/voice-config.js +122 -0
- package/dist/voice-continuation.js +54 -0
- package/dist/voice-contract.js +1 -0
- package/dist/voice-http.js +145 -0
- package/dist/voice-reply-progress.js +55 -0
- package/dist/voice-session.js +992 -0
- package/dist/watermark-badge.js +259 -0
- package/dist/watermark-config.js +111 -0
- package/dist/watermark-handle-position.js +55 -0
- package/dist/watermark-platform.js +15 -0
- package/dist/watermark-timing.js +16 -0
- package/dist/workspace-action-catalog.js +315 -0
- package/dist/workspace-action-contract.js +21 -0
- package/dist/workspace-action-groups.js +98 -0
- package/dist/workspace-action-surfaces.js +7 -0
- package/dist/x/account.js +88 -0
- package/dist/x/authenticated-handle.js +30 -0
- package/dist/x/oauth-flow.js +191 -0
- package/dist/x/post-contract.js +1 -0
- package/dist/x/post-metadata.js +44 -0
- package/dist/x/post-to-x.js +456 -0
- package/dist/x/published-post-cell.js +90 -0
- package/dist/x/x-tokens.js +69 -0
- package/dist/ytdlp-binary.js +65 -0
- package/dist/zod-slots.js +334 -0
- package/package.json +84 -4
- package/ui/assets/alive-captions-BWb5nLKj.css +1 -0
- package/ui/assets/alive-captions-DPEr1nKM.js +1 -0
- package/ui/assets/confirm-bodies-D8ouHXKy.js +1 -0
- package/ui/assets/confirm-bodies-DrMhaXC6.css +1 -0
- package/ui/assets/fullscreen-B7nw4YbE.js +1 -0
- package/ui/assets/goal-ui-DK-xTCK0.js +2 -0
- package/ui/assets/goal-ui-DXdUM2KF.css +1 -0
- package/ui/assets/index-DzPAnCUj.css +1 -0
- package/ui/assets/index-kS1905s5.js +37 -0
- package/ui/assets/inspector-MlzQbTVo.js +1 -0
- package/ui/assets/jobs-ui-CoinOWx0.js +1 -0
- package/ui/assets/music-video-Cbe80kmQ.js +1 -0
- package/ui/assets/music-video-DPaiKKEq.css +1 -0
- package/ui/assets/ui-Oirr9VOf.css +1 -0
- package/ui/assets/ui-xo_Y1yQg.js +2 -0
- package/ui/assets/vendor-D2rfiZ5j.css +1 -0
- package/ui/assets/vendor-DfTCWgKm.js +19 -0
- package/ui/assets/vendor-flow-BXbeWxW7.js +7 -0
- package/ui/assets/vendor-flow-BnuhLJ6X.css +1 -0
- package/ui/assets/vendor-icons-CGqhCIXV.js +1 -0
- package/ui/assets/vendor-mcp-BTlEJcHV.js +67 -0
- package/ui/assets/vendor-react-Dj7D1fD4.js +9 -0
- package/ui/assets/vendor-remotion-CH1HXrlc.js +95 -0
- package/ui/assets/videobook-Qlp9HQFu.js +20 -0
- package/ui/favicon.svg +8 -0
- package/ui/index.html +126 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { MODEL_DISPLAY } from "@apicity/cost";
|
|
2
|
+
import { modelEntry } from "./catalog.js";
|
|
3
|
+
import { parseModelId } from "./model-id.js";
|
|
4
|
+
import { claimedFields, resolveSlot } from "./ref-fields.js";
|
|
5
|
+
import { wireSpec } from "./wire.js";
|
|
6
|
+
import { enumValues, numberBounds, propertyAt, schemaTypes, stringMaxLength, toJsonSchema, } from "./json-schema.js";
|
|
7
|
+
import { REF_ROLES, } from "./types.js";
|
|
8
|
+
const PROMPT_CANDIDATES = ["prompt", "text", "instruction", "description"];
|
|
9
|
+
const cache = new Map();
|
|
10
|
+
export class UnknownModelError extends Error {
|
|
11
|
+
constructor(model) {
|
|
12
|
+
super(`Unknown model ${model}; call list_generation_models for available models`);
|
|
13
|
+
this.name = "UnknownModelError";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function displayTitle(entry, provider, apiId) {
|
|
17
|
+
if (entry.title)
|
|
18
|
+
return entry.title;
|
|
19
|
+
const table = MODEL_DISPLAY;
|
|
20
|
+
return table[provider]?.[apiId] ?? apiId;
|
|
21
|
+
}
|
|
22
|
+
function resolvePromptField(entry, input) {
|
|
23
|
+
if (entry.prompt === null)
|
|
24
|
+
return null;
|
|
25
|
+
if (entry.prompt !== undefined) {
|
|
26
|
+
if (!propertyAt(input, entry.prompt))
|
|
27
|
+
throw new Error(`${entry.id}: prompt field ${entry.prompt} is not in the apicity schema`);
|
|
28
|
+
return entry.prompt;
|
|
29
|
+
}
|
|
30
|
+
return PROMPT_CANDIDATES.find((field) => input.properties?.[field] !== undefined) ?? null;
|
|
31
|
+
}
|
|
32
|
+
function valueType(schema) {
|
|
33
|
+
const types = new Set(schemaTypes(schema).filter((type) => type !== "null"));
|
|
34
|
+
if (types.size === 0)
|
|
35
|
+
return "json";
|
|
36
|
+
if ([...types].every((type) => type === "boolean"))
|
|
37
|
+
return "boolean";
|
|
38
|
+
if ([...types].every((type) => type === "integer"))
|
|
39
|
+
return "integer";
|
|
40
|
+
if ([...types].every((type) => type === "integer" || type === "number"))
|
|
41
|
+
return "number";
|
|
42
|
+
if (types.has("string") && [...types].every((type) => type === "string" || type === "number" || type === "integer")) {
|
|
43
|
+
return types.has("number") || types.has("integer") ? "json" : "string";
|
|
44
|
+
}
|
|
45
|
+
return "json";
|
|
46
|
+
}
|
|
47
|
+
function readPath(value, path) {
|
|
48
|
+
let current = value;
|
|
49
|
+
for (const segment of path.split(".")) {
|
|
50
|
+
if (current === null || typeof current !== "object")
|
|
51
|
+
return undefined;
|
|
52
|
+
current = current[segment];
|
|
53
|
+
}
|
|
54
|
+
return current;
|
|
55
|
+
}
|
|
56
|
+
function optionSpec(name, path, schema, required, defaults) {
|
|
57
|
+
const enumList = enumValues(schema);
|
|
58
|
+
const maxLength = stringMaxLength(schema);
|
|
59
|
+
const defaultValue = readPath(defaults, path) ?? schema.default;
|
|
60
|
+
return {
|
|
61
|
+
name,
|
|
62
|
+
path,
|
|
63
|
+
valueType: enumList.length > 0 && enumList.every((value) => typeof value === "string") ? "string" : valueType(schema),
|
|
64
|
+
required: required && defaultValue === undefined,
|
|
65
|
+
enumValues: enumList,
|
|
66
|
+
...numberBounds(schema),
|
|
67
|
+
...(maxLength !== undefined ? { maxLength } : {}),
|
|
68
|
+
...(defaultValue !== undefined ? { defaultValue } : {}),
|
|
69
|
+
description: schema.description ?? "",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function resolveOptions(entry, input, excluded, fixed) {
|
|
73
|
+
const required = new Set(input.required ?? []);
|
|
74
|
+
const defaults = entry.defaults ?? {};
|
|
75
|
+
const options = [];
|
|
76
|
+
for (const [name, schema] of Object.entries(input.properties ?? {})) {
|
|
77
|
+
if (excluded.has(name) || name in fixed)
|
|
78
|
+
continue;
|
|
79
|
+
options.push(optionSpec(name, name, schema, required.has(name), defaults));
|
|
80
|
+
}
|
|
81
|
+
for (const [name, path] of Object.entries(entry.aliases ?? {})) {
|
|
82
|
+
const schema = propertyAt(input, path);
|
|
83
|
+
if (!schema)
|
|
84
|
+
throw new Error(`${entry.id}: alias ${name} -> ${path} is not in the apicity schema`);
|
|
85
|
+
options.push(optionSpec(name, path, schema, false, defaults));
|
|
86
|
+
}
|
|
87
|
+
return options;
|
|
88
|
+
}
|
|
89
|
+
function defaultModes(slots) {
|
|
90
|
+
return [{ id: "default", label: "Default", roles: slots.map((slot) => slot.role) }];
|
|
91
|
+
}
|
|
92
|
+
function resolveSlots(entry, input, promptField) {
|
|
93
|
+
const slots = [];
|
|
94
|
+
const used = new Set(promptField ? [promptField.split(".")[0]] : []);
|
|
95
|
+
for (const role of REF_ROLES) {
|
|
96
|
+
const slot = resolveSlot(role, input, entry);
|
|
97
|
+
if (!slot || slot.fields.some((field) => used.has(field.path)))
|
|
98
|
+
continue;
|
|
99
|
+
for (const field of slot.fields)
|
|
100
|
+
used.add(field.path);
|
|
101
|
+
slots.push(slot);
|
|
102
|
+
}
|
|
103
|
+
return slots;
|
|
104
|
+
}
|
|
105
|
+
function build(entry) {
|
|
106
|
+
const parsed = parseModelId(entry.id);
|
|
107
|
+
if (!parsed)
|
|
108
|
+
throw new Error(`Invalid model id in catalog: ${entry.id}`);
|
|
109
|
+
const wire = wireSpec(parsed);
|
|
110
|
+
if (!wire)
|
|
111
|
+
throw new Error(`${entry.id}: apicity has no request schema for this model`);
|
|
112
|
+
const input = toJsonSchema(wire.input);
|
|
113
|
+
const promptField = resolvePromptField(entry, input);
|
|
114
|
+
const slots = resolveSlots(entry, input, promptField);
|
|
115
|
+
const excluded = claimedFields(slots);
|
|
116
|
+
const promptTop = promptField?.split(".")[0];
|
|
117
|
+
if (promptTop && promptField === promptTop)
|
|
118
|
+
excluded.add(promptTop);
|
|
119
|
+
const aliasTops = new Set(Object.values(entry.aliases ?? {}).map((path) => path.split(".")[0]));
|
|
120
|
+
for (const top of aliasTops)
|
|
121
|
+
excluded.add(top);
|
|
122
|
+
if (promptTop)
|
|
123
|
+
excluded.add(promptTop);
|
|
124
|
+
return {
|
|
125
|
+
entry,
|
|
126
|
+
id: entry.id,
|
|
127
|
+
provider: parsed.provider,
|
|
128
|
+
apiId: parsed.apiId,
|
|
129
|
+
media: entry.media,
|
|
130
|
+
title: displayTitle(entry, parsed.provider, parsed.apiId),
|
|
131
|
+
wire,
|
|
132
|
+
promptField,
|
|
133
|
+
promptRequired: promptTop !== undefined && promptField === promptTop && (input.required ?? []).includes(promptTop),
|
|
134
|
+
slots,
|
|
135
|
+
options: resolveOptions(entry, input, excluded, wire.fixed),
|
|
136
|
+
modes: entry.modes ? [...entry.modes] : defaultModes(slots),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export function resolveModel(model) {
|
|
140
|
+
const cached = cache.get(model);
|
|
141
|
+
if (cached)
|
|
142
|
+
return cached;
|
|
143
|
+
const entry = modelEntry(model);
|
|
144
|
+
if (!entry)
|
|
145
|
+
throw new UnknownModelError(model);
|
|
146
|
+
const resolved = build(entry);
|
|
147
|
+
cache.set(model, resolved);
|
|
148
|
+
return resolved;
|
|
149
|
+
}
|
|
150
|
+
export function tryResolveModel(model) {
|
|
151
|
+
try {
|
|
152
|
+
return resolveModel(model);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { modelEntry } from "./catalog.js";
|
|
2
|
+
export const FRAME_ASPECT_DESCRIPTION = "Frame mode follows the first image’s aspect ratio (adaptive).";
|
|
3
|
+
function hasFrameRefs(refs) {
|
|
4
|
+
if (refs === null || typeof refs !== "object" || Array.isArray(refs))
|
|
5
|
+
return false;
|
|
6
|
+
const record = refs;
|
|
7
|
+
return [record.first_frame, record.last_frame].some((value) => (typeof value === "string" && value.trim() !== "")
|
|
8
|
+
|| (Array.isArray(value) && value.some((entry) => typeof entry === "string" && entry.trim() !== "")));
|
|
9
|
+
}
|
|
10
|
+
export function frameAspectRatio(model, input) {
|
|
11
|
+
const aspect = modelEntry(model)?.frameOptions?.aspect_ratio;
|
|
12
|
+
if (typeof aspect !== "string")
|
|
13
|
+
return undefined;
|
|
14
|
+
const mode = input.generationMode ?? input.mode;
|
|
15
|
+
if (mode === "r2v")
|
|
16
|
+
return undefined;
|
|
17
|
+
return mode === "i2v" || hasFrameRefs(input.refs) ? aspect : undefined;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function isInsertVideoModel(model) {
|
|
2
|
+
return model === "fal:minimax/h3-max/insert-video" || model === "minimax/h3-max/insert-video";
|
|
3
|
+
}
|
|
4
|
+
export function insertVideoTimingError(options, sourceDuration) {
|
|
5
|
+
const start = typeof options.start_time === "string" && options.start_time.trim() ? Number(options.start_time) : options.start_time;
|
|
6
|
+
const resume = typeof options.resume_time === "string" && options.resume_time.trim() ? Number(options.resume_time) : options.resume_time;
|
|
7
|
+
if (typeof start !== "number" || typeof resume !== "number" || !Number.isFinite(start) || !Number.isFinite(resume))
|
|
8
|
+
return null;
|
|
9
|
+
if (sourceDuration !== undefined && sourceDuration !== null && sourceDuration > 0) {
|
|
10
|
+
const seconds = Number(sourceDuration.toFixed(3));
|
|
11
|
+
if (start >= sourceDuration)
|
|
12
|
+
return `Replace from must be before the source video ends at ${seconds}s (currently ${start}s).`;
|
|
13
|
+
if (resume > sourceDuration)
|
|
14
|
+
return `Resume original must be within the ${seconds}s source video (currently ${resume}s).`;
|
|
15
|
+
}
|
|
16
|
+
return resume <= start ? "Resume original must be after Replace from. Both times refer to the original video." : null;
|
|
17
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export function toJsonSchema(schema) {
|
|
2
|
+
const convert = schema.toJSONSchema;
|
|
3
|
+
if (!convert)
|
|
4
|
+
return {};
|
|
5
|
+
return convert.call(schema, { unrepresentable: "any", io: "input" });
|
|
6
|
+
}
|
|
7
|
+
function branches(schema) {
|
|
8
|
+
return schema.anyOf ?? schema.oneOf ?? [schema];
|
|
9
|
+
}
|
|
10
|
+
export function schemaTypes(schema) {
|
|
11
|
+
return branches(schema).flatMap((branch) => {
|
|
12
|
+
if (Array.isArray(branch.type))
|
|
13
|
+
return branch.type;
|
|
14
|
+
if (branch.type)
|
|
15
|
+
return [branch.type];
|
|
16
|
+
if (branch.const !== undefined)
|
|
17
|
+
return [typeof branch.const];
|
|
18
|
+
return [];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function propertyAt(root, path) {
|
|
22
|
+
let current = root;
|
|
23
|
+
for (const segment of path.split(".")) {
|
|
24
|
+
if (!current)
|
|
25
|
+
return null;
|
|
26
|
+
if (/^\d+$/.test(segment)) {
|
|
27
|
+
current = branches(current).find((branch) => branch.items)?.items;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
current = branches(current).find((branch) => branch.properties?.[segment])?.properties?.[segment];
|
|
31
|
+
}
|
|
32
|
+
return current ?? null;
|
|
33
|
+
}
|
|
34
|
+
export function isUrlObject(schema) {
|
|
35
|
+
if (!schema)
|
|
36
|
+
return false;
|
|
37
|
+
return branches(schema).some((branch) => branch.type === "object" && branch.properties?.url !== undefined);
|
|
38
|
+
}
|
|
39
|
+
export function isArraySchema(schema) {
|
|
40
|
+
return branches(schema).some((branch) => branch.type === "array");
|
|
41
|
+
}
|
|
42
|
+
export function arrayItems(schema) {
|
|
43
|
+
return branches(schema).find((branch) => branch.type === "array")?.items;
|
|
44
|
+
}
|
|
45
|
+
export function arrayBounds(schema) {
|
|
46
|
+
const array = branches(schema).find((branch) => branch.type === "array");
|
|
47
|
+
return { min: array?.minItems ?? 0, max: array?.maxItems ?? null };
|
|
48
|
+
}
|
|
49
|
+
export function enumValues(schema) {
|
|
50
|
+
const values = [];
|
|
51
|
+
for (const branch of branches(schema)) {
|
|
52
|
+
const literals = [...(branch.enum ?? []), ...(branch.const !== undefined ? [branch.const] : [])];
|
|
53
|
+
if (literals.length === 0)
|
|
54
|
+
return [];
|
|
55
|
+
for (const value of literals) {
|
|
56
|
+
if (typeof value === "string" || typeof value === "number")
|
|
57
|
+
values.push(value);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return [...new Set(values)];
|
|
61
|
+
}
|
|
62
|
+
export function numberBounds(schema) {
|
|
63
|
+
const numeric = branches(schema).find((branch) => branch.type === "number" || branch.type === "integer");
|
|
64
|
+
if (!numeric)
|
|
65
|
+
return {};
|
|
66
|
+
const minimum = numeric.minimum ?? numeric.exclusiveMinimum;
|
|
67
|
+
const maximum = numeric.maximum ?? numeric.exclusiveMaximum;
|
|
68
|
+
return {
|
|
69
|
+
...(minimum !== undefined ? { minimum } : {}),
|
|
70
|
+
...(maximum !== undefined ? { maximum } : {}),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function stringMaxLength(schema) {
|
|
74
|
+
return branches(schema).find((branch) => branch.type === "string")?.maxLength;
|
|
75
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
const LEGACY_IMAGE_TASK_TYPES = [
|
|
2
|
+
"nano_banana_image",
|
|
3
|
+
"fal_nano_banana_pro",
|
|
4
|
+
"fal_nano_banana_pro_edit",
|
|
5
|
+
"fal_nano_banana",
|
|
6
|
+
"fal_nano_banana_edit",
|
|
7
|
+
"fal_nano_banana_2",
|
|
8
|
+
"fal_nano_banana_2_edit",
|
|
9
|
+
"fal_nano_banana_2_lite",
|
|
10
|
+
"fal_nano_banana_2_lite_edit",
|
|
11
|
+
"nano_banana_2_1",
|
|
12
|
+
"qwen2_image_edit",
|
|
13
|
+
"qwen3_image_edit",
|
|
14
|
+
"qwen21_text_image",
|
|
15
|
+
"qwen21_image_edit",
|
|
16
|
+
"fal_qwen_image",
|
|
17
|
+
"fal_qwen_image_edit",
|
|
18
|
+
"fal_qwen3_image_edit",
|
|
19
|
+
"seedream_text_image",
|
|
20
|
+
"seedream_image",
|
|
21
|
+
"fal_seedream_v5_lite",
|
|
22
|
+
"fal_seedream_v5_lite_edit",
|
|
23
|
+
"fal_seedream_v5_flash_text_to_image",
|
|
24
|
+
"fal_seedream_v5_flash_edit",
|
|
25
|
+
"fal_seedream_v5_flash_layerize",
|
|
26
|
+
"kie_seedream_v5_flash_text_to_image",
|
|
27
|
+
"kie_seedream_v5_flash_image_to_image",
|
|
28
|
+
"kie_seedream_v5_flash_layer_decomposition",
|
|
29
|
+
"fal_bria_fibo_edit_1_5_product_holding",
|
|
30
|
+
"fal_bria_fibo_edit_1_5_virtual_try_on",
|
|
31
|
+
"fal_recraft_v4_1_flash_text_to_image",
|
|
32
|
+
"fal_ideogram_v4_5_text_to_image",
|
|
33
|
+
"fal_ideogram_v4_5_edit",
|
|
34
|
+
"fal_flux_3_text_to_image",
|
|
35
|
+
"fal_flux_3_edit",
|
|
36
|
+
"wan27_image",
|
|
37
|
+
"wan27_image_pro",
|
|
38
|
+
"fal_wan27",
|
|
39
|
+
"fal_wan27_edit",
|
|
40
|
+
"fal_wan27_pro",
|
|
41
|
+
"fal_wan27_pro_edit",
|
|
42
|
+
"alibaba_image",
|
|
43
|
+
"alibaba_image_pro",
|
|
44
|
+
"alibaba_qwen_image",
|
|
45
|
+
"alibaba_qwen_image_edit",
|
|
46
|
+
"grok_imagine_image",
|
|
47
|
+
"grok_imagine_text",
|
|
48
|
+
"fal_grok_imagine_image",
|
|
49
|
+
"fal_grok_imagine_image_edit",
|
|
50
|
+
"gpt_image",
|
|
51
|
+
"gpt_image_text",
|
|
52
|
+
];
|
|
53
|
+
const LEGACY_VIDEO_TASK_TYPES = [
|
|
54
|
+
"seedance2_video",
|
|
55
|
+
"fal_seedance2_i2v",
|
|
56
|
+
"fal_seedance2_t2v",
|
|
57
|
+
"fal_seedance2_r2v",
|
|
58
|
+
"fal_seedance2_fast_i2v",
|
|
59
|
+
"fal_seedance2_fast_t2v",
|
|
60
|
+
"fal_seedance2_fast_r2v",
|
|
61
|
+
"kling30_video",
|
|
62
|
+
"kling30_motion_control_video",
|
|
63
|
+
"kling30_omni_video",
|
|
64
|
+
"fal_kling_v3_pro_i2v",
|
|
65
|
+
"fal_kling_v3_pro_t2v",
|
|
66
|
+
"fal_kling_v3_standard_i2v",
|
|
67
|
+
"fal_kling_v3_standard_t2v",
|
|
68
|
+
"fal_wan27_t2v",
|
|
69
|
+
"fal_wan27_i2v",
|
|
70
|
+
"fal_wan27_r2v",
|
|
71
|
+
"fal_wan27_videoedit",
|
|
72
|
+
"fal_wan30_t2v",
|
|
73
|
+
"fal_wan30_i2v",
|
|
74
|
+
"fal_wan30_r2v",
|
|
75
|
+
"fal_wan30_prime_t2v",
|
|
76
|
+
"fal_wan30_prime_i2v",
|
|
77
|
+
"fal_wan30_prime_r2v",
|
|
78
|
+
"wan30_video",
|
|
79
|
+
"wan30_prime_video",
|
|
80
|
+
"wan27_t2v_video",
|
|
81
|
+
"wan27_i2v_video",
|
|
82
|
+
"wan27_videoedit_video",
|
|
83
|
+
"wan27_r2v_video",
|
|
84
|
+
"wan27_extend_video",
|
|
85
|
+
"grok_imagine_video",
|
|
86
|
+
"grok_imagine_t2v_video",
|
|
87
|
+
"xai_grok_imagine_video",
|
|
88
|
+
"xai_grok_imagine_ref_video",
|
|
89
|
+
"grok_imagine_extend_video",
|
|
90
|
+
"grok_imagine_upscale_video",
|
|
91
|
+
"fal_grok_imagine_video_i2v",
|
|
92
|
+
"fal_grok_imagine_video_r2v",
|
|
93
|
+
"fal_grok_imagine_video_extend",
|
|
94
|
+
"fal_grok_imagine_video_edit",
|
|
95
|
+
"fal_grok_imagine_video_v15_lite_image_to_video",
|
|
96
|
+
"fal_grok_imagine_video_v15_lite_text_to_video",
|
|
97
|
+
"happyhorse_t2v_video",
|
|
98
|
+
"happyhorse_i2v_video",
|
|
99
|
+
"happyhorse_ref_video",
|
|
100
|
+
"happyhorse_videoedit_video",
|
|
101
|
+
"minimax_h3_t2v_video",
|
|
102
|
+
"minimax_h3_i2v_video",
|
|
103
|
+
"minimax_h3_r2v_video",
|
|
104
|
+
"fal_minimax_h3_max_insert_video",
|
|
105
|
+
"fal_minimax_h3_max_recast",
|
|
106
|
+
"fal_minimax_h3_max_turbo_extend_video",
|
|
107
|
+
"vidu_q4_image_to_video",
|
|
108
|
+
"vidu_q4_reference_to_video",
|
|
109
|
+
"volcengine_lipsync_video",
|
|
110
|
+
"omnihuman_video",
|
|
111
|
+
"alibaba_video",
|
|
112
|
+
];
|
|
113
|
+
const LEGACY_MEDIA_BY_TASK_TYPE = new Map([
|
|
114
|
+
...LEGACY_IMAGE_TASK_TYPES.map((taskType) => [taskType, "image"]),
|
|
115
|
+
...LEGACY_VIDEO_TASK_TYPES.map((taskType) => [taskType, "video"]),
|
|
116
|
+
]);
|
|
117
|
+
export function legacyMediaForTaskType(taskType) {
|
|
118
|
+
return LEGACY_MEDIA_BY_TASK_TYPE.get(taskType) ?? null;
|
|
119
|
+
}
|
|
120
|
+
export function legacyMediaMeta(taskType, meta) {
|
|
121
|
+
const media = legacyMediaForTaskType(taskType);
|
|
122
|
+
if (!media)
|
|
123
|
+
return meta;
|
|
124
|
+
return {
|
|
125
|
+
...meta,
|
|
126
|
+
media: meta.media ?? media,
|
|
127
|
+
model: meta.model ?? meta.apiModel ?? meta.falEndpointId ?? taskType,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MODEL_ENTRIES } from "./catalog.js";
|
|
2
|
+
import { resolveModel } from "./descriptor.js";
|
|
3
|
+
export function modelListing(model) {
|
|
4
|
+
return {
|
|
5
|
+
id: model.id,
|
|
6
|
+
title: model.title,
|
|
7
|
+
provider: model.provider,
|
|
8
|
+
media: model.media,
|
|
9
|
+
operations: model.entry.operations,
|
|
10
|
+
...(model.entry.description ? { description: model.entry.description } : {}),
|
|
11
|
+
prompt: model.promptField ? { field: model.promptField, required: model.promptRequired } : null,
|
|
12
|
+
refs: model.slots.map(({ role, min, max }) => ({ role, min, max })),
|
|
13
|
+
modes: model.modes,
|
|
14
|
+
options: model.options,
|
|
15
|
+
hidden: model.entry.hidden === true,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function listModels(filter = {}) {
|
|
19
|
+
return MODEL_ENTRIES
|
|
20
|
+
.filter((entry) => filter.includeHidden || !entry.hidden)
|
|
21
|
+
.filter((entry) => !filter.media || entry.media === filter.media)
|
|
22
|
+
.filter((entry) => !filter.operation || entry.operations.includes(filter.operation))
|
|
23
|
+
.map((entry) => resolveModel(entry.id));
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const PROVIDERS = ["kie", "fal", "xai", "alibaba", "elevenlabs"];
|
|
2
|
+
function isProvider(value) {
|
|
3
|
+
return PROVIDERS.includes(value);
|
|
4
|
+
}
|
|
5
|
+
export function parseModelId(raw) {
|
|
6
|
+
const index = raw.indexOf(":");
|
|
7
|
+
if (index <= 0)
|
|
8
|
+
return null;
|
|
9
|
+
const provider = raw.slice(0, index);
|
|
10
|
+
const apiId = raw.slice(index + 1);
|
|
11
|
+
if (!isProvider(provider) || apiId.trim() === "")
|
|
12
|
+
return null;
|
|
13
|
+
return { id: raw, provider, apiId };
|
|
14
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { isPreviewPlaceholderUrl, previewPlaceholderUrl } from "../preview-payload.js";
|
|
2
|
+
import { resolveModel, UnknownModelError } from "./descriptor.js";
|
|
3
|
+
import { applyPromptDialect } from "./prompt-dialects.js";
|
|
4
|
+
import { buildWireRequest } from "./request.js";
|
|
5
|
+
import { normalizeRefs } from "./refs.js";
|
|
6
|
+
import { isKieSunoModel, isKieVeoModel } from "./wire.js";
|
|
7
|
+
import { REF_ROLES } from "./types.js";
|
|
8
|
+
const ELEVENLABS_PATHS = {
|
|
9
|
+
"text-to-speech": "elevenlabs.v1.textToSpeech(voice_id, request)",
|
|
10
|
+
"sound-generation": "elevenlabs.v1.soundGeneration(request)",
|
|
11
|
+
music: "elevenlabs.v1.music(request)",
|
|
12
|
+
"video-to-music": "elevenlabs.v1.music.videoToMusic(request)",
|
|
13
|
+
};
|
|
14
|
+
function providerPath(model) {
|
|
15
|
+
switch (model.provider) {
|
|
16
|
+
case "kie":
|
|
17
|
+
if (isKieVeoModel(model.apiId))
|
|
18
|
+
return "kie.veo.post.api.v1.veo.generate(request, { otp })";
|
|
19
|
+
if (isKieSunoModel(model.apiId))
|
|
20
|
+
return "kie.suno.post.api.v1.generate(request)";
|
|
21
|
+
return "kie.post.api.v1.jobs.createTask(request, { otp })";
|
|
22
|
+
case "fal":
|
|
23
|
+
return "fal.post.v1.queue.submit()";
|
|
24
|
+
case "xai":
|
|
25
|
+
return "xai.post.v1.videos.generations(request, { otp })";
|
|
26
|
+
case "alibaba":
|
|
27
|
+
return "alibaba.post.api.v1.services.aigc.multimodalGeneration.generation(request)";
|
|
28
|
+
case "elevenlabs":
|
|
29
|
+
return ELEVENLABS_PATHS[model.apiId] ?? "elevenlabs";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function placeholderRefs(refs) {
|
|
33
|
+
const placeholders = {};
|
|
34
|
+
for (const role of REF_ROLES) {
|
|
35
|
+
const list = refs[role];
|
|
36
|
+
if (list)
|
|
37
|
+
placeholders[role] = list.map((ref) => /^https?:\/\//u.test(ref) ? ref : previewPlaceholderUrl(ref));
|
|
38
|
+
}
|
|
39
|
+
return placeholders;
|
|
40
|
+
}
|
|
41
|
+
function collectPlaceholders(value, path, found) {
|
|
42
|
+
if (typeof value === "string") {
|
|
43
|
+
if (isPreviewPlaceholderUrl(value)) {
|
|
44
|
+
const reference = decodeURIComponent(new URL(value).pathname.slice(1));
|
|
45
|
+
found.push({ path, reference: `@${reference}`, url: value });
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(value)) {
|
|
50
|
+
value.forEach((item, index) => collectPlaceholders(item, `${path}[${index}]`, found));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (value === null || typeof value !== "object")
|
|
54
|
+
return;
|
|
55
|
+
for (const [key, child] of Object.entries(value))
|
|
56
|
+
collectPlaceholders(child, path ? `${path}.${key}` : key, found);
|
|
57
|
+
}
|
|
58
|
+
function stringOrUndefined(value) {
|
|
59
|
+
return typeof value === "string" && value.trim() !== "" ? value : undefined;
|
|
60
|
+
}
|
|
61
|
+
function optionsOf(value) {
|
|
62
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
63
|
+
}
|
|
64
|
+
export function previewGeneration(args) {
|
|
65
|
+
let model;
|
|
66
|
+
try {
|
|
67
|
+
model = resolveModel(String(args.model ?? ""));
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
return { ok: false, error: error instanceof UnknownModelError ? error.message : String(error) };
|
|
71
|
+
}
|
|
72
|
+
const refs = normalizeRefs(args.refs);
|
|
73
|
+
const rawPrompt = stringOrUndefined(args.prompt);
|
|
74
|
+
const built = buildWireRequest(model, {
|
|
75
|
+
prompt: rawPrompt === undefined ? undefined : applyPromptDialect(model.entry.dialect, rawPrompt, refs),
|
|
76
|
+
refUrls: placeholderRefs(refs),
|
|
77
|
+
options: optionsOf(args.options),
|
|
78
|
+
mode: stringOrUndefined(args.mode),
|
|
79
|
+
});
|
|
80
|
+
if (!built.ok)
|
|
81
|
+
return built;
|
|
82
|
+
const payload = model.provider === "fal" ? { endpoint_id: model.apiId, input: built.request } : built.request;
|
|
83
|
+
const placeholders = [];
|
|
84
|
+
collectPlaceholders(payload, "", placeholders);
|
|
85
|
+
return { ok: true, preview: { model, providerPath: providerPath(model), payload, placeholders } };
|
|
86
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { replaceHappyHorseAssetMentions, replaceNaturalAssetMentions, rewriteImageRefMentionsToBrackets, rewriteSeedanceAssetMentions, rewriteViduReferenceMentions, stripRefMentions, } from "../generation-reference-mentions.js";
|
|
2
|
+
const SLOT_TOKEN = /@((image|video|audio)(\d+)|firstframe|lastframe)(?![\w-])/giu;
|
|
3
|
+
function refsFor(refs, role) {
|
|
4
|
+
return (refs[role] ?? []).filter((ref) => !/^https?:\/\//u.test(ref));
|
|
5
|
+
}
|
|
6
|
+
function slotTarget(refs, token, kind, index) {
|
|
7
|
+
if (token.toLowerCase() === "firstframe")
|
|
8
|
+
return refsFor(refs, "first_frame")[0];
|
|
9
|
+
if (token.toLowerCase() === "lastframe")
|
|
10
|
+
return refsFor(refs, "last_frame")[0];
|
|
11
|
+
return refsFor(refs, kind.toLowerCase())[Number(index) - 1];
|
|
12
|
+
}
|
|
13
|
+
function expandSlotTokens(prompt, refs) {
|
|
14
|
+
return prompt.replace(SLOT_TOKEN, (match, token, kind, index) => {
|
|
15
|
+
const target = slotTarget(refs, token, kind, index);
|
|
16
|
+
return target ? `@${target}` : match;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function frames(refs) {
|
|
20
|
+
return [...refsFor(refs, "first_frame"), ...refsFor(refs, "last_frame")];
|
|
21
|
+
}
|
|
22
|
+
function natural(prompt, refs) {
|
|
23
|
+
return replaceNaturalAssetMentions(prompt, {
|
|
24
|
+
imageRefs: refsFor(refs, "image"),
|
|
25
|
+
videoRefs: refsFor(refs, "video"),
|
|
26
|
+
audioRefs: refsFor(refs, "audio"),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function seedance(prompt, refs) {
|
|
30
|
+
return rewriteSeedanceAssetMentions(prompt, {
|
|
31
|
+
imageRefs: refsFor(refs, "image"),
|
|
32
|
+
videoRefs: refsFor(refs, "video"),
|
|
33
|
+
audioRefs: refsFor(refs, "audio"),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function rewrite(dialect, prompt, refs) {
|
|
37
|
+
switch (dialect) {
|
|
38
|
+
case "plain":
|
|
39
|
+
return prompt;
|
|
40
|
+
case "natural":
|
|
41
|
+
return natural(prompt, refs);
|
|
42
|
+
case "natural_numbered":
|
|
43
|
+
return natural(prompt, refs).replace(/@image([1-9]\d*)\b/giu, "reference image $1");
|
|
44
|
+
case "natural_kinds":
|
|
45
|
+
return natural(prompt, refs).replace(/@(image|audio)([1-9]\d*)(?![\w-])/giu, (_match, kind, index) => `reference ${kind.toLowerCase()} ${index}`);
|
|
46
|
+
case "natural_source_video":
|
|
47
|
+
return replaceNaturalAssetMentions(prompt, {
|
|
48
|
+
imageRefs: refsFor(refs, "image"),
|
|
49
|
+
sourceVideoRef: refsFor(refs, "video")[0] ?? null,
|
|
50
|
+
});
|
|
51
|
+
case "seedance":
|
|
52
|
+
return stripRefMentions(seedance(prompt, refs), frames(refs));
|
|
53
|
+
case "strip_frames":
|
|
54
|
+
return stripRefMentions(prompt, [...frames(refs), ...refsFor(refs, "image")]);
|
|
55
|
+
case "brackets":
|
|
56
|
+
return rewriteImageRefMentionsToBrackets(prompt, refsFor(refs, "image"));
|
|
57
|
+
case "vidu":
|
|
58
|
+
return rewriteViduReferenceMentions(prompt, refsFor(refs, "image"), refsFor(refs, "audio"));
|
|
59
|
+
case "happyhorse_edit":
|
|
60
|
+
return replaceHappyHorseAssetMentions(prompt, refsFor(refs, "video")[0] ?? null, refsFor(refs, "image"));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export function applyPromptDialect(dialect, prompt, refs) {
|
|
64
|
+
return rewrite(dialect ?? "natural", expandSlotTokens(prompt, refs), refs).replace(/[ \t]{2,}/gu, " ").trim();
|
|
65
|
+
}
|