@nodetool-ai/protocol 0.7.0-rc.23 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/ai-video-production.d.ts +249 -0
- package/dist/ai-video-production.d.ts.map +1 -0
- package/dist/ai-video-production.js +131 -0
- package/dist/ai-video-production.js.map +1 -0
- package/dist/api-schemas/agent-access.d.ts +134 -0
- package/dist/api-schemas/agent-access.d.ts.map +1 -0
- package/dist/api-schemas/agent-access.js +93 -0
- package/dist/api-schemas/agent-access.js.map +1 -0
- package/dist/api-schemas/api-error-code.d.ts +11 -1
- package/dist/api-schemas/api-error-code.d.ts.map +1 -1
- package/dist/api-schemas/api-error-code.js +10 -0
- package/dist/api-schemas/api-error-code.js.map +1 -1
- package/dist/api-schemas/applications.d.ts +1411 -0
- package/dist/api-schemas/applications.d.ts.map +1 -0
- package/dist/api-schemas/applications.js +333 -0
- package/dist/api-schemas/applications.js.map +1 -0
- package/dist/api-schemas/assets.d.ts +230 -0
- package/dist/api-schemas/assets.d.ts.map +1 -1
- package/dist/api-schemas/assets.js +131 -5
- package/dist/api-schemas/assets.js.map +1 -1
- package/dist/api-schemas/code-gen.d.ts +176 -0
- package/dist/api-schemas/code-gen.d.ts.map +1 -0
- package/dist/api-schemas/code-gen.js +205 -0
- package/dist/api-schemas/code-gen.js.map +1 -0
- package/dist/api-schemas/collections.d.ts.map +1 -1
- package/dist/api-schemas/collections.js +3 -4
- package/dist/api-schemas/collections.js.map +1 -1
- package/dist/api-schemas/costs.d.ts +179 -0
- package/dist/api-schemas/costs.d.ts.map +1 -1
- package/dist/api-schemas/costs.js +100 -4
- package/dist/api-schemas/costs.js.map +1 -1
- package/dist/api-schemas/credits.d.ts +42 -0
- package/dist/api-schemas/credits.d.ts.map +1 -0
- package/dist/api-schemas/credits.js +43 -0
- package/dist/api-schemas/credits.js.map +1 -0
- package/dist/api-schemas/documents.d.ts +163 -0
- package/dist/api-schemas/documents.d.ts.map +1 -0
- package/dist/api-schemas/documents.js +75 -0
- package/dist/api-schemas/documents.js.map +1 -0
- package/dist/api-schemas/files.d.ts +13 -0
- package/dist/api-schemas/files.d.ts.map +1 -1
- package/dist/api-schemas/files.js +8 -0
- package/dist/api-schemas/files.js.map +1 -1
- package/dist/api-schemas/fonts.d.ts +17 -1
- package/dist/api-schemas/fonts.d.ts.map +1 -1
- package/dist/api-schemas/fonts.js +19 -3
- package/dist/api-schemas/fonts.js.map +1 -1
- package/dist/api-schemas/index.d.ts +23 -1
- package/dist/api-schemas/index.d.ts.map +1 -1
- package/dist/api-schemas/index.js +23 -1
- package/dist/api-schemas/index.js.map +1 -1
- package/dist/api-schemas/jobs.d.ts +12 -0
- package/dist/api-schemas/jobs.d.ts.map +1 -1
- package/dist/api-schemas/jobs.js +12 -2
- package/dist/api-schemas/jobs.js.map +1 -1
- package/dist/api-schemas/js-scripts.d.ts +364 -0
- package/dist/api-schemas/js-scripts.d.ts.map +1 -0
- package/dist/api-schemas/js-scripts.js +333 -0
- package/dist/api-schemas/js-scripts.js.map +1 -0
- package/dist/api-schemas/mcp-config.d.ts.map +1 -1
- package/dist/api-schemas/mcp-config.js +3 -1
- package/dist/api-schemas/mcp-config.js.map +1 -1
- package/dist/api-schemas/memories.d.ts +84 -0
- package/dist/api-schemas/memories.d.ts.map +1 -0
- package/dist/api-schemas/memories.js +54 -0
- package/dist/api-schemas/memories.js.map +1 -0
- package/dist/api-schemas/messages.d.ts +1 -0
- package/dist/api-schemas/messages.d.ts.map +1 -1
- package/dist/api-schemas/messages.js +4 -4
- package/dist/api-schemas/messages.js.map +1 -1
- package/dist/api-schemas/models.d.ts +156 -0
- package/dist/api-schemas/models.d.ts.map +1 -1
- package/dist/api-schemas/models.js +51 -6
- package/dist/api-schemas/models.js.map +1 -1
- package/dist/api-schemas/nodes.d.ts +97 -0
- package/dist/api-schemas/nodes.d.ts.map +1 -1
- package/dist/api-schemas/nodes.js +89 -0
- package/dist/api-schemas/nodes.js.map +1 -1
- package/dist/api-schemas/projects.d.ts +427 -0
- package/dist/api-schemas/projects.d.ts.map +1 -0
- package/dist/api-schemas/projects.js +224 -0
- package/dist/api-schemas/projects.js.map +1 -0
- package/dist/api-schemas/recipes.d.ts +172 -0
- package/dist/api-schemas/recipes.d.ts.map +1 -0
- package/dist/api-schemas/recipes.js +144 -0
- package/dist/api-schemas/recipes.js.map +1 -0
- package/dist/api-schemas/resources.d.ts +112 -0
- package/dist/api-schemas/resources.d.ts.map +1 -0
- package/dist/api-schemas/resources.js +44 -0
- package/dist/api-schemas/resources.js.map +1 -0
- package/dist/api-schemas/scripts.d.ts +1571 -0
- package/dist/api-schemas/scripts.d.ts.map +1 -0
- package/dist/api-schemas/scripts.js +153 -0
- package/dist/api-schemas/scripts.js.map +1 -0
- package/dist/api-schemas/sdk-execution-v1.d.ts +467 -0
- package/dist/api-schemas/sdk-execution-v1.d.ts.map +1 -0
- package/dist/api-schemas/sdk-execution-v1.js +115 -0
- package/dist/api-schemas/sdk-execution-v1.js.map +1 -0
- package/dist/api-schemas/sdk-lifecycle-v1.d.ts +217 -0
- package/dist/api-schemas/sdk-lifecycle-v1.d.ts.map +1 -0
- package/dist/api-schemas/sdk-lifecycle-v1.js +117 -0
- package/dist/api-schemas/sdk-lifecycle-v1.js.map +1 -0
- package/dist/api-schemas/sdk-models-v1.d.ts +181 -0
- package/dist/api-schemas/sdk-models-v1.d.ts.map +1 -0
- package/dist/api-schemas/sdk-models-v1.js +108 -0
- package/dist/api-schemas/sdk-models-v1.js.map +1 -0
- package/dist/api-schemas/sdk-v1-http-operations.d.ts +941 -0
- package/dist/api-schemas/sdk-v1-http-operations.d.ts.map +1 -0
- package/dist/api-schemas/sdk-v1-http-operations.js +465 -0
- package/dist/api-schemas/sdk-v1-http-operations.js.map +1 -0
- package/dist/api-schemas/sdk-v1-operations.d.ts +151 -0
- package/dist/api-schemas/sdk-v1-operations.d.ts.map +1 -0
- package/dist/api-schemas/sdk-v1-operations.js +97 -0
- package/dist/api-schemas/sdk-v1-operations.js.map +1 -0
- package/dist/api-schemas/sdk-v1-websocket-operations.d.ts +97 -0
- package/dist/api-schemas/sdk-v1-websocket-operations.d.ts.map +1 -0
- package/dist/api-schemas/sdk-v1-websocket-operations.js +96 -0
- package/dist/api-schemas/sdk-v1-websocket-operations.js.map +1 -0
- package/dist/api-schemas/sdk-v1.d.ts +15 -0
- package/dist/api-schemas/sdk-v1.d.ts.map +1 -0
- package/dist/api-schemas/sdk-v1.js +22 -0
- package/dist/api-schemas/sdk-v1.js.map +1 -0
- package/dist/api-schemas/segmentation.d.ts +75 -0
- package/dist/api-schemas/segmentation.d.ts.map +1 -0
- package/dist/api-schemas/segmentation.js +54 -0
- package/dist/api-schemas/segmentation.js.map +1 -0
- package/dist/api-schemas/settings.d.ts +159 -0
- package/dist/api-schemas/settings.d.ts.map +1 -1
- package/dist/api-schemas/settings.js +70 -0
- package/dist/api-schemas/settings.js.map +1 -1
- package/dist/api-schemas/sketch.d.ts +847 -0
- package/dist/api-schemas/sketch.d.ts.map +1 -0
- package/dist/api-schemas/sketch.js +544 -0
- package/dist/api-schemas/sketch.js.map +1 -0
- package/dist/api-schemas/skills.d.ts +27 -14
- package/dist/api-schemas/skills.d.ts.map +1 -1
- package/dist/api-schemas/skills.js +64 -11
- package/dist/api-schemas/skills.js.map +1 -1
- package/dist/api-schemas/storage.d.ts +8 -0
- package/dist/api-schemas/storage.d.ts.map +1 -1
- package/dist/api-schemas/storage.js +7 -0
- package/dist/api-schemas/storage.js.map +1 -1
- package/dist/api-schemas/storyboards.d.ts +7026 -0
- package/dist/api-schemas/storyboards.d.ts.map +1 -0
- package/dist/api-schemas/storyboards.js +393 -0
- package/dist/api-schemas/storyboards.js.map +1 -0
- package/dist/api-schemas/threads.d.ts +12 -4
- package/dist/api-schemas/threads.d.ts.map +1 -1
- package/dist/api-schemas/threads.js +12 -4
- package/dist/api-schemas/threads.js.map +1 -1
- package/dist/api-schemas/timeline-tool-contracts.d.ts +1650 -0
- package/dist/api-schemas/timeline-tool-contracts.d.ts.map +1 -0
- package/dist/api-schemas/timeline-tool-contracts.js +725 -0
- package/dist/api-schemas/timeline-tool-contracts.js.map +1 -0
- package/dist/api-schemas/timeline-tool-params.d.ts +1237 -0
- package/dist/api-schemas/timeline-tool-params.d.ts.map +1 -0
- package/dist/api-schemas/timeline-tool-params.js +1518 -0
- package/dist/api-schemas/timeline-tool-params.js.map +1 -0
- package/dist/api-schemas/timeline.d.ts +12803 -0
- package/dist/api-schemas/timeline.d.ts.map +1 -0
- package/dist/api-schemas/timeline.js +1838 -0
- package/dist/api-schemas/timeline.js.map +1 -0
- package/dist/api-schemas/ui-tool-contract.d.ts +35 -0
- package/dist/api-schemas/ui-tool-contract.d.ts.map +1 -0
- package/dist/api-schemas/ui-tool-contract.js +31 -0
- package/dist/api-schemas/ui-tool-contract.js.map +1 -0
- package/dist/api-schemas/workflows.d.ts +852 -18
- package/dist/api-schemas/workflows.d.ts.map +1 -1
- package/dist/api-schemas/workflows.js +484 -6
- package/dist/api-schemas/workflows.js.map +1 -1
- package/dist/api-schemas/workspace.d.ts +45 -0
- package/dist/api-schemas/workspace.d.ts.map +1 -1
- package/dist/api-schemas/workspace.js +47 -1
- package/dist/api-schemas/workspace.js.map +1 -1
- package/dist/api-types.d.ts +621 -27
- package/dist/api-types.d.ts.map +1 -1
- package/dist/api-types.js +246 -1
- package/dist/api-types.js.map +1 -1
- package/dist/app-deployment.d.ts +37 -0
- package/dist/app-deployment.d.ts.map +1 -0
- package/dist/app-deployment.js +42 -0
- package/dist/app-deployment.js.map +1 -0
- package/dist/asset-generation.d.ts +58 -0
- package/dist/asset-generation.d.ts.map +1 -0
- package/dist/asset-generation.js +147 -0
- package/dist/asset-generation.js.map +1 -0
- package/dist/blend-modes.d.ts +20 -0
- package/dist/blend-modes.d.ts.map +1 -0
- package/dist/blend-modes.js +33 -0
- package/dist/blend-modes.js.map +1 -0
- package/dist/bridge-frames.d.ts +654 -0
- package/dist/bridge-frames.d.ts.map +1 -0
- package/dist/bridge-frames.js +448 -0
- package/dist/bridge-frames.js.map +1 -0
- package/dist/bridge-frames.schema.json +862 -0
- package/dist/bridge-protocol.d.ts +57 -20
- package/dist/bridge-protocol.d.ts.map +1 -1
- package/dist/bridge-protocol.js +57 -20
- package/dist/bridge-protocol.js.map +1 -1
- package/dist/builtin-packs.d.ts +45 -0
- package/dist/builtin-packs.d.ts.map +1 -0
- package/dist/builtin-packs.js +115 -0
- package/dist/builtin-packs.js.map +1 -0
- package/dist/caption-word.d.ts +15 -0
- package/dist/caption-word.d.ts.map +1 -0
- package/dist/caption-word.js +10 -0
- package/dist/caption-word.js.map +1 -0
- package/dist/cloud-profile.d.ts +187 -0
- package/dist/cloud-profile.d.ts.map +1 -0
- package/dist/cloud-profile.js +281 -0
- package/dist/cloud-profile.js.map +1 -0
- package/dist/creative.d.ts +486 -0
- package/dist/creative.d.ts.map +1 -0
- package/dist/creative.js +269 -0
- package/dist/creative.js.map +1 -0
- package/dist/custom-providers.d.ts +70 -0
- package/dist/custom-providers.d.ts.map +1 -0
- package/dist/custom-providers.js +125 -0
- package/dist/custom-providers.js.map +1 -0
- package/dist/document-ops.d.ts +15 -0
- package/dist/document-ops.d.ts.map +1 -0
- package/dist/document-ops.js +2 -0
- package/dist/document-ops.js.map +1 -0
- package/dist/game-assets.d.ts +344 -0
- package/dist/game-assets.d.ts.map +1 -0
- package/dist/game-assets.js +297 -0
- package/dist/game-assets.js.map +1 -0
- package/dist/game-design.d.ts +90 -0
- package/dist/game-design.d.ts.map +1 -0
- package/dist/game-design.js +417 -0
- package/dist/game-design.js.map +1 -0
- package/dist/game-flow-prompt.d.ts +68 -0
- package/dist/game-flow-prompt.d.ts.map +1 -0
- package/dist/game-flow-prompt.js +121 -0
- package/dist/game-flow-prompt.js.map +1 -0
- package/dist/game-graph.d.ts +96 -0
- package/dist/game-graph.d.ts.map +1 -0
- package/dist/game-graph.js +481 -0
- package/dist/game-graph.js.map +1 -0
- package/dist/game-migration.d.ts +4 -0
- package/dist/game-migration.d.ts.map +1 -0
- package/dist/game-migration.js +6 -0
- package/dist/game-migration.js.map +1 -0
- package/dist/game-slot-prompt.d.ts +90 -0
- package/dist/game-slot-prompt.d.ts.map +1 -0
- package/dist/game-slot-prompt.js +237 -0
- package/dist/game-slot-prompt.js.map +1 -0
- package/dist/game.d.ts +1663 -0
- package/dist/game.d.ts.map +1 -0
- package/dist/game.js +228 -0
- package/dist/game.js.map +1 -0
- package/dist/graph.d.ts +191 -5
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +497 -0
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +47 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -2
- package/dist/index.js.map +1 -1
- package/dist/loop.d.ts +38 -0
- package/dist/loop.d.ts.map +1 -0
- package/dist/loop.js +69 -0
- package/dist/loop.js.map +1 -0
- package/dist/mcp-server-config.d.ts +113 -0
- package/dist/mcp-server-config.d.ts.map +1 -0
- package/dist/mcp-server-config.js +147 -0
- package/dist/mcp-server-config.js.map +1 -0
- package/dist/messages.d.ts +1565 -243
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +709 -22
- package/dist/messages.js.map +1 -1
- package/dist/model-selection.d.ts +20 -0
- package/dist/model-selection.d.ts.map +1 -0
- package/dist/model-selection.js +27 -0
- package/dist/model-selection.js.map +1 -0
- package/dist/nodetool-models.d.ts +71 -0
- package/dist/nodetool-models.d.ts.map +1 -0
- package/dist/nodetool-models.js +138 -0
- package/dist/nodetool-models.js.map +1 -0
- package/dist/package-assets.d.ts +39 -0
- package/dist/package-assets.d.ts.map +1 -0
- package/dist/package-assets.js +63 -0
- package/dist/package-assets.js.map +1 -0
- package/dist/platform.d.ts +66 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +68 -0
- package/dist/platform.js.map +1 -0
- package/dist/predicates.d.ts +43 -0
- package/dist/predicates.d.ts.map +1 -0
- package/dist/predicates.js +65 -0
- package/dist/predicates.js.map +1 -0
- package/dist/processing-messages.schema.json +2525 -0
- package/dist/production-authoring.d.ts +757 -0
- package/dist/production-authoring.d.ts.map +1 -0
- package/dist/production-authoring.js +736 -0
- package/dist/production-authoring.js.map +1 -0
- package/dist/render-record.d.ts +86 -0
- package/dist/render-record.d.ts.map +1 -0
- package/dist/render-record.js +133 -0
- package/dist/render-record.js.map +1 -0
- package/dist/resource-id.d.ts +22 -0
- package/dist/resource-id.d.ts.map +1 -0
- package/dist/resource-id.js +32 -0
- package/dist/resource-id.js.map +1 -0
- package/dist/resource-uri.d.ts +15 -0
- package/dist/resource-uri.d.ts.map +1 -0
- package/dist/resource-uri.js +88 -0
- package/dist/resource-uri.js.map +1 -0
- package/dist/sandbox-capability.d.ts +86 -0
- package/dist/sandbox-capability.d.ts.map +1 -0
- package/dist/sandbox-capability.js +106 -0
- package/dist/sandbox-capability.js.map +1 -0
- package/dist/sandbox-host.d.ts +98 -0
- package/dist/sandbox-host.d.ts.map +1 -0
- package/dist/sandbox-host.js +311 -0
- package/dist/sandbox-host.js.map +1 -0
- package/dist/sandbox-package.d.ts +674 -0
- package/dist/sandbox-package.d.ts.map +1 -0
- package/dist/sandbox-package.js +622 -0
- package/dist/sandbox-package.js.map +1 -0
- package/dist/sandbox-wasm.d.ts +84 -0
- package/dist/sandbox-wasm.d.ts.map +1 -0
- package/dist/sandbox-wasm.js +139 -0
- package/dist/sandbox-wasm.js.map +1 -0
- package/dist/screenplay-authoring.d.ts +69 -0
- package/dist/screenplay-authoring.d.ts.map +1 -0
- package/dist/screenplay-authoring.js +351 -0
- package/dist/screenplay-authoring.js.map +1 -0
- package/dist/script-authoring.d.ts +161 -0
- package/dist/script-authoring.d.ts.map +1 -0
- package/dist/script-authoring.js +503 -0
- package/dist/script-authoring.js.map +1 -0
- package/dist/script-fill.d.ts +39 -0
- package/dist/script-fill.d.ts.map +1 -0
- package/dist/script-fill.js +67 -0
- package/dist/script-fill.js.map +1 -0
- package/dist/script-link.d.ts +110 -0
- package/dist/script-link.d.ts.map +1 -0
- package/dist/script-link.js +252 -0
- package/dist/script-link.js.map +1 -0
- package/dist/sha256.d.ts +11 -0
- package/dist/sha256.d.ts.map +1 -0
- package/dist/sha256.js +110 -0
- package/dist/sha256.js.map +1 -0
- package/dist/shot-prompt.d.ts +78 -0
- package/dist/shot-prompt.d.ts.map +1 -0
- package/dist/shot-prompt.js +120 -0
- package/dist/shot-prompt.js.map +1 -0
- package/dist/skill-document.d.ts +36 -0
- package/dist/skill-document.d.ts.map +1 -0
- package/dist/skill-document.js +137 -0
- package/dist/skill-document.js.map +1 -0
- package/dist/style-presets.d.ts +73 -0
- package/dist/style-presets.d.ts.map +1 -0
- package/dist/style-presets.js +147 -0
- package/dist/style-presets.js.map +1 -0
- package/dist/supervisor.d.ts +227 -0
- package/dist/supervisor.d.ts.map +1 -0
- package/dist/supervisor.js +116 -0
- package/dist/supervisor.js.map +1 -0
- package/dist/token-providers.d.ts +31 -0
- package/dist/token-providers.d.ts.map +1 -0
- package/dist/token-providers.js +52 -0
- package/dist/token-providers.js.map +1 -0
- package/dist/toolSchemas.d.ts +10 -14
- package/dist/toolSchemas.d.ts.map +1 -1
- package/dist/toolSchemas.js +13 -23
- package/dist/toolSchemas.js.map +1 -1
- package/dist/triggers.d.ts +41 -0
- package/dist/triggers.d.ts.map +1 -0
- package/dist/triggers.js +50 -0
- package/dist/triggers.js.map +1 -0
- package/dist/trpc-policy.d.ts +3 -0
- package/dist/trpc-policy.d.ts.map +1 -0
- package/dist/trpc-policy.js +3 -0
- package/dist/trpc-policy.js.map +1 -0
- package/dist/type-metadata.d.ts +5 -0
- package/dist/type-metadata.d.ts.map +1 -1
- package/dist/type-metadata.js +17 -8
- package/dist/type-metadata.js.map +1 -1
- package/dist/typecheck.d.ts.map +1 -1
- package/dist/typecheck.js +5 -4
- package/dist/typecheck.js.map +1 -1
- package/dist/wasm-binary.d.ts +61 -0
- package/dist/wasm-binary.d.ts.map +1 -0
- package/dist/wasm-binary.js +215 -0
- package/dist/wasm-binary.js.map +1 -0
- package/dist/workflow-plan.d.ts +197 -0
- package/dist/workflow-plan.d.ts.map +1 -0
- package/dist/workflow-plan.js +438 -0
- package/dist/workflow-plan.js.map +1 -0
- package/dist/wrap-primitives.d.ts +0 -11
- package/dist/wrap-primitives.d.ts.map +1 -1
- package/dist/wrap-primitives.js +3 -9
- package/dist/wrap-primitives.js.map +1 -1
- package/dist/ws-commands.d.ts +665 -0
- package/dist/ws-commands.d.ts.map +1 -0
- package/dist/ws-commands.js +610 -0
- package/dist/ws-commands.js.map +1 -0
- package/dist/zod-schema.d.ts +20 -0
- package/dist/zod-schema.d.ts.map +1 -0
- package/dist/zod-schema.js +298 -0
- package/dist/zod-schema.js.map +1 -0
- package/package.json +84 -7
- package/schema/sdk-v1.asyncapi.implemented.json +65 -0
- package/schema/sdk-v1.asyncapi.json +65 -0
- package/schema/sdk-v1.discovery.schema.json +1218 -0
- package/schema/sdk-v1.execution.schema.json +2792 -0
- package/schema/sdk-v1.lifecycle.schema.json +1031 -0
- package/schema/sdk-v1.manifest.json +71 -0
- package/schema/sdk-v1.openapi.implemented.json +730 -0
- package/schema/sdk-v1.openapi.json +730 -0
- package/schema/sdk-v1.operations.json +732 -0
- package/dist/agent-protocol.d.ts +0 -217
- package/dist/agent-protocol.d.ts.map +0 -1
- package/dist/agent-protocol.js +0 -85
- package/dist/agent-protocol.js.map +0 -1
|
@@ -0,0 +1,1838 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { BLEND_MODE_TUPLE } from "../blend-modes.js";
|
|
3
|
+
import { creativeContext, productionTakeMetadata, productionRequirement } from "../production-authoring.js";
|
|
4
|
+
import { captionWord } from "../caption-word.js";
|
|
5
|
+
export { captionWord } from "../caption-word.js";
|
|
6
|
+
const blendModeEnum = z.enum(BLEND_MODE_TUPLE);
|
|
7
|
+
/**
|
|
8
|
+
* Curves a clip fade ramps along. The gain functions live in
|
|
9
|
+
* `@nodetool-ai/timeline` (`audioFade.ts`), which cannot be imported here
|
|
10
|
+
* without a cycle; `clipFadeShape.protocol.test.ts` there fails if the two
|
|
11
|
+
* lists drift apart.
|
|
12
|
+
*/
|
|
13
|
+
export const CLIP_FADE_SHAPE_TUPLE = [
|
|
14
|
+
"linear",
|
|
15
|
+
"sCurve",
|
|
16
|
+
"plus3dB",
|
|
17
|
+
"minus3dB"
|
|
18
|
+
];
|
|
19
|
+
export const clipFadeShapeEnum = z.enum(CLIP_FADE_SHAPE_TUPLE);
|
|
20
|
+
// ── Shared sub-schemas ───────────────────────────────────────────────────────
|
|
21
|
+
export const clipVersion = z.object({
|
|
22
|
+
id: z.string(),
|
|
23
|
+
createdAt: z.string(),
|
|
24
|
+
jobId: z.string(),
|
|
25
|
+
assetId: z.string(),
|
|
26
|
+
workflowUpdatedAt: z.string(),
|
|
27
|
+
dependencyHash: z.string(),
|
|
28
|
+
paramOverridesSnapshot: z.record(z.string(), z.unknown()),
|
|
29
|
+
costCredits: z.number().optional(),
|
|
30
|
+
durationMs: z.number().optional(),
|
|
31
|
+
status: z.enum(["success", "failed", "cancelled"]),
|
|
32
|
+
favorite: z.boolean().optional(),
|
|
33
|
+
/** Take metadata (P0 AI Video, PRD § 8.10). Without these fields Zod
|
|
34
|
+
* strips them on every PATCH, breaking take labels/provenance round-trips. */
|
|
35
|
+
label: z.string().optional(),
|
|
36
|
+
source: z
|
|
37
|
+
.enum([
|
|
38
|
+
"imported",
|
|
39
|
+
"generated",
|
|
40
|
+
"extended",
|
|
41
|
+
"inpainted",
|
|
42
|
+
"object_replace",
|
|
43
|
+
"video_to_video"
|
|
44
|
+
])
|
|
45
|
+
.optional(),
|
|
46
|
+
provider: z.string().optional(),
|
|
47
|
+
model: z.string().optional(),
|
|
48
|
+
prompt: z.string().optional(),
|
|
49
|
+
negativePrompt: z.string().optional(),
|
|
50
|
+
parentTakeId: z.string().optional(),
|
|
51
|
+
/** Stable production candidate identity captured before dispatch. */
|
|
52
|
+
...productionTakeMetadata.shape,
|
|
53
|
+
/** Immutable direct-generation inputs for recipe-based New take replay. */
|
|
54
|
+
generationRecipe: z
|
|
55
|
+
.object({
|
|
56
|
+
schemaVersion: z.literal(1),
|
|
57
|
+
task: z.literal("text_to_video"),
|
|
58
|
+
prompt: z.string().trim().min(1),
|
|
59
|
+
provider: z.string().trim().min(1),
|
|
60
|
+
model: z.string().trim().min(1),
|
|
61
|
+
durationMs: z.number().finite().positive(),
|
|
62
|
+
negativePrompt: z.string().trim().min(1).optional(),
|
|
63
|
+
aspectRatio: z.string().trim().min(1).optional(),
|
|
64
|
+
resolution: z.string().trim().min(1).optional(),
|
|
65
|
+
width: z.number().finite().positive().optional(),
|
|
66
|
+
height: z.number().finite().positive().optional(),
|
|
67
|
+
strength: z.number().finite().optional(),
|
|
68
|
+
numInferenceSteps: z.number().int().positive().optional(),
|
|
69
|
+
seed: z.number().int().optional(),
|
|
70
|
+
referenceAssetIds: z.array(z.string().trim().min(1)).optional()
|
|
71
|
+
})
|
|
72
|
+
.optional(),
|
|
73
|
+
/** Immutable Script context for a Change line delivery candidate. */
|
|
74
|
+
lineDelivery: z
|
|
75
|
+
.object({
|
|
76
|
+
action: z.literal("change_line_delivery"),
|
|
77
|
+
modelTask: z.literal("text_to_speech"),
|
|
78
|
+
requestId: z.string(),
|
|
79
|
+
sourceContext: z.object({
|
|
80
|
+
scriptId: z.string().trim().min(1),
|
|
81
|
+
lineId: z.string().trim().min(1),
|
|
82
|
+
speakerId: z.string().trim().min(1).optional(),
|
|
83
|
+
text: z.string().trim().min(1),
|
|
84
|
+
voice: z.object({
|
|
85
|
+
provider: z.string().trim().min(1),
|
|
86
|
+
model: z.string().trim().min(1),
|
|
87
|
+
voice: z.string().trim().min(1)
|
|
88
|
+
}),
|
|
89
|
+
direction: z.string().trim().min(1).optional(),
|
|
90
|
+
language: z.string().trim().min(1).optional(),
|
|
91
|
+
pace: z.enum(["slow", "normal", "fast"]).optional(),
|
|
92
|
+
targetDurationMs: z.number().finite().positive().optional()
|
|
93
|
+
}),
|
|
94
|
+
instructions: z.string().trim().min(1).optional(),
|
|
95
|
+
speed: z.number().finite().min(0.25).max(4).optional()
|
|
96
|
+
})
|
|
97
|
+
.optional(),
|
|
98
|
+
sourceMapping: z
|
|
99
|
+
.object({
|
|
100
|
+
inPointMs: z.number().optional(),
|
|
101
|
+
outPointMs: z.number().optional(),
|
|
102
|
+
speedMultiplier: z.number().optional(),
|
|
103
|
+
speedBaked: z.boolean().optional()
|
|
104
|
+
})
|
|
105
|
+
.optional(),
|
|
106
|
+
mediaEdit: z
|
|
107
|
+
.object({
|
|
108
|
+
action: z.literal("video_edit"),
|
|
109
|
+
modelTask: z.literal("video_to_video"),
|
|
110
|
+
referenceAssetIds: z.array(z.string().trim().min(1)).optional(),
|
|
111
|
+
entityIds: z.array(z.string().trim().min(1)).optional(),
|
|
112
|
+
requestId: z.string(),
|
|
113
|
+
instruction: z.string(),
|
|
114
|
+
provider: z.string(),
|
|
115
|
+
model: z.string(),
|
|
116
|
+
sourceContext: z.object({
|
|
117
|
+
sequenceId: z.string(),
|
|
118
|
+
clipId: z.string(),
|
|
119
|
+
sourceAssetId: z.string(),
|
|
120
|
+
sourceTakeId: z.string().optional(),
|
|
121
|
+
sourceStartMs: z.number(),
|
|
122
|
+
sourceEndMs: z.number(),
|
|
123
|
+
timelineStartMs: z.number(),
|
|
124
|
+
timelineDurationMs: z.number(),
|
|
125
|
+
speedMultiplier: z.number()
|
|
126
|
+
}),
|
|
127
|
+
strength: z.number().optional(),
|
|
128
|
+
resolution: z.string().optional()
|
|
129
|
+
})
|
|
130
|
+
.optional()
|
|
131
|
+
});
|
|
132
|
+
export const timelineMarker = z.object({
|
|
133
|
+
id: z.string(),
|
|
134
|
+
timeMs: z.number(),
|
|
135
|
+
label: z.string(),
|
|
136
|
+
color: z.string().optional(),
|
|
137
|
+
note: z.string().optional()
|
|
138
|
+
});
|
|
139
|
+
// ── Captions ─────────────────────────────────────────────────────────────────
|
|
140
|
+
/**
|
|
141
|
+
* Authored look of a caption layer. Every field is optional: an absent one
|
|
142
|
+
* keeps the drawing default, so a caption written before styling existed
|
|
143
|
+
* renders exactly as it did.
|
|
144
|
+
*/
|
|
145
|
+
export const captionStyle = z.object({
|
|
146
|
+
fontFamily: z.string().optional(),
|
|
147
|
+
fontSizeFrac: z.number().optional(),
|
|
148
|
+
color: z.string().optional(),
|
|
149
|
+
activeColor: z.string().optional(),
|
|
150
|
+
outline: z.object({ color: z.string(), widthPx: z.number() }).optional(),
|
|
151
|
+
bottomMarginFrac: z.number().optional(),
|
|
152
|
+
background: z
|
|
153
|
+
.object({
|
|
154
|
+
color: z.string(),
|
|
155
|
+
paddingPx: z.number(),
|
|
156
|
+
radiusPx: z.number().optional()
|
|
157
|
+
})
|
|
158
|
+
.optional()
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* Word-level caption data carried by a caption clip. Sourced from the
|
|
162
|
+
* transcription of the beat's voiceover. A single fixed render style is used
|
|
163
|
+
* for the MVP, so no style fields are persisted yet.
|
|
164
|
+
*/
|
|
165
|
+
export const clipCaption = z.object({
|
|
166
|
+
words: z.array(captionWord),
|
|
167
|
+
/** Caption look. Without this field Zod strips it on every PATCH, so a
|
|
168
|
+
* restyled caption reverts to the built-in look on the next save. */
|
|
169
|
+
style: captionStyle.optional()
|
|
170
|
+
});
|
|
171
|
+
// ── Transcript (Studio) ────────────────────────────────────────────────────
|
|
172
|
+
/**
|
|
173
|
+
* One line of the Studio transcript. Each line owns the clips generated from
|
|
174
|
+
* it (`clipIds` — typically a voiceover audio clip and a caption clip).
|
|
175
|
+
* `beatStartMs` is the line's position on the timeline, recomputed whenever
|
|
176
|
+
* beats are added, removed, reordered, or re-flowed.
|
|
177
|
+
*/
|
|
178
|
+
export const transcriptLine = z.object({
|
|
179
|
+
id: z.string(),
|
|
180
|
+
text: z.string(),
|
|
181
|
+
beatStartMs: z.number(),
|
|
182
|
+
clipIds: z.array(z.string())
|
|
183
|
+
});
|
|
184
|
+
// ── Track DSP effects ────────────────────────────────────────────────────────
|
|
185
|
+
export const trackGainEffect = z.object({
|
|
186
|
+
id: z.string(),
|
|
187
|
+
type: z.literal("gain"),
|
|
188
|
+
enabled: z.boolean(),
|
|
189
|
+
gainDb: z.number()
|
|
190
|
+
});
|
|
191
|
+
export const trackEq3Effect = z.object({
|
|
192
|
+
id: z.string(),
|
|
193
|
+
type: z.literal("eq3"),
|
|
194
|
+
enabled: z.boolean(),
|
|
195
|
+
lowFreq: z.number(),
|
|
196
|
+
lowGainDb: z.number(),
|
|
197
|
+
midFreq: z.number(),
|
|
198
|
+
midQ: z.number(),
|
|
199
|
+
midGainDb: z.number(),
|
|
200
|
+
highFreq: z.number(),
|
|
201
|
+
highGainDb: z.number()
|
|
202
|
+
});
|
|
203
|
+
export const trackFilterEffect = z.object({
|
|
204
|
+
id: z.string(),
|
|
205
|
+
type: z.literal("filter"),
|
|
206
|
+
enabled: z.boolean(),
|
|
207
|
+
mode: z.enum(["lowpass", "highpass", "bandpass"]),
|
|
208
|
+
frequency: z.number(),
|
|
209
|
+
q: z.number()
|
|
210
|
+
});
|
|
211
|
+
export const trackCompressorEffect = z.object({
|
|
212
|
+
id: z.string(),
|
|
213
|
+
type: z.literal("compressor"),
|
|
214
|
+
enabled: z.boolean(),
|
|
215
|
+
thresholdDb: z.number(),
|
|
216
|
+
ratio: z.number(),
|
|
217
|
+
attackMs: z.number(),
|
|
218
|
+
releaseMs: z.number(),
|
|
219
|
+
kneeDb: z.number()
|
|
220
|
+
});
|
|
221
|
+
// ── Track video effects ──────────────────────────────────────────────────────
|
|
222
|
+
export const trackColorCorrectionEffect = z.object({
|
|
223
|
+
id: z.string(),
|
|
224
|
+
type: z.literal("colorCorrection"),
|
|
225
|
+
enabled: z.boolean(),
|
|
226
|
+
brightness: z.number(),
|
|
227
|
+
contrast: z.number(),
|
|
228
|
+
saturation: z.number(),
|
|
229
|
+
hue: z.number(),
|
|
230
|
+
temperature: z.number(),
|
|
231
|
+
tint: z.number(),
|
|
232
|
+
shadows: z.number(),
|
|
233
|
+
highlights: z.number()
|
|
234
|
+
});
|
|
235
|
+
export const trackVideoBlurEffect = z.object({
|
|
236
|
+
id: z.string(),
|
|
237
|
+
type: z.literal("videoBlur"),
|
|
238
|
+
enabled: z.boolean(),
|
|
239
|
+
radius: z.number()
|
|
240
|
+
});
|
|
241
|
+
export const trackSharpenEffect = z.object({
|
|
242
|
+
id: z.string(),
|
|
243
|
+
type: z.literal("sharpen"),
|
|
244
|
+
enabled: z.boolean(),
|
|
245
|
+
amount: z.number(),
|
|
246
|
+
threshold: z.number()
|
|
247
|
+
});
|
|
248
|
+
export const trackVignetteEffect = z.object({
|
|
249
|
+
id: z.string(),
|
|
250
|
+
type: z.literal("vignette"),
|
|
251
|
+
enabled: z.boolean(),
|
|
252
|
+
intensity: z.number(),
|
|
253
|
+
radius: z.number(),
|
|
254
|
+
softness: z.number()
|
|
255
|
+
});
|
|
256
|
+
export const trackChromaKeyEffect = z.object({
|
|
257
|
+
id: z.string(),
|
|
258
|
+
type: z.literal("chromaKey"),
|
|
259
|
+
enabled: z.boolean(),
|
|
260
|
+
keyColor: z.string(),
|
|
261
|
+
tolerance: z.number(),
|
|
262
|
+
softness: z.number(),
|
|
263
|
+
spill: z.number()
|
|
264
|
+
});
|
|
265
|
+
export const trackEffect = z.discriminatedUnion("type", [
|
|
266
|
+
trackGainEffect,
|
|
267
|
+
trackEq3Effect,
|
|
268
|
+
trackFilterEffect,
|
|
269
|
+
trackCompressorEffect,
|
|
270
|
+
trackColorCorrectionEffect,
|
|
271
|
+
trackVideoBlurEffect,
|
|
272
|
+
trackSharpenEffect,
|
|
273
|
+
trackVignetteEffect,
|
|
274
|
+
trackChromaKeyEffect
|
|
275
|
+
]);
|
|
276
|
+
// ── MIDI ─────────────────────────────────────────────────────────────────────
|
|
277
|
+
/**
|
|
278
|
+
* How many notes one midi clip may carry. A clip is a phrase, not a song: the
|
|
279
|
+
* cap keeps a runaway generator from writing a document no editor can open,
|
|
280
|
+
* and it is checked here so the limit is the same on every surface.
|
|
281
|
+
*/
|
|
282
|
+
export const MIDI_MAX_NOTES_PER_CLIP = 4096;
|
|
283
|
+
/**
|
|
284
|
+
* One note inside a midi clip. `startTick`/`durationTick` are ticks (960 per
|
|
285
|
+
* quarter note, `MIDI_PPQ` in `@nodetool-ai/timeline`) measured from the
|
|
286
|
+
* clip's *content* start, not from its window — exactly as an audio clip's
|
|
287
|
+
* samples are measured from the head of its source. Trimming the window
|
|
288
|
+
* therefore hides notes rather than deleting them.
|
|
289
|
+
*/
|
|
290
|
+
export const midiNote = z.object({
|
|
291
|
+
id: z.string(),
|
|
292
|
+
pitch: z.number().int().min(0).max(127),
|
|
293
|
+
velocity: z.number().int().min(1).max(127),
|
|
294
|
+
startTick: z.number().int().min(0),
|
|
295
|
+
durationTick: z.number().int().positive()
|
|
296
|
+
});
|
|
297
|
+
/** An ADSR envelope, in milliseconds with a 0..1 sustain level. */
|
|
298
|
+
export const midiEnvelope = z.object({
|
|
299
|
+
attackMs: z.number().min(0),
|
|
300
|
+
decayMs: z.number().min(0),
|
|
301
|
+
sustain: z.number().min(0).max(1),
|
|
302
|
+
releaseMs: z.number().min(0)
|
|
303
|
+
});
|
|
304
|
+
/** The filter shapes the FableSynth-derived voices offer. */
|
|
305
|
+
export const midiFilterType = z.enum(["lp12", "lp24", "bp12", "hp12", "notch"]);
|
|
306
|
+
/** The tonal wavetables WT-1 and BL-1 play. */
|
|
307
|
+
export const midiWavetableName = z.enum([
|
|
308
|
+
"prime",
|
|
309
|
+
"bloom",
|
|
310
|
+
"pulse",
|
|
311
|
+
"vox",
|
|
312
|
+
"chime",
|
|
313
|
+
"glitch"
|
|
314
|
+
]);
|
|
315
|
+
/** DR-1's percussive tables. A pad can also play any tonal table. */
|
|
316
|
+
export const midiDrumTableName = z.enum(["thud", "crack", "tine", "grit"]);
|
|
317
|
+
/** One of WT-1's two wavetable oscillators. */
|
|
318
|
+
export const wavetableOscillator = z.object({
|
|
319
|
+
table: midiWavetableName,
|
|
320
|
+
/** Morph position across the table's frames, 0..1. */
|
|
321
|
+
position: z.number().min(0).max(1),
|
|
322
|
+
/** Offset from the played note, in semitones. */
|
|
323
|
+
semitones: z.number(),
|
|
324
|
+
/** Further offset in cents. */
|
|
325
|
+
fine: z.number(),
|
|
326
|
+
/** Output level, 0..1. */
|
|
327
|
+
level: z.number().min(0).max(1),
|
|
328
|
+
/** Detuned copies of the oscillator, 1..7. */
|
|
329
|
+
unison: z.number().int().min(1).max(7),
|
|
330
|
+
/** How far the copies spread, 0..1 (1 = ±50 cents). */
|
|
331
|
+
detune: z.number().min(0).max(1)
|
|
332
|
+
});
|
|
333
|
+
/** One DR-1 pad: a tuned one-shot with its own envelope and filter. */
|
|
334
|
+
export const drumPad = z.object({
|
|
335
|
+
name: z.string(),
|
|
336
|
+
table: z.union([midiWavetableName, midiDrumTableName]),
|
|
337
|
+
position: z.number().min(0).max(1),
|
|
338
|
+
/** Pitch offset from the pad's base note, in semitones. */
|
|
339
|
+
semitones: z.number(),
|
|
340
|
+
/** How far the pitch envelope starts above the pad's pitch, in semitones. */
|
|
341
|
+
pitchEnvAmount: z.number(),
|
|
342
|
+
pitchEnvDecayMs: z.number().min(0),
|
|
343
|
+
noiseLevel: z.number().min(0).max(1),
|
|
344
|
+
/** Noise colour, -1 (dark) to 1 (bright). */
|
|
345
|
+
noiseColor: z.number().min(-1).max(1),
|
|
346
|
+
/** Ring-modulator carrier in Hz. */
|
|
347
|
+
ringHz: z.number().positive(),
|
|
348
|
+
ringMix: z.number().min(0).max(1),
|
|
349
|
+
attackMs: z.number().min(0),
|
|
350
|
+
/** How long the envelope holds at full before decaying, in ms. */
|
|
351
|
+
holdMs: z.number().min(0),
|
|
352
|
+
decayMs: z.number().min(0),
|
|
353
|
+
/** Decay shape, 0 (a straight line) to 1 (exponential). */
|
|
354
|
+
curve: z.number().min(0).max(1),
|
|
355
|
+
/** The pad's filter, or null for no filter. */
|
|
356
|
+
filter: z
|
|
357
|
+
.object({
|
|
358
|
+
type: midiFilterType,
|
|
359
|
+
cutoffHz: z.number().positive(),
|
|
360
|
+
resonance: z.number().min(0).max(1)
|
|
361
|
+
})
|
|
362
|
+
.nullable(),
|
|
363
|
+
level: z.number().min(0).max(1),
|
|
364
|
+
/** How much velocity scales the level, 0..1. */
|
|
365
|
+
velocityToLevel: z.number().min(0).max(1)
|
|
366
|
+
});
|
|
367
|
+
/**
|
|
368
|
+
* The voice a midi track plays.
|
|
369
|
+
*
|
|
370
|
+
* `subtractive` is the built-in synth. The other three are ports of the
|
|
371
|
+
* FableSynth instruments (github.com/georgi/fablesynth): WT-1 the wavetable
|
|
372
|
+
* synth, BL-1 the acid bassline, DR-1 the drum machine.
|
|
373
|
+
*/
|
|
374
|
+
export const midiInstrument = z.discriminatedUnion("type", [
|
|
375
|
+
z.object({
|
|
376
|
+
type: z.literal("subtractive"),
|
|
377
|
+
waveform: z.enum(["saw", "square", "triangle", "sine"]),
|
|
378
|
+
/** Envelope attack in ms. */
|
|
379
|
+
attackMs: z.number().min(0),
|
|
380
|
+
/** Envelope decay in ms. */
|
|
381
|
+
decayMs: z.number().min(0),
|
|
382
|
+
/** Sustain level, 0..1 of the peak. */
|
|
383
|
+
sustain: z.number().min(0).max(1),
|
|
384
|
+
/** Envelope release in ms. */
|
|
385
|
+
releaseMs: z.number().min(0),
|
|
386
|
+
/** Lowpass cutoff in Hz. */
|
|
387
|
+
cutoffHz: z.number().positive(),
|
|
388
|
+
/** Lowpass Q. */
|
|
389
|
+
resonance: z.number().positive(),
|
|
390
|
+
/** Output gain in dB. */
|
|
391
|
+
gainDb: z.number()
|
|
392
|
+
}),
|
|
393
|
+
z.object({
|
|
394
|
+
type: z.literal("wavetable"),
|
|
395
|
+
oscA: wavetableOscillator,
|
|
396
|
+
oscB: wavetableOscillator,
|
|
397
|
+
/** Sine sub-oscillator level, 0..1. */
|
|
398
|
+
subLevel: z.number().min(0).max(1),
|
|
399
|
+
/** Sub octave below the note: -1 or -2. */
|
|
400
|
+
subOctave: z.number().int().min(-2).max(-1),
|
|
401
|
+
/** White noise level, 0..1. */
|
|
402
|
+
noiseLevel: z.number().min(0).max(1),
|
|
403
|
+
filterType: midiFilterType,
|
|
404
|
+
cutoffHz: z.number().positive(),
|
|
405
|
+
/** Filter resonance, 0..1. */
|
|
406
|
+
resonance: z.number().min(0).max(1),
|
|
407
|
+
/** Anti-aliased tanh drive into the filter, 0..1. */
|
|
408
|
+
drive: z.number().min(0).max(1),
|
|
409
|
+
/** How far the mod envelope sweeps the cutoff, in octaves. */
|
|
410
|
+
filterEnvAmount: z.number(),
|
|
411
|
+
/** How far the played note tracks the cutoff, 0..1. */
|
|
412
|
+
keyTrack: z.number().min(0).max(1),
|
|
413
|
+
ampEnv: midiEnvelope,
|
|
414
|
+
modEnv: midiEnvelope,
|
|
415
|
+
gainDb: z.number()
|
|
416
|
+
}),
|
|
417
|
+
z.object({
|
|
418
|
+
type: z.literal("bass"),
|
|
419
|
+
table: midiWavetableName,
|
|
420
|
+
position: z.number().min(0).max(1),
|
|
421
|
+
/** Offset from the played note, in semitones. */
|
|
422
|
+
semitones: z.number(),
|
|
423
|
+
subShape: z.enum(["sine", "square"]),
|
|
424
|
+
/** Sub octave below the note: -1 or -2. */
|
|
425
|
+
subOctave: z.number().int().min(-2).max(-1),
|
|
426
|
+
subLevel: z.number().min(0).max(1),
|
|
427
|
+
filterType: midiFilterType,
|
|
428
|
+
cutoffHz: z.number().positive(),
|
|
429
|
+
resonance: z.number().min(0).max(1),
|
|
430
|
+
drive: z.number().min(0).max(1),
|
|
431
|
+
/** How far the filter envelope sweeps the cutoff, in octaves. */
|
|
432
|
+
filterEnvAmount: z.number(),
|
|
433
|
+
keyTrack: z.number().min(0).max(1),
|
|
434
|
+
filterAttackMs: z.number().min(0),
|
|
435
|
+
filterDecayMs: z.number().min(0),
|
|
436
|
+
ampEnv: midiEnvelope,
|
|
437
|
+
/** How much an accented note adds to its level and filter sweep, 0..1. */
|
|
438
|
+
accentAmount: z.number().min(0).max(1),
|
|
439
|
+
/** The velocity at which a note counts as accented. */
|
|
440
|
+
accentVelocity: z.number().int().min(1).max(127),
|
|
441
|
+
/** How long a note overlapping the one before it glides, in ms. */
|
|
442
|
+
slideMs: z.number().min(0),
|
|
443
|
+
gainDb: z.number()
|
|
444
|
+
}),
|
|
445
|
+
z.object({
|
|
446
|
+
type: z.literal("drum"),
|
|
447
|
+
/** The MIDI note pad 0 answers to. Pads run `baseNote`..`baseNote + 15`. */
|
|
448
|
+
baseNote: z.number().int().min(0).max(127),
|
|
449
|
+
pads: z.array(drumPad),
|
|
450
|
+
gainDb: z.number()
|
|
451
|
+
})
|
|
452
|
+
]);
|
|
453
|
+
/**
|
|
454
|
+
* Document-level constant tempo. Milliseconds stay the stored master clock —
|
|
455
|
+
* ticks are read against `bpm` — so changing the tempo rescales every midi
|
|
456
|
+
* clip's timing around `offsetMs` and leaves every other clip where it is.
|
|
457
|
+
*/
|
|
458
|
+
export const timelineTempo = z.object({
|
|
459
|
+
bpm: z.number().positive(),
|
|
460
|
+
/** Where beat one sits on the timeline, in ms. */
|
|
461
|
+
offsetMs: z.number().min(0),
|
|
462
|
+
timeSignature: z.object({
|
|
463
|
+
beatsPerBar: z.number().int().positive(),
|
|
464
|
+
beatUnit: z.number().int().positive()
|
|
465
|
+
})
|
|
466
|
+
});
|
|
467
|
+
export const timelineTrack = z.object({
|
|
468
|
+
id: z.string(),
|
|
469
|
+
name: z.string(),
|
|
470
|
+
type: z.enum(["video", "audio", "overlay", "subtitle", "midi"]),
|
|
471
|
+
index: z.number().int(),
|
|
472
|
+
folderId: z.string().optional(),
|
|
473
|
+
visible: z.boolean(),
|
|
474
|
+
locked: z.boolean(),
|
|
475
|
+
muted: z.boolean().optional(),
|
|
476
|
+
solo: z.boolean().optional(),
|
|
477
|
+
heightPx: z.number().optional(),
|
|
478
|
+
effects: z.array(trackEffect).optional(),
|
|
479
|
+
/** The voice a `midi` track plays; the track owns the instrument, not the
|
|
480
|
+
* clip. Without this field Zod strips it on every PATCH, so a track reverts
|
|
481
|
+
* to the default synth on the first autosave. */
|
|
482
|
+
instrument: midiInstrument.optional()
|
|
483
|
+
});
|
|
484
|
+
export const timelineTrackFolder = z.object({
|
|
485
|
+
id: z.string(),
|
|
486
|
+
name: z.string().min(1)
|
|
487
|
+
});
|
|
488
|
+
// ── Per-clip placement, transitions, and GPU effects ─────────────────────────
|
|
489
|
+
export const clipTransform = z.object({
|
|
490
|
+
position: z.object({ x: z.number(), y: z.number() }),
|
|
491
|
+
scale: z.object({ x: z.number(), y: z.number() }),
|
|
492
|
+
rotation: z.number(),
|
|
493
|
+
rotationX: z.number().optional(),
|
|
494
|
+
rotationY: z.number().optional(),
|
|
495
|
+
perspective: z.number().positive().optional(),
|
|
496
|
+
depthPx: z.number().optional(),
|
|
497
|
+
anchor: z.object({ x: z.number(), y: z.number() })
|
|
498
|
+
});
|
|
499
|
+
export const timelineCamera2d = z.object({
|
|
500
|
+
position: z.object({ x: z.number(), y: z.number() }),
|
|
501
|
+
depthPx: z.number(),
|
|
502
|
+
focalLengthPx: z.number().positive(),
|
|
503
|
+
focusDepthPx: z.number().optional(),
|
|
504
|
+
aperturePx: z.number().nonnegative().optional(),
|
|
505
|
+
keyframes: z.array(z.object({
|
|
506
|
+
timeMs: z.number(),
|
|
507
|
+
position: z.object({ x: z.number(), y: z.number() }),
|
|
508
|
+
depthPx: z.number(),
|
|
509
|
+
focusDepthPx: z.number().optional(),
|
|
510
|
+
aperturePx: z.number().nonnegative().optional()
|
|
511
|
+
})).optional()
|
|
512
|
+
});
|
|
513
|
+
export const clipLayout = z.object({
|
|
514
|
+
kind: z.enum(["row", "stack", "relative"]),
|
|
515
|
+
children: z.array(z.string()).optional(),
|
|
516
|
+
gapPx: z.number().optional(),
|
|
517
|
+
targetClipId: z.string().optional(),
|
|
518
|
+
side: z.enum(["left", "right", "above", "below", "center"]).optional(),
|
|
519
|
+
fitText: z.object({ paddingXPx: z.number(), paddingYPx: z.number() }).optional()
|
|
520
|
+
});
|
|
521
|
+
export const clipRepeater = z.object({
|
|
522
|
+
count: z.number().int().min(1).max(128),
|
|
523
|
+
positionStep: z.object({ x: z.number(), y: z.number() }),
|
|
524
|
+
columns: z.number().int().min(1).max(128).optional(),
|
|
525
|
+
rowStep: z.object({ x: z.number(), y: z.number() }).optional(),
|
|
526
|
+
timeStepMs: z.number(),
|
|
527
|
+
colorStep: z.object({ hueDegrees: z.number(), brightness: z.number().optional() }).optional()
|
|
528
|
+
});
|
|
529
|
+
/**
|
|
530
|
+
* Per-clip incoming transition. `easing` and `direction` are plain strings on
|
|
531
|
+
* the wire for the same forward compat `preset` has: a value this build cannot
|
|
532
|
+
* parse falls back rather than failing the document. Without the new members
|
|
533
|
+
* Zod strips the whole `transitionIn` of any non-crossfade transition on every
|
|
534
|
+
* PATCH, so the cut silently reverts to a hard one.
|
|
535
|
+
*/
|
|
536
|
+
const knownClipTransition = z.discriminatedUnion("type", [
|
|
537
|
+
z.object({
|
|
538
|
+
type: z.literal("crossfade"),
|
|
539
|
+
durationMs: z.number(),
|
|
540
|
+
easing: z.string().optional()
|
|
541
|
+
}),
|
|
542
|
+
z.object({
|
|
543
|
+
type: z.literal("dipToColor"),
|
|
544
|
+
durationMs: z.number(),
|
|
545
|
+
color: z.string(),
|
|
546
|
+
easing: z.string().optional()
|
|
547
|
+
}),
|
|
548
|
+
z.object({
|
|
549
|
+
type: z.literal("wipe"),
|
|
550
|
+
durationMs: z.number(),
|
|
551
|
+
direction: z.string(),
|
|
552
|
+
softness: z.number().optional(),
|
|
553
|
+
easing: z.string().optional()
|
|
554
|
+
}),
|
|
555
|
+
z.object({
|
|
556
|
+
type: z.literal("push"),
|
|
557
|
+
durationMs: z.number(),
|
|
558
|
+
direction: z.string(),
|
|
559
|
+
easing: z.string().optional()
|
|
560
|
+
}),
|
|
561
|
+
z.object({
|
|
562
|
+
type: z.literal("slide"),
|
|
563
|
+
durationMs: z.number(),
|
|
564
|
+
direction: z.string(),
|
|
565
|
+
easing: z.string().optional()
|
|
566
|
+
}),
|
|
567
|
+
z.object({
|
|
568
|
+
type: z.literal("zoom"),
|
|
569
|
+
durationMs: z.number(),
|
|
570
|
+
easing: z.string().optional()
|
|
571
|
+
}),
|
|
572
|
+
z.object({
|
|
573
|
+
type: z.literal("whip"), durationMs: z.number(), direction: z.string(), blur: z.number().optional(), easing: z.string().optional()
|
|
574
|
+
}),
|
|
575
|
+
z.object({
|
|
576
|
+
type: z.literal("zoomBlur"), durationMs: z.number(), blur: z.number().optional(), easing: z.string().optional()
|
|
577
|
+
}),
|
|
578
|
+
z.object({
|
|
579
|
+
type: z.literal("glitch"), durationMs: z.number(), amount: z.number().optional(), easing: z.string().optional()
|
|
580
|
+
}),
|
|
581
|
+
z.object({
|
|
582
|
+
type: z.literal("gradientWipe"), durationMs: z.number(), direction: z.string(), softness: z.number().optional(), map: z.enum(["linear", "radial", "noise"]).optional(), scale: z.number().optional(), seed: z.number().optional(), easing: z.string().optional()
|
|
583
|
+
}),
|
|
584
|
+
z.object({
|
|
585
|
+
type: z.literal("iris"), durationMs: z.number(), softness: z.number().optional(), easing: z.string().optional()
|
|
586
|
+
}),
|
|
587
|
+
z.object({
|
|
588
|
+
type: z.literal("lightLeak"), durationMs: z.number(), color: z.string().optional(), scale: z.number().optional(), seed: z.number().optional(), easing: z.string().optional()
|
|
589
|
+
})
|
|
590
|
+
]);
|
|
591
|
+
/**
|
|
592
|
+
* Every transition `type` the members above spell out field by field. Exported
|
|
593
|
+
* as a list so the agent tool schemas in `timeline-tool-params.ts` enumerate
|
|
594
|
+
* the same cuts this schema stores — an enum written out twice drifts.
|
|
595
|
+
*/
|
|
596
|
+
export const KNOWN_TRANSITION_TYPE_LIST = [
|
|
597
|
+
"crossfade",
|
|
598
|
+
"dipToColor",
|
|
599
|
+
"wipe",
|
|
600
|
+
"push",
|
|
601
|
+
"slide",
|
|
602
|
+
"zoom",
|
|
603
|
+
"whip",
|
|
604
|
+
"zoomBlur",
|
|
605
|
+
"glitch",
|
|
606
|
+
"gradientWipe",
|
|
607
|
+
"iris",
|
|
608
|
+
"lightLeak"
|
|
609
|
+
];
|
|
610
|
+
const KNOWN_TRANSITION_TYPES = new Set(KNOWN_TRANSITION_TYPE_LIST);
|
|
611
|
+
/**
|
|
612
|
+
* A cut authored by a newer build (I2). The `refine` is what keeps the two
|
|
613
|
+
* halves disjoint: a type one of the members above claims can never reach this
|
|
614
|
+
* one, so `crossfade` with a string `durationMs` still fails rather than
|
|
615
|
+
* sliding into the permissive branch. Everything past the shared shape rides
|
|
616
|
+
* through untyped — dropping it here would lose the newer build's parameters
|
|
617
|
+
* on the first save, which is the data loss `field_stripped` reports.
|
|
618
|
+
*/
|
|
619
|
+
const forwardClipTransition = z.looseObject({
|
|
620
|
+
// `abort` is what keeps the failure legible: without it a bad field on a
|
|
621
|
+
// known type leaves this the only branch Zod reports, so the error reads
|
|
622
|
+
// "unknown type" about a type we ship.
|
|
623
|
+
type: z.string().refine((type) => !KNOWN_TRANSITION_TYPES.has(type), {
|
|
624
|
+
abort: true,
|
|
625
|
+
error: (issue) => `"${String(issue.input)}" is a transition type this build declares; it must match that type's own fields.`
|
|
626
|
+
}),
|
|
627
|
+
durationMs: z.number(),
|
|
628
|
+
easing: z.string().optional()
|
|
629
|
+
});
|
|
630
|
+
export const clipTransition = z.union([
|
|
631
|
+
knownClipTransition,
|
|
632
|
+
forwardClipTransition
|
|
633
|
+
]);
|
|
634
|
+
export const clipColorEffect = z.object({
|
|
635
|
+
id: z.string(),
|
|
636
|
+
type: z.literal("color"),
|
|
637
|
+
enabled: z.boolean(),
|
|
638
|
+
brightness: z.number().optional(),
|
|
639
|
+
contrast: z.number().optional(),
|
|
640
|
+
saturation: z.number().optional(),
|
|
641
|
+
hue: z.number().optional(),
|
|
642
|
+
temperature: z.number().optional(),
|
|
643
|
+
tint: z.number().optional(),
|
|
644
|
+
shadows: z.number().optional(),
|
|
645
|
+
highlights: z.number().optional()
|
|
646
|
+
});
|
|
647
|
+
export const clipBlurEffect = z.object({
|
|
648
|
+
id: z.string(),
|
|
649
|
+
type: z.literal("blur"),
|
|
650
|
+
enabled: z.boolean(),
|
|
651
|
+
radius: z.number(),
|
|
652
|
+
sigma: z.number().optional()
|
|
653
|
+
});
|
|
654
|
+
export const clipPixelateEffect = z.object({
|
|
655
|
+
id: z.string(),
|
|
656
|
+
type: z.literal("pixelate"),
|
|
657
|
+
enabled: z.boolean(),
|
|
658
|
+
cellSize: z.number().min(1).max(128)
|
|
659
|
+
});
|
|
660
|
+
export const clipPosterizeEffect = z.object({
|
|
661
|
+
id: z.string(),
|
|
662
|
+
type: z.literal("posterize"),
|
|
663
|
+
enabled: z.boolean(),
|
|
664
|
+
levels: z.number().min(2).max(256)
|
|
665
|
+
});
|
|
666
|
+
export const clipDirectionalBlurEffect = z.object({
|
|
667
|
+
id: z.string(),
|
|
668
|
+
type: z.literal("directionalBlur"),
|
|
669
|
+
enabled: z.boolean(),
|
|
670
|
+
radius: z.number().min(0).max(256),
|
|
671
|
+
angle: z.number()
|
|
672
|
+
});
|
|
673
|
+
export const clipLensDistortionEffect = z.object({
|
|
674
|
+
id: z.string(),
|
|
675
|
+
type: z.literal("lensDistortion"),
|
|
676
|
+
enabled: z.boolean(),
|
|
677
|
+
amount: z.number().min(-1).max(1)
|
|
678
|
+
});
|
|
679
|
+
export const clipStylizeEffect = z.object({
|
|
680
|
+
id: z.string(),
|
|
681
|
+
type: z.literal("stylize"),
|
|
682
|
+
enabled: z.boolean(),
|
|
683
|
+
mode: z.enum(["rgbSplit", "radialBlur", "zoomBlur", "turbulence", "glitch", "halftone", "dither", "lightRays", "lensFlare", "innerShadow", "innerGlow", "edgeHighlight", "displacement", "gradientWipe", "lightLeakOverlay"]),
|
|
684
|
+
amount: z.number(),
|
|
685
|
+
scale: z.number().optional(),
|
|
686
|
+
angle: z.number().optional(),
|
|
687
|
+
time: z.number().optional(),
|
|
688
|
+
animate: z.boolean().optional(),
|
|
689
|
+
seed: z.number().optional(),
|
|
690
|
+
color: z.string().optional(),
|
|
691
|
+
softness: z.number().optional()
|
|
692
|
+
});
|
|
693
|
+
export const clipGeneratorEffect = z.object({
|
|
694
|
+
id: z.string(),
|
|
695
|
+
type: z.literal("generator"),
|
|
696
|
+
enabled: z.boolean(),
|
|
697
|
+
mode: z.enum(["noise", "fractal", "conicGradient", "meshGradient", "gradientField", "particles", "lightLeak", "gridPattern"]),
|
|
698
|
+
amount: z.number().optional(),
|
|
699
|
+
scale: z.number().optional(),
|
|
700
|
+
angle: z.number().optional(),
|
|
701
|
+
time: z.number().optional(),
|
|
702
|
+
animate: z.boolean().optional(),
|
|
703
|
+
seed: z.number().optional(),
|
|
704
|
+
colorA: z.string().optional(),
|
|
705
|
+
colorB: z.string().optional()
|
|
706
|
+
});
|
|
707
|
+
export const clipLutEffect = z.object({
|
|
708
|
+
id: z.string(),
|
|
709
|
+
type: z.literal("lut"),
|
|
710
|
+
enabled: z.boolean(),
|
|
711
|
+
cube: z.string().min(1),
|
|
712
|
+
intensity: z.number().min(0).max(1).optional()
|
|
713
|
+
});
|
|
714
|
+
/** One control point of a tone curve. Both axes are normalized 0..1. */
|
|
715
|
+
export const curvePoint = z.object({ x: z.number(), y: z.number() });
|
|
716
|
+
export const clipGlowEffect = z.object({
|
|
717
|
+
id: z.string(),
|
|
718
|
+
type: z.literal("glow"),
|
|
719
|
+
enabled: z.boolean(),
|
|
720
|
+
radius: z.number(),
|
|
721
|
+
intensity: z.number(),
|
|
722
|
+
color: z.string().optional()
|
|
723
|
+
});
|
|
724
|
+
export const clipDropShadowEffect = z.object({
|
|
725
|
+
id: z.string(),
|
|
726
|
+
type: z.literal("dropShadow"),
|
|
727
|
+
enabled: z.boolean(),
|
|
728
|
+
offsetX: z.number(),
|
|
729
|
+
offsetY: z.number(),
|
|
730
|
+
blur: z.number(),
|
|
731
|
+
color: z.string(),
|
|
732
|
+
opacity: z.number().optional()
|
|
733
|
+
});
|
|
734
|
+
export const clipVignetteEffect = z.object({
|
|
735
|
+
id: z.string(),
|
|
736
|
+
type: z.literal("vignette"),
|
|
737
|
+
enabled: z.boolean(),
|
|
738
|
+
amount: z.number(),
|
|
739
|
+
softness: z.number(),
|
|
740
|
+
/** Absent means the shader's own default. Mirrors ClipVignetteEffect.radius. */
|
|
741
|
+
radius: z.number().optional()
|
|
742
|
+
});
|
|
743
|
+
export const clipSharpenEffect = z.object({
|
|
744
|
+
id: z.string(),
|
|
745
|
+
type: z.literal("sharpen"),
|
|
746
|
+
enabled: z.boolean(),
|
|
747
|
+
amount: z.number(),
|
|
748
|
+
radius: z.number().optional(),
|
|
749
|
+
/** Absent means the shader's own default. Mirrors ClipSharpenEffect.threshold. */
|
|
750
|
+
threshold: z.number().optional()
|
|
751
|
+
});
|
|
752
|
+
export const clipChromaKeyEffect = z.object({
|
|
753
|
+
id: z.string(),
|
|
754
|
+
type: z.literal("chromaKey"),
|
|
755
|
+
enabled: z.boolean(),
|
|
756
|
+
color: z.string(),
|
|
757
|
+
tolerance: z.number(),
|
|
758
|
+
softness: z.number(),
|
|
759
|
+
spill: z.number().optional()
|
|
760
|
+
});
|
|
761
|
+
export const clipCurvesEffect = z.object({
|
|
762
|
+
id: z.string(),
|
|
763
|
+
type: z.literal("curves"),
|
|
764
|
+
enabled: z.boolean(),
|
|
765
|
+
master: z.array(curvePoint),
|
|
766
|
+
r: z.array(curvePoint).optional(),
|
|
767
|
+
g: z.array(curvePoint).optional(),
|
|
768
|
+
b: z.array(curvePoint).optional()
|
|
769
|
+
});
|
|
770
|
+
export const clipLevelsEffect = z.object({
|
|
771
|
+
id: z.string(),
|
|
772
|
+
type: z.literal("levels"),
|
|
773
|
+
enabled: z.boolean(),
|
|
774
|
+
inBlack: z.number(),
|
|
775
|
+
inWhite: z.number(),
|
|
776
|
+
gamma: z.number(),
|
|
777
|
+
outBlack: z.number(),
|
|
778
|
+
outWhite: z.number()
|
|
779
|
+
});
|
|
780
|
+
const rgbTriple = z.tuple([z.number(), z.number(), z.number()]);
|
|
781
|
+
export const clipLiftGammaGainEffect = z.object({
|
|
782
|
+
id: z.string(),
|
|
783
|
+
type: z.literal("liftGammaGain"),
|
|
784
|
+
enabled: z.boolean(),
|
|
785
|
+
lift: rgbTriple,
|
|
786
|
+
gamma: rgbTriple,
|
|
787
|
+
gain: rgbTriple
|
|
788
|
+
});
|
|
789
|
+
/** Mirrors ClipGrainEffect. Absent knobs mean `filters.grain@1`'s own defaults. */
|
|
790
|
+
export const clipGrainEffect = z.object({
|
|
791
|
+
id: z.string(),
|
|
792
|
+
type: z.literal("grain"),
|
|
793
|
+
enabled: z.boolean(),
|
|
794
|
+
amount: z.number(),
|
|
795
|
+
size: z.number().optional(),
|
|
796
|
+
colorAmount: z.number().optional(),
|
|
797
|
+
animate: z.boolean().optional(),
|
|
798
|
+
seed: z.number().optional()
|
|
799
|
+
});
|
|
800
|
+
/**
|
|
801
|
+
* The clip effect chain. Without the members below Zod drops any effect whose
|
|
802
|
+
* type it does not carry on every PATCH, so a graded clip loses that step of
|
|
803
|
+
* its chain on the next save.
|
|
804
|
+
*/
|
|
805
|
+
const knownClipEffect = z.discriminatedUnion("type", [
|
|
806
|
+
clipColorEffect,
|
|
807
|
+
clipBlurEffect,
|
|
808
|
+
clipPixelateEffect,
|
|
809
|
+
clipPosterizeEffect,
|
|
810
|
+
clipDirectionalBlurEffect,
|
|
811
|
+
clipLensDistortionEffect,
|
|
812
|
+
clipStylizeEffect,
|
|
813
|
+
clipGeneratorEffect,
|
|
814
|
+
clipLutEffect,
|
|
815
|
+
clipGlowEffect,
|
|
816
|
+
clipDropShadowEffect,
|
|
817
|
+
clipVignetteEffect,
|
|
818
|
+
clipSharpenEffect,
|
|
819
|
+
clipChromaKeyEffect,
|
|
820
|
+
clipCurvesEffect,
|
|
821
|
+
clipLevelsEffect,
|
|
822
|
+
clipLiftGammaGainEffect,
|
|
823
|
+
clipGrainEffect
|
|
824
|
+
]);
|
|
825
|
+
/**
|
|
826
|
+
* Every effect `type` the members above spell out field by field. Exported as
|
|
827
|
+
* a list for the same reason {@link KNOWN_TRANSITION_TYPE_LIST} is.
|
|
828
|
+
*/
|
|
829
|
+
export const KNOWN_CLIP_EFFECT_TYPE_LIST = [
|
|
830
|
+
"color",
|
|
831
|
+
"blur",
|
|
832
|
+
"pixelate",
|
|
833
|
+
"posterize",
|
|
834
|
+
"directionalBlur",
|
|
835
|
+
"lensDistortion",
|
|
836
|
+
"stylize",
|
|
837
|
+
"generator",
|
|
838
|
+
"lut",
|
|
839
|
+
"glow",
|
|
840
|
+
"dropShadow",
|
|
841
|
+
"vignette",
|
|
842
|
+
"sharpen",
|
|
843
|
+
"chromaKey",
|
|
844
|
+
"curves",
|
|
845
|
+
"levels",
|
|
846
|
+
"liftGammaGain",
|
|
847
|
+
"grain"
|
|
848
|
+
];
|
|
849
|
+
const KNOWN_CLIP_EFFECT_TYPES = new Set(KNOWN_CLIP_EFFECT_TYPE_LIST);
|
|
850
|
+
/**
|
|
851
|
+
* An effect authored by a newer build (I2), same construction as
|
|
852
|
+
* `forwardClipTransition`: the `refine` keeps this branch unreachable for a
|
|
853
|
+
* type the members above claim, so their field validation is untouched, and
|
|
854
|
+
* the parameters the newer build wrote ride through instead of being dropped
|
|
855
|
+
* on the next save. `id` and `enabled` are required because the whole chain is
|
|
856
|
+
* addressed and filtered by them.
|
|
857
|
+
*/
|
|
858
|
+
const forwardClipEffect = z.looseObject({
|
|
859
|
+
id: z.string(),
|
|
860
|
+
type: z.string().refine((type) => !KNOWN_CLIP_EFFECT_TYPES.has(type), {
|
|
861
|
+
abort: true,
|
|
862
|
+
error: (issue) => `"${String(issue.input)}" is an effect type this build declares; it must match that type's own fields.`
|
|
863
|
+
}),
|
|
864
|
+
enabled: z.boolean()
|
|
865
|
+
});
|
|
866
|
+
export const clipEffect = z.union([knownClipEffect, forwardClipEffect]);
|
|
867
|
+
export const clipBindingKind = z.enum([
|
|
868
|
+
"workflow",
|
|
869
|
+
"text-to-image",
|
|
870
|
+
"image-to-image",
|
|
871
|
+
"text-to-video",
|
|
872
|
+
"text-to-music",
|
|
873
|
+
"text-to-audio"
|
|
874
|
+
]);
|
|
875
|
+
// ── Motion-design animations ─────────────────────────────────────────────────
|
|
876
|
+
/**
|
|
877
|
+
* One keyframe of a baked custom-animation curve. `t` is normalized 0..1
|
|
878
|
+
* within the animation window; `easing` names the segment ENDING at this
|
|
879
|
+
* keyframe and is a plain string for the same forward compat as `preset`.
|
|
880
|
+
*
|
|
881
|
+
* On a `timeBase: "source"` curve the keyframe is placed by `sourceMs` — an
|
|
882
|
+
* absolute time in the media — and `t` is derived from it, which is why `t`
|
|
883
|
+
* defaults rather than being required there.
|
|
884
|
+
*/
|
|
885
|
+
export const animationKeyframe = z.object({
|
|
886
|
+
t: z.number().default(0),
|
|
887
|
+
value: z.number(),
|
|
888
|
+
easing: z.string().optional(),
|
|
889
|
+
/**
|
|
890
|
+
* Absolute source-media time in ms. Required on every keyframe of a
|
|
891
|
+
* source-anchored curve (non-negative and non-decreasing along the curve,
|
|
892
|
+
* enforced by `normalizeCustomCurves`); ignored on a clip-based one.
|
|
893
|
+
*/
|
|
894
|
+
sourceMs: z.number().optional()
|
|
895
|
+
});
|
|
896
|
+
/**
|
|
897
|
+
* One baked property curve. `property` is a plain string on the wire: a curve
|
|
898
|
+
* naming a property this build does not animate parses fine and is dropped at
|
|
899
|
+
* compile time, the same forward compat `preset` has.
|
|
900
|
+
*/
|
|
901
|
+
export const animationPropertyCurve = z.object({
|
|
902
|
+
property: z.string(),
|
|
903
|
+
/**
|
|
904
|
+
* Bounded to `MAX_CUSTOM_KEYFRAMES` in
|
|
905
|
+
* `packages/timeline/src/animation/custom.ts` — a curve the bake would refuse
|
|
906
|
+
* must not be storable through the wire either. `packages/timeline` depends
|
|
907
|
+
* on this package, so the two are pinned equal by
|
|
908
|
+
* `packages/execution/tests/timeline-schema-bounds.test.ts` rather than by an
|
|
909
|
+
* import.
|
|
910
|
+
*/
|
|
911
|
+
keyframes: z.array(animationKeyframe).max(4096)
|
|
912
|
+
});
|
|
913
|
+
/**
|
|
914
|
+
* A custom animation: curves produced by a JS body rather than by a shipped
|
|
915
|
+
* preset. The body runs ONCE, host-side in the QuickJS sandbox, and its
|
|
916
|
+
* keyframes are baked in here — so playback, export, and the headless
|
|
917
|
+
* compositor sample identical curves and no renderer needs a JS engine.
|
|
918
|
+
*
|
|
919
|
+
* `scriptId`/`code` are provenance: they say what produced `curves` so the
|
|
920
|
+
* editor can re-bake, and are never executed at render time.
|
|
921
|
+
*/
|
|
922
|
+
export const customClipAnimation = z.object({
|
|
923
|
+
/** JS script document (`js_scripts` row) the curves were baked from. */
|
|
924
|
+
scriptId: z.string().optional(),
|
|
925
|
+
/** Inline body the curves were baked from. */
|
|
926
|
+
code: z.string().optional(),
|
|
927
|
+
/** ISO timestamp of the bake that produced `curves`. */
|
|
928
|
+
bakedAt: z.string().optional(),
|
|
929
|
+
/**
|
|
930
|
+
* Clock the keyframes are placed on: `"clip"` (default) normalizes `t` over
|
|
931
|
+
* the animation window, `"source"` places every keyframe at an absolute
|
|
932
|
+
* `sourceMs` in the media so the motion tracks the footage through speed,
|
|
933
|
+
* in-point and time remap — and a trim or split re-slices the curve instead
|
|
934
|
+
* of stretching it.
|
|
935
|
+
*/
|
|
936
|
+
timeBase: z.enum(["clip", "source"]).optional(),
|
|
937
|
+
/** Bounded to `MAX_CUSTOM_CURVES`; see `animationPropertyCurve.keyframes`. */
|
|
938
|
+
curves: z.array(animationPropertyCurve).max(16),
|
|
939
|
+
/**
|
|
940
|
+
* Required when a curve drives `wipeProgress`: direction and softness never
|
|
941
|
+
* animate, so they ride here rather than on a curve.
|
|
942
|
+
*/
|
|
943
|
+
mask: z.object({ direction: z.string(), softness: z.number() }).optional(),
|
|
944
|
+
/**
|
|
945
|
+
* What produced these curves when a hand edit did not — an audio bake, a
|
|
946
|
+
* tracker. Provenance to re-bake from, never something to execute, so `kind`
|
|
947
|
+
* is a plain string the way `preset` is.
|
|
948
|
+
*/
|
|
949
|
+
bakedFrom: z
|
|
950
|
+
.object({
|
|
951
|
+
kind: z.string(),
|
|
952
|
+
clipId: z.string().optional(),
|
|
953
|
+
assetId: z.string().optional(),
|
|
954
|
+
settings: z
|
|
955
|
+
.record(z.string(), z.union([z.number(), z.string(), z.boolean()]))
|
|
956
|
+
.optional()
|
|
957
|
+
})
|
|
958
|
+
.optional()
|
|
959
|
+
});
|
|
960
|
+
/**
|
|
961
|
+
* `POST /api/timelines/animations/bake` — run a custom animation's JS body once
|
|
962
|
+
* and get back the keyframes to store on the clip. Exactly one of `code` and
|
|
963
|
+
* `script_id` names the body; the rest is the context the body reads off
|
|
964
|
+
* `inputs` (see `buildCustomAnimationInputs` in `@nodetool-ai/timeline`).
|
|
965
|
+
*/
|
|
966
|
+
export const bakeCustomAnimationRequest = z
|
|
967
|
+
.object({
|
|
968
|
+
code: z.string().min(1).optional(),
|
|
969
|
+
script_id: z.string().min(1).optional(),
|
|
970
|
+
role: z.enum(["in", "out", "emphasis", "loop"]),
|
|
971
|
+
duration_ms: z.number().positive(),
|
|
972
|
+
clip_duration_ms: z.number().positive(),
|
|
973
|
+
canvas: z.object({
|
|
974
|
+
width: z.number().positive(),
|
|
975
|
+
height: z.number().positive()
|
|
976
|
+
}),
|
|
977
|
+
params: z
|
|
978
|
+
.record(z.string(), z.union([z.number(), z.string(), z.boolean()]))
|
|
979
|
+
.optional(),
|
|
980
|
+
stagger_count: z.number().int().nonnegative().optional(),
|
|
981
|
+
sample_count: z.number().int().positive().optional()
|
|
982
|
+
})
|
|
983
|
+
.refine((body) => (body.code === undefined) !== (body.script_id === undefined), { message: "Pass exactly one of `code` or `script_id`" });
|
|
984
|
+
export const bakeCustomAnimationResponse = z.object({
|
|
985
|
+
ok: z.boolean(),
|
|
986
|
+
/** Present only when `ok`. Store these under the animation's `custom`. */
|
|
987
|
+
curves: z.array(animationPropertyCurve).optional(),
|
|
988
|
+
mask: z.object({ direction: z.string(), softness: z.number() }).optional(),
|
|
989
|
+
logs: z.array(z.string()),
|
|
990
|
+
error: z.string().optional(),
|
|
991
|
+
duration_ms: z.number()
|
|
992
|
+
});
|
|
993
|
+
/**
|
|
994
|
+
* One motion-design animation attached to a clip. `preset` and `easing` are
|
|
995
|
+
* plain strings on the wire by design (forward compat): a document saved by a
|
|
996
|
+
* newer client may carry ids this build doesn't know — they parse fine and are
|
|
997
|
+
* skipped at compile time. Validation of preset/role is the engine's job, not
|
|
998
|
+
* the schema's. Without this field on the clip schema Zod would strip
|
|
999
|
+
* `animations` on every PATCH, silently losing motion on save.
|
|
1000
|
+
*/
|
|
1001
|
+
export const clipAnimation = z.object({
|
|
1002
|
+
id: z.string(),
|
|
1003
|
+
role: z.enum(["in", "out", "emphasis", "loop"]),
|
|
1004
|
+
preset: z.string(),
|
|
1005
|
+
/** A zero or negative window has no frames to fill. (`z.number()` already
|
|
1006
|
+
* refuses NaN and Infinity, so `delayMs` needs no bound of its own —
|
|
1007
|
+
* `packages/execution/tests/timeline-schema-bounds.test.ts` pins that.) */
|
|
1008
|
+
durationMs: z.number().positive(),
|
|
1009
|
+
delayMs: z.number().optional(),
|
|
1010
|
+
beat: z.object({
|
|
1011
|
+
index: z.number().int().min(1),
|
|
1012
|
+
scope: z.enum(["clip", "sequence"]),
|
|
1013
|
+
offsetMs: z.number().optional()
|
|
1014
|
+
}).optional(),
|
|
1015
|
+
easing: z.string().optional(),
|
|
1016
|
+
enabled: z.boolean().optional(),
|
|
1017
|
+
params: z
|
|
1018
|
+
.record(z.string(), z.union([z.number(), z.string(), z.boolean()]))
|
|
1019
|
+
.optional(),
|
|
1020
|
+
/** Baked curves for a `"custom"` preset animation. Without this field Zod
|
|
1021
|
+
* strips it on every PATCH, silently reverting custom motion to nothing on
|
|
1022
|
+
* save. */
|
|
1023
|
+
custom: customClipAnimation.optional(),
|
|
1024
|
+
styleTracks: z.array(z.object({
|
|
1025
|
+
target: z.string().min(1),
|
|
1026
|
+
keyframes: z.array(z.object({
|
|
1027
|
+
t: z.number().min(0).max(1),
|
|
1028
|
+
value: z.union([z.number(), z.string()]),
|
|
1029
|
+
easing: z.string().optional()
|
|
1030
|
+
})).min(2).max(4096)
|
|
1031
|
+
})).max(32).optional(),
|
|
1032
|
+
textAnimator: z.union([
|
|
1033
|
+
z.object({
|
|
1034
|
+
kind: z.literal("ticker"),
|
|
1035
|
+
from: z.number(),
|
|
1036
|
+
to: z.number(),
|
|
1037
|
+
decimals: z.number().int().min(0).max(6).optional(),
|
|
1038
|
+
padTo: z.number().int().min(0).max(32).optional(),
|
|
1039
|
+
groupSeparator: z.string().min(1).max(4).optional(),
|
|
1040
|
+
prefix: z.string().optional(),
|
|
1041
|
+
suffix: z.string().optional()
|
|
1042
|
+
}),
|
|
1043
|
+
z.object({
|
|
1044
|
+
kind: z.literal("scramble"),
|
|
1045
|
+
charset: z.string().min(1).max(128).optional(),
|
|
1046
|
+
seed: z.number().optional()
|
|
1047
|
+
})
|
|
1048
|
+
]).optional(),
|
|
1049
|
+
/** Per-unit stagger on a text clip's animation. `unit` is a plain string on
|
|
1050
|
+
* the wire (word, character and line are implemented; unknown units compile un-staggered)
|
|
1051
|
+
* for the same forward compat as `preset`. Without this field Zod strips it
|
|
1052
|
+
* on every PATCH, silently flattening staggered titles into block motion. */
|
|
1053
|
+
stagger: z
|
|
1054
|
+
.object({
|
|
1055
|
+
unit: z.string(),
|
|
1056
|
+
offsetMs: z.number(),
|
|
1057
|
+
from: z.enum(["start", "end", "center"]).optional()
|
|
1058
|
+
})
|
|
1059
|
+
.optional(),
|
|
1060
|
+
caret: z.object({
|
|
1061
|
+
color: z.string(),
|
|
1062
|
+
widthPx: z.number().positive(),
|
|
1063
|
+
blinkPeriodMs: z.number().positive()
|
|
1064
|
+
}).optional()
|
|
1065
|
+
});
|
|
1066
|
+
/**
|
|
1067
|
+
* How a shape or a text run is filled. Stop offsets are normalized 0..1, so a
|
|
1068
|
+
* fill is independent of the shape's size.
|
|
1069
|
+
*/
|
|
1070
|
+
export const shapeFill = z.discriminatedUnion("type", [
|
|
1071
|
+
z.object({ type: z.literal("solid"), color: z.string() }),
|
|
1072
|
+
z.object({
|
|
1073
|
+
type: z.literal("linear"),
|
|
1074
|
+
angle: z.number(),
|
|
1075
|
+
stops: z.array(z.object({ offset: z.number(), color: z.string() }))
|
|
1076
|
+
}),
|
|
1077
|
+
z.object({
|
|
1078
|
+
type: z.literal("radial"),
|
|
1079
|
+
stops: z.array(z.object({ offset: z.number(), color: z.string() }))
|
|
1080
|
+
})
|
|
1081
|
+
]);
|
|
1082
|
+
export const clipTextStyle = z.object({
|
|
1083
|
+
text: z.string(),
|
|
1084
|
+
path: z.string().optional(),
|
|
1085
|
+
fontFamily: z.string().optional(),
|
|
1086
|
+
fontSizePx: z.number(),
|
|
1087
|
+
fontWeight: z.number().optional(),
|
|
1088
|
+
color: z.string(),
|
|
1089
|
+
align: z.enum(["left", "center", "right"]).optional(),
|
|
1090
|
+
maxWidthFrac: z.number().optional(),
|
|
1091
|
+
/** Every field below is styling the rasterizer reads. Without them Zod
|
|
1092
|
+
* strips the styling on every PATCH, so a stroked, shadowed or backed title
|
|
1093
|
+
* reverts to plain fill on the next save. */
|
|
1094
|
+
fontStyle: z.string().optional(),
|
|
1095
|
+
letterSpacingPx: z.number().optional(),
|
|
1096
|
+
lineHeight: z.number().optional(),
|
|
1097
|
+
verticalAlign: z.string().optional(),
|
|
1098
|
+
stroke: z.object({ color: z.string(), widthPx: z.number() }).optional(),
|
|
1099
|
+
shadow: z
|
|
1100
|
+
.object({
|
|
1101
|
+
color: z.string(),
|
|
1102
|
+
blurPx: z.number(),
|
|
1103
|
+
offsetX: z.number(),
|
|
1104
|
+
offsetY: z.number()
|
|
1105
|
+
})
|
|
1106
|
+
.optional(),
|
|
1107
|
+
background: z
|
|
1108
|
+
.object({
|
|
1109
|
+
color: z.string(),
|
|
1110
|
+
paddingPx: z.number(),
|
|
1111
|
+
radiusPx: z.number().optional()
|
|
1112
|
+
})
|
|
1113
|
+
.optional(),
|
|
1114
|
+
fill: shapeFill.optional()
|
|
1115
|
+
});
|
|
1116
|
+
export const clipShapeStyle = z.object({
|
|
1117
|
+
/** A plain string for forward compat (I2): a kind a newer build authored
|
|
1118
|
+
* parses and is skipped at render time — the geometry builder returns no
|
|
1119
|
+
* outline and the validator reports `unknown_shape_kind` — rather than
|
|
1120
|
+
* failing the whole document. */
|
|
1121
|
+
kind: z.string(),
|
|
1122
|
+
fill: z.union([z.string(), shapeFill]).optional(),
|
|
1123
|
+
stroke: z.string().optional(),
|
|
1124
|
+
strokeWidthPx: z.number().optional(),
|
|
1125
|
+
x: z.number().optional(),
|
|
1126
|
+
y: z.number().optional(),
|
|
1127
|
+
width: z.number().optional(),
|
|
1128
|
+
height: z.number().optional(),
|
|
1129
|
+
x2: z.number().optional(),
|
|
1130
|
+
y2: z.number().optional(),
|
|
1131
|
+
/** Every field below is authored geometry. Without them Zod strips the
|
|
1132
|
+
* geometry on every PATCH, so a path, gradient, dash or trim reverts to a
|
|
1133
|
+
* plain filled box on the next save. */
|
|
1134
|
+
d: z.string().optional(),
|
|
1135
|
+
sides: z.number().optional(),
|
|
1136
|
+
innerRadius: z.number().optional(),
|
|
1137
|
+
cornerRadius: z.number().optional(),
|
|
1138
|
+
fillStyle: shapeFill.optional(),
|
|
1139
|
+
dash: z.array(z.number()).optional(),
|
|
1140
|
+
lineCap: z.string().optional(),
|
|
1141
|
+
lineJoin: z.string().optional(),
|
|
1142
|
+
trimStart: z.number().optional(),
|
|
1143
|
+
trimEnd: z.number().optional()
|
|
1144
|
+
});
|
|
1145
|
+
/**
|
|
1146
|
+
* How a `model3d` clip frames its glTF. `orbit` frames the model's bounding
|
|
1147
|
+
* sphere in the vocabulary `nodetool.model3d.RenderToImage`, the Blender bake
|
|
1148
|
+
* and the model editor's pose already share; `scene` uses a camera the glTF
|
|
1149
|
+
* itself declares and ignores the orbit terms.
|
|
1150
|
+
*/
|
|
1151
|
+
export const clipModel3DCamera = z.object({
|
|
1152
|
+
mode: z.enum(["orbit", "scene"]),
|
|
1153
|
+
azimuthDeg: z.number(),
|
|
1154
|
+
elevationDeg: z.number(),
|
|
1155
|
+
fovDeg: z.number(),
|
|
1156
|
+
/** Distance multiplier on the auto-framed fit: above 1 moves closer. */
|
|
1157
|
+
zoom: z.number(),
|
|
1158
|
+
/** Look-at offset from the bounding-sphere center, in world units. */
|
|
1159
|
+
targetOffset: z.tuple([z.number(), z.number(), z.number()]).optional(),
|
|
1160
|
+
/** `scene` mode: the glTF camera's name; the first camera when absent. */
|
|
1161
|
+
sceneCameraName: z.string().optional()
|
|
1162
|
+
});
|
|
1163
|
+
/** Which glTF animation a `model3d` clip plays, and how. */
|
|
1164
|
+
export const clipModel3DAnimation = z.object({
|
|
1165
|
+
/** glTF animation name; every animation plays when absent. */
|
|
1166
|
+
clipName: z.string().optional(),
|
|
1167
|
+
loop: z.boolean(),
|
|
1168
|
+
/** Playback multiplier on top of the clip's own speed and time remap. */
|
|
1169
|
+
speed: z.number()
|
|
1170
|
+
});
|
|
1171
|
+
/**
|
|
1172
|
+
* Everything a `model3d` clip adds on top of its glTF asset, which lives in
|
|
1173
|
+
* `currentAssetId` exactly the way an image clip keeps its image. Every field
|
|
1174
|
+
* below has to be listed here or Zod strips it on every PATCH, so a camera
|
|
1175
|
+
* pose, an animation choice or a finished bake would be lost on the next save.
|
|
1176
|
+
*/
|
|
1177
|
+
export const clipModel3DStyle = z.object({
|
|
1178
|
+
camera: clipModel3DCamera,
|
|
1179
|
+
animation: clipModel3DAnimation,
|
|
1180
|
+
lighting: z.enum(["studio", "soft", "flat"]),
|
|
1181
|
+
lightIntensity: z.number(),
|
|
1182
|
+
background: z.discriminatedUnion("transparent", [
|
|
1183
|
+
z.object({ transparent: z.literal(true) }),
|
|
1184
|
+
z.object({ transparent: z.literal(false), color: z.string() })
|
|
1185
|
+
]),
|
|
1186
|
+
/**
|
|
1187
|
+
* A Blender render of this clip at a given style. The scene model plays it
|
|
1188
|
+
* as video while `dependencyHash` matches the live style; a style edit makes
|
|
1189
|
+
* it stale and the live 3D layer draws again.
|
|
1190
|
+
*/
|
|
1191
|
+
bake: z.object({ assetId: z.string(), dependencyHash: z.string() }).optional()
|
|
1192
|
+
});
|
|
1193
|
+
/**
|
|
1194
|
+
* The part of the source a clip keeps, as the fraction of each edge dropped.
|
|
1195
|
+
* Mirrors ClipCrop: a crop reframes (the kept rectangle becomes the picture and
|
|
1196
|
+
* is re-fit to the canvas), where `clipMask` with `kind: "rect"` hides part of
|
|
1197
|
+
* a layer that stays put.
|
|
1198
|
+
*/
|
|
1199
|
+
export const clipCrop = z.object({
|
|
1200
|
+
left: z.number(),
|
|
1201
|
+
right: z.number(),
|
|
1202
|
+
top: z.number(),
|
|
1203
|
+
bottom: z.number()
|
|
1204
|
+
});
|
|
1205
|
+
/**
|
|
1206
|
+
* Shape mask on one clip, in the layer's own normalized 0..1 space. `kind` is
|
|
1207
|
+
* a plain string for forward compat: an unknown kind parses and is skipped at
|
|
1208
|
+
* render time rather than failing the document.
|
|
1209
|
+
*/
|
|
1210
|
+
export const clipMask = z.object({
|
|
1211
|
+
kind: z.string(),
|
|
1212
|
+
x: z.number().optional(),
|
|
1213
|
+
y: z.number().optional(),
|
|
1214
|
+
width: z.number().optional(),
|
|
1215
|
+
height: z.number().optional(),
|
|
1216
|
+
radiusPx: z.number().nonnegative().optional(),
|
|
1217
|
+
d: z.string().optional(),
|
|
1218
|
+
featherPx: z.number().optional(),
|
|
1219
|
+
invert: z.boolean().optional()
|
|
1220
|
+
});
|
|
1221
|
+
/** Track matte: another clip's alpha or luma drives this layer's alpha. */
|
|
1222
|
+
export const clipMatte = z.object({
|
|
1223
|
+
sourceClipId: z.string(),
|
|
1224
|
+
mode: z.string(),
|
|
1225
|
+
invert: z.boolean().optional()
|
|
1226
|
+
});
|
|
1227
|
+
const generatedMatteSettings = z.record(z.string(), z.union([z.number(), z.string(), z.boolean()]));
|
|
1228
|
+
/**
|
|
1229
|
+
* A matte generated from the clip's own source and carried on that clip (D2),
|
|
1230
|
+
* so a trim, a split or a move keeps it aligned with no second clip to sync.
|
|
1231
|
+
* The asset is a luma mask video cut from `sourceAssetId` frame for frame.
|
|
1232
|
+
*/
|
|
1233
|
+
export const clipGeneratedMatte = z.object({
|
|
1234
|
+
assetId: z.string(),
|
|
1235
|
+
sourceAssetId: z.string(),
|
|
1236
|
+
sourceRange: z.object({ fromMs: z.number(), toMs: z.number() }),
|
|
1237
|
+
settings: generatedMatteSettings,
|
|
1238
|
+
invert: z.boolean().optional(),
|
|
1239
|
+
strength: z.number().optional(),
|
|
1240
|
+
featherPx: z.number().optional(),
|
|
1241
|
+
versions: z
|
|
1242
|
+
.array(z.object({
|
|
1243
|
+
assetId: z.string(),
|
|
1244
|
+
sourceAssetId: z.string(),
|
|
1245
|
+
createdAt: z.string(),
|
|
1246
|
+
jobId: z.string().optional(),
|
|
1247
|
+
settings: generatedMatteSettings
|
|
1248
|
+
}))
|
|
1249
|
+
.optional(),
|
|
1250
|
+
status: z.enum(["ready", "generating", "failed"]).optional()
|
|
1251
|
+
});
|
|
1252
|
+
/**
|
|
1253
|
+
* One sample of a subject/object track (P0 AI Video, Phase 2), anchored to
|
|
1254
|
+
* the tracked clip's own source clock. Mirrors `MediaTrackSample` in
|
|
1255
|
+
* `@nodetool-ai/timeline`.
|
|
1256
|
+
*/
|
|
1257
|
+
export const mediaTrackSample = z.object({
|
|
1258
|
+
sourceMs: z.number(),
|
|
1259
|
+
x: z.number().optional(),
|
|
1260
|
+
y: z.number().optional(),
|
|
1261
|
+
width: z.number().optional(),
|
|
1262
|
+
height: z.number().optional(),
|
|
1263
|
+
rotation: z.number().optional(),
|
|
1264
|
+
quad: z
|
|
1265
|
+
.tuple([
|
|
1266
|
+
z.number(),
|
|
1267
|
+
z.number(),
|
|
1268
|
+
z.number(),
|
|
1269
|
+
z.number(),
|
|
1270
|
+
z.number(),
|
|
1271
|
+
z.number(),
|
|
1272
|
+
z.number(),
|
|
1273
|
+
z.number()
|
|
1274
|
+
])
|
|
1275
|
+
.optional(),
|
|
1276
|
+
maskAssetId: z.string().optional(),
|
|
1277
|
+
confidence: z.number().optional()
|
|
1278
|
+
});
|
|
1279
|
+
/**
|
|
1280
|
+
* A subject/object track: document-level, `clipId`-owned samples of one
|
|
1281
|
+
* subject moving through one clip's source (P0 AI Video, Phase 2). Mirrors
|
|
1282
|
+
* `MediaTrack` in `@nodetool-ai/timeline`.
|
|
1283
|
+
*/
|
|
1284
|
+
export const mediaTrack = z.object({
|
|
1285
|
+
id: z.string(),
|
|
1286
|
+
clipId: z.string(),
|
|
1287
|
+
sourceAssetId: z.string(),
|
|
1288
|
+
name: z.string(),
|
|
1289
|
+
kind: z.enum(["point", "box", "quad", "mask"]),
|
|
1290
|
+
sourceStartMs: z.number(),
|
|
1291
|
+
sourceEndMs: z.number(),
|
|
1292
|
+
samples: z.array(mediaTrackSample),
|
|
1293
|
+
confidence: z.number().optional(),
|
|
1294
|
+
status: z.enum(["ready", "generating", "stale", "failed"]),
|
|
1295
|
+
provenance: z
|
|
1296
|
+
.object({
|
|
1297
|
+
provider: z.string().optional(),
|
|
1298
|
+
model: z.string().optional(),
|
|
1299
|
+
settings: z.record(z.string(), z.unknown()).optional()
|
|
1300
|
+
})
|
|
1301
|
+
.optional()
|
|
1302
|
+
});
|
|
1303
|
+
/**
|
|
1304
|
+
* A clip following a `MediaTrack` (P0 AI Video, Phase 2). Only
|
|
1305
|
+
* `"position"`/`"position_scale"` are live in the scene model today. Smart
|
|
1306
|
+
* Reframe uses `clipReframe` rather than this binding so manual source-time
|
|
1307
|
+
* corrections remain first-class; the other modes stay reserved.
|
|
1308
|
+
*/
|
|
1309
|
+
export const trackBinding = z.object({
|
|
1310
|
+
trackId: z.string(),
|
|
1311
|
+
mode: z.enum([
|
|
1312
|
+
"position",
|
|
1313
|
+
"position_scale",
|
|
1314
|
+
"transform",
|
|
1315
|
+
"mask",
|
|
1316
|
+
"effect_region",
|
|
1317
|
+
"reframe"
|
|
1318
|
+
]),
|
|
1319
|
+
offset: z.object({ x: z.number(), y: z.number() }).optional(),
|
|
1320
|
+
scale: z.number().optional(),
|
|
1321
|
+
rotationOffset: z.number().optional(),
|
|
1322
|
+
smoothing: z.number().optional()
|
|
1323
|
+
});
|
|
1324
|
+
export const reframeSample = z.object({
|
|
1325
|
+
sourceMs: z.number(),
|
|
1326
|
+
x: z.number(),
|
|
1327
|
+
y: z.number(),
|
|
1328
|
+
width: z.number().optional(),
|
|
1329
|
+
height: z.number().optional(),
|
|
1330
|
+
confidence: z.number().optional()
|
|
1331
|
+
});
|
|
1332
|
+
export const reframeKeyframe = z.object({
|
|
1333
|
+
sourceMs: z.number(),
|
|
1334
|
+
x: z.number(),
|
|
1335
|
+
y: z.number(),
|
|
1336
|
+
zoom: z.number().optional()
|
|
1337
|
+
});
|
|
1338
|
+
export const clipReframe = z.object({
|
|
1339
|
+
mode: z.enum(["center", "auto", "track"]),
|
|
1340
|
+
trackId: z.string().optional(),
|
|
1341
|
+
safeMargin: z.number().optional(),
|
|
1342
|
+
smoothing: z.number().optional(),
|
|
1343
|
+
samples: z.array(reframeSample).optional(),
|
|
1344
|
+
keyframes: z.array(reframeKeyframe).optional(),
|
|
1345
|
+
sourceAssetId: z.string().optional(),
|
|
1346
|
+
sourceWidth: z.number().positive().optional(),
|
|
1347
|
+
sourceHeight: z.number().positive().optional()
|
|
1348
|
+
});
|
|
1349
|
+
/**
|
|
1350
|
+
* Retimes a clip's source. `t` is normalized 0..1 over the clip's window and
|
|
1351
|
+
* must ascend; `sourceMs` may descend, which is reverse playback.
|
|
1352
|
+
*/
|
|
1353
|
+
export const clipTimeRemap = z.object({
|
|
1354
|
+
keyframes: z.array(z.object({
|
|
1355
|
+
t: z.number(),
|
|
1356
|
+
sourceMs: z.number(),
|
|
1357
|
+
easing: z.string().optional()
|
|
1358
|
+
}))
|
|
1359
|
+
});
|
|
1360
|
+
export const timelineClip = z.object({
|
|
1361
|
+
id: z.string(),
|
|
1362
|
+
trackId: z.string(),
|
|
1363
|
+
name: z.string(),
|
|
1364
|
+
startMs: z.number(),
|
|
1365
|
+
durationMs: z.number(),
|
|
1366
|
+
inPointMs: z.number().optional(),
|
|
1367
|
+
outPointMs: z.number().optional(),
|
|
1368
|
+
/** `"group"` carries no media: it is a transform parent children name with
|
|
1369
|
+
* `parentId`. `"adjustment"` carries none either: its effects treat the
|
|
1370
|
+
* composite of the layers drawn beneath it. Without them here Zod fails a
|
|
1371
|
+
* document containing either. */
|
|
1372
|
+
mediaType: z.enum([
|
|
1373
|
+
"image",
|
|
1374
|
+
"video",
|
|
1375
|
+
"audio",
|
|
1376
|
+
"overlay",
|
|
1377
|
+
"text",
|
|
1378
|
+
"shape",
|
|
1379
|
+
"model3d",
|
|
1380
|
+
"group",
|
|
1381
|
+
"adjustment",
|
|
1382
|
+
"midi"
|
|
1383
|
+
]),
|
|
1384
|
+
sourceType: z.enum(["imported", "generated"]),
|
|
1385
|
+
bindingKind: clipBindingKind.optional(),
|
|
1386
|
+
workflowId: z.string().optional(),
|
|
1387
|
+
selectedOutputNodeId: z.string().optional(),
|
|
1388
|
+
paramOverrides: z.record(z.string(), z.unknown()).optional(),
|
|
1389
|
+
prompt: z.string().optional(),
|
|
1390
|
+
negativePrompt: z.string().optional(),
|
|
1391
|
+
provider: z.string().optional(),
|
|
1392
|
+
model: z.string().optional(),
|
|
1393
|
+
/** TTS voice id for `text-to-audio` direct-gen clips. */
|
|
1394
|
+
voice: z.string().optional(),
|
|
1395
|
+
sourceClipId: z.string().nullable().optional(),
|
|
1396
|
+
/** Shared id linking a video clip to its auto-extracted audio clip so they
|
|
1397
|
+
* move/trim together. Without this field Zod strips it on every PATCH, so
|
|
1398
|
+
* autosave/reload silently breaks the link. */
|
|
1399
|
+
linkId: z.string().optional(),
|
|
1400
|
+
width: z.number().optional(),
|
|
1401
|
+
height: z.number().optional(),
|
|
1402
|
+
/** Direct-gen target aspect ratio ("16:9") and resolution tier ("720p"),
|
|
1403
|
+
* both written by the direct-gen clip panel. Without these fields Zod strips
|
|
1404
|
+
* them on every PATCH, so a clip re-generates at the provider default rather
|
|
1405
|
+
* than at the size the user picked. */
|
|
1406
|
+
aspectRatio: z.string().optional(),
|
|
1407
|
+
resolution: z.string().optional(),
|
|
1408
|
+
strength: z.number().optional(),
|
|
1409
|
+
numInferenceSteps: z.number().optional(),
|
|
1410
|
+
seed: z.number().optional(),
|
|
1411
|
+
dependencyHash: z.string().optional(),
|
|
1412
|
+
lastGeneratedHash: z.string().optional(),
|
|
1413
|
+
currentAssetId: z.string().optional(),
|
|
1414
|
+
/** Read-only convenience alias for the active take's id (P0 AI Video, PRD
|
|
1415
|
+
* § 8.10). Without this field Zod strips it on every PATCH. */
|
|
1416
|
+
activeTakeId: z.string().optional(),
|
|
1417
|
+
thumbnailAssetId: z.string().optional(),
|
|
1418
|
+
waveformAssetId: z.string().optional(),
|
|
1419
|
+
/** Storyboard provenance (assemble bridge). Without these fields Zod
|
|
1420
|
+
* strips them on every PATCH, breaking shot→clip revision round-trips. */
|
|
1421
|
+
storyboardBoardId: z.string().optional(),
|
|
1422
|
+
storyboardShotId: z.string().optional(),
|
|
1423
|
+
/** Script provenance (script→timeline assemble bridge). Without these
|
|
1424
|
+
* fields Zod strips them on every PATCH, breaking line→clip re-voice
|
|
1425
|
+
* round-trips. */
|
|
1426
|
+
scriptId: z.string().optional(),
|
|
1427
|
+
scriptLineId: z.string().optional(),
|
|
1428
|
+
/** The `setup.beats` entry this clip was generated from (PRD § 8.5). Without
|
|
1429
|
+
* it the plan behind a finished timeline is unreadable after one save. */
|
|
1430
|
+
beatId: z.string().optional(),
|
|
1431
|
+
status: z.enum([
|
|
1432
|
+
"draft",
|
|
1433
|
+
"queued",
|
|
1434
|
+
"generating",
|
|
1435
|
+
"generated",
|
|
1436
|
+
"stale",
|
|
1437
|
+
"failed",
|
|
1438
|
+
"locked",
|
|
1439
|
+
"missing"
|
|
1440
|
+
]),
|
|
1441
|
+
locked: z.boolean(),
|
|
1442
|
+
muted: z.boolean().optional(),
|
|
1443
|
+
hidden: z.boolean().optional(),
|
|
1444
|
+
versions: z.array(clipVersion),
|
|
1445
|
+
opacity: z.number().optional(),
|
|
1446
|
+
blendMode: blendModeEnum.optional(),
|
|
1447
|
+
speedMultiplier: z.number().optional(),
|
|
1448
|
+
speedBaked: z.boolean().optional(),
|
|
1449
|
+
volumeDb: z.number().optional(),
|
|
1450
|
+
fadeInMs: z.number().optional(),
|
|
1451
|
+
fadeOutMs: z.number().optional(),
|
|
1452
|
+
fadeInShape: clipFadeShapeEnum.optional(),
|
|
1453
|
+
fadeOutShape: clipFadeShapeEnum.optional(),
|
|
1454
|
+
transform: clipTransform.optional(),
|
|
1455
|
+
layout: clipLayout.optional(),
|
|
1456
|
+
repeater: clipRepeater.optional(),
|
|
1457
|
+
motionBlur: z.object({ samplesPerFrame: z.number().int().min(1).max(32), shutterAngle: z.number().min(0).max(360) }).optional(),
|
|
1458
|
+
steppedTime: z.object({ fps: z.number().positive() }).optional(),
|
|
1459
|
+
temporalEcho: z.object({ copies: z.number().int().min(1).max(32), intervalMs: z.number().positive(), opacityDecay: z.number().min(0).max(1) }).optional(),
|
|
1460
|
+
borderRadius: z.number().optional(),
|
|
1461
|
+
/** Without this field Zod strips it on every PATCH and a cropped clip
|
|
1462
|
+
* reverts to its full frame on the next save. */
|
|
1463
|
+
crop: clipCrop.optional(),
|
|
1464
|
+
effects: z.array(clipEffect).optional(),
|
|
1465
|
+
transitionIn: clipTransition.optional(),
|
|
1466
|
+
textStyle: clipTextStyle.optional(),
|
|
1467
|
+
shapeStyle: clipShapeStyle.optional(),
|
|
1468
|
+
/** Camera, animation and look for a `model3d` clip; the glTF itself is the
|
|
1469
|
+
* clip's asset. Without this field Zod strips it on every PATCH, so a posed,
|
|
1470
|
+
* lit and baked 3D clip reverts to nothing on the next save. */
|
|
1471
|
+
model3dStyle: clipModel3DStyle.optional(),
|
|
1472
|
+
/** Word-level caption data; present only on caption clips. Without this
|
|
1473
|
+
* field Zod strips it on every PATCH, so autosave erases captions. */
|
|
1474
|
+
caption: clipCaption.optional(),
|
|
1475
|
+
/** Speaker label for transcript clips. Without this field Zod strips it on
|
|
1476
|
+
* every PATCH, so autosave erases the speaker. */
|
|
1477
|
+
speaker: z.string().optional(),
|
|
1478
|
+
/** Paragraph grouping id for transcript clips. Without this field Zod strips
|
|
1479
|
+
* it on every PATCH, so autosave silently breaks paragraph grouping. */
|
|
1480
|
+
paragraphId: z.string().optional(),
|
|
1481
|
+
/** Motion-design animations. Without this field Zod strips it on every
|
|
1482
|
+
* PATCH, so autosave erases animations. */
|
|
1483
|
+
animations: z.array(clipAnimation).optional(),
|
|
1484
|
+
animationLinks: z.array(z.union([
|
|
1485
|
+
z.object({
|
|
1486
|
+
target: z.enum(["positionX", "positionY", "scale", "rotation", "opacity"]),
|
|
1487
|
+
sourceClipId: z.string(),
|
|
1488
|
+
source: z.enum(["positionX", "positionY", "scale", "rotation", "opacity"]),
|
|
1489
|
+
timeOffsetMs: z.number().optional(),
|
|
1490
|
+
loop: z.boolean().optional(),
|
|
1491
|
+
scale: z.number().optional(),
|
|
1492
|
+
offset: z.number().optional()
|
|
1493
|
+
}),
|
|
1494
|
+
z.object({
|
|
1495
|
+
target: z.enum(["positionX", "positionY", "scale", "rotation", "opacity"]),
|
|
1496
|
+
kind: z.literal("wiggle"),
|
|
1497
|
+
amplitude: z.number(),
|
|
1498
|
+
amplitudeKeyframes: z.array(z.object({ timeMs: z.number().nonnegative(), value: z.number() })).optional(),
|
|
1499
|
+
frequencyHz: z.number().nonnegative(),
|
|
1500
|
+
seed: z.number().optional()
|
|
1501
|
+
})
|
|
1502
|
+
])).max(32).optional(),
|
|
1503
|
+
/** Group this clip is parented to. Without this field Zod strips it on every
|
|
1504
|
+
* PATCH, so autosave unparents every child of a group. */
|
|
1505
|
+
parentId: z.string().optional(),
|
|
1506
|
+
/** Shape mask. Without this field Zod strips it on every PATCH, so a masked
|
|
1507
|
+
* layer reverts to its full rectangle on the next save. */
|
|
1508
|
+
mask: clipMask.optional(),
|
|
1509
|
+
/** Track matte. Without this field Zod strips it on every PATCH, so the
|
|
1510
|
+
* matted layer reverts to opaque on the next save. */
|
|
1511
|
+
matte: clipMatte.optional(),
|
|
1512
|
+
/** Matte generated from the clip's own source. Without this field Zod strips
|
|
1513
|
+
* it on every PATCH, so a cut-out subject reverts to its full frame on the
|
|
1514
|
+
* next save and the generation has to be paid for again. */
|
|
1515
|
+
generatedMatte: clipGeneratedMatte.optional(),
|
|
1516
|
+
/** Follows a subject/object track (P0 AI Video, Phase 2). Without this
|
|
1517
|
+
* field Zod strips it on every PATCH, so a text/shape clip following a
|
|
1518
|
+
* tracked subject reverts to static on the next save. */
|
|
1519
|
+
trackBinding: trackBinding.optional(),
|
|
1520
|
+
/** Source-time Smart Reframe state. Without this field Zod strips the
|
|
1521
|
+
* framing path and manual corrections on every PATCH. */
|
|
1522
|
+
reframe: clipReframe.optional(),
|
|
1523
|
+
/** Time remap. Without this field Zod strips it on every PATCH, so a
|
|
1524
|
+
* retimed or reversed clip plays back at its plain rate after one save. */
|
|
1525
|
+
timeRemap: clipTimeRemap.optional(),
|
|
1526
|
+
/** Composition provenance stamped by `insert_composition`. Without these
|
|
1527
|
+
* fields Zod strips them on every PATCH, so an instantiated composition
|
|
1528
|
+
* loses the link to its template and its parameter values. */
|
|
1529
|
+
compositionId: z.string().optional(),
|
|
1530
|
+
compositionParams: z
|
|
1531
|
+
.record(z.string(), z.union([z.number(), z.string(), z.boolean()]))
|
|
1532
|
+
.optional(),
|
|
1533
|
+
/** Notes carried inline by a `midi` clip, in content ticks. Without this
|
|
1534
|
+
* field Zod strips it on every PATCH, so autosave erases the performance. */
|
|
1535
|
+
notes: z.array(midiNote).max(MIDI_MAX_NOTES_PER_CLIP).optional()
|
|
1536
|
+
});
|
|
1537
|
+
// ── Guided setup (PRD § 8.5) ─────────────────────────────────────────────────
|
|
1538
|
+
/**
|
|
1539
|
+
* Where a sequence sits in the guided video flow. A sequence built before the
|
|
1540
|
+
* flow existed carries no `setup` at all and opens straight in the editor, so
|
|
1541
|
+
* there is no `"done"` default to write anywhere — absence is the signal.
|
|
1542
|
+
*/
|
|
1543
|
+
export const timelineSetupStage = z.enum([
|
|
1544
|
+
"idea",
|
|
1545
|
+
"format",
|
|
1546
|
+
"review",
|
|
1547
|
+
"look",
|
|
1548
|
+
"done"
|
|
1549
|
+
]);
|
|
1550
|
+
/**
|
|
1551
|
+
* One beat of the plan: the cheap, editable text the creator reviews before
|
|
1552
|
+
* anything is spent (D4). `clip_id` is written at generate time, which is what
|
|
1553
|
+
* lets the finished timeline be read back as the plan that produced it.
|
|
1554
|
+
*/
|
|
1555
|
+
export const timelineBeat = z
|
|
1556
|
+
.object({
|
|
1557
|
+
id: z.string(),
|
|
1558
|
+
prompt: z.string(),
|
|
1559
|
+
duration_ms: z.number(),
|
|
1560
|
+
/** How this beat opens against the one before it, e.g. "crossfade". */
|
|
1561
|
+
transition: z.string().optional(),
|
|
1562
|
+
/** The line spoken over this beat. Absent or empty means no voiceover. */
|
|
1563
|
+
voiceover: z.string().optional(),
|
|
1564
|
+
music: z.boolean().optional(),
|
|
1565
|
+
clip_id: z.string().optional(),
|
|
1566
|
+
/** Imported source footage this beat edits instead of replacing. */
|
|
1567
|
+
source_clip_id: z.string().optional(),
|
|
1568
|
+
/** Optional production requirements reviewed before generation. */
|
|
1569
|
+
production: productionRequirement.optional()
|
|
1570
|
+
})
|
|
1571
|
+
.passthrough();
|
|
1572
|
+
/**
|
|
1573
|
+
* The flow's state, on the document the flow produces (D19). Loose, like the
|
|
1574
|
+
* beat: the field travels through the editor, autosave and version history
|
|
1575
|
+
* untouched, so a client that knows more about it than this schema does keeps
|
|
1576
|
+
* what it wrote.
|
|
1577
|
+
*/
|
|
1578
|
+
export const timelineSetup = z
|
|
1579
|
+
.object({
|
|
1580
|
+
stage: timelineSetupStage,
|
|
1581
|
+
brief: z.string(),
|
|
1582
|
+
/** The format card's id, e.g. "social-9x16". */
|
|
1583
|
+
format: z.string().optional(),
|
|
1584
|
+
/**
|
|
1585
|
+
* Whether the cut gets a voiceover. Absent means the creator has not said,
|
|
1586
|
+
* so the beats' own lines decide. `false` is a deliberate "no voiceover",
|
|
1587
|
+
* which the lines cannot express: reading it off them would make silence
|
|
1588
|
+
* indistinguishable from an unwritten line, and writing it by clearing
|
|
1589
|
+
* them would throw the creator's words away (PRD § 8.3).
|
|
1590
|
+
*/
|
|
1591
|
+
voiceover: z.boolean().optional(),
|
|
1592
|
+
/** Optional shared product, audience, and reference context. */
|
|
1593
|
+
creative_context: creativeContext.optional(),
|
|
1594
|
+
/** Fingerprint of the reviewed production requirements. */
|
|
1595
|
+
production_review_fingerprint: z.string().optional(),
|
|
1596
|
+
/** Model and voice intent owned by this draft, seeded from preferences once. */
|
|
1597
|
+
generation_settings: z
|
|
1598
|
+
.object({
|
|
1599
|
+
video: z.object({ provider: z.string(), model: z.string() }).optional(),
|
|
1600
|
+
voice: z
|
|
1601
|
+
.object({
|
|
1602
|
+
provider: z.string(),
|
|
1603
|
+
model: z.string(),
|
|
1604
|
+
voice: z.string()
|
|
1605
|
+
})
|
|
1606
|
+
.optional()
|
|
1607
|
+
})
|
|
1608
|
+
.optional(),
|
|
1609
|
+
/** Durable destinations and request identities saved before paid dispatch. */
|
|
1610
|
+
prepared_generation: z
|
|
1611
|
+
.object({
|
|
1612
|
+
batch_id: z.string(),
|
|
1613
|
+
/** Immutable generation inputs this batch was prepared from. */
|
|
1614
|
+
fingerprint: z.string(),
|
|
1615
|
+
status: z.enum(["unsubmitted", "prepared", "submitted"]),
|
|
1616
|
+
requests: z.array(z.object({
|
|
1617
|
+
clip_id: z.string(),
|
|
1618
|
+
request_id: z.string(),
|
|
1619
|
+
kind: z.enum(["video", "voiceover", "music"]),
|
|
1620
|
+
beat_id: z.string().optional(),
|
|
1621
|
+
variation_index: z.number().int().positive().optional()
|
|
1622
|
+
}))
|
|
1623
|
+
})
|
|
1624
|
+
.optional(),
|
|
1625
|
+
beats: z.array(timelineBeat).optional(),
|
|
1626
|
+
/**
|
|
1627
|
+
* The language model that drafts the beats. Absent means the flow picks
|
|
1628
|
+
* one: the curated NodeTool director when this server can serve it, and
|
|
1629
|
+
* otherwise the first model a configured provider reports. Stored so the
|
|
1630
|
+
* creator's pick survives a reload and so a re-plan runs on the same
|
|
1631
|
+
* model the estimate was shown for.
|
|
1632
|
+
*/
|
|
1633
|
+
directorModel: z
|
|
1634
|
+
.object({
|
|
1635
|
+
id: z.string(),
|
|
1636
|
+
provider: z.string(),
|
|
1637
|
+
name: z.string().optional()
|
|
1638
|
+
})
|
|
1639
|
+
.optional()
|
|
1640
|
+
})
|
|
1641
|
+
.passthrough();
|
|
1642
|
+
export const timelineDocument = z.object({
|
|
1643
|
+
tracks: z.array(timelineTrack),
|
|
1644
|
+
trackFolders: z.array(timelineTrackFolder).optional(),
|
|
1645
|
+
clips: z.array(timelineClip),
|
|
1646
|
+
markers: z.array(timelineMarker),
|
|
1647
|
+
transcript: z.array(transcriptLine).optional(),
|
|
1648
|
+
scriptEnabled: z.boolean().optional(),
|
|
1649
|
+
/** Constant tempo the midi clips are read against. Without this field Zod
|
|
1650
|
+
* strips it on every PATCH, so the document falls back to 120 BPM and every
|
|
1651
|
+
* midi clip plays at the wrong speed after one save. */
|
|
1652
|
+
tempo: timelineTempo.optional(),
|
|
1653
|
+
/** Guided-setup state. Absent on every sequence not built through the flow. */
|
|
1654
|
+
setup: timelineSetup.optional(),
|
|
1655
|
+
/** Sequence this one was retargeted from. Without this field Zod strips it
|
|
1656
|
+
* on every PATCH and the lineage is lost on the first save. */
|
|
1657
|
+
templateId: z.string().nullable().optional(),
|
|
1658
|
+
/** Subject/object tracks (P0 AI Video, Phase 2). Without this field Zod
|
|
1659
|
+
* strips it on every PATCH, so a track and every clip following it are
|
|
1660
|
+
* lost on the next save. */
|
|
1661
|
+
mediaTracks: z.array(mediaTrack).optional(),
|
|
1662
|
+
camera2d: timelineCamera2d.nullable().optional()
|
|
1663
|
+
});
|
|
1664
|
+
/** Read-only bundle shipped in the example timeline catalog. */
|
|
1665
|
+
export const exampleTimelineBundle = z.object({
|
|
1666
|
+
name: z.string().min(1),
|
|
1667
|
+
description: z.string().min(1),
|
|
1668
|
+
fps: z.number().int().positive(),
|
|
1669
|
+
width: z.number().int().positive(),
|
|
1670
|
+
height: z.number().int().positive(),
|
|
1671
|
+
durationMs: z.number().int().positive(),
|
|
1672
|
+
videoUri: z.string(),
|
|
1673
|
+
posterUri: z.string(),
|
|
1674
|
+
document: timelineDocument
|
|
1675
|
+
});
|
|
1676
|
+
export const exampleTimelineSummary = z.object({
|
|
1677
|
+
slug: z.string(),
|
|
1678
|
+
name: z.string(),
|
|
1679
|
+
description: z.string(),
|
|
1680
|
+
durationMs: z.number().int().positive(),
|
|
1681
|
+
fps: z.number().int().positive(),
|
|
1682
|
+
clipCount: z.number().int().nonnegative(),
|
|
1683
|
+
videoUri: z.string(),
|
|
1684
|
+
posterUri: z.string()
|
|
1685
|
+
});
|
|
1686
|
+
export const installExampleTimelineInput = z.object({
|
|
1687
|
+
slug: z.string(),
|
|
1688
|
+
projectId: z.string().min(1).optional(),
|
|
1689
|
+
name: z.string().min(1).optional()
|
|
1690
|
+
});
|
|
1691
|
+
// ── Sequence response ────────────────────────────────────────────────────────
|
|
1692
|
+
export const timelineSequenceResponse = z.object({
|
|
1693
|
+
id: z.string(),
|
|
1694
|
+
projectId: z.string(),
|
|
1695
|
+
workflowId: z.string().optional(),
|
|
1696
|
+
name: z.string(),
|
|
1697
|
+
fps: z.number(),
|
|
1698
|
+
width: z.number(),
|
|
1699
|
+
height: z.number(),
|
|
1700
|
+
durationMs: z.number(),
|
|
1701
|
+
tracks: z.array(timelineTrack),
|
|
1702
|
+
trackFolders: z.array(timelineTrackFolder).optional(),
|
|
1703
|
+
clips: z.array(timelineClip),
|
|
1704
|
+
markers: z.array(timelineMarker),
|
|
1705
|
+
transcript: z.array(transcriptLine).optional(),
|
|
1706
|
+
scriptEnabled: z.boolean().optional(),
|
|
1707
|
+
/** Constant tempo, mirroring the document's. Without this field Zod strips
|
|
1708
|
+
* it from every read, so the editor loads a tempo-less sequence. */
|
|
1709
|
+
tempo: timelineTempo.optional(),
|
|
1710
|
+
setup: timelineSetup.optional(),
|
|
1711
|
+
/** Sequence this one was retargeted from, mirroring the document's. */
|
|
1712
|
+
templateId: z.string().nullable().optional(),
|
|
1713
|
+
/** Subject/object tracks, mirroring the document's. */
|
|
1714
|
+
mediaTracks: z.array(mediaTrack).optional(),
|
|
1715
|
+
camera2d: timelineCamera2d.nullable().optional(),
|
|
1716
|
+
createdAt: z.string(),
|
|
1717
|
+
updatedAt: z.string()
|
|
1718
|
+
});
|
|
1719
|
+
// Minimal list item (id, name, updatedAt only)
|
|
1720
|
+
export const timelineSequenceListItem = z.object({
|
|
1721
|
+
id: z.string(),
|
|
1722
|
+
projectId: z.string(),
|
|
1723
|
+
name: z.string(),
|
|
1724
|
+
updatedAt: z.string()
|
|
1725
|
+
});
|
|
1726
|
+
// ── create (POST /api/timeline) ──────────────────────────────────────────────
|
|
1727
|
+
export const createTimelineInput = z.object({
|
|
1728
|
+
/**
|
|
1729
|
+
* Client-supplied id. The caller mints it so the sequence is addressable
|
|
1730
|
+
* (agent tools, tab refs) before the create round-trip returns, and so a
|
|
1731
|
+
* retried create is idempotent rather than duplicating the sequence.
|
|
1732
|
+
*/
|
|
1733
|
+
id: z.string().optional(),
|
|
1734
|
+
name: z.string().min(1),
|
|
1735
|
+
projectId: z.string().min(1),
|
|
1736
|
+
fps: z.number().int().min(1).optional().default(30),
|
|
1737
|
+
width: z.number().int().min(1).optional().default(1920),
|
|
1738
|
+
height: z.number().int().min(1).optional().default(1080)
|
|
1739
|
+
});
|
|
1740
|
+
// ── patch (PATCH /api/timeline/:id) ─────────────────────────────────────────
|
|
1741
|
+
export const patchTimelineInput = z
|
|
1742
|
+
.object({
|
|
1743
|
+
name: z.string().min(1).optional(),
|
|
1744
|
+
fps: z.number().int().min(1).optional(),
|
|
1745
|
+
width: z.number().int().min(1).optional(),
|
|
1746
|
+
height: z.number().int().min(1).optional(),
|
|
1747
|
+
document: timelineDocument.optional()
|
|
1748
|
+
})
|
|
1749
|
+
.refine((v) => Object.keys(v).length > 0, {
|
|
1750
|
+
message: "at least one field is required"
|
|
1751
|
+
});
|
|
1752
|
+
// ── append clip version (POST /api/timeline/:id/clips/:clipId/versions) ──────
|
|
1753
|
+
export const appendClipVersionInput = z.object({
|
|
1754
|
+
...productionTakeMetadata.shape,
|
|
1755
|
+
jobId: z.string(),
|
|
1756
|
+
assetId: z.string(),
|
|
1757
|
+
dependencyHash: z.string(),
|
|
1758
|
+
workflowUpdatedAt: z.string(),
|
|
1759
|
+
paramOverridesSnapshot: z.record(z.string(), z.unknown()).optional(),
|
|
1760
|
+
costCredits: z.number().optional(),
|
|
1761
|
+
durationMs: z.number().optional(),
|
|
1762
|
+
status: z
|
|
1763
|
+
.enum(["success", "failed", "cancelled"])
|
|
1764
|
+
.optional()
|
|
1765
|
+
.default("success")
|
|
1766
|
+
});
|
|
1767
|
+
// ── create clip (POST /api/timeline/:id/clips) ────────────────────────────────
|
|
1768
|
+
export const createClipInput = z.object({
|
|
1769
|
+
/** Timeline sequence that will own the clip. */
|
|
1770
|
+
id: z.string(),
|
|
1771
|
+
trackId: z.string(),
|
|
1772
|
+
startMs: z.number().int().min(0),
|
|
1773
|
+
/** The source workflow the clip will run. The clip references it directly; no clone is created. */
|
|
1774
|
+
sourceWorkflowId: z.string(),
|
|
1775
|
+
/**
|
|
1776
|
+
* Override which terminal node's output becomes the clip's media.
|
|
1777
|
+
* Required when the source workflow has multiple terminal output nodes;
|
|
1778
|
+
* optional (server auto-picks) when there is exactly one.
|
|
1779
|
+
*/
|
|
1780
|
+
selectedOutputNodeId: z.string().optional(),
|
|
1781
|
+
/** If placed on an overlay track, pass `"overlay"` to override mediaType. */
|
|
1782
|
+
mediaTypeOverride: z.enum(["overlay"]).optional()
|
|
1783
|
+
});
|
|
1784
|
+
/** Response shape returned by `timeline.clips.create`. */
|
|
1785
|
+
export const timelineClipResponse = timelineClip;
|
|
1786
|
+
// ── sequence version history (/api/timeline/:id/versions) ────────────────────
|
|
1787
|
+
/**
|
|
1788
|
+
* How a snapshot came to exist. `restore` marks the snapshot taken of the
|
|
1789
|
+
* *pre-restore* state, so restoring is itself undoable.
|
|
1790
|
+
*/
|
|
1791
|
+
export const timelineVersionSaveType = z.enum([
|
|
1792
|
+
"manual",
|
|
1793
|
+
"autosave",
|
|
1794
|
+
"restore"
|
|
1795
|
+
]);
|
|
1796
|
+
/**
|
|
1797
|
+
* Metadata for one snapshot. Deliberately carries no `document`: a timeline
|
|
1798
|
+
* document is large, and the history list renders from metadata alone.
|
|
1799
|
+
*/
|
|
1800
|
+
export const timelineVersionListItem = z.object({
|
|
1801
|
+
id: z.string(),
|
|
1802
|
+
timelineId: z.string(),
|
|
1803
|
+
version: z.number().int(),
|
|
1804
|
+
name: z.string().nullable().optional(),
|
|
1805
|
+
saveType: timelineVersionSaveType,
|
|
1806
|
+
fps: z.number(),
|
|
1807
|
+
width: z.number(),
|
|
1808
|
+
height: z.number(),
|
|
1809
|
+
durationMs: z.number(),
|
|
1810
|
+
createdAt: z.string()
|
|
1811
|
+
});
|
|
1812
|
+
/** One snapshot including the document it captured. */
|
|
1813
|
+
export const timelineVersionResponse = timelineVersionListItem.extend({
|
|
1814
|
+
document: timelineDocument
|
|
1815
|
+
});
|
|
1816
|
+
export const listTimelineVersionsInput = z.object({
|
|
1817
|
+
/** Timeline sequence whose history is read. */
|
|
1818
|
+
id: z.string(),
|
|
1819
|
+
limit: z.number().int().positive().max(500).optional(),
|
|
1820
|
+
saveType: timelineVersionSaveType.optional()
|
|
1821
|
+
});
|
|
1822
|
+
export const getTimelineVersionInput = z.object({
|
|
1823
|
+
id: z.string(),
|
|
1824
|
+
version: z.number().int()
|
|
1825
|
+
});
|
|
1826
|
+
export const createTimelineVersionInput = z.object({
|
|
1827
|
+
id: z.string(),
|
|
1828
|
+
name: z.string().max(200).optional()
|
|
1829
|
+
});
|
|
1830
|
+
export const restoreTimelineVersionInput = z.object({
|
|
1831
|
+
id: z.string(),
|
|
1832
|
+
version: z.number().int()
|
|
1833
|
+
});
|
|
1834
|
+
export const deleteTimelineVersionInput = z.object({
|
|
1835
|
+
id: z.string(),
|
|
1836
|
+
version: z.number().int()
|
|
1837
|
+
});
|
|
1838
|
+
//# sourceMappingURL=timeline.js.map
|