@nativestudio/sdk 0.3.0-rc.11 → 0.3.0-rc.15
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/COMPATIBILITY.json +4 -4
- package/dist/_chunks/chunk-4FFE5MLO.js +1 -0
- package/dist/_chunks/chunk-6UYY5KHI.js +1 -0
- package/dist/_chunks/chunk-7APLYEJT.js +1 -0
- package/dist/_chunks/chunk-GVQ3Y3SF.js +1 -0
- package/dist/_chunks/chunk-QOGO6RNO.js +1 -0
- package/dist/_types/contracts/artifact-discovery.d.ts +60 -0
- package/dist/_types/contracts/audio.d.ts +162 -0
- package/dist/_types/contracts/consistency-profile.d.ts +102 -6
- package/dist/_types/contracts/continuity-evaluation.d.ts +1 -1
- package/dist/_types/contracts/delivery-operations.d.ts +150 -0
- package/dist/_types/contracts/device-render.d.ts +2 -0
- package/dist/_types/contracts/editor-intelligence.d.ts +280 -42
- package/dist/_types/contracts/final-render.d.ts +188 -24
- package/dist/_types/contracts/human-links.d.ts +58 -0
- package/dist/_types/contracts/index.d.ts +8 -0
- package/dist/_types/contracts/interface/media-output.d.ts +90 -0
- package/dist/_types/contracts/interface/operation.d.ts +30 -0
- package/dist/_types/contracts/interface/production-snapshot.d.ts +60 -0
- package/dist/_types/contracts/interface/query.d.ts +60 -0
- package/dist/_types/contracts/keyframe-generation.d.ts +1 -1
- package/dist/_types/contracts/lifecycle-event-projections.d.ts +15 -0
- package/dist/_types/contracts/lifecycle-events.d.ts +53 -1
- package/dist/_types/contracts/local-execution/agent-context.d.ts +23 -3
- package/dist/_types/contracts/local-execution/agent-review.d.ts +29 -3
- package/dist/_types/contracts/local-execution/audio-profile.d.ts +6 -0
- package/dist/_types/contracts/local-execution/cpu-preparation.d.ts +46 -0
- package/dist/_types/contracts/local-execution/cpu-resources.d.ts +55 -0
- package/dist/_types/contracts/local-execution/cpu-speech-job.d.ts +70 -0
- package/dist/_types/contracts/local-execution/cpu-speech.d.ts +161 -0
- package/dist/_types/contracts/local-execution/descriptor.d.ts +1 -1
- package/dist/_types/contracts/local-execution/device-inventory.d.ts +2 -2
- package/dist/_types/contracts/local-execution/device.d.ts +3 -3
- package/dist/_types/contracts/local-execution/index.d.ts +6 -0
- package/dist/_types/contracts/local-execution/ipc.d.ts +18 -2
- package/dist/_types/contracts/local-execution/library-result.d.ts +16 -0
- package/dist/_types/contracts/local-execution/lifecycle.d.ts +49 -7
- package/dist/_types/contracts/local-execution/local-navigation.d.ts +15 -14
- package/dist/_types/contracts/local-execution/management.d.ts +15 -11
- package/dist/_types/contracts/local-execution/preview.d.ts +38 -3
- package/dist/_types/contracts/local-execution/processor-capability.d.ts +2 -0
- package/dist/_types/contracts/local-execution/processor-recipes.d.ts +43 -0
- package/dist/_types/contracts/local-execution/processor-toolchain.d.ts +47 -0
- package/dist/_types/contracts/local-execution/processor.d.ts +184 -3
- package/dist/_types/contracts/local-execution/speech.d.ts +1 -1
- package/dist/_types/contracts/local-execution/tool-selection.d.ts +26 -0
- package/dist/_types/contracts/local-execution/work.d.ts +16 -2
- package/dist/_types/contracts/native-speech-model.d.ts +53 -0
- package/dist/_types/contracts/native-speech-options.d.ts +25 -0
- package/dist/_types/contracts/navigation-context.d.ts +2 -2
- package/dist/_types/contracts/navigation-groups.d.ts +1 -1
- package/dist/_types/contracts/navigation.d.ts +35 -5
- package/dist/_types/contracts/production-creation.d.ts +30 -0
- package/dist/_types/contracts/production-feedback.d.ts +452 -0
- package/dist/_types/contracts/production.d.ts +30 -0
- package/dist/_types/contracts/project-library.d.ts +30 -0
- package/dist/_types/contracts/project.d.ts +30 -0
- package/dist/_types/contracts/provider-models.d.ts +193 -0
- package/dist/_types/contracts/repair-lifecycle.d.ts +4 -4
- package/dist/_types/contracts/repair-plan.d.ts +1 -1
- package/dist/_types/contracts/repair-strategy.d.ts +9 -5
- package/dist/_types/contracts/review-intelligence-final-output.d.ts +90 -0
- package/dist/_types/contracts/review-intelligence.d.ts +3 -1
- package/dist/_types/contracts/rough-cut-manifest.d.ts +19 -4
- package/dist/_types/contracts/rough-cut-review.d.ts +10 -1
- package/dist/_types/contracts/rough-cut.d.ts +111 -12
- package/dist/_types/contracts/shares.d.ts +135 -0
- package/dist/_types/contracts/shot-preparation-basis.d.ts +2 -2
- package/dist/_types/contracts/shot-preparation.d.ts +4 -4
- package/dist/_types/contracts/sound-making-plan.d.ts +207 -0
- package/dist/_types/contracts/speech-cost.d.ts +15 -0
- package/dist/_types/contracts/speech-parameters.d.ts +39 -0
- package/dist/_types/contracts/speech.d.ts +470 -39
- package/dist/_types/contracts/timeline-audio.d.ts +19 -4
- package/dist/_types/contracts/timeline-manifest.d.ts +38 -8
- package/dist/_types/contracts/timeline-source-sound.d.ts +41 -4
- package/dist/_types/contracts/timeline-v2.d.ts +120 -16
- package/dist/_types/contracts/timeline-version-reader.d.ts +278 -40
- package/dist/_types/contracts/timeline-visual-layers.d.ts +120 -16
- package/dist/_types/contracts/video-generation.d.ts +1 -1
- package/dist/_types/contracts/visual-exploration.d.ts +1 -1
- package/dist/_types/contracts/visual-layer-render.d.ts +240 -32
- package/dist/_types/contracts/visual-sequence.d.ts +1 -1
- package/dist/_types/contracts/voice-consistency.d.ts +183 -0
- package/dist/_types/contracts/voice-profile/contracts.d.ts +821 -0
- package/dist/_types/contracts/voice-profile/identity.d.ts +27 -0
- package/dist/_types/contracts/voice-profile/interface.d.ts +89 -0
- package/dist/_types/contracts/voice-profile/reference.d.ts +106 -0
- package/dist/_types/contracts/voice-review.d.ts +1194 -0
- package/dist/_types/contracts/workspace.d.ts +51 -0
- package/dist/_types/sdk/account.d.ts +13 -0
- package/dist/_types/sdk/auxiliary-media.d.ts +1 -0
- package/dist/_types/sdk/catalog/audio-caption.d.ts +116 -20
- package/dist/_types/sdk/catalog/carriers.d.ts +16 -0
- package/dist/_types/sdk/catalog/core.d.ts +256 -8
- package/dist/_types/sdk/catalog/device-library.d.ts +26 -2
- package/dist/_types/sdk/catalog/device-management.d.ts +66 -14
- package/dist/_types/sdk/catalog/discovery.d.ts +26 -0
- package/dist/_types/sdk/catalog/generation.d.ts +4 -4
- package/dist/_types/sdk/catalog/imported-visual.d.ts +12 -12
- package/dist/_types/sdk/catalog/lifecycle-events.d.ts +438 -12
- package/dist/_types/sdk/catalog/mcp.d.ts +23 -1
- package/dist/_types/sdk/catalog/media-descriptors.d.ts +78 -0
- package/dist/_types/sdk/catalog/navigation.d.ts +38 -12
- package/dist/_types/sdk/catalog/planning-intelligence.d.ts +136 -8
- package/dist/_types/sdk/catalog/provider.d.ts +336 -0
- package/dist/_types/sdk/catalog/reference-preview.d.ts +26 -0
- package/dist/_types/sdk/catalog/shares.d.ts +305 -0
- package/dist/_types/sdk/catalog/speech.d.ts +472 -18
- package/dist/_types/sdk/catalog/visual-exploration.d.ts +432 -44
- package/dist/_types/sdk/catalog/voice-profile.d.ts +1547 -0
- package/dist/_types/sdk/catalog/voice-review.d.ts +1125 -0
- package/dist/_types/sdk/client.d.ts +4 -1
- package/dist/_types/sdk/desktop-previews.d.ts +3 -3
- package/dist/_types/sdk/desktop-releases.d.ts +2 -2
- package/dist/_types/sdk/device-renders.d.ts +274 -11
- package/dist/_types/sdk/feedback-observer.d.ts +10 -0
- package/dist/_types/sdk/index.d.ts +2 -0
- package/dist/_types/sdk/local-runtime/device-client.d.ts +54 -2
- package/dist/_types/sdk/local-runtime-client.d.ts +169 -28
- package/dist/_types/sdk/mcp-client.d.ts +3 -3
- package/dist/_types/sdk/mcp-port.d.ts +69 -0
- package/dist/_types/sdk/media.d.ts +2 -0
- package/dist/_types/sdk/navigation-client.d.ts +2 -60
- package/dist/_types/sdk/navigation-facade.d.ts +33 -7
- package/dist/_types/sdk/observe.d.ts +13 -0
- package/dist/_types/sdk/transport/http.d.ts +2 -0
- package/dist/_types/sdk/webhook-receiver.d.ts +38 -0
- package/dist/account.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/local-runtime.js +1 -1
- package/dist/native/helper.exe +0 -0
- package/dist/native/helper.json +1 -0
- package/dist/runtime-authority.js +1 -1
- package/package.json +1 -1
- package/dist/_chunks/chunk-34GRMUSM.js +0 -1
- package/dist/_chunks/chunk-3SWFHYZF.js +0 -1
- package/dist/_chunks/chunk-CJEQNH37.js +0 -1
- package/dist/_chunks/chunk-DIPWMH32.js +0 -1
- package/dist/_chunks/chunk-VPYAXWXY.js +0 -1
- package/dist/native/Bootstrap.ps1 +0 -90
- package/dist/native/JobNative.cs +0 -137
- package/dist/native/JobRunner.cs +0 -381
- package/dist/native/NativeMain.cs +0 -161
- package/dist/native/PipeBridge.cs +0 -260
- package/dist/native/PrivateAccess.cs +0 -152
package/COMPATIBILITY.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"protocol": "NVS_PRODUCT_COMPATIBILITY_V1",
|
|
3
3
|
"product": "@nativestudio/sdk",
|
|
4
|
-
"version": "0.3.0-rc.
|
|
4
|
+
"version": "0.3.0-rc.15",
|
|
5
5
|
"source": {
|
|
6
|
-
"head": "
|
|
7
|
-
"fileDigest": "
|
|
6
|
+
"head": "14ce7bc53988e7f652a164172ea714d1855c2124",
|
|
7
|
+
"fileDigest": "3d54de2d844501316f701fe9e25a60182a4e2d954675855bdcfb427fce5fcfda",
|
|
8
8
|
"dirty": false,
|
|
9
|
-
"remoteMainHead": "
|
|
9
|
+
"remoteMainHead": "14ce7bc53988e7f652a164172ea714d1855c2124"
|
|
10
10
|
},
|
|
11
11
|
"node": ">=24.12 <25",
|
|
12
12
|
"discoveryProfile": "contextual-v1",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ArtifactIdSchema,ArtifactRelationIdSchema,ArtifactRepresentationIdSchema,BriefIdSchema,BriefVersionIdSchema,ContinuationSchema,ContinuityEdgeIdSchema,DeliveryOutputProfileSchema,HumanLinksSchema,OperationIdSchema,PrincipalIdSchema,ProductionIdSchema,ProjectIdSchema,QueryLimitSchema,QueryPageInfoSchema,SceneIdSchema,SceneShotPlanIdSchema,SceneShotPlanVersionIdSchema,ShotIdSchema,StoryIdSchema,StoryVersionIdSchema,TenantIdSchema,finalProfileIds}from"./chunk-6UYY5KHI.js";import{z}from"zod";var LocalIdSchema=z.uuid().overwrite(v=>v.toLowerCase());var LocalDigestSchema=z.string().length(64).regex(/^[0-9a-f]{64}$/);var LocalRevisionSchema=z.int().positive();var LocalTimeSchema=z.iso.datetime({offset:true});var LocalPackageVersionSchema=z.string().max(120).regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/).refine(v=>v===v.trim());var LocalProjectScopeSchema=z.strictObject({tenantId:LocalIdSchema,projectId:LocalIdSchema});var LocalWorkScopeSchema=LocalProjectScopeSchema.extend({productionId:LocalIdSchema,runtimeJobId:LocalIdSchema});var LocalPlacementPolicySchema=z.discriminatedUnion("mode",[z.strictObject({mode:z.literal("local-only"),deviceId:LocalIdSchema}),z.strictObject({mode:z.literal("local-preferred"),deviceId:LocalIdSchema}),z.strictObject({mode:z.literal("cloud-only")})]);var LocalPlacementAvailabilitySchema=z.discriminatedUnion("status",[z.strictObject({status:z.literal("AVAILABLE"),deviceId:LocalIdSchema}),z.strictObject({status:z.literal("UNAVAILABLE"),deviceId:LocalIdSchema,reason:z.enum(["OFFLINE","UNQUALIFIED","BUSY"])}),z.strictObject({status:z.literal("DENIED"),reason:z.enum(["FORBIDDEN","APPROVAL_REQUIRED","INVALID_INPUT"])})]);import{z as z3}from"zod";import{z as z2}from"zod";var Id=z2.uuid().transform(value2=>value2.toLowerCase());var ReadId=z2.uuid().regex(/^[0-9a-f-]{36}$/);var Key=z2.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);var Revision=z2.int().min(0).max(999999999);var AgentHostScopeSchema=z2.strictObject({tenantId:Id,projectId:Id});var ReadScope=z2.strictObject({tenantId:ReadId,projectId:ReadId});var AgentHostSelectionSchema=z2.strictObject({hostKey:Key,tenantKey:Key,workspaceKey:Key,projectKey:Key,agentKey:Key,agentVersion:z2.int().positive().max(1e9),modelOptionKey:Key});var ConfigureAgentHostSchema=AgentHostScopeSchema.extend({requestId:Id,bindingId:Id,expectedRevision:z2.int().min(0).max(999999998),selection:AgentHostSelectionSchema,apiCredential:z2.string().regex(/^agxk_[A-Za-z0-9_-]{43}$/).meta({writeOnly:true})});var RevokeAgentHostSchema=AgentHostScopeSchema.extend({requestId:Id,bindingId:Id,expectedRevision:z2.int().min(1).max(999999998)});var AgentHostBindingSchema=ReadScope.extend({bindingId:ReadId,revision:Revision.refine(value2=>value2>0),configurationVersion:Revision.refine(value2=>value2>0),enabled:z2.boolean(),selection:AgentHostSelectionSchema,updatedAt:z2.iso.datetime({offset:true})}).refine(value2=>value2.configurationVersion<=value2.revision);var UpdateAgentHostSelectionSchema=ConfigureAgentHostSchema.omit({apiCredential:true}).extend({expectedRevision:z2.int().min(1).max(999999998),expectedConfigurationVersion:z2.int().positive().max(999999998)});var AgentHostCurrentSchema=z2.strictObject({binding:AgentHostBindingSchema.nullable()});var AgentHostHistoryQuerySchema=AgentHostScopeSchema.extend({limit:z2.int().min(1).max(100).default(20),beforeVersion:z2.int().positive().max(999999999).optional()});var AgentHostConfigurationVersionSchema=ReadScope.extend({bindingId:ReadId,version:z2.int().positive().max(999999999),selection:AgentHostSelectionSchema,createdByPrincipalId:ReadId,createdAt:z2.iso.datetime({offset:true}),revokedAt:z2.iso.datetime({offset:true}).nullable()});var AgentHostHistoryPageSchema=z2.strictObject({items:z2.array(AgentHostConfigurationVersionSchema).max(100),hasMore:z2.boolean(),nextBeforeVersion:z2.int().positive().max(999999999).nullable()}).refine(page=>page.hasMore===(page.nextBeforeVersion!==null)&&(!page.hasMore||page.items.length>0));var AgentHostReadinessSchema=ReadScope.extend({binding:AgentHostBindingSchema.nullable(),registeredHostKeys:z2.array(Key).max(16),configurationStatus:z2.enum(["NOT_CONFIGURED","REVOKED","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CONFIGURATION_CHANGED","CONFIGURED"]),remoteCredentialVerification:z2.enum(["NOT_CHECKED","VERIFIED"]),nativeToolAuthority:z2.enum(["NOT_CONNECTED","UNVERIFIED","VERIFIED"]),executionAvailability:z2.enum(["UNAVAILABLE","AVAILABLE"]),reason:z2.enum(["NATIVE_TOOL_AUTHORITY_NOT_CONNECTED","NATIVE_TOOL_AUTHORITY_NOT_QUALIFIED","CONFIGURATION_CHANGED"]).nullable(),checkedAt:z2.iso.datetime({offset:true})}).refine(v=>{const verified=v.nativeToolAuthority==="VERIFIED";return(v.binding===null||v.binding.tenantId===v.tenantId&&v.binding.projectId===v.projectId)&&verified===(v.remoteCredentialVerification==="VERIFIED")&&verified===(v.executionAvailability==="AVAILABLE")&&verified===(v.reason===null)&&(!verified||v.configurationStatus==="CONFIGURED"&&v.binding?.enabled===true)});var AgentHostFailureSchema=z2.strictObject({semanticStatus:z2.enum(["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z2.strictObject({code:z2.enum(["INVALID_INPUT","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","REVISION_CONFLICT","REQUEST_CONFLICT","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CREDENTIAL_SCOPE_MISMATCH","BINDING_REVOKED","INTERNAL_OPERATIONAL_FAILURE"]),message:z2.literal("Agent Host operation did not complete")})});var id=z3.uuid().regex(/^[0-9a-f-]{36}$/);var requestId=z3.uuid().transform(v=>v.toLowerCase());var key=z3.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var NativeRuntimePublicKeySchema=z3.strictObject({kty:z3.literal("EC"),crv:z3.literal("P-256"),x:z3.string().regex(/^[A-Za-z0-9_-]{43}$/),y:z3.string().regex(/^[A-Za-z0-9_-]{43}$/)});var ConfigureNativeToolGrantSchema=AgentHostScopeSchema.extend({requestId,bindingId:requestId,expectedBindingRevision:z3.int().positive(),expectedConfigurationVersion:z3.int().positive(),runtimeKey:key,installationId:key,installationRevisionId:key,publicKey:NativeRuntimePublicKeySchema,expiresAt:z3.iso.datetime({offset:true})});var NativeToolGrantGetSchema=AgentHostScopeSchema.extend({grantId:requestId});var RevokeNativeToolGrantSchema=NativeToolGrantGetSchema.extend({requestId,expectedRevision:z3.int().positive()});var NativeRuntimeProofRequestSchema=NativeToolGrantGetSchema.extend({assertion:z3.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).max(4096).meta({writeOnly:true})});var NativeRuntimeStatusClaimsSchema=z3.strictObject({iss:key,sub:key,aud:z3.url().max(2048),grantId:id,installationRevisionId:key,jti:id,iat:z3.int().nonnegative(),exp:z3.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeRuntimeProofClaimsSchema=z3.strictObject({iss:key,sub:key,aud:z3.url().max(2048),grantId:id,grantRevision:z3.int().positive(),installationRevisionId:key,challengeId:id,jti:id,iat:z3.int().nonnegative(),exp:z3.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeToolGrantViewSchema=z3.strictObject({tenantId:id,projectId:id}).extend({protocol:z3.literal("NATIVESTUDIO_RUNTIME_REGISTRATION_V1"),grantId:id,bindingId:id,bindingRevision:z3.int().positive(),configurationVersion:z3.int().positive(),selection:AgentHostSelectionSchema,runtimeKey:key,installationId:key,installationRevisionId:key,publicKey:NativeRuntimePublicKeySchema,resource:z3.url().max(2048),revision:z3.int().positive(),enabled:z3.boolean(),createdByPrincipalId:id,runtimePrincipalId:id,createdAt:z3.iso.datetime({offset:true}),expiresAt:z3.iso.datetime({offset:true}),challengeId:id,challengeExpiresAt:z3.iso.datetime({offset:true}),verifiedAt:z3.iso.datetime({offset:true}).nullable(),revokedAt:z3.iso.datetime({offset:true}).nullable()}).refine(v=>{const resource=new URL(v.resource);return resource.protocol==="https:"&&!resource.username&&!resource.password&&!resource.search&&!resource.hash&&resource.pathname===`/mcp/native/v1/projects/${v.projectId}`&&v.enabled===(v.revokedAt===null)&&Date.parse(v.challengeExpiresAt)<=Date.parse(v.expiresAt)});import{z as z4}from"zod";var processorFamilies={IMPORTED_VISUAL_NORMALIZE:"ARTIFACT_INGEST",SOURCE_SYNC_AUDIO:"ARTIFACT_INGEST",TEMPORAL_SAMPLE:"TEMPORAL_SAMPLE",DELIVERY_VALIDATE:"DELIVERY_VALIDATE",COMPOSITION_RENDER:"COMPOSITION_RENDER",IMPORT_ORIGINAL:"ARTIFACT_INGEST",LOCAL_MEDIA_INSPECT:"OBSERVE",LOCAL_MEDIA_PUBLISH:"ARTIFACT_INGEST",IMPORT_PROJECT_SOURCE:"ARTIFACT_INGEST",REGISTER_VISUAL_SEQUENCE:"ARTIFACT_INGEST",SPEECH_SYNTHESIZE:"AUDIO_GENERATE",SPEECH_SYNTHESIZE_CPU:"AUDIO_GENERATE",SPEECH_EXTERNAL_QWEN:"AUDIO_GENERATE",TRANSCRIBE_AUDIO:"OBSERVE",TRANSCRIBE_EXTERNAL_QWEN:"OBSERVE",KEYFRAME_GENERATE:"KEYFRAME_GENERATE",VIDEO_GENERATE:"VIDEO_GENERATE"};var TenantProcessorKindSchema=z4.enum(Object.keys(processorFamilies));import{z as z5}from"zod";var validationMode=z5.literal("TENANT_TRUSTED_VALIDATOR").optional();var DeviceRenderTargetSchema=z5.strictObject({mode:z5.literal("tenant-device-only"),deviceId:z5.uuid().optional(),validationMode});var DeviceRenderReceiptSchema=z5.strictObject({mode:z5.literal("tenant-device-only"),deviceId:z5.uuid(),runtimeJobId:z5.uuid(),validationMode});var projectDeviceScope=z5.strictObject({tenantId:z5.uuid(),projectId:z5.uuid(),kind:z5.enum(["preview","final","library",...TenantProcessorKindSchema.options])});var ProjectDeviceListInputSchema=projectDeviceScope.extend({deviceId:z5.uuid().optional()});var ProjectDeviceListSchema=projectDeviceScope.extend({items:z5.array(z5.strictObject({deviceId:z5.uuid(),label:z5.string().trim().min(1).max(120),availability:z5.enum(["AVAILABLE","BUSY","OFFLINE","UNQUALIFIED"])})).max(50),truncated:z5.boolean(),validationMode:z5.literal("TENANT_TRUSTED_VALIDATOR").nullable()});import{z as z6}from"zod";var whisperCppRecognitionProfile=Object.freeze({id:"WHISPER_CPP_TINY_EN_Q5_1_PCM16K_V1",sourceRevision:"2eeeba56e9edd762b4b38467bab96c2517163158",modelSha256:"c77c5766f1cef09b6b7d47f21b546cbddd4157886b3b5d6d4f709e91e66c7c2b",language:"en",sampleRateHz:16e3,maxDurationMs:6e4});var LocalWhisperIdentitySchema=z6.strictObject({profileId:z6.literal(whisperCppRecognitionProfile.id),binarySha256:LocalDigestSchema,modelSha256:z6.literal(whisperCppRecognitionProfile.modelSha256)});var LocalWhisperToolSelectionSchema=z6.strictObject({binaryPath:z6.string().min(1).max(4096),binarySha256:LocalDigestSchema,modelPath:z6.string().min(1).max(4096)});import{z as z7}from"zod";var offset=z7.int().min(0).max(4094).multipleOf(2);var dimension=z7.int().min(2).max(4096).multipleOf(2);var ClipFramingSchema=z7.strictObject({algorithm:z7.literal("CROP_PAD_V1"),crop:z7.strictObject({x:offset,y:offset,width:dimension,height:dimension}),anchorXPermille:z7.int().min(0).max(1e3),anchorYPermille:z7.int().min(0).max(1e3)});var PicturePolicySchema=z7.literal("CROP_PAD_V1");import{z as z8}from"zod";var ClipTransitionSchema=z8.union([z8.literal("CUT"),z8.strictObject({kind:z8.literal("CROSS_DISSOLVE_V1"),durationFrames:z8.int().min(2).max(30)})]);import{z as z9}from"zod";var sha=z9.string().regex(/^[0-9a-f]{64}$/);var GraphicPlacementSchema=z9.strictObject({startFrame:z9.int().nonnegative().max(1800),endFrame:z9.int().positive().max(1800),anchor:z9.enum(["TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","BOTTOM_RIGHT"]),widthPermille:z9.int().min(50).max(400),marginXPermille:z9.int().min(0).max(100),marginYPermille:z9.int().min(0).max(100),opacityPermille:z9.int().min(100).max(1e3)}).refine(v=>v.endFrame>v.startFrame,"Graphic frame interval must advance");var TimelineGraphicInputSchema=z9.strictObject({artifactId:ArtifactIdSchema,placement:GraphicPlacementSchema});var TimelineGraphicSourceSchema=z9.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha,contentType:z9.enum(["image/png","image/webp"]),byteSize:z9.int().positive().max(16*1024*1024),width:z9.int().positive().max(8192),height:z9.int().positive().max(8192)});var TimelineGraphicSchema=z9.strictObject({source:TimelineGraphicSourceSchema,placement:GraphicPlacementSchema});import{z as z10}from"zod";var id2=z10.uuid().toLowerCase();var hash=z10.string().regex(/^[0-9a-f]{64}$/);var CaptionTranscriptPlacementSchema=z10.discriminatedUnion("kind",[z10.strictObject({kind:z10.literal("AUDIO_TRACK"),purpose:z10.enum(["VOICEOVER","MUSIC"])}),z10.strictObject({kind:z10.literal("SPEECH_CUE"),cueId:z10.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)}),z10.strictObject({kind:z10.literal("TIMELINE_OUTPUT")})]);var CaptionTranscriptPlanSchema=z10.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,timelineVersionId:id2,language:z10.string().regex(/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/).max(60),sources:z10.array(z10.strictObject({observationId:id2,placement:CaptionTranscriptPlacementSchema,granularity:z10.enum(["word","segment"])})).min(1).max(64)});var AuthorTranscriptCaptionsSchema=CaptionTranscriptPlanSchema.extend({expectedProductionRevision:z10.int().positive(),expectedCaptionVersion:z10.int().nonnegative(),idempotencyKey:z10.string().trim().min(1).max(200)});var CaptionTranscriptProvenanceSchema=z10.strictObject({schemaVersion:z10.literal(1),advisory:z10.literal(true),timing:z10.literal("PROVIDER_REPORTED"),timelineVersionId:id2,timingFingerprint:hash,sources:z10.array(z10.strictObject({observationId:id2,artifactId:id2,representationId:id2,checksumSha256:hash,placement:CaptionTranscriptPlacementSchema,granularity:z10.enum(["word","segment"]),sourceInMs:z10.int().nonnegative(),sourceOutMs:z10.int().positive(),startMs:z10.int().nonnegative(),spanIndices:z10.array(z10.int().nonnegative().max(1199)).min(1).max(120),excludedSpans:z10.int().nonnegative().max(1200)})).min(1).max(64)});import{z as z11}from"zod";var sha2=z11.string().regex(/^[0-9a-f]{64}$/);var CaptionContentSchema=z11.strictObject({language:z11.string().regex(/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/).max(60),durationMs:z11.int().min(3e4).max(6e4),cues:z11.array(z11.strictObject({startMs:z11.int().nonnegative().max(59999),endMs:z11.int().positive().max(6e4),text:z11.string().min(1).max(240)})).min(1).max(120)});var CaptionScopeSchema=z11.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var AuthorCaptionsSchema=CaptionScopeSchema.extend({expectedProductionRevision:z11.int().positive(),expectedCaptionVersion:z11.int().nonnegative(),idempotencyKey:z11.string().trim().min(1).max(200),content:CaptionContentSchema});var CaptionGetSchema=CaptionScopeSchema.extend({versionId:z11.uuid()});var CaptionQuerySchema=CaptionScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var CaptionRepresentationSchema=z11.strictObject({id:z11.uuid(),checksumSha256:sha2,byteSize:z11.int().positive().max(131072)});var CaptionVersionSchema=CaptionScopeSchema.extend({transcriptProvenance:CaptionTranscriptProvenanceSchema.optional(),id:z11.uuid(),captionId:z11.uuid(),projectId:z11.uuid(),version:z11.int().positive(),artifactId:z11.uuid(),content:CaptionContentSchema,fingerprint:sha2,original:CaptionRepresentationSchema,subtitle:CaptionRepresentationSchema,previousVersionId:z11.uuid().nullable(),createdByPrincipalId:z11.uuid(),createdAt:z11.iso.datetime({offset:true})});var CaptionViewSchema=z11.strictObject({version:CaptionVersionSchema,isCurrent:z11.boolean(),availability:z11.enum(["AVAILABLE","UNAVAILABLE"])});var CaptionReceiptSchema=z11.strictObject({semanticStatus:z11.literal("SUCCESS"),version:CaptionVersionSchema,productionRevision:z11.int().positive()});var CaptionBasisSchema=CaptionScopeSchema.extend({productionRevision:z11.int().positive(),currentVersion:z11.int().nonnegative(),currentVersionId:z11.uuid().nullable(),authorable:z11.boolean()});var CaptionPageSchema=z11.strictObject({items:z11.array(CaptionViewSchema).max(200),page:QueryPageInfoSchema});var CaptionExportSchema=CaptionGetSchema.extend({format:z11.enum(["JSON","SRT"])});var CaptionSnapshotSchema=z11.strictObject({currentVersion:z11.int().positive().nullable(),currentVersionId:z11.uuid().nullable(),artifactId:z11.uuid().nullable(),availability:z11.enum(["NONE","AVAILABLE","UNAVAILABLE"]),cueCount:z11.int().nonnegative().max(120),durationMs:z11.int().min(3e4).max(6e4).nullable(),attachedToTimeline:z11.boolean(),attachedCaptionVersionId:z11.uuid().nullable().optional(),attachedTimelineVersionId:z11.uuid().nullable().optional()});var CaptionTranscriptDraftSchema=z11.strictObject({content:CaptionContentSchema,provenance:CaptionTranscriptProvenanceSchema});import{z as z12}from"zod";var LegacyCaptionRenderStyleSchema=z12.strictObject({id:z12.literal("PLAIN_TEXT_NOTO_SANS_SC_V1"),fontSha256:z12.literal("a3041811a78c361b1de50f953c805e0244951c21c5bd412f7232ef0d899af0da"),framePolicy:z12.literal("PTS_HALF_OPEN_CEIL_V1")});var RegularCaptionRenderStyleSchema=z12.strictObject({id:z12.literal("PLAIN_TEXT_NATIVE_SC_REGULAR_V2"),fontSha256:z12.literal("e5a51f41fc1b827da651afee3975e07a182ff4f8e04d9dfc0a3cecd6177a52b6"),framePolicy:z12.literal("PTS_HALF_OPEN_CEIL_V1")});var CaptionRenderStyleSchema=z12.discriminatedUnion("id",[LegacyCaptionRenderStyleSchema,RegularCaptionRenderStyleSchema]);import{z as z13}from"zod";var VoiceProfileRefSchema=z13.strictObject({ownerSystem:z13.string().regex(/^[a-z][a-z0-9-]{1,79}$/),ownerTenantRef:z13.string().trim().min(1).max(160),voiceProfileRef:z13.string().trim().min(1).max(160),version:z13.int().positive(),digest:z13.string().regex(/^[a-f0-9]{64}$/)});var VoiceLocaleSchema=z13.string().min(2).max(35).refine(value2=>{try{return value2.toLowerCase()!=="auto"&&Intl.getCanonicalLocales(value2).length===1}catch{return false}},"A concrete BCP 47 language is required").describe("Concrete BCP 47 tag, for example zh or en-US; auto is not a language");var VoiceProfileUseSchema=z13.strictObject({ref:VoiceProfileRefSchema,bindingKey:z13.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),language:VoiceLocaleSchema,usage:z13.enum(["AUDITION","PRODUCTION"])});import{z as z14}from"zod";var sha3=z14.string().regex(/^[0-9a-f]{64}$/);var AudioPurposeSchema=z14.enum(["VOICEOVER","MUSIC"]);var AudioProductionScopeSchema=z14.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var AudioScopeSchema=AudioProductionScopeSchema.extend({purpose:AudioPurposeSchema});var AudioMaterialPurposeSchema=z14.enum(["VOICEOVER","MUSIC","VOICE_SAMPLE"]);var AudioReadScopeSchema=AudioScopeSchema.extend({purpose:AudioMaterialPurposeSchema});var AudioMediaSchema=z14.strictObject({profile:z14.literal("PCM_S16LE_48000_V1"),audioCodec:z14.literal("pcm_s16le"),sampleRateHz:z14.literal(48e3),audioChannels:z14.union([z14.literal(1),z14.literal(2)]),sampleCount:z14.int().min(4800).max(288e4),durationMs:z14.int().min(100).max(6e4)}).refine(m=>m.sampleCount*1e3===m.durationMs*m.sampleRateHz,{message:"Exact PCM sample count must match duration"});var AudioImportSchema=AudioScopeSchema.extend({expectedProductionRevision:z14.int().positive(),expectedAudioVersion:z14.int().nonnegative(),idempotencyKey:z14.string().trim().min(1).max(200),contentType:z14.literal("audio/wav"),originalName:z14.string().trim().min(1).max(255).regex(/^[^\p{Cc}]*$/u).optional()});var AudioImportRequestSchema=AudioImportSchema.extend({contentBase64:z14.string().min(60).max(16777216).regex(/^[A-Za-z0-9+/]*={0,2}$/)});var AudioPublicationSchema=AudioImportSchema.extend({purpose:AudioMaterialPurposeSchema});var AudioGetSchema=AudioReadScopeSchema.extend({versionId:z14.uuid()});var AudioQuerySchema=AudioReadScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var AudioRepresentationSchema=z14.strictObject({id:z14.uuid(),checksumSha256:sha3,byteSize:z14.int().min(44).max(12582912)});var AudioVersionSchema=AudioReadScopeSchema.extend({id:z14.uuid(),audioId:z14.uuid(),projectId:z14.uuid(),version:z14.int().positive(),artifactId:z14.uuid(),original:AudioRepresentationSchema,media:AudioMediaSchema,originalName:z14.string().trim().min(1).max(255).regex(/^[^\p{Cc}]*$/u).nullable(),previousVersionId:z14.uuid().nullable(),createdByPrincipalId:z14.uuid(),createdAt:z14.iso.datetime({offset:true}),generation:z14.strictObject({generationId:z14.uuid(),voiceProfile:VoiceProfileUseSchema.optional(),executionClass:z14.enum(["LIVE","TEST_ONLY"]),executionTarget:z14.literal("TENANT_DEVICE").optional(),sourceArtifactId:z14.uuid(),sourceRepresentationId:z14.uuid(),sourceChecksumSha256:sha3,sourceByteSize:z14.int().min(44).max(12582912),sourceMedia:z14.strictObject({sampleRateHz:z14.int().positive().max(48e3),audioChannels:z14.union([z14.literal(1),z14.literal(2)]),sampleCount:z14.int().positive()}),normalizationVersion:z14.literal("SPEECH_PCM_V1"),padSamples:z14.int().min(0).max(47)}).optional()}).refine(v=>v.version===1===(v.previousVersionId===null),{message:"Audio replacement history must preserve exact preceding version"});var AudioViewSchema=z14.strictObject({version:AudioVersionSchema,isCurrent:z14.boolean(),availability:z14.enum(["AVAILABLE","UNAVAILABLE"])});var ProductionAudioVersionSchema=AudioVersionSchema.safeExtend({purpose:AudioPurposeSchema});var AudioReceiptSchema=z14.strictObject({semanticStatus:z14.literal("SUCCESS"),version:AudioVersionSchema,productionRevision:z14.int().positive()});var AudioBasisSchema=AudioReadScopeSchema.extend({productionRevision:z14.int().positive(),currentVersion:z14.int().nonnegative(),currentVersionId:z14.uuid().nullable(),importable:z14.boolean()});var AudioPageSchema=z14.strictObject({items:z14.array(AudioViewSchema).max(200),page:QueryPageInfoSchema});var AudioSnapshotSchema=z14.strictObject({tracks:z14.array(z14.strictObject({purpose:AudioPurposeSchema,currentVersion:z14.int().positive().nullable(),currentVersionId:z14.uuid().nullable(),artifactId:z14.uuid().nullable(),availability:z14.enum(["NONE","AVAILABLE","UNAVAILABLE"]),durationMs:z14.int().min(100).max(6e4).nullable(),audioChannels:z14.union([z14.literal(1),z14.literal(2)]).nullable(),attachedToTimeline:z14.boolean()})).length(2)});import{z as z15}from"zod";var placement={sourceInMs:z15.int().nonnegative().max(6e4),sourceOutMs:z15.int().positive().max(6e4),startMs:z15.int().nonnegative().max(6e4),gainPermille:z15.int().nonnegative().max(1e3)};var TimelineAudioInputSchema=z15.strictObject({tracks:z15.array(z15.strictObject({purpose:AudioPurposeSchema,versionId:z15.uuid(),...placement})).min(1).max(2),duckingMusicPermille:z15.int().nonnegative().max(1e3).default(1e3)}).superRefine((audio,ctx)=>{if(new Set(audio.tracks.map(t=>t.purpose)).size!==audio.tracks.length||audio.tracks.some(t=>t.sourceOutMs<=t.sourceInMs)||audio.duckingMusicPermille<1e3&&audio.tracks.length!==2)ctx.addIssue({code:"custom",message:"Distinct purposes, advancing trims and explicit ducking pair required"})});var AudioMixProfileSchema=z15.strictObject({id:z15.literal("PCM_WINDOW_MIX_AAC_V1"),sampleRateHz:z15.literal(48e3),audioChannels:z15.literal(2),audioCodec:z15.literal("aac"),bitrate:z15.literal(192e3),peakPermille:z15.literal(950),duckingMusicPermille:z15.int().nonnegative().max(1e3)});var TimelineAudioCompositionSchema=z15.strictObject({mix:AudioMixProfileSchema,tracks:z15.array(z15.strictObject({source:ProductionAudioVersionSchema,...placement})).min(1).max(2)}).superRefine((audio,ctx)=>{if(new Set(audio.tracks.map(t=>t.source.purpose)).size!==audio.tracks.length||audio.tracks.some(t=>t.sourceOutMs<=t.sourceInMs||t.sourceOutMs>t.source.media.durationMs)||audio.mix.duckingMusicPermille<1e3&&audio.tracks.length!==2)ctx.addIssue({code:"custom",message:"Invalid exact audio composition"})});var RenderedAudioSchema=z15.strictObject({audioCodec:z15.literal("aac"),sampleRateHz:z15.literal(48e3),audioChannels:z15.literal(2),sampleCount:z15.int().positive().max(288e4)});import{z as z16}from"zod";var Fingerprint=z16.string().regex(/^[0-9a-f]{64}$/);var AcceptedShotReferenceSchema=z16.strictObject({acceptanceId:z16.uuid(),reviewId:z16.uuid(),generationId:z16.uuid(),candidateId:z16.uuid(),shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint,artifactChecksumSha256:Fingerprint,preparationId:z16.uuid(),contractId:z16.uuid(),contractFingerprint:Fingerprint,planVersionId:SceneShotPlanVersionIdSchema,planVersion:z16.int().positive(),shotPlanningRevision:z16.int().positive(),executionClass:z16.enum(["LIVE","TEST_ONLY"]),reviewResult:z16.enum(["PASS","WARNING"])});import{z as z17}from"zod";var ProviderIdSchema=z17.enum(["QWEN_CN","VOLCENGINE_CN","GEMINI","OPENAI","XAI"]);var ProviderConnectionIdSchema=z17.uuid().brand();var ModelProfileIdSchema=z17.string().regex(/^[a-z][a-z0-9-]{1,79}$/);var GeometryPolicySchema=z17.enum(["STRICT","PAD_TO_ASPECT"]);var ProviderSelectionSchema=z17.strictObject({connectionId:ProviderConnectionIdSchema,modelProfileId:ModelProfileIdSchema});var TenantProviderExecutionGrantSchema=z17.strictObject({projectId:z17.uuid(),modelProfileId:ModelProfileIdSchema,modelProfileVersion:z17.int().positive(),workload:z17.enum(["KEYFRAME_GENERATE","VIDEO_GENERATE","SPEECH_SYNTHESIS","TRANSCRIPTION","AUDIO_OBSERVATION","VIDEO_OBSERVATION"]),disclosure:z17.enum(["TEXT_ONLY","IMMUTABLE_PROJECT_INPUTS"]),expiresAt:z17.iso.datetime({offset:true}),maxPerRequestMicros:z17.int().min(0).max(1e9),maxTotalMicros:z17.int().min(0).max(1e9),maxSubmissions:z17.int().min(1).max(1e4)}).refine(v=>v.maxPerRequestMicros<=v.maxTotalMicros);var providerConfigurationFields={providerId:ProviderIdSchema,label:z17.string().trim().min(1).max(100),allowedModelProfileIds:z17.array(ModelProfileIdSchema).min(1).max(16),qwenEndpoint:z17.literal("QIANWEN_PLATFORM").optional(),credentialService:z17.enum(["ARK","DOUBAO_SPEECH"]).optional(),qwenWorkspaceId:z17.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/).optional(),geometryPolicy:GeometryPolicySchema.default("STRICT")};var ProviderConfigurationSchema=z17.strictObject({...providerConfigurationFields,tenantExecution:z17.array(TenantProviderExecutionGrantSchema).min(1).max(64).optional()}).superRefine((v,c)=>{if(new Set(v.allowedModelProfileIds).size!==v.allowedModelProfileIds.length)c.addIssue({code:"custom",message:"Duplicate model profile"});const grants=v.tenantExecution??[];const keys=new Set(grants.map(g=>[g.projectId.toLowerCase(),g.modelProfileId,g.workload].join(":")));if(keys.size!==grants.length||grants.some(g=>!v.allowedModelProfileIds.includes(g.modelProfileId)))c.addIssue({code:"custom",message:"Invalid tenant execution scope",path:["tenantExecution"]});if(v.qwenWorkspaceId&&v.providerId!=="QWEN_CN")c.addIssue({code:"custom",message:"Workspace only applies to Qwen China"});if(v.credentialService&&v.providerId!=="VOLCENGINE_CN")c.addIssue({code:"custom",message:"Credential service applies to Volcengine"});if(v.qwenEndpoint&&(v.providerId!=="QWEN_CN"||v.qwenWorkspaceId))c.addIssue({code:"custom",message:"Qianwen platform requires an exact Qwen route without a workspace"})});var ConfigureProviderInputSchema=z17.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,expectedVersion:z17.int().nonnegative(),configuration:ProviderConfigurationSchema,apiKey:z17.string().min(8).max(4096).regex(/^[!-~]+$/)});var ProviderConnectionViewSchema=z17.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,version:z17.int().positive(),enabled:z17.boolean(),credentialConfigured:z17.boolean(),configuration:z17.object(providerConfigurationFields),createdByPrincipalId:PrincipalIdSchema,updatedAt:z17.iso.datetime({offset:true})});var ProviderConnectionCommandSchema=z17.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,expectedVersion:z17.int().positive()});var ProviderCredentialRevokeSchema=z17.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,version:z17.int().positive()});var SetKeyframeDefaultSchema=z17.strictObject({tenantId:TenantIdSchema,selection:ProviderSelectionSchema,expectedRevision:z17.int().nonnegative()});var ProviderExecutionBindingSchema=z17.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,connectionVersion:z17.int().positive(),providerId:ProviderIdSchema,modelProfileId:ModelProfileIdSchema,modelProfileVersion:z17.int().positive(),modelId:z17.string().min(1).max(160),credentialRef:z17.uuid(),credentialVersion:z17.int().positive(),geometryPolicy:GeometryPolicySchema,qwenEndpoint:z17.literal("QIANWEN_PLATFORM").optional()}).refine(binding=>!binding.qwenEndpoint||binding.providerId==="QWEN_CN",{message:"Qianwen platform binding requires Qwen China"});import{z as z18}from"zod";var GenerationCostVariantSchema=z18.strictObject({mode:z18.enum(["REFERENCE_TO_IMAGE","REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"]),aspectRatio:z18.enum(["16:9","9:16"]),workingWidth:z18.int().min(0).max(4096),workingHeight:z18.int().min(0).max(4096),hasAudio:z18.boolean(),references:z18.int().min(0).max(24),durationSeconds:z18.number().finite().min(0).max(30)});var GenerationCostPolicySchema=z18.strictObject({currency:z18.literal("USD"),sourceUrl:z18.url({protocol:/^https$/}).max(2e3),rationale:z18.string().trim().min(1).max(2e3),validUntil:z18.iso.datetime({offset:true}),rules:z18.array(z18.strictObject({id:z18.string().regex(/^[a-zA-Z0-9_-]{1,80}$/),variant:GenerationCostVariantSchema,upperBoundMicros:z18.int().nonnegative().max(1e9)})).min(1).max(64)}).refine(p=>new Set(p.rules.map(r=>r.id)).size===p.rules.length,"Duplicate cost rule");var ExpectedGenerationExecutionSchema=z18.strictObject({connectionVersion:z18.int().positive(),modelProfileVersion:z18.int().positive(),quoteValidUntil:z18.iso.datetime({offset:true})});var GenerationCostQuoteSchema=z18.strictObject({currency:z18.literal("USD"),upperBoundMicros:z18.int().nonnegative().max(1e9),selection:ProviderSelectionSchema,expectedExecution:ExpectedGenerationExecutionSchema,sourceUrl:z18.url({protocol:/^https$/}).max(2e3),ruleIds:z18.array(z18.string()).min(1).max(64),preparationId:z18.uuid(),contractFingerprint:z18.string().regex(/^[a-f0-9]{64}$/)});import{z as z19}from"zod";var id3=z19.uuid().toLowerCase();var hash2=z19.string().regex(/^[0-9a-f]{64}$/);var NativeVideoAudioMetadataSchema=z19.strictObject({normalizationVersion:z19.literal("VIDEO_AUDIO_PCM_V1"),sourceCodec:z19.literal("aac"),sourceSampleRateHz:z19.int().min(8e3).max(96e3),sourceChannels:z19.union([z19.literal(1),z19.literal(2)]),sourceFrameRateHz:z19.union([z19.literal(24),z19.literal(30)]),sourceFrameCount:z19.int().positive().max(905),sourceStartOffsetMs:z19.number().finite().min(-500).max(5e3),sourceDeclaredDurationMs:z19.number().positive().max(31e3),alignment:z19.literal("TRIM_PAD_PCM_TO_VIDEO_ZERO_V1"),media:z19.strictObject({profile:z19.literal("PCM_S16LE_48000_NATIVE_VIDEO_V1"),audioCodec:z19.literal("pcm_s16le"),sampleRateHz:z19.literal(48e3),audioChannels:z19.union([z19.literal(1),z19.literal(2)]),sampleCount:z19.int().positive().max(1448e3),durationMs:z19.number().positive().max(30200)}).refine(m=>m.durationMs===m.sampleCount/48),checksumSha256:hash2}).superRefine((v,ctx)=>{if(v.media.sampleCount!==v.sourceFrameCount*(48e3/v.sourceFrameRateHz)||v.media.audioChannels!==v.sourceChannels)ctx.addIssue({code:"custom",message:"Native PCM must follow the exact source video frame clock"})});var NativeVideoSoundReferenceSchema=z19.strictObject({id:id3,tenantId:id3,projectId:id3,productionId:id3,shotId:id3,generationId:id3,videoArtifactId:id3,videoRepresentationId:id3,videoChecksumSha256:hash2,artifactId:id3,representationId:id3,checksumSha256:hash2,byteSize:z19.int().min(44).max(12582912),metadata:NativeVideoAudioMetadataSchema,executionClass:z19.enum(["LIVE","TEST_ONLY"])});import{z as z20}from"zod";var KeyframePurposeSchema=z20.enum(["START_FRAME","END_FRAME","SUBJECT_REFERENCE"]);var AcceptedKeyframeReferenceSchema=z20.strictObject({acceptanceId:z20.uuid(),reviewId:z20.uuid(),generationId:z20.uuid(),candidateId:z20.uuid(),shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:z20.string().regex(/^[0-9a-f]{64}$/),artifactChecksumSha256:z20.string().regex(/^[0-9a-f]{64}$/),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z20.int().positive(),shotPlanningRevision:z20.int().positive(),executionClass:z20.enum(["LIVE","TEST_ONLY"])});import{z as z21}from"zod";var ConsistencyReviewScaleSchema=z21.enum(["INTRA_SHOT","INTER_SHOT","PRODUCTION"]);var State=z21.string().trim().min(1).max(300);var StoryTime=z21.int().nonnegative().max(31536e8);var position=z21.int().min(1).max(999);var StateChange=z21.strictObject({atPermille:position,from:State,to:State,reason:State});var TimeJump=z21.strictObject({atPermille:position,fromMs:StoryTime,toMs:StoryTime,reason:State});var ContinuityExpectationSchema=z21.discriminatedUnion("kind",[z21.strictObject({kind:z21.literal("STATE"),mode:z21.enum(["PRESERVE","PLANNED_TRANSITIONS"]),entry:State,exit:State,changes:z21.array(StateChange).min(1).max(16).optional()}).superRefine((v,c)=>{const changes=v.changes??[];if(v.mode==="PLANNED_TRANSITIONS"!==!!changes.length||!changes.length&&v.entry!==v.exit||changes.length&&(changes[0].from!==v.entry||changes.at(-1).to!==v.exit)||changes.some((x,i)=>x.from===x.to||i>0&&(x.atPermille<=changes[i-1].atPermille||x.from!==changes[i-1].to)))c.addIssue({code:"custom",message:"State changes require an ordered explicit plan with exact entry and exit"})}),z21.strictObject({kind:z21.literal("TIME"),mode:z21.enum(["MONOTONIC","PLANNED_JUMPS"]),entryMs:StoryTime,exitMs:StoryTime,jumps:z21.array(TimeJump).min(1).max(16).optional()}).superRefine((v,c)=>{const jumps=v.jumps??[];if(v.mode==="PLANNED_JUMPS"!==!!jumps.length||!jumps.length&&v.exitMs<v.entryMs||jumps.length&&(jumps[0].fromMs<v.entryMs||jumps.at(-1).toMs>v.exitMs)||jumps.some((x,i)=>x.fromMs===x.toMs||i>0&&(x.atPermille<=jumps[i-1].atPermille||x.fromMs<jumps[i-1].toMs)))c.addIssue({code:"custom",message:"Story time requires monotonic segments separated by exact planned jumps"})})]);var ContinuitySampleSchema=z21.strictObject({atMs:z21.int().nonnegative().max(6e4),state:State.optional(),storyTimeMs:StoryTime.optional()}).superRefine((v,c)=>{if(v.state!==void 0===(v.storyTimeMs!==void 0))c.addIssue({code:"custom",message:"A sample observes exactly one state or story-time value"})});var ContinuitySamplesSchema=z21.array(ContinuitySampleSchema).min(3).max(64);import{z as z22}from"zod";var PreparationIdSchema=z22.uuid().brand();var GenerationContractIdSchema=z22.uuid().brand();var ContentFingerprintSchema=z22.string().regex(/^[0-9a-f]{64}$/);var PreparationTargetSchema=z22.discriminatedUnion("mediaType",[z22.strictObject({mediaType:z22.literal("IMAGE"),purpose:z22.enum(["KEYFRAME","REFERENCE_FRAME"]),framePurpose:z22.enum(["START_FRAME","END_FRAME","SUBJECT_REFERENCE"])}),z22.strictObject({mediaType:z22.literal("VIDEO"),purpose:z22.literal("SHOT_CANDIDATE")})]);var PreparationBasisSchema=z22.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,sceneId:SceneIdSchema,shotId:ShotIdSchema,productionRevision:z22.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z22.int().positive(),storyVersionId:StoryVersionIdSchema,storyVersion:z22.int().positive(),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z22.int().positive(),shotPlanningRevision:z22.int().positive(),resolverVersion:z22.literal("w7-product-preflight-v1"),consistencyProfile:z22.strictObject({id:z22.uuid(),version:z22.int().positive(),effectiveFingerprint:ContentFingerprintSchema}).optional()});var ReferenceRoleSchema=z22.enum(["PRODUCT_IDENTITY","PRODUCT_PACKSHOT","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","START_FRAME_ANCHOR","END_FRAME_ANCHOR"]);var ReferenceBindingInputSchema=z22.strictObject({keyframeAcceptanceId:z22.uuid().optional(),role:ReferenceRoleSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:ContentFingerprintSchema,reason:z22.string().trim().min(1).max(500)});var ExactEvidenceReferenceSchema=z22.strictObject({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:ContentFingerprintSchema,artifactChecksumSha256:ContentFingerprintSchema});var ResolvedReferenceSchema=ReferenceBindingInputSchema.extend({artifactChecksumSha256:ContentFingerprintSchema,contentType:z22.enum(["image/png","image/jpeg","image/webp"]),acceptedKeyframe:AcceptedKeyframeReferenceSchema.optional(),consistencyRuleId:z22.uuid().optional(),subjectId:z22.uuid().optional(),authority:z22.enum(["BRIEF_SOURCE_AND_EXPLICIT_BINDING","EXPLICIT_SHOT_BINDING","CANONICAL_PROFILE_MASTER","ACCEPTED_KEYFRAME_AND_EXPLICIT_BINDING"])});var ResolvedConstraintSchema=z22.strictObject({continuity:ContinuityExpectationSchema.optional(),reviewScales:z22.array(ConsistencyReviewScaleSchema).min(1).max(3).optional(),key:z22.string().min(1).max(200),family:z22.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","SHOT_INTENT","BOUNDARY_CONTINUITY"]),scope:z22.enum(["PROJECT","PRODUCTION","SCENE","SHOT","CONTINUITY_EDGE"]),subjectId:z22.uuid().optional(),dimension:z22.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/).optional(),enforcement:z22.enum(["LOCKED","REQUIRED","PREFERRED"]),expected:z22.string().min(1).max(1e3),source:z22.strictObject({kind:z22.enum(["BRIEF","SCENE","SHOT","CONTINUITY_EDGE","CONSISTENCY_PROFILE"]),id:z22.uuid(),version:z22.int().positive()})});var PreparationBlockerSchema=z22.strictObject({code:z22.enum(["MISSING_PRODUCT_REFERENCE","CANONICAL_SOURCE_UNAVAILABLE","CONSTRAINT_CONFLICT","PREVIOUS_SHOT_EVIDENCE_UNAVAILABLE","GENERATED_KEYFRAME_REQUIRED"]),summary:z22.string().min(1).max(1e3),relatedShotId:ShotIdSchema.optional(),edgeId:ContinuityEdgeIdSchema.optional()});var ConstraintSetSchema=z22.strictObject({preparationId:PreparationIdSchema,version:z22.int().positive(),fingerprint:ContentFingerprintSchema,items:z22.array(ResolvedConstraintSchema).max(2048)});var ReferenceSetSchema=z22.strictObject({preparationId:PreparationIdSchema,version:z22.int().positive(),fingerprint:ContentFingerprintSchema,bindings:z22.array(ResolvedReferenceSchema).max(12)});import{z as z23}from"zod";var VideoGenerationIdSchema=z23.uuid().brand();var VideoProviderProfileSchema=z23.strictObject({id:z23.string().regex(/^[a-z][a-z0-9-]{1,79}$/),adapterVersion:z23.string().min(1).max(80),model:z23.string().min(1).max(160),executionClass:z23.enum(["LIVE","TEST_ONLY"]),mediaType:z23.literal("VIDEO"),modes:z23.array(z23.enum(["REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"])).min(1).max(3),referenceRoles:z23.array(ReferenceRoleSchema).min(1).max(8),aspectRatios:z23.array(z23.enum(["16:9","9:16"])).min(1).max(2),minDurationSeconds:z23.int().min(1),maxDurationSeconds:z23.int().max(30),maxReferences:z23.int().min(1).max(10),combineAnchorsAndReferences:z23.boolean(),workingWidth:z23.int().positive().max(4096),workingHeight:z23.int().positive().max(4096),frameRate:z23.union([z23.literal(24),z23.literal(30)]),sourceFormat:z23.strictObject({videoCodec:z23.literal("hevc"),pixelFormat:z23.literal("yuv420p10le")}).optional(),hasAudio:z23.boolean(),nativeAudioChannels:z23.union([z23.literal(1),z23.literal(2)]).optional(),correlationStrategy:z23.literal("PROVIDER_TASK_ID")});var VideoOptionsInputSchema=z23.strictObject({tenantId:TenantIdSchema});var VideoStartInputSchema=z23.strictObject({expectedExecution:ExpectedGenerationExecutionSchema.optional(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,selection:ProviderSelectionSchema,idempotencyKey:z23.string().trim().min(1).max(200)});var VideoDeviceStartInputSchema=VideoStartInputSchema.omit({selection:true,expectedExecution:true}).extend({deviceId:z23.uuid(),approvedQuote:GenerationCostQuoteSchema});var VideoGetInputSchema=z23.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:VideoGenerationIdSchema});var VideoQueryInputSchema=z23.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VideoAdmissionSchema=z23.strictObject({semanticStatus:z23.literal("ACCEPTED"),generationId:VideoGenerationIdSchema,operationId:OperationIdSchema,productionId:ProductionIdSchema,contractId:GenerationContractIdSchema,executionClass:z23.enum(["LIVE","TEST_ONLY"])});var VideoTechnicalMetadataSchema=z23.strictObject({contentType:z23.literal("video/mp4"),checksumSha256:ContentFingerprintSchema,byteSize:z23.int().positive().max(128*1024*1024),width:z23.int().positive().max(4096),height:z23.int().positive().max(4096),durationMs:z23.int().min(1).max(30150),frameRate:z23.number().positive().max(120),videoCodec:z23.enum(["h264","hevc"]),pixelFormat:z23.literal("yuv420p10le").optional(),hasAudio:z23.boolean(),nativeAudio:NativeVideoAudioMetadataSchema.optional()});var VideoPosterSchema=z23.strictObject({representationId:ArtifactRepresentationIdSchema,contentType:z23.literal("image/png"),checksumSha256:ContentFingerprintSchema,byteSize:z23.int().positive().max(2*1024*1024),width:z23.int().positive().max(320),height:z23.int().positive().max(320)});var VideoCandidateSchema=VideoTechnicalMetadataSchema.extend({nativeSound:NativeVideoSoundReferenceSchema.optional(),id:z23.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,poster:VideoPosterSchema,availability:z23.enum(["AVAILABLE","INVALID"]),observation:z23.enum(["NOT_OBSERVED","OBSERVED"]),evaluation:z23.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),accepted:z23.boolean(),reviewId:z23.uuid().optional(),reviewVersion:z23.int().positive().optional(),acceptanceDecisionId:z23.uuid().optional(),freshness:z23.enum(["CURRENT_BASIS","STALE_BASIS"])});var VideoGenerationViewSchema=z23.strictObject({generationId:VideoGenerationIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,connection:z23.strictObject({connectionId:z23.uuid(),connectionVersion:z23.int().positive(),modelProfileId:z23.string(),modelProfileVersion:z23.int().positive()}),operationId:OperationIdSchema,provider:VideoProviderProfileSchema,runtimeStatus:z23.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z23.enum(["NOT_SUBMITTED","SUBMITTING","PENDING","UNKNOWN","SUCCEEDED","FAILED"]),freshness:z23.enum(["CURRENT_BASIS","STALE_BASIS"]),cancellationRequested:z23.boolean(),candidate:VideoCandidateSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z23.iso.datetime({offset:true})});var VideoQueryPageSchema=z23.strictObject({items:z23.array(VideoGenerationViewSchema),page:QueryPageInfoSchema});var VideoSummarySchema=z23.strictObject({generations:z23.int().nonnegative(),running:z23.int().nonnegative(),waiting:z23.int().nonnegative(),registeredCandidates:z23.int().nonnegative(),testCandidates:z23.int().nonnegative(),liveCandidates:z23.int().nonnegative()});import{z as z24}from"zod";var TimelineDurationSchema=z24.strictObject({totalMs:z24.int().positive().max(603e4),targetMs:z24.int().min(3e4).max(6e4),minMs:z24.literal(3e4),maxMs:z24.literal(6e4),deltaTargetMs:z24.int(),classification:z24.enum(["TOO_SHORT","WITHIN_TARGET","TOO_LONG"])});var TimelineClipSchema=z24.strictObject({ordinal:z24.int().positive().max(200),source:AcceptedShotReferenceSchema,technical:VideoTechnicalMetadataSchema,sourceInMs:z24.int().nonnegative(),sourceOutMs:z24.int().positive(),startMs:z24.int().nonnegative(),durationMs:z24.int().positive(),transition:ClipTransitionSchema,framing:ClipFramingSchema.optional()});var TimelineManifestSchema=z24.strictObject({schemaVersion:z24.literal(1),caption:CaptionVersionSchema.optional(),captionStyle:CaptionRenderStyleSchema.optional(),audio:TimelineAudioCompositionSchema.optional(),graphics:z24.array(TimelineGraphicSchema).max(8).optional(),basis:z24.strictObject({briefVersionId:BriefVersionIdSchema,briefVersion:z24.int().positive(),storyVersion:z24.int().positive(),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z24.int().positive()}),output:z24.strictObject({aspectRatio:z24.enum(["16:9","9:16"]),profile:DeliveryOutputProfileSchema}),clips:z24.array(TimelineClipSchema).min(1).max(200),duration:TimelineDurationSchema,missingPlannedShotIds:z24.array(ShotIdSchema).max(200),executionClass:z24.enum(["LIVE","TEST_ONLY"])});var TimelineVersionIdentityShape={id:z24.uuid(),timelineId:z24.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z24.int().positive(),fingerprint:z24.string().regex(/^[0-9a-f]{64}$/),createdByPrincipalId:PrincipalIdSchema,createdAt:z24.iso.datetime({offset:true})};function validateTimelineAttachments(timeline,context){if(timeline.audio?.tracks.some(t=>t.source.tenantId!==timeline.tenantId||t.source.projectId!==timeline.projectId||t.source.productionId!==timeline.productionId||t.startMs+t.sourceOutMs-t.sourceInMs>timeline.duration.totalMs||(t.startMs+t.sourceOutMs-t.sourceInMs)*48>Math.round(timeline.duration.totalMs*30/1e3)*1600))context.addIssue({code:"custom",message:"Timeline audio ownership or physical placement mismatch"});const caption=timeline.caption;if(timeline.captionStyle&&!caption)context.addIssue({code:"custom",message:"Timeline caption style requires an exact caption"});if(caption&&(caption.tenantId!==timeline.tenantId||caption.projectId!==timeline.projectId||caption.productionId!==timeline.productionId||caption.content.durationMs!==timeline.duration.totalMs))context.addIssue({code:"custom",message:"Timeline caption ownership or duration mismatch"})}var TimelineVersionSchema=TimelineManifestSchema.extend(TimelineVersionIdentityShape).superRefine(validateTimelineAttachments);import{z as z25}from"zod";var RoughCutProfileIdSchema=z25.enum(["PREVIEW_H264_480P_V1","PREVIEW_H264_720P_V1","PREVIEW_H264_1080P_V1"]);var RoughCutProfileSchema=z25.strictObject({captionPolicy:z25.literal("BURN_IN").optional(),captionStyle:CaptionRenderStyleSchema.optional(),graphicsPolicy:z25.literal("OVERLAY_V1").optional(),id:RoughCutProfileIdSchema,algorithm:z25.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),picturePolicy:PicturePolicySchema.optional(),width:z25.union([z25.literal(854),z25.literal(480),z25.literal(1280),z25.literal(720),z25.literal(1920),z25.literal(1080)]),height:z25.union([z25.literal(854),z25.literal(480),z25.literal(1280),z25.literal(720),z25.literal(1920),z25.literal(1080)]),frameRate:z25.literal(30),codec:z25.literal("h264"),pixelFormat:z25.literal("yuv420p"),fit:z25.literal("PAD"),hasAudio:z25.boolean(),audioMix:AudioMixProfileSchema.optional(),framePolicy:z25.literal("CUMULATIVE_NEAREST_FRAME")}).superRefine((profile,context)=>{const pair=profile.id==="PREVIEW_H264_480P_V1"?[854,480]:profile.id==="PREVIEW_H264_720P_V1"?[1280,720]:[1920,1080];if(!(profile.width===pair[0]&&profile.height===pair[1]||profile.width===pair[1]&&profile.height===pair[0]))context.addIssue({code:"custom",message:"Exact preview profile geometry required"});if(profile.hasAudio!==!!profile.audioMix)context.addIssue({code:"custom",message:"Audio policy requires exact native mix"});if(!!profile.captionStyle!==!!profile.captionPolicy)context.addIssue({code:"custom",message:"Caption policy and style must agree"})});import{z as z26}from"zod";var RoughCutManifestSchema=z26.strictObject({schemaVersion:z26.literal(1),timeline:TimelineVersionSchema,profile:RoughCutProfileSchema,frames:z26.array(z26.strictObject({ordinal:z26.int().positive().max(200),startFrame:z26.int().nonnegative().max(1800),frameCount:z26.int().positive().max(1800),overlapFrames:z26.int().nonnegative().max(30).default(0)})).min(1).max(200),totalFrames:z26.int().min(900).max(1800)});import{z as z27}from"zod";var Fingerprint2=z27.string().regex(/^[0-9a-f]{64}$/);var ProgrammaticAcceptedVisualSourceReferenceSchema=z27.strictObject({sourceKind:z27.literal("PROGRAMMATIC"),acceptanceId:z27.uuid(),reviewId:z27.uuid(),renderId:z27.uuid(),compositionId:z27.uuid(),compositionVersionId:z27.uuid(),compositionVersion:z27.int().positive(),compositionFingerprint:Fingerprint2,renderManifestFingerprint:Fingerprint2,shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint2,artifactChecksumSha256:Fingerprint2,planVersionId:SceneShotPlanVersionIdSchema,planVersion:z27.int().positive(),shotPlanningRevision:z27.int().positive(),executionClass:z27.enum(["LIVE","TEST_ONLY"]),reviewResult:z27.enum(["PASS","WARNING"])});var ImportedAcceptedVisualSourceReferenceSchema=z27.strictObject({sourceKind:z27.literal("IMPORTED"),acceptanceId:z27.uuid(),reviewId:z27.uuid(),normalizationId:z27.uuid(),sourceId:z27.uuid(),sourceVersionId:z27.uuid(),shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint2,executionClass:z27.enum(["LIVE","TEST_ONLY"]),reviewResult:z27.enum(["PASS","WARNING"])});var AcceptedVisualSourceReferenceSchema=z27.union([AcceptedShotReferenceSchema,ProgrammaticAcceptedVisualSourceReferenceSchema,ImportedAcceptedVisualSourceReferenceSchema]);import{z as z28}from"zod";var id4=z28.uuid().toLowerCase();var hash3=z28.string().regex(/^[0-9a-f]{64}$/);var ImportedSynchronousAudioPurposeSchema=z28.literal("SOURCE_SYNC");var SourceSyncPcmMediaSchema=z28.strictObject({profile:z28.literal("PCM_S16LE_48000_SOURCE_SYNC_V1"),audioCodec:z28.literal("pcm_s16le"),sampleRateHz:z28.literal(48e3),audioChannels:z28.union([z28.literal(1),z28.literal(2)]),sampleCount:z28.int().min(1600).max(576e3),durationMs:z28.number().positive().max(12e3)}).refine(m=>m.sampleCount%1600===0&&m.durationMs===m.sampleCount/48);var ImportedSynchronousAudioExtractionSchema=z28.strictObject({schemaVersion:z28.literal(1),purpose:ImportedSynchronousAudioPurposeSchema,tenantId:id4,projectId:id4,productionId:id4,shotId:id4,sourceId:id4,sourceVersionId:id4,normalizationId:id4,originalArtifactId:id4,originalRepresentationId:id4,originalChecksumSha256:hash3,sourceRange:z28.strictObject({clock:z28.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z28.int().nonnegative().max(1799),endFrame:z28.int().positive().max(1800)}),destinationStartSample:z28.literal(0)}).refine(v=>v.sourceRange.endFrame>v.sourceRange.startFrame&&v.sourceRange.endFrame-v.sourceRange.startFrame<=360);var ImportedSynchronousAudioSourceSchema=z28.strictObject({schemaVersion:z28.literal(1),purpose:ImportedSynchronousAudioPurposeSchema,tenantId:id4,projectId:id4,productionId:id4,shotId:id4,sourceId:id4,sourceVersionId:id4,normalizationId:id4,originalArtifactId:id4,originalRepresentationId:id4,originalChecksumSha256:hash3,sourceRange:z28.strictObject({clock:z28.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z28.int().nonnegative(),endFrame:z28.int().positive()}),destinationStartSample:z28.int().nonnegative(),media:z28.union([AudioMediaSchema,SourceSyncPcmMediaSchema]),wavChecksumSha256:hash3,wavByteSize:z28.int().min(44).max(12582912)}).superRefine((v,ctx)=>{if(v.sourceRange.endFrame<=v.sourceRange.startFrame||(v.sourceRange.endFrame-v.sourceRange.startFrame)*1600!==v.media.sampleCount)ctx.addIssue({code:"custom",message:"Exact CFR30 interval and PCM48k sample mapping required"})});import{z as z29}from"zod";var id5=z29.uuid().toLowerCase();var key2=z29.string().trim().min(1).max(200);var SourceSyncAudioStartSchema=z29.strictObject({tenantId:id5,productionId:id5,normalizationId:id5,expectedProductionRevision:z29.int().positive(),expectedVersion:z29.int().nonnegative(),idempotencyKey:key2});var SourceSyncAudioGetSchema=z29.strictObject({tenantId:id5,productionId:id5,shotId:id5,versionId:id5});var SourceSyncAudioVersionSchema=z29.strictObject({schemaVersion:z29.literal(1),purpose:z29.literal("SOURCE_SYNC"),id:id5,audioId:id5,version:z29.int().positive(),tenantId:id5,projectId:id5,productionId:id5,shotId:id5,normalizationId:id5,artifactId:id5,representationId:id5,provenance:ImportedSynchronousAudioSourceSchema,previousVersionId:id5.nullable(),executionClass:z29.enum(["LIVE","TEST_ONLY"]),createdByPrincipalId:id5,createdAt:z29.iso.datetime({offset:true})});var SourceSyncAudioReceiptSchema=z29.strictObject({semanticStatus:z29.literal("SUCCESS"),version:SourceSyncAudioVersionSchema,productionRevision:z29.int().positive()});var SourceSyncAudioViewSchema=z29.strictObject({version:SourceSyncAudioVersionSchema,status:z29.enum(["CURRENT","STALE"]),availability:z29.enum(["AVAILABLE","UNAVAILABLE"])});import{z as z30}from"zod";var SourceSoundTreatmentSchema=z30.strictObject({policy:z30.enum(["KEEP","MUTE","DUCK"]),gainPermille:z30.int().min(0).max(1e3),duckingPermille:z30.int().min(0).max(1e3)}).superRefine((v,c)=>{if(v.policy==="MUTE"&&v.gainPermille!==0||v.policy!=="DUCK"&&v.duckingPermille!==1e3)c.addIssue({code:"custom",message:"Mute requires zero gain; ducking requires explicit DUCK"})});import{z as z31}from"zod";var SpeechParameterValueSchema=z31.union([z31.string().max(4096),z31.number().finite(),z31.boolean(),z31.array(z31.string().max(4096)).max(100),z31.record(z31.string().min(1).max(100),z31.string().max(4096)).refine(v=>Object.keys(v).length<=100)]);var SpeechParameterRuleSchema=z31.strictObject({label:z31.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),type:z31.enum(["NUMBER","INTEGER","STRING","BOOLEAN","STRING_ARRAY","STRING_MAP"]),required:z31.boolean().default(false),min:z31.number().optional(),max:z31.number().optional(),maxLength:z31.int().positive().max(4096).optional(),options:z31.array(z31.string().min(1).max(100)).max(100).optional(),default:SpeechParameterValueSchema.optional(),unit:z31.string().max(40).optional(),description:z31.string().max(500).optional(),maxItems:z31.int().positive().max(100).optional(),maxKeyLength:z31.int().positive().max(100).optional()});var SpeechParametersSchema=z31.record(z31.string().regex(/^[a-z][a-z0-9_]{0,49}$/),SpeechParameterValueSchema).refine(p=>Object.keys(p).length<=24);var SpeechVoiceSchema=z31.strictObject({id:z31.string().min(1).max(100),label:z31.string().min(1).max(100),languages:z31.array(z31.string().min(2).max(20)).min(1).max(32).optional(),parameterDefaults:SpeechParametersSchema.optional(),parameterOptions:z31.record(z31.string(),z31.array(z31.string().min(1).max(100)).min(1).max(100)).optional(),unsupportedParameters:z31.array(z31.string()).max(24).optional()});var cpuSpeechResources={schemaVersion:1,wrapper:{name:"sherpa-onnx-node",url:"https://registry.npmjs.org/sherpa-onnx-node/-/sherpa-onnx-node-1.12.33.tgz",byteSize:10289,sha256:"c56a08c884dcd3ec4b4d815edea4aabbff62fbcd1b0176e88480b5d9b920fa03"},engines:[{platform:"linux-x64",package:"sherpa-onnx-linux-x64",url:"https://registry.npmjs.org/sherpa-onnx-linux-x64/-/sherpa-onnx-linux-x64-1.12.33.tgz",byteSize:10137208,sha256:"651f529869249628c3e304744ab21d658f880be3684e8ead93702f2055bfb5d1",engineDigest:"dbc8c7bcdcd9dc24183894eabb945001ae001fe69cd16c427f01cf41e598c33a",fileCount:25,unpackedBytes:30623890},{platform:"linux-arm64",package:"sherpa-onnx-linux-arm64",url:"https://registry.npmjs.org/sherpa-onnx-linux-arm64/-/sherpa-onnx-linux-arm64-1.12.33.tgz",byteSize:12826691,sha256:"fec1be880a3e6a79e30db4075690759218a28923fafda51983649bcae3efdfbf",engineDigest:"447387941363150362e034f0e8bceb11922b95f11d8553882b7386ad24f1e92f",fileCount:25,unpackedBytes:37679333},{platform:"darwin-x64",package:"sherpa-onnx-darwin-x64",url:"https://registry.npmjs.org/sherpa-onnx-darwin-x64/-/sherpa-onnx-darwin-x64-1.12.33.tgz",byteSize:25289549,sha256:"137082336fa9bf721385c85828b29766dd0d8e0ce67dcc8691d9a5daa7171ce9",engineDigest:"a298b1bd79b690a7cc26eed975980ff69262967627340525a9ef66a8ca45b091",fileCount:26,unpackedBytes:85413811},{platform:"darwin-arm64",package:"sherpa-onnx-darwin-arm64",url:"https://registry.npmjs.org/sherpa-onnx-darwin-arm64/-/sherpa-onnx-darwin-arm64-1.12.33.tgz",byteSize:22164444,sha256:"c5d96d89deadb042f603a83dd0b93b9f147ca635ae3316e83718cd5566c0b61a",engineDigest:"f409d0ef9b864983c784b27369b40a20a988347ecfdbc27a34ea8a8533ccb589",fileCount:26,unpackedBytes:75969095}],model:{url:"https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-int8-multi-lang-v1_1.tar.bz2",byteSize:147052523,sha256:"259c9c8bc906d6078e4e0570421885dabb68b539c2f970fcbb890a58eeaf3e9c",directory:"kokoro-int8-multi-lang-v1_1",treeDigest:"ebd0959580940e20dbb10a55775ec94e47229c7c503f65932403fe0764667126",fileCount:377,unpackedBytes:215227172}};import{z as z32}from"zod";var kokoroCpuProfile=Object.freeze({id:"KOKORO_INT8_ZH_EN_V1",adapter:"KOKORO_ONNX_CPU_V1",engineVersion:"1.12.33",engineDigest:"f409d0ef9b864983c784b27369b40a20a988347ecfdbc27a34ea8a8533ccb589",modelDigest:"ebd0959580940e20dbb10a55775ec94e47229c7c503f65932403fe0764667126",modelArchiveSha256:"259c9c8bc906d6078e4e0570421885dabb68b539c2f970fcbb890a58eeaf3e9c",sampleRateHz:24e3,speakerCount:103,maxCharacters:600,maxDurationMs:6e4});var CpuSpeechToolSelectionSchema=z32.strictObject({engineDirectory:z32.string().min(1).max(4096),modelDirectory:z32.string().min(1).max(4096)});var CpuSpeechInputSchema=z32.strictObject({text:z32.string().min(1).max(kokoroCpuProfile.maxCharacters).refine(s=>s.trim().length>0&&!new RegExp("\\p{Cc}","u").test(s.replace(/[\t\n]/g,""))&&new TextEncoder().encode(s).length<=2400),voiceId:z32.int().min(0).max(kokoroCpuProfile.speakerCount-1),language:z32.enum(["zh","en"]),speed:z32.number().min(.5).max(2).default(1)});var SpeechDeliverySchema=z32.discriminatedUnion("mode",[z32.strictObject({mode:z32.literal("NON_STREAMING"),output:z32.literal("COMPLETE_AUDIO")}),z32.strictObject({mode:z32.literal("SENTENCE_CHUNKED"),output:z32.literal("ORDERED_SENTENCES")}),z32.strictObject({mode:z32.literal("TRUE_STREAMING"),output:z32.literal("CONTINUOUS_AUDIO")})]);var CpuSpeechIdentitySchema=z32.strictObject({profileId:z32.literal(kokoroCpuProfile.id),adapter:z32.literal(kokoroCpuProfile.adapter),platform:z32.strictObject({os:z32.enum(["darwin","linux"]),architecture:z32.enum(["arm64","x64"])}),engineVersion:z32.literal(kokoroCpuProfile.engineVersion),engineDigest:LocalDigestSchema,modelDigest:z32.literal(kokoroCpuProfile.modelDigest),bridgeSha256:LocalDigestSchema,nodeSha256:LocalDigestSchema}).refine(v=>cpuSpeechResources.engines.some(e=>e.platform===v.platform.os+"-"+v.platform.architecture&&e.engineDigest===v.engineDigest));var CpuSpeechObservationSchema=z32.strictObject({inputSha256:LocalDigestSchema,voiceId:CpuSpeechInputSchema.shape.voiceId,language:CpuSpeechInputSchema.shape.language,outputSha256:LocalDigestSchema,outputBytes:z32.int().min(4844).max(2880044),sampleRateHz:z32.literal(kokoroCpuProfile.sampleRateHz),sampleCount:z32.int().min(2400).max(144e4),durationMs:z32.number().min(100).max(kokoroCpuProfile.maxDurationMs),modelLoadMs:z32.number().nonnegative(),synthesisMs:z32.number().nonnegative(),outputReadyMs:z32.number().positive(),realTimeFactor:z32.number().nonnegative(),cpuMs:z32.number().nonnegative(),peakRssBytes:z32.int().positive()});var CpuSpeechQualificationSchema=z32.strictObject({identity:CpuSpeechIdentitySchema,delivery:z32.strictObject({mode:z32.literal("NON_STREAMING"),output:z32.literal("COMPLETE_AUDIO")}),cancellation:z32.literal("OWNED_PROCESS"),technicalStatus:z32.literal("TECHNICALLY_OBSERVED"),listeningStatus:z32.literal("NOT_PROVEN"),observations:z32.array(CpuSpeechObservationSchema).min(3).max(24),observedAt:z32.iso.datetime({offset:true})});var CpuSpeechCapabilitySchema=z32.strictObject({identity:CpuSpeechIdentitySchema,voices:z32.array(z32.strictObject({voiceId:CpuSpeechInputSchema.shape.voiceId,languages:z32.array(CpuSpeechInputSchema.shape.language).min(1).max(2).refine(v=>new Set(v).size===v.length)})).min(1).max(8).refine(v=>new Set(v.map(s=>s.voiceId)).size===v.length)});var CpuSpeechInstallationSchema=CpuSpeechToolSelectionSchema.extend({voiceIds:z32.array(CpuSpeechInputSchema.shape.voiceId).min(1).max(8).refine(v=>new Set(v).size===v.length)});import{z as z33}from"zod";var NativeSpeechExecutionSchema=z33.strictObject({schemaVersion:z33.literal(1),profileId:z33.literal(kokoroCpuProfile.id),modelDigest:z33.literal(kokoroCpuProfile.modelDigest)});var speed=SpeechParameterRuleSchema.safeExtend({type:z33.literal("NUMBER"),min:z33.number().min(.5).max(2),max:z33.number().min(.5).max(2),default:z33.number().min(.5).max(2).default(1)}).refine(r=>r.min<=r.max&&r.default>=r.min&&r.default<=r.max);var voice=SpeechVoiceSchema.safeExtend({id:z33.string().regex(/^(?:[0-9]|[1-9][0-9]|10[0-2])$/),languages:z33.array(z33.enum(["zh","en"])).min(1).max(2).optional()});var NativeSpeechModelProfileSchema=z33.strictObject({id:ModelProfileIdSchema,version:z33.int().positive(),label:z33.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),protocol:z33.literal(kokoroCpuProfile.adapter),execution:NativeSpeechExecutionSchema,textMaxCharacters:z33.int().min(1).max(kokoroCpuProfile.maxCharacters),languages:z33.array(z33.enum(["zh","en"])).min(1).max(2).refine(v=>new Set(v).size===v.length),voices:z33.array(voice).min(1).max(kokoroCpuProfile.speakerCount).refine(v=>new Set(v.map(voice2=>voice2.id)).size===v.length),parameters:z33.strictObject({speed}),sourceUrl:z33.literal("https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/kokoro.html"),output:z33.literal("PCM_S16LE_48000_V1"),normalizationVersion:z33.literal("SPEECH_PCM_V1")});import{z as z34}from"zod";var receiptId=z34.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/);var resultHost="dashscope-result-bj.oss-cn-beijing.aliyuncs.com";var maxQwenTtsAudioBytes=12*1024*1024;var QwenTtsReceiptSchema=z34.strictObject({providerRequestId:receiptId,audioId:receiptId,audioUrl:z34.url().max(8192).meta({writeOnly:true}),expiresAt:z34.iso.datetime(),usage:z34.strictObject({characters:z34.int().min(0).max(6e3)}).optional()}).refine(({audioUrl,expiresAt})=>{try{const url=new URL(audioUrl);const expires=url.searchParams.getAll("Expires");return url.href===audioUrl&&url.protocol==="https:"&&url.hostname===resultHost&&!url.username&&!url.password&&!url.port&&!url.hash&&url.pathname.endsWith(".wav")&&(expires.length===0||expires.length===1&&/^\d{1,12}$/.test(expires[0])&&Number(expires[0])*1e3===Date.parse(expiresAt))}catch{return false}},"Invalid Qwen TTS audio receipt");var QwenSpeechProviderStateSchema=z34.discriminatedUnion("state",[z34.strictObject({state:z34.literal("RECEIVED"),receipt:QwenTtsReceiptSchema}),z34.strictObject({state:z34.literal("UNKNOWN")}),z34.strictObject({state:z34.literal("REJECTED")})]);import{z as z35}from"zod";var MacSpeechIdentitySchema=z35.strictObject({adapter:z35.literal("MACOS_SAY_V1"),voiceId:z35.literal("com.apple.speech.synthesis.voice.Albert"),locale:z35.literal("en-US"),systemBuild:z35.string().regex(/^[A-Za-z0-9]{1,40}$/),saySha256:LocalDigestSchema,sandboxSha256:LocalDigestSchema,synthesizerSha256:LocalDigestSchema,voiceCatalogSha256:LocalDigestSchema,voiceProbeSha256:LocalDigestSchema});var MacSpeechInputSchema=z35.strictObject({text:z35.string().min(1).max(2e3).refine(text=>text.trim().length>0&&!text.includes("[[")&&!new RegExp("\\p{Cc}","u").test(text)&&new TextEncoder().encode(text).length<=4096),rateWordsPerMinute:z35.int().min(80).max(240)});var SpeechSynthesisRecipeSchema=MacSpeechInputSchema.extend({processor:z35.literal("SPEECH_SYNTHESIZE"),identity:MacSpeechIdentitySchema});var audioObject=z35.strictObject({checksumSha256:LocalDigestSchema,byteSize:z35.int().min(44).max(12*1024*1024)});var SpeechSynthesisEvidenceSchema=z35.strictObject({processor:z35.literal("SPEECH_SYNTHESIZE"),source:audioObject,normalized:audioObject,sourceMedia:z35.strictObject({sampleRateHz:z35.literal(22050),audioChannels:z35.literal(1),sampleCount:z35.int().min(2205).max(1323e3)}),media:AudioMediaSchema.refine(value2=>value2.audioChannels===1),padSamples:z35.int().min(0).max(47)});var QwenSpeechRecipeSchema=z35.strictObject({processor:z35.literal("SPEECH_EXTERNAL_QWEN"),generationId:LocalIdSchema,quoteFingerprint:LocalDigestSchema});var QwenSpeechEvidenceSchema=SpeechSynthesisEvidenceSchema.extend({processor:z35.literal("SPEECH_EXTERNAL_QWEN"),providerRequestId:QwenTtsReceiptSchema.shape.providerRequestId,audioId:QwenTtsReceiptSchema.shape.audioId,sourceMedia:z35.strictObject({sampleRateHz:z35.literal([8e3,12e3,16e3,22050,24e3,32e3,44100,48e3]),audioChannels:z35.union([z35.literal(1),z35.literal(2)]),sampleCount:z35.int().min(800).max(288e4)}).refine(({sampleRateHz,sampleCount})=>sampleCount>=sampleRateHz/10&&sampleCount<=sampleRateHz*60)});import{z as z36}from"zod";var NativeSpeechOptionsSchema=z36.strictObject({schemaVersion:z36.literal(1),models:z36.array(z36.strictObject({modelProfileId:ModelProfileIdSchema,modelProfileVersion:z36.int().positive(),label:z36.string().min(1).max(100),profileId:z36.literal(kokoroCpuProfile.id),textMaxCharacters:z36.int().min(1).max(kokoroCpuProfile.maxCharacters)})).max(20),devices:z36.array(z36.strictObject({deviceId:z36.uuid(),label:z36.string().min(1).max(120),profileId:z36.literal(kokoroCpuProfile.id),voices:CpuSpeechCapabilitySchema.shape.voices})).max(50),possiblyTruncated:z36.boolean()});import{z as z37}from"zod";var SpeechModelProfileSchema=z37.strictObject({id:ModelProfileIdSchema,version:z37.int().positive(),providerId:ProviderIdSchema,modelId:z37.string().min(1).max(160).nullable(),protocol:z37.enum(["QWEN_TTS","QWEN_AUDIO_TTS","OPENAI_TTS","XAI_TTS","GEMINI_INTERACTIONS_TTS","VOLCENGINE_TTS"]),label:z37.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),textMaxCharacters:z37.int().positive().max(6e3),requestTimeoutMs:z37.int().positive().max(3e5),workspaceRequired:z37.boolean(),voices:z37.array(SpeechVoiceSchema).min(1).max(100),languages:z37.array(z37.string().min(2).max(20)).min(1).max(32),parameters:z37.record(z37.string().regex(/^[a-z][a-z0-9_]{0,49}$/),SpeechParameterRuleSchema),sourceUrl:z37.url().max(2048),verifiedAt:z37.iso.date(),providerTextMaxCharacters:z37.int().positive().nullable(),resourceId:z37.string().min(1).max(100).nullable(),output:z37.literal("PCM_S16LE_48000_V1"),normalizationVersion:z37.literal("SPEECH_PCM_V1")});var SpeechScopeSchema=z37.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var SpeechExecutionBindingSchema=z37.strictObject({tenantId:TenantIdSchema,connectionId:z37.uuid(),connectionVersion:z37.int().positive(),credentialRef:z37.uuid(),credentialVersion:z37.int().positive(),profile:SpeechModelProfileSchema,executionClass:z37.enum(["LIVE","TEST_ONLY"])});var SpeechStartSchema=SpeechScopeSchema.extend({voiceProfile:VoiceProfileUseSchema.optional(),soundCue:z37.strictObject({soundPlanVersionId:z37.uuid(),cueId:z37.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)}).optional(),expectedProductionRevision:z37.int().positive(),expectedAudioVersion:z37.int().nonnegative(),expectedModelProfileVersion:z37.int().positive(),idempotencyKey:z37.string().trim().min(1).max(200),selection:ProviderSelectionSchema,text:z37.string().min(1).max(6e3).refine(s=>s.trim().length>0&&!s.includes("\0")),voice:z37.string().min(1).max(100),parameters:SpeechParametersSchema.default({})});var SpeechGetSchema=SpeechScopeSchema.extend({generationId:z37.uuid()});var SpeechAdmissionSchema=z37.strictObject({humanLinks:HumanLinksSchema.optional(),semanticStatus:z37.literal("ACCEPTED"),generationId:z37.uuid(),runtimeJobId:z37.uuid(),productionRevision:z37.int().positive(),executionClass:z37.enum(["LIVE","TEST_ONLY"])});var SpeechGenerationViewSchema=SpeechAdmissionSchema.omit({semanticStatus:true}).extend({tenantId:TenantIdSchema,productionId:ProductionIdSchema,soundCue:SpeechStartSchema.shape.soundCue,voiceProfile:VoiceProfileUseSchema.optional(),text:z37.string().min(1).max(6e3),voice:z37.string().min(1).max(100),parameters:SpeechParametersSchema,profile:SpeechModelProfileSchema,connectionId:z37.uuid(),connectionVersion:z37.int().positive(),runtimeStatus:z37.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z37.enum(["NOT_SUBMITTED","SUBMITTING","UNKNOWN","SUCCEEDED","REJECTED"]),cancellationRequested:z37.boolean(),result:AudioReceiptSchema.nullable(),createdAt:z37.iso.datetime({offset:true})});var localSpeechBody=z37.strictObject({expectedProductionRevision:SpeechStartSchema.shape.expectedProductionRevision,expectedAudioVersion:SpeechStartSchema.shape.expectedAudioVersion,idempotencyKey:SpeechStartSchema.shape.idempotencyKey,text:SpeechStartSchema.shape.text,rateWordsPerMinute:MacSpeechInputSchema.shape.rateWordsPerMinute.optional(),voiceProfile:VoiceProfileUseSchema.optional(),soundCue:SpeechStartSchema.shape.soundCue,deviceExecution:z37.strictObject({deviceId:z37.uuid().optional()})});function refineLocalSpeech(v,ctx){const valid=v.voiceProfile?v.rateWordsPerMinute===void 0&&CpuSpeechInputSchema.shape.text.safeParse(v.text).success&&(v.voiceProfile.usage!=="AUDITION"||!v.soundCue):false;const systemValid=!v.voiceProfile&&!v.soundCue&&MacSpeechInputSchema.safeParse({text:v.text,rateWordsPerMinute:v.rateWordsPerMinute}).success;if(!(v.voiceProfile?valid:systemValid))ctx.addIssue({code:"custom",message:"Exact saved CPU voice or anonymous system voice required"})}var LocalSpeechBodySchema=localSpeechBody.superRefine(refineLocalSpeech);var LocalSpeechStartSchema=SpeechScopeSchema.extend(localSpeechBody.shape).superRefine(refineLocalSpeech);var NativeSpeechBindingSchema=z37.strictObject({profile:NativeSpeechModelProfileSchema,voice:z37.string().min(1).max(100),parameters:SpeechParametersSchema});var NativeSpeechBasisSchema=z37.strictObject({schemaVersion:z37.literal(1),modelProfileId:ModelProfileIdSchema,modelProfileVersion:z37.int().positive(),label:z37.string().min(1).max(100),voice:z37.string().min(1).max(100),parameters:SpeechParametersSchema,execution:NativeSpeechExecutionSchema});var LocalSpeechBindingSchema=z37.strictObject({target:z37.literal("TENANT_DEVICE"),tenantId:TenantIdSchema,deviceId:z37.uuid(),identity:z37.union([MacSpeechIdentitySchema,CpuSpeechIdentitySchema]),native:NativeSpeechBindingSchema.optional(),executionClass:z37.literal("LIVE")}).refine(v=>v.identity.adapter==="KOKORO_ONNX_CPU_V1"===!!v.native);var localSpeechExecution=z37.strictObject({target:z37.literal("TENANT_DEVICE"),deviceId:z37.uuid(),identity:LocalSpeechBindingSchema.shape.identity});var LocalSpeechAdmissionSchema=SpeechAdmissionSchema.extend({executionClass:z37.literal("LIVE"),deviceExecution:localSpeechExecution});var LocalSpeechGenerationViewSchema=SpeechGenerationViewSchema.omit({voiceProfile:true,soundCue:true,parameters:true,profile:true,voice:true,connectionId:true,connectionVersion:true,providerStatus:true}).extend({executionClass:z37.literal("LIVE"),deviceExecution:localSpeechExecution,rateWordsPerMinute:MacSpeechInputSchema.shape.rateWordsPerMinute.optional(),voiceProfile:VoiceProfileUseSchema.optional(),soundCue:SpeechStartSchema.shape.soundCue,nativeBasis:NativeSpeechBasisSchema.optional()});var SpeechOptionsSchema=SpeechScopeSchema.extend({native:NativeSpeechOptionsSchema.optional(),options:z37.array(z37.strictObject({selection:ProviderSelectionSchema,profile:SpeechModelProfileSchema,connectionLabel:z37.string().min(1).max(100),connectionVersion:z37.int().positive(),executionTarget:z37.literal("TENANT_DEVICE").optional()})).max(100),possiblyTruncated:z37.boolean()});import{z as z38}from"zod";var KeyframeGenerationIdSchema=z38.uuid().brand();var KeyframeProviderProfileSchema=z38.strictObject({id:z38.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,79}$/),adapterVersion:z38.string().min(1).max(80),model:z38.string().min(1).max(120),executionClass:z38.enum(["LIVE","TEST_ONLY"]),mediaType:z38.literal("IMAGE"),mode:z38.literal("REFERENCE_TO_IMAGE"),referenceRoles:z38.array(ReferenceRoleSchema).min(1).max(6),aspectRatios:z38.array(z38.enum(["16:9","9:16"])).min(1).max(2),maxReferences:z38.int().min(1).max(12),correlationLookup:z38.boolean()});var KeyframeStartInputSchema=z38.strictObject({expectedExecution:ExpectedGenerationExecutionSchema.optional(),selection:ProviderSelectionSchema.optional(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,idempotencyKey:z38.string().trim().min(1).max(200)});var KeyframeDeviceStartInputSchema=KeyframeStartInputSchema.omit({selection:true,expectedExecution:true}).extend({deviceId:z38.uuid(),approvedQuote:GenerationCostQuoteSchema});var KeyframeGetInputSchema=z38.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:KeyframeGenerationIdSchema});var KeyframeQueryInputSchema=z38.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeAdmissionSchema=z38.strictObject({semanticStatus:z38.literal("ACCEPTED"),generationId:KeyframeGenerationIdSchema,operationId:OperationIdSchema,productionId:ProductionIdSchema,contractId:GenerationContractIdSchema,executionClass:z38.enum(["LIVE","TEST_ONLY"])});var KeyframeCandidateSchema=z38.strictObject({id:z38.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,availability:z38.enum(["AVAILABLE","INVALID"]),observation:z38.enum(["NOT_OBSERVED","OBSERVED"]),evaluation:z38.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),accepted:z38.boolean(),reviewId:z38.uuid().optional(),reviewVersion:z38.int().positive().optional(),acceptanceDecisionId:z38.uuid().optional(),freshness:z38.enum(["CURRENT_BASIS","STALE_BASIS"]),checksumSha256:ContentFingerprintSchema,contentType:z38.enum(["image/png","image/jpeg","image/webp"]),byteSize:z38.int().positive(),width:z38.int().positive(),height:z38.int().positive()});var KeyframeGenerationViewSchema=z38.strictObject({connection:z38.strictObject({connectionId:z38.uuid(),connectionVersion:z38.int().positive(),modelProfileId:z38.string(),modelProfileVersion:z38.int().positive()}).optional(),generationId:KeyframeGenerationIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,operationId:OperationIdSchema,provider:KeyframeProviderProfileSchema,runtimeStatus:z38.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z38.enum(["NOT_SUBMITTED","SUBMITTING","PENDING","UNKNOWN","SUCCEEDED","FAILED"]),freshness:z38.enum(["CURRENT_BASIS","STALE_BASIS"]),cancellationRequested:z38.boolean(),candidate:KeyframeCandidateSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z38.iso.datetime({offset:true})});var KeyframeQueryPageSchema=z38.strictObject({items:z38.array(KeyframeGenerationViewSchema),page:QueryPageInfoSchema});var KeyframeMediaSchema=z38.strictObject({contentType:z38.enum(["image/png","image/jpeg","image/webp"]),checksumSha256:ContentFingerprintSchema,byteSize:z38.int().positive().max(8*1024*1024),contentBase64:z38.string().min(4).max(4*Math.ceil(8*1024*1024/3))});var KeyframeSummarySchema=z38.strictObject({generations:z38.int().nonnegative(),running:z38.int().nonnegative(),waiting:z38.int().nonnegative(),registeredCandidates:z38.int().nonnegative(),testCandidates:z38.int().nonnegative(),liveCandidates:z38.int().nonnegative()});import{z as z39}from"zod";var MatrixParameterRuleSchema=SpeechParameterRuleSchema.extend({numberOptions:z39.array(z39.number().finite()).min(1).max(32).optional()}).superRefine((r,ctx)=>{const numeric=r.type==="NUMBER"||r.type==="INTEGER";const stringValid=v=>typeof v==="string"&&v.length<=(r.maxLength??4096)&&(!r.options||r.options.includes(v));const valid=v=>numeric?typeof v==="number"&&Number.isFinite(v)&&(r.type!=="INTEGER"||Number.isInteger(v))&&(r.min===void 0||v>=r.min)&&(r.max===void 0||v<=r.max)&&(!r.numberOptions||r.numberOptions.includes(v)):r.type==="BOOLEAN"?typeof v==="boolean":r.type==="STRING"?stringValid(v):r.type==="STRING_ARRAY"?Array.isArray(v)&&v.length<=(r.maxItems??100)&&v.every(stringValid):!!v&&typeof v==="object"&&!Array.isArray(v)&&Object.keys(v).length<=(r.maxItems??100)&&Object.entries(v).every(([k,item])=>k.length>0&&k.length<=(r.maxKeyLength??100)&&stringValid(item));if(r.min!==void 0&&r.max!==void 0&&r.min>r.max||r.numberOptions&&(!numeric||new Set(r.numberOptions).size!==r.numberOptions.length||r.numberOptions.some(v=>!valid(v)))||r.default!==void 0&&!valid(r.default))ctx.addIssue({code:"custom",message:"Typed parameter range, choices and default must agree"})});import{z as z40}from"zod";var AsrProfileSchema=z40.strictObject({id:ModelProfileIdSchema,version:z40.int().positive(),providerId:ProviderIdSchema,sourceUrl:z40.url().max(2048),verifiedAt:z40.iso.date(),modelId:z40.string().min(1).max(160),label:z40.string().min(1).max(100),protocol:z40.enum(["OPENAI_TRANSCRIPTION_V1","OPENAI_WHISPER_TRANSCRIPTION_V1","QWEN_ASR_V1"]),modes:z40.tuple([z40.literal("TRANSCRIPTION")]),inputKinds:z40.array(z40.enum(["AUDIO","VIDEO"])).min(1).max(2),requestTimeoutMs:z40.int().min(1e3).max(18e4),maxBytes:z40.int().positive().max(12582912),maxDurationMs:z40.int().positive().max(6e4),parameters:z40.record(z40.string().regex(/^[a-z][a-z0-9_]{0,49}$/),MatrixParameterRuleSchema)}).superRefine((p,c)=>{const openai=p.providerId==="OPENAI";const whisper=p.protocol==="OPENAI_WHISPER_TRANSCRIPTION_V1";const fields=openai?whisper?{prompt:"STRING",language:"STRING",temperature:"NUMBER",timestamp_granularities:"STRING_ARRAY"}:{prompt:"STRING",languages:"STRING_ARRAY",keywords:"STRING_ARRAY"}:{context:"STRING",language:"STRING",enable_itn:"BOOLEAN"};if(p.providerId!==(p.protocol==="QWEN_ASR_V1"?"QWEN_CN":"OPENAI")||new Set(p.inputKinds).size!==p.inputKinds.length||!openai&&(p.maxBytes>7340032||p.inputKinds.includes("VIDEO"))||Object.entries(p.parameters).some(([key4,rule])=>fields[key4]!==rule.type))c.addIssue({code:"custom",message:"ASR protocol capability mismatch"});if(whisper){const rule=p.parameters.timestamp_granularities;if(!rule?.required||!rule.options?.length||rule.options.some(v=>!["word","segment"].includes(v)))c.addIssue({code:"custom",message:"Timed ASR requires explicit supported granularities"});const temperature=p.parameters.temperature;if(temperature&&(temperature.min===void 0||temperature.min<0||temperature.max===void 0||temperature.max>1))c.addIssue({code:"custom",message:"Whisper temperature must stay within 0\u20131"})}});var TranscriptText={schemaVersion:z40.literal(1),text:z40.string().max(6e4),languages:z40.array(z40.string().min(2).max(40)).max(32)};var TimedText=z40.strictObject({text:z40.string().min(1).max(2500),startMs:z40.int().nonnegative().max(6e4),endMs:z40.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Transcript interval must advance");var TranscriptSchema=z40.discriminatedUnion("timing",[z40.strictObject({...TranscriptText,timing:z40.literal("UNAVAILABLE")}),z40.strictObject({...TranscriptText,timing:z40.literal("PROVIDER_REPORTED"),timeBase:z40.literal("ORIGINAL_MEDIA_MS"),granularities:z40.array(z40.enum(["word","segment"])).min(1).max(2),words:z40.array(TimedText).max(1200),segments:z40.array(TimedText).max(240)}).superRefine((v,c)=>{if(new Set(v.granularities).size!==v.granularities.length)c.addIssue({code:"custom",message:"Duplicate timing granularity"});for(const[kind,items]of[["word",v.words],["segment",v.segments]]){if(!v.granularities.includes(kind)&&items.length>0||v.granularities.includes(kind)&&v.text.trim()&&!items.length||items.some((item,i)=>i>0&&item.startMs<items[i-1].endMs))c.addIssue({code:"custom",message:"Missing, unordered or overlapping Provider timing"})}})]);import{z as z41}from"zod";var ObservationModeSchema=z41.enum(["AUDIO","AUDIOVISUAL","VIDEO","VIDEO_ALL_FRAMES","TRANSCRIPTION"]);var ObservationParametersSchema=SpeechParametersSchema;var VisualObservationProfileSchema=z41.strictObject({id:ModelProfileIdSchema,version:z41.int().positive(),providerId:ProviderIdSchema,sourceUrl:z41.url().max(2048),modelId:z41.string().min(1).max(160),label:z41.string().min(1).max(100),protocol:z41.enum(["GEMINI_INTERACTIONS_V1","QIANWEN_VIDEO_V1"]),modes:z41.array(z41.enum(["AUDIO","AUDIOVISUAL","VIDEO","VIDEO_ALL_FRAMES"])).min(1).max(4),requestTimeoutMs:z41.int().min(1e3).max(18e4),maxBytes:z41.int().positive().max(12582912),maxDurationMs:z41.int().positive().max(6e4),parameters:z41.record(z41.string(),z41.strictObject({type:z41.enum(["NUMBER","INTEGER","BOOLEAN","STRING"]),min:z41.number().optional(),max:z41.number().optional(),options:z41.array(z41.string()).max(20).optional(),default:z41.union([z41.number().finite(),z41.boolean(),z41.string().max(200)])}))}).superRefine((p,c)=>{if(new Set(p.modes).size!==p.modes.length)c.addIssue({code:"custom",message:"Duplicate observation mode"});if((p.protocol==="QIANWEN_VIDEO_V1"||p.modes.includes("AUDIOVISUAL"))&&p.maxBytes>8388608)c.addIssue({code:"custom",message:"Video observation input exceeds supported bound"});const gemini=p.protocol==="GEMINI_INTERACTIONS_V1";const allowed=gemini?["max_output_tokens"]:["fps","max_tokens"];if(p.providerId!==(gemini?"GEMINI":"QWEN_CN")||p.modes.some(m=>!(gemini?["AUDIO","AUDIOVISUAL"]:["VIDEO","VIDEO_ALL_FRAMES"]).includes(m))||Object.keys(p.parameters).some(k=>!allowed.includes(k))||allowed.some(k=>!p.parameters[k]))c.addIssue({code:"custom",message:"Observation protocol/profile mismatch"});for(const[k,r]of Object.entries(p.parameters)){const n=r.default;const lo=k==="fps"?1:256,hi=k==="fps"?10:4096;if(typeof n!=="number"||!["NUMBER","INTEGER"].includes(r.type)||k!=="fps"&&r.type!=="INTEGER"||r.min===void 0||r.max===void 0||r.min<lo||r.max>hi||r.min>r.max||n<r.min||n>r.max||r.type==="INTEGER"&&!Number.isSafeInteger(n))c.addIssue({code:"custom",message:"Unsupported observation parameter rule"})}});var ObservationProfileSchema=z41.union([VisualObservationProfileSchema,AsrProfileSchema]);import{z as z42}from"zod";var ProviderTenantInputSchema=z42.strictObject({tenantId:TenantIdSchema});var ImageModelProfileSchema=z42.strictObject({referenceRoles:z42.array(ReferenceRoleSchema.exclude(["START_FRAME_ANCHOR","END_FRAME_ANCHOR"])).min(1).max(6).optional(),id:ModelProfileIdSchema,version:z42.int().positive(),providerId:ProviderIdSchema,modelId:z42.string().min(1).max(160),protocol:z42.enum(["QWEN_EDIT","ARK_IMAGE","GEMINI_IMAGE","OPENAI_IMAGE","XAI_IMAGE"]),maxReferences:z42.int().positive(),promptMaxUtf8Bytes:z42.int().positive(),requestTimeoutMs:z42.int().positive(),workingWidth:z42.int().nonnegative(),workingHeight:z42.int().nonnegative()});var VideoModelProfileSchema=z42.strictObject({id:ModelProfileIdSchema,version:z42.int().positive(),providerId:ProviderIdSchema,modelId:z42.string().min(1).max(160),protocol:z42.enum(["QWEN_VIDEO","VOLCENGINE_VIDEO"]),requestTimeoutMs:z42.int().positive(),promptMaxCharacters:z42.int().positive(),resolution:z42.enum(["720P","1080P"]),adapterVersion:z42.string().min(1).max(80),capabilities:VideoProviderProfileSchema.omit({id:true,adapterVersion:true,model:true,executionClass:true})});var ProviderDefaultViewSchema=z42.strictObject({selection:ProviderSelectionSchema,revision:z42.int().positive()});var scan=z42.strictObject({limit:z42.literal(100),possiblyTruncated:z42.boolean()});var ProviderConnectionPageSchema=scan.extend({items:z42.array(ProviderConnectionViewSchema).max(100)});var ProviderModelsViewSchema=z42.strictObject({catalog:z42.array(ImageModelProfileSchema).max(100),videoCatalog:z42.array(VideoModelProfileSchema).max(100),speechCatalog:z42.array(SpeechModelProfileSchema).max(100).default([]),observationCatalog:z42.array(ObservationProfileSchema).max(100).default([]),available:z42.array(z42.strictObject({selection:ProviderSelectionSchema,profile:KeyframeProviderProfileSchema})).max(1600),defaultSelection:ProviderDefaultViewSchema.nullable(),connectionScan:scan});import{z as z43}from"zod";var key3=z43.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,99}$/);var value=z43.union([z43.string().max(160),z43.number().finite(),z43.boolean()]);var ModelAudioCapabilitySchema=z43.enum(["SYNCHRONIZED_AUDIO","SPEECH_GENERATION","SPEECH_RECOGNITION","TRANSCRIPT_TIMESTAMPS","VOICE_REFERENCE","AUDIO_REFERENCE","AUDIO_DRIVEN_VIDEO","LIP_SYNCHRONIZATION","AUDIO_EDITING","SEPARATE_STEMS"]);var ModelCapabilityMatrixSchema=z43.strictObject({schemaVersion:z43.literal(1),service:key3,lifecycle:z43.enum(["ACTIVE","DEPRECATED","RETIRED"]),sources:z43.array(z43.strictObject({url:z43.url().max(2048),checkedAt:z43.iso.date()})).min(1).max(8),modes:z43.array(key3).min(1).max(16),claims:z43.array(z43.strictObject({capability:ModelAudioCapabilitySchema,modes:z43.array(key3).min(1).max(16),support:z43.enum(["SUPPORTED","UNSUPPORTED","UNKNOWN"]),control:z43.enum(["PARAMETER","PROMPT","ALWAYS_ON","MEDIA_INPUT","NONE"]),parameterPath:key3.optional(),access:z43.enum(["PUBLIC","QUALIFIED_ACCOUNT"]).default("PUBLIC"),description:z43.string().max(600).optional()})).max(64),parameters:z43.record(key3,MatrixParameterRuleSchema),constraints:z43.array(z43.strictObject({modes:z43.array(key3).min(1).max(16),when:z43.strictObject({parameter:key3,equals:value}).optional(),require:z43.array(key3).max(16).default([]),forbid:z43.array(key3).max(16).default([]),requireValues:z43.record(key3,value).default({}),reason:z43.string().min(1).max(300)})).max(32),references:z43.array(z43.strictObject({kind:z43.enum(["VOICE_ID","AUDIO_REFERENCE","DRIVING_AUDIO"]),modes:z43.array(key3).min(1).max(16),parameterPath:key3,maxItems:z43.int().min(1).max(10),minDurationMs:z43.int().positive().optional(),maxDurationMs:z43.int().positive().max(6e4).optional(),maxTotalDurationMs:z43.int().positive().max(6e4).optional(),maxBytes:z43.int().positive().max(67108864).optional(),formats:z43.array(z43.enum(["WAV","MP3"])).max(2),requiresVisual:z43.boolean(),access:z43.enum(["PUBLIC","QUALIFIED_ACCOUNT"])})).max(16),outputAudioChannels:z43.union([z43.literal(1),z43.literal(2)]).optional()}).superRefine((m,ctx)=>{const modes=new Set(m.modes);const claims=m.claims.flatMap(c=>c.modes.map(mode=>`${c.capability}:${mode}:${c.access}`));if(modes.size!==m.modes.length||new Set(claims).size!==claims.length||Object.keys(m.parameters).length>48||[...m.claims,...m.constraints,...m.references].some(r=>r.modes.some(mode=>!modes.has(mode)))||m.claims.some(r=>r.control==="PARAMETER"&&(!r.parameterPath||!Object.hasOwn(m.parameters,r.parameterPath)))||m.constraints.some(r=>r.when&&!Object.hasOwn(m.parameters,r.when.parameter)))ctx.addIssue({code:"custom",message:"Matrix modes and parameter references must resolve"});for(const rule of Object.values(m.parameters))if(rule.min!==void 0&&rule.max!==void 0&&rule.min>rule.max)ctx.addIssue({code:"custom",message:"Matrix parameter range must advance"})});import{z as z44}from"zod";var rate=z44.int().positive().max(1e9);var ruleId=z44.string().regex(/^[a-zA-Z0-9_-]{1,80}$/);var sourceUrl=z44.url({protocol:/^https$/}).max(2e3).refine(value2=>{const url=new URL(value2);return!url.username&&!url.password&&!url.search});function speechCostUpperBoundMicros(characters,microsPerMillion){return Math.ceil(characters*microsPerMillion/1e6)}var SpeechCostPolicySchema=z44.strictObject({currency:z44.literal("USD"),unit:z44.literal("INPUT_CHARACTER"),ruleId,upperBoundMicrosPerMillionCharacters:rate,sourceUrl,validUntil:z44.iso.datetime({offset:true})});var SpeechCostQuoteSchema=z44.strictObject({workload:z44.literal("SPEECH_SYNTHESIS"),currency:z44.literal("USD"),projectId:ProjectIdSchema,selection:ProviderSelectionSchema,expectedExecution:ExpectedGenerationExecutionSchema.extend({credentialVersion:z44.int().positive()}),intentFingerprint:z44.string().regex(/^[a-f0-9]{64}$/),textCharacters:z44.int().min(1).max(600),billableCharactersUpperBound:z44.int().min(1).max(2400),upperBoundMicros:z44.int().positive().max(1e9),upperBoundMicrosPerMillionCharacters:rate,ruleId,sourceUrl}).refine(value2=>value2.billableCharactersUpperBound>=value2.textCharacters&&value2.billableCharactersUpperBound<=value2.textCharacters*4&&value2.upperBoundMicros===speechCostUpperBoundMicros(value2.billableCharactersUpperBound,value2.upperBoundMicrosPerMillionCharacters),"Speech quote must match its exact character bound and rate");var SpeechDeviceStartSchema=SpeechStartSchema.extend({deviceId:z44.uuid().optional(),approvedQuote:SpeechCostQuoteSchema});import{z as z45}from"zod";var cost={costPolicy:GenerationCostPolicySchema.optional()};var matrix={matrix:ModelCapabilityMatrixSchema.optional()};var ProviderModelDefinitionSchema=z45.discriminatedUnion("family",[z45.strictObject({family:z45.literal("NATIVE_SPEECH"),profile:NativeSpeechModelProfileSchema}),z45.strictObject({family:z45.literal("IMAGE"),profile:ImageModelProfileSchema,...matrix,...cost}),z45.strictObject({family:z45.literal("VIDEO"),profile:VideoModelProfileSchema,...matrix,...cost}),z45.strictObject({family:z45.literal("SPEECH"),profile:SpeechModelProfileSchema,...matrix}),z45.strictObject({family:z45.literal("OBSERVATION"),profile:ObservationProfileSchema,...matrix}),z45.strictObject({family:z45.literal("DECLARED"),profile:z45.strictObject({id:ModelProfileIdSchema,version:z45.int().positive(),providerId:ProviderIdSchema,modelId:z45.string().min(1).max(160),protocol:z45.literal("DOCUMENTED_ONLY")}),matrix:ModelCapabilityMatrixSchema})]);var ProviderModelViewSchema=z45.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,version:z45.int().positive(),enabled:z45.boolean(),definition:ProviderModelDefinitionSchema}).refine(v=>v.id===v.definition.profile.id&&v.version===v.definition.profile.version,{message:"Model version identity mismatch"});var ConfigureProviderModelSchema=z45.strictObject({tenantId:TenantIdSchema,expectedVersion:z45.int().nonnegative(),definition:ProviderModelDefinitionSchema,speechCostPolicy:SpeechCostPolicySchema.optional()}).refine(v=>!v.speechCostPolicy||v.definition.family==="SPEECH",{message:"Speech cost policy requires a speech model"}).refine(v=>v.definition.profile.version===v.expectedVersion+1,{message:"Next model version required"}).refine(v=>new TextEncoder().encode(JSON.stringify(v.definition)).length<=65536,{message:"Model definition too large"});var DisableProviderModelSchema=z45.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,expectedVersion:z45.int().positive()});var ProviderModelPageSchema=z45.strictObject({items:z45.array(ProviderModelViewSchema).max(100),possiblyTruncated:z45.boolean()});var ProviderModelGetSchema=z45.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,version:z45.int().positive().optional()});import{z as z46}from"zod";var id6=z46.uuid().toLowerCase();var SoundPlanScopeSchema=z46.strictObject({tenantId:id6,productionId:id6});var SoundPlanBasisSchema=z46.strictObject({briefVersionId:id6,briefVersion:z46.int().positive(),storyVersionId:id6,storyVersion:z46.int().positive(),planVersionId:id6,planVersion:z46.int().positive()});var SoundPlanModelSchema=z46.strictObject({modelProfileId:z46.string().regex(/^[a-z][a-z0-9-]{1,79}$/),modelProfileVersion:z46.int().positive(),connectionId:id6});var SoundPlanNativeSpeechSchema=SoundPlanModelSchema.omit({connectionId:true}).extend({schemaVersion:z46.literal(1),execution:NativeSpeechExecutionSchema});var SoundMakingPlanContentSchema=z46.strictObject({visuals:z46.array(z46.strictObject({shotId:id6,method:z46.enum(["CODE","GENERATED","IMPORTED"]),model:SoundPlanModelSchema.optional(),nativeAudio:z46.boolean().optional(),sourceSound:SourceSoundTreatmentSchema,rationale:z46.string().trim().min(1).max(600)})).min(1).max(200),cues:z46.array(z46.strictObject({id:z46.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),role:z46.enum(["NARRATION","DIALOGUE","MUSIC","AMBIENCE","SOUND_EFFECT"]),source:z46.enum(["TTS","NATIVE_VIDEO","IMPORTED_AUDIO","EXISTING_AUDIO"]),shotIds:z46.array(id6).min(1).max(200),startMs:z46.int().min(0).max(6e4),endMs:z46.int().positive().max(6e4),text:z46.string().trim().min(1).max(6e3).optional(),voice:z46.string().min(1).max(100).optional(),voiceProfile:VoiceProfileUseSchema.extend({usage:z46.literal("PRODUCTION")}).optional(),model:SoundPlanModelSchema.optional(),nativeModel:SoundPlanNativeSpeechSchema.optional(),parameters:SpeechParametersSchema.optional(),audio:z46.strictObject({purpose:z46.enum(["VOICEOVER","MUSIC"]),versionId:z46.uuid()}).optional(),lipSync:z46.enum(["REQUIRED","NONE"]),exactSpeech:z46.boolean()})).max(64),unknowns:z46.array(z46.string().trim().min(1).max(300)).max(16)}).superRefine((v,c)=>{if(new Set(v.visuals.map(s=>s.shotId)).size!==v.visuals.length||new Set(v.cues.map(s=>s.id)).size!==v.cues.length)c.addIssue({code:"custom",message:"Visual Shot and cue identities must be unique"});for(const s of v.visuals)if(s.method==="GENERATED"!==!!s.model||s.method==="GENERATED"&&s.nativeAudio===void 0||s.method!=="GENERATED"&&s.nativeAudio!==void 0||s.method==="CODE"&&s.sourceSound.policy!=="MUTE")c.addIssue({code:"custom",message:"Generated visuals require a model; CODE has no native sound"});for(const cue of v.cues)if(cue.endMs<=cue.startMs||new Set(cue.shotIds).size!==cue.shotIds.length||cue.source==="TTS"&&(!cue.text||!cue.voice||!!cue.model===!!cue.nativeModel||cue.nativeModel&&!cue.voiceProfile||!["NARRATION","DIALOGUE"].includes(cue.role))||cue.exactSpeech&&!cue.text||["NARRATION","DIALOGUE"].includes(cue.role)&&!cue.text||["IMPORTED_AUDIO","EXISTING_AUDIO"].includes(cue.source)!==!!cue.audio||cue.audio&&((["NARRATION","DIALOGUE"].includes(cue.role)?"VOICEOVER":"MUSIC")!==cue.audio.purpose||!["NARRATION","DIALOGUE","MUSIC"].includes(cue.role))||cue.source!=="TTS"&&(!!cue.voice||!!cue.model||!!cue.nativeModel||!!cue.parameters||!!cue.voiceProfile)||cue.source==="NATIVE_VIDEO"&&["NARRATION","DIALOGUE"].includes(cue.role)&&cue.shotIds.length!==1||cue.lipSync==="REQUIRED"&&(cue.source!=="NATIVE_VIDEO"||cue.shotIds.length!==1))c.addIssue({code:"custom",message:"Invalid speech, cue timing or synchronization intent"})});var SoundPlanVersionSchema=SoundPlanScopeSchema.extend({id:id6,soundPlanId:id6,projectId:id6,version:z46.int().positive(),basis:SoundPlanBasisSchema,content:SoundMakingPlanContentSchema,createdByPrincipalId:id6,createdAt:z46.iso.datetime({offset:true})});var SoundPlanValidateSchema=SoundPlanScopeSchema.extend({expectedProductionRevision:z46.int().positive(),basis:SoundPlanBasisSchema,content:SoundMakingPlanContentSchema});var SoundPlanAcceptSchema=SoundPlanValidateSchema.extend({expectedVersion:z46.int().nonnegative(),idempotencyKey:z46.string().trim().min(1).max(200)});var SoundPlanGetSchema=SoundPlanScopeSchema.extend({versionId:id6.optional()});var SoundPlanDiagnosticSchema=z46.strictObject({severity:z46.enum(["ERROR","WARNING"]),code:z46.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),shotId:id6.optional(),cueId:z46.string().max(64).optional(),message:z46.string().max(500)});var SoundPlanValidationSchema=z46.strictObject({executable:z46.boolean(),diagnostics:z46.array(SoundPlanDiagnosticSchema).max(256),semantics:z46.literal("PLAN_VALIDATION_NOT_CREATIVE_OR_LISTENING_APPROVAL")});var SoundPlanViewSchema=z46.strictObject({version:SoundPlanVersionSchema,current:z46.boolean(),freshness:z46.enum(["CURRENT_BASIS","STALE_BASIS"])});var SoundPlanReceiptSchema=z46.strictObject({semanticStatus:z46.literal("SUCCESS"),version:SoundPlanVersionSchema,productionRevision:z46.int().positive()});var SoundPlanContextSchema=SoundPlanScopeSchema.extend({projectId:id6,productionRevision:z46.int().positive(),runnable:z46.boolean(),basis:SoundPlanBasisSchema.nullable(),targetDurationMs:z46.int().positive().nullable(),shots:z46.array(z46.strictObject({shotId:id6,durationMs:z46.int().positive()})).max(200),currentVersion:z46.int().nonnegative(),currentVersionId:id6.nullable(),capabilities:z46.strictObject({models:z46.array(ProviderModelViewSchema).max(100),video:z46.array(z46.strictObject({selection:ProviderSelectionSchema,profile:VideoProviderProfileSchema})).max(1600),speech:SpeechOptionsSchema.shape.options,audio:z46.array(AudioViewSchema).max(64)})});import{z as z47}from"zod";var TimelineSourceSoundInputSchema=z47.strictObject({duckingMusicPermille:z47.int().nonnegative().max(1e3).optional(),soundPlanVersionId:z47.uuid(),clips:z47.array(z47.strictObject({ordinal:z47.int().min(1).max(200),treatment:SourceSoundTreatmentSchema,importedAudioVersionId:z47.uuid().optional()})).min(1).max(200),speechCues:z47.array(z47.strictObject({cueId:z47.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),audioVersionId:z47.uuid()})).max(64)});var TimelineSourceSoundSourceSchema=z47.discriminatedUnion("kind",[z47.strictObject({kind:z47.literal("NATIVE_GENERATED"),version:NativeVideoSoundReferenceSchema}),z47.strictObject({kind:z47.literal("IMPORTED_SYNC"),version:SourceSyncAudioVersionSchema})]);var TimelineSourceSoundCompositionSchema=z47.strictObject({schemaVersion:z47.literal(1),soundPlanVersionId:z47.uuid(),soundPlanFingerprint:z47.string().regex(/^[0-9a-f]{64}$/),plannedCues:SoundMakingPlanContentSchema.shape.cues,mix:AudioMixProfileSchema,clips:z47.array(z47.strictObject({ordinal:z47.int().min(1).max(200),treatment:SourceSoundTreatmentSchema,source:TimelineSourceSoundSourceSchema.optional(),sourceInSample:z47.int().nonnegative().max(288e4),sourceOutSample:z47.int().nonnegative().max(288e4),startSample:z47.int().nonnegative().max(288e4),outputSampleCount:z47.int().positive().max(288e4)})).min(1).max(200),speechCues:z47.array(z47.strictObject({cueId:z47.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),source:ProductionAudioVersionSchema,sourceInMs:z47.literal(0),sourceOutMs:z47.int().positive().max(6e4),startMs:z47.int().nonnegative().max(6e4),gainPermille:z47.literal(1e3)})).max(64)}).superRefine((v,ctx)=>{if(new Set(v.clips.map(c=>c.ordinal)).size!==v.clips.length||new Set(v.speechCues.map(c=>c.cueId)).size!==v.speechCues.length||v.speechCues.some(c=>c.source.purpose!=="VOICEOVER"||c.sourceOutMs!==c.source.media.durationMs)||v.clips.some(c=>c.treatment.policy!=="MUTE"!==!!c.source||c.source&&c.sourceOutSample<=c.sourceInSample))ctx.addIssue({code:"custom",message:"Explicit distinct clip sound decisions and exact source required"})});import{z as z48}from"zod";var TimelineV2ClipSchema=TimelineManifestSchema.shape.clips.element.extend({source:AcceptedVisualSourceReferenceSchema});var TimelineV2ManifestSchema=TimelineManifestSchema.extend({schemaVersion:z48.literal(2),clips:z48.array(TimelineV2ClipSchema).min(1).max(200),sourceSound:TimelineSourceSoundCompositionSchema.optional()});var TimelineV2VersionSchema=TimelineV2ManifestSchema.extend(TimelineVersionIdentityShape).superRefine(validateTimelineAttachments);import{z as z49}from"zod";var sha4=z49.string().regex(/^[0-9a-f]{64}$/);var VisualFrameSequenceSchema=z49.strictObject({schemaVersion:z49.literal(1),profileId:z49.literal("RGBA_PNG_SEQUENCE_30_V1"),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha4,width:z49.int().min(1).max(1920),height:z49.int().min(1).max(1920),frameRate:z49.literal(30),frameCount:z49.int().min(1).max(360),alpha:z49.literal("STRAIGHT_RGBA"),frames:z49.array(z49.strictObject({ordinal:z49.int().min(0).max(359),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha4,byteSize:z49.int().min(1).max(16*1024*1024)})).min(1).max(360)}).superRefine((v,context)=>{if(v.width*v.height>1920*1080||v.frames.length!==v.frameCount||v.frames.some((f,i)=>f.ordinal!==i)||new Set(v.frames.map(f=>f.representationId)).size!==v.frames.length||v.frames.reduce((n,f)=>n+f.byteSize,0)>64*1024*1024)context.addIssue({code:"custom",message:"Frame sequence geometry/order/identity/byte budget mismatch"})});var VisualLayerPlacementSchema=z49.strictObject({xPermille:z49.int().min(0).max(1e3),yPermille:z49.int().min(0).max(1e3),widthPermille:z49.int().min(1).max(1e3),heightPermille:z49.int().min(1).max(1e3)}).refine(v=>v.xPermille+v.widthPermille<=1e3&&v.yPermille+v.heightPermille<=1e3,"Layer rectangle must fit the canvas");var VisualLayerSchema=z49.strictObject({id:z49.uuid(),source:VisualFrameSequenceSchema,sourceInFrame:z49.int().min(0).max(359),sourceOutFrame:z49.int().min(1).max(360),startFrame:z49.int().min(0).max(1799),zIndex:z49.int().min(0).max(7),opacityPermille:z49.int().min(0).max(1e3),placement:VisualLayerPlacementSchema}).superRefine((v,context)=>{if(v.sourceOutFrame<=v.sourceInFrame||v.sourceOutFrame>v.source.frameCount||v.startFrame+v.sourceOutFrame-v.sourceInFrame>1800)context.addIssue({code:"custom",message:"Layer source/output frame interval mismatch"})});var VisualLayerCompositionSchema=z49.strictObject({schemaVersion:z49.literal(1),profileId:z49.literal("STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1"),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,totalFrames:z49.int().min(1).max(1800),layers:z49.array(VisualLayerSchema).min(1).max(8)}).superRefine((v,context)=>{const sources=new Map;const frames=new Map;let bytes=0;for(const layer of v.layers){const source=layer.source;const body=JSON.stringify(source);for(const frame of source.frames){const identity=JSON.stringify({artifactId:frame.artifactId,checksumSha256:frame.checksumSha256,byteSize:frame.byteSize,width:source.width,height:source.height});if(frames.has(frame.representationId)&&frames.get(frame.representationId)!==identity)context.addIssue({code:"custom",message:"Shared frame representation has inconsistent facts"});frames.set(frame.representationId,identity)}if(source.tenantId!==v.tenantId||source.projectId!==v.projectId||source.productionId!==null&&source.productionId!==v.productionId||layer.startFrame+layer.sourceOutFrame-layer.sourceInFrame>v.totalFrames||sources.has(source.representationId)&&sources.get(source.representationId)!==body)context.addIssue({code:"custom",message:"Layer source scope/identity/output bounds mismatch"});if(!sources.has(source.representationId))bytes+=source.frames.reduce((n,f)=>n+f.byteSize,0);sources.set(source.representationId,body)}if(new Set(v.layers.map(l=>l.id)).size!==v.layers.length||new Set(v.layers.map(l=>l.zIndex)).size!==v.layers.length||bytes>256*1024*1024)context.addIssue({code:"custom",message:"Layer instance/z-order/byte budget mismatch"})});import{z as z50}from"zod";var TimelineVisualLayerInputSchema=z50.strictObject({id:z50.uuid(),artifactId:ArtifactIdSchema,sourceInFrame:z50.int().min(0).max(359),sourceOutFrame:z50.int().min(1).max(360),startFrame:z50.int().min(0).max(1799),zIndex:z50.int().min(0).max(7),opacityPermille:z50.int().min(0).max(1e3),placement:VisualLayerPlacementSchema}).refine(layer=>layer.sourceOutFrame>layer.sourceInFrame&&layer.startFrame+layer.sourceOutFrame-layer.sourceInFrame<=1800,"Dynamic layer interval must advance and fit the output clock");var TimelineV3ManifestSchema=TimelineV2ManifestSchema.extend({schemaVersion:z50.literal(3),visualLayers:VisualLayerCompositionSchema});var TimelineV3VersionSchema=TimelineV3ManifestSchema.extend(TimelineVersionIdentityShape).superRefine((timeline,context)=>{validateTimelineAttachments(timeline,context);validateTimelineVisualLayerClock(timeline,context)});function validateTimelineVisualLayerClock(timeline,context){const composition=timeline.visualLayers;let sourceMs=0;let totalFrames=0;let previousFrames=0;for(const[index,clip]of timeline.clips.entries()){const previousBoundary=Math.round(sourceMs*30/1e3);sourceMs+=clip.durationMs;const frames=Math.round(sourceMs*30/1e3)-previousBoundary;const overlap=clip.transition==="CUT"?0:clip.transition.durationFrames;if(clip.ordinal!==index+1||frames<1||overlap>0&&(index===0||overlap>=frames||overlap>=previousFrames))context.addIssue({code:"custom",message:"Dynamic Timeline clip frame plan mismatch"});totalFrames+=frames-overlap;previousFrames=frames}if(timeline.tenantId!==void 0&&composition.tenantId!==timeline.tenantId||timeline.projectId!==void 0&&composition.projectId!==timeline.projectId||timeline.productionId!==void 0&&composition.productionId!==timeline.productionId||composition.totalFrames!==totalFrames||Math.abs(totalFrames*1e3/30-timeline.duration.totalMs)>1e3/60+.001)context.addIssue({code:"custom",message:"Dynamic Timeline ownership or physical output clock mismatch"})}import{z as z51}from"zod";var FinalRenderProfileIdSchema=z51.enum(["FINAL_H264_720P_V1","FINAL_H264_1080P_V1","FINAL_H264_480P_V1"]);var FinalRenderProfileSchema=z51.strictObject({id:FinalRenderProfileIdSchema,algorithm:z51.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),picturePolicy:PicturePolicySchema.optional(),width:z51.union([z51.literal(1280),z51.literal(720),z51.literal(1920),z51.literal(1080),z51.literal(854),z51.literal(480)]),height:z51.union([z51.literal(1280),z51.literal(720),z51.literal(1920),z51.literal(1080),z51.literal(854),z51.literal(480)]),frameRate:z51.literal(30),codec:z51.literal("h264"),pixelFormat:z51.literal("yuv420p"),fit:z51.literal("PAD"),hasAudio:z51.boolean(),audioMix:AudioMixProfileSchema.optional(),framePolicy:z51.literal("CUMULATIVE_NEAREST_FRAME"),encoder:z51.literal("libx264"),crf:z51.literal(18),preset:z51.literal("veryfast"),gopFrames:z51.literal(30),bFrames:z51.literal(0),audioPolicy:z51.enum(["SILENT","MIXED"]),captionPolicy:z51.enum(["NONE","BURN_IN"]),sourceQualityPolicy:z51.literal("NO_UPSCALE_V1"),captionStyle:CaptionRenderStyleSchema.optional(),graphicsPolicy:z51.literal("OVERLAY_V1").optional()}).superRefine((profile,context)=>{if(profile.hasAudio!==!!profile.audioMix||profile.hasAudio!==(profile.audioPolicy==="MIXED"))context.addIssue({code:"custom",message:"Exact native audio policy and mix must agree"});if(!!profile.captionStyle!==(profile.captionPolicy==="BURN_IN"))context.addIssue({code:"custom",message:"Caption burn-in requires exact native style"});const pair=profile.id==="FINAL_H264_720P_V1"?[1280,720]:profile.id==="FINAL_H264_480P_V1"?[854,480]:[1920,1080];if(!(profile.width===pair[0]&&profile.height===pair[1]||profile.width===pair[1]&&profile.height===pair[0]))context.addIssue({code:"custom",message:"Final profile geometry mismatch"})});import{z as z52}from"zod";var VisualLayerPolicySchema=z52.enum(["STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1","STRAIGHT_ALPHA_FRAME_OVERLAY_30_V2"]);var VisualLayerPreviewProfileSchema=RoughCutProfileSchema.safeExtend({visualLayerPolicy:VisualLayerPolicySchema});var VisualLayerFinalProfileSchema=FinalRenderProfileSchema.safeExtend({visualLayerPolicy:VisualLayerPolicySchema,visualLayerSourceQualityPolicy:z52.literal("NO_UPSCALE_V1")});var shape={schemaVersion:z52.literal(3),timeline:TimelineV3VersionSchema};var preview=RoughCutManifestSchema.extend({...shape,profile:VisualLayerPreviewProfileSchema});var final=RoughCutManifestSchema.extend({...shape,profile:VisualLayerFinalProfileSchema});function validateClock(value2,context){if(value2.totalFrames!==value2.timeline.visualLayers.totalFrames)context.addIssue({code:"custom",message:"Dynamic render must use the frozen layer clock"})}var VisualLayerPreviewManifestSchema=preview.superRefine(validateClock);var VisualLayerFinalManifestSchema=final.superRefine(validateClock);var VisualLayerRenderManifestSchema=z52.union([VisualLayerPreviewManifestSchema,VisualLayerFinalManifestSchema]);import{z as z53}from"zod";var TimelineVersionReaderSchema=z53.discriminatedUnion("schemaVersion",[TimelineVersionSchema,TimelineV2VersionSchema,TimelineV3VersionSchema]);var TimelineManifestReaderSchema=z53.discriminatedUnion("schemaVersion",[TimelineManifestSchema,TimelineV2ManifestSchema,TimelineV3ManifestSchema.superRefine(validateTimelineVisualLayerClock)]);import{z as z54}from"zod";var TimelineScopeSchema=z54.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var TimelineClipInputSchema=z54.strictObject({shotId:ShotIdSchema,acceptanceId:z54.uuid(),framing:ClipFramingSchema.optional(),transition:ClipTransitionSchema.optional(),sourceInMs:z54.int().nonnegative().max(30150),sourceOutMs:z54.int().positive().max(30150)}).refine(v=>v.sourceOutMs>v.sourceInMs,"Clip source range must advance");var BuildTimelineShapeSchema=TimelineScopeSchema.extend({schemaVersion:z54.union([z54.literal(2),z54.literal(3)]).optional(),expectedProductionRevision:z54.int().positive(),expectedTimelineVersion:z54.int().nonnegative(),idempotencyKey:z54.string().trim().min(1).max(200),clips:z54.array(TimelineClipInputSchema).min(1).max(200),captionVersionId:z54.uuid().optional(),audio:TimelineAudioInputSchema.optional(),sourceSound:TimelineSourceSoundInputSchema.optional(),graphics:z54.array(TimelineGraphicInputSchema).max(8).optional(),visualLayers:z54.array(TimelineVisualLayerInputSchema).min(1).max(8).optional()});var BuildTimelineSchema=BuildTimelineShapeSchema.superRefine((input,context)=>{if(input.sourceSound&&!input.schemaVersion)context.addIssue({code:"custom",message:"Source sound requires explicit Timeline2/3"});if(input.schemaVersion===3!==!!input.visualLayers?.length)context.addIssue({code:"custom",message:"Dynamic layers require explicit Timeline3"});if(input.visualLayers&&(new Set(input.visualLayers.map(layer=>layer.id)).size!==input.visualLayers.length||new Set(input.visualLayers.map(layer=>layer.zIndex)).size!==input.visualLayers.length))context.addIssue({code:"custom",message:"Dynamic layer IDs and z-order must be unique"})});var TimelineStaleReasonSchema=z54.enum(["BRIEF_CHANGED","STORY_CHANGED","PLAN_CHANGED","SHOT_ACCEPTANCE_CHANGED","PRODUCTION_UNAVAILABLE","CAPTION_VERSION_CHANGED","CAPTION_UNAVAILABLE","AUDIO_VERSION_CHANGED","AUDIO_UNAVAILABLE","GRAPHIC_UNAVAILABLE","VISUAL_LAYER_UNAVAILABLE","SOUND_PLAN_CHANGED","SOURCE_SOUND_UNAVAILABLE"]);var TimelineViewSchema=z54.strictObject({version:TimelineVersionReaderSchema,isCurrent:z54.boolean(),freshness:z54.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z54.array(TimelineStaleReasonSchema).max(13),assemblyStatus:z54.enum(["DRAFT","ASSEMBLY_READY"])});var TimelineGetSchema=TimelineScopeSchema.extend({versionId:z54.uuid()});var TimelineQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var TimelinePageSchema=z54.strictObject({items:z54.array(TimelineViewSchema),page:QueryPageInfoSchema});var TimelineBuildReceiptSchema=z54.strictObject({semanticStatus:z54.literal("SUCCESS"),version:TimelineVersionReaderSchema,productionRevision:z54.int().positive()});var TimelineBasisSchema=TimelineScopeSchema.extend({productionRevision:z54.int().positive(),currentTimelineVersion:z54.int().nonnegative(),runnable:z54.boolean(),planningReady:z54.boolean(),output:TimelineManifestSchema.shape.output.nullable(),targetDurationMs:z54.int().positive().nullable(),shots:z54.array(z54.strictObject({shotId:ShotIdSchema,ordinal:z54.int().positive(),acceptanceStatus:z54.enum(["NONE","CURRENT","STALE"]),source:AcceptedVisualSourceReferenceSchema.nullable(),technical:VideoTechnicalMetadataSchema.nullable()})).max(200)});var TimelineSnapshotSchema=z54.strictObject({currentVersion:z54.int().positive().nullable(),stale:z54.boolean(),timelineId:z54.uuid().nullable(),versionId:z54.uuid().nullable(),assemblyStatus:z54.enum(["DRAFT","ASSEMBLY_READY"]).nullable(),totalDurationMs:z54.int().positive().nullable(),durationClassification:TimelineDurationSchema.shape.classification.nullable(),missingPlannedShots:z54.int().nonnegative(),staleReasons:z54.array(TimelineStaleReasonSchema).max(13)});import{z as z55}from"zod";var sha5=z55.string().regex(/^[0-9a-f]{64}$/);var RoughCutStartSchema=TimelineScopeSchema.extend({deviceExecution:DeviceRenderTargetSchema.optional(),timelineVersionId:z55.uuid(),timelineFingerprint:sha5,expectedProductionRevision:z55.int().positive(),profileId:RoughCutProfileIdSchema,idempotencyKey:z55.string().trim().min(1).max(200)});var RoughCutGetSchema=TimelineScopeSchema.extend({renderId:z55.uuid()});var RoughCutQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutV2ManifestSchema=RoughCutManifestSchema.extend({schemaVersion:z55.literal(2),timeline:TimelineV2VersionSchema});var RoughCutManifestReaderSchema=z55.discriminatedUnion("schemaVersion",[RoughCutManifestSchema,RoughCutV2ManifestSchema,VisualLayerPreviewManifestSchema]);var RoughCutTechnicalSchema=VideoTechnicalMetadataSchema.extend({hasAudio:z55.boolean(),audio:RenderedAudioSchema.optional(),durationMs:z55.int().min(29983).max(60017),frameRate:z55.literal(30),frameCount:z55.int().min(900).max(1800),engineVersion:z55.string().min(1).max(200)}).superRefine((v,ctx)=>{if(v.hasAudio!==!!v.audio||v.audio&&v.audio.sampleCount!==v.frameCount*1600)ctx.addIssue({code:"custom",message:"Actual audio stream must match physical output samples"})});var RoughCutArtifactSchema=RoughCutTechnicalSchema.safeExtend({artifactId:z55.uuid(),representationId:z55.uuid(),version:z55.int().positive(),poster:VideoPosterSchema,availability:z55.enum(["AVAILABLE","INVALID"]),reviewState:z55.enum(["UNREVIEWED","PASS","WARNING","FAIL"])});var RoughCutAdmissionSchema=z55.strictObject({humanLinks:HumanLinksSchema.optional(),deviceExecution:DeviceRenderReceiptSchema.optional(),semanticStatus:z55.literal("ACCEPTED"),renderId:z55.uuid(),operationId:OperationIdSchema,productionId:z55.uuid(),timelineVersionId:z55.uuid(),timelineFingerprint:sha5,executionClass:z55.enum(["LIVE","TEST_ONLY"]),manifestFingerprint:sha5,productionRevision:z55.int().positive()});var RoughCutViewSchema=TimelineScopeSchema.extend({humanLinks:HumanLinksSchema.optional(),renderId:z55.uuid(),projectId:ProjectIdSchema,runtimeJobId:z55.uuid(),operationId:OperationIdSchema,manifest:RoughCutManifestReaderSchema,manifestFingerprint:sha5,runtimeStatus:VideoGenerationViewSchema.shape.runtimeStatus,cancellationRequested:z55.boolean(),isCurrentTimeline:z55.boolean(),freshness:z55.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z55.array(z55.string().min(1).max(120)).max(16),executionClass:z55.enum(["LIVE","TEST_ONLY"]),roughCut:RoughCutArtifactSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z55.iso.datetime({offset:true})});var RoughCutPageSchema=z55.strictObject({items:z55.array(RoughCutViewSchema),page:QueryPageInfoSchema});var RoughCutSnapshotSchema=z55.strictObject({latestVersion:z55.int().positive().nullable(),reviewState:z55.enum(["UNREVIEWED","PASS","WARNING","FAIL"]).nullable(),latestRenderId:z55.uuid().nullable(),runtimeStatus:VideoGenerationViewSchema.shape.runtimeStatus.nullable(),currentRenderId:z55.uuid().nullable(),currentArtifactId:z55.uuid().nullable(),currentTimelineVersionId:z55.uuid().nullable(),stale:z55.boolean()});import{z as z56}from"zod";var sha6=z56.string().regex(/^[0-9a-f]{64}$/);var DeliveryPolicySchema=z56.strictObject({schemaVersion:z56.literal(1),requiredAudio:z56.boolean(),requiredCaptions:z56.boolean(),requiredGraphics:z56.boolean(),finalApproval:z56.enum(["AUTOMATIC","HUMAN"])});var DeliveryPolicyInputSchema=DeliveryPolicySchema.extend({requiredAudio:z56.boolean().default(false),requiredCaptions:z56.boolean().default(false),requiredGraphics:z56.boolean().default(false),finalApproval:z56.enum(["AUTOMATIC","HUMAN"]).default("AUTOMATIC")});var DeliveryCompositionSchema=z56.strictObject({hasAudio:z56.boolean(),hasCaptions:z56.boolean(),hasGraphics:z56.boolean()});var DeliveryTargetSchema=z56.strictObject({tenantId:z56.uuid(),projectId:z56.uuid(),productionId:z56.uuid(),renderId:z56.uuid(),timelineVersionId:z56.uuid(),timelineFingerprint:sha6,selectionId:z56.uuid(),selectionVersion:z56.int().positive(),renderManifestFingerprint:sha6,artifactId:z56.uuid(),representationId:z56.uuid(),checksumSha256:sha6,byteSize:z56.int().positive().max(128*1024*1024),executionClass:z56.enum(["LIVE","TEST_ONLY"])});var deliveryPhysicalCheckKeys=["FILE_READABLE","CHECKSUM","CONTAINER_PROFILE","DURATION","VIDEO_DECODE","AUDIO_DECODE","REQUIRED_AUDIO","REQUIRED_CAPTIONS","REQUIRED_GRAPHICS","MISSING_MEDIA","BLACK_FRAMES"];var DeliveryCheckKeySchema=z56.enum([...deliveryPhysicalCheckKeys,"ARTIFACT_REGISTRATION","PROVENANCE","MANIFEST_INTEGRITY","EXACT_BASIS","BLOCKING_FINDINGS"]);var DeliveryCheckSchema=z56.strictObject({key:DeliveryCheckKeySchema,status:z56.enum(["PASS","FAIL","UNVERIFIED","NOT_APPLICABLE"]),detail:z56.string().trim().min(1).max(1e3)});var DeliveryPhysicalChecksSchema=z56.array(DeliveryCheckSchema.extend({key:z56.enum(deliveryPhysicalCheckKeys)})).length(deliveryPhysicalCheckKeys.length).refine(checks=>new Set(checks.map(check=>check.key)).size===deliveryPhysicalCheckKeys.length,"Exact physical media checks required");var DeliveryValidationReviewSchema=z56.strictObject({id:z56.uuid(),target:DeliveryTargetSchema,policy:DeliveryPolicySchema,policyFingerprint:sha6,composition:DeliveryCompositionSchema,checks:z56.array(DeliveryCheckSchema).length(DeliveryCheckKeySchema.options.length),result:z56.enum(["PASS","FAIL"]),blockingChecks:z56.array(DeliveryCheckKeySchema).max(DeliveryCheckKeySchema.options.length),createdAt:z56.iso.datetime({offset:true})}).superRefine((review2,ctx)=>{const seen=new Set;const blocked=new Set;const{policy,composition}=review2;for(const check of review2.checks){if(seen.has(check.key))ctx.addIssue({code:"custom",message:"Duplicate deterministic delivery check"});seen.add(check.key);const mayOmit=check.key==="AUDIO_DECODE"&&!composition.hasAudio||check.key==="REQUIRED_AUDIO"&&!policy.requiredAudio||check.key==="REQUIRED_CAPTIONS"&&!policy.requiredCaptions||check.key==="REQUIRED_GRAPHICS"&&!policy.requiredGraphics;if(check.status==="NOT_APPLICABLE"&&!mayOmit)ctx.addIssue({code:"custom",message:"Required delivery evidence cannot be omitted"});if(check.status==="FAIL"||check.status==="UNVERIFIED")blocked.add(check.key)}if(policy.requiredAudio&&!composition.hasAudio)blocked.add("REQUIRED_AUDIO");if(policy.requiredCaptions&&!composition.hasCaptions)blocked.add("REQUIRED_CAPTIONS");if(policy.requiredGraphics&&!composition.hasGraphics)blocked.add("REQUIRED_GRAPHICS");const expected=DeliveryCheckKeySchema.options.filter(key4=>blocked.has(key4));if(review2.result!==(expected.length?"FAIL":"PASS")||JSON.stringify(review2.blockingChecks)!==JSON.stringify(expected))ctx.addIssue({code:"custom",message:"Review result and blockers must match complete owned evidence"})});import{z as z57}from"zod";var sha7=z57.string().regex(/^[0-9a-f]{64}$/);function sameTarget(a,b){return Object.keys(DeliveryTargetSchema.shape).every(key4=>a[key4]===b[key4])}var DeliveryApprovalSchema=z57.strictObject({id:z57.uuid(),reviewId:z57.uuid(),target:DeliveryTargetSchema,policyFingerprint:sha7,authority:z57.literal("HUMAN"),action:z57.enum(["APPROVE","REJECT"]),principalId:z57.uuid(),createdAt:z57.iso.datetime({offset:true})});var DeliveryManifestLinkSchema=z57.strictObject({id:z57.uuid(),checksumSha256:sha7,target:DeliveryTargetSchema,policyFingerprint:sha7,reviewId:z57.uuid()});var FinalDeliveryReceiptSchema=z57.strictObject({id:z57.uuid(),deliveryRole:z57.literal("FINAL_ARTIFACT"),review:DeliveryValidationReviewSchema,manifest:DeliveryManifestLinkSchema,approval:DeliveryApprovalSchema.nullable(),productionRevision:z57.int().positive(),completedAt:z57.iso.datetime({offset:true})}).superRefine((receipt,ctx)=>{const{review:review2,manifest,approval}=receipt;if(review2.result!=="PASS"||!sameTarget(manifest.target,review2.target)||manifest.reviewId!==review2.id||manifest.policyFingerprint!==review2.policyFingerprint)ctx.addIssue({code:"custom",message:"Final delivery requires an exact PASS Review and Manifest"});if(review2.policy.finalApproval==="HUMAN"){if(!approval||approval.action!=="APPROVE"||approval.reviewId!==review2.id||approval.policyFingerprint!==review2.policyFingerprint||!sameTarget(approval.target,review2.target))ctx.addIssue({code:"custom",message:"Configured Human gate requires exact Human approval"})}else if(approval){ctx.addIssue({code:"custom",message:"Automatic delivery does not carry an unconfigured approval"})}});import{z as z58}from"zod";var sha8=z58.string().regex(/^[0-9a-f]{64}$/);var DecideFinalReadySchema=TimelineScopeSchema.extend({renderId:z58.uuid(),reviewId:z58.uuid(),basisFingerprint:sha8,action:z58.enum(["SELECT","REJECT"]),acknowledgeWarnings:z58.boolean().default(false),expectedProductionRevision:z58.int().positive(),expectedFinalReadyVersion:z58.int().nonnegative(),reason:z58.string().trim().min(1).max(2500),idempotencyKey:z58.string().trim().min(1).max(200)});var RevokeFinalReadySchema=TimelineScopeSchema.extend({selectionId:z58.uuid(),expectedFinalReadyVersion:z58.int().positive(),expectedProductionRevision:z58.int().positive(),reason:z58.string().trim().min(1).max(2500),idempotencyKey:z58.string().trim().min(1).max(200)});var FinalReadyDecisionSchema=TimelineScopeSchema.extend({id:z58.uuid(),projectId:ProjectIdSchema,version:z58.int().positive(),action:z58.enum(["SELECT","REJECT","REVOKE"]),renderId:z58.uuid(),reviewId:z58.uuid(),basisFingerprint:sha8,timelineVersionId:z58.uuid(),timelineFingerprint:sha8,artifactId:z58.uuid(),representationId:z58.uuid(),checksumSha256:sha8,outputProfile:DeliveryOutputProfileSchema,executionClass:z58.enum(["LIVE","TEST_ONLY"]),previousSelectionId:z58.uuid().nullable(),acknowledgeWarnings:z58.boolean(),warningKeys:z58.array(z58.string()).max(300),reason:z58.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z58.iso.datetime({offset:true})});var FinalReadyViewSchema=TimelineScopeSchema.extend({version:z58.int().nonnegative(),status:z58.enum(["NONE","CURRENT","STALE"]),selection:FinalReadyDecisionSchema.nullable(),staleReasons:z58.array(z58.string()).max(24)});var FinalReadyQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var FinalReadyPageSchema=z58.strictObject({items:z58.array(FinalReadyDecisionSchema),page:QueryPageInfoSchema});var FinalReadyReceiptSchema=z58.strictObject({semanticStatus:z58.literal("SUCCESS"),decision:FinalReadyDecisionSchema,productionRevision:z58.int().positive()});var RoughCutReviewSnapshotSchema=z58.strictObject({currentRenderId:z58.uuid().nullable(),latestReviewId:z58.uuid().nullable(),reviewVersion:z58.int().nonnegative(),result:z58.enum(["PASS","WARNING","FAIL"]).nullable(),current:z58.boolean(),inspectable:z58.boolean(),executionClass:z58.enum(["LIVE","TEST_ONLY"]).nullable(),findings:z58.strictObject({open:z58.int().nonnegative(),blocking:z58.int().nonnegative(),warnings:z58.int().nonnegative()}),finalReady:FinalReadyViewSchema,latestDecision:FinalReadyDecisionSchema.nullable()});import{z as z59}from"zod";var sha9=z59.string().regex(/^[0-9a-f]{64}$/);function hasTimelineAudio(timeline){return!!timeline.audio||!!timeline.sourceSound&&(timeline.sourceSound.clips.some(c=>!!c.source)||timeline.sourceSound.speechCues.length>0)}var FinalRenderStartSchema=TimelineScopeSchema.extend({deviceExecution:DeviceRenderTargetSchema.optional(),selectionId:z59.uuid(),expectedFinalReadyVersion:z59.int().positive(),timelineVersionId:z59.uuid(),timelineFingerprint:sha9,expectedProductionRevision:z59.int().positive(),profileId:FinalRenderProfileIdSchema,audioPolicy:z59.enum(["SILENT","MIXED"]),captionPolicy:z59.enum(["NONE","BURN_IN"]),idempotencyKey:z59.string().trim().min(1).max(200)});var FinalRenderGetSchema=RoughCutGetSchema;var FinalRenderQuerySchema=RoughCutQuerySchema;var finalManifestShape={selection:FinalReadyDecisionSchema.refine(v=>v.action==="SELECT"),selectionVersion:z59.int().positive(),profile:FinalRenderProfileSchema};var finalV1=RoughCutManifestSchema.extend(finalManifestShape);var finalV2=RoughCutV2ManifestSchema.extend(finalManifestShape);var finalV3=VisualLayerFinalManifestSchema.safeExtend({...finalManifestShape,profile:VisualLayerFinalProfileSchema});function validateFinalManifest(manifest,context){const{selection:selected,timeline,profile}=manifest;const expectedProfile=finalProfileIds[timeline.output.profile];const landscape=timeline.output.aspectRatio==="16:9";if(!!profile.picturePolicy!==timeline.clips.some(c=>!!c.framing)||profile.audioPolicy!==(hasTimelineAudio(timeline)?"MIXED":"SILENT")||!!profile.audioMix!==hasTimelineAudio(timeline)||profile.captionPolicy!==(timeline.caption?"BURN_IN":"NONE")||!!profile.captionStyle!==!!timeline.caption||!!profile.graphicsPolicy!==!!timeline.graphics?.length||selected.tenantId!==timeline.tenantId||selected.projectId!==timeline.projectId||selected.productionId!==timeline.productionId||selected.timelineVersionId!==timeline.id||selected.timelineFingerprint!==timeline.fingerprint||selected.version>manifest.selectionVersion||selected.outputProfile!==timeline.output.profile||selected.executionClass!==timeline.executionClass||profile.id!==expectedProfile||profile.width>profile.height!==landscape)context.addIssue({code:"custom",message:"Final selection, Timeline and profile mismatch"})}var FinalRenderManifestSchema=finalV1.superRefine(validateFinalManifest);var FinalRenderV2ManifestSchema=finalV2.superRefine(validateFinalManifest);var FinalRenderV3ManifestSchema=finalV3.superRefine(validateFinalManifest);var FinalRenderManifestReaderSchema=z59.discriminatedUnion("schemaVersion",[FinalRenderManifestSchema,FinalRenderV2ManifestSchema,FinalRenderV3ManifestSchema]);var FinalRenderTechnicalSchema=RoughCutTechnicalSchema;var FinalRenderArtifactSchema=RoughCutArtifactSchema.safeExtend({reviewState:z59.literal("UNREVIEWED"),deliveryRole:z59.literal("NONE")});var FinalRenderAdmissionSchema=RoughCutAdmissionSchema.extend({selectionId:z59.uuid(),selectionVersion:z59.int().positive(),profileId:FinalRenderProfileIdSchema});var FinalRenderViewSchema=RoughCutViewSchema.omit({roughCut:true,manifest:true,staleReasons:true}).extend({manifest:FinalRenderManifestReaderSchema,finalOutput:FinalRenderArtifactSchema.nullable(),finalDelivery:FinalDeliveryReceiptSchema.nullable().default(null),staleReasons:z59.array(z59.string().min(1).max(120)).max(24)});var FinalRenderPageSchema=z59.strictObject({items:z59.array(FinalRenderViewSchema).max(200),page:QueryPageInfoSchema});var FinalRenderSourceBlockerSchema=z59.strictObject({code:z59.enum(["SOURCE_RESOLUTION_INSUFFICIENT","SOURCE_MEDIA_UNSUPPORTED"]),shotId:z59.uuid(),ordinal:z59.int().positive().max(200),actualWidth:z59.int().positive().max(4096),actualHeight:z59.int().positive().max(4096),requiredWidth:z59.int().positive().max(4096),requiredHeight:z59.int().positive().max(4096)});var FinalRenderEligibilitySchema=TimelineScopeSchema.extend({productionRevision:z59.int().positive(),finalReady:FinalReadyViewSchema,profile:z59.union([FinalRenderProfileSchema,VisualLayerFinalProfileSchema]).nullable(),renderable:z59.boolean(),blockers:z59.array(z59.string().min(1).max(120)).max(24),sourceBlockers:z59.array(FinalRenderSourceBlockerSchema).max(200),supportedAudioPolicy:z59.enum(["SILENT","MIXED"]),supportedCaptionPolicy:z59.enum(["NONE","BURN_IN"])});var FinalRenderSnapshotSchema=z59.strictObject({latestRenderId:z59.uuid().nullable(),runtimeStatus:RoughCutViewSchema.shape.runtimeStatus.nullable(),currentRenderId:z59.uuid().nullable(),currentArtifactId:z59.uuid().nullable(),stale:z59.boolean(),eligibility:FinalRenderEligibilitySchema});import{z as z60}from"zod";var MediaCategorySchema=z60.enum(["IMAGE","VIDEO","AUDIO","DOCUMENT"]);function mediaCategoryOf(contentType){if(contentType.startsWith("image/"))return"IMAGE";if(contentType.startsWith("video/"))return"VIDEO";if(contentType.startsWith("audio/"))return"AUDIO";return"DOCUMENT"}import{z as z61}from"zod";var TemporalEvidenceReferenceSchema=z61.strictObject({evidenceId:z61.uuid(),frameSetArtifactId:z61.uuid(),contactSheetArtifactId:z61.uuid(),manifestRepresentationId:z61.uuid(),sheetRepresentationId:z61.uuid(),planFingerprint:z61.string().regex(/^[0-9a-f]{64}$/),sourceArtifactId:z61.uuid(),sourceRepresentationId:z61.uuid(),sourceChecksumSha256:z61.string().regex(/^[0-9a-f]{64}$/),timestampsMs:z61.array(z61.number().nonnegative().max(6e4)).min(1).max(64),executionClass:z61.enum(["LIVE","TEST_ONLY"])});var TemporalEvidenceIdsSchema=z61.array(z61.uuid()).min(1).max(8).refine(v=>new Set(v).size===v.length,"Evidence references must be unique");import{z as z62}from"zod";var ListeningEvidenceIdsSchema=z62.array(z62.string().min(1).max(100)).max(64);var ListeningEvidenceSchema=z62.strictObject({id:z62.string().trim().min(1).max(100),kind:z62.enum(["AUDIO_LISTENING","VIDEO_WITH_AUDIO_PLAYBACK"]),media:z62.strictObject({artifactId:z62.uuid(),representationId:z62.uuid(),checksumSha256:z62.string().regex(/^[0-9a-f]{64}$/)}),coverage:z62.array(z62.strictObject({startMs:z62.int().nonnegative().max(6e4),endMs:z62.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs)).min(1).max(200),producer:z62.string().trim().min(1).max(200)});var ListeningEvidenceSetSchema=z62.array(ListeningEvidenceSchema).max(64).refine(v=>new Set(v.map(e=>e.id)).size===v.length);import{z as z63}from"zod";var sha10=z63.string().regex(/^[a-f0-9]{64}$/);var VoiceListeningIntervalSchema=ListeningEvidenceSchema.shape.coverage.element;var VoiceExpectationSchema=z63.strictObject({voiceProfile:VoiceProfileRefSchema,referenceId:z63.uuid()});var VoiceRuleTargetsSchema=z63.discriminatedUnion("kind",[z63.strictObject({kind:z63.literal("VOICEOVER")}),z63.strictObject({kind:z63.literal("SOUND_CUES"),cueIds:z63.array(z63.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)).min(1).max(64).refine(ids=>new Set(ids).size===ids.length)})]);var VoiceConsistencyReasonSchema=z63.enum(["NO_SOURCE","VOICE_UNAVAILABLE","REFERENCE_CHANGED","AUDIO_UNAVAILABLE","IDENTITY_MISMATCH","NO_COMPARISON","COMPARISON_NOT_MATCHED","COMPARISON_STALE","TEST_ONLY"]);var VoiceRequirementGateSchema=z63.strictObject({qualified:z63.boolean(),evidenceFingerprint:sha10,listeningIntervals:z63.array(VoiceListeningIntervalSchema).min(1).max(264),sourceAudioVersionIds:z63.array(z63.uuid()).max(65),reasons:z63.array(VoiceConsistencyReasonSchema).max(9)}).refine(v=>v.qualified===(v.reasons.length===0)&&(!v.qualified||v.sourceAudioVersionIds.length>0));var VoiceSourceEvidenceSchema=z63.strictObject({audioVersionId:z63.uuid(),voiceProfile:VoiceProfileRefSchema.nullable(),referenceId:z63.uuid().nullable(),comparisonId:z63.uuid().nullable(),comparisonVersion:z63.int().nonnegative(),comparisonFingerprint:sha10.nullable(),identityResult:z63.enum(["MATCH","DIFFERENT","UNDETERMINED"]).nullable(),current:z63.boolean(),executionClass:z63.enum(["LIVE","TEST_ONLY"]).nullable(),reasons:z63.array(VoiceConsistencyReasonSchema).max(9)});var VoiceExpectationEvidenceSchema=VoiceExpectationSchema.extend({current:z63.boolean(),executionClass:z63.enum(["LIVE","TEST_ONLY"]).nullable(),reasons:z63.array(VoiceConsistencyReasonSchema).max(9)});var ProductionVoiceEvidenceSchema=z63.strictObject({expectations:z63.array(VoiceExpectationEvidenceSchema).max(16),sources:z63.array(VoiceSourceEvidenceSchema).max(65)});import{z as z64}from"zod";var sha11=z64.string().regex(/^[0-9a-f]{64}$/);var CompositionFindingLocalitySchema=z64.strictObject({schemaVersion:z64.literal(1),sourceKind:z64.literal("CODE"),role:z64.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),compositionId:z64.uuid(),compositionVersionId:z64.uuid(),compositionVersion:z64.int().positive(),compositionFingerprint:sha11,renderId:z64.uuid(),renderManifestFingerprint:sha11,artifactId:z64.uuid(),representationId:z64.uuid(),checksumSha256:sha11,clipOrdinal:z64.int().min(1).max(200).nullable(),visualLayerId:z64.uuid().nullable(),sourceInFrame:z64.int().min(0).max(359),sourceOutFrame:z64.int().min(1).max(360),mapping:z64.literal("INTERSECTING_NATIVE_30FPS_FRAME_CELLS")}).superRefine((v,ctx)=>{if(v.sourceOutFrame<=v.sourceInFrame||(v.role==="PRIMARY_VISUAL"?v.clipOrdinal===null||v.visualLayerId!==null:v.visualLayerId===null||v.clipOrdinal!==null))ctx.addIssue({code:"custom",message:"CODE locality requires an exact occurrence and advancing local frame interval"})});import{z as z65}from"zod";var CanonicalFactSchema=z65.strictObject({key:z65.string().regex(/^[A-Z][A-Z0-9_]{1,59}$/),value:z65.string().trim().min(1).max(300),sourceArtifactId:ArtifactIdSchema,evidence:z65.discriminatedUnion("kind",[z65.strictObject({kind:z65.literal("JSON_POINTER"),pointer:z65.string().startsWith("/").max(200)}),z65.strictObject({kind:z65.literal("EXACT_TEXT_LINE")})])});var BriefContentSchema=z65.strictObject({objective:z65.string().trim().min(1).max(1e3),productPresentationGoal:z65.string().trim().min(1).max(1e3),audience:z65.string().trim().min(1).max(300).optional(),styleTone:z65.string().trim().min(1).max(300).optional(),callToAction:z65.string().trim().min(1).max(300).optional(),targetDurationSeconds:z65.int().min(30).max(60),aspectRatio:z65.enum(["16:9","9:16"]),outputProfile:DeliveryOutputProfileSchema,canonicalFacts:z65.array(CanonicalFactSchema).max(32).default([])});var AcceptBriefRequestSchema=z65.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z65.int().positive(),revisionReason:z65.string().trim().min(1).max(1e3).optional(),sourceArtifactIds:z65.array(ArtifactIdSchema).max(20).default([]),content:BriefContentSchema});var BriefSourceReferenceSchema=z65.strictObject({artifactId:ArtifactIdSchema,checksumSha256:z65.string().regex(/^[0-9a-f]{64}$/)});var BriefVersionSchema=z65.strictObject({id:BriefVersionIdSchema,briefId:BriefIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z65.int().positive(),content:BriefContentSchema,sources:z65.array(BriefSourceReferenceSchema).min(1).max(20),createdByPrincipalId:PrincipalIdSchema,createdAt:z65.iso.datetime({offset:true})});var AcceptBriefResultSchema=z65.discriminatedUnion("semanticStatus",[z65.strictObject({semanticStatus:z65.literal("SUCCESS"),briefVersion:BriefVersionSchema,productionRevision:z65.int().positive(),activeBriefVersion:z65.int().positive()}),z65.strictObject({semanticStatus:z65.literal("NEEDS_INPUT"),missingFacts:z65.array(z65.enum(["PRODUCT_INFORMATION_SOURCE","PRODUCT_NAME"])).min(1)})]);import{z as z66}from"zod";var StoryFactKeySchema=z66.string().regex(/^[A-Z][A-Z0-9_]{1,59}$/);var StoryFactClaimSchema=z66.strictObject({key:StoryFactKeySchema,value:z66.string().trim().min(1).max(300)});var StoryBeatSchema=z66.strictObject({summary:z66.string().trim().min(1).max(600),sceneRequirements:z66.array(z66.string().trim().min(1).max(300)).max(8).default([])});var StoryContentSchema=z66.strictObject({narrativeIntent:z66.string().trim().min(1).max(2e3),beats:z66.array(StoryBeatSchema).min(1).max(24),factualClaims:z66.array(StoryFactClaimSchema).max(32).default([])});var AcceptStoryRequestSchema=z66.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z66.int().positive(),expectedBriefVersion:z66.int().positive(),revisionReason:z66.string().trim().min(1).max(1e3).optional(),idempotencyKey:z66.string().trim().min(1).max(200),content:StoryContentSchema});var StoryVersionSchema=z66.strictObject({id:StoryVersionIdSchema,storyId:StoryIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z66.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z66.int().positive(),content:StoryContentSchema,createdByPrincipalId:PrincipalIdSchema,createdAt:z66.iso.datetime({offset:true})});var AcceptStoryResultSchema=z66.discriminatedUnion("semanticStatus",[z66.strictObject({semanticStatus:z66.literal("SUCCESS"),storyVersion:StoryVersionSchema,productionRevision:z66.int().positive(),activeStoryVersion:z66.int().positive()}),z66.strictObject({semanticStatus:z66.literal("NEEDS_INPUT"),missingPrerequisites:z66.array(z66.literal("ACTIVE_BRIEF")).min(1)})]);import{z as z67}from"zod";var ConsistencyFamilySchema=z67.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","BOUNDARY_CONTINUITY","STYLE","VOICE_IDENTITY"]);var ConsistencyEnforcementSchema=z67.enum(["LOCKED","REQUIRED","PREFERRED","FREE"]);var ConsistencyMasterReferenceSchema=z67.strictObject({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:z67.string().regex(/^[0-9a-f]{64}$/),artifactChecksumSha256:z67.string().regex(/^[0-9a-f]{64}$/),contentType:z67.enum(["image/png","image/jpeg","image/webp","audio/wav"])});var Fact=z67.strictObject({dimension:z67.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),value:z67.string().trim().min(1).max(1e3)});var ConsistencySubjectSchema=z67.strictObject({id:z67.uuid(),kind:z67.enum(["CHARACTER","VOICE"]),displayName:z67.string().trim().min(1).max(200),facts:z67.array(Fact).min(1).max(32),master:ConsistencyMasterReferenceSchema,voiceExpectation:VoiceExpectationSchema.optional()}).superRefine((s,c)=>{if(new Set(s.facts.map(f=>f.dimension)).size!==s.facts.length)c.addIssue({code:"custom",message:"Canonical subject dimensions must be unique"});if(s.kind==="VOICE"!==(s.master.contentType==="audio/wav"))c.addIssue({code:"custom",message:"Character requires an image master; Voice requires audio"});if(s.voiceExpectation&&s.kind!=="VOICE")c.addIssue({code:"custom",message:"Only Voice subjects carry a voice expectation"})});var ConsistencyRuleScopeSchema=z67.discriminatedUnion("kind",[z67.strictObject({kind:z67.literal("PROJECT")}),z67.strictObject({kind:z67.literal("PRODUCTION")}),z67.strictObject({kind:z67.literal("SCENE"),id:z67.uuid()}),z67.strictObject({kind:z67.literal("SHOT"),id:z67.uuid()}),z67.strictObject({kind:z67.literal("CONTINUITY_EDGE"),id:z67.uuid()})]);var ConsistencyRuleSchema=z67.strictObject({voiceTargets:VoiceRuleTargetsSchema.optional(),reviewScales:z67.array(ConsistencyReviewScaleSchema).min(1).max(3).refine(s=>new Set(s).size===s.length,"Review scales must be unique").optional(),continuity:ContinuityExpectationSchema.optional(),id:z67.uuid(),family:ConsistencyFamilySchema,subjectId:z67.uuid().nullable(),dimension:z67.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),scope:ConsistencyRuleScopeSchema,enforcement:ConsistencyEnforcementSchema,expected:z67.string().trim().min(1).max(1e3).nullable(),referenceMode:z67.enum(["NONE","SUBJECT_MASTER","EXACT"]),reference:ConsistencyMasterReferenceSchema.optional(),override:z67.strictObject({priorRuleId:z67.uuid(),reason:z67.string().trim().min(1).max(1e3)}).optional(),transition:z67.strictObject({edgeId:z67.uuid(),from:z67.string().trim().min(1).max(1e3),to:z67.string().trim().min(1).max(1e3),reason:z67.string().trim().min(1).max(1e3)}).optional()}).superRefine((r,c)=>{const invalid=message=>c.addIssue({code:"custom",message});if(r.continuity&&(r.enforcement==="FREE"||r.family==="VOICE_IDENTITY"))invalid("FREE/Voice rules cannot create visual state/time obligations");if(r.family==="VOICE_IDENTITY"&&r.enforcement!=="FREE"&&(!r.voiceTargets||r.referenceMode!=="SUBJECT_MASTER"||r.reviewScales?.length!==1||r.reviewScales[0]!=="PRODUCTION"))invalid("Active Voice identity requires explicit audio targets, subject reference and full-production review");if(r.voiceTargets&&(r.family!=="VOICE_IDENTITY"||r.enforcement==="FREE"))invalid("Only active Voice rules select audio targets");if(r.enforcement==="FREE"!==(r.expected===null))invalid("FREE has no expected obligation; other enforcement requires an expectation");if(r.enforcement==="FREE"&&r.referenceMode!=="NONE")invalid("FREE cannot require reference conditioning");if(r.referenceMode==="EXACT"!==(r.reference!==void 0))invalid("Only EXACT reference mode carries an exact reference");if(r.referenceMode==="SUBJECT_MASTER"&&!r.subjectId)invalid("SUBJECT_MASTER requires an exact canonical subject");if(["CHARACTER_IDENTITY","WARDROBE","VOICE_IDENTITY"].includes(r.family)&&!r.subjectId)invalid("Character, Wardrobe and Voice obligations require an exact subject");if(r.family==="CHARACTER_IDENTITY"&&["LOCKED","REQUIRED"].includes(r.enforcement)&&r.referenceMode==="NONE")invalid("Mandatory Character identity requires concrete identity evidence");if(r.transition&&(r.family!=="WARDROBE"||r.transition.to!==r.expected||!r.override))invalid("A planned Wardrobe transition must name the changed inherited rule and new expectation")});var ConsistencyProfileContentSchema=z67.strictObject({subjects:z67.array(ConsistencySubjectSchema).max(32),rules:z67.array(ConsistencyRuleSchema).max(256)}).superRefine((p,c)=>{const invalid=message=>c.addIssue({code:"custom",message});if(new Set(p.subjects.map(s=>s.id)).size!==p.subjects.length||new Set(p.rules.map(r=>r.id)).size!==p.rules.length)invalid("Consistency subjects and rules require distinct stable IDs");if(p.rules.filter(r=>r.family==="VOICE_IDENTITY"&&r.enforcement!=="FREE").length>16)invalid("Voice obligations exceed their bounded rule budget");for(const r of p.rules){const s=p.subjects.find(s2=>s2.id===r.subjectId);if(r.subjectId&&!s)invalid("Rule names an unknown canonical subject");if(r.family==="VOICE_IDENTITY"&&r.enforcement!=="FREE"&&!s?.voiceExpectation)invalid("Active Voice identity requires an exact approved voice expectation");if(s&&r.family==="VOICE_IDENTITY"!==(s.kind==="VOICE")&&["CHARACTER_IDENTITY","WARDROBE","VOICE_IDENTITY"].includes(r.family))invalid("Rule family and canonical subject kind disagree");if(r.override&&!p.rules.some(prior=>prior.id===r.override.priorRuleId))invalid("An override must name an existing inherited rule");if(r.reference&&r.family==="VOICE_IDENTITY"!==(r.reference.contentType==="audio/wav"))invalid("Visual obligations cannot use audio and Voice obligations cannot use images")}});var ConsistencyProfileScopeSchema=z67.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var ConsistencyProfileVersionQuerySchema=ConsistencyProfileScopeSchema.extend({profileId:z67.uuid()});var ConfigureConsistencyProfileSchema=ConsistencyProfileScopeSchema.extend({expectedProductionRevision:z67.int().positive(),expectedProfileVersion:z67.int().nonnegative(),content:ConsistencyProfileContentSchema,reason:z67.string().trim().min(1).max(2e3),idempotencyKey:z67.string().trim().min(1).max(200)});var ConsistencyProfileVersionSchema=ConsistencyProfileScopeSchema.extend({id:z67.uuid(),projectId:ProjectIdSchema,version:z67.int().positive(),previousVersionId:z67.uuid().nullable(),content:ConsistencyProfileContentSchema,fingerprint:z67.string().regex(/^[0-9a-f]{64}$/),reason:z67.string().trim().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z67.iso.datetime({offset:true})});var ConsistencyProfileViewSchema=ConsistencyProfileScopeSchema.extend({productionRevision:z67.int().positive(),current:ConsistencyProfileVersionSchema.nullable()});var ConsistencyProfileReceiptSchema=z67.strictObject({semanticStatus:z67.literal("SUCCESS"),profile:ConsistencyProfileVersionSchema,productionRevision:z67.int().positive()});import{z as z68}from"zod";var sha12=z68.string().regex(/^[0-9a-f]{64}$/);var RoughCutReviewScopeSchema=TimelineScopeSchema.extend({renderId:z68.uuid()});var ReviewIntervalSchema=z68.strictObject({startMs:z68.int().nonnegative().max(6e4),endMs:z68.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Review interval must advance");var RoughCutRequirementSchema=z68.strictObject({voiceIdentity:VoiceRequirementGateSchema.optional(),continuity:ContinuityExpectationSchema.optional(),consistencyScale:ConsistencyReviewScaleSchema.optional(),consistencyFamily:z68.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","BOUNDARY_CONTINUITY","VOICE_IDENTITY"]).optional(),consistencySubject:ConsistencySubjectSchema.optional(),consistencyReference:ConsistencyMasterReferenceSchema.optional(),key:z68.string().min(1).max(220),dimension:z68.enum(["PRODUCT_PRESENTATION","CANONICAL_FACT","NARRATIVE","PACING","REPETITION","STYLE","TECHNICAL","TRANSITION"]),expected:z68.string().min(1).max(4e3),enforcement:z68.enum(["LOCKED","REQUIRED","PREFERRED"]),scope:z68.enum(["PRODUCTION","TRANSITION"]),interval:ReviewIntervalSchema,shotIds:z68.array(z68.uuid()).min(1).max(200)});var RoughCutObservationSchema=z68.strictObject({listeningEvidenceIds:ListeningEvidenceIdsSchema.optional(),continuitySamples:ContinuitySamplesSchema.optional(),temporalEvidenceIds:TemporalEvidenceIdsSchema.optional(),key:z68.string().min(1).max(220),status:z68.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z68.enum(["CLEAR","UNCERTAIN"]),observed:z68.string().trim().min(1).max(1800),interval:ReviewIntervalSchema,location:z68.strictObject({interval:ReviewIntervalSchema,shotIds:z68.array(z68.uuid()).min(1).max(200)}).optional()});var RoughCutInspectionSchema=z68.strictObject({actor:z68.enum(["HUMAN","EXTERNAL_AGENT"]),method:z68.literal("FULL_TEMPORAL_INSPECTION"),coverage:z68.array(ReviewIntervalSchema).min(1).max(200)});var RoughCutReviewBasisSchema=z68.strictObject({voiceEvidence:ProductionVoiceEvidenceSchema.optional(),consistencyRequirements:z68.array(RoughCutRequirementSchema).max(256).optional(),artifactId:z68.uuid(),representationId:z68.uuid(),checksumSha256:sha12,manifestFingerprint:sha12,manifest:RoughCutManifestReaderSchema,brief:BriefVersionSchema,story:StoryVersionSchema});var RecordRoughCutReviewSchema=RoughCutReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),artifactId:z68.uuid(),representationId:z68.uuid(),checksumSha256:sha12,basisFingerprint:sha12,expectedProductionRevision:z68.int().positive(),expectedReviewVersion:z68.int().nonnegative(),idempotencyKey:z68.string().trim().min(1).max(200),inspection:RoughCutInspectionSchema,observations:z68.array(RoughCutObservationSchema).min(1).max(300),summary:z68.string().trim().min(1).max(2500)});var RoughCutReviewRecordSchema=RoughCutReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),id:z68.uuid(),projectId:ProjectIdSchema,version:z68.int().positive(),kind:z68.literal("PRODUCTION_REVIEW_2"),lifecycle:z68.literal("COMPLETED"),evaluatorVersion:z68.literal("production-review-v1"),basis:RoughCutReviewBasisSchema,basisFingerprint:sha12,executionClass:z68.enum(["LIVE","TEST_ONLY"]),technical:RoughCutTechnicalSchema,durationMs:z68.int().min(3e4).max(6e4),requirements:z68.array(RoughCutRequirementSchema).min(1).max(300),inspection:RoughCutInspectionSchema,observations:z68.array(RoughCutObservationSchema).min(1).max(300),result:z68.enum(["PASS","WARNING","FAIL"]),blockingKeys:z68.array(z68.string()).max(300),warningKeys:z68.array(z68.string()).max(300),summary:z68.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z68.iso.datetime({offset:true})});var RoughCutReviewTargetSchema=RoughCutReviewScopeSchema.extend({temporalEvidence:z68.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,productionRevision:z68.int().positive(),productionRunnable:z68.boolean(),executionClass:z68.enum(["LIVE","TEST_ONLY"]),freshness:z68.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z68.array(z68.string()).max(18),inspectable:z68.boolean(),durationMs:z68.int().min(3e4).max(6e4),basis:RoughCutReviewBasisSchema,basisFingerprint:sha12,technical:RoughCutTechnicalSchema,requirements:z68.array(RoughCutRequirementSchema).min(1).max(300),latestReview:RoughCutReviewRecordSchema.nullable(),reviewVersion:z68.int().nonnegative(),finalReadyVersion:z68.int().nonnegative()});var RoughCutFindingSchema=RoughCutReviewScopeSchema.extend({compositionLocality:z68.array(CompositionFindingLocalitySchema).min(1).max(208).optional(),id:z68.uuid(),projectId:ProjectIdSchema,reviewId:z68.uuid(),reviewVersion:z68.int().positive(),basisFingerprint:sha12,artifactId:z68.uuid(),timelineVersionId:z68.uuid(),requirement:RoughCutRequirementSchema,observation:RoughCutObservationSchema,blocking:z68.boolean(),severity:z68.enum(["BLOCKING","WARNING"]),remediation:z68.enum(["REVISE_PRODUCTION","REVISE_TRANSITION","CORRECT_CANONICAL_CONTRADICTION"]),affectedScope:z68.strictObject({kind:z68.enum(["PRODUCTION","SHOT","TRANSITION","TIMELINE_REGION"]),interval:ReviewIntervalSchema,shotIds:z68.array(z68.uuid()).min(1).max(200)}),initialLifecycle:z68.literal("OPEN"),createdAt:z68.iso.datetime({offset:true})});var RoughCutFindingViewSchema=RoughCutFindingSchema.extend({lifecycle:z68.enum(["OPEN","REMEDIATION_PLANNED","RESOLVED","WAIVED","SUPERSEDED"]),proofReviewId:z68.uuid().nullable(),proofDecisionId:z68.uuid().nullable()});var RoughCutReviewQuerySchema=RoughCutReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutReviewPageSchema=z68.strictObject({items:z68.array(RoughCutReviewRecordSchema),page:QueryPageInfoSchema});var RoughCutFindingQuerySchema=TimelineScopeSchema.extend({renderId:z68.uuid().optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutFindingGetSchema=TimelineScopeSchema.extend({findingId:z68.uuid()});var RoughCutFindingPageSchema=z68.strictObject({items:z68.array(RoughCutFindingViewSchema),page:QueryPageInfoSchema});var RoughCutReviewReceiptSchema=z68.strictObject({semanticStatus:z68.literal("SUCCESS"),review:RoughCutReviewRecordSchema,findingIds:z68.array(z68.uuid()).max(300),productionRevision:z68.int().positive()});import{z as z69}from"zod";var ReviewEvidenceKeySchema=z69.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var ReviewEvidenceMediaSchema=z69.strictObject({artifactId:z69.uuid(),representationId:z69.uuid(),checksumSha256:z69.string().regex(/^[0-9a-f]{64}$/)});var common={id:ReviewEvidenceKeySchema,label:z69.string().trim().min(1).max(200),producer:z69.enum(["EXTERNAL_AGENT_HOST","HUMAN","VLM"]),media:ReviewEvidenceMediaSchema};var ReviewIntelligenceEvidenceSchema=z69.discriminatedUnion("kind",[z69.strictObject({...common,kind:z69.literal("METADATA")}),z69.strictObject({...common,kind:z69.literal("IMAGE_PIXELS")}),z69.strictObject({...common,kind:z69.literal("REGISTERED_TEMPORAL_FRAMES"),reference:TemporalEvidenceReferenceSchema}),z69.strictObject({...common,kind:z69.literal("VIDEO_PLAYBACK"),coverage:z69.array(ReviewIntervalSchema).min(1).max(200)}),z69.strictObject({...common,kind:z69.literal("AUDIO_LISTENING"),coverage:z69.array(ReviewIntervalSchema).min(1).max(200)}),z69.strictObject({...common,kind:z69.literal("VIDEO_WITH_AUDIO_PLAYBACK"),coverage:z69.array(ReviewIntervalSchema).min(1).max(200)}),z69.strictObject({...common,kind:z69.literal("VIDEO_FRAMES"),timestampsMs:z69.array(z69.number().nonnegative().max(6e4)).min(1).max(64)})]);var HYPERFRAME_RENDER_PROFILE={id:"HYPERFRAME_1080P30_FULL_PAINT_V1",adapter:"native-hyperframe-v1",engine:"0.8.134",producer:"0.8.134",gsap:"3.15.0",node:"v24.21.0",browser:"Google Chrome for Testing 154.0.8037.57",browserSha256:"60c03e8882f4bb47459a905ede1074e1e746c5b765e437c288e460320540a8a3",ffmpeg:"ffmpeg version 8.0.1-3ubuntu2 Copyright (c) 2000-2025 the FFmpeg developers",maxFrames:360,timeoutMs:6e5,maxRssBytes:3221225472,maxScratchBytes:3221225472,maxOutputBytes:134217728,maxCpuMs:6e5,capture:"PNG_SOFTWARE_SCREENSHOT_FULL_PAINT",encode:"H264_YUV420P_CRF18_THREADS2_NO_AUDIO"};var HYPERFRAME_ALPHA_RENDER_PROFILE={...HYPERFRAME_RENDER_PROFILE,id:"HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1",adapter:"native-hyperframe-alpha-v1",encode:"RGBA_PNG_SEQUENCE_30_V1",maxOutputBytes:67108864,maxDecodedBytes:536870912};var HYPERFRAME_CACHED_RENDER_PROFILE={...HYPERFRAME_RENDER_PROFILE,id:"HYPERFRAME_1080P30_FRAME_CACHE_V2",adapter:"native-hyperframe-cache-v2",encode:"H264_YUV420P_CRF18_VERYFAST_THREADS2_NO_AUDIO"};import{z as z70}from"zod";var ObservationScopeSchema=z70.strictObject({tenantId:z70.uuid(),productionId:z70.uuid()});var audioSourceRequest=z70.strictObject({kind:z70.literal("AUDIO"),media:ReviewEvidenceMediaSchema,versionId:z70.uuid(),purpose:z70.enum(["VOICEOVER","MUSIC"])});var ObservationSourceRequestSchema=z70.discriminatedUnion("kind",[audioSourceRequest,z70.strictObject({kind:z70.literal("VIDEO"),media:ReviewEvidenceMediaSchema})]);var ObservationStartSchema=ObservationScopeSchema.extend({expectedProductionRevision:z70.int().positive(),idempotencyKey:z70.string().min(1).max(200),source:ObservationSourceRequestSchema,mode:ObservationModeSchema,selection:ProviderSelectionSchema,expectedModelProfileVersion:z70.int().positive(),parameters:ObservationParametersSchema.default({})}).refine(q=>q.mode==="TRANSCRIPTION"||q.mode==="AUDIO"===(q.source.kind==="AUDIO"),{message:"Observation input/mode mismatch"});var ObservationGetSchema=ObservationScopeSchema.extend({observationId:z70.uuid()});var ObservationBindingSchema=z70.strictObject({tenantId:z70.uuid(),connectionId:z70.uuid(),connectionVersion:z70.int().positive(),credentialRef:z70.string(),credentialVersion:z70.int().positive(),profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),executionClass:z70.enum(["LIVE","TEST_ONLY"])}).refine(v=>!v.profile.modes.some(m=>m==="TRANSCRIPTION")||!!v.matrix,{message:"ASR requires its frozen capability matrix"});var ObservationSourceSchema=ReviewEvidenceMediaSchema.extend({tenantId:z70.uuid(),projectId:z70.uuid(),productionId:z70.uuid(),byteSize:z70.int().positive().max(12582912),durationMs:z70.number().positive().max(6e4),frameRate:z70.number().positive().max(60).optional(),executionClass:z70.enum(["LIVE","TEST_ONLY"])});var json=z70.record(z70.string(),z70.unknown());var ObservationResultSchema=z70.strictObject({schemaVersion:z70.int().positive(),advisory:z70.literal(true),producer:z70.enum(["VLM","ASR"]).optional(),source:ObservationSourceSchema,input:json,provider:json,observedAt:z70.iso.datetime(),report:json,transcript:TranscriptSchema.optional(),evidence:ReviewIntelligenceEvidenceSchema.optional(),limitations:z70.array(z70.string().max(200)).max(20)}).refine(v=>v.producer==="ASR"===!!v.transcript&&!(v.producer==="ASR"&&v.evidence),{message:"ASR transcript cannot provide listening or visual Review evidence"}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=131072,{message:"Observation report too large"}).refine(v=>v.transcript?.timing!=="PROVIDER_REPORTED"||v.provider.protocol==="OPENAI_WHISPER_TRANSCRIPTION_V1"&&[...v.transcript.words,...v.transcript.segments].every(item=>item.endMs<=v.source.durationMs),{message:"Transcript timing requires the exact supported protocol and media duration"});var ObservationAdmissionSchema=z70.strictObject({semanticStatus:z70.literal("ACCEPTED"),observationId:z70.uuid(),runtimeJobId:z70.uuid(),productionRevision:z70.int().positive(),executionClass:z70.enum(["LIVE","TEST_ONLY"])});var ObservationViewSchema=ObservationScopeSchema.extend({observationId:z70.uuid(),runtimeJobId:z70.uuid(),request:ObservationStartSchema,profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),parameters:ObservationParametersSchema,executionClass:z70.enum(["LIVE","TEST_ONLY"]),runtimeStatus:z70.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z70.enum(["NOT_SUBMITTED","SUBMITTING","UNKNOWN","SUCCEEDED","REJECTED"]),cancellationRequested:z70.boolean(),failure:z70.strictObject({classification:z70.string().min(1).max(100),summary:z70.string().min(1).max(1e3)}).nullable(),result:ObservationResultSchema.nullable(),createdAt:z70.iso.datetime()});var ObservationOptionsSchema=ObservationScopeSchema.extend({options:z70.array(z70.strictObject({selection:ProviderSelectionSchema,profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),connectionLabel:z70.string(),connectionVersion:z70.int().positive()})).max(100),possiblyTruncated:z70.boolean()});var LocalObservationStartSchema=ObservationScopeSchema.extend({expectedProductionRevision:ObservationStartSchema.shape.expectedProductionRevision,idempotencyKey:ObservationStartSchema.shape.idempotencyKey,source:audioSourceRequest,mode:z70.literal("TRANSCRIPTION"),deviceExecution:z70.strictObject({deviceId:z70.uuid().optional()})});var localObservationExecution=z70.strictObject({target:z70.literal("TENANT_DEVICE"),deviceId:z70.uuid(),identity:LocalWhisperIdentitySchema});var LocalObservationBindingSchema=localObservationExecution.extend({tenantId:z70.uuid(),executionClass:z70.literal("LIVE"),source:ObservationSourceSchema});var LocalObservationAdmissionSchema=ObservationAdmissionSchema.extend({executionClass:z70.literal("LIVE"),deviceExecution:localObservationExecution});var LocalObservationResultSchema=z70.strictObject({schemaVersion:z70.literal(1),advisory:z70.literal(true),producer:z70.literal("ASR"),source:ObservationSourceSchema,deviceExecution:localObservationExecution,observedAt:z70.iso.datetime(),transcript:TranscriptSchema.options[0],inputPcmSha256:z70.string().regex(/^[0-9a-f]{64}$/),inputPcmByteSize:z70.int().min(44).max(1920044)}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=131072,{message:"Observation report too large"});var LocalObservationViewSchema=ObservationViewSchema.omit({profile:true,matrix:true,parameters:true,providerStatus:true}).extend({request:LocalObservationStartSchema,executionClass:z70.literal("LIVE"),deviceExecution:localObservationExecution,result:LocalObservationResultSchema.nullable()});var qwenAsrModelId="qwen3-asr-flash-2026-02-10";var QwenAsrDeviceQuoteInputSchema=ObservationScopeSchema.extend({expectedProductionRevision:ObservationStartSchema.shape.expectedProductionRevision,idempotencyKey:ObservationStartSchema.shape.idempotencyKey,source:audioSourceRequest,mode:z70.literal("TRANSCRIPTION"),selection:ProviderSelectionSchema.extend({modelProfileId:z70.literal(qwenAsrModelId)}),expectedModelProfileVersion:z70.literal(1),parameters:ObservationParametersSchema.default({}),deviceId:z70.uuid()});var QwenAsrCostQuoteSchema=z70.strictObject({protocol:z70.literal("NVS_QWEN_ASR_COST_QUOTE_V1"),currency:z70.literal("USD"),ruleId:z70.string().min(1).max(100),sourceUrl:z70.url().max(2048),selection:QwenAsrDeviceQuoteInputSchema.shape.selection,connectionVersion:z70.int().positive(),modelProfileVersion:z70.literal(1),deviceId:z70.uuid(),intentFingerprint:z70.string().regex(/^[0-9a-f]{64}$/),inputDurationMs:z70.number().positive().max(6e4),reservedSeconds:z70.int().min(1).max(60),upperBoundMicrosPerSecond:z70.int().positive().max(1e6),upperBoundMicros:z70.int().positive().max(6e7),validUntil:z70.iso.datetime()});var QwenAsrDeviceStartSchema=QwenAsrDeviceQuoteInputSchema.extend({approvedQuote:QwenAsrCostQuoteSchema});var qwenAsrDeviceExecution=z70.strictObject({target:z70.literal("TENANT_EXTERNAL_PROVIDER"),deviceId:z70.uuid()});var QwenAsrDeviceAdmissionSchema=ObservationAdmissionSchema.extend({executionClass:z70.literal("LIVE"),deviceExecution:qwenAsrDeviceExecution});var qwenAsrTokenCount=z70.int().min(0).max(1e7).optional();var QwenAsrDeviceResultSchema=ObservationResultSchema.safeExtend({producer:z70.literal("ASR"),transcript:TranscriptSchema.options[0],input:z70.strictObject({kind:z70.literal("ORIGINAL_PCM_WAV_TRANSCRIPTION"),checksumSha256:ObservationSourceSchema.shape.checksumSha256,byteSize:ObservationSourceSchema.shape.byteSize,timeScaleFactor:z70.literal(1)}),provider:z70.strictObject({protocol:z70.literal("QWEN_ASR_V1"),requestedModel:z70.literal(qwenAsrModelId),model:z70.literal(qwenAsrModelId),requestId:z70.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/),usage:z70.strictObject({seconds:z70.int().min(0).max(60).optional(),prompt_tokens:qwenAsrTokenCount,completion_tokens:qwenAsrTokenCount,total_tokens:qwenAsrTokenCount})}),report:z70.strictObject({task:z70.literal("SPEECH_RECOGNITION")})});var QwenAsrDeviceViewSchema=ObservationViewSchema.extend({request:QwenAsrDeviceQuoteInputSchema,executionClass:z70.literal("LIVE"),deviceExecution:qwenAsrDeviceExecution,result:QwenAsrDeviceResultSchema.nullable()});var ProductionGuidanceSchema=z70.strictObject({version:z70.enum(["NVS_PRODUCTION_GUIDANCE_V1","NVS_PRODUCTION_GUIDANCE_V2"]),instructions:z70.string().min(1).max(16e3)});var ProductionGuidanceContextSchema=ObservationScopeSchema.extend({projectId:z70.uuid(),revision:z70.int().positive(),guidance:ProductionGuidanceSchema});var MAX_SHOT_REVIEW_REQUIREMENTS=2200;import{z as z71}from"zod";var Fingerprint3=z71.string().regex(/^[0-9a-f]{64}$/);var VideoReviewScopeSchema=z71.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:z71.uuid()});var VideoReviewRequirementSchema=z71.strictObject({intentPath:z71.string().min(1).max(220).optional(),continuity:ContinuityExpectationSchema.optional(),interval:z71.strictObject({startMs:z71.int().nonnegative().max(6e4),endMs:z71.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Requirement interval must advance").optional(),key:z71.string().min(1).max(220),family:z71.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","SHOT_INTENT","BOUNDARY_CONTINUITY","SOUND"]),expected:z71.string().min(1).max(2500),enforcement:z71.enum(["LOCKED","REQUIRED","PREFERRED"]),evidenceWindow:z71.enum(["WHOLE_VIDEO","START","END","TEMPORAL"])});var VideoObservationSchema=z71.strictObject({listeningEvidenceIds:ListeningEvidenceIdsSchema.optional(),continuitySamples:ContinuitySamplesSchema.optional(),temporalEvidenceIds:TemporalEvidenceIdsSchema.optional(),key:z71.string().min(1).max(220),status:z71.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z71.enum(["CLEAR","UNCERTAIN"]),observed:z71.string().trim().min(1).max(1800),interval:z71.strictObject({startMs:z71.int().nonnegative(),endMs:z71.int().positive()}).refine(v=>v.endMs>v.startMs,"Observation interval must advance").optional()});var RecordVideoReviewSchema=VideoReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),candidateId:z71.uuid(),representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint3,expectedReviewVersion:z71.int().nonnegative(),idempotencyKey:z71.string().trim().min(1).max(200),observations:z71.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z71.string().trim().min(1).max(2500)});var VideoReviewRecordSchema=z71.strictObject({listeningEvidence:ListeningEvidenceSetSchema.optional(),id:z71.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,generationId:z71.uuid(),candidateId:z71.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint3,shotId:ShotIdSchema,version:z71.int().positive(),preparationId:z71.uuid(),contractId:z71.uuid(),contractFingerprint:Fingerprint3,executionClass:z71.enum(["LIVE","TEST_ONLY"]),kind:z71.literal("SHOT_REVIEW_1"),lifecycle:z71.literal("COMPLETED"),evaluatorVersion:z71.literal("shot-review-v1"),source:z71.literal("EXPLICIT_MEDIA_INSPECTION"),technical:VideoTechnicalMetadataSchema,requirements:z71.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z71.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z71.enum(["PASS","WARNING","FAIL"]),blockingKeys:z71.array(z71.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z71.array(z71.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z71.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z71.iso.datetime({offset:true})});var DecideVideoShotSchema=VideoReviewScopeSchema.extend({candidateId:z71.uuid(),reviewId:z71.uuid(),expectedAcceptanceVersion:z71.int().nonnegative(),action:z71.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z71.boolean().default(false),reason:z71.string().trim().min(1).max(2500),idempotencyKey:z71.string().trim().min(1).max(200)});var ShotAcceptanceScopeSchema=z71.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema});var RevokeShotAcceptanceSchema=ShotAcceptanceScopeSchema.extend({acceptanceId:z71.uuid(),expectedAcceptanceVersion:z71.int().positive(),reason:z71.string().trim().min(1).max(2500),idempotencyKey:z71.string().trim().min(1).max(200)});var GeneratedShotAcceptanceDecisionSchema=z71.strictObject({id:z71.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z71.int().positive(),generationId:z71.uuid(),candidateId:z71.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z71.uuid(),action:z71.enum(["ACCEPT","REJECT","REVOKE"]),reference:AcceptedShotReferenceSchema.nullable(),previousAcceptanceId:z71.uuid().nullable(),warningKeys:z71.array(z71.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z71.boolean(),reason:z71.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z71.iso.datetime({offset:true})});var ProgrammaticShotAcceptanceDecisionSchema=z71.strictObject({sourceKind:z71.literal("PROGRAMMATIC"),id:z71.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z71.int().positive(),renderId:z71.uuid(),compositionId:z71.uuid(),compositionVersionId:z71.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z71.uuid(),action:z71.enum(["ACCEPT","REJECT","REVOKE"]),reference:ProgrammaticAcceptedVisualSourceReferenceSchema.nullable(),previousAcceptanceId:z71.uuid().nullable(),warningKeys:z71.array(z71.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z71.boolean(),reason:z71.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z71.iso.datetime({offset:true})});var ShotAcceptanceDecisionSchema=z71.union([GeneratedShotAcceptanceDecisionSchema,ProgrammaticShotAcceptanceDecisionSchema,z71.strictObject({sourceKind:z71.literal("IMPORTED"),id:z71.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z71.int().positive(),normalizationId:z71.uuid(),sourceId:z71.uuid(),sourceVersionId:z71.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z71.uuid(),action:z71.enum(["ACCEPT","REJECT","REVOKE"]),reference:ImportedAcceptedVisualSourceReferenceSchema.nullable(),previousAcceptanceId:z71.uuid().nullable(),warningKeys:z71.array(z71.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z71.boolean(),reason:z71.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z71.iso.datetime({offset:true})})]);var VideoReviewTargetSchema=VideoReviewScopeSchema.extend({temporalEvidence:z71.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,shotId:ShotIdSchema,preparationId:z71.uuid(),contractId:z71.uuid(),contractFingerprint:Fingerprint3,executionClass:z71.enum(["LIVE","TEST_ONLY"]),freshness:z71.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z71.boolean(),productionRunnable:z71.boolean(),candidate:VideoCandidateSchema,requirements:z71.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:VideoReviewRecordSchema.nullable(),reviewVersion:z71.int().nonnegative(),acceptanceVersion:z71.int().nonnegative(),activeAcceptanceId:z71.uuid().nullable()});var ShotAcceptanceViewSchema=ShotAcceptanceScopeSchema.extend({acceptanceVersion:z71.int().nonnegative(),status:z71.enum(["NONE","CURRENT","STALE"]),acceptance:ShotAcceptanceDecisionSchema.nullable(),reference:AcceptedVisualSourceReferenceSchema.nullable()});var VideoReviewQuerySchema=VideoReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VideoReviewPageSchema=z71.strictObject({items:z71.array(VideoReviewRecordSchema),page:QueryPageInfoSchema});var ShotDecisionQuerySchema=ShotAcceptanceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ShotDecisionPageSchema=z71.strictObject({items:z71.array(ShotAcceptanceDecisionSchema),page:QueryPageInfoSchema});var VideoReviewReceiptSchema=z71.strictObject({semanticStatus:z71.literal("SUCCESS"),review:VideoReviewRecordSchema,productionRevision:z71.int().positive()});var ShotDecisionReceiptSchema=z71.strictObject({semanticStatus:z71.literal("SUCCESS"),decision:ShotAcceptanceDecisionSchema,productionRevision:z71.int().positive()});import{z as z72}from"zod";var Fingerprint4=z72.string().regex(/^[0-9a-f]{64}$/);var ProgrammaticVideoReviewScopeSchema=z72.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,renderId:z72.uuid()});var ProgrammaticReviewMediaSchema=VideoTechnicalMetadataSchema.extend({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,availability:z72.enum(["AVAILABLE","INVALID"])});var ProgrammaticVideoReviewRecordSchema=z72.strictObject({sourceKind:z72.literal("PROGRAMMATIC"),id:z72.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,renderId:z72.uuid(),compositionId:z72.uuid(),compositionVersionId:z72.uuid(),compositionVersion:z72.int().positive(),compositionFingerprint:Fingerprint4,renderManifestFingerprint:Fingerprint4,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint4,version:z72.int().positive(),planVersionId:z72.uuid(),planVersion:z72.int().positive(),shotPlanningRevision:z72.int().positive(),executionClass:z72.enum(["LIVE","TEST_ONLY"]),kind:z72.literal("SHOT_REVIEW_1"),lifecycle:z72.literal("COMPLETED"),evaluatorVersion:z72.literal("shot-review-v1"),source:z72.literal("EXPLICIT_MEDIA_INSPECTION"),technical:VideoTechnicalMetadataSchema,requirements:z72.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z72.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z72.enum(["PASS","WARNING","FAIL"]),blockingKeys:z72.array(z72.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z72.array(z72.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z72.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z72.iso.datetime({offset:true})});var ProgrammaticVideoReviewTargetSchema=ProgrammaticVideoReviewScopeSchema.extend({sourceKind:z72.literal("PROGRAMMATIC"),temporalEvidence:z72.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,shotId:ShotIdSchema,compositionId:z72.uuid(),compositionVersionId:z72.uuid(),compositionVersion:z72.int().positive(),compositionFingerprint:Fingerprint4,renderManifestFingerprint:Fingerprint4,executionClass:z72.enum(["LIVE","TEST_ONLY"]),freshness:z72.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z72.boolean(),productionRunnable:z72.boolean(),media:ProgrammaticReviewMediaSchema,requirements:z72.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:ProgrammaticVideoReviewRecordSchema.nullable(),reviewVersion:z72.int().nonnegative(),acceptanceVersion:z72.int().nonnegative(),activeAcceptanceId:z72.uuid().nullable()});var RecordProgrammaticVideoReviewSchema=ProgrammaticVideoReviewScopeSchema.extend({representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint4,expectedReviewVersion:z72.int().nonnegative(),idempotencyKey:z72.string().trim().min(1).max(200),observations:z72.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z72.string().trim().min(1).max(2500)});var DecideProgrammaticShotSchema=ProgrammaticVideoReviewScopeSchema.extend({reviewId:z72.uuid(),expectedAcceptanceVersion:z72.int().nonnegative(),action:z72.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z72.boolean().default(false),reason:z72.string().trim().min(1).max(2500),idempotencyKey:z72.string().trim().min(1).max(200)});var ProgrammaticVideoReviewQuerySchema=ProgrammaticVideoReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ProgrammaticVideoReviewPageSchema=z72.strictObject({items:z72.array(ProgrammaticVideoReviewRecordSchema),page:QueryPageInfoSchema});var ProgrammaticVideoReviewReceiptSchema=z72.strictObject({semanticStatus:z72.literal("SUCCESS"),review:ProgrammaticVideoReviewRecordSchema,productionRevision:z72.int().positive()});import{z as z73}from"zod";var Intent=z73.string().trim().min(1).max(300);var CameraIntentSchema=z73.strictObject({scale:z73.enum(["EXTREME_CLOSE_UP","CLOSE_UP","MEDIUM","WIDE","EXTREME_WIDE"]),framing:z73.enum(["CENTERED","OFF_CENTER","SYMMETRICAL","OVER_SHOULDER"]),angle:z73.enum(["EYE_LEVEL","HIGH","LOW","TOP_DOWN"]),movement:z73.enum(["STATIC","PAN","TILT","DOLLY","TRACK","ORBIT","CRANE","ZOOM"]),stability:z73.enum(["LOCKED","STABILIZED","HANDHELD"]),direction:z73.enum(["LEFT","RIGHT","UP","DOWN","FORWARD","BACKWARD","CLOCKWISE","COUNTERCLOCKWISE"]).optional(),lensIntent:z73.string().trim().min(1).max(120).optional()});var ShotTemporalBeatSchema=z73.strictObject({startSeconds:z73.number().min(0).max(30),endSeconds:z73.number().positive().max(30),action:Intent});var ShotDirectionSchema=z73.strictObject({camera:CameraIntentSchema,temporalBeats:z73.array(ShotTemporalBeatSchema).min(1).max(8),environmentIntent:Intent.optional(),lightingIntent:Intent.optional(),styleIntent:Intent.optional(),audioIntent:Intent.optional()});function checkShotDirectionTiming(direction,duration){let cursor=0;for(const beat of direction.temporalBeats){if(Math.abs(beat.startSeconds-cursor)>1e-6||beat.endSeconds<=beat.startSeconds)return false;cursor=beat.endSeconds}return Math.abs(cursor-duration)<=1e-6}import{z as z74}from"zod";var PlanningClientKeySchema=z74.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/);var BoundaryRequirementSchema=z74.strictObject({attribute:z74.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,59}$/),value:z74.string().trim().min(1).max(300)});var ShotIntentSchema=z74.strictObject({narrativePurpose:z74.string().trim().min(1).max(600),subjectAction:z74.string().trim().min(1).max(600),targetDurationSeconds:z74.number().min(.5).max(30),subjectRequirements:z74.array(z74.string().trim().min(1).max(300)).max(16).default([]),cameraComposition:z74.string().trim().min(1).max(500).optional(),factualClaims:z74.array(StoryFactClaimSchema).max(16).default([]),requiresGeneratedKeyframe:z74.boolean().default(false),sourceMediaAllowed:z74.boolean().default(false),direction:ShotDirectionSchema.optional()}).superRefine((value2,context)=>{if(value2.direction&&!checkShotDirectionTiming(value2.direction,value2.targetDurationSeconds))context.addIssue({code:"custom",path:["direction","temporalBeats"],message:"Temporal beats must be contiguous from zero and cover exactly the Shot duration"})});var ShotPlanInputSchema=z74.strictObject({clientKey:PlanningClientKeySchema,shotId:ShotIdSchema.optional(),intent:ShotIntentSchema,entryBoundary:z74.array(BoundaryRequirementSchema).max(24).default([]),exitBoundary:z74.array(BoundaryRequirementSchema).max(24).default([])});var ScenePlanInputSchema=z74.strictObject({clientKey:PlanningClientKeySchema,sceneId:SceneIdSchema.optional(),purpose:z74.string().trim().min(1).max(800),locationContext:z74.string().trim().min(1).max(300).optional(),timeContext:z74.string().trim().min(1).max(300).optional(),entryBoundary:z74.array(BoundaryRequirementSchema).max(24).default([]),exitBoundary:z74.array(BoundaryRequirementSchema).max(24).default([]),shots:z74.array(ShotPlanInputSchema).min(1).max(24)});var ContinuityRequirementSchema=z74.strictObject({mode:z74.enum(["PERSIST","TRANSITION","REESTABLISH","REVIEW"]),attribute:z74.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,59}$/),description:z74.string().trim().min(1).max(500)});var ContinuityEdgeInputSchema=z74.strictObject({fromShotKey:PlanningClientKeySchema,toShotKey:PlanningClientKeySchema,requirements:z74.array(ContinuityRequirementSchema).min(1).max(24)});var AcceptSceneShotPlanRequestSchema=z74.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z74.int().positive(),expectedStoryVersion:z74.int().positive(),revisionReason:z74.string().trim().min(1).max(1e3).optional(),idempotencyKey:z74.string().trim().min(1).max(200),scenes:z74.array(ScenePlanInputSchema).min(1).max(12),continuityEdges:z74.array(ContinuityEdgeInputSchema).max(64).default([])});var ShotPlanEntrySchema=z74.strictObject({shotId:ShotIdSchema,clientKey:PlanningClientKeySchema,ordinal:z74.int().positive(),planningRevision:z74.int().positive(),intent:ShotIntentSchema,entryBoundary:z74.array(BoundaryRequirementSchema).max(24),exitBoundary:z74.array(BoundaryRequirementSchema).max(24)});var ScenePlanEntrySchema=z74.strictObject({sceneId:SceneIdSchema,clientKey:PlanningClientKeySchema,ordinal:z74.int().positive(),purpose:z74.string().trim().min(1).max(800),locationContext:z74.string().trim().min(1).max(300).optional(),timeContext:z74.string().trim().min(1).max(300).optional(),entryBoundary:z74.array(BoundaryRequirementSchema).max(24),exitBoundary:z74.array(BoundaryRequirementSchema).max(24),shots:z74.array(ShotPlanEntrySchema).min(1).max(24)});var ContinuityEdgeSchema=z74.strictObject({id:ContinuityEdgeIdSchema,fromShotId:ShotIdSchema,toShotId:ShotIdSchema,requirements:z74.array(ContinuityRequirementSchema).min(1).max(24)});var SceneShotPlanVersionSchema=z74.strictObject({id:SceneShotPlanVersionIdSchema,planId:SceneShotPlanIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z74.int().positive(),storyVersionId:StoryVersionIdSchema,storyVersion:z74.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z74.int().positive(),scenes:z74.array(ScenePlanEntrySchema).min(1).max(12),continuityEdges:z74.array(ContinuityEdgeSchema).max(64),createdByPrincipalId:PrincipalIdSchema,createdAt:z74.iso.datetime({offset:true})});var AcceptSceneShotPlanResultSchema=z74.discriminatedUnion("semanticStatus",[z74.strictObject({semanticStatus:z74.literal("SUCCESS"),planVersion:SceneShotPlanVersionSchema,productionRevision:z74.int().positive(),activeSceneShotPlanVersion:z74.int().positive()}),z74.strictObject({semanticStatus:z74.literal("NEEDS_INPUT"),missingPrerequisites:z74.array(z74.literal("ACTIVE_STORY")).min(1)})]);import{z as z75}from"zod";var WriterScopeSchema=z75.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema});var WriterBasisSchema=WriterScopeSchema.extend({productionRevision:z75.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z75.int().positive()});var IntentSchema=z75.string().trim().min(1).max(600);var WriterAlternativeSchema=z75.strictObject({alternativeId:z75.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z75.string().trim().min(1).max(120),story:StoryContentSchema,rationale:z75.strictObject({coreMessage:IntentSchema,hook:IntentSchema,audienceFit:IntentSchema,pacingIntent:IntentSchema,endingIntent:IntentSchema,tradeoffs:z75.array(IntentSchema).max(6)}),beatDurationsSeconds:z75.array(z75.int().positive().max(60)).min(1).max(24)});var WriterProposalSchema=z75.strictObject({origin:z75.strictObject({kind:z75.literal("EXTERNAL_AGENT_HOST"),label:z75.string().trim().min(1).max(100)}),unknowns:z75.array(z75.string().trim().min(1).max(300)).max(8),alternatives:z75.array(WriterAlternativeSchema).min(1).max(3)});var ValidateWriterProposalSchema=z75.strictObject({basis:WriterBasisSchema,revisionReason:AcceptStoryRequestSchema.shape.revisionReason,proposal:WriterProposalSchema});var MissingBriefSchema=z75.strictObject({semanticStatus:z75.literal("NEEDS_INPUT"),missingPrerequisites:z75.array(z75.literal("ACTIVE_BRIEF")).min(1).max(1)});var WriterBriefResultSchema=z75.discriminatedUnion("semanticStatus",[z75.strictObject({semanticStatus:z75.literal("SUCCESS"),basis:WriterBasisSchema,briefVersion:BriefVersionSchema}),MissingBriefSchema]);var WriterAcceptanceDraftSchema=z75.strictObject({alternativeId:WriterAlternativeSchema.shape.alternativeId,projectId:ProjectIdSchema,productionId:ProductionIdSchema,request:AcceptStoryRequestSchema.omit({idempotencyKey:true})});var WriterValidationResultSchema=z75.discriminatedUnion("semanticStatus",[z75.strictObject({semanticStatus:z75.literal("SUCCESS"),advisory:z75.literal(true),basis:WriterBasisSchema,proposal:WriterProposalSchema,acceptanceDrafts:z75.array(WriterAcceptanceDraftSchema).min(1).max(3),limitations:z75.array(z75.enum(["PROSE_IS_CREATIVE_INTENT_NOT_FACT_VERIFIED","PACING_IS_ADVISORY_NOT_TIMELINE_TRUTH","ACCEPTANCE_RECHECKS_CURRENT_BASIS"])).length(3)}),MissingBriefSchema]);import{z as z76}from"zod";var DirectorScopeSchema=WriterScopeSchema;var DirectorBasisSchema=WriterBasisSchema.extend({storyVersionId:StoryVersionIdSchema,storyVersion:z76.int().positive(),sceneShotPlanVersionId:SceneShotPlanVersionIdSchema.nullable(),sceneShotPlanVersion:z76.int().positive().nullable()}).refine(value2=>value2.sceneShotPlanVersionId===null===(value2.sceneShotPlanVersion===null),"Current plan ID and version must both be present or null");var Intent2=z76.string().trim().min(1).max(600);var Plan=AcceptSceneShotPlanRequestSchema.pick({scenes:true,continuityEdges:true});var DirectorAlternativeSchema=z76.strictObject({alternativeId:z76.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z76.string().trim().min(1).max(120),plan:Plan,rationale:z76.strictObject({storyInterpretation:Intent2,visualApproach:Intent2,pacingIntent:Intent2,tradeoffs:z76.array(Intent2).max(6)}),shotStoryBeats:z76.array(z76.strictObject({shotKey:PlanningClientKeySchema,beatOrdinals:z76.array(z76.int().positive().max(24)).min(1).max(4)})).min(1).max(48)}).refine(value2=>value2.plan.scenes.reduce((n,scene)=>n+scene.shots.length,0)<=48,"Director alternatives contain at most 48 Shots");var DirectorProposalSchema=z76.strictObject({origin:z76.strictObject({kind:z76.literal("EXTERNAL_AGENT_HOST"),label:z76.string().trim().min(1).max(100)}),unknowns:z76.array(z76.string().trim().min(1).max(300)).max(8),alternatives:z76.array(DirectorAlternativeSchema).min(1).max(3)});var ValidateDirectorProposalSchema=z76.strictObject({basis:DirectorBasisSchema,revisionReason:AcceptSceneShotPlanRequestSchema.shape.revisionReason,proposal:DirectorProposalSchema}).refine(value2=>new TextEncoder().encode(JSON.stringify(value2)).byteLength<=1024*1024,"Director validation input exceeds the 1 MiB JSON budget");var Missing=z76.strictObject({semanticStatus:z76.literal("NEEDS_INPUT"),missingPrerequisites:z76.array(z76.enum(["ACTIVE_BRIEF","ACTIVE_STORY"])).min(1).max(2)});var DirectorContextResultSchema=z76.discriminatedUnion("semanticStatus",[z76.strictObject({semanticStatus:z76.literal("SUCCESS"),basis:DirectorBasisSchema,briefVersion:BriefVersionSchema,storyVersion:StoryVersionSchema,sceneShotPlanVersion:SceneShotPlanVersionSchema.nullable(),stalePrerequisites:z76.array(z76.enum(["CURRENT_STORY","CURRENT_SCENE_SHOT_PLAN"])).min(1).max(2).optional()}),Missing]);var DirectorAcceptanceDraftSchema=z76.strictObject({alternativeId:DirectorAlternativeSchema.shape.alternativeId,projectId:DirectorScopeSchema.shape.projectId,productionId:DirectorScopeSchema.shape.productionId,request:AcceptSceneShotPlanRequestSchema.omit({idempotencyKey:true})});var DirectorValidationResultSchema=z76.discriminatedUnion("semanticStatus",[z76.strictObject({semanticStatus:z76.literal("SUCCESS"),advisory:z76.literal(true),basis:DirectorBasisSchema,proposal:DirectorProposalSchema,acceptanceDrafts:z76.array(DirectorAcceptanceDraftSchema).min(1).max(3),limitations:z76.array(z76.enum(["PROSE_IS_CREATIVE_INTENT_NOT_FACT_VERIFIED","DIRECTION_IS_INTENT_NOT_OBSERVED_MEDIA","ACCEPTANCE_RECHECKS_CURRENT_BASIS","PREPARATION_AND_GENERATION_REMAIN_SEPARATE"])).length(4)}),Missing]);import{z as z77}from"zod";var Fingerprint5=z77.string().regex(/^[0-9a-f]{64}$/);var KeyframeReviewScopeSchema=z77.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:z77.uuid()});var VisualRequirementSchema=z77.strictObject({intentPath:z77.string().min(1).max(220).optional(),key:z77.string().min(1).max(200),expected:z77.string().min(1).max(2500),enforcement:z77.enum(["LOCKED","REQUIRED","PREFERRED"])});var Region=z77.strictObject({x:z77.number().min(0).max(1),y:z77.number().min(0).max(1),width:z77.number().positive().max(1),height:z77.number().positive().max(1)}).refine(r=>r.x+r.width<=1&&r.y+r.height<=1,"Evidence region must fit within the image");var KeyframeObservationSchema=z77.strictObject({key:z77.string().min(1).max(200),status:z77.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z77.enum(["CLEAR","UNCERTAIN"]),observed:z77.string().trim().min(1).max(1500),region:Region.optional()});var RecordKeyframeReviewSchema=KeyframeReviewScopeSchema.extend({candidateId:z77.uuid(),representationId:z77.uuid(),checksumSha256:Fingerprint5,expectedReviewVersion:z77.int().nonnegative(),idempotencyKey:z77.string().trim().min(1).max(200),observations:z77.array(KeyframeObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z77.string().trim().min(1).max(2e3)});var KeyframeReviewRecordSchema=z77.strictObject({id:z77.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,generationId:z77.uuid(),candidateId:z77.uuid(),artifactId:z77.uuid(),representationId:z77.uuid(),checksumSha256:Fingerprint5,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,version:z77.int().positive(),preparationId:z77.uuid(),contractId:z77.uuid(),contractFingerprint:Fingerprint5,executionClass:z77.enum(["LIVE","TEST_ONLY"]),kind:z77.literal("KEYFRAME_REFERENCE"),lifecycle:z77.literal("COMPLETED"),evaluatorVersion:z77.literal("keyframe-reference-v1"),source:z77.literal("EXPLICIT_VISUAL_INSPECTION"),requirements:z77.array(VisualRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z77.array(KeyframeObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z77.enum(["PASS","WARNING","FAIL"]),blockingKeys:z77.array(z77.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z77.array(z77.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z77.string().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z77.iso.datetime({offset:true})});var DecideKeyframeSchema=KeyframeReviewScopeSchema.extend({candidateId:z77.uuid(),reviewId:z77.uuid(),expectedSelectionVersion:z77.int().nonnegative(),action:z77.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z77.boolean().default(false),reason:z77.string().trim().min(1).max(2e3),idempotencyKey:z77.string().trim().min(1).max(200)});var KeyframeReferenceScopeSchema=z77.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema});var RevokeKeyframeSchema=KeyframeReferenceScopeSchema.extend({acceptanceId:z77.uuid(),expectedSelectionVersion:z77.int().positive(),reason:z77.string().trim().min(1).max(2e3),idempotencyKey:z77.string().trim().min(1).max(200)});var KeyframeDecisionRecordSchema=z77.strictObject({id:z77.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,selectionVersion:z77.int().positive(),generationId:z77.uuid(),candidateId:z77.uuid(),reviewId:z77.uuid(),action:z77.enum(["ACCEPT","REJECT","REVOKE"]),reference:AcceptedKeyframeReferenceSchema.nullable(),previousAcceptanceId:z77.uuid().nullable(),warningKeys:z77.array(z77.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z77.boolean(),reason:z77.string().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z77.iso.datetime({offset:true})});var KeyframeReviewTargetSchema=KeyframeReviewScopeSchema.extend({projectId:ProjectIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,preparationId:z77.uuid(),contractId:z77.uuid(),contractFingerprint:Fingerprint5,executionClass:z77.enum(["LIVE","TEST_ONLY"]),freshness:z77.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z77.boolean(),productionRunnable:z77.boolean(),candidate:KeyframeCandidateSchema,requirements:z77.array(VisualRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:KeyframeReviewRecordSchema.nullable(),reviewVersion:z77.int().nonnegative(),selectionVersion:z77.int().nonnegative(),activeAcceptanceId:z77.uuid().nullable()});var KeyframeReferenceViewSchema=KeyframeReferenceScopeSchema.extend({selectionVersion:z77.int().nonnegative(),status:z77.enum(["NONE","CURRENT","STALE"]),acceptance:KeyframeDecisionRecordSchema.nullable(),reference:AcceptedKeyframeReferenceSchema.nullable()});var KeyframeReviewQuerySchema=KeyframeReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeReviewPageSchema=z77.strictObject({items:z77.array(KeyframeReviewRecordSchema),page:QueryPageInfoSchema});var KeyframeReviewReceiptSchema=z77.strictObject({semanticStatus:z77.literal("SUCCESS"),review:KeyframeReviewRecordSchema,productionRevision:z77.int().positive()});var KeyframeDecisionReceiptSchema=z77.strictObject({semanticStatus:z77.literal("SUCCESS"),decision:KeyframeDecisionRecordSchema,productionRevision:z77.int().positive()});var KeyframeDecisionQuerySchema=KeyframeReferenceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeDecisionPageSchema=z77.strictObject({items:z77.array(KeyframeDecisionRecordSchema),page:QueryPageInfoSchema});var KeyframeReviewSummarySchema=z77.strictObject({reviewedCandidates:z77.int().nonnegative(),unreviewedCandidates:z77.int().nonnegative(),decisionCount:z77.int().nonnegative()});import{z as z78}from"zod";var sha13=z78.string().regex(/^[0-9a-f]{64}$/);var evidenceIds=z78.array(ReviewEvidenceKeySchema).max(16);var ReviewIntelligenceTargetSchema=z78.discriminatedUnion("kind",[z78.strictObject({kind:z78.literal("IMAGE"),generationId:z78.uuid()}),z78.strictObject({kind:z78.literal("VIDEO"),generationId:z78.uuid()}),z78.strictObject({kind:z78.literal("ROUGH_CUT"),renderId:z78.uuid()}),z78.strictObject({kind:z78.literal("PROGRAMMATIC"),renderId:z78.uuid()})]);var ReviewIntelligenceContextInputSchema=z78.strictObject({scope:DirectorScopeSchema,target:ReviewIntelligenceTargetSchema});var ReviewIntelligenceBasisSchema=ReviewIntelligenceContextInputSchema.extend({contextFingerprint:sha13});var ReviewIntelligenceOwnerTargetSchema=z78.discriminatedUnion("kind",[z78.strictObject({kind:z78.literal("IMAGE"),target:KeyframeReviewTargetSchema}),z78.strictObject({kind:z78.literal("VIDEO"),target:VideoReviewTargetSchema}),z78.strictObject({kind:z78.literal("ROUGH_CUT"),target:RoughCutReviewTargetSchema}),z78.strictObject({kind:z78.literal("PROGRAMMATIC"),target:ProgrammaticVideoReviewTargetSchema})]);var review=z78.discriminatedUnion("kind",[z78.strictObject({kind:z78.literal("IMAGE"),observations:z78.array(KeyframeObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z78.strictObject({kind:z78.literal("VIDEO"),observations:z78.array(VideoObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z78.strictObject({kind:z78.literal("PROGRAMMATIC"),observations:z78.array(VideoObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z78.strictObject({kind:z78.literal("ROUGH_CUT"),observations:z78.array(RoughCutObservationSchema.extend({evidenceIds})).min(1).max(300),inspection:RoughCutInspectionSchema})]);var ValidateReviewIntelligenceSchema=z78.strictObject({basis:ReviewIntelligenceBasisSchema,proposal:z78.strictObject({origin:z78.strictObject({kind:z78.literal("EXTERNAL_AGENT_HOST"),label:z78.string().trim().min(1).max(100)}),summary:z78.string().trim().min(1).max(2e3),evidence:z78.array(ReviewIntelligenceEvidenceSchema).max(256),review})}).refine(input=>new TextEncoder().encode(JSON.stringify(input)).byteLength<=1024*1024,"Review Intelligence input exceeds the 1 MiB JSON budget");var ReviewIntelligenceContextResultSchema=z78.strictObject({semanticStatus:z78.literal("SUCCESS"),advisory:z78.literal(true),basis:ReviewIntelligenceBasisSchema,productionGuidance:ProductionGuidanceSchema.optional(),ownerContext:DirectorContextResultSchema,reviewTarget:ReviewIntelligenceOwnerTargetSchema,limitations:z78.array(z78.enum(["NO_IMPLICIT_MEDIA_OR_MODEL_CALL","READS_ARE_NOT_ATOMIC_OR_RESERVED"])).length(2)});var ReviewIntelligenceRecordDraftSchema=z78.discriminatedUnion("kind",[z78.strictObject({kind:z78.literal("PROGRAMMATIC"),input:RecordProgrammaticVideoReviewSchema.omit({idempotencyKey:true})}),z78.strictObject({kind:z78.literal("IMAGE"),input:RecordKeyframeReviewSchema.omit({idempotencyKey:true})}),z78.strictObject({kind:z78.literal("VIDEO"),input:RecordVideoReviewSchema.omit({idempotencyKey:true})}),z78.strictObject({kind:z78.literal("ROUGH_CUT"),input:RecordRoughCutReviewSchema.omit({idempotencyKey:true})})]);var ReviewIntelligenceIssueSchema=z78.strictObject({requirement:z78.union([VisualRequirementSchema,VideoReviewRequirementSchema,RoughCutRequirementSchema]),observation:z78.union([KeyframeObservationSchema,VideoObservationSchema,RoughCutObservationSchema]),evidenceIds,blocking:z78.boolean(),severity:z78.enum(["BLOCKING","WARNING"]),affectedScope:z78.strictObject({kind:z78.enum(["PRODUCTION","SHOT","TRANSITION","TIMELINE_REGION"]),interval:ReviewIntervalSchema,shotIds:z78.array(z78.uuid()).min(1).max(200)}).optional()});var ReviewIntelligenceValidationResultSchema=z78.strictObject({semanticStatus:z78.literal("SUCCESS"),advisory:z78.literal(true),basis:ReviewIntelligenceBasisSchema,proposal:ValidateReviewIntelligenceSchema.shape.proposal,canonicalRulePreview:z78.strictObject({source:z78.literal("EXISTING_CANONICAL_DOMAIN_RULES"),authoritative:z78.literal(false),evaluatorVersion:z78.enum(["keyframe-reference-v1","shot-review-v1","production-review-v1"]),result:z78.enum(["PASS","WARNING","FAIL"]),blockingKeys:z78.array(z78.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z78.array(z78.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),issueProposals:z78.array(ReviewIntelligenceIssueSchema).max(MAX_SHOT_REVIEW_REQUIREMENTS),recordDraft:ReviewIntelligenceRecordDraftSchema,limitations:z78.array(z78.enum(["EVIDENCE_DECLARATIONS_ARE_NOT_ATTESTED_PIXEL_READS","RULE_PREVIEW_IS_NOT_A_CANONICAL_REVIEW","RECORD_RECHECKS_CURRENTNESS_CAS_AND_EXECUTION_CLASS","ACCEPTANCE_REMAINS_A_SEPARATE_OWNER_DECISION"])).length(4)});import{z as z79}from"zod";var maxMediaObjectBytes=128*1024*1024;var mediaObjectTransferPath="/v1/object-transfers";var mediaBrowserReadPath=mediaObjectTransferPath+"/browser-read";var MediaBrowserContentTypeSchema=z79.enum(["image/png","image/jpeg","image/webp","video/mp4","audio/wav","audio/mpeg","application/json","text/plain","application/x-subrip"]);var MediaObjectVersionSchema=LocalProjectScopeSchema.extend({versionId:LocalIdSchema,role:z79.enum(["SOURCE","VIDEO","POSTER","AUDIO","FRAME","SHEET","MANIFEST"]),byteSize:z79.int().min(1).max(maxMediaObjectBytes),checksumSha256:LocalDigestSchema});var MediaTransferGrantSchema=z79.strictObject({protocol:z79.literal("NVS_MEDIA_TRANSFER_V1"),storageId:z79.string().regex(/^[A-Za-z0-9_-]{1,100}$/),method:z79.enum(["GET","PUT","HEAD"]),object:MediaObjectVersionSchema,issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema});var MediaObjectTicketSchema=z79.strictObject({endpoint:z79.url().max(2048),credential:z79.string().regex(/^[A-Za-z0-9_-]{1,2048}\.[A-Za-z0-9_-]{43}$/).meta({writeOnly:true}),method:z79.enum(["GET","PUT"]),object:MediaObjectVersionSchema});var MediaBrowserReadGrantSchema=z79.strictObject({protocol:z79.literal("NVS_MEDIA_BROWSER_READ_V1"),storageId:z79.string().regex(/^[A-Za-z0-9_-]{1,100}$/),object:MediaObjectVersionSchema,contentType:MediaBrowserContentTypeSchema,representationId:LocalIdSchema,attachment:z79.boolean(),issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema});var MediaBrowserReadTicketSchema=z79.strictObject({url:z79.url().max(4096).refine(value2=>{const url=new URL(value2);return(url.protocol==="https:"||url.protocol==="http:"&&url.hostname==="127.0.0.1")&&!url.username&&!url.password&&!url.hash&&url.pathname===mediaBrowserReadPath&&url.searchParams.size===1&&/^[A-Za-z0-9_-]{1,3072}\.[A-Za-z0-9_-]{43}$/.test(url.searchParams.get("ticket")??"")}),expiresAt:LocalTimeSchema,object:MediaObjectVersionSchema,contentType:MediaBrowserContentTypeSchema});import{z as z80}from"zod";var ArtifactLifecycleSchema=z80.enum(["CREATING","PROCESSING","READY","INVALID","ARCHIVED"]);var ArtifactMetadataSchema=z80.object({id:ArtifactIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),family:z80.string().trim().min(1),origin:z80.string().trim().min(1),lifecycle:ArtifactLifecycleSchema,createdByPrincipalId:PrincipalIdSchema,checksumSha256:z80.string().regex(/^[0-9a-f]{64}$/).nullable(),contentType:z80.string().trim().min(1).nullable(),primaryRepresentationId:ArtifactRepresentationIdSchema.nullable(),mediaMetadata:z80.record(z80.string(),z80.unknown()),createdAt:z80.iso.datetime({offset:true}),readyAt:z80.iso.datetime({offset:true}).nullable()});var ArtifactRepresentationSchema=z80.object({id:ArtifactRepresentationIdSchema,tenantId:TenantIdSchema,artifactId:ArtifactIdSchema,role:z80.string().trim().min(1),storageDriver:z80.string().trim().min(1),storageLocator:z80.record(z80.string(),z80.unknown()),checksumSha256:z80.string().regex(/^[0-9a-f]{64}$/),contentType:z80.string().trim().min(1),byteSize:z80.string().regex(/^\d+$/),width:z80.int().positive().nullable(),height:z80.int().positive().nullable(),durationMs:z80.string().regex(/^\d+$/).nullable(),frameRate:z80.string().nullable(),videoCodec:z80.string().nullable(),audioCodec:z80.string().nullable(),hasAudio:z80.boolean().nullable(),sampleRateHz:z80.int().positive().nullable(),audioChannels:z80.int().positive().nullable(),createdAt:z80.iso.datetime({offset:true})});var ArtifactRelationSchema=z80.object({id:ArtifactRelationIdSchema,tenantId:TenantIdSchema,sourceArtifactId:ArtifactIdSchema,targetArtifactId:ArtifactIdSchema,relationType:z80.string().trim().min(1),createdByPrincipalId:PrincipalIdSchema,createdAt:z80.iso.datetime({offset:true})});var RegisterReadyArtifactInputSchema=z80.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),principalId:PrincipalIdSchema,family:z80.string().trim().min(1),origin:z80.string().trim().min(1),representation:z80.object({role:z80.string().trim().min(1),storageDriver:z80.string().trim().min(1),storageLocator:z80.record(z80.string(),z80.unknown()),checksumSha256:z80.string().regex(/^[0-9a-f]{64}$/),contentType:z80.string().trim().min(1),byteSize:z80.string().regex(/^\d+$/),width:z80.int().positive().nullable(),height:z80.int().positive().nullable(),durationMs:z80.string().regex(/^\d+$/).nullable(),frameRate:z80.string().nullable(),videoCodec:z80.string().nullable(),audioCodec:z80.string().nullable(),hasAudio:z80.boolean().nullable(),sampleRateHz:z80.int().positive().nullable(),audioChannels:z80.int().positive().nullable()}),mediaMetadata:z80.record(z80.string(),z80.unknown()).default({}),provenance:z80.array(z80.object({targetArtifactId:ArtifactIdSchema,relationType:z80.string().trim().min(1)})).default([])});var ReadyArtifactRegistrationSchema=z80.object({artifact:ArtifactMetadataSchema,primaryRepresentation:ArtifactRepresentationSchema,relations:z80.array(ArtifactRelationSchema)});var SourceInputMetadataSchema=z80.strictObject({idempotencyKey:z80.string().trim().min(1).max(200).optional(),tenantId:TenantIdSchema,kind:z80.enum(["PRODUCT_INFORMATION","REFERENCE_IMAGE","REFERENCE_VIDEO"]),contentType:z80.enum(["text/plain","application/json","image/png","image/jpeg","image/webp","video/mp4"]),originalName:z80.string().trim().min(1).max(255).optional()});var UploadSourceInputRequestSchema=SourceInputMetadataSchema.extend({contentBase64:z80.string().min(4).max(11184812).regex(/^[A-Za-z0-9+/]*={0,2}$/)});import{z as z81}from"zod";var sha14=z81.string().regex(/^[0-9a-f]{64}$/);var TemporalEvidenceSourceSchema=z81.strictObject({tenantId:z81.uuid(),projectId:z81.uuid(),productionId:z81.uuid(),artifactId:z81.uuid(),representationId:z81.uuid(),checksumSha256:sha14,byteSize:z81.int().positive().max(128*1024*1024),width:z81.int().min(16).max(4096),height:z81.int().min(16).max(4096),durationMs:z81.int().positive().max(6e4),frameRate:z81.number().min(1).max(60),frameCount:z81.int().positive().max(3600),videoCodec:z81.literal("h264"),executionClass:z81.enum(["LIVE","TEST_ONLY"])}).refine(v=>Math.abs(v.frameCount/v.frameRate*1e3-v.durationMs)<=150,"Exact frame count, duration and rate must agree");var TemporalRiskWindowSchema=z81.strictObject({startMs:z81.int().nonnegative().max(6e4),endMs:z81.int().positive().max(6e4),reason:z81.enum(["TEMPORAL_BEAT","PRIOR_FINDING","SUSPICIOUS_DRIFT","SCENE_CHANGE"])}).refine(v=>v.endMs>v.startMs,"Risk window must advance");var TemporalSamplingProfileSchema=z81.strictObject({id:z81.literal("ADAPTIVE_TEMPORAL_V1"),motion:z81.enum(["NORMAL","HIGH"]),lockedIdentity:z81.boolean(),windows:z81.array(TemporalRiskWindowSchema).max(32)});var TemporalSampleSchema=z81.strictObject({ordinal:z81.int().nonnegative().max(63),frameIndex:z81.int().nonnegative().max(3599),timestampMs:z81.number().nonnegative().max(6e4),reasons:z81.array(z81.enum(["START","END","INTERIOR","HIGH_MOTION","LOCKED_IDENTITY","TEMPORAL_BEAT","PRIOR_FINDING","SUSPICIOUS_DRIFT","SCENE_CHANGE"])).min(1).max(9)});var TemporalSamplingPlanSchema=z81.strictObject({schemaVersion:z81.literal(1),source:TemporalEvidenceSourceSchema,profile:TemporalSamplingProfileSchema,samples:z81.array(TemporalSampleSchema).min(1).max(64),frameWidth:z81.int().min(16).max(320),frameHeight:z81.int().min(16).max(320),columns:z81.int().min(1).max(4),rows:z81.int().min(1).max(16),gutterPx:z81.literal(8)}).superRefine((p,ctx)=>{const s=p.samples;if(s[0]?.frameIndex!==0||s.at(-1)?.frameIndex!==p.source.frameCount-1||p.rows!==Math.ceil(s.length/p.columns)||p.columns!==Math.min(4,s.length)||s.some((v,i)=>v.ordinal!==i||v.frameIndex>=p.source.frameCount||Math.abs(v.timestampMs-v.frameIndex*1e3/p.source.frameRate)>.001||i>0&&v.frameIndex<=s[i-1].frameIndex||new Set(v.reasons).size!==v.reasons.length)||p.profile.windows.some(w=>w.endMs>p.source.durationMs))ctx.addIssue({code:"custom",message:"Temporal samples must preserve exact bounded source order, time and layout"})});var ExtractedTemporalFrameSchema=z81.strictObject({sample:TemporalSampleSchema,checksumSha256:sha14,byteSize:z81.int().positive().max(2*1024*1024),width:z81.int().positive().max(320),height:z81.int().positive().max(320),contentType:z81.literal("image/png")});var TemporalEvidenceManifestSchema=z81.strictObject({schemaVersion:z81.literal(1),plan:TemporalSamplingPlanSchema,engineVersion:z81.string().min(1).max(200),frames:z81.array(ExtractedTemporalFrameSchema).min(1).max(64),sheet:z81.strictObject({checksumSha256:sha14,byteSize:z81.int().positive().max(16*1024*1024),width:z81.int().positive().max(1320),height:z81.int().positive().max(5256),contentType:z81.literal("image/png")})}).superRefine((m,ctx)=>{const p=m.plan;if(m.frames.length!==p.samples.length||m.frames.some((f,i)=>JSON.stringify(f.sample)!==JSON.stringify(p.samples[i])||f.width!==p.frameWidth||f.height!==p.frameHeight)||m.sheet.width!==p.columns*p.frameWidth+(p.columns+1)*p.gutterPx||m.sheet.height!==p.rows*p.frameHeight+(p.rows+1)*p.gutterPx)ctx.addIssue({code:"custom",message:"Evidence frames and sheet must match the exact sampling plan"})});import{z as z82}from"zod";var sha15=z82.string().regex(/^[0-9a-f]{64}$/);var name=z82.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/);var CompositionPathSchema=z82.string().max(240).regex(/^[A-Za-z0-9_-][A-Za-z0-9_.-]*(?:\/[A-Za-z0-9_.-]+)*$/).refine(v=>!v.split("/").some(p=>p==="."||p===".."));var CompositionScopeSchema=z82.strictObject({tenantId:z82.uuid(),productionId:z82.uuid()});var CompositionBasisPinSchema=z82.strictObject({briefVersionId:z82.uuid(),storyVersionId:z82.uuid(),planVersionId:z82.uuid(),shotId:z82.uuid().nullable()});var CompositionBindingSchema=z82.strictObject({name,purpose:z82.enum(["SOURCE","DEPENDENCY_MANIFEST","DEPENDENCY_LOCK","DATA","FONT","IMAGE","VIDEO"]),artifactId:z82.uuid(),representationId:z82.uuid(),checksumSha256:sha15,declaredOrigin:z82.enum(["CODE","AI","HUMAN","IMPORTED","UNKNOWN"])});var parameter=z82.discriminatedUnion("type",[z82.strictObject({name,type:z82.literal("STRING"),value:z82.string().max(4e3),maxLength:z82.int().min(0).max(4e3)}).refine(v=>v.value.length<=v.maxLength),z82.strictObject({name,type:z82.literal("NUMBER"),value:z82.number().finite(),minimum:z82.number().finite(),maximum:z82.number().finite()}).refine(v=>v.minimum<=v.value&&v.value<=v.maximum),z82.strictObject({name,type:z82.literal("BOOLEAN"),value:z82.boolean()})]);var CompositionContentSchema=z82.strictObject({schemaVersion:z82.literal(1),provider:z82.literal("HYPERFRAME"),dialect:z82.literal("HYPERFRAME_HTML_GSAP_V1"),role:z82.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),executionClass:z82.enum(["LIVE","TEST_ONLY"]),intent:z82.string().trim().min(1).max(2e3),viewport:z82.strictObject({width:z82.int().min(1).max(8192),height:z82.int().min(1).max(8192)}),clock:z82.strictObject({numerator:z82.int().positive(),denominator:z82.int().positive(),frameCount:z82.int().positive().max(2147483647)}),entrypoint:CompositionPathSchema,parameterSchemaVersion:z82.literal(1),parameters:z82.array(parameter).max(64),bindings:z82.array(CompositionBindingSchema).min(3).max(64),dependencies:z82.array(z82.strictObject({name:z82.string().regex(/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/),version:z82.string().regex(/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/),integrity:z82.string().regex(/^sha(?:256|384|512)-[A-Za-z0-9+/]+={0,2}$/)})).min(1).max(64),randomSeed:z82.int().nonnegative().max(4294967295).nullable()}).superRefine((c,ctx)=>{for(const list of[c.parameters,c.bindings,c.dependencies])if(new Set(list.map(x=>x.name)).size!==list.length)ctx.addIssue({code:"custom",message:"Names must be unique within each input group"});for(const purpose of["SOURCE","DEPENDENCY_MANIFEST","DEPENDENCY_LOCK"])if(c.bindings.filter(x=>x.purpose===purpose).length!==1)ctx.addIssue({code:"custom",path:["bindings"],message:"Exactly one "+purpose+" binding is required"});if(c.bindings.find(x=>x.purpose==="SOURCE")?.declaredOrigin!=="CODE")ctx.addIssue({code:"custom",path:["bindings"],message:"Programmatic source must retain CODE provenance"});for(const p of["@hyperframes/engine","@hyperframes/producer","gsap"])if(!c.dependencies.some(x=>x.name===p))ctx.addIssue({code:"custom",path:["dependencies"],message:"Missing authoring dependency: "+p})});var CompositionSourceBundleSchema=z82.strictObject({schemaVersion:z82.literal(1),entrypoint:CompositionPathSchema,files:z82.array(z82.strictObject({path:CompositionPathSchema,contentType:z82.enum(["text/html","text/css","text/javascript","image/svg+xml","application/json"]),content:z82.string().max(1048576)})).min(1).max(128)}).superRefine((b,ctx)=>{if(new Set(b.files.map(x=>x.path)).size!==b.files.length)ctx.addIssue({code:"custom",message:"Source paths must be unique"});if(!b.files.some(x=>x.path===b.entrypoint&&x.contentType==="text/html"))ctx.addIssue({code:"custom",message:"Entrypoint must resolve to a declared HTML file"})});var SubmitCompositionSchema=CompositionScopeSchema.extend({compositionId:z82.uuid().nullable(),expectedVersion:z82.int().nonnegative(),previousVersionId:z82.uuid().nullable(),expectedProductionRevision:z82.int().positive(),basis:CompositionBasisPinSchema,content:CompositionContentSchema,idempotencyKey:z82.string().trim().min(1).max(200)}).superRefine((i,ctx)=>{if(i.expectedVersion===0!==(i.compositionId===null&&i.previousVersionId===null)||i.expectedVersion>0&&(!i.compositionId||!i.previousVersionId))ctx.addIssue({code:"custom",message:"Create and exact-version revision identities must not be mixed"});if(i.content.role==="PRIMARY_VISUAL"&&!i.basis.shotId)ctx.addIssue({code:"custom",message:"Primary visual must bind a planned Shot"})});var CompositionGetSchema=CompositionScopeSchema.extend({compositionId:z82.uuid(),versionId:z82.uuid().optional()});var CompositionHistorySchema=CompositionScopeSchema.extend({compositionId:z82.uuid(),limit:z82.int().min(1).max(100).default(20),beforeVersion:z82.int().positive().optional()});var CompositionInputFactSchema=CompositionBindingSchema.extend({contentType:z82.string().min(1),byteSize:z82.int().positive().max(67108864),registeredOrigin:z82.string().min(1),executionClass:z82.enum(["LIVE","TEST_ONLY"]).nullable()});var CompositionVersionSchema=CompositionScopeSchema.extend({id:z82.uuid(),compositionId:z82.uuid(),projectId:z82.uuid(),version:z82.int().positive(),previousVersionId:z82.uuid().nullable(),basis:CompositionBasisPinSchema,content:CompositionContentSchema,inputs:z82.array(CompositionInputFactSchema).min(3).max(64),fingerprint:sha15,createdByPrincipalId:z82.uuid(),createdAt:z82.iso.datetime({offset:true})}).refine(v=>v.version===1===(v.previousVersionId===null));var CompositionReceiptSchema=z82.strictObject({semanticStatus:z82.literal("SUCCESS"),version:CompositionVersionSchema,productionRevision:z82.int().positive()});var CompositionViewSchema=z82.strictObject({version:CompositionVersionSchema,isCurrent:z82.boolean(),basisStatus:z82.enum(["CURRENT","STALE"]),inputStatus:z82.enum(["AVAILABLE","UNAVAILABLE"]),byteReadback:z82.literal("NOT_CHECKED")});var CompositionPageSchema=z82.strictObject({items:z82.array(CompositionViewSchema).max(100),hasMore:z82.boolean(),nextBeforeVersion:z82.int().positive().nullable()});var CompositionDependencyManifestSchema=z82.object({dependencies:z82.record(z82.string(),z82.string())});var CompositionDependencyLockSchema=z82.object({lockfileVersion:z82.literal(3),packages:z82.record(z82.string(),z82.object({version:z82.string().optional(),integrity:z82.string().optional(),dependencies:z82.record(z82.string(),z82.string()).optional()}))});import{z as z83}from"zod";var HyperframeLegacyRenderProfileSchema=z83.strictObject({id:z83.literal("HYPERFRAME_1080P30_FULL_PAINT_V1"),adapter:z83.literal("native-hyperframe-v1"),engine:z83.literal("0.8.134"),producer:z83.literal("0.8.134"),gsap:z83.literal("3.15.0"),node:z83.string().min(1).max(80),browser:z83.string().min(1).max(160),browserSha256:z83.string().regex(/^[0-9a-f]{64}$/),ffmpeg:z83.string().min(1).max(240),maxFrames:z83.literal(360),timeoutMs:z83.literal(6e5),maxRssBytes:z83.literal(3221225472),maxScratchBytes:z83.literal(3221225472),maxOutputBytes:z83.literal(134217728),maxCpuMs:z83.literal(6e5),capture:z83.literal("PNG_SOFTWARE_SCREENSHOT_FULL_PAINT"),encode:z83.literal("H264_YUV420P_CRF18_THREADS2_NO_AUDIO")});var HyperframeCachedRenderProfileSchema=HyperframeLegacyRenderProfileSchema.extend({id:z83.literal("HYPERFRAME_1080P30_FRAME_CACHE_V2"),adapter:z83.literal("native-hyperframe-cache-v2"),encode:z83.literal("H264_YUV420P_CRF18_VERYFAST_THREADS2_NO_AUDIO")});var HyperframeRenderProfileSchema=z83.discriminatedUnion("id",[HyperframeLegacyRenderProfileSchema,HyperframeCachedRenderProfileSchema]);var CompositionRenderStartSchema=CompositionGetSchema.extend({versionId:z83.uuid(),fingerprint:z83.string().regex(/^[0-9a-f]{64}$/),expectedProductionRevision:z83.int().positive(),profileId:z83.enum(["HYPERFRAME_1080P30_FULL_PAINT_V1","HYPERFRAME_1080P30_FRAME_CACHE_V2","HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"]),idempotencyKey:z83.string().trim().min(1).max(200),deviceId:z83.uuid().toLowerCase().optional()});var CompositionRenderGetSchema=CompositionScopeSchema.extend({renderId:z83.uuid()});var CompositionRenderManifestSchema=z83.strictObject({schemaVersion:z83.literal(1),version:CompositionVersionSchema,profile:HyperframeRenderProfileSchema,firstFrame:z83.literal(0),frameCount:z83.int().min(1).max(360)}).superRefine((m,ctx)=>{if(m.frameCount!==m.version.content.clock.frameCount||m.version.inputs.reduce((n,i)=>n+i.byteSize,0)>134217728)ctx.addIssue({code:"custom",message:"Exact frame count and aggregate input budget required"})});var CompositionRenderReceiptSchema=z83.strictObject({semanticStatus:z83.literal("ACCEPTED"),renderId:z83.uuid(),runtimeJobId:z83.uuid(),compositionVersionId:z83.uuid(),manifestFingerprint:z83.string().regex(/^[0-9a-f]{64}$/),productionRevision:z83.int().positive()});var CompositionRenderTechnicalSchema=z83.strictObject({width:z83.literal(1920),height:z83.literal(1080),frameRate:z83.literal(30),frameCount:z83.int().min(1).max(360),durationMs:z83.number().positive(),contentType:z83.literal("video/mp4"),videoCodec:z83.literal("h264"),pixelFormat:z83.literal("yuv420p"),hasAudio:z83.literal(false),fullDecode:z83.literal(true),checksumSha256:z83.string().regex(/^[0-9a-f]{64}$/),byteSize:z83.int().min(1).max(134217728),decodedFramesSha256:z83.string().regex(/^[0-9a-f]{64}$/)});var CompositionRenderResourcesSchema=z83.strictObject({sampleIntervalMs:z83.literal(100),sampledTreePeakRssBytes:z83.int().nonnegative(),sampledTreeCpuMs:z83.number().nonnegative(),observedPids:z83.int().nonnegative(),scratchPeakBytes:z83.int().nonnegative(),wallMs:z83.number().nonnegative(),processGroupCleaned:z83.literal(true)});import{z as z84}from"zod";var HyperframeAlphaRenderProfileSchema=HyperframeLegacyRenderProfileSchema.extend({id:z84.literal("HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"),adapter:z84.literal("native-hyperframe-alpha-v1"),encode:z84.literal("RGBA_PNG_SEQUENCE_30_V1"),maxOutputBytes:z84.literal(67108864),maxDecodedBytes:z84.literal(536870912)});var CompositionFrameRenderManifestSchema=z84.strictObject({...CompositionRenderManifestSchema.shape,schemaVersion:z84.literal(2),profile:HyperframeAlphaRenderProfileSchema}).superRefine((m,context)=>{const c=m.version.content;if(m.frameCount!==c.clock.frameCount||m.version.inputs.reduce((n,i)=>n+i.byteSize,0)>134217728||c.role!=="VISUAL_LAYER"||c.viewport.width>1920||c.viewport.height>1920||c.viewport.width*c.viewport.height>1920*1080||c.viewport.width*c.viewport.height*m.frameCount*4>m.profile.maxDecodedBytes||c.clock.numerator!==30||c.clock.denominator!==1)context.addIssue({code:"custom",message:"Qualified CODE alpha geometry/role/clock/decoded budget mismatch"})});var CompositionFrameTechnicalSchema=z84.strictObject({profileId:z84.literal("RGBA_PNG_SEQUENCE_30_V1"),width:z84.int().min(1).max(1920),height:z84.int().min(1).max(1920),frameRate:z84.literal(30),frameCount:z84.int().min(1).max(360),alpha:z84.literal("STRAIGHT_RGBA"),fullDecode:z84.literal(true),frames:z84.array(z84.strictObject({ordinal:z84.int().min(0).max(359),checksumSha256:z84.string().regex(/^[0-9a-f]{64}$/),byteSize:z84.int().min(1).max(16777216)})).min(1).max(360)}).superRefine((value2,context)=>{if(value2.frames.length!==value2.frameCount||value2.frames.some((f,i)=>f.ordinal!==i)||value2.width*value2.height>1920*1080||value2.width*value2.height*value2.frameCount*4>536870912||value2.frames.reduce((n,f)=>n+f.byteSize,0)>67108864)context.addIssue({code:"custom",message:"CODE frame order/geometry/byte budget mismatch"})});var CompositionFrameRenderOutputSchema=z84.strictObject({sequence:VisualFrameSequenceSchema,technical:CompositionFrameTechnicalSchema,resources:CompositionRenderResourcesSchema}).superRefine((output,context)=>{if(output.sequence.width!==output.technical.width||output.sequence.height!==output.technical.height||output.sequence.frameCount!==output.technical.frameCount||output.sequence.frames.some((frame,i)=>frame.ordinal!==output.technical.frames[i]?.ordinal||frame.checksumSha256!==output.technical.frames[i]?.checksumSha256||frame.byteSize!==output.technical.frames[i]?.byteSize))context.addIssue({code:"custom",message:"CODE frame output must identify the exact native sequence"})});import{z as z85}from"zod";var CompositionRenderManifestReaderSchema=z85.discriminatedUnion("schemaVersion",[CompositionRenderManifestSchema,CompositionFrameRenderManifestSchema]);var CompositionRenderViewSchema=z85.strictObject({sourceIdentity:z85.strictObject({tenantId:z85.uuid(),projectId:z85.uuid(),productionId:z85.uuid(),compositionId:z85.uuid(),versionId:z85.uuid(),fingerprint:z85.string().regex(/^[0-9a-f]{64}$/),shotId:z85.uuid().nullable(),role:z85.enum(["PRIMARY_VISUAL","VISUAL_LAYER"])}).optional(),frameOutput:CompositionFrameRenderOutputSchema.optional(),receipt:CompositionRenderReceiptSchema,lifecycle:z85.string().min(1).max(80),cancellationRequested:z85.boolean(),failureClassification:z85.string().min(1).max(80).nullable(),output:z85.strictObject({artifactId:z85.uuid(),representationId:z85.uuid(),technical:CompositionRenderTechnicalSchema,resources:CompositionRenderResourcesSchema}).nullable()}).superRefine((view,context)=>{if(view.sourceIdentity&&view.sourceIdentity.versionId!==view.receipt.compositionVersionId)context.addIssue({code:"custom",message:"Render source identity must bind the admitted exact version"});if(view.frameOutput&&view.output!==null)context.addIssue({code:"custom",message:"CODE frame output must match its render Production and exclude an MP4 output"})});var CompositionRenderCancellationSchema=z85.strictObject({cancellationRequested:z85.boolean()});import{z as z86}from"zod";var VisualSequenceScopeSchema=z86.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema});var RegisterVisualSequenceSchema=VisualSequenceScopeSchema.extend({deviceId:z86.uuid().toLowerCase().optional(),productionId:ProductionIdSchema.nullable(),idempotencyKey:z86.string().trim().min(1).max(200),width:z86.int().min(1).max(1920),height:z86.int().min(1).max(1920),frameArtifactIds:z86.array(ArtifactIdSchema).min(1).max(360)}).refine(v=>v.width*v.height<=1920*1080&&new Set(v.frameArtifactIds).size===v.frameArtifactIds.length,"Sequence requires bounded geometry and unique ordered frame Artifacts");var VisualSequenceGetSchema=VisualSequenceScopeSchema.extend({artifactId:ArtifactIdSchema});var LegacyVisualSequenceRegistrationSchema=z86.strictObject(RegisterVisualSequenceSchema.shape).omit({deviceId:true}).refine(input=>RegisterVisualSequenceSchema.safeParse(input).success);var VisualSequenceRegistrationAdmissionSchema=z86.strictObject({semanticStatus:z86.literal("ACCEPTED"),requestId:z86.uuid(),runtimeJobId:z86.uuid(),runtimeProductionId:ProductionIdSchema,operationId:OperationIdSchema,artifactId:ArtifactIdSchema,representationId:z86.uuid()});var VisualSequenceViewSchema=z86.strictObject({sequence:VisualFrameSequenceSchema,freshness:z86.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z86.array(z86.enum(["SEQUENCE_UNAVAILABLE","FRAME_UNAVAILABLE"])).max(2),createdAt:z86.iso.datetime({offset:true})});var VisualSequenceQuerySchema=VisualSequenceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VisualSequencePageSchema=z86.strictObject({items:z86.array(VisualSequenceViewSchema).max(100),page:QueryPageInfoSchema});var{checksumSha256:_checksum,...manifestShape}=VisualFrameSequenceSchema.shape;var VisualSequenceManifestSchema=z86.strictObject(manifestShape).superRefine((value2,context)=>{if(!VisualFrameSequenceSchema.safeParse({...value2,checksumSha256:"0".repeat(64)}).success)context.addIssue({code:"custom",message:"Invalid canonical frame sequence manifest"})});export{LocalIdSchema,LocalDigestSchema,LocalRevisionSchema,LocalTimeSchema,LocalPackageVersionSchema,LocalProjectScopeSchema,LocalWorkScopeSchema,LocalPlacementPolicySchema,AgentHostScopeSchema,AgentHostSelectionSchema,ConfigureAgentHostSchema,RevokeAgentHostSchema,AgentHostBindingSchema,UpdateAgentHostSelectionSchema,AgentHostCurrentSchema,AgentHostHistoryQuerySchema,AgentHostHistoryPageSchema,AgentHostReadinessSchema,NativeRuntimePublicKeySchema,ConfigureNativeToolGrantSchema,NativeToolGrantGetSchema,RevokeNativeToolGrantSchema,NativeRuntimeProofRequestSchema,NativeToolGrantViewSchema,ClipTransitionSchema,TimelineGraphicInputSchema,CaptionTranscriptPlanSchema,AuthorTranscriptCaptionsSchema,CaptionContentSchema,CaptionScopeSchema,AuthorCaptionsSchema,CaptionGetSchema,CaptionQuerySchema,CaptionViewSchema,CaptionReceiptSchema,CaptionBasisSchema,CaptionPageSchema,CaptionExportSchema,CaptionSnapshotSchema,CaptionTranscriptDraftSchema,LegacyCaptionRenderStyleSchema,RegularCaptionRenderStyleSchema,CaptionRenderStyleSchema,VoiceProfileRefSchema,VoiceLocaleSchema,VoiceProfileUseSchema,AudioReadScopeSchema,AudioImportRequestSchema,AudioGetSchema,AudioQuerySchema,AudioViewSchema,AudioReceiptSchema,AudioBasisSchema,AudioPageSchema,AudioSnapshotSchema,TimelineAudioInputSchema,ModelProfileIdSchema,ProviderSelectionSchema,ConfigureProviderInputSchema,ProviderConnectionViewSchema,ProviderConnectionCommandSchema,ProviderCredentialRevokeSchema,SetKeyframeDefaultSchema,GenerationCostQuoteSchema,PreparationIdSchema,GenerationContractIdSchema,ContentFingerprintSchema,PreparationTargetSchema,PreparationBasisSchema,ReferenceRoleSchema,ReferenceBindingInputSchema,ExactEvidenceReferenceSchema,ResolvedReferenceSchema,PreparationBlockerSchema,ConstraintSetSchema,ReferenceSetSchema,VideoProviderProfileSchema,VideoOptionsInputSchema,VideoStartInputSchema,VideoDeviceStartInputSchema,VideoGetInputSchema,VideoQueryInputSchema,VideoAdmissionSchema,VideoTechnicalMetadataSchema,VideoGenerationViewSchema,VideoQueryPageSchema,VideoSummarySchema,RoughCutProfileIdSchema,AcceptedVisualSourceReferenceSchema,ImportedSynchronousAudioExtractionSchema,ImportedSynchronousAudioSourceSchema,SourceSyncAudioStartSchema,SourceSyncAudioGetSchema,SourceSyncAudioVersionSchema,SourceSyncAudioReceiptSchema,SourceSyncAudioViewSchema,SpeechParametersSchema,kokoroCpuProfile,CpuSpeechToolSelectionSchema,CpuSpeechInputSchema,CpuSpeechIdentitySchema,CpuSpeechCapabilitySchema,CpuSpeechInstallationSchema,NativeSpeechExecutionSchema,MacSpeechIdentitySchema,SpeechSynthesisRecipeSchema,SpeechSynthesisEvidenceSchema,QwenSpeechRecipeSchema,QwenSpeechEvidenceSchema,SpeechScopeSchema,SpeechStartSchema,SpeechGetSchema,SpeechAdmissionSchema,SpeechGenerationViewSchema,LocalSpeechStartSchema,LocalSpeechAdmissionSchema,LocalSpeechGenerationViewSchema,SpeechOptionsSchema,KeyframeProviderProfileSchema,KeyframeStartInputSchema,KeyframeDeviceStartInputSchema,KeyframeGetInputSchema,KeyframeQueryInputSchema,KeyframeAdmissionSchema,KeyframeGenerationViewSchema,KeyframeQueryPageSchema,KeyframeMediaSchema,KeyframeSummarySchema,TranscriptSchema,ProviderTenantInputSchema,ProviderDefaultViewSchema,ProviderConnectionPageSchema,ProviderModelsViewSchema,SpeechCostQuoteSchema,SpeechDeviceStartSchema,ProviderModelViewSchema,ConfigureProviderModelSchema,DisableProviderModelSchema,ProviderModelPageSchema,ProviderModelGetSchema,SoundPlanScopeSchema,SoundPlanValidateSchema,SoundPlanAcceptSchema,SoundPlanGetSchema,SoundPlanValidationSchema,SoundPlanViewSchema,SoundPlanReceiptSchema,SoundPlanContextSchema,VisualFrameSequenceSchema,VisualLayerCompositionSchema,TimelineVisualLayerInputSchema,VisualLayerPolicySchema,processorFamilies,TenantProcessorKindSchema,DeviceRenderTargetSchema,DeviceRenderReceiptSchema,ProjectDeviceListInputSchema,ProjectDeviceListSchema,TimelineManifestReaderSchema,TimelineScopeSchema,BuildTimelineShapeSchema,BuildTimelineSchema,TimelineViewSchema,TimelineGetSchema,TimelineQuerySchema,TimelinePageSchema,TimelineBuildReceiptSchema,TimelineBasisSchema,TimelineSnapshotSchema,RoughCutStartSchema,RoughCutGetSchema,RoughCutQuerySchema,RoughCutManifestReaderSchema,RoughCutTechnicalSchema,RoughCutAdmissionSchema,RoughCutViewSchema,RoughCutPageSchema,RoughCutSnapshotSchema,DeliveryPolicySchema,DeliveryPolicyInputSchema,DeliveryTargetSchema,DeliveryCheckKeySchema,DeliveryPhysicalChecksSchema,DeliveryValidationReviewSchema,DeliveryApprovalSchema,DeliveryManifestLinkSchema,FinalDeliveryReceiptSchema,DecideFinalReadySchema,RevokeFinalReadySchema,FinalReadyViewSchema,FinalReadyQuerySchema,FinalReadyPageSchema,FinalReadyReceiptSchema,RoughCutReviewSnapshotSchema,FinalRenderStartSchema,FinalRenderGetSchema,FinalRenderQuerySchema,FinalRenderManifestReaderSchema,FinalRenderTechnicalSchema,FinalRenderAdmissionSchema,FinalRenderViewSchema,FinalRenderPageSchema,FinalRenderEligibilitySchema,FinalRenderSnapshotSchema,MediaCategorySchema,mediaCategoryOf,ListeningEvidenceSchema,CompositionFindingLocalitySchema,BriefContentSchema,AcceptBriefRequestSchema,AcceptBriefResultSchema,StoryContentSchema,AcceptStoryRequestSchema,StoryVersionSchema,AcceptStoryResultSchema,ConsistencyProfileScopeSchema,ConsistencyProfileVersionQuerySchema,ConfigureConsistencyProfileSchema,ConsistencyProfileVersionSchema,ConsistencyProfileViewSchema,ConsistencyProfileReceiptSchema,RoughCutReviewScopeSchema,RoughCutRequirementSchema,RecordRoughCutReviewSchema,RoughCutReviewRecordSchema,RoughCutReviewTargetSchema,RoughCutFindingViewSchema,RoughCutReviewQuerySchema,RoughCutReviewPageSchema,RoughCutFindingQuerySchema,RoughCutFindingPageSchema,RoughCutReviewReceiptSchema,ReviewEvidenceKeySchema,ReviewEvidenceMediaSchema,HYPERFRAME_CACHED_RENDER_PROFILE,whisperCppRecognitionProfile,LocalWhisperIdentitySchema,LocalWhisperToolSelectionSchema,MAX_SHOT_REVIEW_REQUIREMENTS,ObservationScopeSchema,ObservationStartSchema,ObservationGetSchema,ObservationSourceSchema,ObservationAdmissionSchema,ObservationViewSchema,ObservationOptionsSchema,LocalObservationStartSchema,LocalObservationAdmissionSchema,LocalObservationViewSchema,QwenAsrDeviceQuoteInputSchema,QwenAsrCostQuoteSchema,QwenAsrDeviceStartSchema,QwenAsrDeviceAdmissionSchema,QwenAsrDeviceViewSchema,ProductionGuidanceContextSchema,VideoReviewScopeSchema,VideoReviewRequirementSchema,VideoObservationSchema,RecordVideoReviewSchema,VideoReviewRecordSchema,DecideVideoShotSchema,ShotAcceptanceScopeSchema,RevokeShotAcceptanceSchema,GeneratedShotAcceptanceDecisionSchema,ProgrammaticShotAcceptanceDecisionSchema,VideoReviewTargetSchema,ShotAcceptanceViewSchema,VideoReviewQuerySchema,VideoReviewPageSchema,ShotDecisionQuerySchema,ShotDecisionPageSchema,VideoReviewReceiptSchema,ShotDecisionReceiptSchema,ProgrammaticVideoReviewScopeSchema,ProgrammaticVideoReviewTargetSchema,RecordProgrammaticVideoReviewSchema,DecideProgrammaticShotSchema,ProgrammaticVideoReviewQuerySchema,ProgrammaticVideoReviewPageSchema,ProgrammaticVideoReviewReceiptSchema,BoundaryRequirementSchema,ShotIntentSchema,AcceptSceneShotPlanRequestSchema,ShotPlanEntrySchema,SceneShotPlanVersionSchema,AcceptSceneShotPlanResultSchema,WriterScopeSchema,ValidateWriterProposalSchema,WriterBriefResultSchema,WriterValidationResultSchema,DirectorScopeSchema,DirectorBasisSchema,ValidateDirectorProposalSchema,DirectorContextResultSchema,DirectorValidationResultSchema,KeyframeReviewScopeSchema,VisualRequirementSchema,KeyframeObservationSchema,RecordKeyframeReviewSchema,DecideKeyframeSchema,KeyframeReferenceScopeSchema,RevokeKeyframeSchema,KeyframeReviewTargetSchema,KeyframeReferenceViewSchema,KeyframeReviewQuerySchema,KeyframeReviewPageSchema,KeyframeReviewReceiptSchema,KeyframeDecisionReceiptSchema,KeyframeDecisionQuerySchema,KeyframeDecisionPageSchema,KeyframeReviewSummarySchema,ReviewIntelligenceContextInputSchema,ReviewIntelligenceBasisSchema,ValidateReviewIntelligenceSchema,ReviewIntelligenceContextResultSchema,ReviewIntelligenceValidationResultSchema,mediaObjectTransferPath,MediaBrowserContentTypeSchema,MediaObjectVersionSchema,MediaObjectTicketSchema,MediaBrowserReadTicketSchema,ReadyArtifactRegistrationSchema,SourceInputMetadataSchema,UploadSourceInputRequestSchema,TemporalEvidenceSourceSchema,TemporalSamplingProfileSchema,TemporalSamplingPlanSchema,TemporalEvidenceManifestSchema,CompositionPathSchema,CompositionScopeSchema,CompositionBasisPinSchema,CompositionBindingSchema,CompositionContentSchema,SubmitCompositionSchema,CompositionGetSchema,CompositionHistorySchema,CompositionInputFactSchema,CompositionReceiptSchema,CompositionViewSchema,CompositionPageSchema,CompositionDependencyManifestSchema,CompositionDependencyLockSchema,CompositionRenderStartSchema,CompositionRenderGetSchema,CompositionRenderReceiptSchema,CompositionRenderTechnicalSchema,CompositionRenderResourcesSchema,CompositionFrameTechnicalSchema,CompositionRenderManifestReaderSchema,CompositionRenderViewSchema,CompositionRenderCancellationSchema,RegisterVisualSequenceSchema,VisualSequenceGetSchema,LegacyVisualSequenceRegistrationSchema,VisualSequenceRegistrationAdmissionSchema,VisualSequenceViewSchema,VisualSequenceQuerySchema,VisualSequencePageSchema,VisualSequenceManifestSchema};
|