@nativestudio/sdk 0.3.0-rc.2 → 0.3.0-rc.5

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.
Files changed (57) hide show
  1. package/COMPATIBILITY.json +4 -4
  2. package/README.md +20 -0
  3. package/dist/_chunks/chunk-GLD5WP6Z.js +1 -0
  4. package/dist/_chunks/chunk-NSS2BKVM.js +1 -0
  5. package/dist/_types/contracts/delivery-manifest.d.ts +63 -27
  6. package/dist/_types/contracts/delivery-operations.d.ts +21 -9
  7. package/dist/_types/contracts/device-render.d.ts +10 -0
  8. package/dist/_types/contracts/exploration-recommendation.d.ts +84 -36
  9. package/dist/_types/contracts/final-render.d.ts +9 -0
  10. package/dist/_types/contracts/index.d.ts +1 -0
  11. package/dist/_types/contracts/local-execution/agent-context.d.ts +365 -0
  12. package/dist/_types/contracts/local-execution/agent-evidence.d.ts +79 -0
  13. package/dist/_types/contracts/local-execution/agent-grant.d.ts +31 -0
  14. package/dist/_types/contracts/local-execution/agent-review.d.ts +733 -46
  15. package/dist/_types/contracts/local-execution/device.d.ts +10 -2
  16. package/dist/_types/contracts/local-execution/index.d.ts +6 -0
  17. package/dist/_types/contracts/local-execution/ipc.d.ts +1759 -37
  18. package/dist/_types/contracts/local-execution/lifecycle.d.ts +48 -6
  19. package/dist/_types/contracts/local-execution/local-navigation.d.ts +112 -10
  20. package/dist/_types/contracts/local-execution/management.d.ts +394 -0
  21. package/dist/_types/contracts/local-execution/media-recipe.d.ts +203 -0
  22. package/dist/_types/contracts/local-execution/offline.d.ts +59 -0
  23. package/dist/_types/contracts/local-execution/preview.d.ts +7607 -159
  24. package/dist/_types/contracts/local-execution/work.d.ts +7674 -294
  25. package/dist/_types/contracts/local-execution/workspace.d.ts +136 -0
  26. package/dist/_types/contracts/programmatic-exploration.d.ts +42 -18
  27. package/dist/_types/contracts/repair-strategy.d.ts +42 -18
  28. package/dist/_types/contracts/review-intelligence-final-output.d.ts +42 -18
  29. package/dist/_types/contracts/review-intelligence.d.ts +84 -36
  30. package/dist/_types/contracts/rough-cut-manifest.d.ts +7 -3
  31. package/dist/_types/contracts/rough-cut-profile.d.ts +12 -3
  32. package/dist/_types/contracts/rough-cut-review.d.ts +126 -54
  33. package/dist/_types/contracts/rough-cut.d.ts +85 -32
  34. package/dist/_types/contracts/visual-layer-render.d.ts +21 -9
  35. package/dist/_types/sdk/catalog/assembly.d.ts +146 -110
  36. package/dist/_types/sdk/catalog/delivery.d.ts +36 -36
  37. package/dist/_types/sdk/catalog/programmatic-exploration.d.ts +36 -36
  38. package/dist/_types/sdk/catalog/repair-strategy.d.ts +36 -36
  39. package/dist/_types/sdk/catalog/reviewer.d.ts +72 -72
  40. package/dist/_types/sdk/catalog/visual-exploration.d.ts +36 -36
  41. package/dist/_types/sdk/client.d.ts +2 -0
  42. package/dist/_types/sdk/device-renders.d.ts +138 -0
  43. package/dist/_types/sdk/index.d.ts +1 -0
  44. package/dist/_types/sdk/local-runtime/device-client.d.ts +138 -2
  45. package/dist/_types/sdk/local-runtime/workspace.d.ts +181 -0
  46. package/dist/_types/sdk/local-runtime-client.d.ts +1294 -56
  47. package/dist/_types/sdk/mcp-client.d.ts +2 -0
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.js +1 -1
  50. package/dist/local-runtime.js +1 -1
  51. package/dist/native/JobNative.cs +10 -0
  52. package/dist/native/JobRunner.cs +24 -3
  53. package/dist/native/NativeMain.cs +15 -0
  54. package/dist/runtime-authority.js +1 -1
  55. package/package.json +1 -1
  56. package/dist/_chunks/chunk-34KSWLCI.js +0 -1
  57. package/dist/_chunks/chunk-4IOFVNFG.js +0 -1
@@ -0,0 +1 @@
1
+ import{ArtifactIdSchema,ArtifactRepresentationIdSchema,BriefIdSchema,BriefVersionIdSchema,ContinuationSchema,ContinuityEdgeIdSchema,DeliveryOutputProfileSchema,OperationIdSchema,PrincipalIdSchema,ProductionIdSchema,ProjectIdSchema,QueryLimitSchema,QueryPageInfoSchema,SceneIdSchema,SceneShotPlanIdSchema,SceneShotPlanVersionIdSchema,ShotIdSchema,StoryIdSchema,StoryVersionIdSchema,TenantIdSchema,finalProfileIds}from"./chunk-4M3AGNTZ.js";import{z as z2}from"zod";import{z}from"zod";var Id=z.uuid().transform(value2=>value2.toLowerCase());var ReadId=z.uuid().regex(/^[0-9a-f-]{36}$/);var Key=z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);var Revision=z.int().min(0).max(999999999);var AgentHostScopeSchema=z.strictObject({tenantId:Id,projectId:Id});var ReadScope=z.strictObject({tenantId:ReadId,projectId:ReadId});var AgentHostSelectionSchema=z.strictObject({hostKey:Key,tenantKey:Key,workspaceKey:Key,projectKey:Key,agentKey:Key,agentVersion:z.int().positive().max(1e9),modelOptionKey:Key});var ConfigureAgentHostSchema=AgentHostScopeSchema.extend({requestId:Id,bindingId:Id,expectedRevision:z.int().min(0).max(999999998),selection:AgentHostSelectionSchema,apiCredential:z.string().regex(/^agxk_[A-Za-z0-9_-]{43}$/).meta({writeOnly:true})});var RevokeAgentHostSchema=AgentHostScopeSchema.extend({requestId:Id,bindingId:Id,expectedRevision:z.int().min(1).max(999999998)});var AgentHostBindingSchema=ReadScope.extend({bindingId:ReadId,revision:Revision.refine(value2=>value2>0),configurationVersion:Revision.refine(value2=>value2>0),enabled:z.boolean(),selection:AgentHostSelectionSchema,updatedAt:z.iso.datetime({offset:true})}).refine(value2=>value2.configurationVersion<=value2.revision);var UpdateAgentHostSelectionSchema=ConfigureAgentHostSchema.omit({apiCredential:true}).extend({expectedRevision:z.int().min(1).max(999999998),expectedConfigurationVersion:z.int().positive().max(999999998)});var AgentHostCurrentSchema=z.strictObject({binding:AgentHostBindingSchema.nullable()});var AgentHostHistoryQuerySchema=AgentHostScopeSchema.extend({limit:z.int().min(1).max(100).default(20),beforeVersion:z.int().positive().max(999999999).optional()});var AgentHostConfigurationVersionSchema=ReadScope.extend({bindingId:ReadId,version:z.int().positive().max(999999999),selection:AgentHostSelectionSchema,createdByPrincipalId:ReadId,createdAt:z.iso.datetime({offset:true}),revokedAt:z.iso.datetime({offset:true}).nullable()});var AgentHostHistoryPageSchema=z.strictObject({items:z.array(AgentHostConfigurationVersionSchema).max(100),hasMore:z.boolean(),nextBeforeVersion:z.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:z.array(Key).max(16),configurationStatus:z.enum(["NOT_CONFIGURED","REVOKED","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CONFIGURATION_CHANGED","CONFIGURED"]),remoteCredentialVerification:z.enum(["NOT_CHECKED","VERIFIED"]),nativeToolAuthority:z.enum(["NOT_CONNECTED","UNVERIFIED","VERIFIED"]),executionAvailability:z.enum(["UNAVAILABLE","AVAILABLE"]),reason:z.enum(["NATIVE_TOOL_AUTHORITY_NOT_CONNECTED","NATIVE_TOOL_AUTHORITY_NOT_QUALIFIED","CONFIGURATION_CHANGED"]).nullable(),checkedAt:z.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=z.strictObject({semanticStatus:z.enum(["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z.strictObject({code:z.enum(["INVALID_INPUT","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","REVISION_CONFLICT","REQUEST_CONFLICT","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CREDENTIAL_SCOPE_MISMATCH","BINDING_REVOKED","INTERNAL_OPERATIONAL_FAILURE"]),message:z.literal("Agent Host operation did not complete")})});var id=z2.uuid().regex(/^[0-9a-f-]{36}$/);var requestId=z2.uuid().transform(v=>v.toLowerCase());var key=z2.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var NativeRuntimePublicKeySchema=z2.strictObject({kty:z2.literal("EC"),crv:z2.literal("P-256"),x:z2.string().regex(/^[A-Za-z0-9_-]{43}$/),y:z2.string().regex(/^[A-Za-z0-9_-]{43}$/)});var ConfigureNativeToolGrantSchema=AgentHostScopeSchema.extend({requestId,bindingId:requestId,expectedBindingRevision:z2.int().positive(),expectedConfigurationVersion:z2.int().positive(),runtimeKey:key,installationId:key,installationRevisionId:key,publicKey:NativeRuntimePublicKeySchema,expiresAt:z2.iso.datetime({offset:true})});var NativeToolGrantGetSchema=AgentHostScopeSchema.extend({grantId:requestId});var RevokeNativeToolGrantSchema=NativeToolGrantGetSchema.extend({requestId,expectedRevision:z2.int().positive()});var NativeRuntimeProofRequestSchema=NativeToolGrantGetSchema.extend({assertion:z2.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).max(4096).meta({writeOnly:true})});var NativeRuntimeStatusClaimsSchema=z2.strictObject({iss:key,sub:key,aud:z2.url().max(2048),grantId:id,installationRevisionId:key,jti:id,iat:z2.int().nonnegative(),exp:z2.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeRuntimeProofClaimsSchema=z2.strictObject({iss:key,sub:key,aud:z2.url().max(2048),grantId:id,grantRevision:z2.int().positive(),installationRevisionId:key,challengeId:id,jti:id,iat:z2.int().nonnegative(),exp:z2.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeToolGrantViewSchema=z2.strictObject({tenantId:id,projectId:id}).extend({protocol:z2.literal("NATIVESTUDIO_RUNTIME_REGISTRATION_V1"),grantId:id,bindingId:id,bindingRevision:z2.int().positive(),configurationVersion:z2.int().positive(),selection:AgentHostSelectionSchema,runtimeKey:key,installationId:key,installationRevisionId:key,publicKey:NativeRuntimePublicKeySchema,resource:z2.url().max(2048),revision:z2.int().positive(),enabled:z2.boolean(),createdByPrincipalId:id,runtimePrincipalId:id,createdAt:z2.iso.datetime({offset:true}),expiresAt:z2.iso.datetime({offset:true}),challengeId:id,challengeExpiresAt:z2.iso.datetime({offset:true}),verifiedAt:z2.iso.datetime({offset:true}).nullable(),revokedAt:z2.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 z3}from"zod";var offset=z3.int().min(0).max(4094).multipleOf(2);var dimension=z3.int().min(2).max(4096).multipleOf(2);var ClipFramingSchema=z3.strictObject({algorithm:z3.literal("CROP_PAD_V1"),crop:z3.strictObject({x:offset,y:offset,width:dimension,height:dimension}),anchorXPermille:z3.int().min(0).max(1e3),anchorYPermille:z3.int().min(0).max(1e3)});var PicturePolicySchema=z3.literal("CROP_PAD_V1");import{z as z4}from"zod";var ClipTransitionSchema=z4.union([z4.literal("CUT"),z4.strictObject({kind:z4.literal("CROSS_DISSOLVE_V1"),durationFrames:z4.int().min(2).max(30)})]);import{z as z5}from"zod";var sha=z5.string().regex(/^[0-9a-f]{64}$/);var GraphicPlacementSchema=z5.strictObject({startFrame:z5.int().nonnegative().max(1800),endFrame:z5.int().positive().max(1800),anchor:z5.enum(["TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","BOTTOM_RIGHT"]),widthPermille:z5.int().min(50).max(400),marginXPermille:z5.int().min(0).max(100),marginYPermille:z5.int().min(0).max(100),opacityPermille:z5.int().min(100).max(1e3)}).refine(v=>v.endFrame>v.startFrame,"Graphic frame interval must advance");var TimelineGraphicInputSchema=z5.strictObject({artifactId:ArtifactIdSchema,placement:GraphicPlacementSchema});var TimelineGraphicSourceSchema=z5.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha,contentType:z5.enum(["image/png","image/webp"]),byteSize:z5.int().positive().max(16*1024*1024),width:z5.int().positive().max(8192),height:z5.int().positive().max(8192)});var TimelineGraphicSchema=z5.strictObject({source:TimelineGraphicSourceSchema,placement:GraphicPlacementSchema});import{z as z6}from"zod";var sha2=z6.string().regex(/^[0-9a-f]{64}$/);var AudioPurposeSchema=z6.enum(["VOICEOVER","MUSIC"]);var AudioProductionScopeSchema=z6.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var AudioScopeSchema=AudioProductionScopeSchema.extend({purpose:AudioPurposeSchema});var AudioMediaSchema=z6.strictObject({profile:z6.literal("PCM_S16LE_48000_V1"),audioCodec:z6.literal("pcm_s16le"),sampleRateHz:z6.literal(48e3),audioChannels:z6.union([z6.literal(1),z6.literal(2)]),sampleCount:z6.int().min(4800).max(288e4),durationMs:z6.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:z6.int().positive(),expectedAudioVersion:z6.int().nonnegative(),idempotencyKey:z6.string().trim().min(1).max(200),contentType:z6.literal("audio/wav"),originalName:z6.string().trim().min(1).max(255).regex(/^[^\p{Cc}]*$/u).optional()});var AudioImportRequestSchema=AudioImportSchema.extend({contentBase64:z6.string().min(60).max(16777216).regex(/^[A-Za-z0-9+/]*={0,2}$/)});var AudioGetSchema=AudioScopeSchema.extend({versionId:z6.uuid()});var AudioQuerySchema=AudioScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var AudioRepresentationSchema=z6.strictObject({id:z6.uuid(),checksumSha256:sha2,byteSize:z6.int().min(44).max(12582912)});var AudioVersionSchema=AudioScopeSchema.extend({id:z6.uuid(),audioId:z6.uuid(),projectId:z6.uuid(),version:z6.int().positive(),artifactId:z6.uuid(),original:AudioRepresentationSchema,media:AudioMediaSchema,originalName:z6.string().trim().min(1).max(255).regex(/^[^\p{Cc}]*$/u).nullable(),previousVersionId:z6.uuid().nullable(),createdByPrincipalId:z6.uuid(),createdAt:z6.iso.datetime({offset:true}),generation:z6.strictObject({generationId:z6.uuid(),executionClass:z6.enum(["LIVE","TEST_ONLY"]),sourceArtifactId:z6.uuid(),sourceRepresentationId:z6.uuid(),sourceChecksumSha256:sha2,sourceByteSize:z6.int().min(44).max(12582912),sourceMedia:z6.strictObject({sampleRateHz:z6.int().positive().max(48e3),audioChannels:z6.union([z6.literal(1),z6.literal(2)]),sampleCount:z6.int().positive()}),normalizationVersion:z6.literal("SPEECH_PCM_V1"),padSamples:z6.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=z6.strictObject({version:AudioVersionSchema,isCurrent:z6.boolean(),availability:z6.enum(["AVAILABLE","UNAVAILABLE"])});var AudioReceiptSchema=z6.strictObject({semanticStatus:z6.literal("SUCCESS"),version:AudioVersionSchema,productionRevision:z6.int().positive()});var AudioBasisSchema=AudioScopeSchema.extend({productionRevision:z6.int().positive(),currentVersion:z6.int().nonnegative(),currentVersionId:z6.uuid().nullable(),importable:z6.boolean()});var AudioPageSchema=z6.strictObject({items:z6.array(AudioViewSchema).max(200),page:QueryPageInfoSchema});var AudioSnapshotSchema=z6.strictObject({tracks:z6.array(z6.strictObject({purpose:AudioPurposeSchema,currentVersion:z6.int().positive().nullable(),currentVersionId:z6.uuid().nullable(),artifactId:z6.uuid().nullable(),availability:z6.enum(["NONE","AVAILABLE","UNAVAILABLE"]),durationMs:z6.int().min(100).max(6e4).nullable(),audioChannels:z6.union([z6.literal(1),z6.literal(2)]).nullable(),attachedToTimeline:z6.boolean()})).length(2)});import{z as z7}from"zod";var placement={sourceInMs:z7.int().nonnegative().max(6e4),sourceOutMs:z7.int().positive().max(6e4),startMs:z7.int().nonnegative().max(6e4),gainPermille:z7.int().nonnegative().max(1e3)};var TimelineAudioInputSchema=z7.strictObject({tracks:z7.array(z7.strictObject({purpose:AudioPurposeSchema,versionId:z7.uuid(),...placement})).min(1).max(2),duckingMusicPermille:z7.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=z7.strictObject({id:z7.literal("PCM_WINDOW_MIX_AAC_V1"),sampleRateHz:z7.literal(48e3),audioChannels:z7.literal(2),audioCodec:z7.literal("aac"),bitrate:z7.literal(192e3),peakPermille:z7.literal(950),duckingMusicPermille:z7.int().nonnegative().max(1e3)});var TimelineAudioCompositionSchema=z7.strictObject({mix:AudioMixProfileSchema,tracks:z7.array(z7.strictObject({source:AudioVersionSchema,...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=z7.strictObject({audioCodec:z7.literal("aac"),sampleRateHz:z7.literal(48e3),audioChannels:z7.literal(2),sampleCount:z7.int().positive().max(288e4)});import{z as z8}from"zod";var id2=z8.uuid().toLowerCase();var hash=z8.string().regex(/^[0-9a-f]{64}$/);var NativeVideoAudioMetadataSchema=z8.strictObject({normalizationVersion:z8.literal("VIDEO_AUDIO_PCM_V1"),sourceCodec:z8.literal("aac"),sourceSampleRateHz:z8.int().min(8e3).max(96e3),sourceChannels:z8.union([z8.literal(1),z8.literal(2)]),sourceFrameRateHz:z8.union([z8.literal(24),z8.literal(30)]),sourceFrameCount:z8.int().positive().max(905),sourceStartOffsetMs:z8.number().finite().min(-500).max(5e3),sourceDeclaredDurationMs:z8.number().positive().max(31e3),alignment:z8.literal("TRIM_PAD_PCM_TO_VIDEO_ZERO_V1"),media:z8.strictObject({profile:z8.literal("PCM_S16LE_48000_NATIVE_VIDEO_V1"),audioCodec:z8.literal("pcm_s16le"),sampleRateHz:z8.literal(48e3),audioChannels:z8.union([z8.literal(1),z8.literal(2)]),sampleCount:z8.int().positive().max(1448e3),durationMs:z8.number().positive().max(30200)}).refine(m=>m.durationMs===m.sampleCount/48),checksumSha256:hash}).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=z8.strictObject({id:id2,tenantId:id2,projectId:id2,productionId:id2,shotId:id2,generationId:id2,videoArtifactId:id2,videoRepresentationId:id2,videoChecksumSha256:hash,artifactId:id2,representationId:id2,checksumSha256:hash,byteSize:z8.int().min(44).max(12582912),metadata:NativeVideoAudioMetadataSchema,executionClass:z8.enum(["LIVE","TEST_ONLY"])});import{z as z9}from"zod";var SourceSoundTreatmentSchema=z9.strictObject({policy:z9.enum(["KEEP","MUTE","DUCK"]),gainPermille:z9.int().min(0).max(1e3),duckingPermille:z9.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 z10}from"zod";var ProviderIdSchema=z10.enum(["QWEN_CN","VOLCENGINE_CN","GEMINI","OPENAI","XAI"]);var ProviderConnectionIdSchema=z10.uuid().brand();var ModelProfileIdSchema=z10.string().regex(/^[a-z][a-z0-9-]{1,79}$/);var GeometryPolicySchema=z10.enum(["STRICT","PAD_TO_ASPECT"]);var ProviderSelectionSchema=z10.strictObject({connectionId:ProviderConnectionIdSchema,modelProfileId:ModelProfileIdSchema});var ProviderConfigurationSchema=z10.strictObject({providerId:ProviderIdSchema,label:z10.string().trim().min(1).max(100),allowedModelProfileIds:z10.array(ModelProfileIdSchema).min(1).max(16),qwenEndpoint:z10.literal("QIANWEN_PLATFORM").optional(),credentialService:z10.enum(["ARK","DOUBAO_SPEECH"]).optional(),qwenWorkspaceId:z10.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/).optional(),geometryPolicy:GeometryPolicySchema.default("STRICT")}).superRefine((v,c)=>{if(new Set(v.allowedModelProfileIds).size!==v.allowedModelProfileIds.length)c.addIssue({code:"custom",message:"Duplicate model profile"});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=z10.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,expectedVersion:z10.int().nonnegative(),configuration:ProviderConfigurationSchema,apiKey:z10.string().min(8).max(4096).regex(/^[!-~]+$/)});var ProviderConnectionViewSchema=z10.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,version:z10.int().positive(),enabled:z10.boolean(),credentialConfigured:z10.boolean(),configuration:ProviderConfigurationSchema,createdByPrincipalId:PrincipalIdSchema,updatedAt:z10.iso.datetime({offset:true})});var ProviderConnectionCommandSchema=z10.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,expectedVersion:z10.int().positive()});var ProviderCredentialRevokeSchema=z10.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,version:z10.int().positive()});var SetKeyframeDefaultSchema=z10.strictObject({tenantId:TenantIdSchema,selection:ProviderSelectionSchema,expectedRevision:z10.int().nonnegative()});var ProviderExecutionBindingSchema=z10.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,connectionVersion:z10.int().positive(),providerId:ProviderIdSchema,modelProfileId:ModelProfileIdSchema,modelProfileVersion:z10.int().positive(),modelId:z10.string().min(1).max(160),credentialRef:z10.uuid(),credentialVersion:z10.int().positive(),geometryPolicy:GeometryPolicySchema,qwenEndpoint:z10.literal("QIANWEN_PLATFORM").optional()}).refine(binding=>!binding.qwenEndpoint||binding.providerId==="QWEN_CN",{message:"Qianwen platform binding requires Qwen China"});import{z as z11}from"zod";var SpeechParameterValueSchema=z11.union([z11.string().max(4096),z11.number().finite(),z11.boolean(),z11.array(z11.string().max(4096)).max(100),z11.record(z11.string().min(1).max(100),z11.string().max(4096)).refine(v=>Object.keys(v).length<=100)]);var SpeechParameterRuleSchema=z11.strictObject({label:z11.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),type:z11.enum(["NUMBER","INTEGER","STRING","BOOLEAN","STRING_ARRAY","STRING_MAP"]),required:z11.boolean().default(false),min:z11.number().optional(),max:z11.number().optional(),maxLength:z11.int().positive().max(4096).optional(),options:z11.array(z11.string().min(1).max(100)).max(100).optional(),default:SpeechParameterValueSchema.optional(),unit:z11.string().max(40).optional(),description:z11.string().max(500).optional(),maxItems:z11.int().positive().max(100).optional(),maxKeyLength:z11.int().positive().max(100).optional()});var SpeechParametersSchema=z11.record(z11.string().regex(/^[a-z][a-z0-9_]{0,49}$/),SpeechParameterValueSchema).refine(p=>Object.keys(p).length<=24);var SpeechModelProfileSchema=z11.strictObject({id:ModelProfileIdSchema,version:z11.int().positive(),providerId:ProviderIdSchema,modelId:z11.string().min(1).max(160).nullable(),protocol:z11.enum(["QWEN_TTS","QWEN_AUDIO_TTS","OPENAI_TTS","XAI_TTS","GEMINI_INTERACTIONS_TTS","VOLCENGINE_TTS"]),label:z11.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),textMaxCharacters:z11.int().positive().max(6e3),requestTimeoutMs:z11.int().positive().max(3e5),workspaceRequired:z11.boolean(),voices:z11.array(z11.strictObject({id:z11.string().min(1).max(100),label:z11.string().min(1).max(100),languages:z11.array(z11.string().min(2).max(20)).min(1).max(32).optional(),parameterDefaults:SpeechParametersSchema.optional(),parameterOptions:z11.record(z11.string(),z11.array(z11.string().min(1).max(100)).min(1).max(100)).optional(),unsupportedParameters:z11.array(z11.string()).max(24).optional()})).min(1).max(100),languages:z11.array(z11.string().min(2).max(20)).min(1).max(32),parameters:z11.record(z11.string().regex(/^[a-z][a-z0-9_]{0,49}$/),SpeechParameterRuleSchema),sourceUrl:z11.url().max(2048),verifiedAt:z11.iso.date(),providerTextMaxCharacters:z11.int().positive().nullable(),resourceId:z11.string().min(1).max(100).nullable(),output:z11.literal("PCM_S16LE_48000_V1"),normalizationVersion:z11.literal("SPEECH_PCM_V1")});var SpeechScopeSchema=z11.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var SpeechExecutionBindingSchema=z11.strictObject({tenantId:TenantIdSchema,connectionId:z11.uuid(),connectionVersion:z11.int().positive(),credentialRef:z11.uuid(),credentialVersion:z11.int().positive(),profile:SpeechModelProfileSchema,executionClass:z11.enum(["LIVE","TEST_ONLY"])});var SpeechStartSchema=SpeechScopeSchema.extend({soundCue:z11.strictObject({soundPlanVersionId:z11.uuid(),cueId:z11.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)}).optional(),expectedProductionRevision:z11.int().positive(),expectedAudioVersion:z11.int().nonnegative(),expectedModelProfileVersion:z11.int().positive(),idempotencyKey:z11.string().trim().min(1).max(200),selection:ProviderSelectionSchema,text:z11.string().min(1).max(6e3).refine(s=>s.trim().length>0&&!s.includes("\0")),voice:z11.string().min(1).max(100),parameters:SpeechParametersSchema.default({})});var SpeechGetSchema=SpeechScopeSchema.extend({generationId:z11.uuid()});var SpeechAdmissionSchema=z11.strictObject({semanticStatus:z11.literal("ACCEPTED"),generationId:z11.uuid(),runtimeJobId:z11.uuid(),productionRevision:z11.int().positive(),executionClass:z11.enum(["LIVE","TEST_ONLY"])});var SpeechGenerationViewSchema=SpeechAdmissionSchema.omit({semanticStatus:true}).extend({tenantId:TenantIdSchema,productionId:ProductionIdSchema,soundCue:SpeechStartSchema.shape.soundCue,text:z11.string().min(1).max(6e3),voice:z11.string().min(1).max(100),parameters:SpeechParametersSchema,profile:SpeechModelProfileSchema,connectionId:z11.uuid(),connectionVersion:z11.int().positive(),runtimeStatus:z11.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z11.enum(["NOT_SUBMITTED","SUBMITTING","UNKNOWN","SUCCEEDED","REJECTED"]),cancellationRequested:z11.boolean(),result:AudioReceiptSchema.nullable(),createdAt:z11.iso.datetime({offset:true})});var SpeechOptionsSchema=SpeechScopeSchema.extend({options:z11.array(z11.strictObject({selection:ProviderSelectionSchema,profile:SpeechModelProfileSchema,connectionLabel:z11.string().min(1).max(100),connectionVersion:z11.int().positive()})).max(100),possiblyTruncated:z11.boolean()});import{z as z12}from"zod";var KeyframePurposeSchema=z12.enum(["START_FRAME","END_FRAME","SUBJECT_REFERENCE"]);var AcceptedKeyframeReferenceSchema=z12.strictObject({acceptanceId:z12.uuid(),reviewId:z12.uuid(),generationId:z12.uuid(),candidateId:z12.uuid(),shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:z12.string().regex(/^[0-9a-f]{64}$/),artifactChecksumSha256:z12.string().regex(/^[0-9a-f]{64}$/),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z12.int().positive(),shotPlanningRevision:z12.int().positive(),executionClass:z12.enum(["LIVE","TEST_ONLY"])});import{z as z13}from"zod";var ConsistencyReviewScaleSchema=z13.enum(["INTRA_SHOT","INTER_SHOT","PRODUCTION"]);var State=z13.string().trim().min(1).max(300);var StoryTime=z13.int().nonnegative().max(31536e8);var position=z13.int().min(1).max(999);var StateChange=z13.strictObject({atPermille:position,from:State,to:State,reason:State});var TimeJump=z13.strictObject({atPermille:position,fromMs:StoryTime,toMs:StoryTime,reason:State});var ContinuityExpectationSchema=z13.discriminatedUnion("kind",[z13.strictObject({kind:z13.literal("STATE"),mode:z13.enum(["PRESERVE","PLANNED_TRANSITIONS"]),entry:State,exit:State,changes:z13.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"})}),z13.strictObject({kind:z13.literal("TIME"),mode:z13.enum(["MONOTONIC","PLANNED_JUMPS"]),entryMs:StoryTime,exitMs:StoryTime,jumps:z13.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=z13.strictObject({atMs:z13.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=z13.array(ContinuitySampleSchema).min(3).max(64);import{z as z14}from"zod";var PreparationIdSchema=z14.uuid().brand();var GenerationContractIdSchema=z14.uuid().brand();var ContentFingerprintSchema=z14.string().regex(/^[0-9a-f]{64}$/);var PreparationTargetSchema=z14.discriminatedUnion("mediaType",[z14.strictObject({mediaType:z14.literal("IMAGE"),purpose:z14.enum(["KEYFRAME","REFERENCE_FRAME"]),framePurpose:z14.enum(["START_FRAME","END_FRAME","SUBJECT_REFERENCE"])}),z14.strictObject({mediaType:z14.literal("VIDEO"),purpose:z14.literal("SHOT_CANDIDATE")})]);var PreparationBasisSchema=z14.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,sceneId:SceneIdSchema,shotId:ShotIdSchema,productionRevision:z14.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z14.int().positive(),storyVersionId:StoryVersionIdSchema,storyVersion:z14.int().positive(),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z14.int().positive(),shotPlanningRevision:z14.int().positive(),resolverVersion:z14.literal("w7-product-preflight-v1"),consistencyProfile:z14.strictObject({id:z14.uuid(),version:z14.int().positive(),effectiveFingerprint:ContentFingerprintSchema}).optional()});var ReferenceRoleSchema=z14.enum(["PRODUCT_IDENTITY","PRODUCT_PACKSHOT","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","START_FRAME_ANCHOR","END_FRAME_ANCHOR"]);var ReferenceBindingInputSchema=z14.strictObject({keyframeAcceptanceId:z14.uuid().optional(),role:ReferenceRoleSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:ContentFingerprintSchema,reason:z14.string().trim().min(1).max(500)});var ExactEvidenceReferenceSchema=z14.strictObject({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:ContentFingerprintSchema,artifactChecksumSha256:ContentFingerprintSchema});var ResolvedReferenceSchema=ReferenceBindingInputSchema.extend({artifactChecksumSha256:ContentFingerprintSchema,contentType:z14.enum(["image/png","image/jpeg","image/webp"]),acceptedKeyframe:AcceptedKeyframeReferenceSchema.optional(),consistencyRuleId:z14.uuid().optional(),subjectId:z14.uuid().optional(),authority:z14.enum(["BRIEF_SOURCE_AND_EXPLICIT_BINDING","EXPLICIT_SHOT_BINDING","CANONICAL_PROFILE_MASTER","ACCEPTED_KEYFRAME_AND_EXPLICIT_BINDING"])});var ResolvedConstraintSchema=z14.strictObject({continuity:ContinuityExpectationSchema.optional(),reviewScales:z14.array(ConsistencyReviewScaleSchema).min(1).max(3).optional(),key:z14.string().min(1).max(200),family:z14.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","SHOT_INTENT","BOUNDARY_CONTINUITY"]),scope:z14.enum(["PROJECT","PRODUCTION","SCENE","SHOT","CONTINUITY_EDGE"]),subjectId:z14.uuid().optional(),dimension:z14.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/).optional(),enforcement:z14.enum(["LOCKED","REQUIRED","PREFERRED"]),expected:z14.string().min(1).max(1e3),source:z14.strictObject({kind:z14.enum(["BRIEF","SCENE","SHOT","CONTINUITY_EDGE","CONSISTENCY_PROFILE"]),id:z14.uuid(),version:z14.int().positive()})});var PreparationBlockerSchema=z14.strictObject({code:z14.enum(["MISSING_PRODUCT_REFERENCE","CANONICAL_SOURCE_UNAVAILABLE","CONSTRAINT_CONFLICT","PREVIOUS_SHOT_EVIDENCE_UNAVAILABLE","GENERATED_KEYFRAME_REQUIRED"]),summary:z14.string().min(1).max(1e3),relatedShotId:ShotIdSchema.optional(),edgeId:ContinuityEdgeIdSchema.optional()});var ConstraintSetSchema=z14.strictObject({preparationId:PreparationIdSchema,version:z14.int().positive(),fingerprint:ContentFingerprintSchema,items:z14.array(ResolvedConstraintSchema).max(2048)});var ReferenceSetSchema=z14.strictObject({preparationId:PreparationIdSchema,version:z14.int().positive(),fingerprint:ContentFingerprintSchema,bindings:z14.array(ResolvedReferenceSchema).max(12)});import{z as z15}from"zod";var GenerationCostVariantSchema=z15.strictObject({mode:z15.enum(["REFERENCE_TO_IMAGE","REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"]),aspectRatio:z15.enum(["16:9","9:16"]),workingWidth:z15.int().min(0).max(4096),workingHeight:z15.int().min(0).max(4096),hasAudio:z15.boolean(),references:z15.int().min(0).max(24),durationSeconds:z15.number().finite().min(0).max(30)});var GenerationCostPolicySchema=z15.strictObject({currency:z15.literal("USD"),sourceUrl:z15.url({protocol:/^https$/}).max(2e3),rationale:z15.string().trim().min(1).max(2e3),validUntil:z15.iso.datetime({offset:true}),rules:z15.array(z15.strictObject({id:z15.string().regex(/^[a-zA-Z0-9_-]{1,80}$/),variant:GenerationCostVariantSchema,upperBoundMicros:z15.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=z15.strictObject({connectionVersion:z15.int().positive(),modelProfileVersion:z15.int().positive(),quoteValidUntil:z15.iso.datetime({offset:true})});var GenerationCostQuoteSchema=z15.strictObject({currency:z15.literal("USD"),upperBoundMicros:z15.int().nonnegative().max(1e9),selection:ProviderSelectionSchema,expectedExecution:ExpectedGenerationExecutionSchema,sourceUrl:z15.url({protocol:/^https$/}).max(2e3),ruleIds:z15.array(z15.string()).min(1).max(64),preparationId:z15.uuid(),contractFingerprint:z15.string().regex(/^[a-f0-9]{64}$/)});import{z as z16}from"zod";var KeyframeGenerationIdSchema=z16.uuid().brand();var KeyframeProviderProfileSchema=z16.strictObject({id:z16.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,79}$/),adapterVersion:z16.string().min(1).max(80),model:z16.string().min(1).max(120),executionClass:z16.enum(["LIVE","TEST_ONLY"]),mediaType:z16.literal("IMAGE"),mode:z16.literal("REFERENCE_TO_IMAGE"),referenceRoles:z16.array(ReferenceRoleSchema).min(1).max(6),aspectRatios:z16.array(z16.enum(["16:9","9:16"])).min(1).max(2),maxReferences:z16.int().min(1).max(12),correlationLookup:z16.boolean()});var KeyframeStartInputSchema=z16.strictObject({expectedExecution:ExpectedGenerationExecutionSchema.optional(),selection:ProviderSelectionSchema.optional(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,idempotencyKey:z16.string().trim().min(1).max(200)});var KeyframeGetInputSchema=z16.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:KeyframeGenerationIdSchema});var KeyframeQueryInputSchema=z16.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeAdmissionSchema=z16.strictObject({semanticStatus:z16.literal("ACCEPTED"),generationId:KeyframeGenerationIdSchema,operationId:OperationIdSchema,productionId:ProductionIdSchema,contractId:GenerationContractIdSchema,executionClass:z16.enum(["LIVE","TEST_ONLY"])});var KeyframeCandidateSchema=z16.strictObject({id:z16.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,availability:z16.enum(["AVAILABLE","INVALID"]),observation:z16.enum(["NOT_OBSERVED","OBSERVED"]),evaluation:z16.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),accepted:z16.boolean(),reviewId:z16.uuid().optional(),reviewVersion:z16.int().positive().optional(),acceptanceDecisionId:z16.uuid().optional(),freshness:z16.enum(["CURRENT_BASIS","STALE_BASIS"]),checksumSha256:ContentFingerprintSchema,contentType:z16.enum(["image/png","image/jpeg","image/webp"]),byteSize:z16.int().positive(),width:z16.int().positive(),height:z16.int().positive()});var KeyframeGenerationViewSchema=z16.strictObject({connection:z16.strictObject({connectionId:z16.uuid(),connectionVersion:z16.int().positive(),modelProfileId:z16.string(),modelProfileVersion:z16.int().positive()}).optional(),generationId:KeyframeGenerationIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,operationId:OperationIdSchema,provider:KeyframeProviderProfileSchema,runtimeStatus:z16.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z16.enum(["NOT_SUBMITTED","SUBMITTING","PENDING","UNKNOWN","SUCCEEDED","FAILED"]),freshness:z16.enum(["CURRENT_BASIS","STALE_BASIS"]),cancellationRequested:z16.boolean(),candidate:KeyframeCandidateSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z16.iso.datetime({offset:true})});var KeyframeQueryPageSchema=z16.strictObject({items:z16.array(KeyframeGenerationViewSchema),page:QueryPageInfoSchema});var KeyframeMediaSchema=z16.strictObject({contentType:z16.enum(["image/png","image/jpeg","image/webp"]),checksumSha256:ContentFingerprintSchema,byteSize:z16.int().positive().max(8*1024*1024),contentBase64:z16.string().min(4).max(4*Math.ceil(8*1024*1024/3))});var KeyframeSummarySchema=z16.strictObject({generations:z16.int().nonnegative(),running:z16.int().nonnegative(),waiting:z16.int().nonnegative(),registeredCandidates:z16.int().nonnegative(),testCandidates:z16.int().nonnegative(),liveCandidates:z16.int().nonnegative()});import{z as z17}from"zod";var VideoGenerationIdSchema=z17.uuid().brand();var VideoProviderProfileSchema=z17.strictObject({id:z17.string().regex(/^[a-z][a-z0-9-]{1,79}$/),adapterVersion:z17.string().min(1).max(80),model:z17.string().min(1).max(160),executionClass:z17.enum(["LIVE","TEST_ONLY"]),mediaType:z17.literal("VIDEO"),modes:z17.array(z17.enum(["REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"])).min(1).max(3),referenceRoles:z17.array(ReferenceRoleSchema).min(1).max(8),aspectRatios:z17.array(z17.enum(["16:9","9:16"])).min(1).max(2),minDurationSeconds:z17.int().min(1),maxDurationSeconds:z17.int().max(30),maxReferences:z17.int().min(1).max(10),combineAnchorsAndReferences:z17.boolean(),workingWidth:z17.int().positive().max(4096),workingHeight:z17.int().positive().max(4096),frameRate:z17.union([z17.literal(24),z17.literal(30)]),sourceFormat:z17.strictObject({videoCodec:z17.literal("hevc"),pixelFormat:z17.literal("yuv420p10le")}).optional(),hasAudio:z17.boolean(),nativeAudioChannels:z17.union([z17.literal(1),z17.literal(2)]).optional(),correlationStrategy:z17.literal("PROVIDER_TASK_ID")});var VideoStartInputSchema=z17.strictObject({expectedExecution:ExpectedGenerationExecutionSchema.optional(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,selection:ProviderSelectionSchema,idempotencyKey:z17.string().trim().min(1).max(200)});var VideoGetInputSchema=z17.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:VideoGenerationIdSchema});var VideoQueryInputSchema=z17.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VideoAdmissionSchema=z17.strictObject({semanticStatus:z17.literal("ACCEPTED"),generationId:VideoGenerationIdSchema,operationId:OperationIdSchema,productionId:ProductionIdSchema,contractId:GenerationContractIdSchema,executionClass:z17.enum(["LIVE","TEST_ONLY"])});var VideoTechnicalMetadataSchema=z17.strictObject({contentType:z17.literal("video/mp4"),checksumSha256:ContentFingerprintSchema,byteSize:z17.int().positive().max(128*1024*1024),width:z17.int().positive().max(4096),height:z17.int().positive().max(4096),durationMs:z17.int().min(1).max(30150),frameRate:z17.number().positive().max(120),videoCodec:z17.enum(["h264","hevc"]),pixelFormat:z17.literal("yuv420p10le").optional(),hasAudio:z17.boolean(),nativeAudio:NativeVideoAudioMetadataSchema.optional()});var VideoPosterSchema=z17.strictObject({representationId:ArtifactRepresentationIdSchema,contentType:z17.literal("image/png"),checksumSha256:ContentFingerprintSchema,byteSize:z17.int().positive().max(2*1024*1024),width:z17.int().positive().max(320),height:z17.int().positive().max(320)});var VideoCandidateSchema=VideoTechnicalMetadataSchema.extend({nativeSound:NativeVideoSoundReferenceSchema.optional(),id:z17.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,poster:VideoPosterSchema,availability:z17.enum(["AVAILABLE","INVALID"]),observation:z17.enum(["NOT_OBSERVED","OBSERVED"]),evaluation:z17.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),accepted:z17.boolean(),reviewId:z17.uuid().optional(),reviewVersion:z17.int().positive().optional(),acceptanceDecisionId:z17.uuid().optional(),freshness:z17.enum(["CURRENT_BASIS","STALE_BASIS"])});var VideoGenerationViewSchema=z17.strictObject({generationId:VideoGenerationIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,connection:z17.strictObject({connectionId:z17.uuid(),connectionVersion:z17.int().positive(),modelProfileId:z17.string(),modelProfileVersion:z17.int().positive()}),operationId:OperationIdSchema,provider:VideoProviderProfileSchema,runtimeStatus:z17.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z17.enum(["NOT_SUBMITTED","SUBMITTING","PENDING","UNKNOWN","SUCCEEDED","FAILED"]),freshness:z17.enum(["CURRENT_BASIS","STALE_BASIS"]),cancellationRequested:z17.boolean(),candidate:VideoCandidateSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z17.iso.datetime({offset:true})});var VideoQueryPageSchema=z17.strictObject({items:z17.array(VideoGenerationViewSchema),page:QueryPageInfoSchema});var VideoSummarySchema=z17.strictObject({generations:z17.int().nonnegative(),running:z17.int().nonnegative(),waiting:z17.int().nonnegative(),registeredCandidates:z17.int().nonnegative(),testCandidates:z17.int().nonnegative(),liveCandidates:z17.int().nonnegative()});import{z as z18}from"zod";var MatrixParameterRuleSchema=SpeechParameterRuleSchema.extend({numberOptions:z18.array(z18.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 z19}from"zod";var AsrProfileSchema=z19.strictObject({id:ModelProfileIdSchema,version:z19.int().positive(),providerId:ProviderIdSchema,sourceUrl:z19.url().max(2048),verifiedAt:z19.iso.date(),modelId:z19.string().min(1).max(160),label:z19.string().min(1).max(100),protocol:z19.enum(["OPENAI_TRANSCRIPTION_V1","OPENAI_WHISPER_TRANSCRIPTION_V1","QWEN_ASR_V1"]),modes:z19.tuple([z19.literal("TRANSCRIPTION")]),inputKinds:z19.array(z19.enum(["AUDIO","VIDEO"])).min(1).max(2),requestTimeoutMs:z19.int().min(1e3).max(18e4),maxBytes:z19.int().positive().max(12582912),maxDurationMs:z19.int().positive().max(6e4),parameters:z19.record(z19.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:z19.literal(1),text:z19.string().max(6e4),languages:z19.array(z19.string().min(2).max(40)).max(32)};var TimedText=z19.strictObject({text:z19.string().min(1).max(2500),startMs:z19.int().nonnegative().max(6e4),endMs:z19.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Transcript interval must advance");var TranscriptSchema=z19.discriminatedUnion("timing",[z19.strictObject({...TranscriptText,timing:z19.literal("UNAVAILABLE")}),z19.strictObject({...TranscriptText,timing:z19.literal("PROVIDER_REPORTED"),timeBase:z19.literal("ORIGINAL_MEDIA_MS"),granularities:z19.array(z19.enum(["word","segment"])).min(1).max(2),words:z19.array(TimedText).max(1200),segments:z19.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 z20}from"zod";var ObservationModeSchema=z20.enum(["AUDIO","AUDIOVISUAL","VIDEO","VIDEO_ALL_FRAMES","TRANSCRIPTION"]);var ObservationParametersSchema=SpeechParametersSchema;var VisualObservationProfileSchema=z20.strictObject({id:ModelProfileIdSchema,version:z20.int().positive(),providerId:ProviderIdSchema,sourceUrl:z20.url().max(2048),modelId:z20.string().min(1).max(160),label:z20.string().min(1).max(100),protocol:z20.enum(["GEMINI_INTERACTIONS_V1","QIANWEN_VIDEO_V1"]),modes:z20.array(z20.enum(["AUDIO","AUDIOVISUAL","VIDEO","VIDEO_ALL_FRAMES"])).min(1).max(4),requestTimeoutMs:z20.int().min(1e3).max(18e4),maxBytes:z20.int().positive().max(12582912),maxDurationMs:z20.int().positive().max(6e4),parameters:z20.record(z20.string(),z20.strictObject({type:z20.enum(["NUMBER","INTEGER","BOOLEAN","STRING"]),min:z20.number().optional(),max:z20.number().optional(),options:z20.array(z20.string()).max(20).optional(),default:z20.union([z20.number().finite(),z20.boolean(),z20.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=z20.union([VisualObservationProfileSchema,AsrProfileSchema]);import{z as z21}from"zod";var ProviderTenantInputSchema=z21.strictObject({tenantId:TenantIdSchema});var ImageModelProfileSchema=z21.strictObject({referenceRoles:z21.array(ReferenceRoleSchema.exclude(["START_FRAME_ANCHOR","END_FRAME_ANCHOR"])).min(1).max(6).optional(),id:ModelProfileIdSchema,version:z21.int().positive(),providerId:ProviderIdSchema,modelId:z21.string().min(1).max(160),protocol:z21.enum(["QWEN_EDIT","ARK_IMAGE","GEMINI_IMAGE","OPENAI_IMAGE","XAI_IMAGE"]),maxReferences:z21.int().positive(),promptMaxUtf8Bytes:z21.int().positive(),requestTimeoutMs:z21.int().positive(),workingWidth:z21.int().nonnegative(),workingHeight:z21.int().nonnegative()});var VideoModelProfileSchema=z21.strictObject({id:ModelProfileIdSchema,version:z21.int().positive(),providerId:ProviderIdSchema,modelId:z21.string().min(1).max(160),protocol:z21.enum(["QWEN_VIDEO","VOLCENGINE_VIDEO"]),requestTimeoutMs:z21.int().positive(),promptMaxCharacters:z21.int().positive(),resolution:z21.enum(["720P","1080P"]),adapterVersion:z21.string().min(1).max(80),capabilities:VideoProviderProfileSchema.omit({id:true,adapterVersion:true,model:true,executionClass:true})});var ProviderDefaultViewSchema=z21.strictObject({selection:ProviderSelectionSchema,revision:z21.int().positive()});var scan=z21.strictObject({limit:z21.literal(100),possiblyTruncated:z21.boolean()});var ProviderConnectionPageSchema=scan.extend({items:z21.array(ProviderConnectionViewSchema).max(100)});var ProviderModelsViewSchema=z21.strictObject({catalog:z21.array(ImageModelProfileSchema).max(100),videoCatalog:z21.array(VideoModelProfileSchema).max(100),speechCatalog:z21.array(SpeechModelProfileSchema).max(100).default([]),observationCatalog:z21.array(ObservationProfileSchema).max(100).default([]),available:z21.array(z21.strictObject({selection:ProviderSelectionSchema,profile:KeyframeProviderProfileSchema})).max(1600),defaultSelection:ProviderDefaultViewSchema.nullable(),connectionScan:scan});import{z as z22}from"zod";var key2=z22.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,99}$/);var value=z22.union([z22.string().max(160),z22.number().finite(),z22.boolean()]);var ModelAudioCapabilitySchema=z22.enum(["SYNCHRONIZED_AUDIO","SPEECH_GENERATION","SPEECH_RECOGNITION","TRANSCRIPT_TIMESTAMPS","VOICE_REFERENCE","AUDIO_REFERENCE","AUDIO_DRIVEN_VIDEO","LIP_SYNCHRONIZATION","AUDIO_EDITING","SEPARATE_STEMS"]);var ModelCapabilityMatrixSchema=z22.strictObject({schemaVersion:z22.literal(1),service:key2,lifecycle:z22.enum(["ACTIVE","DEPRECATED","RETIRED"]),sources:z22.array(z22.strictObject({url:z22.url().max(2048),checkedAt:z22.iso.date()})).min(1).max(8),modes:z22.array(key2).min(1).max(16),claims:z22.array(z22.strictObject({capability:ModelAudioCapabilitySchema,modes:z22.array(key2).min(1).max(16),support:z22.enum(["SUPPORTED","UNSUPPORTED","UNKNOWN"]),control:z22.enum(["PARAMETER","PROMPT","ALWAYS_ON","MEDIA_INPUT","NONE"]),parameterPath:key2.optional(),access:z22.enum(["PUBLIC","QUALIFIED_ACCOUNT"]).default("PUBLIC"),description:z22.string().max(600).optional()})).max(64),parameters:z22.record(key2,MatrixParameterRuleSchema),constraints:z22.array(z22.strictObject({modes:z22.array(key2).min(1).max(16),when:z22.strictObject({parameter:key2,equals:value}).optional(),require:z22.array(key2).max(16).default([]),forbid:z22.array(key2).max(16).default([]),requireValues:z22.record(key2,value).default({}),reason:z22.string().min(1).max(300)})).max(32),references:z22.array(z22.strictObject({kind:z22.enum(["VOICE_ID","AUDIO_REFERENCE","DRIVING_AUDIO"]),modes:z22.array(key2).min(1).max(16),parameterPath:key2,maxItems:z22.int().min(1).max(10),minDurationMs:z22.int().positive().optional(),maxDurationMs:z22.int().positive().max(6e4).optional(),maxTotalDurationMs:z22.int().positive().max(6e4).optional(),maxBytes:z22.int().positive().max(67108864).optional(),formats:z22.array(z22.enum(["WAV","MP3"])).max(2),requiresVisual:z22.boolean(),access:z22.enum(["PUBLIC","QUALIFIED_ACCOUNT"])})).max(16),outputAudioChannels:z22.union([z22.literal(1),z22.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 z23}from"zod";var cost={costPolicy:GenerationCostPolicySchema.optional()};var matrix={matrix:ModelCapabilityMatrixSchema.optional()};var ProviderModelDefinitionSchema=z23.discriminatedUnion("family",[z23.strictObject({family:z23.literal("IMAGE"),profile:ImageModelProfileSchema,...matrix,...cost}),z23.strictObject({family:z23.literal("VIDEO"),profile:VideoModelProfileSchema,...matrix,...cost}),z23.strictObject({family:z23.literal("SPEECH"),profile:SpeechModelProfileSchema,...matrix}),z23.strictObject({family:z23.literal("OBSERVATION"),profile:ObservationProfileSchema,...matrix}),z23.strictObject({family:z23.literal("DECLARED"),profile:z23.strictObject({id:ModelProfileIdSchema,version:z23.int().positive(),providerId:ProviderIdSchema,modelId:z23.string().min(1).max(160),protocol:z23.literal("DOCUMENTED_ONLY")}),matrix:ModelCapabilityMatrixSchema})]);var ProviderModelViewSchema=z23.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,version:z23.int().positive(),enabled:z23.boolean(),definition:ProviderModelDefinitionSchema}).refine(v=>v.id===v.definition.profile.id&&v.version===v.definition.profile.version,{message:"Model version identity mismatch"});var ConfigureProviderModelSchema=z23.strictObject({tenantId:TenantIdSchema,expectedVersion:z23.int().nonnegative(),definition:ProviderModelDefinitionSchema}).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=z23.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,expectedVersion:z23.int().positive()});var ProviderModelPageSchema=z23.strictObject({items:z23.array(ProviderModelViewSchema).max(100),possiblyTruncated:z23.boolean()});var ProviderModelGetSchema=z23.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,version:z23.int().positive().optional()});import{z as z24}from"zod";var id3=z24.uuid().toLowerCase();var SoundPlanScopeSchema=z24.strictObject({tenantId:id3,productionId:id3});var SoundPlanBasisSchema=z24.strictObject({briefVersionId:id3,briefVersion:z24.int().positive(),storyVersionId:id3,storyVersion:z24.int().positive(),planVersionId:id3,planVersion:z24.int().positive()});var SoundPlanModelSchema=z24.strictObject({modelProfileId:z24.string().regex(/^[a-z][a-z0-9-]{1,79}$/),modelProfileVersion:z24.int().positive(),connectionId:id3});var SoundMakingPlanContentSchema=z24.strictObject({visuals:z24.array(z24.strictObject({shotId:id3,method:z24.enum(["CODE","GENERATED","IMPORTED"]),model:SoundPlanModelSchema.optional(),nativeAudio:z24.boolean().optional(),sourceSound:SourceSoundTreatmentSchema,rationale:z24.string().trim().min(1).max(600)})).min(1).max(200),cues:z24.array(z24.strictObject({id:z24.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),role:z24.enum(["NARRATION","DIALOGUE","MUSIC","AMBIENCE","SOUND_EFFECT"]),source:z24.enum(["TTS","NATIVE_VIDEO","IMPORTED_AUDIO","EXISTING_AUDIO"]),shotIds:z24.array(id3).min(1).max(200),startMs:z24.int().min(0).max(6e4),endMs:z24.int().positive().max(6e4),text:z24.string().trim().min(1).max(6e3).optional(),voice:z24.string().min(1).max(100).optional(),model:SoundPlanModelSchema.optional(),parameters:SpeechParametersSchema.optional(),audio:z24.strictObject({purpose:z24.enum(["VOICEOVER","MUSIC"]),versionId:z24.uuid()}).optional(),lipSync:z24.enum(["REQUIRED","NONE"]),exactSpeech:z24.boolean()})).max(64),unknowns:z24.array(z24.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||!["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.parameters)||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:id3,soundPlanId:id3,projectId:id3,version:z24.int().positive(),basis:SoundPlanBasisSchema,content:SoundMakingPlanContentSchema,createdByPrincipalId:id3,createdAt:z24.iso.datetime({offset:true})});var SoundPlanValidateSchema=SoundPlanScopeSchema.extend({expectedProductionRevision:z24.int().positive(),basis:SoundPlanBasisSchema,content:SoundMakingPlanContentSchema});var SoundPlanAcceptSchema=SoundPlanValidateSchema.extend({expectedVersion:z24.int().nonnegative(),idempotencyKey:z24.string().trim().min(1).max(200)});var SoundPlanGetSchema=SoundPlanScopeSchema.extend({versionId:id3.optional()});var SoundPlanDiagnosticSchema=z24.strictObject({severity:z24.enum(["ERROR","WARNING"]),code:z24.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),shotId:id3.optional(),cueId:z24.string().max(64).optional(),message:z24.string().max(500)});var SoundPlanValidationSchema=z24.strictObject({executable:z24.boolean(),diagnostics:z24.array(SoundPlanDiagnosticSchema).max(256),semantics:z24.literal("PLAN_VALIDATION_NOT_CREATIVE_OR_LISTENING_APPROVAL")});var SoundPlanViewSchema=z24.strictObject({version:SoundPlanVersionSchema,current:z24.boolean(),freshness:z24.enum(["CURRENT_BASIS","STALE_BASIS"])});var SoundPlanReceiptSchema=z24.strictObject({semanticStatus:z24.literal("SUCCESS"),version:SoundPlanVersionSchema,productionRevision:z24.int().positive()});var SoundPlanContextSchema=SoundPlanScopeSchema.extend({projectId:id3,productionRevision:z24.int().positive(),runnable:z24.boolean(),basis:SoundPlanBasisSchema.nullable(),targetDurationMs:z24.int().positive().nullable(),shots:z24.array(z24.strictObject({shotId:id3,durationMs:z24.int().positive()})).max(200),currentVersion:z24.int().nonnegative(),currentVersionId:id3.nullable(),capabilities:z24.strictObject({models:z24.array(ProviderModelViewSchema).max(100),video:z24.array(z24.strictObject({selection:ProviderSelectionSchema,profile:VideoProviderProfileSchema})).max(1600),speech:SpeechOptionsSchema.shape.options,audio:z24.array(AudioViewSchema).max(64)})});import{z as z27}from"zod";import{z as z26}from"zod";import{z as z25}from"zod";var id4=z25.uuid().toLowerCase();var hash2=z25.string().regex(/^[0-9a-f]{64}$/);var ImportedSynchronousAudioPurposeSchema=z25.literal("SOURCE_SYNC");var SourceSyncPcmMediaSchema=z25.strictObject({profile:z25.literal("PCM_S16LE_48000_SOURCE_SYNC_V1"),audioCodec:z25.literal("pcm_s16le"),sampleRateHz:z25.literal(48e3),audioChannels:z25.union([z25.literal(1),z25.literal(2)]),sampleCount:z25.int().min(1600).max(576e3),durationMs:z25.number().positive().max(12e3)}).refine(m=>m.sampleCount%1600===0&&m.durationMs===m.sampleCount/48);var ImportedSynchronousAudioExtractionSchema=z25.strictObject({schemaVersion:z25.literal(1),purpose:ImportedSynchronousAudioPurposeSchema,tenantId:id4,projectId:id4,productionId:id4,shotId:id4,sourceId:id4,sourceVersionId:id4,normalizationId:id4,originalArtifactId:id4,originalRepresentationId:id4,originalChecksumSha256:hash2,sourceRange:z25.strictObject({clock:z25.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z25.int().nonnegative().max(1799),endFrame:z25.int().positive().max(1800)}),destinationStartSample:z25.literal(0)}).refine(v=>v.sourceRange.endFrame>v.sourceRange.startFrame&&v.sourceRange.endFrame-v.sourceRange.startFrame<=360);var ImportedSynchronousAudioSourceSchema=z25.strictObject({schemaVersion:z25.literal(1),purpose:ImportedSynchronousAudioPurposeSchema,tenantId:id4,projectId:id4,productionId:id4,shotId:id4,sourceId:id4,sourceVersionId:id4,normalizationId:id4,originalArtifactId:id4,originalRepresentationId:id4,originalChecksumSha256:hash2,sourceRange:z25.strictObject({clock:z25.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z25.int().nonnegative(),endFrame:z25.int().positive()}),destinationStartSample:z25.int().nonnegative(),media:z25.union([AudioMediaSchema,SourceSyncPcmMediaSchema]),wavChecksumSha256:hash2,wavByteSize:z25.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"})});var id5=z26.uuid().toLowerCase();var key3=z26.string().trim().min(1).max(200);var SourceSyncAudioStartSchema=z26.strictObject({tenantId:id5,productionId:id5,normalizationId:id5,expectedProductionRevision:z26.int().positive(),expectedVersion:z26.int().nonnegative(),idempotencyKey:key3});var SourceSyncAudioGetSchema=z26.strictObject({tenantId:id5,productionId:id5,shotId:id5,versionId:id5});var SourceSyncAudioVersionSchema=z26.strictObject({schemaVersion:z26.literal(1),purpose:z26.literal("SOURCE_SYNC"),id:id5,audioId:id5,version:z26.int().positive(),tenantId:id5,projectId:id5,productionId:id5,shotId:id5,normalizationId:id5,artifactId:id5,representationId:id5,provenance:ImportedSynchronousAudioSourceSchema,previousVersionId:id5.nullable(),executionClass:z26.enum(["LIVE","TEST_ONLY"]),createdByPrincipalId:id5,createdAt:z26.iso.datetime({offset:true})});var SourceSyncAudioReceiptSchema=z26.strictObject({semanticStatus:z26.literal("SUCCESS"),version:SourceSyncAudioVersionSchema,productionRevision:z26.int().positive()});var SourceSyncAudioViewSchema=z26.strictObject({version:SourceSyncAudioVersionSchema,status:z26.enum(["CURRENT","STALE"]),availability:z26.enum(["AVAILABLE","UNAVAILABLE"])});var TimelineSourceSoundInputSchema=z27.strictObject({duckingMusicPermille:z27.int().nonnegative().max(1e3).optional(),soundPlanVersionId:z27.uuid(),clips:z27.array(z27.strictObject({ordinal:z27.int().min(1).max(200),treatment:SourceSoundTreatmentSchema,importedAudioVersionId:z27.uuid().optional()})).min(1).max(200),speechCues:z27.array(z27.strictObject({cueId:z27.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),audioVersionId:z27.uuid()})).max(64)});var TimelineSourceSoundSourceSchema=z27.discriminatedUnion("kind",[z27.strictObject({kind:z27.literal("NATIVE_GENERATED"),version:NativeVideoSoundReferenceSchema}),z27.strictObject({kind:z27.literal("IMPORTED_SYNC"),version:SourceSyncAudioVersionSchema})]);var TimelineSourceSoundCompositionSchema=z27.strictObject({schemaVersion:z27.literal(1),soundPlanVersionId:z27.uuid(),soundPlanFingerprint:z27.string().regex(/^[0-9a-f]{64}$/),plannedCues:SoundMakingPlanContentSchema.shape.cues,mix:AudioMixProfileSchema,clips:z27.array(z27.strictObject({ordinal:z27.int().min(1).max(200),treatment:SourceSoundTreatmentSchema,source:TimelineSourceSoundSourceSchema.optional(),sourceInSample:z27.int().nonnegative().max(288e4),sourceOutSample:z27.int().nonnegative().max(288e4),startSample:z27.int().nonnegative().max(288e4),outputSampleCount:z27.int().positive().max(288e4)})).min(1).max(200),speechCues:z27.array(z27.strictObject({cueId:z27.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),source:AudioVersionSchema,sourceInMs:z27.literal(0),sourceOutMs:z27.int().positive().max(6e4),startMs:z27.int().nonnegative().max(6e4),gainPermille:z27.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 z28}from"zod";var Fingerprint=z28.string().regex(/^[0-9a-f]{64}$/);var AcceptedShotReferenceSchema=z28.strictObject({acceptanceId:z28.uuid(),reviewId:z28.uuid(),generationId:z28.uuid(),candidateId:z28.uuid(),shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint,artifactChecksumSha256:Fingerprint,preparationId:z28.uuid(),contractId:z28.uuid(),contractFingerprint:Fingerprint,planVersionId:SceneShotPlanVersionIdSchema,planVersion:z28.int().positive(),shotPlanningRevision:z28.int().positive(),executionClass:z28.enum(["LIVE","TEST_ONLY"]),reviewResult:z28.enum(["PASS","WARNING"])});import{z as z29}from"zod";var Fingerprint2=z29.string().regex(/^[0-9a-f]{64}$/);var ProgrammaticAcceptedVisualSourceReferenceSchema=z29.strictObject({sourceKind:z29.literal("PROGRAMMATIC"),acceptanceId:z29.uuid(),reviewId:z29.uuid(),renderId:z29.uuid(),compositionId:z29.uuid(),compositionVersionId:z29.uuid(),compositionVersion:z29.int().positive(),compositionFingerprint:Fingerprint2,renderManifestFingerprint:Fingerprint2,shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint2,artifactChecksumSha256:Fingerprint2,planVersionId:SceneShotPlanVersionIdSchema,planVersion:z29.int().positive(),shotPlanningRevision:z29.int().positive(),executionClass:z29.enum(["LIVE","TEST_ONLY"]),reviewResult:z29.enum(["PASS","WARNING"])});var ImportedAcceptedVisualSourceReferenceSchema=z29.strictObject({sourceKind:z29.literal("IMPORTED"),acceptanceId:z29.uuid(),reviewId:z29.uuid(),normalizationId:z29.uuid(),sourceId:z29.uuid(),sourceVersionId:z29.uuid(),shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint2,executionClass:z29.enum(["LIVE","TEST_ONLY"]),reviewResult:z29.enum(["PASS","WARNING"])});var AcceptedVisualSourceReferenceSchema=z29.union([AcceptedShotReferenceSchema,ProgrammaticAcceptedVisualSourceReferenceSchema,ImportedAcceptedVisualSourceReferenceSchema]);import{z as z30}from"zod";var id6=z30.uuid().toLowerCase();var hash3=z30.string().regex(/^[0-9a-f]{64}$/);var CaptionTranscriptPlacementSchema=z30.discriminatedUnion("kind",[z30.strictObject({kind:z30.literal("AUDIO_TRACK"),purpose:z30.enum(["VOICEOVER","MUSIC"])}),z30.strictObject({kind:z30.literal("SPEECH_CUE"),cueId:z30.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)}),z30.strictObject({kind:z30.literal("TIMELINE_OUTPUT")})]);var CaptionTranscriptPlanSchema=z30.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,timelineVersionId:id6,language:z30.string().regex(/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/).max(60),sources:z30.array(z30.strictObject({observationId:id6,placement:CaptionTranscriptPlacementSchema,granularity:z30.enum(["word","segment"])})).min(1).max(64)});var AuthorTranscriptCaptionsSchema=CaptionTranscriptPlanSchema.extend({expectedProductionRevision:z30.int().positive(),expectedCaptionVersion:z30.int().nonnegative(),idempotencyKey:z30.string().trim().min(1).max(200)});var CaptionTranscriptProvenanceSchema=z30.strictObject({schemaVersion:z30.literal(1),advisory:z30.literal(true),timing:z30.literal("PROVIDER_REPORTED"),timelineVersionId:id6,timingFingerprint:hash3,sources:z30.array(z30.strictObject({observationId:id6,artifactId:id6,representationId:id6,checksumSha256:hash3,placement:CaptionTranscriptPlacementSchema,granularity:z30.enum(["word","segment"]),sourceInMs:z30.int().nonnegative(),sourceOutMs:z30.int().positive(),startMs:z30.int().nonnegative(),spanIndices:z30.array(z30.int().nonnegative().max(1199)).min(1).max(120),excludedSpans:z30.int().nonnegative().max(1200)})).min(1).max(64)});import{z as z31}from"zod";var sha3=z31.string().regex(/^[0-9a-f]{64}$/);var CaptionContentSchema=z31.strictObject({language:z31.string().regex(/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/).max(60),durationMs:z31.int().min(3e4).max(6e4),cues:z31.array(z31.strictObject({startMs:z31.int().nonnegative().max(59999),endMs:z31.int().positive().max(6e4),text:z31.string().min(1).max(240)})).min(1).max(120)});var CaptionScopeSchema=z31.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var AuthorCaptionsSchema=CaptionScopeSchema.extend({expectedProductionRevision:z31.int().positive(),expectedCaptionVersion:z31.int().nonnegative(),idempotencyKey:z31.string().trim().min(1).max(200),content:CaptionContentSchema});var CaptionGetSchema=CaptionScopeSchema.extend({versionId:z31.uuid()});var CaptionQuerySchema=CaptionScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var CaptionRepresentationSchema=z31.strictObject({id:z31.uuid(),checksumSha256:sha3,byteSize:z31.int().positive().max(131072)});var CaptionVersionSchema=CaptionScopeSchema.extend({transcriptProvenance:CaptionTranscriptProvenanceSchema.optional(),id:z31.uuid(),captionId:z31.uuid(),projectId:z31.uuid(),version:z31.int().positive(),artifactId:z31.uuid(),content:CaptionContentSchema,fingerprint:sha3,original:CaptionRepresentationSchema,subtitle:CaptionRepresentationSchema,previousVersionId:z31.uuid().nullable(),createdByPrincipalId:z31.uuid(),createdAt:z31.iso.datetime({offset:true})});var CaptionViewSchema=z31.strictObject({version:CaptionVersionSchema,isCurrent:z31.boolean(),availability:z31.enum(["AVAILABLE","UNAVAILABLE"])});var CaptionReceiptSchema=z31.strictObject({semanticStatus:z31.literal("SUCCESS"),version:CaptionVersionSchema,productionRevision:z31.int().positive()});var CaptionBasisSchema=CaptionScopeSchema.extend({productionRevision:z31.int().positive(),currentVersion:z31.int().nonnegative(),currentVersionId:z31.uuid().nullable(),authorable:z31.boolean()});var CaptionPageSchema=z31.strictObject({items:z31.array(CaptionViewSchema).max(200),page:QueryPageInfoSchema});var CaptionExportSchema=CaptionGetSchema.extend({format:z31.enum(["JSON","SRT"])});var CaptionSnapshotSchema=z31.strictObject({currentVersion:z31.int().positive().nullable(),currentVersionId:z31.uuid().nullable(),artifactId:z31.uuid().nullable(),availability:z31.enum(["NONE","AVAILABLE","UNAVAILABLE"]),cueCount:z31.int().nonnegative().max(120),durationMs:z31.int().min(3e4).max(6e4).nullable(),attachedToTimeline:z31.boolean(),attachedCaptionVersionId:z31.uuid().nullable().optional(),attachedTimelineVersionId:z31.uuid().nullable().optional()});var CaptionTranscriptDraftSchema=z31.strictObject({content:CaptionContentSchema,provenance:CaptionTranscriptProvenanceSchema});import{z as z32}from"zod";var LegacyCaptionRenderStyleSchema=z32.strictObject({id:z32.literal("PLAIN_TEXT_NOTO_SANS_SC_V1"),fontSha256:z32.literal("a3041811a78c361b1de50f953c805e0244951c21c5bd412f7232ef0d899af0da"),framePolicy:z32.literal("PTS_HALF_OPEN_CEIL_V1")});var RegularCaptionRenderStyleSchema=z32.strictObject({id:z32.literal("PLAIN_TEXT_NATIVE_SC_REGULAR_V2"),fontSha256:z32.literal("e5a51f41fc1b827da651afee3975e07a182ff4f8e04d9dfc0a3cecd6177a52b6"),framePolicy:z32.literal("PTS_HALF_OPEN_CEIL_V1")});var CaptionRenderStyleSchema=z32.discriminatedUnion("id",[LegacyCaptionRenderStyleSchema,RegularCaptionRenderStyleSchema]);import{z as z33}from"zod";var TimelineDurationSchema=z33.strictObject({totalMs:z33.int().positive().max(603e4),targetMs:z33.int().min(3e4).max(6e4),minMs:z33.literal(3e4),maxMs:z33.literal(6e4),deltaTargetMs:z33.int(),classification:z33.enum(["TOO_SHORT","WITHIN_TARGET","TOO_LONG"])});var TimelineClipSchema=z33.strictObject({ordinal:z33.int().positive().max(200),source:AcceptedShotReferenceSchema,technical:VideoTechnicalMetadataSchema,sourceInMs:z33.int().nonnegative(),sourceOutMs:z33.int().positive(),startMs:z33.int().nonnegative(),durationMs:z33.int().positive(),transition:ClipTransitionSchema,framing:ClipFramingSchema.optional()});var TimelineManifestSchema=z33.strictObject({schemaVersion:z33.literal(1),caption:CaptionVersionSchema.optional(),captionStyle:CaptionRenderStyleSchema.optional(),audio:TimelineAudioCompositionSchema.optional(),graphics:z33.array(TimelineGraphicSchema).max(8).optional(),basis:z33.strictObject({briefVersionId:BriefVersionIdSchema,briefVersion:z33.int().positive(),storyVersion:z33.int().positive(),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z33.int().positive()}),output:z33.strictObject({aspectRatio:z33.enum(["16:9","9:16"]),profile:DeliveryOutputProfileSchema}),clips:z33.array(TimelineClipSchema).min(1).max(200),duration:TimelineDurationSchema,missingPlannedShotIds:z33.array(ShotIdSchema).max(200),executionClass:z33.enum(["LIVE","TEST_ONLY"])});var TimelineVersionIdentityShape={id:z33.uuid(),timelineId:z33.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z33.int().positive(),fingerprint:z33.string().regex(/^[0-9a-f]{64}$/),createdByPrincipalId:PrincipalIdSchema,createdAt:z33.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 z34}from"zod";var TimelineV2ClipSchema=TimelineManifestSchema.shape.clips.element.extend({source:AcceptedVisualSourceReferenceSchema});var TimelineV2ManifestSchema=TimelineManifestSchema.extend({schemaVersion:z34.literal(2),clips:z34.array(TimelineV2ClipSchema).min(1).max(200),sourceSound:TimelineSourceSoundCompositionSchema.optional()});var TimelineV2VersionSchema=TimelineV2ManifestSchema.extend(TimelineVersionIdentityShape).superRefine(validateTimelineAttachments);import{z as z35}from"zod";var sha4=z35.string().regex(/^[0-9a-f]{64}$/);var VisualFrameSequenceSchema=z35.strictObject({schemaVersion:z35.literal(1),profileId:z35.literal("RGBA_PNG_SEQUENCE_30_V1"),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha4,width:z35.int().min(1).max(1920),height:z35.int().min(1).max(1920),frameRate:z35.literal(30),frameCount:z35.int().min(1).max(360),alpha:z35.literal("STRAIGHT_RGBA"),frames:z35.array(z35.strictObject({ordinal:z35.int().min(0).max(359),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha4,byteSize:z35.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=z35.strictObject({xPermille:z35.int().min(0).max(1e3),yPermille:z35.int().min(0).max(1e3),widthPermille:z35.int().min(1).max(1e3),heightPermille:z35.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=z35.strictObject({id:z35.uuid(),source:VisualFrameSequenceSchema,sourceInFrame:z35.int().min(0).max(359),sourceOutFrame:z35.int().min(1).max(360),startFrame:z35.int().min(0).max(1799),zIndex:z35.int().min(0).max(7),opacityPermille:z35.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=z35.strictObject({schemaVersion:z35.literal(1),profileId:z35.literal("STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1"),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,totalFrames:z35.int().min(1).max(1800),layers:z35.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 z36}from"zod";var TimelineVisualLayerInputSchema=z36.strictObject({id:z36.uuid(),artifactId:ArtifactIdSchema,sourceInFrame:z36.int().min(0).max(359),sourceOutFrame:z36.int().min(1).max(360),startFrame:z36.int().min(0).max(1799),zIndex:z36.int().min(0).max(7),opacityPermille:z36.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:z36.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 z37}from"zod";var TimelineVersionReaderSchema=z37.discriminatedUnion("schemaVersion",[TimelineVersionSchema,TimelineV2VersionSchema,TimelineV3VersionSchema]);var TimelineManifestReaderSchema=z37.discriminatedUnion("schemaVersion",[TimelineManifestSchema,TimelineV2ManifestSchema,TimelineV3ManifestSchema.superRefine(validateTimelineVisualLayerClock)]);import{z as z38}from"zod";var TimelineScopeSchema=z38.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var TimelineClipInputSchema=z38.strictObject({shotId:ShotIdSchema,acceptanceId:z38.uuid(),framing:ClipFramingSchema.optional(),transition:ClipTransitionSchema.optional(),sourceInMs:z38.int().nonnegative().max(30150),sourceOutMs:z38.int().positive().max(30150)}).refine(v=>v.sourceOutMs>v.sourceInMs,"Clip source range must advance");var BuildTimelineShapeSchema=TimelineScopeSchema.extend({schemaVersion:z38.union([z38.literal(2),z38.literal(3)]).optional(),expectedProductionRevision:z38.int().positive(),expectedTimelineVersion:z38.int().nonnegative(),idempotencyKey:z38.string().trim().min(1).max(200),clips:z38.array(TimelineClipInputSchema).min(1).max(200),captionVersionId:z38.uuid().optional(),audio:TimelineAudioInputSchema.optional(),sourceSound:TimelineSourceSoundInputSchema.optional(),graphics:z38.array(TimelineGraphicInputSchema).max(8).optional(),visualLayers:z38.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=z38.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=z38.strictObject({version:TimelineVersionReaderSchema,isCurrent:z38.boolean(),freshness:z38.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z38.array(TimelineStaleReasonSchema).max(13),assemblyStatus:z38.enum(["DRAFT","ASSEMBLY_READY"])});var TimelineGetSchema=TimelineScopeSchema.extend({versionId:z38.uuid()});var TimelineQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var TimelinePageSchema=z38.strictObject({items:z38.array(TimelineViewSchema),page:QueryPageInfoSchema});var TimelineBuildReceiptSchema=z38.strictObject({semanticStatus:z38.literal("SUCCESS"),version:TimelineVersionReaderSchema,productionRevision:z38.int().positive()});var TimelineBasisSchema=TimelineScopeSchema.extend({productionRevision:z38.int().positive(),currentTimelineVersion:z38.int().nonnegative(),runnable:z38.boolean(),planningReady:z38.boolean(),output:TimelineManifestSchema.shape.output.nullable(),targetDurationMs:z38.int().positive().nullable(),shots:z38.array(z38.strictObject({shotId:ShotIdSchema,ordinal:z38.int().positive(),acceptanceStatus:z38.enum(["NONE","CURRENT","STALE"]),source:AcceptedVisualSourceReferenceSchema.nullable(),technical:VideoTechnicalMetadataSchema.nullable()})).max(200)});var TimelineSnapshotSchema=z38.strictObject({currentVersion:z38.int().positive().nullable(),stale:z38.boolean(),timelineId:z38.uuid().nullable(),versionId:z38.uuid().nullable(),assemblyStatus:z38.enum(["DRAFT","ASSEMBLY_READY"]).nullable(),totalDurationMs:z38.int().positive().nullable(),durationClassification:TimelineDurationSchema.shape.classification.nullable(),missingPlannedShots:z38.int().nonnegative(),staleReasons:z38.array(TimelineStaleReasonSchema).max(13)});import{z as z39}from"zod";var sha5=z39.string().regex(/^[0-9a-f]{64}$/);var DeliveryPolicySchema=z39.strictObject({schemaVersion:z39.literal(1),requiredAudio:z39.boolean(),requiredCaptions:z39.boolean(),requiredGraphics:z39.boolean(),finalApproval:z39.enum(["AUTOMATIC","HUMAN"])});var DeliveryPolicyInputSchema=DeliveryPolicySchema.extend({requiredAudio:z39.boolean().default(false),requiredCaptions:z39.boolean().default(false),requiredGraphics:z39.boolean().default(false),finalApproval:z39.enum(["AUTOMATIC","HUMAN"]).default("AUTOMATIC")});var DeliveryCompositionSchema=z39.strictObject({hasAudio:z39.boolean(),hasCaptions:z39.boolean(),hasGraphics:z39.boolean()});var DeliveryTargetSchema=z39.strictObject({tenantId:z39.uuid(),projectId:z39.uuid(),productionId:z39.uuid(),renderId:z39.uuid(),timelineVersionId:z39.uuid(),timelineFingerprint:sha5,selectionId:z39.uuid(),selectionVersion:z39.int().positive(),renderManifestFingerprint:sha5,artifactId:z39.uuid(),representationId:z39.uuid(),checksumSha256:sha5,byteSize:z39.int().positive().max(128*1024*1024),executionClass:z39.enum(["LIVE","TEST_ONLY"])});var DeliveryCheckKeySchema=z39.enum(["FILE_READABLE","CHECKSUM","CONTAINER_PROFILE","DURATION","VIDEO_DECODE","AUDIO_DECODE","REQUIRED_AUDIO","REQUIRED_CAPTIONS","REQUIRED_GRAPHICS","MISSING_MEDIA","BLACK_FRAMES","ARTIFACT_REGISTRATION","PROVENANCE","MANIFEST_INTEGRITY","EXACT_BASIS","BLOCKING_FINDINGS"]);var DeliveryCheckSchema=z39.strictObject({key:DeliveryCheckKeySchema,status:z39.enum(["PASS","FAIL","UNVERIFIED","NOT_APPLICABLE"]),detail:z39.string().trim().min(1).max(1e3)});var DeliveryValidationReviewSchema=z39.strictObject({id:z39.uuid(),target:DeliveryTargetSchema,policy:DeliveryPolicySchema,policyFingerprint:sha5,composition:DeliveryCompositionSchema,checks:z39.array(DeliveryCheckSchema).length(DeliveryCheckKeySchema.options.length),result:z39.enum(["PASS","FAIL"]),blockingChecks:z39.array(DeliveryCheckKeySchema).max(DeliveryCheckKeySchema.options.length),createdAt:z39.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 z40}from"zod";var sha6=z40.string().regex(/^[0-9a-f]{64}$/);function sameTarget(a,b){return Object.keys(DeliveryTargetSchema.shape).every(key4=>a[key4]===b[key4])}var DeliveryApprovalSchema=z40.strictObject({id:z40.uuid(),reviewId:z40.uuid(),target:DeliveryTargetSchema,policyFingerprint:sha6,authority:z40.literal("HUMAN"),action:z40.enum(["APPROVE","REJECT"]),principalId:z40.uuid(),createdAt:z40.iso.datetime({offset:true})});var DeliveryManifestLinkSchema=z40.strictObject({id:z40.uuid(),checksumSha256:sha6,target:DeliveryTargetSchema,policyFingerprint:sha6,reviewId:z40.uuid()});var FinalDeliveryReceiptSchema=z40.strictObject({id:z40.uuid(),deliveryRole:z40.literal("FINAL_ARTIFACT"),review:DeliveryValidationReviewSchema,manifest:DeliveryManifestLinkSchema,approval:DeliveryApprovalSchema.nullable(),productionRevision:z40.int().positive(),completedAt:z40.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 z41}from"zod";var FinalRenderProfileIdSchema=z41.enum(["FINAL_H264_720P_V1","FINAL_H264_1080P_V1","FINAL_H264_480P_V1"]);var FinalRenderProfileSchema=z41.strictObject({id:FinalRenderProfileIdSchema,algorithm:z41.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),picturePolicy:PicturePolicySchema.optional(),width:z41.union([z41.literal(1280),z41.literal(720),z41.literal(1920),z41.literal(1080),z41.literal(854),z41.literal(480)]),height:z41.union([z41.literal(1280),z41.literal(720),z41.literal(1920),z41.literal(1080),z41.literal(854),z41.literal(480)]),frameRate:z41.literal(30),codec:z41.literal("h264"),pixelFormat:z41.literal("yuv420p"),fit:z41.literal("PAD"),hasAudio:z41.boolean(),audioMix:AudioMixProfileSchema.optional(),framePolicy:z41.literal("CUMULATIVE_NEAREST_FRAME"),encoder:z41.literal("libx264"),crf:z41.literal(18),preset:z41.literal("veryfast"),gopFrames:z41.literal(30),bFrames:z41.literal(0),audioPolicy:z41.enum(["SILENT","MIXED"]),captionPolicy:z41.enum(["NONE","BURN_IN"]),sourceQualityPolicy:z41.literal("NO_UPSCALE_V1"),captionStyle:CaptionRenderStyleSchema.optional(),graphicsPolicy:z41.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 z42}from"zod";var RoughCutProfileIdSchema=z42.enum(["PREVIEW_H264_480P_V1","PREVIEW_H264_720P_V1","PREVIEW_H264_1080P_V1"]);var RoughCutProfileSchema=z42.strictObject({captionPolicy:z42.literal("BURN_IN").optional(),captionStyle:CaptionRenderStyleSchema.optional(),graphicsPolicy:z42.literal("OVERLAY_V1").optional(),id:RoughCutProfileIdSchema,algorithm:z42.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),picturePolicy:PicturePolicySchema.optional(),width:z42.union([z42.literal(854),z42.literal(480),z42.literal(1280),z42.literal(720),z42.literal(1920),z42.literal(1080)]),height:z42.union([z42.literal(854),z42.literal(480),z42.literal(1280),z42.literal(720),z42.literal(1920),z42.literal(1080)]),frameRate:z42.literal(30),codec:z42.literal("h264"),pixelFormat:z42.literal("yuv420p"),fit:z42.literal("PAD"),hasAudio:z42.boolean(),audioMix:AudioMixProfileSchema.optional(),framePolicy:z42.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 z43}from"zod";var RoughCutManifestSchema=z43.strictObject({schemaVersion:z43.literal(1),timeline:TimelineVersionSchema,profile:RoughCutProfileSchema,frames:z43.array(z43.strictObject({ordinal:z43.int().positive().max(200),startFrame:z43.int().nonnegative().max(1800),frameCount:z43.int().positive().max(1800),overlapFrames:z43.int().nonnegative().max(30).default(0)})).min(1).max(200),totalFrames:z43.int().min(900).max(1800)});import{z as z44}from"zod";var dynamicPolicy=z44.literal("STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1");var VisualLayerPreviewProfileSchema=RoughCutProfileSchema.safeExtend({visualLayerPolicy:dynamicPolicy});var VisualLayerFinalProfileSchema=FinalRenderProfileSchema.safeExtend({visualLayerPolicy:dynamicPolicy,visualLayerSourceQualityPolicy:z44.literal("NO_UPSCALE_V1")});var shape={schemaVersion:z44.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=z44.union([VisualLayerPreviewManifestSchema,VisualLayerFinalManifestSchema]);import{z as z45}from"zod";var DeviceRenderTargetSchema=z45.strictObject({mode:z45.literal("tenant-device-only"),deviceId:z45.uuid().optional()});var DeviceRenderReceiptSchema=z45.strictObject({mode:z45.literal("tenant-device-only"),deviceId:z45.uuid(),runtimeJobId:z45.uuid()});import{z as z46}from"zod";var sha7=z46.string().regex(/^[0-9a-f]{64}$/);var DecideFinalReadySchema=TimelineScopeSchema.extend({renderId:z46.uuid(),reviewId:z46.uuid(),basisFingerprint:sha7,action:z46.enum(["SELECT","REJECT"]),acknowledgeWarnings:z46.boolean().default(false),expectedProductionRevision:z46.int().positive(),expectedFinalReadyVersion:z46.int().nonnegative(),reason:z46.string().trim().min(1).max(2500),idempotencyKey:z46.string().trim().min(1).max(200)});var RevokeFinalReadySchema=TimelineScopeSchema.extend({selectionId:z46.uuid(),expectedFinalReadyVersion:z46.int().positive(),expectedProductionRevision:z46.int().positive(),reason:z46.string().trim().min(1).max(2500),idempotencyKey:z46.string().trim().min(1).max(200)});var FinalReadyDecisionSchema=TimelineScopeSchema.extend({id:z46.uuid(),projectId:ProjectIdSchema,version:z46.int().positive(),action:z46.enum(["SELECT","REJECT","REVOKE"]),renderId:z46.uuid(),reviewId:z46.uuid(),basisFingerprint:sha7,timelineVersionId:z46.uuid(),timelineFingerprint:sha7,artifactId:z46.uuid(),representationId:z46.uuid(),checksumSha256:sha7,outputProfile:DeliveryOutputProfileSchema,executionClass:z46.enum(["LIVE","TEST_ONLY"]),previousSelectionId:z46.uuid().nullable(),acknowledgeWarnings:z46.boolean(),warningKeys:z46.array(z46.string()).max(300),reason:z46.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z46.iso.datetime({offset:true})});var FinalReadyViewSchema=TimelineScopeSchema.extend({version:z46.int().nonnegative(),status:z46.enum(["NONE","CURRENT","STALE"]),selection:FinalReadyDecisionSchema.nullable(),staleReasons:z46.array(z46.string()).max(24)});var FinalReadyQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var FinalReadyPageSchema=z46.strictObject({items:z46.array(FinalReadyDecisionSchema),page:QueryPageInfoSchema});var FinalReadyReceiptSchema=z46.strictObject({semanticStatus:z46.literal("SUCCESS"),decision:FinalReadyDecisionSchema,productionRevision:z46.int().positive()});var RoughCutReviewSnapshotSchema=z46.strictObject({currentRenderId:z46.uuid().nullable(),latestReviewId:z46.uuid().nullable(),reviewVersion:z46.int().nonnegative(),result:z46.enum(["PASS","WARNING","FAIL"]).nullable(),current:z46.boolean(),inspectable:z46.boolean(),executionClass:z46.enum(["LIVE","TEST_ONLY"]).nullable(),findings:z46.strictObject({open:z46.int().nonnegative(),blocking:z46.int().nonnegative(),warnings:z46.int().nonnegative()}),finalReady:FinalReadyViewSchema,latestDecision:FinalReadyDecisionSchema.nullable()});import{z as z47}from"zod";var sha8=z47.string().regex(/^[0-9a-f]{64}$/);var RoughCutStartSchema=TimelineScopeSchema.extend({deviceExecution:DeviceRenderTargetSchema.optional(),timelineVersionId:z47.uuid(),timelineFingerprint:sha8,expectedProductionRevision:z47.int().positive(),profileId:RoughCutProfileIdSchema,idempotencyKey:z47.string().trim().min(1).max(200)});var RoughCutGetSchema=TimelineScopeSchema.extend({renderId:z47.uuid()});var RoughCutQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutV2ManifestSchema=RoughCutManifestSchema.extend({schemaVersion:z47.literal(2),timeline:TimelineV2VersionSchema});var RoughCutManifestReaderSchema=z47.discriminatedUnion("schemaVersion",[RoughCutManifestSchema,RoughCutV2ManifestSchema,VisualLayerPreviewManifestSchema]);var RoughCutTechnicalSchema=VideoTechnicalMetadataSchema.extend({hasAudio:z47.boolean(),audio:RenderedAudioSchema.optional(),durationMs:z47.int().min(29983).max(60017),frameRate:z47.literal(30),frameCount:z47.int().min(900).max(1800),engineVersion:z47.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:z47.uuid(),representationId:z47.uuid(),version:z47.int().positive(),poster:VideoPosterSchema,availability:z47.enum(["AVAILABLE","INVALID"]),reviewState:z47.enum(["UNREVIEWED","PASS","WARNING","FAIL"])});var RoughCutAdmissionSchema=z47.strictObject({deviceExecution:DeviceRenderReceiptSchema.optional(),semanticStatus:z47.literal("ACCEPTED"),renderId:z47.uuid(),operationId:OperationIdSchema,productionId:z47.uuid(),timelineVersionId:z47.uuid(),timelineFingerprint:sha8,executionClass:z47.enum(["LIVE","TEST_ONLY"]),manifestFingerprint:sha8,productionRevision:z47.int().positive()});var RoughCutViewSchema=TimelineScopeSchema.extend({renderId:z47.uuid(),projectId:ProjectIdSchema,runtimeJobId:z47.uuid(),operationId:OperationIdSchema,manifest:RoughCutManifestReaderSchema,manifestFingerprint:sha8,runtimeStatus:VideoGenerationViewSchema.shape.runtimeStatus,cancellationRequested:z47.boolean(),isCurrentTimeline:z47.boolean(),freshness:z47.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z47.array(z47.string().min(1).max(120)).max(16),executionClass:z47.enum(["LIVE","TEST_ONLY"]),roughCut:RoughCutArtifactSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z47.iso.datetime({offset:true})});var RoughCutPageSchema=z47.strictObject({items:z47.array(RoughCutViewSchema),page:QueryPageInfoSchema});var RoughCutSnapshotSchema=z47.strictObject({latestVersion:z47.int().positive().nullable(),reviewState:z47.enum(["UNREVIEWED","PASS","WARNING","FAIL"]).nullable(),latestRenderId:z47.uuid().nullable(),runtimeStatus:VideoGenerationViewSchema.shape.runtimeStatus.nullable(),currentRenderId:z47.uuid().nullable(),currentArtifactId:z47.uuid().nullable(),currentTimelineVersionId:z47.uuid().nullable(),stale:z47.boolean()});import{z as z48}from"zod";var sha9=z48.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:z48.uuid(),expectedFinalReadyVersion:z48.int().positive(),timelineVersionId:z48.uuid(),timelineFingerprint:sha9,expectedProductionRevision:z48.int().positive(),profileId:FinalRenderProfileIdSchema,audioPolicy:z48.enum(["SILENT","MIXED"]),captionPolicy:z48.enum(["NONE","BURN_IN"]),idempotencyKey:z48.string().trim().min(1).max(200)});var FinalRenderGetSchema=RoughCutGetSchema;var FinalRenderQuerySchema=RoughCutQuerySchema;var finalManifestShape={selection:FinalReadyDecisionSchema.refine(v=>v.action==="SELECT"),selectionVersion:z48.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=z48.discriminatedUnion("schemaVersion",[FinalRenderManifestSchema,FinalRenderV2ManifestSchema,FinalRenderV3ManifestSchema]);var FinalRenderTechnicalSchema=RoughCutTechnicalSchema;var FinalRenderArtifactSchema=RoughCutArtifactSchema.safeExtend({reviewState:z48.literal("UNREVIEWED"),deliveryRole:z48.literal("NONE")});var FinalRenderAdmissionSchema=RoughCutAdmissionSchema.extend({selectionId:z48.uuid(),selectionVersion:z48.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:z48.array(z48.string().min(1).max(120)).max(24)});var FinalRenderPageSchema=z48.strictObject({items:z48.array(FinalRenderViewSchema).max(200),page:QueryPageInfoSchema});var FinalRenderSourceBlockerSchema=z48.strictObject({code:z48.enum(["SOURCE_RESOLUTION_INSUFFICIENT","SOURCE_MEDIA_UNSUPPORTED"]),shotId:z48.uuid(),ordinal:z48.int().positive().max(200),actualWidth:z48.int().positive().max(4096),actualHeight:z48.int().positive().max(4096),requiredWidth:z48.int().positive().max(4096),requiredHeight:z48.int().positive().max(4096)});var FinalRenderEligibilitySchema=TimelineScopeSchema.extend({productionRevision:z48.int().positive(),finalReady:FinalReadyViewSchema,profile:z48.union([FinalRenderProfileSchema,VisualLayerFinalProfileSchema]).nullable(),renderable:z48.boolean(),blockers:z48.array(z48.string().min(1).max(120)).max(24),sourceBlockers:z48.array(FinalRenderSourceBlockerSchema).max(200),supportedAudioPolicy:z48.enum(["SILENT","MIXED"]),supportedCaptionPolicy:z48.enum(["NONE","BURN_IN"])});var FinalRenderSnapshotSchema=z48.strictObject({latestRenderId:z48.uuid().nullable(),runtimeStatus:RoughCutViewSchema.shape.runtimeStatus.nullable(),currentRenderId:z48.uuid().nullable(),currentArtifactId:z48.uuid().nullable(),stale:z48.boolean(),eligibility:FinalRenderEligibilitySchema});import{z as z49}from"zod";var TemporalEvidenceReferenceSchema=z49.strictObject({evidenceId:z49.uuid(),frameSetArtifactId:z49.uuid(),contactSheetArtifactId:z49.uuid(),manifestRepresentationId:z49.uuid(),sheetRepresentationId:z49.uuid(),planFingerprint:z49.string().regex(/^[0-9a-f]{64}$/),sourceArtifactId:z49.uuid(),sourceRepresentationId:z49.uuid(),sourceChecksumSha256:z49.string().regex(/^[0-9a-f]{64}$/),timestampsMs:z49.array(z49.number().nonnegative().max(6e4)).min(1).max(64),executionClass:z49.enum(["LIVE","TEST_ONLY"])});var TemporalEvidenceIdsSchema=z49.array(z49.uuid()).min(1).max(8).refine(v=>new Set(v).size===v.length,"Evidence references must be unique");import{z as z50}from"zod";var ListeningEvidenceIdsSchema=z50.array(z50.string().min(1).max(100)).max(64);var ListeningEvidenceSchema=z50.strictObject({id:z50.string().trim().min(1).max(100),kind:z50.enum(["AUDIO_LISTENING","VIDEO_WITH_AUDIO_PLAYBACK"]),media:z50.strictObject({artifactId:z50.uuid(),representationId:z50.uuid(),checksumSha256:z50.string().regex(/^[0-9a-f]{64}$/)}),coverage:z50.array(z50.strictObject({startMs:z50.int().nonnegative().max(6e4),endMs:z50.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs)).min(1).max(200),producer:z50.string().trim().min(1).max(200)});var ListeningEvidenceSetSchema=z50.array(ListeningEvidenceSchema).max(64).refine(v=>new Set(v.map(e=>e.id)).size===v.length);import{z as z51}from"zod";var sha10=z51.string().regex(/^[0-9a-f]{64}$/);var CompositionFindingLocalitySchema=z51.strictObject({schemaVersion:z51.literal(1),sourceKind:z51.literal("CODE"),role:z51.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),compositionId:z51.uuid(),compositionVersionId:z51.uuid(),compositionVersion:z51.int().positive(),compositionFingerprint:sha10,renderId:z51.uuid(),renderManifestFingerprint:sha10,artifactId:z51.uuid(),representationId:z51.uuid(),checksumSha256:sha10,clipOrdinal:z51.int().min(1).max(200).nullable(),visualLayerId:z51.uuid().nullable(),sourceInFrame:z51.int().min(0).max(359),sourceOutFrame:z51.int().min(1).max(360),mapping:z51.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 z52}from"zod";var CanonicalFactSchema=z52.strictObject({key:z52.string().regex(/^[A-Z][A-Z0-9_]{1,59}$/),value:z52.string().trim().min(1).max(300),sourceArtifactId:ArtifactIdSchema,evidence:z52.discriminatedUnion("kind",[z52.strictObject({kind:z52.literal("JSON_POINTER"),pointer:z52.string().startsWith("/").max(200)}),z52.strictObject({kind:z52.literal("EXACT_TEXT_LINE")})])});var BriefContentSchema=z52.strictObject({objective:z52.string().trim().min(1).max(1e3),productPresentationGoal:z52.string().trim().min(1).max(1e3),audience:z52.string().trim().min(1).max(300).optional(),styleTone:z52.string().trim().min(1).max(300).optional(),callToAction:z52.string().trim().min(1).max(300).optional(),targetDurationSeconds:z52.int().min(30).max(60),aspectRatio:z52.enum(["16:9","9:16"]),outputProfile:DeliveryOutputProfileSchema,canonicalFacts:z52.array(CanonicalFactSchema).max(32).default([])});var AcceptBriefRequestSchema=z52.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z52.int().positive(),revisionReason:z52.string().trim().min(1).max(1e3).optional(),sourceArtifactIds:z52.array(ArtifactIdSchema).max(20).default([]),content:BriefContentSchema});var BriefSourceReferenceSchema=z52.strictObject({artifactId:ArtifactIdSchema,checksumSha256:z52.string().regex(/^[0-9a-f]{64}$/)});var BriefVersionSchema=z52.strictObject({id:BriefVersionIdSchema,briefId:BriefIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z52.int().positive(),content:BriefContentSchema,sources:z52.array(BriefSourceReferenceSchema).min(1).max(20),createdByPrincipalId:PrincipalIdSchema,createdAt:z52.iso.datetime({offset:true})});var AcceptBriefResultSchema=z52.discriminatedUnion("semanticStatus",[z52.strictObject({semanticStatus:z52.literal("SUCCESS"),briefVersion:BriefVersionSchema,productionRevision:z52.int().positive(),activeBriefVersion:z52.int().positive()}),z52.strictObject({semanticStatus:z52.literal("NEEDS_INPUT"),missingFacts:z52.array(z52.enum(["PRODUCT_INFORMATION_SOURCE","PRODUCT_NAME"])).min(1)})]);import{z as z53}from"zod";var StoryFactKeySchema=z53.string().regex(/^[A-Z][A-Z0-9_]{1,59}$/);var StoryFactClaimSchema=z53.strictObject({key:StoryFactKeySchema,value:z53.string().trim().min(1).max(300)});var StoryBeatSchema=z53.strictObject({summary:z53.string().trim().min(1).max(600),sceneRequirements:z53.array(z53.string().trim().min(1).max(300)).max(8).default([])});var StoryContentSchema=z53.strictObject({narrativeIntent:z53.string().trim().min(1).max(2e3),beats:z53.array(StoryBeatSchema).min(1).max(24),factualClaims:z53.array(StoryFactClaimSchema).max(32).default([])});var AcceptStoryRequestSchema=z53.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z53.int().positive(),expectedBriefVersion:z53.int().positive(),revisionReason:z53.string().trim().min(1).max(1e3).optional(),idempotencyKey:z53.string().trim().min(1).max(200),content:StoryContentSchema});var StoryVersionSchema=z53.strictObject({id:StoryVersionIdSchema,storyId:StoryIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z53.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z53.int().positive(),content:StoryContentSchema,createdByPrincipalId:PrincipalIdSchema,createdAt:z53.iso.datetime({offset:true})});var AcceptStoryResultSchema=z53.discriminatedUnion("semanticStatus",[z53.strictObject({semanticStatus:z53.literal("SUCCESS"),storyVersion:StoryVersionSchema,productionRevision:z53.int().positive(),activeStoryVersion:z53.int().positive()}),z53.strictObject({semanticStatus:z53.literal("NEEDS_INPUT"),missingPrerequisites:z53.array(z53.literal("ACTIVE_BRIEF")).min(1)})]);import{z as z54}from"zod";var ConsistencyFamilySchema=z54.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","BOUNDARY_CONTINUITY","STYLE","VOICE_IDENTITY"]);var ConsistencyEnforcementSchema=z54.enum(["LOCKED","REQUIRED","PREFERRED","FREE"]);var ConsistencyMasterReferenceSchema=z54.strictObject({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:z54.string().regex(/^[0-9a-f]{64}$/),artifactChecksumSha256:z54.string().regex(/^[0-9a-f]{64}$/),contentType:z54.enum(["image/png","image/jpeg","image/webp","audio/wav"])});var Fact=z54.strictObject({dimension:z54.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),value:z54.string().trim().min(1).max(1e3)});var ConsistencySubjectSchema=z54.strictObject({id:z54.uuid(),kind:z54.enum(["CHARACTER","VOICE"]),displayName:z54.string().trim().min(1).max(200),facts:z54.array(Fact).min(1).max(32),master:ConsistencyMasterReferenceSchema}).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"})});var ConsistencyRuleScopeSchema=z54.discriminatedUnion("kind",[z54.strictObject({kind:z54.literal("PROJECT")}),z54.strictObject({kind:z54.literal("PRODUCTION")}),z54.strictObject({kind:z54.literal("SCENE"),id:z54.uuid()}),z54.strictObject({kind:z54.literal("SHOT"),id:z54.uuid()}),z54.strictObject({kind:z54.literal("CONTINUITY_EDGE"),id:z54.uuid()})]);var ConsistencyRuleSchema=z54.strictObject({reviewScales:z54.array(ConsistencyReviewScaleSchema).min(1).max(3).refine(s=>new Set(s).size===s.length,"Review scales must be unique").optional(),continuity:ContinuityExpectationSchema.optional(),id:z54.uuid(),family:ConsistencyFamilySchema,subjectId:z54.uuid().nullable(),dimension:z54.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),scope:ConsistencyRuleScopeSchema,enforcement:ConsistencyEnforcementSchema,expected:z54.string().trim().min(1).max(1e3).nullable(),referenceMode:z54.enum(["NONE","SUBJECT_MASTER","EXACT"]),reference:ConsistencyMasterReferenceSchema.optional(),override:z54.strictObject({priorRuleId:z54.uuid(),reason:z54.string().trim().min(1).max(1e3)}).optional(),transition:z54.strictObject({edgeId:z54.uuid(),from:z54.string().trim().min(1).max(1e3),to:z54.string().trim().min(1).max(1e3),reason:z54.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.reviewScales)invalid("Native Voice review remains inactive");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=z54.strictObject({subjects:z54.array(ConsistencySubjectSchema).max(32),rules:z54.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");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(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=z54.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var ConsistencyProfileVersionQuerySchema=ConsistencyProfileScopeSchema.extend({profileId:z54.uuid()});var ConfigureConsistencyProfileSchema=ConsistencyProfileScopeSchema.extend({expectedProductionRevision:z54.int().positive(),expectedProfileVersion:z54.int().nonnegative(),content:ConsistencyProfileContentSchema,reason:z54.string().trim().min(1).max(2e3),idempotencyKey:z54.string().trim().min(1).max(200)});var ConsistencyProfileVersionSchema=ConsistencyProfileScopeSchema.extend({id:z54.uuid(),projectId:ProjectIdSchema,version:z54.int().positive(),previousVersionId:z54.uuid().nullable(),content:ConsistencyProfileContentSchema,fingerprint:z54.string().regex(/^[0-9a-f]{64}$/),reason:z54.string().trim().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z54.iso.datetime({offset:true})});var ConsistencyProfileViewSchema=ConsistencyProfileScopeSchema.extend({productionRevision:z54.int().positive(),current:ConsistencyProfileVersionSchema.nullable()});var ConsistencyProfileReceiptSchema=z54.strictObject({semanticStatus:z54.literal("SUCCESS"),profile:ConsistencyProfileVersionSchema,productionRevision:z54.int().positive()});import{z as z55}from"zod";var sha11=z55.string().regex(/^[0-9a-f]{64}$/);var RoughCutReviewScopeSchema=TimelineScopeSchema.extend({renderId:z55.uuid()});var ReviewIntervalSchema=z55.strictObject({startMs:z55.int().nonnegative().max(6e4),endMs:z55.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Review interval must advance");var RoughCutRequirementSchema=z55.strictObject({continuity:ContinuityExpectationSchema.optional(),consistencyScale:ConsistencyReviewScaleSchema.optional(),consistencyFamily:z55.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","BOUNDARY_CONTINUITY"]).optional(),consistencySubject:ConsistencySubjectSchema.optional(),consistencyReference:ConsistencyMasterReferenceSchema.optional(),key:z55.string().min(1).max(220),dimension:z55.enum(["PRODUCT_PRESENTATION","CANONICAL_FACT","NARRATIVE","PACING","REPETITION","STYLE","TECHNICAL","TRANSITION"]),expected:z55.string().min(1).max(4e3),enforcement:z55.enum(["LOCKED","REQUIRED","PREFERRED"]),scope:z55.enum(["PRODUCTION","TRANSITION"]),interval:ReviewIntervalSchema,shotIds:z55.array(z55.uuid()).min(1).max(200)});var RoughCutObservationSchema=z55.strictObject({listeningEvidenceIds:ListeningEvidenceIdsSchema.optional(),continuitySamples:ContinuitySamplesSchema.optional(),temporalEvidenceIds:TemporalEvidenceIdsSchema.optional(),key:z55.string().min(1).max(220),status:z55.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z55.enum(["CLEAR","UNCERTAIN"]),observed:z55.string().trim().min(1).max(1800),interval:ReviewIntervalSchema,location:z55.strictObject({interval:ReviewIntervalSchema,shotIds:z55.array(z55.uuid()).min(1).max(200)}).optional()});var RoughCutInspectionSchema=z55.strictObject({actor:z55.enum(["HUMAN","EXTERNAL_AGENT"]),method:z55.literal("FULL_TEMPORAL_INSPECTION"),coverage:z55.array(ReviewIntervalSchema).min(1).max(200)});var RoughCutReviewBasisSchema=z55.strictObject({consistencyRequirements:z55.array(RoughCutRequirementSchema).max(256).optional(),artifactId:z55.uuid(),representationId:z55.uuid(),checksumSha256:sha11,manifestFingerprint:sha11,manifest:RoughCutManifestReaderSchema,brief:BriefVersionSchema,story:StoryVersionSchema});var RecordRoughCutReviewSchema=RoughCutReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),artifactId:z55.uuid(),representationId:z55.uuid(),checksumSha256:sha11,basisFingerprint:sha11,expectedProductionRevision:z55.int().positive(),expectedReviewVersion:z55.int().nonnegative(),idempotencyKey:z55.string().trim().min(1).max(200),inspection:RoughCutInspectionSchema,observations:z55.array(RoughCutObservationSchema).min(1).max(300),summary:z55.string().trim().min(1).max(2500)});var RoughCutReviewRecordSchema=RoughCutReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),id:z55.uuid(),projectId:ProjectIdSchema,version:z55.int().positive(),kind:z55.literal("PRODUCTION_REVIEW_2"),lifecycle:z55.literal("COMPLETED"),evaluatorVersion:z55.literal("production-review-v1"),basis:RoughCutReviewBasisSchema,basisFingerprint:sha11,executionClass:z55.enum(["LIVE","TEST_ONLY"]),technical:RoughCutTechnicalSchema,durationMs:z55.int().min(3e4).max(6e4),requirements:z55.array(RoughCutRequirementSchema).min(1).max(300),inspection:RoughCutInspectionSchema,observations:z55.array(RoughCutObservationSchema).min(1).max(300),result:z55.enum(["PASS","WARNING","FAIL"]),blockingKeys:z55.array(z55.string()).max(300),warningKeys:z55.array(z55.string()).max(300),summary:z55.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z55.iso.datetime({offset:true})});var RoughCutReviewTargetSchema=RoughCutReviewScopeSchema.extend({temporalEvidence:z55.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,productionRevision:z55.int().positive(),productionRunnable:z55.boolean(),executionClass:z55.enum(["LIVE","TEST_ONLY"]),freshness:z55.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z55.array(z55.string()).max(18),inspectable:z55.boolean(),durationMs:z55.int().min(3e4).max(6e4),basis:RoughCutReviewBasisSchema,basisFingerprint:sha11,technical:RoughCutTechnicalSchema,requirements:z55.array(RoughCutRequirementSchema).min(1).max(300),latestReview:RoughCutReviewRecordSchema.nullable(),reviewVersion:z55.int().nonnegative(),finalReadyVersion:z55.int().nonnegative()});var RoughCutFindingSchema=RoughCutReviewScopeSchema.extend({compositionLocality:z55.array(CompositionFindingLocalitySchema).min(1).max(208).optional(),id:z55.uuid(),projectId:ProjectIdSchema,reviewId:z55.uuid(),reviewVersion:z55.int().positive(),basisFingerprint:sha11,artifactId:z55.uuid(),timelineVersionId:z55.uuid(),requirement:RoughCutRequirementSchema,observation:RoughCutObservationSchema,blocking:z55.boolean(),severity:z55.enum(["BLOCKING","WARNING"]),remediation:z55.enum(["REVISE_PRODUCTION","REVISE_TRANSITION","CORRECT_CANONICAL_CONTRADICTION"]),affectedScope:z55.strictObject({kind:z55.enum(["PRODUCTION","SHOT","TRANSITION","TIMELINE_REGION"]),interval:ReviewIntervalSchema,shotIds:z55.array(z55.uuid()).min(1).max(200)}),initialLifecycle:z55.literal("OPEN"),createdAt:z55.iso.datetime({offset:true})});var RoughCutFindingViewSchema=RoughCutFindingSchema.extend({lifecycle:z55.enum(["OPEN","REMEDIATION_PLANNED","RESOLVED","WAIVED","SUPERSEDED"]),proofReviewId:z55.uuid().nullable(),proofDecisionId:z55.uuid().nullable()});var RoughCutReviewQuerySchema=RoughCutReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutReviewPageSchema=z55.strictObject({items:z55.array(RoughCutReviewRecordSchema),page:QueryPageInfoSchema});var RoughCutFindingQuerySchema=TimelineScopeSchema.extend({renderId:z55.uuid().optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutFindingGetSchema=TimelineScopeSchema.extend({findingId:z55.uuid()});var RoughCutFindingPageSchema=z55.strictObject({items:z55.array(RoughCutFindingViewSchema),page:QueryPageInfoSchema});var RoughCutReviewReceiptSchema=z55.strictObject({semanticStatus:z55.literal("SUCCESS"),review:RoughCutReviewRecordSchema,findingIds:z55.array(z55.uuid()).max(300),productionRevision:z55.int().positive()});var MAX_SHOT_REVIEW_REQUIREMENTS=2200;import{z as z56}from"zod";var Fingerprint3=z56.string().regex(/^[0-9a-f]{64}$/);var KeyframeReviewScopeSchema=z56.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:z56.uuid()});var VisualRequirementSchema=z56.strictObject({intentPath:z56.string().min(1).max(220).optional(),key:z56.string().min(1).max(200),expected:z56.string().min(1).max(2500),enforcement:z56.enum(["LOCKED","REQUIRED","PREFERRED"])});var Region=z56.strictObject({x:z56.number().min(0).max(1),y:z56.number().min(0).max(1),width:z56.number().positive().max(1),height:z56.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=z56.strictObject({key:z56.string().min(1).max(200),status:z56.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z56.enum(["CLEAR","UNCERTAIN"]),observed:z56.string().trim().min(1).max(1500),region:Region.optional()});var RecordKeyframeReviewSchema=KeyframeReviewScopeSchema.extend({candidateId:z56.uuid(),representationId:z56.uuid(),checksumSha256:Fingerprint3,expectedReviewVersion:z56.int().nonnegative(),idempotencyKey:z56.string().trim().min(1).max(200),observations:z56.array(KeyframeObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z56.string().trim().min(1).max(2e3)});var KeyframeReviewRecordSchema=z56.strictObject({id:z56.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,generationId:z56.uuid(),candidateId:z56.uuid(),artifactId:z56.uuid(),representationId:z56.uuid(),checksumSha256:Fingerprint3,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,version:z56.int().positive(),preparationId:z56.uuid(),contractId:z56.uuid(),contractFingerprint:Fingerprint3,executionClass:z56.enum(["LIVE","TEST_ONLY"]),kind:z56.literal("KEYFRAME_REFERENCE"),lifecycle:z56.literal("COMPLETED"),evaluatorVersion:z56.literal("keyframe-reference-v1"),source:z56.literal("EXPLICIT_VISUAL_INSPECTION"),requirements:z56.array(VisualRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z56.array(KeyframeObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z56.enum(["PASS","WARNING","FAIL"]),blockingKeys:z56.array(z56.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z56.array(z56.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z56.string().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z56.iso.datetime({offset:true})});var DecideKeyframeSchema=KeyframeReviewScopeSchema.extend({candidateId:z56.uuid(),reviewId:z56.uuid(),expectedSelectionVersion:z56.int().nonnegative(),action:z56.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z56.boolean().default(false),reason:z56.string().trim().min(1).max(2e3),idempotencyKey:z56.string().trim().min(1).max(200)});var KeyframeReferenceScopeSchema=z56.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema});var RevokeKeyframeSchema=KeyframeReferenceScopeSchema.extend({acceptanceId:z56.uuid(),expectedSelectionVersion:z56.int().positive(),reason:z56.string().trim().min(1).max(2e3),idempotencyKey:z56.string().trim().min(1).max(200)});var KeyframeDecisionRecordSchema=z56.strictObject({id:z56.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,selectionVersion:z56.int().positive(),generationId:z56.uuid(),candidateId:z56.uuid(),reviewId:z56.uuid(),action:z56.enum(["ACCEPT","REJECT","REVOKE"]),reference:AcceptedKeyframeReferenceSchema.nullable(),previousAcceptanceId:z56.uuid().nullable(),warningKeys:z56.array(z56.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z56.boolean(),reason:z56.string().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z56.iso.datetime({offset:true})});var KeyframeReviewTargetSchema=KeyframeReviewScopeSchema.extend({projectId:ProjectIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,preparationId:z56.uuid(),contractId:z56.uuid(),contractFingerprint:Fingerprint3,executionClass:z56.enum(["LIVE","TEST_ONLY"]),freshness:z56.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z56.boolean(),productionRunnable:z56.boolean(),candidate:KeyframeCandidateSchema,requirements:z56.array(VisualRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:KeyframeReviewRecordSchema.nullable(),reviewVersion:z56.int().nonnegative(),selectionVersion:z56.int().nonnegative(),activeAcceptanceId:z56.uuid().nullable()});var KeyframeReferenceViewSchema=KeyframeReferenceScopeSchema.extend({selectionVersion:z56.int().nonnegative(),status:z56.enum(["NONE","CURRENT","STALE"]),acceptance:KeyframeDecisionRecordSchema.nullable(),reference:AcceptedKeyframeReferenceSchema.nullable()});var KeyframeReviewQuerySchema=KeyframeReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeReviewPageSchema=z56.strictObject({items:z56.array(KeyframeReviewRecordSchema),page:QueryPageInfoSchema});var KeyframeReviewReceiptSchema=z56.strictObject({semanticStatus:z56.literal("SUCCESS"),review:KeyframeReviewRecordSchema,productionRevision:z56.int().positive()});var KeyframeDecisionReceiptSchema=z56.strictObject({semanticStatus:z56.literal("SUCCESS"),decision:KeyframeDecisionRecordSchema,productionRevision:z56.int().positive()});var KeyframeDecisionQuerySchema=KeyframeReferenceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeDecisionPageSchema=z56.strictObject({items:z56.array(KeyframeDecisionRecordSchema),page:QueryPageInfoSchema});var KeyframeReviewSummarySchema=z56.strictObject({reviewedCandidates:z56.int().nonnegative(),unreviewedCandidates:z56.int().nonnegative(),decisionCount:z56.int().nonnegative()});import{z as z57}from"zod";var Intent=z57.string().trim().min(1).max(300);var CameraIntentSchema=z57.strictObject({scale:z57.enum(["EXTREME_CLOSE_UP","CLOSE_UP","MEDIUM","WIDE","EXTREME_WIDE"]),framing:z57.enum(["CENTERED","OFF_CENTER","SYMMETRICAL","OVER_SHOULDER"]),angle:z57.enum(["EYE_LEVEL","HIGH","LOW","TOP_DOWN"]),movement:z57.enum(["STATIC","PAN","TILT","DOLLY","TRACK","ORBIT","CRANE","ZOOM"]),stability:z57.enum(["LOCKED","STABILIZED","HANDHELD"]),direction:z57.enum(["LEFT","RIGHT","UP","DOWN","FORWARD","BACKWARD","CLOCKWISE","COUNTERCLOCKWISE"]).optional(),lensIntent:z57.string().trim().min(1).max(120).optional()});var ShotTemporalBeatSchema=z57.strictObject({startSeconds:z57.number().min(0).max(30),endSeconds:z57.number().positive().max(30),action:Intent});var ShotDirectionSchema=z57.strictObject({camera:CameraIntentSchema,temporalBeats:z57.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 z58}from"zod";var PlanningClientKeySchema=z58.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/);var BoundaryRequirementSchema=z58.strictObject({attribute:z58.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,59}$/),value:z58.string().trim().min(1).max(300)});var ShotIntentSchema=z58.strictObject({narrativePurpose:z58.string().trim().min(1).max(600),subjectAction:z58.string().trim().min(1).max(600),targetDurationSeconds:z58.number().min(.5).max(30),subjectRequirements:z58.array(z58.string().trim().min(1).max(300)).max(16).default([]),cameraComposition:z58.string().trim().min(1).max(500).optional(),factualClaims:z58.array(StoryFactClaimSchema).max(16).default([]),requiresGeneratedKeyframe:z58.boolean().default(false),sourceMediaAllowed:z58.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=z58.strictObject({clientKey:PlanningClientKeySchema,shotId:ShotIdSchema.optional(),intent:ShotIntentSchema,entryBoundary:z58.array(BoundaryRequirementSchema).max(24).default([]),exitBoundary:z58.array(BoundaryRequirementSchema).max(24).default([])});var ScenePlanInputSchema=z58.strictObject({clientKey:PlanningClientKeySchema,sceneId:SceneIdSchema.optional(),purpose:z58.string().trim().min(1).max(800),locationContext:z58.string().trim().min(1).max(300).optional(),timeContext:z58.string().trim().min(1).max(300).optional(),entryBoundary:z58.array(BoundaryRequirementSchema).max(24).default([]),exitBoundary:z58.array(BoundaryRequirementSchema).max(24).default([]),shots:z58.array(ShotPlanInputSchema).min(1).max(24)});var ContinuityRequirementSchema=z58.strictObject({mode:z58.enum(["PERSIST","TRANSITION","REESTABLISH","REVIEW"]),attribute:z58.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,59}$/),description:z58.string().trim().min(1).max(500)});var ContinuityEdgeInputSchema=z58.strictObject({fromShotKey:PlanningClientKeySchema,toShotKey:PlanningClientKeySchema,requirements:z58.array(ContinuityRequirementSchema).min(1).max(24)});var AcceptSceneShotPlanRequestSchema=z58.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z58.int().positive(),expectedStoryVersion:z58.int().positive(),revisionReason:z58.string().trim().min(1).max(1e3).optional(),idempotencyKey:z58.string().trim().min(1).max(200),scenes:z58.array(ScenePlanInputSchema).min(1).max(12),continuityEdges:z58.array(ContinuityEdgeInputSchema).max(64).default([])});var ShotPlanEntrySchema=z58.strictObject({shotId:ShotIdSchema,clientKey:PlanningClientKeySchema,ordinal:z58.int().positive(),planningRevision:z58.int().positive(),intent:ShotIntentSchema,entryBoundary:z58.array(BoundaryRequirementSchema).max(24),exitBoundary:z58.array(BoundaryRequirementSchema).max(24)});var ScenePlanEntrySchema=z58.strictObject({sceneId:SceneIdSchema,clientKey:PlanningClientKeySchema,ordinal:z58.int().positive(),purpose:z58.string().trim().min(1).max(800),locationContext:z58.string().trim().min(1).max(300).optional(),timeContext:z58.string().trim().min(1).max(300).optional(),entryBoundary:z58.array(BoundaryRequirementSchema).max(24),exitBoundary:z58.array(BoundaryRequirementSchema).max(24),shots:z58.array(ShotPlanEntrySchema).min(1).max(24)});var ContinuityEdgeSchema=z58.strictObject({id:ContinuityEdgeIdSchema,fromShotId:ShotIdSchema,toShotId:ShotIdSchema,requirements:z58.array(ContinuityRequirementSchema).min(1).max(24)});var SceneShotPlanVersionSchema=z58.strictObject({id:SceneShotPlanVersionIdSchema,planId:SceneShotPlanIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z58.int().positive(),storyVersionId:StoryVersionIdSchema,storyVersion:z58.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z58.int().positive(),scenes:z58.array(ScenePlanEntrySchema).min(1).max(12),continuityEdges:z58.array(ContinuityEdgeSchema).max(64),createdByPrincipalId:PrincipalIdSchema,createdAt:z58.iso.datetime({offset:true})});var AcceptSceneShotPlanResultSchema=z58.discriminatedUnion("semanticStatus",[z58.strictObject({semanticStatus:z58.literal("SUCCESS"),planVersion:SceneShotPlanVersionSchema,productionRevision:z58.int().positive(),activeSceneShotPlanVersion:z58.int().positive()}),z58.strictObject({semanticStatus:z58.literal("NEEDS_INPUT"),missingPrerequisites:z58.array(z58.literal("ACTIVE_STORY")).min(1)})]);import{z as z59}from"zod";var Fingerprint4=z59.string().regex(/^[0-9a-f]{64}$/);var VideoReviewScopeSchema=z59.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:z59.uuid()});var VideoReviewRequirementSchema=z59.strictObject({intentPath:z59.string().min(1).max(220).optional(),continuity:ContinuityExpectationSchema.optional(),interval:z59.strictObject({startMs:z59.int().nonnegative().max(6e4),endMs:z59.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Requirement interval must advance").optional(),key:z59.string().min(1).max(220),family:z59.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","SHOT_INTENT","BOUNDARY_CONTINUITY","SOUND"]),expected:z59.string().min(1).max(2500),enforcement:z59.enum(["LOCKED","REQUIRED","PREFERRED"]),evidenceWindow:z59.enum(["WHOLE_VIDEO","START","END","TEMPORAL"])});var VideoObservationSchema=z59.strictObject({listeningEvidenceIds:ListeningEvidenceIdsSchema.optional(),continuitySamples:ContinuitySamplesSchema.optional(),temporalEvidenceIds:TemporalEvidenceIdsSchema.optional(),key:z59.string().min(1).max(220),status:z59.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z59.enum(["CLEAR","UNCERTAIN"]),observed:z59.string().trim().min(1).max(1800),interval:z59.strictObject({startMs:z59.int().nonnegative(),endMs:z59.int().positive()}).refine(v=>v.endMs>v.startMs,"Observation interval must advance").optional()});var RecordVideoReviewSchema=VideoReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),candidateId:z59.uuid(),representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint4,expectedReviewVersion:z59.int().nonnegative(),idempotencyKey:z59.string().trim().min(1).max(200),observations:z59.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z59.string().trim().min(1).max(2500)});var VideoReviewRecordSchema=z59.strictObject({listeningEvidence:ListeningEvidenceSetSchema.optional(),id:z59.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,generationId:z59.uuid(),candidateId:z59.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint4,shotId:ShotIdSchema,version:z59.int().positive(),preparationId:z59.uuid(),contractId:z59.uuid(),contractFingerprint:Fingerprint4,executionClass:z59.enum(["LIVE","TEST_ONLY"]),kind:z59.literal("SHOT_REVIEW_1"),lifecycle:z59.literal("COMPLETED"),evaluatorVersion:z59.literal("shot-review-v1"),source:z59.literal("EXPLICIT_MEDIA_INSPECTION"),technical:VideoTechnicalMetadataSchema,requirements:z59.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z59.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z59.enum(["PASS","WARNING","FAIL"]),blockingKeys:z59.array(z59.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z59.array(z59.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z59.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z59.iso.datetime({offset:true})});var DecideVideoShotSchema=VideoReviewScopeSchema.extend({candidateId:z59.uuid(),reviewId:z59.uuid(),expectedAcceptanceVersion:z59.int().nonnegative(),action:z59.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z59.boolean().default(false),reason:z59.string().trim().min(1).max(2500),idempotencyKey:z59.string().trim().min(1).max(200)});var ShotAcceptanceScopeSchema=z59.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema});var RevokeShotAcceptanceSchema=ShotAcceptanceScopeSchema.extend({acceptanceId:z59.uuid(),expectedAcceptanceVersion:z59.int().positive(),reason:z59.string().trim().min(1).max(2500),idempotencyKey:z59.string().trim().min(1).max(200)});var GeneratedShotAcceptanceDecisionSchema=z59.strictObject({id:z59.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z59.int().positive(),generationId:z59.uuid(),candidateId:z59.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z59.uuid(),action:z59.enum(["ACCEPT","REJECT","REVOKE"]),reference:AcceptedShotReferenceSchema.nullable(),previousAcceptanceId:z59.uuid().nullable(),warningKeys:z59.array(z59.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z59.boolean(),reason:z59.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z59.iso.datetime({offset:true})});var ProgrammaticShotAcceptanceDecisionSchema=z59.strictObject({sourceKind:z59.literal("PROGRAMMATIC"),id:z59.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z59.int().positive(),renderId:z59.uuid(),compositionId:z59.uuid(),compositionVersionId:z59.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z59.uuid(),action:z59.enum(["ACCEPT","REJECT","REVOKE"]),reference:ProgrammaticAcceptedVisualSourceReferenceSchema.nullable(),previousAcceptanceId:z59.uuid().nullable(),warningKeys:z59.array(z59.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z59.boolean(),reason:z59.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z59.iso.datetime({offset:true})});var ShotAcceptanceDecisionSchema=z59.union([GeneratedShotAcceptanceDecisionSchema,ProgrammaticShotAcceptanceDecisionSchema,z59.strictObject({sourceKind:z59.literal("IMPORTED"),id:z59.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z59.int().positive(),normalizationId:z59.uuid(),sourceId:z59.uuid(),sourceVersionId:z59.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z59.uuid(),action:z59.enum(["ACCEPT","REJECT","REVOKE"]),reference:ImportedAcceptedVisualSourceReferenceSchema.nullable(),previousAcceptanceId:z59.uuid().nullable(),warningKeys:z59.array(z59.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z59.boolean(),reason:z59.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z59.iso.datetime({offset:true})})]);var VideoReviewTargetSchema=VideoReviewScopeSchema.extend({temporalEvidence:z59.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,shotId:ShotIdSchema,preparationId:z59.uuid(),contractId:z59.uuid(),contractFingerprint:Fingerprint4,executionClass:z59.enum(["LIVE","TEST_ONLY"]),freshness:z59.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z59.boolean(),productionRunnable:z59.boolean(),candidate:VideoCandidateSchema,requirements:z59.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:VideoReviewRecordSchema.nullable(),reviewVersion:z59.int().nonnegative(),acceptanceVersion:z59.int().nonnegative(),activeAcceptanceId:z59.uuid().nullable()});var ShotAcceptanceViewSchema=ShotAcceptanceScopeSchema.extend({acceptanceVersion:z59.int().nonnegative(),status:z59.enum(["NONE","CURRENT","STALE"]),acceptance:ShotAcceptanceDecisionSchema.nullable(),reference:AcceptedVisualSourceReferenceSchema.nullable()});var VideoReviewQuerySchema=VideoReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VideoReviewPageSchema=z59.strictObject({items:z59.array(VideoReviewRecordSchema),page:QueryPageInfoSchema});var ShotDecisionQuerySchema=ShotAcceptanceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ShotDecisionPageSchema=z59.strictObject({items:z59.array(ShotAcceptanceDecisionSchema),page:QueryPageInfoSchema});var VideoReviewReceiptSchema=z59.strictObject({semanticStatus:z59.literal("SUCCESS"),review:VideoReviewRecordSchema,productionRevision:z59.int().positive()});var ShotDecisionReceiptSchema=z59.strictObject({semanticStatus:z59.literal("SUCCESS"),decision:ShotAcceptanceDecisionSchema,productionRevision:z59.int().positive()});import{z as z60}from"zod";var Fingerprint5=z60.string().regex(/^[0-9a-f]{64}$/);var ProgrammaticVideoReviewScopeSchema=z60.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,renderId:z60.uuid()});var ProgrammaticReviewMediaSchema=VideoTechnicalMetadataSchema.extend({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,availability:z60.enum(["AVAILABLE","INVALID"])});var ProgrammaticVideoReviewRecordSchema=z60.strictObject({sourceKind:z60.literal("PROGRAMMATIC"),id:z60.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,renderId:z60.uuid(),compositionId:z60.uuid(),compositionVersionId:z60.uuid(),compositionVersion:z60.int().positive(),compositionFingerprint:Fingerprint5,renderManifestFingerprint:Fingerprint5,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint5,version:z60.int().positive(),planVersionId:z60.uuid(),planVersion:z60.int().positive(),shotPlanningRevision:z60.int().positive(),executionClass:z60.enum(["LIVE","TEST_ONLY"]),kind:z60.literal("SHOT_REVIEW_1"),lifecycle:z60.literal("COMPLETED"),evaluatorVersion:z60.literal("shot-review-v1"),source:z60.literal("EXPLICIT_MEDIA_INSPECTION"),technical:VideoTechnicalMetadataSchema,requirements:z60.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z60.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z60.enum(["PASS","WARNING","FAIL"]),blockingKeys:z60.array(z60.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z60.array(z60.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z60.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z60.iso.datetime({offset:true})});var ProgrammaticVideoReviewTargetSchema=ProgrammaticVideoReviewScopeSchema.extend({sourceKind:z60.literal("PROGRAMMATIC"),temporalEvidence:z60.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,shotId:ShotIdSchema,compositionId:z60.uuid(),compositionVersionId:z60.uuid(),compositionVersion:z60.int().positive(),compositionFingerprint:Fingerprint5,renderManifestFingerprint:Fingerprint5,executionClass:z60.enum(["LIVE","TEST_ONLY"]),freshness:z60.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z60.boolean(),productionRunnable:z60.boolean(),media:ProgrammaticReviewMediaSchema,requirements:z60.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:ProgrammaticVideoReviewRecordSchema.nullable(),reviewVersion:z60.int().nonnegative(),acceptanceVersion:z60.int().nonnegative(),activeAcceptanceId:z60.uuid().nullable()});var RecordProgrammaticVideoReviewSchema=ProgrammaticVideoReviewScopeSchema.extend({representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint5,expectedReviewVersion:z60.int().nonnegative(),idempotencyKey:z60.string().trim().min(1).max(200),observations:z60.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z60.string().trim().min(1).max(2500)});var DecideProgrammaticShotSchema=ProgrammaticVideoReviewScopeSchema.extend({reviewId:z60.uuid(),expectedAcceptanceVersion:z60.int().nonnegative(),action:z60.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z60.boolean().default(false),reason:z60.string().trim().min(1).max(2500),idempotencyKey:z60.string().trim().min(1).max(200)});var ProgrammaticVideoReviewQuerySchema=ProgrammaticVideoReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ProgrammaticVideoReviewPageSchema=z60.strictObject({items:z60.array(ProgrammaticVideoReviewRecordSchema),page:QueryPageInfoSchema});var ProgrammaticVideoReviewReceiptSchema=z60.strictObject({semanticStatus:z60.literal("SUCCESS"),review:ProgrammaticVideoReviewRecordSchema,productionRevision:z60.int().positive()});import{z as z61}from"zod";var WriterScopeSchema=z61.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema});var WriterBasisSchema=WriterScopeSchema.extend({productionRevision:z61.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z61.int().positive()});var IntentSchema=z61.string().trim().min(1).max(600);var WriterAlternativeSchema=z61.strictObject({alternativeId:z61.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z61.string().trim().min(1).max(120),story:StoryContentSchema,rationale:z61.strictObject({coreMessage:IntentSchema,hook:IntentSchema,audienceFit:IntentSchema,pacingIntent:IntentSchema,endingIntent:IntentSchema,tradeoffs:z61.array(IntentSchema).max(6)}),beatDurationsSeconds:z61.array(z61.int().positive().max(60)).min(1).max(24)});var WriterProposalSchema=z61.strictObject({origin:z61.strictObject({kind:z61.literal("EXTERNAL_AGENT_HOST"),label:z61.string().trim().min(1).max(100)}),unknowns:z61.array(z61.string().trim().min(1).max(300)).max(8),alternatives:z61.array(WriterAlternativeSchema).min(1).max(3)});var ValidateWriterProposalSchema=z61.strictObject({basis:WriterBasisSchema,revisionReason:AcceptStoryRequestSchema.shape.revisionReason,proposal:WriterProposalSchema});var MissingBriefSchema=z61.strictObject({semanticStatus:z61.literal("NEEDS_INPUT"),missingPrerequisites:z61.array(z61.literal("ACTIVE_BRIEF")).min(1).max(1)});var WriterBriefResultSchema=z61.discriminatedUnion("semanticStatus",[z61.strictObject({semanticStatus:z61.literal("SUCCESS"),basis:WriterBasisSchema,briefVersion:BriefVersionSchema}),MissingBriefSchema]);var WriterAcceptanceDraftSchema=z61.strictObject({alternativeId:WriterAlternativeSchema.shape.alternativeId,projectId:ProjectIdSchema,productionId:ProductionIdSchema,request:AcceptStoryRequestSchema.omit({idempotencyKey:true})});var WriterValidationResultSchema=z61.discriminatedUnion("semanticStatus",[z61.strictObject({semanticStatus:z61.literal("SUCCESS"),advisory:z61.literal(true),basis:WriterBasisSchema,proposal:WriterProposalSchema,acceptanceDrafts:z61.array(WriterAcceptanceDraftSchema).min(1).max(3),limitations:z61.array(z61.enum(["PROSE_IS_CREATIVE_INTENT_NOT_FACT_VERIFIED","PACING_IS_ADVISORY_NOT_TIMELINE_TRUTH","ACCEPTANCE_RECHECKS_CURRENT_BASIS"])).length(3)}),MissingBriefSchema]);import{z as z62}from"zod";var DirectorScopeSchema=WriterScopeSchema;var DirectorBasisSchema=WriterBasisSchema.extend({storyVersionId:StoryVersionIdSchema,storyVersion:z62.int().positive(),sceneShotPlanVersionId:SceneShotPlanVersionIdSchema.nullable(),sceneShotPlanVersion:z62.int().positive().nullable()}).refine(value2=>value2.sceneShotPlanVersionId===null===(value2.sceneShotPlanVersion===null),"Current plan ID and version must both be present or null");var Intent2=z62.string().trim().min(1).max(600);var Plan=AcceptSceneShotPlanRequestSchema.pick({scenes:true,continuityEdges:true});var DirectorAlternativeSchema=z62.strictObject({alternativeId:z62.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z62.string().trim().min(1).max(120),plan:Plan,rationale:z62.strictObject({storyInterpretation:Intent2,visualApproach:Intent2,pacingIntent:Intent2,tradeoffs:z62.array(Intent2).max(6)}),shotStoryBeats:z62.array(z62.strictObject({shotKey:PlanningClientKeySchema,beatOrdinals:z62.array(z62.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=z62.strictObject({origin:z62.strictObject({kind:z62.literal("EXTERNAL_AGENT_HOST"),label:z62.string().trim().min(1).max(100)}),unknowns:z62.array(z62.string().trim().min(1).max(300)).max(8),alternatives:z62.array(DirectorAlternativeSchema).min(1).max(3)});var ValidateDirectorProposalSchema=z62.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=z62.strictObject({semanticStatus:z62.literal("NEEDS_INPUT"),missingPrerequisites:z62.array(z62.enum(["ACTIVE_BRIEF","ACTIVE_STORY"])).min(1).max(2)});var DirectorContextResultSchema=z62.discriminatedUnion("semanticStatus",[z62.strictObject({semanticStatus:z62.literal("SUCCESS"),basis:DirectorBasisSchema,briefVersion:BriefVersionSchema,storyVersion:StoryVersionSchema,sceneShotPlanVersion:SceneShotPlanVersionSchema.nullable(),stalePrerequisites:z62.array(z62.enum(["CURRENT_STORY","CURRENT_SCENE_SHOT_PLAN"])).min(1).max(2).optional()}),Missing]);var DirectorAcceptanceDraftSchema=z62.strictObject({alternativeId:DirectorAlternativeSchema.shape.alternativeId,projectId:DirectorScopeSchema.shape.projectId,productionId:DirectorScopeSchema.shape.productionId,request:AcceptSceneShotPlanRequestSchema.omit({idempotencyKey:true})});var DirectorValidationResultSchema=z62.discriminatedUnion("semanticStatus",[z62.strictObject({semanticStatus:z62.literal("SUCCESS"),advisory:z62.literal(true),basis:DirectorBasisSchema,proposal:DirectorProposalSchema,acceptanceDrafts:z62.array(DirectorAcceptanceDraftSchema).min(1).max(3),limitations:z62.array(z62.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 z63}from"zod";var ReviewEvidenceKeySchema=z63.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var ReviewEvidenceMediaSchema=z63.strictObject({artifactId:z63.uuid(),representationId:z63.uuid(),checksumSha256:z63.string().regex(/^[0-9a-f]{64}$/)});var common={id:ReviewEvidenceKeySchema,label:z63.string().trim().min(1).max(200),producer:z63.enum(["EXTERNAL_AGENT_HOST","HUMAN","VLM"]),media:ReviewEvidenceMediaSchema};var ReviewIntelligenceEvidenceSchema=z63.discriminatedUnion("kind",[z63.strictObject({...common,kind:z63.literal("METADATA")}),z63.strictObject({...common,kind:z63.literal("IMAGE_PIXELS")}),z63.strictObject({...common,kind:z63.literal("REGISTERED_TEMPORAL_FRAMES"),reference:TemporalEvidenceReferenceSchema}),z63.strictObject({...common,kind:z63.literal("VIDEO_PLAYBACK"),coverage:z63.array(ReviewIntervalSchema).min(1).max(200)}),z63.strictObject({...common,kind:z63.literal("AUDIO_LISTENING"),coverage:z63.array(ReviewIntervalSchema).min(1).max(200)}),z63.strictObject({...common,kind:z63.literal("VIDEO_WITH_AUDIO_PLAYBACK"),coverage:z63.array(ReviewIntervalSchema).min(1).max(200)}),z63.strictObject({...common,kind:z63.literal("VIDEO_FRAMES"),timestampsMs:z63.array(z63.number().nonnegative().max(6e4)).min(1).max(64)})]);import{z as z64}from"zod";var ObservationScopeSchema=z64.strictObject({tenantId:z64.uuid(),productionId:z64.uuid()});var ObservationSourceRequestSchema=z64.discriminatedUnion("kind",[z64.strictObject({kind:z64.literal("AUDIO"),media:ReviewEvidenceMediaSchema,versionId:z64.uuid(),purpose:z64.enum(["VOICEOVER","MUSIC"])}),z64.strictObject({kind:z64.literal("VIDEO"),media:ReviewEvidenceMediaSchema})]);var ObservationStartSchema=ObservationScopeSchema.extend({expectedProductionRevision:z64.int().positive(),idempotencyKey:z64.string().min(1).max(200),source:ObservationSourceRequestSchema,mode:ObservationModeSchema,selection:ProviderSelectionSchema,expectedModelProfileVersion:z64.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:z64.uuid()});var ObservationBindingSchema=z64.strictObject({tenantId:z64.uuid(),connectionId:z64.uuid(),connectionVersion:z64.int().positive(),credentialRef:z64.string(),credentialVersion:z64.int().positive(),profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),executionClass:z64.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:z64.uuid(),projectId:z64.uuid(),productionId:z64.uuid(),byteSize:z64.int().positive().max(12582912),durationMs:z64.number().positive().max(6e4),frameRate:z64.number().positive().max(60).optional(),executionClass:z64.enum(["LIVE","TEST_ONLY"])});var json=z64.record(z64.string(),z64.unknown());var ObservationResultSchema=z64.strictObject({schemaVersion:z64.int().positive(),advisory:z64.literal(true),producer:z64.enum(["VLM","ASR"]).optional(),source:ObservationSourceSchema,input:json,provider:json,observedAt:z64.iso.datetime(),report:json,transcript:TranscriptSchema.optional(),evidence:ReviewIntelligenceEvidenceSchema.optional(),limitations:z64.array(z64.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=z64.strictObject({semanticStatus:z64.literal("ACCEPTED"),observationId:z64.uuid(),runtimeJobId:z64.uuid(),productionRevision:z64.int().positive(),executionClass:z64.enum(["LIVE","TEST_ONLY"])});var ObservationViewSchema=ObservationScopeSchema.extend({observationId:z64.uuid(),runtimeJobId:z64.uuid(),request:ObservationStartSchema,profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),parameters:ObservationParametersSchema,executionClass:z64.enum(["LIVE","TEST_ONLY"]),runtimeStatus:z64.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z64.enum(["NOT_SUBMITTED","SUBMITTING","UNKNOWN","SUCCEEDED","REJECTED"]),cancellationRequested:z64.boolean(),failure:z64.strictObject({classification:z64.string().min(1).max(100),summary:z64.string().min(1).max(1e3)}).nullable(),result:ObservationResultSchema.nullable(),createdAt:z64.iso.datetime()});var ObservationOptionsSchema=ObservationScopeSchema.extend({options:z64.array(z64.strictObject({selection:ProviderSelectionSchema,profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),connectionLabel:z64.string(),connectionVersion:z64.int().positive()})).max(100),possiblyTruncated:z64.boolean()});var ProductionGuidanceSchema=z64.strictObject({version:z64.enum(["NVS_PRODUCTION_GUIDANCE_V1","NVS_PRODUCTION_GUIDANCE_V2"]),instructions:z64.string().min(1).max(16e3)});var ProductionGuidanceContextSchema=ObservationScopeSchema.extend({projectId:z64.uuid(),revision:z64.int().positive(),guidance:ProductionGuidanceSchema});import{z as z65}from"zod";var sha12=z65.string().regex(/^[0-9a-f]{64}$/);var evidenceIds=z65.array(ReviewEvidenceKeySchema).max(16);var ReviewIntelligenceTargetSchema=z65.discriminatedUnion("kind",[z65.strictObject({kind:z65.literal("IMAGE"),generationId:z65.uuid()}),z65.strictObject({kind:z65.literal("VIDEO"),generationId:z65.uuid()}),z65.strictObject({kind:z65.literal("ROUGH_CUT"),renderId:z65.uuid()}),z65.strictObject({kind:z65.literal("PROGRAMMATIC"),renderId:z65.uuid()})]);var ReviewIntelligenceContextInputSchema=z65.strictObject({scope:DirectorScopeSchema,target:ReviewIntelligenceTargetSchema});var ReviewIntelligenceBasisSchema=ReviewIntelligenceContextInputSchema.extend({contextFingerprint:sha12});var ReviewIntelligenceOwnerTargetSchema=z65.discriminatedUnion("kind",[z65.strictObject({kind:z65.literal("IMAGE"),target:KeyframeReviewTargetSchema}),z65.strictObject({kind:z65.literal("VIDEO"),target:VideoReviewTargetSchema}),z65.strictObject({kind:z65.literal("ROUGH_CUT"),target:RoughCutReviewTargetSchema}),z65.strictObject({kind:z65.literal("PROGRAMMATIC"),target:ProgrammaticVideoReviewTargetSchema})]);var review=z65.discriminatedUnion("kind",[z65.strictObject({kind:z65.literal("IMAGE"),observations:z65.array(KeyframeObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z65.strictObject({kind:z65.literal("VIDEO"),observations:z65.array(VideoObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z65.strictObject({kind:z65.literal("PROGRAMMATIC"),observations:z65.array(VideoObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z65.strictObject({kind:z65.literal("ROUGH_CUT"),observations:z65.array(RoughCutObservationSchema.extend({evidenceIds})).min(1).max(300),inspection:RoughCutInspectionSchema})]);var ValidateReviewIntelligenceSchema=z65.strictObject({basis:ReviewIntelligenceBasisSchema,proposal:z65.strictObject({origin:z65.strictObject({kind:z65.literal("EXTERNAL_AGENT_HOST"),label:z65.string().trim().min(1).max(100)}),summary:z65.string().trim().min(1).max(2e3),evidence:z65.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=z65.strictObject({semanticStatus:z65.literal("SUCCESS"),advisory:z65.literal(true),basis:ReviewIntelligenceBasisSchema,productionGuidance:ProductionGuidanceSchema.optional(),ownerContext:DirectorContextResultSchema,reviewTarget:ReviewIntelligenceOwnerTargetSchema,limitations:z65.array(z65.enum(["NO_IMPLICIT_MEDIA_OR_MODEL_CALL","READS_ARE_NOT_ATOMIC_OR_RESERVED"])).length(2)});var ReviewIntelligenceRecordDraftSchema=z65.discriminatedUnion("kind",[z65.strictObject({kind:z65.literal("PROGRAMMATIC"),input:RecordProgrammaticVideoReviewSchema.omit({idempotencyKey:true})}),z65.strictObject({kind:z65.literal("IMAGE"),input:RecordKeyframeReviewSchema.omit({idempotencyKey:true})}),z65.strictObject({kind:z65.literal("VIDEO"),input:RecordVideoReviewSchema.omit({idempotencyKey:true})}),z65.strictObject({kind:z65.literal("ROUGH_CUT"),input:RecordRoughCutReviewSchema.omit({idempotencyKey:true})})]);var ReviewIntelligenceIssueSchema=z65.strictObject({requirement:z65.union([VisualRequirementSchema,VideoReviewRequirementSchema,RoughCutRequirementSchema]),observation:z65.union([KeyframeObservationSchema,VideoObservationSchema,RoughCutObservationSchema]),evidenceIds,blocking:z65.boolean(),severity:z65.enum(["BLOCKING","WARNING"]),affectedScope:z65.strictObject({kind:z65.enum(["PRODUCTION","SHOT","TRANSITION","TIMELINE_REGION"]),interval:ReviewIntervalSchema,shotIds:z65.array(z65.uuid()).min(1).max(200)}).optional()});var ReviewIntelligenceValidationResultSchema=z65.strictObject({semanticStatus:z65.literal("SUCCESS"),advisory:z65.literal(true),basis:ReviewIntelligenceBasisSchema,proposal:ValidateReviewIntelligenceSchema.shape.proposal,canonicalRulePreview:z65.strictObject({source:z65.literal("EXISTING_CANONICAL_DOMAIN_RULES"),authoritative:z65.literal(false),evaluatorVersion:z65.enum(["keyframe-reference-v1","shot-review-v1","production-review-v1"]),result:z65.enum(["PASS","WARNING","FAIL"]),blockingKeys:z65.array(z65.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z65.array(z65.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),issueProposals:z65.array(ReviewIntelligenceIssueSchema).max(MAX_SHOT_REVIEW_REQUIREMENTS),recordDraft:ReviewIntelligenceRecordDraftSchema,limitations:z65.array(z65.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)});export{ClipTransitionSchema,TimelineGraphicInputSchema,AudioScopeSchema,AudioImportRequestSchema,AudioGetSchema,AudioQuerySchema,AudioViewSchema,AudioReceiptSchema,AudioBasisSchema,AudioPageSchema,AudioSnapshotSchema,TimelineAudioInputSchema,SourceSyncAudioStartSchema,SourceSyncAudioGetSchema,SourceSyncAudioVersionSchema,SourceSyncAudioReceiptSchema,SourceSyncAudioViewSchema,ProviderSelectionSchema,ConfigureProviderInputSchema,ProviderConnectionViewSchema,ProviderConnectionCommandSchema,ProviderCredentialRevokeSchema,SetKeyframeDefaultSchema,SpeechScopeSchema,SpeechStartSchema,SpeechGetSchema,SpeechAdmissionSchema,SpeechGenerationViewSchema,SpeechOptionsSchema,PreparationIdSchema,GenerationContractIdSchema,ContentFingerprintSchema,PreparationTargetSchema,PreparationBasisSchema,ReferenceRoleSchema,ReferenceBindingInputSchema,ExactEvidenceReferenceSchema,PreparationBlockerSchema,ConstraintSetSchema,ReferenceSetSchema,GenerationCostQuoteSchema,KeyframeProviderProfileSchema,KeyframeStartInputSchema,KeyframeGetInputSchema,KeyframeQueryInputSchema,KeyframeAdmissionSchema,KeyframeGenerationViewSchema,KeyframeQueryPageSchema,KeyframeMediaSchema,KeyframeSummarySchema,VideoProviderProfileSchema,VideoStartInputSchema,VideoGetInputSchema,VideoQueryInputSchema,VideoAdmissionSchema,VideoTechnicalMetadataSchema,VideoGenerationViewSchema,VideoQueryPageSchema,VideoSummarySchema,ProviderTenantInputSchema,ProviderDefaultViewSchema,ProviderConnectionPageSchema,ProviderModelsViewSchema,ProviderModelViewSchema,ConfigureProviderModelSchema,DisableProviderModelSchema,ProviderModelPageSchema,ProviderModelGetSchema,SoundPlanScopeSchema,SoundPlanValidateSchema,SoundPlanAcceptSchema,SoundPlanGetSchema,SoundPlanValidationSchema,SoundPlanViewSchema,SoundPlanReceiptSchema,SoundPlanContextSchema,AcceptedVisualSourceReferenceSchema,CaptionTranscriptPlanSchema,AuthorTranscriptCaptionsSchema,CaptionContentSchema,CaptionScopeSchema,AuthorCaptionsSchema,CaptionGetSchema,CaptionQuerySchema,CaptionViewSchema,CaptionReceiptSchema,CaptionBasisSchema,CaptionPageSchema,CaptionExportSchema,CaptionSnapshotSchema,CaptionTranscriptDraftSchema,CaptionRenderStyleSchema,VisualFrameSequenceSchema,VisualLayerCompositionSchema,TimelineVisualLayerInputSchema,TimelineManifestReaderSchema,TimelineScopeSchema,BuildTimelineShapeSchema,BuildTimelineSchema,TimelineViewSchema,TimelineGetSchema,TimelineQuerySchema,TimelinePageSchema,TimelineBuildReceiptSchema,TimelineBasisSchema,TimelineSnapshotSchema,DeliveryPolicySchema,DeliveryPolicyInputSchema,DeliveryTargetSchema,DeliveryCheckKeySchema,DeliveryValidationReviewSchema,DeliveryApprovalSchema,DeliveryManifestLinkSchema,FinalDeliveryReceiptSchema,RoughCutProfileIdSchema,DeviceRenderTargetSchema,DeviceRenderReceiptSchema,DecideFinalReadySchema,RevokeFinalReadySchema,FinalReadyViewSchema,FinalReadyQuerySchema,FinalReadyPageSchema,FinalReadyReceiptSchema,RoughCutReviewSnapshotSchema,RoughCutStartSchema,RoughCutGetSchema,RoughCutQuerySchema,RoughCutManifestReaderSchema,RoughCutTechnicalSchema,RoughCutAdmissionSchema,RoughCutViewSchema,RoughCutPageSchema,RoughCutSnapshotSchema,FinalRenderStartSchema,FinalRenderGetSchema,FinalRenderQuerySchema,FinalRenderManifestReaderSchema,FinalRenderTechnicalSchema,FinalRenderAdmissionSchema,FinalRenderViewSchema,FinalRenderPageSchema,FinalRenderEligibilitySchema,FinalRenderSnapshotSchema,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,MAX_SHOT_REVIEW_REQUIREMENTS,KeyframeReviewScopeSchema,VisualRequirementSchema,KeyframeObservationSchema,RecordKeyframeReviewSchema,DecideKeyframeSchema,KeyframeReferenceScopeSchema,RevokeKeyframeSchema,KeyframeReviewTargetSchema,KeyframeReferenceViewSchema,KeyframeReviewQuerySchema,KeyframeReviewPageSchema,KeyframeReviewReceiptSchema,KeyframeDecisionReceiptSchema,KeyframeDecisionQuerySchema,KeyframeDecisionPageSchema,KeyframeReviewSummarySchema,BoundaryRequirementSchema,ShotIntentSchema,AcceptSceneShotPlanRequestSchema,ShotPlanEntrySchema,SceneShotPlanVersionSchema,AcceptSceneShotPlanResultSchema,AgentHostScopeSchema,AgentHostSelectionSchema,ConfigureAgentHostSchema,RevokeAgentHostSchema,AgentHostBindingSchema,UpdateAgentHostSelectionSchema,AgentHostCurrentSchema,AgentHostHistoryQuerySchema,AgentHostHistoryPageSchema,AgentHostReadinessSchema,NativeRuntimePublicKeySchema,ConfigureNativeToolGrantSchema,NativeToolGrantGetSchema,RevokeNativeToolGrantSchema,NativeRuntimeProofRequestSchema,NativeToolGrantViewSchema,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,WriterScopeSchema,ValidateWriterProposalSchema,WriterBriefResultSchema,WriterValidationResultSchema,DirectorScopeSchema,DirectorBasisSchema,ValidateDirectorProposalSchema,DirectorContextResultSchema,DirectorValidationResultSchema,ReviewEvidenceKeySchema,ReviewEvidenceMediaSchema,ObservationScopeSchema,ObservationStartSchema,ObservationGetSchema,ObservationAdmissionSchema,ObservationViewSchema,ObservationOptionsSchema,ProductionGuidanceContextSchema,ReviewIntelligenceContextInputSchema,ReviewIntelligenceBasisSchema,ValidateReviewIntelligenceSchema,ReviewIntelligenceContextResultSchema,ReviewIntelligenceValidationResultSchema};